mesurer-solid 0.2.0-beta.0 → 0.2.0-beta.2
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 +141 -144
- package/dist/inject-script.js +4 -4
- package/dist/inject.js +147 -150
- package/dist/plugins.js +337 -336
- package/package.json +1 -1
package/dist/inject.js
CHANGED
|
@@ -14630,21 +14630,17 @@ function t_(e) {
|
|
|
14630
14630
|
if (!Ru(e.fingerprint)) return null;
|
|
14631
14631
|
let t = [];
|
|
14632
14632
|
try {
|
|
14633
|
-
t = D(e.selector)
|
|
14633
|
+
t = D(e.selector);
|
|
14634
14634
|
} catch {
|
|
14635
14635
|
return null;
|
|
14636
14636
|
}
|
|
14637
|
-
|
|
14638
|
-
if (
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
}
|
|
14645
|
-
if (n.length !== 1 || n[0] !== t[0]) return null;
|
|
14646
|
-
}
|
|
14647
|
-
return t[0] ?? null;
|
|
14637
|
+
let n = t.filter((t) => zu(t, e.fingerprint));
|
|
14638
|
+
if (t.length === 1 && n.length === 1) return n[0] ?? null;
|
|
14639
|
+
if (t.length !== 1 || e.fingerprint.id || e.fingerprint.testId) return null;
|
|
14640
|
+
let r = t[0];
|
|
14641
|
+
if (!r || r.localName !== e.fingerprint.tag) return null;
|
|
14642
|
+
let i = Tu(r), a = e.lastRect, o = Math.max(4, Math.max(a.width, a.height) * .05), s = Math.max(2, Math.max(a.width, a.height) * .03);
|
|
14643
|
+
return Math.abs(i.left - a.left) <= o && Math.abs(i.top - a.top) <= o && Math.abs(i.width - a.width) <= s && Math.abs(i.height - a.height) <= s ? r : null;
|
|
14648
14644
|
}, j = (e, t) => {
|
|
14649
14645
|
let n = T(e, t.id), r = y.get(n);
|
|
14650
14646
|
if (r?.isConnected && E(r)) return r;
|
|
@@ -17836,7 +17832,7 @@ function Ty(e) {
|
|
|
17836
17832
|
}
|
|
17837
17833
|
//#endregion
|
|
17838
17834
|
//#region src/version.ts
|
|
17839
|
-
var Ey = "0.2.0-beta.
|
|
17835
|
+
var Ey = "0.2.0-beta.2", Dy = Xf, Oy = Zf, ky = () => ({
|
|
17840
17836
|
...Ip(),
|
|
17841
17837
|
version: Ey
|
|
17842
17838
|
}), Ay = (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, jy = (e) => {
|
|
@@ -18079,8 +18075,8 @@ var Ky = (e, t, n, r, i) => {
|
|
|
18079
18075
|
evidence: t,
|
|
18080
18076
|
id: n,
|
|
18081
18077
|
label: r
|
|
18082
|
-
});
|
|
18083
|
-
function
|
|
18078
|
+
}), Jy = (e, t) => Math.abs(e.left - t.left) < .01 && Math.abs(e.top - t.top) < .01 && Math.abs(e.width - t.width) < .01 && Math.abs(e.height - t.height) < .01;
|
|
18079
|
+
function Yy(e) {
|
|
18084
18080
|
let t = e.runtime.annotation(e.annotationId);
|
|
18085
18081
|
if (!t) throw Error(`Mesurer annotation not found: ${e.annotationId}`);
|
|
18086
18082
|
let n = Vy({
|
|
@@ -18114,12 +18110,13 @@ function Jy(e) {
|
|
|
18114
18110
|
Ky(a, "guide", `${e.orientation} guide ${e.id}`, e.position, t.position);
|
|
18115
18111
|
}
|
|
18116
18112
|
for (let e of t.baseline.measurements) {
|
|
18117
|
-
let
|
|
18118
|
-
if (!
|
|
18119
|
-
|
|
18113
|
+
let r = n.visualContext.measurements.find((t) => t.id === e.id) ?? i.find((t) => t.id === e.id);
|
|
18114
|
+
if (!r) {
|
|
18115
|
+
let r = t.baseline.targets.find((t) => Jy(t.rect, e.rect));
|
|
18116
|
+
r && n.targets.some((e) => e.ref === r.id) || qy(a, "measurement", e.id, e.id);
|
|
18120
18117
|
continue;
|
|
18121
18118
|
}
|
|
18122
|
-
Ky(a, "measurement", `${e.id} width`, e.rect.width,
|
|
18119
|
+
Ky(a, "measurement", `${e.id} width`, e.rect.width, r.rect.width), Ky(a, "measurement", `${e.id} height`, e.rect.height, r.rect.height);
|
|
18123
18120
|
}
|
|
18124
18121
|
for (let e of t.baseline.distances) {
|
|
18125
18122
|
let t = n.visualContext.distances.find((t) => t.id === e.id) ?? r.heldDistances.find((t) => t.id === e.id);
|
|
@@ -18139,7 +18136,7 @@ function Jy(e) {
|
|
|
18139
18136
|
changes: a
|
|
18140
18137
|
};
|
|
18141
18138
|
}
|
|
18142
|
-
async function
|
|
18139
|
+
async function Xy(e, t, n) {
|
|
18143
18140
|
try {
|
|
18144
18141
|
if (t.navigator.clipboard?.writeText) {
|
|
18145
18142
|
await t.navigator.clipboard.writeText(n);
|
|
@@ -18153,22 +18150,22 @@ async function Yy(e, t, n) {
|
|
|
18153
18150
|
}
|
|
18154
18151
|
//#endregion
|
|
18155
18152
|
//#region src/layout-guides.ts
|
|
18156
|
-
var
|
|
18153
|
+
var Zy = $_, Qy = ev, $y = () => ({
|
|
18157
18154
|
...Ev(),
|
|
18158
18155
|
version: Ey
|
|
18159
|
-
}),
|
|
18156
|
+
}), eb = "mesurer.context", tb = "context:v1", nb = "mesurer.context.settings", rb = "context.ui", ib = "data-mesurer-direct-text-edit-active", ab = {
|
|
18160
18157
|
viewBox: "0 0 256 256",
|
|
18161
18158
|
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"]
|
|
18162
|
-
},
|
|
18159
|
+
}, ob = {
|
|
18163
18160
|
viewBox: "0 0 256 256",
|
|
18164
18161
|
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"]
|
|
18165
|
-
},
|
|
18162
|
+
}, sb = {
|
|
18166
18163
|
viewBox: "0 0 256 256",
|
|
18167
18164
|
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"]
|
|
18168
|
-
},
|
|
18165
|
+
}, cb = async (e, t, n = 1) => {
|
|
18169
18166
|
await e.fonts?.ready;
|
|
18170
18167
|
for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
|
|
18171
|
-
},
|
|
18168
|
+
}, lb = (e, t, n, r) => {
|
|
18172
18169
|
let i = async (i) => Vy({
|
|
18173
18170
|
runtime: e,
|
|
18174
18171
|
ownerDocument: t,
|
|
@@ -18179,17 +18176,17 @@ var Xy = $_, Zy = ev, Qy = () => ({
|
|
|
18179
18176
|
return {
|
|
18180
18177
|
context: i,
|
|
18181
18178
|
contextText: a,
|
|
18182
|
-
copyContext: async (e) =>
|
|
18179
|
+
copyContext: async (e) => Xy(t, n, await a(e)),
|
|
18183
18180
|
select: async (r) => {
|
|
18184
18181
|
let a = Array.isArray(r) ? [...r] : [String(r)];
|
|
18185
|
-
return e.select(a), await
|
|
18182
|
+
return e.select(a), await cb(t, n), i({ scope: "selection" });
|
|
18186
18183
|
},
|
|
18187
18184
|
annotations: async () => e.annotations(),
|
|
18188
18185
|
removeAnnotation: async (r) => {
|
|
18189
|
-
e.removeAnnotation(r), await
|
|
18186
|
+
e.removeAnnotation(r), await cb(t, n);
|
|
18190
18187
|
},
|
|
18191
18188
|
review: async (i) => {
|
|
18192
|
-
if (await
|
|
18189
|
+
if (await cb(t, n), i) return Yy({
|
|
18193
18190
|
runtime: e,
|
|
18194
18191
|
ownerDocument: t,
|
|
18195
18192
|
ownerWindow: n,
|
|
@@ -18197,7 +18194,7 @@ var Xy = $_, Zy = ev, Qy = () => ({
|
|
|
18197
18194
|
layoutGuides: r()
|
|
18198
18195
|
});
|
|
18199
18196
|
let a = r();
|
|
18200
|
-
return e.annotations().map((r) =>
|
|
18197
|
+
return e.annotations().map((r) => Yy({
|
|
18201
18198
|
runtime: e,
|
|
18202
18199
|
ownerDocument: t,
|
|
18203
18200
|
ownerWindow: n,
|
|
@@ -18207,36 +18204,36 @@ var Xy = $_, Zy = ev, Qy = () => ({
|
|
|
18207
18204
|
},
|
|
18208
18205
|
capturePlan: async (e) => Gy(await i(e)),
|
|
18209
18206
|
prepareCapture: async () => {
|
|
18210
|
-
e.prepareCapture(), await
|
|
18207
|
+
e.prepareCapture(), await cb(t, n);
|
|
18211
18208
|
},
|
|
18212
18209
|
finishCapture: async () => {
|
|
18213
|
-
e.finishCapture(), await
|
|
18210
|
+
e.finishCapture(), await cb(t, n);
|
|
18214
18211
|
}
|
|
18215
18212
|
};
|
|
18216
|
-
},
|
|
18213
|
+
}, ub = (e) => {
|
|
18217
18214
|
let t = e.currentSelection();
|
|
18218
18215
|
return t.elements.length > 0 || t.region !== null;
|
|
18219
18216
|
};
|
|
18220
|
-
function
|
|
18217
|
+
function db(e = {}) {
|
|
18221
18218
|
return {
|
|
18222
|
-
id:
|
|
18219
|
+
id: eb,
|
|
18223
18220
|
version: Ey,
|
|
18224
18221
|
requires: ["runtime:solid"],
|
|
18225
|
-
provides: [
|
|
18222
|
+
provides: [tb],
|
|
18226
18223
|
setup(t) {
|
|
18227
18224
|
let n = t.service.get("runtime:solid");
|
|
18228
18225
|
if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
|
|
18229
|
-
let r = n.createWorkspaceRuntime(
|
|
18230
|
-
t.service.provide(
|
|
18231
|
-
id:
|
|
18226
|
+
let r = n.createWorkspaceRuntime(eb), i = lb(r, n.ownerDocument, n.ownerWindow, () => t.service.get(Qy)?.list() ?? []);
|
|
18227
|
+
t.service.provide(tb, i), t.state.register({
|
|
18228
|
+
id: nb,
|
|
18232
18229
|
initial: { ui: e.ui ?? !0 },
|
|
18233
18230
|
persist: !0
|
|
18234
18231
|
}), t.state.register({
|
|
18235
|
-
id:
|
|
18236
|
-
initial: { hasSelection:
|
|
18232
|
+
id: rb,
|
|
18233
|
+
initial: { hasSelection: ub(r) }
|
|
18237
18234
|
});
|
|
18238
|
-
let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(
|
|
18239
|
-
t.state.update(
|
|
18235
|
+
let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(rb)?.hasSelection === !0, s = (e) => {
|
|
18236
|
+
t.state.update(nb, (t) => ({
|
|
18240
18237
|
...t,
|
|
18241
18238
|
ui: e
|
|
18242
18239
|
}));
|
|
@@ -18250,12 +18247,12 @@ function ub(e = {}) {
|
|
|
18250
18247
|
region: e.region ? { ...e.region } : null
|
|
18251
18248
|
}, r.selectGestureActive() ? c?.abandonNoteComposer() : n && c?.closeNoteComposer();
|
|
18252
18249
|
let i = e.elements.length > 0 || e.region !== null;
|
|
18253
|
-
i !== (t.state.get(
|
|
18250
|
+
i !== (t.state.get(rb)?.hasSelection ?? !1) && t.state.update(rb, () => ({ hasSelection: i }));
|
|
18254
18251
|
});
|
|
18255
18252
|
t.command.register("context.copy", () => i.copyContext()), t.command.register("context.copy-selection", () => i.copyContext({ scope: "selection" }));
|
|
18256
18253
|
let g = () => {
|
|
18257
18254
|
let e = u?.element;
|
|
18258
|
-
e && (n.rendererRoot?.hasAttribute(
|
|
18255
|
+
e && (n.rendererRoot?.hasAttribute(ib) ? e.setAttribute(ib, "true") : e.removeAttribute(ib));
|
|
18259
18256
|
}, _ = () => {
|
|
18260
18257
|
d?.disconnect(), d = null, c = null, l?.(), l = null, u?.dispose(), u = null;
|
|
18261
18258
|
}, v = () => {
|
|
@@ -18264,7 +18261,7 @@ function ub(e = {}) {
|
|
|
18264
18261
|
let e = new n.ownerWindow.MutationObserver(g);
|
|
18265
18262
|
d = e, e.observe(n.rendererRoot, {
|
|
18266
18263
|
attributes: !0,
|
|
18267
|
-
attributeFilter: [
|
|
18264
|
+
attributeFilter: [ib]
|
|
18268
18265
|
}), g();
|
|
18269
18266
|
}
|
|
18270
18267
|
let e = {
|
|
@@ -18287,7 +18284,7 @@ function ub(e = {}) {
|
|
|
18287
18284
|
shortcut: "C",
|
|
18288
18285
|
command: "context.copy",
|
|
18289
18286
|
order: 70,
|
|
18290
|
-
icon:
|
|
18287
|
+
icon: ab,
|
|
18291
18288
|
hidden: () => !a()
|
|
18292
18289
|
}), t.tool.register({
|
|
18293
18290
|
id: "context.copy-selection",
|
|
@@ -18295,7 +18292,7 @@ function ub(e = {}) {
|
|
|
18295
18292
|
shortcut: "Shift+C",
|
|
18296
18293
|
command: "context.copy-selection",
|
|
18297
18294
|
order: 71,
|
|
18298
|
-
icon:
|
|
18295
|
+
icon: ob,
|
|
18299
18296
|
hidden: () => !a(),
|
|
18300
18297
|
disabled: () => !o()
|
|
18301
18298
|
}), t.tool.register({
|
|
@@ -18304,7 +18301,7 @@ function ub(e = {}) {
|
|
|
18304
18301
|
shortcut: "N",
|
|
18305
18302
|
command: "context.add-note",
|
|
18306
18303
|
order: 72,
|
|
18307
|
-
icon:
|
|
18304
|
+
icon: sb,
|
|
18308
18305
|
hidden: () => !a(),
|
|
18309
18306
|
disabled: () => !o()
|
|
18310
18307
|
}), t.settings.register({
|
|
@@ -18327,7 +18324,7 @@ function ub(e = {}) {
|
|
|
18327
18324
|
}
|
|
18328
18325
|
//#endregion
|
|
18329
18326
|
//#region src/host-layer.ts
|
|
18330
|
-
var
|
|
18327
|
+
var fb = {
|
|
18331
18328
|
display: "block",
|
|
18332
18329
|
position: "fixed",
|
|
18333
18330
|
inset: "0",
|
|
@@ -18369,48 +18366,48 @@ var db = {
|
|
|
18369
18366
|
"letter-spacing": "normal",
|
|
18370
18367
|
direction: "ltr"
|
|
18371
18368
|
};
|
|
18372
|
-
function fb(e) {
|
|
18373
|
-
for (let [t, n] of Object.entries(db)) e.style.setProperty(t, n, "important");
|
|
18374
|
-
}
|
|
18375
18369
|
function pb(e) {
|
|
18370
|
+
for (let [t, n] of Object.entries(fb)) e.style.setProperty(t, n, "important");
|
|
18371
|
+
}
|
|
18372
|
+
function mb(e) {
|
|
18376
18373
|
return "popover" in e && "showPopover" in e && typeof e.showPopover == "function" && "hidePopover" in e && typeof e.hidePopover == "function";
|
|
18377
18374
|
}
|
|
18378
|
-
var
|
|
18379
|
-
function
|
|
18380
|
-
if (!
|
|
18375
|
+
var hb = (e) => "newState" in e, gb = (e) => e.localName === "dialog";
|
|
18376
|
+
function _b(e) {
|
|
18377
|
+
if (!gb(e) || !e.open) return !1;
|
|
18381
18378
|
try {
|
|
18382
18379
|
return e.matches(":modal");
|
|
18383
18380
|
} catch {
|
|
18384
18381
|
return !1;
|
|
18385
18382
|
}
|
|
18386
18383
|
}
|
|
18387
|
-
function
|
|
18388
|
-
|
|
18384
|
+
function vb(e, t, n = !0) {
|
|
18385
|
+
pb(e);
|
|
18389
18386
|
let r = e.ownerDocument, i = r.defaultView ?? window, a = t, o = !1, s = "fixed", c = !1, l = 0, u = [];
|
|
18390
|
-
if (n &&
|
|
18387
|
+
if (n && mb(e) && (e.popover = "manual"), t.append(e), n && mb(e)) try {
|
|
18391
18388
|
e.showPopover(), c = e.matches(":popover-open"), c && (s = "top-layer");
|
|
18392
18389
|
} catch {
|
|
18393
18390
|
e.removeAttribute("popover");
|
|
18394
18391
|
}
|
|
18395
18392
|
let d = () => {
|
|
18396
|
-
if (!(!c || !
|
|
18393
|
+
if (!(!c || !mb(e))) try {
|
|
18397
18394
|
e.matches(":popover-open") || e.showPopover();
|
|
18398
18395
|
} catch {}
|
|
18399
18396
|
}, f = (t) => {
|
|
18400
18397
|
if (e.parentNode === t) return;
|
|
18401
|
-
let n = c &&
|
|
18402
|
-
if (n &&
|
|
18398
|
+
let n = c && mb(e) && e.matches(":popover-open");
|
|
18399
|
+
if (n && mb(e)) try {
|
|
18403
18400
|
e.hidePopover();
|
|
18404
18401
|
} catch {}
|
|
18405
|
-
t.append(e),
|
|
18402
|
+
t.append(e), pb(e), n && d();
|
|
18406
18403
|
}, p = () => {
|
|
18407
|
-
u = u.filter((e) => e.isConnected &&
|
|
18404
|
+
u = u.filter((e) => e.isConnected && _b(e)), f(u.at(-1) ?? a);
|
|
18408
18405
|
}, m = (e) => {
|
|
18409
18406
|
u = u.filter((t) => t !== e), u.push(e), p();
|
|
18410
18407
|
}, h = (e) => {
|
|
18411
18408
|
u = u.filter((t) => t !== e), p();
|
|
18412
18409
|
}, g = () => {
|
|
18413
|
-
if (!(o || !c || !
|
|
18410
|
+
if (!(o || !c || !mb(e))) try {
|
|
18414
18411
|
e.matches(":popover-open") && e.hidePopover(), e.showPopover();
|
|
18415
18412
|
} catch {}
|
|
18416
18413
|
}, _ = () => {
|
|
@@ -18419,27 +18416,27 @@ function _b(e, t, n = !0) {
|
|
|
18419
18416
|
}));
|
|
18420
18417
|
}, v = (t) => {
|
|
18421
18418
|
if (!c || t.target === e) return;
|
|
18422
|
-
let n =
|
|
18419
|
+
let n = hb(t) ? t.newState : void 0, r = t.target;
|
|
18423
18420
|
if (r instanceof i.Element) {
|
|
18424
|
-
if (
|
|
18425
|
-
n === "open" &&
|
|
18421
|
+
if (gb(r)) {
|
|
18422
|
+
n === "open" && _b(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
|
|
18426
18423
|
return;
|
|
18427
18424
|
}
|
|
18428
18425
|
n === "open" && r.hasAttribute("popover") && _();
|
|
18429
18426
|
}
|
|
18430
18427
|
}, y = (e) => {
|
|
18431
18428
|
let t = e.target;
|
|
18432
|
-
t instanceof i.Element &&
|
|
18429
|
+
t instanceof i.Element && gb(t) && h(t);
|
|
18433
18430
|
}, b = () => {
|
|
18434
18431
|
r.fullscreenElement && _();
|
|
18435
18432
|
}, x = (e) => {
|
|
18436
|
-
|
|
18437
|
-
for (let t of e.querySelectorAll("dialog"))
|
|
18433
|
+
_b(e) && m(e);
|
|
18434
|
+
for (let t of e.querySelectorAll("dialog")) _b(t) && m(t);
|
|
18438
18435
|
}, S = new i.MutationObserver((e) => {
|
|
18439
18436
|
if (c) for (let t of e) {
|
|
18440
18437
|
if (t.type === "attributes") {
|
|
18441
18438
|
let e = t.target;
|
|
18442
|
-
e instanceof i.Element &&
|
|
18439
|
+
e instanceof i.Element && gb(e) && (_b(e) ? m(e) : h(e));
|
|
18443
18440
|
}
|
|
18444
18441
|
for (let e of t.addedNodes) e instanceof i.Element && x(e);
|
|
18445
18442
|
u.some((e) => !e.isConnected) && p();
|
|
@@ -18455,7 +18452,7 @@ function _b(e, t, n = !0) {
|
|
|
18455
18452
|
bringToFront: g,
|
|
18456
18453
|
dispose() {
|
|
18457
18454
|
if (!o) {
|
|
18458
|
-
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 &&
|
|
18455
|
+
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 && mb(e) && e.matches(":popover-open")) try {
|
|
18459
18456
|
e.hidePopover();
|
|
18460
18457
|
} catch {}
|
|
18461
18458
|
u = [];
|
|
@@ -18465,28 +18462,28 @@ function _b(e, t, n = !0) {
|
|
|
18465
18462
|
}
|
|
18466
18463
|
//#endregion
|
|
18467
18464
|
//#region src/codex-plugin.ts
|
|
18468
|
-
var
|
|
18465
|
+
var yb = "mesurer.codex", bb = "codex:v1", xb = "http://127.0.0.1:47365", Sb = 2e3, Cb = 750, wb = 1800, Tb = 2e3, Eb = 12e4, Db = 10, Ob = 5, kb = [
|
|
18469
18466
|
"Implement the current human feedback from Mesurer in this project.",
|
|
18470
18467
|
"Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
|
|
18471
18468
|
"and verify the affected UI in the live page with Mesurer before claiming completion."
|
|
18472
|
-
].join(" "),
|
|
18469
|
+
].join(" "), Ab = {
|
|
18473
18470
|
viewBox: "0 0 256 256",
|
|
18474
18471
|
paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
|
|
18475
|
-
},
|
|
18472
|
+
}, jb = {
|
|
18476
18473
|
viewBox: "0 0 256 256",
|
|
18477
18474
|
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"]
|
|
18478
|
-
},
|
|
18475
|
+
}, Mb = {
|
|
18479
18476
|
viewBox: "0 0 256 256",
|
|
18480
18477
|
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"]
|
|
18481
|
-
},
|
|
18478
|
+
}, Nb = (e) => {
|
|
18482
18479
|
try {
|
|
18483
18480
|
let t = globalThis.location;
|
|
18484
18481
|
return t?.origin ? `mesurer-codex-ui:v1:${e}:${t.origin}${t.pathname}` : null;
|
|
18485
18482
|
} catch {
|
|
18486
18483
|
return null;
|
|
18487
18484
|
}
|
|
18488
|
-
},
|
|
18489
|
-
let t =
|
|
18485
|
+
}, Pb = (e) => {
|
|
18486
|
+
let t = Nb(e);
|
|
18490
18487
|
if (!t) return null;
|
|
18491
18488
|
try {
|
|
18492
18489
|
let e = globalThis.sessionStorage?.getItem(t);
|
|
@@ -18511,18 +18508,18 @@ var vb = "mesurer.codex", yb = "codex:v1", bb = "http://127.0.0.1:47365", xb = 2
|
|
|
18511
18508
|
} catch {
|
|
18512
18509
|
return null;
|
|
18513
18510
|
}
|
|
18514
|
-
},
|
|
18515
|
-
let n =
|
|
18511
|
+
}, Fb = (e, t) => {
|
|
18512
|
+
let n = Nb(e);
|
|
18516
18513
|
if (n) try {
|
|
18517
18514
|
globalThis.sessionStorage?.setItem(n, JSON.stringify(t));
|
|
18518
18515
|
} catch {}
|
|
18519
|
-
},
|
|
18516
|
+
}, Ib = (e, t) => {
|
|
18520
18517
|
let n = e.endsWith("/") ? e : `${e}/`;
|
|
18521
18518
|
return new URL(t, n).toString();
|
|
18522
|
-
},
|
|
18519
|
+
}, Lb = async (e, t, n) => {
|
|
18523
18520
|
let r = new AbortController(), i = setTimeout(() => r.abort(), 15e3);
|
|
18524
18521
|
try {
|
|
18525
|
-
let i = await fetch(
|
|
18522
|
+
let i = await fetch(Ib(e, t), {
|
|
18526
18523
|
...n,
|
|
18527
18524
|
signal: r.signal
|
|
18528
18525
|
}), a = await i.text(), o = {};
|
|
@@ -18538,10 +18535,10 @@ var vb = "mesurer.codex", yb = "codex:v1", bb = "http://127.0.0.1:47365", xb = 2
|
|
|
18538
18535
|
} finally {
|
|
18539
18536
|
clearTimeout(i);
|
|
18540
18537
|
}
|
|
18541
|
-
},
|
|
18538
|
+
}, Rb = (e) => ({
|
|
18542
18539
|
thread: e.thread?.trim() || null,
|
|
18543
18540
|
threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
|
|
18544
|
-
}),
|
|
18541
|
+
}), zb = (e) => {
|
|
18545
18542
|
let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
|
|
18546
18543
|
if (!t || !n || !r) throw Error("Mesurer Codex bridge returned an invalid delivery state.");
|
|
18547
18544
|
let i = {
|
|
@@ -18553,7 +18550,7 @@ var vb = "mesurer.codex", yb = "codex:v1", bb = "http://127.0.0.1:47365", xb = 2
|
|
|
18553
18550
|
updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
|
|
18554
18551
|
};
|
|
18555
18552
|
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;
|
|
18556
|
-
},
|
|
18553
|
+
}, Bb = (e) => ({
|
|
18557
18554
|
thread: e.thread?.trim() || null,
|
|
18558
18555
|
threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
|
|
18559
18556
|
let t = e.id?.trim() ?? "";
|
|
@@ -18565,7 +18562,7 @@ var vb = "mesurer.codex", yb = "codex:v1", bb = "http://127.0.0.1:47365", xb = 2
|
|
|
18565
18562
|
}] : [];
|
|
18566
18563
|
}) : [],
|
|
18567
18564
|
hasMore: e.hasMore === !0
|
|
18568
|
-
}),
|
|
18565
|
+
}), Vb = async (e, t, n) => {
|
|
18569
18566
|
let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = a ? a.flatMap((e) => {
|
|
18570
18567
|
let t = i.find((t) => t.id === e);
|
|
18571
18568
|
return t ? [t] : [];
|
|
@@ -18588,18 +18585,18 @@ var vb = "mesurer.codex", yb = "codex:v1", bb = "http://127.0.0.1:47365", xb = 2
|
|
|
18588
18585
|
])
|
|
18589
18586
|
].join("\n").trimEnd()
|
|
18590
18587
|
};
|
|
18591
|
-
},
|
|
18592
|
-
function
|
|
18593
|
-
let t = e.endpoint ??
|
|
18588
|
+
}, Hb = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, Ub = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, Wb = (e, t) => e instanceof Error && e.message === `Mesurer Codex bridge is unavailable at ${t}. Start the local bridge before queueing feedback.`;
|
|
18589
|
+
function Gb(e = {}) {
|
|
18590
|
+
let t = e.endpoint ?? xb, n = e.instruction?.trim() || kb, r = e.ui ?? !0, i = e.clearCompletedAnnotations ?? !0;
|
|
18594
18591
|
return {
|
|
18595
|
-
id:
|
|
18592
|
+
id: yb,
|
|
18596
18593
|
version: Ey,
|
|
18597
|
-
requires: [
|
|
18598
|
-
provides: [
|
|
18594
|
+
requires: [tb],
|
|
18595
|
+
provides: [bb],
|
|
18599
18596
|
setup(e) {
|
|
18600
|
-
let a = e.service.get(
|
|
18597
|
+
let a = e.service.get(tb);
|
|
18601
18598
|
if (!a) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
|
|
18602
|
-
let o = r ?
|
|
18599
|
+
let o = r ? Pb(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 = Ob, _, v = "", y = null, b = o?.delivery ? {
|
|
18603
18600
|
id: o.delivery.id,
|
|
18604
18601
|
thread: o.delivery.thread,
|
|
18605
18602
|
status: o.delivery.status,
|
|
@@ -18607,22 +18604,22 @@ function Wb(e = {}) {
|
|
|
18607
18604
|
queuedSubmissionId: o.delivery.queuedSubmissionId ?? null,
|
|
18608
18605
|
dispatch: o.delivery.dispatch ?? null,
|
|
18609
18606
|
dispatchError: o.delivery.dispatchError ?? null
|
|
18610
|
-
} : null, x = 0, S = 0, C = null, w = !1, T = async () =>
|
|
18607
|
+
} : null, x = 0, S = 0, C = null, w = !1, T = async () => Rb(await Lb(t, "health")), E = async (e) => zb(await Lb(t, `deliveries/${encodeURIComponent(e)}`)), D = async (e) => {
|
|
18611
18608
|
if (!e.id || !e.thread) throw Error("Cannot restore a Codex delivery without its id and thread.");
|
|
18612
18609
|
let n = {
|
|
18613
18610
|
deliveryId: e.id,
|
|
18614
18611
|
thread: e.thread
|
|
18615
18612
|
};
|
|
18616
|
-
return e.queuedSubmissionId && (n.queuedSubmissionId = e.queuedSubmissionId),
|
|
18613
|
+
return e.queuedSubmissionId && (n.queuedSubmissionId = e.queuedSubmissionId), zb(await Lb(t, "deliveries/restore", {
|
|
18617
18614
|
method: "POST",
|
|
18618
18615
|
headers: { "Content-Type": "application/json" },
|
|
18619
18616
|
body: JSON.stringify(n)
|
|
18620
18617
|
}));
|
|
18621
18618
|
}, O = async (e = {}) => {
|
|
18622
18619
|
let n = new URLSearchParams();
|
|
18623
|
-
n.set("limit", String(e.limit ??
|
|
18620
|
+
n.set("limit", String(e.limit ?? Db));
|
|
18624
18621
|
let r = e.thread?.trim();
|
|
18625
|
-
return r && n.set("thread", r),
|
|
18622
|
+
return r && n.set("thread", r), Bb(await Lb(t, `threads?${n.toString()}`));
|
|
18626
18623
|
}, k = () => u ?? l ?? (d ? null : f), A = () => {
|
|
18627
18624
|
if (!r) return;
|
|
18628
18625
|
let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "interrupted") ? {
|
|
@@ -18634,7 +18631,7 @@ function Wb(e = {}) {
|
|
|
18634
18631
|
dispatch: b.dispatch,
|
|
18635
18632
|
dispatchError: b.dispatchError
|
|
18636
18633
|
} : null;
|
|
18637
|
-
|
|
18634
|
+
Fb(t, {
|
|
18638
18635
|
version: 1,
|
|
18639
18636
|
originThread: l,
|
|
18640
18637
|
selectedThread: u,
|
|
@@ -18652,12 +18649,12 @@ function Wb(e = {}) {
|
|
|
18652
18649
|
"queueing",
|
|
18653
18650
|
"queued",
|
|
18654
18651
|
"working"
|
|
18655
|
-
].includes(b.status) ?
|
|
18652
|
+
].includes(b.status) ? jb : b.status === "completed" ? Mb : Ab : Ab, L = () => {
|
|
18656
18653
|
let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
|
|
18657
18654
|
t.has(n.id) || (t.add(n.id), e.push(n));
|
|
18658
18655
|
}, r = (e) => ({
|
|
18659
18656
|
id: e,
|
|
18660
|
-
title: `Codex ${
|
|
18657
|
+
title: `Codex ${Hb(e)}`,
|
|
18661
18658
|
updatedAt: null,
|
|
18662
18659
|
connected: !0
|
|
18663
18660
|
});
|
|
@@ -18677,7 +18674,7 @@ function Wb(e = {}) {
|
|
|
18677
18674
|
let t = e.id === l ? "Current · " : e.connected ? "Connected · " : "", r = b?.thread === e.id ? ` · ${N() ? "Blocked" : P(b.status)}` : "";
|
|
18678
18675
|
return {
|
|
18679
18676
|
id: `codex.thread.${e.id}`,
|
|
18680
|
-
label: `${t}${
|
|
18677
|
+
label: `${t}${Ub(e.title)}${r}`,
|
|
18681
18678
|
checked: () => n === e.id,
|
|
18682
18679
|
disabled: () => M(),
|
|
18683
18680
|
run() {
|
|
@@ -18685,11 +18682,11 @@ function Wb(e = {}) {
|
|
|
18685
18682
|
}
|
|
18686
18683
|
};
|
|
18687
18684
|
});
|
|
18688
|
-
return g <
|
|
18685
|
+
return g < Db && (e.length > g || h) && r.push({
|
|
18689
18686
|
id: "codex.thread.show-more",
|
|
18690
18687
|
label: "Show 5 more…",
|
|
18691
18688
|
run() {
|
|
18692
|
-
g =
|
|
18689
|
+
g = Db, B();
|
|
18693
18690
|
}
|
|
18694
18691
|
}), r;
|
|
18695
18692
|
}, B = () => {
|
|
@@ -18725,14 +18722,14 @@ function Wb(e = {}) {
|
|
|
18725
18722
|
let e = l && p.includes(l) ? l : f;
|
|
18726
18723
|
try {
|
|
18727
18724
|
let t = await O({
|
|
18728
|
-
limit:
|
|
18725
|
+
limit: Db,
|
|
18729
18726
|
thread: e ?? void 0
|
|
18730
18727
|
});
|
|
18731
18728
|
m = t.threads, h = t.hasMore;
|
|
18732
18729
|
} catch {
|
|
18733
18730
|
m = p.map((e) => ({
|
|
18734
18731
|
id: e,
|
|
18735
|
-
title: `Codex ${
|
|
18732
|
+
title: `Codex ${Hb(e)}`,
|
|
18736
18733
|
updatedAt: null,
|
|
18737
18734
|
connected: !0
|
|
18738
18735
|
})), h = !1;
|
|
@@ -18755,7 +18752,7 @@ function Wb(e = {}) {
|
|
|
18755
18752
|
}, te = () => {
|
|
18756
18753
|
S && globalThis.clearTimeout(S), S = globalThis.setTimeout(() => {
|
|
18757
18754
|
S = 0, b?.status === "completed" && (b = null, A(), B());
|
|
18758
|
-
},
|
|
18755
|
+
}, wb);
|
|
18759
18756
|
}, H = async (e) => {
|
|
18760
18757
|
if (!(!b || b.id !== e.id)) {
|
|
18761
18758
|
if (b = {
|
|
@@ -18773,14 +18770,14 @@ function Wb(e = {}) {
|
|
|
18773
18770
|
if (e.status === "interrupted") {
|
|
18774
18771
|
A(), B();
|
|
18775
18772
|
let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
|
|
18776
|
-
Date.now() - t <
|
|
18773
|
+
Date.now() - t < Eb && (x = globalThis.setTimeout(() => {
|
|
18777
18774
|
x = 0, ne(e.id);
|
|
18778
|
-
},
|
|
18775
|
+
}, Tb));
|
|
18779
18776
|
return;
|
|
18780
18777
|
}
|
|
18781
18778
|
B(), x = globalThis.setTimeout(() => {
|
|
18782
18779
|
x = 0, ne(e.id);
|
|
18783
|
-
},
|
|
18780
|
+
}, Cb);
|
|
18784
18781
|
}
|
|
18785
18782
|
}, ne = async (e) => {
|
|
18786
18783
|
if (!(w || b?.id !== e)) try {
|
|
@@ -18804,7 +18801,7 @@ function Wb(e = {}) {
|
|
|
18804
18801
|
b = {
|
|
18805
18802
|
...b,
|
|
18806
18803
|
status: "failed"
|
|
18807
|
-
}, A(),
|
|
18804
|
+
}, A(), Wb(r, t) && (s = "unavailable"), B();
|
|
18808
18805
|
}
|
|
18809
18806
|
}, U = {
|
|
18810
18807
|
health: T,
|
|
@@ -18813,7 +18810,7 @@ function Wb(e = {}) {
|
|
|
18813
18810
|
async useThread(e) {
|
|
18814
18811
|
let n = e.trim();
|
|
18815
18812
|
if (!n) throw Error("Codex thread must be a non-empty string.");
|
|
18816
|
-
let r =
|
|
18813
|
+
let r = Rb(await Lb(t, "target", {
|
|
18817
18814
|
method: "POST",
|
|
18818
18815
|
headers: { "Content-Type": "application/json" },
|
|
18819
18816
|
body: JSON.stringify({ thread: n })
|
|
@@ -18821,12 +18818,12 @@ function Wb(e = {}) {
|
|
|
18821
18818
|
return j(n, !l), f = r.thread, p = r.threads, s = "available", c = !0, B(), r;
|
|
18822
18819
|
},
|
|
18823
18820
|
async queue(e) {
|
|
18824
|
-
let i = await
|
|
18821
|
+
let i = await Vb(a, e, n), o = e?.thread?.trim(), c = o || (r ? k() : null);
|
|
18825
18822
|
if (r && !o && (d || !c)) throw Error("Choose a Codex thread before queueing feedback.");
|
|
18826
18823
|
let l = { message: i.message };
|
|
18827
18824
|
c && (l.thread = c);
|
|
18828
18825
|
try {
|
|
18829
|
-
let e = await
|
|
18826
|
+
let e = await Lb(t, "send", {
|
|
18830
18827
|
method: "POST",
|
|
18831
18828
|
headers: { "Content-Type": "application/json" },
|
|
18832
18829
|
body: JSON.stringify(l)
|
|
@@ -18842,14 +18839,14 @@ function Wb(e = {}) {
|
|
|
18842
18839
|
};
|
|
18843
18840
|
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;
|
|
18844
18841
|
} catch (e) {
|
|
18845
|
-
throw r &&
|
|
18842
|
+
throw r && Wb(e, t) && (s = "unavailable", B()), e;
|
|
18846
18843
|
}
|
|
18847
18844
|
},
|
|
18848
18845
|
send(e) {
|
|
18849
18846
|
return U.queue(e);
|
|
18850
18847
|
}
|
|
18851
18848
|
};
|
|
18852
|
-
e.service.provide(
|
|
18849
|
+
e.service.provide(bb, U);
|
|
18853
18850
|
let re = async () => {
|
|
18854
18851
|
if (!(C || M())) return V(), b = {
|
|
18855
18852
|
id: null,
|
|
@@ -18880,9 +18877,9 @@ function Wb(e = {}) {
|
|
|
18880
18877
|
updatedAt: 0
|
|
18881
18878
|
}) : x = globalThis.setTimeout(() => {
|
|
18882
18879
|
x = 0, ne(e.deliveryId);
|
|
18883
|
-
},
|
|
18880
|
+
}, Cb) : S = globalThis.setTimeout(() => {
|
|
18884
18881
|
S = 0, b?.id === null && b?.status === "queued" && (b = null, A(), B());
|
|
18885
|
-
},
|
|
18882
|
+
}, wb);
|
|
18886
18883
|
} catch (e) {
|
|
18887
18884
|
b = null, A(), B();
|
|
18888
18885
|
let t = e instanceof Error ? e.message : String(e);
|
|
@@ -18898,7 +18895,7 @@ function Wb(e = {}) {
|
|
|
18898
18895
|
}, 0));
|
|
18899
18896
|
let t = globalThis.setInterval(() => {
|
|
18900
18897
|
c && R().catch(() => void 0);
|
|
18901
|
-
},
|
|
18898
|
+
}, Sb);
|
|
18902
18899
|
e.lifecycle.onDispose(() => {
|
|
18903
18900
|
w = !0, V(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
|
|
18904
18901
|
});
|
|
@@ -18908,12 +18905,12 @@ function Wb(e = {}) {
|
|
|
18908
18905
|
}
|
|
18909
18906
|
//#endregion
|
|
18910
18907
|
//#region src/plugin-catalog.ts
|
|
18911
|
-
var
|
|
18908
|
+
var Kb = [
|
|
18912
18909
|
{
|
|
18913
|
-
id:
|
|
18910
|
+
id: eb,
|
|
18914
18911
|
label: "Context",
|
|
18915
18912
|
order: 30,
|
|
18916
|
-
create:
|
|
18913
|
+
create: db,
|
|
18917
18914
|
settingsIds: ["context"],
|
|
18918
18915
|
hiddenSettingsControlIds: ["ui"]
|
|
18919
18916
|
},
|
|
@@ -18925,10 +18922,10 @@ var Gb = [
|
|
|
18925
18922
|
settingsIds: ["arrange"]
|
|
18926
18923
|
},
|
|
18927
18924
|
{
|
|
18928
|
-
id:
|
|
18925
|
+
id: Zy,
|
|
18929
18926
|
label: "Layout Guides",
|
|
18930
18927
|
order: 38,
|
|
18931
|
-
create:
|
|
18928
|
+
create: $y
|
|
18932
18929
|
},
|
|
18933
18930
|
{
|
|
18934
18931
|
id: Rv,
|
|
@@ -18942,13 +18939,13 @@ var Gb = [
|
|
|
18942
18939
|
hiddenSettingsControlIds: ["tool"]
|
|
18943
18940
|
},
|
|
18944
18941
|
{
|
|
18945
|
-
id:
|
|
18942
|
+
id: yb,
|
|
18946
18943
|
label: "Codex",
|
|
18947
18944
|
order: 45,
|
|
18948
|
-
create:
|
|
18945
|
+
create: Gb
|
|
18949
18946
|
}
|
|
18950
|
-
],
|
|
18951
|
-
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(
|
|
18947
|
+
], qb = (e) => {
|
|
18948
|
+
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(Kb.map((e) => e.id)), i = Kb.map((e) => {
|
|
18952
18949
|
let r = n.get(e.id);
|
|
18953
18950
|
return {
|
|
18954
18951
|
...e,
|
|
@@ -18965,7 +18962,7 @@ var Gb = [
|
|
|
18965
18962
|
create: () => n
|
|
18966
18963
|
});
|
|
18967
18964
|
return i;
|
|
18968
|
-
},
|
|
18965
|
+
}, Jb = {
|
|
18969
18966
|
select: "select",
|
|
18970
18967
|
xray: "xray",
|
|
18971
18968
|
colorPicker: "color-picker",
|
|
@@ -18975,14 +18972,14 @@ var Gb = [
|
|
|
18975
18972
|
distance: "distance",
|
|
18976
18973
|
settings: "settings"
|
|
18977
18974
|
};
|
|
18978
|
-
function
|
|
18975
|
+
function Yb(e = {}) {
|
|
18979
18976
|
if (!("document" in globalThis)) throw Error("mountMesurer() requires a browser or Electron renderer document.");
|
|
18980
18977
|
let { target: t = document.body, isolate: n = !0, shadowMode: r = "open", topLayer: i = !0, agent: a = !1, signal: o, onPluginHost: s, onPluginsReady: c, plugins: l, excludeBuiltins: u, excludePlugins: d, ...f } = e;
|
|
18981
18978
|
if (o?.aborted) throw o.reason ?? new DOMException("Mesurer mount aborted.", "AbortError");
|
|
18982
18979
|
if (!t) throw Error("mountMesurer() requires document.body to exist or an explicit target.");
|
|
18983
18980
|
let p = t.ownerDocument ?? document, m = p.defaultView ?? window, h = p.createElement("div");
|
|
18984
18981
|
h.dataset.mesurerIsland = "true";
|
|
18985
|
-
let g =
|
|
18982
|
+
let g = vb(h, t, i), _ = h, v = h, y = h;
|
|
18986
18983
|
if (n) {
|
|
18987
18984
|
let e = h.attachShadow({ mode: r });
|
|
18988
18985
|
v = p.createElement("div"), v.dataset.mesurerIslandMount = "true", e.append(v), _ = e, y = e;
|
|
@@ -19005,7 +19002,7 @@ function Jb(e = {}) {
|
|
|
19005
19002
|
return t;
|
|
19006
19003
|
}, N = async () => {
|
|
19007
19004
|
await j.ready();
|
|
19008
|
-
let e = b?.service.get(
|
|
19005
|
+
let e = b?.service.get(tb);
|
|
19009
19006
|
if (!e) throw Error("Mesurer Context is disabled. Enable it in Settings or include context() in plugins.");
|
|
19010
19007
|
return e;
|
|
19011
19008
|
}, P = async () => {
|
|
@@ -19021,7 +19018,7 @@ function Jb(e = {}) {
|
|
|
19021
19018
|
(await P()).show(e, t);
|
|
19022
19019
|
}, re = async (e, t) => (await P()).capturePlan(e, t), ie = async (e, t) => (await P()).review(e, t), ae = () => j.textEdits(), oe = (e) => j.textEdit(e), se = Object.assign(j, {
|
|
19023
19020
|
capabilities: () => {
|
|
19024
|
-
let e = !!b?.service.get(
|
|
19021
|
+
let e = !!b?.service.get(tb);
|
|
19025
19022
|
return {
|
|
19026
19023
|
protocol: "mesurer.agent/v1",
|
|
19027
19024
|
contextSchema: "mesurer.context/v1",
|
|
@@ -19052,8 +19049,8 @@ function Jb(e = {}) {
|
|
|
19052
19049
|
}), ce = {
|
|
19053
19050
|
...f,
|
|
19054
19051
|
version: Ey,
|
|
19055
|
-
plugins:
|
|
19056
|
-
excludePlugins: u ? u.map((e) =>
|
|
19052
|
+
plugins: qb(l),
|
|
19053
|
+
excludePlugins: u ? u.map((e) => Jb[e]) : [...d ?? []]
|
|
19057
19054
|
}, le = _i(() => Rr(u_, gi(ce, {
|
|
19058
19055
|
portalTarget: y,
|
|
19059
19056
|
pageTarget: t,
|
|
@@ -19124,20 +19121,20 @@ function Jb(e = {}) {
|
|
|
19124
19121
|
}
|
|
19125
19122
|
//#endregion
|
|
19126
19123
|
//#region src/inject.ts
|
|
19127
|
-
var { target:
|
|
19128
|
-
function
|
|
19129
|
-
let e =
|
|
19130
|
-
if (!e) throw Error(`Mesurer injection target not found: ${
|
|
19131
|
-
return globalThis.__MESURER_INSTANCE__?.dispose(),
|
|
19132
|
-
|
|
19124
|
+
var { target: Xb, globalName: Zb = "__MESURER__", reuseExisting: Qb = !0, recoverDisconnected: $b = !1, ...ex } = globalThis.__MESURER_CONFIG__ ?? {}, tx = globalThis.__MESURER_INSTANCE__, nx = Qb && tx?.element.isConnected ? tx : void 0;
|
|
19125
|
+
function rx() {
|
|
19126
|
+
let e = Xb ? document.querySelector(Xb) : document.body;
|
|
19127
|
+
if (!e) throw Error(`Mesurer injection target not found: ${Xb}`);
|
|
19128
|
+
return globalThis.__MESURER_INSTANCE__?.dispose(), Yb({
|
|
19129
|
+
...ex,
|
|
19133
19130
|
target: e,
|
|
19134
19131
|
agent: {
|
|
19135
|
-
globalName:
|
|
19132
|
+
globalName: Zb,
|
|
19136
19133
|
root: document
|
|
19137
19134
|
}
|
|
19138
19135
|
});
|
|
19139
19136
|
}
|
|
19140
|
-
var
|
|
19137
|
+
var ix = (e) => {
|
|
19141
19138
|
globalThis.__MESURER_INJECT_RECOVERY__?.stop();
|
|
19142
19139
|
let t = !1, n = !1, r = () => {
|
|
19143
19140
|
if (n = !1, t || globalThis.__MESURER_INSTANCE__?.element.isConnected) return;
|
|
@@ -19156,7 +19153,7 @@ var rx = (e) => {
|
|
|
19156
19153
|
}), globalThis.__MESURER_INJECT_RECOVERY__ = { stop() {
|
|
19157
19154
|
t = !0, i.disconnect();
|
|
19158
19155
|
} };
|
|
19159
|
-
},
|
|
19160
|
-
globalThis.__MESURER_INSTANCE__ =
|
|
19156
|
+
}, ax = nx ?? rx();
|
|
19157
|
+
globalThis.__MESURER_INSTANCE__ = ax, globalThis.__MESURER_INJECT_RECOVERY__?.stop(), globalThis.__MESURER_INJECT_RECOVERY__ = void 0, $b && ix(rx), await ax.ready;
|
|
19161
19158
|
//#endregion
|
|
19162
|
-
export {
|
|
19159
|
+
export { ax as mesurer };
|