mesurer-solid 0.1.8-beta.2 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/inject.js CHANGED
@@ -11143,7 +11143,19 @@ function lp(e, t) {
11143
11143
  u = !0, p.disconnect(), l && r.clearTimeout(l), r.removeEventListener("scroll", h, !0), o.clear(), a.remove();
11144
11144
  });
11145
11145
  }
11146
- var up = "mesurer.text-edit.intents", dp = "text-edit", fp = "text-edit.commit", pp = "text-edit.clear", mp = 600, hp = 360, gp = 24, _p = 80, vp = "#0d99ff", yp = "#0f172a", bp = "#8a8a8a", xp = 288, Sp = "0 0 0.5px rgba(0, 0, 0, 0.18), 0 3px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1)", Cp = /* @__PURE__ */ new Set([
11146
+ var up = /* @__PURE__ */ new WeakMap(), dp = (e) => {
11147
+ let t = up.get(e.pageTarget);
11148
+ t && (e.ownerWindow.clearTimeout(t.clearTimer), up.delete(e.pageTarget));
11149
+ }, fp = (e, t) => {
11150
+ dp(e);
11151
+ let n = e.pageTarget, r = {
11152
+ target: t,
11153
+ clearTimer: 0
11154
+ };
11155
+ up.set(n, r), r.clearTimer = e.ownerWindow.setTimeout(() => {
11156
+ up.get(n) === r && up.delete(n);
11157
+ }, 0);
11158
+ }, pp = (e) => up.get(e.pageTarget)?.target ?? null, mp = "mesurer.text-edit.intents", hp = "text-edit", gp = "text-edit.commit", _p = "text-edit.clear", vp = 600, yp = 360, bp = 24, xp = 80, Sp = "#0d99ff", Cp = "#0f172a", wp = "#8a8a8a", Tp = 288, Ep = "0 0 0.5px rgba(0, 0, 0, 0.18), 0 3px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1)", Dp = /* @__PURE__ */ new Set([
11147
11159
  "HTML",
11148
11160
  "BODY",
11149
11161
  "SCRIPT",
@@ -11159,7 +11171,7 @@ var up = "mesurer.text-edit.intents", dp = "text-edit", fp = "text-edit.commit",
11159
11171
  "TEXTAREA",
11160
11172
  "SELECT",
11161
11173
  "OPTION"
11162
- ]), wp = [
11174
+ ]), Op = [
11163
11175
  "font-family",
11164
11176
  "font-size",
11165
11177
  "font-weight",
@@ -11168,10 +11180,10 @@ var up = "mesurer.text-edit.intents", dp = "text-edit", fp = "text-edit.commit",
11168
11180
  "letter-spacing",
11169
11181
  "text-transform",
11170
11182
  "color"
11171
- ], Tp = (e) => {
11183
+ ], kp = (e) => {
11172
11184
  let { origin: t, pathname: n, search: r } = e.location;
11173
11185
  return `${t}${n}${r}`;
11174
- }, Ep = (e, t) => `${t}-${e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`}`, Dp = (e) => ({
11186
+ }, Ap = (e, t) => `${t}-${e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`}`, jp = (e) => ({
11175
11187
  tag: e.fingerprintTag,
11176
11188
  id: e.fingerprintId,
11177
11189
  testId: e.fingerprintTestId,
@@ -11179,11 +11191,11 @@ var up = "mesurer.text-edit.intents", dp = "text-edit", fp = "text-edit.commit",
11179
11191
  ariaLabel: e.fingerprintAriaLabel,
11180
11192
  classes: e.fingerprintClasses,
11181
11193
  text: e.fingerprintText
11182
- }), Op = (e) => ({
11194
+ }), Mp = (e) => ({
11183
11195
  property: e.property,
11184
11196
  before: e.before,
11185
11197
  desired: e.desired
11186
- }), kp = (e) => ({
11198
+ }), Np = (e) => ({
11187
11199
  id: e.id,
11188
11200
  createdAt: e.createdAt,
11189
11201
  pageUrl: e.pageUrl,
@@ -11191,29 +11203,29 @@ var up = "mesurer.text-edit.intents", dp = "text-edit", fp = "text-edit.commit",
11191
11203
  nodeIndex: e.nodeIndex,
11192
11204
  before: e.beforeText,
11193
11205
  desired: e.desiredText,
11194
- styles: e.styleChanges.map(Op)
11195
- }), Ap = (e) => {
11206
+ styles: e.styleChanges.map(Mp)
11207
+ }), Pp = (e) => {
11196
11208
  let t = e.match(/^\s*/)?.[0] ?? "", n = e.slice(t.length), r = n.match(/\s*$/)?.[0] ?? "";
11197
11209
  return {
11198
11210
  leading: t,
11199
11211
  trailing: r,
11200
11212
  value: n.slice(0, Math.max(0, n.length - r.length))
11201
11213
  };
11202
- }, jp = (e) => e.map((e) => ({ ...e })), Mp = (e) => (e.split(",")[0] ?? e).trim().replace(/^['"]|['"]$/g, ""), Np = (e) => {
11214
+ }, Fp = (e) => e.map((e) => ({ ...e })), Ip = (e) => (e.split(",")[0] ?? e).trim().replace(/^['"]|['"]$/g, ""), Lp = (e) => {
11203
11215
  if (e === "bold") return 700;
11204
11216
  if (e === "normal") return 400;
11205
11217
  let t = Number(e);
11206
11218
  return Number.isFinite(t) ? t : 400;
11207
- }, Pp = (e) => e === "transparent" || /^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(e) || /^rgba\(0\s+0\s+0\s*\/\s*0(?:\.0+)?\)$/.test(e), Fp = (e) => {
11219
+ }, Rp = (e) => e === "transparent" || /^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(e) || /^rgba\(0\s+0\s+0\s*\/\s*0(?:\.0+)?\)$/.test(e), zp = (e) => {
11208
11220
  let t = /^rgba?\(\s*(\d+(?:\.\d+)?)\D+(\d+(?:\.\d+)?)\D+(\d+(?:\.\d+)?)/.exec(e);
11209
11221
  if (!t) return "#000000";
11210
11222
  let n = (e) => Math.max(0, Math.min(255, Math.round(Number(e)))).toString(16).padStart(2, "0");
11211
11223
  return `#${n(t[1])}${n(t[2])}${n(t[3])}`;
11212
- }, Ip = (e, t) => [...e.entries()].sort((e, t) => t[1] - e[1] || e[0].localeCompare(t[0])).slice(0, t).map(([e]) => e), Lp = (e, t) => t ? [t, ...e.filter((e) => e !== t)] : e;
11213
- function Rp(e, t) {
11224
+ }, Bp = (e, t) => [...e.entries()].sort((e, t) => t[1] - e[1] || e[0].localeCompare(t[0])).slice(0, t).map(([e]) => e), Vp = (e, t) => t ? [t, ...e.filter((e) => e !== t)] : e;
11225
+ function Hp(e, t) {
11214
11226
  let { ownerDocument: n, ownerWindow: r, pageTarget: i } = t, a = r, o = t.createWorkspaceRuntime(), s = new td(n, r), c = t.createInspectorMount();
11215
11227
  c.element.dataset.mesurerTextEditRuntime = "true", c.element.style.position = "fixed", c.element.style.inset = "0", c.element.style.zIndex = "2147483646", c.element.style.pointerEvents = "none", e.state.register({
11216
- id: up,
11228
+ id: mp,
11217
11229
  initial: { edits: [] },
11218
11230
  history: !0,
11219
11231
  persist: !0
@@ -11230,7 +11242,7 @@ function Rp(e, t) {
11230
11242
  let t = u.get(e.id);
11231
11243
  if (t?.element.isConnected && t.node.isConnected && x(t.element)) return t;
11232
11244
  u.delete(e.id);
11233
- let n = Dp(e);
11245
+ let n = jp(e);
11234
11246
  if (!kl(n)) return null;
11235
11247
  let r = [];
11236
11248
  try {
@@ -11292,7 +11304,7 @@ function Rp(e, t) {
11292
11304
  for (let e of d.values()) e.node.isConnected && e.node.nodeValue === e.desiredText && T(e.node, e.beforeText), e.element.isConnected && O(e.element, e.styleChanges);
11293
11305
  d.clear();
11294
11306
  }, j = () => {
11295
- let e = l().edits.filter((e) => e.pageUrl === Tp(r)), t = new Set(e.map((e) => e.id));
11307
+ let e = l().edits.filter((e) => e.pageUrl === kp(r)), t = new Set(e.map((e) => e.id));
11296
11308
  for (let [e, n] of d) t.has(e) && n.node.isConnected && n.element.isConnected || (n.node.isConnected && n.node.nodeValue === n.desiredText && T(n.node, n.beforeText), n.element.isConnected && O(n.element, n.styleChanges), d.delete(e));
11297
11309
  for (let t of e) {
11298
11310
  let e = w(t);
@@ -11333,9 +11345,9 @@ function Rp(e, t) {
11333
11345
  }, P = (e) => [...e.values()].sort((e, t) => t.count - e.count)[0] ?? null, F = (e) => {
11334
11346
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = [], l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = null;
11335
11347
  i instanceof a.HTMLElement && c.push(i);
11336
- for (let e of i.querySelectorAll("*")) if (e instanceof a.HTMLElement && c.push(e), c.length >= mp) break;
11348
+ for (let e of i.querySelectorAll("*")) if (e instanceof a.HTMLElement && c.push(e), c.length >= vp) break;
11337
11349
  for (let e of c) {
11338
- if (!x(e) || !S(e) || Cp.has(e.tagName)) continue;
11350
+ if (!x(e) || !S(e) || Dp.has(e.tagName)) continue;
11339
11351
  let i = r.getComputedStyle(e);
11340
11352
  if (i.display === "none" || i.visibility === "hidden") continue;
11341
11353
  let a = (e, t) => {
@@ -11382,17 +11394,17 @@ function Rp(e, t) {
11382
11394
  });
11383
11395
  }
11384
11396
  return {
11385
- fontFamilies: Lp(Ip(t, 12), f.fontFamily),
11386
- fontSizes: Lp(Ip(n, 12), f.fontSize),
11387
- fontWeights: Lp(Ip(o, 9).sort((e, t) => Np(e) - Np(t)), f.fontWeight),
11388
- colors: Lp(Ip(s, 10), f.color),
11397
+ fontFamilies: Vp(Bp(t, 12), f.fontFamily),
11398
+ fontSizes: Vp(Bp(n, 12), f.fontSize),
11399
+ fontWeights: Vp(Bp(o, 9).sort((e, t) => Lp(e) - Lp(t)), f.fontWeight),
11400
+ colors: Vp(Bp(s, 10), f.color),
11389
11401
  presets: p
11390
11402
  };
11391
11403
  }, I = (e) => {
11392
11404
  let t = e;
11393
11405
  for (; t;) {
11394
11406
  let e = r.getComputedStyle(t).backgroundColor;
11395
- if (e && !Pp(e)) return e;
11407
+ if (e && !Rp(e)) return e;
11396
11408
  t = t.parentElement;
11397
11409
  }
11398
11410
  return "Canvas";
@@ -11427,23 +11439,23 @@ function Rp(e, t) {
11427
11439
  }, V = (e, t) => {
11428
11440
  for (let [n, r] of t) B(e, n, r);
11429
11441
  pe(e), R(e, !0), me();
11430
- }, H = (e, t, n) => V(e, [[t, n]]), ee = (e, t) => wp.every((n) => {
11442
+ }, H = (e, t, n) => V(e, [[t, n]]), ee = (e, t) => Op.every((n) => {
11431
11443
  let r = t.styles[n];
11432
11444
  return r === void 0 || z(e, n) === E(n, r);
11433
11445
  }), U = (e) => e.catalog.presets.find((t) => ee(e, t)) ?? null, te = (e, t) => {
11434
11446
  e.menuOpen = !1;
11435
- let n = wp.flatMap((e) => {
11447
+ let n = Op.flatMap((e) => {
11436
11448
  let n = t.styles[e];
11437
11449
  return n === void 0 ? [] : [[e, n]];
11438
11450
  });
11439
11451
  V(e, n), e.editor.focus({ preventScroll: !0 });
11440
11452
  }, ne = (e) => {
11441
11453
  let t = z(e, "font-weight"), n = L(e, "font-weight");
11442
- if (n && Np(n.desired) >= 600 && Np(n.before) < 600) {
11454
+ if (n && Lp(n.desired) >= 600 && Lp(n.before) < 600) {
11443
11455
  H(e, "font-weight", n.before);
11444
11456
  return;
11445
11457
  }
11446
- H(e, "font-weight", Np(t) >= 600 ? "400" : "700");
11458
+ H(e, "font-weight", Lp(t) >= 600 ? "400" : "700");
11447
11459
  }, re = (e) => {
11448
11460
  let t = z(e, "font-style"), n = L(e, "font-style");
11449
11461
  if (n && n.desired !== "normal" && n.before === "normal") {
@@ -11465,7 +11477,7 @@ function Rp(e, t) {
11465
11477
  height: "32px",
11466
11478
  border: "0",
11467
11479
  borderRadius: "8px",
11468
- background: i ? vp : "transparent",
11480
+ background: i ? Sp : "transparent",
11469
11481
  color: i ? "#ffffff" : "#000000",
11470
11482
  font: "600 13px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
11471
11483
  textDecoration: r === "Underline" ? "underline" : "none",
@@ -11475,7 +11487,7 @@ function Rp(e, t) {
11475
11487
  }), o.addEventListener("mouseenter", () => {
11476
11488
  i || (o.style.background = "rgba(0, 0, 0, 0.04)");
11477
11489
  }), o.addEventListener("mouseleave", () => {
11478
- o.style.background = i ? vp : "transparent";
11490
+ o.style.background = i ? Sp : "transparent";
11479
11491
  }), o.addEventListener("click", (t) => {
11480
11492
  t.preventDefault(), t.stopPropagation(), m === e && (a(), e.editor.focus({ preventScroll: !0 }));
11481
11493
  }), o;
@@ -11488,11 +11500,11 @@ function Rp(e, t) {
11488
11500
  gap: "8px",
11489
11501
  minHeight: "38px",
11490
11502
  padding: "0 8px",
11491
- color: yp,
11503
+ color: Cp,
11492
11504
  font: "500 12px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif"
11493
11505
  });
11494
11506
  let c = n.createElement("span");
11495
- c.textContent = t, c.style.color = bp;
11507
+ c.textContent = t, c.style.color = wp;
11496
11508
  let l = n.createElement("select");
11497
11509
  l.setAttribute("aria-label", t), l.dataset.mesurerTextStyleSelect = t.toLowerCase().replace(/\s+/g, "-"), Object.assign(l.style, {
11498
11510
  width: "100%",
@@ -11500,13 +11512,13 @@ function Rp(e, t) {
11500
11512
  border: "0",
11501
11513
  borderRadius: "8px",
11502
11514
  background: "rgba(0, 0, 0, 0.035)",
11503
- color: yp,
11515
+ color: Cp,
11504
11516
  font: "500 12px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
11505
11517
  padding: "0 8px",
11506
11518
  cursor: "pointer",
11507
11519
  outline: "none"
11508
11520
  });
11509
- for (let e of Lp(r, i)) {
11521
+ for (let e of Vp(r, i)) {
11510
11522
  let t = n.createElement("option");
11511
11523
  t.value = e, t.textContent = a(e), t.selected = e === i, l.append(t);
11512
11524
  }
@@ -11522,11 +11534,11 @@ function Rp(e, t) {
11522
11534
  gap: "8px",
11523
11535
  minHeight: "38px",
11524
11536
  padding: "0 8px",
11525
- color: yp,
11537
+ color: Cp,
11526
11538
  font: "500 12px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif"
11527
11539
  });
11528
11540
  let o = n.createElement("span");
11529
- o.textContent = t, o.style.color = bp;
11541
+ o.textContent = t, o.style.color = wp;
11530
11542
  let s = n.createElement("input");
11531
11543
  s.type = "text", s.value = i, s.setAttribute("aria-label", t), s.dataset.mesurerTextStyleInput = t.toLowerCase().replace(/\s+/g, "-"), Object.assign(s.style, {
11532
11544
  width: "100%",
@@ -11535,7 +11547,7 @@ function Rp(e, t) {
11535
11547
  border: "0",
11536
11548
  borderRadius: "8px",
11537
11549
  background: "rgba(0, 0, 0, 0.035)",
11538
- color: yp,
11550
+ color: Cp,
11539
11551
  font: "500 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace",
11540
11552
  padding: "0 8px",
11541
11553
  outline: "none"
@@ -11580,7 +11592,7 @@ function Rp(e, t) {
11580
11592
  a.textContent = t.label;
11581
11593
  let o = n.createElement("span");
11582
11594
  return o.textContent = ce(t.shortcut), Object.assign(o.style, {
11583
- color: bp,
11595
+ color: wp,
11584
11596
  font: "500 12px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
11585
11597
  whiteSpace: "nowrap"
11586
11598
  }), i.append(a, o), i.addEventListener("mouseenter", () => {
@@ -11604,7 +11616,7 @@ function Rp(e, t) {
11604
11616
  for (let n of e.catalog.presets) t.append(le(e, n, r?.id === n.id));
11605
11617
  t.append(ue());
11606
11618
  let i = z(e, "font-family"), a = z(e, "font-size"), o = z(e, "font-weight"), s = z(e, "line-height"), c = z(e, "letter-spacing"), l = z(e, "color");
11607
- t.append(oe(e, "Font", e.catalog.fontFamilies, i, Mp, (t) => H(e, "font-family", t)), oe(e, "Size", e.catalog.fontSizes, a, (e) => e, (t) => H(e, "font-size", t)), oe(e, "Weight", e.catalog.fontWeights, o, (e) => e, (t) => H(e, "font-weight", t)), se(e, "Line", "line-height", s), se(e, "Tracking", "letter-spacing", c)), t.append(ue());
11619
+ t.append(oe(e, "Font", e.catalog.fontFamilies, i, Ip, (t) => H(e, "font-family", t)), oe(e, "Size", e.catalog.fontSizes, a, (e) => e, (t) => H(e, "font-size", t)), oe(e, "Weight", e.catalog.fontWeights, o, (e) => e, (t) => H(e, "font-weight", t)), se(e, "Line", "line-height", s), se(e, "Tracking", "letter-spacing", c)), t.append(ue());
11608
11620
  let u = n.createElement("div");
11609
11621
  Object.assign(u.style, {
11610
11622
  display: "grid",
@@ -11613,7 +11625,7 @@ function Rp(e, t) {
11613
11625
  });
11614
11626
  let d = n.createElement("div");
11615
11627
  d.textContent = "Text color", Object.assign(d.style, {
11616
- color: bp,
11628
+ color: wp,
11617
11629
  font: "500 12px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif"
11618
11630
  });
11619
11631
  let f = n.createElement("div");
@@ -11629,7 +11641,7 @@ function Rp(e, t) {
11629
11641
  width: "22px",
11630
11642
  height: "22px",
11631
11643
  borderRadius: "50%",
11632
- border: t === l ? `2px solid ${vp}` : "1px solid rgba(0, 0, 0, 0.18)",
11644
+ border: t === l ? `2px solid ${Sp}` : "1px solid rgba(0, 0, 0, 0.18)",
11633
11645
  boxShadow: t === l ? "0 0 0 2px #ffffff inset" : "none",
11634
11646
  background: t,
11635
11647
  cursor: "pointer",
@@ -11639,7 +11651,7 @@ function Rp(e, t) {
11639
11651
  }), f.append(r);
11640
11652
  }
11641
11653
  let p = n.createElement("input");
11642
- p.type = "color", p.value = Fp(l), p.title = "Custom text color", p.setAttribute("aria-label", "Custom text color"), p.dataset.mesurerTextCustomColor = "true", Object.assign(p.style, {
11654
+ p.type = "color", p.value = zp(l), p.title = "Custom text color", p.setAttribute("aria-label", "Custom text color"), p.dataset.mesurerTextCustomColor = "true", Object.assign(p.style, {
11643
11655
  width: "28px",
11644
11656
  height: "28px",
11645
11657
  border: "0",
@@ -11672,7 +11684,7 @@ function Rp(e, t) {
11672
11684
  i.textContent = t?.label ?? "Text";
11673
11685
  let a = n.createElement("span");
11674
11686
  return a.textContent = "⌄", a.setAttribute("aria-hidden", "true"), Object.assign(a.style, {
11675
- color: bp,
11687
+ color: wp,
11676
11688
  fontSize: "15px",
11677
11689
  transform: e.menuOpen ? "rotate(180deg)" : "none",
11678
11690
  transformOrigin: "center"
@@ -11687,7 +11699,7 @@ function Rp(e, t) {
11687
11699
  let t = e.toolbar;
11688
11700
  t.replaceChildren();
11689
11701
  let n = z(e, "font-weight"), r = z(e, "font-style"), i = z(e, "text-decoration-line");
11690
- t.append(ae(e, "B", "Bold", Np(n) >= 600, () => ne(e)), ae(e, "I", "Italic", r === "italic" || r === "oblique", () => re(e)), ae(e, "U", "Underline", i.includes("underline"), () => ie(e)), fe(e)), de(e);
11702
+ t.append(ae(e, "B", "Bold", Lp(n) >= 600, () => ne(e)), ae(e, "I", "Italic", r === "italic" || r === "oblique", () => re(e)), ae(e, "U", "Underline", i.includes("underline"), () => ie(e)), fe(e)), de(e);
11691
11703
  }, me = () => {
11692
11704
  let e = m;
11693
11705
  if (!e || !e.element.isConnected) return;
@@ -11716,7 +11728,7 @@ function Rp(e, t) {
11716
11728
  e.toolbar.style.left = `${h}px`, e.toolbar.style.top = `${f}px`;
11717
11729
  let g = f, _ = f, v = !1;
11718
11730
  if (e.menuOpen) {
11719
- let t = e.menu.getBoundingClientRect(), n = Math.max(0, t.height), i = Math.max(xp, t.width), a = f - n - 8;
11731
+ let t = e.menu.getBoundingClientRect(), n = Math.max(0, t.height), i = Math.max(Tp, t.width), a = f - n - 8;
11720
11732
  v = a >= 8, g = v ? a : Math.min(r.innerHeight - n - 8, f + l + 8);
11721
11733
  let o = Math.min(Math.max(8, h + p - i), Math.max(8, r.innerWidth - i - 8));
11722
11734
  e.menu.style.left = `${o}px`, e.menu.style.top = `${Math.max(8, g)}px`, _ = Math.max(8, g) + n;
@@ -11751,7 +11763,7 @@ function Rp(e, t) {
11751
11763
  }, _e = () => {
11752
11764
  let t = m;
11753
11765
  if (!t) return;
11754
- let n = `${t.leading}${t.editor.value}${t.trailing}`, i = jp(t.styleChanges);
11766
+ let n = `${t.leading}${t.editor.value}${t.trailing}`, i = Fp(t.styleChanges);
11755
11767
  if (n === t.initialText && JSON.stringify(i) === JSON.stringify(t.initialStyleChanges)) {
11756
11768
  T(t.node, t.initialText), he();
11757
11769
  return;
@@ -11759,7 +11771,7 @@ function Rp(e, t) {
11759
11771
  p = {
11760
11772
  id: t.editId,
11761
11773
  createdAt: Date.now(),
11762
- pageUrl: Tp(r),
11774
+ pageUrl: kp(r),
11763
11775
  selector: t.selector,
11764
11776
  nodeIndex: t.nodeIndex,
11765
11777
  beforeText: t.beforeText,
@@ -11781,26 +11793,28 @@ function Rp(e, t) {
11781
11793
  beforeText: t.beforeText,
11782
11794
  desiredText: n,
11783
11795
  styleChanges: i
11784
- }), T(t.node, n), he(), e.command.execute(fp, void 0, { source: "text-inspector" }).catch(() => {
11796
+ }), T(t.node, n), he(), e.command.execute(gp, void 0, { source: "text-inspector" }).catch(() => {
11785
11797
  let e = d.get(t.editId);
11786
11798
  e && (e.node.isConnected && e.node.nodeValue === n && T(e.node, t.beforeText), e.element.isConnected && O(e.element, e.styleChanges)), d.delete(t.editId);
11787
11799
  });
11788
- }, ve = (e, t) => {
11789
- for (let r of n.elementsFromPoint(e, t)) {
11790
- if (!(r instanceof a.HTMLElement) || !x(r) || Cp.has(r.tagName) || r.isContentEditable) continue;
11791
- let e = Array.from(r.childNodes).map((e, t) => ({
11800
+ }, ve = (e, r) => {
11801
+ let i = pp(t);
11802
+ if (i && i.element.isConnected && i.node.isConnected && i.node.parentNode === i.element && i.node.nodeValue?.trim() && x(i.element) && !Dp.has(i.element.tagName) && !i.element.isContentEditable) return i;
11803
+ for (let t of n.elementsFromPoint(e, r)) {
11804
+ if (!(t instanceof a.HTMLElement) || !x(t) || Dp.has(t.tagName) || t.isContentEditable) continue;
11805
+ let e = Array.from(t.childNodes).map((e, t) => ({
11792
11806
  node: e,
11793
11807
  index: t
11794
11808
  })).filter(({ node: e }) => e.nodeType === a.Node.TEXT_NODE && !!e.nodeValue?.trim());
11795
11809
  if (e.length === 1) return {
11796
- element: r,
11810
+ element: t,
11797
11811
  node: e[0].node,
11798
11812
  nodeIndex: e[0].index
11799
11813
  };
11800
11814
  }
11801
11815
  return null;
11802
11816
  }, ye = (e, t, n, i) => {
11803
- let a = Tp(r);
11817
+ let a = kp(r);
11804
11818
  return l().edits.find((r) => {
11805
11819
  if (r.pageUrl !== a || r.nodeIndex !== i) return !1;
11806
11820
  let o = w(r);
@@ -11811,10 +11825,10 @@ function Rp(e, t) {
11811
11825
  let a = ve(e, t);
11812
11826
  if (!a) return;
11813
11827
  i?.preventDefault(), i?.stopImmediatePropagation(), ge();
11814
- let o = Dl(a.element), l = Ol(a.element), u = ye(a.element, a.node, o, a.nodeIndex), f = a.node.nodeValue ?? "", p = u ? d.get(u.id) : void 0, h = !!(u && p?.node === a.node && (f === p.desiredText || p.styleChanges.length > 0)), g = f, _ = f, v = [], y = u?.id ?? Ep(r, "text-edit");
11815
- if (u && h) g = u.beforeText, _ = u.desiredText, v = jp(u.styleChanges), T(a.node, _);
11828
+ let o = Dl(a.element), l = Ol(a.element), u = ye(a.element, a.node, o, a.nodeIndex), f = a.node.nodeValue ?? "", p = u ? d.get(u.id) : void 0, h = !!(u && p?.node === a.node && (f === p.desiredText || p.styleChanges.length > 0)), g = f, _ = f, v = [], y = u?.id ?? Ap(r, "text-edit");
11829
+ if (u && h) g = u.beforeText, _ = u.desiredText, v = Fp(u.styleChanges), T(a.node, _);
11816
11830
  else if (u && f === u.beforeText) {
11817
- g = u.beforeText, _ = u.desiredText, v = jp(u.styleChanges), T(a.node, _);
11831
+ g = u.beforeText, _ = u.desiredText, v = Fp(u.styleChanges), T(a.node, _);
11818
11832
  let e = k(a.element, v, []);
11819
11833
  d.set(u.id, {
11820
11834
  ...a,
@@ -11823,7 +11837,7 @@ function Rp(e, t) {
11823
11837
  styleChanges: e
11824
11838
  });
11825
11839
  } else u && f === u.desiredText && (g = f, _ = f, v = []);
11826
- let x = Ap(_), S = n.createElement("textarea");
11840
+ let x = Pp(_), S = n.createElement("textarea");
11827
11841
  S.dataset.mesurerTextEditor = "true", S.dataset.mesurerInspectorUi = "true", S.setAttribute("aria-label", "Edit text"), S.rows = 1, S.value = x.value, Object.assign(S.style, {
11828
11842
  position: "fixed",
11829
11843
  boxSizing: "border-box",
@@ -11848,14 +11862,14 @@ function Rp(e, t) {
11848
11862
  padding: "4px",
11849
11863
  borderRadius: "12px",
11850
11864
  background: "#ffffff",
11851
- color: yp,
11852
- boxShadow: Sp
11865
+ color: Cp,
11866
+ boxShadow: Ep
11853
11867
  });
11854
11868
  let w = n.createElement("div");
11855
11869
  w.className = "mesurer-toolbar-surface", w.dataset.mesurerTextStyleMenu = "true", w.dataset.mesurerInspectorUi = "true", w.setAttribute("role", "menu"), w.setAttribute("aria-label", "Text style menu"), Object.assign(w.style, {
11856
11870
  position: "fixed",
11857
11871
  zIndex: "2147483647",
11858
- width: `${xp}px`,
11872
+ width: `${Tp}px`,
11859
11873
  maxWidth: "calc(100vw - 16px)",
11860
11874
  maxHeight: "min(520px, calc(100vh - 16px))",
11861
11875
  overflowY: "auto",
@@ -11864,8 +11878,8 @@ function Rp(e, t) {
11864
11878
  padding: "6px",
11865
11879
  borderRadius: "12px",
11866
11880
  background: "#ffffff",
11867
- color: yp,
11868
- boxShadow: Sp
11881
+ color: Cp,
11882
+ boxShadow: Ep
11869
11883
  });
11870
11884
  let E = Uu(n, !1);
11871
11885
  E.dataset.mesurerTextInspectorInfo = "true", E.dataset.mesurerInspectorUi = "true", E.setAttribute("aria-label", "Text inspector"), Object.assign(E.style, {
@@ -11892,7 +11906,7 @@ function Rp(e, t) {
11892
11906
  nodeIndex: a.nodeIndex,
11893
11907
  selector: o,
11894
11908
  fingerprint: l,
11895
- initialStyleChanges: jp(v),
11909
+ initialStyleChanges: Fp(v),
11896
11910
  styleChanges: v,
11897
11911
  catalog: F(a.element)
11898
11912
  }, pe(m), R(m, !1), me(), S.addEventListener("input", () => {
@@ -11909,7 +11923,7 @@ function Rp(e, t) {
11909
11923
  return;
11910
11924
  }
11911
11925
  let n = r.performance.now(), i = h;
11912
- if (i && i.element === t.element && n - i.time <= hp && Math.hypot(e.clientX - i.x, e.clientY - i.y) <= gp) {
11926
+ if (i && i.element === t.element && n - i.time <= yp && Math.hypot(e.clientX - i.x, e.clientY - i.y) <= bp) {
11913
11927
  h = null, be(e.clientX, e.clientY, e);
11914
11928
  return;
11915
11929
  }
@@ -11936,7 +11950,7 @@ function Rp(e, t) {
11936
11950
  }
11937
11951
  _ &&= (r.cancelAnimationFrame(_), 0), v && r.clearTimeout(v), v = r.setTimeout(() => {
11938
11952
  v = 0, we();
11939
- }, _p);
11953
+ }, xp);
11940
11954
  }, Ee = (e) => {
11941
11955
  let t = m;
11942
11956
  if (!t) return;
@@ -11971,7 +11985,7 @@ function Rp(e, t) {
11971
11985
  e && t.key === "Enter" && !t.shiftKey && (t.preventDefault(), t.stopImmediatePropagation(), _e());
11972
11986
  return;
11973
11987
  }
11974
- t.key === "Escape" && y() === "text-inspector" && e.command.execute(pp, void 0, { source: "text-inspector-clear" });
11988
+ t.key === "Escape" && y() === "text-inspector" && e.command.execute(_p, void 0, { source: "text-inspector-clear" });
11975
11989
  }, Oe = new a.MutationObserver((e) => {
11976
11990
  for (let t of e) {
11977
11991
  if (t.type !== "characterData" || !(t.target instanceof a.Text)) continue;
@@ -11996,100 +12010,100 @@ function Rp(e, t) {
11996
12010
  "role",
11997
12011
  "aria-label"
11998
12012
  ]
11999
- }), e.command.register(fp, () => {
12013
+ }), e.command.register(gp, () => {
12000
12014
  let t = p;
12001
12015
  p = null, t && e.state.update("mesurer.text-edit.intents", (e) => {
12002
12016
  let n = e.edits.filter((e) => e.id !== t.id);
12003
12017
  return { edits: t.desiredText !== t.beforeText || t.styleChanges.length > 0 ? [...n, t].slice(-100) : n };
12004
12018
  });
12005
- }), e.command.register(pp, () => {
12006
- p = null, e.state.update(up, () => ({ edits: [] }));
12007
- }), e.service.provide(dp, {
12008
- intents: () => l().edits.map(kp),
12019
+ }), e.command.register(_p, () => {
12020
+ p = null, e.state.update(mp, () => ({ edits: [] }));
12021
+ }), e.service.provide(hp, {
12022
+ intents: () => l().edits.map(Np),
12009
12023
  intent: (e) => {
12010
12024
  let t = l().edits.find((t) => t.id === e);
12011
- return t ? kp(t) : null;
12025
+ return t ? Np(t) : null;
12012
12026
  },
12013
- clear: () => e.command.execute(pp)
12027
+ clear: () => e.command.execute(_p)
12014
12028
  });
12015
12029
  let ke = o.subscribe(we);
12016
12030
  e.state.subscribe(we), r.addEventListener("dblclick", xe, !0), r.addEventListener("pointerup", Se, !0), r.addEventListener("pointerdown", Ee, !0), r.addEventListener("keydown", De, !0), r.addEventListener("resize", we), r.addEventListener("scroll", Te, !0), we(), e.lifecycle.onDispose(() => {
12017
12031
  g = !0, _ && r.cancelAnimationFrame(_), _ = 0, v && r.clearTimeout(v), v = 0, ge(), A(), Oe.disconnect(), ke(), r.removeEventListener("dblclick", xe, !0), r.removeEventListener("pointerup", Se, !0), r.removeEventListener("pointerdown", Ee, !0), r.removeEventListener("keydown", De, !0), r.removeEventListener("resize", we), r.removeEventListener("scroll", Te, !0), u.clear(), o.dispose(), c.dispose();
12018
12032
  });
12019
12033
  }
12020
- var zp = "[data-mesurer-text-editor='true']", Bp = "[data-mesurer-text-edit-runtime='true']", Vp = "[data-mesurer-root='true']", Hp = "data-mesurer-direct-text-edit-active";
12021
- function Up(e, t, n) {
12022
- let { ownerWindow: r, portalTarget: i } = t, a = r, o = i.querySelectorAll(Bp), s = o.item(o.length - 1), c = n.rendererRoot ?? s?.closest(Vp) ?? null;
12034
+ var Up = "[data-mesurer-text-editor='true']", Wp = "[data-mesurer-text-edit-runtime='true']", Gp = "[data-mesurer-root='true']", Kp = "data-mesurer-direct-text-edit-active";
12035
+ function qp(e, t, n) {
12036
+ let { ownerWindow: r, portalTarget: i } = t, a = r, o = i.querySelectorAll(Wp), s = o.item(o.length - 1), c = n.rendererRoot ?? s?.closest(Gp) ?? null;
12023
12037
  if (!s?.isConnected || !c?.isConnected) return;
12024
12038
  let l = !1, u = () => {
12025
- let e = !!s.querySelector(zp);
12026
- e !== l && (l = e, l ? c.setAttribute(Hp, "true") : c.removeAttribute(Hp));
12039
+ let e = !!s.querySelector(Up);
12040
+ e !== l && (l = e, l ? c.setAttribute(Kp, "true") : c.removeAttribute(Kp));
12027
12041
  }, d = new a.MutationObserver(u);
12028
12042
  d.observe(s, {
12029
12043
  childList: !0,
12030
12044
  subtree: !0
12031
12045
  }), u(), e.lifecycle.onDispose(() => {
12032
- d.disconnect(), c.removeAttribute(Hp);
12046
+ d.disconnect(), c.removeAttribute(Kp);
12033
12047
  });
12034
12048
  }
12035
- var Wp = 8, Gp = 2, Kp = 4, qp = 20, Jp = "[data-mesurer-selected-measurement='true']", Yp = "[data-mesurer-measurement-chrome='true']", Xp = "[data-mesurer-measurement-label='true']", Zp = "[data-mesurer-text-editor='true']", Qp = "[data-mesurer-text-edit-ring='true']", $p = "[data-mesurer-text-inspector-info='true']", em = "[data-mesurer-text-inspector-placement-shell='true']", tm = "data-mesurer-measurement-label-clearance", nm = (e) => ({
12049
+ var Jp = 8, Yp = 2, Xp = 4, Zp = 20, Qp = "[data-mesurer-selected-measurement='true']", $p = "[data-mesurer-measurement-chrome='true']", em = "[data-mesurer-measurement-label='true']", tm = "[data-mesurer-text-editor='true']", nm = "[data-mesurer-text-edit-ring='true']", rm = "[data-mesurer-text-inspector-info='true']", im = "[data-mesurer-text-inspector-placement-shell='true']", am = "data-mesurer-measurement-label-clearance", om = (e) => ({
12036
12050
  left: e.left,
12037
12051
  top: e.top,
12038
12052
  right: e.right,
12039
12053
  bottom: e.bottom,
12040
12054
  width: e.width,
12041
12055
  height: e.height
12042
- }), rm = (e, t, n = Kp) => Math.abs(e.left - t.left) <= n && Math.abs(e.top - t.top) <= n && Math.abs(e.width - t.width) <= n && Math.abs(e.height - t.height) <= n, im = (e, t) => Math.max(0, Math.min(e.right, t.right) - Math.max(e.left, t.left)) > 0 && Math.max(0, Math.min(e.bottom, t.bottom) - Math.max(e.top, t.top)) > 0, am = (e) => e.reduce((e, t) => ({
12056
+ }), sm = (e, t, n = Xp) => Math.abs(e.left - t.left) <= n && Math.abs(e.top - t.top) <= n && Math.abs(e.width - t.width) <= n && Math.abs(e.height - t.height) <= n, cm = (e, t) => Math.max(0, Math.min(e.right, t.right) - Math.max(e.left, t.left)) > 0 && Math.max(0, Math.min(e.bottom, t.bottom) - Math.max(e.top, t.top)) > 0, lm = (e) => e.reduce((e, t) => ({
12043
12057
  left: Math.min(e.left, t.left),
12044
12058
  top: Math.min(e.top, t.top),
12045
12059
  right: Math.max(e.right, t.right),
12046
12060
  bottom: Math.max(e.bottom, t.bottom),
12047
12061
  width: Math.max(e.right, t.right) - Math.min(e.left, t.left),
12048
12062
  height: Math.max(e.bottom, t.bottom) - Math.min(e.top, t.top)
12049
- })), om = (e) => ({
12063
+ })), um = (e) => ({
12050
12064
  left: e.left,
12051
12065
  top: e.bottom + 2,
12052
12066
  right: e.right,
12053
- bottom: e.bottom + 2 + qp,
12067
+ bottom: e.bottom + 2 + Zp,
12054
12068
  width: e.width,
12055
- height: qp
12069
+ height: Zp
12056
12070
  });
12057
- function sm(e, t, n, r) {
12058
- let i = am(t.length > 0 ? [e, ...t] : [e, om(e)]), a = n.width, o = n.height, s = r.width - Wp, c = r.height - Wp, l = Math.max(Wp, s - a), u = Math.max(Wp, c - o), d = Math.min(Math.max(e.left + e.width / 2 - a / 2, Wp), l), f = Math.min(Math.max(e.top + e.height / 2 - o / 2, Wp), u), p = [
12071
+ function dm(e, t, n, r) {
12072
+ let i = lm(t.length > 0 ? [e, ...t] : [e, um(e)]), a = n.width, o = n.height, s = r.width - Jp, c = r.height - Jp, l = Math.max(Jp, s - a), u = Math.max(Jp, c - o), d = Math.min(Math.max(e.left + e.width / 2 - a / 2, Jp), l), f = Math.min(Math.max(e.top + e.height / 2 - o / 2, Jp), u), p = [
12059
12073
  {
12060
12074
  left: d,
12061
- top: i.top - Gp - o,
12075
+ top: i.top - Yp - o,
12062
12076
  placement: "above",
12063
12077
  maxHeight: null
12064
12078
  },
12065
12079
  {
12066
12080
  left: d,
12067
- top: i.bottom + Gp,
12081
+ top: i.bottom + Yp,
12068
12082
  placement: "below",
12069
12083
  maxHeight: null
12070
12084
  },
12071
12085
  {
12072
- left: i.right + Gp,
12086
+ left: i.right + Yp,
12073
12087
  top: f,
12074
12088
  placement: "side",
12075
12089
  maxHeight: null
12076
12090
  },
12077
12091
  {
12078
- left: i.left - Gp - a,
12092
+ left: i.left - Yp - a,
12079
12093
  top: f,
12080
12094
  placement: "side",
12081
12095
  maxHeight: null
12082
12096
  }
12083
- ], m = (e) => e.left >= Wp && e.top >= Wp && e.left + a <= s && e.top + o <= c, h = p.find((e) => m(e));
12097
+ ], m = (e) => e.left >= Jp && e.top >= Jp && e.left + a <= s && e.top + o <= c, h = p.find((e) => m(e));
12084
12098
  if (h) return h;
12085
12099
  let g = [{
12086
12100
  placement: "above",
12087
- top: Wp,
12088
- height: Math.max(0, i.top - Gp - Wp)
12101
+ top: Jp,
12102
+ height: Math.max(0, i.top - Yp - Jp)
12089
12103
  }, {
12090
12104
  placement: "below",
12091
- top: i.bottom + Gp,
12092
- height: Math.max(0, c - i.bottom - Gp)
12105
+ top: i.bottom + Yp,
12106
+ height: Math.max(0, c - i.bottom - Yp)
12093
12107
  }].sort((e, t) => t.height - e.height)[0];
12094
12108
  return g && g.height > 0 ? {
12095
12109
  left: d,
@@ -12098,42 +12112,42 @@ function sm(e, t, n, r) {
12098
12112
  maxHeight: g.height
12099
12113
  } : {
12100
12114
  left: d,
12101
- top: Wp,
12115
+ top: Jp,
12102
12116
  placement: "viewport",
12103
12117
  maxHeight: Math.max(0, r.height - 16)
12104
12118
  };
12105
12119
  }
12106
- var cm = (e, t) => ({
12120
+ var fm = (e, t) => ({
12107
12121
  value: e.style.getPropertyValue(t),
12108
12122
  priority: e.style.getPropertyPriority(t)
12109
- }), lm = (e, t, n, r = "") => {
12123
+ }), pm = (e, t, n, r = "") => {
12110
12124
  (e.style.getPropertyValue(t) !== n || e.style.getPropertyPriority(t) !== r) && e.style.setProperty(t, n, r);
12111
- }, um = (e, t, n) => {
12125
+ }, mm = (e, t, n) => {
12112
12126
  (e.style.getPropertyValue(t) !== n.value || e.style.getPropertyPriority(t) !== n.priority) && (n.value || n.priority ? e.style.setProperty(t, n.value, n.priority) : e.style.removeProperty(t));
12113
- }, dm = (e, t, n) => {
12127
+ }, hm = (e, t, n) => {
12114
12128
  e.getAttribute(t) !== n && e.setAttribute(t, n);
12115
- }, fm = (e, t) => {
12129
+ }, gm = (e, t) => {
12116
12130
  let n = t.bottom + 2, r = t.left + t.width / 2, i = e.left + e.width / 2;
12117
12131
  return Math.abs(e.top - n) <= 8 && Math.abs(i - r) <= 8;
12118
- }, pm = (e, t, n) => {
12132
+ }, _m = (e, t, n) => {
12119
12133
  let r = /* @__PURE__ */ new Set();
12120
- for (let t of e) for (let e of t.querySelectorAll(Jp)) r.add(e);
12134
+ for (let t of e) for (let e of t.querySelectorAll(Qp)) r.add(e);
12121
12135
  let i = [];
12122
12136
  for (let e of r) {
12123
12137
  let r = n.getComputedStyle(e);
12124
12138
  if (r.display === "none" || r.visibility === "hidden") continue;
12125
- let a = e.querySelector(Xp);
12139
+ let a = e.querySelector(em);
12126
12140
  if (!a) continue;
12127
12141
  let o = n.getComputedStyle(a);
12128
12142
  if (o.display === "none" || o.visibility === "hidden") continue;
12129
- let s = nm(a.getBoundingClientRect());
12143
+ let s = om(a.getBoundingClientRect());
12130
12144
  if (s.width <= 0 || s.height <= 0) continue;
12131
- let c = e.querySelector(Yp), l = c?.isConnected ? nm(c.getBoundingClientRect()) : null;
12132
- !(l && l.width > 0 && l.height > 0 && rm(l, t)) && !fm(s, t) || i.push(s);
12145
+ let c = e.querySelector($p), l = c?.isConnected ? om(c.getBoundingClientRect()) : null;
12146
+ !(l && l.width > 0 && l.height > 0 && sm(l, t)) && !gm(s, t) || i.push(s);
12133
12147
  }
12134
12148
  return i;
12135
- }, mm = (e, t) => e instanceof t.HTMLElement ? e.matches(Jp) || !!e.closest(Jp) || !!e.querySelector(Jp) : !1;
12136
- function hm(e, t, n = t.portalTarget) {
12149
+ }, vm = (e, t) => e instanceof t.HTMLElement ? e.matches(Qp) || !!e.closest(Qp) || !!e.querySelector(Qp) : !1;
12150
+ function ym(e, t, n = t.portalTarget) {
12137
12151
  let { ownerDocument: r, ownerWindow: i, portalTarget: a } = t, o = i, s = a.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), c = s.item(s.length - 1);
12138
12152
  if (!c) return;
12139
12153
  let l = null, u = 0, d = !1, f = () => {
@@ -12143,42 +12157,42 @@ function hm(e, t, n = t.portalTarget) {
12143
12157
  let e = l;
12144
12158
  if (!e) return;
12145
12159
  let { shell: t, card: n } = e;
12146
- t.isConnected && (um(t, "left", e.shellLeft), um(t, "top", e.shellTop), um(t, "--mesurer-native-anchor-x", e.anchorX), um(t, "--mesurer-native-anchor-y", e.anchorY), e.marker === null ? t.removeAttribute(tm) : dm(t, tm, e.marker)), n.isConnected && (um(n, "max-height", e.cardMaxHeight), e.placement === null ? delete n.dataset.mesurerTextInspectorPlacement : n.dataset.mesurerTextInspectorPlacement !== e.placement && (n.dataset.mesurerTextInspectorPlacement = e.placement)), l = null;
12160
+ t.isConnected && (mm(t, "left", e.shellLeft), mm(t, "top", e.shellTop), mm(t, "--mesurer-native-anchor-x", e.anchorX), mm(t, "--mesurer-native-anchor-y", e.anchorY), e.marker === null ? t.removeAttribute(am) : hm(t, am, e.marker)), n.isConnected && (mm(n, "max-height", e.cardMaxHeight), e.placement === null ? delete n.dataset.mesurerTextInspectorPlacement : n.dataset.mesurerTextInspectorPlacement !== e.placement && (n.dataset.mesurerTextInspectorPlacement = e.placement)), l = null;
12147
12161
  }, m = (e, t) => {
12148
12162
  l = {
12149
12163
  shell: e,
12150
12164
  card: t,
12151
- shellLeft: cm(e, "left"),
12152
- shellTop: cm(e, "top"),
12153
- anchorX: cm(e, "--mesurer-native-anchor-x"),
12154
- anchorY: cm(e, "--mesurer-native-anchor-y"),
12155
- cardMaxHeight: cm(t, "max-height"),
12165
+ shellLeft: fm(e, "left"),
12166
+ shellTop: fm(e, "top"),
12167
+ anchorX: fm(e, "--mesurer-native-anchor-x"),
12168
+ anchorY: fm(e, "--mesurer-native-anchor-y"),
12169
+ cardMaxHeight: fm(t, "max-height"),
12156
12170
  placement: t.getAttribute("data-mesurer-text-inspector-placement"),
12157
- marker: e.getAttribute(tm)
12171
+ marker: e.getAttribute(am)
12158
12172
  };
12159
12173
  }, h = () => {
12160
12174
  if (d) return;
12161
- let e = c.querySelector(Zp), t = c.querySelector(em), n = c.querySelector($p), r = c.querySelectorAll(Qp), a = r.item(r.length - 1);
12175
+ let e = c.querySelector(tm), t = c.querySelector(im), n = c.querySelector(rm), r = c.querySelectorAll(nm), a = r.item(r.length - 1);
12162
12176
  if (!e?.isConnected || !t?.isConnected || !n?.isConnected || !a?.isConnected) {
12163
12177
  p();
12164
12178
  return;
12165
12179
  }
12166
12180
  l && (l.shell !== t || l.card !== n) && p();
12167
- let s = nm(a.getBoundingClientRect());
12181
+ let s = om(a.getBoundingClientRect());
12168
12182
  if (s.width <= 0 || s.height <= 0) return;
12169
12183
  let u = t.dataset.mesurerNativeScrollOwner === "typography" && t.dataset.mesurerNativeScrollAnchor === "offset", h = s.right > 0 && s.bottom > 0 && s.left < i.innerWidth && s.top < i.innerHeight;
12170
12184
  if (u && !h) return;
12171
- let g = pm(f(), s, o), _ = om(s), v = nm(n.getBoundingClientRect()), y = im(v, _) || g.some((e) => im(v, e));
12185
+ let g = _m(f(), s, o), _ = um(s), v = om(n.getBoundingClientRect()), y = cm(v, _) || g.some((e) => cm(v, e));
12172
12186
  if (!l && !y) return;
12173
12187
  l || m(t, n);
12174
- let b = Math.max(v.height, n.scrollHeight), x = sm(s, g, {
12188
+ let b = Math.max(v.height, n.scrollHeight), x = dm(s, g, {
12175
12189
  width: v.width,
12176
12190
  height: b
12177
12191
  }, {
12178
12192
  width: i.innerWidth,
12179
12193
  height: i.innerHeight
12180
12194
  });
12181
- u ? (lm(t, "--mesurer-native-anchor-x", `${x.left - s.left}px`), lm(t, "--mesurer-native-anchor-y", `${x.top - s.top}px`)) : (lm(t, "left", `${x.left}px`), lm(t, "top", `${x.top}px`)), x.maxHeight === null && l ? um(n, "max-height", l.cardMaxHeight) : x.maxHeight !== null && lm(n, "max-height", `${x.maxHeight}px`), n.dataset.mesurerTextInspectorPlacement !== x.placement && (n.dataset.mesurerTextInspectorPlacement = x.placement), dm(t, tm, "true");
12195
+ u ? (pm(t, "--mesurer-native-anchor-x", `${x.left - s.left}px`), pm(t, "--mesurer-native-anchor-y", `${x.top - s.top}px`)) : (pm(t, "left", `${x.left}px`), pm(t, "top", `${x.top}px`)), x.maxHeight === null && l ? mm(n, "max-height", l.cardMaxHeight) : x.maxHeight !== null && pm(n, "max-height", `${x.maxHeight}px`), n.dataset.mesurerTextInspectorPlacement !== x.placement && (n.dataset.mesurerTextInspectorPlacement = x.placement), hm(t, am, "true");
12182
12196
  }, g = () => {
12183
12197
  d || u || (u = i.requestAnimationFrame(() => {
12184
12198
  u = 0, h();
@@ -12189,7 +12203,7 @@ function hm(e, t, n = t.portalTarget) {
12189
12203
  subtree: !0
12190
12204
  });
12191
12205
  let v = n === a ? null : new o.MutationObserver((e) => {
12192
- e.some((e) => e.type === "attributes" ? mm(e.target, o) : mm(e.target, o) ? !0 : [...e.addedNodes, ...e.removedNodes].some((e) => mm(e, o))) && g();
12206
+ e.some((e) => e.type === "attributes" ? vm(e.target, o) : vm(e.target, o) ? !0 : [...e.addedNodes, ...e.removedNodes].some((e) => vm(e, o))) && g();
12193
12207
  });
12194
12208
  v?.observe(n, {
12195
12209
  childList: !0,
@@ -12200,8 +12214,8 @@ function hm(e, t, n = t.portalTarget) {
12200
12214
  d = !0, _.disconnect(), v?.disconnect(), i.removeEventListener("resize", g, !0), i.removeEventListener("dblclick", g, !0), u && i.cancelAnimationFrame(u), p();
12201
12215
  });
12202
12216
  }
12203
- var gm = "#0d99ff", _m = "#8a8a8a", vm = 288, ym = 1.5, bm = 80, xm = (e, t, n = 2) => Math.abs(e.left - t.left) <= n && Math.abs(e.top - t.top) <= n && Math.abs(e.width - t.width) <= n && Math.abs(e.height - t.height) <= n, Sm = (e, t, n) => Math.min(Math.max(e, t), n);
12204
- function Cm(e, t) {
12217
+ var bm = "#0d99ff", xm = "#8a8a8a", Sm = 288, Cm = 1.5, wm = 80, Tm = (e, t, n = 2) => Math.abs(e.left - t.left) <= n && Math.abs(e.top - t.top) <= n && Math.abs(e.width - t.width) <= n && Math.abs(e.height - t.height) <= n, Em = (e, t, n) => Math.min(Math.max(e, t), n);
12218
+ function Dm(e, t) {
12205
12219
  let { ownerDocument: n, ownerWindow: r, pageTarget: i, portalTarget: a } = t, o = r, s = a.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), c = s.item(s.length - 1);
12206
12220
  if (!c) return;
12207
12221
  let l = c.closest("[data-mesurer-root='true']"), u = null, d = /* @__PURE__ */ new Map(), f = null, p = !1, m = null, h = null, g = null, _ = 0, v = 0, y = !1, b = !1, x = () => l?.querySelector("button[data-mesurer-builtin='text-inspector']") ?? null, S = () => {
@@ -12244,7 +12258,7 @@ function Cm(e, t) {
12244
12258
  ariaPressed: t.getAttribute("aria-pressed"),
12245
12259
  background: t.style.backgroundColor,
12246
12260
  color: t.style.color
12247
- }, t.setAttribute("aria-pressed", "true"), t.style.backgroundColor = gm, t.style.color = "#ffffff";
12261
+ }, t.setAttribute("aria-pressed", "true"), t.style.backgroundColor = bm, t.style.color = "#ffffff";
12248
12262
  return;
12249
12263
  }
12250
12264
  if (delete l.dataset.mesurerTypographyContextActive, !t || !u) {
@@ -12304,8 +12318,8 @@ function Cm(e, t) {
12304
12318
  height: "7px",
12305
12319
  flex: "0 0 7px",
12306
12320
  boxSizing: "border-box",
12307
- borderRight: `1.5px solid ${_m}`,
12308
- borderBottom: `1.5px solid ${_m}`,
12321
+ borderRight: `1.5px solid ${xm}`,
12322
+ borderBottom: `1.5px solid ${xm}`,
12309
12323
  color: "transparent",
12310
12324
  fontSize: "0",
12311
12325
  lineHeight: "0",
@@ -12323,9 +12337,9 @@ function Cm(e, t) {
12323
12337
  }, M = () => g?.isConnected ? g : (g = n.createElement("div"), g.dataset.mesurerTextCaret = "true", g.dataset.mesurerInspectorUi = "true", g.setAttribute("aria-hidden", "true"), Object.assign(g.style, {
12324
12338
  position: "fixed",
12325
12339
  zIndex: "2147483647",
12326
- width: `${ym}px`,
12340
+ width: `${Cm}px`,
12327
12341
  pointerEvents: "none",
12328
- transform: `translateX(-${ym / 2}px)`,
12342
+ transform: `translateX(-${Cm / 2}px)`,
12329
12343
  transformOrigin: "center"
12330
12344
  }), a.append(g), g.animate?.([
12331
12345
  {
@@ -12362,7 +12376,7 @@ function Cm(e, t) {
12362
12376
  ], s = [];
12363
12377
  for (let [e, t] of a) for (let r of n.elementsFromPoint(e, t)) !(r instanceof o.HTMLElement) || s.includes(r) || i.contains(r) && (r.closest("[data-mesurer-root='true'], [data-mesurer-inspector-ui='true']") || s.push(r));
12364
12378
  for (let t of s) {
12365
- if (!xm(t.getBoundingClientRect(), r)) continue;
12379
+ if (!Tm(t.getBoundingClientRect(), r)) continue;
12366
12380
  let n = Array.from(t.childNodes).filter((e) => e.nodeType === o.Node.TEXT_NODE).flatMap((t) => {
12367
12381
  let n = N(t, e.value);
12368
12382
  return n ? [{
@@ -12425,7 +12439,7 @@ function Cm(e, t) {
12425
12439
  j();
12426
12440
  return;
12427
12441
  }
12428
- let o = a.leadingLength + Sm(i, 0, e.value.length), s = F(a.node, o);
12442
+ let o = a.leadingLength + Em(i, 0, e.value.length), s = F(a.node, o);
12429
12443
  if (!s || s.left < 0 || s.top < 0 || s.left > r.innerWidth || s.top > r.innerHeight) {
12430
12444
  j();
12431
12445
  return;
@@ -12435,7 +12449,7 @@ function Cm(e, t) {
12435
12449
  left: `${s.left}px`,
12436
12450
  top: `${s.top}px`,
12437
12451
  height: `${Math.max(1, s.height)}px`,
12438
- background: c.color && c.color !== "transparent" ? c.color : gm
12452
+ background: c.color && c.color !== "transparent" ? c.color : bm
12439
12453
  });
12440
12454
  }, L = () => {
12441
12455
  if (_ = 0, y) return;
@@ -12450,7 +12464,7 @@ function Cm(e, t) {
12450
12464
  }, z = () => {
12451
12465
  _ &&= (r.cancelAnimationFrame(_), 0), g && j(), v && r.clearTimeout(v), v = r.setTimeout(() => {
12452
12466
  v = 0, R();
12453
- }, bm);
12467
+ }, wm);
12454
12468
  }, B = () => {
12455
12469
  m && (m.removeEventListener("input", R), m.removeEventListener("select", R), m.removeEventListener("keyup", R), m.removeEventListener("pointerup", R), m.removeEventListener("focus", R), m.removeEventListener("blur", R), m = null, h = null);
12456
12470
  }, V = (e) => {
@@ -12484,7 +12498,7 @@ function Cm(e, t) {
12484
12498
  }
12485
12499
  for (let e of Array.from(r.children)) e instanceof o.HTMLButtonElement && e.hasAttribute("data-mesurer-text-style-preset") || e.remove();
12486
12500
  Object.assign(r.style, {
12487
- width: `${vm}px`,
12501
+ width: `${Sm}px`,
12488
12502
  maxHeight: "min(260px, calc(100vh - 16px))",
12489
12503
  overflowY: "auto"
12490
12504
  }), r.setAttribute("aria-label", "Text presets");
@@ -12511,7 +12525,7 @@ function Cm(e, t) {
12511
12525
  y = !0, ee.disconnect(), r.removeEventListener("resize", R), r.removeEventListener("scroll", z, !0), _ && r.cancelAnimationFrame(_), v && r.clearTimeout(v), _ = 0, v = 0, B(), w(), j(), C(), E(!1);
12512
12526
  });
12513
12527
  }
12514
- var wm = "#0d99ff", Tm = "rgba(13, 153, 255, 0.22)", Em = /* @__PURE__ */ new Set([
12528
+ var Om = "#0d99ff", km = "rgba(13, 153, 255, 0.22)", Am = /* @__PURE__ */ new Set([
12515
12529
  "HTML",
12516
12530
  "BODY",
12517
12531
  "SCRIPT",
@@ -12527,10 +12541,10 @@ var wm = "#0d99ff", Tm = "rgba(13, 153, 255, 0.22)", Em = /* @__PURE__ */ new Se
12527
12541
  "TEXTAREA",
12528
12542
  "SELECT",
12529
12543
  "OPTION"
12530
- ]), Dm = /* @__PURE__ */ new WeakMap(), Om = (e, t) => Array.from(e.childNodes).map((e, t) => ({
12544
+ ]), jm = (e, t) => Array.from(e.childNodes).map((e, t) => ({
12531
12545
  node: e,
12532
12546
  index: t
12533
- })).filter((e) => e.node.nodeType === t.Node.TEXT_NODE && !!e.node.nodeValue?.trim()), km = (e, t, n, r, i) => {
12547
+ })).filter((e) => e.node.nodeType === t.Node.TEXT_NODE && !!e.node.nodeValue?.trim()), Mm = (e, t, n, r, i) => {
12534
12548
  let a = e, o = a.caretPositionFromPoint?.(r, i);
12535
12549
  if (o?.offsetNode instanceof t.Text) {
12536
12550
  let e = n.find((e) => e.node === o.offsetNode);
@@ -12553,50 +12567,43 @@ var wm = "#0d99ff", Tm = "rgba(13, 153, 255, 0.22)", Em = /* @__PURE__ */ new Se
12553
12567
  if (Array.from(a).some((e) => r >= e.left - 1 && r <= e.right + 1 && i >= e.top - 1 && i <= e.bottom + 1)) return t;
12554
12568
  }
12555
12569
  return null;
12556
- }, Am = (e, t, n) => Math.min(Math.max(e, t), n);
12557
- function jm(e, t) {
12570
+ }, Nm = (e, t, n) => Math.min(Math.max(e, t), n);
12571
+ function Pm(e, t) {
12558
12572
  let { ownerDocument: n, ownerWindow: r, pageTarget: i } = t, a = r, o = () => {
12559
12573
  let e = t.currentToolMode?.() ?? "none";
12560
12574
  return e === "text-inspector" || e === "select";
12561
12575
  }, s = (e) => Tl(e, i) && !e.closest("[data-mesurer-root='true'], [data-mesurer-inspector-ui='true']"), c = (e, i) => {
12562
- if (Dm.delete(t), o()) for (let o of n.elementsFromPoint(e, i)) {
12576
+ if (dp(t), o()) for (let o of n.elementsFromPoint(e, i)) {
12563
12577
  if (mo(o, r)) return;
12564
- if (!(o instanceof a.HTMLElement) || !s(o) || Em.has(o.tagName) || o.isContentEditable) continue;
12565
- let c = Om(o, a);
12578
+ if (!(o instanceof a.HTMLElement) || !s(o) || Am.has(o.tagName) || o.isContentEditable) continue;
12579
+ let c = jm(o, a);
12566
12580
  if (c.length === 0) continue;
12567
12581
  if (c.length === 1) {
12568
- Dm.set(t, {
12582
+ fp(t, {
12569
12583
  element: o,
12570
- node: c[0].node
12584
+ node: c[0].node,
12585
+ nodeIndex: c[0].index
12571
12586
  });
12572
12587
  return;
12573
12588
  }
12574
- let l = km(n, a, c, e, i);
12575
- if (!l) continue;
12576
- if (Dm.set(t, {
12577
- element: o,
12578
- node: l.node
12579
- }), Object.prototype.hasOwnProperty.call(o, "childNodes")) {
12580
- Dm.delete(t);
12581
- continue;
12589
+ let l = Mm(n, a, c, e, i);
12590
+ if (l) {
12591
+ fp(t, {
12592
+ element: o,
12593
+ node: l.node,
12594
+ nodeIndex: l.index
12595
+ });
12596
+ return;
12582
12597
  }
12583
- let u = Array.from(o.childNodes).map((e, t) => t === l.index || e.nodeType !== a.Node.TEXT_NODE || !e.nodeValue?.trim() ? e : n.createComment("mesurer-non-target-text")), d = () => u;
12584
- Object.defineProperty(o, "childNodes", {
12585
- configurable: !0,
12586
- get: d
12587
- }), r.setTimeout(() => {
12588
- Object.getOwnPropertyDescriptor(o, "childNodes")?.get === d && Reflect.deleteProperty(o, "childNodes");
12589
- }, 0);
12590
- return;
12591
12598
  }
12592
12599
  }, l = (e) => c(e.clientX, e.clientY), u = (e) => {
12593
12600
  !e.pointerType || e.pointerType === "mouse" || c(e.clientX, e.clientY);
12594
12601
  };
12595
12602
  r.addEventListener("dblclick", l, !0), r.addEventListener("pointerup", u, !0), e.lifecycle.onDispose(() => {
12596
- Dm.delete(t), r.removeEventListener("dblclick", l, !0), r.removeEventListener("pointerup", u, !0);
12603
+ dp(t), r.removeEventListener("dblclick", l, !0), r.removeEventListener("pointerup", u, !0);
12597
12604
  });
12598
12605
  }
12599
- function Mm(e, t) {
12606
+ function Fm(e, t) {
12600
12607
  let { ownerDocument: n, ownerWindow: r, pageTarget: i, portalTarget: a } = t, o = r, s = a.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), c = s.item(s.length - 1);
12601
12608
  if (!c) return;
12602
12609
  let l = t.createWorkspaceRuntime(), u = null, d = [], f = null, p = null, m = !1, h = 0, g = !1, _ = () => {
@@ -12613,7 +12620,7 @@ function Mm(e, t) {
12613
12620
  zIndex: "2147483644",
12614
12621
  pointerEvents: "none",
12615
12622
  borderRadius: "2px",
12616
- background: Tm,
12623
+ background: km,
12617
12624
  transition: "none",
12618
12625
  animation: "none"
12619
12626
  }), a.append(r), d[e] = r, r;
@@ -12625,7 +12632,7 @@ function Mm(e, t) {
12625
12632
  pointerEvents: "none",
12626
12633
  boxSizing: "border-box",
12627
12634
  background: "transparent",
12628
- boxShadow: `inset 0 0 0 1.5px ${wm}`,
12635
+ boxShadow: `inset 0 0 0 1.5px ${Om}`,
12629
12636
  transition: "none",
12630
12637
  animation: "none"
12631
12638
  }), c.append(u), u), S = () => {
@@ -12642,7 +12649,7 @@ function Mm(e, t) {
12642
12649
  v();
12643
12650
  return;
12644
12651
  }
12645
- let o = t.node.nodeValue ?? "", s = o.length - o.trimStart().length, c = o.length - o.trimEnd().length, l = Math.max(0, o.length - s - c), u = s + Am(Math.min(i, a), 0, l), d = s + Am(Math.max(i, a), 0, l);
12652
+ let o = t.node.nodeValue ?? "", s = o.length - o.trimStart().length, c = o.length - o.trimEnd().length, l = Math.max(0, o.length - s - c), u = s + Nm(Math.min(i, a), 0, l), d = s + Nm(Math.max(i, a), 0, l);
12646
12653
  if (u === d) {
12647
12654
  v();
12648
12655
  return;
@@ -12676,12 +12683,13 @@ function Mm(e, t) {
12676
12683
  }, T = (e) => {
12677
12684
  let t = l.currentSelection().elements.filter((e) => e.isConnected && Tl(e, i) && !e.closest("[data-mesurer-root='true'], [data-mesurer-inspector-ui='true']"));
12678
12685
  if (t.length !== 1) return null;
12679
- let n = t[0], r = Om(n, o);
12686
+ let n = t[0], r = jm(n, o);
12680
12687
  if (!r.length) return null;
12681
12688
  let a = e.value.trim(), s = r.find(({ node: e }) => (e.nodeValue ?? "").trim() === a) ?? (r.length === 1 ? r[0] : null);
12682
12689
  return s ? {
12683
12690
  element: n,
12684
- node: s.node
12691
+ node: s.node,
12692
+ nodeIndex: s.index
12685
12693
  } : null;
12686
12694
  }, E = () => {
12687
12695
  if (g) return;
@@ -12691,7 +12699,7 @@ function Mm(e, t) {
12691
12699
  return;
12692
12700
  }
12693
12701
  e.style.opacity = "0", e.style.background = "transparent", e.style.boxShadow = "none", w(e);
12694
- let n = Dm.get(t) ?? null ?? p ?? T(e);
12702
+ let n = pp(t) ?? p ?? T(e);
12695
12703
  n?.element.isConnected && n.node.isConnected && (p = n);
12696
12704
  let a = n?.element ?? null, o = a?.isConnected && Tl(a, i) && !a.closest("[data-mesurer-root='true'], [data-mesurer-inspector-ui='true']") ? a : null, s = o?.getBoundingClientRect() ?? e.getBoundingClientRect(), l = r.getComputedStyle(o ?? e), u = x();
12697
12705
  Object.assign(u.style, {
@@ -12713,25 +12721,25 @@ function Mm(e, t) {
12713
12721
  capture: !0,
12714
12722
  passive: !0
12715
12723
  }), E(), e.lifecycle.onDispose(() => {
12716
- g = !0, Dm.delete(t), O.disconnect(), r.removeEventListener("resize", S), r.removeEventListener("scroll", D, !0), h && r.cancelAnimationFrame(h), f && (f.removeEventListener("input", S), f.removeEventListener("select", S), f.removeEventListener("keyup", S), f.removeEventListener("pointerup", S)), p = null, v(), _(), l.dispose();
12724
+ g = !0, dp(t), O.disconnect(), r.removeEventListener("resize", S), r.removeEventListener("scroll", D, !0), h && r.cancelAnimationFrame(h), f && (f.removeEventListener("input", S), f.removeEventListener("select", S), f.removeEventListener("keyup", S), f.removeEventListener("pointerup", S)), p = null, v(), _(), l.dispose();
12717
12725
  });
12718
12726
  }
12719
- var Nm = "[data-mesurer-selected-measurement='true']", Pm = "[data-mesurer-hover-measurement='true']", Fm = "[data-mesurer-text-editor='true']", Im = "data-mesurer-direct-edit-selection-suppressed", Lm = "data-mesurer-direct-edit-hover-suppressed";
12720
- function Rm(e, t, n = t.portalTarget) {
12727
+ var Im = "[data-mesurer-selected-measurement='true']", Lm = "[data-mesurer-hover-measurement='true']", Rm = "[data-mesurer-text-editor='true']", zm = "data-mesurer-direct-edit-selection-suppressed", Bm = "data-mesurer-direct-edit-hover-suppressed";
12728
+ function Vm(e, t, n = t.portalTarget) {
12721
12729
  let { ownerDocument: r, ownerWindow: i, portalTarget: a } = t, o = i, s = a.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), c = s.item(s.length - 1);
12722
12730
  if (!c) return;
12723
12731
  let l = t.createWorkspaceRuntime(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), h = !1, g = !1, _ = !1, v = null, y = () => {
12724
12732
  let e = [a];
12725
12733
  return n !== a && e.push(n), r.body && !e.includes(r.body) && e.push(r.body), e;
12726
12734
  }, b = (e) => {
12727
- e.matches(Nm) && f.add(e), e.matches(Pm) && p.add(e);
12735
+ e.matches(Im) && f.add(e), e.matches(Lm) && p.add(e);
12728
12736
  }, x = (e) => {
12729
12737
  if (e instanceof o.HTMLElement) {
12730
12738
  b(e);
12731
- for (let t of e.querySelectorAll(`${Nm}, ${Pm}`)) b(t);
12739
+ for (let t of e.querySelectorAll(`${Im}, ${Lm}`)) b(t);
12732
12740
  }
12733
12741
  }, S = (e) => {
12734
- for (let t of e.querySelectorAll(`${Nm}, ${Pm}`)) b(t);
12742
+ for (let t of e.querySelectorAll(`${Im}, ${Lm}`)) b(t);
12735
12743
  };
12736
12744
  for (let e of y()) S(e);
12737
12745
  let C = (e, t, n) => {
@@ -12749,28 +12757,28 @@ function Rm(e, t, n = t.portalTarget) {
12749
12757
  if (!e.isConnected) {
12750
12758
  f.delete(e);
12751
12759
  let t = u.get(e);
12752
- t && w(e, t, u, Im);
12760
+ t && w(e, t, u, zm);
12753
12761
  continue;
12754
12762
  }
12755
- C(e, u, Im);
12763
+ C(e, u, zm);
12756
12764
  }
12757
- for (let [e, t] of Array.from(u)) (!e.isConnected || !f.has(e)) && w(e, t, u, Im);
12765
+ for (let [e, t] of Array.from(u)) (!e.isConnected || !f.has(e)) && w(e, t, u, zm);
12758
12766
  }, D = () => {
12759
12767
  let e = l.hoveredElement(), t = l.currentSelection().elements, n = e ? m.has(e) : !1, r = e ? t.includes(e) : !1;
12760
12768
  if (!n && !r) {
12761
- T(d, Lm);
12769
+ T(d, Bm);
12762
12770
  return;
12763
12771
  }
12764
12772
  for (let e of Array.from(p)) {
12765
12773
  if (!e.isConnected) {
12766
12774
  p.delete(e);
12767
12775
  let t = d.get(e);
12768
- t && w(e, t, d, Lm);
12776
+ t && w(e, t, d, Bm);
12769
12777
  continue;
12770
12778
  }
12771
- C(e, d, Lm);
12779
+ C(e, d, Bm);
12772
12780
  }
12773
- for (let [e, t] of Array.from(d)) (!e.isConnected || !p.has(e)) && w(e, t, d, Lm);
12781
+ for (let [e, t] of Array.from(d)) (!e.isConnected || !p.has(e)) && w(e, t, d, Bm);
12774
12782
  }, O = () => {
12775
12783
  _ || g || (g = !0, i.queueMicrotask(() => {
12776
12784
  g = !1, M();
@@ -12793,11 +12801,11 @@ function Rm(e, t, n = t.portalTarget) {
12793
12801
  v?.disconnect(), v = null;
12794
12802
  }, M = () => {
12795
12803
  if (!_) {
12796
- if (c.querySelector(Fm)) {
12804
+ if (c.querySelector(Rm)) {
12797
12805
  h || (m = new Set(l.currentSelection().elements)), h = !0, E(), D(), A();
12798
12806
  return;
12799
12807
  }
12800
- !h && u.size === 0 && d.size === 0 || (h = !1, m.clear(), j(), T(u, Im), T(d, Lm));
12808
+ !h && u.size === 0 && d.size === 0 || (h = !1, m.clear(), j(), T(u, zm), T(d, Bm));
12801
12809
  }
12802
12810
  }, N = new o.MutationObserver(k);
12803
12811
  N.observe(c, {
@@ -12806,39 +12814,39 @@ function Rm(e, t, n = t.portalTarget) {
12806
12814
  });
12807
12815
  let P = l.subscribe(O);
12808
12816
  M(), e.lifecycle.onDispose(() => {
12809
- _ = !0, N.disconnect(), j(), P(), l.dispose(), T(u, Im), T(d, Lm), f.clear(), p.clear();
12817
+ _ = !0, N.disconnect(), j(), P(), l.dispose(), T(u, zm), T(d, Bm), f.clear(), p.clear();
12810
12818
  });
12811
12819
  }
12812
- var zm = "[data-mesurer-text-editor='true']", Bm = "[data-mesurer-text-edit-ring='true']", Vm = "[data-mesurer-text-inspector-info='true']", Hm = "[data-mesurer-text-inspector-placement-shell='true']", Um = "[data-mesurer-measurement='true']", Wm = "[data-mesurer-measurement-chrome='true']", Gm = "[data-mesurer-measurement-label='true']", Km = 20, qm = .75, Jm = "data-mesurer-symmetric-measurement-spacing", Ym = "mesurerSymmetricCardOffsetY", Xm = (e) => ({
12820
+ var Hm = "[data-mesurer-text-editor='true']", Um = "[data-mesurer-text-edit-ring='true']", Wm = "[data-mesurer-text-inspector-info='true']", Gm = "[data-mesurer-text-inspector-placement-shell='true']", Km = "[data-mesurer-measurement='true']", qm = "[data-mesurer-measurement-chrome='true']", Jm = "[data-mesurer-measurement-label='true']", Ym = 20, Xm = .75, Zm = "data-mesurer-symmetric-measurement-spacing", Qm = "mesurerSymmetricCardOffsetY", $m = (e) => ({
12813
12821
  left: e.left,
12814
12822
  top: e.top,
12815
12823
  right: e.right,
12816
12824
  bottom: e.bottom,
12817
12825
  width: e.width,
12818
12826
  height: e.height
12819
- }), Zm = (e, t) => Math.abs(e.left - t.left) + Math.abs(e.top - t.top) + Math.abs(e.width - t.width) + Math.abs(e.height - t.height), Qm = (e) => ({
12827
+ }), eh = (e, t) => Math.abs(e.left - t.left) + Math.abs(e.top - t.top) + Math.abs(e.width - t.width) + Math.abs(e.height - t.height), th = (e) => ({
12820
12828
  left: e.left,
12821
12829
  top: e.bottom + 2,
12822
12830
  right: e.right,
12823
- bottom: e.bottom + 2 + Km,
12831
+ bottom: e.bottom + 2 + Ym,
12824
12832
  width: e.width,
12825
- height: Km
12826
- }), $m = (e, t, n) => e.style.getPropertyValue(t) !== n && (e.style.setProperty(t, n), !0);
12827
- function eh(e, t, n = t.portalTarget) {
12833
+ height: Ym
12834
+ }), nh = (e, t, n) => e.style.getPropertyValue(t) !== n && (e.style.setProperty(t, n), !0);
12835
+ function rh(e, t, n = t.portalTarget) {
12828
12836
  let { ownerDocument: r, ownerWindow: i, portalTarget: a } = t, o = i, s = a.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), c = s.item(s.length - 1);
12829
12837
  if (!c) return;
12830
12838
  let l = /* @__PURE__ */ new Set(), u = null, d = null, f = null, p = null, m = !1, h = 0, g = !1, _ = (e) => {
12831
- e instanceof o.HTMLTextAreaElement && e.matches(zm) && (u = e), e.matches(Bm) && (d = e), e.matches(Hm) && (f = e), e.matches(Vm) && (p = e), e.matches(Gm) && l.add(e);
12839
+ e instanceof o.HTMLTextAreaElement && e.matches(Hm) && (u = e), e.matches(Um) && (d = e), e.matches(Gm) && (f = e), e.matches(Wm) && (p = e), e.matches(Jm) && l.add(e);
12832
12840
  }, v = (e) => {
12833
- if (e instanceof o.HTMLElement && (_(e), e === c || e.matches(`${Um}, [data-mesurer-text-edit-runtime='true'], [data-mesurer-root='true']`))) for (let t of [
12834
- zm,
12835
- Bm,
12841
+ if (e instanceof o.HTMLElement && (_(e), e === c || e.matches(`${Km}, [data-mesurer-text-edit-runtime='true'], [data-mesurer-root='true']`))) for (let t of [
12836
12842
  Hm,
12837
- Vm,
12838
- Gm
12843
+ Um,
12844
+ Gm,
12845
+ Wm,
12846
+ Jm
12839
12847
  ]) for (let n of e.querySelectorAll(t)) _(n);
12840
12848
  }, y = (e) => {
12841
- for (let t of e.querySelectorAll(Um)) v(t);
12849
+ for (let t of e.querySelectorAll(Km)) v(t);
12842
12850
  };
12843
12851
  v(c), y(a), n !== a && y(n);
12844
12852
  let b = (e) => {
@@ -12848,27 +12856,27 @@ function eh(e, t, n = t.portalTarget) {
12848
12856
  l.delete(n);
12849
12857
  continue;
12850
12858
  }
12851
- let r = n.closest(Um);
12859
+ let r = n.closest(Km);
12852
12860
  if (!(r instanceof o.HTMLElement) || r.getAttribute("data-mesurer-selected-measurement") !== "true") continue;
12853
- let i = Xm(n.getBoundingClientRect());
12861
+ let i = $m(n.getBoundingClientRect());
12854
12862
  if (i.width <= 0 || i.height <= 0) continue;
12855
- let a = r.querySelector(Wm), s = a?.isConnected ? Xm(a.getBoundingClientRect()) : null, c = e.bottom + 2, u = e.left + e.width / 2, d = i.left + i.width / 2, f = s && s.width > 0 && s.height > 0 ? Zm(s, e) : Math.abs(i.top - c) + Math.abs(d - u);
12863
+ let a = r.querySelector(qm), s = a?.isConnected ? $m(a.getBoundingClientRect()) : null, c = e.bottom + 2, u = e.left + e.width / 2, d = i.left + i.width / 2, f = s && s.width > 0 && s.height > 0 ? eh(s, e) : Math.abs(i.top - c) + Math.abs(d - u);
12856
12864
  f > 32 || (!t || f < t.score) && (t = {
12857
12865
  rect: i,
12858
12866
  score: f
12859
12867
  });
12860
12868
  }
12861
- return t?.rect ?? Qm(e);
12869
+ return t?.rect ?? th(e);
12862
12870
  }, x = () => {
12863
12871
  if (g || !u?.isConnected || !d?.isConnected || !f?.isConnected || !p?.isConnected) return;
12864
- let e = Xm(d.getBoundingClientRect());
12872
+ let e = $m(d.getBoundingClientRect());
12865
12873
  if (e.width <= 0 || e.height <= 0 || !(e.right > 0 && e.bottom > 0 && e.left < i.innerWidth && e.top < i.innerHeight)) return;
12866
- let t = Xm(p.getBoundingClientRect());
12874
+ let t = $m(p.getBoundingClientRect());
12867
12875
  if (t.width <= 0 || t.height <= 0 || t.top < e.bottom) return;
12868
12876
  let n = b(e), r = n.top - e.bottom, a = t.top - n.bottom, o = a - r;
12869
- if (f.setAttribute(Jm, "true"), f.dataset.mesurerSymmetricSourceGap = r.toFixed(3), f.dataset.mesurerSymmetricTypographyGap = a.toFixed(3), Math.abs(o) <= qm) return;
12870
- let s = Number.parseFloat(p.dataset[Ym] ?? "0"), c = (Number.isFinite(s) ? s : 0) - o;
12871
- p.dataset[Ym] = c.toFixed(3), $m(p, "translate", `0px ${c}px`);
12877
+ if (f.setAttribute(Zm, "true"), f.dataset.mesurerSymmetricSourceGap = r.toFixed(3), f.dataset.mesurerSymmetricTypographyGap = a.toFixed(3), Math.abs(o) <= Xm) return;
12878
+ let s = Number.parseFloat(p.dataset[Qm] ?? "0"), c = (Number.isFinite(s) ? s : 0) - o;
12879
+ p.dataset[Qm] = c.toFixed(3), nh(p, "translate", `0px ${c}px`);
12872
12880
  }, S = () => {
12873
12881
  g || m || (m = !0, i.queueMicrotask(() => {
12874
12882
  m = !1, !h && (h = i.requestAnimationFrame(() => {
@@ -12883,7 +12891,7 @@ function eh(e, t, n = t.portalTarget) {
12883
12891
  t = !0;
12884
12892
  continue;
12885
12893
  }
12886
- n.target instanceof o.HTMLElement && n.target.matches(Hm) && (_(n.target), t = !0);
12894
+ n.target instanceof o.HTMLElement && n.target.matches(Gm) && (_(n.target), t = !0);
12887
12895
  }
12888
12896
  t && S();
12889
12897
  });
@@ -12899,7 +12907,7 @@ function eh(e, t, n = t.portalTarget) {
12899
12907
  });
12900
12908
  let w = new o.MutationObserver((e) => {
12901
12909
  let t = !1;
12902
- for (let n of e) for (let e of n.addedNodes) e instanceof o.HTMLElement && e.matches(`${Um}, [data-mesurer-root='true']`) && (v(e), t = !0);
12910
+ for (let n of e) for (let e of n.addedNodes) e instanceof o.HTMLElement && e.matches(`${Km}, [data-mesurer-root='true']`) && (v(e), t = !0);
12903
12911
  t && S();
12904
12912
  }), T = /* @__PURE__ */ new Set(), E = (e, t) => {
12905
12913
  T.has(e) || e === c || (T.add(e), w.observe(e, {
@@ -12908,10 +12916,10 @@ function eh(e, t, n = t.portalTarget) {
12908
12916
  }));
12909
12917
  };
12910
12918
  E(a, a !== r.body), n !== a && E(n, !0), r.body && E(r.body, !1), i.addEventListener("resize", S, !0), i.addEventListener("dblclick", S, !0), S(), e.lifecycle.onDispose(() => {
12911
- g = !0, C.disconnect(), w.disconnect(), i.removeEventListener("resize", S, !0), i.removeEventListener("dblclick", S, !0), h && i.cancelAnimationFrame(h), l.clear(), f?.removeAttribute(Jm), p && (p.style.removeProperty("translate"), delete p.dataset[Ym]);
12919
+ g = !0, C.disconnect(), w.disconnect(), i.removeEventListener("resize", S, !0), i.removeEventListener("dblclick", S, !0), h && i.cancelAnimationFrame(h), l.clear(), f?.removeAttribute(Zm), p && (p.style.removeProperty("translate"), delete p.dataset[Qm]);
12912
12920
  });
12913
12921
  }
12914
- var th = (e, t) => {
12922
+ var ih = (e, t) => {
12915
12923
  let n = {
12916
12924
  document: e.document,
12917
12925
  location: e.location,
@@ -12948,8 +12956,8 @@ var th = (e, t) => {
12948
12956
  requestAnimationFrame: t
12949
12957
  };
12950
12958
  return Object.defineProperties(Object.create(null), Object.getOwnPropertyDescriptors(n));
12951
- }, nh = (e, t) => {
12952
- let n = t.ownerWindow, r = !1, i = !1, a = null, o = th(n, (e) => n.requestAnimationFrame((t) => {
12959
+ }, ah = (e, t) => {
12960
+ let n = t.ownerWindow, r = !1, i = !1, a = null, o = ih(n, (e) => n.requestAnimationFrame((t) => {
12953
12961
  r = !0;
12954
12962
  try {
12955
12963
  e(t);
@@ -12983,7 +12991,7 @@ var th = (e, t) => {
12983
12991
  currentToolMode: s,
12984
12992
  createInspectorMount: c
12985
12993
  };
12986
- }, rh = "#f8fafc", ih = "#f1f5f9", ah = "#e2e8f0", oh = "#64748b", sh = "#334155", ch = "#0f172a", lh = "#0d99ff", uh = 8, dh = 8, fh = (e, t) => {
12994
+ }, oh = "#f8fafc", sh = "#f1f5f9", ch = "#e2e8f0", lh = "#64748b", uh = "#334155", dh = "#0f172a", fh = "#0d99ff", ph = 8, mh = 8, hh = (e, t) => {
12987
12995
  let n = /* @__PURE__ */ new Map(), r = Array.from(e.children).filter((e) => e instanceof t.HTMLElement);
12988
12996
  for (let e = 0; e + 1 < r.length; e += 2) {
12989
12997
  let t = r[e], i = r[e + 1], a = t.textContent?.trim();
@@ -12993,8 +13001,8 @@ var th = (e, t) => {
12993
13001
  });
12994
13002
  }
12995
13003
  return n;
12996
- }, ph = (e) => Array.from(e.querySelectorAll("span")).map((e) => e.textContent?.trim() ?? "").find((e) => e.startsWith("--")) ?? null;
12997
- function mh(e, t) {
13004
+ }, gh = (e) => Array.from(e.querySelectorAll("span")).map((e) => e.textContent?.trim() ?? "").find((e) => e.startsWith("--")) ?? null;
13005
+ function _h(e, t) {
12998
13006
  let { ownerDocument: n, ownerWindow: r, portalTarget: i } = t, a = r, o = i.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), s = o.item(o.length - 1);
12999
13007
  if (!s) return;
13000
13008
  let c = !1, l = !1, u = 0, d = 0, f = null, p = () => {
@@ -13048,28 +13056,28 @@ function mh(e, t) {
13048
13056
  });
13049
13057
  let o = n.getBoundingClientRect(), l = e.getBoundingClientRect();
13050
13058
  if (l.width <= 0 || l.height <= 0) return;
13051
- let u = l.width, d = l.height, f = r.innerWidth - uh, p = r.innerHeight - uh, m = Math.max(uh, f - u), g = Math.max(uh, p - d), _ = Math.min(Math.max(o.left + o.width / 2 - u / 2, uh), m), v = Math.min(Math.max(o.top + o.height / 2 - d / 2, uh), g), y = [
13059
+ let u = l.width, d = l.height, f = r.innerWidth - ph, p = r.innerHeight - ph, m = Math.max(ph, f - u), g = Math.max(ph, p - d), _ = Math.min(Math.max(o.left + o.width / 2 - u / 2, ph), m), v = Math.min(Math.max(o.top + o.height / 2 - d / 2, ph), g), y = [
13052
13060
  {
13053
13061
  left: _,
13054
- top: o.top - dh - d,
13062
+ top: o.top - mh - d,
13055
13063
  placement: "above"
13056
13064
  },
13057
13065
  {
13058
13066
  left: _,
13059
- top: o.bottom + dh,
13067
+ top: o.bottom + mh,
13060
13068
  placement: "below"
13061
13069
  },
13062
13070
  {
13063
- left: o.right + dh,
13071
+ left: o.right + mh,
13064
13072
  top: v,
13065
13073
  placement: "side"
13066
13074
  },
13067
13075
  {
13068
- left: o.left - dh - u,
13076
+ left: o.left - mh - u,
13069
13077
  top: v,
13070
13078
  placement: "side"
13071
13079
  }
13072
- ], b = (e, t) => e >= uh && t >= uh && e + u <= f && t + d <= p, x = (e, t) => {
13080
+ ], b = (e, t) => e >= ph && t >= ph && e + u <= f && t + d <= p, x = (e, t) => {
13073
13081
  let n = Math.max(0, Math.min(e + u, o.right) - Math.max(e, o.left)), r = Math.max(0, Math.min(t + d, o.bottom) - Math.max(t, o.top));
13074
13082
  return n > 0 && r > 0;
13075
13083
  }, S = y.find((e) => b(e.left, e.top) && !x(e.left, e.top));
@@ -13079,18 +13087,18 @@ function mh(e, t) {
13079
13087
  }
13080
13088
  let C = [{
13081
13089
  name: "above",
13082
- top: uh,
13083
- height: Math.max(0, o.top - dh - uh)
13090
+ top: ph,
13091
+ height: Math.max(0, o.top - mh - ph)
13084
13092
  }, {
13085
13093
  name: "below",
13086
- top: o.bottom + dh,
13087
- height: Math.max(0, p - o.bottom - dh)
13094
+ top: o.bottom + mh,
13095
+ height: Math.max(0, p - o.bottom - mh)
13088
13096
  }].sort((e, t) => t.height - e.height)[0];
13089
13097
  if (C && C.height > 0) {
13090
13098
  e.style.maxHeight = `${C.height}px`, a.style.left = `${_}px`, a.style.top = `${C.top}px`, e.dataset.mesurerTextInspectorPlacement = C.name;
13091
13099
  return;
13092
13100
  }
13093
- a.style.left = `${_}px`, a.style.top = `${uh}px`, e.dataset.mesurerTextInspectorPlacement = "viewport";
13101
+ a.style.left = `${_}px`, a.style.top = `${ph}px`, e.dataset.mesurerTextInspectorPlacement = "viewport";
13094
13102
  }, v = () => {
13095
13103
  c || u || (u = r.requestAnimationFrame(() => {
13096
13104
  u = 0, _();
@@ -13106,16 +13114,16 @@ function mh(e, t) {
13106
13114
  boxSizing: "border-box",
13107
13115
  border: "1px solid transparent",
13108
13116
  borderRadius: "5px",
13109
- background: rh,
13110
- color: sh,
13117
+ background: oh,
13118
+ color: uh,
13111
13119
  outline: "none",
13112
13120
  transition: "border-color 120ms ease, box-shadow 120ms ease, background 120ms ease"
13113
13121
  }), e.addEventListener("mouseenter", () => {
13114
- e.style.borderColor = ah;
13122
+ e.style.borderColor = ch;
13115
13123
  }), e.addEventListener("mouseleave", () => {
13116
13124
  n.activeElement !== e && (e.style.borderColor = "transparent");
13117
13125
  }), e.addEventListener("focus", () => {
13118
- e.style.borderColor = "transparent", e.style.boxShadow = `inset 0 0 0 1px ${lh}`;
13126
+ e.style.borderColor = "transparent", e.style.boxShadow = `inset 0 0 0 1px ${fh}`;
13119
13127
  }), e.addEventListener("blur", () => {
13120
13128
  e.style.boxShadow = "none", e.style.borderColor = "transparent";
13121
13129
  });
@@ -13128,7 +13136,7 @@ function mh(e, t) {
13128
13136
  height: "28px",
13129
13137
  border: "1px solid transparent",
13130
13138
  borderRadius: "5px",
13131
- background: rh,
13139
+ background: oh,
13132
13140
  transition: "border-color 120ms ease, box-shadow 120ms ease, background 120ms ease"
13133
13141
  }), Object.assign(e.style, {
13134
13142
  appearance: "none",
@@ -13140,7 +13148,7 @@ function mh(e, t) {
13140
13148
  border: "0",
13141
13149
  borderRadius: "5px",
13142
13150
  background: "transparent",
13143
- color: sh,
13151
+ color: uh,
13144
13152
  font: "500 11px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
13145
13153
  padding: "0 27px 0 8px",
13146
13154
  outline: "none",
@@ -13153,17 +13161,17 @@ function mh(e, t) {
13153
13161
  top: "8px",
13154
13162
  width: "7px",
13155
13163
  height: "7px",
13156
- borderRight: `1.5px solid ${oh}`,
13157
- borderBottom: `1.5px solid ${oh}`,
13164
+ borderRight: `1.5px solid ${lh}`,
13165
+ borderBottom: `1.5px solid ${lh}`,
13158
13166
  transform: "rotate(45deg)",
13159
13167
  transformOrigin: "center",
13160
13168
  pointerEvents: "none"
13161
13169
  }), t.addEventListener("mouseenter", () => {
13162
- t.style.borderColor = ah;
13170
+ t.style.borderColor = ch;
13163
13171
  }), t.addEventListener("mouseleave", () => {
13164
13172
  n.activeElement !== e && (t.style.borderColor = "transparent");
13165
13173
  }), e.addEventListener("focus", () => {
13166
- t.style.borderColor = "transparent", t.style.boxShadow = `inset 0 0 0 1px ${lh}`;
13174
+ t.style.borderColor = "transparent", t.style.boxShadow = `inset 0 0 0 1px ${fh}`;
13167
13175
  }), e.addEventListener("blur", () => {
13168
13176
  t.style.boxShadow = "none", t.style.borderColor = "transparent";
13169
13177
  }), t.append(e, r), t;
@@ -13180,18 +13188,18 @@ function mh(e, t) {
13180
13188
  Object.assign(e.style, {
13181
13189
  width: "28px",
13182
13190
  height: "28px",
13183
- border: `1px solid ${t ? lh : "transparent"}`,
13191
+ border: `1px solid ${t ? fh : "transparent"}`,
13184
13192
  borderRadius: "5px",
13185
- background: t ? "rgba(13, 153, 255, 0.10)" : rh,
13186
- color: ch,
13193
+ background: t ? "rgba(13, 153, 255, 0.10)" : oh,
13194
+ color: dh,
13187
13195
  padding: "0",
13188
13196
  fontSize: "12px",
13189
13197
  cursor: "pointer",
13190
13198
  transition: "border-color 120ms ease, background 120ms ease"
13191
13199
  }), e.addEventListener("mouseenter", () => {
13192
- t || (e.style.borderColor = ah);
13200
+ t || (e.style.borderColor = ch);
13193
13201
  }), e.addEventListener("mouseleave", () => {
13194
- e.style.borderColor = t ? lh : "transparent";
13202
+ e.style.borderColor = t ? fh : "transparent";
13195
13203
  });
13196
13204
  }, T = (e) => {
13197
13205
  Object.assign(e.style, {
@@ -13217,10 +13225,10 @@ function mh(e, t) {
13217
13225
  height: "28px",
13218
13226
  border: "1px solid transparent",
13219
13227
  borderRadius: "5px",
13220
- background: rh,
13228
+ background: oh,
13221
13229
  padding: "3px"
13222
13230
  }), n.addEventListener("mouseenter", () => {
13223
- n.style.borderColor = ah;
13231
+ n.style.borderColor = ch;
13224
13232
  }), n.addEventListener("mouseleave", () => {
13225
13233
  n.style.borderColor = "transparent";
13226
13234
  }));
@@ -13231,17 +13239,17 @@ function mh(e, t) {
13231
13239
  height: "28px",
13232
13240
  border: "1px solid transparent",
13233
13241
  borderRadius: "5px",
13234
- background: rh,
13235
- color: sh,
13242
+ background: oh,
13243
+ color: uh,
13236
13244
  padding: "0 8px",
13237
13245
  font: "500 11px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
13238
13246
  transition: "border-color 120ms ease, box-shadow 120ms ease, background 120ms ease"
13239
13247
  }), e.addEventListener("mouseenter", () => {
13240
- e.style.borderColor = ah;
13248
+ e.style.borderColor = ch;
13241
13249
  }), e.addEventListener("mouseleave", () => {
13242
13250
  e.style.borderColor = "transparent";
13243
13251
  }), e.addEventListener("focus", () => {
13244
- e.style.boxShadow = `inset 0 0 0 1px ${lh}`;
13252
+ e.style.boxShadow = `inset 0 0 0 1px ${fh}`;
13245
13253
  }), e.addEventListener("blur", () => {
13246
13254
  e.style.boxShadow = "none";
13247
13255
  });
@@ -13269,7 +13277,7 @@ function mh(e, t) {
13269
13277
  if (!n) return;
13270
13278
  let r = e.get(t);
13271
13279
  if (!r) return;
13272
- let i = ph(r.value);
13280
+ let i = gh(r.value);
13273
13281
  r.value.replaceChildren(D(n, i)), Object.assign(r.value.style, {
13274
13282
  overflow: "visible",
13275
13283
  textOverflow: "clip",
@@ -13280,7 +13288,7 @@ function mh(e, t) {
13280
13288
  if (!r) return;
13281
13289
  let i = n.createElement("span");
13282
13290
  i.textContent = t, i.dataset.mesurerUnifiedTextRow = "true", Object.assign(i.style, {
13283
- color: oh,
13291
+ color: lh,
13284
13292
  fontSize: "11px",
13285
13293
  alignSelf: "center"
13286
13294
  });
@@ -13321,7 +13329,7 @@ function mh(e, t) {
13321
13329
  let o = i.children.item(1);
13322
13330
  if (!(o instanceof a.HTMLElement)) return;
13323
13331
  if (t.querySelector("[data-mesurer-text-style-menu-button='true']")) for (let e of i.querySelectorAll("[data-mesurer-unified-text-row='true'], [data-mesurer-unified-text-presets='true']")) e.remove();
13324
- let c = fh(o, a);
13332
+ let c = hh(o, a);
13325
13333
  i.dataset.mesurerTextInspectorUnified = "true", i.setAttribute("aria-label", "Typography editor"), i.removeAttribute("aria-hidden"), i.style.removeProperty("visibility"), Object.assign(i.style, {
13326
13334
  pointerEvents: "auto",
13327
13335
  position: "static",
@@ -13366,7 +13374,7 @@ function mh(e, t) {
13366
13374
  gap: "3px",
13367
13375
  marginTop: "9px",
13368
13376
  paddingTop: "8px",
13369
- borderTop: `1px solid ${ih}`
13377
+ borderTop: `1px solid ${sh}`
13370
13378
  });
13371
13379
  for (let t of Array.from(r.querySelectorAll("[data-mesurer-text-style-preset]"))) t.style.width = "100%", t.style.minHeight = "34px", e.append(t);
13372
13380
  e.childElementCount && i.append(e);
@@ -13389,8 +13397,8 @@ function mh(e, t) {
13389
13397
  c = !0, P.disconnect(), u && r.cancelAnimationFrame(u), d && r.clearTimeout(d), s.removeEventListener("click", A, !0), s.removeEventListener("change", j, !0), s.removeEventListener("keydown", M, !0), r.removeEventListener("resize", v), r.removeEventListener("scroll", y, !0), g();
13390
13398
  });
13391
13399
  }
13392
- var hh = 4, gh = 4, _h = 220, vh = 60, yh = (e, t, n) => Math.min(Math.max(e, t), n);
13393
- function bh(e, t) {
13400
+ var vh = 4, yh = 4, bh = 220, xh = 60, Sh = (e, t, n) => Math.min(Math.max(e, t), n);
13401
+ function Ch(e, t) {
13394
13402
  let { ownerWindow: n, portalTarget: r } = t, i = n, a = (e) => {
13395
13403
  if (e.key !== "Escape") return;
13396
13404
  let t = e.composedPath().find((e) => e instanceof i.HTMLElement && e.dataset.mesurerUnifiedSelectPopup === "true"), n = t instanceof i.HTMLElement ? t : r.querySelector("[data-mesurer-unified-select-popup='true']");
@@ -13404,7 +13412,7 @@ function bh(e, t) {
13404
13412
  n.removeEventListener("keydown", a, !0);
13405
13413
  });
13406
13414
  }
13407
- function xh(e, t) {
13415
+ function wh(e, t) {
13408
13416
  let { ownerDocument: n, ownerWindow: r, portalTarget: i } = t, a = r, o = i.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), s = o.item(o.length - 1);
13409
13417
  if (!s) return;
13410
13418
  let c = !1, l = !1, u = 0, d = null, f = /* @__PURE__ */ new Map(), p = (e) => {
@@ -13435,10 +13443,10 @@ function xh(e, t) {
13435
13443
  e.style.position = "absolute", e.style.inset = "auto", e.style.margin = "0", e.style.pointerEvents = "auto", e.style.zIndex = "2147483647", e.style.transform = "none";
13436
13444
  let s = Math.max(1, o.width - 8), c = Math.min(Math.max(i.width, 120), s);
13437
13445
  e.style.width = `${c}px`, e.style.maxWidth = `${s}px`;
13438
- let l = Math.max(1, o.height - 8), u = Math.min(_h, Math.max(vh, e.scrollHeight)), d = Math.min(u, l);
13446
+ let l = Math.max(1, o.height - 8), u = Math.min(bh, Math.max(xh, e.scrollHeight)), d = Math.min(u, l);
13439
13447
  e.style.maxHeight = `${d}px`;
13440
- let m = o.left - a.left, h = o.top - a.top, g = i.left - a.left, _ = i.top - a.top, v = i.bottom - a.top, y = Math.max(0, _ - h - hh - gh), b = o.bottom - a.top, x = Math.max(0, b - v - hh - gh), S = x >= d || x >= y ? v + hh : _ - hh - d, C = m + gh, w = Math.max(C, m + o.width - gh - c), T = h + gh, E = Math.max(T, h + o.height - gh - d);
13441
- e.style.left = `${yh(g, C, w)}px`, e.style.top = `${yh(S, T, E)}px`, f.set(e, {
13448
+ let m = o.left - a.left, h = o.top - a.top, g = i.left - a.left, _ = i.top - a.top, v = i.bottom - a.top, y = Math.max(0, _ - h - vh - yh), b = o.bottom - a.top, x = Math.max(0, b - v - vh - yh), S = x >= d || x >= y ? v + vh : _ - vh - d, C = m + yh, w = Math.max(C, m + o.width - yh - c), T = h + yh, E = Math.max(T, h + o.height - yh - d);
13449
+ e.style.left = `${Sh(g, C, w)}px`, e.style.top = `${Sh(S, T, E)}px`, f.set(e, {
13442
13450
  left: n.scrollLeft,
13443
13451
  top: n.scrollTop
13444
13452
  });
@@ -13473,8 +13481,8 @@ function xh(e, t) {
13473
13481
  c = !0, b.disconnect(), u && r.cancelAnimationFrame(u), r.removeEventListener("resize", y), g(null);
13474
13482
  });
13475
13483
  }
13476
- var Sh = "#f8fafc", Ch = "#f1f5f9", wh = "#e2e8f0", Th = "#64748b", Eh = "#334155", Dh = "#0f172a", Oh = "#0d99ff", kh = 8, Ah = 4;
13477
- function jh(e, t) {
13484
+ var Th = "#f8fafc", Eh = "#f1f5f9", Dh = "#e2e8f0", Oh = "#64748b", kh = "#334155", Ah = "#0f172a", jh = "#0d99ff", Mh = 8, Nh = 4;
13485
+ function Ph(e, t) {
13478
13486
  let { ownerDocument: n, ownerWindow: r, portalTarget: i } = t, a = r, o = i.querySelectorAll("[data-mesurer-text-edit-runtime='true']"), s = o.item(o.length - 1);
13479
13487
  if (!s) return;
13480
13488
  let c = !1, l = !1, u = null, d = (e = !1) => {
@@ -13490,8 +13498,8 @@ function jh(e, t) {
13490
13498
  }
13491
13499
  let e = u.trigger.getBoundingClientRect(), t = u.popup.getBoundingClientRect(), n = Math.max(e.width, Math.min(260, t.width || e.width));
13492
13500
  u.popup.style.width = `${n}px`;
13493
- let i = u.popup.getBoundingClientRect(), a = r.innerWidth - kh, o = r.innerHeight - kh, s = Math.max(kh, a - i.width), c = Math.min(Math.max(e.left, kh), s), l = e.bottom + Ah, f = e.top - Ah - i.height, p = l + i.height <= o || f < kh ? Math.min(l, Math.max(kh, o - i.height)) : f;
13494
- u.popup.style.left = `${c}px`, u.popup.style.top = `${Math.max(kh, p)}px`;
13501
+ let i = u.popup.getBoundingClientRect(), a = r.innerWidth - Mh, o = r.innerHeight - Mh, s = Math.max(Mh, a - i.width), c = Math.min(Math.max(e.left, Mh), s), l = e.bottom + Nh, f = e.top - Nh - i.height, p = l + i.height <= o || f < Mh ? Math.min(l, Math.max(Mh, o - i.height)) : f;
13502
+ u.popup.style.left = `${c}px`, u.popup.style.top = `${Math.max(Mh, p)}px`;
13495
13503
  }, p = (e) => {
13496
13504
  let t = n.createElement("button");
13497
13505
  t.type = "button", t.dataset.mesurerUnifiedSelectOption = e.key, t.setAttribute("role", "option"), t.setAttribute("aria-selected", e.selected ? "true" : "false"), t.disabled = e.disabled, Object.assign(t.style, {
@@ -13504,8 +13512,8 @@ function jh(e, t) {
13504
13512
  boxSizing: "border-box",
13505
13513
  border: "0",
13506
13514
  borderRadius: "5px",
13507
- background: e.selected ? Ch : "transparent",
13508
- color: e.disabled ? Th : Dh,
13515
+ background: e.selected ? Eh : "transparent",
13516
+ color: e.disabled ? Oh : Ah,
13509
13517
  padding: "0 9px",
13510
13518
  textAlign: "left",
13511
13519
  font: `${e.selected ? "600" : "500"} 11px/1.2 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,
@@ -13523,15 +13531,15 @@ function jh(e, t) {
13523
13531
  let r = n.createElement("span");
13524
13532
  r.textContent = e.shortcut, Object.assign(r.style, {
13525
13533
  flex: "0 0 auto",
13526
- color: Th,
13534
+ color: Oh,
13527
13535
  font: "500 10px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
13528
13536
  whiteSpace: "nowrap"
13529
13537
  }), t.append(r);
13530
13538
  }
13531
13539
  return t.addEventListener("mouseenter", () => {
13532
- e.disabled || (t.style.background = e.selected ? Ch : Sh);
13540
+ e.disabled || (t.style.background = e.selected ? Eh : Th);
13533
13541
  }), t.addEventListener("mouseleave", () => {
13534
- t.style.background = e.selected ? Ch : "transparent";
13542
+ t.style.background = e.selected ? Eh : "transparent";
13535
13543
  }), t.addEventListener("click", () => {
13536
13544
  e.disabled || (e.activate(), d());
13537
13545
  }), t.addEventListener("keydown", (e) => {
@@ -13561,7 +13569,7 @@ function jh(e, t) {
13561
13569
  maxHeight: "220px",
13562
13570
  overflowY: "auto",
13563
13571
  boxSizing: "border-box",
13564
- border: `1px solid ${wh}`,
13572
+ border: `1px solid ${Dh}`,
13565
13573
  borderRadius: "8px",
13566
13574
  background: "#ffffff",
13567
13575
  padding: "4px",
@@ -13571,7 +13579,7 @@ function jh(e, t) {
13571
13579
  for (let e of r) i.append(p(e));
13572
13580
  s.append(i), e.setAttribute("aria-expanded", "true"), t?.style.setProperty("transform", "rotate(225deg)");
13573
13581
  let a = e.closest("[data-mesurer-unified-select-shell='true'], [data-mesurer-unified-style-shell='true']");
13574
- a && (a.style.borderColor = "transparent", a.style.boxShadow = `inset 0 0 0 1px ${Oh}`), u = {
13582
+ a && (a.style.borderColor = "transparent", a.style.boxShadow = `inset 0 0 0 1px ${jh}`), u = {
13575
13583
  popup: i,
13576
13584
  trigger: e,
13577
13585
  chevron: t
@@ -13587,14 +13595,14 @@ function jh(e, t) {
13587
13595
  border: "0",
13588
13596
  borderRadius: "5px",
13589
13597
  background: "transparent",
13590
- color: Eh,
13598
+ color: kh,
13591
13599
  padding: "0 28px 0 8px",
13592
13600
  textAlign: "left",
13593
13601
  font: "500 11px/1 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",
13594
13602
  cursor: "pointer",
13595
13603
  outline: "none"
13596
13604
  }), e.addEventListener("focus", () => {
13597
- t.style.borderColor = "transparent", t.style.boxShadow = `inset 0 0 0 1px ${Oh}`;
13605
+ t.style.borderColor = "transparent", t.style.boxShadow = `inset 0 0 0 1px ${jh}`;
13598
13606
  }), e.addEventListener("blur", () => {
13599
13607
  u?.trigger !== e && (t.style.boxShadow = "none");
13600
13608
  });
@@ -13660,12 +13668,12 @@ function jh(e, t) {
13660
13668
  boxSizing: "border-box",
13661
13669
  border: "1px solid transparent",
13662
13670
  borderRadius: "5px",
13663
- background: Sh,
13671
+ background: Th,
13664
13672
  transition: "border-color 120ms ease, box-shadow 120ms ease, background 120ms ease"
13665
13673
  });
13666
13674
  let a = n.createElement("button");
13667
13675
  a.type = "button", a.dataset.mesurerUnifiedSelectTrigger = "style", a.dataset.mesurerTextStyleMenuButton = "true", a.setAttribute("aria-haspopup", "listbox"), a.setAttribute("aria-expanded", "false"), a.setAttribute("aria-label", "Text style"), h(a, i), i.addEventListener("mouseenter", () => {
13668
- i.style.borderColor = wh;
13676
+ i.style.borderColor = Dh;
13669
13677
  }), i.addEventListener("mouseleave", () => {
13670
13678
  u?.trigger !== a && n.activeElement !== a && (i.style.borderColor = "transparent");
13671
13679
  });
@@ -13677,8 +13685,8 @@ function jh(e, t) {
13677
13685
  top: "8px",
13678
13686
  width: "7px",
13679
13687
  height: "7px",
13680
- borderRight: `1.5px solid ${Th}`,
13681
- borderBottom: `1.5px solid ${Th}`,
13688
+ borderRight: `1.5px solid ${Oh}`,
13689
+ borderBottom: `1.5px solid ${Oh}`,
13682
13690
  transform: "rotate(45deg)",
13683
13691
  transformOrigin: "center",
13684
13692
  pointerEvents: "none"
@@ -13739,22 +13747,22 @@ function jh(e, t) {
13739
13747
  c = !0, x.disconnect(), d(), r.removeEventListener("pointerdown", y, !0), r.removeEventListener("resize", b);
13740
13748
  });
13741
13749
  }
13742
- function Mh(e, t) {
13750
+ function Fh(e, t) {
13743
13751
  op(e, t);
13744
13752
  let { runtime: n } = tp(t);
13745
- jm(e, n), bh(e, n), Rp(e, nh(e, n)), Cm(e, n), mh(e, n), Rm(e, n, t.portalTarget), Up(e, n, t), Mm(e, n), jh(e, n), xh(e, n), $f(e, n), lp(e, n), hm(e, n, t.portalTarget), eh(e, n, t.portalTarget);
13753
+ Pm(e, n), Ch(e, n), Hp(e, ah(e, n)), Dm(e, n), _h(e, n), Vm(e, n, t.portalTarget), qp(e, n, t), Fm(e, n), Ph(e, n), wh(e, n), $f(e, n), lp(e, n), ym(e, n, t.portalTarget), rh(e, n, t.portalTarget);
13746
13754
  }
13747
- var Nh = 1, Ph = (e, t) => {
13755
+ var Ih = 1, Lh = (e, t) => {
13748
13756
  if (!t) return [];
13749
13757
  try {
13750
13758
  let n = e.sessionStorage.getItem(t);
13751
13759
  if (!n) return [];
13752
13760
  let r = JSON.parse(n);
13753
- return r.version !== Nh || !Array.isArray(r.annotations) ? [] : r.annotations.map(Fh);
13761
+ return r.version !== Ih || !Array.isArray(r.annotations) ? [] : r.annotations.map(Rh);
13754
13762
  } catch {
13755
13763
  return [];
13756
13764
  }
13757
- }, Fh = (e) => ({
13765
+ }, Rh = (e) => ({
13758
13766
  ...e,
13759
13767
  anchor: e.anchor.kind === "elements" ? {
13760
13768
  kind: "elements",
@@ -13789,7 +13797,7 @@ var Nh = 1, Ph = (e, t) => {
13789
13797
  vertical: e.vertical ? { ...e.vertical } : null
13790
13798
  }))
13791
13799
  }
13792
- }), Ih = (e, t) => `${t}-${e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`}`, Lh = (e) => {
13800
+ }), zh = (e, t) => `${t}-${e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`}`, Bh = (e) => {
13793
13801
  let t = /* @__PURE__ */ new Set(), n = [];
13794
13802
  for (let r of e.current.selectedMeasurements) {
13795
13803
  let e = r.elementRef;
@@ -13798,8 +13806,8 @@ var Nh = 1, Ph = (e, t) => {
13798
13806
  let r = e.current.selectedMeasurement?.elementRef;
13799
13807
  return r?.isConnected && !t.has(r) && n.push(r), n;
13800
13808
  };
13801
- function Rh(e) {
13802
- let { model: t, ownerDocument: n, ownerWindow: r, uiRoot: i } = e, a = r, o = e.pageTarget ?? n.body ?? n.documentElement, s = o instanceof a.ShadowRoot ? o : o.getRootNode(), c = s instanceof a.ShadowRoot ? s : n, l = o, u = Ph(r, e.persistenceKey), d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = !1, g = 0, _ = null, v = !1, y = (e, t) => `${e}:${t}`, b = (e) => Tl(e, o), x = (e) => {
13809
+ function Vh(e) {
13810
+ let { model: t, ownerDocument: n, ownerWindow: r, uiRoot: i } = e, a = r, o = e.pageTarget ?? n.body ?? n.documentElement, s = o instanceof a.ShadowRoot ? o : o.getRootNode(), c = s instanceof a.ShadowRoot ? s : n, l = o, u = Lh(r, e.persistenceKey), d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = !1, g = 0, _ = null, v = !1, y = (e, t) => `${e}:${t}`, b = (e) => Tl(e, o), x = (e) => {
13803
13811
  let t = [];
13804
13812
  o instanceof a.HTMLElement && o.matches(e) && t.push(o);
13805
13813
  for (let n of c.querySelectorAll(e)) n instanceof a.HTMLElement && b(n) && t.push(n);
@@ -13812,8 +13820,8 @@ function Rh(e) {
13812
13820
  return;
13813
13821
  }
13814
13822
  r.sessionStorage.setItem(t, JSON.stringify({
13815
- version: Nh,
13816
- annotations: u.map(Fh)
13823
+ version: Ih,
13824
+ annotations: u.map(Rh)
13817
13825
  }));
13818
13826
  } catch {}
13819
13827
  }, C = () => {
@@ -13912,12 +13920,12 @@ function Rh(e) {
13912
13920
  }, F = (e, t = []) => (u.push(e), e.anchor.kind === "elements" && e.anchor.targets.forEach((n, r) => {
13913
13921
  let i = t[r], a = y(e.id, n.id);
13914
13922
  i && b(i) && p.set(a, i), m.set(a, !!(i && b(i)));
13915
- }), O(), S(), C(), Fh(e)), I = (e, t) => {
13923
+ }), O(), S(), C(), Rh(e)), I = (e, t) => {
13916
13924
  let n = e.trim();
13917
13925
  if (!n) throw Error("Annotation note cannot be empty.");
13918
13926
  let i = Yi(t);
13919
13927
  return F({
13920
- id: Ih(r, "annotation"),
13928
+ id: zh(r, "annotation"),
13921
13929
  note: n,
13922
13930
  createdAt: Date.now(),
13923
13931
  anchor: {
@@ -13932,14 +13940,14 @@ function Rh(e) {
13932
13940
  }, L = (e) => {
13933
13941
  let n = e.trim();
13934
13942
  if (!n) throw Error("Annotation note cannot be empty.");
13935
- let i = Lh(t).filter(b), a = t.current.selectionOriginRect ? Yi(t.current.selectionOriginRect) : null;
13943
+ let i = Bh(t).filter(b), a = t.current.selectionOriginRect ? Yi(t.current.selectionOriginRect) : null;
13936
13944
  if (!i.length) {
13937
13945
  if (!a) throw Error("Select a page element or drag a region before adding an annotation.");
13938
13946
  return I(n, a);
13939
13947
  }
13940
13948
  let o = i.map(N);
13941
13949
  return F({
13942
- id: Ih(r, "annotation"),
13950
+ id: zh(r, "annotation"),
13943
13951
  note: n,
13944
13952
  createdAt: Date.now(),
13945
13953
  anchor: {
@@ -13969,12 +13977,12 @@ function Rh(e) {
13969
13977
  activeMeasurement: t.current.activeMeasurement,
13970
13978
  heldDistances: [...t.current.heldDistances],
13971
13979
  guides: t.current.guides.map((e) => ({ ...e })),
13972
- annotations: u.map(Fh)
13980
+ annotations: u.map(Rh)
13973
13981
  };
13974
13982
  },
13975
13983
  currentSelection() {
13976
13984
  return {
13977
- elements: Lh(t).filter(b),
13985
+ elements: Bh(t).filter(b),
13978
13986
  region: t.current.selectionOriginRect ? Yi(t.current.selectionOriginRect) : null
13979
13987
  };
13980
13988
  },
@@ -13986,12 +13994,12 @@ function Rh(e) {
13986
13994
  return t.current.hoverElement?.isConnected && b(t.current.hoverElement) ? t.current.hoverElement : null;
13987
13995
  },
13988
13996
  annotations() {
13989
- return u.map(Fh);
13997
+ return u.map(Rh);
13990
13998
  },
13991
13999
  annotation(e) {
13992
14000
  let t = u.find((t) => t.id === e);
13993
14001
  if (!t) return null;
13994
- let n = Fh(t), r = [];
14002
+ let n = Rh(t), r = [];
13995
14003
  if (n.anchor.kind === "elements" && t.anchor.kind === "elements") {
13996
14004
  let e = t.anchor.targets;
13997
14005
  r = n.anchor.targets.map((n, r) => ({
@@ -14057,7 +14065,7 @@ function Rh(e) {
14057
14065
  }
14058
14066
  };
14059
14067
  }
14060
- var zh = [
14068
+ var Hh = [
14061
14069
  "select",
14062
14070
  "xray",
14063
14071
  "color-picker",
@@ -14065,22 +14073,22 @@ var zh = [
14065
14073
  "text-inspector",
14066
14074
  "guides",
14067
14075
  "settings"
14068
- ], Bh = "mesurer-plugin-settings", Vh = 1, Hh = (e) => (e.startsWith("mesurer.") ? e.slice(8) : e).split(/[.-]/g).filter(Boolean).map((e) => e[0]?.toUpperCase() + e.slice(1)).join(" ") || e, Uh = (e) => "create" in e && typeof e.create == "function", Wh = (e) => e === "select" || e === "xray" || e === "color-picker" || e === "rulers" || e === "text-inspector" || e === "guides" || e === "distance" || e === "settings", Gh = (e) => `builtin.${e}`, Kh = (e, t) => {
14076
+ ], Uh = "mesurer-plugin-settings", Wh = 1, Gh = (e) => (e.startsWith("mesurer.") ? e.slice(8) : e).split(/[.-]/g).filter(Boolean).map((e) => e[0]?.toUpperCase() + e.slice(1)).join(" ") || e, Kh = (e) => "create" in e && typeof e.create == "function", qh = (e) => e === "select" || e === "xray" || e === "color-picker" || e === "rulers" || e === "text-inspector" || e === "guides" || e === "distance" || e === "settings", Jh = (e) => `builtin.${e}`, Yh = (e, t) => {
14069
14077
  let n = t.toLowerCase().replaceAll("cmd", "meta").split("+").map((e) => e.trim()).filter(Boolean);
14070
14078
  if (!n.length) return !1;
14071
14079
  let r = n.at(-1), i = new Set(n.slice(0, -1)), a = i.has("mod"), o = i.has("meta"), s = i.has("ctrl") || i.has("control"), c = i.has("shift"), l = i.has("alt") || i.has("option");
14072
14080
  return (a ? !(e.metaKey || e.ctrlKey) : o !== e.metaKey || s !== e.ctrlKey) || c !== e.shiftKey || l !== e.altKey || !a && !o && !s && (e.metaKey || e.ctrlKey) ? !1 : e.key.toLowerCase() === r;
14073
14081
  };
14074
- function qh(e) {
14082
+ function Xh(e) {
14075
14083
  let t = bt(() => e.pluginHost), n = t ?? ha(), r = !t, i = bt(() => e.version ?? "0.1.0"), a = (t) => e.version && t.id.startsWith("mesurer.") ? {
14076
14084
  ...t,
14077
14085
  version: i
14078
14086
  } : t, o = new Set(bt(() => e.excludePlugins ?? [])), s = bt(() => Nf([], e.excludePlugins ?? []).map(a)), c = /* @__PURE__ */ new Map();
14079
14087
  for (let [t, n] of bt(() => [...e.plugins ?? []]).entries()) {
14080
- if (Uh(n)) {
14088
+ if (Kh(n)) {
14081
14089
  c.set(n.id, {
14082
14090
  ...n,
14083
- label: n.label ?? Hh(n.id),
14091
+ label: n.label ?? Gh(n.id),
14084
14092
  order: n.order ?? 1e3 + t
14085
14093
  });
14086
14094
  continue;
@@ -14088,7 +14096,7 @@ function qh(e) {
14088
14096
  let e = a(n);
14089
14097
  c.set(e.id, {
14090
14098
  id: e.id,
14091
- label: Hh(e.id),
14099
+ label: Gh(e.id),
14092
14100
  order: 1e3 + t,
14093
14101
  enabled: !0,
14094
14102
  create: () => e
@@ -14096,7 +14104,7 @@ function qh(e) {
14096
14104
  }
14097
14105
  let l = /* @__PURE__ */ new Set();
14098
14106
  for (let e of c.values()) e.enabled !== !1 && l.add(e.id);
14099
- let u = new Map([...c.values()].map((e) => [e.id, new Set(e.settingsIds ?? [])])), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Map(), h = null, g = null, _ = () => void 0, v = async () => void 0, [y, b] = K(0), [x, S] = K(!1), C = (e) => (y(), n.tools().find((t) => (t.builtin === e || t.id === e) && t.command !== Gh(e))), w = (e) => (y(), x() ? e === "distance" ? n.overlays().some((t) => t.builtin === e || t.id === e) : n.tools().some((t) => t.builtin === e || t.id === e) : !o.has(e)), T = () => (y(), n.state.get("mesurer.arrange.active") ?? !1), E = (e) => T() && (e === "color-picker" || e === "text-inspector" || e === "guides"), D = G(() => (y(), n.tools().filter((e) => e.hidden?.() ? !1 : !e.builtin || !Wh(e.builtin) || e.command !== Gh(e.builtin)))), O = G(() => {
14107
+ let u = new Map([...c.values()].map((e) => [e.id, new Set(e.settingsIds ?? [])])), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Map(), h = null, g = null, _ = () => void 0, v = async () => void 0, [y, b] = K(0), [x, S] = K(!1), C = (e) => (y(), n.tools().find((t) => (t.builtin === e || t.id === e) && t.command !== Jh(e))), w = (e) => (y(), x() ? e === "distance" ? n.overlays().some((t) => t.builtin === e || t.id === e) : n.tools().some((t) => t.builtin === e || t.id === e) : !o.has(e)), T = () => (y(), n.state.get("mesurer.arrange.active") ?? !1), E = (e) => T() && (e === "color-picker" || e === "text-inspector" || e === "guides"), D = G(() => (y(), n.tools().filter((e) => e.hidden?.() ? !1 : !e.builtin || !qh(e.builtin) || e.command !== Jh(e.builtin)))), O = G(() => {
14100
14108
  y();
14101
14109
  let e = n.settings();
14102
14110
  return [...c.values()].sort((e, t) => (e.order ?? 0) - (t.order ?? 0)).map((t) => {
@@ -14106,7 +14114,7 @@ function qh(e) {
14106
14114
  })).filter((e) => (e.controls?.length ?? 0) > 0);
14107
14115
  return {
14108
14116
  id: t.id,
14109
- label: t.label ?? Hh(t.id),
14117
+ label: t.label ?? Gh(t.id),
14110
14118
  enabled: n.has(t.id),
14111
14119
  busy: p.has(t.id),
14112
14120
  sections: a
@@ -14115,7 +14123,7 @@ function qh(e) {
14115
14123
  }), k = G(() => (y(), n.settings().filter((e) => e.id === Ad))), A = () => {
14116
14124
  y();
14117
14125
  let e = [];
14118
- for (let t of zh) (!w(t) || C(t)) && e.push(`[data-mesurer-builtin='${t}']{display:none!important}`);
14126
+ for (let t of Hh) (!w(t) || C(t)) && e.push(`[data-mesurer-builtin='${t}']{display:none!important}`);
14119
14127
  return (!w("guides") || C("guides")) && e.push("[data-mesurer-builtin='guides-menu']{display:none!important}"), w("guides") || e.push("[data-mesurer-guide='true']{display:none!important}"), w("distance") || e.push("[data-mesurer-distance='true']{display:none!important}"), w("rulers") || e.push("[data-mesurer-rulers='true']{display:none!important}"), w("color-picker") || e.push(".mesurer-color-picker{display:none!important}"), e.join("\n");
14120
14128
  }, j = async (t, r = "toolbar") => {
14121
14129
  if (!t.disabled?.()) try {
@@ -14171,21 +14179,21 @@ function qh(e) {
14171
14179
  t || (t = !0, e.remove());
14172
14180
  }
14173
14181
  };
14174
- }, ee = (e) => Rh({
14182
+ }, ee = (e) => Vh({
14175
14183
  model: z(),
14176
14184
  ownerDocument: F,
14177
14185
  ownerWindow: L,
14178
14186
  uiRoot: P,
14179
14187
  pageTarget: R,
14180
- persistenceKey: e ? `${N.persistKey ?? Bh}:${e}:${L.location.origin}${L.location.pathname}` : void 0
14188
+ persistenceKey: e ? `${N.persistKey ?? Uh}:${e}:${L.location.origin}${L.location.pathname}` : void 0
14181
14189
  }), U = F.createElement("style");
14182
14190
  U.dataset.mesurerPluginVisibility = "true", U.dataset.mesurerInspectorUi = "true", U.textContent = A(), P.append(U);
14183
- let te = N.persistKey ? `${N.persistKey}:plugins` : Bh, ne = `${te}:availability`, re = /* @__PURE__ */ new Map();
14191
+ let te = N.persistKey ? `${N.persistKey}:plugins` : Uh, ne = `${te}:availability`, re = /* @__PURE__ */ new Map();
14184
14192
  try {
14185
14193
  let e = L.localStorage.getItem(ne);
14186
14194
  if (e) {
14187
14195
  let t = JSON.parse(e);
14188
- if (t?.version === Vh) {
14196
+ if (t?.version === Wh) {
14189
14197
  for (let [e, n] of Object.entries(t.enabled ?? {})) re.set(e, n);
14190
14198
  for (let [e, n] of Object.entries(t.state ?? {})) f.set(e, n);
14191
14199
  }
@@ -14197,7 +14205,7 @@ function qh(e) {
14197
14205
  let e = Object.fromEntries([...c.keys()].map((e) => [e, k.has(e)])), t = Object.fromEntries(f);
14198
14206
  try {
14199
14207
  L.localStorage.setItem(ne, JSON.stringify({
14200
- version: Vh,
14208
+ version: Wh,
14201
14209
  enabled: e,
14202
14210
  state: t
14203
14211
  }));
@@ -14220,7 +14228,7 @@ function qh(e) {
14220
14228
  let le = k.subscribe((e) => {
14221
14229
  if (b((e) => e + 1), U.textContent = A(), (e.reason === "state" || e.reason === "history" || e.reason === "remove" || e.reason === "replace") && oe(), x() && !y && (e.reason === "load" || e.reason === "remove" || e.reason === "replace") && ie(), e.reason === "remove" && e.pluginId?.startsWith("mesurer.")) {
14222
14230
  let t = e.pluginId.slice(8);
14223
- Wh(t) && V().deactivate(t);
14231
+ qh(t) && V().deactivate(t);
14224
14232
  }
14225
14233
  });
14226
14234
  N.onPluginHost?.(k);
@@ -14320,8 +14328,8 @@ function qh(e) {
14320
14328
  createWorkspaceRuntime: ee,
14321
14329
  createInspectorMount: H
14322
14330
  };
14323
- e.service.provide("runtime:solid", t), Pd(e), If(e, t), Mh(e, t);
14324
- for (let t of zh) e.command.register(Gh(t), () => _e(t));
14331
+ e.service.provide("runtime:solid", t), Pd(e), If(e, t), Fh(e, t);
14332
+ for (let t of Hh) e.command.register(Jh(t), () => _e(t));
14325
14333
  }
14326
14334
  }), t)) {
14327
14335
  for (let e of [...c.values()].sort((e, t) => (e.order ?? 0) - (t.order ?? 0))) {
@@ -14373,7 +14381,7 @@ function qh(e) {
14373
14381
  e.preventDefault(), e.stopImmediatePropagation();
14374
14382
  return;
14375
14383
  }
14376
- let i = D().find((t) => t.shortcut && !t.disabled?.() && Kh(e, t.shortcut));
14384
+ let i = D().find((t) => t.shortcut && !t.disabled?.() && Yh(e, t.shortcut));
14377
14385
  if (i) {
14378
14386
  e.preventDefault(), e.stopImmediatePropagation(), M(i);
14379
14387
  return;
@@ -14423,7 +14431,7 @@ function qh(e) {
14423
14431
  }
14424
14432
  });
14425
14433
  }
14426
- var Jh = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), Yh = (e, t, n = 0) => !(e.left + e.width + n <= t.left || t.left + t.width + n <= e.left || e.top + e.height + n <= t.top || t.top + t.height + n <= e.top), Xh = (e, t, n, r, i) => {
14434
+ var Zh = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), Qh = (e, t, n = 0) => !(e.left + e.width + n <= t.left || t.left + t.width + n <= e.left || e.top + e.height + n <= t.top || t.top + t.height + n <= e.top), $h = (e, t, n, r, i) => {
14427
14435
  let a = e.left + e.width, o = e.top + e.height, s = [
14428
14436
  {
14429
14437
  axis: "vertical",
@@ -14471,7 +14479,7 @@ var Jh = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), Yh = (e, t, n =
14471
14479
  }
14472
14480
  ];
14473
14481
  return i ? s.sort((e, t) => t.space - e.space) : s;
14474
- }, Zh = (e, t, n) => {
14482
+ }, eg = (e, t, n) => {
14475
14483
  let r = [];
14476
14484
  for (let i = 0; i <= n; i += 1) {
14477
14485
  let n = i * t;
@@ -14497,14 +14505,14 @@ var Jh = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), Yh = (e, t, n =
14497
14505
  }
14498
14506
  return r;
14499
14507
  };
14500
- function Qh(e, t, n = {}) {
14508
+ function tg(e, t, n = {}) {
14501
14509
  let r = n.markerSize ?? 24, i = n.markerGap ?? 4, a = n.targetGap ?? 6, o = n.targetClearance ?? 2, s = n.viewportPadding ?? 4, c = n.obstacles ?? [], l = Math.max(0, n.maxShiftRings ?? 2), u = n.viewportAware ?? !1, d = r + i, f = Math.max(s, t.width - r - s), p = Math.max(s, t.height - r - s), m = [], h = e.map((e) => e.rect), g = [];
14502
14510
  for (let n of e) {
14503
- let e = /* @__PURE__ */ new Set(), _ = [], v = Xh(n.rect, t, r, a, u);
14504
- for (let t of Zh(v, d, l)) {
14511
+ let e = /* @__PURE__ */ new Set(), _ = [], v = $h(n.rect, t, r, a, u);
14512
+ for (let t of eg(v, d, l)) {
14505
14513
  let n = u ? {
14506
- left: Jh(t.left, s, f),
14507
- top: Jh(t.top, s, p)
14514
+ left: Zh(t.left, s, f),
14515
+ top: Zh(t.top, s, p)
14508
14516
  } : t, r = `${n.left}:${n.top}`;
14509
14517
  e.has(r) || (e.add(r), _.push(n));
14510
14518
  }
@@ -14514,21 +14522,21 @@ function Qh(e, t, n = {}) {
14514
14522
  width: r,
14515
14523
  height: r
14516
14524
  };
14517
- return h.every((e) => !Yh(t, e, o)) && c.every((e) => !Yh(t, e, i));
14525
+ return h.every((e) => !Qh(t, e, o)) && c.every((e) => !Qh(t, e, i));
14518
14526
  }), b = y.find((e) => {
14519
14527
  let t = {
14520
14528
  ...e,
14521
14529
  width: r,
14522
14530
  height: r
14523
14531
  };
14524
- return m.every((e) => !Yh(t, e, i));
14532
+ return m.every((e) => !Qh(t, e, i));
14525
14533
  }) ?? y.find((e) => {
14526
14534
  let t = {
14527
14535
  ...e,
14528
14536
  width: r,
14529
14537
  height: r
14530
14538
  };
14531
- return m.every((e) => !Yh(t, e));
14539
+ return m.every((e) => !Qh(t, e));
14532
14540
  }) ?? y[0] ?? _[0] ?? {
14533
14541
  left: s,
14534
14542
  top: s
@@ -14544,17 +14552,17 @@ function Qh(e, t, n = {}) {
14544
14552
  }
14545
14553
  return g;
14546
14554
  }
14547
- var $h = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), eg = 0, tg = (e) => e.split(",").map((e) => e.trim()).filter((e) => e.length > 0 && e !== "none"), ng = (e, t) => {
14548
- let n = e.style.getPropertyValue("anchor-name"), r = e.style.getPropertyPriority("anchor-name"), i = tg(n);
14555
+ var ng = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), rg = 0, ig = (e) => e.split(",").map((e) => e.trim()).filter((e) => e.length > 0 && e !== "none"), ag = (e, t) => {
14556
+ let n = e.style.getPropertyValue("anchor-name"), r = e.style.getPropertyPriority("anchor-name"), i = ig(n);
14549
14557
  i.includes(t) || e.style.setProperty("anchor-name", [...i, t].join(", "), r);
14550
14558
  let a = !1;
14551
14559
  return () => {
14552
14560
  if (a) return;
14553
14561
  a = !0;
14554
- let i = tg(e.style.getPropertyValue("anchor-name")).filter((e) => e !== t);
14562
+ let i = ig(e.style.getPropertyValue("anchor-name")).filter((e) => e !== t);
14555
14563
  i.length ? e.style.setProperty("anchor-name", i.join(", "), e.style.getPropertyPriority("anchor-name")) : n.trim() === "none" ? e.style.setProperty("anchor-name", n, r) : e.style.removeProperty("anchor-name");
14556
14564
  };
14557
- }, rg = (e) => {
14565
+ }, og = (e) => {
14558
14566
  if (!e.length) return null;
14559
14567
  let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.left + e.width)), i = Math.max(...e.map((e) => e.top + e.height));
14560
14568
  return {
@@ -14563,14 +14571,14 @@ var $h = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), eg = 0, tg = (e)
14563
14571
  width: r - t,
14564
14572
  height: i - n
14565
14573
  };
14566
- }, ig = (e, t, n, r, i = 8) => {
14574
+ }, sg = (e, t, n, r, i = 8) => {
14567
14575
  let a = r.innerWidth - t - 8, o = r.innerHeight - n - 8, s = e.left + e.width + i, c = e.left - t - i;
14568
14576
  return {
14569
- left: s + t <= r.innerWidth - 8 ? s : c >= 8 ? c : $h(e.left + e.width - t, 8, a),
14570
- top: $h(e.top, 8, o)
14577
+ left: s + t <= r.innerWidth - 8 ? s : c >= 8 ? c : ng(e.left + e.width - t, 8, a),
14578
+ top: ng(e.top, 8, o)
14571
14579
  };
14572
- }, ag = (e, t, n, r, i = 8) => {
14573
- let a = r.innerWidth - t - 8, o = $h(e.left + e.width / 2 - t / 2, 8, a), s = e.top + e.height + i;
14580
+ }, cg = (e, t, n, r, i = 8) => {
14581
+ let a = r.innerWidth - t - 8, o = ng(e.left + e.width / 2 - t / 2, 8, a), s = e.top + e.height + i;
14574
14582
  if (s + n <= r.innerHeight - 8) return {
14575
14583
  left: o,
14576
14584
  top: s
@@ -14579,10 +14587,10 @@ var $h = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), eg = 0, tg = (e)
14579
14587
  return c >= 8 ? {
14580
14588
  left: o,
14581
14589
  top: c
14582
- } : ig(e, t, n, r, i);
14590
+ } : sg(e, t, n, r, i);
14583
14591
  };
14584
- function og(e) {
14585
- let [t, n] = K(0), [r, i] = K(0), [a, o] = K(null), [s, c] = K(null), [l, u] = K(null), [d, f] = K({}), [p, m] = K(null), [h, g] = K(!1), [_, v] = K(""), [y, b] = K(null), [x, S] = K(!1), [C, w] = K(null), [T, E] = K(null), D = `--mesurer-annotation-trigger-${++eg}`, O = null, k = e.initialTriggerFallback === "current-and-next", A = null, j = null, M = null, N, P, F = null, I = null, L = null, R = null, z = null, B = null, V = /* @__PURE__ */ new Map(), H = () => N?.ownerDocument.defaultView ?? window, ee = () => e.coordinateSpace === "viewport", U = (e) => e ? "native-anchor" : ee() ? "cached-delta" : "document", te = (e) => {
14592
+ function lg(e) {
14593
+ let [t, n] = K(0), [r, i] = K(0), [a, o] = K(null), [s, c] = K(null), [l, u] = K(null), [d, f] = K({}), [p, m] = K(null), [h, g] = K(!1), [_, v] = K(""), [y, b] = K(null), [x, S] = K(!1), [C, w] = K(null), [T, E] = K(null), D = `--mesurer-annotation-trigger-${++rg}`, O = null, k = e.initialTriggerFallback === "current-and-next", A = null, j = null, M = null, N, P, F = null, I = null, L = null, R = null, z = null, B = null, V = /* @__PURE__ */ new Map(), H = () => N?.ownerDocument.defaultView ?? window, ee = () => e.coordinateSpace === "viewport", U = (e) => e ? "native-anchor" : ee() ? "cached-delta" : "document", te = (e) => {
14586
14594
  if (ee()) return e;
14587
14595
  let t = H();
14588
14596
  return {
@@ -14632,11 +14640,11 @@ function og(e) {
14632
14640
  let a = t.ownerDocument.defaultView;
14633
14641
  if (a) {
14634
14642
  if (r) {
14635
- let n = `--mesurer-annotation-${++eg}`;
14643
+ let n = `--mesurer-annotation-${++rg}`;
14636
14644
  V.set(e, {
14637
14645
  target: t,
14638
14646
  anchorName: n,
14639
- releaseAnchor: ng(t, n),
14647
+ releaseAnchor: ag(t, n),
14640
14648
  scroll: nc(a, t, () => le(e), { trackWindow: !1 })
14641
14649
  });
14642
14650
  } else V.set(e, {
@@ -14670,13 +14678,13 @@ function og(e) {
14670
14678
  R?.sync();
14671
14679
  return;
14672
14680
  }
14673
- let i = e === t ? D : `--mesurer-annotation-trigger-${++eg}`;
14681
+ let i = e === t ? D : `--mesurer-annotation-trigger-${++rg}`;
14674
14682
  if (_e(), !e?.isConnected) return;
14675
14683
  F = e;
14676
14684
  let a = e.ownerDocument.defaultView;
14677
14685
  if (a) {
14678
14686
  if (n) {
14679
- L = ng(e, i), I = e, D = i, R = nc(a, e, ce, { trackWindow: !1 });
14687
+ L = ag(e, i), I = e, D = i, R = nc(a, e, ce, { trackWindow: !1 });
14680
14688
  return;
14681
14689
  }
14682
14690
  D = i, R = nc(a, e, ce, { trackWindow: ee() });
@@ -14745,7 +14753,7 @@ function og(e) {
14745
14753
  };
14746
14754
  });
14747
14755
  return e.region && t.push({ ...e.region }), t;
14748
- }), Pe = G(() => rg(Ne())), Fe = () => {
14756
+ }), Pe = G(() => og(Ne())), Fe = () => {
14749
14757
  let e = Te().elements.length;
14750
14758
  return e > 1 ? `${e} selected elements` : e === 1 ? "Selected element" : "Selected region";
14751
14759
  }, Ie = (e) => e.anchor.kind === "elements" ? `${e.anchor.targets.length} selected ${e.anchor.targets.length === 1 ? "element" : "elements"}` : "Selected region", Le = G(() => {
@@ -14767,7 +14775,7 @@ function og(e) {
14767
14775
  top: e.top,
14768
14776
  width: 24,
14769
14777
  height: 24
14770
- })), [a] = Qh([{
14778
+ })), [a] = tg([{
14771
14779
  id: "selection-note-trigger",
14772
14780
  rect: n
14773
14781
  }], {
@@ -14776,7 +14784,7 @@ function og(e) {
14776
14784
  }, {
14777
14785
  obstacles: i,
14778
14786
  maxShiftRings: 1
14779
- }), o = a?.left ?? $h(n.left + n.width + 6, 4, r.innerWidth - 24 - 4), s = a?.top ?? $h(n.top, 4, r.innerHeight - 24 - 4), c = I === e, l = ee() && !c;
14787
+ }), o = a?.left ?? ng(n.left + n.width + 6, 4, r.innerWidth - 24 - 4), s = a?.top ?? ng(n.top, 4, r.innerHeight - 24 - 4), c = I === e, l = ee() && !c;
14780
14788
  return {
14781
14789
  left: c || l ? o : o + r.scrollX,
14782
14790
  top: c || l ? s : s + r.scrollY,
@@ -14794,7 +14802,7 @@ function og(e) {
14794
14802
  rect: n
14795
14803
  }] : [];
14796
14804
  });
14797
- return new Map(Qh(i, {
14805
+ return new Map(tg(i, {
14798
14806
  width: n.innerWidth,
14799
14807
  height: n.innerHeight
14800
14808
  }, { obstacles: Ne() }).map((e) => [e.id, e]));
@@ -14818,7 +14826,7 @@ function og(e) {
14818
14826
  return n && e ? {
14819
14827
  left: e.left + n.left,
14820
14828
  top: e.top + n.top
14821
- } : e ? ag(e, 272, 168, t) : {
14829
+ } : e ? cg(e, 272, 168, t) : {
14822
14830
  left: 8,
14823
14831
  top: 8
14824
14832
  };
@@ -14839,7 +14847,7 @@ function og(e) {
14839
14847
  };
14840
14848
  }, We = (e, t) => {
14841
14849
  let n = H(), r = ze(), i = r.get(e);
14842
- if (!i) return ig(t, 272, 176, n);
14850
+ if (!i) return sg(t, 272, 176, n);
14843
14851
  let a = n.innerWidth - 272 - 8, o = n.innerHeight - 176 - 8, s = [...r.values()].map((e) => ({
14844
14852
  left: e.left,
14845
14853
  top: e.top,
@@ -14865,8 +14873,8 @@ function og(e) {
14865
14873
  }
14866
14874
  ]) {
14867
14875
  let t = {
14868
- left: $h(e.left, 8, a),
14869
- top: $h(e.top, 8, o)
14876
+ left: ng(e.left, 8, a),
14877
+ top: ng(e.top, 8, o)
14870
14878
  }, n = `${t.left}:${t.top}`;
14871
14879
  l.has(n) || (l.add(n), u.push(t));
14872
14880
  }
@@ -14882,7 +14890,7 @@ function og(e) {
14882
14890
  targetOverlap: c(r, t),
14883
14891
  index: n
14884
14892
  };
14885
- }).sort((e, t) => e.markerOverlap - t.markerOverlap || e.targetOverlap - t.targetOverlap || e.index - t.index)[0]?.candidate ?? ig(t, 272, 176, n);
14893
+ }).sort((e, t) => e.markerOverlap - t.markerOverlap || e.targetOverlap - t.targetOverlap || e.index - t.index)[0]?.candidate ?? sg(t, 272, 176, n);
14886
14894
  }, Ge = (t) => {
14887
14895
  let n = e.runtime.annotationRect(t);
14888
14896
  if (!n) return {
@@ -14930,8 +14938,8 @@ function og(e) {
14930
14938
  let u = (t) => {
14931
14939
  if (!j || t.pointerId !== j.pointerId) return;
14932
14940
  let r = j, i = Math.max(8, s.innerWidth - r.width - 8), a = Math.max(8, s.innerHeight - r.height - 8), o = {
14933
- left: $h(r.originLeft + t.clientX - r.startX, 8, i),
14934
- top: $h(r.originTop + t.clientY - r.startY, 8, a)
14941
+ left: ng(r.originLeft + t.clientX - r.startX, 8, i),
14942
+ top: ng(r.originTop + t.clientY - r.startY, 8, a)
14935
14943
  };
14936
14944
  if (n === "composer") {
14937
14945
  let e = Pe();
@@ -14976,7 +14984,7 @@ function og(e) {
14976
14984
  k = !1, A = ne(), v(""), b(null), w(null), o(null);
14977
14985
  let e = Pe();
14978
14986
  if (e) {
14979
- let t = ag(e, 272, 168, H());
14987
+ let t = cg(e, 272, 168, H());
14980
14988
  m({
14981
14989
  left: t.left - e.left,
14982
14990
  top: t.top - e.top
@@ -15340,11 +15348,11 @@ function og(e) {
15340
15348
  })
15341
15349
  ];
15342
15350
  }
15343
- function sg(e) {
15351
+ function ug(e) {
15344
15352
  let t = null;
15345
15353
  return Lt(xu(e.ownerWindow, () => {
15346
15354
  t?.abandonNoteComposer();
15347
- })), Y(og, {
15355
+ })), Y(lg, {
15348
15356
  get runtime() {
15349
15357
  return e.runtime;
15350
15358
  },
@@ -15362,8 +15370,8 @@ function sg(e) {
15362
15370
  }
15363
15371
  });
15364
15372
  }
15365
- var cg = "2147482950", lg = "2147483646", ug = "2147483647";
15366
- function dg(e) {
15373
+ var dg = "2147482950", fg = "2147483646", pg = "2147483647";
15374
+ function mg(e) {
15367
15375
  let { ownerDocument: t, ownerWindow: n, pageTarget: r } = e, i = t.body;
15368
15376
  if (!(i && !(r instanceof n.ShadowRoot) && r.getRootNode() === t)) return e.createInspectorMount();
15369
15377
  Fu(vd, i);
@@ -15380,17 +15388,17 @@ function dg(e) {
15380
15388
  o.dataset.mesurerDocumentInspectorLayerStyle = "true", o.textContent = `
15381
15389
  [data-mesurer-document-inspector-mount="true"] [data-mesurer-annotation-target-highlight="true"] {
15382
15390
  position: absolute !important;
15383
- z-index: ${cg} !important;
15391
+ z-index: ${dg} !important;
15384
15392
  }
15385
15393
  [data-mesurer-document-inspector-mount="true"] [data-mesurer-annotation-panel="true"] {
15386
15394
  position: absolute !important;
15387
- z-index: ${lg} !important;
15395
+ z-index: ${fg} !important;
15388
15396
  }
15389
15397
  [data-mesurer-document-inspector-mount="true"] [data-mesurer-annotation-marker="true"],
15390
15398
  [data-mesurer-document-inspector-mount="true"] [data-mesurer-annotation-trigger="true"],
15391
15399
  [data-mesurer-document-inspector-mount="true"] [data-mesurer-annotation-composer="true"] {
15392
15400
  position: absolute !important;
15393
- z-index: ${ug} !important;
15401
+ z-index: ${pg} !important;
15394
15402
  }
15395
15403
  `, t.head.append(o), i.append(a);
15396
15404
  let s = !1;
@@ -15401,7 +15409,7 @@ function dg(e) {
15401
15409
  }
15402
15410
  };
15403
15411
  }
15404
- var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", mg = "mesurer:capture-bridge-response", hg = (e, t, n) => {
15412
+ var hg = "mesurer:capture-bridge-ping", gg = "mesurer:capture-bridge-request", _g = "mesurer:capture-bridge-response", vg = (e, t, n) => {
15405
15413
  let r = Math.max(0, Math.min(e.x, t.x, n.width)), i = Math.max(0, Math.min(e.y, t.y, n.height)), a = Math.max(0, Math.min(Math.max(e.x, t.x), n.width)), o = Math.max(0, Math.min(Math.max(e.y, t.y), n.height));
15406
15414
  return {
15407
15415
  left: r,
@@ -15409,7 +15417,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15409
15417
  width: Math.max(0, a - r),
15410
15418
  height: Math.max(0, o - i)
15411
15419
  };
15412
- }, gg = async (e, t, n, r) => {
15420
+ }, yg = async (e, t, n, r) => {
15413
15421
  let i = await createImageBitmap(e);
15414
15422
  try {
15415
15423
  let e = i.width / n.width, a = i.height / n.height, o = Math.max(0, Math.round(t.left * e)), s = Math.max(0, Math.round(t.top * a)), c = Math.max(1, Math.min(i.width - o, Math.round(t.width * e))), l = Math.max(1, Math.min(i.height - s, Math.round(t.height * a))), u = r.createElement("canvas");
@@ -15424,34 +15432,34 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15424
15432
  } finally {
15425
15433
  i.close();
15426
15434
  }
15427
- }, _g = async (e, t) => {
15435
+ }, bg = async (e, t) => {
15428
15436
  let n = t.navigator.clipboard, r = globalThis.ClipboardItem;
15429
15437
  if (!n?.write || !r) throw Error("PNG clipboard copy is not available");
15430
15438
  await n.write([new r({ "image/png": e })]);
15431
- }, vg = (e = /* @__PURE__ */ new Date()) => {
15439
+ }, xg = (e = /* @__PURE__ */ new Date()) => {
15432
15440
  let t = (e) => String(e).padStart(2, "0");
15433
15441
  return `mesurer-${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}${t(e.getSeconds())}.png`;
15434
- }, yg = (e, t, n, r) => {
15442
+ }, Sg = (e, t, n, r) => {
15435
15443
  let i = globalThis.URL.createObjectURL(e), a = n.createElement("a");
15436
15444
  a.href = i, a.download = t, a.rel = "noopener", n.documentElement.append(a), a.click(), a.remove(), r.setTimeout(() => globalThis.URL.revokeObjectURL(i), 1e3);
15437
- }, bg = (e) => new Promise((t) => {
15445
+ }, Cg = (e) => new Promise((t) => {
15438
15446
  e.requestAnimationFrame(() => {
15439
15447
  e.requestAnimationFrame(() => t());
15440
15448
  });
15441
- }), xg = (e) => e.crypto?.randomUUID?.() ?? `mesurer-${Date.now()}-${Math.random().toString(36).slice(2)}`, Sg = (e, t, n = "") => `${e}:${t}:${n}`, Cg = (e, t, n) => {
15449
+ }), wg = (e) => e.crypto?.randomUUID?.() ?? `mesurer-${Date.now()}-${Math.random().toString(36).slice(2)}`, Tg = (e, t, n = "") => `${e}:${t}:${n}`, Eg = (e, t, n) => {
15442
15450
  let r = `${t}:${n}:`;
15443
15451
  return e.startsWith(r) ? e.slice(r.length) : null;
15444
- }, wg = (e) => new Promise((t) => {
15445
- let n = xg(e), r = e.location.origin, i = (o) => {
15446
- o.source === e && o.origin === r && Cg(String(o.data ?? ""), "mesurer:capture-bridge-pong", n) !== null && (e.removeEventListener("message", i), e.clearTimeout(a), t(!0));
15452
+ }, Dg = (e) => new Promise((t) => {
15453
+ let n = wg(e), r = e.location.origin, i = (o) => {
15454
+ o.source === e && o.origin === r && Eg(String(o.data ?? ""), "mesurer:capture-bridge-pong", n) !== null && (e.removeEventListener("message", i), e.clearTimeout(a), t(!0));
15447
15455
  }, a = e.setTimeout(() => {
15448
15456
  e.removeEventListener("message", i), t(!1);
15449
15457
  }, 80);
15450
- e.addEventListener("message", i), e.postMessage(Sg(fg, n), r);
15451
- }), Tg = (e) => new Promise((t, n) => {
15452
- let r = xg(e), i = e.location.origin, a = (s) => {
15458
+ e.addEventListener("message", i), e.postMessage(Tg(hg, n), r);
15459
+ }), Og = (e) => new Promise((t, n) => {
15460
+ let r = wg(e), i = e.location.origin, a = (s) => {
15453
15461
  if (s.source !== e || s.origin !== i) return;
15454
- let c = Cg(String(s.data ?? ""), mg, r);
15462
+ let c = Eg(String(s.data ?? ""), _g, r);
15455
15463
  if (c === null) return;
15456
15464
  if (e.removeEventListener("message", a), e.clearTimeout(o), !c.startsWith("ok:")) {
15457
15465
  t(null);
@@ -15466,16 +15474,16 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15466
15474
  }, o = e.setTimeout(() => {
15467
15475
  e.removeEventListener("message", a), t(null);
15468
15476
  }, 4e3);
15469
- e.addEventListener("message", a), e.postMessage(Sg(pg, r), i);
15470
- }), Eg = /* @__PURE__ */ new WeakMap(), Dg = (e) => {
15471
- let t = Eg.get(e), n = t?.stream.getVideoTracks()[0];
15477
+ e.addEventListener("message", a), e.postMessage(Tg(gg, r), i);
15478
+ }), kg = /* @__PURE__ */ new WeakMap(), Ag = (e) => {
15479
+ let t = kg.get(e), n = t?.stream.getVideoTracks()[0];
15472
15480
  if (!t || !n || n.readyState !== "live") {
15473
- Eg.delete(e);
15481
+ kg.delete(e);
15474
15482
  return;
15475
15483
  }
15476
15484
  return t;
15477
- }, Og = async (e, t) => {
15478
- let n = Dg(t);
15485
+ }, jg = async (e, t) => {
15486
+ let n = Ag(t);
15479
15487
  if (n) return n;
15480
15488
  let r = t.navigator.mediaDevices;
15481
15489
  if (!r?.getDisplayMedia) throw Error("Screenshot capture is unavailable");
@@ -15495,17 +15503,17 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15495
15503
  stream: i,
15496
15504
  video: n
15497
15505
  };
15498
- return Eg.set(t, r), a.addEventListener("ended", () => {
15499
- Eg.get(t) === r && Eg.delete(t);
15506
+ return kg.set(t, r), a.addEventListener("ended", () => {
15507
+ kg.get(t) === r && kg.delete(t);
15500
15508
  }, { once: !0 }), r;
15501
15509
  } catch (e) {
15502
15510
  throw i.getTracks().forEach((e) => e.stop()), e;
15503
15511
  }
15504
- }, kg = (e) => {
15505
- let t = Eg.get(e);
15506
- t && (Eg.delete(e), t.video.pause(), t.video.srcObject = null, t.stream.getTracks().forEach((e) => e.stop()));
15507
- }, Ag = async ({ ownerDocument: e, ownerWindow: t }) => {
15508
- let { video: n } = await Og(e, t), r = e.createElement("canvas");
15512
+ }, Mg = (e) => {
15513
+ let t = kg.get(e);
15514
+ t && (kg.delete(e), t.video.pause(), t.video.srcObject = null, t.stream.getTracks().forEach((e) => e.stop()));
15515
+ }, Ng = async ({ ownerDocument: e, ownerWindow: t }) => {
15516
+ let { video: n } = await jg(e, t), r = e.createElement("canvas");
15509
15517
  r.width = n.videoWidth, r.height = n.videoHeight;
15510
15518
  let i = r.getContext("2d");
15511
15519
  if (!i) throw Error("Capture failed");
@@ -15514,25 +15522,25 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15514
15522
  n ? e(n) : t(/* @__PURE__ */ Error("Capture failed"));
15515
15523
  }, "image/png");
15516
15524
  });
15517
- }, jg = async (e, t) => {
15518
- await wg(t) || await Og(e, t);
15519
- }, Mg = async ({ ownerDocument: e, ownerWindow: t }) => {
15520
- if (await wg(t)) {
15521
- let e = await Tg(t);
15525
+ }, Pg = async (e, t) => {
15526
+ await Dg(t) || await jg(e, t);
15527
+ }, Fg = async ({ ownerDocument: e, ownerWindow: t }) => {
15528
+ if (await Dg(t)) {
15529
+ let e = await Og(t);
15522
15530
  if (e) return e;
15523
15531
  }
15524
- return Ag({
15532
+ return Ng({
15525
15533
  ownerDocument: e,
15526
15534
  ownerWindow: t
15527
15535
  });
15528
- }, Ng = 144, Pg = 96, Fg = 8, Ig = 4, Lg = 1800, Rg = (e, t) => {
15536
+ }, Ig = 144, Lg = 96, Rg = 8, zg = 4, Bg = 1800, Vg = (e, t) => {
15529
15537
  for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
15530
- }, zg = (e, t) => ({
15531
- left: Math.min(Math.max(Fg, e.left), Math.max(Fg, t.innerWidth - Ng - Fg)),
15532
- top: Math.min(Math.max(Fg, e.top), Math.max(Fg, t.innerHeight - Pg - Fg))
15533
- }), Bg = (e, t) => {
15538
+ }, Hg = (e, t) => ({
15539
+ left: Math.min(Math.max(Rg, e.left), Math.max(Rg, t.innerWidth - Ig - Rg)),
15540
+ top: Math.min(Math.max(Rg, e.top), Math.max(Rg, t.innerHeight - Lg - Rg))
15541
+ }), Ug = (e, t) => {
15534
15542
  let n = e.createElement("button");
15535
- return n.type = "button", n.textContent = t, Rg(n, {
15543
+ return n.type = "button", n.textContent = t, Vg(n, {
15536
15544
  height: "32px",
15537
15545
  padding: "0 12px",
15538
15546
  border: "1px solid rgb(255 255 255 / 18%)",
@@ -15544,11 +15552,11 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15544
15552
  "font-weight": "500",
15545
15553
  cursor: "pointer"
15546
15554
  }), n;
15547
- }, Vg = ({ copied: e, downloaded: t, copyFailed: n, downloadFailed: r }) => e && t ? "Copied and saved screenshot" : e && r ? "Copied screenshot · Save unavailable" : t && n ? "Saved screenshot · Copy unavailable" : e ? "Copied screenshot" : t ? "Saved screenshot" : n && r ? "Screenshot captured · Copy and save unavailable" : n ? "Screenshot captured · Copy unavailable" : r ? "Screenshot captured · Save unavailable" : "Screenshot captured", Hg = (e) => e !== null && (e.nodeType === 1 || e.nodeType === 11), Ug = ({ ownerDocument: e, ownerWindow: t, root: n, previewDurationMs: r }) => {
15555
+ }, Wg = ({ copied: e, downloaded: t, copyFailed: n, downloadFailed: r }) => e && t ? "Copied and saved screenshot" : e && r ? "Copied screenshot · Save unavailable" : t && n ? "Saved screenshot · Copy unavailable" : e ? "Copied screenshot" : t ? "Saved screenshot" : n && r ? "Screenshot captured · Copy and save unavailable" : n ? "Screenshot captured · Copy unavailable" : r ? "Screenshot captured · Save unavailable" : "Screenshot captured", Gg = (e) => e !== null && (e.nodeType === 1 || e.nodeType === 11), Kg = ({ ownerDocument: e, ownerWindow: t, root: n, previewDurationMs: r }) => {
15548
15556
  let i = n.closest("[data-mesurer-root='true']")?.parentNode ?? n.parentNode;
15549
- if (!Hg(i)) throw Error("Screenshot preview requires a mounted Mesurer host.");
15557
+ if (!Gg(i)) throw Error("Screenshot preview requires a mounted Mesurer host.");
15550
15558
  let a = e.createElement("div");
15551
- a.dataset.mesurerInspectorUi = "true", a.dataset.mesurerScreenshotInteractive = "true", Rg(a, {
15559
+ a.dataset.mesurerInspectorUi = "true", a.dataset.mesurerScreenshotInteractive = "true", Vg(a, {
15552
15560
  position: "fixed",
15553
15561
  left: "0",
15554
15562
  top: "0",
@@ -15560,12 +15568,12 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15560
15568
  "font-family": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"
15561
15569
  }), i.append(a);
15562
15570
  let o = e.createElement("div");
15563
- o.dataset.mesurerScreenshotPreview = "true", o.setAttribute("role", "button"), o.setAttribute("aria-label", "Open captured screenshot"), o.tabIndex = 0, Rg(o, {
15571
+ o.dataset.mesurerScreenshotPreview = "true", o.setAttribute("role", "button"), o.setAttribute("aria-label", "Open captured screenshot"), o.tabIndex = 0, Vg(o, {
15564
15572
  position: "fixed",
15565
15573
  display: "none",
15566
15574
  "z-index": "96",
15567
- width: `${Ng}px`,
15568
- height: `${Pg}px`,
15575
+ width: `${Ig}px`,
15576
+ height: `${Lg}px`,
15569
15577
  "box-sizing": "border-box",
15570
15578
  overflow: "hidden",
15571
15579
  "border-radius": "10px",
@@ -15578,7 +15586,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15578
15586
  "touch-action": "none"
15579
15587
  });
15580
15588
  let s = e.createElement("img");
15581
- s.dataset.mesurerScreenshotPreviewImage = "true", s.alt = "Captured screenshot", s.draggable = !1, s.title = "Click to open · Right-click for browser image actions", Rg(s, {
15589
+ s.dataset.mesurerScreenshotPreviewImage = "true", s.alt = "Captured screenshot", s.draggable = !1, s.title = "Click to open · Right-click for browser image actions", Vg(s, {
15582
15590
  display: "block",
15583
15591
  width: "100%",
15584
15592
  height: "100%",
@@ -15586,7 +15594,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15586
15594
  "background-color": "white"
15587
15595
  }), o.append(s);
15588
15596
  let c = e.createElement("button");
15589
- c.dataset.mesurerScreenshotPreviewDismiss = "true", c.type = "button", c.setAttribute("aria-label", "Dismiss screenshot preview"), c.title = "Dismiss", Rg(c, {
15597
+ c.dataset.mesurerScreenshotPreviewDismiss = "true", c.type = "button", c.setAttribute("aria-label", "Dismiss screenshot preview"), c.title = "Dismiss", Vg(c, {
15590
15598
  position: "absolute",
15591
15599
  top: "8px",
15592
15600
  right: "8px",
@@ -15612,7 +15620,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15612
15620
  let u = e.createElementNS("http://www.w3.org/2000/svg", "path");
15613
15621
  u.setAttribute("d", "m4 4 8 8M12 4l-8 8"), u.setAttribute("stroke", "currentColor"), u.setAttribute("stroke-width", "1.75"), u.setAttribute("stroke-linecap", "round"), l.append(u), c.append(l), o.append(c), a.append(o);
15614
15622
  let d = e.createElement("div");
15615
- d.dataset.mesurerScreenshotViewer = "true", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-label", "Screenshot viewer"), Rg(d, {
15623
+ d.dataset.mesurerScreenshotViewer = "true", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-label", "Screenshot viewer"), Vg(d, {
15616
15624
  position: "fixed",
15617
15625
  inset: "0",
15618
15626
  display: "none",
@@ -15626,7 +15634,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15626
15634
  "pointer-events": "auto"
15627
15635
  });
15628
15636
  let f = e.createElement("img");
15629
- f.dataset.mesurerScreenshotViewerImage = "true", f.alt = "Captured screenshot", Rg(f, {
15637
+ f.dataset.mesurerScreenshotViewerImage = "true", f.alt = "Captured screenshot", Vg(f, {
15630
15638
  display: "block",
15631
15639
  "max-width": "calc(100vw - 96px)",
15632
15640
  "max-height": "calc(100vh - 112px)",
@@ -15637,7 +15645,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15637
15645
  "box-shadow": "0 8px 30px rgb(0 0 0 / 28%)"
15638
15646
  }), d.append(f);
15639
15647
  let p = e.createElement("div");
15640
- p.dataset.mesurerScreenshotViewerControls = "true", Rg(p, {
15648
+ p.dataset.mesurerScreenshotViewerControls = "true", Vg(p, {
15641
15649
  position: "fixed",
15642
15650
  top: "16px",
15643
15651
  right: "16px",
@@ -15645,14 +15653,14 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15645
15653
  gap: "8px",
15646
15654
  "pointer-events": "auto"
15647
15655
  });
15648
- let m = Bg(e, "Copy");
15656
+ let m = Ug(e, "Copy");
15649
15657
  m.dataset.mesurerScreenshotViewerCopy = "true", m.setAttribute("aria-label", "Copy screenshot");
15650
- let h = Bg(e, "Save");
15658
+ let h = Ug(e, "Save");
15651
15659
  h.dataset.mesurerScreenshotViewerSave = "true", h.setAttribute("aria-label", "Save screenshot");
15652
- let g = Bg(e, "Close");
15660
+ let g = Ug(e, "Close");
15653
15661
  g.dataset.mesurerScreenshotViewerClose = "true", g.setAttribute("aria-label", "Close screenshot viewer"), p.append(m, h, g), d.append(p), a.append(d);
15654
15662
  let _ = e.createElement("div");
15655
- _.dataset.mesurerScreenshotToast = "true", _.setAttribute("role", "status"), Rg(_, {
15663
+ _.dataset.mesurerScreenshotToast = "true", _.setAttribute("role", "status"), Vg(_, {
15656
15664
  position: "fixed",
15657
15665
  left: "50%",
15658
15666
  bottom: "20px",
@@ -15674,32 +15682,32 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15674
15682
  }, D = (e, n = !1) => {
15675
15683
  E(), _.textContent = e, _.style.backgroundColor = n ? "#b42318" : "rgb(28 28 30 / 90%)", _.style.display = "block", C = t.setTimeout(() => {
15676
15684
  C = 0, _.style.display = "none";
15677
- }, Lg);
15685
+ }, Bg);
15678
15686
  }, O = () => {
15679
15687
  d.style.display = "none";
15680
15688
  }, k = () => {
15681
15689
  y && globalThis.URL.revokeObjectURL(y), y = null, v = null, s.removeAttribute("src"), f.removeAttribute("src");
15682
15690
  }, A = () => {
15683
15691
  T(), O(), o.style.display = "none", k();
15684
- }, j = () => zg({
15685
- left: t.innerWidth - Ng - Fg,
15686
- top: t.innerHeight - Pg - Fg
15692
+ }, j = () => Hg({
15693
+ left: t.innerWidth - Ig - Rg,
15694
+ top: t.innerHeight - Lg - Rg
15687
15695
  }, t), M = (e) => {
15688
- let n = zg(e, t);
15696
+ let n = Hg(e, t);
15689
15697
  b = n, o.style.left = `${n.left}px`, o.style.top = `${n.top}px`;
15690
15698
  }, N = () => {
15691
15699
  !v || !y || (T(), d.style.display = "flex", g.focus());
15692
15700
  }, P = async () => {
15693
15701
  let e = v;
15694
15702
  if (e) try {
15695
- await _g(Promise.resolve(e), t), D("Copied screenshot");
15703
+ await bg(Promise.resolve(e), t), D("Copied screenshot");
15696
15704
  } catch {
15697
15705
  D("Could not copy screenshot", !0);
15698
15706
  }
15699
15707
  }, F = () => {
15700
15708
  let n = v;
15701
15709
  if (n) try {
15702
- yg(n, vg(), e, t), D("Saved screenshot");
15710
+ Sg(n, xg(), e, t), D("Saved screenshot");
15703
15711
  } catch {
15704
15712
  D("Could not save screenshot", !0);
15705
15713
  }
@@ -15719,7 +15727,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15719
15727
  let n = x;
15720
15728
  if (!n) return;
15721
15729
  let r = e - n.startX, i = t - n.startY;
15722
- !n.moved && Math.hypot(r, i) >= Ig && (n.moved = !0), n.moved && M({
15730
+ !n.moved && Math.hypot(r, i) >= zg && (n.moved = !0), n.moved && M({
15723
15731
  left: n.left + r,
15724
15732
  top: n.top + i
15725
15733
  });
@@ -15763,25 +15771,25 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15763
15771
  if (w) return;
15764
15772
  T(), O(), k(), v = e;
15765
15773
  let i = globalThis.URL.createObjectURL(e);
15766
- y = i, s.src = i, f.src = i, o.style.display = "block", M(b ?? j()), D(Vg(n)), r > 0 && (S = t.setTimeout(A, r));
15774
+ y = i, s.src = i, f.src = i, o.style.display = "block", M(b ?? j()), D(Wg(n)), r > 0 && (S = t.setTimeout(A, r));
15767
15775
  },
15768
15776
  dismiss: A,
15769
15777
  dispose() {
15770
15778
  w || (w = !0, T(), E(), A(), t.removeEventListener("mousemove", V, !0), t.removeEventListener("mouseup", H, !0), t.removeEventListener("pointermove", U, !0), t.removeEventListener("pointerup", te, !0), t.removeEventListener("pointercancel", ne, !0), t.removeEventListener("keydown", oe, !0), o.removeEventListener("mousedown", B), o.removeEventListener("pointerdown", ee), o.removeEventListener("keydown", re), o.removeEventListener("contextmenu", ie), d.removeEventListener("click", ae), a.remove());
15771
15779
  }
15772
15780
  };
15773
- }, Wg = "mesurer.screenshot", Gg = "screenshot", Kg = "mesurer.screenshot.settings", qg = "mesurer.screenshot.active", Jg = "runtime:solid", Yg = "screenshot.toggle", Xg = 2500, Zg = 0, Qg = [
15781
+ }, qg = "mesurer.screenshot", Jg = "screenshot", Yg = "mesurer.screenshot.settings", Xg = "mesurer.screenshot.active", Zg = "runtime:solid", Qg = "screenshot.toggle", $g = 2500, e_ = 0, t_ = [
15774
15782
  "[data-mesurer-measurement='true']",
15775
15783
  "[data-mesurer-selected-measurement='true']",
15776
15784
  "[data-mesurer-selection-spacing-target='true']",
15777
15785
  "[data-mesurer-guide='true']",
15778
15786
  "[data-mesurer-distance='true']"
15779
- ].join(","), $g = `${Qg},[data-mesurer-rulers='true']`, e_ = {
15787
+ ].join(","), n_ = `${t_},[data-mesurer-rulers='true']`, r_ = {
15780
15788
  viewBox: "0 0 256 256",
15781
15789
  paths: ["m 96,50 a 6.0006,6.0006 0 0 0 -4.992188,2.671875 L 76.789062,74 H 40 C 27.920803,74 18,83.920803 18,96 v 96 c 0,12.0792 9.920803,22 22,22 h 176 c 12.0792,0 22,-9.9208 22,-22 V 96 C 238,83.920803 228.0792,74 216,74 H 179.21094 L 164.99219,52.671875 A 6.0006,6.0006 0 0 0 160,50 Z m 3.210937,12 h 57.578123 l 14.21875,21.328125 A 6.0006,6.0006 0 0 0 176,86 h 40 c 5.59392,0 10,4.406085 10,10 v 96 c 0,5.59392 -4.40608,10 -10,10 H 40 c -5.593915,0 -10,-4.40608 -10,-10 V 96 c 0,-5.593915 4.406085,-10 10,-10 h 40 a 6.0006,6.0006 0 0 0 4.992187,-2.671875 z", "m 128,94 c -23.12489,0 -42,18.87511 -42,42 0,23.12489 18.87511,42 42,42 23.12489,0 42,-18.87511 42,-42 0,-23.12489 -18.87511,-42 -42,-42 z m 0,12 c 16.63961,0 30,13.36039 30,30 0,16.63961 -13.36039,30 -30,30 -16.63961,0 -30,-13.36039 -30,-30 0,-16.63961 13.36039,-30 30,-30 z"]
15782
- }, t_ = (e, t) => {
15790
+ }, i_ = (e, t) => {
15783
15791
  for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
15784
- }, n_ = (e, t) => {
15792
+ }, a_ = (e, t) => {
15785
15793
  for (let n of [
15786
15794
  "left",
15787
15795
  "top",
@@ -15793,63 +15801,63 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15793
15801
  let r = t[n];
15794
15802
  r === void 0 ? e.style.removeProperty(n) : e.style.setProperty(n, `${r}px`);
15795
15803
  }
15796
- }, r_ = (e) => {
15797
- let t = e(Kg);
15804
+ }, o_ = (e) => {
15805
+ let t = e(Yg);
15798
15806
  return {
15799
15807
  toolEnabled: t?.toolEnabled ?? !0,
15800
15808
  copy: t?.copy ?? !0,
15801
15809
  download: t?.download ?? !1,
15802
15810
  includeMeasurements: t?.includeMeasurements ?? !1
15803
15811
  };
15804
- }, i_ = (e) => ({
15812
+ }, s_ = (e) => ({
15805
15813
  value: e.style.getPropertyValue("display"),
15806
15814
  priority: e.style.getPropertyPriority("display")
15807
- }), a_ = (e, t) => {
15815
+ }), c_ = (e, t) => {
15808
15816
  t.value || t.priority ? e.style.setProperty("display", t.value, t.priority) : e.style.removeProperty("display");
15809
- }, o_ = (e, t) => {
15817
+ }, l_ = (e, t) => {
15810
15818
  let n = e;
15811
15819
  for (; n.parentElement && n.parentElement !== t;) n = n.parentElement;
15812
15820
  return n.parentElement === t ? n : null;
15813
- }, s_ = (e) => {
15821
+ }, u_ = (e) => {
15814
15822
  let t = e.querySelector("[data-mesurer-root='true']");
15815
15823
  if (!t) return () => void 0;
15816
15824
  let n = /* @__PURE__ */ new Set();
15817
15825
  for (let e of t.querySelectorAll("[data-mesurer-rulers='true']")) {
15818
- let r = o_(e, t);
15826
+ let r = l_(e, t);
15819
15827
  r && n.add(r);
15820
15828
  }
15821
- for (let e of t.querySelectorAll(Qg)) {
15822
- let r = o_(e, t);
15829
+ for (let e of t.querySelectorAll(t_)) {
15830
+ let r = l_(e, t);
15823
15831
  r && n.add(r);
15824
15832
  }
15825
15833
  let r = [];
15826
15834
  for (let e of n) e.dataset.mesurerInspectorUi !== "true" && (r.push({
15827
15835
  element: e,
15828
- display: i_(e)
15836
+ display: s_(e)
15829
15837
  }), e.style.setProperty("display", "none", "important"));
15830
15838
  return () => {
15831
- for (let e of r) a_(e.element, e.display);
15839
+ for (let e of r) c_(e.element, e.display);
15832
15840
  };
15833
- }, c_ = (e) => Array.from(e.querySelectorAll($g)).filter((e) => e.dataset.mesurerInspectorUi === "true").map((e) => ({
15841
+ }, d_ = (e) => Array.from(e.querySelectorAll(n_)).filter((e) => e.dataset.mesurerInspectorUi === "true").map((e) => ({
15834
15842
  element: e,
15835
- display: i_(e)
15836
- })), l_ = (e) => {
15837
- for (let t of e) t.element.isConnected && a_(t.element, t.display);
15838
- }, u_ = (e = {}) => pa({
15839
- id: Wg,
15843
+ display: s_(e)
15844
+ })), f_ = (e) => {
15845
+ for (let t of e) t.element.isConnected && c_(t.element, t.display);
15846
+ }, p_ = (e = {}) => pa({
15847
+ id: qg,
15840
15848
  version: "0.1.0",
15841
- requires: [Jg],
15849
+ requires: [Zg],
15842
15850
  provides: [
15843
15851
  "tool:screenshot",
15844
15852
  "capture:screenshot",
15845
15853
  "settings:screenshot"
15846
15854
  ],
15847
15855
  setup(t) {
15848
- let n = t.service.get(Jg);
15856
+ let n = t.service.get(Zg);
15849
15857
  if (!n) throw Error("Screenshot plugin requires the Solid renderer runtime.");
15850
- let { ownerDocument: r, ownerWindow: i } = n, a = n.createWorkspaceRuntime(), o = n.createInspectorMount(), s = e.captureVisibleTab ?? Mg, c = e.previewDurationMs ?? Zg;
15858
+ let { ownerDocument: r, ownerWindow: i } = n, a = n.createWorkspaceRuntime(), o = n.createInspectorMount(), s = e.captureVisibleTab ?? Fg, c = e.previewDurationMs ?? e_;
15851
15859
  t.state.register({
15852
- id: Kg,
15860
+ id: Yg,
15853
15861
  initial: {
15854
15862
  toolEnabled: e.toolEnabled ?? !0,
15855
15863
  copy: e.copy ?? !0,
@@ -15858,11 +15866,11 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15858
15866
  },
15859
15867
  persist: !0
15860
15868
  }), t.state.register({
15861
- id: qg,
15869
+ id: Xg,
15862
15870
  initial: !1
15863
15871
  });
15864
15872
  let l = o.element;
15865
- l.dataset.mesurerScreenshot = "true", t_(l, {
15873
+ l.dataset.mesurerScreenshot = "true", i_(l, {
15866
15874
  position: "fixed",
15867
15875
  inset: "0",
15868
15876
  "z-index": "85",
@@ -15870,7 +15878,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15870
15878
  "font-family": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"
15871
15879
  });
15872
15880
  let u = r.createElement("div");
15873
- u.dataset.mesurerScreenshotSelect = "true", u.setAttribute("role", "application"), u.setAttribute("aria-label", "Screenshot selection"), t_(u, {
15881
+ u.dataset.mesurerScreenshotSelect = "true", u.setAttribute("role", "application"), u.setAttribute("aria-label", "Screenshot selection"), i_(u, {
15874
15882
  position: "fixed",
15875
15883
  inset: "0",
15876
15884
  display: "none",
@@ -15882,13 +15890,13 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15882
15890
  }), l.append(u);
15883
15891
  let d = Array.from({ length: 4 }, () => {
15884
15892
  let e = r.createElement("div");
15885
- return t_(e, {
15893
+ return i_(e, {
15886
15894
  position: "fixed",
15887
15895
  "background-color": "rgb(0 0 0 / 40%)",
15888
15896
  "pointer-events": "none"
15889
15897
  }), u.append(e), e;
15890
15898
  }), f = r.createElement("div");
15891
- t_(f, {
15899
+ i_(f, {
15892
15900
  position: "fixed",
15893
15901
  display: "none",
15894
15902
  border: "1px solid #0d99ff",
@@ -15896,7 +15904,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15896
15904
  "pointer-events": "none"
15897
15905
  }), u.append(f);
15898
15906
  let p = r.createElement("div");
15899
- t_(p, {
15907
+ i_(p, {
15900
15908
  position: "fixed",
15901
15909
  display: "none",
15902
15910
  "z-index": "86",
@@ -15910,7 +15918,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15910
15918
  "pointer-events": "none"
15911
15919
  }), u.append(p);
15912
15920
  let m = r.createElement("div");
15913
- m.textContent = "Drag to select · Esc to cancel", t_(m, {
15921
+ m.textContent = "Drag to select · Esc to cancel", i_(m, {
15914
15922
  position: "fixed",
15915
15923
  left: "50%",
15916
15924
  bottom: "16px",
@@ -15923,7 +15931,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15923
15931
  "pointer-events": "none"
15924
15932
  }), u.append(m);
15925
15933
  let h = r.createElement("div");
15926
- h.dataset.mesurerScreenshotError = "true", h.setAttribute("role", "status"), h.textContent = "Could not save screenshot", t_(h, {
15934
+ h.dataset.mesurerScreenshotError = "true", h.setAttribute("role", "status"), h.textContent = "Could not save screenshot", i_(h, {
15927
15935
  position: "fixed",
15928
15936
  display: "none",
15929
15937
  "z-index": "97",
@@ -15934,8 +15942,8 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15934
15942
  "font-size": "11px",
15935
15943
  "pointer-events": "none"
15936
15944
  }), l.append(h);
15937
- let g = null, _ = null, v = 0, y = 0, b = !1, x = !1, S = !1, C = () => t.state.get("mesurer.screenshot.active") ?? !1, w = () => r_(t.state.get), T = (e) => {
15938
- t.state.update(Kg, (t) => {
15945
+ let g = null, _ = null, v = 0, y = 0, b = !1, x = !1, S = !1, C = () => t.state.get("mesurer.screenshot.active") ?? !1, w = () => o_(t.state.get), T = (e) => {
15946
+ t.state.update(Yg, (t) => {
15939
15947
  let n = { ...t };
15940
15948
  return e.toolEnabled !== void 0 && (n.toolEnabled = e.toolEnabled), e.copy !== void 0 && (n.copy = e.copy), e.download !== void 0 && (n.download = e.download), e.includeMeasurements !== void 0 && (n.includeMeasurements = e.includeMeasurements), n;
15941
15949
  });
@@ -15958,13 +15966,13 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15958
15966
  }, k = (e) => {
15959
15967
  let t = i.innerWidth, n = i.innerHeight;
15960
15968
  if (!e || e.width <= 0 || e.height <= 0) {
15961
- n_(d[0], {
15969
+ a_(d[0], {
15962
15970
  left: 0,
15963
15971
  top: 0,
15964
15972
  width: t,
15965
15973
  height: n
15966
15974
  });
15967
- for (let e of d.slice(1)) n_(e, {
15975
+ for (let e of d.slice(1)) a_(e, {
15968
15976
  left: 0,
15969
15977
  top: 0,
15970
15978
  width: 0,
@@ -15973,31 +15981,31 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
15973
15981
  f.style.display = "none", p.style.display = "none";
15974
15982
  return;
15975
15983
  }
15976
- n_(d[0], {
15984
+ a_(d[0], {
15977
15985
  left: 0,
15978
15986
  top: 0,
15979
15987
  width: t,
15980
15988
  height: e.top
15981
- }), n_(d[1], {
15989
+ }), a_(d[1], {
15982
15990
  left: 0,
15983
15991
  top: e.top,
15984
15992
  width: e.left,
15985
15993
  height: e.height
15986
- }), n_(d[2], {
15994
+ }), a_(d[2], {
15987
15995
  left: e.left + e.width,
15988
15996
  top: e.top,
15989
15997
  width: Math.max(0, t - e.left - e.width),
15990
15998
  height: e.height
15991
- }), n_(d[3], {
15999
+ }), a_(d[3], {
15992
16000
  left: 0,
15993
16001
  top: e.top + e.height,
15994
16002
  width: t,
15995
16003
  height: Math.max(0, n - e.top - e.height)
15996
- }), f.style.display = "block", n_(f, e), p.style.display = "block", p.textContent = `${Math.round(e.width)} × ${Math.round(e.height)}`, n_(p, {
16004
+ }), f.style.display = "block", a_(f, e), p.style.display = "block", p.textContent = `${Math.round(e.width)} × ${Math.round(e.height)}`, a_(p, {
15997
16005
  left: e.left + e.width / 2,
15998
16006
  top: Math.min(n - 22, e.top + e.height + 6)
15999
16007
  });
16000
- }, A = () => n.portalTarget.querySelector("[data-mesurer-tool-id='screenshot']")?.getBoundingClientRect() ?? null, j = Ug({
16008
+ }, A = () => n.portalTarget.querySelector("[data-mesurer-tool-id='screenshot']")?.getBoundingClientRect() ?? null, j = Kg({
16001
16009
  ownerDocument: r,
16002
16010
  ownerWindow: i,
16003
16011
  root: l,
@@ -16008,20 +16016,20 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16008
16016
  }, N = () => {
16009
16017
  v && i.clearTimeout(v), h.style.display = "block", M(h), v = i.setTimeout(() => {
16010
16018
  v = 0, h.style.display = "none";
16011
- }, Xg);
16019
+ }, $g);
16012
16020
  }, P = () => {
16013
16021
  g = null, k(null), u.style.visibility = "", u.style.display = "none", l.style.pointerEvents = "none", E(!1), O();
16014
16022
  }, F = () => {
16015
- y += 1, P(), kg(i);
16023
+ y += 1, P(), Mg(i);
16016
16024
  }, I = async (e) => {
16017
16025
  if (b) throw Error("A screenshot capture is already running.");
16018
16026
  if (e.width < 4 || e.height < 4) throw Error("Screenshot selection must be at least 4px by 4px.");
16019
16027
  b = !0;
16020
- let o = ++y, c = w(), l = c.includeMeasurements ? c_(r) : [], d = c.includeMeasurements ? () => void 0 : s_(n.portalTarget);
16021
- a.prepareCapture(), c.includeMeasurements && l_(l);
16028
+ let o = ++y, c = w(), l = c.includeMeasurements ? d_(r) : [], d = c.includeMeasurements ? () => void 0 : u_(n.portalTarget);
16029
+ a.prepareCapture(), c.includeMeasurements && f_(l);
16022
16030
  try {
16023
- u.style.visibility = "hidden", await bg(i);
16024
- let n = await gg(await s({
16031
+ u.style.visibility = "hidden", await Cg(i);
16032
+ let n = await yg(await s({
16025
16033
  ownerDocument: r,
16026
16034
  ownerWindow: i
16027
16035
  }), e, {
@@ -16029,10 +16037,10 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16029
16037
  height: i.innerHeight
16030
16038
  }, r);
16031
16039
  if (y !== o) throw Error("Screenshot capture was cancelled.");
16032
- let a = !1, l = !1, d = c.copy ? _g(Promise.resolve(n), i).then(() => {
16040
+ let a = !1, l = !1, d = c.copy ? bg(Promise.resolve(n), i).then(() => {
16033
16041
  a = !0;
16034
16042
  }) : Promise.resolve(), f = c.download ? Promise.resolve().then(() => {
16035
- yg(n, vg(), r, i), l = !0;
16043
+ Sg(n, xg(), r, i), l = !0;
16036
16044
  }) : Promise.resolve(), p = await Promise.allSettled([d, f]), m = c.copy && p[0]?.status === "rejected", h = c.download && p[1]?.status === "rejected";
16037
16045
  if (y !== o) throw Error("Screenshot capture was cancelled.");
16038
16046
  return j.show(n, {
@@ -16064,7 +16072,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16064
16072
  if (!x) {
16065
16073
  x = !0, j.dismiss();
16066
16074
  try {
16067
- if (e.captureVisibleTab === void 0 && await jg(r, i), S) return;
16075
+ if (e.captureVisibleTab === void 0 && await Pg(r, i), S) return;
16068
16076
  D(), k(null), u.style.visibility = "visible", l.style.pointerEvents = "auto", u.style.display = "block", E(!0);
16069
16077
  } catch (e) {
16070
16078
  throw e instanceof Error && e.name === "AbortError" || N(), e;
@@ -16077,12 +16085,12 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16077
16085
  !C() || e.button !== 0 || (e.preventDefault(), e.stopPropagation(), g = {
16078
16086
  x: e.clientX,
16079
16087
  y: e.clientY
16080
- }, k(hg(g, g, {
16088
+ }, k(vg(g, g, {
16081
16089
  width: i.innerWidth,
16082
16090
  height: i.innerHeight
16083
16091
  })), u.setPointerCapture?.(e.pointerId));
16084
16092
  }, z = (e) => {
16085
- !C() || !g || k(hg(g, {
16093
+ !C() || !g || k(vg(g, {
16086
16094
  x: e.clientX,
16087
16095
  y: e.clientY
16088
16096
  }, {
@@ -16093,7 +16101,7 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16093
16101
  let t = g;
16094
16102
  if (g = null, !C() || !t) return;
16095
16103
  u.hasPointerCapture?.(e.pointerId) && u.releasePointerCapture(e.pointerId);
16096
- let n = hg(t, {
16104
+ let n = vg(t, {
16097
16105
  x: e.clientX,
16098
16106
  y: e.clientY
16099
16107
  }, {
@@ -16126,8 +16134,8 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16126
16134
  label: "Screenshot",
16127
16135
  shortcut: "Shift+S",
16128
16136
  order: 70,
16129
- command: Yg,
16130
- icon: e_,
16137
+ command: Qg,
16138
+ icon: r_,
16131
16139
  active: C,
16132
16140
  hidden: () => !w().toolEnabled,
16133
16141
  menu: {
@@ -16193,25 +16201,25 @@ var fg = "mesurer:capture-bridge-ping", pg = "mesurer:capture-bridge-request", m
16193
16201
  set: (e) => T({ includeMeasurements: e })
16194
16202
  }
16195
16203
  ]
16196
- }), t.command.register(Yg, L), t.service.provide(Gg, ee), t.lifecycle.onDispose(() => {
16197
- S = !0, y += 1, u.removeEventListener("pointerdown", R), u.removeEventListener("pointermove", z), u.removeEventListener("pointerup", B), u.removeEventListener("pointercancel", V), i.removeEventListener("keydown", H, !0), v && i.clearTimeout(v), j.dispose(), O(), kg(i), a.finishCapture(), a.dispose(), o.dispose();
16204
+ }), t.command.register(Qg, L), t.service.provide(Jg, ee), t.lifecycle.onDispose(() => {
16205
+ S = !0, y += 1, u.removeEventListener("pointerdown", R), u.removeEventListener("pointermove", z), u.removeEventListener("pointerup", B), u.removeEventListener("pointercancel", V), i.removeEventListener("keydown", H, !0), v && i.clearTimeout(v), j.dispose(), O(), Mg(i), a.finishCapture(), a.dispose(), o.dispose();
16198
16206
  });
16199
16207
  }
16200
- }), d_ = (e) => Number.parseFloat(e) || 0, f_ = 0, p_ = (e, t) => {
16208
+ }), m_ = (e) => Number.parseFloat(e) || 0, h_ = 0, g_ = (e, t) => {
16201
16209
  let n = t.CSS;
16202
16210
  return n?.escape ? n.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
16203
- }, m_ = (e) => e.nodeType === 9, h_ = (e) => e.nodeType === 11;
16204
- function g_(e) {
16211
+ }, __ = (e) => e.nodeType === 9, v_ = (e) => e.nodeType === 11;
16212
+ function y_(e) {
16205
16213
  let t = e.getRootNode();
16206
- return h_(t) ? t : e.ownerDocument;
16214
+ return v_(t) ? t : e.ownerDocument;
16207
16215
  }
16208
- var __ = (e, t) => {
16209
- if (m_(e) || h_(e)) return e;
16210
- let n = g_(e);
16211
- return h_(n) ? n : t;
16216
+ var b_ = (e, t) => {
16217
+ if (__(e) || v_(e)) return e;
16218
+ let n = y_(e);
16219
+ return v_(n) ? n : t;
16212
16220
  };
16213
- function v_(e, t, n = m_(t) ? t : t.ownerDocument ?? document) {
16214
- let r = __(t, n).elementFromPoint(e.x, e.y);
16221
+ function x_(e, t, n = __(t) ? t : t.ownerDocument ?? document) {
16222
+ let r = b_(t, n).elementFromPoint(e.x, e.y);
16215
16223
  for (; r?.shadowRoot;) {
16216
16224
  let t = r.shadowRoot.elementFromPoint(e.x, e.y);
16217
16225
  if (!t || t === r) break;
@@ -16219,18 +16227,18 @@ function v_(e, t, n = m_(t) ? t : t.ownerDocument ?? document) {
16219
16227
  }
16220
16228
  return r;
16221
16229
  }
16222
- function y_(e, t) {
16223
- if (m_(t)) return !0;
16230
+ function S_(e, t) {
16231
+ if (__(t)) return !0;
16224
16232
  let n = e;
16225
16233
  for (; n;) {
16226
16234
  if (t === n || t.contains(n)) return !0;
16227
16235
  let e = n.getRootNode();
16228
- if (!h_(e)) return !1;
16236
+ if (!v_(e)) return !1;
16229
16237
  n = e.host;
16230
16238
  }
16231
16239
  return !1;
16232
16240
  }
16233
- function b_(e, t) {
16241
+ function C_(e, t) {
16234
16242
  if (!e) return t();
16235
16243
  let n = [e, ...e.querySelectorAll("*")], r = n.map((e) => [
16236
16244
  e,
@@ -16244,9 +16252,9 @@ function b_(e, t) {
16244
16252
  for (let [e, t, n] of r) t ? e.style.setProperty("pointer-events", t, n) : e.style.removeProperty("pointer-events");
16245
16253
  }
16246
16254
  }
16247
- function x_(e) {
16255
+ function w_(e) {
16248
16256
  let t = e.ownerDocument.defaultView ?? window;
16249
- if (e.id) return `#${p_(e.id, t)}`;
16257
+ if (e.id) return `#${g_(e.id, t)}`;
16250
16258
  let n = e.getAttribute("data-testid");
16251
16259
  if (n) return `[data-testid=${JSON.stringify(n)}]`;
16252
16260
  let r = [], i = e;
@@ -16260,17 +16268,17 @@ function x_(e) {
16260
16268
  }
16261
16269
  return r.join(" > ");
16262
16270
  }
16263
- function S_(e, t, n = `dom-inspection-${++f_}`) {
16271
+ function T_(e, t, n = `dom-inspection-${++h_}`) {
16264
16272
  let r = e.getBoundingClientRect(), i = t.getComputedStyle(e), a = {
16265
- top: d_(i.paddingTop),
16266
- right: d_(i.paddingRight),
16267
- bottom: d_(i.paddingBottom),
16268
- left: d_(i.paddingLeft)
16273
+ top: m_(i.paddingTop),
16274
+ right: m_(i.paddingRight),
16275
+ bottom: m_(i.paddingBottom),
16276
+ left: m_(i.paddingLeft)
16269
16277
  }, o = {
16270
- top: d_(i.marginTop),
16271
- right: d_(i.marginRight),
16272
- bottom: d_(i.marginBottom),
16273
- left: d_(i.marginLeft)
16278
+ top: m_(i.marginTop),
16279
+ right: m_(i.marginRight),
16280
+ bottom: m_(i.marginBottom),
16281
+ left: m_(i.marginLeft)
16274
16282
  }, s = {
16275
16283
  left: r.left + a.left,
16276
16284
  top: r.top + a.top,
@@ -16298,8 +16306,8 @@ function S_(e, t, n = `dom-inspection-${++f_}`) {
16298
16306
  elementRef: e
16299
16307
  };
16300
16308
  }
16301
- function C_(e) {
16302
- let t = e.ownerDocument.defaultView ?? window, n = t.getComputedStyle(e), r = e instanceof t.HTMLElement ? e : null, i = e.getBoundingClientRect(), a = r ? S_(r, t) : null, o = (e) => {
16309
+ function E_(e) {
16310
+ let t = e.ownerDocument.defaultView ?? window, n = t.getComputedStyle(e), r = e instanceof t.HTMLElement ? e : null, i = e.getBoundingClientRect(), a = r ? T_(r, t) : null, o = (e) => {
16303
16311
  let t = Number.parseFloat(e);
16304
16312
  return Number.isFinite(t) ? t : 0;
16305
16313
  }, s = (e) => ({
@@ -16309,7 +16317,7 @@ function C_(e) {
16309
16317
  left: o(n.getPropertyValue(`${e}-left${e === "border" ? "-width" : ""}`))
16310
16318
  });
16311
16319
  return {
16312
- selector: x_(e),
16320
+ selector: w_(e),
16313
16321
  tag: e.localName,
16314
16322
  id: e.id || null,
16315
16323
  classes: [...e.classList],
@@ -16371,10 +16379,10 @@ function C_(e) {
16371
16379
  }
16372
16380
  //#endregion
16373
16381
  //#region src/agent.ts
16374
- var w_ = "text-edit", T_ = (e) => C_(e);
16375
- function E_(e) {
16376
- let t = e.root ?? e.ownerDocument, n = e.ownerDocument.defaultView ?? window, r = (e, n = 0) => t.querySelectorAll(e).item(n) || null, i = (n) => t === e.ownerDocument || y_(n, t), a = async () => {
16377
- let t = (e.getPluginHost() ?? await e.waitForPluginHost()).service.get(w_);
16382
+ var D_ = "text-edit", O_ = (e) => E_(e);
16383
+ function k_(e) {
16384
+ let t = e.root ?? e.ownerDocument, n = e.ownerDocument.defaultView ?? window, r = (e, n = 0) => t.querySelectorAll(e).item(n) || null, i = (n) => t === e.ownerDocument || S_(n, t), a = async () => {
16385
+ let t = (e.getPluginHost() ?? await e.waitForPluginHost()).service.get(D_);
16378
16386
  if (!t) throw Error("Mesurer text editing service is unavailable.");
16379
16387
  return t;
16380
16388
  }, o = () => {
@@ -16403,25 +16411,25 @@ function E_(e) {
16403
16411
  },
16404
16412
  inspect(e, t = 0) {
16405
16413
  let n = r(e, t);
16406
- return n ? T_(n) : null;
16414
+ return n ? O_(n) : null;
16407
16415
  },
16408
16416
  inspectAll(e, n = 50) {
16409
- return [...t.querySelectorAll(e)].slice(0, Math.max(0, n)).map(T_);
16417
+ return [...t.querySelectorAll(e)].slice(0, Math.max(0, n)).map(O_);
16410
16418
  },
16411
16419
  at(n, r) {
16412
16420
  let a = t.querySelector?.("[data-mesurer-island]") ?? null;
16413
- return b_(a?.shadowRoot?.querySelector("[data-mesurer-root='true']") ?? a, () => {
16414
- let a = v_({
16421
+ return C_(a?.shadowRoot?.querySelector("[data-mesurer-root='true']") ?? a, () => {
16422
+ let a = x_({
16415
16423
  x: n,
16416
16424
  y: r
16417
16425
  }, t, e.ownerDocument);
16418
- return a && i(a) ? T_(a) : null;
16426
+ return a && i(a) ? O_(a) : null;
16419
16427
  });
16420
16428
  },
16421
16429
  distance(e, t) {
16422
16430
  let n = r(e), i = r(t);
16423
16431
  if (!n || !i) return null;
16424
- let a = T_(n), o = T_(i), s = a.rect, c = o.rect;
16432
+ let a = O_(n), o = O_(i), s = a.rect, c = o.rect;
16425
16433
  return {
16426
16434
  a,
16427
16435
  b: o,
@@ -16437,7 +16445,7 @@ function E_(e) {
16437
16445
  let r = e.getPluginHost() ?? await e.waitForPluginHost();
16438
16446
  return {
16439
16447
  viewport: o(),
16440
- elements: n.flatMap((e) => [...t.querySelectorAll(e)].slice(0, 50).map(T_)),
16448
+ elements: n.flatMap((e) => [...t.querySelectorAll(e)].slice(0, 50).map(O_)),
16441
16449
  plugins: r.describe(),
16442
16450
  pluginState: r.state.serialize("all")
16443
16451
  };
@@ -16461,7 +16469,7 @@ function E_(e) {
16461
16469
  }
16462
16470
  //#endregion
16463
16471
  //#region ../mesurer-core/dist/context.js
16464
- var D_ = (e, t) => e.left <= t.left + t.width && e.left + e.width >= t.left && e.top <= t.top + t.height && e.top + e.height >= t.top, O_ = (e) => {
16472
+ var A_ = (e, t) => e.left <= t.left + t.width && e.left + e.width >= t.left && e.top <= t.top + t.height && e.top + e.height >= t.top, j_ = (e) => {
16465
16473
  if (!e.length) return null;
16466
16474
  let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.left + e.width)), i = Math.max(...e.map((e) => e.top + e.height));
16467
16475
  return {
@@ -16470,47 +16478,47 @@ var D_ = (e, t) => e.left <= t.left + t.width && e.left + e.width >= t.left && e
16470
16478
  width: r - t,
16471
16479
  height: i - n
16472
16480
  };
16473
- }, k_ = (e, t, n) => t.some((t) => e.orientation === "vertical" ? e.position >= t.left - n && e.position <= t.left + t.width + n : e.position >= t.top - n && e.position <= t.top + t.height + n), A_ = (e) => [...e.measurements, ...e.activeMeasurement && !e.measurements.some((t) => t.id === e.activeMeasurement?.id) ? [e.activeMeasurement] : []];
16474
- function j_(e) {
16481
+ }, M_ = (e, t, n) => t.some((t) => e.orientation === "vertical" ? e.position >= t.left - n && e.position <= t.left + t.width + n : e.position >= t.top - n && e.position <= t.top + t.height + n), N_ = (e) => [...e.measurements, ...e.activeMeasurement && !e.measurements.some((t) => t.id === e.activeMeasurement?.id) ? [e.activeMeasurement] : []];
16482
+ function P_(e) {
16475
16483
  let { workspace: t, scope: n, guideTolerance: r } = e;
16476
16484
  if (n.kind === "workspace") return {
16477
16485
  guides: t.guides.map((e) => ({ ...e })),
16478
- measurements: A_(t),
16486
+ measurements: N_(t),
16479
16487
  distances: [...t.distances]
16480
16488
  };
16481
- let i = new Set(n.elements), a = (e) => e != null && i.has(e), o = (e) => n.regions.some((t) => D_(e, t));
16489
+ let i = new Set(n.elements), a = (e) => e != null && i.has(e), o = (e) => n.regions.some((t) => A_(e, t));
16482
16490
  return {
16483
- guides: t.guides.filter((e) => k_(e, n.regions, r)).map((e) => ({ ...e })),
16484
- measurements: A_(t).filter((e) => a(e.elementRef) || o(e.rect)),
16491
+ guides: t.guides.filter((e) => M_(e, n.regions, r)).map((e) => ({ ...e })),
16492
+ measurements: N_(t).filter((e) => a(e.elementRef) || o(e.rect)),
16485
16493
  distances: t.distances.filter((e) => a(e.elementRefA) || a(e.elementRefB) || o(e.rectA) || o(e.rectB))
16486
16494
  };
16487
16495
  }
16488
16496
  //#endregion
16489
16497
  //#region ../mesurer-core/dist/domain.js
16490
- var M_ = {
16498
+ var F_ = {
16491
16499
  opacity: 1,
16492
16500
  width: 1,
16493
16501
  pattern: "solid",
16494
16502
  dashLength: 6,
16495
16503
  gap: 4
16496
- }, N_ = {
16504
+ }, I_ = {
16497
16505
  opacity: 1,
16498
16506
  edgeReveal: !1
16499
16507
  };
16500
- ({ ...M_ }), { ...N_ };
16508
+ ({ ...F_ }), { ...I_ };
16501
16509
  //#endregion
16502
16510
  //#region src/context.ts
16503
- var P_ = 10, F_ = (e) => ({
16511
+ var L_ = 10, R_ = (e) => ({
16504
16512
  left: e.left,
16505
16513
  top: e.top,
16506
16514
  width: e.width,
16507
16515
  height: e.height
16508
- }), I_ = (e) => {
16516
+ }), z_ = (e) => {
16509
16517
  let t = /* @__PURE__ */ new Set(), n = [];
16510
16518
  for (let r of e) !r?.isConnected || t.has(r) || (t.add(r), n.push(r));
16511
16519
  return n;
16512
- }, L_ = (e) => e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
16513
- function R_(e) {
16520
+ }, B_ = (e) => e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
16521
+ function V_(e) {
16514
16522
  let { runtime: t, ownerDocument: n, ownerWindow: r } = e, i = e.request ?? { scope: "workspace" }, a = t.snapshot();
16515
16523
  if (!a) throw Error("Mesurer workspace is not ready yet.");
16516
16524
  let o = [], s = [], c = { kind: "workspace" }, l = /* @__PURE__ */ new Map();
@@ -16518,7 +16526,7 @@ function R_(e) {
16518
16526
  let e = t.annotation(i.annotation);
16519
16527
  if (!e) throw Error(`Mesurer annotation not found: ${i.annotation}`);
16520
16528
  for (let t of e.resolvedTargets) t.element?.isConnected && l.set(t.element, t.target.id);
16521
- o = I_(e.resolvedTargets.map((e) => e.element));
16529
+ o = z_(e.resolvedTargets.map((e) => e.element));
16522
16530
  let n = t.annotationRect(e.id);
16523
16531
  n && (s = [n]);
16524
16532
  let r = e.resolvedTargets.length, a = e.resolvedTargets.filter((e) => e.element?.isConnected).length, u = e.anchor.kind === "region" ? "connected" : r === 0 || a === 0 ? "stale" : a === r ? "connected" : "partial";
@@ -16530,15 +16538,15 @@ function R_(e) {
16530
16538
  };
16531
16539
  } else if (i.scope === "selection") {
16532
16540
  let e = t.currentSelection();
16533
- if (o = I_(e.elements), !o.length && !e.region) throw Error("Mesurer has no current selection.");
16534
- s = e.region ? [e.region] : o.map((e) => F_(e.getBoundingClientRect())), c = { kind: "selection" };
16535
- } else o = I_([
16541
+ if (o = z_(e.elements), !o.length && !e.region) throw Error("Mesurer has no current selection.");
16542
+ s = e.region ? [e.region] : o.map((e) => R_(e.getBoundingClientRect())), c = { kind: "selection" };
16543
+ } else o = z_([
16536
16544
  ...t.currentSelection().elements,
16537
16545
  ...a.measurements.map((e) => e.elementRef),
16538
16546
  a.activeMeasurement?.elementRef,
16539
16547
  ...a.heldDistances.flatMap((e) => [e.elementRefA, e.elementRefB])
16540
16548
  ]);
16541
- let u = c.kind === "workspace" ? [] : s.length ? s : o.map((e) => F_(e.getBoundingClientRect())), d = j_({
16549
+ let u = c.kind === "workspace" ? [] : s.length ? s : o.map((e) => R_(e.getBoundingClientRect())), d = P_({
16542
16550
  workspace: {
16543
16551
  guides: a.guides,
16544
16552
  measurements: a.measurements,
@@ -16550,8 +16558,8 @@ function R_(e) {
16550
16558
  elements: o,
16551
16559
  regions: u
16552
16560
  },
16553
- guideTolerance: a.guideRelevanceTolerance ?? P_
16554
- }), f = d.measurements, p = d.distances, m = d.guides, h = I_([
16561
+ guideTolerance: a.guideRelevanceTolerance ?? L_
16562
+ }), f = d.measurements, p = d.distances, m = d.guides, h = z_([
16555
16563
  ...o,
16556
16564
  ...f.map((e) => e.elementRef),
16557
16565
  ...p.flatMap((e) => [e.elementRefA, e.elementRefB])
@@ -16563,12 +16571,12 @@ function R_(e) {
16563
16571
  let t = l.get(e) ?? y();
16564
16572
  return g.set(e, t), {
16565
16573
  ref: t,
16566
- inspection: C_(e)
16574
+ inspection: E_(e)
16567
16575
  };
16568
16576
  }), x = f.map((e) => {
16569
16577
  let t = {
16570
16578
  id: e.id,
16571
- rect: F_(e.rect),
16579
+ rect: R_(e.rect),
16572
16580
  deltaX: e.deltaX,
16573
16581
  deltaY: e.deltaY
16574
16582
  };
@@ -16578,8 +16586,8 @@ function R_(e) {
16578
16586
  }), S = p.map((e) => {
16579
16587
  let t = {
16580
16588
  id: e.id,
16581
- rectA: F_(e.rectA),
16582
- rectB: F_(e.rectB),
16589
+ rectA: R_(e.rectA),
16590
+ rectB: R_(e.rectB),
16583
16591
  horizontal: e.horizontal ? { ...e.horizontal } : null,
16584
16592
  vertical: e.vertical ? { ...e.vertical } : null
16585
16593
  }, n = e.elementRefA ? g.get(e.elementRefA) : void 0, r = e.elementRefB ? g.get(e.elementRefB) : void 0;
@@ -16587,7 +16595,7 @@ function R_(e) {
16587
16595
  });
16588
16596
  return {
16589
16597
  schema: "mesurer.context/v1",
16590
- id: L_(r),
16598
+ id: B_(r),
16591
16599
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
16592
16600
  scope: c,
16593
16601
  page: {
@@ -16602,7 +16610,7 @@ function R_(e) {
16602
16610
  scrollY: r.scrollY
16603
16611
  },
16604
16612
  coordinateSpace: "viewport-css-px",
16605
- regions: c.kind === "workspace" ? [] : s.map(F_),
16613
+ regions: c.kind === "workspace" ? [] : s.map(R_),
16606
16614
  visualState: {
16607
16615
  rulersVisible: a.rulersVisible,
16608
16616
  xrayVisible: a.xrayVisible
@@ -16615,40 +16623,40 @@ function R_(e) {
16615
16623
  }
16616
16624
  };
16617
16625
  }
16618
- var z_ = (e) => `${Math.round(e * 100) / 100}px`, B_ = (e) => `x=${z_(e.left)} y=${z_(e.top)} w=${z_(e.width)} h=${z_(e.height)}`;
16619
- function V_(e) {
16626
+ var H_ = (e) => `${Math.round(e * 100) / 100}px`, U_ = (e) => `x=${H_(e.left)} y=${H_(e.top)} w=${H_(e.width)} h=${H_(e.height)}`;
16627
+ function W_(e) {
16620
16628
  let t = [
16621
16629
  "Mesurer visual context",
16622
16630
  "",
16623
16631
  `Page: ${e.page.url}`,
16624
16632
  `Viewport: ${e.viewport.width} × ${e.viewport.height} CSS px; scroll x=${e.viewport.scrollX} y=${e.viewport.scrollY}`
16625
16633
  ];
16626
- if (e.scope.kind === "annotation" ? t.push("", "Annotation", e.scope.note, `Target status: ${e.scope.targetStatus}`) : t.push("", `Scope: ${e.scope.kind}`), e.regions.length && (t.push("", "Requested regions"), e.regions.forEach((e, n) => t.push(`- region-${n + 1}: ${B_(e)}`))), (e.visualState.rulersVisible || e.visualState.xrayVisible) && t.push("", `Visual state: rulers=${e.visualState.rulersVisible ? "on" : "off"}; x-ray=${e.visualState.xrayVisible ? "on" : "off"}`), e.targets.length) {
16634
+ if (e.scope.kind === "annotation" ? t.push("", "Annotation", e.scope.note, `Target status: ${e.scope.targetStatus}`) : t.push("", `Scope: ${e.scope.kind}`), e.regions.length && (t.push("", "Requested regions"), e.regions.forEach((e, n) => t.push(`- region-${n + 1}: ${U_(e)}`))), (e.visualState.rulersVisible || e.visualState.xrayVisible) && t.push("", `Visual state: rulers=${e.visualState.rulersVisible ? "on" : "off"}; x-ray=${e.visualState.xrayVisible ? "on" : "off"}`), e.targets.length) {
16627
16635
  t.push("", "Targets");
16628
16636
  for (let n of e.targets) {
16629
16637
  let e = n.inspection;
16630
- t.push(`[${n.ref}] ${e.selector}`, ` rect: ${B_(e.rect)}`, ` margin: ${z_(e.margin.top)} ${z_(e.margin.right)} ${z_(e.margin.bottom)} ${z_(e.margin.left)}`, ` padding: ${z_(e.padding.top)} ${z_(e.padding.right)} ${z_(e.padding.bottom)} ${z_(e.padding.left)}`, ` layout: display=${e.layout.display}; position=${e.layout.position}; gap=${e.layout.gap}`, ` typography: ${e.typography.fontSize} / ${e.typography.lineHeight}; weight=${e.typography.fontWeight}; align=${e.typography.textAlign}`), e.text && t.push(` text: ${JSON.stringify(e.text)}`);
16638
+ t.push(`[${n.ref}] ${e.selector}`, ` rect: ${U_(e.rect)}`, ` margin: ${H_(e.margin.top)} ${H_(e.margin.right)} ${H_(e.margin.bottom)} ${H_(e.margin.left)}`, ` padding: ${H_(e.padding.top)} ${H_(e.padding.right)} ${H_(e.padding.bottom)} ${H_(e.padding.left)}`, ` layout: display=${e.layout.display}; position=${e.layout.position}; gap=${e.layout.gap}`, ` typography: ${e.typography.fontSize} / ${e.typography.lineHeight}; weight=${e.typography.fontWeight}; align=${e.typography.textAlign}`), e.text && t.push(` text: ${JSON.stringify(e.text)}`);
16631
16639
  }
16632
16640
  }
16633
16641
  if (e.visualContext.guides.length) {
16634
16642
  t.push("", "Relevant guides");
16635
- for (let n of e.visualContext.guides) t.push(`- ${n.orientation} ${n.orientation === "vertical" ? "x" : "y"}=${z_(n.position)}`);
16643
+ for (let n of e.visualContext.guides) t.push(`- ${n.orientation} ${n.orientation === "vertical" ? "x" : "y"}=${H_(n.position)}`);
16636
16644
  }
16637
16645
  if (e.visualContext.measurements.length) {
16638
16646
  t.push("", "Relevant measurements");
16639
- for (let n of e.visualContext.measurements) t.push(`- ${n.targetRef ? `${n.targetRef}: ` : ""}${B_(n.rect)}; delta=${z_(n.deltaX)} × ${z_(n.deltaY)}`);
16647
+ for (let n of e.visualContext.measurements) t.push(`- ${n.targetRef ? `${n.targetRef}: ` : ""}${U_(n.rect)}; delta=${H_(n.deltaX)} × ${H_(n.deltaY)}`);
16640
16648
  }
16641
16649
  if (e.visualContext.distances.length) {
16642
16650
  t.push("", "Relevant distances");
16643
16651
  for (let n of e.visualContext.distances) {
16644
- let e = [n.targetARef, n.targetBRef].filter(Boolean).join(" → "), r = [n.horizontal ? `horizontal=${z_(n.horizontal.value)}` : null, n.vertical ? `vertical=${z_(n.vertical.value)}` : null].filter(Boolean).join("; ");
16652
+ let e = [n.targetARef, n.targetBRef].filter(Boolean).join(" → "), r = [n.horizontal ? `horizontal=${H_(n.horizontal.value)}` : null, n.vertical ? `vertical=${H_(n.vertical.value)}` : null].filter(Boolean).join("; ");
16645
16653
  t.push(`- ${e ? `${e}: ` : ""}${r || "overlapping"}`);
16646
16654
  }
16647
16655
  }
16648
16656
  return t.join("\n").trimEnd();
16649
16657
  }
16650
- function H_(e) {
16651
- let t = O_([
16658
+ function G_(e) {
16659
+ let t = j_([
16652
16660
  ...e.regions,
16653
16661
  ...e.targets.map((e) => e.inspection.rect),
16654
16662
  ...e.visualContext.measurements.map((e) => e.rect),
@@ -16678,7 +16686,7 @@ function H_(e) {
16678
16686
  captures: n
16679
16687
  };
16680
16688
  }
16681
- var U_ = (e, t, n, r, i) => {
16689
+ var K_ = (e, t, n, r, i) => {
16682
16690
  !Number.isFinite(r) || !Number.isFinite(i) || Math.abs(r - i) < .01 || e.push({
16683
16691
  kind: t,
16684
16692
  label: n,
@@ -16687,16 +16695,16 @@ var U_ = (e, t, n, r, i) => {
16687
16695
  delta: i - r,
16688
16696
  unit: "px"
16689
16697
  });
16690
- }, W_ = (e, t, n, r) => e.push({
16698
+ }, q_ = (e, t, n, r) => e.push({
16691
16699
  kind: "missing",
16692
16700
  evidence: t,
16693
16701
  id: n,
16694
16702
  label: r
16695
16703
  });
16696
- function G_(e) {
16704
+ function J_(e) {
16697
16705
  let t = e.runtime.annotation(e.annotationId);
16698
16706
  if (!t) throw Error(`Mesurer annotation not found: ${e.annotationId}`);
16699
- let n = R_({
16707
+ let n = V_({
16700
16708
  runtime: e.runtime,
16701
16709
  ownerDocument: e.ownerDocument,
16702
16710
  ownerWindow: e.ownerWindow,
@@ -16705,41 +16713,41 @@ function G_(e) {
16705
16713
  if (n.scope.kind !== "annotation") throw Error("Mesurer annotation context invariant failed.");
16706
16714
  let r = e.runtime.snapshot();
16707
16715
  if (!r) throw Error("Mesurer workspace is not ready yet.");
16708
- let i = A_({
16716
+ let i = N_({
16709
16717
  measurements: r.measurements,
16710
16718
  activeMeasurement: r.activeMeasurement
16711
16719
  }), a = [];
16712
16720
  for (let e of t.baseline.targets) {
16713
16721
  let t = n.targets.find((t) => t.ref === e.id);
16714
16722
  if (!t) {
16715
- W_(a, "target", e.id, e.selector);
16723
+ q_(a, "target", e.id, e.selector);
16716
16724
  continue;
16717
16725
  }
16718
- U_(a, "target-rect", `${t.inspection.selector} left`, e.rect.left, t.inspection.rect.left), U_(a, "target-rect", `${t.inspection.selector} top`, e.rect.top, t.inspection.rect.top), U_(a, "target-rect", `${t.inspection.selector} width`, e.rect.width, t.inspection.rect.width), U_(a, "target-rect", `${t.inspection.selector} height`, e.rect.height, t.inspection.rect.height);
16726
+ K_(a, "target-rect", `${t.inspection.selector} left`, e.rect.left, t.inspection.rect.left), K_(a, "target-rect", `${t.inspection.selector} top`, e.rect.top, t.inspection.rect.top), K_(a, "target-rect", `${t.inspection.selector} width`, e.rect.width, t.inspection.rect.width), K_(a, "target-rect", `${t.inspection.selector} height`, e.rect.height, t.inspection.rect.height);
16719
16727
  }
16720
16728
  for (let e of t.baseline.guides) {
16721
16729
  let t = n.visualContext.guides.find((t) => t.id === e.id) ?? r.guides.find((t) => t.id === e.id);
16722
16730
  if (!t) {
16723
- W_(a, "guide", e.id, `${e.orientation} guide ${e.id}`);
16731
+ q_(a, "guide", e.id, `${e.orientation} guide ${e.id}`);
16724
16732
  continue;
16725
16733
  }
16726
- U_(a, "guide", `${e.orientation} guide ${e.id}`, e.position, t.position);
16734
+ K_(a, "guide", `${e.orientation} guide ${e.id}`, e.position, t.position);
16727
16735
  }
16728
16736
  for (let e of t.baseline.measurements) {
16729
16737
  let t = n.visualContext.measurements.find((t) => t.id === e.id) ?? i.find((t) => t.id === e.id);
16730
16738
  if (!t) {
16731
- W_(a, "measurement", e.id, e.id);
16739
+ q_(a, "measurement", e.id, e.id);
16732
16740
  continue;
16733
16741
  }
16734
- U_(a, "measurement", `${e.id} width`, e.rect.width, t.rect.width), U_(a, "measurement", `${e.id} height`, e.rect.height, t.rect.height);
16742
+ K_(a, "measurement", `${e.id} width`, e.rect.width, t.rect.width), K_(a, "measurement", `${e.id} height`, e.rect.height, t.rect.height);
16735
16743
  }
16736
16744
  for (let e of t.baseline.distances) {
16737
16745
  let t = n.visualContext.distances.find((t) => t.id === e.id) ?? r.heldDistances.find((t) => t.id === e.id);
16738
16746
  if (!t) {
16739
- W_(a, "distance", e.id, e.id);
16747
+ q_(a, "distance", e.id, e.id);
16740
16748
  continue;
16741
16749
  }
16742
- e.horizontal && t.horizontal ? U_(a, "distance", `${e.id} horizontal`, e.horizontal.value, t.horizontal.value) : e.horizontal && !t.horizontal && W_(a, "distance", e.id, `${e.id} horizontal`), e.vertical && t.vertical ? U_(a, "distance", `${e.id} vertical`, e.vertical.value, t.vertical.value) : e.vertical && !t.vertical && W_(a, "distance", e.id, `${e.id} vertical`);
16750
+ e.horizontal && t.horizontal ? K_(a, "distance", `${e.id} horizontal`, e.horizontal.value, t.horizontal.value) : e.horizontal && !t.horizontal && q_(a, "distance", e.id, `${e.id} horizontal`), e.vertical && t.vertical ? K_(a, "distance", `${e.id} vertical`, e.vertical.value, t.vertical.value) : e.vertical && !t.vertical && q_(a, "distance", e.id, `${e.id} vertical`);
16743
16751
  }
16744
16752
  return {
16745
16753
  schema: "mesurer.review/v1",
@@ -16751,7 +16759,7 @@ function G_(e) {
16751
16759
  changes: a
16752
16760
  };
16753
16761
  }
16754
- async function K_(e, t, n) {
16762
+ async function Y_(e, t, n) {
16755
16763
  try {
16756
16764
  if (t.navigator.clipboard?.writeText) {
16757
16765
  await t.navigator.clipboard.writeText(n);
@@ -16765,77 +16773,77 @@ async function K_(e, t, n) {
16765
16773
  }
16766
16774
  //#endregion
16767
16775
  //#region src/version.ts
16768
- var q_ = "0.1.8-beta.2", J_ = "mesurer.context", Y_ = "context:v1", X_ = "mesurer.context.settings", Z_ = "context.ui", Q_ = "data-mesurer-direct-text-edit-active", $_ = {
16776
+ var X_ = "0.1.8", Z_ = "mesurer.context", Q_ = "context:v1", $_ = "mesurer.context.settings", ev = "context.ui", tv = "data-mesurer-direct-text-edit-active", nv = {
16769
16777
  viewBox: "0 0 256 256",
16770
16778
  paths: ["M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"]
16771
- }, ev = {
16779
+ }, rv = {
16772
16780
  viewBox: "0 0 256 256",
16773
16781
  paths: ["M152,40a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16h32A8,8,0,0,1,152,40Zm-8,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM72,32H48A16,16,0,0,0,32,48V72a8,8,0,0,0,16,0V48H72a8,8,0,0,0,0-16Z"]
16774
- }, tv = {
16782
+ }, iv = {
16775
16783
  viewBox: "0 0 256 256",
16776
16784
  paths: ["M229.66,58.34l-32-32a8,8,0,0,0-11.32,0l-96,96A8,8,0,0,0,88,128v32a8,8,0,0,0,8,8h32a8,8,0,0,0,5.66-2.34l96-96A8,8,0,0,0,229.66,58.34ZM124.69,152H104V131.31l64-64L188.69,88ZM200,76.69,179.31,56,192,43.31,212.69,64ZM224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Z"]
16777
- }, nv = async (e, t, n = 1) => {
16785
+ }, av = async (e, t, n = 1) => {
16778
16786
  await e.fonts?.ready;
16779
16787
  for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
16780
- }, rv = (e, t, n) => {
16781
- let r = async (r) => R_({
16788
+ }, ov = (e, t, n) => {
16789
+ let r = async (r) => V_({
16782
16790
  runtime: e,
16783
16791
  ownerDocument: t,
16784
16792
  ownerWindow: n,
16785
16793
  request: r
16786
- }), i = async (e) => V_(await r(e));
16794
+ }), i = async (e) => W_(await r(e));
16787
16795
  return {
16788
16796
  context: r,
16789
16797
  contextText: i,
16790
- copyContext: async (e) => K_(t, n, await i(e)),
16791
- select: async (i) => (e.select(Array.isArray(i) ? i : [i]), await nv(t, n), r({ scope: "selection" })),
16798
+ copyContext: async (e) => Y_(t, n, await i(e)),
16799
+ select: async (i) => (e.select(Array.isArray(i) ? i : [i]), await av(t, n), r({ scope: "selection" })),
16792
16800
  annotations: async () => e.annotations(),
16793
16801
  removeAnnotation: async (r) => {
16794
- e.removeAnnotation(r), await nv(t, n);
16802
+ e.removeAnnotation(r), await av(t, n);
16795
16803
  },
16796
- review: async (r) => (await nv(t, n), r ? G_({
16804
+ review: async (r) => (await av(t, n), r ? J_({
16797
16805
  runtime: e,
16798
16806
  ownerDocument: t,
16799
16807
  ownerWindow: n,
16800
16808
  annotationId: r
16801
- }) : e.annotations().map((r) => G_({
16809
+ }) : e.annotations().map((r) => J_({
16802
16810
  runtime: e,
16803
16811
  ownerDocument: t,
16804
16812
  ownerWindow: n,
16805
16813
  annotationId: r.id
16806
16814
  }))),
16807
- capturePlan: async (e) => H_(await r(e)),
16815
+ capturePlan: async (e) => G_(await r(e)),
16808
16816
  prepareCapture: async () => {
16809
- e.prepareCapture(), await nv(t, n);
16817
+ e.prepareCapture(), await av(t, n);
16810
16818
  },
16811
16819
  finishCapture: async () => {
16812
- e.finishCapture(), await nv(t, n);
16820
+ e.finishCapture(), await av(t, n);
16813
16821
  }
16814
16822
  };
16815
- }, iv = (e) => {
16823
+ }, sv = (e) => {
16816
16824
  let t = e.currentSelection();
16817
16825
  return t.elements.length > 0 || t.region !== null;
16818
16826
  };
16819
- function av(e = {}) {
16827
+ function cv(e = {}) {
16820
16828
  return {
16821
- id: J_,
16822
- version: q_,
16829
+ id: Z_,
16830
+ version: X_,
16823
16831
  requires: ["runtime:solid"],
16824
- provides: [Y_],
16832
+ provides: [Q_],
16825
16833
  setup(t) {
16826
16834
  let n = t.service.get("runtime:solid");
16827
16835
  if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
16828
- let r = n.createWorkspaceRuntime(J_), i = rv(r, n.ownerDocument, n.ownerWindow);
16829
- t.service.provide(Y_, i), t.state.register({
16830
- id: X_,
16836
+ let r = n.createWorkspaceRuntime(Z_), i = ov(r, n.ownerDocument, n.ownerWindow);
16837
+ t.service.provide(Q_, i), t.state.register({
16838
+ id: $_,
16831
16839
  initial: { ui: e.ui ?? !0 },
16832
16840
  persist: !0
16833
16841
  }), t.state.register({
16834
- id: Z_,
16835
- initial: { hasSelection: iv(r) }
16842
+ id: ev,
16843
+ initial: { hasSelection: sv(r) }
16836
16844
  });
16837
- let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(Z_)?.hasSelection === !0, s = (e) => {
16838
- t.state.update(X_, (t) => ({
16845
+ let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(ev)?.hasSelection === !0, s = (e) => {
16846
+ t.state.update($_, (t) => ({
16839
16847
  ...t,
16840
16848
  ui: e
16841
16849
  }));
@@ -16849,21 +16857,21 @@ function av(e = {}) {
16849
16857
  region: e.region ? { ...e.region } : null
16850
16858
  }, r.selectGestureActive() ? c?.abandonNoteComposer() : n && c?.closeNoteComposer();
16851
16859
  let i = e.elements.length > 0 || e.region !== null;
16852
- i !== (t.state.get(Z_)?.hasSelection ?? !1) && t.state.update(Z_, () => ({ hasSelection: i }));
16860
+ i !== (t.state.get(ev)?.hasSelection ?? !1) && t.state.update(ev, () => ({ hasSelection: i }));
16853
16861
  });
16854
16862
  t.command.register("context.copy", () => i.copyContext()), t.command.register("context.copy-selection", () => i.copyContext({ scope: "selection" }));
16855
16863
  let g = () => {
16856
16864
  let e = u?.element;
16857
- e && (n.rendererRoot?.hasAttribute(Q_) ? e.setAttribute(Q_, "true") : e.removeAttribute(Q_));
16865
+ e && (n.rendererRoot?.hasAttribute(tv) ? e.setAttribute(tv, "true") : e.removeAttribute(tv));
16858
16866
  }, _ = () => {
16859
16867
  d?.disconnect(), d = null, c = null, l?.(), l = null, u?.dispose(), u = null;
16860
16868
  }, v = () => {
16861
16869
  if (u) return;
16862
- if (u = dg(n), u.element.dataset.mesurerLayer = "evidence", u.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
16870
+ if (u = mg(n), u.element.dataset.mesurerLayer = "evidence", u.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
16863
16871
  let e = new n.ownerWindow.MutationObserver(g);
16864
16872
  d = e, e.observe(n.rendererRoot, {
16865
16873
  attributes: !0,
16866
- attributeFilter: [Q_]
16874
+ attributeFilter: [tv]
16867
16875
  }), g();
16868
16876
  }
16869
16877
  let e = {
@@ -16874,7 +16882,7 @@ function av(e = {}) {
16874
16882
  },
16875
16883
  coordinateSpace: "document"
16876
16884
  };
16877
- l = _i(() => Rr(sg, gi(e, { get ownerWindow() {
16885
+ l = _i(() => Rr(ug, gi(e, { get ownerWindow() {
16878
16886
  return n.ownerWindow;
16879
16887
  } })), u.element);
16880
16888
  }, y = () => {
@@ -16886,7 +16894,7 @@ function av(e = {}) {
16886
16894
  shortcut: "C",
16887
16895
  command: "context.copy",
16888
16896
  order: 70,
16889
- icon: $_,
16897
+ icon: nv,
16890
16898
  hidden: () => !a()
16891
16899
  }), t.tool.register({
16892
16900
  id: "context.copy-selection",
@@ -16894,7 +16902,7 @@ function av(e = {}) {
16894
16902
  shortcut: "Shift+C",
16895
16903
  command: "context.copy-selection",
16896
16904
  order: 71,
16897
- icon: ev,
16905
+ icon: rv,
16898
16906
  hidden: () => !a(),
16899
16907
  disabled: () => !o()
16900
16908
  }), t.tool.register({
@@ -16903,7 +16911,7 @@ function av(e = {}) {
16903
16911
  shortcut: "N",
16904
16912
  command: "context.add-note",
16905
16913
  order: 72,
16906
- icon: tv,
16914
+ icon: iv,
16907
16915
  hidden: () => !a(),
16908
16916
  disabled: () => !o()
16909
16917
  }), t.settings.register({
@@ -16926,7 +16934,7 @@ function av(e = {}) {
16926
16934
  }
16927
16935
  //#endregion
16928
16936
  //#region src/host-layer.ts
16929
- var ov = {
16937
+ var lv = {
16930
16938
  display: "block",
16931
16939
  position: "fixed",
16932
16940
  inset: "0",
@@ -16968,48 +16976,48 @@ var ov = {
16968
16976
  "letter-spacing": "normal",
16969
16977
  direction: "ltr"
16970
16978
  };
16971
- function sv(e) {
16972
- for (let [t, n] of Object.entries(ov)) e.style.setProperty(t, n, "important");
16979
+ function uv(e) {
16980
+ for (let [t, n] of Object.entries(lv)) e.style.setProperty(t, n, "important");
16973
16981
  }
16974
- function cv(e) {
16982
+ function dv(e) {
16975
16983
  return "popover" in e && "showPopover" in e && typeof e.showPopover == "function" && "hidePopover" in e && typeof e.hidePopover == "function";
16976
16984
  }
16977
- var lv = (e) => "newState" in e, uv = (e) => e.localName === "dialog";
16978
- function dv(e) {
16979
- if (!uv(e) || !e.open) return !1;
16985
+ var fv = (e) => "newState" in e, pv = (e) => e.localName === "dialog";
16986
+ function mv(e) {
16987
+ if (!pv(e) || !e.open) return !1;
16980
16988
  try {
16981
16989
  return e.matches(":modal");
16982
16990
  } catch {
16983
16991
  return !1;
16984
16992
  }
16985
16993
  }
16986
- function fv(e, t, n = !0) {
16987
- sv(e);
16994
+ function hv(e, t, n = !0) {
16995
+ uv(e);
16988
16996
  let r = e.ownerDocument, i = r.defaultView ?? window, a = t, o = !1, s = "fixed", c = !1, l = 0, u = [];
16989
- if (n && cv(e) && (e.popover = "manual"), t.append(e), n && cv(e)) try {
16997
+ if (n && dv(e) && (e.popover = "manual"), t.append(e), n && dv(e)) try {
16990
16998
  e.showPopover(), c = e.matches(":popover-open"), c && (s = "top-layer");
16991
16999
  } catch {
16992
17000
  e.removeAttribute("popover");
16993
17001
  }
16994
17002
  let d = () => {
16995
- if (!(!c || !cv(e))) try {
17003
+ if (!(!c || !dv(e))) try {
16996
17004
  e.matches(":popover-open") || e.showPopover();
16997
17005
  } catch {}
16998
17006
  }, f = (t) => {
16999
17007
  if (e.parentNode === t) return;
17000
- let n = c && cv(e) && e.matches(":popover-open");
17001
- if (n && cv(e)) try {
17008
+ let n = c && dv(e) && e.matches(":popover-open");
17009
+ if (n && dv(e)) try {
17002
17010
  e.hidePopover();
17003
17011
  } catch {}
17004
- t.append(e), sv(e), n && d();
17012
+ t.append(e), uv(e), n && d();
17005
17013
  }, p = () => {
17006
- u = u.filter((e) => e.isConnected && dv(e)), f(u.at(-1) ?? a);
17014
+ u = u.filter((e) => e.isConnected && mv(e)), f(u.at(-1) ?? a);
17007
17015
  }, m = (e) => {
17008
17016
  u = u.filter((t) => t !== e), u.push(e), p();
17009
17017
  }, h = (e) => {
17010
17018
  u = u.filter((t) => t !== e), p();
17011
17019
  }, g = () => {
17012
- if (!(o || !c || !cv(e))) try {
17020
+ if (!(o || !c || !dv(e))) try {
17013
17021
  e.matches(":popover-open") && e.hidePopover(), e.showPopover();
17014
17022
  } catch {}
17015
17023
  }, _ = () => {
@@ -17018,27 +17026,27 @@ function fv(e, t, n = !0) {
17018
17026
  }));
17019
17027
  }, v = (t) => {
17020
17028
  if (!c || t.target === e) return;
17021
- let n = lv(t) ? t.newState : void 0, r = t.target;
17029
+ let n = fv(t) ? t.newState : void 0, r = t.target;
17022
17030
  if (r instanceof i.Element) {
17023
- if (uv(r)) {
17024
- n === "open" && dv(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
17031
+ if (pv(r)) {
17032
+ n === "open" && mv(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
17025
17033
  return;
17026
17034
  }
17027
17035
  n === "open" && r.hasAttribute("popover") && _();
17028
17036
  }
17029
17037
  }, y = (e) => {
17030
17038
  let t = e.target;
17031
- t instanceof i.Element && uv(t) && h(t);
17039
+ t instanceof i.Element && pv(t) && h(t);
17032
17040
  }, b = () => {
17033
17041
  r.fullscreenElement && _();
17034
17042
  }, x = (e) => {
17035
- dv(e) && m(e);
17036
- for (let t of e.querySelectorAll("dialog")) dv(t) && m(t);
17043
+ mv(e) && m(e);
17044
+ for (let t of e.querySelectorAll("dialog")) mv(t) && m(t);
17037
17045
  }, S = new i.MutationObserver((e) => {
17038
17046
  if (c) for (let t of e) {
17039
17047
  if (t.type === "attributes") {
17040
17048
  let e = t.target;
17041
- e instanceof i.Element && uv(e) && (dv(e) ? m(e) : h(e));
17049
+ e instanceof i.Element && pv(e) && (mv(e) ? m(e) : h(e));
17042
17050
  }
17043
17051
  for (let e of t.addedNodes) e instanceof i.Element && x(e);
17044
17052
  u.some((e) => !e.isConnected) && p();
@@ -17054,7 +17062,7 @@ function fv(e, t, n = !0) {
17054
17062
  bringToFront: g,
17055
17063
  dispose() {
17056
17064
  if (!o) {
17057
- if (o = !0, l && i.cancelAnimationFrame(l), r.removeEventListener("toggle", v, !0), r.removeEventListener("close", y, !0), r.removeEventListener("fullscreenchange", b, !0), S.disconnect(), c && cv(e) && e.matches(":popover-open")) try {
17065
+ if (o = !0, l && i.cancelAnimationFrame(l), r.removeEventListener("toggle", v, !0), r.removeEventListener("close", y, !0), r.removeEventListener("fullscreenchange", b, !0), S.disconnect(), c && dv(e) && e.matches(":popover-open")) try {
17058
17066
  e.hidePopover();
17059
17067
  } catch {}
17060
17068
  u = [];
@@ -17064,31 +17072,31 @@ function fv(e, t, n = !0) {
17064
17072
  }
17065
17073
  //#endregion
17066
17074
  //#region src/arrange.ts
17067
- var pv = Fd, mv = () => ({
17075
+ var gv = Fd, _v = () => ({
17068
17076
  ...Sf(),
17069
- version: q_
17070
- }), hv = "mesurer.codex", gv = "codex:v1", _v = "context:v1", vv = "http://127.0.0.1:47365", yv = 2e3, bv = 750, xv = 1800, Sv = 2e3, Cv = 12e4, wv = 10, Tv = 5, Ev = [
17077
+ version: X_
17078
+ }), vv = "mesurer.codex", yv = "codex:v1", bv = "context:v1", xv = "http://127.0.0.1:47365", Sv = 2e3, Cv = 750, wv = 1800, Tv = 2e3, Ev = 12e4, Dv = 10, Ov = 5, kv = [
17071
17079
  "Implement the current human feedback from Mesurer in this project.",
17072
17080
  "Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
17073
17081
  "and verify the affected UI in the live page with Mesurer before claiming completion."
17074
- ].join(" "), Dv = {
17082
+ ].join(" "), Av = {
17075
17083
  viewBox: "0 0 256 256",
17076
17084
  paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
17077
- }, Ov = {
17085
+ }, jv = {
17078
17086
  viewBox: "0 0 256 256",
17079
17087
  paths: ["M72,32H184a8,8,0,0,1,0,16h-8v20.69a40,40,0,0,1-11.72,28.28L137.25,124l27.03,27.03A40,40,0,0,1,176,179.31V208h8a8,8,0,0,1,0,16H72a8,8,0,0,1,0-16h8V179.31a40,40,0,0,1,11.72-28.28L118.75,124,91.72,96.97A40,40,0,0,1,80,68.69V48H72a8,8,0,0,1,0-16Zm24,16V68.69a24,24,0,0,0,7.03,16.97L128,110.63l24.97-24.97A24,24,0,0,0,160,68.69V48Zm32,90.63-24.97,24.97A24,24,0,0,0,96,180.57V208h64V180.57a24,24,0,0,0-7.03-16.97Z"]
17080
- }, kv = {
17088
+ }, Mv = {
17081
17089
  viewBox: "0 0 256 256",
17082
17090
  paths: ["M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"]
17083
- }, Av = (e) => {
17091
+ }, Nv = (e) => {
17084
17092
  try {
17085
17093
  let t = globalThis.location;
17086
17094
  return t?.origin ? `mesurer-codex-ui:v1:${e}:${t.origin}${t.pathname}` : null;
17087
17095
  } catch {
17088
17096
  return null;
17089
17097
  }
17090
- }, jv = (e) => {
17091
- let t = Av(e);
17098
+ }, Pv = (e) => {
17099
+ let t = Nv(e);
17092
17100
  if (!t) return null;
17093
17101
  try {
17094
17102
  let e = globalThis.sessionStorage?.getItem(t);
@@ -17113,18 +17121,18 @@ var pv = Fd, mv = () => ({
17113
17121
  } catch {
17114
17122
  return null;
17115
17123
  }
17116
- }, Mv = (e, t) => {
17117
- let n = Av(e);
17124
+ }, Fv = (e, t) => {
17125
+ let n = Nv(e);
17118
17126
  if (n) try {
17119
17127
  globalThis.sessionStorage?.setItem(n, JSON.stringify(t));
17120
17128
  } catch {}
17121
- }, Nv = (e, t) => {
17129
+ }, Iv = (e, t) => {
17122
17130
  let n = e.endsWith("/") ? e : `${e}/`;
17123
17131
  return new URL(t, n).toString();
17124
- }, Pv = async (e, t, n) => {
17132
+ }, Lv = async (e, t, n) => {
17125
17133
  let r = new AbortController(), i = setTimeout(() => r.abort(), 15e3);
17126
17134
  try {
17127
- let i = await fetch(Nv(e, t), {
17135
+ let i = await fetch(Iv(e, t), {
17128
17136
  ...n,
17129
17137
  signal: r.signal
17130
17138
  }), a = await i.text(), o = {};
@@ -17140,10 +17148,10 @@ var pv = Fd, mv = () => ({
17140
17148
  } finally {
17141
17149
  clearTimeout(i);
17142
17150
  }
17143
- }, Fv = (e) => ({
17151
+ }, Rv = (e) => ({
17144
17152
  thread: e.thread?.trim() || null,
17145
17153
  threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
17146
- }), Iv = (e) => {
17154
+ }), zv = (e) => {
17147
17155
  let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
17148
17156
  if (!t || !n || !r) throw Error("Mesurer Codex bridge returned an invalid delivery state.");
17149
17157
  let i = {
@@ -17155,7 +17163,7 @@ var pv = Fd, mv = () => ({
17155
17163
  updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
17156
17164
  };
17157
17165
  return e.queuedSubmissionId !== void 0 && (i.queuedSubmissionId = e.queuedSubmissionId?.trim() || null), e.dispatch !== void 0 && (i.dispatch = e.dispatch), e.dispatchError !== void 0 && (i.dispatchError = e.dispatchError?.trim() || null), i;
17158
- }, Lv = (e) => ({
17166
+ }, Bv = (e) => ({
17159
17167
  thread: e.thread?.trim() || null,
17160
17168
  threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
17161
17169
  let t = e.id?.trim() ?? "";
@@ -17167,7 +17175,7 @@ var pv = Fd, mv = () => ({
17167
17175
  }] : [];
17168
17176
  }) : [],
17169
17177
  hasMore: e.hasMore === !0
17170
- }), Rv = async (e, t, n) => {
17178
+ }), Vv = async (e, t, n) => {
17171
17179
  let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = a ? a.flatMap((e) => {
17172
17180
  let t = i.find((t) => t.id === e);
17173
17181
  return t ? [t] : [];
@@ -17190,18 +17198,18 @@ var pv = Fd, mv = () => ({
17190
17198
  ])
17191
17199
  ].join("\n").trimEnd()
17192
17200
  };
17193
- }, zv = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, Bv = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Vv = (e, t) => e instanceof Error && e.message === `Mesurer Codex bridge is unavailable at ${t}. Start the local bridge before queueing feedback.`;
17194
- function Hv(e = {}) {
17195
- let t = e.endpoint ?? vv, n = e.instruction?.trim() || Ev, r = e.ui ?? !0, i = e.clearCompletedAnnotations ?? !0;
17201
+ }, Hv = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, Uv = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Wv = (e, t) => e instanceof Error && e.message === `Mesurer Codex bridge is unavailable at ${t}. Start the local bridge before queueing feedback.`;
17202
+ function Gv(e = {}) {
17203
+ let t = e.endpoint ?? xv, n = e.instruction?.trim() || kv, r = e.ui ?? !0, i = e.clearCompletedAnnotations ?? !0;
17196
17204
  return {
17197
- id: hv,
17198
- version: q_,
17199
- requires: [_v],
17200
- provides: [gv],
17205
+ id: vv,
17206
+ version: X_,
17207
+ requires: [bv],
17208
+ provides: [yv],
17201
17209
  setup(e) {
17202
- let a = e.service.get(_v);
17210
+ let a = e.service.get(bv);
17203
17211
  if (!a) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
17204
- let o = r ? jv(t) : null, s = "unknown", c = !1, l = o?.originThread ?? null, u = o?.selectedThread ?? o?.originThread ?? null, d = !1, f = null, p = [], m = [], h = !1, g = Tv, _, v = "", y = null, b = o?.delivery ? {
17212
+ let o = r ? Pv(t) : null, s = "unknown", c = !1, l = o?.originThread ?? null, u = o?.selectedThread ?? o?.originThread ?? null, d = !1, f = null, p = [], m = [], h = !1, g = Ov, _, v = "", y = null, b = o?.delivery ? {
17205
17213
  id: o.delivery.id,
17206
17214
  thread: o.delivery.thread,
17207
17215
  status: o.delivery.status,
@@ -17209,22 +17217,22 @@ function Hv(e = {}) {
17209
17217
  queuedSubmissionId: o.delivery.queuedSubmissionId ?? null,
17210
17218
  dispatch: o.delivery.dispatch ?? null,
17211
17219
  dispatchError: o.delivery.dispatchError ?? null
17212
- } : null, x = 0, S = 0, C = null, w = !1, T = async () => Fv(await Pv(t, "health")), E = async (e) => Iv(await Pv(t, `deliveries/${encodeURIComponent(e)}`)), D = async (e) => {
17220
+ } : null, x = 0, S = 0, C = null, w = !1, T = async () => Rv(await Lv(t, "health")), E = async (e) => zv(await Lv(t, `deliveries/${encodeURIComponent(e)}`)), D = async (e) => {
17213
17221
  if (!e.id || !e.thread) throw Error("Cannot restore a Codex delivery without its id and thread.");
17214
17222
  let n = {
17215
17223
  deliveryId: e.id,
17216
17224
  thread: e.thread
17217
17225
  };
17218
- return e.queuedSubmissionId && (n.queuedSubmissionId = e.queuedSubmissionId), Iv(await Pv(t, "deliveries/restore", {
17226
+ return e.queuedSubmissionId && (n.queuedSubmissionId = e.queuedSubmissionId), zv(await Lv(t, "deliveries/restore", {
17219
17227
  method: "POST",
17220
17228
  headers: { "Content-Type": "application/json" },
17221
17229
  body: JSON.stringify(n)
17222
17230
  }));
17223
17231
  }, O = async (e = {}) => {
17224
17232
  let n = new URLSearchParams();
17225
- n.set("limit", String(e.limit ?? wv));
17233
+ n.set("limit", String(e.limit ?? Dv));
17226
17234
  let r = e.thread?.trim();
17227
- return r && n.set("thread", r), Lv(await Pv(t, `threads?${n.toString()}`));
17235
+ return r && n.set("thread", r), Bv(await Lv(t, `threads?${n.toString()}`));
17228
17236
  }, k = () => u ?? l ?? (d ? null : f), A = () => {
17229
17237
  if (!r) return;
17230
17238
  let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "interrupted") ? {
@@ -17236,7 +17244,7 @@ function Hv(e = {}) {
17236
17244
  dispatch: b.dispatch,
17237
17245
  dispatchError: b.dispatchError
17238
17246
  } : null;
17239
- Mv(t, {
17247
+ Fv(t, {
17240
17248
  version: 1,
17241
17249
  originThread: l,
17242
17250
  selectedThread: u,
@@ -17254,12 +17262,12 @@ function Hv(e = {}) {
17254
17262
  "queueing",
17255
17263
  "queued",
17256
17264
  "working"
17257
- ].includes(b.status) ? Ov : b.status === "completed" ? kv : Dv : Dv, L = () => {
17265
+ ].includes(b.status) ? jv : b.status === "completed" ? Mv : Av : Av, L = () => {
17258
17266
  let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
17259
17267
  t.has(n.id) || (t.add(n.id), e.push(n));
17260
17268
  }, r = (e) => ({
17261
17269
  id: e,
17262
- title: `Codex ${zv(e)}`,
17270
+ title: `Codex ${Hv(e)}`,
17263
17271
  updatedAt: null,
17264
17272
  connected: !0
17265
17273
  });
@@ -17279,7 +17287,7 @@ function Hv(e = {}) {
17279
17287
  let t = e.id === l ? "Current · " : e.connected ? "Connected · " : "", r = b?.thread === e.id ? ` · ${N() ? "Blocked" : P(b.status)}` : "";
17280
17288
  return {
17281
17289
  id: `codex.thread.${e.id}`,
17282
- label: `${t}${Bv(e.title)}${r}`,
17290
+ label: `${t}${Uv(e.title)}${r}`,
17283
17291
  checked: () => n === e.id,
17284
17292
  disabled: () => M(),
17285
17293
  run() {
@@ -17287,11 +17295,11 @@ function Hv(e = {}) {
17287
17295
  }
17288
17296
  };
17289
17297
  });
17290
- return g < wv && (e.length > g || h) && r.push({
17298
+ return g < Dv && (e.length > g || h) && r.push({
17291
17299
  id: "codex.thread.show-more",
17292
17300
  label: "Show 5 more…",
17293
17301
  run() {
17294
- g = wv, B();
17302
+ g = Dv, B();
17295
17303
  }
17296
17304
  }), r;
17297
17305
  }, B = () => {
@@ -17327,14 +17335,14 @@ function Hv(e = {}) {
17327
17335
  let e = l && p.includes(l) ? l : f;
17328
17336
  try {
17329
17337
  let t = await O({
17330
- limit: wv,
17338
+ limit: Dv,
17331
17339
  thread: e ?? void 0
17332
17340
  });
17333
17341
  m = t.threads, h = t.hasMore;
17334
17342
  } catch {
17335
17343
  m = p.map((e) => ({
17336
17344
  id: e,
17337
- title: `Codex ${zv(e)}`,
17345
+ title: `Codex ${Hv(e)}`,
17338
17346
  updatedAt: null,
17339
17347
  connected: !0
17340
17348
  })), h = !1;
@@ -17357,7 +17365,7 @@ function Hv(e = {}) {
17357
17365
  }, ee = () => {
17358
17366
  S && globalThis.clearTimeout(S), S = globalThis.setTimeout(() => {
17359
17367
  S = 0, b?.status === "completed" && (b = null, A(), B());
17360
- }, xv);
17368
+ }, wv);
17361
17369
  }, U = async (e) => {
17362
17370
  if (!(!b || b.id !== e.id)) {
17363
17371
  if (b = {
@@ -17375,14 +17383,14 @@ function Hv(e = {}) {
17375
17383
  if (e.status === "interrupted") {
17376
17384
  A(), B();
17377
17385
  let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
17378
- Date.now() - t < Cv && (x = globalThis.setTimeout(() => {
17386
+ Date.now() - t < Ev && (x = globalThis.setTimeout(() => {
17379
17387
  x = 0, te(e.id);
17380
- }, Sv));
17388
+ }, Tv));
17381
17389
  return;
17382
17390
  }
17383
17391
  B(), x = globalThis.setTimeout(() => {
17384
17392
  x = 0, te(e.id);
17385
- }, bv);
17393
+ }, Cv);
17386
17394
  }
17387
17395
  }, te = async (e) => {
17388
17396
  if (!(w || b?.id !== e)) try {
@@ -17406,7 +17414,7 @@ function Hv(e = {}) {
17406
17414
  b = {
17407
17415
  ...b,
17408
17416
  status: "failed"
17409
- }, A(), Vv(r, t) && (s = "unavailable"), B();
17417
+ }, A(), Wv(r, t) && (s = "unavailable"), B();
17410
17418
  }
17411
17419
  }, ne = {
17412
17420
  health: T,
@@ -17415,7 +17423,7 @@ function Hv(e = {}) {
17415
17423
  async useThread(e) {
17416
17424
  let n = e.trim();
17417
17425
  if (!n) throw Error("Codex thread must be a non-empty string.");
17418
- let r = Fv(await Pv(t, "target", {
17426
+ let r = Rv(await Lv(t, "target", {
17419
17427
  method: "POST",
17420
17428
  headers: { "Content-Type": "application/json" },
17421
17429
  body: JSON.stringify({ thread: n })
@@ -17423,12 +17431,12 @@ function Hv(e = {}) {
17423
17431
  return j(n, !l), f = r.thread, p = r.threads, s = "available", c = !0, B(), r;
17424
17432
  },
17425
17433
  async send(e) {
17426
- let i = await Rv(a, e, n), o = e?.thread?.trim(), c = o || (r ? k() : null);
17434
+ let i = await Vv(a, e, n), o = e?.thread?.trim(), c = o || (r ? k() : null);
17427
17435
  if (r && !o && (d || !c)) throw Error("Choose a Codex thread before queueing feedback.");
17428
17436
  let l = { message: i.message };
17429
17437
  c && (l.thread = c);
17430
17438
  try {
17431
- let e = await Pv(t, "send", {
17439
+ let e = await Lv(t, "send", {
17432
17440
  method: "POST",
17433
17441
  headers: { "Content-Type": "application/json" },
17434
17442
  body: JSON.stringify(l)
@@ -17444,11 +17452,11 @@ function Hv(e = {}) {
17444
17452
  };
17445
17453
  return e.queuedSubmissionId !== void 0 && (r.queuedSubmissionId = e.queuedSubmissionId?.trim() || null), e.dispatch !== void 0 && (r.dispatch = e.dispatch), e.dispatchError !== void 0 && (r.dispatchError = e.dispatchError?.trim() || null), r;
17446
17454
  } catch (e) {
17447
- throw r && Vv(e, t) && (s = "unavailable", B()), e;
17455
+ throw r && Wv(e, t) && (s = "unavailable", B()), e;
17448
17456
  }
17449
17457
  }
17450
17458
  };
17451
- if (e.service.provide(gv, ne), e.command.register("codex.send", async () => {
17459
+ if (e.service.provide(yv, ne), e.command.register("codex.send", async () => {
17452
17460
  if (!(C || M())) return H(), b = {
17453
17461
  id: null,
17454
17462
  thread: k(),
@@ -17478,9 +17486,9 @@ function Hv(e = {}) {
17478
17486
  updatedAt: 0
17479
17487
  }) : x = globalThis.setTimeout(() => {
17480
17488
  x = 0, te(e.deliveryId);
17481
- }, bv) : S = globalThis.setTimeout(() => {
17489
+ }, Cv) : S = globalThis.setTimeout(() => {
17482
17490
  S = 0, b?.id === null && b?.status === "queued" && (b = null, A(), B());
17483
- }, xv);
17491
+ }, wv);
17484
17492
  } catch (e) {
17485
17493
  b = null, A(), B();
17486
17494
  let t = e instanceof Error ? e.message : String(e);
@@ -17495,7 +17503,7 @@ function Hv(e = {}) {
17495
17503
  }, 0));
17496
17504
  let t = globalThis.setInterval(() => {
17497
17505
  c && R().catch(() => void 0);
17498
- }, yv);
17506
+ }, Sv);
17499
17507
  e.lifecycle.onDispose(() => {
17500
17508
  w = !0, H(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
17501
17509
  });
@@ -17505,41 +17513,41 @@ function Hv(e = {}) {
17505
17513
  }
17506
17514
  //#endregion
17507
17515
  //#region src/plugin-catalog.ts
17508
- var Uv = [
17516
+ var Kv = [
17509
17517
  {
17510
- id: J_,
17518
+ id: Z_,
17511
17519
  label: "Context",
17512
17520
  order: 30,
17513
- create: av,
17521
+ create: cv,
17514
17522
  settingsIds: ["context"],
17515
17523
  hiddenSettingsControlIds: ["ui"]
17516
17524
  },
17517
17525
  {
17518
- id: pv,
17526
+ id: gv,
17519
17527
  label: "Arrange",
17520
17528
  order: 35,
17521
- create: mv,
17529
+ create: _v,
17522
17530
  settingsIds: ["arrange"]
17523
17531
  },
17524
17532
  {
17525
- id: Wg,
17533
+ id: qg,
17526
17534
  label: "Screenshot",
17527
17535
  order: 40,
17528
17536
  create: (e = {}) => ({
17529
- ...u_(e),
17530
- version: q_
17537
+ ...p_(e),
17538
+ version: X_
17531
17539
  }),
17532
17540
  settingsIds: ["screenshot"],
17533
17541
  hiddenSettingsControlIds: ["tool"]
17534
17542
  },
17535
17543
  {
17536
- id: hv,
17544
+ id: vv,
17537
17545
  label: "Codex",
17538
17546
  order: 45,
17539
- create: Hv
17547
+ create: Gv
17540
17548
  }
17541
- ], Wv = (e) => {
17542
- let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(Uv.map((e) => e.id)), i = Uv.map((e) => {
17549
+ ], qv = (e) => {
17550
+ let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(Kv.map((e) => e.id)), i = Kv.map((e) => {
17543
17551
  let r = n.get(e.id);
17544
17552
  return {
17545
17553
  ...e,
@@ -17556,12 +17564,12 @@ var Uv = [
17556
17564
  create: () => n
17557
17565
  });
17558
17566
  return i;
17559
- }, Gv = "arrange";
17560
- function Kv(e = {}) {
17567
+ }, Jv = "arrange";
17568
+ function Yv(e = {}) {
17561
17569
  if (!("document" in globalThis)) throw Error("mountMesurer() requires a browser or Electron renderer document.");
17562
17570
  let { target: t = document.body, isolate: n = !0, shadowMode: r = "open", topLayer: i = !0, agent: a = !1, onPluginHost: o, onPluginsReady: s, plugins: c, ...l } = e, u = t.ownerDocument ?? document, d = u.defaultView ?? window, f = u.createElement("div");
17563
17571
  f.dataset.mesurerIsland = "true";
17564
- let p = fv(f, t, i), m = f, h = f, g = f;
17572
+ let p = hv(f, t, i), m = f, h = f, g = f;
17565
17573
  if (n) {
17566
17574
  let e = f.attachShadow({ mode: r });
17567
17575
  h = u.createElement("div"), h.dataset.mesurerIslandMount = "true", e.append(h), m = e, g = e;
@@ -17570,19 +17578,19 @@ function Kv(e = {}) {
17570
17578
  v = e;
17571
17579
  }), S = new Promise((e) => {
17572
17580
  y = e;
17573
- }), C = async () => (await (_ ? Promise.resolve(_) : x), S), w = a === !0 ? {} : a === !1 ? null : a, T = E_({
17581
+ }), C = async () => (await (_ ? Promise.resolve(_) : x), S), w = a === !0 ? {} : a === !1 ? null : a, T = k_({
17574
17582
  ownerDocument: u,
17575
17583
  root: w?.root ?? (t.nodeType === 11 ? t : u),
17576
17584
  getPluginHost: () => _,
17577
17585
  waitForPluginHost: C
17578
17586
  }), E = async () => {
17579
17587
  await T.ready();
17580
- let e = _?.service.get(Y_);
17588
+ let e = _?.service.get(Q_);
17581
17589
  if (!e) throw Error("Mesurer Context is disabled. Enable it in Settings or include context() in plugins.");
17582
17590
  return e;
17583
17591
  }, D = async () => {
17584
17592
  await T.ready();
17585
- let e = _?.service.get(Gv);
17593
+ let e = _?.service.get(Jv);
17586
17594
  if (!e) throw Error("Mesurer Arrange is disabled. Enable it in Settings or include arrange() in plugins.");
17587
17595
  return e;
17588
17596
  }, O = async (e) => (await E()).context(e), k = async (e) => (await E()).contextText(e), A = async (e) => (await E()).copyContext(e), j = async (e) => (await E()).select(e), M = async () => (await E()).annotations(), N = async (e) => (await E()).review(e), P = async (e) => (await E()).capturePlan(e), F = async () => (await E()).prepareCapture(), I = async () => (await E()).finishCapture(), L = async () => (await D()).intents(), R = async (e) => {
@@ -17593,7 +17601,7 @@ function Kv(e = {}) {
17593
17601
  (await D()).show(e, t);
17594
17602
  }, B = async (e, t) => (await D()).capturePlan(e, t), V = async (e, t) => (await D()).review(e, t), H = () => T.textEdits(), ee = (e) => T.textEdit(e), U = Object.assign(T, {
17595
17603
  capabilities: () => {
17596
- let e = !!_?.service.get(Y_);
17604
+ let e = !!_?.service.get(Q_);
17597
17605
  return {
17598
17606
  protocol: "mesurer.agent/v1",
17599
17607
  contextSchema: "mesurer.context/v1",
@@ -17603,8 +17611,8 @@ function Kv(e = {}) {
17603
17611
  annotations: e,
17604
17612
  review: e,
17605
17613
  capturePlan: e,
17606
- arrange: !!_?.service.get(Gv),
17607
- textEdit: !!_?.service.get(w_)
17614
+ arrange: !!_?.service.get(Jv),
17615
+ textEdit: !!_?.service.get(D_)
17608
17616
  }
17609
17617
  };
17610
17618
  },
@@ -17623,9 +17631,9 @@ function Kv(e = {}) {
17623
17631
  reviewArrange: V
17624
17632
  }), te = {
17625
17633
  ...l,
17626
- version: q_,
17627
- plugins: Wv(c)
17628
- }, ne = _i(() => Rr(qh, gi(te, {
17634
+ version: X_,
17635
+ plugins: qv(c)
17636
+ }, ne = _i(() => Rr(Xh, gi(te, {
17629
17637
  portalTarget: g,
17630
17638
  pageTarget: t,
17631
17639
  onPluginHost: (e) => {
@@ -17676,20 +17684,20 @@ function Kv(e = {}) {
17676
17684
  }
17677
17685
  //#endregion
17678
17686
  //#region src/inject.ts
17679
- var { target: qv, globalName: Jv = "__MESURER__", reuseExisting: Yv = !0, ...Xv } = globalThis.__MESURER_CONFIG__ ?? {}, Zv = globalThis.__MESURER_INSTANCE__, Qv = Yv && Zv?.element.isConnected ? Zv : void 0;
17680
- function $v() {
17681
- let e = qv ? document.querySelector(qv) : document.body;
17682
- if (!e) throw Error(`Mesurer injection target not found: ${qv}`);
17683
- return Zv?.dispose(), Kv({
17684
- ...Xv,
17687
+ var { target: Xv, globalName: Zv = "__MESURER__", reuseExisting: Qv = !0, ...$v } = globalThis.__MESURER_CONFIG__ ?? {}, ey = globalThis.__MESURER_INSTANCE__, ty = Qv && ey?.element.isConnected ? ey : void 0;
17688
+ function ny() {
17689
+ let e = Xv ? document.querySelector(Xv) : document.body;
17690
+ if (!e) throw Error(`Mesurer injection target not found: ${Xv}`);
17691
+ return ey?.dispose(), Yv({
17692
+ ...$v,
17685
17693
  target: e,
17686
17694
  agent: {
17687
- globalName: Jv,
17695
+ globalName: Zv,
17688
17696
  root: document
17689
17697
  }
17690
17698
  });
17691
17699
  }
17692
- var ey = Qv ?? $v();
17693
- globalThis.__MESURER_INSTANCE__ = ey, await ey.ready;
17700
+ var ry = ty ?? ny();
17701
+ globalThis.__MESURER_INSTANCE__ = ry, await ry.ready;
17694
17702
  //#endregion
17695
- export { ey as mesurer };
17703
+ export { ry as mesurer };