@flemo/devtools 0.5.0 → 0.6.0

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/react.mjs ADDED
@@ -0,0 +1,1635 @@
1
+ import { useEffect as e } from "react";
2
+ //#region src/domProtocol.ts
3
+ var t = "data-flemo-screen", n = "data-flemo-status", r = "data-flemo-active", i = "data-flemo-anim-hold", a = "data-flemo-img-hold", o = "data-flemo-held-arrival", s = "data-flemo-part-name", c = "data-flemo-decorator", l = "data-flemo-bar", u = "data-flemo-morph", d = "data-flemo-morph-id", f = "data-flemo-morph-layer", p = "data-flemo-morph-stand-in", m = "data-flemo-morph-ghost", h = "data-flemo-morph-camera", g = ["enter", "exit"], _ = "data-flemo-devtools-panel", v = [
4
+ "PUSHING",
5
+ "POPPING",
6
+ "REPLACING"
7
+ ], y = [
8
+ "true",
9
+ "park",
10
+ "park-under",
11
+ "park-over"
12
+ ], b = (e) => `[${e}]`, x = (e, t) => `[${e}="${t}"]`, ee = 1e4, S = (e) => {
13
+ let t = [], { t0Ms: n, driver: r, frameSamples: i, longTasks: a, holdLongTasks: o, landing: s } = e, c = n + (e.releasedAtMs ?? 0);
14
+ if (i.released.over30Count > 0) {
15
+ let e = r === "compiled" ? " (compiled/compositor flights can still present cleanly through main-thread gaps)" : "";
16
+ t.push(`main-thread rAF gap up to ${i.released.maxGapMs}ms ×${i.released.over30Count} during visible motion${e}`);
17
+ }
18
+ for (let e of a) e.startMs <= c + 120 && e.startMs + e.durationMs >= c - 50 ? t.push(`long task ${Math.round(e.durationMs)}ms overlapped the visible-motion start (opening-swallow risk: the first presented frames of the transition may have been lost)`) : e.durationMs >= 100 && t.push(`long task ${Math.round(e.durationMs)}ms mid-flight`);
19
+ for (let e of o) e.durationMs >= 100 && t.push(`long task ${Math.round(e.durationMs)}ms absorbed by the hold (screen posed, not yet moving — the hold doing its job, not user-visible jank)`);
20
+ let { motion: l, images: u } = e;
21
+ l.holdReassertedAtMs !== null && t.push(`hold re-asserted ${l.holdReassertedAtMs}ms into the flight, after it had already released (an interleaved commit wrote the stale paused hold attribute over a running flight — the flemo 2026-08-18 release-race signature; the motion pauses while every timing metric stays clean)`), l.pausedAfterRelease && t.push("compiled animation reported playState=paused after its release (the flight was posed and then stopped mid-motion, not merely starved of frames)"), l.longestStallMs >= 48 && t.push(`motion stalled ${l.longestStallMs}ms mid-flight (${l.stalledFrames}/${l.sampledFrames} released frames advanced neither the animation clock nor the pose — freeze, or freeze-then-leap if the flight still landed on time)`), l.sampledFrames === 0 && e.releasedAtMs !== null && t.push("no released frames were sampled (the flight ended at or before its own hold release — the visible motion, if any, was never observed)"), u.completedUnheld > 0 && t.push(`${u.completedUnheld} image(s) finished loading mid-flight without a hold (${u.completedDuringFlight} completed, ${u.heldDuringFlight} held; ${u.loadingAtStart} were loading at t0, ${u.addedDuringFlight} arrived mid-flight) — each decode rasters on the moving layer and costs a present; this is the warm-side image-hold regression`), s.orphanedHolds.length > 0 && t.push(`hold markers left on the page at rest: ${s.orphanedHolds.join("; ")} (whatever they hide has no owner left to reveal it — the permanently-blank-avatar class)`), s.residualInlineTransforms.length > 0 && t.push(`residual inline style after COMPLETED: ${s.residualInlineTransforms.join("; ")} (landing cleanup failure — the landed scope belongs to the compiled rest rules)`), s.offViewportAtRest && t.push("screen resting at from-pose while COMPLETED+active (blank-viewport signature — the flemo PR #259 class: a residual pose left the landed screen parked off-viewport)"), s.stuckStatuses.length > 0 && t.push(`transitional status stuck >${ee / 1e3}s: ${s.stuckStatuses.join(", ")} (navigation queue lock or missed animationend — later navigations will be swallowed)`);
22
+ let { morphs: d, tripwires: f } = e;
23
+ for (let e of f) t.push(`tripwire ${e.kind} at +${e.atMs}ms: ${e.detail}`);
24
+ return d.skipped.length > 0 && t.push(`shared element(s) did not fly: ${d.skipped.join(", ")} (${d.pairable.length} pairable key(s), ${d.flew.length} flew) — both ends were registered on two different screens and neither was stamped with a flight role, so the pair was never made`), d.duplicatedKeys.length > 0 && t.push(`pairing key(s) used twice inside one screen: ${d.duplicatedKeys.join(", ")} (two ends under one screen are not a pair, so one of them can never fly — this is in the consuming app)`), d.strandedRoles > 0 && t.push(`${d.strandedRoles} morph element(s) still carry a flight role at rest (the stranded participant class: a role that outlives its flight stays in the layer and poisons the NEXT pairing, which is how one interrupted gesture turned into every later pop losing its camera)`), (d.strandedStandIns > 0 || d.strandedGhosts > 0 || d.layerResidue > 0) && t.push(`morph residue at rest: ${d.strandedStandIns} stand-in(s), ${d.strandedGhosts} ghost(s), ${d.layerResidue} element(s) left in a flight layer (a stand-in is a hole in the layout and a layer element is a corpse the next flight will pair against)`), d.leakedSheetRules > 0 && t.push(`${d.leakedSheetRules} morph keyframe rule(s) were left in the per-flight sheet (a flight that never landed keeps its keyframes; they accumulate for the life of the page)`), r === "unknown" && t.push("driver could not be classified (no running flemo-* CSSAnimation and no player inline-style signature observed — zero-duration flight, or the sampler attached after motion ended)"), t;
25
+ }, C = (e) => {
26
+ let t = [];
27
+ if (e.emulationSuspected) {
28
+ let n = /Win/i.test(e.platform) ? " (Windows touch hardware makes this signal ambiguous — confirm the DevTools device toolbar state)" : "";
29
+ t.push("DevTools device emulation suspected — the page composites to a rescaled surface, so visual reports from this session are untrustworthy; judge motion in a plain window or on a real device" + n);
30
+ }
31
+ return e.stuckFlightOpen && t.push(`a flight is still transitional after ${ee / 1e3}s — the navigation queue is likely locked; subsequent navigations will be ignored`), e.flightAnomalies.some((e) => e.some((e) => e.includes("blank-viewport"))) && t.push("at least one flight landed with the blank-viewport signature (see that flight's anomalies)"), t;
32
+ }, w = [
33
+ "macOS Chrome present-pipeline pacing: on 120Hz ProMotion displays Chrome can present frames unevenly even when rAF cadence and this report read perfectly clean (Chromium issues 40062488 / 345275139; proven with a no-script pure-CSS control page that still juddered). Not diagnosable or fixable from page code.",
34
+ "Display-hardware effects: local dimming, backlight modulation, and panel overdrive alter perceived motion and are invisible to every web API.",
35
+ "Compositor-internal present skips: a frame can be produced on time (clean rAF, clean player gaps) yet dropped or delayed inside the compositor's present queue; only platform tools (about:tracing, Instruments) see that layer.",
36
+ "DevTools device emulation composites the page to a rescaled surface: every in-page instrument reads the pre-scale surface and reports clean while the eye watches the post-scale one, so emulated sessions grow shimmer/flash artifacts that do not exist in a plain window or on a real device."
37
+ ], T = (e) => {
38
+ /* v8 ignore next -- unreachable: a group exists only because a flight was
39
+ put in it, so nothing ever asks for the median of nothing. */
40
+ if (e.length === 0) return 0;
41
+ let t = [...e].sort((e, t) => e - t);
42
+ return Math.round(t[Math.floor(t.length / 2)] * 10) / 10;
43
+ }, te = (e) => {
44
+ let t = e.filter((e) => typeof e.bucket == "string");
45
+ if (t.length === 0) return [];
46
+ let n = /* @__PURE__ */ new Map();
47
+ for (let e of t) {
48
+ let t = e.bucket, r = n.get(t);
49
+ r ? r.push(e) : n.set(t, [e]);
50
+ }
51
+ return [...n.entries()].map(([e, t]) => ({
52
+ bucket: e,
53
+ flights: t.length,
54
+ medianDurationMs: T(t.map((e) => e.durationMs)),
55
+ medianReleasedGapMs: T(t.map((e) => e.frameSamples.released.medianGapMs)),
56
+ worstReleasedGapMs: t.reduce((e, t) => Math.max(e, t.frameSamples.released.maxGapMs), 0),
57
+ longGapCount: t.reduce((e, t) => e + t.frameSamples.released.over30Count, 0),
58
+ anomalyCount: t.reduce((e, t) => e + t.anomalies.length, 0),
59
+ stalledFlights: t.filter((e) => e.motion.stalledFrames > 0).length
60
+ })).sort((e, t) => e.bucket.localeCompare(t.bucket));
61
+ }, E = () => {
62
+ if (typeof navigator > "u") return null;
63
+ let e = navigator.userAgentData;
64
+ return !e || !Array.isArray(e.brands) ? null : e.brands.map((e) => ({
65
+ brand: String(e.brand ?? ""),
66
+ version: String(e.version ?? "")
67
+ }));
68
+ }, D = () => {
69
+ if (typeof navigator > "u") return "unknown";
70
+ let e = E();
71
+ if (e?.some((e) => /Chromium/i.test(e.brand))) return "blink";
72
+ let t = navigator.userAgent ?? "";
73
+ return /Firefox|FxiOS/i.test(t) ? "gecko" : e || /AppleWebKit/i.test(t) && !/Chrome|Chromium|Android/i.test(t) ? "webkit" : /Android/i.test(t) ? "blink" : "unknown";
74
+ }, O = () => {
75
+ if (typeof navigator > "u" || D() !== "blink") return !1;
76
+ let e = navigator.platform ?? "";
77
+ return /Mac|Win|Linux/i.test(e) ? /Android/i.test(navigator.userAgent ?? "") && !/Mac|Win/i.test(e) ? /Linux (x86_64|i686)/i.test(e) : (navigator.maxTouchPoints ?? 0) > 0 : !1;
78
+ }, k = (e = 20) => new Promise((t) => {
79
+ let n = Number.isFinite(e) ? Math.max(1, Math.floor(e)) : 20;
80
+ if (typeof requestAnimationFrame != "function" || typeof performance > "u") {
81
+ t({
82
+ medianGapMs: null,
83
+ sampleCount: 0
84
+ });
85
+ return;
86
+ }
87
+ let r = [], i = null, a = () => {
88
+ let e = performance.now();
89
+ if (i !== null && r.push(e - i), i = e, r.length >= n) {
90
+ let e = [...r].sort((e, t) => e - t), n = e[Math.floor(e.length / 2)];
91
+ t({
92
+ medianGapMs: Math.round(n * 100) / 100,
93
+ sampleCount: r.length
94
+ });
95
+ return;
96
+ }
97
+ requestAnimationFrame(a);
98
+ };
99
+ requestAnimationFrame(a);
100
+ }), A = [
101
+ "__vite_plugin_react_preamble_installed__",
102
+ "__vite__",
103
+ "__NEXT_HMR_CB",
104
+ "__NEXT_HMR_LATENCY_CB",
105
+ "__webpack_hot_middleware_reporter__",
106
+ "webpackHotUpdate",
107
+ "__REACT_REFRESH_RUNTIME__",
108
+ "$RefreshReg$"
109
+ ], j = () => {
110
+ if (typeof window > "u") return [];
111
+ let e = [];
112
+ for (let t of A) try {
113
+ window[t] !== void 0 && e.push(t);
114
+ } catch {}
115
+ return e;
116
+ }, M = () => {
117
+ try {
118
+ return typeof PerformanceObserver < "u" && Array.isArray(PerformanceObserver.supportedEntryTypes) && PerformanceObserver.supportedEntryTypes.includes("longtask");
119
+ } catch {
120
+ return !1;
121
+ }
122
+ }, ne = (e, t = !1) => {
123
+ let n = typeof navigator < "u" ? navigator : null, r = typeof window < "u" ? window : null, i = !1;
124
+ try {
125
+ i = r?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
126
+ } catch {
127
+ i = !1;
128
+ }
129
+ return {
130
+ userAgent: n?.userAgent ?? "",
131
+ uaBrands: E(),
132
+ engine: D(),
133
+ platform: n?.platform ?? "",
134
+ maxTouchPoints: n?.maxTouchPoints ?? 0,
135
+ devicePixelRatio: r?.devicePixelRatio ?? 1,
136
+ hardwareConcurrency: n?.hardwareConcurrency ?? 0,
137
+ screen: {
138
+ width: r?.screen?.width ?? 0,
139
+ height: r?.screen?.height ?? 0
140
+ },
141
+ viewport: {
142
+ width: r?.innerWidth ?? 0,
143
+ height: r?.innerHeight ?? 0
144
+ },
145
+ visualViewportScale: r?.visualViewport?.scale ?? null,
146
+ rafCadence: e,
147
+ reducedMotion: i,
148
+ developmentHints: j(),
149
+ emulationSuspected: O(),
150
+ observation: {
151
+ longTasks: M(),
152
+ elementAnimations: typeof Element < "u" && typeof Element.prototype.getAnimations == "function",
153
+ animationEvents: t
154
+ }
155
+ };
156
+ }, re = 2, N = new Set(y), ie = (e) => Math.round(e * 10) / 10, ae = () => ({
157
+ heldGaps: [],
158
+ releasedGaps: [],
159
+ lastFrameAt: null,
160
+ evidence: {
161
+ compiledAnimation: !1,
162
+ inlineSuppression: !1,
163
+ inlineAdvance: !1
164
+ },
165
+ lastPose: /* @__PURE__ */ new Map(),
166
+ clocks: /* @__PURE__ */ new Map(),
167
+ lastClock: /* @__PURE__ */ new Map(),
168
+ releasedFrames: 0,
169
+ stalledFrames: 0,
170
+ tailFrames: 0,
171
+ stallRunMs: 0,
172
+ longestStallMs: 0,
173
+ pausedAfterRelease: !1,
174
+ holdReassertedAtMs: null
175
+ }), oe = (e) => e.some((e) => {
176
+ let t = e.getAttribute(i);
177
+ return t !== null && N.has(t);
178
+ }), P = (e) => `${e.transform}/${e.opacity}`, se = (e, t, n) => {
179
+ e.releasedFrames += 1;
180
+ let r = !1, i = !1;
181
+ for (let n of t) {
182
+ let t = e.clocks.get(n);
183
+ if (t) {
184
+ t.playState === "paused" && (e.pausedAfterRelease = !0), t.playState !== "finished" && (i = !0);
185
+ let a = typeof t.currentTime == "number" ? t.currentTime : null;
186
+ if (a !== null) {
187
+ let t = e.lastClock.get(n);
188
+ t !== void 0 && a !== t && (r = !0), e.lastClock.set(n, a);
189
+ }
190
+ }
191
+ let a = n.style;
192
+ a && a.animation !== "" && e.lastPose.get(n) !== P(a) && (r = !0);
193
+ }
194
+ if (!(e.releasedFrames < re)) {
195
+ if (r) {
196
+ e.stallRunMs = 0;
197
+ return;
198
+ }
199
+ if (!i && e.clocks.size > 0) {
200
+ e.tailFrames += 1, e.stallRunMs = 0;
201
+ return;
202
+ }
203
+ e.stalledFrames += 1, e.stallRunMs += n, e.stallRunMs > e.longestStallMs && (e.longestStallMs = e.stallRunMs);
204
+ }
205
+ }, F = (e, t) => {
206
+ let n = t.style;
207
+ if (!n || n.animation === "") return;
208
+ e.evidence.inlineSuppression = !0;
209
+ let r = P(n), i = e.lastPose.get(t);
210
+ i !== void 0 && i !== r && (e.evidence.inlineAdvance = !0), e.lastPose.set(t, r);
211
+ }, ce = (e, t) => {
212
+ for (let n of t) {
213
+ let t = n.getAnimations, r = e.clocks.get(n);
214
+ if (r !== void 0 && r.playState !== "finished") {
215
+ r.playState === "running" && (e.evidence.compiledAnimation = !0), F(e, n);
216
+ continue;
217
+ }
218
+ if (typeof t == "function") try {
219
+ for (let r of t.call(n)) {
220
+ let t = r.animationName;
221
+ typeof t == "string" && t.startsWith("flemo-") && (e.clocks.set(n, r), r.playState === "running" && (e.evidence.compiledAnimation = !0));
222
+ }
223
+ } catch {}
224
+ F(e, n);
225
+ }
226
+ }, le = (e) => ({
227
+ sampledFrames: e.releasedFrames,
228
+ stalledFrames: e.stalledFrames,
229
+ longestStallMs: ie(e.longestStallMs),
230
+ pausedAfterRelease: e.pausedAfterRelease,
231
+ holdReassertedAtMs: e.holdReassertedAtMs,
232
+ tailFrames: e.tailFrames
233
+ }), I = 200, ue = (e) => {
234
+ let t = [];
235
+ for (let n of e) for (let e of Array.from(n.querySelectorAll("img"))) t.push(e);
236
+ return t;
237
+ }, de = (e) => {
238
+ let t = new Set(ue(e).filter((e) => !e.complete));
239
+ return {
240
+ tracked: t,
241
+ loadingAtStart: t.size,
242
+ addedDuringFlight: 0,
243
+ held: /* @__PURE__ */ new Set()
244
+ };
245
+ }, L = (e, t, n) => {
246
+ if (!(e.tracked.size >= I)) for (let r of Array.from(n)) {
247
+ if (!(r instanceof Element) || !t.some((e) => e === r || e.contains(r))) continue;
248
+ let n = r instanceof HTMLImageElement ? [r] : Array.from(r.querySelectorAll("img"));
249
+ for (let t of n) if (!(t.complete || e.tracked.has(t))) {
250
+ if (e.tracked.size >= I) return;
251
+ e.tracked.add(t), e.addedDuringFlight += 1;
252
+ }
253
+ }
254
+ }, fe = (e, t) => {
255
+ for (let n of t) for (let t of Array.from(n.querySelectorAll(`img[${a}]`))) e.held.add(t);
256
+ for (let t of e.tracked) t.hasAttribute("data-flemo-img-hold") && e.held.add(t);
257
+ }, pe = (e) => {
258
+ let t = 0, n = 0;
259
+ for (let r of e.tracked) r.complete && (t += 1, e.held.has(r) || (n += 1));
260
+ return {
261
+ loadingAtStart: e.loadingAtStart,
262
+ addedDuringFlight: e.addedDuringFlight,
263
+ completedDuringFlight: t,
264
+ heldDuringFlight: e.held.size,
265
+ completedUnheld: n
266
+ };
267
+ }, me = [
268
+ "DevTools must be CLOSED while judging motion. An open inspector serializes requests and repaints its own panels on the same machine; the 2026-08 campaign's entire residual 'stutter' was this, and it is invisible to every in-page metric.",
269
+ "No screen recording or display capture while judging. A capture client forces WindowServer to composite every vsync, which SUPPRESSES the symptom — a capture that looks smooth proves nothing about the uncaptured session.",
270
+ "Judge with real input (a finger, a mouse). Synthetic dispatch — evaluate().click() and friends — never fires pointerdown, so it bypasses the swipe/gesture machinery that a real navigation goes through.",
271
+ "Establish the viewing configuration before believing any verdict: device emulation off, which physical display, its refresh rate and HiDPI scaling, Low Power Mode. Ask for a photo of the setup if it is not certain."
272
+ ], R = (e) => Math.round(e * 10) / 10, he = (e) => {
273
+ if (e.length === 0) return {
274
+ count: 0,
275
+ medianGapMs: 0,
276
+ maxGapMs: 0,
277
+ over30Count: 0
278
+ };
279
+ let t = [...e].sort((e, t) => e - t);
280
+ return {
281
+ count: e.length,
282
+ medianGapMs: R(t[Math.floor(t.length / 2)]),
283
+ maxGapMs: R(t[t.length - 1]),
284
+ over30Count: e.filter((e) => e >= 30).length
285
+ };
286
+ }, ge = (e, t = []) => {
287
+ let n = [...e, ...t];
288
+ return {
289
+ ...n.length === 0 ? {
290
+ count: 0,
291
+ medianGapMs: 0,
292
+ maxGapMs: 0
293
+ } : (() => {
294
+ let e = [...n].sort((e, t) => e - t);
295
+ return {
296
+ count: n.length,
297
+ medianGapMs: R(e[Math.floor(e.length / 2)]),
298
+ maxGapMs: R(e[e.length - 1])
299
+ };
300
+ })(),
301
+ longGaps: n.filter((e) => e >= 30).map(R),
302
+ held: he(e),
303
+ released: he(t)
304
+ };
305
+ }, _e = (e) => {
306
+ let t = e.inlineSuppression || e.inlineAdvance;
307
+ return t && e.compiledAnimation ? "mixed" : t ? "inline" : e.compiledAnimation ? "compiled" : "unknown";
308
+ }, ve = (e) => e === "PUSHING" ? "PUSH" : e === "POPPING" ? "POP" : e === "REPLACING" ? "REPLACE" : null, ye = (e) => {
309
+ let t = /^matrix3d\(([^)]+)\)$/.exec(e.trim());
310
+ if (t) {
311
+ let e = t[1].split(",").map((e) => Number(e.trim()));
312
+ return e.length === 16 && Number.isFinite(e[12]) ? e[12] : null;
313
+ }
314
+ let n = /^matrix\(([^)]+)\)$/.exec(e.trim());
315
+ if (n) {
316
+ let e = n[1].split(",").map((e) => Number(e.trim()));
317
+ return e.length === 6 && Number.isFinite(e[4]) ? e[4] : null;
318
+ }
319
+ return null;
320
+ }, be = (e) => {
321
+ if (e) return [];
322
+ let t = [];
323
+ for (let [e, n] of [[a, "image reveal hold"], [o, "arrival hold"]]) {
324
+ let r = document.querySelectorAll(`[${e}]`).length;
325
+ r > 0 && t.push(`${r} × ${n} (${e}) still marked at rest`);
326
+ }
327
+ return t;
328
+ }, xe = (e, t) => {
329
+ let n = [], i = !1, a = window.visualViewport?.width ?? window.innerWidth ?? 0;
330
+ return e.forEach((e, t) => {
331
+ if (!(e instanceof HTMLElement) || !e.isConnected) return;
332
+ let o = "", s = "";
333
+ try {
334
+ let t = getComputedStyle(e);
335
+ o = t.transform ?? "", s = t.display ?? "";
336
+ } catch {}
337
+ if (s === "none") return;
338
+ let c = e.getAttribute(r) === "true", l = `screen[${t}]${c ? " (active)" : ""}`;
339
+ if (e.style.transform !== "" && e.style.transform !== "none" && n.push(`${l} transform=${e.style.transform}`), e.style.opacity !== "" && e.style.opacity !== "1" && n.push(`${l} opacity=${e.style.opacity}`), c && e.getAttribute("data-flemo-status") === "COMPLETED" && a > 0) {
340
+ let e = ye(o);
341
+ e !== null && Math.abs(e) >= a * .5 && (i = !0);
342
+ }
343
+ }), {
344
+ residualInlineTransforms: n,
345
+ offViewportAtRest: i,
346
+ orphanedHolds: be(t)
347
+ };
348
+ }, Se = g.map((e) => `[${u}="${e}"]`).join(","), Ce = b(t), we = (e) => Math.round(e * 10) / 10, z = (e) => {
349
+ let t = e.getAttribute(d);
350
+ return t === null || t === "" ? null : t;
351
+ }, Te = (e) => {
352
+ let t = e.getAttribute(u);
353
+ return t !== null && g.includes(t);
354
+ }, Ee = () => {
355
+ try {
356
+ return document.querySelector("style[data-flemo-morph-sheet]")?.sheet?.cssRules.length ?? 0;
357
+ } catch {
358
+ return 0;
359
+ }
360
+ }, De = (e) => {
361
+ let t = {
362
+ registered: 0,
363
+ pairable: /* @__PURE__ */ new Set(),
364
+ duplicated: /* @__PURE__ */ new Set(),
365
+ flew: /* @__PURE__ */ new Set(),
366
+ camera: document.querySelector(b(h)) !== null,
367
+ ghosts: 0,
368
+ ghostBornAt: /* @__PURE__ */ new Map(),
369
+ shortestGhostLifeMs: null,
370
+ sheetRulesAtStart: Ee()
371
+ }, n = new Set(e), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
372
+ for (let e of Array.from(document.querySelectorAll(b(u)))) {
373
+ t.registered += 1;
374
+ let a = z(e);
375
+ if (a === null) continue;
376
+ if (Te(e)) {
377
+ t.flew.add(a);
378
+ continue;
379
+ }
380
+ let o = e.closest(Ce);
381
+ if (o !== null && !n.has(o)) continue;
382
+ let s = o, c = r.get(a);
383
+ c || r.set(a, c = /* @__PURE__ */ new Set()), c.add(s);
384
+ let l = i.get(a);
385
+ l || i.set(a, l = /* @__PURE__ */ new Map()), l.set(s, (l.get(s) ?? 0) + 1);
386
+ }
387
+ for (let [e, n] of r) {
388
+ n.size >= 2 && t.pairable.add(e);
389
+ let r = i.get(e);
390
+ r && [...r.values()].some((e) => e > 1) && t.duplicated.add(e);
391
+ }
392
+ return t;
393
+ }, Oe = (e, t) => {
394
+ if (t.hasAttribute("data-flemo-morph-camera") && (e.camera = !0), !Te(t)) return;
395
+ let n = z(t);
396
+ n !== null && e.flew.add(n);
397
+ }, ke = (e, t, n) => {
398
+ for (let r of Array.from(t.addedNodes)) if (r instanceof Element) for (let t of Ae(r)) e.ghostBornAt.has(t) || (e.ghosts += 1, e.ghostBornAt.set(t, n));
399
+ for (let r of Array.from(t.removedNodes)) if (r instanceof Element) for (let t of Ae(r)) {
400
+ let r = e.ghostBornAt.get(t);
401
+ if (r === void 0) continue;
402
+ e.ghostBornAt.delete(t);
403
+ let i = n - r;
404
+ (e.shortestGhostLifeMs === null || i < e.shortestGhostLifeMs) && (e.shortestGhostLifeMs = i);
405
+ }
406
+ }, Ae = (e) => [...e.hasAttribute("data-flemo-morph-ghost") ? [e] : [], ...Array.from(e.querySelectorAll(b(m)))], je = (e) => {
407
+ let t = e.shortestGhostLifeMs;
408
+ return t === null || t >= 34 ? [] : [{
409
+ kind: "ghost-cut",
410
+ atMs: we(t),
411
+ detail: `a morph ghost was removed ${we(t)}ms after it was created (under one frame) — the departing content it stands for was never presented; this is the first-frame blade signature`
412
+ }];
413
+ }, Me = (e, t) => {
414
+ let n = [...e.pairable].sort(), r = [...e.flew].sort(), i = new Set(r), a = t ? {
415
+ strandedRoles: 0,
416
+ strandedStandIns: 0,
417
+ strandedGhosts: 0,
418
+ layerResidue: 0,
419
+ leaked: 0
420
+ } : {
421
+ strandedRoles: document.querySelectorAll(Se).length,
422
+ strandedStandIns: document.querySelectorAll(b(p)).length,
423
+ strandedGhosts: document.querySelectorAll(b(m)).length,
424
+ layerResidue: Array.from(document.querySelectorAll(b(f))).reduce((e, t) => e + t.childElementCount, 0),
425
+ leaked: Math.max(0, Ee() - e.sheetRulesAtStart)
426
+ };
427
+ return {
428
+ registered: e.registered,
429
+ pairable: n,
430
+ flew: r,
431
+ skipped: n.filter((e) => !i.has(e)),
432
+ camera: e.camera,
433
+ ghosts: e.ghosts,
434
+ strandedRoles: a.strandedRoles,
435
+ strandedStandIns: a.strandedStandIns,
436
+ strandedGhosts: a.strandedGhosts,
437
+ leakedSheetRules: a.leaked,
438
+ layerResidue: a.layerResidue,
439
+ duplicatedKeys: [...e.duplicated].sort()
440
+ };
441
+ }, Ne = "flemo:devtools-panel-height", Pe = [{
442
+ key: "flemo:devtools",
443
+ storage: "session",
444
+ kind: "opt-in-diagnostic",
445
+ values: "\"on\" / \"off\"",
446
+ fallback: "off",
447
+ effect: "arms this flight recorder in the playground (?devtools=on)"
448
+ }, {
449
+ key: Ne,
450
+ storage: "session",
451
+ kind: "production-state",
452
+ values: "a pixel height",
453
+ fallback: "(the panel's default height)",
454
+ effect: "the drawer height this panel was last dragged to"
455
+ }], B = [
456
+ {
457
+ key: "flemo:sixty",
458
+ storage: "session",
459
+ retiredWith: "the steady-60 verdict seed, now document-scoped module state (2026-08-31)"
460
+ },
461
+ {
462
+ key: "flemo:settle-gate",
463
+ storage: "session",
464
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
465
+ },
466
+ {
467
+ key: "flemo:arrivalhold",
468
+ storage: "session",
469
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
470
+ },
471
+ {
472
+ key: "flemo:deskflip",
473
+ storage: "session",
474
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
475
+ },
476
+ {
477
+ key: "flemo:deskhead",
478
+ storage: "session",
479
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
480
+ },
481
+ {
482
+ key: "flemo:creep",
483
+ storage: "session",
484
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
485
+ },
486
+ {
487
+ key: "flemo:relcommit",
488
+ storage: "session",
489
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
490
+ },
491
+ {
492
+ key: "flemo:imgoffload",
493
+ storage: "session",
494
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
495
+ },
496
+ {
497
+ key: "flemo:governed",
498
+ storage: "session",
499
+ retiredWith: "the engine diagnostic surface (2026-08-31)"
500
+ },
501
+ {
502
+ key: "flemo:imghold",
503
+ storage: "session",
504
+ retiredWith: "the image reveal hold, whose only arming path it was (2026-08-31)"
505
+ },
506
+ {
507
+ key: "flemo:preraster",
508
+ storage: "session",
509
+ retiredWith: "the REST-time scope promotion, whose only arming path it was (2026-08-31)"
510
+ },
511
+ {
512
+ key: "flemo:parkhead",
513
+ storage: "session",
514
+ retiredWith: "the engine diagnostic surface — the park head is unconditional (2026-08-31)"
515
+ },
516
+ {
517
+ key: "flemo:layers",
518
+ storage: "session",
519
+ retiredWith: "the resident-layer experiment (2026-08-31)"
520
+ },
521
+ {
522
+ key: "flemo:morph",
523
+ storage: "session",
524
+ retiredWith: "the morph decision trace (2026-08-31)"
525
+ },
526
+ {
527
+ key: "flemo:freeze",
528
+ storage: "session",
529
+ retiredWith: "the shallow-freeze experiment (2026-08-31)"
530
+ },
531
+ {
532
+ key: "flemo:motion-driver",
533
+ storage: "local",
534
+ retiredWith: "the per-origin driver demotion ledger (2026-08-19)"
535
+ },
536
+ {
537
+ key: "flemo:motion-driver-force",
538
+ storage: "session",
539
+ retiredWith: "the hard driver pin, with the rAF player (2026-08-22)"
540
+ },
541
+ {
542
+ key: "flemo:landing-snap",
543
+ storage: "session",
544
+ retiredWith: "the integer-device-pixel landing snap, falsified on device (2026-08-22)"
545
+ },
546
+ {
547
+ key: "flemo:handoff",
548
+ storage: "session",
549
+ retiredWith: "the player's anchored-opening handoff (2026-08-22)"
550
+ },
551
+ {
552
+ key: "flemo:handoffms",
553
+ storage: "session",
554
+ retiredWith: "the player's anchored-opening handoff (2026-08-22)"
555
+ },
556
+ {
557
+ key: "flemo:apply",
558
+ storage: "session",
559
+ retiredWith: "the scrub-WAAPI value-application tier (2026-08-22)"
560
+ },
561
+ {
562
+ key: "flemo:snap",
563
+ storage: "session",
564
+ retiredWith: "the player's device-pixel snap policy (2026-08-22)"
565
+ },
566
+ {
567
+ key: "flemo:snapband",
568
+ storage: "session",
569
+ retiredWith: "the player's device-pixel snap policy (2026-08-22)"
570
+ },
571
+ {
572
+ key: "flemo:lat",
573
+ storage: "session",
574
+ retiredWith: "the Low Power Mode release-latency probe (2026-08-22)"
575
+ }
576
+ ], Fe = "(retired — the library no longer reads this)", Ie = (e) => {
577
+ try {
578
+ let t = e === "session" ? sessionStorage : localStorage;
579
+ return t.length, t;
580
+ } catch {
581
+ return null;
582
+ }
583
+ }, Le = (e, t) => {
584
+ try {
585
+ return e ? e.getItem(t) : null;
586
+ } catch {
587
+ return null;
588
+ }
589
+ }, Re = new Set(Pe.map((e) => e.key)), ze = new Set(B.map((e) => e.key)), Be = () => {
590
+ let e = {}, t = Ie("session"), n = Ie("local");
591
+ for (let r of Pe) {
592
+ let i = Le(r.storage === "session" ? t : n, r.key);
593
+ i !== null && (e[r.key] = i);
594
+ }
595
+ for (let r of B) for (let [i, a] of [[t, "sessionStorage"], [n, "localStorage"]]) {
596
+ let t = Le(i, r.key);
597
+ t !== null && (e[`${r.key} (${a}) ${Fe}`] = t);
598
+ }
599
+ for (let [r, i] of [[t, "sessionStorage"], [n, "localStorage"]]) if (r) try {
600
+ for (let t = 0; t < r.length; t += 1) {
601
+ let n = r.key(t);
602
+ !n || !n.startsWith("flemo:") || Re.has(n) || ze.has(n) || (e[`${n} (${i}, unknown key)`] = r.getItem(n) ?? "");
603
+ }
604
+ } catch {}
605
+ return e;
606
+ }, Ve = (e) => {
607
+ let t = [];
608
+ for (let [n, r] of Object.entries(e)) if (n.includes("(retired — the library no longer reads this)")) {
609
+ let e = n.slice(0, n.indexOf(" (")), i = B.find((t) => t.key === e);
610
+ t.push(`${n}=${r} — RETIRED residue: this key went with ${i?.retiredWith ?? "a removed feature"}. The library never reads it, so it cannot explain anything you are seeing. Safe to delete; it is listed only so it does not read as an unexplained lead.`);
611
+ continue;
612
+ }
613
+ return t;
614
+ }, V = "flemo:devtools-trace", He = () => {
615
+ try {
616
+ let e = sessionStorage;
617
+ return e.length, e;
618
+ } catch {
619
+ return null;
620
+ }
621
+ }, Ue = (e, t) => {
622
+ let n = He();
623
+ if (!n) return;
624
+ let r = e.slice(-10);
625
+ for (; r.length > 0;) {
626
+ let e = JSON.stringify({
627
+ version: t,
628
+ savedAt: (/* @__PURE__ */ new Date()).toISOString(),
629
+ flights: r
630
+ });
631
+ if (e.length <= 64e3) {
632
+ try {
633
+ n.setItem(V, e);
634
+ } catch {}
635
+ return;
636
+ }
637
+ r = r.slice(1);
638
+ }
639
+ We();
640
+ }, We = () => {
641
+ try {
642
+ He()?.removeItem(V);
643
+ } catch {}
644
+ }, Ge = (e) => {
645
+ let t = He();
646
+ if (!t) return null;
647
+ let n = null;
648
+ try {
649
+ n = t.getItem(V);
650
+ } catch {
651
+ return null;
652
+ }
653
+ if (n === null) return null;
654
+ let r = null;
655
+ try {
656
+ r = JSON.parse(n);
657
+ } catch {
658
+ return We(), null;
659
+ }
660
+ return !r || r.version !== e || !Array.isArray(r.flights) ? (We(), null) : {
661
+ savedAt: typeof r.savedAt == "string" ? r.savedAt : "",
662
+ flights: r.flights,
663
+ note: "These flights were recorded by the page instance BEFORE the last full load. They are kept apart from the live ones because they may have come from a different build."
664
+ };
665
+ }, Ke = 12, qe = 20, Je = 40, Ye = 500, Xe = 200, Ze = (e) => {
666
+ let t = e.rafCadence.medianGapMs;
667
+ if (t === null) return {
668
+ id: "display-cadence",
669
+ status: "unknown",
670
+ detail: "the idle frame cadence could not be sampled, so the display's rate is unknown"
671
+ };
672
+ let n = { medianIdleFrameMs: t };
673
+ return t < Ke ? {
674
+ id: "display-cadence",
675
+ status: "ok",
676
+ detail: `idle frames arrive every ${t}ms — a display above 60Hz. Frame budgets in this report are still quoted against 60Hz (a gap of 30ms or more)`,
677
+ metrics: n
678
+ } : t <= qe ? {
679
+ id: "display-cadence",
680
+ status: "ok",
681
+ detail: `idle frames arrive every ${t}ms — a 60Hz clock`,
682
+ metrics: n
683
+ } : t <= Je ? {
684
+ id: "display-cadence",
685
+ status: "violated",
686
+ detail: `idle frames arrive every ${t}ms — the page is being served roughly HALF rate. On iOS this is Low Power Mode, whose main-thread ceiling is ~30Hz while the compositor keeps 60: motion judged here is judged against a clock no transition can beat, and the ceiling is not a library defect. Turn it off, or judge elsewhere`,
687
+ metrics: n
688
+ } : {
689
+ id: "display-cadence",
690
+ status: "violated",
691
+ detail: `idle frames arrive every ${t}ms — the page is barely being served frames at all while idle. Something outside the transition owns this machine; no motion verdict taken here means anything`,
692
+ metrics: n
693
+ };
694
+ }, Qe = (e) => {
695
+ if (!e.environment.observation.longTasks) return {
696
+ id: "machine-idle",
697
+ status: "unknown",
698
+ detail: "this browser does not report long tasks, so the recorder cannot tell whether anything else was competing for the main thread"
699
+ };
700
+ let t = e.idleLongTasks.length, n = Math.round(e.idleLongTasks.reduce((e, t) => e + t.durationMs, 0)), r = Math.round(e.idleLongTasks.reduce((e, t) => Math.max(e, t.durationMs), 0)), i = {
701
+ idleLongTasks: t,
702
+ idleLongTaskMs: n,
703
+ worstIdleTaskMs: r
704
+ };
705
+ return n >= Ye || r >= Xe ? {
706
+ id: "machine-idle",
707
+ status: "violated",
708
+ detail: `${t} long task(s) totalling ${n}ms ran while NO navigation was in flight (worst ${r}ms). Something else on this page or this machine was busy, and a motion verdict taken under someone else's load measures the load. A whole tremble campaign was invalidated by exactly this, with a build running in another window`,
709
+ metrics: i
710
+ } : {
711
+ id: "machine-idle",
712
+ status: "ok",
713
+ detail: `${t} idle long task(s), ${n}ms total — the page was quiet between navigations`,
714
+ metrics: i
715
+ };
716
+ }, $e = (e) => {
717
+ let { trusted: t, synthetic: n, pointerTypes: r } = e.input;
718
+ return n > 0 ? {
719
+ id: "real-input",
720
+ status: "violated",
721
+ detail: `${n} script-dispatched (untrusted) input event(s) drove this session. Synthetic dispatch never fires the gesture machinery a real navigation goes through, so a clean run proves nothing about a finger`,
722
+ metrics: {
723
+ trusted: t,
724
+ synthetic: n
725
+ }
726
+ } : t === 0 ? {
727
+ id: "real-input",
728
+ status: "unknown",
729
+ detail: "no input event preceded any recorded flight. These navigations were driven programmatically or by the browser's own back/forward, which is a different path from the one a user takes",
730
+ metrics: {
731
+ trusted: t,
732
+ synthetic: n
733
+ }
734
+ } : {
735
+ id: "real-input",
736
+ status: "ok",
737
+ detail: `${t} trusted input event(s) drove this session (${r.join(", ") || "type unreported"})`,
738
+ metrics: {
739
+ trusted: t,
740
+ synthetic: n
741
+ }
742
+ };
743
+ }, et = (e) => e.input.pointerTypes.includes("touch") ? {
744
+ id: "touch-path",
745
+ status: "ok",
746
+ detail: "at least one navigation was driven by touch"
747
+ } : e.environment.maxTouchPoints === 0 ? {
748
+ id: "touch-path",
749
+ status: "unknown",
750
+ detail: "this device reports no touch points, so there is no touch path to exercise here"
751
+ } : {
752
+ id: "touch-path",
753
+ status: "unknown",
754
+ detail: "no touch-driven navigation was recorded on a touch-capable device. The swipe and pointer-capture paths are only reached by a finger; a build that had broken them outright once passed every automated layer green because every probe used a mouse"
755
+ }, tt = [
756
+ {
757
+ id: "devtools-closed",
758
+ status: "unknown",
759
+ detail: "whether an inspector is open cannot be seen from inside the page. An open one serializes requests and repaints its own panels on the same machine; a whole campaign's residual stutter was this and nothing else. Confirm it with the user"
760
+ },
761
+ {
762
+ id: "no-screen-capture",
763
+ status: "unknown",
764
+ detail: "whether the screen is being captured cannot be seen from inside the page. A capture client forces the compositor to present every vsync, which SUPPRESSES the symptom — a recording that looks smooth proves nothing about the uncaptured session"
765
+ },
766
+ {
767
+ id: "viewing-configuration",
768
+ status: "unknown",
769
+ detail: "which physical display this window is on, its refresh rate and scaling, cannot be read from the page. Establish it with the user before believing any verdict"
770
+ }
771
+ ], nt = (e) => {
772
+ let { environment: t } = e, n = [];
773
+ return n.push(t.emulationSuspected ? {
774
+ id: "device-emulation",
775
+ status: "violated",
776
+ detail: "DevTools device emulation is suspected (Blink on a desktop platform reporting touch points). Emulation composites the page to a rescaled surface: every in-page instrument reads the pre-scale surface and reports clean while the eye watches the post-scale one" + (/Win/i.test(t.platform) ? ". Windows touch hardware makes this signal ambiguous — confirm the device toolbar state" : "")
777
+ } : {
778
+ id: "device-emulation",
779
+ status: "ok",
780
+ detail: "no device-emulation signature on this session"
781
+ }), n.push(Ze(t)), n.push(e.documentHidden || e.wentHidden ? {
782
+ id: "page-foreground",
783
+ status: "violated",
784
+ detail: e.documentHidden ? "this document is HIDDEN right now — a backgrounded page is throttled to a fraction of its frames" : "this document was hidden at least once while recording; any flight that ran then was throttled"
785
+ } : {
786
+ id: "page-foreground",
787
+ status: "ok",
788
+ detail: "the document stayed visible throughout"
789
+ }), n.push(Qe(e)), n.push(t.developmentHints.length > 0 ? {
790
+ id: "build-mode",
791
+ status: "violated",
792
+ detail: `development-server globals are present (${t.developmentHints.join(", ")}). A development build is a different program: unminified, double-invoking, and hot-reload instrumented. A day of ladder measurements once turned out to be measuring the build itself`
793
+ } : {
794
+ id: "build-mode",
795
+ status: "unknown",
796
+ detail: "no development-server global was found. That is consistent with a production build but does not prove one — confirm how this page was built"
797
+ }), n.push($e(e)), n.push(et(e)), n.push(t.reducedMotion ? {
798
+ id: "reduced-motion",
799
+ status: "violated",
800
+ detail: "this session prefers reduced motion, so the transitions under test are being suppressed or shortened. Whatever is on screen is not the motion being judged"
801
+ } : {
802
+ id: "reduced-motion",
803
+ status: "ok",
804
+ detail: "reduced motion is not requested"
805
+ }), [...n, ...tt];
806
+ }, rt = 2e3, it = 40, at = (e) => Math.round(e * 10) / 10, ot = (e) => typeof e.animationName == "string" && e.animationName.startsWith("flemo-"), st = (e) => e instanceof Element ? `<${e.tagName.toLowerCase()}>${e.getAttribute("data-flemo-screen") === null ? "" : " (screen)"}` : "an unidentified node", ct = (e) => {
807
+ if (typeof document > "u") return {
808
+ detach: () => {},
809
+ sawAnimationEvent: () => !1,
810
+ inputBetween: () => ({
811
+ trusted: 0,
812
+ synthetic: 0,
813
+ pointerTypes: []
814
+ })
815
+ };
816
+ let t = [], n = !1, r = (t) => {
817
+ ot(t) && (n = !0, e.onAnimationStart(performance.now()));
818
+ }, i = (t) => {
819
+ ot(t) && (n = !0, e.onHit({
820
+ kind: "animation-cancel",
821
+ atMs: performance.now(),
822
+ detail: `${t.animationName} was CANCELLED on ${st(t.target)} — the element was re-parented, re-styled or removed mid-flight. A cancelled animation loses its start time, and whatever restarts it is free to overwrite the authored delay`
823
+ }));
824
+ }, a = (t) => {
825
+ ot(t) && (n = !0, t.elapsedTime === 0 && e.onHit({
826
+ kind: "zero-length-animation-end",
827
+ atMs: performance.now(),
828
+ detail: `${t.animationName} reported animationend with elapsedTime 0 on ${st(t.target)} — the animation ended without ever running. Anything landing on this event lands before the motion it was waiting for`
829
+ }));
830
+ }, o = (e) => {
831
+ let n = e.pointerType ?? "";
832
+ t.push({
833
+ atMs: performance.now(),
834
+ trusted: e.isTrusted === !0,
835
+ pointerType: n === "" ? e.type : n
836
+ }), t.length > it && t.splice(0, t.length - it);
837
+ }, s = {
838
+ capture: !0,
839
+ passive: !0
840
+ };
841
+ return document.addEventListener("animationstart", r, s), document.addEventListener("animationcancel", i, s), document.addEventListener("animationend", a, s), document.addEventListener("pointerdown", o, s), document.addEventListener("click", o, s), {
842
+ detach: () => {
843
+ document.removeEventListener("animationstart", r, s), document.removeEventListener("animationcancel", i, s), document.removeEventListener("animationend", a, s), document.removeEventListener("pointerdown", o, s), document.removeEventListener("click", o, s);
844
+ },
845
+ sawAnimationEvent: () => n,
846
+ inputBetween: (e, n) => {
847
+ let r = e - rt, i = t.filter((e) => e.atMs >= r && e.atMs <= n), a = i.filter((e) => e.trusted).length, o = new Set(i.map((e) => e.pointerType));
848
+ return {
849
+ trusted: a,
850
+ synthetic: i.length - a,
851
+ pointerTypes: [...o].sort()
852
+ };
853
+ }
854
+ };
855
+ }, lt = (e, t) => ({
856
+ kind: e.kind,
857
+ atMs: at(e.atMs - t),
858
+ detail: e.detail
859
+ }), ut = (e) => {
860
+ /* v8 ignore next -- unreachable: deriveVerdict returns before this on an
861
+ empty flight list, so nothing ever asks for the median of nothing. */
862
+ if (e.length === 0) return 0;
863
+ let t = [...e].sort((e, t) => e - t);
864
+ return t[Math.floor(t.length / 2)];
865
+ }, dt = (e) => {
866
+ let t = [], n = e.preconditions.filter((e) => e.status === "violated");
867
+ if (n.length > 0 && t.push(`NOT EVIDENCE: ${n.length} judging precondition(s) failed — ${n.map((e) => e.id).join(", ")}. Everything below was measured under those conditions; fix them and measure again before drawing a conclusion from it.`), e.flights.length === 0) return t.push("No flights were recorded. Either no navigation happened while the recorder was attached, or it attached after the one you meant to measure — the recorder only sees flights that start after it does."), t;
868
+ e.observation.animationEvents || t.push("The animation channel observed NOTHING across this whole session: not one flemo keyframe reported a start, an end or a cancel, though flights were recorded. Treat every animation-derived field here as unmeasured rather than as clean — a probe that never fires reads exactly like a page with nothing to report.");
869
+ let r = e.flights, i = r.reduce((e, t) => Math.max(e, t.frameSamples.released.maxGapMs), 0), a = r.filter((e) => e.anomalies.length > 0).length;
870
+ t.push(`${r.length} flight(s) recorded. Median duration ${ut(r.map((e) => e.durationMs))}ms, worst frame gap during visible motion ${i}ms, ${a} flight(s) carrying at least one anomaly.`);
871
+ let o = r.filter((e) => e.motion.longestStallMs >= 48);
872
+ o.length > 0 && t.push(`${o.length} flight(s) STOPPED MOVING mid-flight (longest ${Math.max(...o.map((e) => e.motion.longestStallMs))}ms). Frames kept arriving; the picture did not change. Look at the hold and the animation's play state, not at the frame budget.`);
873
+ let s = r.filter((e) => e.morphs.skipped.length > 0);
874
+ if (s.length > 0) {
875
+ let e = [...new Set(s.flatMap((e) => e.morphs.skipped))];
876
+ t.push(`Shared elements did NOT fly on ${s.length} flight(s): ${e.join(", ")}. Both ends were registered on two different screens and neither was ever stamped with a flight role, so the pair was never made. This is silent by nature — nothing else on the page says it happened.`);
877
+ }
878
+ let c = [...new Set(r.flatMap((e) => e.morphs.duplicatedKeys))];
879
+ c.length > 0 && t.push(`Pairing key(s) used twice inside one screen: ${c.join(", ")}. Two ends under one screen are not a pair, so one of them can never fly. This is in the consuming app, not in the library.`);
880
+ let l = r.flatMap((e) => e.tripwires);
881
+ if (l.length > 0) {
882
+ let e = [...new Set(l.map((e) => e.kind))];
883
+ t.push(`${l.length} tripwire hit(s) across the session (${e.join(", ")}). These are one-frame events reported by the browser itself, not sampled — read the flights' \`tripwires\` arrays for the exact animations.`);
884
+ }
885
+ return r.filter((e) => e.frameSamples.released.over30Count > 0).length === 0 && a === 0 && n.length === 0 && t.push("No flight dropped a frame during visible motion (nothing at or over 30ms) and no anomaly fired. Under the preconditions above, this session is clean — what remains is in `blindSpots`, and none of it is reachable from page code."), t;
886
+ }, H = new Set(v), ft = new Set(y), pt = b(t), mt = 2e3, ht = 1e3, gt = 4e3, U = (e) => Math.round(e * 10) / 10, _t = null, vt = () => ({
887
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
888
+ version: "3",
889
+ verdict: ["No DOM was available, so nothing could be observed. The recorder ran inert."],
890
+ environment: ne({
891
+ medianGapMs: null,
892
+ sampleCount: 0
893
+ }),
894
+ preconditions: [],
895
+ overrides: {
896
+ active: {},
897
+ warnings: ["no DOM available — recorder ran inert"]
898
+ },
899
+ flights: [],
900
+ comparison: [],
901
+ previousSession: null,
902
+ anomalies: [],
903
+ blindSpots: [...w],
904
+ judgingProtocol: [...me]
905
+ }), yt = (e = {}) => {
906
+ if (_t) return _t;
907
+ if (typeof window > "u" || typeof document > "u") return {
908
+ detach: () => {},
909
+ report: vt,
910
+ mark: () => null
911
+ };
912
+ let t = e.maxFlights ?? 50, a = e.log ?? !1, o = e.installGlobal ?? !0, d = e.persist ?? !0, f = Be(), p = performance.now(), m = d ? Ge("3") : null, g = {
913
+ medianGapMs: null,
914
+ sampleCount: 0
915
+ };
916
+ k().then((e) => {
917
+ g = e;
918
+ });
919
+ let _ = [], v = null;
920
+ try {
921
+ typeof PerformanceObserver < "u" && PerformanceObserver.supportedEntryTypes?.includes("longtask") && (v = new PerformanceObserver((e) => {
922
+ for (let t of e.getEntries()) _.push({
923
+ startMs: U(t.startTime),
924
+ durationMs: U(t.duration)
925
+ });
926
+ _.length > ht && _.splice(0, _.length - ht);
927
+ }), v.observe({
928
+ type: "longtask",
929
+ buffered: !0
930
+ }));
931
+ } catch {
932
+ v = null;
933
+ }
934
+ let y = [], x = 0, T = null, E = null, D = [], O = !1, A = !1, j = document.visibilityState === "hidden", M = 0, re = () => Array.from(document.querySelectorAll(pt)).filter((e) => H.has(e.getAttribute("data-flemo-status") ?? "")), N = () => T !== null || re().length > 0, ie = (e) => {
935
+ let t = Array.from(document.querySelectorAll(b(l))).filter((e) => H.has(e.getAttribute("data-flemo-bar-status") ?? "") || e.getAttribute("data-flemo-bar-riding") === "true").length, n = Array.from(document.querySelectorAll(b(c))).filter((e) => H.has(e.getAttribute("data-flemo-status") ?? "")).length, r = Array.from(document.querySelectorAll(b(s))).filter((e) => H.has(e.getAttribute("data-flemo-status") ?? "")).length;
936
+ return {
937
+ screens: e.length,
938
+ bars: t,
939
+ decorators: n,
940
+ parts: r
941
+ };
942
+ }, P = ct({
943
+ onHit: (e) => {
944
+ let t = T;
945
+ t && t.tripwires.push(lt(e, t.t0Ms));
946
+ },
947
+ onAnimationStart: (e) => {
948
+ let t = T;
949
+ !t || t.firstAnimationAtMs !== null || (t.firstAnimationAtMs = U(e - t.t0Ms));
950
+ }
951
+ }), F = (e) => {
952
+ let t = /* @__PURE__ */ new Set();
953
+ for (let n of e.elements) {
954
+ let e = n.getAttribute("data-flemo-status") ?? "";
955
+ H.has(e) && t.add(e);
956
+ }
957
+ return [...t];
958
+ }, I = () => {
959
+ let e = T;
960
+ if (!e || O) return;
961
+ let t = performance.now(), n = e.frames;
962
+ if (n.lastFrameAt !== null && n.heldGaps.length + n.releasedGaps.length < mt) {
963
+ let r = t - n.lastFrameAt, i = oe(e.elements);
964
+ (i ? n.heldGaps : n.releasedGaps).push(r), i || (se(n, e.elements, r), n.releasedFrames === 1 && fe(e.images, e.elements));
965
+ }
966
+ if (n.lastFrameAt = t, ce(n, e.elements), t - e.t0Ms > 1e4) {
967
+ D = [...e.elements], be(t, F(e));
968
+ return;
969
+ }
970
+ e.rafId = requestAnimationFrame(I);
971
+ }, ue = (e) => {
972
+ let t = performance.now();
973
+ x += 1;
974
+ let n = e.find((e) => e.getAttribute("data-flemo-active") === "true") ?? e[0], r = ve(n.getAttribute("data-flemo-status") ?? "") ?? "PUSH", a = null;
975
+ for (let t of e) {
976
+ let e = t.getAttribute(i);
977
+ if (e !== null && ft.has(e)) {
978
+ a = e;
979
+ break;
980
+ }
981
+ }
982
+ T = {
983
+ id: `flight-${x}`,
984
+ kind: r,
985
+ routerId: n.getAttribute("data-flemo-router") ?? void 0,
986
+ bucket: E,
987
+ t0Ms: t,
988
+ t0Iso: (/* @__PURE__ */ new Date()).toISOString(),
989
+ elements: [...e],
990
+ participants: ie(e),
991
+ holdKind: a,
992
+ holdReleasedAtMs: null,
993
+ firstAnimationAtMs: null,
994
+ frames: ae(),
995
+ images: de(e),
996
+ morphs: De(e),
997
+ tripwires: [],
998
+ rafId: null
999
+ }, ce(T.frames, T.elements), T.rafId = requestAnimationFrame(I);
1000
+ }, R = (e, t) => {
1001
+ let n = 2, r = () => {
1002
+ if (O) return;
1003
+ if (--n, n > 0) {
1004
+ requestAnimationFrame(r);
1005
+ return;
1006
+ }
1007
+ let i = xe(t, N());
1008
+ e.landing.residualInlineTransforms = i.residualInlineTransforms, e.landing.offViewportAtRest = i.offViewportAtRest, e.landing.orphanedHolds = i.orphanedHolds;
1009
+ };
1010
+ requestAnimationFrame(r);
1011
+ }, he = (e, t) => {
1012
+ let n = 2, r = () => {
1013
+ if (!O) {
1014
+ if (--n, n > 0) {
1015
+ requestAnimationFrame(r);
1016
+ return;
1017
+ }
1018
+ e.morphs = Me(t.morphs, N());
1019
+ }
1020
+ };
1021
+ requestAnimationFrame(r);
1022
+ }, ye = (e, t, n, r) => ({
1023
+ id: r ? `${e.id} (in flight)` : e.id,
1024
+ ...e.routerId === void 0 ? {} : { routerId: e.routerId },
1025
+ ...e.bucket === null ? {} : { bucket: e.bucket },
1026
+ kind: e.kind,
1027
+ t0: {
1028
+ ms: U(e.t0Ms),
1029
+ iso: e.t0Iso
1030
+ },
1031
+ t1: {
1032
+ ms: U(t),
1033
+ iso: (/* @__PURE__ */ new Date()).toISOString()
1034
+ },
1035
+ durationMs: U(t - e.t0Ms),
1036
+ driver: _e(e.frames.evidence),
1037
+ participants: e.participants,
1038
+ holds: {
1039
+ kind: e.holdKind,
1040
+ releasedAtMs: e.holdReleasedAtMs
1041
+ },
1042
+ frameSamples: ge(e.frames.heldGaps, e.frames.releasedGaps),
1043
+ motion: {
1044
+ ...le(e.frames),
1045
+ firstAnimationAtMs: e.firstAnimationAtMs
1046
+ },
1047
+ images: pe(e.images),
1048
+ morphs: Me(e.morphs, !0),
1049
+ tripwires: [...e.tripwires, ...je(e.morphs)],
1050
+ input: P.inputBetween(e.t0Ms, t),
1051
+ longTasks: [],
1052
+ holdLongTasks: [],
1053
+ landing: {
1054
+ residualInlineTransforms: [],
1055
+ offViewportAtRest: !1,
1056
+ stuckStatuses: n,
1057
+ orphanedHolds: []
1058
+ },
1059
+ anomalies: []
1060
+ }), be = (e, n) => {
1061
+ let r = T;
1062
+ /* v8 ignore next -- unreachable: both callers hold a flight. sampleFrame
1063
+ returns at its own top when `current` is null, and evaluate only calls
1064
+ this inside `if (current && ...)`. The narrowing stays for the type. */
1065
+ if (!r) return;
1066
+ fe(r.images, r.elements), T = null, r.rafId !== null && cancelAnimationFrame(r.rafId);
1067
+ let i = ye(r, e, n, !1);
1068
+ y.push(i), y.length > t && y.splice(0, y.length - t), n.length === 0 && (R(i, r.elements), he(i, r)), a && console.info(`[flemo devtools] ${i.id} ${i.kind} driver=${i.driver} ${i.durationMs}ms screens=${i.participants.screens}`);
1069
+ }, Se = (e) => {
1070
+ let t = T;
1071
+ if (!t || !(e.target instanceof Element)) return;
1072
+ let n = e.target.getAttribute(i);
1073
+ if (n !== null && ft.has(n) && t.holdKind === null && (t.holdKind = n), n !== null && ft.has(n) && t.holdReleasedAtMs !== null && t.frames.holdReassertedAtMs === null) {
1074
+ let e = U(performance.now() - t.t0Ms);
1075
+ t.frames.holdReassertedAtMs = e, t.tripwires.push({
1076
+ kind: "hold-reassert",
1077
+ atMs: e,
1078
+ detail: "an animation hold was re-asserted after this flight had already released it — the motion pauses here while every timing metric stays clean"
1079
+ });
1080
+ }
1081
+ (n === "false" || n === null) && e.oldValue !== null && ft.has(e.oldValue) && t.holdReleasedAtMs === null && !oe(t.elements) && (t.holdReleasedAtMs = U(performance.now() - t.t0Ms));
1082
+ }, Ce = () => {
1083
+ let e = re();
1084
+ if (D.length > 0) {
1085
+ if (e.some((e) => D.includes(e))) return;
1086
+ D = [];
1087
+ }
1088
+ if (!T && e.length > 0) {
1089
+ ue(e);
1090
+ return;
1091
+ }
1092
+ if (T && e.length === 0) {
1093
+ be(performance.now(), []);
1094
+ return;
1095
+ }
1096
+ if (T) for (let t of e) T.elements.includes(t) || (T.elements.push(t), L(T.images, T.elements, t.querySelectorAll("img")), T.participants = ie(T.elements));
1097
+ }, we = null, z = null, Te = () => {
1098
+ let e = document.documentElement;
1099
+ if (!e) return !1;
1100
+ let t = new MutationObserver((e) => {
1101
+ if (O) return;
1102
+ let t = performance.now();
1103
+ for (let n of e) n.type === "attributes" ? n.attributeName === "data-flemo-anim-hold" ? Se(n) : T && (n.attributeName === "data-flemo-morph" || n.attributeName === "data-flemo-morph-camera") && n.target instanceof Element && Oe(T.morphs, n.target) : (T && ke(T.morphs, n, t), T && n.addedNodes.length > 0 && L(T.images, T.elements, n.addedNodes));
1104
+ Ce();
1105
+ });
1106
+ try {
1107
+ t.observe(e, {
1108
+ subtree: !0,
1109
+ childList: !0,
1110
+ attributes: !0,
1111
+ attributeOldValue: !0,
1112
+ attributeFilter: [
1113
+ n,
1114
+ r,
1115
+ i,
1116
+ u,
1117
+ h
1118
+ ]
1119
+ });
1120
+ } catch {
1121
+ return !1;
1122
+ }
1123
+ return we = t, Ce(), !0;
1124
+ };
1125
+ if (!Te()) {
1126
+ let e = () => {
1127
+ z = null, O || Te();
1128
+ };
1129
+ z = e, document.addEventListener("DOMContentLoaded", e, { once: !0 });
1130
+ }
1131
+ let Ee = () => {
1132
+ document.visibilityState === "hidden" && (j = !0, d && T === null && Ue(y, "3"));
1133
+ };
1134
+ document.addEventListener("visibilitychange", Ee);
1135
+ let Ae = () => {
1136
+ M = 0, !O && (T === null && Ue(y, "3"), M = window.setTimeout(Ae, gt));
1137
+ };
1138
+ d && (M = window.setTimeout(Ae, gt));
1139
+ let Ne = (e) => {
1140
+ let t = _.filter((t) => t.startMs + t.durationMs >= e.t0.ms - 120 && t.startMs <= e.t1.ms), n = e.holds.kind === null ? e.t0.ms : e.holds.releasedAtMs === null ? e.t1.ms : e.t0.ms + e.holds.releasedAtMs;
1141
+ return {
1142
+ released: t.filter((e) => e.startMs + e.durationMs > n),
1143
+ held: t.filter((e) => e.startMs + e.durationMs <= n)
1144
+ };
1145
+ }, Pe = (e) => _.filter((t) => t.startMs >= p && !e.some((e) => t.startMs + t.durationMs >= e.t0.ms && t.startMs <= e.t1.ms)), B = (e) => {
1146
+ let t = Ne(e), n = {
1147
+ ...e,
1148
+ longTasks: t.released,
1149
+ holdLongTasks: t.held,
1150
+ landing: {
1151
+ residualInlineTransforms: [...e.landing.residualInlineTransforms],
1152
+ offViewportAtRest: e.landing.offViewportAtRest,
1153
+ stuckStatuses: [...e.landing.stuckStatuses],
1154
+ orphanedHolds: [...e.landing.orphanedHolds]
1155
+ },
1156
+ morphs: { ...e.morphs },
1157
+ tripwires: [...e.tripwires]
1158
+ };
1159
+ return n.anomalies = S({
1160
+ t0Ms: n.t0.ms,
1161
+ t1Ms: n.t1.ms,
1162
+ driver: n.driver,
1163
+ frameSamples: n.frameSamples,
1164
+ longTasks: n.longTasks,
1165
+ holdLongTasks: n.holdLongTasks,
1166
+ releasedAtMs: n.holds.releasedAtMs,
1167
+ landing: n.landing,
1168
+ motion: n.motion,
1169
+ images: n.images,
1170
+ morphs: n.morphs,
1171
+ tripwires: n.tripwires
1172
+ }), n;
1173
+ }, Fe = () => {
1174
+ let e = y.map(B), t = T;
1175
+ if (!t) return e;
1176
+ let n = performance.now(), r = n - t.t0Ms > ee;
1177
+ return [...e, B(ye(t, n, r ? F(t) : [], !0))];
1178
+ }, Ie = (e) => {
1179
+ let t = /* @__PURE__ */ new Set(), n = 0, r = 0;
1180
+ for (let i of e) {
1181
+ n += i.input.trusted, r += i.input.synthetic;
1182
+ for (let e of i.input.pointerTypes) t.add(e);
1183
+ }
1184
+ return {
1185
+ trusted: n,
1186
+ synthetic: r,
1187
+ pointerTypes: [...t].sort()
1188
+ };
1189
+ }, Le = () => {
1190
+ let e = Be(), t = { ...e };
1191
+ for (let [n, r] of Object.entries(f)) n in e || (t[`${n} (at attach, since cleared)`] = r);
1192
+ let n = Ve(t), r = ne(g, P.sawAnimationEvent()), i = Fe(), a = T, o = nt({
1193
+ environment: r,
1194
+ idleLongTasks: Pe(i),
1195
+ observedMs: performance.now() - p,
1196
+ wentHidden: j,
1197
+ documentHidden: document.visibilityState === "hidden",
1198
+ input: Ie(i)
1199
+ });
1200
+ return {
1201
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1202
+ version: "3",
1203
+ verdict: dt({
1204
+ preconditions: o,
1205
+ flights: i,
1206
+ observation: r.observation
1207
+ }),
1208
+ environment: r,
1209
+ preconditions: o,
1210
+ overrides: {
1211
+ active: t,
1212
+ warnings: n
1213
+ },
1214
+ flights: i,
1215
+ comparison: te(i),
1216
+ previousSession: m,
1217
+ anomalies: C({
1218
+ emulationSuspected: r.emulationSuspected,
1219
+ platform: r.platform,
1220
+ stuckFlightOpen: a !== null && performance.now() - a.t0Ms > 1e4,
1221
+ flightAnomalies: i.map((e) => e.anomalies)
1222
+ }),
1223
+ blindSpots: [...w],
1224
+ judgingProtocol: [...me]
1225
+ };
1226
+ }, Re = (e) => (E = e === null || e === "" ? null : e, E), ze = () => {
1227
+ if (!O) {
1228
+ if (O = !0, we?.disconnect(), z !== null && (document.removeEventListener("DOMContentLoaded", z), z = null), document.removeEventListener("visibilitychange", Ee), P.detach(), v?.disconnect(), window.clearTimeout(M), M = 0, T?.rafId != null && cancelAnimationFrame(T.rafId), T = null, A) {
1229
+ let e = window;
1230
+ e.flemo?.__flemoDevtools === !0 && delete e.flemo;
1231
+ }
1232
+ _t = null;
1233
+ }
1234
+ }, V = {
1235
+ detach: ze,
1236
+ report: Le,
1237
+ mark: Re
1238
+ };
1239
+ if (o) {
1240
+ let e = window, t = e.flemo;
1241
+ (t === void 0 || t?.__flemoDevtools === !0) && (e.flemo = {
1242
+ __flemoDevtools: !0,
1243
+ report: Le,
1244
+ flights: Fe,
1245
+ mark: Re,
1246
+ detach: ze
1247
+ }, A = !0);
1248
+ }
1249
+ return _t = V, V;
1250
+ }, bt = v.map((e) => b(t) + x(n, e)).join(","), W = () => document.querySelector(bt) !== null, xt = (e) => {
1251
+ let t = document.createElement("div");
1252
+ t.setAttribute(_, ""), t.style.position = "fixed", t.style.top = "0", t.style.left = "0", t.style.width = "0", t.style.height = "0", t.style.zIndex = "2147483000";
1253
+ let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
1254
+ r.textContent = e, n.appendChild(r);
1255
+ let i = document.createElement("div");
1256
+ return i.className = "root", n.appendChild(i), {
1257
+ host: t,
1258
+ root: i
1259
+ };
1260
+ }, St = () => {}, Ct = (e) => {
1261
+ if (e) return {
1262
+ recorder: e,
1263
+ ownsRecorder: !1
1264
+ };
1265
+ let t = window.flemo;
1266
+ return t?.__flemoDevtools === !0 && typeof t.report == "function" ? {
1267
+ recorder: {
1268
+ report: t.report,
1269
+ detach: St,
1270
+ mark: t.mark ?? (() => null)
1271
+ },
1272
+ ownsRecorder: !1
1273
+ } : {
1274
+ recorder: yt(),
1275
+ ownsRecorder: !0
1276
+ };
1277
+ }, wt = 500, Tt = 450, Et = "\n:host { all: initial; }\n.root { all: initial; }\n.hud {\n position: fixed;\n left: 50%;\n transform: translateX(-50%);\n max-width: calc(100vw - 16px);\n box-sizing: border-box;\n padding: 6px 10px;\n border-radius: 8px;\n background: #0b0f14;\n color: #e8f0f8;\n border: 1px solid #2b3a4a;\n font: 500 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n white-space: pre;\n text-align: left;\n overflow-x: auto;\n -webkit-user-select: none;\n user-select: none;\n touch-action: manipulation;\n /* No transition and no keyframe anywhere in this sheet: the readout must\n never be a moving thing on a screen whose motion is under test. */\n}\n.hud[data-edge=\"top\"] { top: max(8px, env(safe-area-inset-top)); }\n.hud[data-edge=\"bottom\"] { bottom: max(8px, env(safe-area-inset-bottom)); }\n.hud[data-alarm=\"true\"] { border-color: #ff6b6b; color: #ffd9d9; }\n.hud[data-blocked=\"true\"] { border-color: #ffb020; color: #ffe9c2; }\n", G = (e) => Math.round(e * 10) / 10, Dt = (e) => {
1278
+ if (!e) return "flemo no flight yet";
1279
+ let t = e.frameSamples?.released, n = e.anomalies?.length ?? 0;
1280
+ return `${e.kind} ${Math.round(e.durationMs)}ms gap ${G(t?.maxGapMs ?? 0)} drop ${t?.over30Count ?? 0}` + (n > 0 ? ` !${n}` : " ok") + (e.bucket ? ` [${e.bucket}]` : "");
1281
+ }, Ot = (e, t) => {
1282
+ let n = [], r = (e?.preconditions ?? []).filter((e) => e.status === "violated");
1283
+ if (r.length > 0 && n.push(`BLOCKED ${r.map((e) => e.id).join(" ")}`), !t) return n.push(`rAF ${G(e?.environment?.rafCadence?.medianGapMs ?? 0)}ms`), n;
1284
+ let i = t.frameSamples;
1285
+ n.push(`frames n${i?.released?.count ?? 0} med ${G(i?.released?.medianGapMs ?? 0)} max ${G(i?.released?.maxGapMs ?? 0)}`), n.push(`motion stall ${G(t.motion?.longestStallMs ?? 0)}ms tail ${t.motion?.tailFrames ?? 0} start +${t.motion?.firstAnimationAtMs ?? "?"}ms`), n.push(`hold ${t.holds?.kind ?? "none"} rel ${t.holds?.releasedAtMs ?? "-"}ms task ${t.longTasks?.length ?? 0}`);
1286
+ let a = t.morphs;
1287
+ a && (a.pairable.length > 0 || a.flew.length > 0) && n.push(`morph ${a.flew.length} flew` + (a.camera ? " cam" : "") + (a.skipped.length > 0 ? ` SKIPPED ${a.skipped.length} (${a.skipped.join(",")})` : ""));
1288
+ let o = t.input;
1289
+ o && n.push(`input ${o.pointerTypes.join("/") || "none"}` + (o.synthetic > 0 ? ` SYNTHETIC ${o.synthetic}` : ""));
1290
+ for (let e of t.anomalies ?? []) n.push(`! ${e.slice(0, 120)}`);
1291
+ return n;
1292
+ }, kt = null, At = (e = {}) => {
1293
+ if (kt) return kt;
1294
+ if (typeof document > "u") return { detach: () => {} };
1295
+ let { recorder: t, ownsRecorder: n } = Ct(e.recorder), r = e.buckets && e.buckets.length > 0 ? e.buckets : ["A", "B"], { host: i, root: a } = xt(Et), o = document.createElement("div");
1296
+ o.className = "hud", o.setAttribute("data-edge", e.position ?? "top"), o.setAttribute("role", "status"), o.textContent = "flemo attaching", a.appendChild(o);
1297
+ let s = !1, c = e.initialExpanded === !0, l = -1, u = 0, d = 0, f = !1, p = "", m = () => {
1298
+ try {
1299
+ return t.report();
1300
+ } catch {
1301
+ return null;
1302
+ }
1303
+ }, h = () => {
1304
+ if (s || W()) return;
1305
+ let e = m(), t = e?.flights ?? [], n = t[t.length - 1], r = [Dt(n)];
1306
+ c && r.push(...Ot(e, n));
1307
+ let i = r.join("\n"), a = (e?.preconditions ?? []).some((e) => e.status === "violated"), l = (n?.anomalies?.length ?? 0) > 0;
1308
+ i !== p && (p = i, o.textContent = i), o.setAttribute("data-alarm", l ? "true" : "false"), o.setAttribute("data-blocked", a ? "true" : "false");
1309
+ }, g = () => {
1310
+ u = 0, h(), u = window.setTimeout(g, wt);
1311
+ }, _ = () => {
1312
+ l = l + 1 >= r.length ? -1 : l + 1, t.mark(l === -1 ? null : r[l]), p = "", h();
1313
+ };
1314
+ o.addEventListener("pointerdown", () => {
1315
+ f = !1, window.clearTimeout(d), d = window.setTimeout(() => {
1316
+ f = !0, _();
1317
+ }, Tt);
1318
+ }), o.addEventListener("pointerup", () => {
1319
+ window.clearTimeout(d), d = 0, !f && (c = !c, p = "", h());
1320
+ }), o.addEventListener("pointercancel", () => window.clearTimeout(d));
1321
+ let v = () => {
1322
+ s || (s = !0, window.clearTimeout(u), u = 0, window.clearTimeout(d), d = 0, i.remove(), n && t.detach(), kt = null);
1323
+ };
1324
+ document.body.appendChild(i), h(), u = window.setTimeout(g, wt);
1325
+ let y = { detach: v };
1326
+ return kt = y, y;
1327
+ }, jt = "http://www.w3.org/2000/svg", K = (e, t, n) => {
1328
+ let r = document.createElement(e);
1329
+ return t !== void 0 && (r.className = t), n !== void 0 && (r.textContent = n), r;
1330
+ }, Mt = (e, t) => {
1331
+ let n = document.createElementNS(jt, e);
1332
+ for (let [e, r] of Object.entries(t)) n.setAttribute(e, r);
1333
+ return n;
1334
+ }, Nt = (e) => {
1335
+ for (; e.firstChild !== null;) e.removeChild(e.firstChild);
1336
+ }, q = (e, t) => {
1337
+ e.textContent !== t && (e.textContent = t);
1338
+ }, J = (e) => e == null || e === "" ? "—" : String(e), Y = (e) => typeof e == "number" && Number.isFinite(e) ? `${Math.round(e)}ms` : "—", Pt = (e) => typeof e == "number" && Number.isFinite(e) ? `${Math.round(e * 10) / 10}ms` : "—", X = (e) => typeof e == "number" && Number.isFinite(e) ? String(e) : "—", Ft = (e) => e === !0 ? "yes" : e === !1 ? "no" : "—", It = (e) => {
1339
+ let t = e?.environment;
1340
+ if (!t) return "—";
1341
+ let n = t.viewport, r = n && typeof n.width == "number" && typeof n.height == "number" ? `${Math.round(n.width)}×${Math.round(n.height)}` : "—";
1342
+ return [
1343
+ J(t.engine),
1344
+ `dpr ${J(t.devicePixelRatio)}`,
1345
+ r,
1346
+ `rAF ${Pt(t.rafCadence?.medianGapMs)}`
1347
+ ].join(" · ");
1348
+ }, Lt = (e, t) => `${t ?? ""}#${e.map((e) => `${e?.id ?? ""}|${e?.kind ?? ""}|${e?.driver ?? ""}|${Math.round(e?.durationMs ?? 0)}|${e?.participants?.screens ?? 0}|${e?.anomalies?.length ?? 0}`).join(",")}`, Rt = (e) => {
1349
+ let t = e?.released?.gaps;
1350
+ if (!Array.isArray(t)) return null;
1351
+ let n = t.filter((e) => typeof e == "number" && Number.isFinite(e));
1352
+ return n.length >= 2 ? n : null;
1353
+ }, zt = "\n:host {\n all: initial;\n color-scheme: dark;\n}\n* { box-sizing: border-box; }\n.root {\n --bg: #14161a;\n --bg-soft: #1b1e24;\n --line: #2b3038;\n --fg: #e6e9ef;\n --fg-dim: #99a1b0;\n --accent: #7cc4ff;\n --warn: #ffb454;\n --bad: #ff6b6b;\n font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n color: var(--fg);\n}\n@media (prefers-color-scheme: light) {\n .root {\n --bg: #ffffff;\n --bg-soft: #f4f6f9;\n --line: #dde1e8;\n --fg: #1a1d22;\n --fg-dim: #5c6472;\n --accent: #0b6bcb;\n --warn: #a35a00;\n --bad: #c2261f;\n }\n}\n.toggle {\n position: fixed;\n bottom: 12px;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n gap: 6px;\n margin: 0;\n padding: 6px 10px;\n border: 1px solid var(--line);\n border-radius: 999px;\n background: var(--bg);\n color: var(--fg);\n font: inherit;\n cursor: pointer;\n}\n.toggle:hover { background: var(--bg-soft); }\n.toggle[data-corner=\"bottom-right\"] { right: 12px; }\n.toggle[data-corner=\"bottom-left\"] { left: 12px; }\n.mark { font-weight: 700; letter-spacing: 0.04em; }\n.count {\n padding: 0 6px;\n border-radius: 999px;\n background: var(--bg-soft);\n color: var(--fg-dim);\n}\n.dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background: var(--bad);\n}\n.dot[hidden] { display: none; }\n.panel {\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 2147482999;\n display: flex;\n flex-direction: column;\n max-width: 100%;\n border-top: 1px solid var(--line);\n background: var(--bg);\n overflow: hidden;\n}\n.panel[hidden] { display: none; }\n.grip {\n flex: 0 0 6px;\n height: 6px;\n background: var(--line);\n cursor: ns-resize;\n touch-action: none;\n}\n.head {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 8px;\n padding: 8px 10px;\n border-bottom: 1px solid var(--line);\n}\n.env { color: var(--fg-dim); }\n.spacer { flex: 1 1 auto; }\n.act {\n padding: 4px 8px;\n border: 1px solid var(--line);\n border-radius: 4px;\n background: var(--bg-soft);\n color: var(--fg);\n font: inherit;\n cursor: pointer;\n}\n.chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n flex: 1 1 100%;\n}\n.chips:empty { display: none; }\n.chip {\n padding: 2px 8px;\n border: 1px solid var(--line);\n border-radius: 999px;\n background: var(--bg-soft);\n color: var(--fg-dim);\n max-width: 100%;\n overflow-wrap: anywhere;\n}\n/* The verdict reads as prose, not as a tag: it is a sentence about the whole\n session and it is the first thing anybody should read. */\n.chip.lead {\n border-color: var(--fg);\n color: var(--fg);\n white-space: normal;\n max-width: 100%;\n line-height: 1.5;\n}\n.chip.warn { border-color: var(--warn); color: var(--warn); }\n.chip.bad { border-color: var(--bad); color: var(--bad); }\n.body {\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n}\n.list {\n flex: 0 0 40%;\n max-width: 340px;\n min-width: 180px;\n overflow: auto;\n border-right: 1px solid var(--line);\n}\n.row {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 6px 10px;\n border: 0;\n border-bottom: 1px solid var(--line);\n background: none;\n color: var(--fg);\n font: inherit;\n text-align: left;\n cursor: pointer;\n}\n.row[aria-selected=\"true\"] { background: var(--bg-soft); }\n.row .kind { font-weight: 700; }\n.row .driver { color: var(--accent); }\n.row .dur, .row .screens { color: var(--fg-dim); }\n.row .n {\n margin-left: auto;\n padding: 0 6px;\n border-radius: 999px;\n background: var(--bg-soft);\n color: var(--fg-dim);\n}\n.row .n.bad { background: var(--bad); color: #fff; }\n.detail { flex: 1 1 auto; overflow: auto; padding: 8px 10px; }\n.section { margin: 0 0 10px; }\n.section > h2 {\n margin: 0 0 4px;\n font: inherit;\n font-weight: 700;\n color: var(--fg-dim);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n}\n.kv { display: flex; gap: 8px; }\n.kv > .k { flex: 0 0 34%; max-width: 180px; color: var(--fg-dim); }\n.kv > .v { flex: 1 1 auto; overflow-wrap: anywhere; }\n/* A value that IS the finding — a stall, a re-asserted hold, an orphan. */\n.kv > .v.bad { color: var(--bad); }\n.li { overflow-wrap: anywhere; }\n.li.bad { color: var(--bad); }\n.dim { color: var(--fg-dim); }\n.spark { display: block; width: 100%; height: 28px; }\n.foot { border-top: 1px solid var(--line); padding: 6px 10px; color: var(--fg-dim); }\n.foot summary { cursor: pointer; }\n.foot .li { margin-top: 4px; }\n", Bt = 48, Z = (e, t, n, r) => {
1354
+ let i = K("div", "kv");
1355
+ i.appendChild(K("span", "k", t)), i.appendChild(K("span", r ? `v ${r}` : "v", n)), e.appendChild(i);
1356
+ }, Q = (e, t) => {
1357
+ let n = K("section", "section");
1358
+ return n.appendChild(K("h2", void 0, t)), e.appendChild(n), n;
1359
+ }, $ = (e, t, n = "li") => {
1360
+ e.appendChild(K("div", n, t));
1361
+ }, Vt = (e, t) => {
1362
+ Nt(e);
1363
+ for (let n of t?.verdict ?? []) e.appendChild(K("span", "chip lead", J(n)));
1364
+ for (let n of t?.preconditions ?? []) n?.status === "violated" && e.appendChild(K("span", "chip bad", `${n.id}: ${J(n.detail)}`));
1365
+ for (let n of t?.overrides?.warnings ?? []) e.appendChild(K("span", "chip warn", J(n)));
1366
+ for (let n of t?.anomalies ?? []) e.appendChild(K("span", "chip bad", J(n)));
1367
+ for (let [n, r] of Object.entries(t?.overrides?.active ?? {})) e.appendChild(K("span", "chip", `${n}=${String(r)}`));
1368
+ }, Ht = (e, t, n, r) => {
1369
+ if (Nt(e), t.length === 0) {
1370
+ $(e, "no flights recorded yet — navigate once", "li dim");
1371
+ return;
1372
+ }
1373
+ for (let i = t.length - 1; i >= 0; --i) {
1374
+ let a = t[i], o = J(a?.id), s = K("button", "row");
1375
+ s.type = "button", s.setAttribute("data-flight-id", o), s.setAttribute("aria-selected", String(o === n)), s.appendChild(K("span", "kind", J(a?.kind))), s.appendChild(K("span", "driver", J(a?.driver))), s.appendChild(K("span", "dur", Y(a?.durationMs))), s.appendChild(K("span", "screens", `${X(a?.participants?.screens)} scr`));
1376
+ let c = a?.anomalies?.length ?? 0;
1377
+ s.appendChild(K("span", c > 0 ? "n bad" : "n", String(c))), s.addEventListener("click", () => r(o)), e.appendChild(s);
1378
+ }
1379
+ }, Ut = (e, t, n) => {
1380
+ if (!n) {
1381
+ Z(e, t, "—");
1382
+ return;
1383
+ }
1384
+ let r = [
1385
+ `${X(n.count)} frames`,
1386
+ `median ${Pt(n.medianGapMs)}`,
1387
+ `max ${Pt(n.maxGapMs)}`
1388
+ ];
1389
+ typeof n.over30Count == "number" && r.push(`>30ms ×${n.over30Count}`), Z(e, t, r.join(" · "));
1390
+ }, Wt = (e) => {
1391
+ let t = Math.max(...e), n = t > 0 ? t : 1, r = 100 / (e.length - 1), i = e.map((e, t) => `${Math.round(t * r * 10) / 10},${Math.round((27 - e / n * 26) * 10) / 10}`).join(" "), a = Mt("svg", {
1392
+ class: "spark",
1393
+ viewBox: "0 0 100 28",
1394
+ preserveAspectRatio: "none",
1395
+ "aria-hidden": "true"
1396
+ });
1397
+ return a.appendChild(Mt("polyline", {
1398
+ points: i,
1399
+ fill: "none",
1400
+ stroke: "currentColor",
1401
+ "stroke-width": "1",
1402
+ "vector-effect": "non-scaling-stroke"
1403
+ })), a;
1404
+ }, Gt = (e, t) => {
1405
+ let n = t.longTasks ?? [], r = t.holdLongTasks ?? [];
1406
+ if (n.length === 0 && r.length === 0) {
1407
+ $(e, "none", "li dim");
1408
+ return;
1409
+ }
1410
+ let i = (e) => `${Y(e?.startMs)} + ${Y(e?.durationMs)}`;
1411
+ for (let t of n) $(e, i(t), "li bad");
1412
+ for (let t of r) $(e, `${i(t)} (absorbed by hold)`, "li dim");
1413
+ }, Kt = (e, t) => {
1414
+ if (Nt(e), !t) {
1415
+ $(e, "select a flight", "li dim");
1416
+ return;
1417
+ }
1418
+ let n = Q(e, "timing");
1419
+ Z(n, "id", J(t.id)), Z(n, "kind / driver", `${J(t.kind)} · ${J(t.driver)}`), Z(n, "router", J(t.routerId)), Z(n, "t0", J(t.t0?.iso)), Z(n, "duration", Y(t.durationMs)), Z(n, "participants", `${X(t.participants?.screens)} screens · ${X(t.participants?.bars)} bars · ${X(t.participants?.decorators)} decorators · ${X(t.participants?.parts)} parts`), Z(n, "hold", `${J(t.holds?.kind)} · released ${Y(t.holds?.releasedAtMs)}`);
1420
+ let r = Q(e, "frames");
1421
+ Ut(r, "held (absorbed)", t.frameSamples?.held), Ut(r, "released (visible)", t.frameSamples?.released);
1422
+ let i = Rt(t.frameSamples);
1423
+ i && r.appendChild(Wt(i));
1424
+ let a = Q(e, "motion (did it move)"), o = t.motion?.longestStallMs, s = t.motion?.holdReassertedAtMs;
1425
+ Z(a, "released frames", X(t.motion?.sampledFrames)), Z(a, "stalled frames", X(t.motion?.stalledFrames), (t.motion?.stalledFrames ?? 0) > 0 ? "bad" : void 0), Z(a, "longest stall", Y(o), (o ?? 0) >= Bt ? "bad" : void 0), Z(a, "paused after release", Ft(t.motion?.pausedAfterRelease), t.motion?.pausedAfterRelease === !0 ? "bad" : void 0), Z(a, "hold re-asserted", s == null ? "no" : Y(s), typeof s == "number" ? "bad" : void 0), Z(a, "first animation", t.motion?.firstAnimationAtMs === null || t.motion?.firstAnimationAtMs === void 0 ? "not observed" : `+${Y(t.motion.firstAnimationAtMs)} after t0`);
1426
+ let c = t.morphs;
1427
+ if (c) {
1428
+ let t = Q(e, "shared elements");
1429
+ Z(t, "registered", X(c.registered)), Z(t, "pairable / flew", `${X(c.pairable?.length)} · ${X(c.flew?.length)}`);
1430
+ let n = c.skipped ?? [];
1431
+ Z(t, "did not fly", n.length === 0 ? "none" : n.join(", "), n.length > 0 ? "bad" : void 0);
1432
+ let r = c.duplicatedKeys ?? [];
1433
+ r.length > 0 && Z(t, "duplicate keys in one screen", r.join(", "), "bad"), Z(t, "camera", Ft(c.camera)), Z(t, "ghosts", X(c.ghosts));
1434
+ let i = (c.strandedRoles ?? 0) + (c.strandedStandIns ?? 0) + (c.strandedGhosts ?? 0) + (c.layerResidue ?? 0) + (c.leakedSheetRules ?? 0);
1435
+ Z(t, "residue at rest", i === 0 ? "clean" : `${X(c.strandedRoles)} roles · ${X(c.strandedStandIns)} stand-ins · ${X(c.strandedGhosts)} ghosts · ${X(c.layerResidue)} in layer · ${X(c.leakedSheetRules)} rules`, i > 0 ? "bad" : void 0);
1436
+ }
1437
+ let l = t.tripwires ?? [];
1438
+ if (l.length > 0) {
1439
+ let t = Q(e, "tripwires (one-frame events)");
1440
+ for (let e of l) $(t, `+${Y(e.atMs)} ${e.kind}: ${e.detail}`, "li bad");
1441
+ }
1442
+ let u = t.input;
1443
+ if (u) {
1444
+ let t = Q(e, "what drove it");
1445
+ Z(t, "input", `${X(u.trusted)} trusted · ${X(u.synthetic)} synthetic`, u.synthetic > 0 ? "bad" : void 0), Z(t, "pointer types", u.pointerTypes?.join(", ") || "none observed");
1446
+ }
1447
+ let d = Q(e, "images"), f = t.images?.completedDuringFlight ?? 0, p = t.images?.heldDuringFlight ?? 0, m = t.images?.completedUnheld, h = typeof m == "number" ? m > 0 : f > p;
1448
+ Z(d, "loading at t0", X(t.images?.loadingAtStart)), Z(d, "added mid-flight", X(t.images?.addedDuringFlight)), Z(d, "completed mid-flight", X(t.images?.completedDuringFlight), h ? "bad" : void 0), Z(d, "held by the engine", X(t.images?.heldDuringFlight)), Z(d, "completed without hold", X(m), h ? "bad" : void 0), Gt(Q(e, "long tasks"), t);
1449
+ let g = Q(e, "landing"), _ = t.landing?.residualInlineTransforms ?? [];
1450
+ if (_.length === 0) Z(g, "inline residue", "clean");
1451
+ else for (let e of _) Z(g, "inline residue", J(e));
1452
+ Z(g, "off-viewport at rest", Ft(t.landing?.offViewportAtRest));
1453
+ let v = t.landing?.stuckStatuses ?? [];
1454
+ Z(g, "stuck statuses", v.length === 0 ? "none" : v.join(", "));
1455
+ let y = t.landing?.orphanedHolds ?? [];
1456
+ if (y.length === 0) Z(g, "orphaned holds", "none");
1457
+ else for (let e of y) Z(g, "orphaned holds", J(e), "bad");
1458
+ let b = Q(e, "anomalies"), x = t.anomalies ?? [];
1459
+ if (x.length === 0) {
1460
+ $(b, "none", "li dim");
1461
+ return;
1462
+ }
1463
+ for (let e of x) $(b, J(e), "li bad");
1464
+ }, qt = (e, t) => {
1465
+ Nt(e);
1466
+ for (let n of t ?? []) $(e, J(n));
1467
+ }, Jt = 320, Yt = 2e3, Xt = 120, Zt = "Copy report JSON", Qt = () => {}, $t = null, en = (e = {}) => {
1468
+ if ($t) return $t;
1469
+ if (typeof document > "u") return { detach: Qt };
1470
+ let { recorder: t, ownsRecorder: n } = Ct(e.recorder), { host: r, root: i } = xt(zt), a = K("button", "toggle");
1471
+ a.type = "button", a.setAttribute("data-corner", e.position ?? "bottom-right"), a.setAttribute("aria-label", "flemo devtools");
1472
+ let o = K("span", "count", "0"), s = K("span", "dot");
1473
+ s.hidden = !0, a.appendChild(K("span", "mark", "flemo")), a.appendChild(o), a.appendChild(s);
1474
+ let c = K("section", "panel");
1475
+ c.hidden = !0;
1476
+ let l = K("div", "grip");
1477
+ l.setAttribute("role", "separator"), l.setAttribute("aria-label", "Resize flemo devtools panel");
1478
+ let u = K("header", "head"), d = K("div", "env", "—"), f = K("button", "act", Zt);
1479
+ f.type = "button";
1480
+ let p = K("button", "act", "Close");
1481
+ p.type = "button";
1482
+ let m = K("button", "act", "Detach");
1483
+ m.type = "button";
1484
+ let h = K("button", "act", "A/B: off");
1485
+ h.type = "button";
1486
+ let g = K("div", "chips");
1487
+ u.appendChild(d), u.appendChild(K("div", "spacer")), u.appendChild(h), u.appendChild(f), u.appendChild(p), u.appendChild(m), u.appendChild(g);
1488
+ let _ = K("div", "body"), v = K("div", "list"), y = K("div", "detail");
1489
+ _.appendChild(v), _.appendChild(y);
1490
+ let b = K("div", "foot"), x = K("details");
1491
+ x.appendChild(K("summary", void 0, "What this cannot see"));
1492
+ let ee = K("div");
1493
+ x.appendChild(ee), b.appendChild(x), c.appendChild(l), c.appendChild(u), c.appendChild(_), c.appendChild(b), i.appendChild(a), i.appendChild(c);
1494
+ let S = !1, C = e.initialOpen === !0, w = null, T = "", te = "", E = "", D = !1, O = 0, k = 0, A = -1, j = e.buckets && e.buckets.length > 0 ? e.buckets : ["A", "B"], M = (e) => Math.min(Math.max(e, Xt), Math.max(Xt, window.innerHeight * .9)), ne = () => {
1495
+ try {
1496
+ let e = sessionStorage.getItem(Ne);
1497
+ if (e === null) return null;
1498
+ let t = Number.parseFloat(e);
1499
+ return Number.isFinite(t) ? t : null;
1500
+ } catch {
1501
+ return null;
1502
+ }
1503
+ }, re = (e) => {
1504
+ try {
1505
+ sessionStorage.setItem(Ne, String(Math.round(e)));
1506
+ } catch {}
1507
+ }, N = M(ne() ?? window.innerHeight * .4);
1508
+ c.style.height = `${Math.round(N)}px`;
1509
+ let ie = () => {
1510
+ try {
1511
+ return t.report();
1512
+ } catch {
1513
+ return null;
1514
+ }
1515
+ }, ae = (e) => {
1516
+ e !== w && (w = e, P());
1517
+ }, oe = () => {
1518
+ let e = ie(), t = e?.flights ?? [];
1519
+ q(o, String(t.length));
1520
+ let n = t.some((e) => (e?.anomalies?.length ?? 0) > 0);
1521
+ if (s.hidden = !n, c.hidden = !C, !C) return;
1522
+ q(d, It(e));
1523
+ let r = JSON.stringify([
1524
+ e?.overrides?.warnings ?? [],
1525
+ e?.anomalies ?? [],
1526
+ e?.overrides?.active ?? {}
1527
+ ]);
1528
+ r !== E && (E = r, Vt(g, e)), w === null && t.length > 0 && (w = t[t.length - 1]?.id ?? null);
1529
+ let i = Lt(t, w);
1530
+ i !== T && (T = i, Ht(v, t, w, ae));
1531
+ let a = t.find((e) => e?.id === w) ?? null, l = JSON.stringify(a);
1532
+ l !== te && (te = l, Kt(y, a)), D || (D = !0, qt(ee, e?.blindSpots));
1533
+ };
1534
+ function P() {
1535
+ S || W() || oe();
1536
+ }
1537
+ function se() {
1538
+ O = 0, P(), F();
1539
+ }
1540
+ function F() {
1541
+ O = window.setTimeout(se, C ? Jt : Yt);
1542
+ }
1543
+ let ce = () => {
1544
+ window.clearTimeout(O), F();
1545
+ }, le = (e) => {
1546
+ C = e, ce(), P();
1547
+ };
1548
+ a.addEventListener("click", () => le(!C)), p.addEventListener("click", () => le(!1)), m.addEventListener("click", () => pe()), h.addEventListener("click", () => {
1549
+ A = A + 1 >= j.length ? -1 : A + 1;
1550
+ let e = A === -1 ? null : j[A];
1551
+ t.mark(e), q(h, `A/B: ${e ?? "off"}`), E = "", P();
1552
+ });
1553
+ let I = () => {
1554
+ if (!S) {
1555
+ if (W()) {
1556
+ window.clearTimeout(k), k = window.setTimeout(I, Jt);
1557
+ return;
1558
+ }
1559
+ q(f, "Copied ✓"), window.clearTimeout(k), k = window.setTimeout(ue, 1200);
1560
+ }
1561
+ };
1562
+ function ue() {
1563
+ if (W()) {
1564
+ k = window.setTimeout(ue, Jt);
1565
+ return;
1566
+ }
1567
+ k = 0, q(f, Zt);
1568
+ }
1569
+ let de = (e) => {
1570
+ if (S) return;
1571
+ if (W()) {
1572
+ window.clearTimeout(k), k = window.setTimeout(() => de(e), Jt);
1573
+ return;
1574
+ }
1575
+ let t = K("textarea");
1576
+ t.value = e, t.setAttribute("aria-hidden", "true"), t.style.position = "fixed", t.style.opacity = "0", t.style.pointerEvents = "none", document.body.appendChild(t), t.select();
1577
+ let n = document;
1578
+ try {
1579
+ n.execCommand?.("copy");
1580
+ } catch {}
1581
+ t.remove(), I();
1582
+ };
1583
+ f.addEventListener("click", () => {
1584
+ let e = JSON.stringify(ie(), null, 2), t = navigator.clipboard;
1585
+ if (t && typeof t.writeText == "function") {
1586
+ t.writeText(e).then(I, () => de(e));
1587
+ return;
1588
+ }
1589
+ de(e);
1590
+ });
1591
+ let L = (e) => {
1592
+ N = M(window.innerHeight - e.clientY), c.style.height = `${Math.round(N)}px`;
1593
+ }, fe = () => {
1594
+ window.removeEventListener("pointermove", L), window.removeEventListener("pointerup", fe), re(N);
1595
+ };
1596
+ l.addEventListener("pointerdown", (e) => {
1597
+ e.preventDefault(), window.addEventListener("pointermove", L), window.addEventListener("pointerup", fe);
1598
+ });
1599
+ function pe() {
1600
+ S || (S = !0, window.clearTimeout(O), O = 0, window.clearTimeout(k), k = 0, window.removeEventListener("pointermove", L), window.removeEventListener("pointerup", fe), r.remove(), n && t.detach(), $t = null);
1601
+ }
1602
+ document.body.appendChild(r), P(), F();
1603
+ let me = { detach: pe };
1604
+ return $t = me, me;
1605
+ };
1606
+ //#endregion
1607
+ //#region src/react.ts
1608
+ function tn({ recorder: t, hud: n = !0, panel: r = !0, hudPosition: i = "top", panelPosition: a = "bottom-left", initialOpen: o = !1, buckets: s } = {}) {
1609
+ let c = s?.join("\0");
1610
+ return e(() => {
1611
+ let e = [];
1612
+ return r && e.push(en({
1613
+ recorder: t,
1614
+ position: a,
1615
+ initialOpen: o,
1616
+ buckets: s
1617
+ }).detach), n && e.push(At({
1618
+ recorder: t,
1619
+ position: i,
1620
+ buckets: s
1621
+ }).detach), () => {
1622
+ for (let t of e.reverse()) t();
1623
+ };
1624
+ }, [
1625
+ t,
1626
+ n,
1627
+ r,
1628
+ i,
1629
+ a,
1630
+ o,
1631
+ c
1632
+ ]), null;
1633
+ }
1634
+ //#endregion
1635
+ export { tn as FlemoDevtools, tn as default };