refinekit 0.2.1 → 0.4.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/README.md +26 -26
- package/dist/index.d.ts +4 -4
- package/dist/inspect-panel.d.ts +17 -0
- package/dist/overlay.d.ts +2 -0
- package/dist/{refiner.d.ts → refinekit.d.ts} +5 -3
- package/dist/refinekit.js +2 -0
- package/dist/refinekit.js.map +1 -0
- package/dist/refinekit.mjs +2 -0
- package/dist/refinekit.mjs.map +1 -0
- package/dist/styles.d.ts +1 -1
- package/dist/toolbar.d.ts +4 -0
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
- package/dist/refiner.js +0 -2
- package/dist/refiner.js.map +0 -1
- package/dist/refiner.mjs +0 -2
- package/dist/refiner.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Claude Code will add the script tag to your HTML files for you. You can also use
|
|
|
21
21
|
Add this line to your HTML file, just before the closing `</body>` tag:
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
|
-
<script src="https://unpkg.com/refinekit/dist/
|
|
24
|
+
<script src="https://unpkg.com/refinekit/dist/refinekit.js"></script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Open the file in your browser and the refinekit toolbar will appear in the bottom-right corner.
|
|
@@ -76,7 +76,7 @@ Issue: Change this color to blue and add more padding
|
|
|
76
76
|
Want Claude to review your page's design on its own? Type:
|
|
77
77
|
|
|
78
78
|
```
|
|
79
|
-
/
|
|
79
|
+
/refinekit-self-driving
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Claude opens your page in a browser and drives through it like a design reviewer — clicking elements, adding expert feedback on typography, spacing, colors, and layout. You watch it work in real time.
|
|
@@ -101,7 +101,7 @@ npx refinekit-mcp init
|
|
|
101
101
|
|
|
102
102
|
The most powerful setup uses two Claude Code sessions at once:
|
|
103
103
|
|
|
104
|
-
1. **Session 1** runs `/
|
|
104
|
+
1. **Session 1** runs `/refinekit-self-driving` — it reviews your page and adds design annotations
|
|
105
105
|
2. **Session 2** watches for those annotations and fixes the code to address each one
|
|
106
106
|
|
|
107
107
|
You watch Session 1 critique the design while Session 2 implements the fixes — fully hands-free.
|
|
@@ -119,9 +119,9 @@ npm install refinekit
|
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
```js
|
|
122
|
-
import {
|
|
122
|
+
import { RefineKit } from 'refinekit';
|
|
123
123
|
|
|
124
|
-
const
|
|
124
|
+
const refinekit = new RefineKit();
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
### Configuration
|
|
@@ -130,25 +130,25 @@ const refiner = new Refiner();
|
|
|
130
130
|
|
|
131
131
|
```html
|
|
132
132
|
<script
|
|
133
|
-
src="https://unpkg.com/refinekit/dist/
|
|
134
|
-
data-
|
|
135
|
-
data-
|
|
136
|
-
data-
|
|
137
|
-
data-
|
|
133
|
+
src="https://unpkg.com/refinekit/dist/refinekit.js"
|
|
134
|
+
data-refinekit-enabled="true"
|
|
135
|
+
data-refinekit-position="right"
|
|
136
|
+
data-refinekit-mcp-enabled="true"
|
|
137
|
+
data-refinekit-mcp-port="4848"
|
|
138
138
|
></script>
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
| Attribute | Values | Default | Description |
|
|
142
142
|
|-----------|--------|---------|-------------|
|
|
143
|
-
| `data-
|
|
144
|
-
| `data-
|
|
145
|
-
| `data-
|
|
146
|
-
| `data-
|
|
143
|
+
| `data-refinekit-enabled` | `true` / `false` | `true` | Whether to activate on load |
|
|
144
|
+
| `data-refinekit-position` | `left` / `right` | `right` | Which side of the viewport |
|
|
145
|
+
| `data-refinekit-mcp-enabled` | `true` / `false` | `true` | Auto-discover MCP server |
|
|
146
|
+
| `data-refinekit-mcp-port` | number | `4848` | MCP server HTTP port |
|
|
147
147
|
|
|
148
148
|
#### Constructor options
|
|
149
149
|
|
|
150
150
|
```js
|
|
151
|
-
const
|
|
151
|
+
const refinekit = new RefineKit({
|
|
152
152
|
enabled: true,
|
|
153
153
|
position: 'right',
|
|
154
154
|
mcpEnabled: true,
|
|
@@ -158,10 +158,10 @@ const refiner = new Refiner({
|
|
|
158
158
|
|
|
159
159
|
### JavaScript API
|
|
160
160
|
|
|
161
|
-
The instance is available at `window.
|
|
161
|
+
The instance is available at `window.__refinekit` when loaded via script tag.
|
|
162
162
|
|
|
163
163
|
```js
|
|
164
|
-
const r = window.
|
|
164
|
+
const r = window.__refinekit;
|
|
165
165
|
|
|
166
166
|
r.enable(); // show the toolbar and overlay
|
|
167
167
|
r.disable(); // hide everything
|
|
@@ -180,11 +180,11 @@ r.clearAnnotations(); // removes all annotations
|
|
|
180
180
|
|
|
181
181
|
| Tool | Description |
|
|
182
182
|
|------|-------------|
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
183
|
+
| `refinekit_list_sessions` | List all annotation sessions |
|
|
184
|
+
| `refinekit_get_all_pending` | Get all unresolved annotations |
|
|
185
|
+
| `refinekit_resolve` | Mark an annotation as resolved with a summary |
|
|
186
|
+
| `refinekit_dismiss` | Dismiss an annotation with a reason |
|
|
187
|
+
| `refinekit_watch_annotations` | Block until a new annotation arrives (for continuous watching) |
|
|
188
188
|
|
|
189
189
|
#### HTTP API
|
|
190
190
|
|
|
@@ -203,8 +203,8 @@ r.clearAnnotations(); // removes all annotations
|
|
|
203
203
|
|
|
204
204
|
| Variable | Default | Description |
|
|
205
205
|
|----------|---------|-------------|
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
206
|
+
| `REFINEKIT_PORT` | `4848` | HTTP server port |
|
|
207
|
+
| `REFINEKIT_STORE` | SQLite at `~/.refinekit/store.db` | Set to `memory` for in-memory storage |
|
|
208
208
|
|
|
209
209
|
#### Verify setup
|
|
210
210
|
|
|
@@ -215,9 +215,9 @@ npx refinekit-mcp doctor
|
|
|
215
215
|
### Installing Claude Code skills manually
|
|
216
216
|
|
|
217
217
|
```bash
|
|
218
|
-
# From the
|
|
218
|
+
# From the refinekit project directory
|
|
219
219
|
ln -sf "$(pwd)/skills/refinekit" ~/.claude/skills/refinekit
|
|
220
|
-
ln -sf "$(pwd)/skills/
|
|
220
|
+
ln -sf "$(pwd)/skills/refinekit-self-driving" ~/.claude/skills/refinekit-self-driving
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
Restart Claude Code after installing.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Annotation,
|
|
3
|
-
export {
|
|
4
|
-
export type { Annotation,
|
|
1
|
+
import { RefineKit } from './refinekit';
|
|
2
|
+
import type { Annotation, RefineKitOptions } from './types';
|
|
3
|
+
export { RefineKit };
|
|
4
|
+
export type { Annotation, RefineKitOptions };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class InspectPanel {
|
|
2
|
+
private root;
|
|
3
|
+
readonly el: HTMLElement;
|
|
4
|
+
private content;
|
|
5
|
+
private lastTarget;
|
|
6
|
+
private visible;
|
|
7
|
+
constructor(root: ShadowRoot);
|
|
8
|
+
show(target: Element, rect: DOMRect): void;
|
|
9
|
+
hide(): void;
|
|
10
|
+
isVisible(): boolean;
|
|
11
|
+
private extractProperties;
|
|
12
|
+
private addSpacingRows;
|
|
13
|
+
private addBorderRows;
|
|
14
|
+
private formatFontFamily;
|
|
15
|
+
private renderContent;
|
|
16
|
+
private position;
|
|
17
|
+
}
|
package/dist/overlay.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export declare class Overlay {
|
|
|
6
6
|
private blocking;
|
|
7
7
|
private currentTarget;
|
|
8
8
|
private highlightColor;
|
|
9
|
+
inspectMode: boolean;
|
|
9
10
|
onClick?: (target: Element, rect: DOMRect) => void;
|
|
11
|
+
onHoverChange?: (target: Element | null, rect: DOMRect | null) => void;
|
|
10
12
|
constructor(root: ShadowRoot);
|
|
11
13
|
private isOverOwnUI;
|
|
12
14
|
private handleMouseMove;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class
|
|
1
|
+
import { RefineKitOptions } from './types';
|
|
2
|
+
export declare class RefineKit {
|
|
3
3
|
private host;
|
|
4
4
|
private shadow;
|
|
5
5
|
private store;
|
|
@@ -8,11 +8,13 @@ export declare class Refiner {
|
|
|
8
8
|
private dialog;
|
|
9
9
|
private markers;
|
|
10
10
|
private settings;
|
|
11
|
+
private inspectPanel;
|
|
11
12
|
private mcpBridge;
|
|
12
13
|
private currentTarget;
|
|
13
14
|
private currentRect;
|
|
14
15
|
private clearOnCopy;
|
|
15
|
-
|
|
16
|
+
private inspectMode;
|
|
17
|
+
constructor(options?: RefineKitOptions);
|
|
16
18
|
enable(): void;
|
|
17
19
|
disable(): void;
|
|
18
20
|
destroy(): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var RefineKit=function(t){"use strict";class e{constructor(){this.annotations=new Map,this.listeners=new Map}add(t,e,n){const i={id:crypto.randomUUID(),targetSelector:t,targetRect:{x:e.x,y:e.y,width:e.width,height:e.height},text:n,timestamp:Date.now(),resolved:!1};return this.annotations.set(i.id,i),this.emit("add",i),i}resolve(t){const e=this.annotations.get(t);e&&(e.resolved=!0,this.emit("resolve",e))}remove(t){const e=this.annotations.get(t);e&&(this.annotations.delete(t),this.emit("remove",e))}get(t){return this.annotations.get(t)}getAll(){return Array.from(this.annotations.values())}getPending(){return this.getAll().filter(t=>!t.resolved)}getCount(){return this.annotations.size}exportJSON(){return JSON.stringify(this.getAll(),null,2)}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(e)}off(t,e){this.listeners.get(t)?.delete(e)}emit(t,e){this.listeners.get(t)?.forEach(t=>t(e))}}class n{constructor(t){this.root=t,this.collapsed=!0,this.inspectActive=!1,this.settingsOpen=!1,this.el=document.createElement("div"),this.el.className="refinekit-toolbar",this.el.setAttribute("data-refinekit-toolbar",""),this.el.setAttribute("data-collapsed","true"),this.render(),t.appendChild(this.el),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.collapsed=!1,this.el.setAttribute("data-collapsed","false"),this.updateBadgeVisibility()})})}render(){const t=document.createElement("div");t.className="toolbar-pill",this.innerEl=document.createElement("div"),this.innerEl.className="toolbar-inner",this.countBadge=document.createElement("span"),this.countBadge.className="toolbar-count",this.countBadge.textContent="0",this.innerEl.appendChild(this.createBtn(this.countBadge,"Annotations",null));const e='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';this.copyBtn=this.createBtn(e,"Copy annotations",()=>{this.copyBtn.classList.contains("disabled")||(this.onCopy?.(),this.copyBtn.querySelector(".toolbar-icon").innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>',setTimeout(()=>{this.copyBtn.querySelector(".toolbar-icon").innerHTML=e},1500))}),this.copyBtn.classList.add("disabled"),this.innerEl.appendChild(this.copyBtn),this.clearBtn=this.createBtn('<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="3 6 5 6 21 6"/><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"/></svg>',"Clear all",()=>{this.clearBtn.classList.contains("disabled")||this.onClear?.()}),this.clearBtn.classList.add("disabled"),this.innerEl.appendChild(this.clearBtn),this.inspectBtn=this.createBtn('<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>',"Inspect element",()=>{this.inspectActive=!this.inspectActive,this.inspectBtn.classList.toggle("active",this.inspectActive),this.onInspectToggle?.(this.inspectActive)}),this.innerEl.appendChild(this.inspectBtn),this.innerEl.appendChild(this.createBtn('<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',"Settings",()=>this.onSettings?.()));const n=document.createElement("div");n.className="toolbar-divider",this.innerEl.appendChild(n),t.appendChild(this.innerEl);const i='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>';this.toggleBtn=this.createBtn(i,"",()=>this.toggleCollapse()),this.toggleBtn.classList.add("toolbar-toggle-btn"),t.appendChild(this.toggleBtn),this.expandBadge=document.createElement("span"),this.expandBadge.className="toolbar-expand-badge hidden",this.expandBadge.textContent="0",t.appendChild(this.expandBadge),this.el.appendChild(t),this.el.addEventListener("transitionend",()=>{this.toggleBtn.querySelector(".toolbar-icon").innerHTML=this.collapsed?i:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>'})}createBtn(t,e,n){const i=document.createElement("button");i.className="toolbar-btn";const s=document.createElement("span");if(s.className="toolbar-icon","string"==typeof t?s.innerHTML=t:s.appendChild(t),i.appendChild(s),e){const t=document.createElement("span");t.className="toolbar-tooltip",t.textContent=e,i.appendChild(t)}return n&&i.addEventListener("click",n),i}toggleCollapse(){this.collapsed=!this.collapsed,this.el.setAttribute("data-collapsed",String(this.collapsed)),this.updateBadgeVisibility(),this.collapsed?this.onCollapse?.():this.onExpand?.()}setInspectActive(t){this.inspectActive=t,this.inspectBtn.classList.toggle("active",t)}setSettingsOpen(t){this.settingsOpen=t,this.el.classList.toggle("tooltips-hidden",t)}updateCount(t){this.countBadge.textContent=String(t),this.expandBadge.textContent=String(t),this.updateBadgeVisibility(t);const e=0===t;this.copyBtn.classList.toggle("disabled",e),this.clearBtn.classList.toggle("disabled",e)}updateBadgeVisibility(t){const e=t??parseInt(this.expandBadge.textContent||"0",10);this.expandBadge.classList.toggle("hidden",0===e||!this.collapsed)}}class i{constructor(t){this.root=t,this.enabled=!0,this.blocking=!0,this.currentTarget=null,this.highlightColor="#7C3AED",this.inspectMode=!1,this.handleMouseMove=t=>{if(!this.enabled)return;if(this.isOverOwnUI(t.clientX,t.clientY))return void this.hideHighlight();const e=this.getElementAt(t.clientX,t.clientY);e&&e!==this.currentTarget&&(this.currentTarget=e,this.showHighlight(e),this.onHoverChange?.(e,e.getBoundingClientRect()))},this.handleClick=t=>{if(!this.enabled)return;if(this.isOverOwnUI(t.clientX,t.clientY))return;if(t.preventDefault(),t.stopPropagation(),this.inspectMode)return;const e=this.getElementAt(t.clientX,t.clientY);if(e){const t=e.getBoundingClientRect();this.onClick?.(e,t)}},this.handleKeyBlock=t=>{if(!this.enabled||!this.blocking)return;const e=t.target;e&&(e===this.root.host||this.root.host.contains(e))||(t.preventDefault(),t.stopPropagation())},this.el=document.createElement("div"),this.el.className="refinekit-overlay",this.el.setAttribute("data-blocking","true"),this.highlight=document.createElement("div"),this.highlight.className="refinekit-highlight",this.highlight.style.display="none",t.appendChild(this.highlight),t.appendChild(this.el),this.el.addEventListener("mousemove",this.handleMouseMove),this.el.addEventListener("click",this.handleClick),this.el.addEventListener("mouseleave",()=>this.hideHighlight()),document.addEventListener("keydown",this.handleKeyBlock,!0)}isOverOwnUI(t,e){const n=this.root.elementFromPoint(t,e);return!!n&&(n!==this.el&&n!==this.highlight)}getElementAt(t,e){this.el.style.pointerEvents="none",this.highlight.style.pointerEvents="none";const n=document.elementFromPoint(t,e);return this.el.style.pointerEvents="",this.highlight.style.pointerEvents="",n&&n===this.root.host?null:n}showHighlight(t){const e=t.getBoundingClientRect();this.highlight.style.display="block",this.highlight.style.top=e.top-2+"px",this.highlight.style.left=e.left-2+"px",this.highlight.style.width=`${e.width+4}px`,this.highlight.style.height=`${e.height+4}px`,this.highlight.style.borderColor=this.highlightColor,this.highlight.style.borderStyle=this.inspectMode?"solid":"dashed"}hideHighlight(){this.highlight.style.display="none",this.currentTarget=null,this.onHoverChange?.(null,null)}setHighlightColor(t){this.highlightColor=t}setBlocking(t){this.blocking=t,this.el.setAttribute("data-blocking",String(t)),t||this.hideHighlight()}setEnabled(t){this.enabled=t,this.el.classList.toggle("hidden",!t),t||this.hideHighlight()}}class s{constructor(t){this.root=t,this.el=document.createElement("div"),this.el.className="refinekit-dialog hidden",this.render(),t.appendChild(this.el)}render(){const t=document.createElement("div");t.className="dialog-header";const e=document.createElement("span");e.textContent="What should change?",t.appendChild(e),this.el.appendChild(t),this.textarea=document.createElement("textarea"),this.textarea.className="dialog-textarea",this.textarea.placeholder="Describe the issue or improvement...",this.textarea.addEventListener("input",()=>{this.addBtn.disabled=0===this.textarea.value.trim().length}),this.textarea.addEventListener("keydown",t=>{"Enter"===t.key&&(t.metaKey||t.ctrlKey)&&this.textarea.value.trim()&&this.submit(),"Escape"===t.key&&(this.hide(),this.onCancel?.())}),this.el.appendChild(this.textarea);const n=document.createElement("div");n.className="dialog-actions";const i=document.createElement("button");i.className="dialog-btn dialog-btn-cancel",i.textContent="Cancel",i.addEventListener("click",()=>{this.hide(),this.onCancel?.()}),this.addBtn=document.createElement("button"),this.addBtn.className="dialog-btn dialog-btn-add",this.addBtn.textContent="Add",this.addBtn.disabled=!0,this.addBtn.addEventListener("click",()=>this.submit()),n.appendChild(i),n.appendChild(this.addBtn),this.el.appendChild(n)}submit(){const t=this.textarea.value.trim();t&&(this.onSubmit?.(t),this.hide())}show(t,e){let n=t+12,i=e+12;n+320>window.innerWidth-16&&(n=t-320-12),i+200>window.innerHeight-16&&(i=e-200-12),this.el.style.left=`${Math.max(16,n)}px`,this.el.style.top=`${Math.max(16,i)}px`,this.el.classList.remove("hidden"),this.textarea.value="",this.addBtn.disabled=!0,requestAnimationFrame(()=>this.textarea.focus())}hide(){this.el.classList.add("hidden"),this.textarea.value=""}isVisible(){return!this.el.classList.contains("hidden")}}class o{constructor(t,e){this.root=t,this.store=e,this.markers=new Map,this.rafId=null,this.color="#7C3AED",this.container=document.createElement("div"),this.container.className="refinekit-markers",t.appendChild(this.container),e.on("add",t=>this.addMarker(t)),e.on("resolve",t=>this.updateMarker(t)),e.on("remove",t=>this.removeMarker(t.id));const n=()=>this.repositionAll();window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n,{passive:!0})}addMarker(t){const e=document.createElement("div");e.className="refinekit-marker",e.setAttribute("data-annotation-marker",t.id),e.setAttribute("data-resolved",String(t.resolved)),e.style.background=this.color;const n=this.markers.size+1;e.textContent=String(n);const i=document.createElement("div");i.className="marker-tooltip";const s=document.createElement("div");s.textContent=t.text,i.appendChild(s);const o=document.createElement("div");o.className="marker-tooltip-actions";const a=document.createElement("button");a.className="marker-tooltip-btn resolve",a.textContent="Resolve",a.addEventListener("click",e=>{e.stopPropagation(),this.store.resolve(t.id)});const r=document.createElement("button");r.className="marker-tooltip-btn delete",r.textContent="Delete",r.addEventListener("click",e=>{e.stopPropagation(),this.store.remove(t.id)}),o.appendChild(a),o.appendChild(r),i.appendChild(o),e.appendChild(i),this.positionMarker(e,t),this.container.appendChild(e),this.markers.set(t.id,{el:e,annotation:t})}updateMarker(t){const e=this.markers.get(t.id);e&&(e.annotation=t,e.el.setAttribute("data-resolved",String(t.resolved)))}removeMarker(t){const e=this.markers.get(t);e&&(e.el.remove(),this.markers.delete(t),this.renumber())}renumber(){let t=1;for(const[,e]of this.markers){const n=e.el.childNodes[0];n&&n.nodeType===Node.TEXT_NODE&&(n.textContent=String(t)),t++}}positionMarker(t,e){const n=this.queryTarget(e.targetSelector);if(n){const e=n.getBoundingClientRect();t.style.top=e.top-8+"px",t.style.left=e.right-8+"px"}else t.style.top=e.targetRect.y-8+"px",t.style.left=e.targetRect.x+e.targetRect.width-8+"px"}queryTarget(t){try{return document.querySelector(t)}catch{return null}}setColor(t){this.color=t;for(const[,e]of this.markers)e.el.style.background=t}clearAll(){for(const[t]of this.markers)this.removeMarker(t)}repositionAll(){null===this.rafId&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;for(const[,t]of this.markers)this.positionMarker(t.el,t.annotation)}))}}const a=[{id:"purple",color:"#7C3AED"},{id:"blue",color:"#2563EB"},{id:"green",color:"#059669"},{id:"yellow",color:"#D97706"},{id:"orange",color:"#EA580C"},{id:"red",color:"#DC2626"},{id:"pink",color:"#DB2777"}];class r{constructor(t){this.root=t,this.visible=!1,this.settings={clearOnCopy:!1,blockInteractions:!0,markerColor:"#7C3AED"},this.el=document.createElement("div"),this.el.className="settings-panel hidden",this.render(),t.appendChild(this.el)}render(){const t=document.createElement("div");t.className="settings-header";const e=document.createElement("span");e.className="settings-title",e.textContent="refinekit";const n=document.createElement("span");n.className="settings-version",n.textContent="v0.1.0",t.appendChild(e),t.appendChild(n),this.el.appendChild(t),this.el.appendChild(this.createDivider());const i=document.createElement("div");i.className="settings-section";const s=document.createElement("span");s.className="settings-label",s.textContent="Marker Colour",i.appendChild(s);const o=document.createElement("div");o.className="settings-color-row";for(const t of a){const e=document.createElement("button");e.className="settings-swatch",e.style.background=t.color,e.setAttribute("data-color",t.color),t.color===this.settings.markerColor&&e.classList.add("selected"),e.addEventListener("click",()=>{o.querySelectorAll(".settings-swatch").forEach(t=>t.classList.remove("selected")),e.classList.add("selected"),this.settings.markerColor=t.color,this.emitChange()}),o.appendChild(e)}i.appendChild(o),this.el.appendChild(i),this.el.appendChild(this.createDivider()),this.el.appendChild(this.createCheckbox("Clear on copy",this.settings.clearOnCopy,t=>{this.settings.clearOnCopy=t,this.emitChange()})),this.el.appendChild(this.createCheckbox("Block page interactions",this.settings.blockInteractions,t=>{this.settings.blockInteractions=t,this.emitChange()})),this.el.appendChild(this.createDivider());const r=document.createElement("div");r.className="settings-mcp-row",this.mcpDot=document.createElement("span"),this.mcpDot.className="settings-mcp-dot disconnected",this.mcpLabel=document.createElement("span"),this.mcpLabel.className="settings-check-label",this.mcpLabel.textContent="MCP Disconnected",r.appendChild(this.mcpDot),r.appendChild(this.mcpLabel),this.el.appendChild(r)}createCheckbox(t,e,n){const i=document.createElement("label");i.className="settings-check-row";const s=document.createElement("input");s.type="checkbox",s.className="settings-checkbox",s.checked=e,s.addEventListener("change",()=>n(s.checked));const o=document.createElement("span");return o.className="settings-check-label",o.textContent=t,i.appendChild(s),i.appendChild(o),i}createDivider(){const t=document.createElement("div");return t.className="settings-divider",t}emitChange(){this.onChange?.({...this.settings})}toggle(){this.visible=!this.visible,this.el.classList.toggle("hidden",!this.visible)}hide(){this.visible=!1,this.el.classList.add("hidden")}isVisible(){return this.visible}setMcpStatus(t){this.mcpDot.className="settings-mcp-dot "+(t?"connected":"disconnected"),this.mcpLabel.textContent=t?"MCP Connected":"MCP Disconnected"}getSettings(){return{...this.settings}}}function l(t){if(t.id)return`#${CSS.escape(t.id)}`;if(t.classList.length>0){const e=`${t.tagName.toLowerCase()}.${Array.from(t.classList).map(CSS.escape).join(".")}`;if(1===document.querySelectorAll(e).length)return e}const e=[];let n=t;for(;n&&n!==document.documentElement;){const t=n.tagName.toLowerCase(),i=n.parentElement;if(n.id){e.unshift(`#${CSS.escape(n.id)}`);break}if(i){const s=Array.from(i.children).filter(t=>t.tagName===n.tagName);if(1===s.length)e.unshift(t);else{const i=s.indexOf(n)+1;e.unshift(`${t}:nth-child(${i})`)}}else e.unshift(t);n=i}return e.join(" > ")}class d{constructor(t,e=4848){this.store=t,this.sessionId=null,this.connected=!1,this.retryTimer=null,this.baseUrl=`http://localhost:${e}`,this.discover(),this.store.on("add",t=>this.postAnnotation(t)),this.store.on("resolve",t=>this.patchAnnotation(t))}async discover(){try{const t=await fetch(`${this.baseUrl}/health`),e=await t.json();e&&"object"==typeof e&&"status"in e&&"ok"===e.status&&(this.connected=!0,this.onChange?.(!0),await this.createSession(),this.stopRetry())}catch{this.connected=!1,this.onChange?.(!1),this.startRetry()}}startRetry(){this.retryTimer||(this.retryTimer=setInterval(()=>this.discover(),5e3))}stopRetry(){this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=null)}async createSession(){try{const t=await fetch(`${this.baseUrl}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:window.location.href,title:document.title||window.location.pathname})}),e=await t.json();this.sessionId=e.id}catch{}}async postAnnotation(t){if(this.connected&&this.sessionId)try{await fetch(`${this.baseUrl}/sessions/${this.sessionId}/annotations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetSelector:t.targetSelector,targetRect:t.targetRect,text:t.text})})}catch{}}async patchAnnotation(t){if(this.connected)try{await fetch(`${this.baseUrl}/annotations/${t.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:!0,summary:"Resolved from browser"})})}catch{}}isConnected(){return this.connected}destroy(){this.stopRetry()}}class h{constructor(t){this.root=t,this.lastTarget=null,this.visible=!1,this.el=document.createElement("div"),this.el.className="inspect-panel hidden",this.content=document.createElement("div"),this.el.appendChild(this.content),t.appendChild(this.el)}show(t,e){if(t===this.lastTarget)return void this.position(e);this.lastTarget=t;const n=window.getComputedStyle(t),i=this.extractProperties(t,n);this.renderContent(t,i),this.position(e),this.el.classList.remove("hidden"),this.visible=!0}hide(){this.el.classList.add("hidden"),this.visible=!1,this.lastTarget=null}isVisible(){return this.visible}extractProperties(t,e){const n=[],i=[{label:"font-family",value:this.formatFontFamily(e.fontFamily)},{label:"font-size",value:e.fontSize},{label:"font-weight",value:e.fontWeight},{label:"line-height",value:e.lineHeight},{label:"letter-spacing",value:e.letterSpacing},{label:"color",value:e.color,color:e.color}];n.push({title:"Typography",rows:i});const s=[];this.addSpacingRows(s,"padding",e),this.addSpacingRows(s,"margin",e),n.push({title:"Spacing",rows:s});const o=[];e.backgroundColor&&"rgba(0, 0, 0, 0)"!==e.backgroundColor&&o.push({label:"background",value:e.backgroundColor,color:e.backgroundColor}),o.length>0&&n.push({title:"Background",rows:o});const a=[];this.addBorderRows(a,e),e.borderRadius&&"0px"!==e.borderRadius&&a.push({label:"border-radius",value:e.borderRadius}),a.length>0&&n.push({title:"Border",rows:a});const r=[{label:"width",value:`${Math.round(t.getBoundingClientRect().width)}px`},{label:"height",value:`${Math.round(t.getBoundingClientRect().height)}px`},{label:"display",value:e.display},{label:"position",value:e.position}];return n.push({title:"Layout",rows:r}),n}addSpacingRows(t,e,n){const i=n.getPropertyValue(`${e}-top`),s=n.getPropertyValue(`${e}-right`),o=n.getPropertyValue(`${e}-bottom`),a=n.getPropertyValue(`${e}-left`);i===s&&s===o&&o===a?"0px"!==i&&t.push({label:e,value:i}):i===o&&a===s?t.push({label:e,value:`${i} ${s}`}):t.push({label:e,value:`${i} ${s} ${o} ${a}`})}addBorderRows(t,e){const n=e.borderTopWidth,i=e.borderTopStyle,s=e.borderTopColor;if("none"===i||"0px"===n)return;const o=e.borderRightWidth,a=e.borderRightStyle,r=e.borderRightColor,l=e.borderBottomWidth,d=e.borderBottomStyle,h=e.borderBottomColor,c=e.borderLeftWidth,p=e.borderLeftStyle,g=e.borderLeftColor;n===o&&o===l&&l===c&&i===a&&a===d&&d===p&&s===r&&r===h&&h===g?t.push({label:"border",value:`${n} ${i} ${s}`,color:s}):(t.push({label:"border-top",value:`${n} ${i} ${s}`,color:s}),t.push({label:"border-right",value:`${o} ${a} ${r}`,color:r}),t.push({label:"border-bottom",value:`${l} ${d} ${h}`,color:h}),t.push({label:"border-left",value:`${c} ${p} ${g}`,color:g}))}formatFontFamily(t){const e=t.split(",").map(t=>t.trim().replace(/^["']|["']$/g,""));return e.length<=2?e.join(", "):`${e[0]}, +${e.length-1}`}renderContent(t,e){this.content.innerHTML="";const n=document.createElement("div");n.className="inspect-element-tag",n.textContent=`<${t.tagName.toLowerCase()}>`,this.content.appendChild(n);const i=document.createElement("div");i.className="inspect-element-selector",i.textContent=l(t),this.content.appendChild(i);for(const t of e){const e=document.createElement("div");e.className="inspect-section-title",e.textContent=t.title,this.content.appendChild(e);for(const e of t.rows){const t=document.createElement("div");t.className="inspect-row";const n=document.createElement("span");n.className="inspect-row-label",n.textContent=e.label;const i=document.createElement("span");if(i.className="inspect-row-value",e.color){const t=document.createElement("span");t.className="inspect-color-swatch",t.style.background=e.color,i.appendChild(t)}i.appendChild(document.createTextNode(e.value)),t.appendChild(n),t.appendChild(i),t.addEventListener("click",n=>{n.stopPropagation(),navigator.clipboard.writeText(e.value),t.classList.add("copied"),setTimeout(()=>t.classList.remove("copied"),600)}),this.content.appendChild(t)}}}position(t){const e=280,n=this.el.offsetHeight||400,i=16;let s,o;s=t.right+12+e<window.innerWidth-i?t.right+12:t.left-12-e>i?t.left-12-e:Math.max(i,(window.innerWidth-e)/2),o=t.top,o+n>window.innerHeight-i&&(o=window.innerHeight-i-n),o=Math.max(i,o),this.el.style.left=`${s}px`,this.el.style.top=`${o}px`}}class c{constructor(t={}){this.mcpBridge=null,this.currentTarget=null,this.currentRect=null,this.clearOnCopy=!1,this.inspectMode=!1,this.host=document.createElement("div"),this.host.id="refinekit-host",this.shadow=this.host.attachShadow({mode:"open"});const a=document.createElement("style");a.textContent="\n :host {\n all: initial;\n position: fixed;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n z-index: 2147483647;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n font-size: 13px;\n line-height: 1.4;\n color: #1a1a2e;\n }\n\n *, *::before, *::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n /* ── Toolbar ── */\n\n .refinekit-toolbar {\n position: fixed;\n bottom: 24px;\n right: 24px;\n z-index: 10;\n user-select: none;\n }\n\n .toolbar-pill {\n display: flex;\n align-items: center;\n position: relative;\n background: #1a1a2e;\n border-radius: 100px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);\n padding: 6px;\n transform: scale(1);\n transform-origin: right center;\n transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .refinekit-toolbar[data-collapsed=\"true\"] .toolbar-pill {\n transform: scale(0.92);\n }\n\n .toolbar-inner {\n display: flex;\n align-items: center;\n gap: 2px;\n overflow: hidden;\n clip-path: inset(0);\n max-width: 300px;\n opacity: 1;\n padding-right: 2px;\n transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),\n opacity 0.2s ease 0.1s,\n padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .refinekit-toolbar[data-collapsed=\"true\"] .toolbar-inner {\n max-width: 0;\n opacity: 0;\n padding-right: 0;\n transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),\n opacity 0.15s ease,\n padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .toolbar-btn {\n position: relative;\n width: 36px;\n height: 36px;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: #a0a0b8;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: color 0.15s, background 0.15s;\n }\n\n .toolbar-btn:hover {\n color: #ffffff;\n background: rgba(255, 255, 255, 0.1);\n }\n\n .toolbar-btn.active {\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n }\n\n .toolbar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .toolbar-count {\n font-size: 14px;\n font-weight: 700;\n min-width: 18px;\n text-align: center;\n }\n\n .toolbar-divider {\n width: 1px;\n height: 20px;\n background: rgba(255, 255, 255, 0.15);\n margin: 0 4px;\n flex-shrink: 0;\n }\n\n /* Tooltip */\n .toolbar-tooltip {\n position: absolute;\n bottom: calc(100% + 10px);\n left: 50%;\n transform: translateX(-50%);\n padding: 6px 10px;\n background: #1a1a2e;\n color: #e8e8f0;\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n }\n\n .toolbar-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n border: 5px solid transparent;\n border-top-color: #1a1a2e;\n }\n\n .toolbar-btn:hover .toolbar-tooltip {\n opacity: 1;\n }\n\n .tooltips-hidden .toolbar-tooltip {\n display: none;\n }\n\n .toolbar-btn.disabled {\n opacity: 0.3;\n cursor: default;\n }\n\n .toolbar-btn.disabled:hover {\n color: #a0a0b8;\n background: transparent;\n }\n\n /* Toggle button (always visible) */\n .toolbar-toggle-btn {\n flex-shrink: 0;\n }\n\n /* Badge for collapsed state */\n .toolbar-expand-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n min-width: 20px;\n height: 20px;\n padding: 0 5px;\n border-radius: 10px;\n background: #DC2626;\n color: #ffffff;\n font-size: 11px;\n font-weight: 700;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);\n }\n\n .toolbar-expand-badge.hidden {\n display: none;\n }\n\n /* ── Settings Panel ── */\n\n .settings-panel {\n position: fixed;\n bottom: 80px;\n right: 24px;\n width: 300px;\n z-index: 12;\n background: #1a1a2e;\n border-radius: 16px;\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);\n padding: 20px;\n color: #e8e8f0;\n transform-origin: bottom right;\n transition: transform 0.25s ease, opacity 0.1s ease;\n transform: scale(1);\n opacity: 1;\n }\n\n .settings-panel.hidden {\n transform: scale(0.4);\n opacity: 0;\n pointer-events: none;\n }\n\n .settings-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n }\n\n .settings-title {\n font-size: 16px;\n font-weight: 700;\n font-style: normal;\n color: #ffffff;\n }\n\n .settings-version {\n font-size: 12px;\n color: #6b6b80;\n font-weight: 500;\n }\n\n .settings-divider {\n height: 1px;\n background: rgba(255, 255, 255, 0.08);\n margin: 16px 0;\n }\n\n .settings-section {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .settings-label {\n font-size: 14px;\n font-weight: 500;\n color: #c0c0d0;\n }\n\n .settings-color-row {\n display: flex;\n gap: 8px;\n }\n\n .settings-swatch {\n width: 24px;\n height: 24px;\n border-radius: 4px;\n border: 2px solid transparent;\n cursor: pointer;\n transition: transform 0.15s, border-color 0.15s;\n outline: none;\n }\n\n .settings-swatch:hover {\n transform: scale(1.1);\n }\n\n .settings-swatch.selected {\n border-color: #ffffff;\n transform: scale(1.1);\n }\n\n .settings-check-row {\n display: flex;\n align-items: center;\n gap: 10px;\n cursor: pointer;\n padding: 2px 0;\n }\n\n .settings-checkbox {\n appearance: none;\n -webkit-appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 5px;\n border: 2px solid #4a4a60;\n background: transparent;\n cursor: pointer;\n position: relative;\n flex-shrink: 0;\n transition: background 0.15s, border-color 0.15s;\n }\n\n .settings-checkbox:checked {\n background: #2563EB;\n border-color: #2563EB;\n }\n\n .settings-checkbox:checked::after {\n content: '';\n position: absolute;\n top: 2px;\n left: 5px;\n width: 5px;\n height: 9px;\n border: solid #ffffff;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .settings-check-label {\n font-size: 14px;\n font-weight: 500;\n color: #e8e8f0;\n }\n\n /* ── Overlay ── */\n\n .refinekit-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n cursor: crosshair;\n z-index: 1;\n }\n\n .refinekit-overlay[data-blocking=\"true\"] {\n pointer-events: all;\n }\n\n .refinekit-overlay[data-blocking=\"false\"] {\n pointer-events: none;\n }\n\n .refinekit-overlay.hidden {\n display: none;\n }\n\n /* ── Highlight ── */\n\n .refinekit-highlight {\n position: fixed;\n pointer-events: none;\n border: 2px dashed;\n border-radius: 3px;\n z-index: 2;\n transition: all 0.1s ease;\n }\n\n /* ── Dialog ── */\n\n .refinekit-dialog {\n position: fixed;\n width: 320px;\n background: #1a1a2e;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 14px;\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);\n padding: 16px;\n z-index: 11;\n color: #e8e8f0;\n animation: dialog-in 0.2s ease;\n }\n\n @keyframes dialog-in {\n from { opacity: 0; transform: translateY(4px) scale(0.98); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n\n .refinekit-dialog.hidden {\n display: none;\n }\n\n .dialog-header {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 12px;\n }\n\n .dialog-header span {\n font-size: 12px;\n font-weight: 600;\n color: #c0c0d0;\n }\n\n .dialog-textarea {\n width: 100%;\n min-height: 72px;\n padding: 10px 12px;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 10px;\n font-family: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: #e8e8f0;\n background: rgba(255, 255, 255, 0.06);\n resize: vertical;\n outline: none;\n transition: border-color 0.15s;\n }\n\n .dialog-textarea:focus {\n border-color: rgba(255, 255, 255, 0.25);\n }\n\n .dialog-textarea::placeholder {\n color: #6b6b80;\n }\n\n .dialog-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 12px;\n }\n\n .dialog-btn {\n height: 32px;\n padding: 0 14px;\n border-radius: 8px;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.15s;\n }\n\n .dialog-btn-cancel {\n background: transparent;\n border: 1px solid rgba(255, 255, 255, 0.12);\n color: #a0a0b8;\n }\n\n .dialog-btn-cancel:hover {\n background: rgba(255, 255, 255, 0.08);\n color: #e8e8f0;\n }\n\n .dialog-btn-add {\n background: #2563EB;\n border: none;\n color: #ffffff;\n }\n\n .dialog-btn-add:hover {\n background: #3B82F6;\n }\n\n .dialog-btn-add:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n }\n\n /* ── Markers ── */\n\n .refinekit-marker {\n position: fixed;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 11px;\n font-weight: 700;\n color: #ffffff;\n cursor: pointer;\n z-index: 10;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);\n transition: transform 0.15s;\n pointer-events: all;\n }\n\n .refinekit-marker:hover {\n transform: scale(1.2);\n }\n\n .refinekit-marker[data-resolved=\"true\"] {\n opacity: 0.4;\n }\n\n .marker-tooltip {\n position: absolute;\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n width: 220px;\n padding: 10px 12px;\n background: #1a1a2e;\n color: #e8e8f0;\n font-size: 12px;\n line-height: 1.4;\n border-radius: 10px;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .refinekit-marker:hover .marker-tooltip {\n opacity: 1;\n }\n\n .marker-tooltip-actions {\n display: flex;\n gap: 6px;\n margin-top: 8px;\n border-top: 1px solid rgba(255,255,255,0.1);\n padding-top: 8px;\n }\n\n .marker-tooltip-btn {\n height: 22px;\n padding: 0 8px;\n border-radius: 5px;\n border: none;\n font-size: 10px;\n font-weight: 600;\n cursor: pointer;\n transition: background 0.15s;\n }\n\n .marker-tooltip-btn.resolve {\n background: #34D399;\n color: #0a2e1f;\n }\n\n .marker-tooltip-btn.resolve:hover {\n background: #4ade80;\n }\n\n .marker-tooltip-btn.delete {\n background: rgba(255,255,255,0.1);\n color: #e8e8f0;\n }\n\n .marker-tooltip-btn.delete:hover {\n background: #FF6B6B;\n color: #fff;\n }\n\n /* MCP status */\n .settings-mcp-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 0;\n }\n\n .settings-mcp-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n }\n\n .settings-mcp-dot.connected {\n background: #34D399;\n box-shadow: 0 0 6px #34D39980;\n }\n\n .settings-mcp-dot.disconnected {\n background: #6B7280;\n }\n\n /* ── Inspect Panel ── */\n\n .inspect-panel {\n position: fixed;\n width: 280px;\n max-height: 80vh;\n overflow-y: auto;\n z-index: 13;\n background: #1a1a2e;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 14px;\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);\n padding: 16px;\n color: #e8e8f0;\n animation: dialog-in 0.15s ease;\n }\n\n .inspect-panel.hidden {\n display: none;\n }\n\n .inspect-element-tag {\n font-size: 12px;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n color: #2563EB;\n font-weight: 600;\n margin-bottom: 4px;\n }\n\n .inspect-element-selector {\n font-size: 11px;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n color: #6b6b80;\n margin-bottom: 12px;\n word-break: break-all;\n }\n\n .inspect-section-title {\n font-size: 10px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #6b6b80;\n margin-bottom: 6px;\n margin-top: 12px;\n }\n\n .inspect-section-title:first-child {\n margin-top: 0;\n }\n\n .inspect-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 4px 8px;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.1s;\n gap: 12px;\n }\n\n .inspect-row:hover {\n background: rgba(255, 255, 255, 0.06);\n }\n\n .inspect-row.copied {\n background: rgba(37, 99, 235, 0.2);\n }\n\n .inspect-row-label {\n font-size: 11px;\n color: #6b6b80;\n font-weight: 500;\n flex-shrink: 0;\n }\n\n .inspect-row-value {\n font-size: 12px;\n color: #e8e8f0;\n font-weight: 500;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n max-width: 160px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: right;\n }\n\n .inspect-color-swatch {\n display: inline-block;\n width: 12px;\n height: 12px;\n border-radius: 3px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n margin-right: 6px;\n vertical-align: middle;\n }\n\n .inspect-panel::-webkit-scrollbar {\n width: 4px;\n }\n\n .inspect-panel::-webkit-scrollbar-track {\n background: transparent;\n }\n\n .inspect-panel::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.1);\n border-radius: 2px;\n }\n",this.shadow.appendChild(a),this.store=new e,this.toolbar=new n(this.shadow),this.settings=new r(this.shadow),this.overlay=new i(this.shadow),this.dialog=new s(this.shadow),this.markers=new o(this.shadow,this.store),this.inspectPanel=new h(this.shadow),this.toolbar.onCopy=()=>this.copyAnnotations(),this.toolbar.onClear=()=>this.clearAnnotations(),this.toolbar.onSettings=()=>{this.settings.toggle(),this.toolbar.setSettingsOpen(this.settings.isVisible())},this.toolbar.onCollapse=()=>{this.settings.hide(),this.toolbar.setSettingsOpen(!1),this.overlay.setEnabled(!1),this.inspectMode=!1,this.overlay.inspectMode=!1,this.inspectPanel.hide(),this.toolbar.setInspectActive(!1)},this.toolbar.onExpand=()=>{this.overlay.setEnabled(!0)},this.toolbar.onInspectToggle=t=>{this.inspectMode=t,this.overlay.inspectMode=t,t||this.inspectPanel.hide(),t&&(this.settings.hide(),this.toolbar.setSettingsOpen(!1),this.dialog.hide())},this.overlay.onHoverChange=(t,e)=>{this.inspectMode&&t&&e?this.inspectPanel.show(t,e):this.inspectMode&&this.inspectPanel.hide()},this.settings.onChange=t=>{this.clearOnCopy=t.clearOnCopy,this.overlay.setBlocking(t.blockInteractions),this.markers.setColor(t.markerColor),this.overlay.setHighlightColor(t.markerColor)},this.overlay.onClick=(t,e)=>{if(this.settings.isVisible())return void this.settings.hide();if(this.dialog.isVisible())return void this.dialog.hide();this.currentTarget=t,this.currentRect=e;const n=e.left+e.width/2,i=e.top+e.height/2;this.dialog.show(n,i)},this.dialog.onSubmit=t=>{if(this.currentTarget&&this.currentRect){const e=l(this.currentTarget);this.store.add(e,this.currentRect,t),this.toolbar.updateCount(this.store.getCount())}this.currentTarget=null,this.currentRect=null},this.dialog.onCancel=()=>{this.currentTarget=null,this.currentRect=null},this.store.on("resolve",()=>this.toolbar.updateCount(this.store.getCount())),this.store.on("remove",()=>this.toolbar.updateCount(this.store.getCount())),!1!==t.mcpEnabled&&(this.mcpBridge=new d(this.store,t.mcpPort),this.mcpBridge.onChange=t=>{this.settings.setMcpStatus(t)}),document.body.appendChild(this.host),!1===t.enabled&&this.disable()}enable(){this.host.style.display="",this.overlay.setEnabled(!0)}disable(){this.host.style.display="none",this.overlay.setEnabled(!1)}destroy(){this.mcpBridge?.destroy(),this.host.remove()}getAnnotations(){return this.store.getAll()}getAnnotationCount(){return this.store.getCount()}formatForAgent(){const t=this.store.getAll();if(0===t.length)return"No annotations.";const e=document.title||window.location.pathname,n=window.location.pathname,i=[`# Design Annotations — ${e}`,`**File:** \`${n.substring(n.lastIndexOf("/")+1)||"index.html"}\``,""];for(let e=0;e<t.length;e++){const n=t[e],s=n.resolved?" (resolved)":"";i.push(`## ${e+1}.${s}`),i.push(`**Element:** \`${n.targetSelector}\``),i.push(`**Issue:** ${n.text}`),i.push("")}return i.join("\n")}clearAnnotations(){const t=this.store.getAll();for(const e of t)this.store.remove(e.id);this.toolbar.updateCount(0)}copyAnnotations(){const t=this.formatForAgent();navigator.clipboard.writeText(t),this.clearOnCopy&&this.clearAnnotations()}}if("undefined"!=typeof window&&"undefined"!=typeof document){const t=()=>{if(window.__refinekit)return;const t=document.currentScript,e=t?.dataset.refinekitPosition??"right",n="false"!==t?.dataset.refinekitEnabled,i=t?.dataset.refinekitMcpPort?parseInt(t.dataset.refinekitMcpPort,10):void 0,s="false"!==t?.dataset.refinekitMcpEnabled,o=new c({position:e,enabled:n,mcpPort:i,mcpEnabled:s});window.__refinekit=o};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}return t.RefineKit=c,t}({});
|
|
2
|
+
//# sourceMappingURL=refinekit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refinekit.js","sources":["../src/annotation-store.ts","../src/toolbar.ts","../src/overlay.ts","../src/annotation-dialog.ts","../src/annotation-marker.ts","../src/settings.ts","../src/selector.ts","../src/mcp-bridge.ts","../src/inspect-panel.ts","../src/refinekit.ts","../src/styles.ts","../src/index.ts"],"sourcesContent":["import { Annotation } from './types';\n\ntype Listener = (annotation: Annotation) => void;\n\nexport class AnnotationStore {\n private annotations: Map<string, Annotation> = new Map();\n private listeners: Map<string, Set<Listener>> = new Map();\n\n add(targetSelector: string, targetRect: DOMRect, text: string): Annotation {\n const annotation: Annotation = {\n id: crypto.randomUUID(),\n targetSelector,\n targetRect: {\n x: targetRect.x,\n y: targetRect.y,\n width: targetRect.width,\n height: targetRect.height,\n },\n text,\n timestamp: Date.now(),\n resolved: false,\n };\n this.annotations.set(annotation.id, annotation);\n this.emit('add', annotation);\n return annotation;\n }\n\n resolve(id: string): void {\n const annotation = this.annotations.get(id);\n if (annotation) {\n annotation.resolved = true;\n this.emit('resolve', annotation);\n }\n }\n\n remove(id: string): void {\n const annotation = this.annotations.get(id);\n if (annotation) {\n this.annotations.delete(id);\n this.emit('remove', annotation);\n }\n }\n\n get(id: string): Annotation | undefined {\n return this.annotations.get(id);\n }\n\n getAll(): Annotation[] {\n return Array.from(this.annotations.values());\n }\n\n getPending(): Annotation[] {\n return this.getAll().filter((a) => !a.resolved);\n }\n\n getCount(): number {\n return this.annotations.size;\n }\n\n exportJSON(): string {\n return JSON.stringify(this.getAll(), null, 2);\n }\n\n on(event: string, listener: Listener): void {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event)!.add(listener);\n }\n\n off(event: string, listener: Listener): void {\n this.listeners.get(event)?.delete(listener);\n }\n\n private emit(event: string, annotation: Annotation): void {\n this.listeners.get(event)?.forEach((fn) => fn(annotation));\n }\n}\n","export class Toolbar {\n readonly el: HTMLElement;\n private collapsed = true;\n private countBadge!: HTMLElement;\n private expandBadge!: HTMLElement;\n private innerEl!: HTMLElement;\n private copyBtn!: HTMLElement;\n private clearBtn!: HTMLElement;\n private toggleBtn!: HTMLElement;\n private inspectBtn!: HTMLElement;\n private inspectActive = false;\n private settingsOpen = false;\n\n onCopy?: () => void;\n onClear?: () => void;\n onSettings?: () => void;\n onCollapse?: () => void;\n onExpand?: () => void;\n onInspectToggle?: (active: boolean) => void;\n\n constructor(private root: ShadowRoot) {\n this.el = document.createElement('div');\n this.el.className = 'refinekit-toolbar';\n this.el.setAttribute('data-refinekit-toolbar', '');\n this.el.setAttribute('data-collapsed', 'true');\n this.render();\n root.appendChild(this.el);\n\n // Expand on first load after a short delay\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this.collapsed = false;\n this.el.setAttribute('data-collapsed', 'false');\n this.updateBadgeVisibility();\n });\n });\n }\n\n private render(): void {\n const pill = document.createElement('div');\n pill.className = 'toolbar-pill';\n\n // Inner (collapsible buttons)\n this.innerEl = document.createElement('div');\n this.innerEl.className = 'toolbar-inner';\n\n // Note count\n this.countBadge = document.createElement('span');\n this.countBadge.className = 'toolbar-count';\n this.countBadge.textContent = '0';\n this.innerEl.appendChild(this.createBtn(\n this.countBadge,\n 'Annotations',\n null,\n ));\n\n // Copy\n const copyIcon = `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>`;\n const checkIcon = `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg>`;\n this.copyBtn = this.createBtn(\n copyIcon,\n 'Copy annotations',\n () => {\n if (this.copyBtn.classList.contains('disabled')) return;\n this.onCopy?.();\n this.copyBtn.querySelector('.toolbar-icon')!.innerHTML = checkIcon;\n setTimeout(() => {\n this.copyBtn.querySelector('.toolbar-icon')!.innerHTML = copyIcon;\n }, 1500);\n },\n );\n this.copyBtn.classList.add('disabled');\n this.innerEl.appendChild(this.copyBtn);\n\n // Clear all\n this.clearBtn = this.createBtn(\n `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><polyline points=\"3 6 5 6 21 6\"/><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\"/></svg>`,\n 'Clear all',\n () => {\n if (this.clearBtn.classList.contains('disabled')) return;\n this.onClear?.();\n },\n );\n this.clearBtn.classList.add('disabled');\n this.innerEl.appendChild(this.clearBtn);\n\n // Inspect\n this.inspectBtn = this.createBtn(\n `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/></svg>`,\n 'Inspect element',\n () => {\n this.inspectActive = !this.inspectActive;\n this.inspectBtn.classList.toggle('active', this.inspectActive);\n this.onInspectToggle?.(this.inspectActive);\n },\n );\n this.innerEl.appendChild(this.inspectBtn);\n\n // Settings\n this.innerEl.appendChild(this.createBtn(\n `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z\"/></svg>`,\n 'Settings',\n () => this.onSettings?.(),\n ));\n\n // Divider\n const divider = document.createElement('div');\n divider.className = 'toolbar-divider';\n this.innerEl.appendChild(divider);\n\n pill.appendChild(this.innerEl);\n\n // Toggle button (always visible — pen when collapsed, X when expanded)\n const penIcon = `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><path d=\"M12 20h9\"/><path d=\"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z\"/></svg>`;\n const xIcon = `<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>`;\n\n this.toggleBtn = this.createBtn(\n penIcon,\n '',\n () => this.toggleCollapse(),\n );\n this.toggleBtn.classList.add('toolbar-toggle-btn');\n pill.appendChild(this.toggleBtn);\n\n // Badge for collapsed state\n this.expandBadge = document.createElement('span');\n this.expandBadge.className = 'toolbar-expand-badge hidden';\n this.expandBadge.textContent = '0';\n pill.appendChild(this.expandBadge);\n\n this.el.appendChild(pill);\n\n // Update toggle icon on transition end\n this.el.addEventListener('transitionend', () => {\n const icon = this.toggleBtn.querySelector('.toolbar-icon')!;\n icon.innerHTML = this.collapsed ? penIcon : xIcon;\n });\n }\n\n private createBtn(content: string | HTMLElement, tooltip: string, onClick: (() => void) | null): HTMLElement {\n const btn = document.createElement('button');\n btn.className = 'toolbar-btn';\n\n const iconWrap = document.createElement('span');\n iconWrap.className = 'toolbar-icon';\n if (typeof content === 'string') {\n iconWrap.innerHTML = content;\n } else {\n iconWrap.appendChild(content);\n }\n btn.appendChild(iconWrap);\n\n if (tooltip) {\n const tip = document.createElement('span');\n tip.className = 'toolbar-tooltip';\n tip.textContent = tooltip;\n btn.appendChild(tip);\n }\n\n if (onClick) {\n btn.addEventListener('click', onClick);\n }\n\n return btn;\n }\n\n private toggleCollapse(): void {\n this.collapsed = !this.collapsed;\n this.el.setAttribute('data-collapsed', String(this.collapsed));\n this.updateBadgeVisibility();\n if (this.collapsed) {\n this.onCollapse?.();\n } else {\n this.onExpand?.();\n }\n }\n\n setInspectActive(active: boolean): void {\n this.inspectActive = active;\n this.inspectBtn.classList.toggle('active', active);\n }\n\n setSettingsOpen(open: boolean): void {\n this.settingsOpen = open;\n this.el.classList.toggle('tooltips-hidden', open);\n }\n\n updateCount(count: number): void {\n this.countBadge.textContent = String(count);\n this.expandBadge.textContent = String(count);\n this.updateBadgeVisibility(count);\n\n const empty = count === 0;\n this.copyBtn.classList.toggle('disabled', empty);\n this.clearBtn.classList.toggle('disabled', empty);\n }\n\n private updateBadgeVisibility(count?: number): void {\n const c = count ?? parseInt(this.expandBadge.textContent || '0', 10);\n this.expandBadge.classList.toggle('hidden', c === 0 || !this.collapsed);\n }\n}\n","export class Overlay {\n readonly el: HTMLElement;\n private highlight: HTMLElement;\n private enabled = true;\n private blocking = true;\n private currentTarget: Element | null = null;\n private highlightColor = '#7C3AED';\n\n inspectMode = false;\n\n onClick?: (target: Element, rect: DOMRect) => void;\n onHoverChange?: (target: Element | null, rect: DOMRect | null) => void;\n\n constructor(private root: ShadowRoot) {\n this.el = document.createElement('div');\n this.el.className = 'refinekit-overlay';\n this.el.setAttribute('data-blocking', 'true');\n\n this.highlight = document.createElement('div');\n this.highlight.className = 'refinekit-highlight';\n this.highlight.style.display = 'none';\n\n root.appendChild(this.highlight);\n root.appendChild(this.el);\n\n this.el.addEventListener('mousemove', this.handleMouseMove);\n this.el.addEventListener('click', this.handleClick);\n this.el.addEventListener('mouseleave', () => this.hideHighlight());\n\n document.addEventListener('keydown', this.handleKeyBlock, true);\n }\n\n private isOverOwnUI(x: number, y: number): boolean {\n const shadowEl = this.root.elementFromPoint(x, y);\n if (!shadowEl) return false;\n if (shadowEl === this.el || shadowEl === this.highlight) return false;\n return true;\n }\n\n private handleMouseMove = (e: MouseEvent): void => {\n if (!this.enabled) return;\n if (this.isOverOwnUI(e.clientX, e.clientY)) {\n this.hideHighlight();\n return;\n }\n\n const target = this.getElementAt(e.clientX, e.clientY);\n if (target && target !== this.currentTarget) {\n this.currentTarget = target;\n this.showHighlight(target);\n this.onHoverChange?.(target, target.getBoundingClientRect());\n }\n };\n\n private handleClick = (e: MouseEvent): void => {\n if (!this.enabled) return;\n if (this.isOverOwnUI(e.clientX, e.clientY)) return;\n\n e.preventDefault();\n e.stopPropagation();\n\n if (this.inspectMode) return;\n\n const target = this.getElementAt(e.clientX, e.clientY);\n if (target) {\n const rect = target.getBoundingClientRect();\n this.onClick?.(target, rect);\n }\n };\n\n private handleKeyBlock = (e: KeyboardEvent): void => {\n if (!this.enabled || !this.blocking) return;\n // Allow keys when focus is inside refinekit's own UI (e.g. annotation dialog textarea)\n const target = e.target as Element;\n if (target && (target === this.root.host || this.root.host.contains(target))) return;\n\n e.preventDefault();\n e.stopPropagation();\n };\n\n private getElementAt(x: number, y: number): Element | null {\n this.el.style.pointerEvents = 'none';\n this.highlight.style.pointerEvents = 'none';\n\n const el = document.elementFromPoint(x, y);\n\n this.el.style.pointerEvents = '';\n this.highlight.style.pointerEvents = '';\n\n if (el && el === this.root.host) return null;\n return el;\n }\n\n private showHighlight(target: Element): void {\n const rect = target.getBoundingClientRect();\n this.highlight.style.display = 'block';\n this.highlight.style.top = `${rect.top - 2}px`;\n this.highlight.style.left = `${rect.left - 2}px`;\n this.highlight.style.width = `${rect.width + 4}px`;\n this.highlight.style.height = `${rect.height + 4}px`;\n this.highlight.style.borderColor = this.highlightColor;\n this.highlight.style.borderStyle = this.inspectMode ? 'solid' : 'dashed';\n }\n\n private hideHighlight(): void {\n this.highlight.style.display = 'none';\n this.currentTarget = null;\n this.onHoverChange?.(null, null);\n }\n\n setHighlightColor(color: string): void {\n this.highlightColor = color;\n }\n\n setBlocking(blocking: boolean): void {\n this.blocking = blocking;\n this.el.setAttribute('data-blocking', String(blocking));\n if (!blocking) {\n this.hideHighlight();\n }\n }\n\n setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.el.classList.toggle('hidden', !enabled);\n if (!enabled) this.hideHighlight();\n }\n}\n","export class AnnotationDialog {\n readonly el: HTMLElement;\n private textarea!: HTMLTextAreaElement;\n private addBtn!: HTMLButtonElement;\n\n onSubmit?: (text: string) => void;\n onCancel?: () => void;\n\n constructor(private root: ShadowRoot) {\n this.el = document.createElement('div');\n this.el.className = 'refinekit-dialog hidden';\n this.render();\n root.appendChild(this.el);\n }\n\n private render(): void {\n // Header\n const header = document.createElement('div');\n header.className = 'dialog-header';\n const label = document.createElement('span');\n label.textContent = 'What should change?';\n header.appendChild(label);\n this.el.appendChild(header);\n\n // Textarea\n this.textarea = document.createElement('textarea');\n this.textarea.className = 'dialog-textarea';\n this.textarea.placeholder = 'Describe the issue or improvement...';\n this.textarea.addEventListener('input', () => {\n this.addBtn.disabled = this.textarea.value.trim().length === 0;\n });\n this.textarea.addEventListener('keydown', (e) => {\n if (e.key === 'Enter' && (e.metaKey || e.ctrlKey) && this.textarea.value.trim()) {\n this.submit();\n }\n if (e.key === 'Escape') {\n this.hide();\n this.onCancel?.();\n }\n });\n this.el.appendChild(this.textarea);\n\n // Actions\n const actions = document.createElement('div');\n actions.className = 'dialog-actions';\n\n const cancelBtn = document.createElement('button');\n cancelBtn.className = 'dialog-btn dialog-btn-cancel';\n cancelBtn.textContent = 'Cancel';\n cancelBtn.addEventListener('click', () => {\n this.hide();\n this.onCancel?.();\n });\n\n this.addBtn = document.createElement('button');\n this.addBtn.className = 'dialog-btn dialog-btn-add';\n this.addBtn.textContent = 'Add';\n this.addBtn.disabled = true;\n this.addBtn.addEventListener('click', () => this.submit());\n\n actions.appendChild(cancelBtn);\n actions.appendChild(this.addBtn);\n this.el.appendChild(actions);\n }\n\n private submit(): void {\n const text = this.textarea.value.trim();\n if (text) {\n this.onSubmit?.(text);\n this.hide();\n }\n }\n\n show(x: number, y: number): void {\n // Position: prefer below-right of click, but keep on screen\n const dialogW = 320;\n const dialogH = 200;\n let left = x + 12;\n let top = y + 12;\n\n if (left + dialogW > window.innerWidth - 16) {\n left = x - dialogW - 12;\n }\n if (top + dialogH > window.innerHeight - 16) {\n top = y - dialogH - 12;\n }\n\n this.el.style.left = `${Math.max(16, left)}px`;\n this.el.style.top = `${Math.max(16, top)}px`;\n this.el.classList.remove('hidden');\n\n this.textarea.value = '';\n this.addBtn.disabled = true;\n requestAnimationFrame(() => this.textarea.focus());\n }\n\n hide(): void {\n this.el.classList.add('hidden');\n this.textarea.value = '';\n }\n\n isVisible(): boolean {\n return !this.el.classList.contains('hidden');\n }\n}\n","import { Annotation } from './types';\nimport { AnnotationStore } from './annotation-store';\n\ninterface MarkerElement {\n el: HTMLElement;\n annotation: Annotation;\n}\n\nexport class AnnotationMarkers {\n private markers: Map<string, MarkerElement> = new Map();\n private container: HTMLElement;\n private rafId: number | null = null;\n private color = '#7C3AED';\n\n constructor(private root: ShadowRoot, private store: AnnotationStore) {\n this.container = document.createElement('div');\n this.container.className = 'refinekit-markers';\n root.appendChild(this.container);\n\n store.on('add', (annotation) => this.addMarker(annotation));\n store.on('resolve', (annotation) => this.updateMarker(annotation));\n store.on('remove', (annotation) => this.removeMarker(annotation.id));\n\n const reposition = () => this.repositionAll();\n window.addEventListener('scroll', reposition, { passive: true });\n window.addEventListener('resize', reposition, { passive: true });\n }\n\n private addMarker(annotation: Annotation): void {\n const el = document.createElement('div');\n el.className = 'refinekit-marker';\n el.setAttribute('data-annotation-marker', annotation.id);\n el.setAttribute('data-resolved', String(annotation.resolved));\n el.style.background = this.color;\n\n const index = this.markers.size + 1;\n el.textContent = String(index);\n\n // Tooltip\n const tooltip = document.createElement('div');\n tooltip.className = 'marker-tooltip';\n\n const tooltipText = document.createElement('div');\n tooltipText.textContent = annotation.text;\n tooltip.appendChild(tooltipText);\n\n const tooltipActions = document.createElement('div');\n tooltipActions.className = 'marker-tooltip-actions';\n\n const resolveBtn = document.createElement('button');\n resolveBtn.className = 'marker-tooltip-btn resolve';\n resolveBtn.textContent = 'Resolve';\n resolveBtn.addEventListener('click', (e) => {\n e.stopPropagation();\n this.store.resolve(annotation.id);\n });\n\n const deleteBtn = document.createElement('button');\n deleteBtn.className = 'marker-tooltip-btn delete';\n deleteBtn.textContent = 'Delete';\n deleteBtn.addEventListener('click', (e) => {\n e.stopPropagation();\n this.store.remove(annotation.id);\n });\n\n tooltipActions.appendChild(resolveBtn);\n tooltipActions.appendChild(deleteBtn);\n tooltip.appendChild(tooltipActions);\n el.appendChild(tooltip);\n\n this.positionMarker(el, annotation);\n this.container.appendChild(el);\n this.markers.set(annotation.id, { el, annotation });\n }\n\n private updateMarker(annotation: Annotation): void {\n const marker = this.markers.get(annotation.id);\n if (marker) {\n marker.annotation = annotation;\n marker.el.setAttribute('data-resolved', String(annotation.resolved));\n }\n }\n\n private removeMarker(id: string): void {\n const marker = this.markers.get(id);\n if (marker) {\n marker.el.remove();\n this.markers.delete(id);\n this.renumber();\n }\n }\n\n private renumber(): void {\n let i = 1;\n for (const [, marker] of this.markers) {\n const firstText = marker.el.childNodes[0];\n if (firstText && firstText.nodeType === Node.TEXT_NODE) {\n firstText.textContent = String(i);\n }\n i++;\n }\n }\n\n private positionMarker(el: HTMLElement, annotation: Annotation): void {\n const target = this.queryTarget(annotation.targetSelector);\n if (target) {\n const rect = target.getBoundingClientRect();\n el.style.top = `${rect.top - 8}px`;\n el.style.left = `${rect.right - 8}px`;\n } else {\n el.style.top = `${annotation.targetRect.y - 8}px`;\n el.style.left = `${annotation.targetRect.x + annotation.targetRect.width - 8}px`;\n }\n }\n\n private queryTarget(selector: string): Element | null {\n try {\n return document.querySelector(selector);\n } catch {\n return null;\n }\n }\n\n setColor(color: string): void {\n this.color = color;\n for (const [, marker] of this.markers) {\n marker.el.style.background = color;\n }\n }\n\n clearAll(): void {\n for (const [id] of this.markers) {\n this.removeMarker(id);\n }\n }\n\n private repositionAll(): void {\n if (this.rafId !== null) return;\n this.rafId = requestAnimationFrame(() => {\n this.rafId = null;\n for (const [, marker] of this.markers) {\n this.positionMarker(marker.el, marker.annotation);\n }\n });\n }\n}\n","const MARKER_COLORS = [\n { id: 'purple', color: '#7C3AED' },\n { id: 'blue', color: '#2563EB' },\n { id: 'green', color: '#059669' },\n { id: 'yellow', color: '#D97706' },\n { id: 'orange', color: '#EA580C' },\n { id: 'red', color: '#DC2626' },\n { id: 'pink', color: '#DB2777' },\n];\n\nexport interface Settings {\n clearOnCopy: boolean;\n blockInteractions: boolean;\n markerColor: string;\n}\n\nexport class SettingsPanel {\n readonly el: HTMLElement;\n private visible = false;\n private mcpDot!: HTMLElement;\n private mcpLabel!: HTMLElement;\n private settings: Settings = {\n clearOnCopy: false,\n blockInteractions: true,\n markerColor: '#7C3AED',\n };\n\n onChange?: (settings: Settings) => void;\n\n constructor(private root: ShadowRoot) {\n this.el = document.createElement('div');\n this.el.className = 'settings-panel hidden';\n this.render();\n root.appendChild(this.el);\n }\n\n private render(): void {\n // Header\n const header = document.createElement('div');\n header.className = 'settings-header';\n const title = document.createElement('span');\n title.className = 'settings-title';\n title.textContent = 'refinekit';\n const version = document.createElement('span');\n version.className = 'settings-version';\n version.textContent = 'v0.1.0';\n header.appendChild(title);\n header.appendChild(version);\n this.el.appendChild(header);\n\n this.el.appendChild(this.createDivider());\n\n // Marker color\n const colorSection = document.createElement('div');\n colorSection.className = 'settings-section';\n const colorLabel = document.createElement('span');\n colorLabel.className = 'settings-label';\n colorLabel.textContent = 'Marker Colour';\n colorSection.appendChild(colorLabel);\n\n const colorRow = document.createElement('div');\n colorRow.className = 'settings-color-row';\n for (const mc of MARKER_COLORS) {\n const swatch = document.createElement('button');\n swatch.className = 'settings-swatch';\n swatch.style.background = mc.color;\n swatch.setAttribute('data-color', mc.color);\n if (mc.color === this.settings.markerColor) {\n swatch.classList.add('selected');\n }\n swatch.addEventListener('click', () => {\n colorRow.querySelectorAll('.settings-swatch').forEach((s) =>\n s.classList.remove('selected')\n );\n swatch.classList.add('selected');\n this.settings.markerColor = mc.color;\n this.emitChange();\n });\n colorRow.appendChild(swatch);\n }\n colorSection.appendChild(colorRow);\n this.el.appendChild(colorSection);\n\n this.el.appendChild(this.createDivider());\n\n // Clear on copy\n this.el.appendChild(this.createCheckbox(\n 'Clear on copy',\n this.settings.clearOnCopy,\n (checked) => {\n this.settings.clearOnCopy = checked;\n this.emitChange();\n },\n ));\n\n // Block page interactions\n this.el.appendChild(this.createCheckbox(\n 'Block page interactions',\n this.settings.blockInteractions,\n (checked) => {\n this.settings.blockInteractions = checked;\n this.emitChange();\n },\n ));\n\n this.el.appendChild(this.createDivider());\n\n // MCP status\n const mcpRow = document.createElement('div');\n mcpRow.className = 'settings-mcp-row';\n\n this.mcpDot = document.createElement('span');\n this.mcpDot.className = 'settings-mcp-dot disconnected';\n\n this.mcpLabel = document.createElement('span');\n this.mcpLabel.className = 'settings-check-label';\n this.mcpLabel.textContent = 'MCP Disconnected';\n\n mcpRow.appendChild(this.mcpDot);\n mcpRow.appendChild(this.mcpLabel);\n this.el.appendChild(mcpRow);\n }\n\n private createCheckbox(label: string, initial: boolean, onChange: (v: boolean) => void): HTMLElement {\n const row = document.createElement('label');\n row.className = 'settings-check-row';\n\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.className = 'settings-checkbox';\n checkbox.checked = initial;\n checkbox.addEventListener('change', () => onChange(checkbox.checked));\n\n const text = document.createElement('span');\n text.className = 'settings-check-label';\n text.textContent = label;\n\n row.appendChild(checkbox);\n row.appendChild(text);\n return row;\n }\n\n private createDivider(): HTMLElement {\n const div = document.createElement('div');\n div.className = 'settings-divider';\n return div;\n }\n\n private emitChange(): void {\n this.onChange?.({ ...this.settings });\n }\n\n toggle(): void {\n this.visible = !this.visible;\n this.el.classList.toggle('hidden', !this.visible);\n }\n\n hide(): void {\n this.visible = false;\n this.el.classList.add('hidden');\n }\n\n isVisible(): boolean {\n return this.visible;\n }\n\n setMcpStatus(connected: boolean): void {\n this.mcpDot.className = `settings-mcp-dot ${connected ? 'connected' : 'disconnected'}`;\n this.mcpLabel.textContent = connected ? 'MCP Connected' : 'MCP Disconnected';\n }\n\n getSettings(): Settings {\n return { ...this.settings };\n }\n}\n","/**\n * Generate a stable CSS selector for a DOM element.\n * Priority: #id > tag.class > nth-child path\n */\nexport function generateSelector(el: Element): string {\n if (el.id) {\n return `#${CSS.escape(el.id)}`;\n }\n\n // Try tag + distinctive class\n if (el.classList.length > 0) {\n const tag = el.tagName.toLowerCase();\n const classSelector = `${tag}.${Array.from(el.classList).map(CSS.escape).join('.')}`;\n if (document.querySelectorAll(classSelector).length === 1) {\n return classSelector;\n }\n }\n\n // Build nth-child path\n const parts: string[] = [];\n let current: Element | null = el;\n\n while (current && current !== document.documentElement) {\n const tag = current.tagName.toLowerCase();\n const parent: Element | null = current.parentElement;\n\n if (current.id) {\n parts.unshift(`#${CSS.escape(current.id)}`);\n break;\n }\n\n if (parent) {\n const siblings = Array.from(parent.children).filter(\n (c: Element) => c.tagName === current!.tagName\n );\n if (siblings.length === 1) {\n parts.unshift(tag);\n } else {\n const index = siblings.indexOf(current) + 1;\n parts.unshift(`${tag}:nth-child(${index})`);\n }\n } else {\n parts.unshift(tag);\n }\n\n current = parent;\n }\n\n return parts.join(' > ');\n}\n","import { AnnotationStore } from './annotation-store';\nimport { Annotation } from './types';\n\nexport class McpBridge {\n private baseUrl: string;\n private sessionId: string | null = null;\n private connected = false;\n private retryTimer: ReturnType<typeof setInterval> | null = null;\n\n onChange?: (connected: boolean) => void;\n\n constructor(\n private store: AnnotationStore,\n port: number = 4848,\n ) {\n this.baseUrl = `http://localhost:${port}`;\n this.discover();\n\n // Wire up store events\n this.store.on('add', (annotation) => this.postAnnotation(annotation));\n this.store.on('resolve', (annotation) => this.patchAnnotation(annotation));\n }\n\n private async discover(): Promise<void> {\n try {\n const res = await fetch(`${this.baseUrl}/health`);\n const data = await res.json();\n if (data && typeof data === 'object' && 'status' in data && data.status === 'ok') {\n this.connected = true;\n this.onChange?.(true);\n await this.createSession();\n this.stopRetry();\n }\n } catch {\n this.connected = false;\n this.onChange?.(false);\n this.startRetry();\n }\n }\n\n private startRetry(): void {\n if (this.retryTimer) return;\n this.retryTimer = setInterval(() => this.discover(), 5000);\n }\n\n private stopRetry(): void {\n if (this.retryTimer) {\n clearInterval(this.retryTimer);\n this.retryTimer = null;\n }\n }\n\n private async createSession(): Promise<void> {\n try {\n const res = await fetch(`${this.baseUrl}/sessions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n url: window.location.href,\n title: document.title || window.location.pathname,\n }),\n });\n const session = await res.json();\n this.sessionId = session.id;\n } catch {\n // Session creation failed — annotations won't sync but local still works\n }\n }\n\n private async postAnnotation(annotation: Annotation): Promise<void> {\n if (!this.connected || !this.sessionId) return;\n\n try {\n await fetch(`${this.baseUrl}/sessions/${this.sessionId}/annotations`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n targetSelector: annotation.targetSelector,\n targetRect: annotation.targetRect,\n text: annotation.text,\n }),\n });\n } catch {\n // Silently fail — local annotation still exists\n }\n }\n\n private async patchAnnotation(annotation: Annotation): Promise<void> {\n if (!this.connected) return;\n\n try {\n await fetch(`${this.baseUrl}/annotations/${annotation.id}`, {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n resolved: true,\n summary: 'Resolved from browser',\n }),\n });\n } catch {\n // Silently fail\n }\n }\n\n isConnected(): boolean {\n return this.connected;\n }\n\n destroy(): void {\n this.stopRetry();\n }\n}\n","import { generateSelector } from './selector';\n\ninterface PropertyRow {\n label: string;\n value: string;\n color?: string; // if set, show a color swatch\n}\n\ninterface PropertySection {\n title: string;\n rows: PropertyRow[];\n}\n\nexport class InspectPanel {\n readonly el: HTMLElement;\n private content: HTMLElement;\n private lastTarget: Element | null = null;\n private visible = false;\n\n constructor(private root: ShadowRoot) {\n this.el = document.createElement('div');\n this.el.className = 'inspect-panel hidden';\n\n this.content = document.createElement('div');\n this.el.appendChild(this.content);\n\n root.appendChild(this.el);\n }\n\n show(target: Element, rect: DOMRect): void {\n if (target === this.lastTarget) {\n this.position(rect);\n return;\n }\n this.lastTarget = target;\n\n const style = window.getComputedStyle(target);\n const sections = this.extractProperties(target, style);\n this.renderContent(target, sections);\n this.position(rect);\n\n this.el.classList.remove('hidden');\n this.visible = true;\n }\n\n hide(): void {\n this.el.classList.add('hidden');\n this.visible = false;\n this.lastTarget = null;\n }\n\n isVisible(): boolean {\n return this.visible;\n }\n\n private extractProperties(target: Element, style: CSSStyleDeclaration): PropertySection[] {\n const sections: PropertySection[] = [];\n\n // Typography\n const typoRows: PropertyRow[] = [\n { label: 'font-family', value: this.formatFontFamily(style.fontFamily) },\n { label: 'font-size', value: style.fontSize },\n { label: 'font-weight', value: style.fontWeight },\n { label: 'line-height', value: style.lineHeight },\n { label: 'letter-spacing', value: style.letterSpacing },\n { label: 'color', value: style.color, color: style.color },\n ];\n sections.push({ title: 'Typography', rows: typoRows });\n\n // Spacing\n const spacingRows: PropertyRow[] = [];\n this.addSpacingRows(spacingRows, 'padding', style);\n this.addSpacingRows(spacingRows, 'margin', style);\n sections.push({ title: 'Spacing', rows: spacingRows });\n\n // Background\n const bgRows: PropertyRow[] = [];\n if (style.backgroundColor && style.backgroundColor !== 'rgba(0, 0, 0, 0)') {\n bgRows.push({ label: 'background', value: style.backgroundColor, color: style.backgroundColor });\n }\n if (bgRows.length > 0) {\n sections.push({ title: 'Background', rows: bgRows });\n }\n\n // Border\n const borderRows: PropertyRow[] = [];\n this.addBorderRows(borderRows, style);\n if (style.borderRadius && style.borderRadius !== '0px') {\n borderRows.push({ label: 'border-radius', value: style.borderRadius });\n }\n if (borderRows.length > 0) {\n sections.push({ title: 'Border', rows: borderRows });\n }\n\n // Layout\n const layoutRows: PropertyRow[] = [\n { label: 'width', value: `${Math.round(target.getBoundingClientRect().width)}px` },\n { label: 'height', value: `${Math.round(target.getBoundingClientRect().height)}px` },\n { label: 'display', value: style.display },\n { label: 'position', value: style.position },\n ];\n sections.push({ title: 'Layout', rows: layoutRows });\n\n return sections;\n }\n\n private addSpacingRows(rows: PropertyRow[], prop: 'padding' | 'margin', style: CSSStyleDeclaration): void {\n const top = style.getPropertyValue(`${prop}-top`);\n const right = style.getPropertyValue(`${prop}-right`);\n const bottom = style.getPropertyValue(`${prop}-bottom`);\n const left = style.getPropertyValue(`${prop}-left`);\n\n if (top === right && right === bottom && bottom === left) {\n if (top !== '0px') {\n rows.push({ label: prop, value: top });\n }\n } else if (top === bottom && left === right) {\n rows.push({ label: prop, value: `${top} ${right}` });\n } else {\n rows.push({ label: prop, value: `${top} ${right} ${bottom} ${left}` });\n }\n }\n\n private addBorderRows(rows: PropertyRow[], style: CSSStyleDeclaration): void {\n const tw = style.borderTopWidth;\n const ts = style.borderTopStyle;\n const tc = style.borderTopColor;\n\n if (ts === 'none' || tw === '0px') return;\n\n const rw = style.borderRightWidth;\n const rs = style.borderRightStyle;\n const rc = style.borderRightColor;\n const bw = style.borderBottomWidth;\n const bs = style.borderBottomStyle;\n const bc = style.borderBottomColor;\n const lw = style.borderLeftWidth;\n const ls = style.borderLeftStyle;\n const lc = style.borderLeftColor;\n\n if (tw === rw && rw === bw && bw === lw &&\n ts === rs && rs === bs && bs === ls &&\n tc === rc && rc === bc && bc === lc) {\n rows.push({ label: 'border', value: `${tw} ${ts} ${tc}`, color: tc });\n } else {\n rows.push({ label: 'border-top', value: `${tw} ${ts} ${tc}`, color: tc });\n rows.push({ label: 'border-right', value: `${rw} ${rs} ${rc}`, color: rc });\n rows.push({ label: 'border-bottom', value: `${bw} ${bs} ${bc}`, color: bc });\n rows.push({ label: 'border-left', value: `${lw} ${ls} ${lc}`, color: lc });\n }\n }\n\n private formatFontFamily(value: string): string {\n const fonts = value.split(',').map(f => f.trim().replace(/^[\"']|[\"']$/g, ''));\n if (fonts.length <= 2) return fonts.join(', ');\n return `${fonts[0]}, +${fonts.length - 1}`;\n }\n\n private renderContent(target: Element, sections: PropertySection[]): void {\n this.content.innerHTML = '';\n\n // Element header\n const tag = document.createElement('div');\n tag.className = 'inspect-element-tag';\n tag.textContent = `<${target.tagName.toLowerCase()}>`;\n this.content.appendChild(tag);\n\n const sel = document.createElement('div');\n sel.className = 'inspect-element-selector';\n sel.textContent = generateSelector(target);\n this.content.appendChild(sel);\n\n // Sections\n for (const section of sections) {\n const title = document.createElement('div');\n title.className = 'inspect-section-title';\n title.textContent = section.title;\n this.content.appendChild(title);\n\n for (const row of section.rows) {\n const rowEl = document.createElement('div');\n rowEl.className = 'inspect-row';\n\n const labelEl = document.createElement('span');\n labelEl.className = 'inspect-row-label';\n labelEl.textContent = row.label;\n\n const valueEl = document.createElement('span');\n valueEl.className = 'inspect-row-value';\n\n if (row.color) {\n const swatch = document.createElement('span');\n swatch.className = 'inspect-color-swatch';\n swatch.style.background = row.color;\n valueEl.appendChild(swatch);\n }\n\n valueEl.appendChild(document.createTextNode(row.value));\n\n rowEl.appendChild(labelEl);\n rowEl.appendChild(valueEl);\n\n rowEl.addEventListener('click', (e) => {\n e.stopPropagation();\n navigator.clipboard.writeText(row.value);\n rowEl.classList.add('copied');\n setTimeout(() => rowEl.classList.remove('copied'), 600);\n });\n\n this.content.appendChild(rowEl);\n }\n }\n }\n\n private position(rect: DOMRect): void {\n const panelW = 280;\n const panelH = this.el.offsetHeight || 400;\n const gap = 12;\n const margin = 16;\n\n let left: number;\n let top: number;\n\n // Prefer right side of element\n if (rect.right + gap + panelW < window.innerWidth - margin) {\n left = rect.right + gap;\n } else if (rect.left - gap - panelW > margin) {\n // Fall back to left side\n left = rect.left - gap - panelW;\n } else {\n // Center horizontally as last resort\n left = Math.max(margin, (window.innerWidth - panelW) / 2);\n }\n\n // Align top with element, clamp to viewport\n top = rect.top;\n if (top + panelH > window.innerHeight - margin) {\n top = window.innerHeight - margin - panelH;\n }\n top = Math.max(margin, top);\n\n this.el.style.left = `${left}px`;\n this.el.style.top = `${top}px`;\n }\n}\n","import { RefineKitOptions } from './types';\nimport { STYLES } from './styles';\nimport { AnnotationStore } from './annotation-store';\nimport { Toolbar } from './toolbar';\nimport { Overlay } from './overlay';\nimport { AnnotationDialog } from './annotation-dialog';\nimport { AnnotationMarkers } from './annotation-marker';\nimport { SettingsPanel } from './settings';\nimport { generateSelector } from './selector';\nimport { McpBridge } from './mcp-bridge';\nimport { InspectPanel } from './inspect-panel';\n\nexport class RefineKit {\n private host: HTMLDivElement;\n private shadow: ShadowRoot;\n private store: AnnotationStore;\n private toolbar: Toolbar;\n private overlay: Overlay;\n private dialog: AnnotationDialog;\n private markers: AnnotationMarkers;\n private settings: SettingsPanel;\n private inspectPanel: InspectPanel;\n private mcpBridge: McpBridge | null = null;\n private currentTarget: Element | null = null;\n private currentRect: DOMRect | null = null;\n private clearOnCopy = false;\n private inspectMode = false;\n\n constructor(options: RefineKitOptions = {}) {\n // Create shadow host\n this.host = document.createElement('div');\n this.host.id = 'refinekit-host';\n this.shadow = this.host.attachShadow({ mode: 'open' });\n\n // Inject styles\n const style = document.createElement('style');\n style.textContent = STYLES;\n this.shadow.appendChild(style);\n\n // Initialize components\n this.store = new AnnotationStore();\n this.toolbar = new Toolbar(this.shadow);\n this.settings = new SettingsPanel(this.shadow);\n this.overlay = new Overlay(this.shadow);\n this.dialog = new AnnotationDialog(this.shadow);\n this.markers = new AnnotationMarkers(this.shadow, this.store);\n this.inspectPanel = new InspectPanel(this.shadow);\n\n // Wire up toolbar\n this.toolbar.onCopy = () => this.copyAnnotations();\n this.toolbar.onClear = () => this.clearAnnotations();\n this.toolbar.onSettings = () => {\n this.settings.toggle();\n this.toolbar.setSettingsOpen(this.settings.isVisible());\n };\n\n this.toolbar.onCollapse = () => {\n this.settings.hide();\n this.toolbar.setSettingsOpen(false);\n this.overlay.setEnabled(false);\n this.inspectMode = false;\n this.overlay.inspectMode = false;\n this.inspectPanel.hide();\n this.toolbar.setInspectActive(false);\n };\n\n this.toolbar.onExpand = () => {\n this.overlay.setEnabled(true);\n };\n\n this.toolbar.onInspectToggle = (active) => {\n this.inspectMode = active;\n this.overlay.inspectMode = active;\n if (!active) this.inspectPanel.hide();\n if (active) {\n this.settings.hide();\n this.toolbar.setSettingsOpen(false);\n this.dialog.hide();\n }\n };\n\n this.overlay.onHoverChange = (target, rect) => {\n if (this.inspectMode && target && rect) {\n this.inspectPanel.show(target, rect);\n } else if (this.inspectMode) {\n this.inspectPanel.hide();\n }\n };\n\n // Wire up settings\n this.settings.onChange = (s) => {\n this.clearOnCopy = s.clearOnCopy;\n this.overlay.setBlocking(s.blockInteractions);\n this.markers.setColor(s.markerColor);\n this.overlay.setHighlightColor(s.markerColor);\n };\n\n // Wire up overlay click (disabled in inspect mode via overlay.ts)\n this.overlay.onClick = (target, rect) => {\n if (this.settings.isVisible()) {\n this.settings.hide();\n return;\n }\n if (this.dialog.isVisible()) {\n this.dialog.hide();\n return;\n }\n this.currentTarget = target;\n this.currentRect = rect;\n const centerX = rect.left + rect.width / 2;\n const centerY = rect.top + rect.height / 2;\n this.dialog.show(centerX, centerY);\n };\n\n // Wire up dialog submit\n this.dialog.onSubmit = (text) => {\n if (this.currentTarget && this.currentRect) {\n const selector = generateSelector(this.currentTarget);\n this.store.add(selector, this.currentRect, text);\n this.toolbar.updateCount(this.store.getCount());\n }\n this.currentTarget = null;\n this.currentRect = null;\n };\n\n this.dialog.onCancel = () => {\n this.currentTarget = null;\n this.currentRect = null;\n };\n\n // Update count on resolve/remove\n this.store.on('resolve', () => this.toolbar.updateCount(this.store.getCount()));\n this.store.on('remove', () => this.toolbar.updateCount(this.store.getCount()));\n\n // MCP bridge (auto-discover by default)\n if (options.mcpEnabled !== false) {\n this.mcpBridge = new McpBridge(this.store, options.mcpPort);\n this.mcpBridge.onChange = (connected) => {\n this.settings.setMcpStatus(connected);\n };\n }\n\n // Mount\n document.body.appendChild(this.host);\n\n if (options.enabled === false) {\n this.disable();\n }\n }\n\n enable(): void {\n this.host.style.display = '';\n this.overlay.setEnabled(true);\n }\n\n disable(): void {\n this.host.style.display = 'none';\n this.overlay.setEnabled(false);\n }\n\n destroy(): void {\n this.mcpBridge?.destroy();\n this.host.remove();\n }\n\n getAnnotations() {\n return this.store.getAll();\n }\n\n getAnnotationCount(): number {\n return this.store.getCount();\n }\n\n formatForAgent(): string {\n const annotations = this.store.getAll();\n if (annotations.length === 0) return 'No annotations.';\n\n const pageTitle = document.title || window.location.pathname;\n const pathname = window.location.pathname;\n const filename = pathname.substring(pathname.lastIndexOf('/') + 1) || 'index.html';\n const lines: string[] = [\n `# Design Annotations — ${pageTitle}`,\n `**File:** \\`${filename}\\``,\n '',\n ];\n\n for (let i = 0; i < annotations.length; i++) {\n const a = annotations[i];\n const status = a.resolved ? ' (resolved)' : '';\n lines.push(`## ${i + 1}.${status}`);\n lines.push(`**Element:** \\`${a.targetSelector}\\``);\n lines.push(`**Issue:** ${a.text}`);\n lines.push('');\n }\n\n return lines.join('\\n');\n }\n\n clearAnnotations(): void {\n const all = this.store.getAll();\n for (const a of all) {\n this.store.remove(a.id);\n }\n this.toolbar.updateCount(0);\n }\n\n copyAnnotations(): void {\n const text = this.formatForAgent();\n navigator.clipboard.writeText(text);\n\n if (this.clearOnCopy) {\n this.clearAnnotations();\n }\n }\n}\n","export const STYLES = `\n :host {\n all: initial;\n position: fixed;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n z-index: 2147483647;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n font-size: 13px;\n line-height: 1.4;\n color: #1a1a2e;\n }\n\n *, *::before, *::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n /* ── Toolbar ── */\n\n .refinekit-toolbar {\n position: fixed;\n bottom: 24px;\n right: 24px;\n z-index: 10;\n user-select: none;\n }\n\n .toolbar-pill {\n display: flex;\n align-items: center;\n position: relative;\n background: #1a1a2e;\n border-radius: 100px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);\n padding: 6px;\n transform: scale(1);\n transform-origin: right center;\n transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .refinekit-toolbar[data-collapsed=\"true\"] .toolbar-pill {\n transform: scale(0.92);\n }\n\n .toolbar-inner {\n display: flex;\n align-items: center;\n gap: 2px;\n overflow: hidden;\n clip-path: inset(0);\n max-width: 300px;\n opacity: 1;\n padding-right: 2px;\n transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),\n opacity 0.2s ease 0.1s,\n padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .refinekit-toolbar[data-collapsed=\"true\"] .toolbar-inner {\n max-width: 0;\n opacity: 0;\n padding-right: 0;\n transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),\n opacity 0.15s ease,\n padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n .toolbar-btn {\n position: relative;\n width: 36px;\n height: 36px;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: #a0a0b8;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: color 0.15s, background 0.15s;\n }\n\n .toolbar-btn:hover {\n color: #ffffff;\n background: rgba(255, 255, 255, 0.1);\n }\n\n .toolbar-btn.active {\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n }\n\n .toolbar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .toolbar-count {\n font-size: 14px;\n font-weight: 700;\n min-width: 18px;\n text-align: center;\n }\n\n .toolbar-divider {\n width: 1px;\n height: 20px;\n background: rgba(255, 255, 255, 0.15);\n margin: 0 4px;\n flex-shrink: 0;\n }\n\n /* Tooltip */\n .toolbar-tooltip {\n position: absolute;\n bottom: calc(100% + 10px);\n left: 50%;\n transform: translateX(-50%);\n padding: 6px 10px;\n background: #1a1a2e;\n color: #e8e8f0;\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n }\n\n .toolbar-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n border: 5px solid transparent;\n border-top-color: #1a1a2e;\n }\n\n .toolbar-btn:hover .toolbar-tooltip {\n opacity: 1;\n }\n\n .tooltips-hidden .toolbar-tooltip {\n display: none;\n }\n\n .toolbar-btn.disabled {\n opacity: 0.3;\n cursor: default;\n }\n\n .toolbar-btn.disabled:hover {\n color: #a0a0b8;\n background: transparent;\n }\n\n /* Toggle button (always visible) */\n .toolbar-toggle-btn {\n flex-shrink: 0;\n }\n\n /* Badge for collapsed state */\n .toolbar-expand-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n min-width: 20px;\n height: 20px;\n padding: 0 5px;\n border-radius: 10px;\n background: #DC2626;\n color: #ffffff;\n font-size: 11px;\n font-weight: 700;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);\n }\n\n .toolbar-expand-badge.hidden {\n display: none;\n }\n\n /* ── Settings Panel ── */\n\n .settings-panel {\n position: fixed;\n bottom: 80px;\n right: 24px;\n width: 300px;\n z-index: 12;\n background: #1a1a2e;\n border-radius: 16px;\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);\n padding: 20px;\n color: #e8e8f0;\n transform-origin: bottom right;\n transition: transform 0.25s ease, opacity 0.1s ease;\n transform: scale(1);\n opacity: 1;\n }\n\n .settings-panel.hidden {\n transform: scale(0.4);\n opacity: 0;\n pointer-events: none;\n }\n\n .settings-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n }\n\n .settings-title {\n font-size: 16px;\n font-weight: 700;\n font-style: normal;\n color: #ffffff;\n }\n\n .settings-version {\n font-size: 12px;\n color: #6b6b80;\n font-weight: 500;\n }\n\n .settings-divider {\n height: 1px;\n background: rgba(255, 255, 255, 0.08);\n margin: 16px 0;\n }\n\n .settings-section {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .settings-label {\n font-size: 14px;\n font-weight: 500;\n color: #c0c0d0;\n }\n\n .settings-color-row {\n display: flex;\n gap: 8px;\n }\n\n .settings-swatch {\n width: 24px;\n height: 24px;\n border-radius: 4px;\n border: 2px solid transparent;\n cursor: pointer;\n transition: transform 0.15s, border-color 0.15s;\n outline: none;\n }\n\n .settings-swatch:hover {\n transform: scale(1.1);\n }\n\n .settings-swatch.selected {\n border-color: #ffffff;\n transform: scale(1.1);\n }\n\n .settings-check-row {\n display: flex;\n align-items: center;\n gap: 10px;\n cursor: pointer;\n padding: 2px 0;\n }\n\n .settings-checkbox {\n appearance: none;\n -webkit-appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 5px;\n border: 2px solid #4a4a60;\n background: transparent;\n cursor: pointer;\n position: relative;\n flex-shrink: 0;\n transition: background 0.15s, border-color 0.15s;\n }\n\n .settings-checkbox:checked {\n background: #2563EB;\n border-color: #2563EB;\n }\n\n .settings-checkbox:checked::after {\n content: '';\n position: absolute;\n top: 2px;\n left: 5px;\n width: 5px;\n height: 9px;\n border: solid #ffffff;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .settings-check-label {\n font-size: 14px;\n font-weight: 500;\n color: #e8e8f0;\n }\n\n /* ── Overlay ── */\n\n .refinekit-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n cursor: crosshair;\n z-index: 1;\n }\n\n .refinekit-overlay[data-blocking=\"true\"] {\n pointer-events: all;\n }\n\n .refinekit-overlay[data-blocking=\"false\"] {\n pointer-events: none;\n }\n\n .refinekit-overlay.hidden {\n display: none;\n }\n\n /* ── Highlight ── */\n\n .refinekit-highlight {\n position: fixed;\n pointer-events: none;\n border: 2px dashed;\n border-radius: 3px;\n z-index: 2;\n transition: all 0.1s ease;\n }\n\n /* ── Dialog ── */\n\n .refinekit-dialog {\n position: fixed;\n width: 320px;\n background: #1a1a2e;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 14px;\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);\n padding: 16px;\n z-index: 11;\n color: #e8e8f0;\n animation: dialog-in 0.2s ease;\n }\n\n @keyframes dialog-in {\n from { opacity: 0; transform: translateY(4px) scale(0.98); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n\n .refinekit-dialog.hidden {\n display: none;\n }\n\n .dialog-header {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 12px;\n }\n\n .dialog-header span {\n font-size: 12px;\n font-weight: 600;\n color: #c0c0d0;\n }\n\n .dialog-textarea {\n width: 100%;\n min-height: 72px;\n padding: 10px 12px;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 10px;\n font-family: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: #e8e8f0;\n background: rgba(255, 255, 255, 0.06);\n resize: vertical;\n outline: none;\n transition: border-color 0.15s;\n }\n\n .dialog-textarea:focus {\n border-color: rgba(255, 255, 255, 0.25);\n }\n\n .dialog-textarea::placeholder {\n color: #6b6b80;\n }\n\n .dialog-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 12px;\n }\n\n .dialog-btn {\n height: 32px;\n padding: 0 14px;\n border-radius: 8px;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.15s;\n }\n\n .dialog-btn-cancel {\n background: transparent;\n border: 1px solid rgba(255, 255, 255, 0.12);\n color: #a0a0b8;\n }\n\n .dialog-btn-cancel:hover {\n background: rgba(255, 255, 255, 0.08);\n color: #e8e8f0;\n }\n\n .dialog-btn-add {\n background: #2563EB;\n border: none;\n color: #ffffff;\n }\n\n .dialog-btn-add:hover {\n background: #3B82F6;\n }\n\n .dialog-btn-add:disabled {\n opacity: 0.3;\n cursor: not-allowed;\n }\n\n /* ── Markers ── */\n\n .refinekit-marker {\n position: fixed;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 11px;\n font-weight: 700;\n color: #ffffff;\n cursor: pointer;\n z-index: 10;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);\n transition: transform 0.15s;\n pointer-events: all;\n }\n\n .refinekit-marker:hover {\n transform: scale(1.2);\n }\n\n .refinekit-marker[data-resolved=\"true\"] {\n opacity: 0.4;\n }\n\n .marker-tooltip {\n position: absolute;\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%);\n width: 220px;\n padding: 10px 12px;\n background: #1a1a2e;\n color: #e8e8f0;\n font-size: 12px;\n line-height: 1.4;\n border-radius: 10px;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .refinekit-marker:hover .marker-tooltip {\n opacity: 1;\n }\n\n .marker-tooltip-actions {\n display: flex;\n gap: 6px;\n margin-top: 8px;\n border-top: 1px solid rgba(255,255,255,0.1);\n padding-top: 8px;\n }\n\n .marker-tooltip-btn {\n height: 22px;\n padding: 0 8px;\n border-radius: 5px;\n border: none;\n font-size: 10px;\n font-weight: 600;\n cursor: pointer;\n transition: background 0.15s;\n }\n\n .marker-tooltip-btn.resolve {\n background: #34D399;\n color: #0a2e1f;\n }\n\n .marker-tooltip-btn.resolve:hover {\n background: #4ade80;\n }\n\n .marker-tooltip-btn.delete {\n background: rgba(255,255,255,0.1);\n color: #e8e8f0;\n }\n\n .marker-tooltip-btn.delete:hover {\n background: #FF6B6B;\n color: #fff;\n }\n\n /* MCP status */\n .settings-mcp-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 0;\n }\n\n .settings-mcp-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n }\n\n .settings-mcp-dot.connected {\n background: #34D399;\n box-shadow: 0 0 6px #34D39980;\n }\n\n .settings-mcp-dot.disconnected {\n background: #6B7280;\n }\n\n /* ── Inspect Panel ── */\n\n .inspect-panel {\n position: fixed;\n width: 280px;\n max-height: 80vh;\n overflow-y: auto;\n z-index: 13;\n background: #1a1a2e;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 14px;\n box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);\n padding: 16px;\n color: #e8e8f0;\n animation: dialog-in 0.15s ease;\n }\n\n .inspect-panel.hidden {\n display: none;\n }\n\n .inspect-element-tag {\n font-size: 12px;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n color: #2563EB;\n font-weight: 600;\n margin-bottom: 4px;\n }\n\n .inspect-element-selector {\n font-size: 11px;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n color: #6b6b80;\n margin-bottom: 12px;\n word-break: break-all;\n }\n\n .inspect-section-title {\n font-size: 10px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #6b6b80;\n margin-bottom: 6px;\n margin-top: 12px;\n }\n\n .inspect-section-title:first-child {\n margin-top: 0;\n }\n\n .inspect-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 4px 8px;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.1s;\n gap: 12px;\n }\n\n .inspect-row:hover {\n background: rgba(255, 255, 255, 0.06);\n }\n\n .inspect-row.copied {\n background: rgba(37, 99, 235, 0.2);\n }\n\n .inspect-row-label {\n font-size: 11px;\n color: #6b6b80;\n font-weight: 500;\n flex-shrink: 0;\n }\n\n .inspect-row-value {\n font-size: 12px;\n color: #e8e8f0;\n font-weight: 500;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n max-width: 160px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: right;\n }\n\n .inspect-color-swatch {\n display: inline-block;\n width: 12px;\n height: 12px;\n border-radius: 3px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n margin-right: 6px;\n vertical-align: middle;\n }\n\n .inspect-panel::-webkit-scrollbar {\n width: 4px;\n }\n\n .inspect-panel::-webkit-scrollbar-track {\n background: transparent;\n }\n\n .inspect-panel::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.1);\n border-radius: 2px;\n }\n`;\n","import { RefineKit } from './refinekit';\nimport type { Annotation, RefineKitOptions } from './types';\n\nexport { RefineKit };\nexport type { Annotation, RefineKitOptions };\n\n// Auto-initialize when loaded via script tag\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n const init = () => {\n // Skip if already initialized (e.g. bookmarklet + script tag both present)\n if ((window as any).__refinekit) return;\n\n // Read config from script tag data attributes\n const script = document.currentScript as HTMLScriptElement | null;\n const position = (script?.dataset.refinekitPosition as 'left' | 'right') ?? 'right';\n const enabled = script?.dataset.refinekitEnabled !== 'false';\n const mcpPort = script?.dataset.refinekitMcpPort ? parseInt(script.dataset.refinekitMcpPort, 10) : undefined;\n const mcpEnabled = script?.dataset.refinekitMcpEnabled !== 'false';\n\n const refinekit = new RefineKit({ position, enabled, mcpPort, mcpEnabled });\n (window as any).__refinekit = refinekit;\n };\n\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', init);\n } else {\n init();\n }\n}\n"],"names":["AnnotationStore","constructor","this","annotations","Map","listeners","add","targetSelector","targetRect","text","annotation","id","crypto","randomUUID","x","y","width","height","timestamp","Date","now","resolved","set","emit","resolve","get","remove","delete","getAll","Array","from","values","getPending","filter","a","getCount","size","exportJSON","JSON","stringify","on","event","listener","has","Set","off","forEach","fn","Toolbar","root","collapsed","inspectActive","settingsOpen","el","document","createElement","className","setAttribute","render","appendChild","requestAnimationFrame","updateBadgeVisibility","pill","innerEl","countBadge","textContent","createBtn","copyIcon","copyBtn","classList","contains","onCopy","querySelector","innerHTML","setTimeout","clearBtn","onClear","inspectBtn","toggle","onInspectToggle","onSettings","divider","penIcon","toggleBtn","toggleCollapse","expandBadge","addEventListener","content","tooltip","onClick","btn","iconWrap","tip","String","onCollapse","onExpand","setInspectActive","active","setSettingsOpen","open","updateCount","count","empty","c","parseInt","Overlay","enabled","blocking","currentTarget","highlightColor","inspectMode","handleMouseMove","e","isOverOwnUI","clientX","clientY","hideHighlight","target","getElementAt","showHighlight","onHoverChange","getBoundingClientRect","handleClick","preventDefault","stopPropagation","rect","handleKeyBlock","host","highlight","style","display","shadowEl","elementFromPoint","pointerEvents","top","left","borderColor","borderStyle","setHighlightColor","color","setBlocking","setEnabled","AnnotationDialog","header","label","textarea","placeholder","addBtn","disabled","value","trim","length","key","metaKey","ctrlKey","submit","hide","onCancel","actions","cancelBtn","onSubmit","show","window","innerWidth","innerHeight","Math","max","focus","isVisible","AnnotationMarkers","store","markers","rafId","container","addMarker","updateMarker","removeMarker","reposition","repositionAll","passive","background","index","tooltipText","tooltipActions","resolveBtn","deleteBtn","positionMarker","marker","renumber","i","firstText","childNodes","nodeType","Node","TEXT_NODE","queryTarget","right","selector","setColor","clearAll","MARKER_COLORS","SettingsPanel","visible","settings","clearOnCopy","blockInteractions","markerColor","title","version","createDivider","colorSection","colorLabel","colorRow","mc","swatch","querySelectorAll","s","emitChange","createCheckbox","checked","mcpRow","mcpDot","mcpLabel","initial","onChange","row","checkbox","type","div","setMcpStatus","connected","getSettings","generateSelector","CSS","escape","classSelector","tagName","toLowerCase","map","join","parts","current","documentElement","tag","parent","parentElement","unshift","siblings","children","indexOf","McpBridge","port","sessionId","retryTimer","baseUrl","discover","postAnnotation","patchAnnotation","res","fetch","data","json","status","createSession","stopRetry","startRetry","setInterval","clearInterval","method","headers","body","url","location","href","pathname","session","summary","isConnected","destroy","InspectPanel","lastTarget","position","getComputedStyle","sections","extractProperties","renderContent","typoRows","formatFontFamily","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","push","rows","spacingRows","addSpacingRows","bgRows","backgroundColor","borderRows","addBorderRows","borderRadius","layoutRows","round","prop","getPropertyValue","bottom","tw","borderTopWidth","ts","borderTopStyle","tc","borderTopColor","rw","borderRightWidth","rs","borderRightStyle","rc","borderRightColor","bw","borderBottomWidth","bs","borderBottomStyle","bc","borderBottomColor","lw","borderLeftWidth","ls","borderLeftStyle","lc","borderLeftColor","fonts","split","f","replace","sel","section","rowEl","labelEl","valueEl","createTextNode","navigator","clipboard","writeText","panelW","panelH","offsetHeight","margin","RefineKit","options","mcpBridge","currentRect","shadow","attachShadow","mode","toolbar","overlay","dialog","inspectPanel","copyAnnotations","clearAnnotations","centerX","centerY","mcpEnabled","mcpPort","disable","enable","getAnnotations","getAnnotationCount","formatForAgent","pageTitle","lines","substring","lastIndexOf","all","init","__refinekit","script","currentScript","dataset","refinekitPosition","refinekitEnabled","refinekitMcpPort","undefined","refinekitMcpEnabled","refinekit","readyState"],"mappings":"6CAIaA,EAAb,WAAAC,GACUC,KAAAC,YAAuC,IAAIC,IAC3CF,KAAAG,UAAwC,IAAID,GAuEtD,CArEE,GAAAE,CAAIC,EAAwBC,EAAqBC,GAC/C,MAAMC,EAAyB,CAC7BC,GAAIC,OAAOC,aACXN,iBACAC,WAAY,CACVM,EAAGN,EAAWM,EACdC,EAAGP,EAAWO,EACdC,MAAOR,EAAWQ,MAClBC,OAAQT,EAAWS,QAErBR,OACAS,UAAWC,KAAKC,MAChBC,UAAU,GAIZ,OAFAnB,KAAKC,YAAYmB,IAAIZ,EAAWC,GAAID,GACpCR,KAAKqB,KAAK,MAAOb,GACVA,CACT,CAEA,OAAAc,CAAQb,GACN,MAAMD,EAAaR,KAAKC,YAAYsB,IAAId,GACpCD,IACFA,EAAWW,UAAW,EACtBnB,KAAKqB,KAAK,UAAWb,GAEzB,CAEA,MAAAgB,CAAOf,GACL,MAAMD,EAAaR,KAAKC,YAAYsB,IAAId,GACpCD,IACFR,KAAKC,YAAYwB,OAAOhB,GACxBT,KAAKqB,KAAK,SAAUb,GAExB,CAEA,GAAAe,CAAId,GACF,OAAOT,KAAKC,YAAYsB,IAAId,EAC9B,CAEA,MAAAiB,GACE,OAAOC,MAAMC,KAAK5B,KAAKC,YAA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