mesurer-solid 0.2.3-beta.12 → 0.2.3-beta.13

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/plugins.js CHANGED
@@ -7062,7 +7062,9 @@ function vu(e) {
7062
7062
  let r = Math.hypot(t.clientX - n.x, t.clientY - n.y), i = e.runtime.annotations().find((e) => e.id === n.id);
7063
7063
  r > 8 || !i || (f = n.id, h(i));
7064
7064
  }, _ = () => {
7065
- e.onCancel(), e.onOpenChange(!1), e.rendererRoot?.querySelector("button[data-mesurer-tool-id=\"context.notes\"]")?.focus();
7065
+ e.onCancel(), e.onOpenChange(!1), e.ownerWindow.queueMicrotask(() => {
7066
+ e.rendererRoot?.querySelector("button[data-mesurer-tool-id=\"context.notes\"]")?.focus();
7067
+ });
7066
7068
  };
7067
7069
  e.ownerWindow.addEventListener("pointerup", g, !0), Cn(() => e.ownerWindow.removeEventListener("pointerup", g, !0));
7068
7070
  let v = (t) => {
@@ -10438,7 +10440,7 @@ var Ku = "mesurer.layout-guides", qu = "layout-guides:v1", Ju = "mesurer.layout-
10438
10440
  C = !0, b += 1, d.removeEventListener("pointerdown", z), d.removeEventListener("pointermove", B), d.removeEventListener("pointerup", V), d.removeEventListener("pointercancel", H), i.removeEventListener("keydown", ee, !0), y && i.clearTimeout(y), M.dispose(), k(), fo(i), a.finishCapture(), a.dispose(), o.dispose();
10439
10441
  });
10440
10442
  }
10441
- }), Cp = "0.2.3-beta.12", wp = Jc, Tp = Gc, Ep = Kc, Dp = Yc, Op = qc, kp = () => ({
10443
+ }), Cp = "0.2.3-beta.13", wp = Jc, Tp = Gc, Ep = Kc, Dp = Yc, Op = qc, kp = () => ({
10442
10444
  ...Vl(),
10443
10445
  version: Cp
10444
10446
  }), Ap = kp, jp = wp, Mp = Tp, Np = Ep, Pp = Dp, Fp = Op, Ip = (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, Lp = (e) => {
@@ -10910,22 +10912,22 @@ async function cm(e, t, n) {
10910
10912
  var lm = Ku, um = qu, dm = Ju, fm = Yu, pm = () => ({
10911
10913
  ...yd(),
10912
10914
  version: Cp
10913
- }), mm = "mesurer.context", hm = "context:v1", gm = "mesurer.context.settings", _m = "context.ui", vm = "data-mesurer-direct-text-edit-active", ym = {
10915
+ }), mm = "mesurer.context", hm = "context:v1", gm = "mesurer.context.settings", _m = "context.ui", vm = "context.notes-open", ym = "data-mesurer-direct-text-edit-active", bm = {
10914
10916
  viewBox: "0 0 256 256",
10915
10917
  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"]
10916
- }, bm = {
10918
+ }, xm = {
10917
10919
  viewBox: "0 0 256 256",
10918
10920
  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"]
10919
- }, xm = {
10921
+ }, Sm = {
10920
10922
  viewBox: "0 0 256 256",
10921
10923
  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"]
10922
- }, Sm = {
10924
+ }, Cm = {
10923
10925
  viewBox: "0 0 256 256",
10924
10926
  paths: ["M40 40h176v16H40zm0 48h176v16H40zm0 48h112v16H40zm0 48h112v16H40zM184 144l40 40-48 48-40-40z"]
10925
- }, Cm = async (e, t, n = 1) => {
10927
+ }, wm = async (e, t, n = 1) => {
10926
10928
  await e.fonts?.ready;
10927
10929
  for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
10928
- }, wm = (e, t, n, r) => {
10930
+ }, Tm = (e, t, n, r) => {
10929
10931
  let i = async (i) => $p({
10930
10932
  runtime: e,
10931
10933
  ownerDocument: t,
@@ -10939,14 +10941,14 @@ var lm = Ku, um = qu, dm = Ju, fm = Yu, pm = () => ({
10939
10941
  copyContext: async (e) => cm(t, n, await a(e)),
10940
10942
  select: async (r) => {
10941
10943
  let a = Array.isArray(r) ? [...r] : [String(r)];
10942
- return e.select(a), await Cm(t, n), i({ scope: "selection" });
10944
+ return e.select(a), await wm(t, n), i({ scope: "selection" });
10943
10945
  },
10944
10946
  annotations: async () => e.annotations(),
10945
10947
  removeAnnotation: async (r, i) => {
10946
- e.removeAnnotation(r, i), await Cm(t, n);
10948
+ e.removeAnnotation(r, i), await wm(t, n);
10947
10949
  },
10948
10950
  review: async (i) => {
10949
- if (await Cm(t, n), i) return sm({
10951
+ if (await wm(t, n), i) return sm({
10950
10952
  runtime: e,
10951
10953
  ownerDocument: t,
10952
10954
  ownerWindow: n,
@@ -10964,17 +10966,17 @@ var lm = Ku, um = qu, dm = Ju, fm = Yu, pm = () => ({
10964
10966
  },
10965
10967
  capturePlan: async (e) => rm(await i(e)),
10966
10968
  prepareCapture: async () => {
10967
- e.prepareCapture(), await Cm(t, n);
10969
+ e.prepareCapture(), await wm(t, n);
10968
10970
  },
10969
10971
  finishCapture: async () => {
10970
- e.finishCapture(), await Cm(t, n);
10972
+ e.finishCapture(), await wm(t, n);
10971
10973
  }
10972
10974
  };
10973
- }, Tm = (e, t) => {
10975
+ }, Em = (e, t) => {
10974
10976
  let n = e.currentSelection();
10975
10977
  return n.elements.length > 0 || n.region !== null && !t?.querySelector("[data-mesurer-responsive-stage]");
10976
10978
  };
10977
- function Em(e = {}) {
10979
+ function Dm(e = {}) {
10978
10980
  return {
10979
10981
  id: mm,
10980
10982
  version: Cp,
@@ -10985,59 +10987,66 @@ function Em(e = {}) {
10985
10987
  if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
10986
10988
  let r = n.rendererRoot;
10987
10989
  if (!r) throw Error("Mesurer Notes requires the renderer root.");
10988
- let i = n.createWorkspaceRuntime(mm), a = n.createAnnotationRevealCoordinator(i), [o, s] = J(!1), c = wm(i, n.ownerDocument, n.ownerWindow, () => t.service.get(um)?.list() ?? []);
10989
- t.service.provide(hm, c), t.state.register({
10990
+ let i = n.createWorkspaceRuntime(mm), a = n.createAnnotationRevealCoordinator(i), [o, s] = J(!1);
10991
+ t.state.register({
10992
+ id: vm,
10993
+ initial: !1
10994
+ });
10995
+ let c = (e) => {
10996
+ s(e), t.state.get(vm) !== e && t.state.update(vm, () => e);
10997
+ }, l = () => t.state.get(vm) ?? !1, u = Tm(i, n.ownerDocument, n.ownerWindow, () => t.service.get(um)?.list() ?? []);
10998
+ t.service.provide(hm, u), t.state.register({
10990
10999
  id: gm,
10991
11000
  initial: { ui: e.ui ?? !0 },
10992
11001
  persist: !0
10993
11002
  }), t.state.register({
10994
11003
  id: _m,
10995
- initial: { hasSelection: Tm(i, n.rendererRoot) }
11004
+ initial: { hasSelection: Em(i, n.rendererRoot) }
10996
11005
  });
10997
- let l = () => t.state.get("mesurer.context.settings")?.ui ?? !0, u = () => Tm(i, n.rendererRoot), d = (e) => {
10998
- e || (s(!1), a.cancel()), t.state.update(gm, (t) => ({
11006
+ let d = () => t.state.get("mesurer.context.settings")?.ui ?? !0, f = () => Em(i, n.rendererRoot), p = (e) => {
11007
+ e || (c(!1), a.cancel()), t.state.update(gm, (t) => ({
10999
11008
  ...t,
11000
11009
  ui: e
11001
11010
  }));
11002
- }, f = null, p = null, m = null, h = null, [g, _] = J(!!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]")), v = null, y = i.currentSelection(), b = {
11003
- elements: [...y.elements],
11004
- region: y.region ? { ...y.region } : null
11005
- }, x = (e, t) => e.elements.length !== t.elements.length || e.elements.some((e, n) => e !== t.elements[n]) ? !1 : e.region === t.region ? !0 : !e.region || !t.region ? !1 : e.region.left === t.region.left && e.region.top === t.region.top && e.region.width === t.region.width && e.region.height === t.region.height, S = i.subscribe(() => {
11006
- let e = i.currentSelection(), r = !x(b, e);
11007
- b = {
11011
+ }, m = null, h = null, g = null, _ = null, [v, y] = J(!!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]")), b = null, x = i.currentSelection(), S = {
11012
+ elements: [...x.elements],
11013
+ region: x.region ? { ...x.region } : null
11014
+ }, C = (e, t) => e.elements.length !== t.elements.length || e.elements.some((e, n) => e !== t.elements[n]) ? !1 : e.region === t.region ? !0 : !e.region || !t.region ? !1 : e.region.left === t.region.left && e.region.top === t.region.top && e.region.width === t.region.width && e.region.height === t.region.height, w = i.subscribe(() => {
11015
+ let e = i.currentSelection(), r = !C(S, e);
11016
+ S = {
11008
11017
  elements: [...e.elements],
11009
11018
  region: e.region ? { ...e.region } : null
11010
- }, i.selectGestureActive() ? f?.abandonNoteComposer() : r && f?.closeNoteComposer();
11011
- let a = Tm(i, n.rendererRoot);
11019
+ }, i.selectGestureActive() ? m?.abandonNoteComposer() : r && m?.closeNoteComposer();
11020
+ let a = Em(i, n.rendererRoot);
11012
11021
  a !== (t.state.get(_m)?.hasSelection ?? !1) && t.state.update(_m, () => ({ hasSelection: a }));
11013
11022
  });
11014
- t.command.register("context.copy", () => c.copyContext()), t.command.register("context.copy-selection", () => c.copyContext({ scope: "selection" }));
11015
- let C = () => {
11016
- let e = m?.element;
11017
- e && (n.rendererRoot?.hasAttribute(vm) ? e.setAttribute(vm, "true") : e.removeAttribute(vm));
11018
- }, w = () => {
11019
- h?.disconnect(), h = null, f = null, p?.(), p = null, m?.dispose(), m = null;
11020
- }, T = () => {
11021
- if (m) return;
11022
- if (m = Su(n), v = m.element.parentNode, m.element.dataset.mesurerLayer = "evidence", m.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
11023
- let e = new n.ownerWindow.MutationObserver(C);
11024
- h = e, e.observe(n.rendererRoot, {
11023
+ t.command.register("context.copy", () => u.copyContext()), t.command.register("context.copy-selection", () => u.copyContext({ scope: "selection" }));
11024
+ let T = () => {
11025
+ let e = g?.element;
11026
+ e && (n.rendererRoot?.hasAttribute(ym) ? e.setAttribute(ym, "true") : e.removeAttribute(ym));
11027
+ }, E = () => {
11028
+ _?.disconnect(), _ = null, m = null, h?.(), h = null, g?.dispose(), g = null;
11029
+ }, D = () => {
11030
+ if (g) return;
11031
+ if (g = Su(n), b = g.element.parentNode, g.element.dataset.mesurerLayer = "evidence", g.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
11032
+ let e = new n.ownerWindow.MutationObserver(T);
11033
+ _ = e, e.observe(n.rendererRoot, {
11025
11034
  attributes: !0,
11026
- attributeFilter: [vm]
11027
- }), C();
11035
+ attributeFilter: [ym]
11036
+ }), T();
11028
11037
  }
11029
11038
  let e = {
11030
11039
  runtime: i,
11031
- onCopy: c.copyContext,
11040
+ onCopy: u.copyContext,
11032
11041
  onController: (e) => {
11033
- f = e;
11042
+ m = e;
11034
11043
  },
11035
11044
  get coordinateSpace() {
11036
- return g() ? "viewport" : "document";
11045
+ return v() ? "viewport" : "document";
11037
11046
  },
11038
11047
  rendererRoot: n.rendererRoot
11039
11048
  };
11040
- p = Gr(() => [Ar(gu, xr(e, { get ownerWindow() {
11049
+ h = Gr(() => [Ar(gu, xr(e, { get ownerWindow() {
11041
11050
  return n.ownerWindow;
11042
11051
  } })), Ar(pi, {
11043
11052
  mount: r,
@@ -11054,7 +11063,7 @@ function Em(e = {}) {
11054
11063
  return o();
11055
11064
  },
11056
11065
  onOpenChange: (e) => {
11057
- s(e), e || a.cancel();
11066
+ c(e), e || a.cancel();
11058
11067
  },
11059
11068
  get onReveal() {
11060
11069
  return a.reveal;
@@ -11063,29 +11072,29 @@ function Em(e = {}) {
11063
11072
  return a.cancel;
11064
11073
  },
11065
11074
  onOpenAnnotation: (e) => {
11066
- if (f) {
11067
- f.openAnnotation(e);
11075
+ if (m) {
11076
+ m.openAnnotation(e);
11068
11077
  return;
11069
11078
  }
11070
11079
  n.ownerDocument.querySelector(`[data-mesurer-annotation-marker='true'][data-mesurer-annotation-id="${CSS.escape(e)}"]`)?.click();
11071
11080
  }
11072
11081
  });
11073
11082
  }
11074
- })], m.element), $t(g) && n.rendererRoot && (n.rendererRoot.append(m.element), m.element.style.zIndex = "90");
11075
- }, E = () => {
11076
- l() ? T() : w();
11083
+ })], g.element), $t(v) && n.rendererRoot && (n.rendererRoot.append(g.element), g.element.style.zIndex = "90");
11084
+ }, O = () => {
11085
+ d() ? D() : E();
11077
11086
  };
11078
- E(), t.state.subscribe(E);
11079
- let D = () => {
11087
+ O(), t.state.subscribe(O);
11088
+ let k = () => {
11080
11089
  let e = !!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]");
11081
- if (e === $t(g) || (_(e), !m)) return;
11082
- let t = e ? n.rendererRoot : v;
11083
- t && m.element.parentNode !== t && t.appendChild(m.element), m.element.style.zIndex = e ? "90" : "", $t(() => f?.closeNoteComposer());
11090
+ if (e === $t(v) || (y(e), !g)) return;
11091
+ let t = e ? n.rendererRoot : b;
11092
+ t && g.element.parentNode !== t && t.appendChild(g.element), g.element.style.zIndex = e ? "90" : "", $t(() => m?.closeNoteComposer());
11084
11093
  };
11085
- n.ownerWindow.addEventListener("mesurer:responsive-stage-change", D), t.command.register("context.add-note", () => {
11086
- u() && f?.openNoteComposer();
11094
+ n.ownerWindow.addEventListener("mesurer:responsive-stage-change", k), t.command.register("context.add-note", () => {
11095
+ f() && m?.openNoteComposer();
11087
11096
  }), t.command.register("context.notes", () => {
11088
- l() && (o() && a.cancel(), s((e) => !e));
11097
+ d() && (o() && a.cancel(), c(!$t(o)));
11089
11098
  }), t.tool.register({
11090
11099
  id: "context.copy",
11091
11100
  label: "Copy context",
@@ -11093,8 +11102,8 @@ function Em(e = {}) {
11093
11102
  command: "context.copy",
11094
11103
  order: 70,
11095
11104
  toolbarMode: "always",
11096
- icon: ym,
11097
- hidden: () => !l()
11105
+ icon: bm,
11106
+ hidden: () => !d()
11098
11107
  }), t.tool.register({
11099
11108
  id: "context.copy-selection",
11100
11109
  label: "Copy selection",
@@ -11102,9 +11111,9 @@ function Em(e = {}) {
11102
11111
  command: "context.copy-selection",
11103
11112
  order: 71,
11104
11113
  toolbarMode: "always",
11105
- icon: bm,
11106
- hidden: () => !l(),
11107
- disabled: () => !u()
11114
+ icon: xm,
11115
+ hidden: () => !d(),
11116
+ disabled: () => !f()
11108
11117
  }), t.tool.register({
11109
11118
  id: "context.add-note",
11110
11119
  label: "Add note",
@@ -11112,9 +11121,9 @@ function Em(e = {}) {
11112
11121
  command: "context.add-note",
11113
11122
  order: 72,
11114
11123
  toolbarMode: "always",
11115
- icon: xm,
11116
- hidden: () => !l(),
11117
- disabled: () => !u()
11124
+ icon: Sm,
11125
+ hidden: () => !d(),
11126
+ disabled: () => !f()
11118
11127
  }), t.tool.register({
11119
11128
  id: "context.notes",
11120
11129
  label: "Notes",
@@ -11122,9 +11131,9 @@ function Em(e = {}) {
11122
11131
  order: 73,
11123
11132
  toolbarMode: "always",
11124
11133
  compactPinned: !0,
11125
- icon: Sm,
11126
- active: o,
11127
- hidden: () => !l()
11134
+ icon: Cm,
11135
+ active: l,
11136
+ hidden: () => !d()
11128
11137
  }), t.settings.register({
11129
11138
  id: "context",
11130
11139
  label: "Context",
@@ -11134,18 +11143,18 @@ function Em(e = {}) {
11134
11143
  id: "ui",
11135
11144
  label: "Context tools",
11136
11145
  description: "Show Copy Context, Copy Selection, Add Note, and annotation controls.",
11137
- value: l,
11138
- set: d
11146
+ value: d,
11147
+ set: p
11139
11148
  }]
11140
11149
  }), t.lifecycle.onDispose(() => {
11141
- a.dispose(), S(), n.ownerWindow.removeEventListener("mesurer:responsive-stage-change", D), w(), i.dispose();
11150
+ a.dispose(), w(), n.ownerWindow.removeEventListener("mesurer:responsive-stage-change", k), E(), i.dispose();
11142
11151
  });
11143
11152
  }
11144
11153
  };
11145
11154
  }
11146
11155
  //#endregion
11147
11156
  //#region src/plugins/codex/index.ts
11148
- var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable", Am = 2e3, jm = 750, Mm = 2e3, Nm = 1800, Pm = 2e3, Fm = 12e4, Im = 10, Lm = 5, Rm = "http://127.0.0.1:47365", zm = "mesurer-codex", Bm = 2, Vm = [
11157
+ var Om = "mesurer.codex", km = "codex:v1", Am = "mesurer.plugin.before-disable", jm = 2e3, Mm = 750, Nm = 2e3, Pm = 1800, Fm = 2e3, Im = 12e4, Lm = 10, Rm = 5, zm = "http://127.0.0.1:47365", Bm = "mesurer-codex", Vm = 2, Hm = [
11149
11158
  "thread-discovery-v1",
11150
11159
  "durable-queue-v1",
11151
11160
  "history-recovery-v2",
@@ -11153,33 +11162,33 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11153
11162
  "idle-safe-shutdown-v1",
11154
11163
  "nonterminal-retention-v1",
11155
11164
  "instance-binding-v1"
11156
- ], Hm = 1500, Um = 15e3, Wm = 5e3, Gm = [
11165
+ ], Um = 1500, Wm = 15e3, Gm = 5e3, Km = [
11157
11166
  "Implement the current human feedback from Mesurer in this project.",
11158
11167
  "Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
11159
11168
  "and verify the affected UI in the live page with Mesurer before claiming completion."
11160
- ].join(" "), Km = {
11169
+ ].join(" "), qm = {
11161
11170
  viewBox: "0 0 256 256",
11162
11171
  paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
11163
- }, qm = {
11172
+ }, Jm = {
11164
11173
  viewBox: "0 0 256 256",
11165
11174
  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"]
11166
- }, Jm = {
11175
+ }, Ym = {
11167
11176
  viewBox: "0 0 256 256",
11168
11177
  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"]
11169
- }, Ym = class extends Error {
11178
+ }, Xm = class extends Error {
11170
11179
  issue;
11171
11180
  constructor(e, t) {
11172
11181
  super(t), this.issue = e, this.name = "BrowserBridgeConnectionError";
11173
11182
  }
11174
- }, Xm = () => {
11183
+ }, Zm = () => {
11175
11184
  try {
11176
11185
  let e = globalThis.location;
11177
11186
  return e?.origin ? `mesurer-codex-ui:v2:${e.origin}${e.pathname}` : null;
11178
11187
  } catch {
11179
11188
  return null;
11180
11189
  }
11181
- }, Zm = () => {
11182
- let e = Xm();
11190
+ }, Qm = () => {
11191
+ let e = Zm();
11183
11192
  if (!e) return null;
11184
11193
  try {
11185
11194
  let t = globalThis.sessionStorage?.getItem(e);
@@ -11207,35 +11216,35 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11207
11216
  } catch {
11208
11217
  return null;
11209
11218
  }
11210
- }, Qm = (e) => {
11211
- let t = Xm();
11219
+ }, $m = (e) => {
11220
+ let t = Zm();
11212
11221
  if (t) try {
11213
11222
  globalThis.sessionStorage?.setItem(t, JSON.stringify(e));
11214
11223
  } catch {}
11215
- }, $m = (e) => {
11216
- let t = Rm.endsWith("/") ? Rm : `${Rm}/`;
11217
- return new URL(e, t).toString();
11218
11224
  }, eh = (e) => {
11225
+ let t = zm.endsWith("/") ? zm : `${zm}/`;
11226
+ return new URL(e, t).toString();
11227
+ }, th = (e) => {
11219
11228
  let t = e.bridge;
11220
- if (!t) throw new Ym("port-conflict", "Another local service or an outdated Mesurer Codex Bridge is using port 47365. Mesurer will not send data to an unverified service.");
11221
- if (t.name !== zm) throw new Ym("port-conflict", `Another local service is using port 47365 (${t.name ?? "unknown"}). Mesurer will not send Codex data to it.`);
11222
- if (t.protocol !== Bm) throw new Ym("version-mismatch", `Mesurer Codex Bridge is out of date (protocol ${t.protocol ?? "unknown"}; expected ${Bm}). Restart the matching Mesurer Codex Bridge helper.`);
11223
- if (e.access?.allowed === !1) throw new Ym("origin-denied", `Mesurer Codex Bridge does not allow this browser origin (${globalThis.location?.origin ?? "this page"}). Allow this origin when starting the bridge.`);
11224
- let n = new Set(Array.isArray(t.capabilities) ? t.capabilities : []), r = Vm.filter((e) => !n.has(e));
11225
- if (r.length > 0) throw new Ym("capability-mismatch", `Mesurer Codex Bridge is missing required capabilities: ${r.join(", ")}. Restart or update the matching helper.`);
11226
- if (!t.instanceId?.trim()) throw new Ym("capability-mismatch", "Mesurer Codex Bridge did not provide an instance identity. Restart or update the matching helper.");
11227
- }, th = (e) => e.includes("does not allow this browser origin") ? "origin-denied" : e.includes("out of date") ? "version-mismatch" : e.includes("missing required capabilities") || e.includes("did not provide an instance identity") ? "capability-mismatch" : e.includes("Another local service") ? "port-conflict" : e.includes("instance changed") ? "instance-changed" : e.includes("timed out") ? "timed-out" : e.includes("companion is unavailable") ? "not-running" : null, nh = (e) => e instanceof Ym ? e.issue : e instanceof Error ? th(e.message) : null, rh = async (e) => {
11229
+ if (!t) throw new Xm("port-conflict", "Another local service or an outdated Mesurer Codex Bridge is using port 47365. Mesurer will not send data to an unverified service.");
11230
+ if (t.name !== Bm) throw new Xm("port-conflict", `Another local service is using port 47365 (${t.name ?? "unknown"}). Mesurer will not send Codex data to it.`);
11231
+ if (t.protocol !== Vm) throw new Xm("version-mismatch", `Mesurer Codex Bridge is out of date (protocol ${t.protocol ?? "unknown"}; expected ${Vm}). Restart the matching Mesurer Codex Bridge helper.`);
11232
+ if (e.access?.allowed === !1) throw new Xm("origin-denied", `Mesurer Codex Bridge does not allow this browser origin (${globalThis.location?.origin ?? "this page"}). Allow this origin when starting the bridge.`);
11233
+ let n = new Set(Array.isArray(t.capabilities) ? t.capabilities : []), r = Hm.filter((e) => !n.has(e));
11234
+ if (r.length > 0) throw new Xm("capability-mismatch", `Mesurer Codex Bridge is missing required capabilities: ${r.join(", ")}. Restart or update the matching helper.`);
11235
+ if (!t.instanceId?.trim()) throw new Xm("capability-mismatch", "Mesurer Codex Bridge did not provide an instance identity. Restart or update the matching helper.");
11236
+ }, nh = (e) => e.includes("does not allow this browser origin") ? "origin-denied" : e.includes("out of date") ? "version-mismatch" : e.includes("missing required capabilities") || e.includes("did not provide an instance identity") ? "capability-mismatch" : e.includes("Another local service") ? "port-conflict" : e.includes("instance changed") ? "instance-changed" : e.includes("timed out") ? "timed-out" : e.includes("companion is unavailable") ? "not-running" : null, rh = (e) => e instanceof Xm ? e.issue : e instanceof Error ? nh(e.message) : null, ih = async (e) => {
11228
11237
  let t, n;
11229
- if (e.action === "health") t = $m("health");
11238
+ if (e.action === "health") t = eh("health");
11230
11239
  else if (e.action === "threads") {
11231
11240
  let n = new URLSearchParams();
11232
- n.set("limit", String(e.limit ?? Im)), e.thread && n.set("thread", e.thread), t = `${$m("threads")}?${n.toString()}`;
11233
- } else if (e.action === "target") t = $m("target"), n = {
11241
+ n.set("limit", String(e.limit ?? Lm)), e.thread && n.set("thread", e.thread), t = `${eh("threads")}?${n.toString()}`;
11242
+ } else if (e.action === "target") t = eh("target"), n = {
11234
11243
  method: "POST",
11235
11244
  headers: { "Content-Type": "application/json" },
11236
11245
  body: JSON.stringify({ thread: e.thread })
11237
11246
  };
11238
- else if (e.action === "queue") t = $m("send"), n = {
11247
+ else if (e.action === "queue") t = eh("send"), n = {
11239
11248
  method: "POST",
11240
11249
  headers: { "Content-Type": "application/json" },
11241
11250
  body: JSON.stringify({
@@ -11243,8 +11252,8 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11243
11252
  thread: e.thread
11244
11253
  })
11245
11254
  };
11246
- else if (e.action === "delivery") t = $m(`deliveries/${encodeURIComponent(String(e.deliveryId ?? ""))}`);
11247
- else if (e.action === "restore") t = $m("deliveries/restore"), n = {
11255
+ else if (e.action === "delivery") t = eh(`deliveries/${encodeURIComponent(String(e.deliveryId ?? ""))}`);
11256
+ else if (e.action === "restore") t = eh("deliveries/restore"), n = {
11248
11257
  method: "POST",
11249
11258
  headers: { "Content-Type": "application/json" },
11250
11259
  body: JSON.stringify({
@@ -11258,14 +11267,14 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11258
11267
  else throw Error(`Codex browser companion does not support ${e.action}.`);
11259
11268
  if (e.action !== "health") {
11260
11269
  let t = e.bridgeInstanceId?.trim();
11261
- if (!t) throw new Ym("instance-changed", "Mesurer Codex Bridge instance changed before this request could be verified.");
11270
+ if (!t) throw new Xm("instance-changed", "Mesurer Codex Bridge instance changed before this request could be verified.");
11262
11271
  let r = new Headers(n?.headers);
11263
11272
  r.set("X-Mesurer-Bridge-Instance", t), n = {
11264
11273
  ...n,
11265
11274
  headers: r
11266
11275
  };
11267
11276
  }
11268
- let r = new AbortController(), i = e.action === "health" || e.action === "threads" ? Hm : Um, a = globalThis.setTimeout(() => r.abort(), i);
11277
+ let r = new AbortController(), i = e.action === "health" || e.action === "threads" ? Um : Wm, a = globalThis.setTimeout(() => r.abort(), i);
11269
11278
  try {
11270
11279
  let i = await fetch(t, {
11271
11280
  ...n,
@@ -11276,23 +11285,23 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11276
11285
  } catch {
11277
11286
  o = { error: a };
11278
11287
  }
11279
- if (e.action === "health" && eh(o), !i.ok || o.ok === !1) {
11280
- let e = o.error ?? `Mesurer Codex companion returned HTTP ${i.status}.`, t = th(e);
11281
- throw t ? new Ym(t, e) : Error(e);
11288
+ if (e.action === "health" && th(o), !i.ok || o.ok === !1) {
11289
+ let e = o.error ?? `Mesurer Codex companion returned HTTP ${i.status}.`, t = nh(e);
11290
+ throw t ? new Xm(t, e) : Error(e);
11282
11291
  }
11283
11292
  return o;
11284
11293
  } catch (e) {
11285
- throw e instanceof Error && e.name === "AbortError" ? new Ym("timed-out", "Mesurer Codex companion timed out.") : e instanceof TypeError ? new Ym("not-running", `Mesurer Codex companion is unavailable at ${Rm}.`) : e;
11294
+ throw e instanceof Error && e.name === "AbortError" ? new Xm("timed-out", "Mesurer Codex companion timed out.") : e instanceof TypeError ? new Xm("not-running", `Mesurer Codex companion is unavailable at ${zm}.`) : e;
11286
11295
  } finally {
11287
11296
  globalThis.clearTimeout(a);
11288
11297
  }
11289
- }, ih = async (e) => {
11298
+ }, ah = async (e) => {
11290
11299
  let t = window.__MESURER_HOST__?.codexBridge;
11291
11300
  if (!t) throw Error("Codex native host bridge is unavailable.");
11292
11301
  let n = await t(e);
11293
11302
  if (n.ok === !1) throw Error(n.error ?? "Codex Bridge request failed.");
11294
11303
  return n;
11295
- }, ah = (e) => {
11304
+ }, oh = (e) => {
11296
11305
  let t = e.runtime;
11297
11306
  return !t || ![
11298
11307
  "shared",
@@ -11310,10 +11319,10 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11310
11319
  available: t.available === !0,
11311
11320
  reason: t.reason
11312
11321
  };
11313
- }, oh = (e) => ({
11322
+ }, sh = (e) => ({
11314
11323
  thread: e.thread?.trim() || null,
11315
11324
  threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
11316
- }), sh = (e) => {
11325
+ }), ch = (e) => {
11317
11326
  let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
11318
11327
  if (!t || !n || !r) throw Error("Codex Bridge returned an invalid delivery state.");
11319
11328
  let i = {
@@ -11325,7 +11334,7 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11325
11334
  updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
11326
11335
  };
11327
11336
  return e.queuedSubmissionId !== void 0 && (i.queuedSubmissionId = e.queuedSubmissionId?.trim() || null), e.clientUserMessageId !== void 0 && (i.clientUserMessageId = e.clientUserMessageId?.trim() || null), e.dispatch !== void 0 && (i.dispatch = e.dispatch), e.dispatchError !== void 0 && (i.dispatchError = e.dispatchError?.trim() || null), i;
11328
- }, ch = (e) => ({
11337
+ }, lh = (e) => ({
11329
11338
  thread: e.thread?.trim() || null,
11330
11339
  threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
11331
11340
  let t = e.id?.trim() ?? "";
@@ -11337,7 +11346,7 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11337
11346
  }] : [];
11338
11347
  }) : [],
11339
11348
  hasMore: e.hasMore === !0
11340
- }), lh = async (e, t, n) => {
11349
+ }), uh = async (e, t, n) => {
11341
11350
  let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = (a ? a.flatMap((e) => {
11342
11351
  let t = i.find((t) => t.id === e);
11343
11352
  return t ? [t] : [];
@@ -11368,18 +11377,18 @@ var Dm = "mesurer.codex", Om = "codex:v1", km = "mesurer.plugin.before-disable",
11368
11377
  ])
11369
11378
  ].join("\n").trimEnd()
11370
11379
  };
11371
- }, uh = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, dh = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, fh = (e) => nh(e) !== null || e instanceof Error && (e.message === "Codex Bridge is unavailable in this host." || e.message.includes("Codex Bridge lease") || e.message.includes("Mesurer Codex Bridge"));
11372
- function ph(e = {}) {
11373
- let t = e.instruction?.trim() || Gm, n = e.ui ?? !0, r = e.clearCompletedAnnotations ?? !0;
11380
+ }, dh = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, fh = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, ph = (e) => rh(e) !== null || e instanceof Error && (e.message === "Codex Bridge is unavailable in this host." || e.message.includes("Codex Bridge lease") || e.message.includes("Mesurer Codex Bridge"));
11381
+ function mh(e = {}) {
11382
+ let t = e.instruction?.trim() || Km, n = e.ui ?? !0, r = e.clearCompletedAnnotations ?? !0;
11374
11383
  return {
11375
- id: Dm,
11384
+ id: Om,
11376
11385
  version: Cp,
11377
11386
  requires: [hm],
11378
- provides: [Om],
11387
+ provides: [km],
11379
11388
  async setup(e) {
11380
11389
  let i = e.service.get(hm);
11381
11390
  if (!i) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
11382
- let a = n ? Zm() : null, o = "unknown", s = null, c = !1, l = a?.originThread ?? null, u = a?.selectedThread ?? a?.originThread ?? null, d = !1, f = null, p = [], m = [], h = !1, g = Lm, _, v = "", y = null, b = a?.delivery ? {
11391
+ let a = n ? Qm() : null, o = "unknown", s = null, c = !1, l = a?.originThread ?? null, u = a?.selectedThread ?? a?.originThread ?? null, d = !1, f = null, p = [], m = [], h = !1, g = Rm, _, v = "", y = null, b = a?.delivery ? {
11383
11392
  id: a.delivery.id,
11384
11393
  thread: a.delivery.thread,
11385
11394
  status: a.delivery.status,
@@ -11394,22 +11403,22 @@ function ph(e = {}) {
11394
11403
  if (!A) try {
11395
11404
  let t = e.action === "queue" || e.action === "target" || e.action === "delivery" || e.action === "restore";
11396
11405
  if (e.action === "health") {
11397
- let t = await rh(e);
11406
+ let t = await ih(e);
11398
11407
  return O = t.bridge?.instanceId?.trim() || null, D = Date.now(), t;
11399
11408
  }
11400
- return (!O || t || Date.now() - D >= Wm) && (O = (await rh({
11409
+ return (!O || t || Date.now() - D >= Gm) && (O = (await ih({
11401
11410
  action: "health",
11402
11411
  thread: u ?? l ?? void 0
11403
- })).bridge?.instanceId?.trim() || null, D = Date.now()), await rh({
11412
+ })).bridge?.instanceId?.trim() || null, D = Date.now()), await ih({
11404
11413
  ...e,
11405
11414
  bridgeInstanceId: O ?? void 0
11406
11415
  });
11407
11416
  } catch (e) {
11408
11417
  throw D = 0, O = null, e;
11409
11418
  }
11410
- if (e.action === "activate" || e.action === "runtime") return ih(e);
11419
+ if (e.action === "activate" || e.action === "runtime") return ah(e);
11411
11420
  if (!E) throw Error("Codex Bridge lease is not active for this plugin.");
11412
- return ih({
11421
+ return ah({
11413
11422
  ...e,
11414
11423
  leaseId: E
11415
11424
  });
@@ -11417,7 +11426,7 @@ function ph(e = {}) {
11417
11426
  if (!A) return;
11418
11427
  let e = E;
11419
11428
  if (e) {
11420
- if ((await ih({
11429
+ if ((await ah({
11421
11430
  action: "deactivate",
11422
11431
  leaseId: e
11423
11432
  })).released !== !0) throw Error("Codex Bridge did not confirm lease release.");
@@ -11425,13 +11434,13 @@ function ph(e = {}) {
11425
11434
  }
11426
11435
  };
11427
11436
  if (A) {
11428
- let e = await ih({
11437
+ let e = await ah({
11429
11438
  action: "activate",
11430
11439
  thread: u ?? l ?? void 0
11431
11440
  }), t = e.leaseId?.trim();
11432
11441
  if (!t) throw Error("Codex Bridge did not return an activation lease.");
11433
- E = t, o = "available", s = ah(e);
11434
- let n = oh(e);
11442
+ E = t, o = "available", s = oh(e);
11443
+ let n = sh(e);
11435
11444
  c = !0, f = n.thread, p = n.threads;
11436
11445
  }
11437
11446
  e.lifecycle.onDispose(() => {
@@ -11439,12 +11448,12 @@ function ph(e = {}) {
11439
11448
  let t = e instanceof Error ? e.message : String(e);
11440
11449
  console.error(`[Mesurer] Failed to release Codex host lease: ${t}`);
11441
11450
  });
11442
- }), e.hook.on(km, async (e) => {
11451
+ }), e.hook.on(Am, async (e) => {
11443
11452
  e === "mesurer.codex" && await M();
11444
11453
  });
11445
11454
  let N = async () => {
11446
11455
  if (!A) return null;
11447
- let e = ah(await j({ action: "runtime" }));
11456
+ let e = oh(await j({ action: "runtime" }));
11448
11457
  if (!e) throw Error("Codex Bridge returned an invalid runtime state.");
11449
11458
  return s = e, e;
11450
11459
  }, P = async () => {
@@ -11452,8 +11461,8 @@ function ph(e = {}) {
11452
11461
  action: "health",
11453
11462
  thread: u ?? l ?? void 0
11454
11463
  });
11455
- return s = ah(e) ?? s, oh(e);
11456
- }, F = P, I = async (e) => sh(await j({
11464
+ return s = oh(e) ?? s, sh(e);
11465
+ }, F = P, I = async (e) => ch(await j({
11457
11466
  action: "delivery",
11458
11467
  deliveryId: e
11459
11468
  })), L = async (e) => {
@@ -11463,13 +11472,13 @@ function ph(e = {}) {
11463
11472
  deliveryId: e.id,
11464
11473
  thread: e.thread
11465
11474
  };
11466
- return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), e.clientUserMessageId && (t.clientUserMessageId = e.clientUserMessageId), e.message && (t.message = e.message), sh(await j(t));
11475
+ return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), e.clientUserMessageId && (t.clientUserMessageId = e.clientUserMessageId), e.message && (t.message = e.message), ch(await j(t));
11467
11476
  }, R = async (e = {}) => {
11468
11477
  let t = {
11469
11478
  action: "threads",
11470
- limit: e.limit ?? Im
11479
+ limit: e.limit ?? Lm
11471
11480
  }, n = e.thread?.trim();
11472
- return n && (t.thread = n), ch(await j(t));
11481
+ return n && (t.thread = n), lh(await j(t));
11473
11482
  }, z = () => u ?? l ?? (d ? null : f), B = () => {
11474
11483
  if (!n) return;
11475
11484
  let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "completed" || b.status === "interrupted" || b.status === "failed") ? {
@@ -11484,7 +11493,7 @@ function ph(e = {}) {
11484
11493
  annotationSnapshots: b.annotationSnapshots,
11485
11494
  message: b.message
11486
11495
  } : null;
11487
- Qm({
11496
+ $m({
11488
11497
  version: 1,
11489
11498
  originThread: l,
11490
11499
  selectedThread: u,
@@ -11502,12 +11511,12 @@ function ph(e = {}) {
11502
11511
  "queueing",
11503
11512
  "queued",
11504
11513
  "working"
11505
- ].includes(b.status) ? qm : b.status === "completed" ? Jm : Km : Km, ne = () => {
11514
+ ].includes(b.status) ? Jm : b.status === "completed" ? Ym : qm : qm, ne = () => {
11506
11515
  let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
11507
11516
  t.has(n.id) || (t.add(n.id), e.push(n));
11508
11517
  }, r = (e) => ({
11509
11518
  id: e,
11510
- title: `Codex ${uh(e)}`,
11519
+ title: `Codex ${dh(e)}`,
11511
11520
  updatedAt: null,
11512
11521
  connected: !0
11513
11522
  });
@@ -11545,22 +11554,22 @@ function ph(e = {}) {
11545
11554
  let t = e.id === l ? "Current · " : e.connected ? "Loaded · " : "", r = b?.thread === e.id ? ` · ${ee(b.status)}` : "";
11546
11555
  return {
11547
11556
  id: `codex.thread.${e.id}`,
11548
- label: `${t}${dh(e.title)}${r}`,
11557
+ label: `${t}${fh(e.title)}${r}`,
11549
11558
  checked: () => n === e.id,
11550
11559
  disabled: () => H(),
11551
11560
  run() {
11552
11561
  H() || (V(e.id, !l), W());
11553
11562
  }
11554
11563
  };
11555
- })), g < Im && (e.length > g || h) && r.push({
11564
+ })), g < Lm && (e.length > g || h) && r.push({
11556
11565
  id: "codex.thread.show-more",
11557
11566
  label: "Show 5 more…",
11558
11567
  run() {
11559
- g = Im, W();
11568
+ g = Lm, W();
11560
11569
  }
11561
11570
  }), b?.queuedSubmissionId && b.status === "queued" && (b.dispatch === "desktop-opened" || b.dispatch === "desktop-wake-failed") && r.push({
11562
11571
  id: "codex.delivery.receipt",
11563
- label: `Receipt · ${uh(b.queuedSubmissionId)}`,
11572
+ label: `Receipt · ${dh(b.queuedSubmissionId)}`,
11564
11573
  disabled: () => !0,
11565
11574
  run: () => void 0
11566
11575
  }), r;
@@ -11597,7 +11606,7 @@ function ph(e = {}) {
11597
11606
  }, G = async (e) => {
11598
11607
  if (o !== "available") return;
11599
11608
  let t = await R({
11600
- limit: Im,
11609
+ limit: Lm,
11601
11610
  thread: e ?? void 0
11602
11611
  });
11603
11612
  m = t.threads, h = t.hasMore, p = t.threads.filter((e) => e.connected).map((e) => e.id), f = t.thread;
@@ -11609,7 +11618,7 @@ function ph(e = {}) {
11609
11618
  let t = u ?? l;
11610
11619
  t && p.includes(t) ? d = !1 : p.length === 1 ? V(p[0], !0) : d = !0, !d && t && B();
11611
11620
  } catch (e) {
11612
- throw o = "unavailable", k = A ? null : nh(e) ?? "unavailable", s = await N().catch(() => s), e;
11621
+ throw o = "unavailable", k = A ? null : rh(e) ?? "unavailable", s = await N().catch(() => s), e;
11613
11622
  } finally {
11614
11623
  y = null, W();
11615
11624
  }
@@ -11619,7 +11628,7 @@ function ph(e = {}) {
11619
11628
  }, ce = () => {
11620
11629
  C && globalThis.clearTimeout(C), C = globalThis.setTimeout(() => {
11621
11630
  C = 0, b?.status === "completed" && (b = null, B(), W());
11622
- }, Nm);
11631
+ }, Pm);
11623
11632
  }, le = async (e) => {
11624
11633
  if (!(!b || b.id !== e.id)) {
11625
11634
  if (b = {
@@ -11648,7 +11657,7 @@ function ph(e = {}) {
11648
11657
  if (t) {
11649
11658
  B(), W(), S = globalThis.setTimeout(() => {
11650
11659
  S = 0, K(e.id);
11651
- }, jm);
11660
+ }, Mm);
11652
11661
  return;
11653
11662
  }
11654
11663
  }
@@ -11658,14 +11667,14 @@ function ph(e = {}) {
11658
11667
  if (e.status === "interrupted") {
11659
11668
  B(), W();
11660
11669
  let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
11661
- Date.now() - t < Fm && (S = globalThis.setTimeout(() => {
11670
+ Date.now() - t < Im && (S = globalThis.setTimeout(() => {
11662
11671
  S = 0, K(e.id);
11663
- }, Pm));
11672
+ }, Fm));
11664
11673
  return;
11665
11674
  }
11666
11675
  W(), S = globalThis.setTimeout(() => {
11667
11676
  S = 0, K(e.id);
11668
- }, Mm);
11677
+ }, Nm);
11669
11678
  }
11670
11679
  }, K = async (e) => {
11671
11680
  if (!(T || b?.id !== e)) try {
@@ -11689,7 +11698,7 @@ function ph(e = {}) {
11689
11698
  b = {
11690
11699
  ...b,
11691
11700
  status: "failed"
11692
- }, B(), fh(n) && (o = "unavailable"), W();
11701
+ }, B(), ph(n) && (o = "unavailable"), W();
11693
11702
  }
11694
11703
  }, ue = {
11695
11704
  health: P,
@@ -11701,11 +11710,11 @@ function ph(e = {}) {
11701
11710
  let n = await j({
11702
11711
  action: "target",
11703
11712
  thread: t
11704
- }), r = oh(n);
11705
- return s = ah(n) ?? s, V(t, !l), f = r.thread, p = r.threads, o = "available", c = !0, W(), r;
11713
+ }), r = sh(n);
11714
+ return s = oh(n) ?? s, V(t, !l), f = r.thread, p = r.threads, o = "available", c = !0, W(), r;
11706
11715
  },
11707
11716
  async queue(e) {
11708
- let r = await lh(i, e, t), a = e?.thread?.trim(), s = a || (n ? z() : null);
11717
+ let r = await uh(i, e, t), a = e?.thread?.trim(), s = a || (n ? z() : null);
11709
11718
  if (n && !a && (d || !s)) throw Error("Choose a Codex thread before queueing feedback.");
11710
11719
  let c = { message: r.message };
11711
11720
  s && (c.thread = s);
@@ -11728,14 +11737,14 @@ function ph(e = {}) {
11728
11737
  message: r.message
11729
11738
  }), n;
11730
11739
  } catch (e) {
11731
- throw n && fh(e) && (o = "unavailable", k = A ? null : nh(e) ?? "unavailable", W()), e;
11740
+ throw n && ph(e) && (o = "unavailable", k = A ? null : rh(e) ?? "unavailable", W()), e;
11732
11741
  }
11733
11742
  },
11734
11743
  send(e) {
11735
11744
  return ue.queue(e);
11736
11745
  }
11737
11746
  };
11738
- e.service.provide(Om, ue);
11747
+ e.service.provide(km, ue);
11739
11748
  let de = async () => {
11740
11749
  if (!(w || H())) {
11741
11750
  if (b?.status === "failed" && b.id) {
@@ -11775,9 +11784,9 @@ function ph(e = {}) {
11775
11784
  updatedAt: 0
11776
11785
  }) : S = globalThis.setTimeout(() => {
11777
11786
  S = 0, K(e.deliveryId);
11778
- }, jm) : C = globalThis.setTimeout(() => {
11787
+ }, Mm) : C = globalThis.setTimeout(() => {
11779
11788
  C = 0, b?.id === null && b?.status === "queued" && (b = null, B(), W());
11780
- }, Nm);
11789
+ }, Pm);
11781
11790
  } catch (e) {
11782
11791
  b = null, B(), W();
11783
11792
  let t = e instanceof Error ? e.message : String(e);
@@ -11806,7 +11815,7 @@ function ph(e = {}) {
11806
11815
  }, 0));
11807
11816
  let t = globalThis.setInterval(() => {
11808
11817
  A && !c || re(!0).catch(() => void 0);
11809
- }, A ? Am : Wm);
11818
+ }, A ? jm : Gm);
11810
11819
  e.lifecycle.onDispose(() => {
11811
11820
  T = !0, se(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
11812
11821
  });
@@ -11816,15 +11825,15 @@ function ph(e = {}) {
11816
11825
  }
11817
11826
  //#endregion
11818
11827
  //#region src/recording.ts
11819
- var mh = Sf, hh = Cf, gh = wf, _h = (e = {}) => ({
11828
+ var hh = Sf, gh = Cf, _h = wf, vh = (e = {}) => ({
11820
11829
  ...Uf(e),
11821
11830
  version: Cp
11822
- }), vh = ap, yh = np, bh = rp, xh = ip, Sh = 4, Ch = po, wh = (e, t) => Ua(e, t), Th = (e = /* @__PURE__ */ new Date()) => Wa(e), Eh = (e, t, n, r) => Ha(e, t, n, r), Dh = (e, t, n) => Va(e, t, n), Oh = (e, t) => lo(e, t), kh = (e) => fo(e), Ah = (e = {}) => ({
11831
+ }), yh = ap, bh = np, xh = rp, Sh = ip, Ch = 4, wh = po, Th = (e, t) => Ua(e, t), Eh = (e = /* @__PURE__ */ new Date()) => Wa(e), Dh = (e, t, n, r) => Ha(e, t, n, r), Oh = (e, t, n) => Va(e, t, n), kh = (e, t) => lo(e, t), Ah = (e) => fo(e), jh = (e = {}) => ({
11823
11832
  ...Sp(e),
11824
11833
  version: Cp
11825
- }), jh = (e) => Ka(e), Mh = (e) => ({
11834
+ }), Mh = (e) => Ka(e), Nh = (e) => ({
11826
11835
  ...e,
11827
11836
  version: Cp
11828
- }), Nh = () => Mh(Ul()), Ph = () => Mh(Wl()), Fh = () => Mh(Gl()), Ih = () => Mh(Kl()), Lh = () => Mh(Jl()), Rh = () => Mh(Yl()), zh = () => Mh(Zl()), Bh = () => Mh(Xl()), Vh = () => Ql().map(Mh), Hh = (e = [], t = []) => $l(e, t).map((e) => e.id.startsWith("mesurer.") ? Mh(e) : e);
11837
+ }), Ph = () => Nh(Ul()), Fh = () => Nh(Wl()), Ih = () => Nh(Gl()), Lh = () => Nh(Kl()), Rh = () => Nh(Jl()), zh = () => Nh(Yl()), Bh = () => Nh(Zl()), Vh = () => Nh(Xl()), Hh = () => Ql().map(Nh), Uh = (e = [], t = []) => $l(e, t).map((e) => e.id.startsWith("mesurer.") ? Nh(e) : e);
11829
11838
  //#endregion
11830
- export { wp as MESURER_ARRANGE_ACTIVE_STATE_ID, Tp as MESURER_ARRANGE_PLUGIN_ID, Ep as MESURER_ARRANGE_SERVICE_ID, Dp as MESURER_ARRANGE_SETTINGS_STATE_ID, Op as MESURER_ARRANGE_STATE_ID, Dm as MESURER_CODEX_PLUGIN_ID, Om as MESURER_CODEX_SERVICE_ID, mm as MESURER_CONTEXT_PLUGIN_ID, hm as MESURER_CONTEXT_SERVICE_ID, gm as MESURER_CONTEXT_SETTINGS_STATE_ID, jp as MESURER_EDIT_ACTIVE_STATE_ID, Mp as MESURER_EDIT_PLUGIN_ID, Np as MESURER_EDIT_SERVICE_ID, Pp as MESURER_EDIT_SETTINGS_STATE_ID, Fp as MESURER_EDIT_STATE_ID, fm as MESURER_LAYOUT_GUIDES_ACTIVE_STATE_ID, lm as MESURER_LAYOUT_GUIDES_PLUGIN_ID, um as MESURER_LAYOUT_GUIDES_SERVICE_ID, dm as MESURER_LAYOUT_GUIDES_STATE_ID, mh as MESURER_RECORDING_PLUGIN_ID, hh as MESURER_RECORDING_SERVICE_ID, gh as MESURER_RECORDING_SETTINGS_STATE_ID, vh as MESURER_SCREENSHOT_ACTIVE_STATE_ID, yh as MESURER_SCREENSHOT_PLUGIN_ID, bh as MESURER_SCREENSHOT_SERVICE_ID, xh as MESURER_SCREENSHOT_SETTINGS_STATE_ID, Sh as MIN_SCREENSHOT_SELECTION, kp as arrange, Ch as captureVisibleTabPng, ph as codex, Fh as colorPicker, Hh as compose, Em as context, wh as copyPngToClipboard, Th as createScreenshotFilename, Eh as cropPngToViewportRect, Vh as defaults, zh as distance, Ap as edit, Rh as guides, pm as layoutGuides, Dh as normalizeScreenshotRect, Oh as prepareScreenshotCapture, _h as recording, kh as releaseScreenshotCapture, Ih as rulers, Ah as screenshot, Nh as select, Bh as settings, Lh as typography, jh as waitForNextPaint, Ph as xray };
11839
+ export { wp as MESURER_ARRANGE_ACTIVE_STATE_ID, Tp as MESURER_ARRANGE_PLUGIN_ID, Ep as MESURER_ARRANGE_SERVICE_ID, Dp as MESURER_ARRANGE_SETTINGS_STATE_ID, Op as MESURER_ARRANGE_STATE_ID, Om as MESURER_CODEX_PLUGIN_ID, km as MESURER_CODEX_SERVICE_ID, mm as MESURER_CONTEXT_PLUGIN_ID, hm as MESURER_CONTEXT_SERVICE_ID, gm as MESURER_CONTEXT_SETTINGS_STATE_ID, jp as MESURER_EDIT_ACTIVE_STATE_ID, Mp as MESURER_EDIT_PLUGIN_ID, Np as MESURER_EDIT_SERVICE_ID, Pp as MESURER_EDIT_SETTINGS_STATE_ID, Fp as MESURER_EDIT_STATE_ID, fm as MESURER_LAYOUT_GUIDES_ACTIVE_STATE_ID, lm as MESURER_LAYOUT_GUIDES_PLUGIN_ID, um as MESURER_LAYOUT_GUIDES_SERVICE_ID, dm as MESURER_LAYOUT_GUIDES_STATE_ID, hh as MESURER_RECORDING_PLUGIN_ID, gh as MESURER_RECORDING_SERVICE_ID, _h as MESURER_RECORDING_SETTINGS_STATE_ID, yh as MESURER_SCREENSHOT_ACTIVE_STATE_ID, bh as MESURER_SCREENSHOT_PLUGIN_ID, xh as MESURER_SCREENSHOT_SERVICE_ID, Sh as MESURER_SCREENSHOT_SETTINGS_STATE_ID, Ch as MIN_SCREENSHOT_SELECTION, kp as arrange, wh as captureVisibleTabPng, mh as codex, Ih as colorPicker, Uh as compose, Dm as context, Th as copyPngToClipboard, Eh as createScreenshotFilename, Dh as cropPngToViewportRect, Hh as defaults, Bh as distance, Ap as edit, zh as guides, pm as layoutGuides, Oh as normalizeScreenshotRect, kh as prepareScreenshotCapture, vh as recording, Ah as releaseScreenshotCapture, Lh as rulers, jh as screenshot, Ph as select, Vh as settings, Rh as typography, Mh as waitForNextPaint, Fh as xray };