@mindstudio-ai/browser-agent 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +187 -0
- package/dist/index.js +155 -1
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# @mindstudio-ai/browser-agent
|
|
2
|
+
|
|
3
|
+
Browser-side agent for MindStudio dev previews. Injected into app preview pages via the dev tunnel proxy. Captures browser events, provides DOM snapshots, enables remote interaction by AI agents, and supports user annotations for visual feedback.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
The dev tunnel proxy injects `<script src>` into every HTML response (default: ngrok dev URL, fallback: unpkg latest). This script runs inside the app's preview (either in the MindStudio IDE iframe or a standalone tab) and communicates with the tunnel via HTTP endpoints on the proxy.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
AI Agent ──stdin──▶ Tunnel ──queue──▶ Proxy endpoint
|
|
11
|
+
│
|
|
12
|
+
Browser agent ◀──GET /commands────────────┘
|
|
13
|
+
Browser agent ──POST /results──▶ Proxy ──stdout──▶ AI Agent
|
|
14
|
+
Browser agent ──POST /logs────▶ Proxy ──file──▶ .logs/browser.ndjson
|
|
15
|
+
|
|
16
|
+
Frontend ──postMessage──▶ Browser agent (notes mode, screenshots)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
### Log capture (always active)
|
|
22
|
+
|
|
23
|
+
Captures browser events and POSTs them to `/__mindstudio_dev__/logs`, which the tunnel writes to `.logs/browser.ndjson`:
|
|
24
|
+
|
|
25
|
+
- **Console** -- overrides `console.log/info/warn/error/debug`, calls originals through
|
|
26
|
+
- **JS errors** -- `window.addEventListener('error')` with message, stack, source, line, column
|
|
27
|
+
- **Unhandled rejections** -- `window.addEventListener('unhandledrejection')`
|
|
28
|
+
- **Network requests** -- monkey-patches `fetch` and `XMLHttpRequest` to log all requests (method, URL, status, duration, response body for failures)
|
|
29
|
+
- **Click interactions** -- capture-phase click listener with accessible element descriptions
|
|
30
|
+
|
|
31
|
+
Log entries are batched and flushed every 2 seconds, or immediately on errors. Uses `navigator.sendBeacon` on page unload.
|
|
32
|
+
|
|
33
|
+
All monkey-patches are guarded against stacking on HMR/reload (checked via `__ms_patched` flags on the patched objects).
|
|
34
|
+
|
|
35
|
+
### DOM snapshots
|
|
36
|
+
|
|
37
|
+
Compact, token-efficient accessibility-tree-style representation of the page. Designed for AI agent consumption (~200-400 tokens for a typical page).
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
navigation "Generate Collection" [ref=e1]
|
|
41
|
+
button "Generate" [ref=e2]
|
|
42
|
+
button "Collection" [ref=e3]
|
|
43
|
+
textbox [value=""] [placeholder="enter a topic..."] [ref=e4]
|
|
44
|
+
button "Generate" [disabled] [ref=e5]
|
|
45
|
+
paragraph "5 · 7 · 5"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Key design decisions:
|
|
49
|
+
|
|
50
|
+
- **Semantic roles and accessible names**, not CSS classes -- handles styled-components/CSS-in-JS apps where class names are generated hashes
|
|
51
|
+
- **Transparent element collapsing** -- generic `<div>`/`<span>` wrappers without roles disappear from the tree, children float up to the nearest semantic ancestor
|
|
52
|
+
- **Cursor-interactive detection** -- elements with `cursor: pointer` or `onclick` are included even if they're generic divs
|
|
53
|
+
- **Block/inline spacing** -- text from block-level children gets spaces between them (fixes concatenated text from nested components)
|
|
54
|
+
- **Network idle wait** -- `takeSnapshot()` waits for all fetch/XHR requests to settle (200ms quiet period, 5s max) before walking the DOM
|
|
55
|
+
- **Stable refs** -- interactive elements get `[ref=eN]` identifiers for command targeting
|
|
56
|
+
- **Form state** -- shows `[value="..."]`, `[placeholder="..."]`, `[disabled]`, `[checked]`, `[open]`
|
|
57
|
+
|
|
58
|
+
### Command channel (iframe mode only)
|
|
59
|
+
|
|
60
|
+
When the page URL contains `?mode=iframe`, the agent polls `GET /__mindstudio_dev__/commands` every 100ms for commands from the AI agent. This ensures only the preview iframe in the MindStudio IDE responds to commands, not standalone browser tabs.
|
|
61
|
+
|
|
62
|
+
The AI agent sends commands via the tunnel's stdin:
|
|
63
|
+
```json
|
|
64
|
+
{"action": "browser", "steps": [{"command": "click", "text": "Generate"}]}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The result comes back on the tunnel's stdout with a snapshot, logs captured during execution, and step results:
|
|
68
|
+
```json
|
|
69
|
+
{"event": "browser-completed", "steps": [...], "snapshot": "...", "logs": [...], "duration": 250}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Commands execute sequentially with a visible animated cursor. Execution stops on first error.
|
|
73
|
+
|
|
74
|
+
**Available commands:**
|
|
75
|
+
|
|
76
|
+
| Command | Description |
|
|
77
|
+
|---------|-------------|
|
|
78
|
+
| `snapshot` | Returns the compact DOM accessibility tree |
|
|
79
|
+
| `click` | Clicks an element (full pointer/mouse/click event sequence for React/Vue/Svelte) |
|
|
80
|
+
| `type` | Types text into an input/textarea (character-by-character with native value setter for React) |
|
|
81
|
+
| `select` | Selects an option from a `<select>` element |
|
|
82
|
+
| `wait` | Waits for an element to appear in the DOM (polls with timeout) |
|
|
83
|
+
| `evaluate` | Runs arbitrary JavaScript and returns the result (auto-wraps with return, handles async) |
|
|
84
|
+
|
|
85
|
+
**Element targeting** (for click, type, select, wait):
|
|
86
|
+
|
|
87
|
+
| Field | Example | Description |
|
|
88
|
+
|-------|---------|-------------|
|
|
89
|
+
| `ref` | `"e5"` | Ref from the last snapshot (most reliable) |
|
|
90
|
+
| `text` | `"Create Board"` | Match by accessible name or visible text |
|
|
91
|
+
| `role` + `text` | `"button"` + `"Submit"` | Match by ARIA role and name |
|
|
92
|
+
| `label` | `"Board name"` | Find input by its associated label text |
|
|
93
|
+
| `selector` | `"#my-id"` | CSS selector fallback |
|
|
94
|
+
|
|
95
|
+
Error messages include what IS on the page so the agent can self-correct (e.g., `No button "Submit" found. Visible buttons: "Generate", "Collection"`).
|
|
96
|
+
|
|
97
|
+
### Screenshots
|
|
98
|
+
|
|
99
|
+
Screenshots are captured via SnapDOM (`@zumer/snapdom`) and can be triggered two ways:
|
|
100
|
+
|
|
101
|
+
1. **Via tunnel stdin** -- `{"action": "screenshot"}` captures the viewport, uploads to S3 via the platform, and returns a CDN URL.
|
|
102
|
+
2. **Via postMessage** -- the frontend sends `notes-screenshot` to capture with annotations (see Notes below).
|
|
103
|
+
|
|
104
|
+
### Visible cursor
|
|
105
|
+
|
|
106
|
+
A Figma-style animated cursor (`#DD2590` pink with "Remy" name tag) shows the AI agent's actions in real time:
|
|
107
|
+
|
|
108
|
+
- Appears from a random viewport edge on first action
|
|
109
|
+
- Glides smoothly to target elements (450ms ease)
|
|
110
|
+
- Click animation with ripple effect
|
|
111
|
+
- Fades out after 1.5s of inactivity
|
|
112
|
+
- Reappears at last known position for subsequent actions
|
|
113
|
+
- Only renders in iframe mode (`?mode=iframe`)
|
|
114
|
+
|
|
115
|
+
### Annotation notes (postMessage API)
|
|
116
|
+
|
|
117
|
+
Users can add ephemeral visual annotations to the preview for AI feedback. Controlled by the frontend via postMessage.
|
|
118
|
+
|
|
119
|
+
**Frontend → iframe messages** (`channel: 'mindstudio-browser-agent'`):
|
|
120
|
+
|
|
121
|
+
| Command | Purpose |
|
|
122
|
+
|---------|---------|
|
|
123
|
+
| `notes-enter` | Enter notes mode (overlay, custom cursor, click/drag to annotate) |
|
|
124
|
+
| `notes-exit` | Exit notes mode, remove all notes |
|
|
125
|
+
| `notes-screenshot` | Capture screenshot including annotations, return base64 |
|
|
126
|
+
| `notes-cursor-hide` | Hide the notes cursor (call when mouse leaves iframe) |
|
|
127
|
+
|
|
128
|
+
**Iframe → frontend responses:**
|
|
129
|
+
|
|
130
|
+
| Command | Payload | Purpose |
|
|
131
|
+
|---------|---------|---------|
|
|
132
|
+
| `screenshot-result` | `{ image: string }` or `{ error: string }` | Base64 PNG screenshot |
|
|
133
|
+
|
|
134
|
+
Notes are pink (`#DD2590`) rounded bubbles with inline-editable text. Pin notes (click) have a dot at the click point. Area notes (drag) have a dashed border around the selected region. Notes support select → edit → move → delete lifecycle with Enter to confirm, Escape to cancel, and a × delete button.
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm install
|
|
140
|
+
npm run build # build dist/index.js (single IIFE, minified)
|
|
141
|
+
npm run dev # watch mode + local HTTP server on port 8787
|
|
142
|
+
npm run serve # serve dist/ on port 8787 (no watch)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The dev tunnel proxy defaults to loading the script from `https://seankoji-msba.ngrok.io/index.js`. Point ngrok at port 8787 to serve your local dev build to remote sandboxes. Falls back to `https://unpkg.com/@mindstudio-ai/browser-agent/dist/index.js` when no URL is configured.
|
|
146
|
+
|
|
147
|
+
## Architecture
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
src/
|
|
151
|
+
index.ts -- entry point, idempotency guard, init all modules
|
|
152
|
+
transport.ts -- log entry buffer, batched POST to proxy, capture mode
|
|
153
|
+
network-idle.ts -- tracks in-flight requests for snapshot idle wait
|
|
154
|
+
utils.ts -- serialization, element description, sleep
|
|
155
|
+
capture/
|
|
156
|
+
console.ts -- console.* override (patch-guarded)
|
|
157
|
+
errors.ts -- error + unhandledrejection listeners
|
|
158
|
+
network.ts -- fetch monkey-patch (patch-guarded, logs + idle tracking)
|
|
159
|
+
xhr.ts -- XMLHttpRequest monkey-patch (patch-guarded, logs + idle tracking)
|
|
160
|
+
interactions.ts -- click listener (patch-guarded)
|
|
161
|
+
snapshot/
|
|
162
|
+
walker.ts -- DOM walker, takeSnapshot(), describeTarget()
|
|
163
|
+
roles.ts -- implicit ARIA role mapping, cursor-interactive detection
|
|
164
|
+
name.ts -- accessible name computation
|
|
165
|
+
commands/
|
|
166
|
+
poller.ts -- polls proxy for commands (iframe mode only)
|
|
167
|
+
executor.ts -- dispatches steps, captures logs, appends snapshot
|
|
168
|
+
actions.ts -- click, type, select, wait, evaluate implementations
|
|
169
|
+
resolve.ts -- element resolution (ref, text, role, label, selector)
|
|
170
|
+
screenshot.ts -- SnapDOM viewport capture
|
|
171
|
+
cursor/
|
|
172
|
+
cursor.ts -- animated Figma-style cursor with ripple
|
|
173
|
+
notes/
|
|
174
|
+
constants.ts -- shared color constant
|
|
175
|
+
messages.ts -- postMessage handler (idempotent listener)
|
|
176
|
+
notes-mode.ts -- enter/exit lifecycle, screenshot orchestration
|
|
177
|
+
note-layer.ts -- overlay, pointer events, state machine
|
|
178
|
+
note-element.ts -- DOM creation for pin and area notes
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Proxy endpoints
|
|
182
|
+
|
|
183
|
+
| Endpoint | Method | Purpose |
|
|
184
|
+
|----------|--------|---------|
|
|
185
|
+
| `/__mindstudio_dev__/logs` | POST | Receive browser log entries |
|
|
186
|
+
| `/__mindstudio_dev__/commands` | GET | Poll for pending commands |
|
|
187
|
+
| `/__mindstudio_dev__/results` | POST | Return command execution results |
|
package/dist/index.js
CHANGED
|
@@ -1 +1,155 @@
|
|
|
1
|
-
"use strict";var __MindStudioBrowserAgent=(()=>{var
|
|
1
|
+
"use strict";var __MindStudioBrowserAgent=(()=>{var Dt=Object.defineProperty;var To=Object.getOwnPropertyDescriptor;var Ro=Object.getOwnPropertyNames;var _o=Object.prototype.hasOwnProperty;var Po=(e,t)=>{for(var n in t)Dt(e,n,{get:t[n],enumerable:!0})},Fo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ro(t))!_o.call(e,i)&&i!==n&&Dt(e,i,{get:()=>t[i],enumerable:!(r=To(t,i))||r.enumerable});return e};var Io=e=>Fo(Dt({},"__esModule",{value:!0}),e);var ns={};Po(ns,{executeSteps:()=>Nt,getRefMap:()=>st,resolveElement:()=>pe,takeSnapshot:()=>qe,takeSnapshotSync:()=>Ut});var Sn="/__mindstudio_dev__/logs";var ye=[],$e=null,at=!1,He=[];function Cn(){if(ye.length===0)return;let e=ye;ye=[];try{let t=new XMLHttpRequest;t.open("POST",Sn,!0),t.setRequestHeader("Content-Type","application/json"),t.send(JSON.stringify(e))}catch{}}function Do(){$e||($e=setTimeout(()=>{$e=null,Cn()},2e3))}function Oo(){$e&&(clearTimeout($e),$e=null),Cn()}function J(e){ye.push(e),at&&He.push(e),Do()}function Ot(e){ye.push(e),at&&He.push(e),Oo()}function En(){at=!0,He=[]}function kn(){at=!1;let e=He;return He=[],e}function $n(){window.addEventListener("beforeunload",()=>{ye.length>0&&navigator.sendBeacon&&navigator.sendBeacon(Sn,JSON.stringify(ye))})}var Wo={a:"link",button:"button",input:"textbox",textarea:"textbox",select:"combobox",option:"option",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",dialog:"dialog",details:"group",summary:"button",img:"img",ul:"list",ol:"list",li:"listitem",table:"table",tr:"row",th:"columnheader",td:"cell",form:"form",article:"article",section:"region",label:"label",fieldset:"group",legend:"legend",p:"paragraph",blockquote:"blockquote",pre:"code",code:"code",hr:"separator",progress:"progressbar"};function be(e){let t=e.getAttribute("role");if(t)return t==="presentation"||t==="none"?null:t;let n=e.tagName.toLowerCase();if(n==="a")return e.hasAttribute("href")?"link":null;if(n==="section")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"region":null;if(n==="form")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"form":null;if(n==="img")return e.alt===""?null:"img";if(n==="input")switch(e.type){case"checkbox":return"checkbox";case"radio":return"radio";case"range":return"slider";case"submit":case"button":case"reset":return"button";case"hidden":return null;default:return"textbox"}return Wo[n]??null}function Mn(e){if(e.hasAttribute("onclick")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1")return!0;try{if(getComputedStyle(e).cursor==="pointer")return!0}catch{}return!1}function Me(e){let t=e.getAttribute("aria-label");if(t)return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let a=n.split(/\s+/).map(c=>{let l=document.getElementById(c);return l?we(l):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=Ho(e);if(a)return a}if(r==="img"){let a=e.alt;if(a)return a.trim()}if(r==="fieldset"){let a=e.querySelector("legend");if(a)return we(a)}let i=we(e);if(i)return i;let o=e.getAttribute("title");return o?o.trim():""}function we(e){if(!e.children.length)return(e.textContent||"").trim();let t=[];for(let n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE){let r=(n.textContent||"").trim();r&&t.push(r)}else if(n.nodeType===Node.ELEMENT_NODE){let r=n;if(Uo(r))continue;let i=Bo(r),o=we(r);o&&(i&&t.length>0&&t.push(" "),t.push(o),i&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function Ho(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return we(n)}let t=e.closest("label");if(t){let n=t.cloneNode(!0),r=n.querySelector("input, textarea, select");r&&r.remove();let i=n.textContent?.trim();if(i)return i}return null}function Bo(e){try{return!getComputedStyle(e).display.includes("inline")}catch{let t=e.tagName.toLowerCase();return["div","p","h1","h2","h3","h4","h5","h6","li","section","article","header","footer","nav","main","aside","blockquote","pre","form","fieldset","table","tr","br"].includes(t)}}function Uo(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||e.getAttribute("aria-hidden")==="true")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return!0}catch{}return!1}function Wt(e,t){try{let n=getComputedStyle(e,t).content;if(!n||n==="none"||n==="normal")return"";let r=n.match(/^["'](.*)["']$/);return r?r[1]:""}catch{return""}}var Be=0;function lt(){Be++}function Ue(){Be=Math.max(0,Be-1)}function An(e=5e3,t=200){return new Promise((n,r)=>{let i=Date.now()+e,o=null;function a(){if(Date.now()>i){o&&clearTimeout(o),n();return}Be===0?o||(o=setTimeout(()=>{Be===0?n():(o=null,a())},t)):(o&&(clearTimeout(o),o=null),setTimeout(a,50))}a()})}var Ht=0,Bt=new Map;function st(){return Bt}async function qe(){return await An(),Ut()}function Ut(){Ht=0,Bt=new Map;let e=document.body;if(!e)return"(empty page)";let t=Ln(e);return qt(t,0).trimEnd()}function Z(e){let t=be(e),n=Me(e),r=n.length>60?n.slice(0,57)+"...":n;if(t&&r)return`${t} "${r}"`;if(t)return t;if(r)return`"${r}"`;let i=e.tagName.toLowerCase();return e.id?`${i}#${e.id}`:i}function Ln(e){if(jo(e))return[];let t=be(e),n=!t&&Mn(e),r=t||(n?"clickable":null),i="";if(r){i=Me(e);let u=Wt(e,"::before"),d=Wt(e,"::after");(u||d)&&(i=[u,i,d].filter(Boolean).join(" ")),i.length>80&&(i=i.slice(0,77)+"...")}let o=zo(e),a=t==="button"||t==="link"||t==="textbox"||t==="combobox"||t==="checkbox"||t==="radio"||t==="slider"||t==="tab"||t==="menuitem"||n,c=r&&i&&!a,l=null;(a||c)&&(Ht++,l=`e${Ht}`,Bt.set(l,e));let s=qo(e);if(r){let u=s.length===0?"":qt(s,0).trim();return[{tag:r,name:i,attrs:o,ref:l,children:u&&u===i?[]:s,element:e}]}if(s.length===0){let u=we(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return s}function qo(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...Ln(n));return t}function jo(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||t==="head"||e.getAttribute("aria-hidden")==="true"||e.id==="__mindstudio-browser-agent"||e.id==="__mindstudio-cursor"||e.id==="__mindstudio-cursor-ripple"||e.id==="__mindstudio-notes-overlay"||e.id==="__mindstudio-notes-cursor")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"&&n.position!=="static")return!0}catch{}return!1}function zo(e){let t=[],n=e.tagName.toLowerCase();if((n==="dialog"&&e.open||n==="details"&&e.open)&&t.push("open"),e.disabled&&t.push("disabled"),n==="input"){let o=e;(o.type==="checkbox"||o.type==="radio")&&o.checked&&t.push("checked")}if(n==="input"){let o=e;o.type!=="checkbox"&&o.type!=="radio"&&o.type!=="hidden"&&o.type!=="submit"&&o.type!=="button"&&o.type!=="reset"&&(t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`))}if(n==="textarea"){let o=e;t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`)}if(n==="select"){let o=e,a=o.options[o.selectedIndex];a&&t.push(`value="${a.text}"`)}let r=n.match(/^h([1-6])$/);r&&t.push(`level=${r[1]}`);let i=e.getAttribute("aria-expanded");return i==="true"&&t.push("expanded"),i==="false"&&t.push("collapsed"),e.getAttribute("aria-selected")==="true"&&t.push("selected"),e.getAttribute("aria-pressed")==="true"&&t.push("pressed"),t}function qt(e,t){let n="";for(let r of e)n+=Vo(r,t);return n}function Vo(e,t){let n=" ".repeat(t),r=[];e.tag&&r.push(e.tag),e.name&&r.push(`"${e.name}"`);for(let a of e.attrs)r.push(`[${a}]`);e.ref&&r.push(`[ref=${e.ref}]`);let i="";r.length>0&&(i+=`${n}${r.join(" ")}
|
|
2
|
+
`);let o=r.length>0?t+1:t;return i+=qt(e.children,o),i}function Nn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e instanceof Error)return e.stack||e.message||String(e);if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function X(e){return new Promise(t=>setTimeout(t,e))}var Xo=["log","info","warn","error","debug"];function Tn(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of Xo){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),J({type:"console",level:e,args:n.map(Nn),url:location.href})}}}}function Rn(){window.addEventListener("error",e=>{Ot({type:"error",message:e.message,stack:e.error&&e.error.stack||"",source:e.filename,line:e.lineno,column:e.colno,url:location.href})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason||{};Ot({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})})}function _n(){if(!window.fetch||window.fetch.__ms_patched)return;let e=window.fetch;window.fetch=function(t,n){let r=(n?.method||"GET").toUpperCase(),i=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(i.includes("/__mindstudio_dev__/"))return e.apply(this,[t,n]);let o=Date.now();return lt(),e.apply(this,[t,n]).then(a=>{Ue();let c={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)J(c);else try{a.clone().text().then(l=>{c.body=l.slice(0,1e3),J(c)}).catch(()=>J(c))}catch{J(c)}return a},a=>{throw Ue(),J({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function Pn(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);J({type:"interaction",event:"click",target:Z(t),text:n,url:location.href})},!0))}function Fn(){if(XMLHttpRequest.prototype.open.__ms_patched)return;let e=window.XMLHttpRequest,t=e.prototype.open,n=e.prototype.send;e.prototype.open=function(r,i,...o){return this.__ms_method=r.toUpperCase(),this.__ms_url=String(i),t.apply(this,[r,i,...o])},e.prototype.send=function(r){let i=this.__ms_method||"GET",o=this.__ms_url||"";if(o.includes("/__mindstudio_dev__/"))return n.apply(this,[r]);let a=Date.now();return lt(),this.addEventListener("loadend",function(){Ue(),J({type:"network",method:i,url:o,status:this.status,statusText:this.statusText,duration:Date.now()-a,ok:this.status>=200&&this.status<300,...this.status>=400?{body:(this.responseText||"").slice(0,1e3)}:{},via:"xhr"})}),n.apply(this,[r])},XMLHttpRequest.prototype.open.__ms_patched=!0}function pe(e){let t=null;if(e.ref){let n=st(),r=n.get(e.ref);if(r&&r.isConnected)if(le(r))t={element:r,matched:`${Z(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${jt(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&le(o)).slice(0,10).map(([o,a])=>`${Z(a)} [ref=${o}]`).join(", ");throw new Error(`Element [ref=${e.ref}] not found. `+(i?`Available refs: ${i}`:"No refs available \u2014 take a snapshot first."))}}if(!t&&(e.text||e.role&&e.text)){let n=e.text,r=e.role,i=In(n,r);if(i.length===0){let o=In(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${jt(o[0])}). Wait for it to become visible or check if a dialog/modal needs to be opened first.`);let a=r?`${r} "${n}"`:`"${n}"`,c=Dn(r);throw new Error(`No element found matching ${a}. `+(c?`Visible ${r||"element"}s: ${c}`:"The page may still be loading \u2014 try a wait command first."))}if(i.length>1){let o=i.filter(On),a=o.length===1?o[0]:i[0];t={element:a,matched:Z(a)}}else t={element:i[0],matched:Z(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=Yo(n);if(r.length===0){let i=Dn(n);throw new Error(`No visible element with role "${n}" found. `+(i?`Visible ${n}s: ${i}`:"The page may still be loading \u2014 try a wait command first."))}t={element:r[0],matched:Z(r[0])}}if(!t&&e.label){let n=e.label,r=Go(n);if(!r){let i=[...document.querySelectorAll("label")].filter(le).map(o=>`"${(o.textContent||"").trim().slice(0,40)}"`).slice(0,8).join(", ");throw new Error(`No input found with label "${n}". `+(i?`Visible labels: ${i}`:"No labels found on the page."))}t={element:r,matched:`${Z(r)} via label "${n}"`}}if(!t&&e.selector){let n=e.selector,r=document.querySelector(n);if(!r)throw new Error(`No element found for selector "${n}".`);if(!le(r))throw new Error(`Found element for selector "${n}" but it is hidden (${jt(r)}).`);t={element:r,matched:`${Z(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t.element.scrollIntoView({block:"nearest",behavior:"instant"}),t}function In(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!le(o)||n&&!o.isConnected||t&&be(o)!==t)continue;if(Me(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function Yo(e){let t=[];for(let n of document.querySelectorAll("*"))le(n)&&be(n)===e&&t.push(n);return t}function Go(e){let t=e.toLowerCase();for(let n of document.querySelectorAll("label")){if(!(n.textContent||"").trim().toLowerCase().includes(t))continue;let i=n.getAttribute("for");if(i){let a=document.getElementById(i);if(a&&le(a))return a}let o=n.querySelector("input, textarea, select");if(o&&le(o))return o}return null}function le(e){if(!e.isConnected)return!1;try{let t=getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden")return!1}catch{return!1}return!0}function On(e){if(e.matches('a, button, input, textarea, select, [role="button"], [role="link"], [tabindex]'))return!0;try{return getComputedStyle(e).cursor==="pointer"}catch{return!1}}function jt(e){try{let t=getComputedStyle(e);if(t.display==="none")return"display: none";if(t.visibility==="hidden")return"visibility: hidden"}catch{}return e.getAttribute("aria-hidden")==="true"?'aria-hidden="true"':"hidden"}function Dn(e){let t=[];for(let n of document.querySelectorAll("*"))if(le(n)&&(e?be(n)===e&&t.push(n):On(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${Me(n).slice(0,40)||Z(n)}"`).join(", ")}function zt(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i={bubbles:!0,cancelable:!0,clientX:n,clientY:r,button:0};e.dispatchEvent(new PointerEvent("pointerdown",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mousedown",i)),e instanceof HTMLElement&&e.focus(),e.dispatchEvent(new PointerEvent("pointerup",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mouseup",i)),e.dispatchEvent(new MouseEvent("click",i))}var Ko=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,Jo=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function Bn(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),zt(e),n.clear&&(Wn(e,""),e.dispatchEvent(new Event("input",{bubbles:!0})));for(let r=0;r<t.length;r++){let i=t[r];e.dispatchEvent(new KeyboardEvent("keydown",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),Wn(e,e.value+i),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),await X(85)}e.dispatchEvent(new Event("change",{bubbles:!0}))}function Wn(e,t){let n=e instanceof HTMLTextAreaElement?Jo:Ko;n?n.call(e,t):e.value=t}async function Un(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...pe(e),elapsed:Date.now()-n}}catch{await X(100)}let i=e.text?`"${e.text}"`:e.role?`role "${e.role}"`:e.selector?`selector "${e.selector}"`:"element";throw new Error(`Timed out waiting for ${i} after ${t}ms`)}var Hn=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function qn(e,t){if(!(e instanceof HTMLSelectElement))throw new Error("select command requires a <select> element");let n=t.toLowerCase(),r=null;for(let i of e.options)if(i.text.toLowerCase().includes(n)||i.value.toLowerCase()===n||i.label.toLowerCase().includes(n)){r=i;break}if(!r){let i=[...e.options].map(o=>`"${o.text}"`).join(", ");throw new Error(`No option matching "${t}" in select. Available options: ${i}`)}return Hn?Hn.call(e,r.value):e.value=r.value,e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new Event("input",{bubbles:!0})),r.text}async function jn(e){try{let n=!/\b(return|;|\{)\b/.test(e.trim())?`return (${e})`:e,i=new Function(n)();return i instanceof Promise?await i:i}catch(t){throw new Error(`evaluate failed: ${t instanceof Error?t.message:String(t)}`)}}var Qo=Object.defineProperty,Y=(e,t)=>()=>(e&&(t=e(e=0)),t),Ge=(e,t)=>{for(var n in t)Qo(e,n,{get:t[n],enumerable:!0})};function ei(e){if(e===!0)return"soft";if(e===!1)return"disabled";if(typeof e=="string"){let t=e.toLowerCase().trim();if(t==="auto")return"auto";if(t==="full")return"full";if(t==="soft"||t==="disabled")return t}return"soft"}function ti(e="soft"){switch(C.session.__counterEpoch=(C.session.__counterEpoch||0)+1,e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.baseStyle=new Q(50),C.defaultStyle=new Q(30),C.image=new Q(100),C.background=new Q(100),C.resource=new Q(150),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var Q,C,ne=Y(()=>{Q=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let n=this.keys().next().value;n!==void 0&&this.delete(n)}return super.set(e,t)}},C={image:new Q(100),background:new Q(100),resource:new Q(150),defaultStyle:new Q(30),baseStyle:new Q(50),computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function sn(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function ni(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function gt(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function ri(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let n=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,n).href}catch{return e}}var bt=Y(()=>{});function oi(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(a,c,l){if(i>=n)return;let s=Date.now();(r.get(c)||0)>s||(r.set(c,s+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,c){o("warn",a,c)},errorOnce(a,c){o("error",a,c)},reset(){r.clear(),i=0}}}function ii(e){return/^data:|^blob:|^about:blank$/i.test(e)}function ai(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=t.includes("{url}")?t.split("{url}")[0]:t,i=new URL(r||".",n),o=new URL(e,n);if(o.origin===i.origin)return!0;let a=o.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function li(e,t){if(!t||ii(e)||ai(e,t))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(e,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!t}}function si(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",gt(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${gt(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function zn(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(e)})}function ci(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function te(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,i=t.useProxy||"",o=t.errorTTL??8e3,a=t.headers||{},c=!!t.silent;if(/^data:/i.test(e))try{if(n==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,f="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(f)?atob(y):decodeURIComponent(y),w=new Uint8Array([...x].map(E=>E.charCodeAt(0))),b=new Blob([w],{type:(f||"").split(";")[0]||""});return{ok:!0,data:b,status:200,url:e,fromCache:!1,mime:b.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let f=await fetch(e);if(!f.ok)return{ok:!1,data:null,status:f.status,url:e,fromCache:!1,reason:"http_error"};let y=await f.blob(),x=y.type||f.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await zn(y),status:f.status,url:e,fromCache:!1,mime:x}:n==="text"?{ok:!0,data:await y.text(),status:f.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:f.status,url:e,fromCache:!1,mime:x}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let l=ci(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),s=ze.get(l);if(s&&s.until>Date.now())return{...s.result,fromCache:!0};s&&ze.delete(l);let u=ut.get(l);if(u)return u;let d=li(e,i)?si(e,i):e,m=t.credentials;if(!m)try{let f=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,f);m=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{m="omit"}let h=new AbortController,g=setTimeout(()=>h.abort("timeout"),r),p=(async()=>{try{let f=await fetch(d,{signal:h.signal,credentials:m,headers:a});if(!f.ok){let w={ok:!1,data:null,status:f.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&ze.set(l,{until:Date.now()+o,result:w}),!c){let b=`${f.status} ${f.statusText||""}`.trim();Yt.warnOnce(`http:${f.status}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${b} while fetching ${n} ${e}`)}return t.onError&&t.onError(w),w}if(n==="text")return{ok:!0,data:await f.text(),status:f.status,url:d,fromCache:!1};let y=await f.blob(),x=y.type||f.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await zn(y),status:f.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:y,status:f.status,url:d,fromCache:!1,mime:x}}catch(f){let y=f&&typeof f=="object"&&"name"in f&&f.name==="AbortError"?String(f.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&ze.set(l,{until:Date.now()+o,result:x}),!c){let w=`${y}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,b=y==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;Yt.errorOnce(w,b)}return t.onError&&t.onError(x),x}finally{clearTimeout(g),ut.delete(l)}})();return ut.set(l,p),p}var Yt,ut,ze,_e=Y(()=>{bt(),Yt=oi("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ut=new Map,ze=new Map});async function hr(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=sn(e);if(!n)return e;let r=ri(n),i=gt(r);if(C.background.has(i)){let o=C.background.get(i);return o?`url("${o}")`:"none"}try{let o=await te(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(C.background.set(i,o.data),`url("${o.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var ui=Y(()=>{ne(),bt(),_e()});function di(e){if(e=String(e).toLowerCase(),un.has(e)){let o={};return C.defaultStyle.set(e,o),o}if(C.defaultStyle.has(e))return C.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let n=document.createElement(e);n.style.all="initial",t.appendChild(n);let r=getComputedStyle(n),i={};for(let o of r){if(cn(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),C.defaultStyle.set(e,i),i}function cn(e){let t=String(e).toLowerCase();return!!(wr.has(t)||br.test(t)||yr.test(t))}function Gt(e,t){if(t=String(t||"").toLowerCase(),un.has(t))return"";let n=[],r=di(t),i=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[o,a]of Object.entries(e)){if(cn(o)||i&&(o==="width"||o==="min-width"||o==="max-width"))continue;let c=r[o];a&&a!==c&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function fi(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(n=>t.add(n.tagName.toLowerCase())),Array.from(t))}function mi(e){let t=new Map;for(let r of e){let i=C.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([a,c])=>`${a}:${c};`).sort().join("");o&&(t.has(o)||t.set(o,[]),t.get(o).push(r))}let n="";for(let[r,i]of t.entries())n+=`${i.join(",")} { ${r} }
|
|
3
|
+
`;return n}function pi(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of t)n.set(i,`c${r++}`);return n}function hi(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let r=0;r<window.frames.length;r++)try{if(window.frames[r]?.document===t)return window.frames[r]}catch{}}catch{}return typeof window<"u"?window:null}function ue(e,t=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(e instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=C.computedStyle.get(e);r||(r=new Map,C.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=hi(e),a=null;try{a=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}i=a||n(),r.set(t,i)}return i}function Vn(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function Kt(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var gr,un,gi,yr,br,wr,xr=Y(()=>{ne(),gr=new Set(["meta","script","noscript","title","link","template"]),un=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),gi=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"],yr=/(?:^|-)(animation|transition)(?:-|$)/i,br=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,wr=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function Ne(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function yi(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function xe(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),n=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),r=/applewebkit/i.test(e),i=/mobile/i.test(e),o=!/safari/i.test(e),a=r&&i&&o,c=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),s=/ipad|iphone|ipod/.test(t)&&r;return n||a||c||l||s}function bi(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var Ke=Y(()=>{});function F(e,t,n){let r=e&&typeof e=="object"&&(e.options||e);r&&r.debug&&(n!==void 0?console.warn("[snapdom]",t,n):console.warn("[snapdom]",t))}var vr=Y(()=>{}),re=Y(()=>{ui(),xr(),Ke(),bt(),vr()}),Sr={};Ge(Sr,{toCanvas:()=>wt});function wi(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function xi(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function vi(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function Si(e){let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(t.push(n),n=""):n+=o}return n.trim()&&t.push(n),t.map(i=>i.trim()).filter(Boolean)}function Ci(e){let t=[],n="",r=0;for(let o=0;o<e.length;o++){let a=e[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===","&&r===0?(t.push(n.trim()),n=""):n+=a}n.trim()&&t.push(n.trim());let i=[];for(let o of t){if(/\binset\b/i.test(o))continue;let a=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[c="0px",l="0px",s="0px"]=a,u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";i.push(`drop-shadow(${c} ${l} ${s}${d?` ${u}`:""})`)}return i.join(" ")}function Cr(e){let t=Si(e),n=null,r=null,i=null,o=[];for(let c of t){let l=c.indexOf(":");if(l<0)continue;let s=c.slice(0,l).trim().toLowerCase(),u=c.slice(l+1).trim();s==="box-shadow"?i=u:s==="filter"?n=u:s==="-webkit-filter"?r=u:o.push([s,u])}if(i){let c=Ci(i);c&&(n=n?`${n} ${c}`:c,r=r?`${r} ${c}`:c)}let a=[...o];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([c,l])=>`${c}:${l}`).join(";")}function Ei(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${Cr(r)}}`)}function ki(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,Ei(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${Cr(r)}${n}`),e}function $i(e){if(!xe()||!wi(e))return e;try{let t=xi(e),n=ki(t);return vi(n)}catch{return e}}async function wt(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:c}=t;e=$i(e);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=e,await l.decode();let s=l.naturalWidth,u=l.naturalHeight,d=Number.isFinite(a.w0)?a.w0:s,m=Number.isFinite(a.h0)?a.h0:u,h,g,p=Number.isFinite(n),f=Number.isFinite(r);if(p&&f)h=Math.max(1,n),g=Math.max(1,r);else if(p){let w=n/Math.max(1,d);h=n,g=m*w}else if(f){let w=r/Math.max(1,m);g=r,h=d*w}else h=s,g=u;h=h*i,g=g*i;let y=document.createElement("canvas");y.width=h*o,y.height=g*o,y.style.width=`${h}px`,y.style.height=`${g}px`;let x=y.getContext("2d");return o!==1&&x.scale(o,o),c&&(x.save(),x.fillStyle=c,x.fillRect(0,0,h,g),x.restore()),x.drawImage(l,0,0,h,g),y}var xt=Y(()=>{Ke()}),dt={};Ge(dt,{rasterize:()=>Er});async function Er(e,t){let n=await wt(e,t),r=new Image;return r.src=n.toDataURL(`image/${t.format}`,t.quality),await r.decode(),r.style.width=`${n.width/t.dpr}px`,r.style.height=`${n.height/t.dpr}px`,r}var ft=Y(()=>{xt()}),Jt={};Ge(Jt,{toImg:()=>Xn,toSvg:()=>Xn});async function Xn(e,t){let{scale:n=1,width:r,height:i,meta:o={}}=t,a=Number.isFinite(r),c=Number.isFinite(i),l=Number.isFinite(n)&&n!==1||a||c;if(xe()&&l)return await Er(e,{...t,format:"png",quality:1,meta:o});let s=new Image;if(s.decoding="sync",s.loading="eager",s.src=e,await s.decode(),a&&c)s.style.width=`${r}px`,s.style.height=`${i}px`;else if(a){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,m=r/Math.max(1,u);s.style.width=`${r}px`,s.style.height=`${Math.round(d*m)}px`}else if(c){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,m=i/Math.max(1,d);s.style.height=`${i}px`,s.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(s.naturalWidth*n),d=Math.round(s.naturalHeight*n);if(s.style.width=`${u}px`,s.style.height=`${d}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let m=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${d}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,s.src=e}catch(m){F(t,"SVG width/height patch in toImg failed",m)}}return s}var Yn=Y(()=>{re(),ft()}),kr={};Ge(kr,{toBlob:()=>$r});async function $r(e,t){let n=t.type;if(n==="svg"){let i=decodeURIComponent(e.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await wt(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var Mr=Y(()=>{xt()}),Ar={};Ge(Ar,{download:()=>Mi});async function Gn(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(r){if(r.name!=="AbortError")return!1}return!0}async function Mi(e,t){let n=(t?.format||t?.type||"").toLowerCase(),r=n==="jpg"?"jpeg":n||"png",i=t?.filename||`snapdom.${r}`,o={...t||{},format:r,type:r};o.dpr=1;let a=yi();if(r==="svg"){let s=await $r(e,{...o,type:"svg"});if(a&&await Gn(s,i))return;let u=URL.createObjectURL(s),d=document.createElement("a");d.href=u,d.download=i,document.body.appendChild(d),d.click(),URL.revokeObjectURL(u),d.remove();return}let c=await wt(e,o);if(a){let s=`image/${r}`,u=await new Promise(d=>c.toBlob(d,s,t?.quality));if(u&&await Gn(u,i))return}let l=document.createElement("a");l.href=c.toDataURL(`image/${r}`,t?.quality),l.download=i,document.body.appendChild(l),l.click(),l.remove()}var Ai=Y(()=>{Mr(),xt(),Ke()});re();re();ne();var Kn=new WeakMap,Zt=new Map,Qt=0;function Ve(){Qt++}var Jn=!1;function Li(e=document.documentElement){if(!Jn){Jn=!0;try{new MutationObserver(()=>Ve()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Ve()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",Ve),t.ready?.then(()=>Ve()).catch(()=>{}))}catch{}}}function Ni(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let m=e[d];if(cn(m)||i&&(i instanceof RegExp&&i.test(m)||typeof i=="function"&&i(m)))continue;let h=e.getPropertyValue(m);(m==="background-image"||m==="content")&&h.includes("url(")&&!h.includes("data:")&&(h="none"),n[m]=h}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let d of o)if(!n[d])try{let m=e.getPropertyValue(d);m&&(n[d]=m)}catch{}let a=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let d of a)if(!n[d])try{let m=e.getPropertyValue(d);m&&(n[d]=m)}catch{}if(t.embedFonts){let d=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let m of d)if(!n[m])try{let h=e.getPropertyValue(m);h&&(n[m]=h)}catch{}}r==="hidden"&&(n.opacity="0");let c=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,s=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(c===0&&l===0&&s===0&&u===0){let d=(e.getPropertyValue("border-image-source")||"").trim(),m=d&&d!=="none",h=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let g of h)delete n[g];m||(n.border="none")}return n}var Zn=new WeakMap;function Ti(e){let t=Zn.get(e);return t||(t=Object.entries(e).sort((n,r)=>n[0]<r[0]?-1:n[0]>r[0]?1:0).map(([n,r])=>`${n}:${r}`).join(";"),Zn.set(e,t),t)}function Ri(e,t=null,n={}){let r=Kn.get(e);if(r&&r.epoch===Qt)return r.snapshot;let i=t||getComputedStyle(e),o=Ni(i,n);return Wi(e,i,o),Kn.set(e,{epoch:Qt,snapshot:o}),o}function _i(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Zt,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:Zt,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function Pi(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],o=n.getPropertyValue(i);o&&t.style.setProperty(i,o)}}async function Te(e,t,n,r){if(e.tagName==="STYLE")return;let i=_i(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&Li(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Ve(),Zt.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:c}=i;a.styleCache.has(e)||a.styleCache.set(e,getComputedStyle(e));let l=a.styleCache.get(e);e.getAttribute?.("style")&&Pi(e,t,l);let s=Ri(e,l,i.options),u=Ti(s),d=c.snapshotKeyCache.get(u);if(!d){let m=e.tagName?.toLowerCase()||"div";d=Gt(s,m),c.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function Fi(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Ii(e){return e.backgroundImage&&e.backgroundImage!=="none"||e.backgroundColor&&e.backgroundColor!=="rgba(0, 0, 0, 0)"&&e.backgroundColor!=="transparent"||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||"visible")!=="visible"}function Di(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Oi(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let n=e.firstElementChild,r=e.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let i=e.scrollHeight;if(i===0)return!1;let o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return i>o+a}function Wi(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||!["div","section","article","main","aside","header","footer","nav"].includes(r))return;let i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid")||Fi(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||Ii(t)||Di(e))return;let c=t.overflowX||t.overflow||"visible",l=t.overflowY||t.overflow||"visible";if(c!=="visible"||l!=="visible")return;let s=t.clip;s&&s!=="auto"&&s!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||Oi(e,t)&&(delete n.height,delete n["block-size"])}xr();var Lr=["fill","stroke","color","background-color","stop-color"],Qn=new Map;function Hi(e,t){let n=t+"::"+e.toLowerCase(),r=Qn.get(n);if(r)return r;let i=document,o=t==="http://www.w3.org/2000/svg"?i.createElementNS(t,e):i.createElement(e),a=i.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(o),i.documentElement.appendChild(a);let c=getComputedStyle(o),l={};for(let s of Lr)l[s]=c.getPropertyValue(s)||"";return a.remove(),Qn.set(n,l),l}function Bi(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let n=e.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(c&&typeof c.value=="string"&&c.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let o=e.style;if(o&&o.length)for(let a=0;a<o.length;a++){let c=o[a],l=o.getPropertyValue(c);if(!l||!l.includes("var("))continue;let s=i&&i.getPropertyValue(c);if(s)try{t.style.setProperty(c,s.trim(),o.getPropertyPriority(c))}catch{}}}if(r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(!c||typeof c.value!="string"||!c.value.includes("var("))continue;let l=c.name,s=i&&i.getPropertyValue(l);if(s)try{t.style.setProperty(l,s.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=Hi(e.tagName,o);for(let c of Lr){let l=i.getPropertyValue(c)||"",s=a[c]||"";if(l&&l!==s)try{t.style.setProperty(c,l.trim())}catch{}}}}re();re();ne();_e();function Vt(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){Ne(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function Ui(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function qi(e,t,n=!0){return e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?Ui(r):r;return`:where(${t} ${i})`}).join(", ")}function ji(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${t}:is(${r.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${t} ${r.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,i,o)=>{let a=qi(o,t,!0);return`${r}${i}${a}{`}),e):""}function zi(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Vi(e){let t="";try{e.querySelectorAll("style").forEach(r=>{t+=(r.textContent||"")+`
|
|
4
|
+
`});let n=e.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let i of r.cssRules)t+=i.cssText+`
|
|
5
|
+
`}catch{}}catch{}return t}function Xi(e,t,n){if(!t)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=t,e.insertBefore(r,e.firstChild||null)}function Yi(e,t){try{let n=e.currentSrc||e.src||"";if(!n)return;t.setAttribute("src",n),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function Gi(e){let t=new Set;if(!e)return t;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(e);)t.add(r[1]);return t}function Ki(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let n=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(n)return n}catch{}return""}function Ji(e,t,n){let r=[];for(let i of t){let o=Ki(e,i);o&&r.push(`${i}: ${o};`)}return r.length?`${n}{${r.join("")}}
|
|
6
|
+
`:""}function Zi(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted","")))}async function Qi(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function ea(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let l=getComputedStyle(e);n=parseFloat(l.borderLeftWidth)||0,r=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(n+r))),c=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:c,rect:t}}function se(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(t=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(t===0||n===0)try{if(t===0){let r=parseFloat(e.getAttribute("width"));!isNaN(r)&&r>0&&(t=r)}if(n===0){let r=parseFloat(e.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function ta(e,t,n){let r=e.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function na(e,t,n){let r=await Qi(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=ea(e),c=n?.snap;if(!c&&typeof window<"u"&&window.snapdom&&(c=window.snapdom),!c||typeof c.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let l={...n,scale:1},s=ta(r,i,o),u;try{u=await c.toPng(r.documentElement,l)}finally{s()}u.style.display="block",u.style.width=`${i}px`,u.style.height=`${o}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),Te(e,d,t,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}function ra(e){let{width:t,height:n}=se(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,c=Math.round(t||r.width||0),l=Math.round(n||r.height||0),s=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),d=(e.type||"text").toLowerCase()==="checkbox",m=!!e.checked,h=!!e.indeterminate,g=Math.max(Math.min(s,u),12),p=document.createElement("div");p.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),p.style.cssText=`display:inline-block;width:${g}px;height:${g}px;vertical-align:middle;flex-shrink:0;line-height:0;`;let f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",String(g)),f.setAttribute("height",String(g)),f.setAttribute("viewBox",`0 0 ${g} ${g}`),p.appendChild(f);function y(){let x="#0a6ed1";try{i&&(x=i.accentColor||i.color||x)}catch{}let w=2,b=w/2,E=g-w;if(f.innerHTML="",d){let S=document.createElementNS("http://www.w3.org/2000/svg","rect");if(S.setAttribute("x",String(b)),S.setAttribute("y",String(b)),S.setAttribute("width",String(E)),S.setAttribute("height",String(E)),S.setAttribute("rx","2"),S.setAttribute("ry","2"),S.setAttribute("fill",m?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(w)),f.appendChild(S),m){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",`M ${b+2} ${g/2} L ${g/2-1} ${g-b-2} L ${g-b-2} ${b+2}`),v.setAttribute("stroke","white"),v.setAttribute("stroke-width",String(Math.max(1.5,w))),v.setAttribute("fill","none"),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round"),f.appendChild(v)}else if(h){let v=document.createElementNS("http://www.w3.org/2000/svg","rect"),$=Math.max(6,E-4);v.setAttribute("x",String((g-$)/2)),v.setAttribute("y",String((g-w)/2)),v.setAttribute("width",String($)),v.setAttribute("height",String(w)),v.setAttribute("fill",x),v.setAttribute("rx","1"),f.appendChild(v)}}else{let S=document.createElementNS("http://www.w3.org/2000/svg","circle");if(S.setAttribute("cx",String(g/2)),S.setAttribute("cy",String(g/2)),S.setAttribute("r",String((g-w)/2)),S.setAttribute("fill",m?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(w)),f.appendChild(S),m){let v=document.createElementNS("http://www.w3.org/2000/svg","circle"),$=Math.max(2,(g-w*2)*.35);v.setAttribute("cx",String(g/2)),v.setAttribute("cy",String(g/2)),v.setAttribute("r",String($)),v.setAttribute("fill","white"),f.appendChild(v)}}p.style.setProperty("width",`${g}px`,"important"),p.style.setProperty("height",`${g}px`,"important"),p.style.setProperty("min-width",`${g}px`,"important"),p.style.setProperty("min-height",`${g}px`,"important")}return y(),{el:p,applyVisual:y}}var je=new Q(80);async function Xe(e){if(C.resource?.has(e))return C.resource.get(e);if(je.has(e))return je.get(e);let t=(async()=>{let n=await te(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.resource?.set(e,n.data),n.data})();je.set(e,t);try{let n=await t;return je.set(e,n),n}catch(n){throw je.delete(e),n}}var oa=/\bblob:[^)"'\s]+/g;async function er(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(oa)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await Xe(r);n=n.split(r).join(i)}catch{}return n}function ct(e){return typeof e=="string"&&e.startsWith("blob:")}function ia(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let n=t.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function aa(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function la(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll("img"):[];for(let l of r)try{let s=l.getAttribute("src")||l.currentSrc||"";if(ct(s)){let d=await Xe(s);l.setAttribute("src",d)}let u=l.getAttribute("srcset");if(u&&u.includes("blob:")){let d=ia(u),m=!1;for(let h of d)if(ct(h.url))try{h.url=await Xe(h.url),m=!0}catch(g){F(n,"blobUrlToDataUrl for srcset item failed",g)}m&&l.setAttribute("srcset",aa(d))}}catch(s){F(n,"resolveBlobUrls for img failed",s)}let i=e.querySelectorAll?e.querySelectorAll("image"):[];for(let l of i)try{let s="http://www.w3.org/1999/xlink",u=l.getAttribute("href")||l.getAttributeNS?.(s,"href");if(ct(u)){let d=await Xe(u);l.setAttribute("href",d),l.removeAttributeNS?.(s,"href")}}catch(s){F(n,"resolveBlobUrls for SVG image href failed",s)}let o=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let l of o)try{let s=l.getAttribute("style");if(s&&s.includes("blob:")){let u=await er(s);l.setAttribute("style",u)}}catch(s){F(n,"replaceBlobUrls in inline style failed",s)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let s=l.textContent||"";s.includes("blob:")&&(l.textContent=await er(s))}catch(s){F(n,"replaceBlobUrls in style tag failed",s)}let c=["poster"];for(let l of c){let s=e.querySelectorAll?e.querySelectorAll(`[${l}^='blob:']`):[];for(let u of s)try{let d=u.getAttribute(l);ct(d)&&u.setAttribute(l,await Xe(d))}catch(d){F(n,`resolveBlobUrls for ${l} failed`,d)}}}Ke();async function mt(e,t,n){if(!e)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||gr.has(u))return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let u=document.createElement("div"),{width:d,height:m}=se(e),h=d||e.getBoundingClientRect().width||0,g=m||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${h}px;height:${g}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if(e.matches?.(u)){if(n.excludeMode==="hide"){let d=document.createElement("div"),{width:m,height:h}=se(e),g=m||e.getBoundingClientRect().width||0,p=h||e.getBoundingClientRect().height||0;return d.style.cssText=`display:inline-block;width:${g}px;height:${p}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof n.filter=="function")try{if(!n.filter(e)){if(n.filterMode==="hide"){let u=document.createElement("div"),{width:d,height:m}=se(e),h=d||e.getBoundingClientRect().width||0,g=m||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${h}px;height:${g}px;visibility:hidden;`,u}else if(n.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(e.tagName==="IFRAME"){let u=!1;try{u=!!(e.contentDocument||e.contentWindow?.document)}catch(d){F(t,"iframe same-origin probe failed",d)}if(u)try{return await na(e,t,n)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(n.placeholders){let{width:d,height:m}=se(e),h=document.createElement("div");return h.style.cssText=`width:${d}px;height:${m}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,Te(e,h,t,n),h}else{let{width:d,height:m}=se(e),h=document.createElement("div");return h.style.cssText=`display:inline-block;width:${d}px;height:${m}px;visibility:hidden;`,Te(e,h,t,n),h}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),Te(e,u,t,n);let d=document.createElement("div");return d.textContent=e.getAttribute("data-placeholder-text")||"",d.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(d),u}if(e.tagName==="CANVAS"){let u="";try{let g=e.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),u=e.toDataURL("image/png"),!u||u==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),u=e.toDataURL("image/png"),!u||u==="data:,"){let p=document.createElement("canvas");p.width=e.width,p.height=e.height;let f=p.getContext("2d");f&&(f.drawImage(e,0,0),u=p.toDataURL("image/png"))}}}catch(g){F(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){F(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:m,height:h}=se(e);return m>0&&(d.style.width=`${m}px`),h>0&&(d.style.height=`${h}px`),t.nodeMap.set(d,e),Te(e,d,t,n),d}let a;try{if(a=e.cloneNode(!1),Bi(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Yi(e,a);try{let{width:u,height:d}=se(e),m=Math.round(u||0),h=Math.round(d||0);m&&(a.dataset.snapdomWidth=String(m)),h&&(a.dataset.snapdomHeight=String(h))}catch(u){F(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),m=y=>{let x=u.match(new RegExp(`${y}\\s*:\\s*([^;]+)`,"i")),w=x?x[1].trim():d.getPropertyValue(y);return/%|auto/i.test(String(w||""))},h=parseInt(a.dataset.snapdomWidth||"0",10),g=parseInt(a.dataset.snapdomHeight||"0",10),p=m("width")||!h,f=m("height")||!g;p&&h&&(a.style.width=`${h}px`),f&&g&&(a.style.height=`${g}px`),h&&(a.style.minWidth=`${h}px`),g&&(a.style.minHeight=`${g}px`)}catch(u){F(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let c=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=se(e),m=u||e.getBoundingClientRect().width||0,h=d||e.getBoundingClientRect().height||0;m&&(a.style.width=`${m}px`),h&&(a.style.height=`${h}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&bi()){let{el:d,applyVisual:m}=ra(e);t.nodeMap.set(d,e),c=m,a=d}else a.value=e.value,a.setAttribute("value",e.value),e.checked!==void 0&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=e.value),Te(e,a,t,n),c&&c(),e.shadowRoot){let u=function(w,b){if(w.nodeType===Node.ELEMENT_NODE&&w.tagName==="STYLE")return b(null);mt(w,t,n).then(E=>{b(E||null)}).catch(()=>{b(null)})};try{let w=e.shadowRoot.querySelectorAll("slot");for(let b of w){let E=[];try{E=b.assignedNodes?.({flatten:!0})||b.assignedNodes?.()||[]}catch{E=b.assignedNodes?.()||[]}for(let S of E)r.add(S)}}catch{}let d=zi(t),m=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let h=Vi(e.shadowRoot),g=ji(h,m),p=Gi(h),f=Ji(e,p,m);Xi(a,f+g,d);let y=document.createDocumentFragment(),x=await Vt(Array.from(e.shadowRoot.childNodes),u,n.fast);y.append(...x.filter(w=>!!w)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=function(p,f){mt(p,t,n).then(y=>{y&&Zi(y),f(y||null)}).catch(()=>{f(null)})},d=e.assignedNodes?.({flatten:!0})||[],m=d.length>0?d:Array.from(e.childNodes),h=document.createDocumentFragment(),g=await Vt(Array.from(m),u,n.fast);return h.append(...g.filter(p=>!!p)),h}function l(u,d){if(r.has(u))return d(null);mt(u,t,n).then(m=>{d(m||null)}).catch(()=>{d(null)})}let s=await Vt(Array.from(e.childNodes),l,n.fast);if(a.append(...s.filter(u=>!!u)),i!==null&&a instanceof HTMLSelectElement){a.value=i;for(let u of a.options)u.value===i?u.setAttribute("selected",""):u.removeAttribute("selected")}return o!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=o),a}re();bt();ne();var sa=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],Ae=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),en=[];function ca(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?en.push(n):typeof n=="string"?en.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function ce(e){let t=typeof e=="string"?e:"",n=[...sa,...en];for(let r of n)if(r instanceof RegExp&&r.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function ua(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var tr=new Map;function da(e=""){let t=Object.create(null),n=String(e||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function fa(e,t,n){let r=String(e||""),i=r.toLowerCase(),o=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let a=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?c="rounded":/\bsharp\b/.test(o)?c="sharp":/\boutlined\b/.test(o)&&(c="outlined");let l=a===1,s=null;if(l&&(c==="outlined"&&Ae.materialIconsFilled?s={url:Ae.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&Ae.materialIconsRound?s={url:Ae.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&Ae.materialIconsSharp&&(s={url:Ae.materialIconsSharp,alias:"snapdom-mi-sharp"})),!s)return{familyForMeasure:r,familyForCanvas:r};if(!tr.has(s.alias))try{let d=new FontFace(s.alias,`url(${s.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),tr.set(s.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${s.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function ma(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function pa(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&t.toLowerCase()!=="currentcolor")return t;let r=e.color?.trim();return r&&r!=="inherit"?r:"#000"}async function ha(e,{family:t="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:a=""}={}){let c=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,s=da(o),{familyForMeasure:u,familyForCanvas:d}=await fa(c,a,s);await ma(d.replace(/^["']+|["']+$/g,""),r);let m=document.createElement("span");m.textContent=e,m.style.position="absolute",m.style.visibility="hidden",m.style.left="-99999px",m.style.whiteSpace="nowrap",m.style.fontFamily=u,m.style.fontWeight=String(n||"normal"),m.style.fontSize=`${r}px`,m.style.lineHeight="1",m.style.margin="0",m.style.padding="0",m.style.fontFeatureSettings="'liga' 1",m.style.fontVariantLigatures="normal",m.style.color=i,document.body.appendChild(m);let h=m.getBoundingClientRect(),g=Math.max(1,Math.ceil(h.width)),p=Math.max(1,Math.ceil(h.height));document.body.removeChild(m);let f=document.createElement("canvas");f.width=g*l,f.height=p*l;let y=f.getContext("2d");y.scale(l,l),y.font=`${n?`${n} `:""}${r}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:f.toDataURL(),width:g,height:p}}async function ga(e,t){if(!(e instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(r.length===0)return 0;let i=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],o=0;for(let a=0;a<r.length;a++){let c=r[a],l=i[a]||null;try{let s=getComputedStyle(l||c),u=s.fontFamily||"Material Icons";if(!ua(u))continue;let d=(l||c).textContent.trim();if(!d)continue;let m=parseInt(s.fontSize,10)||24,h=s.fontWeight&&s.fontWeight!=="normal"?s.fontWeight:"normal",g=pa(s),p=s.fontVariationSettings&&s.fontVariationSettings!=="normal"?s.fontVariationSettings:"",f=(l||c).className||"",{dataUrl:y,width:x,height:w}=await ha(d,{family:u,weight:h,fontSize:m,color:g,variation:p,className:f});c.textContent="";let b=c.ownerDocument.createElement("img");b.src=y,b.alt=d,b.style.height=`${m}px`,b.style.width=`${Math.max(1,Math.round(x/w*m))}px`,b.style.objectFit="contain",b.style.verticalAlign=getComputedStyle(c).verticalAlign||"baseline",c.appendChild(b),o++}catch{}}return o}_e();async function ya(e,t,n,r=32,i="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${r}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let c=a.getBoundingClientRect(),l=Math.ceil(c.width),s=Math.ceil(c.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,l*o),u.height=Math.max(1,s*o);let d=u.getContext("2d");return d.scale(o,o),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:l,height:s}}var ba=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),wa=["katex","mathjax","mathml"];function vt(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!ba.has(n.toLowerCase()))return n}return""}function pt(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ht(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function xa(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function va(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=pt(n[1]),o=pt(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=pt(t);return{min:r,max:r}}function Sa(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Ca(e){let t=String(e||"100%").trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function Ea(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function ka(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>i.endsWith(a))||n.some(a=>i===a.toLowerCase()||i.endsWith("."+a.toLowerCase())))return!0;let o=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(o)||/\.woff2?(\b|$)/.test(o)||wa.some(a=>o.includes(a)))return!0;for(let a of t){let c=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),s=Ea(a);if(o.includes(c)||o.includes(l)||s&&o.includes(s))return!0}return!1}catch{return!1}}function $a(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function nr(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return n;let a=o;try{a=new URL(o,t||location.href).href}catch{}return`url("${a}")`})}var tn=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,yt=4;async function Ma(e,t,n){if(!e)return e;let r=new Set;function i(c,l){try{return new URL(c,l||location.href).href}catch{return c}}async function o(c,l,s=0){if(s>yt)return console.warn(`[snapDOM] @import depth exceeded (${yt}) at ${l}`),c;let u="",d=0,m;for(;m=tn.exec(c);){u+=c.slice(d,m.index),d=tn.lastIndex;let h=(m[2]||m[4]||"").trim(),g=i(h,l);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let p="";try{let f=await te(g,{as:"text",useProxy:n,silent:!0});f.ok&&typeof f.data=="string"&&(p=f.data)}catch{}p?(p=nr(p,g),p=await o(p,g,s+1),u+=`
|
|
7
|
+
/* inlined: ${g} */
|
|
8
|
+
${p}
|
|
9
|
+
`):u+=m[0]}return u+=c.slice(d),u}let a=nr(e,t||location.href);return a=await o(a,t||location.href,0),a}var Nr=/url\((["']?)([^"')]+)\1\)/g,Aa=/@font-face[^{}]*\{[^}]*\}/g;function Tr(e){if(!e)return[];let t=[],n=e.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let i=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],a=i[2],c=l=>{if(!l.includes("?"))return parseInt(l,16);let s=parseInt(l.replace(/\?/g,"0"),16),u=parseInt(l.replace(/\?/g,"F"),16);return[s,u]};if(a){let l=c(o),s=c(a),u=Array.isArray(l)?l[0]:l,d=Array.isArray(s)?s[1]:s;t.push([Math.min(u,d),Math.max(u,d)])}else{let l=c(o);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function Rr(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[r,i]of t)if(n>=r&&n<=i)return!0;return!1}function dn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(Nr)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,t||location.href).href}catch{}n.push(i)}}return n}async function _r(e,t,n=""){let r=e;for(let i of e.matchAll(Nr)){let o=sn(i[0]);if(!o)continue;let a=o;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!ce(a)){if(C.resource?.has(a)){C.font?.add(a),r=r.replace(i[0],`url(${C.resource.get(a)})`);continue}if(!C.font?.has(a))try{let c=await te(a,{as:"dataURL",useProxy:n,silent:!0});if(c.ok&&typeof c.data=="string"){let l=c.data;C.resource?.set(a,l),C.font?.add(a),r=r.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function La(e){if(!e.length)return null;let t=(a,c)=>e.some(([l,s])=>!(s<a||l>c)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),o=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function rr(e={}){let t=new Set((e.families||[]).map(i=>String(i).toLowerCase())),n=new Set((e.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((e.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(t.size&&t.has(i.family.toLowerCase()))return!0;if(n.size)for(let a of i.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(r.size){let a=La(o);if(a&&r.has(a))return!0}return!1}}function Na(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of e.match(t)||[]){let a=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",c=vt(a),l=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),s=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),d=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),h=dn(m,location.href),g=h.length?h.map(f=>String(f).toLowerCase()).sort().join("|"):m.toLowerCase(),p=[String(c||"").toLowerCase(),l,s,u,d.toLowerCase(),g].join("|");n.has(p)||(n.add(p),r.push(o))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||"")}function Ta(e,t,n,r,i){let o=Array.from(e||[]).sort().join("|"),a=t?JSON.stringify({families:(t.families||[]).map(u=>String(u).toLowerCase()).sort(),domains:(t.domains||[]).map(u=>String(u).toLowerCase()).sort(),subsets:(t.subsets||[]).map(u=>String(u).toLowerCase()).sort()}):"",c=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),l=r||"",s=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${c}::px=${l}::fd=${s}`}async function Pr(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let o=(a,c)=>{try{return new URL(a,c||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let c=a.href?o(a.href,t):t;if(r.depth>=yt){console.warn(`[snapDOM] CSSOM import depth exceeded (${yt}) at ${c}`);continue}if(c&&r.visitedSheets.has(c)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${c}`);continue}c&&r.visitedSheets.add(c);let l={...r,depth:(r.depth||0)+1};await Pr(a.styleSheet,c,n,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let c=(a.style.getPropertyValue("font-family")||"").trim(),l=vt(c);if(!l||ce(l))continue;let s=(a.style.getPropertyValue("font-weight")||"400").trim(),u=(a.style.getPropertyValue("font-style")||"normal").trim(),d=(a.style.getPropertyValue("font-stretch")||"100%").trim(),m=(a.style.getPropertyValue("src")||"").trim(),h=(a.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(l,u,s,d))continue;let g=Tr(h);if(!Rr(r.usedCodepoints,g))continue;let p={family:l,weightSpec:s,styleSpec:u,stretchSpec:d,unicodeRange:h,srcRaw:m,srcUrls:dn(m,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(p,g))continue;if(/url\(/i.test(m)){let f=await _r(m,t||location.href,r.useProxy);await n(`@font-face{font-family:${l};src:${f};font-style:${u};font-weight:${s};font-stretch:${d};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${l};src:${m};font-style:${u};font-weight:${s};font-stretch:${d};${h?`unicode-range:${h};`:""}}`)}}}async function Ra({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let a=new Map;for(let f of e){let[y,x,w,b]=String(f).split("__");if(!y)continue;let E=a.get(y)||[];E.push({w:parseInt(x,10),s:w,st:parseInt(b,10)}),a.set(y,E)}function c(f,y,x,w){if(!a.has(f))return!1;let b=a.get(f),E=va(x),S=Sa(y),v=Ca(w),$=E.min!==E.max,P=E.min,B=A=>S.kind==="normal"&&A==="normal"||S.kind!=="normal"&&(A==="italic"||A==="oblique"),D=!1;for(let A of b){let M=$?A.w>=E.min&&A.w<=E.max:A.w===P,U=B(ht(A.s)),ee=A.st>=v.min&&A.st<=v.max;if(M&&U&&ee){D=!0;break}}if(D)return!0;if(!$)for(let A of b){let M=B(ht(A.s)),U=A.st>=v.min&&A.st<=v.max;if(Math.abs(P-A.w)<=300&&M&&U)return!0}if(!$&&S.kind==="normal"&&b.some(A=>ht(A.s)!=="normal"))for(let A of b){let M=Math.abs(P-A.w)<=300,U=A.st>=v.min&&A.st<=v.max;if(M&&U)return!0}return!1}let l=rr(n),s=Ta(e,n,r,i,o);if(C.resource?.has(s))return C.resource.get(s);let u=$a(e),d=[],m=tn;for(let f of document.querySelectorAll("style")){let y=f.textContent||"";for(let x of y.matchAll(m)){let w=(x[2]||x[4]||"").trim();!w||ce(w)||document.querySelector(`link[rel="stylesheet"][href="${w}"]`)||d.push(w)}}d.length&&await Promise.all(d.map(f=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${f}"]`))return y(null);let x=document.createElement("link");x.rel="stylesheet",x.href=f,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>y(x),x.onerror=()=>y(null),document.head.appendChild(x)})));let h="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(f=>!!f.href);for(let f of g)try{if(ce(f.href))continue;let y="",x=!1;try{x=new URL(f.href,location.href).origin===location.origin}catch{}if(!x){let b=Array.isArray(o)?o:[];if(!ka(f.href,u,b))continue}if(x){let b=Array.from(document.styleSheets).find(E=>E.href===f.href);if(b)try{let E=b.cssRules||[];y=Array.from(E).map(S=>S.cssText).join("")}catch{}}if(!y){let b=await te(f.href,{as:"text",useProxy:i});if(b?.ok&&typeof b.data=="string"&&(y=b.data),ce(f.href))continue}y=await Ma(y,f.href,i);let w="";for(let b of y.match(Aa)||[]){let E=(b.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),S=vt(E);if(!S||ce(S))continue;let v=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),$=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),B=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),D=(b.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),A=dn(D,f.href);if(!c(S,$,v,P))continue;let M=Tr(B);if(!Rr(t,M))continue;let U={family:S,weightSpec:v,styleSpec:$,stretchSpec:P,unicodeRange:B,srcRaw:D,srcUrls:A,href:f.href};if(n&&l(U,M))continue;let ee=/url\(/i.test(D)?await _r(b,f.href,i):b;w+=ee}w.trim()&&(h+=w)}catch{console.warn("[snapDOM] Failed to process stylesheet:",f.href)}let p={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:c,simpleExcluder:n?rr(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let f of document.styleSheets)if(!(f.href&&g.some(y=>y.href===f.href)))try{let y=f.href||location.origin+"/";y&&p.visitedSheets.add(y),await Pr(f,y,async x=>{h+=x},p)}catch{}try{for(let f of document.fonts||[]){if(!f||!f.family||f.status!=="loaded"||!f._snapdomSrc)continue;let y=String(f.family).replace(/^['"]+|['"]+$/g,"");if(ce(y)||!a.has(y)||n?.families&&n.families.some(w=>String(w).toLowerCase()===y.toLowerCase()))continue;let x=f._snapdomSrc;if(!String(x).startsWith("data:")){if(C.resource?.has(f._snapdomSrc))x=C.resource.get(f._snapdomSrc),C.font?.add(f._snapdomSrc);else if(!C.font?.has(f._snapdomSrc))try{let w=await te(f._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(w.ok&&typeof w.data=="string")x=w.data,C.resource?.set(f._snapdomSrc,x),C.font?.add(f._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",f._snapdomSrc);continue}}h+=`@font-face{font-family:'${y}';src:url(${x});font-style:${f.style||"normal"};font-weight:${f.weight||"normal"};}`}}catch{}for(let f of r){if(!f||typeof f!="object")continue;let y=String(f.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||ce(y)||!a.has(y)||n?.families&&n.families.some(v=>String(v).toLowerCase()===y.toLowerCase()))continue;let x=f.weight!=null?String(f.weight):"normal",w=f.style!=null?String(f.style):"normal",b=f.stretchPct!=null?`${f.stretchPct}%`:"100%",E=String(f.src||""),S=E;if(!S.startsWith("data:")){if(C.resource?.has(E))S=C.resource.get(E),C.font?.add(E);else if(!C.font?.has(E))try{let v=await te(E,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")S=v.data,C.resource?.set(E,S),C.font?.add(E);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",E);continue}}h+=`@font-face{font-family:'${y}';src:url(${S});font-style:${w};font-weight:${x};font-stretch:${b};}`}return h&&(h=Na(h),C.resource?.set(s,h)),h}function Fr(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let c=vt(a.fontFamily);if(!c)return;let l=(s,u,d)=>`${c}__${pt(s)}__${ht(u)}__${xa(d)}`;t.add(l(a.fontWeight,a.fontStyle,a.fontStretch))};r(getComputedStyle(e));let i=getComputedStyle(e,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(e,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let a=n.currentNode,c=getComputedStyle(a);r(c);let l=getComputedStyle(a,"::before");l&&l.content&&l.content!=="none"&&r(l);let s=getComputedStyle(a,"::after");s&&s.content&&s.content!=="none"&&r(s)}return t}function _a(e){let t=new Set,n=i=>{if(i)for(let o of i)t.add(o.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let i=r.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let o=i;for(let a of["::before","::after"]){let c=getComputedStyle(o,a)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let l=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(l)for(let s of l)try{t.add(parseInt(s.slice(1),16))}catch{}}}}}return t}async function Ir(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let i=document.createElement("div");i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let o of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${o}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",i.appendChild(a)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}ne();function Pa(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function Fa(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function or(e,t=!1){let n="",r=Math.max(1,e);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return t?n.toUpperCase():n}function ir(e,t=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,e)),i="";for(let[o,a]of n)for(;r>=o;)i+=a,r-=o;return t?i:i.toLowerCase()}function ar(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,e));case"decimal-leading-zero":return(e<10?"0":"")+String(Math.max(0,e));case"lower-alpha":return or(e,!1);case"upper-alpha":return or(e,!0);case"lower-roman":return ir(e,!1);case"upper-roman":return ir(e,!0);default:return String(Math.max(0,e))}}function Ia(e){let t=()=>C?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,o=m=>m&&m.tagName==="LI",a=m=>{let h=0,g=m?.parentElement;if(!g)return 0;for(let p of g.children){if(p===m)break;p.tagName==="LI"&&h++}return h},c=m=>{let h=new Map;for(let[g,p]of m)h.set(g,p.slice());return h},l=(m,h,g)=>{let p=c(m),f;try{f=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(f&&f!=="none")for(let x of f.split(",")){let w=x.trim().split(/\s+/),b=w[0],E=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!b)continue;let S=h.get(b);if(S&&S.length){let v=S.slice();v.push(E),p.set(b,v)}else p.set(b,[E])}let y;try{y=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(y&&y!=="none")for(let x of y.split(",")){let w=x.trim().split(/\s+/),b=w[0],E=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!b)continue;let S=p.get(b)||[];S.length===0&&S.push(0),S[S.length-1]+=E,p.set(b,S)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let x=g.parentElement,w=1;if(x&&x.tagName==="OL"){let E=x.getAttribute("start"),S=Number.isFinite(Number(E))?Number(E):1,v=a(g),$=g.getAttribute("value");w=Number.isFinite(Number($))?Number($):S+v}else w=1+a(g);let b=p.get("list-item")||[];b.length===0&&b.push(0),b[b.length-1]=w,p.set("list-item",b)}}catch{}return p},s=(m,h,g)=>{let p=l(g,h,m);r.set(m,p);let f=p;for(let y of m.children)f=s(y,p,f);return p},u=new Map;s(i,u,u);function d(){let m=t();if(m!==n){n=m;let h=new Map;s(i,h,h)}}return{get(m,h){d();let g=r.get(m)?.get(h);return g&&g.length?g[g.length-1]:0},getStack(m,h){d();let g=r.get(m)?.get(h);return g?g.slice():[]}}}function Da(e,t,n){if(!e||e==="none")return e;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=e.replace(r,(o,a,c)=>{let l=String(c).split(",").map(s=>s.trim());if(a==="counter"){let s=l[0]?.replace(/^["']|["']$/g,""),u=(l[1]||"decimal").toLowerCase(),d=n.get(t,s);return ar(d,u)}else{let s=l[0]?.replace(/^["']|["']$/g,""),u=l[1]?.replace(/^["']|["']$/g,"")??"",d=(l[2]||"decimal").toLowerCase(),m=n.getStack(t,s);return m.length?m.map(h=>ar(h,d)).join(u):""}});return Fa(i)}catch{return"- "}}_e();ne();var Le=new WeakMap,lr=300;function Oa(e,t){let n=Dr(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=cr(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):cr(e)}function nn(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Dr(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${t.length}|`,r=0;for(let o=0;o<t.length;o++){let a=t[o];if(a.tagName==="STYLE"){let c=a.textContent?a.textContent.length:0;n+=`S${c}|`;let l=a.sheet,s=l?nn(l):null;s&&(r+=s.length)}else{let c=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";n+=`L${c}|m:${l}|`;let s=a.sheet,u=s?nn(s):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function sr(e,t,n){let r=nn(e);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],a=o&&o.cssText?o.cssText:"";n.budget--;for(let c of t)if(a.includes(c))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let c=0;c<o.cssRules.length&&n.budget>0;c++){let l=o.cssRules[c],s=l&&l.cssText?l.cssText:"";n.budget--;for(let u of t)if(s.includes(u))return!0}if(n.budget<=0)return!1}return!1}function cr(e=document){let t=Dr(e),n=Le.get(e);if(n&&n.fingerprint===t)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=e.querySelectorAll("style");for(let a=0;a<i.length;a++){let c=i[a].textContent||"";for(let l of r)if(c.includes(l))return Le.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:lr};try{for(let c of o)if(sr(c,r,a))return Le.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),c={budget:lr};for(let l=0;l<a.length&&c.budget>0;l++){let s=a[l],u=null;if(s.tagName,u=s.sheet||null,u&&sr(u,r,c))return Le.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Le.set(e,{fingerprint:t,result:!0}),!0):(Le.set(e,{fingerprint:t,result:!1}),!1)}var Re=new WeakMap,ur=-1;function Wa(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Ha(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):Wa(e)}function rn(e,t){let n=e.parentElement,r=n?Re.get(n):null;return r?{get(i,o){let a=t.get(i,o),c=r.get(o);return typeof c=="number"?Math.max(a,c):a},getStack(i,o){let a=t.getStack(i,o);if(!a.length)return a;let c=r.get(o);if(typeof c=="number"){let l=a.slice();return l[l.length-1]=Math.max(l[l.length-1],c),l}return a}}:t}function on(e,t,n){let r=new Map;function i(l){let s=[];if(!l||l==="none")return s;for(let u of String(l).split(",")){let d=u.trim().split(/\s+/),m=d[0],h=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;m&&s.push({name:m,num:h})}return s}let o=i(t?.counterReset),a=i(t?.counterIncrement);function c(l){if(r.has(l))return r.get(l).slice();let s=n.getStack(e,l);s=s.length?s.slice():[];let u=o.find(m=>m.name===l);if(u){let m=Number.isFinite(u.num)?u.num:0;s=s.length?[...s,m]:[m]}let d=a.find(m=>m.name===l);if(d){let m=Number.isFinite(d.num)?d.num:1;s.length===0&&(s=[0]),s[s.length-1]+=m}return r.set(l,s.slice()),s}return{get(l,s){let u=c(s);return u.length?u[u.length-1]:0},getStack(l,s){return c(s)},__incs:a}}function Ba(e,t,n){let r;try{r=ue(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=rn(e,n),a=on(e,r,o),c=Pa(i)?Da(i,e,a):i;return{text:Ha(c),incs:a.__incs||[]}}async function an(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!Oa(i,n))return;let o=C?.session?.__counterEpoch??0;if(ur!==o&&(Re=new WeakMap,n&&(n.__counterCtx=null),ur=o),!n.__counterCtx)try{n.__counterCtx=Ia(e.ownerDocument||document)}catch(l){F(n,"buildCounterContext failed",l)}let a=n.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let s=ue(e,l);if(!s||s.content==="none"&&s.backgroundImage==="none"&&s.backgroundColor==="transparent"&&(s.borderStyle==="none"||parseFloat(s.borderWidth)===0)&&(!s.transform||s.transform==="none")&&s.display==="inline")continue;if(l==="::first-letter"){let R=ue(e);if(!(s.color!==R.color||s.fontSize!==R.fontSize||s.fontWeight!==R.fontWeight))continue;let T=Array.from(t.childNodes).find(We=>We.nodeType===Node.TEXT_NODE&&We.textContent?.trim().length>0);if(!T)continue;let W=T.textContent,O=W.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],de=W.slice(O?.length||0);if(!O||/[\uD800-\uDFFF]/.test(O))continue;let ae=document.createElement("span");ae.textContent=O,ae.dataset.snapdomPseudo="::first-letter";let Ee=Vn(s),ke=Gt(Ee,"span");n.styleMap.set(ae,ke);let ge=document.createTextNode(de);t.replaceChild(ge,T),t.insertBefore(ae,ge);continue}let u=s.content??"",d=u===""||u==="none"||u==="normal",{text:m,incs:h}=Ba(e,l,a),g=s.backgroundImage,p=s.backgroundColor,f=s.fontFamily,y=parseInt(s.fontSize)||32,x=parseInt(s.fontWeight)||!1,w=s.color||"#000",b=s.borderStyle,E=parseFloat(s.borderWidth),S=s.transform,v=ce(f),$=!d&&m!=="",P=g&&g!=="none",B=p&&p!=="transparent"&&p!=="rgba(0, 0, 0, 0)",D=b&&b!=="none"&&E>0,A=S&&S!=="none";if(!($||P||B||D||A)){if(h&&h.length&&e.parentElement){let R=Re.get(e.parentElement)||new Map;for(let{name:T}of h){if(!T)continue;let W=rn(e,a),O=on(e,ue(e,l),W).get(e,T);R.set(T,O)}Re.set(e.parentElement,R)}continue}let M=document.createElement("span");M.dataset.snapdomPseudo=l,M.style.pointerEvents="none";let U=Vn(s),ee=Gt(U,"span");if(n.styleMap.set(M,ee),v&&m&&m.length===1){let{dataUrl:R,width:T,height:W}=await ya(m,f,x,y,w),O=document.createElement("img");O.src=R,O.style=`height:${y}px;width:${T/W*y}px;object-fit:contain;`,M.appendChild(O),t.dataset.snapdomHasIcon="true"}else if(m&&m.startsWith("url(")){let R=sn(m);if(R?.trim())try{let T=await te(gt(R),{as:"dataURL",useProxy:r.useProxy});if(T?.ok&&typeof T.data=="string"){let W=document.createElement("img");W.src=T.data,W.style=`width:${y}px;height:auto;object-fit:contain;`,M.appendChild(W)}}catch(T){console.error(`[snapdom] Error in pseudo ${l} for`,e,T)}}else!v&&$&&(M.textContent=m);M.style.backgroundImage="none","maskImage"in M.style&&(M.style.maskImage="none"),"webkitMaskImage"in M.style&&(M.style.webkitMaskImage="none");try{M.style.backgroundRepeat=s.backgroundRepeat,M.style.backgroundSize=s.backgroundSize,s.backgroundPositionX&&s.backgroundPositionY?(M.style.backgroundPositionX=s.backgroundPositionX,M.style.backgroundPositionY=s.backgroundPositionY):M.style.backgroundPosition=s.backgroundPosition,M.style.backgroundOrigin=s.backgroundOrigin,M.style.backgroundClip=s.backgroundClip,M.style.backgroundAttachment=s.backgroundAttachment,M.style.backgroundBlendMode=s.backgroundBlendMode}catch{}if(P)try{let R=Kt(g),T=await Promise.all(R.map(hr));M.style.backgroundImage=T.join(", ")}catch(R){console.warn(`[snapdom] Failed to inline background-image for ${l}`,R)}B&&(M.style.backgroundColor=p);let et=M.childNodes.length>0||M.textContent?.trim()!==""||P||B||D||A;if(h&&h.length&&e.parentElement){let R=Re.get(e.parentElement)||new Map,T=rn(e,a),W=on(e,ue(e,l),T);for(let{name:O}of h){if(!O)continue;let de=W.get(e,O);R.set(O,de)}Re.set(e.parentElement,R)}if(!et)continue;l==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(M,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(M))}catch(s){console.warn(`[snapdom] Failed to capture ${l} for`,e,s)}let c=Array.from(t.children).filter(l=>!l.dataset.snapdomPseudo);if(n.nodeMap)for(let l of c){let s=n.nodeMap.get(l);s instanceof Element&&await an(s,l,n,r)}else{let l=Array.from(e.children);for(let s=0;s<Math.min(l.length,c.length);s++)await an(l[s],c[s],n,r)}}function Ua(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],c=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",s=b=>{if(!b||!b.getAttribute)return null;let E=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(l,"href"):null);if(E)return E;let S=b.attributes;if(!S)return null;for(let v=0;v<S.length;v++){let $=S[v];if(!$||!$.name)continue;if($.name==="href")return $.value;let P=$.name.indexOf(":");if(P!==-1&&$.name.slice(P+1)==="href")return $.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(b=>b.id)),d=new Set,m=!1,h=(b,E=null)=>{if(!b)return;o.lastIndex=0;let S;for(;S=o.exec(b);){m=!0;let v=(S[1]||"").trim();v&&(u.has(v)||(d.add(v),E&&!E.has(v)&&E.add(v)))}},g=b=>{let E=b.querySelectorAll("use");for(let v of E){let $=s(v);if(!$||!$.startsWith("#"))continue;m=!0;let P=$.slice(1).trim();P&&!u.has(P)&&d.add(P)}let S=b.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of S){h(v.getAttribute("style")||"");for(let $ of a)h(v.getAttribute($))}};for(let b of i)g(b);if(!m)return;let p=e.querySelector("svg.inline-defs-container");p||(p=n.createElementNS("http://www.w3.org/2000/svg","svg"),p.classList.add("inline-defs-container"),p.setAttribute("aria-hidden","true"),p.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(p,e.firstChild||null));let f=p.querySelector("defs")||null,y=b=>{if(!b||u.has(b))return null;let E=c(b),S=v=>{let $=r.querySelector(v);return $&&!e.contains($)?$:null};return S(`svg defs > *#${E}`)||S(`svg > symbol#${E}`)||S(`*#${E}`)};if(!d.size)return;let x=new Set(d),w=new Set;for(;x.size;){let b=x.values().next().value;if(x.delete(b),!b||u.has(b)||w.has(b))continue;let E=y(b);if(!E){w.add(b);continue}f||(f=n.createElementNS("http://www.w3.org/2000/svg","defs"),p.appendChild(f));let S=E.cloneNode(!0);S.id||S.setAttribute("id",b),f.appendChild(S),w.add(b),u.add(b);let v=[S,...S.querySelectorAll("*")];for(let $ of v){let P=s($);if(P&&P.startsWith("#")){let D=P.slice(1).trim();D&&!u.has(D)&&!w.has(D)&&x.add(D)}let B=$.getAttribute?.("style")||"";B&&h(B,x);for(let D of a){let A=$.getAttribute?.(D);A&&h(A,x)}}}}ne();function qa(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;getComputedStyle(t).position==="static"&&(t.style.position="relative");let r=e.getBoundingClientRect(),i=e.clientHeight,o="data-snap-ph",a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let c=a.currentNode,l=getComputedStyle(c),s=l.position;if(s!=="sticky"&&s!=="-webkit-sticky")continue;let u=dr(l.top),d=dr(l.bottom);if(u==null&&d==null)continue;let m=ja(c,e),h=za(t,m,o);if(!h)continue;let g=c.getBoundingClientRect(),p=g.width,f=g.height,y=g.left-r.left;if(!(p>0&&f>0)||!Number.isFinite(y))continue;let x=u!=null?u+n:n+(i-f-d);if(!Number.isFinite(x))continue;let w=Number.parseInt(l.zIndex,10),b=Number.isFinite(w),E=b?Math.max(w,1)+1:2,S=b?w-1:0,v=h.cloneNode(!1);v.setAttribute(o,"1"),v.style.position="sticky",v.style.left=`${y}px`,v.style.top=`${x}px`,v.style.width=`${p}px`,v.style.height=`${f}px`,v.style.visibility="hidden",v.style.zIndex=String(S),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",h.parentElement?.insertBefore(v,h),h.style.position="absolute",h.style.left=`${y}px`,h.style.top=`${x}px`,h.style.bottom="auto",h.style.zIndex=String(E),h.style.pointerEvents="none"}}function dr(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function ja(e,t){let n=[];for(let r=e;r&&r!==t;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function za(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=Va(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function Va(e,t){let n=[],r=e.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(t)||n.push(o)}return n}function Xa(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=n!=="none"&&parseFloat(r)>0,c=i==="none"||parseFloat(o)===0;a&&c&&(e.style.border=`${r} solid transparent`)}async function Ya(e,t={}){let n={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap,options:t},r,i="",o="";Xa(e);try{Ua(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await mt(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{await an(e,r,n,t)}catch(l){console.warn("inlinePseudoElements failed:",l)}await la(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let s of l)o+=s.textContent||"",s.remove()}catch(l){F(n,"Failed to extract shadow CSS from style[data-sd]",l)}let a=pi(n.styleMap);i=Array.from(a.entries()).map(([l,s])=>`.${s}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,s]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",s.replace(/;/g,"; "));continue}let u=a.get(s);u&&l.classList.add(u);let d=l.style?.backgroundImage,m=l.dataset?.snapdomHasIcon;d&&d!=="none"&&(l.style.backgroundImage=d),m&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,s]of n.nodeMap.entries()){let u=s.scrollLeft,d=s.scrollTop;if((u||d)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let m=document.createElement("div");for(m.style.transform=`translate(${-u}px, ${-d}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m)}}let c=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(qa(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||ue(e);n.styleCache.set(e,l);let s=ni(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=s||""}for(let[l,s]of n.nodeMap.entries())s.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}_e();var Or="http://www.w3.org/1999/xlink";function Ga(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Or,"href"):null)}function Ka(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,n=parseInt(e.dataset?.snapdomHeight||"",10)||0,r=parseInt(e.getAttribute("width")||"",10)||0,i=parseInt(e.getAttribute("height")||"",10)||0,o=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,c=t||o||r||e.width||e.naturalWidth||100,l=n||a||i||e.height||e.naturalHeight||100;return{width:c,height:l}}async function Ja(e,t={}){let n=Array.from(e.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let m=a.currentSrc||a.src||"";m&&a.setAttribute("src",m)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let c=a.src||"";if(!c)return;let l=await te(c,{as:"dataURL",useProxy:t.useProxy});if(l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")){a.src=l.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:s,height:u}=Ka(a),{fallbackURL:d}=t||{};if(d)try{let m=typeof d=="function"?await d({width:s,height:u,src:c,element:a}):d;if(m){let h=await te(m,{as:"dataURL",useProxy:t.useProxy});if(h?.ok&&typeof h.data=="string"){a.src=h.data,a.width||(a.width=s),a.height||(a.height=u);return}}}catch{}if(t.placeholders!==!1){let m=document.createElement("div");m.style.cssText=[`width:${s}px`,`height:${u}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${u}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),m.textContent="img",a.replaceWith(m)}else{let m=document.createElement("div");m.style.cssText=`display:inline-block;width:${s}px;height:${u}px;visibility:hidden;`,a.replaceWith(m)}};for(let a=0;a<n.length;a+=4){let c=n.slice(a,a+4).map(r);await Promise.allSettled(c)}let i=Array.from(e.querySelectorAll("image")),o=async a=>{let c=Ga(a);if(!c||c.startsWith("data:")||c.startsWith("blob:"))return;let l=await te(c,{as:"dataURL",useProxy:t.useProxy});l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")&&(a.setAttribute("href",l.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Or,"href"))};for(let a=0;a<i.length;a+=4){let c=i.slice(a,a+4).map(o);await Promise.allSettled(c)}}re();async function Za(e,t,n,r={}){let i=[[e,t]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],c=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[s,u]=i.shift();if(!u)continue;let d=n.get(s)||ue(s);n.has(s)||n.set(s,d);let m=(()=>{let p=d.getPropertyValue("border-image"),f=d.getPropertyValue("border-image-source");return p&&p!=="none"||f&&f!=="none"})();for(let p of c){let f=d.getPropertyValue(p);f&&u.style.setProperty(p,f)}for(let p of o){let f=d.getPropertyValue(p);if(p==="background-image"&&(!f||f==="none")){let w=d.getPropertyValue("background");w&&/url\s*\(/.test(w)&&(f=Kt(w).find(b=>/url\s*\(/.test(b))||f)}if(!f||f==="none")continue;let y=Kt(f),x=await Promise.all(y.map(w=>hr(w,r)));x.some(w=>w&&w!=="none"&&!/^url\(undefined/.test(w))&&u.style.setProperty(p,x.join(", "))}for(let p of a){let f=d.getPropertyValue(p);!f||f==="initial"||u.style.setProperty(p,f)}if(m)for(let p of l){let f=d.getPropertyValue(p);!f||f==="initial"||u.style.setProperty(p,f)}let h=s.shadowRoot?Array.from(s.shadowRoot.children).filter(p=>p.tagName!=="STYLE"):Array.from(s.children),g=Array.from(u.children).filter(p=>!(p.dataset?.snapdomPseudo||p.tagName==="STYLE"&&p.dataset?.sd));for(let p=0;p<Math.min(h.length,g.length);p++)i.push([h[p],g[p]])}}re();ne();function Qa(e){if(!e)return()=>{};let t=[];function n(r){let i=el(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function el(e){if(!e)return()=>{};let t=tl(e);if(t<=0)return()=>{};if(!ol(e))return()=>{};let n=getComputedStyle(e),r=Math.round(nl(n)*t+rl(n)),i=e.textContent??"",o=i;if(e.scrollHeight<=r+.5)return()=>{};let a=0,c=i.length,l=-1;for(;a<=c;){let s=a+c>>1;e.textContent=i.slice(0,s)+"\u2026",e.scrollHeight<=r+.5?(l=s,a=s+1):c=s-1}return e.textContent=(l>=0?i.slice(0,l):"")+"\u2026",()=>{e.textContent=o}}function tl(e){let t=getComputedStyle(e),n=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function nl(e){let t=(e.lineHeight||"").trim(),n=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(n*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith("%")?Math.round(parseFloat(t)/100*n):Math.round(n*1.2)}function rl(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ol(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Ye=[];function Wr(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return typeof t=="function"?t(n):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:n}=e;return typeof t=="function"?t(n):t}return typeof e=="function"?e():e}function il(...e){let t=e.flat();for(let n of t){let r=Wr(n);r&&(Ye.some(i=>i&&i.name&&r.name&&i.name===r.name)||Ye.push(r))}}function Hr(e){return(e&&Array.isArray(e.plugins)?e.plugins:Ye)||Ye}async function he(e,t,n){let r=n,i=Hr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,r);typeof c<"u"&&(r=c)}return r}async function al(e,t,n){let r=[],i=Hr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,n);typeof c<"u"&&r.push(c)}return r}function ll(e){let t=[];if(Array.isArray(e))for(let n of e){let r=Wr(n);if(!r||!r.name)continue;let i=t.findIndex(o=>o&&o.name===r.name);i>=0&&t.splice(i,1),t.push(r)}for(let n of Ye)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function sl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=ll(t)),e}re();function cl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){F(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){F(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){F(n,"stripRootShadows outline",o)}let i=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=i.length?i:"none"}catch(o){F(n,"stripRootShadows filter",o)}}function ul(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let r of n)r.remove()}function dl(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set(["xml","xlink"]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let a of Array.from(o.attributes)){let c=a.name;if(c.includes("@")){o.removeAttribute(c);continue}if(c.includes(":")){let l=c.split(":",1)[0];if(!r.has(l)){o.removeAttribute(c);continue}}if(n&&(c.startsWith("x-")||c.startsWith("v-")||c.startsWith(":")||c.startsWith("on:")||c.startsWith("bind:")||c.startsWith("let:")||c.startsWith("class:"))){o.removeAttribute(c);continue}}}}function fl(e,t={}){e&&(dl(e,t),ul(e))}function ml(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function pl(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function hl(e,t){if(!(e instanceof Element)||ml(e)||pl(e))return!1;let n=t.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=t.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||t.transform&&t.transform!=="none")}function gl(e,t,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let a=i.childElementCount>o.childElementCount,c=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,c),a&&hl(i,c)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let u=c.overflowY||c.overflowBlock||"visible",d=c.overflowX||c.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(o.style.overflow="visible")}let l=Array.from(i.children),s=Array.from(o.children);for(let u=0;u<Math.min(l.length,s.length);u++)r(l[u],s[u])}r(e,t)}function yl(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function bl(e,t){if(!(e instanceof Element))return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return t.excludeMode==="remove"}catch(r){F(t,"exclude selector match failed",r)}return!1}function wl(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,c=Array.from(e.children);for(let h of c){if(bl(h,t)||!yl(h))continue;let g=h.getBoundingClientRect(),p=g.top-r.top,f=g.bottom-r.top;f<=p||(p<i&&(i=p),f>o&&(o=f),a=!0)}let l=a?Math.max(0,o-i):0,s=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,m=parseFloat(n.paddingBottom)||0;return s+u+d+m+l}var k=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,xl=/::-webkit-scrollbar(-[a-z]+)?\b/i;function ln(e,t=new Set){let n="";if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=ln(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=ln(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(xl.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function vl(e){if(!e||!e.styleSheets)return"";let t=new Set,n="";for(let r of Array.from(e.styleSheets))try{let i=r.cssRules;i&&(n+=ln(i,t))}catch{}return n}function Sl(e){let t=e.boxShadow||"";if(!t||t==="none")return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(c=>c.trim()),r=0,i=0,o=0,a=0;for(let c of n){let l=c.match(/-?\d+(\.\d+)?px/g)?.map(p=>parseFloat(p))||[];if(l.length<2)continue;let[s,u,d=0,m=0]=l,h=Math.abs(s)+d+m,g=Math.abs(u)+d+m;i=Math.max(i,h+Math.max(s,0)),a=Math.max(a,h+Math.max(-s,0)),o=Math.max(o,g+Math.max(u,0)),r=Math.max(r,g+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(o),left:Math.ceil(a)}}function Cl(e){let t=(e.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=t?Math.ceil(parseFloat(t[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function El(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0);return{top:t,right:t,bottom:t,left:t}}function kl(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||t==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,a=0,c=!1;for(let l of n){c=!0;let s=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(p=>parseFloat(p))||[],[u=0,d=0,m=0]=s,h=Math.abs(u)+m,g=Math.abs(d)+m;i=Math.max(i,h+Math.max(u,0)),a=Math.max(a,h+Math.max(-u,0)),o=Math.max(o,g+Math.max(d,0)),r=Math.max(r,g+Math.max(-d,0))}return{bleed:{top:k(r),right:k(i),bottom:k(o),left:k(a)},has:c}}function $l(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let o=Br(e);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let i=r.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let o=i[1].split(",").map(a=>parseFloat(a.trim()));if(o.length===6&&o.every(Number.isFinite)){let[a,c,l,s]=o,u=Math.sqrt(a*a+c*c)||0,d=0,m=0,h=0,g=0,p=0,f=0;u>0&&(d=a/u,m=c/u,h=d*l+m*s,g=l-d*h,p=s-m*h,f=Math.sqrt(g*g+p*p)||0,f>0?h=h/f:h=0);let y=u,x=0,w=h*f,b=f;try{t.style.transform=`matrix(${y}, ${x}, ${w}, ${b}, 0, 0)`}catch{}return{a:y,b:x,c:w,d:b}}}try{let o=String(r).trim();return t.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function fr(e,t,n,r,i){let o=n.a,a=n.b,c=n.c,l=n.d,s=n.e||0,u=n.f||0;function d(y,x){let w=y-r,b=x-i,E=o*w+c*b,S=a*w+l*b;return E+=r+s,S+=i+u,[E,S]}let m=[d(0,0),d(e,0),d(0,t),d(e,t)],h=1/0,g=1/0,p=-1/0,f=-1/0;for(let[y,x]of m)y<h&&(h=y),x<g&&(g=x),y>p&&(p=y),x>f&&(f=x);return{minX:h,minY:g,maxX:p,maxY:f,width:p-h,height:f-g}}function Ml(e,t,n){let r=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],a=(c,l)=>{let s=c.toLowerCase();return s==="left"||s==="top"?0:s==="center"?l/2:s==="right"||s==="bottom"?l:s.endsWith("px")?parseFloat(s)||0:s.endsWith("%")?(parseFloat(s)||0)*l/100:/^-?\d+(\.\d+)?$/.test(s)&&parseFloat(s)||0};return{ox:a(i,t),oy:a(o,n)}}function Al(e){let t={rotate:"0deg",scale:null,translate:null},n=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(n){let i=l=>{try{return typeof n.has=="function"&&!n.has(l)||typeof n.get!="function"?null:n.get(l)}catch{return null}},o=i("rotate");if(o)if(o.angle){let l=o.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else o.unit?t.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:t.rotate=String(o);else{let l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=i("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,s="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${s}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let c=i("translate");if(c){let l="x"in c&&"value"in c.x?c.x.value:Array.isArray(c)?c[0]?.value:0,s="y"in c&&"value"in c.y?c.y.value:Array.isArray(c)?c[1]?.value:0,u="x"in c&&c.x?.unit?c.x.unit:"px",d="y"in c&&c.y?.unit?c.y.unit:"px";t.translate=`${l}${u} ${s}${d}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.translate:null}return t}let r=getComputedStyle(e);return t.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",t.scale=r.scale&&r.scale!=="none"?r.scale:null,t.translate=r.translate&&r.translate!=="none"?r.translate:null,t}var Xt=null;function Ll(){if(Xt)return Xt;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),Xt=e,e}function Nl(e){let t=Ll(),n=document.createElement("div");n.style.transformOrigin="0 0",e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let r=Br(n);return t.removeChild(n),r}function Tl(e){let t=getComputedStyle(e),n=t.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let r=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",i=t.scale&&t.scale!=="none"&&t.scale!=="1",o=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(r||i||o)}function Br(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}async function Ur(e,t){if(!e)throw new Error("Element cannot be null or undefined");ti(t.cache);let n=t.fast,r=t.outerTransforms!==!1,i=!!t.outerShadows,o={element:e,options:t,plugins:t.plugins},a,c,l,s="",u="",d,m,h=null;await he("beforeSnap",o),await he("beforeClone",o);let g=Qa(o.element);try{({clone:a,classCSS:c,styleCache:l}=await Ya(o.element,o.options)),!r&&a&&(h=$l(o.element,a)),!i&&a&&cl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:c,styleCache:l,...o},await he("afterClone",o),fl(o.clone),o.options?.excludeMode==="remove")try{gl(o.element,o.clone,o.styleCache)}catch(w){console.warn("[snapdom] shrink pass failed:",w)}try{await ga(o.clone,o.element)}catch{}await new Promise(w=>{Ne(async()=>{await Ja(o.clone,o.options),w()},{fast:n})}),await new Promise(w=>{Ne(async()=>{await Za(o.element,o.clone,o.styleCache,o.options),w()},{fast:n})}),t.embedFonts&&await new Promise(w=>{Ne(async()=>{let b=Fr(o.element),E=_a(o.element);if(xe()){let S=new Set(Array.from(b).map(v=>String(v).split("__")[0]).filter(Boolean));await Ir(S,1)}s=await Ra({required:b,usedCodepoints:E,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),w()},{fast:n})});let p=fi(o.clone).sort(),f=p.join(",");C.baseStyle.has(f)?u=C.baseStyle.get(f):await new Promise(w=>{Ne(()=>{u=mi(p),C.baseStyle.set(f,u),w()},{fast:n})});let y=vl(o.element?.ownerDocument||document);o={fontsCSS:s,baseCSS:u,scrollbarCSS:y,...o},await he("beforeRender",o),await new Promise(w=>{Ne(()=>{let b=ue(o.element),E=o.element.getBoundingClientRect(),S=Math.max(1,k(o.element.offsetWidth||parseFloat(b.width)||E.width||1)),v=Math.max(1,k(o.element.offsetHeight||parseFloat(b.height)||E.height||1)),$=o.element.ownerDocument||document;if(o.element===$.body||o.element===$.documentElement){let j=Math.max(o.element.scrollHeight||0,$.documentElement?.scrollHeight||0,$.body?.scrollHeight||0),V=Math.max(o.element.scrollWidth||0,$.documentElement?.scrollWidth||0,$.body?.scrollWidth||0);j>0&&(v=Math.max(v,k(j))),V>0&&(S=Math.max(S,k(V)));try{let z=$.createElement("div");z.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+S+"px!important;overflow:visible!important;visibility:hidden!important;";let nt=$.createElement("style");nt.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,z.appendChild(nt),z.appendChild(o.clone.cloneNode(!0)),$.body.appendChild(z);let rt=z.scrollHeight,ot=z.scrollWidth;$.body.removeChild(z),rt>0&&(v=Math.max(v,k(rt))),ot>0&&(S=Math.max(S,k(ot)))}catch{}}if(o.options?.excludeMode==="remove"){let j=wl(o.element,o.options);Number.isFinite(j)&&j>0&&(v=Math.max(1,Math.min(v,k(j+1))))}let P=(j,V=NaN)=>{let z=typeof j=="string"?parseFloat(j):j;return Number.isFinite(z)?z:V},B=P(o.options.width),D=P(o.options.height),A=S,M=v,U=Number.isFinite(B),ee=Number.isFinite(D),et=v>0?S/v:1;U&&ee?(A=Math.max(1,k(B)),M=Math.max(1,k(D))):U?(A=Math.max(1,k(B)),M=Math.max(1,k(A/(et||1)))):ee?(M=Math.max(1,k(D)),A=Math.max(1,k(M*(et||1)))):(A=S,M=v);let R=0,T=0,W=S,O=v;if(!r&&h&&Number.isFinite(h.a)){let j={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},V=fr(S,v,j,0,0);R=k(V.minX),T=k(V.minY),W=k(V.maxX),O=k(V.maxY)}else if(r&&mr(o.element)){let j=b.transform&&b.transform!=="none"?b.transform:"",V=Al(o.element),z=Nl({baseTransform:j,rotate:V.rotate||"0deg",scale:V.scale,translate:V.translate}),{ox:nt,oy:rt}=Ml(b,S,v),ot=z.is2D?z:new DOMMatrix(z.toString()),it=fr(S,v,ot,nt,rt);R=k(it.minX),T=k(it.minY),W=k(it.maxX),O=k(it.maxY)}let de=Sl(b),ae=Cl(b),Ee=El(b),ke=kl(b),ge=i?{top:k(de.top+ae.top+Ee.top+ke.bleed.top),right:k(de.right+ae.right+Ee.right+ke.bleed.right),bottom:k(de.bottom+ae.bottom+Ee.bottom+ke.bleed.bottom),left:k(de.left+ae.left+Ee.left+ke.bleed.left)}:{top:0,right:0,bottom:0,left:0};R=k(R-ge.left),T=k(T-ge.top),W=k(W+ge.right),O=k(O+ge.bottom);let We=Math.max(1,k(W-R)),bn=Math.max(1,k(O-T)),xo=U||ee?k(A/S):1,vo=ee||U?k(M/v):1,So=Math.max(1,k(We*xo)),Co=Math.max(1,k(bn*vo)),wn="http://www.w3.org/2000/svg",Eo=xe()&&mr(o.element)?1:0,fe=k(Eo+(r?0:1)),me=document.createElementNS(wn,"foreignObject"),ko=k(R),$o=k(T);me.setAttribute("x",String(k(-(ko-fe)))),me.setAttribute("y",String(k(-($o-fe)))),me.setAttribute("width",String(k(S+fe*2))),me.setAttribute("height",String(k(v+fe*2))),me.style.overflow="visible";let xn=document.createElement("style");xn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,me.appendChild(xn);let tt=document.createElement("div");tt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),tt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${k(S)}px;height:${k(v)}px`,tt.appendChild(o.clone),me.appendChild(tt);let Mo=new XMLSerializer().serializeToString(me),Ft=k(We+fe*2),It=k(bn+fe*2),vn=U||ee;t.meta={w0:S,h0:v,vbW:Ft,vbH:It,targetW:A,targetH:M};let Ao=xe()&&vn?Ft:k(So+fe*2),Lo=xe()&&vn?It:k(Co+fe*2),No=parseFloat(ue($.documentElement)?.fontSize)||16;m=`<svg xmlns="${wn}" width="${Ao}" height="${Lo}" viewBox="0 0 ${Ft} ${It}" font-size="${No}px">`+Mo+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,o={svgString:m,dataURL:d,...o},w()},{fast:n})}),await he("afterRender",o);let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),o.dataURL}function mr(e){return Tl(e)}ne();function Rl(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=ei(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null}}Ke();vr();re();_e();ne();function _l(...e){return il(...e),_}var _=Object.assign(Fl,{plugins:_l}),qr=Symbol("snapdom.internal"),Pl=Symbol("snapdom.internal.silent"),pr=!1;async function Fl(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=Rl(t);if(sl(n,t&&t.plugins),xe()&&(n.embedFonts===!0||Dl(e))){if(n.embedFonts)try{let i=Fr(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await Ir(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await Il(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&ca(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>_.toPng(r,i),toSvg:(r,i)=>_.toSvg(r,i)}),_.capture(e,n,qr)}_.capture=async(e,t,n)=>{if(n!==qr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Ur(e,t),i={img:async(p,f)=>{let{toImg:y}=await Promise.resolve().then(()=>(Yn(),Jt));return y(r,{...p,...f||{}})},svg:async(p,f)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Yn(),Jt));return y(r,{...p,...f||{}})},canvas:async(p,f)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(xt(),Sr));return y(r,{...p,...f||{}})},blob:async(p,f)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Mr(),kr));return y(r,{...p,...f||{}})},png:async(p,f)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ft(),dt));return y(r,{...p,...f||{},format:"png"})},jpeg:async(p,f)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ft(),dt));return y(r,{...p,...f||{},format:"jpeg"})},webp:async(p,f)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ft(),dt));return y(r,{...p,...f||{},format:"webp"})},download:async(p,f)=>{let{download:y}=await Promise.resolve().then(()=>(Ai(),Ar));return y(r,{...p,...f||{}})}},o={};for(let p of["img","svg","canvas","blob","png","jpeg","webp"])o[p]=async f=>i[p](t,{...f||{},[Pl]:!0});o.jpg=o.jpeg;let a={...t,export:{url:r},exports:o},c=await al("defineExports",a),l=Object.assign({},...c.filter(p=>p&&typeof p=="object")),s={...i,...l};s.jpeg&&!s.jpg&&(s.jpg=(p,f)=>s.jpeg(p,f));function u(p,f){let y={...t,...f||{}};return(p==="jpeg"||p==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,m=Promise.resolve();async function h(p,f){let y=async()=>{let x=s[p];if(!x)throw new Error(`[snapdom] Unknown export type: ${p}`);let w=u(p,f),b={...t,export:{type:p,options:w,url:r}};await he("beforeExport",b);let E=await x(b,w);return await he("afterExport",b,E),d||(d=!0,await he("afterSnap",t)),E};return m=m.then(y)}let g={url:r,toRaw:()=>r,to:(p,f)=>h(p,f),toImg:p=>h("img",p),toSvg:p=>h("svg",p),toCanvas:p=>h("canvas",p),toBlob:p=>h("blob",p),toPng:p=>h("png",p),toJpg:p=>h("jpg",p),toWebp:p=>h("webp",p),download:p=>h("download",p)};for(let p of Object.keys(s)){let f="to"+p.charAt(0).toUpperCase()+p.slice(1);g[f]||(g[f]=y=>h(p,y))}return g};_.toRaw=(e,t)=>_(e,t).then(n=>n.toRaw());_.toImg=(e,t)=>_(e,t).then(n=>n.toImg());_.toSvg=(e,t)=>_(e,t).then(n=>n.toSvg());_.toCanvas=(e,t)=>_(e,t).then(n=>n.toCanvas());_.toBlob=(e,t)=>_(e,t).then(n=>n.toBlob());_.toPng=(e,t)=>_(e,{...t,format:"png"}).then(n=>n.toPng());_.toJpg=(e,t)=>_(e,{...t,format:"jpeg"}).then(n=>n.toJpg());_.toWebp=(e,t)=>_(e,{...t,format:"webp"}).then(n=>n.toWebp());_.download=(e,t)=>_(e,t).then(n=>n.download());async function Il(e,t){if(pr)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Ur(e,n)}catch(i){F(t,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),r&&await new Promise(i=>{let o=new Image;try{o.decoding="sync",o.loading="eager"}catch(a){F(t,"safariWarmup img hints failed",a)}o.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",o.src=r,document.body.appendChild(o),(async()=>{try{typeof o.decode=="function"&&await o.decode()}catch(c){F(t,"safariWarmup img.decode failed",c)}let a=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-a<900;)await new Promise(c=>setTimeout(c,200));await new Promise(c=>requestAnimationFrame(c));try{let c=document.createElement("canvas");c.width=Math.max(1,o.naturalWidth||10),c.height=Math.max(1,o.naturalHeight||10);let l=c.getContext("2d");l&&l.drawImage(o,0,0)}catch{}await new Promise(c=>requestAnimationFrame(c));try{o.remove()}catch(c){F(t,"safariWarmup img.remove failed",c)}i()})()}),e.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){F(t,"safariWarmup canvas poke failed",o)}}),pr=!0}function Dl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let n=t.currentNode,r=getComputedStyle(n),i=r.backgroundImage&&r.backgroundImage!=="none",o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(i||o||n.tagName==="CANVAS")return!0}return!1}async function St(){let e=document.documentElement,t=window.innerWidth,n=window.innerHeight,r=await _.toPng(e,{width:t,height:n});if(!r)throw new Error("SnapDOM capture returned empty result");if(typeof r=="string"){let l=r.replace(/^data:image\/png;base64,/,"");if(!l)throw new Error("SnapDOM capture produced no image data");return{image:l,width:t,height:n}}r.complete||await Promise.race([new Promise((l,s)=>{r.onload=()=>l(),r.onerror=()=>s(new Error("SnapDOM image failed to load"))}),X(1e4).then(()=>{throw new Error("Screenshot image load timed out")})]);let i=document.createElement("canvas");i.width=r.naturalWidth||t,i.height=r.naturalHeight||n;let o=i.getContext("2d");if(!o)throw new Error("Failed to create canvas context");o.drawImage(r,0,0);let c=i.toDataURL("image/png").replace(/^data:image\/png;base64,/,"");if(!c)throw new Error("Canvas export produced no image data");return{image:c,width:t,height:n}}var jr="__mindstudio-cursor",Ol="__mindstudio-cursor-ripple",ve=450,$t=180,Ct=200,Wl=1500,Et="#DD2590",Hl=`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
<g filter="url(#filter0_d_4_78)">
|
|
11
|
+
<path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${Et}"/>
|
|
12
|
+
<path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${Et}"/>
|
|
13
|
+
</g>
|
|
14
|
+
<defs>
|
|
15
|
+
<filter id="filter0_d_4_78" x="3.15491" y="2.73625" width="27.442" height="28.8217" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
16
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
17
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
18
|
+
<feOffset dy="1"/>
|
|
19
|
+
<feGaussianBlur stdDeviation="1"/>
|
|
20
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
21
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"/>
|
|
22
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_4_78"/>
|
|
23
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_4_78" result="shape"/>
|
|
24
|
+
</filter>
|
|
25
|
+
</defs>
|
|
26
|
+
</svg>`,Bl="Remy",N=null,G=null,fn=0,mn=0,Pe=!1,kt=!1,K=null,Je=null;function zr(){window.location.search.includes("mode=iframe")&&Vr()}function Vr(){if(document.getElementById(jr))return;let e=document.createElement("div");e.id=jr,e.innerHTML=`
|
|
27
|
+
${Hl}
|
|
28
|
+
<div style="
|
|
29
|
+
position: absolute;
|
|
30
|
+
left: 26px;
|
|
31
|
+
top: 18px;
|
|
32
|
+
background: ${Et};
|
|
33
|
+
color: white;
|
|
34
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 1;
|
|
38
|
+
padding: 5px 8px;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
letter-spacing: 0.3px;
|
|
42
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
43
|
+
">${Bl}</div>
|
|
44
|
+
`,e.style.cssText=["position: fixed","top: 0","left: 0","z-index: 2147483647","pointer-events: none",`transition: left ${ve}ms cubic-bezier(0.4, 0, 0, 1), top ${ve}ms cubic-bezier(0.4, 0, 0, 1), transform ${$t}ms cubic-bezier(0.2, 0, 0.2, 1), opacity ${Ct}ms ease`,"will-change: left, top, transform, opacity","opacity: 0"].join("; ");let t=document.createElement("div");t.id=Ol,t.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${Et}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.body.appendChild(t),document.body.appendChild(e),N=e,G=t}async function Mt(e){if(!N)return;K&&(clearTimeout(K),K=null);let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2;if(!Pe){if(!kt){let i=window.innerWidth,o=window.innerHeight,a=Math.random(),c,l;a<.25?(c=i+20,l=o*.2+Math.random()*o*.6):a<.5?(c=i*.2+Math.random()*i*.6,l=o+20):a<.75?(c=-40,l=o*.2+Math.random()*o*.6):(c=i*.2+Math.random()*i*.6,l=-40),N.style.transition="none",N.style.left=`${c}px`,N.style.top=`${l}px`,N.style.opacity="0",N.offsetWidth}N.style.transition=`left ${ve}ms cubic-bezier(0.4, 0, 0, 1), top ${ve}ms cubic-bezier(0.4, 0, 0, 1), transform ${$t}ms cubic-bezier(0.2, 0, 0.2, 1), opacity ${Ct}ms ease`,N.style.opacity="1",Pe=!0,await X(Ct)}return fn=n,mn=r,kt=!0,N.style.left=`${fn}px`,N.style.top=`${mn}px`,X(ve)}async function At(){N&&(N.style.transform="scale(0.85) translateY(1px)",G&&(G.style.transition="none",G.style.left=`${fn}px`,G.style.top=`${mn}px`,G.style.width="0",G.style.height="0",G.style.opacity="0.35",G.offsetWidth,G.style.transition="width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out",G.style.width="40px",G.style.height="40px",G.style.opacity="0"),await X($t),N&&(N.style.transform="scale(1) translateY(0)"),await X(100))}function pn(){console.info("[cursor] scheduleHide",{hasCursorEl:!!N,forcedState:Je}),N&&Je!=="visible"&&(K&&clearTimeout(K),K=setTimeout(()=>{Je!=="visible"&&(N&&(N.style.opacity="0",Pe=!1),K=null)},Wl))}function Lt(e){if(console.info("[cursor] setForcedVisibility",e,{hasCursorEl:!!N,visible:Pe,hasPosition:kt,forcedState:Je}),Je=e,e==="visible"&&!N&&(console.info("[cursor] Creating cursor elements on demand"),Vr()),!N){console.info("[cursor] No cursorEl after create attempt");return}if(e==="visible"){if(K&&(clearTimeout(K),K=null),!kt){let t=window.innerWidth,n=window.innerHeight,r=Math.random(),i,o;r<.25?(i=t+20,o=n*.2+Math.random()*n*.6):r<.5?(i=t*.2+Math.random()*t*.6,o=n+20):r<.75?(i=-40,o=n*.2+Math.random()*n*.6):(i=t*.2+Math.random()*t*.6,o=-40),N.style.transition="none",N.style.left=`${i}px`,N.style.top=`${o}px`,N.offsetWidth,N.style.transition=`left ${ve}ms cubic-bezier(0.4, 0, 0, 1), top ${ve}ms cubic-bezier(0.4, 0, 0, 1), transform ${$t}ms cubic-bezier(0.2, 0, 0.2, 1), opacity ${Ct}ms ease`}N.style.opacity="1",Pe=!0}else e==="hidden"?(K&&(clearTimeout(K),K=null),N.style.opacity="0",Pe=!1):pn()}async function Nt(e,t){let n=Date.now(),r=[];En();for(let a=0;a<t.length;a++){let c=t[a],l=c.command;try{let s=await ql(c);r.push({index:a,command:l,...s})}catch(s){r.push({index:a,command:l,error:s instanceof Error?s.message:String(s)});break}}let i=kn(),o=await qe();return pn(),{id:e,steps:r,snapshot:o,logs:i,duration:Date.now()-n}}async function ql(e){switch(e.command){case"snapshot":return{result:await qe()};case"click":{let{element:t,matched:n}=pe(e);return await Mt(t),await At(),zt(t),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=pe(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await Mt(t),await At(),await Bn(t,r,{clear:!!e.clear}),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=pe(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');return await Mt(t),await At(),{result:`selected "${qn(t,r)}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await Un(e);return{result:"ok",matched:t,elapsed:n}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:jn(t)}}case"screenshot":{let{image:t,width:n,height:r}=await St();return{result:{image:t,width:n,height:r}}}default:throw new Error(`Unknown command: ${e.command}`)}}var jl="/__mindstudio_dev__/commands",zl="/__mindstudio_dev__/results",Vl=100,Xl=1e3,hn=!1;function Yr(){window.location.search.includes("mode=iframe")&&(hn||(hn=!0,Yl()))}async function Yl(){for(;hn;)try{let e=await fetch(jl);if(e.status===200){let t=await e.json();t?.id&&Array.isArray(t.steps)&&await Gl(t.id,t.steps)}await X(Vl)}catch{await X(Xl)}}async function Gl(e,t){try{let n=await Nt(e,t);await Xr(n)}catch{await Xr({id:e,steps:[],snapshot:"",logs:[],duration:0})}}async function Xr(e){try{await fetch(zl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch{}}var oe="#DD2590";var Gr="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Kl=200,Kr=`
|
|
45
|
+
width: ${Kl}px;
|
|
46
|
+
background: ${oe};
|
|
47
|
+
border-radius: 19px 120px 120px;
|
|
48
|
+
font-weight: bold;
|
|
49
|
+
padding: 8px 18px 10px 18px;
|
|
50
|
+
font-family: ${Gr};
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
line-height: 1.4;
|
|
53
|
+
color: white;
|
|
54
|
+
outline: none;
|
|
55
|
+
overflow-wrap: break-word;
|
|
56
|
+
white-space: pre-wrap;
|
|
57
|
+
transition: box-shadow 0.15s;
|
|
58
|
+
`.trim(),Ze={inactive:"0 2px 6px rgba(0, 0, 0, 0.15)",selected:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px",editing:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px"},Jl=`
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: -8px;
|
|
61
|
+
right: -4px;
|
|
62
|
+
width: 22px;
|
|
63
|
+
height: 22px;
|
|
64
|
+
background: white;
|
|
65
|
+
color: ${oe};
|
|
66
|
+
border: 2px solid ${oe};
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
line-height: 16px;
|
|
70
|
+
text-align: center;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
pointer-events: auto;
|
|
73
|
+
display: none;
|
|
74
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
75
|
+
font-family: ${Gr};
|
|
76
|
+
font-weight: bold;
|
|
77
|
+
`.trim(),Jr=0;function Zr(){let e=document.createElement("div");return e.dataset.deleteBtn="true",e.innerHTML="\xD7",e.style.cssText=Jl,e}function Qr(e,t){let n=`note-${++Jr}`,r=document.createElement("div");r.id=n,r.dataset.noteId=n,r.style.cssText=`
|
|
78
|
+
position: absolute;
|
|
79
|
+
left: ${e}px;
|
|
80
|
+
top: ${t}px;
|
|
81
|
+
pointer-events: auto;
|
|
82
|
+
z-index: 1;
|
|
83
|
+
`;let i=document.createElement("div");i.style.cssText=`
|
|
84
|
+
width: 14px;
|
|
85
|
+
height: 14px;
|
|
86
|
+
background: ${oe};
|
|
87
|
+
border: 2px solid white;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px;
|
|
90
|
+
position: absolute;
|
|
91
|
+
left: -16px;
|
|
92
|
+
top: -14px;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
z-index: 2;
|
|
95
|
+
`;let o=document.createElement("div");o.style.cssText="position: relative;";let a=document.createElement("div");a.dataset.bubble="true",a.style.cssText=`
|
|
96
|
+
${Kr}
|
|
97
|
+
box-shadow: ${Ze.inactive};
|
|
98
|
+
cursor: grab;
|
|
99
|
+
`;let c=Zr();return o.appendChild(a),o.appendChild(c),r.appendChild(i),r.appendChild(o),{id:n,type:"pin",x:e,y:t,element:r,bubble:a,deleteBtn:c,state:"inactive"}}function eo(e,t,n,r){let i=`note-${++Jr}`,o=document.createElement("div");o.id=i,o.dataset.noteId=i,o.style.cssText=`
|
|
100
|
+
position: absolute;
|
|
101
|
+
left: ${e}px;
|
|
102
|
+
top: ${t}px;
|
|
103
|
+
pointer-events: auto;
|
|
104
|
+
z-index: 1;
|
|
105
|
+
`;let a=document.createElement("div");a.style.cssText=`
|
|
106
|
+
width: ${n}px;
|
|
107
|
+
height: ${r}px;
|
|
108
|
+
border: 4px dashed ${oe};
|
|
109
|
+
border-radius: 12px;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
`;let c=document.createElement("div");c.style.cssText=`
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: 0;
|
|
114
|
+
top: ${r+8}px;
|
|
115
|
+
`;let l=document.createElement("div");l.dataset.bubble="true",l.style.cssText=`
|
|
116
|
+
${Kr}
|
|
117
|
+
box-shadow: ${Ze.inactive};
|
|
118
|
+
cursor: grab;
|
|
119
|
+
`;let s=Zr();return c.appendChild(l),c.appendChild(s),o.appendChild(a),o.appendChild(c),{id:i,type:"area",x:e,y:t,width:n,height:r,element:o,bubble:l,deleteBtn:s,state:"inactive"}}function to(e){e.state="selected",e.bubble.contentEditable="false",e.bubble.style.boxShadow=Ze.selected,e.bubble.style.cursor="grab",e.deleteBtn.style.display="block"}function Tt(e){e.state="editing",e.bubble.contentEditable="true",e.bubble.style.boxShadow=Ze.editing,e.bubble.style.cursor="text",e.deleteBtn.style.display="block",e.bubble.focus();let t=window.getSelection();t&&(t.selectAllChildren(e.bubble),t.collapseToEnd())}function Fe(e){return e.bubble.textContent?.trim()||""?(e.state="inactive",e.bubble.contentEditable="false",e.bubble.style.boxShadow=Ze.inactive,e.bubble.style.cursor="grab",e.deleteBtn.style.display="none",!0):!1}var Zl="__mindstudio-notes-overlay",Ql="__mindstudio-notes-cursor",es=5,ts=`<svg width="25" height="26" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
120
|
+
<g filter="url(#filter0_d_notes)">
|
|
121
|
+
<path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${oe}"/>
|
|
122
|
+
<path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${oe}"/>
|
|
123
|
+
</g>
|
|
124
|
+
<defs>
|
|
125
|
+
<filter id="filter0_d_notes" x="3.15491" y="2.73625" width="27.442" height="28.8217" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
126
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
127
|
+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
|
128
|
+
<feOffset dy="1"/>
|
|
129
|
+
<feGaussianBlur stdDeviation="1"/>
|
|
130
|
+
<feComposite in2="hardAlpha" operator="out"/>
|
|
131
|
+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"/>
|
|
132
|
+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
|
133
|
+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
|
134
|
+
</filter>
|
|
135
|
+
</defs>
|
|
136
|
+
</svg>`,I=null,q=null,Ce=[],L=null,Rt=!1,De=0,Oe=0,_t=!1,Qe=!1,H=null,ie=null,ro=0,oo=0;function io(){I||(I=document.createElement("div"),I.id=Zl,I.style.cssText=`
|
|
137
|
+
position: fixed;
|
|
138
|
+
inset: 0;
|
|
139
|
+
z-index: 2147483646;
|
|
140
|
+
cursor: none;
|
|
141
|
+
touch-action: none;
|
|
142
|
+
`,q=document.createElement("div"),q.id=Ql,q.innerHTML=ts,q.style.cssText=`
|
|
143
|
+
position: fixed;
|
|
144
|
+
top: 0;
|
|
145
|
+
left: 0;
|
|
146
|
+
z-index: 2147483647;
|
|
147
|
+
pointer-events: none;
|
|
148
|
+
will-change: left, top;
|
|
149
|
+
`,I.addEventListener("pointerdown",co),I.addEventListener("pointermove",so),document.addEventListener("pointermove",uo,{capture:!0}),document.addEventListener("pointerup",fo,{capture:!0}),document.addEventListener("pointercancel",mo,{capture:!0}),document.addEventListener("keydown",po),document.body.appendChild(I),document.body.appendChild(q))}function ao(){document.removeEventListener("pointermove",uo,{capture:!0}),document.removeEventListener("pointerup",fo,{capture:!0}),document.removeEventListener("pointercancel",mo,{capture:!0}),document.removeEventListener("keydown",po),I&&(I.removeEventListener("pointerdown",co),I.removeEventListener("pointermove",so),I.remove(),I=null),q&&(q.remove(),q=null),Ce=[],L=null,Ie()}function lo(){q&&(q.style.display="none"),ie=null,Qe=!1,Ie()}function so(e){if(!q||!I)return;q.style.left=`${e.clientX}px`,q.style.top=`${e.clientY}px`,ho(e.target)?(q.style.display="none",I.style.cursor=""):(q.style.display="",I.style.cursor="none")}function co(e){if(!I)return;let t=e.target;if(t.dataset?.deleteBtn==="true"||t.closest("[data-delete-btn]")){let r=t.closest("[data-note-id]");if(r){let i=Ce.find(o=>o.id===r.id);if(i){Se(i),e.preventDefault(),e.stopPropagation();return}}}I.setPointerCapture(e.pointerId);let n=ho(e.target);if(n){if(n.state==="editing")return;if(n.state==="selected"){let r=e.target;if(r.dataset?.bubble==="true"||r.closest("[data-bubble]")){Tt(n),L=n,e.preventDefault();return}no(n,e),e.preventDefault();return}L&&L!==n&&(Fe(L)||Se(L)),to(n),L=n,no(n,e),e.preventDefault();return}if(L&&(L.state==="editing"||L.state==="selected")){Fe(L)||Se(L),L=null,Qe=!0,e.preventDefault();return}Rt=!0,De=e.clientX,Oe=e.clientY,_t=!1,Qe=!1,e.preventDefault()}function uo(e){if(ie){let r=e.clientX-ro,i=e.clientY-oo;ie.x=r,ie.y=i,ie.element.style.left=`${r}px`,ie.element.style.top=`${i}px`;return}if(!Rt||!I)return;let t=e.clientX-De,n=e.clientY-Oe;Math.sqrt(t*t+n*n)>es&&(_t=!0,H||(H=document.createElement("div"),H.style.cssText=`
|
|
150
|
+
position: fixed;
|
|
151
|
+
border: 4px dashed ${oe};
|
|
152
|
+
border-radius: 12px;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
z-index: 2;
|
|
155
|
+
`,I.appendChild(H)),H.style.left=`${Math.min(De,e.clientX)}px`,H.style.top=`${Math.min(Oe,e.clientY)}px`,H.style.width=`${Math.abs(t)}px`,H.style.height=`${Math.abs(n)}px`)}function fo(e){if(I)try{I.releasePointerCapture(e.pointerId)}catch{}if(ie){ie=null;return}if(Qe){Qe=!1,Ie();return}if(!Rt||!I){Ie();return}if(_t){H&&(H.remove(),H=null);let t=Math.min(De,e.clientX),n=Math.min(Oe,e.clientY),r=Math.abs(e.clientX-De),i=Math.abs(e.clientY-Oe);if(r>10&&i>10){let o=eo(t,n,r,i);I.appendChild(o.element),Ce.push(o),Tt(o),L=o}}else{let t=Qr(e.clientX,e.clientY);I.appendChild(t.element),Ce.push(t),Tt(t),L=t}Ie()}function mo(){H&&(H.remove(),H=null),ie=null,Ie()}function po(e){if(L){if(e.key==="Enter"&&!e.shiftKey&&L.state==="editing"){Fe(L)||Se(L),L=null,e.preventDefault();return}if(e.key==="Escape"){L.state==="editing"?(Fe(L)||Se(L),L=null):L.state==="selected"&&(Fe(L),L=null),e.preventDefault();return}if(L.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){Se(L),L=null,e.preventDefault();return}L.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&L.bubble.textContent?.trim()===""&&(Se(L),L=null,e.preventDefault())}}function no(e,t){ie=e,ro=t.clientX-e.x,oo=t.clientY-e.y}function ho(e){for(let t of Ce)if(t.element.contains(e))return t;return null}function Se(e){e.element.remove(),Ce=Ce.filter(t=>t.id!==e.id),L===e&&(L=null)}function Ie(){Rt=!1,De=0,Oe=0,_t=!1,H&&(H.remove(),H=null)}var Pt=!1;function go(){Pt||(Pt=!0,io())}function yo(){Pt&&(Pt=!1,ao())}async function bo(){let{image:e}=await St();return e}var gn="mindstudio-browser-agent",yn=null;function wo(){yn||(yn=async e=>{if(e.source===window)return;let t=e.data;if(!(!t||t.channel!==gn))switch(t.command){case"notes-enter":go();break;case"notes-exit":yo();break;case"notes-cursor-hide":lo();break;case"cursor-show":Lt("visible");break;case"cursor-hide":Lt("hidden");break;case"cursor-auto":Lt(null);break;case"notes-screenshot":{try{let n=await bo();window.parent.postMessage({channel:gn,command:"screenshot-result",image:n},"*")}catch(n){window.parent.postMessage({channel:gn,command:"screenshot-result",error:n instanceof Error?n.message:"Screenshot failed"},"*")}break}}},window.addEventListener("message",yn))}window.__MINDSTUDIO_BROWSER_AGENT__||(window.__MINDSTUDIO_BROWSER_AGENT__=!0,$n(),Tn(),Rn(),_n(),Fn(),Pn(),Yr(),zr(),wo());return Io(ns);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstudio-ai/browser-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Browser-side agent for MindStudio dev previews — captures logs, provides DOM snapshots, and enables remote interaction.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsup": "^8.5.0",
|
|
20
20
|
"typescript": "^5.7.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@zumer/snapdom": "^2.5.0"
|
|
21
24
|
}
|
|
22
25
|
}
|