@naylabs/agent-lens 0.0.0-stage → 0.1.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/index.mjs ADDED
@@ -0,0 +1,1324 @@
1
+ import { jsxs as b, jsx as r, Fragment as S } from "react/jsx-runtime";
2
+ import { useState as k, useEffect as $, useCallback as N, useRef as D } from "react";
3
+ import { createPortal as W } from "react-dom";
4
+ function O(e) {
5
+ try {
6
+ const t = e.getAttribute("data-component-id") || e.getAttribute("data-component");
7
+ if (t)
8
+ return {
9
+ componentName: t.split(":")[0] || t,
10
+ sourceFile: t.includes(":") ? t : null
11
+ };
12
+ const o = Object.keys(e).find(
13
+ (n) => n.startsWith("__reactFiber$") || n.startsWith("__reactInternalInstance$")
14
+ );
15
+ if (!o)
16
+ return { componentName: null, sourceFile: null };
17
+ let a = e[o], d = null, g = null;
18
+ for (; a; ) {
19
+ const n = a.type, l = a._debugSource;
20
+ if (l != null && l.fileName && !g) {
21
+ const s = l.fileName, p = l.lineNumber ? `:${l.lineNumber}` : "";
22
+ g = `${s.replace(/.*\/src\//, "src/")}${p}`;
23
+ }
24
+ if (typeof n == "function") {
25
+ const s = n.displayName || n.name;
26
+ s && s !== "Anonymous" && !s.startsWith("_") && !d && (d = s);
27
+ } else if (typeof n == "object" && n !== null) {
28
+ const s = n.displayName;
29
+ s && !d && (d = s);
30
+ }
31
+ if (d && g)
32
+ break;
33
+ a = a.return || null;
34
+ }
35
+ return { componentName: d, sourceFile: g };
36
+ } catch {
37
+ return { componentName: null, sourceFile: null };
38
+ }
39
+ }
40
+ function Y(e) {
41
+ if (e.id)
42
+ return `#${CSS.escape(e.id)}`;
43
+ const t = e.getAttribute("data-testid");
44
+ if (t)
45
+ return `[data-testid="${CSS.escape(t)}"]`;
46
+ const o = [];
47
+ let a = e;
48
+ for (; a && a.nodeType === Node.ELEMENT_NODE && a !== document.body; ) {
49
+ let d = a.tagName.toLowerCase();
50
+ if (a.id) {
51
+ d = `#${CSS.escape(a.id)}`, o.unshift(d);
52
+ break;
53
+ }
54
+ if (a.className && typeof a.className == "string") {
55
+ const n = a.className.trim().split(/\s+/).filter((l) => !l.includes(":") && !l.includes("/") && !l.startsWith("[") && l.length < 25);
56
+ n.length > 0 && n[0] && (d += `.${CSS.escape(n[0])}`);
57
+ }
58
+ const g = a.parentElement;
59
+ if (g) {
60
+ const n = Array.from(g.children).filter((l) => l.tagName === a.tagName);
61
+ if (n.length > 1) {
62
+ const l = n.indexOf(a) + 1;
63
+ d += `:nth-of-type(${l})`;
64
+ }
65
+ }
66
+ if (o.unshift(d), a = a.parentElement, o.length >= 4) break;
67
+ }
68
+ return o.join(" > ");
69
+ }
70
+ function K(e) {
71
+ const t = window.getComputedStyle(e), o = {};
72
+ t.display !== "inline" && t.display !== "block" && (o.display = t.display), t.display.includes("flex") && (o.flexDirection = t.flexDirection, t.gap && t.gap !== "normal" && (o.gap = t.gap)), t.display.includes("grid") && t.gridTemplateColumns && (o.gridTemplateColumns = t.gridTemplateColumns, t.gap && t.gap !== "normal" && (o.gap = t.gap)), t.padding && t.padding !== "0px" && (o.padding = t.padding), t.margin && t.margin !== "0px" && (o.margin = t.margin);
73
+ const a = e.getBoundingClientRect();
74
+ return o.width = `${Math.round(a.width)}px`, o.height = `${Math.round(a.height)}px`, t.backgroundColor && t.backgroundColor !== "rgba(0, 0, 0, 0)" && t.backgroundColor !== "transparent" && (o.backgroundColor = t.backgroundColor), t.color && (o.color = t.color), t.fontSize && (o.fontSize = t.fontSize), t.fontWeight && t.fontWeight !== "400" && (o.fontWeight = t.fontWeight), t.borderRadius && t.borderRadius !== "0px" && (o.borderRadius = t.borderRadius), t.border && t.border !== "none" && !t.border.startsWith("0px") && (o.border = t.border), o;
75
+ }
76
+ function I(e) {
77
+ const t = e.getBoundingClientRect(), { componentName: o, sourceFile: a } = O(e), d = Y(e), g = K(e);
78
+ let n = null;
79
+ const s = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim();
80
+ s && (n = s.length > 50 ? `${s.slice(0, 47)}...` : s);
81
+ const p = typeof e.className == "string" ? e.className.trim() : "";
82
+ return {
83
+ componentName: o,
84
+ sourceFile: a,
85
+ selector: d,
86
+ tagName: e.tagName.toLowerCase(),
87
+ classes: p,
88
+ textSnippet: n,
89
+ rect: {
90
+ top: Math.round(t.top + window.scrollY),
91
+ left: Math.round(t.left + window.scrollX),
92
+ width: Math.round(t.width),
93
+ height: Math.round(t.height)
94
+ },
95
+ computedStyles: g,
96
+ viewport: {
97
+ width: window.innerWidth,
98
+ height: window.innerHeight
99
+ },
100
+ route: window.location.pathname + window.location.search + window.location.hash
101
+ };
102
+ }
103
+ const _ = {
104
+ style: "Style",
105
+ copy: "Copy",
106
+ layout: "Layout",
107
+ motion: "Motion",
108
+ bug: "Bug",
109
+ general: "Note"
110
+ };
111
+ function V(e) {
112
+ return e < 640 ? "Mobile (< 640px)" : e < 1024 ? "Tablet (640-1024px)" : "Desktop (>= 1024px)";
113
+ }
114
+ function H(e) {
115
+ if (e.length === 0)
116
+ return "No visual pins recorded.";
117
+ const t = e[0], o = t.metadata.viewport, a = t.metadata.route, d = V(o.width), g = [
118
+ `### AgentLens: Visual UI Feedback (${e.length} ${e.length === 1 ? "item" : "items"})`,
119
+ `**Context:** Route: \`${a}\` | Viewport: \`${o.width} × ${o.height}px\` (${d})`,
120
+ `**Timestamp:** ${(/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`,
121
+ "",
122
+ "Please implement the following visual and code adjustments:",
123
+ "",
124
+ "---"
125
+ ].join(`
126
+ `), n = e.map((s) => {
127
+ const p = s.metadata, v = _[s.category] || "Note", f = p.componentName ? `<${p.componentName}> (${p.tagName})` : `<${p.tagName}>`, y = [
128
+ `#### Pin #${s.number}: ${f}`,
129
+ `- **Category:** [${v}]`,
130
+ `- **Instruction:** "${s.instruction.trim()}"`
131
+ ];
132
+ p.sourceFile && y.push(`- **Source Component:** \`${p.sourceFile}\``), y.push(`- **CSS Selector:** \`${p.selector}\``), p.textSnippet && y.push(`- **Current Text Snippet:** "${p.textSnippet}"`), p.classes && y.push(`- **Current Classes:** \`${p.classes}\``);
133
+ const i = p.computedStyles, h = [];
134
+ return h.push(`box: ${i.width || "auto"} × ${i.height || "auto"}`), i.display && h.push(`display: ${i.display}`), i.gap && h.push(`gap: ${i.gap}`), i.padding && h.push(`padding: ${i.padding}`), i.margin && h.push(`margin: ${i.margin}`), i.backgroundColor && h.push(`bg: ${i.backgroundColor}`), i.color && h.push(`color: ${i.color}`), i.fontSize && h.push(`font-size: ${i.fontSize}`), i.borderRadius && h.push(`radius: ${i.borderRadius}`), h.length > 0 && y.push(`- **Computed Styles:** ${h.join(" | ")}`), y.join(`
135
+ `);
136
+ }), l = [
137
+ "---",
138
+ "**Implementation Guidance:**",
139
+ "1. Locate each component file indicated above.",
140
+ "2. Apply the requested visual styling, copy, or layout adjustments.",
141
+ "3. Ensure responsive behavior is preserved across breakpoints."
142
+ ].join(`
143
+ `);
144
+ return [g, ...n, l].join(`
145
+
146
+ `);
147
+ }
148
+ const X = `
149
+ :host {
150
+ all: initial;
151
+ position: fixed;
152
+ top: 0;
153
+ left: 0;
154
+ width: 0;
155
+ height: 0;
156
+ z-index: 2147483647;
157
+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
158
+ -webkit-font-smoothing: antialiased;
159
+ -moz-osx-font-smoothing: grayscale;
160
+ color: #F4F4F5;
161
+ box-sizing: border-box;
162
+ }
163
+
164
+ *, *::before, *::after {
165
+ box-sizing: border-box;
166
+ margin: 0;
167
+ padding: 0;
168
+ }
169
+
170
+ /* Arc Design System Tokens */
171
+ :host {
172
+ --arc-gradient: linear-gradient(135deg, #FF6EA7 0%, #A855F7 50%, #38BDF8 100%);
173
+ --arc-gradient-subtle: linear-gradient(135deg, rgba(255, 110, 167, 0.12) 0%, rgba(168, 85, 247, 0.12) 50%, rgba(56, 189, 248, 0.12) 100%);
174
+ --arc-cyan: #38BDF8;
175
+ --arc-purple: #A855F7;
176
+ --arc-pink: #FF6EA7;
177
+ --arc-glass-bg: rgba(18, 18, 24, 0.88);
178
+ --arc-glass-surface: rgba(28, 28, 36, 0.72);
179
+ --arc-glass-hover: rgba(42, 42, 54, 0.85);
180
+ --arc-border: rgba(255, 255, 255, 0.1);
181
+ --arc-border-highlight: rgba(255, 255, 255, 0.22);
182
+ --arc-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
183
+ --arc-shadow-hover: 0 20px 48px -8px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.18);
184
+ --arc-radius-pill: 9999px;
185
+ --arc-radius-card: 16px;
186
+ }
187
+
188
+ /* Loom / Intercom Floating Trigger Button (Bottom Right) */
189
+ .arc-launcher-btn {
190
+ position: fixed;
191
+ bottom: 24px;
192
+ right: 24px;
193
+ width: 48px;
194
+ height: 48px;
195
+ border-radius: 50%;
196
+ background: var(--arc-glass-bg);
197
+ backdrop-filter: blur(28px) saturate(190%);
198
+ -webkit-backdrop-filter: blur(28px) saturate(190%);
199
+ border: 1px solid var(--arc-border);
200
+ box-shadow: var(--arc-shadow);
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: center;
204
+ color: #FFFFFF;
205
+ cursor: pointer;
206
+ pointer-events: auto;
207
+ user-select: none;
208
+ transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
209
+ z-index: 2147483647;
210
+ }
211
+
212
+ .arc-launcher-btn:hover {
213
+ transform: translateY(-2px) scale(1.04);
214
+ border-color: var(--arc-border-highlight);
215
+ box-shadow: var(--arc-shadow-hover);
216
+ }
217
+
218
+ .arc-launcher-btn:active {
219
+ transform: translateY(0) scale(0.96);
220
+ }
221
+
222
+ .arc-launcher-badge {
223
+ position: absolute;
224
+ top: -3px;
225
+ right: -3px;
226
+ min-width: 18px;
227
+ height: 18px;
228
+ padding: 0 5px;
229
+ border-radius: var(--arc-radius-pill);
230
+ background: var(--arc-gradient);
231
+ color: #FFFFFF;
232
+ font-size: 10px;
233
+ font-weight: 700;
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: center;
237
+ box-shadow: 0 2px 8px rgba(168, 85, 247, 0.6);
238
+ }
239
+
240
+ /* Arc Expanded Dock / Toolbar (Docked at Bottom-Right) */
241
+ .arc-dock {
242
+ position: fixed;
243
+ bottom: 24px;
244
+ right: 24px;
245
+ display: flex;
246
+ align-items: center;
247
+ gap: 6px;
248
+ padding: 5px 8px;
249
+ background: var(--arc-glass-bg);
250
+ backdrop-filter: blur(28px) saturate(190%);
251
+ -webkit-backdrop-filter: blur(28px) saturate(190%);
252
+ border: 1px solid var(--arc-border);
253
+ border-radius: var(--arc-radius-pill);
254
+ box-shadow: var(--arc-shadow);
255
+ transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
256
+ pointer-events: auto;
257
+ user-select: none;
258
+ z-index: 2147483647;
259
+ }
260
+
261
+ .arc-dock:hover {
262
+ border-color: var(--arc-border-highlight);
263
+ box-shadow: var(--arc-shadow-hover);
264
+ }
265
+
266
+ /* Brand Pill */
267
+ .arc-brand-pill {
268
+ display: flex;
269
+ align-items: center;
270
+ gap: 6px;
271
+ padding: 4px 10px;
272
+ border-radius: var(--arc-radius-pill);
273
+ background: rgba(255, 255, 255, 0.04);
274
+ font-size: 12px;
275
+ font-weight: 600;
276
+ letter-spacing: -0.01em;
277
+ color: #FFFFFF;
278
+ }
279
+
280
+ .arc-brand-dot {
281
+ width: 6px;
282
+ height: 6px;
283
+ border-radius: 50%;
284
+ background: var(--arc-gradient);
285
+ box-shadow: 0 0 8px rgba(168, 85, 247, 0.8);
286
+ animation: arc-pulse 2s infinite ease-in-out;
287
+ }
288
+
289
+ @keyframes arc-pulse {
290
+ 0%, 100% { opacity: 1; transform: scale(1); }
291
+ 50% { opacity: 0.5; transform: scale(0.85); }
292
+ }
293
+
294
+ /* Tactile Pill Buttons */
295
+ .arc-btn {
296
+ display: inline-flex;
297
+ align-items: center;
298
+ justify-content: center;
299
+ gap: 6px;
300
+ height: 32px;
301
+ padding: 0 12px;
302
+ background: var(--arc-glass-surface);
303
+ border: 1px solid var(--arc-border);
304
+ border-radius: var(--arc-radius-pill);
305
+ color: #D4D4D8;
306
+ font-size: 12px;
307
+ font-weight: 500;
308
+ cursor: pointer;
309
+ transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
310
+ outline: none;
311
+ user-select: none;
312
+ }
313
+
314
+ .arc-btn:hover {
315
+ background: var(--arc-glass-hover);
316
+ color: #FFFFFF;
317
+ border-color: var(--arc-border-highlight);
318
+ transform: translateY(-1px);
319
+ }
320
+
321
+ .arc-btn:active {
322
+ transform: translateY(1px) scale(0.98);
323
+ }
324
+
325
+ .arc-btn-active {
326
+ background: var(--arc-gradient);
327
+ color: #FFFFFF;
328
+ border-color: rgba(255, 255, 255, 0.3);
329
+ box-shadow: 0 3px 12px rgba(168, 85, 247, 0.45);
330
+ }
331
+
332
+ .arc-btn-active:hover {
333
+ filter: brightness(1.08);
334
+ }
335
+
336
+ .arc-btn-gradient {
337
+ background: var(--arc-gradient);
338
+ color: #FFFFFF;
339
+ border: 1px solid rgba(255, 255, 255, 0.25);
340
+ box-shadow: 0 3px 12px rgba(168, 85, 247, 0.35);
341
+ }
342
+
343
+ .arc-btn-gradient:hover {
344
+ filter: brightness(1.1);
345
+ transform: translateY(-1px);
346
+ }
347
+
348
+ .arc-btn-success {
349
+ background: #10B981;
350
+ color: #FFFFFF;
351
+ border-color: rgba(255, 255, 255, 0.3);
352
+ box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
353
+ }
354
+
355
+ .arc-badge {
356
+ display: inline-flex;
357
+ align-items: center;
358
+ justify-content: center;
359
+ min-width: 16px;
360
+ height: 16px;
361
+ padding: 0 5px;
362
+ border-radius: var(--arc-radius-pill);
363
+ font-size: 10px;
364
+ font-weight: 600;
365
+ background: rgba(255, 255, 255, 0.12);
366
+ color: #FFFFFF;
367
+ }
368
+
369
+ /* Hover Inspector Overlay */
370
+ .arc-inspect-box {
371
+ position: fixed;
372
+ pointer-events: none;
373
+ z-index: 2147483640;
374
+ border: 1.5px solid var(--arc-cyan);
375
+ background: rgba(56, 189, 248, 0.06);
376
+ border-radius: 4px;
377
+ transition: all 0.08s ease-out;
378
+ box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
379
+ }
380
+
381
+ .arc-inspect-label {
382
+ position: absolute;
383
+ top: -26px;
384
+ left: 0;
385
+ display: flex;
386
+ align-items: center;
387
+ gap: 6px;
388
+ padding: 3px 8px;
389
+ background: rgba(14, 14, 18, 0.94);
390
+ backdrop-filter: blur(12px);
391
+ border: 1px solid rgba(56, 189, 248, 0.5);
392
+ border-radius: 6px;
393
+ font-size: 11px;
394
+ font-weight: 600;
395
+ color: var(--arc-cyan);
396
+ white-space: nowrap;
397
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
398
+ }
399
+
400
+ .arc-inspect-label .size {
401
+ color: #A1A1AA;
402
+ font-weight: 400;
403
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
404
+ font-size: 10px;
405
+ }
406
+
407
+ /* Numbered Pin Badges */
408
+ .arc-pin-marker {
409
+ position: absolute;
410
+ z-index: 2147483642;
411
+ width: 26px;
412
+ height: 26px;
413
+ display: flex;
414
+ align-items: center;
415
+ justify-content: center;
416
+ border-radius: 50%;
417
+ background: var(--arc-gradient);
418
+ color: #FFFFFF;
419
+ font-size: 12px;
420
+ font-weight: 700;
421
+ cursor: pointer;
422
+ pointer-events: auto;
423
+ box-shadow: 0 4px 14px rgba(168, 85, 247, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.9);
424
+ transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
425
+ transform: translate(-50%, -50%);
426
+ user-select: none;
427
+ }
428
+
429
+ .arc-pin-marker:hover {
430
+ transform: translate(-50%, -50%) scale(1.15);
431
+ box-shadow: 0 6px 18px rgba(168, 85, 247, 0.75), 0 0 0 2px #FFFFFF;
432
+ }
433
+
434
+ .arc-pin-marker.active {
435
+ transform: translate(-50%, -50%) scale(1.2);
436
+ box-shadow: 0 8px 22px rgba(255, 110, 167, 0.8), 0 0 0 2.5px #FFFFFF;
437
+ }
438
+
439
+ /* Figma-style Comment Popover */
440
+ .arc-popover {
441
+ position: absolute;
442
+ z-index: 2147483645;
443
+ width: 320px;
444
+ background: var(--arc-glass-bg);
445
+ backdrop-filter: blur(32px) saturate(200%);
446
+ -webkit-backdrop-filter: blur(32px) saturate(200%);
447
+ border: 1px solid var(--arc-border);
448
+ border-radius: var(--arc-radius-card);
449
+ padding: 14px;
450
+ box-shadow: var(--arc-shadow-hover);
451
+ pointer-events: auto;
452
+ animation: arc-pop-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
453
+ }
454
+
455
+ @keyframes arc-pop-in {
456
+ from { opacity: 0; transform: translateY(6px) scale(0.96); }
457
+ to { opacity: 1; transform: translateY(0) scale(1); }
458
+ }
459
+
460
+ .arc-popover-header {
461
+ display: flex;
462
+ align-items: center;
463
+ justify-content: space-between;
464
+ margin-bottom: 10px;
465
+ }
466
+
467
+ .arc-component-badge {
468
+ display: inline-flex;
469
+ align-items: center;
470
+ gap: 6px;
471
+ padding: 3px 8px;
472
+ border-radius: var(--arc-radius-pill);
473
+ background: rgba(56, 189, 248, 0.12);
474
+ border: 1px solid rgba(56, 189, 248, 0.28);
475
+ color: var(--arc-cyan);
476
+ font-size: 11px;
477
+ font-weight: 600;
478
+ max-width: 230px;
479
+ overflow: hidden;
480
+ text-overflow: ellipsis;
481
+ white-space: nowrap;
482
+ }
483
+
484
+ /* Category Chips (Clean Text, No Emojis) */
485
+ .arc-chips {
486
+ display: flex;
487
+ flex-wrap: wrap;
488
+ gap: 5px;
489
+ margin-bottom: 10px;
490
+ }
491
+
492
+ .arc-chip {
493
+ padding: 3px 9px;
494
+ border-radius: var(--arc-radius-pill);
495
+ background: rgba(255, 255, 255, 0.05);
496
+ border: 1px solid var(--arc-border);
497
+ font-size: 11px;
498
+ font-weight: 500;
499
+ color: #A1A1AA;
500
+ cursor: pointer;
501
+ transition: all 0.15s ease;
502
+ }
503
+
504
+ .arc-chip:hover {
505
+ background: rgba(255, 255, 255, 0.1);
506
+ color: #FFFFFF;
507
+ }
508
+
509
+ .arc-chip.selected {
510
+ background: var(--arc-gradient);
511
+ border-color: rgba(255, 255, 255, 0.3);
512
+ color: #FFFFFF;
513
+ font-weight: 600;
514
+ }
515
+
516
+ /* Comment Input */
517
+ .arc-textarea {
518
+ width: 100%;
519
+ height: 76px;
520
+ padding: 10px 12px;
521
+ background: rgba(0, 0, 0, 0.32);
522
+ border: 1px solid var(--arc-border);
523
+ border-radius: 10px;
524
+ color: #F4F4F5;
525
+ font-size: 12px;
526
+ line-height: 1.5;
527
+ resize: none;
528
+ outline: none;
529
+ transition: border-color 0.15s ease;
530
+ font-family: inherit;
531
+ }
532
+
533
+ .arc-textarea:focus {
534
+ border-color: var(--arc-purple);
535
+ box-shadow: 0 0 0 1px var(--arc-purple);
536
+ }
537
+
538
+ .arc-textarea::placeholder {
539
+ color: #71717A;
540
+ }
541
+
542
+ /* Popover Footer */
543
+ .arc-popover-footer {
544
+ display: flex;
545
+ align-items: center;
546
+ justify-content: space-between;
547
+ margin-top: 10px;
548
+ }
549
+
550
+ .arc-btn-icon {
551
+ width: 30px;
552
+ height: 30px;
553
+ display: inline-flex;
554
+ align-items: center;
555
+ justify-content: center;
556
+ border-radius: 50%;
557
+ background: rgba(255, 255, 255, 0.05);
558
+ border: 1px solid var(--arc-border);
559
+ color: #A1A1AA;
560
+ cursor: pointer;
561
+ transition: all 0.15s ease;
562
+ }
563
+
564
+ .arc-btn-icon:hover {
565
+ background: rgba(255, 255, 255, 0.12);
566
+ color: #FFFFFF;
567
+ }
568
+
569
+ .arc-btn-icon.danger:hover {
570
+ background: rgba(239, 68, 68, 0.2);
571
+ border-color: rgba(239, 68, 68, 0.4);
572
+ color: #EF4444;
573
+ }
574
+
575
+ /* Slide-up Tray (Docked at Bottom-Right above Launcher) */
576
+ .arc-tray {
577
+ position: fixed;
578
+ bottom: 76px;
579
+ right: 24px;
580
+ width: 380px;
581
+ max-width: 90vw;
582
+ max-height: 360px;
583
+ background: var(--arc-glass-bg);
584
+ backdrop-filter: blur(32px) saturate(200%);
585
+ -webkit-backdrop-filter: blur(32px) saturate(200%);
586
+ border: 1px solid var(--arc-border);
587
+ border-radius: var(--arc-radius-card);
588
+ padding: 14px;
589
+ box-shadow: var(--arc-shadow-hover);
590
+ display: flex;
591
+ flex-direction: column;
592
+ gap: 10px;
593
+ pointer-events: auto;
594
+ animation: arc-pop-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
595
+ z-index: 2147483646;
596
+ }
597
+
598
+ .arc-tray-header {
599
+ display: flex;
600
+ align-items: center;
601
+ justify-content: space-between;
602
+ padding-bottom: 8px;
603
+ border-bottom: 1px solid var(--arc-border);
604
+ }
605
+
606
+ .arc-tray-title {
607
+ font-size: 12px;
608
+ font-weight: 600;
609
+ color: #FFFFFF;
610
+ display: flex;
611
+ align-items: center;
612
+ gap: 6px;
613
+ }
614
+
615
+ .arc-tray-list {
616
+ display: flex;
617
+ flex-direction: column;
618
+ gap: 8px;
619
+ overflow-y: auto;
620
+ max-height: 250px;
621
+ padding-right: 2px;
622
+ }
623
+
624
+ .arc-tray-list::-webkit-scrollbar {
625
+ width: 4px;
626
+ }
627
+
628
+ .arc-tray-list::-webkit-scrollbar-thumb {
629
+ background: rgba(255, 255, 255, 0.2);
630
+ border-radius: 4px;
631
+ }
632
+
633
+ .arc-tray-item {
634
+ display: flex;
635
+ align-items: flex-start;
636
+ justify-content: space-between;
637
+ gap: 10px;
638
+ padding: 8px 10px;
639
+ background: rgba(255, 255, 255, 0.04);
640
+ border: 1px solid var(--arc-border);
641
+ border-radius: 10px;
642
+ cursor: pointer;
643
+ transition: all 0.15s ease;
644
+ }
645
+
646
+ .arc-tray-item:hover {
647
+ background: rgba(255, 255, 255, 0.08);
648
+ border-color: var(--arc-border-highlight);
649
+ }
650
+
651
+ .arc-tray-item-left {
652
+ display: flex;
653
+ align-items: flex-start;
654
+ gap: 8px;
655
+ flex: 1;
656
+ min-width: 0;
657
+ }
658
+
659
+ .arc-tray-pin-num {
660
+ width: 20px;
661
+ height: 20px;
662
+ border-radius: 50%;
663
+ background: var(--arc-gradient);
664
+ display: flex;
665
+ align-items: center;
666
+ justify-content: center;
667
+ font-size: 10px;
668
+ font-weight: 700;
669
+ color: #FFFFFF;
670
+ flex-shrink: 0;
671
+ }
672
+
673
+ .arc-tray-item-content {
674
+ flex: 1;
675
+ min-width: 0;
676
+ }
677
+
678
+ .arc-tray-item-meta {
679
+ font-size: 11px;
680
+ color: var(--arc-cyan);
681
+ font-weight: 600;
682
+ margin-bottom: 2px;
683
+ white-space: nowrap;
684
+ overflow: hidden;
685
+ text-overflow: ellipsis;
686
+ }
687
+
688
+ .arc-tray-item-text {
689
+ font-size: 11px;
690
+ color: #E4E4E7;
691
+ line-height: 1.4;
692
+ word-break: break-word;
693
+ }
694
+ `, G = ({ size: e = 16 }) => /* @__PURE__ */ b(
695
+ "svg",
696
+ {
697
+ width: e,
698
+ height: e,
699
+ viewBox: "0 0 24 24",
700
+ fill: "none",
701
+ stroke: "currentColor",
702
+ strokeWidth: "2",
703
+ strokeLinecap: "round",
704
+ strokeLinejoin: "round",
705
+ children: [
706
+ /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
707
+ /* @__PURE__ */ r("line", { x1: "22", y1: "12", x2: "18", y2: "12" }),
708
+ /* @__PURE__ */ r("line", { x1: "6", y1: "12", x2: "2", y2: "12" }),
709
+ /* @__PURE__ */ r("line", { x1: "12", y1: "6", x2: "12", y2: "2" }),
710
+ /* @__PURE__ */ r("line", { x1: "12", y1: "22", x2: "12", y2: "18" })
711
+ ]
712
+ }
713
+ ), T = ({ size: e = 14 }) => /* @__PURE__ */ b(
714
+ "svg",
715
+ {
716
+ width: e,
717
+ height: e,
718
+ viewBox: "0 0 24 24",
719
+ fill: "none",
720
+ stroke: "currentColor",
721
+ strokeWidth: "2",
722
+ strokeLinecap: "round",
723
+ strokeLinejoin: "round",
724
+ children: [
725
+ /* @__PURE__ */ r("path", { d: "M12 17v5" }),
726
+ /* @__PURE__ */ r("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z" })
727
+ ]
728
+ }
729
+ ), U = ({ size: e = 14 }) => /* @__PURE__ */ b(
730
+ "svg",
731
+ {
732
+ width: e,
733
+ height: e,
734
+ viewBox: "0 0 24 24",
735
+ fill: "none",
736
+ stroke: "currentColor",
737
+ strokeWidth: "2",
738
+ strokeLinecap: "round",
739
+ strokeLinejoin: "round",
740
+ children: [
741
+ /* @__PURE__ */ r("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
742
+ /* @__PURE__ */ r("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
743
+ ]
744
+ }
745
+ ), q = ({ size: e = 14 }) => /* @__PURE__ */ r(
746
+ "svg",
747
+ {
748
+ width: e,
749
+ height: e,
750
+ viewBox: "0 0 24 24",
751
+ fill: "none",
752
+ stroke: "currentColor",
753
+ strokeWidth: "2.5",
754
+ strokeLinecap: "round",
755
+ strokeLinejoin: "round",
756
+ children: /* @__PURE__ */ r("polyline", { points: "20 6 9 17 4 12" })
757
+ }
758
+ ), J = ({ size: e = 14 }) => /* @__PURE__ */ b(
759
+ "svg",
760
+ {
761
+ width: e,
762
+ height: e,
763
+ viewBox: "0 0 24 24",
764
+ fill: "none",
765
+ stroke: "currentColor",
766
+ strokeWidth: "2",
767
+ strokeLinecap: "round",
768
+ strokeLinejoin: "round",
769
+ children: [
770
+ /* @__PURE__ */ r("polyline", { points: "3 6 5 6 21 6" }),
771
+ /* @__PURE__ */ r("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
772
+ ]
773
+ }
774
+ ), P = ({ size: e = 14 }) => /* @__PURE__ */ b(
775
+ "svg",
776
+ {
777
+ width: e,
778
+ height: e,
779
+ viewBox: "0 0 24 24",
780
+ fill: "none",
781
+ stroke: "currentColor",
782
+ strokeWidth: "2",
783
+ strokeLinecap: "round",
784
+ strokeLinejoin: "round",
785
+ children: [
786
+ /* @__PURE__ */ r("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
787
+ /* @__PURE__ */ r("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
788
+ ]
789
+ }
790
+ ), Q = ({ size: e = 14 }) => /* @__PURE__ */ b(
791
+ "svg",
792
+ {
793
+ width: e,
794
+ height: e,
795
+ viewBox: "0 0 24 24",
796
+ fill: "none",
797
+ stroke: "currentColor",
798
+ strokeWidth: "2",
799
+ strokeLinecap: "round",
800
+ strokeLinejoin: "round",
801
+ children: [
802
+ /* @__PURE__ */ r("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
803
+ /* @__PURE__ */ r("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
804
+ /* @__PURE__ */ r("line", { x1: "8", y1: "18", x2: "21", y2: "18" }),
805
+ /* @__PURE__ */ r("line", { x1: "3", y1: "6", x2: "3.01", y2: "6" }),
806
+ /* @__PURE__ */ r("line", { x1: "3", y1: "12", x2: "3.01", y2: "12" }),
807
+ /* @__PURE__ */ r("line", { x1: "3", y1: "18", x2: "3.01", y2: "18" })
808
+ ]
809
+ }
810
+ ), Z = ({ size: e = 14 }) => /* @__PURE__ */ b(
811
+ "svg",
812
+ {
813
+ width: e,
814
+ height: e,
815
+ viewBox: "0 0 24 24",
816
+ fill: "none",
817
+ stroke: "currentColor",
818
+ strokeWidth: "2",
819
+ strokeLinecap: "round",
820
+ strokeLinejoin: "round",
821
+ children: [
822
+ /* @__PURE__ */ r("line", { x1: "2", y1: "12", x2: "22", y2: "12" }),
823
+ /* @__PURE__ */ r("line", { x1: "12", y1: "2", x2: "12", y2: "22" }),
824
+ /* @__PURE__ */ r("path", { d: "m20 16-4-4 4-4" }),
825
+ /* @__PURE__ */ r("path", { d: "m4 8 4 4-4 4" }),
826
+ /* @__PURE__ */ r("path", { d: "m16 4-4 4-4-4" }),
827
+ /* @__PURE__ */ r("path", { d: "m8 20 4-4 4 4" })
828
+ ]
829
+ }
830
+ ), ee = ({
831
+ isInspectActive: e,
832
+ pinCount: t,
833
+ isTrayOpen: o,
834
+ freezeCountdown: a,
835
+ onToggleInspect: d,
836
+ onToggleTray: g,
837
+ onTriggerFreeze: n,
838
+ onCopyPrompt: l
839
+ }) => {
840
+ const [s, p] = k(!1), [v, f] = k(!1), y = () => {
841
+ l(), p(!0), setTimeout(() => {
842
+ p(!1);
843
+ }, 2200);
844
+ }, i = (m) => {
845
+ m.stopPropagation(), m.preventDefault();
846
+ };
847
+ return v || e || o || a !== null ? /* @__PURE__ */ b("div", { className: "arc-dock", onPointerDown: i, children: [
848
+ /* @__PURE__ */ b("div", { className: "arc-brand-pill", children: [
849
+ /* @__PURE__ */ r("span", { className: "arc-brand-dot" }),
850
+ /* @__PURE__ */ r("span", { children: "AgentLens" })
851
+ ] }),
852
+ /* @__PURE__ */ b(
853
+ "button",
854
+ {
855
+ type: "button",
856
+ className: `arc-btn ${e ? "arc-btn-active" : ""}`,
857
+ onPointerDown: i,
858
+ onClick: d,
859
+ title: "Inspect element (Hotkey: C or Option+C)",
860
+ children: [
861
+ /* @__PURE__ */ r(T, { size: 13 }),
862
+ /* @__PURE__ */ r("span", { children: e ? "Click Element..." : "Pin" })
863
+ ]
864
+ }
865
+ ),
866
+ /* @__PURE__ */ b(
867
+ "button",
868
+ {
869
+ type: "button",
870
+ className: `arc-btn ${a !== null ? "arc-btn-active" : ""}`,
871
+ onPointerDown: i,
872
+ onClick: n,
873
+ disabled: a !== null,
874
+ title: "3s Freeze countdown: open any popover or hover menu before inspection (Hotkey: Option+F)",
875
+ children: [
876
+ /* @__PURE__ */ r(Z, { size: 13 }),
877
+ /* @__PURE__ */ r("span", { children: a !== null ? `Freeze in ${a}s...` : "Freeze (3s)" })
878
+ ]
879
+ }
880
+ ),
881
+ /* @__PURE__ */ b(
882
+ "button",
883
+ {
884
+ type: "button",
885
+ className: `arc-btn ${o ? "arc-btn-active" : ""}`,
886
+ onPointerDown: i,
887
+ onClick: g,
888
+ title: "Review active pins",
889
+ children: [
890
+ /* @__PURE__ */ r(Q, { size: 13 }),
891
+ /* @__PURE__ */ r("span", { children: "Pins" }),
892
+ /* @__PURE__ */ r("span", { className: "arc-badge", children: t })
893
+ ]
894
+ }
895
+ ),
896
+ /* @__PURE__ */ r(
897
+ "button",
898
+ {
899
+ type: "button",
900
+ className: `arc-btn ${s ? "arc-btn-success" : "arc-btn-gradient"}`,
901
+ onPointerDown: i,
902
+ onClick: y,
903
+ disabled: t === 0,
904
+ style: {
905
+ opacity: t === 0 ? 0.5 : 1,
906
+ cursor: t === 0 ? "not-allowed" : "pointer"
907
+ },
908
+ title: t === 0 ? "Pin an element first" : "Copy prompt for AI agent",
909
+ children: s ? /* @__PURE__ */ b(S, { children: [
910
+ /* @__PURE__ */ r(q, { size: 13 }),
911
+ /* @__PURE__ */ r("span", { children: "Copied!" })
912
+ ] }) : /* @__PURE__ */ b(S, { children: [
913
+ /* @__PURE__ */ r(U, { size: 13 }),
914
+ /* @__PURE__ */ r("span", { children: "Copy Prompt" })
915
+ ] })
916
+ }
917
+ ),
918
+ /* @__PURE__ */ r(
919
+ "button",
920
+ {
921
+ type: "button",
922
+ className: "arc-btn-icon",
923
+ style: { width: "26px", height: "26px" },
924
+ onPointerDown: i,
925
+ onClick: () => f(!1),
926
+ title: "Collapse to bottom right",
927
+ children: /* @__PURE__ */ r(P, { size: 12 })
928
+ }
929
+ )
930
+ ] }) : /* @__PURE__ */ b(
931
+ "button",
932
+ {
933
+ type: "button",
934
+ className: "arc-launcher-btn",
935
+ onPointerDown: i,
936
+ onClick: () => f(!0),
937
+ title: "Open AgentLens (Hotkey: C or Option+C)",
938
+ children: [
939
+ /* @__PURE__ */ r(G, { size: 20 }),
940
+ t > 0 && /* @__PURE__ */ r("span", { className: "arc-launcher-badge", children: t })
941
+ ]
942
+ }
943
+ );
944
+ }, te = ({
945
+ isActive: e,
946
+ onSelectElement: t,
947
+ shadowHost: o
948
+ }) => {
949
+ const [a, d] = k(null), [g, n] = k(null);
950
+ if ($(() => {
951
+ if (!e) {
952
+ d(null), n(null);
953
+ return;
954
+ }
955
+ const v = (i) => {
956
+ const h = document.elementFromPoint(i.clientX, i.clientY);
957
+ if (!h || h === document.body || h === document.documentElement) {
958
+ d(null), n(null);
959
+ return;
960
+ }
961
+ if (o && (o.contains(h) || o === h))
962
+ return;
963
+ const m = h.getBoundingClientRect();
964
+ d(m), n(I(h));
965
+ }, f = (i) => {
966
+ o && (o.contains(i.target) || o === i.target) || (i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation());
967
+ }, y = (i) => {
968
+ if (o && (o.contains(i.target) || o === i.target))
969
+ return;
970
+ i.preventDefault(), i.stopPropagation(), i.stopImmediatePropagation();
971
+ const h = document.elementFromPoint(i.clientX, i.clientY);
972
+ !h || h === document.body || h === document.documentElement || (t(h), d(null), n(null));
973
+ };
974
+ return window.addEventListener("pointermove", v, { passive: !0, capture: !0 }), window.addEventListener("pointerdown", f, { capture: !0 }), window.addEventListener("mousedown", f, { capture: !0 }), window.addEventListener("click", y, { capture: !0 }), () => {
975
+ window.removeEventListener("pointermove", v, !0), window.removeEventListener("pointerdown", f, !0), window.removeEventListener("mousedown", f, !0), window.removeEventListener("click", y, !0);
976
+ };
977
+ }, [e, o, t]), !e || !a || !g) return null;
978
+ const l = g.componentName ? `<${g.componentName}>` : g.tagName, s = `${Math.round(a.width)}×${Math.round(a.height)}`, p = a.top > 32 ? -26 : a.height + 6;
979
+ return /* @__PURE__ */ r(
980
+ "div",
981
+ {
982
+ className: "arc-inspect-box",
983
+ style: {
984
+ top: `${a.top}px`,
985
+ left: `${a.left}px`,
986
+ width: `${a.width}px`,
987
+ height: `${a.height}px`
988
+ },
989
+ children: /* @__PURE__ */ b("div", { className: "arc-inspect-label", style: { top: `${p}px` }, children: [
990
+ /* @__PURE__ */ r("span", { children: l }),
991
+ /* @__PURE__ */ r("span", { className: "size", children: s })
992
+ ] })
993
+ }
994
+ );
995
+ }, re = ({ pin: e, isActive: t, onClick: o }) => {
996
+ const [a, d] = k(null), g = N(() => {
997
+ if (!e.targetElement || !e.targetElement.isConnected) {
998
+ d(null);
999
+ return;
1000
+ }
1001
+ const n = e.targetElement.getBoundingClientRect(), l = n.left + Math.min(16, n.width / 2), s = n.top + Math.min(16, n.height / 2);
1002
+ d({ x: l, y: s });
1003
+ }, [e.targetElement]);
1004
+ return $(() => {
1005
+ g();
1006
+ const n = () => g(), l = () => g();
1007
+ window.addEventListener("scroll", n, { passive: !0, capture: !0 }), window.addEventListener("resize", l, { passive: !0 });
1008
+ let s = null;
1009
+ return e.targetElement && typeof ResizeObserver < "u" && (s = new ResizeObserver(() => g()), s.observe(e.targetElement)), () => {
1010
+ window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", l), s == null || s.disconnect();
1011
+ };
1012
+ }, [g, e.targetElement]), a ? /* @__PURE__ */ r(
1013
+ "div",
1014
+ {
1015
+ className: `arc-pin-marker ${t ? "active" : ""}`,
1016
+ style: {
1017
+ left: `${a.x}px`,
1018
+ top: `${a.y}px`
1019
+ },
1020
+ onClick: (n) => {
1021
+ n.stopPropagation(), o();
1022
+ },
1023
+ title: `Pin #${e.number}: ${e.metadata.componentName || e.metadata.tagName}`,
1024
+ children: e.number
1025
+ }
1026
+ ) : null;
1027
+ }, ne = [
1028
+ { id: "style", label: "Style" },
1029
+ { id: "copy", label: "Copy" },
1030
+ { id: "layout", label: "Layout" },
1031
+ { id: "motion", label: "Motion" },
1032
+ { id: "bug", label: "Bug" }
1033
+ ], oe = ({ pin: e, onSave: t, onDelete: o, onClose: a }) => {
1034
+ var h;
1035
+ const [d, g] = k(e.instruction), [n, l] = k(e.category), s = D(null);
1036
+ $(() => {
1037
+ setTimeout(() => {
1038
+ var m;
1039
+ (m = s.current) == null || m.focus();
1040
+ }, 40);
1041
+ }, []);
1042
+ const p = (m) => {
1043
+ (m.metaKey || m.ctrlKey) && m.key === "Enter" ? (m.preventDefault(), t(d, n)) : m.key === "Escape" && (m.preventDefault(), a());
1044
+ }, v = (h = e.targetElement) == null ? void 0 : h.getBoundingClientRect(), f = v ? Math.min(window.innerHeight - 260, Math.max(16, v.top + 28)) : 100, y = v ? Math.min(window.innerWidth - 340, Math.max(16, v.left + 16)) : 100, i = e.metadata.componentName ? `<${e.metadata.componentName}>` : `<${e.metadata.tagName}>`;
1045
+ return /* @__PURE__ */ b(
1046
+ "div",
1047
+ {
1048
+ className: "arc-popover",
1049
+ style: {
1050
+ top: `${f}px`,
1051
+ left: `${y}px`
1052
+ },
1053
+ onClick: (m) => m.stopPropagation(),
1054
+ children: [
1055
+ /* @__PURE__ */ b("div", { className: "arc-popover-header", children: [
1056
+ /* @__PURE__ */ b("span", { className: "arc-component-badge", title: e.metadata.sourceFile || e.metadata.selector, children: [
1057
+ /* @__PURE__ */ b("span", { children: [
1058
+ "#",
1059
+ e.number
1060
+ ] }),
1061
+ /* @__PURE__ */ r("span", { children: "•" }),
1062
+ /* @__PURE__ */ r("span", { children: i })
1063
+ ] }),
1064
+ /* @__PURE__ */ r("button", { className: "arc-btn-icon", onClick: a, title: "Close", children: /* @__PURE__ */ r(P, { size: 12 }) })
1065
+ ] }),
1066
+ /* @__PURE__ */ r("div", { className: "arc-chips", children: ne.map((m) => /* @__PURE__ */ r(
1067
+ "button",
1068
+ {
1069
+ type: "button",
1070
+ className: `arc-chip ${n === m.id ? "selected" : ""}`,
1071
+ onClick: () => l(m.id),
1072
+ children: m.label
1073
+ },
1074
+ m.id
1075
+ )) }),
1076
+ /* @__PURE__ */ r(
1077
+ "textarea",
1078
+ {
1079
+ ref: s,
1080
+ className: "arc-textarea",
1081
+ placeholder: "Instructions for the agent (e.g. increase padding, rounded-full, change copy...)",
1082
+ value: d,
1083
+ onChange: (m) => g(m.target.value),
1084
+ onKeyDown: p
1085
+ }
1086
+ ),
1087
+ /* @__PURE__ */ b("div", { className: "arc-popover-footer", children: [
1088
+ /* @__PURE__ */ r(
1089
+ "button",
1090
+ {
1091
+ className: "arc-btn-icon danger",
1092
+ onClick: o,
1093
+ title: "Delete pin",
1094
+ children: /* @__PURE__ */ r(J, { size: 13 })
1095
+ }
1096
+ ),
1097
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: "8px" }, children: /* @__PURE__ */ r(
1098
+ "button",
1099
+ {
1100
+ type: "button",
1101
+ className: "arc-btn arc-btn-gradient",
1102
+ onClick: () => t(d, n),
1103
+ children: "Save Pin"
1104
+ }
1105
+ ) })
1106
+ ] })
1107
+ ]
1108
+ }
1109
+ );
1110
+ }, ae = ({
1111
+ pins: e,
1112
+ isOpen: t,
1113
+ onSelectPin: o,
1114
+ onDeletePin: a,
1115
+ onClearAll: d,
1116
+ onClose: g
1117
+ }) => t ? /* @__PURE__ */ b("div", { className: "arc-tray", onClick: (n) => n.stopPropagation(), children: [
1118
+ /* @__PURE__ */ b("div", { className: "arc-tray-header", children: [
1119
+ /* @__PURE__ */ b("div", { className: "arc-tray-title", children: [
1120
+ /* @__PURE__ */ r(T, { size: 13 }),
1121
+ /* @__PURE__ */ r("span", { children: "Active Pins" }),
1122
+ /* @__PURE__ */ r("span", { className: "arc-badge", children: e.length })
1123
+ ] }),
1124
+ /* @__PURE__ */ b("div", { style: { display: "flex", gap: "6px" }, children: [
1125
+ e.length > 0 && /* @__PURE__ */ r(
1126
+ "button",
1127
+ {
1128
+ type: "button",
1129
+ className: "arc-btn",
1130
+ style: { height: "24px", padding: "0 8px", fontSize: "11px" },
1131
+ onClick: d,
1132
+ children: "Clear All"
1133
+ }
1134
+ ),
1135
+ /* @__PURE__ */ r(
1136
+ "button",
1137
+ {
1138
+ type: "button",
1139
+ className: "arc-btn-icon",
1140
+ style: { width: "24px", height: "24px" },
1141
+ onClick: g,
1142
+ children: /* @__PURE__ */ r(P, { size: 12 })
1143
+ }
1144
+ )
1145
+ ] })
1146
+ ] }),
1147
+ /* @__PURE__ */ r("div", { className: "arc-tray-list", children: e.length === 0 ? /* @__PURE__ */ r("div", { style: { padding: "24px 12px", textAlign: "center", color: "#71717A", fontSize: "12px" }, children: "No pins yet. Press “Pin” (or hit C) to inspect an element." }) : e.map((n) => {
1148
+ const l = n.metadata.componentName ? `<${n.metadata.componentName}>` : `<${n.metadata.tagName}>`;
1149
+ return /* @__PURE__ */ b(
1150
+ "div",
1151
+ {
1152
+ className: "arc-tray-item",
1153
+ onClick: () => {
1154
+ var s;
1155
+ (s = n.targetElement) == null || s.scrollIntoView({ behavior: "smooth", block: "center" }), o(n);
1156
+ },
1157
+ children: [
1158
+ /* @__PURE__ */ b("div", { className: "arc-tray-item-left", children: [
1159
+ /* @__PURE__ */ r("div", { className: "arc-tray-pin-num", children: n.number }),
1160
+ /* @__PURE__ */ b("div", { className: "arc-tray-item-content", children: [
1161
+ /* @__PURE__ */ b("div", { className: "arc-tray-item-meta", children: [
1162
+ l,
1163
+ " • ",
1164
+ n.metadata.sourceFile || n.metadata.selector
1165
+ ] }),
1166
+ /* @__PURE__ */ r("div", { className: "arc-tray-item-text", children: n.instruction || /* @__PURE__ */ r("em", { children: "(No instruction provided)" }) })
1167
+ ] })
1168
+ ] }),
1169
+ /* @__PURE__ */ r(
1170
+ "button",
1171
+ {
1172
+ type: "button",
1173
+ className: "arc-btn-icon",
1174
+ style: { width: "24px", height: "24px", flexShrink: 0 },
1175
+ onClick: (s) => {
1176
+ s.stopPropagation(), a(n.id);
1177
+ },
1178
+ title: "Delete pin",
1179
+ children: /* @__PURE__ */ r(P, { size: 11 })
1180
+ }
1181
+ )
1182
+ ]
1183
+ },
1184
+ n.id
1185
+ );
1186
+ }) })
1187
+ ] }) : null, le = ({
1188
+ defaultCategory: e = "style",
1189
+ onPromptCopied: t
1190
+ }) => {
1191
+ const [o, a] = k(null), [d, g] = k(null), [n, l] = k([]), [s, p] = k(null), [v, f] = k(!1), [y, i] = k(!1), [h, m] = k(null), C = D(null);
1192
+ $(() => {
1193
+ const c = document.getElementById("agent-lens-host");
1194
+ c && c.remove();
1195
+ const u = document.createElement("div");
1196
+ u.id = "agent-lens-host", document.body.appendChild(u);
1197
+ const x = u.attachShadow({ mode: "open" }), w = document.createElement("style");
1198
+ w.textContent = X, x.appendChild(w);
1199
+ const F = document.createElement("div");
1200
+ return F.style.position = "relative", F.style.zIndex = "2147483647", x.appendChild(F), a(u), g(F), () => {
1201
+ u.remove();
1202
+ };
1203
+ }, []), $(() => {
1204
+ if (!o) return;
1205
+ const c = (u) => {
1206
+ const x = u.target;
1207
+ o && (o.contains(x) || o === x) && (u.stopPropagation(), u.stopImmediatePropagation());
1208
+ };
1209
+ return window.addEventListener("pointerdown", c, { capture: !0 }), window.addEventListener("mousedown", c, { capture: !0 }), () => {
1210
+ window.removeEventListener("pointerdown", c, !0), window.removeEventListener("mousedown", c, !0);
1211
+ };
1212
+ }, [o]), $(() => {
1213
+ const c = (u) => {
1214
+ const x = document.activeElement, w = (x == null ? void 0 : x.tagName) === "INPUT" || (x == null ? void 0 : x.tagName) === "TEXTAREA" || (x == null ? void 0 : x.isContentEditable), F = u.altKey;
1215
+ if (F && u.key.toLowerCase() === "c") {
1216
+ u.preventDefault(), f((E) => !E);
1217
+ return;
1218
+ }
1219
+ if (F && u.key.toLowerCase() === "f") {
1220
+ u.preventDefault(), z();
1221
+ return;
1222
+ }
1223
+ !w && u.key.toLowerCase() === "c" && !u.metaKey && !u.ctrlKey && !u.altKey ? (u.preventDefault(), f((E) => !E)) : u.key === "Escape" && (C.current && (clearInterval(C.current), C.current = null, m(null)), f(!1), p(null), i(!1));
1224
+ };
1225
+ return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
1226
+ }, []);
1227
+ const z = N(() => {
1228
+ C.current && clearInterval(C.current), m(3);
1229
+ let c = 3;
1230
+ C.current = setInterval(() => {
1231
+ c -= 1, c > 0 ? m(c) : (C.current && (clearInterval(C.current), C.current = null), m(null), f(!0));
1232
+ }, 1e3);
1233
+ }, []), j = N(
1234
+ (c) => {
1235
+ const u = I(c), x = n.length + 1, w = `pin-${Date.now()}`, F = {
1236
+ id: w,
1237
+ number: x,
1238
+ targetElement: c,
1239
+ category: e,
1240
+ instruction: "",
1241
+ createdAt: Date.now(),
1242
+ metadata: u
1243
+ };
1244
+ l((E) => [...E, F]), p(w), f(!1);
1245
+ },
1246
+ [n.length, e]
1247
+ ), R = N((c, u) => {
1248
+ l(
1249
+ (x) => x.map((w) => w.id === s ? { ...w, instruction: c, category: u } : w)
1250
+ ), p(null);
1251
+ }, [s]), A = N((c) => {
1252
+ l((u) => u.filter((w) => w.id !== c).map((w, F) => ({ ...w, number: F + 1 }))), p((u) => u === c ? null : u);
1253
+ }, []), M = N(() => {
1254
+ l([]), p(null), i(!1);
1255
+ }, []), B = N(() => {
1256
+ if (n.length === 0) return;
1257
+ const c = H(n);
1258
+ navigator.clipboard.writeText(c), t == null || t(c, n.length);
1259
+ }, [n, t]);
1260
+ if (!d) return null;
1261
+ const L = n.find((c) => c.id === s);
1262
+ return W(
1263
+ /* @__PURE__ */ b(S, { children: [
1264
+ /* @__PURE__ */ r(
1265
+ te,
1266
+ {
1267
+ isActive: v,
1268
+ onSelectElement: j,
1269
+ shadowHost: o
1270
+ }
1271
+ ),
1272
+ n.map((c) => /* @__PURE__ */ r(
1273
+ re,
1274
+ {
1275
+ pin: c,
1276
+ isActive: c.id === s,
1277
+ onClick: () => {
1278
+ p((u) => u === c.id ? null : c.id);
1279
+ }
1280
+ },
1281
+ c.id
1282
+ )),
1283
+ L && /* @__PURE__ */ r(
1284
+ oe,
1285
+ {
1286
+ pin: L,
1287
+ onSave: R,
1288
+ onDelete: () => A(L.id),
1289
+ onClose: () => p(null)
1290
+ }
1291
+ ),
1292
+ /* @__PURE__ */ r(
1293
+ ae,
1294
+ {
1295
+ pins: n,
1296
+ isOpen: y,
1297
+ onSelectPin: (c) => p(c.id),
1298
+ onDeletePin: A,
1299
+ onClearAll: M,
1300
+ onClose: () => i(!1)
1301
+ }
1302
+ ),
1303
+ /* @__PURE__ */ r(
1304
+ ee,
1305
+ {
1306
+ isInspectActive: v,
1307
+ pinCount: n.length,
1308
+ isTrayOpen: y,
1309
+ freezeCountdown: h,
1310
+ onToggleInspect: () => f((c) => !c),
1311
+ onToggleTray: () => i((c) => !c),
1312
+ onTriggerFreeze: z,
1313
+ onCopyPrompt: B
1314
+ }
1315
+ )
1316
+ ] }),
1317
+ d
1318
+ );
1319
+ };
1320
+ export {
1321
+ le as AgentLens,
1322
+ H as compileAgentPrompt,
1323
+ I as extractElementMetadata
1324
+ };