mesurer-solid 0.1.8-beta.2 → 0.1.8-beta.3

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/index.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,36 +16478,36 @@ 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
16508
  //#endregion
16501
16509
  //#region ../mesurer-core/dist/events.js
16502
- function P_() {
16510
+ function L_() {
16503
16511
  let e = /* @__PURE__ */ new Map();
16504
16512
  return {
16505
16513
  on(t, n) {
@@ -16517,12 +16525,12 @@ function P_() {
16517
16525
  }
16518
16526
  };
16519
16527
  }
16520
- ({ ...M_ }), { ...N_ };
16528
+ ({ ...F_ }), { ...I_ };
16521
16529
  //#endregion
16522
16530
  //#region ../mesurer-core/dist/plugins.js
16523
- var F_ = 50;
16524
- function I_() {
16525
- let e = 1, t = 0, n = P_(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [], m = [], h = (e, t) => {
16531
+ var R_ = 50;
16532
+ function z_() {
16533
+ let e = 1, t = 0, n = L_(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [], m = [], h = (e, t) => {
16526
16534
  n.emit("changed", {
16527
16535
  pluginId: e,
16528
16536
  reason: t
@@ -16583,14 +16591,14 @@ function I_() {
16583
16591
  }
16584
16592
  if (o && s) {
16585
16593
  let e = y("history");
16586
- x(s, e) || (p.push(s), p.length > F_ && p.shift(), m.length = 0);
16594
+ x(s, e) || (p.push(s), p.length > R_ && p.shift(), m.length = 0);
16587
16595
  }
16588
16596
  }, w = () => {
16589
16597
  let e = p.pop();
16590
- return e ? (m.push(y("history")), m.length > F_ && m.shift(), b(e, "history"), h(void 0, "history"), !0) : !1;
16598
+ return e ? (m.push(y("history")), m.length > R_ && m.shift(), b(e, "history"), h(void 0, "history"), !0) : !1;
16591
16599
  }, T = () => {
16592
16600
  let e = m.pop();
16593
- return e ? (p.push(y("history")), p.length > F_ && p.shift(), b(e, "history"), h(void 0, "history"), !0) : !1;
16601
+ return e ? (p.push(y("history")), p.length > R_ && p.shift(), b(e, "history"), h(void 0, "history"), !0) : !1;
16594
16602
  }, E = async (e, t) => {
16595
16603
  for (let n of [...l.values()].filter((t) => t.name === e)) await n.handler(t);
16596
16604
  }, D = (e) => [...u.values()].reverse().find((t) => t.id === e)?.value, O = {
@@ -16747,17 +16755,17 @@ function I_() {
16747
16755
  }
16748
16756
  //#endregion
16749
16757
  //#region src/context.ts
16750
- var L_ = 10, R_ = (e) => ({
16758
+ var B_ = 10, V_ = (e) => ({
16751
16759
  left: e.left,
16752
16760
  top: e.top,
16753
16761
  width: e.width,
16754
16762
  height: e.height
16755
- }), z_ = (e) => {
16763
+ }), H_ = (e) => {
16756
16764
  let t = /* @__PURE__ */ new Set(), n = [];
16757
16765
  for (let r of e) !r?.isConnected || t.has(r) || (t.add(r), n.push(r));
16758
16766
  return n;
16759
- }, B_ = (e) => e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
16760
- function V_(e) {
16767
+ }, U_ = (e) => e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
16768
+ function W_(e) {
16761
16769
  let { runtime: t, ownerDocument: n, ownerWindow: r } = e, i = e.request ?? { scope: "workspace" }, a = t.snapshot();
16762
16770
  if (!a) throw Error("Mesurer workspace is not ready yet.");
16763
16771
  let o = [], s = [], c = { kind: "workspace" }, l = /* @__PURE__ */ new Map();
@@ -16765,7 +16773,7 @@ function V_(e) {
16765
16773
  let e = t.annotation(i.annotation);
16766
16774
  if (!e) throw Error(`Mesurer annotation not found: ${i.annotation}`);
16767
16775
  for (let t of e.resolvedTargets) t.element?.isConnected && l.set(t.element, t.target.id);
16768
- o = z_(e.resolvedTargets.map((e) => e.element));
16776
+ o = H_(e.resolvedTargets.map((e) => e.element));
16769
16777
  let n = t.annotationRect(e.id);
16770
16778
  n && (s = [n]);
16771
16779
  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";
@@ -16777,15 +16785,15 @@ function V_(e) {
16777
16785
  };
16778
16786
  } else if (i.scope === "selection") {
16779
16787
  let e = t.currentSelection();
16780
- if (o = z_(e.elements), !o.length && !e.region) throw Error("Mesurer has no current selection.");
16781
- s = e.region ? [e.region] : o.map((e) => R_(e.getBoundingClientRect())), c = { kind: "selection" };
16782
- } else o = z_([
16788
+ if (o = H_(e.elements), !o.length && !e.region) throw Error("Mesurer has no current selection.");
16789
+ s = e.region ? [e.region] : o.map((e) => V_(e.getBoundingClientRect())), c = { kind: "selection" };
16790
+ } else o = H_([
16783
16791
  ...t.currentSelection().elements,
16784
16792
  ...a.measurements.map((e) => e.elementRef),
16785
16793
  a.activeMeasurement?.elementRef,
16786
16794
  ...a.heldDistances.flatMap((e) => [e.elementRefA, e.elementRefB])
16787
16795
  ]);
16788
- let u = c.kind === "workspace" ? [] : s.length ? s : o.map((e) => R_(e.getBoundingClientRect())), d = j_({
16796
+ let u = c.kind === "workspace" ? [] : s.length ? s : o.map((e) => V_(e.getBoundingClientRect())), d = P_({
16789
16797
  workspace: {
16790
16798
  guides: a.guides,
16791
16799
  measurements: a.measurements,
@@ -16797,8 +16805,8 @@ function V_(e) {
16797
16805
  elements: o,
16798
16806
  regions: u
16799
16807
  },
16800
- guideTolerance: a.guideRelevanceTolerance ?? L_
16801
- }), f = d.measurements, p = d.distances, m = d.guides, h = z_([
16808
+ guideTolerance: a.guideRelevanceTolerance ?? B_
16809
+ }), f = d.measurements, p = d.distances, m = d.guides, h = H_([
16802
16810
  ...o,
16803
16811
  ...f.map((e) => e.elementRef),
16804
16812
  ...p.flatMap((e) => [e.elementRefA, e.elementRefB])
@@ -16810,12 +16818,12 @@ function V_(e) {
16810
16818
  let t = l.get(e) ?? y();
16811
16819
  return g.set(e, t), {
16812
16820
  ref: t,
16813
- inspection: C_(e)
16821
+ inspection: E_(e)
16814
16822
  };
16815
16823
  }), x = f.map((e) => {
16816
16824
  let t = {
16817
16825
  id: e.id,
16818
- rect: R_(e.rect),
16826
+ rect: V_(e.rect),
16819
16827
  deltaX: e.deltaX,
16820
16828
  deltaY: e.deltaY
16821
16829
  };
@@ -16825,8 +16833,8 @@ function V_(e) {
16825
16833
  }), S = p.map((e) => {
16826
16834
  let t = {
16827
16835
  id: e.id,
16828
- rectA: R_(e.rectA),
16829
- rectB: R_(e.rectB),
16836
+ rectA: V_(e.rectA),
16837
+ rectB: V_(e.rectB),
16830
16838
  horizontal: e.horizontal ? { ...e.horizontal } : null,
16831
16839
  vertical: e.vertical ? { ...e.vertical } : null
16832
16840
  }, n = e.elementRefA ? g.get(e.elementRefA) : void 0, r = e.elementRefB ? g.get(e.elementRefB) : void 0;
@@ -16834,7 +16842,7 @@ function V_(e) {
16834
16842
  });
16835
16843
  return {
16836
16844
  schema: "mesurer.context/v1",
16837
- id: B_(r),
16845
+ id: U_(r),
16838
16846
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
16839
16847
  scope: c,
16840
16848
  page: {
@@ -16849,7 +16857,7 @@ function V_(e) {
16849
16857
  scrollY: r.scrollY
16850
16858
  },
16851
16859
  coordinateSpace: "viewport-css-px",
16852
- regions: c.kind === "workspace" ? [] : s.map(R_),
16860
+ regions: c.kind === "workspace" ? [] : s.map(V_),
16853
16861
  visualState: {
16854
16862
  rulersVisible: a.rulersVisible,
16855
16863
  xrayVisible: a.xrayVisible
@@ -16862,40 +16870,40 @@ function V_(e) {
16862
16870
  }
16863
16871
  };
16864
16872
  }
16865
- 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)}`;
16866
- function W_(e) {
16873
+ var G_ = (e) => `${Math.round(e * 100) / 100}px`, K_ = (e) => `x=${G_(e.left)} y=${G_(e.top)} w=${G_(e.width)} h=${G_(e.height)}`;
16874
+ function q_(e) {
16867
16875
  let t = [
16868
16876
  "Mesurer visual context",
16869
16877
  "",
16870
16878
  `Page: ${e.page.url}`,
16871
16879
  `Viewport: ${e.viewport.width} × ${e.viewport.height} CSS px; scroll x=${e.viewport.scrollX} y=${e.viewport.scrollY}`
16872
16880
  ];
16873
- 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) {
16881
+ 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}: ${K_(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) {
16874
16882
  t.push("", "Targets");
16875
16883
  for (let n of e.targets) {
16876
16884
  let e = n.inspection;
16877
- 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)}`);
16885
+ t.push(`[${n.ref}] ${e.selector}`, ` rect: ${K_(e.rect)}`, ` margin: ${G_(e.margin.top)} ${G_(e.margin.right)} ${G_(e.margin.bottom)} ${G_(e.margin.left)}`, ` padding: ${G_(e.padding.top)} ${G_(e.padding.right)} ${G_(e.padding.bottom)} ${G_(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)}`);
16878
16886
  }
16879
16887
  }
16880
16888
  if (e.visualContext.guides.length) {
16881
16889
  t.push("", "Relevant guides");
16882
- for (let n of e.visualContext.guides) t.push(`- ${n.orientation} ${n.orientation === "vertical" ? "x" : "y"}=${H_(n.position)}`);
16890
+ for (let n of e.visualContext.guides) t.push(`- ${n.orientation} ${n.orientation === "vertical" ? "x" : "y"}=${G_(n.position)}`);
16883
16891
  }
16884
16892
  if (e.visualContext.measurements.length) {
16885
16893
  t.push("", "Relevant measurements");
16886
- for (let n of e.visualContext.measurements) t.push(`- ${n.targetRef ? `${n.targetRef}: ` : ""}${U_(n.rect)}; delta=${H_(n.deltaX)} × ${H_(n.deltaY)}`);
16894
+ for (let n of e.visualContext.measurements) t.push(`- ${n.targetRef ? `${n.targetRef}: ` : ""}${K_(n.rect)}; delta=${G_(n.deltaX)} × ${G_(n.deltaY)}`);
16887
16895
  }
16888
16896
  if (e.visualContext.distances.length) {
16889
16897
  t.push("", "Relevant distances");
16890
16898
  for (let n of e.visualContext.distances) {
16891
- 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("; ");
16899
+ let e = [n.targetARef, n.targetBRef].filter(Boolean).join(" → "), r = [n.horizontal ? `horizontal=${G_(n.horizontal.value)}` : null, n.vertical ? `vertical=${G_(n.vertical.value)}` : null].filter(Boolean).join("; ");
16892
16900
  t.push(`- ${e ? `${e}: ` : ""}${r || "overlapping"}`);
16893
16901
  }
16894
16902
  }
16895
16903
  return t.join("\n").trimEnd();
16896
16904
  }
16897
- function G_(e) {
16898
- let t = O_([
16905
+ function J_(e) {
16906
+ let t = j_([
16899
16907
  ...e.regions,
16900
16908
  ...e.targets.map((e) => e.inspection.rect),
16901
16909
  ...e.visualContext.measurements.map((e) => e.rect),
@@ -16925,7 +16933,7 @@ function G_(e) {
16925
16933
  captures: n
16926
16934
  };
16927
16935
  }
16928
- var K_ = (e, t, n, r, i) => {
16936
+ var Y_ = (e, t, n, r, i) => {
16929
16937
  !Number.isFinite(r) || !Number.isFinite(i) || Math.abs(r - i) < .01 || e.push({
16930
16938
  kind: t,
16931
16939
  label: n,
@@ -16934,16 +16942,16 @@ var K_ = (e, t, n, r, i) => {
16934
16942
  delta: i - r,
16935
16943
  unit: "px"
16936
16944
  });
16937
- }, q_ = (e, t, n, r) => e.push({
16945
+ }, X_ = (e, t, n, r) => e.push({
16938
16946
  kind: "missing",
16939
16947
  evidence: t,
16940
16948
  id: n,
16941
16949
  label: r
16942
16950
  });
16943
- function J_(e) {
16951
+ function Z_(e) {
16944
16952
  let t = e.runtime.annotation(e.annotationId);
16945
16953
  if (!t) throw Error(`Mesurer annotation not found: ${e.annotationId}`);
16946
- let n = V_({
16954
+ let n = W_({
16947
16955
  runtime: e.runtime,
16948
16956
  ownerDocument: e.ownerDocument,
16949
16957
  ownerWindow: e.ownerWindow,
@@ -16952,41 +16960,41 @@ function J_(e) {
16952
16960
  if (n.scope.kind !== "annotation") throw Error("Mesurer annotation context invariant failed.");
16953
16961
  let r = e.runtime.snapshot();
16954
16962
  if (!r) throw Error("Mesurer workspace is not ready yet.");
16955
- let i = A_({
16963
+ let i = N_({
16956
16964
  measurements: r.measurements,
16957
16965
  activeMeasurement: r.activeMeasurement
16958
16966
  }), a = [];
16959
16967
  for (let e of t.baseline.targets) {
16960
16968
  let t = n.targets.find((t) => t.ref === e.id);
16961
16969
  if (!t) {
16962
- q_(a, "target", e.id, e.selector);
16970
+ X_(a, "target", e.id, e.selector);
16963
16971
  continue;
16964
16972
  }
16965
- 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);
16973
+ Y_(a, "target-rect", `${t.inspection.selector} left`, e.rect.left, t.inspection.rect.left), Y_(a, "target-rect", `${t.inspection.selector} top`, e.rect.top, t.inspection.rect.top), Y_(a, "target-rect", `${t.inspection.selector} width`, e.rect.width, t.inspection.rect.width), Y_(a, "target-rect", `${t.inspection.selector} height`, e.rect.height, t.inspection.rect.height);
16966
16974
  }
16967
16975
  for (let e of t.baseline.guides) {
16968
16976
  let t = n.visualContext.guides.find((t) => t.id === e.id) ?? r.guides.find((t) => t.id === e.id);
16969
16977
  if (!t) {
16970
- q_(a, "guide", e.id, `${e.orientation} guide ${e.id}`);
16978
+ X_(a, "guide", e.id, `${e.orientation} guide ${e.id}`);
16971
16979
  continue;
16972
16980
  }
16973
- K_(a, "guide", `${e.orientation} guide ${e.id}`, e.position, t.position);
16981
+ Y_(a, "guide", `${e.orientation} guide ${e.id}`, e.position, t.position);
16974
16982
  }
16975
16983
  for (let e of t.baseline.measurements) {
16976
16984
  let t = n.visualContext.measurements.find((t) => t.id === e.id) ?? i.find((t) => t.id === e.id);
16977
16985
  if (!t) {
16978
- q_(a, "measurement", e.id, e.id);
16986
+ X_(a, "measurement", e.id, e.id);
16979
16987
  continue;
16980
16988
  }
16981
- K_(a, "measurement", `${e.id} width`, e.rect.width, t.rect.width), K_(a, "measurement", `${e.id} height`, e.rect.height, t.rect.height);
16989
+ Y_(a, "measurement", `${e.id} width`, e.rect.width, t.rect.width), Y_(a, "measurement", `${e.id} height`, e.rect.height, t.rect.height);
16982
16990
  }
16983
16991
  for (let e of t.baseline.distances) {
16984
16992
  let t = n.visualContext.distances.find((t) => t.id === e.id) ?? r.heldDistances.find((t) => t.id === e.id);
16985
16993
  if (!t) {
16986
- q_(a, "distance", e.id, e.id);
16994
+ X_(a, "distance", e.id, e.id);
16987
16995
  continue;
16988
16996
  }
16989
- 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`);
16997
+ e.horizontal && t.horizontal ? Y_(a, "distance", `${e.id} horizontal`, e.horizontal.value, t.horizontal.value) : e.horizontal && !t.horizontal && X_(a, "distance", e.id, `${e.id} horizontal`), e.vertical && t.vertical ? Y_(a, "distance", `${e.id} vertical`, e.vertical.value, t.vertical.value) : e.vertical && !t.vertical && X_(a, "distance", e.id, `${e.id} vertical`);
16990
16998
  }
16991
16999
  return {
16992
17000
  schema: "mesurer.review/v1",
@@ -16998,7 +17006,7 @@ function J_(e) {
16998
17006
  changes: a
16999
17007
  };
17000
17008
  }
17001
- async function Y_(e, t, n) {
17009
+ async function Q_(e, t, n) {
17002
17010
  try {
17003
17011
  if (t.navigator.clipboard?.writeText) {
17004
17012
  await t.navigator.clipboard.writeText(n);
@@ -17012,77 +17020,77 @@ async function Y_(e, t, n) {
17012
17020
  }
17013
17021
  //#endregion
17014
17022
  //#region src/version.ts
17015
- var X_ = "0.1.8-beta.2", Z_ = "mesurer.context", Q_ = "context:v1", $_ = "mesurer.context.settings", ev = "context.ui", tv = "data-mesurer-direct-text-edit-active", nv = {
17023
+ var $_ = "0.1.8-beta.3", ev = "mesurer.context", tv = "context:v1", nv = "mesurer.context.settings", rv = "context.ui", iv = "data-mesurer-direct-text-edit-active", av = {
17016
17024
  viewBox: "0 0 256 256",
17017
17025
  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"]
17018
- }, rv = {
17026
+ }, ov = {
17019
17027
  viewBox: "0 0 256 256",
17020
17028
  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"]
17021
- }, iv = {
17029
+ }, sv = {
17022
17030
  viewBox: "0 0 256 256",
17023
17031
  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"]
17024
- }, av = async (e, t, n = 1) => {
17032
+ }, cv = async (e, t, n = 1) => {
17025
17033
  await e.fonts?.ready;
17026
17034
  for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
17027
- }, ov = (e, t, n) => {
17028
- let r = async (r) => V_({
17035
+ }, lv = (e, t, n) => {
17036
+ let r = async (r) => W_({
17029
17037
  runtime: e,
17030
17038
  ownerDocument: t,
17031
17039
  ownerWindow: n,
17032
17040
  request: r
17033
- }), i = async (e) => W_(await r(e));
17041
+ }), i = async (e) => q_(await r(e));
17034
17042
  return {
17035
17043
  context: r,
17036
17044
  contextText: i,
17037
- copyContext: async (e) => Y_(t, n, await i(e)),
17038
- select: async (i) => (e.select(Array.isArray(i) ? i : [i]), await av(t, n), r({ scope: "selection" })),
17045
+ copyContext: async (e) => Q_(t, n, await i(e)),
17046
+ select: async (i) => (e.select(Array.isArray(i) ? i : [i]), await cv(t, n), r({ scope: "selection" })),
17039
17047
  annotations: async () => e.annotations(),
17040
17048
  removeAnnotation: async (r) => {
17041
- e.removeAnnotation(r), await av(t, n);
17049
+ e.removeAnnotation(r), await cv(t, n);
17042
17050
  },
17043
- review: async (r) => (await av(t, n), r ? J_({
17051
+ review: async (r) => (await cv(t, n), r ? Z_({
17044
17052
  runtime: e,
17045
17053
  ownerDocument: t,
17046
17054
  ownerWindow: n,
17047
17055
  annotationId: r
17048
- }) : e.annotations().map((r) => J_({
17056
+ }) : e.annotations().map((r) => Z_({
17049
17057
  runtime: e,
17050
17058
  ownerDocument: t,
17051
17059
  ownerWindow: n,
17052
17060
  annotationId: r.id
17053
17061
  }))),
17054
- capturePlan: async (e) => G_(await r(e)),
17062
+ capturePlan: async (e) => J_(await r(e)),
17055
17063
  prepareCapture: async () => {
17056
- e.prepareCapture(), await av(t, n);
17064
+ e.prepareCapture(), await cv(t, n);
17057
17065
  },
17058
17066
  finishCapture: async () => {
17059
- e.finishCapture(), await av(t, n);
17067
+ e.finishCapture(), await cv(t, n);
17060
17068
  }
17061
17069
  };
17062
- }, sv = (e) => {
17070
+ }, uv = (e) => {
17063
17071
  let t = e.currentSelection();
17064
17072
  return t.elements.length > 0 || t.region !== null;
17065
17073
  };
17066
- function cv(e = {}) {
17074
+ function dv(e = {}) {
17067
17075
  return {
17068
- id: Z_,
17069
- version: X_,
17076
+ id: ev,
17077
+ version: $_,
17070
17078
  requires: ["runtime:solid"],
17071
- provides: [Q_],
17079
+ provides: [tv],
17072
17080
  setup(t) {
17073
17081
  let n = t.service.get("runtime:solid");
17074
17082
  if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
17075
- let r = n.createWorkspaceRuntime(Z_), i = ov(r, n.ownerDocument, n.ownerWindow);
17076
- t.service.provide(Q_, i), t.state.register({
17077
- id: $_,
17083
+ let r = n.createWorkspaceRuntime(ev), i = lv(r, n.ownerDocument, n.ownerWindow);
17084
+ t.service.provide(tv, i), t.state.register({
17085
+ id: nv,
17078
17086
  initial: { ui: e.ui ?? !0 },
17079
17087
  persist: !0
17080
17088
  }), t.state.register({
17081
- id: ev,
17082
- initial: { hasSelection: sv(r) }
17089
+ id: rv,
17090
+ initial: { hasSelection: uv(r) }
17083
17091
  });
17084
- let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(ev)?.hasSelection === !0, s = (e) => {
17085
- t.state.update($_, (t) => ({
17092
+ let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(rv)?.hasSelection === !0, s = (e) => {
17093
+ t.state.update(nv, (t) => ({
17086
17094
  ...t,
17087
17095
  ui: e
17088
17096
  }));
@@ -17096,21 +17104,21 @@ function cv(e = {}) {
17096
17104
  region: e.region ? { ...e.region } : null
17097
17105
  }, r.selectGestureActive() ? c?.abandonNoteComposer() : n && c?.closeNoteComposer();
17098
17106
  let i = e.elements.length > 0 || e.region !== null;
17099
- i !== (t.state.get(ev)?.hasSelection ?? !1) && t.state.update(ev, () => ({ hasSelection: i }));
17107
+ i !== (t.state.get(rv)?.hasSelection ?? !1) && t.state.update(rv, () => ({ hasSelection: i }));
17100
17108
  });
17101
17109
  t.command.register("context.copy", () => i.copyContext()), t.command.register("context.copy-selection", () => i.copyContext({ scope: "selection" }));
17102
17110
  let g = () => {
17103
17111
  let e = u?.element;
17104
- e && (n.rendererRoot?.hasAttribute(tv) ? e.setAttribute(tv, "true") : e.removeAttribute(tv));
17112
+ e && (n.rendererRoot?.hasAttribute(iv) ? e.setAttribute(iv, "true") : e.removeAttribute(iv));
17105
17113
  }, _ = () => {
17106
17114
  d?.disconnect(), d = null, c = null, l?.(), l = null, u?.dispose(), u = null;
17107
17115
  }, v = () => {
17108
17116
  if (u) return;
17109
- if (u = dg(n), u.element.dataset.mesurerLayer = "evidence", u.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
17117
+ if (u = mg(n), u.element.dataset.mesurerLayer = "evidence", u.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
17110
17118
  let e = new n.ownerWindow.MutationObserver(g);
17111
17119
  d = e, e.observe(n.rendererRoot, {
17112
17120
  attributes: !0,
17113
- attributeFilter: [tv]
17121
+ attributeFilter: [iv]
17114
17122
  }), g();
17115
17123
  }
17116
17124
  let e = {
@@ -17121,7 +17129,7 @@ function cv(e = {}) {
17121
17129
  },
17122
17130
  coordinateSpace: "document"
17123
17131
  };
17124
- l = _i(() => Rr(sg, gi(e, { get ownerWindow() {
17132
+ l = _i(() => Rr(ug, gi(e, { get ownerWindow() {
17125
17133
  return n.ownerWindow;
17126
17134
  } })), u.element);
17127
17135
  }, y = () => {
@@ -17133,7 +17141,7 @@ function cv(e = {}) {
17133
17141
  shortcut: "C",
17134
17142
  command: "context.copy",
17135
17143
  order: 70,
17136
- icon: nv,
17144
+ icon: av,
17137
17145
  hidden: () => !a()
17138
17146
  }), t.tool.register({
17139
17147
  id: "context.copy-selection",
@@ -17141,7 +17149,7 @@ function cv(e = {}) {
17141
17149
  shortcut: "Shift+C",
17142
17150
  command: "context.copy-selection",
17143
17151
  order: 71,
17144
- icon: rv,
17152
+ icon: ov,
17145
17153
  hidden: () => !a(),
17146
17154
  disabled: () => !o()
17147
17155
  }), t.tool.register({
@@ -17150,7 +17158,7 @@ function cv(e = {}) {
17150
17158
  shortcut: "N",
17151
17159
  command: "context.add-note",
17152
17160
  order: 72,
17153
- icon: iv,
17161
+ icon: sv,
17154
17162
  hidden: () => !a(),
17155
17163
  disabled: () => !o()
17156
17164
  }), t.settings.register({
@@ -17173,7 +17181,7 @@ function cv(e = {}) {
17173
17181
  }
17174
17182
  //#endregion
17175
17183
  //#region src/host-layer.ts
17176
- var lv = {
17184
+ var fv = {
17177
17185
  display: "block",
17178
17186
  position: "fixed",
17179
17187
  inset: "0",
@@ -17215,48 +17223,48 @@ var lv = {
17215
17223
  "letter-spacing": "normal",
17216
17224
  direction: "ltr"
17217
17225
  };
17218
- function uv(e) {
17219
- for (let [t, n] of Object.entries(lv)) e.style.setProperty(t, n, "important");
17226
+ function pv(e) {
17227
+ for (let [t, n] of Object.entries(fv)) e.style.setProperty(t, n, "important");
17220
17228
  }
17221
- function dv(e) {
17229
+ function mv(e) {
17222
17230
  return "popover" in e && "showPopover" in e && typeof e.showPopover == "function" && "hidePopover" in e && typeof e.hidePopover == "function";
17223
17231
  }
17224
- var fv = (e) => "newState" in e, pv = (e) => e.localName === "dialog";
17225
- function mv(e) {
17226
- if (!pv(e) || !e.open) return !1;
17232
+ var hv = (e) => "newState" in e, gv = (e) => e.localName === "dialog";
17233
+ function _v(e) {
17234
+ if (!gv(e) || !e.open) return !1;
17227
17235
  try {
17228
17236
  return e.matches(":modal");
17229
17237
  } catch {
17230
17238
  return !1;
17231
17239
  }
17232
17240
  }
17233
- function hv(e, t, n = !0) {
17234
- uv(e);
17241
+ function vv(e, t, n = !0) {
17242
+ pv(e);
17235
17243
  let r = e.ownerDocument, i = r.defaultView ?? window, a = t, o = !1, s = "fixed", c = !1, l = 0, u = [];
17236
- if (n && dv(e) && (e.popover = "manual"), t.append(e), n && dv(e)) try {
17244
+ if (n && mv(e) && (e.popover = "manual"), t.append(e), n && mv(e)) try {
17237
17245
  e.showPopover(), c = e.matches(":popover-open"), c && (s = "top-layer");
17238
17246
  } catch {
17239
17247
  e.removeAttribute("popover");
17240
17248
  }
17241
17249
  let d = () => {
17242
- if (!(!c || !dv(e))) try {
17250
+ if (!(!c || !mv(e))) try {
17243
17251
  e.matches(":popover-open") || e.showPopover();
17244
17252
  } catch {}
17245
17253
  }, f = (t) => {
17246
17254
  if (e.parentNode === t) return;
17247
- let n = c && dv(e) && e.matches(":popover-open");
17248
- if (n && dv(e)) try {
17255
+ let n = c && mv(e) && e.matches(":popover-open");
17256
+ if (n && mv(e)) try {
17249
17257
  e.hidePopover();
17250
17258
  } catch {}
17251
- t.append(e), uv(e), n && d();
17259
+ t.append(e), pv(e), n && d();
17252
17260
  }, p = () => {
17253
- u = u.filter((e) => e.isConnected && mv(e)), f(u.at(-1) ?? a);
17261
+ u = u.filter((e) => e.isConnected && _v(e)), f(u.at(-1) ?? a);
17254
17262
  }, m = (e) => {
17255
17263
  u = u.filter((t) => t !== e), u.push(e), p();
17256
17264
  }, h = (e) => {
17257
17265
  u = u.filter((t) => t !== e), p();
17258
17266
  }, g = () => {
17259
- if (!(o || !c || !dv(e))) try {
17267
+ if (!(o || !c || !mv(e))) try {
17260
17268
  e.matches(":popover-open") && e.hidePopover(), e.showPopover();
17261
17269
  } catch {}
17262
17270
  }, _ = () => {
@@ -17265,27 +17273,27 @@ function hv(e, t, n = !0) {
17265
17273
  }));
17266
17274
  }, v = (t) => {
17267
17275
  if (!c || t.target === e) return;
17268
- let n = fv(t) ? t.newState : void 0, r = t.target;
17276
+ let n = hv(t) ? t.newState : void 0, r = t.target;
17269
17277
  if (r instanceof i.Element) {
17270
- if (pv(r)) {
17271
- n === "open" && mv(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
17278
+ if (gv(r)) {
17279
+ n === "open" && _v(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
17272
17280
  return;
17273
17281
  }
17274
17282
  n === "open" && r.hasAttribute("popover") && _();
17275
17283
  }
17276
17284
  }, y = (e) => {
17277
17285
  let t = e.target;
17278
- t instanceof i.Element && pv(t) && h(t);
17286
+ t instanceof i.Element && gv(t) && h(t);
17279
17287
  }, b = () => {
17280
17288
  r.fullscreenElement && _();
17281
17289
  }, x = (e) => {
17282
- mv(e) && m(e);
17283
- for (let t of e.querySelectorAll("dialog")) mv(t) && m(t);
17290
+ _v(e) && m(e);
17291
+ for (let t of e.querySelectorAll("dialog")) _v(t) && m(t);
17284
17292
  }, S = new i.MutationObserver((e) => {
17285
17293
  if (c) for (let t of e) {
17286
17294
  if (t.type === "attributes") {
17287
17295
  let e = t.target;
17288
- e instanceof i.Element && pv(e) && (mv(e) ? m(e) : h(e));
17296
+ e instanceof i.Element && gv(e) && (_v(e) ? m(e) : h(e));
17289
17297
  }
17290
17298
  for (let e of t.addedNodes) e instanceof i.Element && x(e);
17291
17299
  u.some((e) => !e.isConnected) && p();
@@ -17301,7 +17309,7 @@ function hv(e, t, n = !0) {
17301
17309
  bringToFront: g,
17302
17310
  dispose() {
17303
17311
  if (!o) {
17304
- 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 {
17312
+ 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 && mv(e) && e.matches(":popover-open")) try {
17305
17313
  e.hidePopover();
17306
17314
  } catch {}
17307
17315
  u = [];
@@ -17311,31 +17319,31 @@ function hv(e, t, n = !0) {
17311
17319
  }
17312
17320
  //#endregion
17313
17321
  //#region src/arrange.ts
17314
- var gv = Fd, _v = () => ({
17322
+ var yv = Fd, bv = () => ({
17315
17323
  ...Sf(),
17316
- version: X_
17317
- }), 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 = [
17324
+ version: $_
17325
+ }), xv = "mesurer.codex", Sv = "codex:v1", Cv = "context:v1", wv = "http://127.0.0.1:47365", Tv = 2e3, Ev = 750, Dv = 1800, Ov = 2e3, kv = 12e4, Av = 10, jv = 5, Mv = [
17318
17326
  "Implement the current human feedback from Mesurer in this project.",
17319
17327
  "Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
17320
17328
  "and verify the affected UI in the live page with Mesurer before claiming completion."
17321
- ].join(" "), Av = {
17329
+ ].join(" "), Nv = {
17322
17330
  viewBox: "0 0 256 256",
17323
17331
  paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
17324
- }, jv = {
17332
+ }, Pv = {
17325
17333
  viewBox: "0 0 256 256",
17326
17334
  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"]
17327
- }, Mv = {
17335
+ }, Fv = {
17328
17336
  viewBox: "0 0 256 256",
17329
17337
  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"]
17330
- }, Nv = (e) => {
17338
+ }, Iv = (e) => {
17331
17339
  try {
17332
17340
  let t = globalThis.location;
17333
17341
  return t?.origin ? `mesurer-codex-ui:v1:${e}:${t.origin}${t.pathname}` : null;
17334
17342
  } catch {
17335
17343
  return null;
17336
17344
  }
17337
- }, Pv = (e) => {
17338
- let t = Nv(e);
17345
+ }, Lv = (e) => {
17346
+ let t = Iv(e);
17339
17347
  if (!t) return null;
17340
17348
  try {
17341
17349
  let e = globalThis.sessionStorage?.getItem(t);
@@ -17360,18 +17368,18 @@ var gv = Fd, _v = () => ({
17360
17368
  } catch {
17361
17369
  return null;
17362
17370
  }
17363
- }, Fv = (e, t) => {
17364
- let n = Nv(e);
17371
+ }, Rv = (e, t) => {
17372
+ let n = Iv(e);
17365
17373
  if (n) try {
17366
17374
  globalThis.sessionStorage?.setItem(n, JSON.stringify(t));
17367
17375
  } catch {}
17368
- }, Iv = (e, t) => {
17376
+ }, zv = (e, t) => {
17369
17377
  let n = e.endsWith("/") ? e : `${e}/`;
17370
17378
  return new URL(t, n).toString();
17371
- }, Lv = async (e, t, n) => {
17379
+ }, Bv = async (e, t, n) => {
17372
17380
  let r = new AbortController(), i = setTimeout(() => r.abort(), 15e3);
17373
17381
  try {
17374
- let i = await fetch(Iv(e, t), {
17382
+ let i = await fetch(zv(e, t), {
17375
17383
  ...n,
17376
17384
  signal: r.signal
17377
17385
  }), a = await i.text(), o = {};
@@ -17387,10 +17395,10 @@ var gv = Fd, _v = () => ({
17387
17395
  } finally {
17388
17396
  clearTimeout(i);
17389
17397
  }
17390
- }, Rv = (e) => ({
17398
+ }, Vv = (e) => ({
17391
17399
  thread: e.thread?.trim() || null,
17392
17400
  threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
17393
- }), zv = (e) => {
17401
+ }), Hv = (e) => {
17394
17402
  let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
17395
17403
  if (!t || !n || !r) throw Error("Mesurer Codex bridge returned an invalid delivery state.");
17396
17404
  let i = {
@@ -17402,7 +17410,7 @@ var gv = Fd, _v = () => ({
17402
17410
  updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
17403
17411
  };
17404
17412
  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;
17405
- }, Bv = (e) => ({
17413
+ }, Uv = (e) => ({
17406
17414
  thread: e.thread?.trim() || null,
17407
17415
  threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
17408
17416
  let t = e.id?.trim() ?? "";
@@ -17414,7 +17422,7 @@ var gv = Fd, _v = () => ({
17414
17422
  }] : [];
17415
17423
  }) : [],
17416
17424
  hasMore: e.hasMore === !0
17417
- }), Vv = async (e, t, n) => {
17425
+ }), Wv = async (e, t, n) => {
17418
17426
  let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = a ? a.flatMap((e) => {
17419
17427
  let t = i.find((t) => t.id === e);
17420
17428
  return t ? [t] : [];
@@ -17437,18 +17445,18 @@ var gv = Fd, _v = () => ({
17437
17445
  ])
17438
17446
  ].join("\n").trimEnd()
17439
17447
  };
17440
- }, 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.`;
17441
- function Gv(e = {}) {
17442
- let t = e.endpoint ?? xv, n = e.instruction?.trim() || kv, r = e.ui ?? !0, i = e.clearCompletedAnnotations ?? !0;
17448
+ }, Gv = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, Kv = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, qv = (e, t) => e instanceof Error && e.message === `Mesurer Codex bridge is unavailable at ${t}. Start the local bridge before queueing feedback.`;
17449
+ function Jv(e = {}) {
17450
+ let t = e.endpoint ?? wv, n = e.instruction?.trim() || Mv, r = e.ui ?? !0, i = e.clearCompletedAnnotations ?? !0;
17443
17451
  return {
17444
- id: vv,
17445
- version: X_,
17446
- requires: [bv],
17447
- provides: [yv],
17452
+ id: xv,
17453
+ version: $_,
17454
+ requires: [Cv],
17455
+ provides: [Sv],
17448
17456
  setup(e) {
17449
- let a = e.service.get(bv);
17457
+ let a = e.service.get(Cv);
17450
17458
  if (!a) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
17451
- 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 ? {
17459
+ let o = r ? Lv(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 = jv, _, v = "", y = null, b = o?.delivery ? {
17452
17460
  id: o.delivery.id,
17453
17461
  thread: o.delivery.thread,
17454
17462
  status: o.delivery.status,
@@ -17456,22 +17464,22 @@ function Gv(e = {}) {
17456
17464
  queuedSubmissionId: o.delivery.queuedSubmissionId ?? null,
17457
17465
  dispatch: o.delivery.dispatch ?? null,
17458
17466
  dispatchError: o.delivery.dispatchError ?? null
17459
- } : 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) => {
17467
+ } : null, x = 0, S = 0, C = null, w = !1, T = async () => Vv(await Bv(t, "health")), E = async (e) => Hv(await Bv(t, `deliveries/${encodeURIComponent(e)}`)), D = async (e) => {
17460
17468
  if (!e.id || !e.thread) throw Error("Cannot restore a Codex delivery without its id and thread.");
17461
17469
  let n = {
17462
17470
  deliveryId: e.id,
17463
17471
  thread: e.thread
17464
17472
  };
17465
- return e.queuedSubmissionId && (n.queuedSubmissionId = e.queuedSubmissionId), zv(await Lv(t, "deliveries/restore", {
17473
+ return e.queuedSubmissionId && (n.queuedSubmissionId = e.queuedSubmissionId), Hv(await Bv(t, "deliveries/restore", {
17466
17474
  method: "POST",
17467
17475
  headers: { "Content-Type": "application/json" },
17468
17476
  body: JSON.stringify(n)
17469
17477
  }));
17470
17478
  }, O = async (e = {}) => {
17471
17479
  let n = new URLSearchParams();
17472
- n.set("limit", String(e.limit ?? Dv));
17480
+ n.set("limit", String(e.limit ?? Av));
17473
17481
  let r = e.thread?.trim();
17474
- return r && n.set("thread", r), Bv(await Lv(t, `threads?${n.toString()}`));
17482
+ return r && n.set("thread", r), Uv(await Bv(t, `threads?${n.toString()}`));
17475
17483
  }, k = () => u ?? l ?? (d ? null : f), A = () => {
17476
17484
  if (!r) return;
17477
17485
  let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "interrupted") ? {
@@ -17483,7 +17491,7 @@ function Gv(e = {}) {
17483
17491
  dispatch: b.dispatch,
17484
17492
  dispatchError: b.dispatchError
17485
17493
  } : null;
17486
- Fv(t, {
17494
+ Rv(t, {
17487
17495
  version: 1,
17488
17496
  originThread: l,
17489
17497
  selectedThread: u,
@@ -17501,12 +17509,12 @@ function Gv(e = {}) {
17501
17509
  "queueing",
17502
17510
  "queued",
17503
17511
  "working"
17504
- ].includes(b.status) ? jv : b.status === "completed" ? Mv : Av : Av, L = () => {
17512
+ ].includes(b.status) ? Pv : b.status === "completed" ? Fv : Nv : Nv, L = () => {
17505
17513
  let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
17506
17514
  t.has(n.id) || (t.add(n.id), e.push(n));
17507
17515
  }, r = (e) => ({
17508
17516
  id: e,
17509
- title: `Codex ${Hv(e)}`,
17517
+ title: `Codex ${Gv(e)}`,
17510
17518
  updatedAt: null,
17511
17519
  connected: !0
17512
17520
  });
@@ -17526,7 +17534,7 @@ function Gv(e = {}) {
17526
17534
  let t = e.id === l ? "Current · " : e.connected ? "Connected · " : "", r = b?.thread === e.id ? ` · ${N() ? "Blocked" : P(b.status)}` : "";
17527
17535
  return {
17528
17536
  id: `codex.thread.${e.id}`,
17529
- label: `${t}${Uv(e.title)}${r}`,
17537
+ label: `${t}${Kv(e.title)}${r}`,
17530
17538
  checked: () => n === e.id,
17531
17539
  disabled: () => M(),
17532
17540
  run() {
@@ -17534,11 +17542,11 @@ function Gv(e = {}) {
17534
17542
  }
17535
17543
  };
17536
17544
  });
17537
- return g < Dv && (e.length > g || h) && r.push({
17545
+ return g < Av && (e.length > g || h) && r.push({
17538
17546
  id: "codex.thread.show-more",
17539
17547
  label: "Show 5 more…",
17540
17548
  run() {
17541
- g = Dv, B();
17549
+ g = Av, B();
17542
17550
  }
17543
17551
  }), r;
17544
17552
  }, B = () => {
@@ -17574,14 +17582,14 @@ function Gv(e = {}) {
17574
17582
  let e = l && p.includes(l) ? l : f;
17575
17583
  try {
17576
17584
  let t = await O({
17577
- limit: Dv,
17585
+ limit: Av,
17578
17586
  thread: e ?? void 0
17579
17587
  });
17580
17588
  m = t.threads, h = t.hasMore;
17581
17589
  } catch {
17582
17590
  m = p.map((e) => ({
17583
17591
  id: e,
17584
- title: `Codex ${Hv(e)}`,
17592
+ title: `Codex ${Gv(e)}`,
17585
17593
  updatedAt: null,
17586
17594
  connected: !0
17587
17595
  })), h = !1;
@@ -17604,7 +17612,7 @@ function Gv(e = {}) {
17604
17612
  }, ee = () => {
17605
17613
  S && globalThis.clearTimeout(S), S = globalThis.setTimeout(() => {
17606
17614
  S = 0, b?.status === "completed" && (b = null, A(), B());
17607
- }, wv);
17615
+ }, Dv);
17608
17616
  }, U = async (e) => {
17609
17617
  if (!(!b || b.id !== e.id)) {
17610
17618
  if (b = {
@@ -17622,14 +17630,14 @@ function Gv(e = {}) {
17622
17630
  if (e.status === "interrupted") {
17623
17631
  A(), B();
17624
17632
  let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
17625
- Date.now() - t < Ev && (x = globalThis.setTimeout(() => {
17633
+ Date.now() - t < kv && (x = globalThis.setTimeout(() => {
17626
17634
  x = 0, te(e.id);
17627
- }, Tv));
17635
+ }, Ov));
17628
17636
  return;
17629
17637
  }
17630
17638
  B(), x = globalThis.setTimeout(() => {
17631
17639
  x = 0, te(e.id);
17632
- }, Cv);
17640
+ }, Ev);
17633
17641
  }
17634
17642
  }, te = async (e) => {
17635
17643
  if (!(w || b?.id !== e)) try {
@@ -17653,7 +17661,7 @@ function Gv(e = {}) {
17653
17661
  b = {
17654
17662
  ...b,
17655
17663
  status: "failed"
17656
- }, A(), Wv(r, t) && (s = "unavailable"), B();
17664
+ }, A(), qv(r, t) && (s = "unavailable"), B();
17657
17665
  }
17658
17666
  }, ne = {
17659
17667
  health: T,
@@ -17662,7 +17670,7 @@ function Gv(e = {}) {
17662
17670
  async useThread(e) {
17663
17671
  let n = e.trim();
17664
17672
  if (!n) throw Error("Codex thread must be a non-empty string.");
17665
- let r = Rv(await Lv(t, "target", {
17673
+ let r = Vv(await Bv(t, "target", {
17666
17674
  method: "POST",
17667
17675
  headers: { "Content-Type": "application/json" },
17668
17676
  body: JSON.stringify({ thread: n })
@@ -17670,12 +17678,12 @@ function Gv(e = {}) {
17670
17678
  return j(n, !l), f = r.thread, p = r.threads, s = "available", c = !0, B(), r;
17671
17679
  },
17672
17680
  async send(e) {
17673
- let i = await Vv(a, e, n), o = e?.thread?.trim(), c = o || (r ? k() : null);
17681
+ let i = await Wv(a, e, n), o = e?.thread?.trim(), c = o || (r ? k() : null);
17674
17682
  if (r && !o && (d || !c)) throw Error("Choose a Codex thread before queueing feedback.");
17675
17683
  let l = { message: i.message };
17676
17684
  c && (l.thread = c);
17677
17685
  try {
17678
- let e = await Lv(t, "send", {
17686
+ let e = await Bv(t, "send", {
17679
17687
  method: "POST",
17680
17688
  headers: { "Content-Type": "application/json" },
17681
17689
  body: JSON.stringify(l)
@@ -17691,11 +17699,11 @@ function Gv(e = {}) {
17691
17699
  };
17692
17700
  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;
17693
17701
  } catch (e) {
17694
- throw r && Wv(e, t) && (s = "unavailable", B()), e;
17702
+ throw r && qv(e, t) && (s = "unavailable", B()), e;
17695
17703
  }
17696
17704
  }
17697
17705
  };
17698
- if (e.service.provide(yv, ne), e.command.register("codex.send", async () => {
17706
+ if (e.service.provide(Sv, ne), e.command.register("codex.send", async () => {
17699
17707
  if (!(C || M())) return H(), b = {
17700
17708
  id: null,
17701
17709
  thread: k(),
@@ -17725,9 +17733,9 @@ function Gv(e = {}) {
17725
17733
  updatedAt: 0
17726
17734
  }) : x = globalThis.setTimeout(() => {
17727
17735
  x = 0, te(e.deliveryId);
17728
- }, Cv) : S = globalThis.setTimeout(() => {
17736
+ }, Ev) : S = globalThis.setTimeout(() => {
17729
17737
  S = 0, b?.id === null && b?.status === "queued" && (b = null, A(), B());
17730
- }, wv);
17738
+ }, Dv);
17731
17739
  } catch (e) {
17732
17740
  b = null, A(), B();
17733
17741
  let t = e instanceof Error ? e.message : String(e);
@@ -17742,7 +17750,7 @@ function Gv(e = {}) {
17742
17750
  }, 0));
17743
17751
  let t = globalThis.setInterval(() => {
17744
17752
  c && R().catch(() => void 0);
17745
- }, Sv);
17753
+ }, Tv);
17746
17754
  e.lifecycle.onDispose(() => {
17747
17755
  w = !0, H(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
17748
17756
  });
@@ -17752,41 +17760,41 @@ function Gv(e = {}) {
17752
17760
  }
17753
17761
  //#endregion
17754
17762
  //#region src/plugin-catalog.ts
17755
- var Kv = [
17763
+ var Yv = [
17756
17764
  {
17757
- id: Z_,
17765
+ id: ev,
17758
17766
  label: "Context",
17759
17767
  order: 30,
17760
- create: cv,
17768
+ create: dv,
17761
17769
  settingsIds: ["context"],
17762
17770
  hiddenSettingsControlIds: ["ui"]
17763
17771
  },
17764
17772
  {
17765
- id: gv,
17773
+ id: yv,
17766
17774
  label: "Arrange",
17767
17775
  order: 35,
17768
- create: _v,
17776
+ create: bv,
17769
17777
  settingsIds: ["arrange"]
17770
17778
  },
17771
17779
  {
17772
- id: Wg,
17780
+ id: qg,
17773
17781
  label: "Screenshot",
17774
17782
  order: 40,
17775
17783
  create: (e = {}) => ({
17776
- ...u_(e),
17777
- version: X_
17784
+ ...p_(e),
17785
+ version: $_
17778
17786
  }),
17779
17787
  settingsIds: ["screenshot"],
17780
17788
  hiddenSettingsControlIds: ["tool"]
17781
17789
  },
17782
17790
  {
17783
- id: vv,
17791
+ id: xv,
17784
17792
  label: "Codex",
17785
17793
  order: 45,
17786
- create: Gv
17794
+ create: Jv
17787
17795
  }
17788
- ], qv = (e) => {
17789
- 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) => {
17796
+ ], Xv = (e) => {
17797
+ let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(Yv.map((e) => e.id)), i = Yv.map((e) => {
17790
17798
  let r = n.get(e.id);
17791
17799
  return {
17792
17800
  ...e,
@@ -17803,23 +17811,23 @@ var Kv = [
17803
17811
  create: () => n
17804
17812
  });
17805
17813
  return i;
17806
- }, Jv = (e) => e;
17807
- function Yv() {
17808
- return I_();
17814
+ }, Zv = (e) => e;
17815
+ function Qv() {
17816
+ return z_();
17809
17817
  }
17810
- async function Xv(e = {}) {
17811
- let t = Yv();
17818
+ async function $v(e = {}) {
17819
+ let t = Qv();
17812
17820
  for (let n of e.plugins ?? []) await t.load(n);
17813
17821
  return t;
17814
17822
  }
17815
17823
  //#endregion
17816
17824
  //#region src/index.tsx
17817
- var Zv = "arrange";
17818
- function Qv(e = {}) {
17825
+ var ey = "arrange";
17826
+ function ty(e = {}) {
17819
17827
  if (!("document" in globalThis)) throw Error("mountMesurer() requires a browser or Electron renderer document.");
17820
17828
  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");
17821
17829
  f.dataset.mesurerIsland = "true";
17822
- let p = hv(f, t, i), m = f, h = f, g = f;
17830
+ let p = vv(f, t, i), m = f, h = f, g = f;
17823
17831
  if (n) {
17824
17832
  let e = f.attachShadow({ mode: r });
17825
17833
  h = u.createElement("div"), h.dataset.mesurerIslandMount = "true", e.append(h), m = e, g = e;
@@ -17828,19 +17836,19 @@ function Qv(e = {}) {
17828
17836
  v = e;
17829
17837
  }), S = new Promise((e) => {
17830
17838
  y = e;
17831
- }), C = async () => (await (_ ? Promise.resolve(_) : x), S), w = a === !0 ? {} : a === !1 ? null : a, T = E_({
17839
+ }), C = async () => (await (_ ? Promise.resolve(_) : x), S), w = a === !0 ? {} : a === !1 ? null : a, T = k_({
17832
17840
  ownerDocument: u,
17833
17841
  root: w?.root ?? (t.nodeType === 11 ? t : u),
17834
17842
  getPluginHost: () => _,
17835
17843
  waitForPluginHost: C
17836
17844
  }), E = async () => {
17837
17845
  await T.ready();
17838
- let e = _?.service.get(Q_);
17846
+ let e = _?.service.get(tv);
17839
17847
  if (!e) throw Error("Mesurer Context is disabled. Enable it in Settings or include context() in plugins.");
17840
17848
  return e;
17841
17849
  }, D = async () => {
17842
17850
  await T.ready();
17843
- let e = _?.service.get(Zv);
17851
+ let e = _?.service.get(ey);
17844
17852
  if (!e) throw Error("Mesurer Arrange is disabled. Enable it in Settings or include arrange() in plugins.");
17845
17853
  return e;
17846
17854
  }, 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) => {
@@ -17851,7 +17859,7 @@ function Qv(e = {}) {
17851
17859
  (await D()).show(e, t);
17852
17860
  }, 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, {
17853
17861
  capabilities: () => {
17854
- let e = !!_?.service.get(Q_);
17862
+ let e = !!_?.service.get(tv);
17855
17863
  return {
17856
17864
  protocol: "mesurer.agent/v1",
17857
17865
  contextSchema: "mesurer.context/v1",
@@ -17861,8 +17869,8 @@ function Qv(e = {}) {
17861
17869
  annotations: e,
17862
17870
  review: e,
17863
17871
  capturePlan: e,
17864
- arrange: !!_?.service.get(Zv),
17865
- textEdit: !!_?.service.get(w_)
17872
+ arrange: !!_?.service.get(ey),
17873
+ textEdit: !!_?.service.get(D_)
17866
17874
  }
17867
17875
  };
17868
17876
  },
@@ -17881,9 +17889,9 @@ function Qv(e = {}) {
17881
17889
  reviewArrange: V
17882
17890
  }), te = {
17883
17891
  ...l,
17884
- version: X_,
17885
- plugins: qv(c)
17886
- }, ne = _i(() => Rr(qh, gi(te, {
17892
+ version: $_,
17893
+ plugins: Xv(c)
17894
+ }, ne = _i(() => Rr(Xh, gi(te, {
17887
17895
  portalTarget: g,
17888
17896
  pageTarget: t,
17889
17897
  onPluginHost: (e) => {
@@ -17932,6 +17940,6 @@ function Qv(e = {}) {
17932
17940
  }
17933
17941
  };
17934
17942
  }
17935
- var $v = Qv;
17943
+ var ny = ty;
17936
17944
  //#endregion
17937
- export { w_ as MESURER_TEXT_EDIT_SERVICE_ID, X_ as MESURER_VERSION, V_ as captureMesurerContext, Y_ as copyTextToClipboard, E_ as createMesurerAgentHarness, G_ as createMesurerCapturePlan, Yv as createMesurerPluginHost, Xv as createMesurerRuntime, Jv as defineMesurerPlugin, W_ as formatMesurerContext, $v as mountMeasurer, Qv as mountMesurer, J_ as reviewMesurerAnnotation };
17945
+ export { D_ as MESURER_TEXT_EDIT_SERVICE_ID, $_ as MESURER_VERSION, W_ as captureMesurerContext, Q_ as copyTextToClipboard, k_ as createMesurerAgentHarness, J_ as createMesurerCapturePlan, Qv as createMesurerPluginHost, $v as createMesurerRuntime, Zv as defineMesurerPlugin, q_ as formatMesurerContext, ny as mountMeasurer, ty as mountMesurer, Z_ as reviewMesurerAnnotation };