browsertrack 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -0
- package/dist/chunk-6A7FFDIB.js +221 -0
- package/dist/chunk-6A7FFDIB.js.map +1 -0
- package/dist/chunk-ANMR5WBH.js +659 -0
- package/dist/chunk-ANMR5WBH.js.map +1 -0
- package/dist/chunk-BSKNG4V7.js +1199 -0
- package/dist/chunk-BSKNG4V7.js.map +1 -0
- package/dist/chunk-X7C5CHBO.js +2080 -0
- package/dist/chunk-X7C5CHBO.js.map +1 -0
- package/dist/chunk-ZLNGOOH2.js +554 -0
- package/dist/chunk-ZLNGOOH2.js.map +1 -0
- package/dist/cli/index.js +2829 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/index.cjs +2218 -0
- package/dist/client/index.d.ts +197 -0
- package/dist/client/index.js +20 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client.iife.js +309 -0
- package/dist/core/index.d.ts +78 -0
- package/dist/core/index.js +31 -0
- package/dist/core/index.js.map +1 -0
- package/dist/daemon/index.d.ts +58 -0
- package/dist/daemon/index.js +32 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/engine-DKloFjvs.d.ts +157 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +11 -0
- package/dist/mcp/index.js +12 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/notes-CBvN91Wf.d.ts +260 -0
- package/dist/projects-CY8ungMt.d.ts +99 -0
- package/dist/server-CN-se8td.d.ts +55 -0
- package/examples/test-app/index.html +299 -0
- package/package.json +52 -7
- package/packages/cli/src/index.ts +413 -0
- package/packages/client/package.json +28 -0
- package/packages/client/src/breadcrumbs.ts +30 -0
- package/packages/client/src/client.ts +278 -0
- package/packages/client/src/commands/handler.ts +301 -0
- package/packages/client/src/config.ts +37 -0
- package/packages/client/src/index.ts +50 -0
- package/packages/client/src/interceptors/console.ts +68 -0
- package/packages/client/src/interceptors/interaction.ts +119 -0
- package/packages/client/src/interceptors/navigation.ts +93 -0
- package/packages/client/src/interceptors/network.ts +165 -0
- package/packages/client/src/interceptors/runtime.ts +65 -0
- package/packages/client/src/notes/inspector.ts +943 -0
- package/packages/client/src/screenshot/browser-script-driver.ts +192 -0
- package/packages/client/src/screenshot/driver.ts +14 -0
- package/packages/client/src/transport/websocket.ts +179 -0
- package/packages/client/tsconfig.json +8 -0
- package/packages/core/dist/index.d.ts +317 -0
- package/packages/core/dist/index.js +221 -0
- package/packages/core/package.json +23 -0
- package/packages/core/src/fingerprint.ts +120 -0
- package/packages/core/src/index.ts +9 -0
- package/packages/core/src/redaction.ts +139 -0
- package/packages/core/src/selector.ts +77 -0
- package/packages/core/src/types/commands.ts +101 -0
- package/packages/core/src/types/events.ts +108 -0
- package/packages/core/src/types/incidents.ts +54 -0
- package/packages/core/src/types/notes.ts +106 -0
- package/packages/core/src/types/probes.ts +44 -0
- package/packages/core/src/types/projects.ts +20 -0
- package/packages/core/tsconfig.json +8 -0
- package/packages/daemon/src/config.ts +29 -0
- package/packages/daemon/src/incidents/engine.ts +211 -0
- package/packages/daemon/src/index.ts +18 -0
- package/packages/daemon/src/notes/engine.ts +92 -0
- package/packages/daemon/src/notes/verification.ts +191 -0
- package/packages/daemon/src/server/daemon.ts +112 -0
- package/packages/daemon/src/server/http.ts +165 -0
- package/packages/daemon/src/server/ws.ts +175 -0
- package/packages/daemon/src/session/manager.ts +126 -0
- package/packages/daemon/src/storage/db.ts +733 -0
- package/packages/daemon/src/storage/screenshot-store.ts +49 -0
- package/packages/daemon/src/verification/engine.ts +264 -0
- package/packages/mcp/src/handlers.ts +398 -0
- package/packages/mcp/src/index.ts +3 -0
- package/packages/mcp/src/server.ts +86 -0
- package/packages/mcp/src/tools.ts +236 -0
- package/src/index.ts +4 -0
- package/test/client/interceptors.test.ts +69 -0
- package/test/core/fingerprint.test.ts +53 -0
- package/test/core/notes.test.ts +66 -0
- package/test/core/redaction.test.ts +48 -0
- package/test/daemon/incident-engine.test.ts +98 -0
- package/test/daemon/notes-storage.test.ts +130 -0
- package/test/daemon/notes-verification.test.ts +135 -0
- package/test/daemon/storage.test.ts +123 -0
- package/test/daemon/verification-engine.test.ts +88 -0
- package/test/e2e/daemon-mcp-e2e.test.ts +153 -0
- package/test/e2e/visual-notes-e2e.test.ts +205 -0
- package/test/mcp/handlers.test.ts +116 -0
- package/test/mcp/notes.test.ts +107 -0
- package/tsconfig.base.json +17 -0
- package/tsconfig.json +26 -0
- package/tsup.config.ts +54 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";var BrowserTrack=(()=>{var tt=Object.defineProperty;var go=Object.getOwnPropertyDescriptor;var yo=Object.getOwnPropertyNames;var bo=Object.prototype.hasOwnProperty;var wo=(e,t,r)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var xo=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},vo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of yo(t))!bo.call(e,o)&&o!==r&&tt(e,o,{get:()=>t[o],enumerable:!(n=go(t,o))||n.enumerable});return e};var So=e=>vo(tt({},"__esModule",{value:!0}),e);var L=(e,t,r)=>wo(e,typeof t!="symbol"?t+"":t,r);var fs={};xo(fs,{BreadcrumbBuffer:()=>Pe,BrowserScriptScreenshotDriver:()=>Ue,BrowserTrackClient:()=>ze,DEFAULT_OPTIONS:()=>ot,NoteInspector:()=>qe,getClient:()=>no,init:()=>fr});var Pe=class{constructor(t=50){L(this,"capacity");L(this,"buffer",[]);this.capacity=t}add(t){let r={...t,timestamp:t.timestamp||Date.now()};this.buffer.push(r),this.buffer.length>this.capacity&&this.buffer.shift()}getRecent(){return[...this.buffer]}clear(){this.buffer=[]}};var Co=[/^authorization$/i,/^cookie$/i,/^set-cookie$/i,/password/i,/token/i,/secret/i,/api[-_]?key/i,/access[-_]?token/i,/refresh[-_]?token/i,/credentials/i,/private[-_]?key/i,/ssn/i,/credit[-_]?card/i,/cvv/i],Cr=["token","auth","key","apikey","api_key","secret","password","access_token","refresh_token","code","signature"],rt="[REDACTED]";function Mo(e){if(!e)return!1;let t=e.replace(/[-_]/g,"");return Co.some(r=>r.test(e)||r.test(t))}function me(e){if(!e)return e;try{let t=!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("ws://")&&!e.startsWith("wss://"),r="http://localhost",n=new URL(e,r),o=!1;for(let a of Cr)n.searchParams.has(a)&&(n.searchParams.set(a,rt),o=!0);for(let a of Array.from(n.searchParams.keys()))Mo(a)&&(n.searchParams.set(a,rt),o=!0);if(!o)return e;let i=t?n.pathname+n.search+n.hash:n.toString();return i=i.replace(/%5BREDACTED%5D/g,rt),i}catch{let t=e;for(let r of Cr){let n=new RegExp(`([?&]${r}=)[^&#]+`,"gi");t=t.replace(n,`$1${rt}`)}return t}}function ge(e,t={}){if(!e||!e.tagName)return"unknown";let r=t.maxClasses??2,n=e.getAttribute("data-testid")||e.getAttribute("data-test")||e.getAttribute("data-cy")||e.getAttribute("data-qa");if(n)return`[data-testid="${n}"]`;let o=e.id;if(o&&!/^[0-9]+$/.test(o)&&!/[0-9a-f]{8}-[0-9a-f]{4}/i.test(o))return`#${o}`;let i=e.getAttribute("aria-label");if(i&&i.length<30)return`${e.tagName.toLowerCase()}[aria-label="${i}"]`;let a=e.getAttribute("name");if(a)return`${e.tagName.toLowerCase()}[name="${a}"]`;let l=e.tagName.toLowerCase(),s=Array.from(e.classList||[]).filter(c=>!c.startsWith("css-")&&!c.startsWith("_")&&!/^[a-z0-9]{5,}$/i.test(c)).slice(0,r);if(s.length>0){let c=s.map(u=>`.${u}`).join("");return`${l}${c}`}if(e.parentElement&&e.parentElement!==document.body&&e.parentElement!==document.documentElement){let c=ge(e.parentElement,{maxClasses:1});if(c&&c!=="unknown"&&!c.includes(">"))return`${c} > ${l}`}return l}function Me(e,t=200){return e?e.length<=t?e:e.slice(0,t)+"...":""}function Ie(e){let t=ge(e),r=e.tagName.toLowerCase(),n=e.id||void 0,o=Array.from(e.classList||[]),i,a=!0;try{let c=e.getBoundingClientRect();i={x:Math.round(c.x),y:Math.round(c.y),width:Math.round(c.width),height:Math.round(c.height),top:Math.round(c.top),left:Math.round(c.left),bottom:Math.round(c.bottom),right:Math.round(c.right)};let u=window.getComputedStyle(e);a=u.display!=="none"&&u.visibility!=="hidden"&&u.opacity!=="0"&&c.width>0&&c.height>0}catch{}let l;r!=="input"&&r!=="textarea"&&r!=="select"&&(l=Me(e.textContent?.trim(),80));let s=Me(e.outerHTML?.trim(),200);return{selector:t,tag:r,id:n,classes:o,boundingRect:i,visible:a,innerText:l,outerHTML:s}}function Mr(e){if(typeof document>"u")return()=>{};let t=n=>{try{let o=n.target;if(!o||!(o instanceof Element))return;let i=Ie(o),a=`click ${i.selector}${i.innerText?` ("${i.innerText}")`:""}`;e({type:"click",category:"ui",message:a,timestamp:Date.now(),element:i},i)}catch{}},r=n=>{try{let o=n.target;if(!o||!(o instanceof Element))return;let i=Ie(o),a=o.getAttribute("action")||"",l=`submit form ${i.selector}${a?` (action: ${a})`:""}`;e({type:"submit",category:"ui",message:l,timestamp:Date.now(),element:i},i)}catch{}};return document.addEventListener("click",t,{capture:!0,passive:!0}),document.addEventListener("submit",r,{capture:!0,passive:!0}),()=>{document.removeEventListener("click",t,{capture:!0}),document.removeEventListener("submit",r,{capture:!0})}}var nt=class{constructor(t){L(this,"screenshotDriver");this.screenshotDriver=t}async executeCommand(t){try{switch(t.type){case"reload":return this.handleReload(t);case"navigate":return this.handleNavigate(t);case"get_page_state":return this.handleGetPageState(t);case"query_element":return this.handleQueryElement(t);case"capture_element":return await this.handleCaptureElement(t);case"check_overflow":return this.handleCheckOverflow(t);case"get_element_rect":return this.handleGetElementRect(t);case"get_element_style":return this.handleGetElementStyle(t);default:return{id:t.id,ok:!1,error:`Unsupported command type: ${t.type}`}}}catch(r){return{id:t.id,ok:!1,error:r?.message||"Command execution failed"}}}handleReload(t){return typeof window<"u"&&window.location?(setTimeout(()=>{window.location.reload()},50),{id:t.id,ok:!0,result:{message:"Reload initiated"}}):{id:t.id,ok:!1,error:"No browser window available"}}handleNavigate(t){let r=t.params?.url;return r?typeof window<"u"&&window.location?(setTimeout(()=>{window.location.href=r},50),{id:t.id,ok:!0,result:{message:`Navigating to ${r}`}}):{id:t.id,ok:!1,error:"No browser window available"}:{id:t.id,ok:!1,error:"Missing target url parameter"}}handleGetPageState(t){if(typeof window>"u"||typeof document>"u")return{id:t.id,ok:!1,error:"No browser document available"};let r=document.activeElement&&document.activeElement!==document.body?Ie(document.activeElement):void 0;return{id:t.id,ok:!0,result:{url:window.location.href,route:window.location.pathname+window.location.search+window.location.hash,title:document.title,readyState:document.readyState,activeElement:r}}}handleQueryElement(t){if(typeof document>"u")return{id:t.id,ok:!1,error:"No browser document available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!0,result:{exists:!1}};let o=Ie(n);return{id:t.id,ok:!0,result:{exists:!0,visible:o.visible,tag:o.tag,id:o.id,classes:o.classes,boundingRect:o.boundingRect,innerText:o.innerText,outerHTML:o.outerHTML}}}async handleCaptureElement(t){let r=t.params?.selector,n=null;if(r){if(n=document.querySelector(r),!n)return{id:t.id,ok:!1,reason:`ELEMENT_NOT_FOUND: ${r}`,error:`Element not found for selector: ${r}`}}else n=document.body||document.documentElement;let o=await this.screenshotDriver.captureElement(n);return o.ok?{id:t.id,ok:!0,result:{dataUrl:o.dataUrl,format:o.format,width:o.width,height:o.height}}:{id:t.id,ok:!1,reason:o.reason||"CAPTURE_FAILED",error:o.reason||"Failed to capture element screenshot"}}handleCheckOverflow(t){if(typeof window>"u"||typeof document>"u")return{id:t.id,ok:!1,error:"No browser window available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!1,error:`Element not found: ${r}`};let o=n.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,l=Math.max(0,Math.round(o.right-i)),s=Math.max(0,Math.round(o.bottom-a)),c=l>0||o.left<0,u=!1;return n.parentElement&&(u=n.parentElement.scrollWidth>n.parentElement.clientWidth),{id:t.id,ok:!0,result:{selector:r,overflow:c||u,viewportWidth:i,viewportHeight:a,rect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height),top:Math.round(o.top),left:Math.round(o.left),bottom:Math.round(o.bottom),right:Math.round(o.right)},overflowRightPx:l,overflowBottomPx:s,parentOverflow:u}}}handleGetElementRect(t){if(typeof document>"u")return{id:t.id,ok:!1,error:"No browser document available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!1,error:`Element not found: ${r}`};let o=n.getBoundingClientRect();return{id:t.id,ok:!0,result:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height),top:Math.round(o.top),left:Math.round(o.left),bottom:Math.round(o.bottom),right:Math.round(o.right)}}}handleGetElementStyle(t){if(typeof window>"u"||typeof document>"u")return{id:t.id,ok:!1,error:"No browser window available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!1,error:`Element not found: ${r}`};let o=window.getComputedStyle(n),i=t.params?.properties||["overflow","overflowX","overflowY","width","maxWidth","display","position"],a={};for(let l of i)a[l]=o.getPropertyValue(l)||o[l]||"";return{id:t.id,ok:!0,result:{selector:r,styles:a}}}};var ot={daemonUrl:"ws://127.0.0.1:7331",projectId:"",maxBreadcrumbs:50,captureErrors:!0,captureConsole:!0,captureNetwork:!0,captureNavigation:!0,captureInteractions:!0,onErrorScreenshot:!0,notes:{enabled:!0,shortcut:"Alt+Click",showBadges:!0,maskSelectors:['input[type="password"]',"[data-sensitive]"]},debug:!1};function kr(e){if(typeof console>"u")return()=>{};let t=console.error,r=console.warn;function n(o){return o.map(i=>{if(i instanceof Error)return i.stack||`${i.name}: ${i.message}`;if(typeof i=="object"&&i!==null)try{return JSON.stringify(i)}catch{return String(i)}return String(i)}).join(" ")}return console.error=function(...o){try{let i=n(o),a=new Error().stack;e({level:"error",message:i,stack:a,timestamp:Date.now()})}catch{}return t.apply(console,o)},console.warn=function(...o){try{let i=n(o),a=new Error().stack;e({level:"warn",message:i,stack:a,timestamp:Date.now()})}catch{}return r.apply(console,o)},()=>{console.error=t,console.warn=r}}function Er(e){if(typeof window>"u"||typeof history>"u")return()=>{};let t=me(window.location.href);e({to:t,type:"initial",timestamp:Date.now()});let r=history.pushState,n=history.replaceState;history.pushState=function(a,l,s){let c=t,u=r.apply(history,[a,l,s]);try{let d=me(window.location.href);t=d,e({from:c,to:d,type:"pushState",timestamp:Date.now()})}catch{}return u},history.replaceState=function(a,l,s){let c=t,u=n.apply(history,[a,l,s]);try{let d=me(window.location.href);t=d,e({from:c,to:d,type:"replaceState",timestamp:Date.now()})}catch{}return u};let o=()=>{let a=t,l=me(window.location.href);t=l,e({from:a,to:l,type:"popstate",timestamp:Date.now()})},i=()=>{let a=t,l=me(window.location.href);t=l,e({from:a,to:l,type:"hashchange",timestamp:Date.now()})};return window.addEventListener("popstate",o),window.addEventListener("hashchange",i),()=>{history.pushState=r,history.replaceState=n,window.removeEventListener("popstate",o),window.removeEventListener("hashchange",i)}}function $r(e){let t=[];if(typeof window<"u"&&typeof window.fetch=="function"){let r=window.fetch;window.fetch=async function(n,o){let i=Date.now(),a="",l="GET";try{typeof n=="string"?a=n:n instanceof URL?a=n.toString():n&&typeof n=="object"&&"url"in n&&(a=n.url,l=n.method||"GET"),o&&o.method&&(l=o.method.toUpperCase())}catch{a="unknown_url"}let s=me(a);try{let c=await r.apply(window,[n,o]),u=Date.now()-i;return e({url:s,method:l,status:c.status,statusText:c.statusText,durationMs:u,timestamp:i}),c}catch(c){let u=Date.now()-i,d=c?.name==="AbortError";throw e({url:s,method:l,durationMs:u,error:c?.message||"Network request failed",aborted:d,timestamp:i}),c}},t.push(()=>{window.fetch=r})}if(typeof window<"u"&&typeof window.XMLHttpRequest=="function"){let r=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.send,o=XMLHttpRequest.prototype.abort,i=new WeakMap;XMLHttpRequest.prototype.open=function(...a){try{let l=String(a[0]||"GET").toUpperCase(),s=String(a[1]||"");i.set(this,{url:me(s),method:l,startTime:Date.now()})}catch{}return r.apply(this,a)},XMLHttpRequest.prototype.abort=function(){let a=i.get(this);return a&&(a.aborted=!0),o.apply(this)},XMLHttpRequest.prototype.send=function(a){let l=i.get(this)||{url:"unknown_url",method:"GET",startTime:Date.now()},s=()=>{try{let u=Date.now()-l.startTime;e({url:l.url,method:l.method,status:this.status,statusText:this.statusText,durationMs:u,aborted:l.aborted,timestamp:l.startTime})}catch{}},c=()=>{try{let u=Date.now()-l.startTime;e({url:l.url,method:l.method,status:this.status||0,durationMs:u,error:"XHR Network Error",aborted:l.aborted,timestamp:l.startTime})}catch{}};return this.addEventListener("load",s,{once:!0}),this.addEventListener("error",c,{once:!0}),this.addEventListener("timeout",c,{once:!0}),n.apply(this,[a])},t.push(()=>{XMLHttpRequest.prototype.open=r,XMLHttpRequest.prototype.send=n,XMLHttpRequest.prototype.abort=o})}return()=>{for(let r of t)try{r()}catch{}}}function Ar(e){if(typeof window>"u")return()=>{};let t=n=>{try{let o={message:n.message||n.error&&n.error.message||"Script error",stack:n.error&&n.error.stack||void 0,filename:n.filename||void 0,lineno:n.lineno||void 0,colno:n.colno||void 0,errorType:n.error&&n.error.name||"Error",timestamp:Date.now()};e(o,n.error)}catch{}},r=n=>{try{let o=n.reason,i="Unhandled Promise Rejection",a,l="UnhandledRejection";if(o instanceof Error)i=o.message,a=o.stack,l=o.name||"UnhandledRejection";else if(typeof o=="string")i=o;else if(o&&typeof o=="object")try{i=JSON.stringify(o)}catch{i=String(o)}let s={message:i,stack:a,errorType:l,timestamp:Date.now()};e(s,o)}catch{}};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",r)}}var ko=Object.defineProperty,ae=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}},_e=(e,t)=>{for(var r in t)ko(e,r,{get:t[r],enumerable:!0})};function Eo(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 $o(e="soft"){switch(e){case"auto":{M.session.styleMap=new Map,M.session.nodeMap=new Map;return}case"soft":{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap,M.computedStyle=new WeakMap,M.measureHints=new WeakMap,M.baseStyle=new re(50),M.defaultStyle=new re(30),M.image=new re(100),M.background=new re(100),M.resource=new re(150),M.compress=new re(50),M.font=new Set;return}default:{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap;return}}}var re,M,ne=ae(()=>{"use strict";re=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let r=this.keys().next().value;r!==void 0&&this.delete(r)}return super.set(e,t)}},M={image:new re(100),background:new re(100),resource:new re(150),defaultStyle:new re(30),baseStyle:new re(50),compress:new re(50),computedStyle:new WeakMap,measureHints:new WeakMap,burstAdvice:new WeakMap,warnedReconcile:!1,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function nr(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let r=t[2].trim();return r.startsWith("#")?null:r}function cn(e,t=1){let r=e.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!r)return null;let n=[];for(let o of r[1].split(",")){let i=o.match(/url\((['"]?)(.*?)(\1)\)/);if(!i)continue;let a=o.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!un.test(a[1].trim()))continue;let l=o.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),s=1;if(l){let c=parseFloat(l[1]);s=/dpi/i.test(l[2])?c/96:c}n.push({url:i[2].trim(),dppx:s})}return n.length?(n.sort((o,i)=>o.dppx-i.dppx),(n.find(o=>o.dppx>=t)||n[n.length-1]).url):null}function Ao(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(r,n)=>{let o=n.split(",").map(i=>i.trim());return o.length!==6?`matrix(${n})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(r,n)=>{let o=n.split(",").map(i=>i.trim());return o.length!==16?`matrix3d(${n})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function xt(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function Ro(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let r=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,r).href}catch{return e}}var un,Et=ae(()=>{"use strict";un=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function No(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:r=12}={}){let n=new Map,o=0;function i(a,l,s){if(o>=r)return;let c=Date.now();(n.get(l)||0)>c||(n.set(l,c+t),o++,a==="warn"&&console&&console.warn?console.warn(`${e} ${s}`):console&&console.error&&console.error(`${e} ${s}`))}return{warnOnce(a,l){i("warn",a,l)},errorOnce(a,l){i("error",a,l)},reset(){n.clear(),o=0}}}function Lo(e){return/^data:|^blob:|^about:blank$/i.test(e)}function To(e,t){try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=t.includes("{url}")?t.split("{url}")[0]:t,o=new URL(n||".",r),i=new URL(e,r);if(i.origin===o.origin)return!0;let a=i.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function Fo(e,t){if(!t||Lo(e)||To(e,t))return!1;try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=new URL(e,r);return typeof location<"u"?n.origin!==location.origin:!0}catch{return!!t}}function Po(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",xt(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}${xt(e)}`;let r=t.includes("?")?"&":"?";return`${t}${r}url=${encodeURIComponent(e)}`}function Rr(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(String(n.result||"")),n.onerror=()=>r(new Error("read_failed")),n.readAsDataURL(e)})}function Io(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function se(e,t={}){let r=t.as??"blob",n=t.timeout??3e3,o=t.useProxy||"",i=t.errorTTL??8e3,a=t.headers||{},l=!!t.silent;if(/^data:/i.test(e))try{if(r==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(r==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,y="",b=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(y)?atob(b):decodeURIComponent(b),v=new Uint8Array([...x].map(w=>w.charCodeAt(0))),g=new Blob([v],{type:(y||"").split(";")[0]||""});return{ok:!0,data:g,status:200,url:e,fromCache:!1,mime:g.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let y=await fetch(e);if(!y.ok)return{ok:!1,data:null,status:y.status,url:e,fromCache:!1,reason:"http_error"};let b=await y.blob(),x=b.type||y.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Rr(b),status:y.status,url:e,fromCache:!1,mime:x}:r==="text"?{ok:!0,data:await b.text(),status:y.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:b,status:y.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 r==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:r==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let s=Io(e,{as:r,timeout:n,useProxy:o,errorTTL:i}),c=We.get(s);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&We.delete(s);let u=ut.get(s);if(u)return u;let d=Fo(e,o)?Po(e,o):e,h=t.credentials;if(!h)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",b=new URL(e,y);h=typeof location<"u"&&b.origin===location.origin?"include":"omit"}catch{h="omit"}let f=new AbortController,p=setTimeout(()=>f.abort("timeout"),n),m=(async()=>{try{let y=await fetch(d,{signal:f.signal,credentials:h,headers:a});if(!y.ok){let v={ok:!1,data:null,status:y.status,url:d,fromCache:!1,reason:"http_error"};if(i>0&&We.set(s,{until:Date.now()+i,result:v}),!l){let g=`${y.status} ${y.statusText||""}`.trim();Dt.warnOnce(`http:${y.status}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${g} while fetching ${r} ${e}`)}return t.onError&&t.onError(v),v}if(r==="text")return{ok:!0,data:await y.text(),status:y.status,url:d,fromCache:!1};let b=await y.blob(),x=b.type||y.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Rr(b),status:y.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:b,status:y.status,url:d,fromCache:!1,mime:x}}catch(y){let b=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:b};if(!/^blob:/i.test(e)&&i>0&&We.set(s,{until:Date.now()+i,result:x}),!l){let v=`${b}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,g=b==="timeout"?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${e}`:b==="abort"?`Request aborted while fetching ${r} ${e}`:`Network/CORS issue while fetching ${r} ${e}. A proxy may be required`;Dt.errorOnce(v,g)}return t.onError&&t.onError(x),x}finally{clearTimeout(p),ut.delete(s)}})();return ut.set(s,m),m}var Dt,ut,We,$e=ae(()=>{"use strict";Et(),Dt=No("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ut=new Map,We=new Map});async function dn(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let r=cn(e,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??nr(e);if(!r)return e;let n=Ro(r),o=xt(n),i=(t.useProxy||"")+"|"+o;if(M.background.has(i)){let a=M.background.get(i);return a?`url("${a}")`:"none"}try{let a=await se(o,{as:"dataURL",useProxy:t.useProxy});return a.ok?(M.background.set(i,a.data),`url("${a.data}")`):(M.background.set(i,null),"none")}catch{return M.background.set(i,null),"none"}}var Oo=ae(()=>{"use strict";ne(),Et(),$e()});function hn(e){if(e=String(e).toLowerCase(),ir.has(e)){let i={};return M.defaultStyle.set(e,i),i}if(M.defaultStyle.has(e))return M.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 r=document.createElement(e);r.style.all="initial",t.appendChild(r);let n=getComputedStyle(r),o={};for(let i of n){if(or(i))continue;let a=n.getPropertyValue(i);o[i]=a}return t.removeChild(r),M.defaultStyle.set(e,o),o}function or(e){let t=_t.get(e);if(t===void 0){let r=String(e).toLowerCase();t=yn.has(r)||gn.test(r)||mn.test(r),_t.set(e,t)}return t}function fn(e,t){return!wn.has(e)&&(t==="inline"||bn.has(e)||ar.has(e))}function Wo(e,t,r){let n=(t.display||"").toLowerCase();if(n==="inline"||ar.has(e))return!1;if(r)return!0;if((t.float||"none").toLowerCase()!=="none")return!1;let o=(t.position||"static").toLowerCase();return o==="absolute"||o==="fixed"?!1:!Cn.has(n)}function Ht(e,t,r=!0,n=!1){if(t=String(t||"").toLowerCase(),ir.has(t))return"";let o=[],i=hn(t),a=(e.display||"").toLowerCase(),l=a==="inline",s=fn(t,a),c=e["text-wrap-mode"]||e["white-space"]||"",u=c==="nowrap"||c==="pre",d=s&&r&&!(s&&r&&!l&&u),h=!1;for(let f in e){if(or(f))continue;let p=e[f];if(d){if(xn.has(f))continue;if(vn.has(f)){p&&p!==i[f]&&(o.push(`${f}:${p}`),p!=="auto"&&(h=!0));continue}}if(p&&p!==i[f]){if(!u&&(f==="width"||f==="inline-size")&&p.endsWith("px")&&p.includes(".")){let m=parseFloat(p);if(Number.isFinite(m)){o.push(`${f}:${(m+Sn).toFixed(3)}px`);continue}}o.push(`${f}:${p}`)}}if(d&&!l&&!n&&!h){let f=e.width;f&&f!=="auto"&&f!==i.width&&o.push(`min-width:${f}`)}return o.sort(),o.join(";")}function Do(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(r=>t.add(r.tagName.toLowerCase())),Array.from(t))}function Ho(e){let t=new Map;for(let n of e){let o=hn(n);if(!o)continue;let i=Object.entries(o).map(([a,l])=>`${a}:${l};`).sort().join("");i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))}let r="";for(let[n,o]of t.entries())r+=`${o.join(",")} { ${n} }
|
|
2
|
+
`;return r}function Bo(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),r=new Map,n=1;for(let o of t)r.set(o,`c${n++}`);return r}function _o(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let r=t.defaultView;if(r&&typeof r.getComputedStyle=="function")return r;if(typeof window<"u"&&window.frames)for(let n=0;n<window.frames.length;n++)try{if(window.frames[n]?.document===t)return window.frames[n]}catch{}}catch{}return typeof window<"u"?window:null}function _(e,t=null){let r=()=>{let i={length:0,getPropertyValue:()=>"",item:()=>""};return i[Symbol.iterator]=function*(){},i};if(e?.nodeType!==1){let i=typeof window<"u"?window:null;if(i&&typeof i.getComputedStyle=="function")try{return i.getComputedStyle(e,t)||r()}catch{return r()}return r()}let n=M.computedStyle.get(e);n||(n=new Map,M.computedStyle.set(e,n));let o=n.get(t);if(!o){let i=_o(e),a=null;try{a=i&&typeof i.getComputedStyle=="function"?i.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}o=a||r(),n.set(t,o)}return o}function Nr(e){let t={};for(let r of e)t[r]=e.getPropertyValue(r);for(let r of Mn){let n=t[`border-${r}-style`],o=t[`border-${r}-width`];(n==="none"||n==="hidden"||o==="0px")&&(delete t[`border-${r}-style`],delete t[`border-${r}-width`],delete t[`border-${r}-color`])}return t}function Bt(e){let t=[],r=0,n=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("&&r++,i===")"&&r--,i===","&&r===0&&(t.push(e.slice(n,o).trim()),n=o+1)}return t.push(e.slice(n).trim()),t}var pn,ir,jo,mn,gn,yn,_t,bn,ar,wn,xn,vn,Sn,Cn,Mn,$t=ae(()=>{"use strict";ne(),pn=new Set(["meta","script","noscript","title","link","template"]),ir=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","symbol","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),jo=["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"],mn=/(?:^|-)(animation|transition)(?:-|$)/i,gn=/^(--.+|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,yn=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","zoom","stroke-color"]),_t=new Map,bn=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),ar=new Set(["table","thead","tbody","tfoot","tr","td","th"]),wn=new Set(["img","video","canvas","svg","iframe","embed","object","input","textarea","select"]),xn=new Set(["width","max-width","inline-size","max-inline-size"]),vn=new Set(["min-width","min-inline-size"]),Sn=.001,Cn=new Set(["inline-block","inline-flex","inline-grid","inline-table","inline-flow-root","table"]),Mn=["top","right","bottom","left"]});function dt(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ke(e=1e3){return typeof requestAnimationFrame!="function"||typeof document<"u"&&document.visibilityState==="hidden"?Promise.resolve():new Promise(t=>{let r=!1,n=()=>{r||(r=!0,t())};try{requestAnimationFrame(n)}catch{n();return}setTimeout(n,e)})}function Uo(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),r=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||r}function we(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),r=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),n=/applewebkit/i.test(e),o=/mobile/i.test(e),i=!/safari/i.test(e),a=n&&o&&i,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),s=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),c=/ipad|iphone|ipod/.test(t)&&n;return r||a||l||s||c}function qo(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var Ae=ae(()=>{"use strict"});function j(e,t,r){let n=e&&typeof e=="object"&&(e.options||e);n&&n.debug&&(r!==void 0?console.warn("[snapdom]",t,r):console.warn("[snapdom]",t))}var kn=ae(()=>{"use strict"}),ue=ae(()=>{"use strict";Oo(),$t(),Ae(),Et(),kn()}),En={};_e(En,{decodeSvgFromDataURL:()=>lr,encodeSvgToDataURL:()=>sr,fixSafariShadows:()=>cr,toCanvas:()=>At});function zo(e){try{let t=e.match(/<svg\b[^>]*>/i);if(!t)return e;let r=t[0],n=parseFloat((r.match(/\bwidth="([\d.]+)/i)||[])[1]),o=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0)return e;let i=Math.min(1,be/n,be/o,Math.sqrt(vt/(n*o)));if(i>=1)return e;let a=Math.max(1,Math.floor(n*i)),l=Math.max(1,Math.floor(o*i));return console.warn(`[snapDOM] Capture ${Math.round(n)}\xD7${Math.round(o)}px exceeds the browser image-decode limit (${be}px/side); downscaling to ${a}\xD7${l}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`),e.replace(r,r.replace(/(\bwidth=")[\d.]+/i,`$1${a}`).replace(/(\bheight=")[\d.]+/i,`$1${l}`))}catch{return e}}function Vo(e,t){let r=["x","y","width","height"].map(C=>Number(t?.[C]));if(!r.every(Number.isFinite)||r[2]<=0||r[3]<=0)throw new RangeError("[snapdom] canvas crop requires finite x/y and positive width/height");let n=e.match(/<svg\b[^>]*>/i);if(!n)throw new Error("[snapdom] cannot crop a non-SVG capture");let o=n[0],i=(o.match(/\bviewBox="([^"]+)"/i)||[])[1],a=String(i||"").trim().split(/[\s,]+/).map(Number);if(a.length!==4||!a.every(Number.isFinite)||a[2]<=0||a[3]<=0)throw new Error("[snapdom] cannot crop an SVG without a finite viewBox");let[l,s,c,u]=a,d=Math.max(l,r[0]),h=Math.max(s,r[1]),f=Math.min(l+c,r[0]+r[2]),p=Math.min(s+u,r[1]+r[3]);if(!(f>d)||!(p>h))throw new RangeError("[snapdom] canvas crop does not intersect the SVG viewBox");let m=parseFloat((o.match(/\bwidth="([\d.]+)/i)||[])[1]),y=parseFloat((o.match(/\bheight="([\d.]+)/i)||[])[1]),b=Number.isFinite(m)&&m>0?m/c:1,x=Number.isFinite(y)&&y>0?y/u:1,v=Math.max(1,(f-d)*b),g=Math.max(1,(p-h)*x),w=o.replace(/(\bwidth=")[^"]*/i,`$1${v}`).replace(/(\bheight=")[^"]*/i,`$1${g}`).replace(/(\bviewBox=")[^"]*/i,`$1${d} ${h} ${f-d} ${p-h}`);return e.replace(o,w)}function Lr(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function lr(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function Xo(e){let t=e.indexOf(",");if(t<0)return"";let r=e.slice(t+1,t+1201).replace(/%[0-9A-Fa-f]?$/,"");try{return decodeURIComponent(r)}catch{return""}}function sr(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function $n(e){let t=[],r="",n=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("&&n++,i===")"&&(n=Math.max(0,n-1)),i===";"&&n===0?(t.push(r),r=""):r+=i}return r.trim()&&t.push(r),t.map(o=>o.trim()).filter(Boolean)}function Yo(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("&&n++,a===")"&&(n=Math.max(0,n-1)),a===","&&n===0?(t.push(r.trim()),r=""):r+=a}r.trim()&&t.push(r.trim());let o=[];for(let i of t){if(/\binset\b/i.test(i))continue;let a=i.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",s="0px",c="0px"]=a;c=`${parseFloat(c)/2}px`;let u=i.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";o.push(`drop-shadow(${l} ${s} ${c}${d?` ${u}`:""})`)}return o.join(" ")}function An(e){let t=$n(e),r=null,n=null,o=null,i=[];for(let l of t){let s=l.indexOf(":");if(s<0)continue;let c=l.slice(0,s).trim().toLowerCase(),u=l.slice(s+1).trim();c==="box-shadow"?o=u:c==="filter"?r=u:c==="-webkit-filter"?n=u:i.push([c,u])}if(o){let l=Yo(o);l&&(r=r?`${r} ${l}`:l,n=n?`${n} ${l}`:l)}let a=[...i];return r&&a.push(["filter",r]),n&&a.push(["-webkit-filter",n]),a.map(([l,s])=>`${l}:${s}`).join(";")}function Go(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,r,n)=>`${r}{${An(n)}}`)}function Qo(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,r)=>t.replace(r,Go(r))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,r,n)=>`style=${r}${An(n)}${r}`),e}function Ko(){return ht||(ht=(async()=>{try{let e='<svg xmlns="http://www.w3.org/2000/svg" width="8" height="20"><foreignObject width="8" height="20"><div xmlns="http://www.w3.org/1999/xhtml" style="width:4px;height:4px;margin-top:8px;background:#000;box-shadow:0 8px 0 0 #000"></div></foreignObject></svg>',t=new Image;t.decoding="sync",t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,await t.decode();let r=document.createElement("canvas");r.width=8,r.height=20;let n=r.getContext("2d",{willReadFrequently:!0});n.drawImage(t,0,0);let o=n.getImageData(2,18,1,1).data[3]>128,i=n.getImageData(2,2,1,1).data[3]>128;return{native:o||i,flippedY:i&&!o}}catch{return{native:!1,flippedY:!1}}})(),ht)}function Jo(e){let t=[],r=0,n=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("?r++:i===")"?r=Math.max(0,r-1):i===","&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t.map(o=>{let i=0,a=0,l="",s=0;for(;s<o.length;){let c=o[s];if(c==="("?i++:c===")"&&(i=Math.max(0,i-1)),i===0&&(s===0||o[s-1]===" ")){let u=/^-?\d*\.?\d+px/.exec(o.slice(s));if(u){a++,l+=a===2?`${-parseFloat(u[0])}px`:u[0],s+=u[0].length;continue}}l+=c,s++}return l}).join(",")}function Zo(e,t){let r=n=>$n(n).map(o=>{let i=o.indexOf(":");if(i<0)return o;let a=o.slice(0,i).trim().toLowerCase();return a==="text-shadow"||t&&a==="box-shadow"?`${a}:${Jo(o.slice(i+1))}`:o}).join(";");return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(n,o)=>n.replace(o,o.replace(/([^{}]+)\{([^}]*)\}/g,(i,a,l)=>`${a}{${r(l)}}`))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(n,o,i)=>`style=${o}${r(i)}${o}`),e}async function cr(e){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(e))return{svg:e,naturalOnly:!1};let{native:t,flippedY:r}=await Ko();try{let n=e;return t||(n=Qo(n)),r&&(n=Zo(n,t)),{svg:n,naturalOnly:!0}}catch{return{svg:e,naturalOnly:!0}}}async function ei(e,t){e.setAttribute("data-snapdom-internal",""),e.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(e);try{let r=document.createElement("canvas");r.width=16,r.height=16;let n=()=>new Promise(a=>{requestAnimationFrame(a),setTimeout(a,50)}),o=r.getContext("2d",{willReadFrequently:!0});if(!o){await n(),await n();return}let i=performance.now()+(t?600:150);for(;;){o.clearRect(0,0,16,16);try{o.drawImage(e,0,0,16,16)}catch{return}let a=o.getImageData(0,0,16,16).data,l=!1;for(let s=3;s<a.length;s+=4)if(a[s]>0){l=!0;break}if(l||performance.now()>i)return;await n()}}finally{try{e.remove()}catch{}}}async function At(e,t){let{width:r,height:n,scale:o=1,dpr:i=1,meta:a={},backgroundColor:l,crop:s=null}=t,c=e,u=!1,d=!1;if(s&&!Lr(e))throw new RangeError("[snapdom] canvas crop requires an SVG capture payload");if(Lr(e)){let $=(Xo(e).match(/<svg\b[^>]*>/i)||[])[0]||"",R=parseFloat(($.match(/\bwidth="([\d.]+)/i)||[])[1]),T=parseFloat(($.match(/\bheight="([\d.]+)/i)||[])[1]),W=Number.isFinite(R)&&Number.isFinite(T)&&R>0&&T>0&&Math.min(1,be/R,be/T,Math.sqrt(vt/(R*T)))<1;if(s||W||we())try{let F=lr(e);if(s&&(F=Vo(F,s)),we()){let I=await cr(F);F=I.svg,u=I.naturalOnly,d=/@font-face|data:image\//i.test(F)}(W||s)&&(F=zo(F)),c=sr(F)}catch(F){if(s)throw F;c=e}}let h=new Image;h.loading="eager",h.decoding="sync",h.crossOrigin="anonymous",h.src=c,await h.decode(),we()&&await ei(h,d);let f=h.naturalWidth,p=h.naturalHeight,m=s?f:Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:f,y=s?p:Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:p,b,x,v=Number.isFinite(r),g=Number.isFinite(n);if(v&&g)b=Math.max(1,r),x=Math.max(1,n);else if(v){let $=r/Math.max(1,m);b=r,x=y*$}else if(g){let $=n/Math.max(1,y);x=n,b=m*$}else b=f,x=p;b=b*o,x=x*o;let w=b*i,C=x*i,k=Math.max(w/be,C/be,Math.sqrt(w*C/vt));k>1&&(console.warn(`[snapDOM] Output ${Math.round(w)}\xD7${Math.round(C)}px exceeds the browser canvas limit (${be}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),b/=k,x/=k);let S=document.createElement("canvas");S.width=b*i,S.height=x*i,S.style.width=`${b}px`,S.style.height=`${x}px`;let E=S.getContext("2d");if(i!==1&&E.scale(i,i),l&&(E.save(),E.fillStyle=l,E.fillRect(0,0,b,x),E.restore()),u&&(Math.round(b*i)!==f||Math.round(x*i)!==p)){let $=document.createElement("canvas");$.width=f,$.height=p,$.getContext("2d").drawImage(h,0,0),E.drawImage($,0,0,b,x)}else E.drawImage(h,0,0,b,x);return S}var be,vt,ht,je=ae(()=>{"use strict";Ae(),be=16384,vt=16384*16384,ht=null}),ft={};_e(ft,{rasterize:()=>Rn});async function Rn(e,t){let r=await At(e,t),n=await new Promise(i=>{let a=()=>i(r.toDataURL(`image/${t.format}`,t.quality));try{r.toBlob(l=>{if(!l)return a();let s=new FileReader;s.onload=()=>i(String(s.result||"")),s.onerror=a,s.readAsDataURL(l)},`image/${t.format}`,t.quality)}catch{a()}}),o=new Image;return o.src=n,await o.decode(),o.style.width=`${r.width/t.dpr}px`,o.style.height=`${r.height/t.dpr}px`,o}var pt=ae(()=>{"use strict";je()}),jt={};_e(jt,{toImg:()=>Tr,toSvg:()=>Tr});async function Tr(e,t){let{scale:r=1,width:n,height:o,meta:i={}}=t,a=Number.isFinite(n),l=Number.isFinite(o),s=Number.isFinite(r)&&r!==1||a||l;if(we()&&s)try{let{svg:u}=await cr(lr(e)),d=(u.match(/<svg\b[^>]*>/i)||[])[0]||"",h=parseFloat((d.match(/\bwidth="([\d.]+)/i)||[])[1]),f=parseFloat((d.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(h)||!Number.isFinite(f))throw new Error("svg without dimensions");let p=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:h,m=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:f,y,b;a&&l?(y=n,b=o):a?(y=n,b=Math.round(m*(n/Math.max(1,p)))):l?(b=o,y=Math.round(p*(o/Math.max(1,m)))):(y=Math.round(h*r),b=Math.round(f*r));let x=u.replace(/width="[^"]*"/,`width="${y}"`).replace(/height="[^"]*"/,`height="${b}"`),v=new Image;return v.decoding="sync",v.loading="eager",v.src=sr(x),await v.decode(),v.style.width=`${y}px`,v.style.height=`${b}px`,v}catch(u){return j(t,"safari vector toImg failed, falling back to PNG",u),Rn(e,{...t,format:"png",quality:1,meta:i})}let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=e,await c.decode(),a&&l)c.style.width=`${n}px`,c.style.height=`${o}px`;else if(a){let u=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:c.naturalWidth,d=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:c.naturalHeight,h=n/Math.max(1,u);c.style.width=`${n}px`,c.style.height=`${Math.round(d*h)}px`}else if(l){let u=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:c.naturalWidth,d=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:c.naturalHeight,h=o/Math.max(1,d);c.style.height=`${o}px`,c.style.width=`${Math.round(u*h)}px`}else{let u=Math.round(c.naturalWidth*r),d=Math.round(c.naturalHeight*r);if(c.style.width=`${u}px`,c.style.height=`${d}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${d}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,c.src=e}catch(h){j(t,"SVG width/height patch in toImg failed",h)}}return c}var Fr=ae(()=>{"use strict";ue(),pt(),je()}),Nn={};_e(Nn,{toBlob:()=>Ln});async function Ln(e,t){let r=t.type;if(r==="svg"){let o=decodeURIComponent(e.split(",")[1]);return new Blob([o],{type:"image/svg+xml"})}let n=await At(e,t);return new Promise(o=>n.toBlob(i=>o(i),`image/${r}`,t.quality))}var Tn=ae(()=>{"use strict";je()}),Fn={};_e(Fn,{download:()=>ti});async function Pr(e,t){let r=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[r]}))return!1;try{await navigator.share({files:[r],title:t})}catch(n){if(n.name!=="AbortError")return!1}return!0}async function ti(e,t){let r=new Set(["png","jpeg","jpg","webp","svg"]),n=(t?.type||"").toLowerCase(),o=r.has(n)?n:"",i=(t?.format||o||"").toLowerCase(),a=i==="jpg"?"jpeg":i||"png",l=t?.filename||`snapdom.${a}`,s={...t||{},format:a,type:a};s.dpr=1;let c=Uo();if(a==="svg"){let h=await Ln(e,{...s,type:"svg"});if(c&&await Pr(h,l))return;let f=URL.createObjectURL(h),p=document.createElement("a");p.href=f,p.download=l,document.body.appendChild(p),p.click(),URL.revokeObjectURL(f),p.remove();return}let u=await At(e,s);if(c){let h=`image/${a}`,f=await new Promise(p=>u.toBlob(p,h,t?.quality));if(f&&await Pr(f,l))return}let d=document.createElement("a");d.href=u.toDataURL(`image/${a}`,t?.quality),d.download=l,document.body.appendChild(d),d.click(),d.remove()}var ri=ae(()=>{"use strict";Tn(),je(),Ae()});ue();ue();ne();var Ut=new WeakMap,He=new Map,ni=2e3,St=0;function mt(){St++,He.size>ni&&He.clear()}var oi="[data-snapdom-sandbox],[data-snapdom-internal],[data-snapdom]";function Ft(e){let t=e&&(e.nodeType===1?e:e.parentElement);return!!(t&&t.closest&&t.closest(oi))}function Pn(e){for(let t of e)if(!Ft(t.target)){if(t.type==="childList"){let r=!0;for(let n of t.addedNodes)if(!Ft(n)){r=!1;break}if(r){for(let n of t.removedNodes)if(!Ft(n)){r=!1;break}}if(r)continue}return!0}return!1}var Ir=!1;function ii(e=document.documentElement){if(Ir)return;Ir=!0;let t=r=>{Pn(r)&&mt()};try{new MutationObserver(t).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(t).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let r=document.fonts;r&&(r.addEventListener?.("loadingdone",mt),r.ready?.then(()=>mt()).catch(()=>{}))}catch{}}var ai=["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"];function Or(e){let t=Ut.get(e);if(t&&t.epoch===St){let r=t.snapshot&&t.snapshot.__needsBgInline;if(r!==void 0)return r}return!0}function li(e,t={}){let r={},n=t.excludeStyleProps;for(let d=0;d<e.length;d++){let h=e[d];if(or(h)||n&&(n instanceof RegExp&&n.test(h)||typeof n=="function"&&n(h)))continue;let f=e.getPropertyValue(h);(h==="background-image"||h==="content")&&f.includes("url(")&&!f.includes("data:")&&(f="none"),r[h]=f}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(!r[d])try{let h=e.getPropertyValue(d);h&&(r[d]=h)}catch{}let i=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let d of i)if(!r[d])try{let h=e.getPropertyValue(d);h&&(r[d]=h)}catch{}if(t.embedFonts){let d=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let h of d)if(!r[h])try{let f=e.getPropertyValue(h);f&&(r[h]=f)}catch{}}try{(r["content-visibility"]||e.getPropertyValue("content-visibility"))==="hidden"&&(r["content-visibility"]="hidden")}catch{}let a=!1;{let d=e.getPropertyValue("background-image");if(d&&d!=="none"&&(a=!0),!a){let h=e.getPropertyValue("background-color");h&&h!=="rgba(0, 0, 0, 0)"&&h!=="transparent"&&(a=!0)}if(!a)for(let h of ai){let f=e.getPropertyValue(h);if(f&&f!=="none"){a=!0;break}}if(!a){let h=e.getPropertyValue("background");h&&/url\s*\(/i.test(h)&&(a=!0)}}Object.defineProperty(r,"__needsBgInline",{value:a,enumerable:!1});let l=parseFloat(e.getPropertyValue("border-top-width")||0)||0,s=parseFloat(e.getPropertyValue("border-right-width")||0)||0,c=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(l===0&&s===0&&c===0&&u===0){let d=(e.getPropertyValue("border-image-source")||"").trim(),h=d&&d!=="none",f=["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 p of f)delete r[p];h||(r.border="none")}return r}function si(e){for(let t=e.firstChild;t;t=t.nextSibling){if(t.nodeType===3&&/\S/.test(t.nodeValue||""))return!0;if(t.nodeType===1){let r=_(t).position;if(r!=="absolute"&&r!=="fixed")return!0}}return!1}function ci(e,t,r){try{if(typeof e.computedStyleMap=="function"){let o=e.computedStyleMap().get("width");if(o!=null)return!Wr(String(o).trim().toLowerCase())}}catch{}let n=e.style&&(e.style.width||e.style.inlineSize);return n&&!Wr(String(n).trim().toLowerCase())?!0:di(e,t)?r||hi(e,t):!1}var ui=new Set(["auto","min-content","max-content","stretch","fill-available","-webkit-fill-available"]);function Wr(e){return ui.has(e)||e.startsWith("fit-content")}function di(e,t){let r=e.getBoundingClientRect().width-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)-(parseFloat(t.borderLeftWidth)||0)-(parseFloat(t.borderRightWidth)||0);if(!(r>0))return!1;let n=1/0,o=-1/0,i=null;for(let a=e.firstChild;a;a=a.nextSibling){let l;if(a.nodeType===3){if(!/\S/.test(a.nodeValue||"")||(i=i||document.createRange(),i.selectNode(a),l=i.getBoundingClientRect(),!l.width&&!l.height))continue}else if(a.nodeType===1){let s=_(a);if(s.display==="none"||s.position==="absolute"||s.position==="fixed")continue;l=a.getBoundingClientRect()}else continue;l.left<n&&(n=l.left),l.right>o&&(o=l.right)}return o===-1/0?!1:o-n<r-.5}function hi(e,t){let r=e.parentElement;if(!r)return!1;let n=_(r),o=r.getBoundingClientRect().width-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0)-(parseFloat(n.borderLeftWidth)||0)-(parseFloat(n.borderRightWidth)||0)-(parseFloat(t.marginLeft)||0)-(parseFloat(t.marginRight)||0);return o>0?Math.abs(e.getBoundingClientRect().width-o)>.5:!1}var Dr=new WeakMap;function fi(e){let t=Dr.get(e);return t||(t=Object.entries(e).sort((r,n)=>r[0]<n[0]?-1:r[0]>n[0]?1:0).map(([r,n])=>`${r}:${n}`).join(";"),Dr.set(e,t),t)}function pi(e,t=null,r={}){let n=Ut.get(e),o=!!(r&&r.embedFonts),i=r&&r.excludeStyleProps||null;if(n&&n.epoch===St&&n.embedFonts===o&&n.excludeStyleProps===i)return n.snapshot;let a=t||getComputedStyle(e),l=li(a,r);return xi(e,a,l),Ut.set(e,{epoch:St,snapshot:l,embedFonts:o,excludeStyleProps:i}),l}function mi(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:He,defaultStyle:M.defaultStyle,baseStyle:M.baseStyle,image:M.image,resource:M.resource,background:M.background,font:M.font},options:t||{}}:{session:M.session,persist:{snapshotKeyCache:He,defaultStyle:M.defaultStyle,baseStyle:M.baseStyle,image:M.image,resource:M.resource,background:M.background,font:M.font},options:e||t||{}}}function gi(e,t,r){if(!(!e.style||e.style.length===0))for(let n=0;n<e.style.length;n++){let o=e.style[n],i=r.getPropertyValue(o);i&&t.style.setProperty(o,i)}}async function he(e,t,r,n){if(e.tagName==="STYLE")return;let o=mi(r,n),i=o.options&&o.options.cache||"auto";i!=="disabled"&&ii(document.documentElement),i==="disabled"&&!o.session.__bumpedForDisabled&&(mt(),He.clear(),o.session.__bumpedForDisabled=!0);let{session:a,persist:l}=o;if(!a.styleCache.has(e)){let y=null;try{y=getComputedStyle(e)}catch{}a.styleCache.set(e,y||getComputedStyle(document.documentElement))}let s=a.styleCache.get(e);e.getAttribute?.("style")&&gi(e,t,s);let c=s.getPropertyValue("animation-name");t&&t.style&&c&&c!=="none"&&t.style.setProperty("animation","none","important");let u=pi(e,s,o.options),d=In(e);if(d){let y=s.getPropertyValue("min-width");(!y||y==="auto"||y==="0px")&&(u["min-width"]="0px")}let h=e.tagName?.toLowerCase()||"div",f=fi(u),p=!0;if(fn(h,(u.display||"").toLowerCase())){p=si(e),p&&Wo(h,u,d)&&ci(e,s,d)&&(p=!1),f=`${f}|${h}${p?"|c":""}${d?"|f":""}`;let y=u["text-wrap-mode"]||u["white-space"]||"";p&&y!=="nowrap"&&y!=="pre"&&(a.reconcileRisk=(a.reconcileRisk||0)+1)}let m=l.snapshotKeyCache.get(f);m===void 0&&(m=Ht(u,h,p,d),l.snapshotKeyCache.set(f,m)),a.styleMap.set(t,m)}function yi(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 In(e){let t=e.parentElement;if(!t)return!1;let r=_(t).display||"";return r.includes("flex")||r.includes("grid")}function bi(e){for(let n=e.firstChild;n;n=n.nextSibling)if(n.nodeType===3&&/\S/.test(n.nodeValue))return!0;let t=e.firstElementChild,r=e.lastElementChild;if(t&&t.tagName==="BR"||r&&r.tagName==="BR")return!0;for(let n=e.firstElementChild;n;n=n.nextElementSibling){let o=_(n);if(o.display==="none")continue;let i=o.position;if(i!=="absolute"&&i!=="fixed")return!0}return!1}function wi(e){let t=e.getBoundingClientRect().top,r=-1/0,n=null;for(let o=e.firstChild;o;o=o.nextSibling){if(o.nodeType===3){if(!/\S/.test(o.nodeValue||""))continue;n=n||document.createRange(),n.selectNode(o);let l=n.getBoundingClientRect();(l.width||l.height)&&(r=Math.max(r,l.bottom));continue}if(o.nodeType!==1)continue;let i=_(o);if(i.display==="none")continue;let a=i.position;a==="absolute"||a==="fixed"||i.float&&i.float!=="none"||(r=Math.max(r,o.getBoundingClientRect().bottom))}return r===-1/0?NaN:r-t}function xi(e,t,r){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let n=e.tagName&&e.tagName.toLowerCase();if(!n||!["div","section","article","main","aside","header","footer","nav"].includes(n)||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid"))return;let i=t.position;if(i==="absolute"||i==="fixed"||i==="sticky"||t.transform!=="none"||yi(t)||In(e))return;let a=t.overflowX||t.overflow||"visible",l=t.overflowY||t.overflow||"visible";if(a!=="visible"||l!=="visible")return;let s=t.clip;if(s&&s!=="auto"&&s!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||!bi(e))return;let c=parseFloat(t.height),u=wi(e);Number.isFinite(c)&&Number.isFinite(u)&&Math.abs(c-u)>2||(delete r.height,delete r["block-size"])}$t();var On=["fill","stroke","color","background-color","stop-color"],vi=new Set(["symbol","defs","pattern","marker","linearGradient","radialGradient","filter"]);function qt(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI==="http://www.w3.org/2000/svg"){if(t.localName==="mask"||t.localName==="clipPath")return!1;if(vi.has(t.localName))return!0}t=t.parentNode}return!1}var Hr=new Map;function Si(e,t){let r=t+"::"+e.toLowerCase(),n=Hr.get(r);if(n)return n;let o=document,i=t==="http://www.w3.org/2000/svg"?o.createElementNS(t,e):o.createElement(e),a=o.createElement("div");a.setAttribute("data-snapdom-internal",""),a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(i),o.documentElement.appendChild(a);let l=getComputedStyle(i),s={};for(let c of On)s[c]=l.getPropertyValue(c)||"";return a.remove(),Hr.set(r,s),s}function Ci(e,t){if(e?.nodeType!==1||t?.nodeType!==1||qt(e))return;let r=e.getAttribute?.("style"),n=!!(r&&r.includes("var("));if(!n&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let l=i[a];if(l&&typeof l.value=="string"&&l.value.includes("var(")){n=!0;break}}}let o=null;if(n)try{o=getComputedStyle(e)}catch{}if(n){let i=e.style;if(i&&i.length){let a=new Set;for(let l=0;l<i.length;l++){let s=i[l];if(a.has(s))continue;a.add(s);let c=i.getPropertyValue(s);if(!c||!c.includes("var("))continue;let u=o&&o.getPropertyValue(s);if(u)try{t.style.setProperty(s,u.trim(),i.getPropertyPriority(s))}catch{}}}}if(n&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let l=i[a];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let s=l.name,c=o&&o.getPropertyValue(s);if(c)try{t.style.setProperty(s,c.trim())}catch{}}}if(!n){if(!o)try{o=getComputedStyle(e)}catch{o=null}if(!o)return;let i=e.namespaceURI||"html",a=Si(e.tagName,i);for(let l of On){let s=o.getPropertyValue(l)||"",c=a[l]||"";if(s&&s!==c)try{t.style.setProperty(l,s.trim())}catch{}}}}ue();ue();ne();$e();$e();function Ee(e){return!!(!e||e.startsWith("data:")||e.startsWith("blob:")||/^data:image\/(gif|png|svg)/.test(e)&&e.length<200)}var Br="img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]";function Mi(e,t){return!e||e?.nodeType!==1?!1:e.matches?.("picture")||e.querySelector("picture")?!0:t?!!(e.matches?.(Br)||e.querySelector(Br)):!1}var ki=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i;function Ct(e,t){if(!e)return null;let r=0;try{r=t?t.getBoundingClientRect().width||t.width:0}catch{}r||(r=window.innerWidth||1e3);let n=[];for(let i of e.split(",")){let a=i.trim().split(/\s+/);if(!a[0])continue;let l=a[1]||"",s=1;/^\d*\.?\d+x$/i.test(l)?s=parseFloat(l):/^\d+w$/i.test(l)&&(s=parseInt(l,10)/r),n.push({url:a[0],d:s})}if(!n.length)return null;n.sort((i,a)=>i.d-a.d);let o=window.devicePixelRatio||1;return(n.find(i=>i.d>=o)||n[n.length-1]).url}function Wn(e,t){let r=e.currentSrc||"";if(r&&!Ee(r))return r;let n=t.querySelectorAll("source[srcset]"),o=null;for(let i of n){let a=i.getAttribute("srcset");if(!a||Ee(a))continue;let l=i.getAttribute("type");if(l&&!ki.test(l.trim()))continue;let s=i.getAttribute("media");if(s)try{if(window.matchMedia(s).matches)return Ct(a,e)}catch{}o||(o=Ct(a,e))}return o}function Ei(e){let t=[e.getAttribute("data-src"),e.getAttribute("data-lazy-src"),e.getAttribute("data-original"),e.getAttribute("data-hi-res-src")];for(let n of t)if(n&&!Ee(n))return n;let r=e.getAttribute("data-srcset")||e.getAttribute("data-lazy-srcset");if(r){let n=r.split(",")[0].trim().split(/\s+/)[0];if(n&&!Ee(n))return n}return null}function $i(e={}){let t=e.pictureResolver&&typeof e.pictureResolver=="object"?e.pictureResolver:{};return{timeout:t.timeout??5e3,concurrency:t.concurrency??4,resolveLazySrc:t.resolveLazySrc!==!1,silent:t.silent??!1,useProxy:typeof e.useProxy=="string"?e.useProxy:""}}async function Ai(e,t={}){if(!e||e?.nodeType!==1||t.resolvePicturePlaceholders===!1)return null;let{timeout:r,concurrency:n,resolveLazySrc:o,silent:i,useProxy:a}=$i(t);if(!Mi(e,o))return null;let l=[],s=[];async function c(h){let f=await se(h,{as:"dataURL",timeout:r,useProxy:a,silent:!0});return f.ok?f.data:null}async function u(h){for(let f=0;f<h.length;f+=n){let p=h.slice(f,f+n);await Promise.allSettled(p.map(m=>m()))}}let d=Array.from(e.querySelectorAll("picture"));e.matches?.("picture")&&d.unshift(e);for(let h of d){let f=h.querySelector("img");if(!f)continue;let p=f.getAttribute("src")||"";if(!Ee(p))continue;let m=Wn(f,h);m&&s.push(async()=>{let y=await c(m);if(!y){i||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${m.slice(0,60)}`);return}let b=f.getAttribute("src"),x=f.getAttribute("srcset"),v=f.getAttribute("sizes"),g=[];f.src=y,f.setAttribute("src",y),f.removeAttribute("srcset"),f.removeAttribute("sizes");let w=h.querySelectorAll("source");for(let C of w)g.push({el:C,parent:C.parentElement,next:C.nextSibling}),C.remove();l.push(()=>{b!==null?f.setAttribute("src",b):f.removeAttribute("src"),x!==null&&f.setAttribute("srcset",x),v!==null&&f.setAttribute("sizes",v);for(let{el:C,parent:k,next:S}of g)k&&k.insertBefore(C,S)})})}if(o){let h=Array.from(e.querySelectorAll("img"));e.localName==="img"&&h.unshift(e);for(let f of h){if(f.closest("picture")&&Ee(f.getAttribute("src")||""))continue;let p=f.getAttribute("src")||"",m=Ei(f);m&&Ee(p)&&s.push(async()=>{let y=await c(m);if(!y)return;let b=f.getAttribute("src");f.src=y,f.setAttribute("src",y),f.removeAttribute("srcset"),f.removeAttribute("sizes"),l.push(()=>{b!==null?f.setAttribute("src",b):f.removeAttribute("src")})})}}return s.length===0?null:(await u(s),async function(){for(let h of l)try{h()}catch{}})}function Pt(e,t,r){return r?Promise.all(e.map(n=>new Promise(o=>t(n,o)))):Promise.all(e.map(n=>new Promise(o=>{function i(){dt(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(n,o):i()},{fast:r})}i()})))}function Ri(e,t){if(e=e.trim(),!e)return e;let r=t?`[data-sd-slotted~="${t}"]`:"[data-sd-slotted]";return e.endsWith(":not([data-sd-slotted])")||e.endsWith(`:not(${r})`)?e:`${e}:not(${r})`}function Ni(e,t,r=!0,n){return e.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let i=r?Ri(o,n):o;return`:where(${t} ${i})`}).join(", ")}function Li(e,t,r){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${t}:is(${o.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${t} ${o.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,i,a)=>{let l=Ni(a,t,!0,r);return`${o}${i}${l}{`}),e):""}function Ti(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Fi(e){let t="";try{e.querySelectorAll("style").forEach(n=>{t+=(n.textContent||"")+`
|
|
3
|
+
`});let r=e.adoptedStyleSheets||[];for(let n of r)try{if(n&&n.cssRules)for(let o of n.cssRules)t+=o.cssText+`
|
|
4
|
+
`}catch{}}catch{}return t}function Pi(e,t,r){if(!t)return;let n=document.createElement("style");n.setAttribute("data-sd",r),n.textContent=t,e.insertBefore(n,e.firstChild||null)}function Ii(e,t){try{let r=null,n=_(e).content;if(n&&n.includes("url(")){let a=n.match(/url\(["']?([^"')]+)["']?\)/);a&&(r=a[1])}let o=e.closest?.("picture"),i=r||(o?Wn(e,o):e.currentSrc)||e.src||Ct(e.getAttribute("srcset"),e)||"";if(!i)return;t.setAttribute("src",i),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function Oi(e){let t=new Set;if(!e)return t;let r=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,n;for(;n=r.exec(e);)t.add(n[1]);return t}function Wi(e,t){try{let r=getComputedStyle(e).getPropertyValue(t).trim();if(r)return r}catch{}try{let r=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(r)return r}catch{}return""}function Di(e,t,r){let n=[];for(let o of t){let i=Wi(e,o);i&&n.push(`${o}: ${i};`)}return n.length?`${r}{${n.join("")}}
|
|
5
|
+
`:""}function Hi(e,t){if(!e)return;let r=n=>{let o=n.getAttribute("data-sd-slotted")||"";t?` ${o} `.includes(` ${t} `)||n.setAttribute("data-sd-slotted",o?`${o} ${t}`:t):n.setAttribute("data-sd-slotted",o)};e.nodeType===Node.ELEMENT_NODE&&r(e),e.querySelectorAll?.("*").forEach(r)}async function Bi(e,t=3){let r=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},n=r(),o=0;for(;o<t&&(!n||!n.body&&!n.documentElement);)await new Promise(i=>setTimeout(i,0)),n=r(),o++;return n&&(n.body||n.documentElement)?n:null}function _i(e){let t=e.getBoundingClientRect(),r=0,n=0,o=0,i=0;try{let s=getComputedStyle(e);r=parseFloat(s.borderLeftWidth)||0,n=parseFloat(s.borderRightWidth)||0,o=parseFloat(s.borderTopWidth)||0,i=parseFloat(s.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(r+n))),l=Math.max(0,Math.round(t.height-(o+i)));return{contentWidth:a,contentHeight:l,rect:t}}function fe(e){let t=0,r=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(r=e.offsetHeight),t===0||r===0)try{let n=getComputedStyle(e);if(t===0){let o=parseFloat(n.width);!isNaN(o)&&o>0&&(t=o)}if(r===0){let o=parseFloat(n.height);!isNaN(o)&&o>0&&(r=o)}}catch{}if(t===0||r===0)try{if(t===0){let n=parseFloat(e.getAttribute("width"));!isNaN(n)&&n>0&&(t=n)}if(r===0){let n=parseFloat(e.getAttribute("height"));!isNaN(n)&&n>0&&(r=n)}}catch{}if((t===0||r===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),r===0&&e.naturalHeight>0&&(r=e.naturalHeight)}catch{}return{width:t,height:r}}function ji(e,t,r){let n=e.defaultView,o=n?n.scrollX:0,i=n?n.scrollY:0,a=e.body?e.body.scrollLeft:0,l=e.body?e.body.scrollTop:0,s=e.documentElement?e.documentElement.scrollLeft:0,c=e.documentElement?e.documentElement.scrollTop:0,u=0,d=0,h=0,f=0;try{let m=n&&e.body?n.getComputedStyle(e.body):null;m&&(u=(parseFloat(m.marginTop)||0)+(parseFloat(m.paddingTop)||0),d=(parseFloat(m.marginRight)||0)+(parseFloat(m.paddingRight)||0),h=(parseFloat(m.marginBottom)||0)+(parseFloat(m.paddingBottom)||0),f=(parseFloat(m.marginLeft)||0)+(parseFloat(m.paddingLeft)||0))}catch{}try{e.documentElement.setAttribute("data-sd-pinned","")}catch{}let p=e.createElement("style");return p.setAttribute("data-sd-iframe-pin",""),p.textContent=`html {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${r}px !important;min-width: ${t}px !important;min-height: ${r}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}body {margin: 0 !important;padding: ${u}px ${d}px ${h}px ${f}px !important;width: ${t}px !important;height: ${r}px !important;min-width: ${t}px !important;min-height: ${r}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(p),()=>{try{p.remove()}catch{}try{e.documentElement.removeAttribute("data-sd-pinned")}catch{}try{n&&typeof n.scrollTo=="function"&&n.scrollTo(o,i),e.body&&(e.body.scrollLeft=a,e.body.scrollTop=l),e.documentElement&&(e.documentElement.scrollLeft=s,e.documentElement.scrollTop=c)}catch{}}}async function Ui(e,t,r){let n=await Bi(e,3);if(!n)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:i,rect:a}=_i(e),l=r?.snap;if(!l&&typeof window<"u"&&window.snapdom&&(l=window.snapdom),!l||typeof l.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 s={...r,scale:1,clip:null},c=ji(n,o,i),u=M.session.nodeMap,d=M.session.styleMap,h=M.session.styleCache,f;try{f=await l.toPng(n.documentElement,s)}finally{c(),M.session.nodeMap=u,M.session.styleMap=d,M.session.styleCache=h}f.style.display="block",f.style.width=`${o}px`,f.style.height=`${i}px`;let p=document.createElement("div");return t.nodeMap.set(p,e),he(e,p,t,r),p.style.overflow="hidden",p.style.display="block",p.style.width||(p.style.width=`${Math.round(a.width)}px`),p.style.height||(p.style.height=`${Math.round(a.height)}px`),p.appendChild(f),p}function qi(e){let{width:t,height:r}=fe(e),n=e.getBoundingClientRect(),o;try{o=window.getComputedStyle(e)}catch{}let i=o?parseFloat(o.width):NaN,a=o?parseFloat(o.height):NaN,l=Math.round(t||n.width||0),s=Math.round(r||n.height||0),c=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,l||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,s||16),d=(e.type||"text").toLowerCase()==="checkbox",h=!!e.checked,f=!!e.indeterminate,p=Math.max(Math.min(c,u),12),m="middle";try{o&&o.verticalAlign&&(m=o.verticalAlign)}catch{}let y=document.createElement("div");y.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),y.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:${m};flex-shrink:0;line-height:0;`;let b=document.createElementNS("http://www.w3.org/2000/svg","svg");b.setAttribute("width",String(p)),b.setAttribute("height",String(p)),b.setAttribute("viewBox",`0 0 ${p} ${p}`),y.appendChild(b);function x(){let v="#0a6ed1";try{o&&(v=o.accentColor||o.color||v)}catch{}let g=2,w=g/2,C=p-g;if(b.innerHTML="",d){let k=document.createElementNS("http://www.w3.org/2000/svg","rect");if(k.setAttribute("x",String(w)),k.setAttribute("y",String(w)),k.setAttribute("width",String(C)),k.setAttribute("height",String(C)),k.setAttribute("rx","2"),k.setAttribute("ry","2"),k.setAttribute("fill",h?v:"none"),k.setAttribute("stroke",v),k.setAttribute("stroke-width",String(g)),b.appendChild(k),h){let S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("d",`M ${w+2} ${p/2} L ${p/2-1} ${p-w-2} L ${p-w-2} ${w+2}`),S.setAttribute("stroke","white"),S.setAttribute("stroke-width",String(Math.max(1.5,g))),S.setAttribute("fill","none"),S.setAttribute("stroke-linecap","round"),S.setAttribute("stroke-linejoin","round"),b.appendChild(S)}else if(f){let S=document.createElementNS("http://www.w3.org/2000/svg","rect"),E=Math.max(6,C-4);S.setAttribute("x",String((p-E)/2)),S.setAttribute("y",String((p-g)/2)),S.setAttribute("width",String(E)),S.setAttribute("height",String(g)),S.setAttribute("fill",v),S.setAttribute("rx","1"),b.appendChild(S)}}else{let k=document.createElementNS("http://www.w3.org/2000/svg","circle");if(k.setAttribute("cx",String(p/2)),k.setAttribute("cy",String(p/2)),k.setAttribute("r",String((p-g)/2)),k.setAttribute("fill",h?v:"none"),k.setAttribute("stroke",v),k.setAttribute("stroke-width",String(g)),b.appendChild(k),h){let S=document.createElementNS("http://www.w3.org/2000/svg","circle"),E=Math.max(2,(p-g*2)*.35);S.setAttribute("cx",String(p/2)),S.setAttribute("cy",String(p/2)),S.setAttribute("r",String(E)),S.setAttribute("fill","white"),b.appendChild(S)}}y.style.setProperty("width",`${p}px`,"important"),y.style.setProperty("height",`${p}px`,"important"),y.style.setProperty("min-width",`${p}px`,"important"),y.style.setProperty("min-height",`${p}px`,"important")}return x(),{el:y,applyVisual:x}}var Oe=new re(80);async function De(e){if(M.resource?.has(e))return M.resource.get(e);if(Oe.has(e))return Oe.get(e);let t=(async()=>{let r=await se(e,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return M.resource?.set(e,r.data),r.data})();Oe.set(e,t);try{let r=await t;return Oe.set(e,r),r}catch(r){throw Oe.delete(e),r}}var zi=/\bblob:[^)"'\s]+/g;async function _r(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(zi)||[]));if(t.length===0)return e;let r=e;for(let n of t)try{let o=await De(n);r=r.split(n).join(o)}catch{}return r}function it(e){return typeof e=="string"&&e.startsWith("blob:")}function Vi(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let r=t.match(/^(\S+)(\s+.+)?$/);return r?{url:r[1],desc:r[2]||""}:null}).filter(Boolean)}function Xi(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}function at(e,t){let r=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&r.unshift(e),r}async function Yi(e,t=null){if(!e)return;let r=t,n=at(e,"img");for(let s of n)try{let c=s.getAttribute("src")||s.currentSrc||"";if(it(c)){let d=await De(c);s.setAttribute("src",d)}let u=s.getAttribute("srcset");if(u&&u.includes("blob:")){let d=Vi(u),h=!1;for(let f of d)if(it(f.url))try{f.url=await De(f.url),h=!0}catch(p){j(r,"blobUrlToDataUrl for srcset item failed",p)}h&&s.setAttribute("srcset",Xi(d))}}catch(c){j(r,"resolveBlobUrls for img failed",c)}let o=at(e,"image");for(let s of o)try{let c="http://www.w3.org/1999/xlink",u=s.getAttribute("href")||s.getAttributeNS?.(c,"href");if(it(u)){let d=await De(u);s.setAttribute("href",d),s.removeAttributeNS?.(c,"href")}}catch(c){j(r,"resolveBlobUrls for SVG image href failed",c)}let i=at(e,"[style*='blob:']");for(let s of i)try{let c=s.getAttribute("style");if(c&&c.includes("blob:")){let u=await _r(c);s.setAttribute("style",u)}}catch(c){j(r,"replaceBlobUrls in inline style failed",c)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let s of a)try{let c=s.textContent||"";c.includes("blob:")&&(s.textContent=await _r(c))}catch(c){j(r,"replaceBlobUrls in style tag failed",c)}let l=["poster"];for(let s of l){let c=at(e,`[${s}^='blob:']`);for(let u of c)try{let d=u.getAttribute(s);it(d)&&u.setAttribute(s,await De(d))}catch(d){j(r,`resolveBlobUrls for ${s} failed`,d)}}}Ae();var zt=new Map,jr=new Set(["IFRAME"]);function Rt(e,t){zt.set(String(e).toUpperCase(),t)}function It(e){let{width:t,height:r}=fe(e),n=t,o=r;if(!n||!o){let a=e.getBoundingClientRect();n=n||a.width||0,o=o||a.height||0}let i=document.createElement("div");return i.style.cssText=`display:inline-block;width:${n}px;height:${o}px;visibility:hidden;`,i}var lt=200,Gi=new Set(["img","canvas","video","iframe","object","embed"]);function Ur(e,t){return e.right>=t.left-lt&&e.left<=t.right+lt&&e.bottom>=t.top-lt&&e.top<=t.bottom+lt}function Qi(e,t){if(e===t.root)return!1;let r;try{r=e.getBoundingClientRect()}catch{return!1}if(r.width===0&&r.height===0)return!1;let n=_(e);if(n.display==="inline"&&!Gi.has((e.localName||"").toLowerCase()))return!1;let o=t.rect,i=e.scrollWidth||0,a=e.scrollHeight||0,l={left:n.direction==="rtl"?Math.min(r.left,r.right-i):r.left,top:r.top,right:Math.max(r.right,r.left+i),bottom:Math.max(r.bottom,r.top+a)},s=n.writingMode||"";if((s.startsWith("vertical")||s.startsWith("sideways"))&&(l.top=Math.min(r.top,r.bottom-a),l.left=Math.min(l.left,r.right-i)),Ur(l,o))return!1;let c=(e.ownerDocument||document).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;c.nextNode();){let u=c.currentNode.getBoundingClientRect();if((u.width>0||u.height>0)&&Ur(u,o))return!1}return!0}function Ki(e,t,r){let n=e.cloneNode(!1);e.tagName==="IMG"&&(n.removeAttribute("src"),n.removeAttribute("srcset"),n.removeAttribute("sizes")),he(e,n,t,r);let{width:o,height:i}=fe(e);return o>0&&(n.style.width=`${o}px`,n.style.minWidth=`${o}px`,n.style.maxWidth=`${o}px`),i>0&&(n.style.height=`${i}px`,n.style.minHeight=`${i}px`,n.style.maxHeight=`${i}px`),n.style.visibility="hidden",n.style.overflow="hidden",n.style.boxSizing="border-box",n}async function gt(e,t,r){if(!e)throw new Error("Invalid node");let n=new Set,o=null,i=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||pn.has(u))return null;if(u==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return j(t,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null;if(u==="source"&&e.parentElement?.localName==="picture")return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(r.excludeMode==="hide")return It(e);if(r.excludeMode==="remove")return null}if(r.exclude&&Array.isArray(r.exclude))for(let u of r.exclude)try{if(e.matches?.(u)){if(r.excludeMode==="hide")return It(e);if(r.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof r.filter=="function")try{if(!r.filter(e)){if(r.filterMode==="hide")return It(e);if(r.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(t.clip&&Qi(e,t.clip))return Ki(e,t,r);if(r.__resolveNodeHooks)for(let u of r.__resolveNodeHooks){let d;try{d=await u(e,r)}catch(h){j(t,"resolveNode plugin hook failed",h)}if(d===null)return null;if(d instanceof Node)return d.nodeType===Node.ELEMENT_NODE&&(t.nodeMap.set(d,e),he(e,d,t,r)),d}{let u=jr.has(e.tagName)&&zt.get(e.tagName);if(u){let d=await u(e,t,r);if(d!==void 0)return d}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),he(e,u,t,r);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}{let u=!jr.has(e.tagName)&&zt.get(e.tagName);if(u){let d=await u(e,t,r);if(d!==void 0)return d}}let a;try{if(a=e.cloneNode(!1),a.attributes?.length)try{for(let u of a.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(u.value)&&a.setAttribute(u.name,u.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Ci(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Ii(e,a);try{let{width:u,height:d}=fe(e),h=Math.round(u||0),f=Math.round(d||0);h&&(a.dataset.snapdomWidth=String(h)),f&&(a.dataset.snapdomHeight=String(f))}catch(u){j(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),h=v=>{let g=u.match(new RegExp(`${v}\\s*:\\s*([^;]+)`,"i")),w=g?g[1].trim():d.getPropertyValue(v);return/%|auto/i.test(String(w||""))},f=parseInt(a.dataset.snapdomWidth||"0",10),p=parseInt(a.dataset.snapdomHeight||"0",10),m=h("width")||!f,y=h("height")||!p;m&&f&&(a.style.width=`${f}px`),y&&p&&(a.style.height=`${p}px`);let b=d.getPropertyValue("object-fit"),x=d.getPropertyValue("object-position");b&&b!=="fill"?(a.style.objectFit=b,x&&(a.style.objectPosition=x)):(f&&(a.style.minWidth=`${f}px`),p&&(a.style.minHeight=`${p}px`))}catch(u){j(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let l=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=fe(e),h=u||e.getBoundingClientRect().width||0,f=d||e.getBoundingClientRect().height||0;h&&(a.style.width=`${h}px`),f&&(a.style.height=`${f}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&qo()){let{el:d,applyVisual:h}=qi(e);t.nodeMap.set(d,e),l=h,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 HTMLInputElement||e instanceof HTMLTextAreaElement)&&!e.value&&e.placeholder)try{let u=window.getComputedStyle(e,"::placeholder"),d=u&&u.color;if(d&&d!=="rgba(0, 0, 0, 0)"){let h="snapdom-ph-"+(Math.random()*1e6|0);a.classList.add(h);let f=document.createElement("style");f.textContent=`.${h}::placeholder{color:${d}!important;opacity:${u.opacity||"1"}!important;-webkit-text-fill-color:${d}!important;}`,a.prepend(f)}}catch{}if(e instanceof HTMLSelectElement&&(o=e.value),e instanceof HTMLTextAreaElement&&(i=e.value),e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){e.disabled&&a.setAttribute("disabled",""),e.required&&a.setAttribute("required",""),e.readOnly&&a.setAttribute("readonly","");let u=e;u.min!==void 0&&u.min!==""&&a.setAttribute("min",u.min),u.max!==void 0&&u.max!==""&&a.setAttribute("max",u.max),u.pattern!==void 0&&u.pattern!==""&&a.setAttribute("pattern",u.pattern);let d=e.getAttribute("aria-invalid");d!==null&&a.setAttribute("aria-invalid",d)}if(qt(e)||he(e,a,t,r),l&&l(),e instanceof SVGElement&&!qt(e)){let u=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let d=window.getComputedStyle(e);for(let h of u){let f=d.getPropertyValue(h);f&&a.style.setProperty(h,f)}}catch{}}if(e.shadowRoot){try{let v=e.shadowRoot.querySelectorAll("slot");for(let g of v){let w=g.assignedNodes?.()||[];for(let C of w)n.add(C)}}catch{}let u=Ti(t),d=`[data-sd="${u}"]`;t.shadowScopes||(t.shadowScopes=new WeakMap),t.shadowScopes.set(e.shadowRoot,u);try{a.setAttribute("data-sd",u)}catch{}let h=Fi(e.shadowRoot),f=Li(h,d,u),p=Oi(h),m=Di(e,p,d);Pi(a,m+f,u);let y=document.createDocumentFragment(),b=(v,g)=>{if(v.nodeType===Node.ELEMENT_NODE&&v.tagName==="STYLE")return g(null);gt(v,t,r).then(w=>{g(w||null)}).catch(()=>{g(null)})},x=await Pt(Array.from(e.shadowRoot.childNodes),b,r.fast);y.append(...x.filter(v=>!!v)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=t.shadowScopes?.get(e.getRootNode()),d=e.assignedNodes?.()||[],h=d.length?e.assignedNodes?.({flatten:!0})||d:[],f=h.length?h:Array.from(e.childNodes),p=document.createDocumentFragment(),m=(b,x)=>{gt(b,t,r).then(v=>{v&&d.length&&Hi(v,u),x(v||null)}).catch(()=>{x(null)})},y=await Pt(Array.from(f),m,r.fast);return p.append(...y.filter(b=>!!b)),p}function s(u,d){if(n.has(u)||e.shadowRoot&&!u.assignedSlot)return d(null);gt(u,t,r).then(h=>{d(h||null)}).catch(()=>{d(null)})}let c=await Pt(Array.from(e.childNodes),s,r.fast);if(a.append(...c.filter(u=>!!u)),o!==null&&a instanceof HTMLSelectElement){a.value=o;for(let u of a.options)u.value===o?u.setAttribute("selected",""):u.removeAttribute("selected")}return i!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=i),a}async function Ji(e,t,r){let n=!1;try{n=!!(e.contentDocument||e.contentWindow?.document)}catch(o){j(t,"iframe same-origin probe failed",o)}if(n)try{return await Ui(e,t,r)}catch(o){console.warn("[SnapDOM] iframe rasterization failed, fallback:",o)}if(n||console.warn("[snapdom] cross-origin <iframe> skipped (its document cannot be read). Captured as a placeholder that keeps the frame's box; pass { placeholders: false } for an invisible spacer.",e),r.placeholders){let{width:o,height:i}=fe(e),a=document.createElement("div");return a.style.cssText=`width:${o}px;height:${i}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;`,he(e,a,t,r),a}else{let{width:o,height:i}=fe(e),a=document.createElement("div");return a.style.cssText=`display:inline-block;width:${o}px;height:${i}px;visibility:hidden;`,he(e,a,t,r),a}}function Zi(e){try{let t=Math.max(1,Math.min(32,e.width)),r=Math.max(1,Math.min(32,e.height)),n=document.createElement("canvas");n.width=t,n.height=r;let o=n.getContext("2d",{willReadFrequently:!0});if(!o)return!1;o.drawImage(e,0,0,t,r);let i=o.getImageData(0,0,t,r).data;for(let a=3;a<i.length;a+=4)if(i[a]!==0)return!1;return!0}catch{return!1}}async function ea(e,t,r){let n="";try{let l=e.getContext("2d",{willReadFrequently:!0});try{l&&l.getImageData(0,0,1,1)}catch{}if((we()||!l)&&await ke(),n=e.toDataURL("image/png"),!n||n==="data:,"){try{l&&l.getImageData(0,0,1,1)}catch{}if(await ke(),n=e.toDataURL("image/png"),!n||n==="data:,"){let s=document.createElement("canvas");s.width=e.width,s.height=e.height;let c=s.getContext("2d");c&&(c.drawImage(e,0,0),n=s.toDataURL("image/png"))}}}catch(l){j(t,"Canvas toDataURL failed, using empty/fallback",l)}r&&r.debug&&n&&Zi(e)&&j(t,"canvas is empty at capture time \u2014 capture it after its first frame is drawn",e);let o=document.createElement("img");try{o.decoding="sync",o.loading="eager"}catch(l){j(t,"img decoding/loading hints failed",l)}n&&(o.src=n),o.width=e.width,o.height=e.height;let{width:i,height:a}=fe(e);return i>0&&(o.style.width=`${i}px`),a>0&&(o.style.height=`${a}px`),t.nodeMap.set(o,e),he(e,o,t,r),o}async function ta(e,t,r){let n="";try{let l=document.createElement("canvas");l.width=e.videoWidth||e.offsetWidth||320,l.height=e.videoHeight||e.offsetHeight||240;let s=l.getContext("2d");s&&(s.drawImage(e,0,0,l.width,l.height),n=l.toDataURL("image/png"),(!n||n==="data:,")&&(n=""))}catch(l){j(t,"Video frame capture failed, using poster fallback",l)}let o=document.createElement("img");try{o.decoding="sync",o.loading="eager"}catch{}n?o.src=n:e.poster&&(o.src=e.poster),o.width=e.videoWidth||e.offsetWidth||0,o.height=e.videoHeight||e.offsetHeight||0;let{width:i,height:a}=fe(e);return i>0&&(o.style.width=`${i}px`),a>0&&(o.style.height=`${a}px`),o.style.objectFit="contain",t.nodeMap.set(o,e),he(e,o,t,r),o}async function ra(e,t,r){if(!e.controls)return;let{width:n,height:o}=fe(e),i=Math.round(n||e.offsetWidth||300),a=Math.round(o||e.offsetHeight||54),l=a/2,s=Math.max(4,a*.16),c=a*.34,u=i-a*.34,d=c+s+a*.55,h=Math.max(0,u-a*.7-d),f=Math.max(9,Math.round(a*.24)),p=`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${a}" viewBox="0 0 ${i} ${a}"><rect width="${i}" height="${a}" rx="${Math.min(a/2,10)}" fill="#f1f3f4"/><path d="M ${c} ${l-s} L ${c+s} ${l} L ${c} ${l+s} Z" fill="#5f6368"/><rect x="${d}" y="${l-1.5}" width="${h}" height="3" rx="1.5" fill="#bdc1c6"/><circle cx="${d}" cy="${l}" r="${Math.max(3,a*.09)}" fill="#5f6368"/><text x="${u}" y="${l}" fill="#5f6368" font-family="sans-serif" font-size="${f}" text-anchor="end" dominant-baseline="central">0:00</text></svg>`,m=document.createElement("img");try{m.decoding="sync",m.loading="eager"}catch{}return m.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,m.width=i,m.height=a,m.style.width=`${i}px`,m.style.height=`${a}px`,t.nodeMap.set(m,e),he(e,m,t,r),m}Rt("IFRAME",Ji);Rt("CANVAS",ea);Rt("VIDEO",ta);Rt("AUDIO",ra);ue();Et();$t();ne();ne();var na=[/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],Ne=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__||{}),Dn=[],qr=new Set;function oa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ia(e){let t=Array.isArray(e)?e:[e];for(let r of t){let n;if(r instanceof RegExp)n=r;else if(typeof r=="string")n=new RegExp(oa(r),"i");else{console.warn("[snapdom] Ignored invalid iconFont value:",r);continue}let o=`${n.source}/${n.flags}`;qr.has(o)||(qr.add(o),Dn.push(n))}}function ye(e){let t=typeof e=="string"?e:"",r=[...na,...Dn];for(let n of r)if(n instanceof RegExp&&n.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 aa(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var zr=new Map;function la(e=""){let t=Object.create(null),r=String(e||""),n=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,o;for(;o=n.exec(r);)t[o[1].toUpperCase()]=Number(o[2]);return t}async function sa(e,t,r){let n=String(e||""),o=n.toLowerCase(),i=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(o)&&!/\bsymbols\b/.test(o))return{familyForMeasure:n,familyForCanvas:n};if(!/\bmaterial\s*symbols\b/.test(o))return{familyForMeasure:n,familyForCanvas:n};let a=r&&(r.FILL??r.fill),l="outlined";/\brounded\b/.test(i)||/\bround\b/.test(i)?l="rounded":/\bsharp\b/.test(i)?l="sharp":/\boutlined\b/.test(i)&&(l="outlined");let s=a===1,c=null;if(s&&(l==="outlined"&&Ne.materialIconsFilled?c={url:Ne.materialIconsFilled,alias:"snapdom-mi-filled"}:l==="rounded"&&Ne.materialIconsRound?c={url:Ne.materialIconsRound,alias:"snapdom-mi-round"}:l==="sharp"&&Ne.materialIconsSharp&&(c={url:Ne.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:n,familyForCanvas:n};if(!zr.has(c.alias))try{let d=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),zr.set(c.alias,!0)}catch{return{familyForMeasure:n,familyForCanvas:n}}let u=`"${c.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function ca(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function ua(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",r=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!r&&t.toLowerCase()!=="currentcolor")return t;let n=e.color?.trim();return n&&n!=="inherit"?n:"#000"}async function da(e,{family:t="Material Icons",weight:r="normal",fontSize:n=32,color:o="#000",variation:i="",className:a=""}={}){let l=String(t||"").replace(/^['"]+|['"]+$/g,""),s=window.devicePixelRatio||1,c=la(i),{familyForMeasure:u,familyForCanvas:d}=await sa(l,a,c);await ca(d.replace(/^["']+|["']+$/g,""),n);let h=document.createElement("span");h.setAttribute("data-snapdom-internal",""),h.textContent=e,h.style.position="absolute",h.style.visibility="hidden",h.style.left="-99999px",h.style.whiteSpace="nowrap",h.style.fontFamily=u,h.style.fontWeight=String(r||"normal"),h.style.fontSize=`${n}px`,h.style.lineHeight="1",h.style.margin="0",h.style.padding="0",h.style.fontFeatureSettings="'liga' 1",h.style.fontVariantLigatures="normal",h.style.color=o,document.body.appendChild(h);let f=h.getBoundingClientRect(),p=Math.max(1,Math.ceil(f.width)),m=Math.max(1,Math.ceil(f.height));document.body.removeChild(h);let y=document.createElement("canvas");y.width=p*s,y.height=m*s;let b=y.getContext("2d");b.scale(s,s),b.font=`${r?`${r} `:""}${n}px ${d}`,b.textAlign="left",b.textBaseline="top",b.fillStyle=o;try{b.fontKerning="normal"}catch{}return b.fillText(e,0,0),{dataUrl:y.toDataURL(),width:p,height:m}}async function ha(e,t,r=M.session.nodeMap){if(e?.nodeType!==1)return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(e.querySelectorAll(n)).filter(l=>l&&l.textContent&&l.textContent.trim());if(e.matches?.(n)&&e.textContent&&e.textContent.trim()&&o.unshift(e),o.length===0)return 0;let i=t?.nodeType===1?Array.from(t.querySelectorAll(n)).filter(l=>l&&l.textContent&&l.textContent.trim()):[];t?.nodeType===1&&t.matches?.(n)&&t.textContent&&t.textContent.trim()&&i.unshift(t);let a=0;for(let l=0;l<o.length;l++){let s=o[l],c=r&&r.get(s)||i[l]||null;try{let u=getComputedStyle(c||s),d=u.fontFamily||"Material Icons";if(!aa(d))continue;let h=(c||s).textContent.trim();if(!h)continue;let f=parseInt(u.fontSize,10)||24,p=u.fontWeight&&u.fontWeight!=="normal"?u.fontWeight:"normal",m=ua(u),y=u.fontVariationSettings&&u.fontVariationSettings!=="normal"?u.fontVariationSettings:"",b=(c||s).className||"",{dataUrl:x,width:v,height:g}=await da(h,{family:d,weight:p,fontSize:f,color:m,variation:y,className:b});s.textContent="";let w=s.ownerDocument.createElement("img");w.src=x,w.alt=h,w.style.height=`${f}px`,w.style.width=`${Math.max(1,Math.round(v/g*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(s).verticalAlign||"baseline",s.appendChild(w),a++}catch{}}return a}$e();Ae();async function fa(e,t,r,n=32,o="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let i=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.setAttribute("data-snapdom-internal",""),a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=r||"normal",a.style.fontSize=`${n}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let l=a.getBoundingClientRect(),s=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,s*i),u.height=Math.max(1,c*i);let d=u.getContext("2d");return d.scale(i,i),d.font=r?`${r} ${n}px "${t}"`:`${n}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=o,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:s,height:c}}var Hn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),pa=["katex","mathjax","mathml"];function ur(e){if(!e)return"";for(let t of e.split(",")){let r=t.trim().replace(/^['"]+|['"]+$/g,"");if(r&&!Hn.has(r.toLowerCase()))return r}return""}function ma(e){if(!e)return[];let t=[];for(let r of e.split(",")){let n=r.trim().replace(/^['"]+|['"]+$/g,"");n&&(Hn.has(n.toLowerCase())||t.push(n))}return t}function yt(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let r=parseInt(t,10);return Number.isFinite(r)?Math.min(900,Math.max(100,r)):400}function bt(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function ga(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function ya(e){let t=String(e||"400").trim(),r=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(r){let o=yt(r[1]),i=yt(r[2]);return{min:Math.min(o,i),max:Math.max(o,i)}}let n=yt(t);return{min:n,max:n}}function ba(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function wa(e){let t=String(e||"100%").trim(),r=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(r){let i=parseFloat(r[1]),a=parseFloat(r[2]);return{min:Math.min(i,a),max:Math.max(i,a)}}let n=t.match(/(\d+(?:\.\d+)?)\s*%/),o=n?parseFloat(n[1]):100;return{min:o,max:o}}function xa(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function va(e,t,r=[]){if(!e)return!1;try{let n=new URL(e,location.href);if(n.origin===location.origin)return!0;let o=n.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=>o.endsWith(a))||r.some(a=>o===a.toLowerCase()||o.endsWith("."+a.toLowerCase())))return!0;let i=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i)||pa.some(a=>i.includes(a)))return!0;for(let a of t){let l=a.toLowerCase().replace(/\s+/g,"+"),s=a.toLowerCase().replace(/\s+/g,"-"),c=xa(a);if(i.includes(l)||i.includes(s)||c&&i.includes(c))return!0}return!1}catch{return!1}}function Sa(e){let t=new Set;for(let r of e||[]){let n=String(r).split("__")[0]?.trim();n&&t.add(n)}return t}function Vr(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(r,n,o)=>{let i=(o||"").trim();if(!i||/^data:|^blob:|^https?:|^file:|^about:/i.test(i))return r;let a=i;try{a=new URL(i,t||location.href).href}catch{}return`url("${a}")`})}var Vt=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Mt=4;async function Ca(e,t,r){if(!e)return e;let n=new Set;function o(l,s){try{return new URL(l,s||location.href).href}catch{return l}}async function i(l,s,c=0){if(c>Mt)return console.warn(`[snapDOM] @import depth exceeded (${Mt}) at ${s}`),l;let u="",d=0,h;for(;h=Vt.exec(l);){u+=l.slice(d,h.index),d=Vt.lastIndex;let f=(h[2]||h[4]||"").trim(),p=o(f,s);if(n.has(p)){console.warn(`[snapDOM] Skipping circular @import: ${p}`);continue}n.add(p);let m="";try{let y=await se(p,{as:"text",useProxy:r,silent:!0});y.ok&&typeof y.data=="string"&&(m=y.data)}catch{}m?(m=Vr(m,p),m=await i(m,p,c+1),u+=`
|
|
6
|
+
/* inlined: ${p} */
|
|
7
|
+
${m}
|
|
8
|
+
`):u+=h[0]}return u+=l.slice(d),u}let a=Vr(e,t||location.href);return a=await i(a,t||location.href,0),a}var Bn=/url\((["']?)([^"')]+)\1\)/g,Ma=/@font-face[^{}]*\{[^}]*\}/g;function le(e,t,r=""){return(e.match(new RegExp(`${t}\\s*:\\s*([^;}]+)[;}]`,"i"))?.[1]||r).trim()}function _n(e){if(!e)return[];let t=[],r=e.split(",").map(n=>n.trim()).filter(Boolean);for(let n of r){let o=n.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let i=o[1],a=o[2],l=s=>{if(!s.includes("?"))return parseInt(s,16);let c=parseInt(s.replace(/\?/g,"0"),16),u=parseInt(s.replace(/\?/g,"F"),16);return[c,u]};if(a){let s=l(i),c=l(a),u=Array.isArray(s)?s[0]:s,d=Array.isArray(c)?c[1]:c;t.push([Math.min(u,d),Math.max(u,d)])}else{let s=l(i);Array.isArray(s)?t.push([s[0],s[1]]):t.push([s,s])}}return t}function jn(e,t){if(!t.length||!e||e.size===0)return!0;for(let r of e)for(let[n,o]of t)if(r>=n&&r<=o)return!0;return!1}function dr(e,t){let r=[];if(!e)return r;for(let n of e.matchAll(Bn)){let o=(n[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,t||location.href).href}catch{}r.push(o)}}return r}async function Xt(e,t,r=""){let n=e;for(let o of e.matchAll(Bn)){let i=nr(o[0]);if(!i)continue;let a=i;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!ye(a)){if(M.resource?.has(a)){M.font?.add(a),n=n.replace(o[0],`url(${M.resource.get(a)})`);continue}try{let l=await se(a,{as:"dataURL",useProxy:r,silent:!0});if(l.ok&&typeof l.data=="string"){let s=l.data;M.resource?.set(a,s),M.font?.add(a),n=n.replace(o[0],`url(${s})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return n}function ka(e){if(!e.length)return null;let t=(a,l)=>e.some(([s,c])=>!(c<a||s>l)),r=t(0,255)||t(305,305),n=t(256,591)||t(7680,7935),o=t(880,1023),i=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":i?"cyrillic":o?"greek":n?"latin-ext":r?"latin":null}function Xr(e={}){let t=new Set((e.families||[]).map(o=>String(o).toLowerCase())),r=new Set((e.domains||[]).map(o=>String(o).toLowerCase())),n=new Set((e.subsets||[]).map(o=>String(o).toLowerCase()));return(o,i)=>{if(t.size&&t.has(o.family.toLowerCase()))return!0;if(r.size)for(let a of o.srcUrls)try{if(r.has(new URL(a).host.toLowerCase()))return!0}catch{}if(n.size){let a=ka(i);if(a&&n.has(a))return!0}return!1}}function Ea(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,r=new Set,n=[];for(let i of e.match(t)||[]){let a=le(i,"font-family"),l=ur(a),s=le(i,"font-weight","400"),c=le(i,"font-style","normal"),u=le(i,"font-stretch","100%"),d=le(i,"unicode-range"),h=le(i,"src"),f=dr(h,location.href),p=f.length?f.map(y=>String(y).toLowerCase()).sort().join("|"):h.toLowerCase(),m=[String(l||"").toLowerCase(),s,c,u,d.toLowerCase(),p].join("|");r.has(m)||(r.add(m),n.push(i))}if(n.length===0)return e;let o=0;return e.replace(t,()=>n[o++]||"")}var Yr=new WeakMap,$a=0;function Aa(e){let t=Yr.get(e);return t===void 0&&(t=$a++,Yr.set(e,t)),t}function Ra(e,t,r,n,o,i){let a=Array.from(e||[]).sort().join("|"),l=t?JSON.stringify({families:(t.families||[]).map(h=>String(h).toLowerCase()).sort(),domains:(t.domains||[]).map(h=>String(h).toLowerCase()).sort(),subsets:(t.subsets||[]).map(h=>String(h).toLowerCase()).sort()}):"",s=(r||[]).map(h=>`${(h.family||"").toLowerCase()}::${h.weight||"normal"}::${h.style||"normal"}::${h.src||""}`).sort().join("|"),c=n||"",u=(o||[]).map(h=>String(h).toLowerCase()).sort().join("|"),d=Aa(i||document);return`fonts-embed-css::req=${a}::ex=${l}::lf=${s}::px=${c}::fd=${u}::doc=${d}`}async function Un(e,t,r,n){let o;try{o=e.cssRules||[]}catch{return}let i=(a,l)=>{try{return new URL(a,l||location.href).href}catch{return a}};for(let a of o){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let l=a.href?i(a.href,t):t;if(n.depth>=Mt){console.warn(`[snapDOM] CSSOM import depth exceeded (${Mt}) at ${l}`);continue}if(l&&n.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&n.visitedSheets.add(l);let s={...n,depth:(n.depth||0)+1};await Un(a.styleSheet,l,r,s);continue}if(a.type===CSSRule.FONT_FACE_RULE){let l=(a.style.getPropertyValue("font-family")||"").trim(),s=ur(l);if(!s||ye(s))continue;let c=(a.style.getPropertyValue("font-weight")||"").trim(),u=(a.style.getPropertyValue("font-style")||"").trim(),d=(a.style.getPropertyValue("font-stretch")||"").trim(),h=(a.style.getPropertyValue("font-variation-settings")||"").trim(),f=(a.style.getPropertyValue("src")||"").trim(),p=(a.style.getPropertyValue("unicode-range")||"").trim(),m=c||"400",y=u||"normal",b=d||"100%",x=(u?`font-style:${u};`:"")+(c?`font-weight:${c};`:"")+(d?`font-stretch:${d};`:"")+(h?`font-variation-settings:${h};`:"")+(p?`unicode-range:${p};`:""),v=n.faceMatchesRequired(s,y,m,b);if(!v&&!n.requiredIndex.has(s.toLowerCase()))continue;let g=_n(p);if(!jn(n.usedCodepoints,g))continue;let w={family:s,weightSpec:m,styleSpec:y,stretchSpec:b,unicodeRange:p,srcRaw:f,srcUrls:dr(f,t||location.href),href:t||location.href};if(n.simpleExcluder&&n.simpleExcluder(w,g))continue;if(!v){n.provisionalFaces.push({family:s.toLowerCase(),block:`@font-face{font-family:${s};src:${f};${x}}`,srcRaw:f,baseHref:t||location.href});continue}if(n.coveredFamilies.add(s.toLowerCase()),/url\(/i.test(f)){let C=await Xt(f,t||location.href,n.useProxy);await r(`@font-face{font-family:${s};src:${C};${x}}`)}else await r(`@font-face{font-family:${s};src:${f};${x}}`)}}}async function Na({required:e,usedCodepoints:t,exclude:r=void 0,localFonts:n=[],useProxy:o="",fontStylesheetDomains:i=[],doc:a=document}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let l=new Map;for(let g of e){let[w,C,k,S]=String(g).split("__");if(!w)continue;let E=w.toLowerCase(),$=l.get(E)||[];$.push({w:parseInt(C,10),s:k,st:parseInt(S,10)}),l.set(E,$)}function s(g,w,C,k){let S=String(g).toLowerCase();if(!l.has(S))return!1;let E=l.get(S),$=ya(C),R=ba(w),T=wa(k),W=$.min!==$.max,F=$.min,I=O=>R.kind==="normal"&&O==="normal"||R.kind!=="normal"&&(O==="italic"||O==="oblique"),N=!1;for(let O of E){let X=W?O.w>=$.min&&O.w<=$.max:O.w===F,U=I(bt(O.s)),V=O.st>=T.min&&O.st<=T.max;if(X&&U&&V){N=!0;break}}if(N)return!0;if(!W)for(let O of E){let X=I(bt(O.s)),U=O.st>=T.min&&O.st<=T.max;if(Math.abs(F-O.w)<=300&&X&&U)return!0}if(!W&&R.kind==="normal"&&E.some(O=>bt(O.s)!=="normal"))for(let O of E){let X=Math.abs(F-O.w)<=300,U=O.st>=T.min&&O.st<=T.max;if(X&&U)return!0}return!1}let c=Xr(r),u=Ra(e,r,n,o,i,a);if(M.resource?.has(u))return M.resource.get(u);let d=Sa(e),h=[],f=Vt;for(let g of a.querySelectorAll("style")){let w=g.textContent||"";for(let C of w.matchAll(f)){let k=(C[2]||C[4]||"").trim();!k||ye(k)||a.querySelector(`link[rel="stylesheet"][href="${k}"]`)||h.push(k)}}let p=[];h.length&&await Promise.all(h.map(g=>new Promise(w=>{if(a.querySelector(`link[rel="stylesheet"][href="${g}"]`))return w(null);let C=a.createElement("link");C.rel="stylesheet",C.href=g,C.setAttribute("data-snapdom","injected-import"),C.onload=()=>w(C),C.onerror=()=>w(null),a.head.appendChild(C),p.push(C)})));let m="",y=new Set,b=[],x=Array.from(a.querySelectorAll('link[rel="stylesheet"]')).filter(g=>!!g.href);for(let g of p)try{g.remove()}catch{}for(let g of x)try{if(ye(g.href))continue;let w="",C=!1;try{C=new URL(g.href,location.href).origin===location.origin}catch{}if(!C){let S=Array.isArray(i)?i:[];if(!va(g.href,d,S))continue}if(C){let S=Array.from(a.styleSheets).find(E=>E.href===g.href);if(S)try{let E=S.cssRules||[];w=Array.from(E).map($=>$.cssText).join("")}catch{}}if(!w){let S=await se(g.href,{as:"text",useProxy:o});if(S?.ok&&typeof S.data=="string"&&(w=S.data),ye(g.href))continue}w=await Ca(w,g.href,o);let k="";for(let S of w.match(Ma)||[]){let E=le(S,"font-family"),$=ur(E);if(!$||ye($))continue;let R=le(S,"font-weight","400"),T=le(S,"font-style","normal"),W=le(S,"font-stretch","100%"),F=le(S,"unicode-range"),I=le(S,"src"),N=dr(I,g.href),O=s($,T,R,W);if(!O&&!l.has($.toLowerCase()))continue;let X=_n(F);if(!jn(t,X))continue;let U={family:$,weightSpec:R,styleSpec:T,stretchSpec:W,unicodeRange:F,srcRaw:I,srcUrls:N,href:g.href};if(r&&c(U,X))continue;if(!O){b.push({family:$.toLowerCase(),block:S,srcRaw:I,baseHref:g.href});continue}y.add($.toLowerCase());let V=/url\(/i.test(I)?await Xt(S,g.href,o):S;k+=V}k.trim()&&(m+=k)}catch{console.warn("[snapDOM] Failed to process stylesheet:",g.href)}let v={requiredIndex:l,usedCodepoints:t,faceMatchesRequired:s,coveredFamilies:y,provisionalFaces:b,simpleExcluder:r?Xr(r):null,useProxy:o,visitedSheets:new Set,depth:0};for(let g of a.styleSheets)if(!(g.href&&x.some(w=>w.href===g.href)))try{let w=g.href||location.origin+"/";w&&v.visitedSheets.add(w),await Un(g,w,async C=>{m+=C},v)}catch{}for(let g of b)y.has(g.family)||(m+=/url\(/i.test(g.srcRaw)?await Xt(g.block,g.baseHref,o):g.block);try{for(let g of a.fonts||[]){if(!g||!g.family||g.status!=="loaded"||!g._snapdomSrc)continue;let w=String(g.family).replace(/^['"]+|['"]+$/g,"");if(ye(w)||!l.has(w.toLowerCase())||r?.families&&r.families.some(k=>String(k).toLowerCase()===w.toLowerCase()))continue;let C=g._snapdomSrc;if(!String(C).startsWith("data:")){if(M.resource?.has(g._snapdomSrc))C=M.resource.get(g._snapdomSrc),M.font?.add(g._snapdomSrc);else if(!M.font?.has(g._snapdomSrc))try{let k=await se(g._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(k.ok&&typeof k.data=="string")C=k.data,M.resource?.set(g._snapdomSrc,C),M.font?.add(g._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",g._snapdomSrc);continue}}m+=`@font-face{font-family:'${w}';src:url(${C});font-style:${g.style||"normal"};font-weight:${g.weight||"normal"};}`}}catch{}for(let g of n){if(!g||typeof g!="object")continue;let w=String(g.family||"").replace(/^['"]+|['"]+$/g,"");if(!w||ye(w)||!l.has(w.toLowerCase())||r?.families&&r.families.some(R=>String(R).toLowerCase()===w.toLowerCase()))continue;let C=g.weight!=null?String(g.weight):"normal",k=g.style!=null?String(g.style):"normal",S=g.stretchPct!=null?`${g.stretchPct}%`:"100%",E=String(g.src||""),$=E;if(!$.startsWith("data:")){if(M.resource?.has(E))$=M.resource.get(E),M.font?.add(E);else if(!M.font?.has(E))try{let R=await se(E,{as:"dataURL",useProxy:o,silent:!0});if(R.ok&&typeof R.data=="string")$=R.data,M.resource?.set(E,$),M.font?.add(E);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",E);continue}}m+=`@font-face{font-family:'${w}';src:url(${$});font-style:${k};font-weight:${C};font-stretch:${S};}`}return m&&(m=Ea(m),M.resource?.set(u,m)),m}function qn(e,t){let r=new Set,n=new Set;if(!e)return{required:r,usedCodepoints:n};let o=s=>{if(s)for(let c of s)n.add(c.codePointAt(0))},i=s=>{let c=ma(s.fontFamily);if(c.length)for(let u of c)r.add(`${u}__${yt(s.fontWeight)}__${bt(s.fontStyle)}__${ga(s.fontStretch)}`)},a=s=>{i(_(s));for(let c of["::before","::after"]){let u=_(s,c),d=u&&u.content;if(!(!d||d==="none"||d==="normal"))if(i(u),/^["']/.test(d))o(d.slice(1,-1));else{let h=d.match(/\\[0-9A-Fa-f]{1,6}/g);if(h)for(let f of h)try{n.add(parseInt(f.slice(1),16))}catch{}}}};a(e);let l=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;l.nextNode();){let s=l.currentNode;if(s.nodeType===Node.TEXT_NODE){if(t&&s.parentElement&&!t(s.parentElement))continue;o(s.nodeValue||"")}else{if(t&&!t(s))continue;a(s)}}return{required:r,usedCodepoints:n}}function La(e,t){return qn(e,t).required}async function zn(e,t=2,r=document){try{await r.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let i=r.createElement("div");i.setAttribute("data-snapdom-internal",""),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 a of n){let l=r.createElement("span");l.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",l.style.fontFamily=`"${a}"`,l.style.fontWeight="700",l.style.fontStyle="italic",l.style.fontSize="32px",l.style.lineHeight="1",l.style.whiteSpace="nowrap",l.style.margin="0",l.style.padding="0",i.appendChild(l)}r.body.appendChild(i),i.offsetWidth,r.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)o(),await ke(),await ke()}function Ta(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function Gr(e,t=!1){let r="",n=Math.max(1,e);for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function Qr(e,t=!0){let r=[[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"]],n=Math.max(1,Math.min(3999,e)),o="";for(let[i,a]of r)for(;n>=i;)o+=a,n-=i;return t?o:o.toLowerCase()}function Kr(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(e);case"decimal-leading-zero":{let r=Math.abs(e);return(e<0?"-":"")+(r<10?"0":"")+String(r)}case"lower-alpha":return Gr(e,!1);case"upper-alpha":return Gr(e,!0);case"lower-roman":return Qr(e,!1);case"upper-roman":return Qr(e,!0);default:return String(e)}}function Fa(e){let t=new WeakMap,r=e instanceof Document?e.documentElement:e,n=c=>c&&c.tagName==="LI",o=c=>{let u=0,d=c?.parentElement;if(!d)return 0;for(let h of d.children){if(h===c)break;h.tagName==="LI"&&u++}return u},i=c=>{let u=new Map;for(let[d,h]of c)u.set(d,h.slice());return u},a=(c,u,d)=>{let h=i(c),f;try{f=d.style?.counterReset||getComputedStyle(d).counterReset}catch{}if(f&&f!=="none")for(let y of f.split(",")){let b=y.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!x)continue;let g=u.get(x);if(g&&g.length){let w=g.slice();w.push(v),h.set(x,w)}else h.set(x,[v])}let p;try{p=d.style?.counterSet||getComputedStyle(d).counterSet}catch{}if(p&&p!=="none")for(let y of p.split(",")){let b=y.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!x)continue;let g=h.get(x)||[];g.length===0&&g.push(0),g[g.length-1]=v,h.set(x,g)}let m;try{m=d.style?.counterIncrement||getComputedStyle(d).counterIncrement}catch{}if(m&&m!=="none")for(let y of m.split(",")){let b=y.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!x)continue;let g=h.get(x)||[];g.length===0&&g.push(0),g[g.length-1]+=v,h.set(x,g)}try{if(getComputedStyle(d).display==="list-item"&&n(d)){let y=d.parentElement,b=1;if(y&&y.tagName==="OL"){let v=y.getAttribute("start"),g=Number.isFinite(Number(v))?Number(v):1,w=o(d),C=d.getAttribute("value");b=Number.isFinite(Number(C))?Number(C):g+w}else b=1+o(d);let x=h.get("list-item")||[];x.length===0&&x.push(0),x[x.length-1]=b,h.set("list-item",x)}}catch{}return h},l=(c,u,d)=>{let h=a(d,u,c);t.set(c,h);let f=h;for(let m of c.children)f=l(m,h,f);let p=new Map;for(let[m,y]of d){let b=y.length,x=f.get(m);p.set(m,x&&x.length?x.slice(0,b):y.slice())}for(let[m,y]of f)!p.has(m)&&y.length&&!u.has(m)&&p.set(m,y.slice(0,1));return p},s=new Map;return l(r,s,s),{get(c,u){let d=t.get(c)?.get(u);return d&&d.length?d[d.length-1]:0},getStack(c,u){let d=t.get(c)?.get(u);return d?d.slice():[]}}}function Pa(e,t,r){if(!e||e==="none")return e;try{let n=/\b(counter|counters)\s*\(([^)]+)\)/g;return e.replace(n,(o,i,a)=>{let l=String(a).split(",").map(s=>s.trim());if(i==="counter"){let s=l[0]?.replace(/^["']|["']$/g,""),c=(l[1]||"decimal").toLowerCase(),u=r.get(t,s);return Kr(u,c)}else{let s=l[0]?.replace(/^["']|["']$/g,""),c=l[1]?.replace(/^["']|["']$/g,"")??"",u=(l[2]||"decimal").toLowerCase(),d=r.getStack(t,s);return d.length?d.map(h=>Kr(h,u)).join(c):""}})}catch{return"- "}}$e();var Le=new WeakMap,Jr=1e3;function Ia(e,t){let r=Vn(e);return t?(t.__pseudoPreflightFp!==r&&(t.__pseudoPreflight=en(e,r),t.__pseudoPreflightFp=r),!!t.__pseudoPreflight):en(e,r)}function Yt(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Vn(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),r=`n:${t.length}|`,n=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.tagName==="STYLE"){let l=a.textContent?a.textContent.length:0;r+=`S${l}|`;let s=a.sheet,c=s?Yt(s):null;c&&(n+=c.length)}else{let l=a.getAttribute("href")||"",s=a.getAttribute("media")||"all";r+=`L${l}|m:${s}|`;let c=a.sheet,u=c?Yt(c):null;u&&(n+=u.length)}}let o=e.adoptedStyleSheets;return r+=`ass:${Array.isArray(o)?o.length:0}|tr:${n}`,r}function Zr(e,t,r){let n=Yt(e);if(!n)return!1;for(let o=0;o<n.length;o++){if(r.budget<=0)return!1;let i=n[o],a=i&&i.cssText?i.cssText:"";r.budget--;for(let l of t)if(a.includes(l))return!0;if(i&&i.cssRules&&i.cssRules.length)for(let l=0;l<i.cssRules.length&&r.budget>0;l++){let s=i.cssRules[l],c=s&&s.cssText?s.cssText:"";r.budget--;for(let u of t)if(c.includes(u))return!0}if(r.budget<=0)return!1}return!1}function en(e=document,t=Vn(e)){let r=Le.get(e);if(r&&r.fingerprint===t)return r.result;let n=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],o=e.querySelectorAll("style");for(let a=0;a<o.length;a++){let l=o[a].textContent||"";for(let s of n)if(l.includes(s))return Le.set(e,{fingerprint:t,result:!0}),!0}let i=e.adoptedStyleSheets;if(Array.isArray(i)&&i.length){let a={budget:Jr};try{for(let l of i)if(Zr(l,n,a))return Le.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),l={budget:Jr};for(let s=0;s<a.length&&l.budget>0;s++){let c=a[s],u=null;if(c.tagName,u=c.sheet||null,u&&Zr(u,n,l))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)}function tn(e){for(let t of["Top","Right","Bottom","Left"]){let r=parseFloat(e[`border${t}Width`])||0,n=e[`border${t}Style`];if(r>0&&n&&n!=="none"&&n!=="hidden")return!0}return!1}function Oa(e,t){let r=null,n=()=>{if(!r)try{r=Fa(e)}catch(o){j(t,"buildCounterContext failed",o),r={get:()=>0,getStack:()=>[]}}return r};return{get(o,i){return n().get(o,i)},getStack(o,i){return n().getStack(o,i)}}}function Wa(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r];if(n==='"')t=!t;else if(n==="/"&&!t)return e.slice(0,r).trim()}return e}function Da(e){if(!e)return"";let t=[],r=/"([^"]*)"/g,n=0,o;for(;o=r.exec(e);){let a=e.slice(n,o.index).trim();a&&t.push(a),t.push(o[1]),n=r.lastIndex}let i=e.slice(n).trim();return i&&t.push(i),t.join("")}function Gt(e,t,r){let n=e.parentElement,o=n&&r?r.get(n):null;return o?{get(i,a){let l=t.get(i,a),s=o.get(a);return typeof s=="number"?Math.max(l,s):l},getStack(i,a){let l=t.getStack(i,a);if(!l.length)return l;let s=o.get(a);if(typeof s=="number"){let c=l.slice();return c[c.length-1]=Math.max(c[c.length-1],s),c}return l}}:t}function Qt(e,t,r){let n=new Map;function o(c){let u=[];if(!c||c==="none")return u;for(let d of String(c).split(",")){let h=d.trim().split(/\s+/),f=h[0],p=Number.isFinite(Number(h[1]))?Number(h[1]):void 0;f&&u.push({name:f,num:p})}return u}let i=o(t?.counterReset),a=o(t?.counterSet),l=o(t?.counterIncrement);function s(c){if(n.has(c))return n.get(c).slice();let u=r.getStack(e,c);u=u.length?u.slice():[];let d=i.find(p=>p.name===c);if(d){let p=Number.isFinite(d.num)?d.num:0;u=u.length?[...u,p]:[p]}let h=a.find(p=>p.name===c);if(h){let p=Number.isFinite(h.num)?h.num:0;u.length===0&&(u=[0]),u[u.length-1]=p}let f=l.find(p=>p.name===c);if(f){let p=Number.isFinite(f.num)?f.num:1;u.length===0&&(u=[0]),u[u.length-1]+=p}return n.set(c,u.slice()),u}return{get(c,u){let d=s(u);return d.length?d[d.length-1]:0},getStack(c,u){return s(u)},__incs:l}}function Ha(e,t,r,n){let o;try{o=_(e,t)}catch{}let i=o?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};i=Wa(i);let a=Gt(e,r,n),l=Qt(e,o,a),s=Ta(i)?Pa(i,e,l):i;return{text:Da(s),incs:l.__incs||[]}}async function Kt(e,t,r,n){if(e?.nodeType!==1||t?.nodeType!==1||e.tagName==="TEXTAREA")return;let o=e.ownerDocument||document;if(!Ia(o,r))return;r.__siblingCounters||(r.__siblingCounters=new WeakMap),r.__counterCtx||(r.__counterCtx=Oa(e.ownerDocument||document,r));let i=r.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let s=_(e,l);if(!s||s.content==="none"&&s.backgroundImage==="none"&&s.backgroundColor==="transparent"&&!tn(s)&&(!s.transform||s.transform==="none")&&s.display==="inline")continue;if(l==="::first-letter"){let P=_(e),B=(P?.display||"").toLowerCase();if(B.includes("flex")||B.includes("grid"))continue;let D=ee=>s[ee]!==P[ee]&&(parseFloat(s[ee])||0)!==0;if(!(s.color!==P.color||s.fontSize!==P.fontSize||s.fontWeight!==P.fontWeight||s.fontFamily!==P.fontFamily||s.fontStyle!==P.fontStyle||s.textTransform!==P.textTransform||s.float!==P.float&&s.float!=="none"||D("paddingTop")||D("paddingRight")||D("paddingBottom")||D("paddingLeft")||D("marginTop")||D("marginRight")||D("marginBottom")||D("marginLeft")))continue;let q=Array.from(t.childNodes).find(ee=>ee.nodeType===Node.TEXT_NODE&&ee.textContent?.trim().length>0);if(!q)continue;let ce=q.textContent,Q=ce.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],te=ce.slice(Q?.length||0);if(!Q||/[\uD800-\uDFFF]/.test(Q))continue;let oe=document.createElement("span");oe.textContent=Q,oe.dataset.snapdomPseudo="::first-letter";let J=Nr(s),pe=Ht(J,"span");r.styleMap.set(oe,pe);let Ce=document.createTextNode(te);t.replaceChild(Ce,q),t.insertBefore(oe,Ce);continue}let c=s.content??"",u=c===""||c==="none"||c==="normal",{text:d,incs:h}=Ha(e,l,i,r.__siblingCounters),f=s.backgroundImage,p=s.backgroundColor,m=s.fontFamily,y=parseInt(s.fontSize)||32,b=parseInt(s.fontWeight)||!1,x=s.color||"#000",v=s.transform,g=ye(m),w=!u&&d!=="",C=f&&f!=="none",k=p&&p!=="transparent"&&p!=="rgba(0, 0, 0, 0)",S=tn(s),E=v&&v!=="none",$=c!=="none"&&c!=="normal",R=$&&((parseFloat(s.width)||0)>0||(parseFloat(s.height)||0)>0),T=$&&s.boxShadow&&s.boxShadow!=="none",W=$&&s.outlineStyle&&s.outlineStyle!=="none"&&(parseFloat(s.outlineWidth)||0)>0;if(!(w||C||k||S||E||R||T||W)){if(h&&h.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map;for(let{name:B}of h){if(!B)continue;let D=Gt(e,i,r.__siblingCounters),q=Qt(e,_(e,l),D).get(e,B);P.set(B,q)}r.__siblingCounters.set(e.parentElement,P)}continue}let F=d.startsWith("url(")||/^-?(?:webkit-)?image-set\(/i.test(d),I=!1;if(w&&!g&&d.length>1&&!F){let P=_(e),B=parseFloat(P.fontSize)||16,D=parseFloat(P.lineHeight);Number.isFinite(D)||(D=B*1.5),e.getBoundingClientRect().height<D*1.6&&(t.style.whiteSpace="nowrap",I=!0)}let N=document.createElement("span");N.dataset.snapdomPseudo=l,N.style.pointerEvents="none",I&&(N.style.whiteSpace="nowrap");let O=Nr(s),X=(_(e).display||"").toLowerCase(),U=X.includes("flex")||X.includes("grid");if(U){let P=O["min-width"];(!P||P==="auto"||P==="0px")&&(O["min-width"]="0px")}let V=Ht(O,"span",w,U);if(r.styleMap.set(N,V),g&&d&&d.length===1){let{dataUrl:P,width:B,height:D}=await fa(d,m,b,y,x),q=document.createElement("img");q.src=P,q.style=`height:${y}px;width:${B/D*y}px;object-fit:contain;`,N.appendChild(q),t.dataset.snapdomHasIcon="true"}else if(d&&F){let P=cn(d,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??nr(d);if(P?.trim())try{let B=await se(xt(P),{as:"dataURL",useProxy:n.useProxy});if(B?.ok&&typeof B.data=="string"){let D=document.createElement("img");D.src=B.data,D.style=`width:${y}px;height:auto;object-fit:contain;`,N.appendChild(D)}}catch(B){console.error(`[snapdom] Error in pseudo ${l} for`,e,B)}}else!g&&w&&(N.textContent=d);N.style.backgroundImage="none","maskImage"in N.style&&(N.style.maskImage="none"),"webkitMaskImage"in N.style&&(N.style.webkitMaskImage="none");try{N.style.backgroundRepeat=s.backgroundRepeat,N.style.backgroundSize=s.backgroundSize,s.backgroundPositionX&&s.backgroundPositionY?(N.style.backgroundPositionX=s.backgroundPositionX,N.style.backgroundPositionY=s.backgroundPositionY):N.style.backgroundPosition=s.backgroundPosition,N.style.backgroundOrigin=s.backgroundOrigin,N.style.backgroundClip=s.backgroundClip,N.style.backgroundAttachment=s.backgroundAttachment,N.style.backgroundBlendMode=s.backgroundBlendMode}catch{}if(C)try{let P=Bt(f),B=await Promise.all(P.map(dn));N.style.backgroundImage=B.join(", ")}catch(P){console.warn(`[snapdom] Failed to inline background-image for ${l}`,P)}k&&(N.style.backgroundColor=p);let K=N.childNodes.length>0||N.textContent?.trim()!==""||C||k||S||E||R||T||W;if(h&&h.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map,B=Gt(e,i,r.__siblingCounters),D=Qt(e,_(e,l),B);for(let{name:q}of h){if(!q)continue;let ce=D.get(e,q);P.set(q,ce)}r.__siblingCounters.set(e.parentElement,P)}if(!K)continue;l==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(N,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(N))}catch(s){console.warn(`[snapdom] Failed to capture ${l} for`,e,s)}let a=Array.from(t.children).filter(l=>!l.dataset.snapdomPseudo);if(r.nodeMap)for(let l of a){let s=r.nodeMap.get(l);s?.nodeType===1&&await Kt(s,l,r,n)}else{let l=Array.from(e.children);for(let s=0;s<Math.min(l.length,a.length);s++)await Kt(l[s],a[s],r,n)}}function Ba(e,t){if(!e||e?.nodeType!==1)return;let r=e.ownerDocument||document,n=t||r,o=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(o.length===0)return;let i=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],l=g=>window.CSS&&CSS.escape?CSS.escape(g):g.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),s="http://www.w3.org/1999/xlink",c=g=>{if(!g||!g.getAttribute)return null;let w=g.getAttribute("href")||g.getAttribute("xlink:href")||(typeof g.getAttributeNS=="function"?g.getAttributeNS(s,"href"):null);if(w)return w;let C=g.attributes;if(!C)return null;for(let k=0;k<C.length;k++){let S=C[k];if(!S||!S.name)continue;if(S.name==="href")return S.value;let E=S.name.indexOf(":");if(E!==-1&&S.name.slice(E+1)==="href")return S.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(g=>g.id)),d=new Set,h=!1,f=(g,w=null)=>{if(!g)return;i.lastIndex=0;let C;for(;C=i.exec(g);){h=!0;let k=(C[1]||"").trim();k&&(u.has(k)||(d.add(k),w&&!w.has(k)&&w.add(k)))}},p=g=>{let w=g.querySelectorAll("use");for(let S of w){let E=c(S);if(!E||!E.startsWith("#"))continue;h=!0;let $=E.slice(1).trim();$&&!u.has($)&&d.add($)}let C='*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]';f(g.getAttribute("style")||"");for(let S of a)f(g.getAttribute(S));let k=g.querySelectorAll(C);for(let S of k){f(S.getAttribute("style")||"");for(let E of a)f(S.getAttribute(E))}};for(let g of o)p(g);if(!h)return;let m=e.querySelector("svg.inline-defs-container");m||(m=r.createElementNS("http://www.w3.org/2000/svg","svg"),m.classList.add("inline-defs-container"),m.setAttribute("aria-hidden","true"),m.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(m,e.firstChild||null));let y=m.querySelector("defs")||null,b=g=>{if(!g||u.has(g))return null;let w=l(g),C=k=>{let S=n.querySelector(k);return S&&!e.contains(S)?S:null};return C(`svg defs > *#${w}`)||C(`svg > symbol#${w}`)||C(`*#${w}`)};if(!d.size)return;let x=new Set(d),v=new Set;for(;x.size;){let g=x.values().next().value;if(x.delete(g),!g||u.has(g)||v.has(g))continue;let w=b(g);if(!w){v.add(g);continue}y||(y=r.createElementNS("http://www.w3.org/2000/svg","defs"),m.appendChild(y));let C=w.cloneNode(!0);C.id||C.setAttribute("id",g),y.appendChild(C),v.add(g),u.add(g);let k=[C,...C.querySelectorAll("*")];for(let S of k){let E=c(S);if(E&&E.startsWith("#")){let R=E.slice(1).trim();R&&!u.has(R)&&!v.has(R)&&x.add(R)}let $=S.getAttribute?.("style")||"";$&&f($,x);for(let R of a){let T=S.getAttribute?.(R);T&&f(T,x)}}}}ne();function _a(e){let t=getComputedStyle(e),r=t.outlineStyle,n=t.outlineWidth,o=t.borderStyle,i=t.borderWidth,a=r!=="none"&&parseFloat(n)>0,l=o==="none"||parseFloat(i)===0;if(a&&l){let s=e.style.border;return e.style.border=`${n} solid transparent`,()=>{e.style.border=s}}return()=>{}}function ja(e){let t=[];try{let r=e.querySelectorAll("*");for(let n of r){if(!(n instanceof HTMLElement))continue;let o=n.style.contentVisibility||"",i=getComputedStyle(n);(i.contentVisibility||i.getPropertyValue("content-visibility")||"")==="auto"&&(t.push({el:n,original:o}),n.style.contentVisibility="visible")}if(e instanceof HTMLElement){let n=getComputedStyle(e);(n.contentVisibility||n.getPropertyValue("content-visibility")||"")==="auto"&&(t.push({el:e,original:e.style.contentVisibility||""}),e.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:r,original:n}of t)try{r.style.contentVisibility=n}catch{}}}ue();$t();function Ua(e){return Xn(e.boxShadow)}function qa(e){return Xn(e.textShadow)}function Xn(e){if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let t=[],r="",n=0;for(let s=0;s<e.length;s++){let c=e[s];c==="("?n++:c===")"&&(n=Math.max(0,n-1)),c===","&&n===0?(t.push(r),r=""):r+=c}r.trim()&&t.push(r);let o=0,i=0,a=0,l=0;for(let s of t){if(/\binset\b/i.test(s))continue;let c=s.match(/-?\d+(\.\d+)?px/g)?.map(y=>parseFloat(y))||[];if(c.length<2)continue;let[u,d,h=0,f=0]=c,p=Math.abs(u)+h+f,m=Math.abs(d)+h+f;i=Math.max(i,p+Math.max(u,0)),l=Math.max(l,p+Math.max(-u,0)),a=Math.max(a,m+Math.max(d,0)),o=Math.max(o,m+Math.max(-d,0))}return{top:Math.ceil(o),right:Math.ceil(i),bottom:Math.ceil(a),left:Math.ceil(l)}}function za(e){let t=e.filter&&e.filter!=="none"?e.filter:e.webkitFilter||"",r=/blur\(\s*([0-9.]+)px\s*\)/gi,n=0,o;for(;o=r.exec(t);)n+=parseFloat(o[1])||0;let i=Math.ceil(n);return{top:i,right:i,bottom:i,left:i}}function Va(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0),r=parseFloat(e.outlineOffset||"0")||0,n=t+Math.max(0,Math.ceil(r));return{top:n,right:n,bottom:n,left:n}}function Xa(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 r=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],n=0,o=0,i=0,a=0,l=!1;for(let s of r){l=!0;let c=s.match(/-?\d+(?:\.\d+)?px/gi)?.map(m=>parseFloat(m))||[],[u=0,d=0,h=0]=c,f=Math.abs(u)+h,p=Math.abs(d)+h;o=Math.max(o,f+Math.max(u,0)),a=Math.max(a,f+Math.max(-u,0)),i=Math.max(i,p+Math.max(d,0)),n=Math.max(n,p+Math.max(-d,0))}return{bleed:{top:A(n),right:A(o),bottom:A(i),left:A(a)},has:l}}function Ya(e,t){if(!e||!t||!t.style)return null;let r=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 n=r.transform||"none";if(!n||n==="none"){let l=null;try{l=kt(e).scale}catch{}try{t.style.transform="none"}catch{}if(!l)return{a:1,b:0,c:0,d:1};let s=l.trim().split(/\s+/).map(parseFloat),c=Number.isFinite(s[0])?s[0]:1,u=Number.isFinite(s[1])?s[1]:c;return{a:c,b:0,c:0,d:u}}function o(l,s,c,u){let d=Math.sqrt(l*l+s*s)||0,h=0,f=0;if(d>0){let p=l/d,m=s/d;h=p*c+m*u;let y=c-p*h,b=u-m*h;f=Math.sqrt(y*y+b*b)||0,f>0?h=h/f:h=0}return{a:d,b:0,c:h*f,d:f}}let i=n.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let l=i[1].split(",").map(s=>parseFloat(s.trim()));if(l.length===6&&l.every(Number.isFinite)){let[s,c,u,d]=l,h=o(s,c,u,d);try{t.style.transform=`matrix(${h.a}, ${h.b}, ${h.c}, ${h.d}, 0, 0)`}catch{}return h}}let a=n.match(/^matrix3d\(\s*([^)]+)\)$/i);if(a){let l=a[1].split(",").map(s=>parseFloat(s.trim()));if(l.length===16&&l.every(Number.isFinite)){let s=l[0],c=l[1],u=l[4],d=l[5],h=o(s,c,u,d);try{t.style.transform=`matrix(${h.a}, ${h.b}, ${h.c}, ${h.d}, 0, 0)`}catch{}return h}}try{let l=new DOMMatrix(n),s=o(l.a,l.b,l.c,l.d);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}catch{return null}}function wt(e,t,r,n,o){let i=r.a,a=r.b,l=r.c,s=r.d,c=r.e||0,u=r.f||0;function d(b,x){let v=b-n,g=x-o,w=i*v+l*g,C=a*v+s*g;return w+=n+c,C+=o+u,[w,C]}let h=[d(0,0),d(e,0),d(0,t),d(e,t)],f=1/0,p=1/0,m=-1/0,y=-1/0;for(let[b,x]of h)b<f&&(f=b),x<p&&(p=x),b>m&&(m=b),x>y&&(y=x);return{minX:f,minY:p,maxX:m,maxY:y,width:m-f,height:y-p}}function Jt(e,t,r){let n=(e.transformOrigin||"0 0").trim().split(/\s+/),[o,i]=[n[0]||"0",n[1]||"0"],a=(l,s)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?s/2:c==="right"||c==="bottom"?s:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*s/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:a(o,t),oy:a(i,r)}}function kt(e){let t={rotate:"0deg",scale:null,translate:null},r=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(r){let o=s=>{try{return typeof r.has=="function"&&!r.has(s)||typeof r.get!="function"?null:r.get(s)}catch{return null}},i=o("rotate");if(i)if(i.angle){let s=i.angle;t.rotate=s.unit==="rad"?s.value*180/Math.PI+"deg":s.value+s.unit}else i.unit?t.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit:t.rotate=String(i);else{let s=getComputedStyle(e);t.rotate=s.rotate&&s.rotate!=="none"?s.rotate:"0deg"}let a=o("scale");if(a){let s="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,c="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:s;t.scale=`${s} ${c}`}else{let s=getComputedStyle(e);t.scale=s.scale&&s.scale!=="none"?s.scale:null}let l=o("translate");if(l){let s="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",d="y"in l&&l.y?.unit?l.y.unit:"px";t.translate=`${s}${u} ${c}${d}`}else{let s=getComputedStyle(e);t.translate=s.translate&&s.translate!=="none"?s.translate:null}return t}let n=getComputedStyle(e);return t.rotate=n.rotate&&n.rotate!=="none"?n.rotate:"0deg",t.scale=n.scale&&n.scale!=="none"?n.scale:null,t.translate=n.translate&&n.translate!=="none"?n.translate:null,t}var Ot=null;function Ga(){if(Ot)return Ot;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),Ot=e,e}function Qa(e){let t=Ga(),r=document.createElement("div");r.style.transformOrigin="0 0",e.baseTransform&&(r.style.transform=e.baseTransform),e.rotate&&(r.style.rotate=e.rotate),e.scale&&(r.style.scale=e.scale),e.translate&&(r.style.translate=e.translate),t.appendChild(r);let n=Ja(r);return t.removeChild(r),n}function Ka(e){let t=_(e),r=t.transform||"none";if(r!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(r))return!0;let n=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",o=t.scale&&t.scale!=="none"&&t.scale!=="1",i=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(n||o||i)}function Ja(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}var Zt="http://www.w3.org/1999/xhtml",Yn=new WeakSet;function Gn(e,t){if(!t)return null;let r=e.ownerDocument||document,n=r.defaultView||window,o,i,a,l;if(t==="viewport")o=0,i=0,a=r.documentElement?.clientWidth||n.innerWidth,l=r.documentElement?.clientHeight||n.innerHeight;else if(typeof t=="object")o=(Number(t.x)||0)-(n.scrollX||0),i=(Number(t.y)||0)-(n.scrollY||0),a=Number(t.width),l=Number(t.height);else return null;return a>0&&l>0?{left:o,top:i,width:a,height:l,right:o+a,bottom:i+l}:null}function er(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode&&e.getRootNode();return t instanceof ShadowRoot?t.host:null}function Za(e,t){for(let r=t;r;r=er(r))if(r===e)return!0;return!1}function el(e,t){for(let r=er(e);r&&r!==t&&r?.nodeType===1;r=er(r)){let n=_(r);if(n.position!=="static"||n.transform&&n.transform!=="none"||n.filter&&n.filter!=="none"||n.backdropFilter&&n.backdropFilter!=="none"||n.perspective&&n.perspective!=="none"||/transform|perspective|filter/.test(n.willChange||"")||/layout|paint|strict|content/.test(n.contain||""))return r}return null}function Qn(e,t){try{let r=new DOMMatrix;if(t&&t.rotate&&t.rotate!=="0deg"&&(r=r.multiply(new DOMMatrix(`rotate(${t.rotate})`))),t&&t.scale){let n=String(t.scale).trim().split(/\s+/).filter(Boolean);n.length&&n.every(o=>Number.isFinite(Number(o)))&&(r=r.multiply(new DOMMatrix(`scale(${n.join(",")})`)))}return e&&(r=r.multiply(new DOMMatrix(e))),r}catch{return null}}function tl(e,t,r,n,o){let i=e.getBoundingClientRect();t?.nodeType===1&&t.namespaceURI===Zt&&_(e).position==="static"&&(t.style.position="relative");let a=[];for(let[l,s]of r){if(l?.nodeType!==1||l.namespaceURI!==Zt||s?.nodeType!==1||s===e||!Za(e,s))continue;let c=n.get(s)||_(s),u=c.position;if(u!=="fixed"&&u!=="sticky"&&u!=="-webkit-sticky"||l.style.position==="absolute")continue;let d=s.getBoundingClientRect();if(!(d.width>0&&d.height>0))continue;Yn.add(l);let h=c.transform&&c.transform!=="none"?c.transform:"",f=kt(s),p=!!(h||f.rotate!=="0deg"||f.scale||f.translate),m=p?Qn(h,f):null,y=!m||!m.is2D||m.a===1&&m.b===0&&m.c===0&&m.d===1,b=d.width,x=d.height;y||(b=s.offsetWidth||d.width,x=s.offsetHeight||d.height);let v=s.getRootNode&&s.getRootNode()instanceof ShadowRoot,g=i,w=e.clientLeft||0,C=e.clientTop||0;if(v){let R=el(s,e);R&&(g=R.getBoundingClientRect(),w=R.clientLeft||0,C=R.clientTop||0)}let k=d.left-g.left-w,S=d.top-g.top-C;if(p)if(l.style.translate="none",l.style.rotate="none",l.style.scale="none",y)l.style.transform="none";else{l.style.transform=`matrix(${m.a},${m.b},${m.c},${m.d},0,0)`;let{ox:R,oy:T}=Jt(c,b,x),W=wt(b,x,{a:m.a,b:m.b,c:m.c,d:m.d,e:0,f:0},R,T);k-=W.minX,S-=W.minY}if(u!=="fixed"){let R=l.cloneNode(!1);R.setAttribute("data-snap-ph","1"),R.style.position="static",R.style.visibility="hidden",R.style.width=`${b}px`,R.style.height=`${x}px`,R.style.boxSizing="border-box",l.parentElement?.insertBefore(R,l)}let E=b+2,$=x;o&&(Math.abs(S-o.y)<.5&&(S-=1,$+=1),Math.abs(k-o.x)<.5&&(k-=1,E+=1)),l.style.position="absolute",l.style.left=`${k}px`,l.style.top=`${S}px`,l.style.right="auto",l.style.bottom="auto",l.style.margin="0",l.style.width=`${E}px`,l.style.height=`${$}px`,l.style.boxSizing="border-box",v||a.push(l)}for(let l of a)t.appendChild(l)}function rl(e,t,r={}){if(!e||!t||!t.style)return;let n=getComputedStyle(e);try{t.style.boxShadow="none"}catch(i){j(r,"stripRootShadows boxShadow",i)}try{t.style.textShadow="none"}catch(i){j(r,"stripRootShadows textShadow",i)}try{t.style.outline="none"}catch(i){j(r,"stripRootShadows outline",i)}let o=(n.filter||"").replace(/\bdrop-shadow\((?:[^()]|\([^()]*\))*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=o.length?o:"none"}catch(i){j(r,"stripRootShadows filter",i)}}function nl(e,t){if(!e||!t||!t.style)return;let r=1;try{r=parseFloat(getComputedStyle(e).zoom)}catch{return}if(!(!t.style.getPropertyValue("zoom")&&(!Number.isFinite(r)||r===1)))try{t.style.setProperty("zoom","1","important")}catch{}}function rn(e){let t=e.display||"";if(t.includes("flex")||t.includes("grid")||t.startsWith("table")||t==="inline-block"||t==="flow-root"||e.position==="absolute"||e.position==="fixed"||e.float&&e.float!=="none")return!0;let r=e.overflowX||e.overflow||"visible",n=e.overflowY||e.overflow||"visible";return!!(r!=="visible"||n!=="visible"||e.contain&&/\b(layout|content|paint|strict)\b/.test(e.contain))}function ol(e,t){let r=Array.from(e.childNodes),n=t==="top"?r:r.reverse();for(let o of n){if(o.nodeType===Node.TEXT_NODE){if(/\S/.test(o.textContent||""))return null;continue}if(o.nodeType!==Node.ELEMENT_NODE)continue;let i=getComputedStyle(o),a=String(i.display||"");if(!(a==="none"||a==="contents")&&!(i.position==="absolute"||i.position==="fixed"))return i.float&&i.float!=="none"||a.startsWith("inline")?null:o}return null}function il(e,t,r){if(!e||!t||!t.style)return;let n=getComputedStyle(e);if(!rn(n))for(let o of["top","bottom"]){let i=o==="top"?"Top":"Bottom";if((parseFloat(n[`border${i}Width`])||0)>0||(parseFloat(n[`padding${i}`])||0)>0)continue;let a=e,l=t;for(;a&&l;){let s=ol(a,o);if(!s)break;let c=r?Array.from(l.children).find(h=>r.get(h)===s)||null:l.children[Array.from(a.children).indexOf(s)]||null,u=getComputedStyle(s),d=parseFloat(u[`margin${i}`])||0;if(c&&c.style&&d>0&&(c.style[`margin${i}`]="0px"),rn(u)||(parseFloat(u[`border${i}Width`])||0)>0||(parseFloat(u[`padding${i}`])||0)>0)break;a=s,l=c}}}function al(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),r=[];for(;t.nextNode();)r.push(t.currentNode);for(let n of r)n.remove()}function ll(e,t={}){let{stripFrameworkDirectives:r=!0}=t,n=new Set(["xml","xlink"]),o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();){let i=o.currentNode;for(let a of Array.from(i.attributes)){let l=a.name;if(l.startsWith("*")){i.removeAttribute(l);continue}if(l.includes("@")){i.removeAttribute(l);continue}if(l.includes(":")){let s=l.split(":",1)[0];if(!n.has(s)){i.removeAttribute(l);continue}}if(r&&(l.startsWith("x-")||l.startsWith("v-")||l.startsWith(":")||l.startsWith("on:")||l.startsWith("bind:")||l.startsWith("let:")||l.startsWith("class:"))){i.removeAttribute(l);continue}}}}var nn=/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;function sl(e){if(!e)return;let t=o=>{if(o.nodeType===Node.ELEMENT_NODE){if(o.attributes)for(let i of Array.from(o.attributes)){let a=i.value.replace(nn,"");if(a!==i.value)try{o.setAttribute(i.name,a)}catch{}}}else if(o.nodeType===Node.TEXT_NODE||o.nodeType===Node.CDATA_SECTION_NODE){let i=o.data.replace(nn,"");i!==o.data&&(o.data=i)}};t(e);let r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),n;for(;n=r.nextNode();)t(n)}function cl(e,t={}){e&&(ll(e,t),al(e),sl(e))}function ul(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function dl(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?.nodeType!==1||ul(e)||dl(e))return!1;let r=t.position;if(r==="absolute"||r==="fixed"||r==="sticky")return!1;let n=t.display||"";return!(n.includes("flex")||n.includes("grid")||n.startsWith("table")||t.transform&&t.transform!=="none")}function fl(e,t,r=new Map){function n(o,i){if(o?.nodeType!==1||i?.nodeType!==1)return;let a=o.childElementCount>i.childElementCount,l=r.get(o)||getComputedStyle(o);if(r.has(o)||r.set(o,l),a&&hl(o,l)){i.style.height||(i.style.height="auto"),i.style.width||(i.style.width="auto"),i.style.removeProperty("block-size"),i.style.removeProperty("inline-size"),i.style.minHeight||(i.style.minHeight="0"),i.style.minWidth||(i.style.minWidth="0"),i.style.maxHeight||(i.style.maxHeight="none"),i.style.maxWidth||(i.style.maxWidth="none");let u=l.overflowY||l.overflowBlock||"visible",d=l.overflowX||l.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(i.style.overflow="visible")}let s=Array.from(o.children),c=Array.from(i.children);for(let u=0;u<Math.min(s.length,c.length);u++)n(s[u],c[u])}n(e,t)}function pl(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function ml(e,t){if(e?.nodeType!==1)return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let r of t.exclude)try{if(e.matches(r))return t.excludeMode==="remove"}catch(n){j(t,"exclude selector match failed",n)}if(typeof t?.filter=="function"&&t.filterMode==="remove")try{if(!t.filter(e))return!0}catch(r){j(t,"filter function failed",r)}return!1}function gl(e,t){let r=getComputedStyle(e),n=e.getBoundingClientRect(),o=1/0,i=-1/0,a=!1,l=Array.from(e.children);for(let f of l){if(ml(f,t)||!pl(f))continue;let p=f.getBoundingClientRect(),m=p.top-n.top,y=p.bottom-n.top;y<=m||(m<o&&(o=m),y>i&&(i=y),a=!0)}let s=a?Math.max(0,i-o):0,c=parseFloat(r.borderTopWidth)||0,u=parseFloat(r.borderBottomWidth)||0,d=parseFloat(r.paddingTop)||0,h=parseFloat(r.paddingBottom)||0;return c+u+d+h+s}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,Te=.75;function yl(e,t,r,n,o,i){let a=e.ownerDocument||document,l=e.getBoundingClientRect(),s=o>0&&l.width>0?l.width/o:1,c=i>0&&l.height>0?l.height/i:1;if(Math.abs(s-c)>.02)return 0;let u=a.createElement("div");u.setAttribute("data-snapdom-internal",""),u.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+o+"px!important;overflow:visible!important;visibility:hidden!important;";let d=u.attachShadow({mode:"open"}),h=a.createElement("style");h.textContent=r,d.appendChild(h);let f=t.cloneNode(!0);d.appendChild(f),a.body.appendChild(u);let p=0,m=(y,b,x)=>{let v=_(y),g=v.boxSizing==="border-box",w=(C,k,...S)=>{let E=parseFloat(C);if(!Number.isFinite(E))return k;let $=E+(g?0:S.reduce((R,T)=>R+(parseFloat(T)||0),0));return Math.abs($-k)<=.51?$:k};return{width:w(v.width,b,v.paddingLeft,v.paddingRight,v.borderLeftWidth,v.borderRightWidth),height:w(v.height,x,v.paddingTop,v.paddingBottom,v.borderTopWidth,v.borderBottomWidth)}};try{let y=f.getBoundingClientRect(),b=f.offsetWidth||o,x=f.offsetHeight||i,v=b>0&&y.width>0?y.width/b:1,g=x>0&&y.height>0?y.height/x:1,w=(C,k,S=!1)=>{let E=C.children,$=k.children,R=Math.min(E.length,$.length);for(let T=0;T<R;T++){let W=E[T],F=$[T],I=n.get(W),N=S||Yn.has(W);if(I?.nodeType===1&&W?.namespaceURI===Zt&&W.style&&I.isConnected){let O=I.getBoundingClientRect();if(O.width>0&&O.height>0){let X=F.getBoundingClientRect(),U=O.width/s,V=O.height/c,K=X.width,P=X.height,B=I.offsetWidth||U,D=I.offsetHeight||V,q=F.offsetWidth||K,ce=F.offsetHeight||P,Q=Math.abs(U-B)>Te||Math.abs(V-D)>Te||Math.abs(K-q)>Te||Math.abs(P-ce)>Te;if(N){let J=m(F,q,ce);U=K>0?U*v*J.width/K:U,V=P>0?V*g*J.height/P:V,K=J.width,P=J.height}else if(Q){let J=m(I,B,D),pe=m(F,q,ce);U=J.width,V=J.height,K=pe.width,P=pe.height}let te=K-U,oe=P-V;(Math.abs(te)>Te||Math.abs(oe)>Te)&&(W.style.boxSizing="border-box",W.style.width=`${A(U)}px`,W.style.height=`${A(V)}px`,p++)}}w(W,F,N)}};w(t,f)}finally{u.remove()}return p}var bl=/::-webkit-scrollbar(-[a-z]+)?\b/i;function tr(e,t=new Set){let r="";if(!e)return r;for(let n=0;n<e.length;n++){let o=e[n];try{if(o.type===CSSRule.IMPORT_RULE&&o.styleSheet){r+=tr(o.styleSheet.cssRules,t);continue}if(o.type===CSSRule.MEDIA_RULE&&o.cssRules){let i=tr(o.cssRules,t);i&&(r+=`@media ${o.conditionText}{${i}}`);continue}if(o.type===CSSRule.STYLE_RULE){let i=o.selectorText||"";if(bl.test(i)){let a=o.cssText;a&&!t.has(a)&&(t.add(a),r+=a)}}}catch{}}return r}var on=new WeakMap;function wl(e){let t="";for(let r of e.styleSheets){let n=-1;try{n=r.cssRules?r.cssRules.length:-1}catch{}t+=(r.href||"inline")+":"+n+"|"}return t}function xl(e){if(!e||!e.styleSheets)return"";let t=wl(e),r=on.get(e);if(r&&r.fp===t)return r.css;let n=new Set,o="";for(let i of Array.from(e.styleSheets))try{let a=i.cssRules;a&&(o+=tr(a,n))}catch{}return on.set(e,{fp:t,css:o}),o}Ae();var st=new Set;async function vl(e,t={}){let r=t.__session||M.session,n={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:t},o=null;if(t.clip){let d=Gn(e,t.clip);if(d){n.clip={rect:d,root:e};let h=e.getBoundingClientRect();o={x:d.left-h.left,y:d.top-h.top,width:d.width,height:d.height}}}let i,a="",l="";if(st.size){let d=(h,f)=>{for(let p=f;p;p=p.assignedSlot||p.parentElement||p.getRootNode()?.host)if(p===h)return!0;return!1};for(;;){let h=[...st].filter(({root:f})=>d(f,e)||d(e,f)).map(({promise:f})=>f.catch(()=>{}));if(!h.length)break;await Promise.all(h)}}if(!n.clip&&e.isConnected&&e.ownerDocument?.visibilityState!=="hidden")try{let d=e.getBoundingClientRect(),h=e.ownerDocument?.defaultView||window,f=d.right<=0||d.bottom<=0||d.left>=h.innerWidth||d.top>=h.innerHeight,p=[];if(f&&(()=>{let m=[];e.shadowRoot&&m.push(e.shadowRoot);for(let y of e.querySelectorAll("*"))y.shadowRoot&&m.push(y.shadowRoot);for(;m.length;){let y=m.pop(),b=y.host?.localName==="calcite-icon";for(let x of y.querySelectorAll("*")){if(x.shadowRoot&&m.push(x.shadowRoot),!b||x.localName!=="svg")continue;let v=x.querySelectorAll("path");if(!v.length||[...v].some(w=>w.getAttribute("d")?.trim()))continue;let g=x.getBoundingClientRect();g.width&&g.height&&p.push(x)}}})(),p.length){let m=(async()=>{let b=e.style,x=e.hasAttribute("style"),v=new Map,g=(w,C)=>{v.has(w)||v.set(w,{value:b.getPropertyValue(w),priority:b.getPropertyPriority(w)}),b.setProperty(w,C,"important");let k=v.get(w);k.forcedValue=b.getPropertyValue(w),k.forcedPriority=b.getPropertyPriority(w)};try{g("left","0"),g("top","0"),g("right","auto"),g("bottom","auto"),g("margin-top","0"),g("margin-right","0"),g("margin-bottom","0"),g("margin-left","0"),g("transform","none"),g("translate","none"),g("opacity","0"),g("pointer-events","none");let w=e.getBoundingClientRect();if(w.right<=0||w.bottom<=0||w.left>=h.innerWidth||w.top>=h.innerHeight){let S=e.parentElement?.getBoundingClientRect(),E=S&&S.right>0&&S.left<h.innerWidth?Math.max(0,S.left):0,$=S&&S.bottom>0&&S.top<h.innerHeight?Math.max(0,S.top):0;g("position","fixed"),g("left",`${E}px`),g("top",`${$}px`)}await ke(100);let C=Date.now()+1500,k=()=>p.some(S=>{if([...S.querySelectorAll("path")].some($=>$.getAttribute("d")?.trim()))return!1;let E=S.getBoundingClientRect();return E.width&&E.height&&E.right>0&&E.bottom>0&&E.left<h.innerWidth&&E.top<h.innerHeight});for(;Date.now()<C&&k();)await new Promise(S=>setTimeout(S,25));await ke(100)}finally{for(let[w,C]of v)b.getPropertyValue(w)!==C.forcedValue||b.getPropertyPriority(w)!==C.forcedPriority||(C.value?b.setProperty(w,C.value,C.priority):b.removeProperty(w));!x&&!b.length&&e.removeAttribute("style"),await ke(100)}})(),y={root:e,promise:m};st.add(y);try{await m}finally{st.delete(y)}}}catch{}let s=_a(e),c=n.clip?()=>{}:ja(e);try{i=await gt(e,n,t)}catch(d){throw console.warn("deepClone failed:",d),d}finally{c(),s()}try{Ba(i)}catch(d){console.warn("inlineExternal defs or symbol failed:",d)}try{await Kt(e,i,n,t)}catch(d){console.warn("inlinePseudoElements failed:",d)}await Yi(i,n);try{let d=i.querySelectorAll("style[data-sd]");for(let h of d)l+=h.textContent||"",h.remove()}catch(d){j(n,"Failed to extract shadow CSS from style[data-sd]",d)}let u=Bo(n.styleMap);a=Array.from(u.entries()).map(([d,h])=>`.${h}{${d}}`).join(""),a=l+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+a;for(let[d,h]of n.styleMap.entries()){if(d.tagName==="STYLE")continue;if(d.getRootNode&&d.getRootNode()instanceof ShadowRoot){d.setAttribute("style",h.replace(/;/g,"; "));continue}let f=u.get(h);f&&d.classList.add(f);let p=d.style?.backgroundImage,m=d.dataset?.snapdomHasIcon;p&&p!=="none"&&(d.style.backgroundImage=p),m&&(d.style.verticalAlign="middle",d.style.display="inline")}if((n.clip||e.scrollTop||e.scrollLeft)&&i?.nodeType===1)try{let d=n.clip&&o?{x:o.x,y:o.y}:{x:0,y:0};tl(e,i,n.nodeMap,n.styleCache,d)}catch(d){j(n,"freezeViewportPositioned failed",d)}for(let[d,h]of n.nodeMap.entries()){if(n.clip&&h===e)continue;let f=h.scrollLeft,p=h.scrollTop;if((f||p)&&d?.nodeType===1&&d.namespaceURI==="http://www.w3.org/1999/xhtml"){d.style.overflow="hidden",d.style.scrollbarWidth="none",d.style.msOverflowStyle="none";try{let y=d.querySelectorAll("*");for(let b of y){if(b.nodeType!==1||b.namespaceURI!=="http://www.w3.org/1999/xhtml")continue;let x=b.style.position;if(x==="fixed"||x==="absolute"){let v=parseFloat(b.style.top)||0,g=parseFloat(b.style.left)||0;b.style.top=`${v+p}px`,b.style.left=`${g+f}px`,x==="fixed"&&(b.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.all="unset",m.style.transform=`translate(${-f}px, ${-p}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";d.firstChild;)m.appendChild(d.firstChild);d.appendChild(m)}}if(e===n.nodeMap.get(i)){let d=n.styleCache.get(e)||_(e);n.styleCache.set(e,d);let h=Ao(d.transform);i.style.margin="0",i.style.top="auto",i.style.left="auto",i.style.right="auto",i.style.bottom="auto",i.style.animation="none",i.style.transition="none",i.style.willChange="auto",i.style.float="none",i.style.clear="none",i.style.transform=h||""}for(let[d,h]of n.nodeMap.entries())h.tagName==="PRE"&&(d.style.marginTop="0",d.style.marginBlockStart="0");return{clone:i,classCSS:a,styleCache:n.styleCache,nodeMap:n.nodeMap,reconcileRisk:n.reconcileRisk||0,clipWindow:o}}$e();ne();var Kn="http://www.w3.org/1999/xlink";function Sl(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Kn,"href"):null)}function Cl(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,r=parseInt(e.dataset?.snapdomHeight||"",10)||0,n=parseInt(e.getAttribute("width")||"",10)||0,o=parseInt(e.getAttribute("height")||"",10)||0,i=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,l=t||i||n||e.width||e.naturalWidth||100,s=r||a||o||e.height||e.naturalHeight||100;return{width:l,height:s}}async function Ml(e,t={}){let r=Array.from(e.querySelectorAll("img"));e.tagName==="IMG"&&r.unshift(e);let n=async l=>{if(!l.getAttribute("src")){let p=l.currentSrc||l.src||Ct(l.getAttribute("srcset"),l)||"";p&&l.setAttribute("src",p)}l.removeAttribute("srcset"),l.removeAttribute("sizes");let s=l.src||"";if(!s)return;let c=M.image?.get(s);if(c){l.src=c,l.width||(l.width=l.naturalWidth||100),l.height||(l.height=l.naturalHeight||100);return}let u=await se(s,{as:"dataURL",useProxy:t.useProxy});if(u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")){M.image?.set(s,u.data),l.src=u.data,l.width||(l.width=l.naturalWidth||100),l.height||(l.height=l.naturalHeight||100);return}let{width:d,height:h}=Cl(l),{fallbackURL:f}=t||{};if(f)try{let p=typeof f=="function"?await f({width:d,height:h,src:s,element:l}):f;if(p){let m=await se(p,{as:"dataURL",useProxy:t.useProxy});if(m?.ok&&typeof m.data=="string"){l.src=m.data,l.width||(l.width=d),l.height||(l.height=h);return}}}catch{}if(t.placeholders!==!1){let p=document.createElement("div");p.style.cssText=[`width:${d}px`,`height:${h}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${h}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),p.textContent="img",l.replaceWith(p)}else{let p=document.createElement("div");p.style.cssText=`display:inline-block;width:${d}px;height:${h}px;visibility:hidden;`,l.replaceWith(p)}},o=6;for(let l=0;l<r.length;l+=o){let s=r.slice(l,l+o).map(n);await Promise.allSettled(s)}let i=Array.from(e.querySelectorAll("image"));e.localName==="image"&&i.unshift(e);let a=async l=>{let s=Sl(l);if(!s||s.startsWith("data:")||s.startsWith("blob:"))return;let c=await se(s,{as:"dataURL",useProxy:t.useProxy});c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")&&(l.setAttribute("href",c.data),l.removeAttribute("xlink:href"),typeof l.removeAttributeNS=="function"&&l.removeAttributeNS(Kn,"href"))};for(let l=0;l<i.length;l+=o){let s=i.slice(l,l+o).map(a);await Promise.allSettled(s)}}ue();ne();var kl=["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"],El=["mask-position","mask-size","mask-repeat","mask-mode","mask-composite","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","-webkit-mask-composite","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],$l=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],Al=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];async function Rl(e,t,r,n){let o=r.get(e)||_(e);r.has(e)||r.set(e,o);let i=o.getPropertyValue("border-image"),a=o.getPropertyValue("border-image-source"),l=i&&i!=="none"||a&&a!=="none",s=o.getPropertyValue("background-image"),c=o.getPropertyValue("background-color");if(s&&s!=="none"||c&&c!=="rgba(0, 0, 0, 0)"&&c!=="transparent"||/url\s*\(|gradient\s*\(/i.test(o.getPropertyValue("background")||""))for(let u of $l){let d=o.getPropertyValue(u);d&&t.style.setProperty(u,d)}for(let u of kl){let d=o.getPropertyValue(u);if(u==="background-image"&&(!d||d==="none")){let p=o.getPropertyValue("background");p&&/url\s*\(/.test(p)&&(d=Bt(p).filter(m=>/url\s*\(/.test(m)).join(", ")||d)}if(!d||d==="none")continue;let h=Bt(d),f=await Promise.all(h.map(p=>dn(p,n)));f.some(p=>p&&p!=="none"&&!/^url\(undefined/.test(p))&&t.style.setProperty(u,f.join(", "))}for(let u of El){let d=o.getPropertyValue(u);!d||d==="initial"||t.style.setProperty(u,d)}if(l)for(let u of Al){let d=o.getPropertyValue(u);!d||d==="initial"||t.style.setProperty(u,d)}}async function Nl(e,t,r,n={},o=M.session.nodeMap){if(!t)return;let i=[];e&&Or(e)&&i.push([e,t]);let a=[t];for(;a.length;){let s=a.pop();if(s.children)for(let c of s.children){if(c.tagName==="STYLE")continue;let u=o.get(c);u&&Or(u)&&i.push([u,c]),a.push(c)}}let l=6;for(let s=0;s<i.length;s+=l)await Promise.allSettled(i.slice(s,s+l).map(([c,u])=>Rl(c,u,r,n)))}ne();ue();function Ll(e,t,r=M.session.nodeMap){let n=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let l=o.currentNode;l;l=o.nextNode()){let s=r.get(l);if(s?.nodeType!==1)continue;let c=_(s),u=c.getPropertyValue("backdrop-filter")||c.getPropertyValue("-webkit-backdrop-filter");u&&u!=="none"&&l!==t&&n.push({cloneEl:l,orig:s,bf:u,path:Pl(t,l)})}if(!n.length)return;let i=e.getBoundingClientRect(),a=n.map((l,s)=>{let c=t.cloneNode(!0);Fl(c,t,l.orig.getBoundingClientRect(),r),Il(an(c,l.path));for(let u=0;u<s;u++){let d=an(c,n[u].path);d&&(d.style.setProperty("backdrop-filter","none","important"),d.style.setProperty("-webkit-backdrop-filter","none","important"))}return{...l,copy:c}});for(let{cloneEl:l,orig:s,bf:c,copy:u}of a)Tl(l,s,c,u,i)}function Tl(e,t,r,n,o){let i=t.getBoundingClientRect();if(!i.width||!i.height)return;let a=_(t),l=t.offsetWidth?i.width/t.offsetWidth:1,s=Math.abs(l-1)>.001?1/l:1;n.style.position="absolute",n.style.left=`${(o.left-i.left)*s}px`,n.style.top=`${(o.top-i.top)*s}px`,n.style.width=`${o.width}px`,n.style.height=`${o.height}px`,n.style.margin="0",n.style.filter=r,s!==1&&(n.style.transform=`scale(${s})`,n.style.transformOrigin="top left");let c=document.createElement("div");c.style.cssText="position:absolute;inset:0;overflow:hidden;border-radius:inherit;z-index:-2",c.appendChild(n);let u=document.createElement("div");u.style.cssText="position:absolute;inset:0;border-radius:inherit;z-index:-1",u.style.backgroundColor=a.backgroundColor,u.style.backgroundImage=e.style.backgroundImage||a.backgroundImage;for(let d of["background-size","background-position","background-repeat","background-origin","background-clip"])u.style.setProperty(d,a.getPropertyValue(d));e.style.setProperty("background-color","transparent","important"),e.style.setProperty("background-image","none","important"),e.style.setProperty("backdrop-filter","none","important"),e.style.setProperty("-webkit-backdrop-filter","none","important"),a.position==="static"&&(e.style.position="relative"),e.style.isolation="isolate",e.prepend(u),e.prepend(c)}var ct=128;function Fl(e,t,r,n){let o=[[e,t]];for(;o.length;){let[i,a]=o.pop(),l=n.get(a);if(l?.nodeType===1){let u=l.getBoundingClientRect();(u.left>r.right+ct||u.right<r.left-ct||u.top>r.bottom+ct||u.bottom<r.top-ct)&&(i.tagName==="IMG"&&i.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="),i.style&&(i.style.backgroundImage="none"))}let s=i.children,c=a.children;for(let u=0;u<s.length;u++)o.push([s[u],c[u]])}}function Pl(e,t){let r=[];for(let n=t;n!==e;n=n.parentElement){if(!n?.parentElement)return null;r.push([...n.parentElement.children].indexOf(n))}return r.reverse()}function an(e,t){if(!t)return null;let r=e;for(let n of t)if(r=r.children[n],!r)return null;return r}function Il(e){if(e)for(let t=e;t&&t.parentNode;){let r=t.parentNode;for(;t.nextSibling;)t.nextSibling.remove();t===e&&t.remove(),t=r}}ue();ne();function Ol(e,t){if(!e)return()=>{};let r=[],n=200;function o(i){if(t){let c=i.getBoundingClientRect();if(c.width>0||c.height>0){let u=Math.max(c.right,c.left+(i.scrollWidth||0)),d=Math.max(c.bottom,c.top+(i.scrollHeight||0));if(u<t.left-n||c.left>t.right+n||d<t.top-n||c.top>t.bottom+n)return}}let a=getComputedStyle(i),l=Wl(i,a);l&&r.push(l);let s=Dl(i,a);s&&r.push(s);for(let c of i.children||[])o(c)}return o(e),()=>r.forEach(i=>i())}function Wl(e,t){if(!e)return()=>{};t=t||getComputedStyle(e);let r=Hl(t);if(r<=0)return()=>{};if(!Zn(e))return()=>{};let n=Jn(e),o=n.text,i=_l(t);n.write("X");let a=e.scrollHeight-i;n.restore();let l=a>0?a:Bl(t),s=Math.round(l*r+i);if(e.scrollHeight<=s+.5)return()=>{};let c=0,u=o.length,d=-1;for(;c<=u;){let h=c+u>>1;n.write(o.slice(0,h)+"\u2026"),e.scrollHeight<=s+.5?(d=h,c=h+1):u=h-1}return n.write((d>=0?o.slice(0,d):"")+"\u2026"),()=>{n.restore()}}function Dl(e,t){if(!e)return()=>{};if(t=t||getComputedStyle(e),t.textOverflow!=="ellipsis")return()=>{};if(t.whiteSpace!=="nowrap"&&t.whiteSpace!=="pre")return()=>{};if(t.overflowX!=="hidden"&&t.overflowX!=="clip")return()=>{};if(!Zn(e))return()=>{};if(e.scrollWidth<=e.clientWidth+.5)return()=>{};let r=Jn(e),n=r.text,o=0,i=n.length,a=-1;for(;o<=i;){let l=o+i>>1;r.write(n.slice(0,l)+"\u2026"),e.scrollWidth<=e.clientWidth+.5?(a=l,o=l+1):i=l-1}return r.write((a>=0?n.slice(0,a):"")+"\u2026"),()=>{r.restore()}}function Jn(e){let t=[];for(let n=e.firstChild;n;n=n.nextSibling)n.nodeType===Node.TEXT_NODE&&t.push(n);let r=t.map(n=>n.data);return{text:r.join(""),write(n){t[0].data=n;for(let o=1;o<t.length;o++)t[o].data=""},restore(){for(let n=0;n<t.length;n++)t[n].data=r[n]}}}function Hl(e){let t=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");t=(t||"").trim();let r=parseInt(t,10);return Number.isFinite(r)&&r>0?r:0}function Bl(e){let t=(e.lineHeight||"").trim(),r=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(r*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*r):t.endsWith("%")?Math.round(parseFloat(t)/100*r):Math.round(r*1.2)}function _l(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function Zn(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Be=[];function Nt(e){if(!e)return null;if(Array.isArray(e)){let[t,r]=e;return typeof t=="function"?t(r):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:r}=e;return typeof t=="function"?t(r):t}return typeof e=="function"?e():e}function jl(...e){let t=e.flat();for(let r of t){let n=Nt(r);n&&(Be.some(o=>o&&o.name&&n.name&&o.name===n.name)||Be.push(n))}}function eo(e){return e&&Array.isArray(e.plugins)?e.plugins:Be}async function Se(e,t,r){let n=r,o=eo(t);for(let i of o){let a=i&&typeof i[e]=="function"?i[e]:null;if(!a)continue;let l=await a(t,n);typeof l<"u"&&(n=l)}return n}async function Ul(e,t,r){let n=[],o=eo(t);for(let i of o){let a=i&&typeof i[e]=="function"?i[e]:null;if(!a)continue;let l=await a(t,r);typeof l<"u"&&n.push(l)}return n}function ql(e){let t=[];if(Array.isArray(e))for(let r of e){let n=Nt(r);if(!n||!n.name)continue;let o=t.findIndex(i=>i&&i.name===n.name);o>=0&&t.splice(o,1),t.push(n)}for(let r of Be)r&&r.name&&!t.some(n=>n.name===r.name)&&t.push(r);return Object.freeze(t)}function zl(e,t,r=!1){return!e||e.plugins&&!r||(e.plugins=ql(t)),e}function to(){return Be.slice()}ne();var Vl=.92,Xl=.95;async function Yl(e){let t=new Image;if(t.decoding="sync",t.src=e,typeof t.decode=="function")try{return await t.decode(),t}catch{}return await new Promise((r,n)=>{t.onload=()=>r(),t.onerror=n}),t}function Gl(e){let t=/^data:([^;,]+)/.exec(e);return t?t[1]:""}async function hr(e,t,r){if(typeof e!="string"||!e.startsWith("data:image")||e.startsWith("data:image/svg"))return null;let n=e.length+":"+e.slice(0,64)+e.slice(-64)+":"+Math.round(t)+"x"+Math.round(r);if(M.compress.has(n))return M.compress.get(n);let o=await(async()=>{let i;try{i=await Yl(e)}catch{return null}let a=i.naturalWidth||i.width,l=i.naturalHeight||i.height;if(!a||!l)return null;let s=Math.min(1,Math.max(t/a,r/l));if(!(s>0)||s>=.95)return null;let c=s*Xl,u=Math.max(1,Math.round(a*c)),d=Math.max(1,Math.round(l*c)),h=document.createElement("canvas");h.width=u,h.height=d;let f=h.getContext("2d");if(!f)return null;f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(i,0,0,u,d);let p=Gl(e),m=p==="image/jpeg"?"image/jpeg":p==="image/webp"?"image/webp":"image/png";try{let y=h.toDataURL(m,Vl);if(typeof y=="string"&&y.startsWith("data:image")&&y.length<e.length)return y}catch{}return null})();return M.compress.set(n,o),o}async function Ql(e,t){if(!t.compress)return{count:0,before:0,after:0};let r=(t.scale||1)*(t.dpr||1),n=Array.from(e.querySelectorAll("img"));e.tagName==="IMG"&&n.unshift(e);let o=0,i=0,a=0,l=async c=>{let u=c.getAttribute("src")||"";if(!u.startsWith("data:image")||u.startsWith("data:image/svg"))return;let d=parseFloat(c.dataset.snapdomWidth)||parseFloat(c.style.width)||c.width||0,h=parseFloat(c.dataset.snapdomHeight)||parseFloat(c.style.height)||c.height||0;if(!d||!h)return;let f=await hr(u,d*r,h*r);f&&(o++,i+=u.length,a+=f.length,c.setAttribute("src",f))},s=6;for(let c=0;c<n.length;c+=s)await Promise.allSettled(n.slice(c,c+s).map(l));return{count:o,before:i,after:a}}function Kl(e){let t=e.offsetWidth||e.getBoundingClientRect().width||0,r=e.offsetHeight||e.getBoundingClientRect().height||0;return{w:t,h:r}}async function Jl(e,t,r=M.session.nodeMap){if(!t.compress)return{count:0};let n=(t.scale||1)*(t.dpr||1),o=[],i=[e,...e.querySelectorAll("*")];for(let c of i){let u=c.style&&c.style.backgroundImage;u&&u.includes("data:image")&&o.push(c)}let a=0,l=async c=>{let u=r.get(c);if(!u||!u.isConnected)return;let d;try{d=getComputedStyle(u)}catch{return}if((d.backgroundRepeat||"repeat").toLowerCase().split(",").some(v=>v.trim()!=="no-repeat"))return;let{w:h,h:f}=Kl(u);if(!h||!f)return;let p=h*n,m=f*n,y=c.style.backgroundImage,b=[...y.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],x=y;for(let v of b){let g=v[2];if(g.startsWith("data:image/svg"))continue;let w=await hr(g,p,m);w&&(x=x.split(g).join(w),a++)}x!==y&&(c.style.backgroundImage=x)},s=6;for(let c=0;c<o.length;c+=s)await Promise.allSettled(o.slice(c,c+s).map(l));return{count:a}}async function Zl(e,t){if(!t.compress)return{count:0};let r=(t.scale||1)*(t.dpr||1),n=Array.from(e.querySelectorAll("image"));e.localName==="image"&&n.unshift(e);let o=0,i=async l=>{let s=l.getAttribute("href")||(typeof l.getAttributeNS=="function"?l.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!s||!s.startsWith("data:image")||s.startsWith("data:image/svg"))return;let c=parseFloat(l.getAttribute("width"))||0,u=parseFloat(l.getAttribute("height"))||0;if(!c||!u)return;let d=await hr(s,c*r,u*r);d&&(l.setAttribute("href",d),l.hasAttribute("xlink:href")&&l.setAttribute("xlink:href",d),o++)},a=6;for(let l=0;l<n.length;l+=a)await Promise.allSettled(n.slice(l,l+a).map(i));return{count:o}}async function es(e,t,r){t.compress&&(await Ql(e,t),await Jl(e,t,r),await Zl(e,t))}function ts(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(Nt(t)?.name==="picture-resolver")return!0}return to().some(t=>t?.name==="picture-resolver")}function rs(e){let t=Array.isArray(e.plugins)?e.plugins:to(),r=[];for(let n of t){let o=Nt(n);o&&typeof o.resolveNode=="function"&&r.push(o.resolveNode.bind(o))}return r.length?r:null}var ns=2e3,os=3;function is(e){let t=Date.now(),r=M.burstAdvice.get(e);if(!r||t-r.firstTs>ns){M.burstAdvice.set(e,{count:1,firstTs:t,warned:!1});return}r.count++,r.count>=os&&!r.warned&&(r.warned=!0,console.warn("[snapdom] Captured this element multiple times. Pass { burst: true } to increase the speed."))}async function as(e,t){if(!e)throw new Error("Element cannot be null or undefined");$o(t.cache),t.__session={styleMap:M.session.styleMap,styleCache:M.session.styleCache,nodeMap:M.session.nodeMap},t.burst||is(e),t.__resolveNodeHooks=rs(t);let r=t.fast,n=t.outerTransforms!==!1,o=!!t.outerShadows,i=t.clip?Gn(e,t.clip):null,a={element:e,options:t,plugins:t.plugins},l,s,c,u,d,h,f="",p="",m,y,b=null;await Se("beforeSnap",a);let x=null;t.resolvePicturePlaceholders!==!1&&!ts(t)&&(x=await Ai(a.element,a.options)),await Se("beforeClone",a);let v=Ol(a.element,i);try{({clone:l,classCSS:s,styleCache:c,nodeMap:u,reconcileRisk:d,clipWindow:h}=await vl(a.element,a.options)),d>0&&!t.reconcile&&!M.warnedReconcile&&(M.warnedReconcile=!0,console.warn("[snapdom] Text in inline/table-cell elements kept its natural width and may re-wrap under font-fallback rasterization. Pass { reconcile: true } for pixel-exact layout (roughly doubles capture time).")),!n&&l&&(b=Ya(a.element,l)),!o&&l&&rl(a.element,l,a.options),l&&(il(a.element,l,u),nl(a.element,l))}finally{v()}if(a={clone:l,classCSS:s,styleCache:c,nodeMap:u,...a},await Se("afterClone",a),x&&await x(),cl(a.clone),a.options?.excludeMode==="remove"||a.options?.filterMode==="remove")try{fl(a.element,a.clone,a.styleCache)}catch(R){console.warn("[snapdom] shrink pass failed:",R)}try{await ha(a.clone,a.element,a.nodeMap)}catch{}let g=R=>new Promise((T,W)=>{dt(()=>{Promise.resolve().then(R).then(T,W)},{fast:r})}),w=(async()=>{await Promise.all([g(()=>Ml(a.clone,a.options)),g(()=>Nl(a.element,a.clone,a.styleCache,a.options,a.nodeMap))]);try{Ll(a.element,a.clone,a.nodeMap)}catch(R){console.warn("[snapdom] backdrop-filter emulation failed:",R)}t.compress&&await g(()=>es(a.clone,a.options,a.nodeMap))})(),C=Promise.resolve();t.embedFonts&&(C=g(async()=>{let R=a.element.ownerDocument||document,T=i?I=>{try{let N=I.getBoundingClientRect();return N.right>=i.left-200&&N.left<=i.right+200&&N.bottom>=i.top-200&&N.top<=i.bottom+200}catch{return!0}}:null,{required:W,usedCodepoints:F}=qn(a.element,T);if(we()){let I=new Set(Array.from(W).map(N=>String(N).split("__")[0]).filter(Boolean));await zn(I,1,R)}f=await Na({required:W,usedCodepoints:F,preCached:!1,exclude:a.options.excludeFonts,localFonts:a.options.localFonts,useProxy:a.options.useProxy,fontStylesheetDomains:a.options.fontStylesheetDomains,doc:R})})),await Promise.all([w,C]);let k=Do(a.clone).sort(),S=k.join(",");M.baseStyle.has(S)?p=M.baseStyle.get(S):await new Promise(R=>{dt(()=>{p=Ho(k),M.baseStyle.set(S,p),R()},{fast:r})});let E=xl(a.element?.ownerDocument||document);a={fontsCSS:f,baseCSS:p,scrollbarCSS:E,...a},await Se("beforeRender",a),await new Promise(R=>{dt(()=>{let T=_(a.element),W=a.element.getBoundingClientRect(),F=Math.max(1,A(a.element.offsetWidth||parseFloat(T.width)||W.width||1)),I=Math.max(1,A(a.element.offsetHeight||parseFloat(T.height)||W.height||1)),N=a.element.ownerDocument||document;if(!h&&(a.element===N.body||a.element===N.documentElement)&&!N.documentElement.hasAttribute("data-sd-pinned")){let z=Math.max(a.element.scrollHeight||0,N.documentElement?.scrollHeight||0,N.body?.scrollHeight||0),Z=Math.max(a.element.scrollWidth||0,N.documentElement?.scrollWidth||0,N.body?.scrollWidth||0);z>0&&(I=Math.max(I,A(z))),Z>0&&(F=Math.max(F,A(Z)));try{let Y=(a.scrollbarCSS||"").length+(a.baseCSS||"").length+(a.fontsCSS||"").length+(a.classCSS||"").length,ie=M.measureHints.get(a.element);if(ie&&ie.cssLen===Y&&ie.w0===F)ie.csh>0&&(I=Math.max(I,A(ie.csh))),ie.csw>0&&(F=Math.max(F,A(ie.csw)));else{let G=N.createElement("div");G.setAttribute("data-snapdom-internal",""),G.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+F+"px!important;overflow:visible!important;visibility:hidden!important;";let de=G.attachShadow({mode:"open"}),et=N.createElement("style");et.textContent=(a.scrollbarCSS||"")+a.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a.classCSS,de.appendChild(et),de.appendChild(a.clone.cloneNode(!0)),N.body.appendChild(G);let ve=G.scrollHeight,Tt=G.scrollWidth;N.body.removeChild(G),M.measureHints.set(a.element,{cssLen:Y,w0:F,csh:ve,csw:Tt}),ve>0&&(I=Math.max(I,A(ve))),Tt>0&&(F=Math.max(F,A(Tt)))}}catch{}}if(a.options?.excludeMode==="remove"||a.options?.filterMode==="remove"){let z=gl(a.element,a.options);Number.isFinite(z)&&z>0&&(I=Math.max(1,Math.min(I,A(z+1))))}if(a.options?.reconcile)try{let z=(a.scrollbarCSS||"")+a.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a.classCSS;yl(a.element,a.clone,z,a.nodeMap,F,I)}catch(z){console.warn("[snapdom] reconcile pass failed:",z)}let O=(z,Z=NaN)=>{let Y=typeof z=="string"?parseFloat(z):z;return Number.isFinite(Y)?Y:Z},X=O(a.options.width),U=O(a.options.height),V=h?A(h.width):F,K=h?A(h.height):I,P=V,B=K,D=Number.isFinite(X),q=Number.isFinite(U),ce=K>0?V/K:1;D&&q?(P=Math.max(1,A(X)),B=Math.max(1,A(U))):D?(P=Math.max(1,A(X)),B=Math.max(1,A(P/(ce||1)))):q&&(B=Math.max(1,A(U)),P=Math.max(1,A(B*(ce||1))));let Q=0,te=0,oe=F,J=I;if(h){let z=0,Z=0;if(Wt(a.element)){let Y=null;if(!n&&b&&Number.isFinite(b.a))Y={a:b.a,b:b.b||0,c:b.c||0,d:b.d||1,e:0,f:0};else{let ie=kt(a.element),G=Qn(T.transform&&T.transform!=="none"?T.transform:"",ie);G&&G.is2D&&(Y={a:G.a,b:G.b,c:G.c,d:G.d,e:0,f:0})}if(Y&&!(Y.a===1&&Y.b===0&&Y.c===0&&Y.d===1)){let{ox:ie,oy:G}=Jt(T,F,I),de=wt(F,I,Y,ie,G);z=de.minX,Z=de.minY}}Q=A(h.x+z),te=A(h.y+Z),oe=A(Q+h.width),J=A(te+h.height)}else if(!n&&b&&Number.isFinite(b.a)){let z={a:b.a,b:b.b||0,c:b.c||0,d:b.d||1,e:0,f:0},Z=wt(F,I,z,0,0);Q=A(Z.minX),te=A(Z.minY),oe=A(Z.maxX),J=A(Z.maxY)}else if(n&&Wt(a.element)){let z=T.transform&&T.transform!=="none"?T.transform:"",Z=kt(a.element),Y=Qa({baseTransform:z,rotate:Z.rotate||"0deg",scale:Z.scale,translate:Z.translate}),{ox:ie,oy:G}=Jt(T,F,I),de=Y.is2D?Y:new DOMMatrix(Y.toString()),et={a:de.a,b:de.b,c:de.c,d:de.d,e:0,f:0},ve=wt(F,I,et,ie,G);Q=A(ve.minX),te=A(ve.minY),oe=A(ve.maxX),J=A(ve.maxY)}let pe=Ua(T),Ce=qa(T),ee=za(T),Ve=Va(T),Xe=Xa(T),Ye=h?{top:0,right:0,bottom:0,left:0}:o?{top:A(Math.max(pe.top,Ce.top)+ee.top+Ve.top+Xe.bleed.top),right:A(Math.max(pe.right,Ce.right)+ee.right+Ve.right+Xe.bleed.right),bottom:A(Math.max(pe.bottom,Ce.bottom)+ee.bottom+Ve.bottom+Xe.bleed.bottom),left:A(Math.max(pe.left,Ce.left)+ee.left+Ve.left+Xe.bleed.left)}:{top:ee.top,right:ee.right,bottom:ee.bottom,left:ee.left};Q=A(Q-Ye.left),te=A(te-Ye.top),oe=A(oe+Ye.right),J=A(J+Ye.bottom);let pr=Math.max(1,A(oe-Q)),mr=Math.max(1,A(J-te)),oo=D||q?A(P/V):1,io=q||D?A(B/K):1,ao=Math.max(1,A(pr*oo)),lo=Math.max(1,A(mr*io)),gr="http://www.w3.org/2000/svg",so=Wt(a.element)?2:0,Re=A(so+(n?0:1)),Ge=Math.ceil(pr+Re*2),Qe=Math.ceil(mr+Re*2),Ke=A(-(A(Q)-Re)),Je=A(-(A(te)-Re)),yr=Math.max(0,Ke),br=Math.max(0,Je),wr=A(Ge-Math.min(0,Ke)),xr=A(Qe-Math.min(0,Je)),xe=document.createElementNS(gr,"foreignObject");xe.setAttribute("x",String(Math.min(0,Ke))),xe.setAttribute("y",String(Math.min(0,Je))),xe.setAttribute("width",String(wr)),xe.setAttribute("height",String(xr)),xe.style.overflow="visible";let vr=document.createElement("style"),co="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";vr.textContent=(a.scrollbarCSS||"")+a.baseCSS+a.fontsCSS+co+a.classCSS,xe.appendChild(vr);let Ze=document.createElement("div");Ze.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ze.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${wr}px;height:${xr}px`+(yr!==0||br!==0?`;padding:${br}px 0 0 ${yr}px !important`:""),Ze.appendChild(a.clone),xe.appendChild(Ze);let uo=new XMLSerializer().serializeToString(xe),Sr=D||q,ho=Object.freeze({w0:V,h0:K,vbW:Ge,vbH:Qe,targetW:P,targetH:B,contentX:A(Ke+(h?Q:0)),contentY:A(Je+(h?te:0)),clip:h?Object.freeze({x:A(Q),y:A(te),width:V,height:K}):null});Object.defineProperty(t,"meta",{value:ho,enumerable:!0,writable:!1,configurable:!0});let fo=!Sr||we()?Ge:A(ao+Re*2),po=!Sr||we()?Qe:A(lo+Re*2),mo=parseFloat(_(N.documentElement)?.fontSize)||16;y=`<svg xmlns="${gr}" width="${fo}" height="${po}" viewBox="0 0 ${Ge} ${Qe}" font-size="${mo}px">`+uo+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,a={svgString:y,dataURL:m,...a},R()},{fast:r})}),await Se("afterRender",a);let $=document.getElementById("snapdom-sandbox");return $&&$.style.position==="absolute"&&$.remove(),a.dataURL}function Wt(e){return Ka(e)}ne();function ls(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let r=Eo(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:r,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,reconcile:e.reconcile??!1,burst:e.burst??!1,invalidate:e.invalidate??!1,clip:e.clip??null,compress:e.compress!==!1,excludeStyleProps:e.excludeStyleProps??null,resolvePicturePlaceholders:e.resolvePicturePlaceholders!==!1,pictureResolver:e.pictureResolver&&typeof e.pictureResolver=="object"?e.pictureResolver:{}}}Ae();kn();var ln=new WeakMap;function ro(e,t,r){let n=new Set;if(e instanceof HTMLVideoElement&&n.add(e),e.querySelectorAll)for(let o of e.querySelectorAll("video"))n.add(o);for(let o of t.trackedVideos)n.has(o)||(o.removeEventListener("timeupdate",r),o.removeEventListener("seeked",r),t.trackedVideos.delete(o));for(let o of n)t.trackedVideos.has(o)||(o.addEventListener("timeupdate",r),o.addEventListener("seeked",r),t.trackedVideos.add(o))}function ss(e){let t={dirty:!0,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedVideos:new Set},r=i=>{t.capturing||Pn(i)&&(t.dirty=!0)},n=()=>{t.capturing||(t.dirty=!0)},o=e.ownerDocument||document;try{let i=new MutationObserver(r);i.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),t.observers.push(i)}catch{}try{if(o.head){let i=new MutationObserver(r);i.observe(o.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),t.observers.push(i)}}catch{}return t.markDirty=r,t.onMediaDirty=n,ro(e,t,n),t}function sn(e){let{burst:t,invalidate:r,...n}=e||{};try{return JSON.stringify(n,Object.keys(n).sort())}catch{return null}}function cs(e,t,r,n){let o=ln.get(e);o||(o=ss(e),o.baselineSignature=sn(t),ln.set(e,o));let i=sn(t),a=i===null||i!==o.baselineSignature,l=async()=>{for(let c of o.observers)o.markDirty(c.takeRecords());if(r.invalidate&&(o.dirty=!0),!a&&!o.dirty&&o.last)return o.last;o.capturing=!0,a||(o.dirty=!1);try{let c=await n();return a||(o.last=c),c}finally{for(let c of o.observers)c.takeRecords();o.capturing=!1,ro(e,o,o.onMediaDirty)}},s=o.inflight.then(l,l);return o.inflight=s.catch(()=>{}),s}ue();$e();ne();function us(...e){return jl(...e),H}var H=Object.assign(hs,{plugins:us}),rr=Symbol("snapdom.internal"),ds=Symbol("snapdom.internal.silent");async function hs(e,t){if(!e)throw new Error("Element cannot be null or undefined");let r=ls(t);if(zl(r,t&&t.plugins),we()){if(r.embedFonts===!0)try{let o=La(e),i=new Set([...o].map(a=>String(a).split("__")[0]).filter(Boolean));await zn(i,1)}catch{}let n=Array.from(e.querySelectorAll("canvas"));e.tagName==="CANVAS"&&n.unshift(e);for(let o of n)try{let i=o.getContext("2d",{willReadFrequently:!0});i&&i.getImageData(0,0,1,1)}catch(i){j(t,"safari canvas poke failed",i)}}return r.iconFonts&&r.iconFonts.length>0&&ia(r.iconFonts),r.snap||(r.snap={toPng:(n,o)=>H.toPng(n,o),toSvg:(n,o)=>H.toSvg(n,o)}),r.burst?cs(e,t,r,()=>H.capture(e,r,rr)):H.capture(e,r,rr)}H.capture=async(e,t,r)=>{if(r!==rr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");t.element=e;let n=await as(e,t),o={img:async(m,y)=>{let{toImg:b}=await Promise.resolve().then(()=>(Fr(),jt));return b(n,{...m,...y||{}})},svg:async(m,y)=>{let{toSvg:b}=await Promise.resolve().then(()=>(Fr(),jt));return b(n,{...m,...y||{}})},canvas:async(m,y)=>{let{toCanvas:b}=await Promise.resolve().then(()=>(je(),En));return b(n,{...m,...y||{}})},blob:async(m,y)=>{let{toBlob:b}=await Promise.resolve().then(()=>(Tn(),Nn));return b(n,{...m,...y||{}})},png:async(m,y)=>{let{rasterize:b}=await Promise.resolve().then(()=>(pt(),ft));return b(n,{...m,...y||{},format:"png"})},jpeg:async(m,y)=>{let{rasterize:b}=await Promise.resolve().then(()=>(pt(),ft));return b(n,{...m,...y||{},format:"jpeg"})},webp:async(m,y)=>{let{rasterize:b}=await Promise.resolve().then(()=>(pt(),ft));return b(n,{...m,...y||{},format:"webp"})},download:async(m,y)=>{let{download:b}=await Promise.resolve().then(()=>(ri(),Fn));return b(n,{...m,...y||{}})}},i={};for(let m of["img","svg","canvas","blob","png","jpeg","webp"])i[m]=async y=>o[m](t,{...y||{},[ds]:!0});i.jpg=i.jpeg;let a={...t,export:{url:n},exports:i},l=await Ul("defineExports",a),s=Object.assign({},...l.filter(m=>m&&typeof m=="object").reverse()),c={...o,...s};c.jpeg&&!c.jpg&&(c.jpg=(m,y)=>c.jpeg(m,y));function u(m,y){let b={...t,...y||{}},x=v=>v==="jpeg"||v==="jpg"||v==="webp";return[m,b.format,b.type].map(v=>typeof v=="string"?v.toLowerCase():"").find(x)&&(b.backgroundColor==null||b.backgroundColor==="transparent")&&(b.backgroundColor="#ffffff"),b}let d=!1,h=Promise.resolve();async function f(m,y){let b=Object.freeze(y&&typeof y=="object"?{...y}:{}),x=async()=>{let g=c[m];if(!g)throw new Error(`[snapdom] Unknown export type: ${m}`);let w=u(m,b),C={...t,export:{type:m,options:w,requestedOptions:b,url:n}};await Se("beforeExport",C,{format:m,options:w});let k=await g(C,w);return await Se("afterExport",C,{format:m,options:w,result:k}),d||(d=!0,await Se("afterSnap",t)),k},v=h.then(x);return h=v.catch(()=>{}),v}let p={url:n,toRaw:()=>n,to:(m,y)=>f(m,y),toImg:m=>f("img",m),toSvg:m=>f("svg",m),toCanvas:m=>f("canvas",m),toBlob:m=>f("blob",m),toPng:m=>f("png",m),toJpg:m=>f("jpg",m),toWebp:m=>f("webp",m),download:m=>f("download",m)};Object.defineProperty(p,"meta",{value:t.meta,enumerable:!0,writable:!1,configurable:!1});for(let m of Object.keys(c)){let y="to"+m.charAt(0).toUpperCase()+m.slice(1);p[y]||(p[y]=b=>f(m,b))}return p};H.toRaw=(e,t)=>H(e,t).then(r=>r.toRaw());H.toImg=(e,t)=>H(e,t).then(r=>r.toImg());H.toSvg=(e,t)=>H(e,t).then(r=>r.toSvg());H.toCanvas=(e,t)=>H(e,t).then(r=>r.toCanvas());H.toBlob=(e,t)=>H(e,t).then(r=>r.toBlob());H.toPng=(e,t)=>H(e,{...t,format:"png"}).then(r=>r.toPng());H.toJpg=(e,t)=>H(e,{...t,format:"jpeg"}).then(r=>r.toJpg());H.toWebp=(e,t)=>H(e,{...t,format:"webp"}).then(r=>r.toWebp());H.download=(e,t)=>H(e,t).then(r=>r.download());var Ue=class{constructor(){L(this,"name","BrowserScriptScreenshotDriver")}async captureSelector(t){try{if(typeof document>"u")return{ok:!1,reason:"NO_DOCUMENT_ENVIRONMENT"};let r=document.querySelector(t);return r?await this.captureElement(r):{ok:!1,reason:`ELEMENT_NOT_FOUND: ${t}`}}catch(r){return{ok:!1,reason:r?.message||"UNKNOWN_CAPTURE_ERROR"}}}async captureElement(t){try{if(typeof window>"u"||typeof document>"u")return{ok:!1,reason:"NO_BROWSER_ENVIRONMENT"};let r=t.getBoundingClientRect(),n=Math.max(Math.round(r.width),10),o=Math.max(Math.round(r.height),10),i=(async()=>{try{let l,s="webp";try{if(typeof H=="function"){let c=await H(t,{scale:1,embedFonts:!1});if(c&&typeof c.toWebp=="function")l=await c.toWebp();else if(c&&typeof c.toPng=="function")l=await c.toPng(),s="png";else if(c?.url)return{ok:!0,dataUrl:c.url,format:"webp",width:n,height:o}}else H?.toWebp?l=await H.toWebp(t,{scale:1,embedFonts:!1}):H?.toPng&&(l=await H.toPng(t,{scale:1,embedFonts:!1}),s="png")}catch{}if(l&&l.src)return{ok:!0,dataUrl:l.src,format:l.src.startsWith("data:image/webp")?"webp":s,width:l.naturalWidth||n,height:l.naturalHeight||o}}catch(l){let s=String(l?.message||l);if(s.includes("CORS")||s.includes("SecurityError")||s.includes("tainted"))return{ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}}return await this.captureWithSvgFallback(t,n,o)})(),a=new Promise(l=>{setTimeout(()=>l({ok:!1,reason:"CAPTURE_TIMEOUT"}),3e3)});return await Promise.race([i,a])}catch(r){return{ok:!1,reason:r?.message||"CAPTURE_EXCEPTION"}}}async captureWithSvgFallback(t,r,n){try{let o=t.cloneNode(!0),i=window.getComputedStyle(t),a="";for(let u=0;u<i.length;u++){let d=i[u];a+=`${d}:${i.getPropertyValue(d)};`}o.style.cssText=a,o.style.margin="0",o.style.position="static";let l=`
|
|
9
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">
|
|
10
|
+
<foreignObject width="100%" height="100%">
|
|
11
|
+
<div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px;height:${n}px;">
|
|
12
|
+
${o.outerHTML}
|
|
13
|
+
</div>
|
|
14
|
+
</foreignObject>
|
|
15
|
+
</svg>
|
|
16
|
+
`.trim(),s=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(s);return await new Promise(u=>{let d=new Image;d.onload=()=>{try{let h=document.createElement("canvas");h.width=r,h.height=n;let f=h.getContext("2d");if(!f){URL.revokeObjectURL(c),u({ok:!1,reason:"CANVAS_CONTEXT_UNAVAILABLE"});return}f.drawImage(d,0,0),URL.revokeObjectURL(c);let p;try{p=h.toDataURL("image/webp",.85)}catch{p=h.toDataURL("image/png")}u({ok:!0,dataUrl:p,format:p.startsWith("data:image/webp")?"webp":"png",width:r,height:n})}catch(h){URL.revokeObjectURL(c),h?.name==="SecurityError"||String(h).includes("tainted")?u({ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}):u({ok:!1,reason:h?.message||"CANVAS_EXPORT_FAILED"})}},d.onerror=()=>{URL.revokeObjectURL(c),u({ok:!1,reason:"IMAGE_LOAD_FAILED"})},d.src=c})}catch(o){return{ok:!1,reason:o?.message||"FALLBACK_CAPTURE_FAILED"}}}};var Lt=class{constructor(t){L(this,"wsUrl");L(this,"projectId");L(this,"debug");L(this,"ws",null);L(this,"sessionId",null);L(this,"queue",[]);L(this,"maxQueueSize",50);L(this,"reconnectAttempts",0);L(this,"maxReconnectDelay",1e4);L(this,"reconnectTimer",null);L(this,"commandHandler");L(this,"isDestroyed",!1);this.wsUrl=t.url||"ws://127.0.0.1:7331",this.projectId=t.projectId,this.debug=!!t.debug}setCommandHandler(t){this.commandHandler=t}getSessionId(){return this.sessionId}isConnected(){return this.ws!==null&&this.ws.readyState===(typeof WebSocket<"u"?WebSocket.OPEN:1)}connect(){if(!(this.isDestroyed||typeof WebSocket>"u")&&!(this.ws&&(this.ws.readyState===WebSocket.CONNECTING||this.ws.readyState===WebSocket.OPEN)))try{this.ws=new WebSocket(this.wsUrl),this.ws.onopen=()=>{this.reconnectAttempts=0,this.sendHello(),this.flushQueue()},this.ws.onmessage=async t=>{try{let r=typeof t.data=="string"?t.data:"";if(!r)return;let n=JSON.parse(r);if(n.type==="hello_ack"){this.sessionId=n.sessionId,this.debug&&console.log("[BrowserTrack] Connected, session ID:",this.sessionId);return}if(n.type==="command"&&this.commandHandler){let o=n.command,i=await this.commandHandler.executeCommand(o);this.send({type:"command_response",sessionId:this.sessionId,response:i})}}catch{}},this.ws.onerror=()=>{},this.ws.onclose=()=>{this.ws=null,this.scheduleReconnect()}}catch{this.scheduleReconnect()}}send(t){let r=JSON.stringify(t);if(this.isConnected())try{this.ws.send(r)}catch{this.enqueue(r)}else this.enqueue(r)}enqueue(t){this.queue.length>=this.maxQueueSize&&this.queue.shift(),this.queue.push(t)}flushQueue(){if(this.isConnected())for(;this.queue.length>0;){let t=this.queue.shift();if(t)try{this.ws.send(t)}catch{this.queue.unshift(t);break}}}sendHello(){if(typeof window>"u")return;let t={type:"hello",origin:window.location.origin,url:window.location.href,title:document.title,userAgent:navigator.userAgent,timestamp:Date.now(),projectId:this.projectId};try{this.ws.send(JSON.stringify(t))}catch{}}scheduleReconnect(){if(this.isDestroyed||this.reconnectTimer)return;this.reconnectAttempts++;let t=Math.min(1e3*Math.pow(1.5,this.reconnectAttempts),this.maxReconnectDelay);this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}destroy(){if(this.isDestroyed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws){try{this.ws.close()}catch{}this.ws=null}this.queue=[]}};var qe=class{constructor(t,r,n={}){L(this,"transport");L(this,"screenshotDriver");L(this,"options");L(this,"container",null);L(this,"shadowRoot",null);L(this,"highlightOverlay",null);L(this,"regionOverlay",null);L(this,"regionBox",null);L(this,"toolbarElement",null);L(this,"modalOverlay",null);L(this,"activeMode","idle");L(this,"hoveredElement",null);L(this,"selectedElement",null);L(this,"selectedRegion",null);L(this,"isDraggingRegion",!1);L(this,"dragStartX",0);L(this,"dragStartY",0);L(this,"cleanups",[]);this.transport=t,this.screenshotDriver=r,this.options={shortcut:"Alt+Click",maskSelectors:['input[type="password"]',"[data-sensitive]"],showToolbar:!0,...n}}init(){typeof window>"u"||typeof document>"u"||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{this.ensureContainer()}):this.ensureContainer(),this.setupListeners())}setMode(t){this.activeMode=t,this.updateToolbarState(),t==="element"?this.hideRegionOverlay():t==="region"?(this.hideHighlight(),this.showRegionOverlay()):t==="page"?(this.hideRegionOverlay(),this.hideHighlight(),this.openNoteEditor(document.body,"page")):(this.hideRegionOverlay(),this.hideHighlight())}ensureContainer(){if(typeof document>"u")return null;if(!this.container){this.container=document.createElement("div"),this.container.id="browsertrack-inspector-host",this.container.style.cssText="all: initial; position: fixed; top: 0; left: 0; width: 0; height: 0; z-index: 2147483647; pointer-events: none;",this.shadowRoot=this.container.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=`
|
|
17
|
+
:host {
|
|
18
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
19
|
+
color-scheme: dark;
|
|
20
|
+
-webkit-font-smoothing: antialiased;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* 1. Element Highlight Overlay */
|
|
24
|
+
.bt-highlight {
|
|
25
|
+
position: fixed;
|
|
26
|
+
border: 2px solid #3b82f6;
|
|
27
|
+
background: rgba(59, 130, 246, 0.15);
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
transition: all 0.05s ease-out;
|
|
31
|
+
z-index: 2147483640;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.bt-badge {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: -24px;
|
|
38
|
+
left: 0;
|
|
39
|
+
background: #1e293b;
|
|
40
|
+
color: #38bdf8;
|
|
41
|
+
border: 1px solid #3b82f6;
|
|
42
|
+
font-size: 11px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
padding: 2px 6px;
|
|
45
|
+
border-radius: 3px;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* 2. Region Selection Overlay */
|
|
52
|
+
.bt-region-overlay {
|
|
53
|
+
position: fixed;
|
|
54
|
+
inset: 0;
|
|
55
|
+
width: 100vw;
|
|
56
|
+
height: 100vh;
|
|
57
|
+
cursor: crosshair;
|
|
58
|
+
z-index: 2147483642;
|
|
59
|
+
pointer-events: auto;
|
|
60
|
+
background: rgba(15, 23, 42, 0.2);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.bt-region-box {
|
|
64
|
+
position: fixed;
|
|
65
|
+
border: 2px dashed #38bdf8;
|
|
66
|
+
background: rgba(56, 189, 248, 0.2);
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
z-index: 2147483643;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.bt-region-badge {
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: -24px;
|
|
75
|
+
left: 0;
|
|
76
|
+
background: #0f172a;
|
|
77
|
+
color: #38bdf8;
|
|
78
|
+
border: 1px solid #0284c7;
|
|
79
|
+
font-size: 11px;
|
|
80
|
+
font-weight: 600;
|
|
81
|
+
padding: 2px 6px;
|
|
82
|
+
border-radius: 3px;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* 3. Floating Quick Toolbar */
|
|
88
|
+
.bt-toolbar {
|
|
89
|
+
position: fixed;
|
|
90
|
+
bottom: 20px;
|
|
91
|
+
right: 20px;
|
|
92
|
+
background: #1e293b;
|
|
93
|
+
border: 1px solid #334155;
|
|
94
|
+
border-radius: 30px;
|
|
95
|
+
padding: 4px 6px;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 4px;
|
|
99
|
+
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.5);
|
|
100
|
+
pointer-events: auto;
|
|
101
|
+
z-index: 2147483646;
|
|
102
|
+
user-select: none;
|
|
103
|
+
transition: all 0.2s ease;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.bt-toolbar-btn {
|
|
107
|
+
background: transparent;
|
|
108
|
+
border: none;
|
|
109
|
+
color: #94a3b8;
|
|
110
|
+
font-size: 12px;
|
|
111
|
+
font-weight: 500;
|
|
112
|
+
padding: 6px 10px;
|
|
113
|
+
border-radius: 20px;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 5px;
|
|
118
|
+
transition: all 0.15s ease;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.bt-toolbar-btn:hover {
|
|
122
|
+
background: #334155;
|
|
123
|
+
color: #f8fafc;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.bt-toolbar-btn.active {
|
|
127
|
+
background: #2563eb;
|
|
128
|
+
color: #ffffff;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.bt-toolbar-divider {
|
|
133
|
+
width: 1px;
|
|
134
|
+
height: 16px;
|
|
135
|
+
background: #334155;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* 4. Modal Backdrop & Editor */
|
|
139
|
+
.bt-modal-backdrop {
|
|
140
|
+
position: fixed;
|
|
141
|
+
top: 0;
|
|
142
|
+
left: 0;
|
|
143
|
+
width: 100vw;
|
|
144
|
+
height: 100vh;
|
|
145
|
+
background: rgba(15, 23, 42, 0.75);
|
|
146
|
+
backdrop-filter: blur(4px);
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
pointer-events: auto;
|
|
151
|
+
z-index: 2147483647;
|
|
152
|
+
opacity: 1;
|
|
153
|
+
box-sizing: border-box;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.bt-modal {
|
|
157
|
+
background: #1e293b;
|
|
158
|
+
color: #f8fafc;
|
|
159
|
+
border: 1px solid #334155;
|
|
160
|
+
border-radius: 12px;
|
|
161
|
+
padding: 18px;
|
|
162
|
+
width: 420px;
|
|
163
|
+
max-width: 90vw;
|
|
164
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.7);
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
gap: 12px;
|
|
168
|
+
box-sizing: border-box;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.bt-modal-header {
|
|
172
|
+
display: flex;
|
|
173
|
+
justify-content: space-between;
|
|
174
|
+
align-items: center;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.bt-modal-title {
|
|
178
|
+
font-size: 14px;
|
|
179
|
+
font-weight: 600;
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
gap: 6px;
|
|
183
|
+
color: #f8fafc;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.bt-mode-badge {
|
|
187
|
+
font-size: 10px;
|
|
188
|
+
font-weight: 700;
|
|
189
|
+
text-transform: uppercase;
|
|
190
|
+
background: rgba(59, 130, 246, 0.2);
|
|
191
|
+
color: #60a5fa;
|
|
192
|
+
border: 1px solid #3b82f6;
|
|
193
|
+
padding: 2px 6px;
|
|
194
|
+
border-radius: 4px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.bt-close-btn {
|
|
198
|
+
background: transparent;
|
|
199
|
+
border: none;
|
|
200
|
+
color: #94a3b8;
|
|
201
|
+
font-size: 16px;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
padding: 2px 6px;
|
|
204
|
+
border-radius: 4px;
|
|
205
|
+
}
|
|
206
|
+
.bt-close-btn:hover {
|
|
207
|
+
background: #334155;
|
|
208
|
+
color: #ffffff;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.bt-target-pill {
|
|
212
|
+
background: #0f172a;
|
|
213
|
+
color: #94a3b8;
|
|
214
|
+
border: 1px solid #334155;
|
|
215
|
+
border-radius: 6px;
|
|
216
|
+
padding: 6px 10px;
|
|
217
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
218
|
+
font-size: 11px;
|
|
219
|
+
overflow: hidden;
|
|
220
|
+
text-overflow: ellipsis;
|
|
221
|
+
white-space: nowrap;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.bt-textarea {
|
|
225
|
+
background: #0f172a;
|
|
226
|
+
color: #f8fafc;
|
|
227
|
+
border: 1px solid #334155;
|
|
228
|
+
border-radius: 6px;
|
|
229
|
+
padding: 10px;
|
|
230
|
+
font-size: 13px;
|
|
231
|
+
resize: vertical;
|
|
232
|
+
min-height: 85px;
|
|
233
|
+
outline: none;
|
|
234
|
+
box-sizing: border-box;
|
|
235
|
+
width: 100%;
|
|
236
|
+
font-family: inherit;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.bt-textarea:focus {
|
|
240
|
+
border-color: #3b82f6;
|
|
241
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.bt-modal-actions {
|
|
245
|
+
display: flex;
|
|
246
|
+
justify-content: flex-end;
|
|
247
|
+
gap: 8px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.bt-btn {
|
|
251
|
+
padding: 8px 14px;
|
|
252
|
+
border-radius: 6px;
|
|
253
|
+
font-size: 12px;
|
|
254
|
+
font-weight: 600;
|
|
255
|
+
cursor: pointer;
|
|
256
|
+
border: 1px solid transparent;
|
|
257
|
+
transition: all 0.1s ease;
|
|
258
|
+
font-family: inherit;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.bt-btn-cancel {
|
|
262
|
+
background: transparent;
|
|
263
|
+
color: #94a3b8;
|
|
264
|
+
}
|
|
265
|
+
.bt-btn-cancel:hover {
|
|
266
|
+
background: #334155;
|
|
267
|
+
color: #f8fafc;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.bt-btn-save {
|
|
271
|
+
background: #2563eb;
|
|
272
|
+
color: #ffffff;
|
|
273
|
+
}
|
|
274
|
+
.bt-btn-save:hover {
|
|
275
|
+
background: #1d4ed8;
|
|
276
|
+
}
|
|
277
|
+
.bt-btn-save:disabled {
|
|
278
|
+
opacity: 0.6;
|
|
279
|
+
cursor: not-allowed;
|
|
280
|
+
}
|
|
281
|
+
`,this.shadowRoot.appendChild(t),this.highlightOverlay=document.createElement("div"),this.highlightOverlay.className="bt-highlight",this.highlightOverlay.style.display="none",this.shadowRoot.appendChild(this.highlightOverlay),this.options.showToolbar&&this.createToolbar()}if(this.container&&!this.container.isConnected){let t=document.body||document.documentElement;t&&t.appendChild(this.container)}return this.shadowRoot}createToolbar(){if(!this.shadowRoot||this.toolbarElement)return;this.toolbarElement=document.createElement("div"),this.toolbarElement.className="bt-toolbar",this.toolbarElement.innerHTML=`
|
|
282
|
+
<button class="bt-toolbar-btn" id="bt-mode-element" title="Inspect element (or hold Alt+Click)">
|
|
283
|
+
<span>\u{1F3AF}</span> Element
|
|
284
|
+
</button>
|
|
285
|
+
<button class="bt-toolbar-btn" id="bt-mode-region" title="Drag to select screen region">
|
|
286
|
+
<span>\u{1F4D0}</span> Region
|
|
287
|
+
</button>
|
|
288
|
+
<button class="bt-toolbar-btn" id="bt-mode-page" title="Leave full-page note">
|
|
289
|
+
<span>\u{1F4C4}</span> Page
|
|
290
|
+
</button>
|
|
291
|
+
`;let t=this.toolbarElement.querySelector("#bt-mode-element"),r=this.toolbarElement.querySelector("#bt-mode-region"),n=this.toolbarElement.querySelector("#bt-mode-page");t.onclick=()=>{this.setMode(this.activeMode==="element"?"idle":"element")},r.onclick=()=>{this.setMode(this.activeMode==="region"?"idle":"region")},n.onclick=()=>{this.setMode("page")},this.shadowRoot.appendChild(this.toolbarElement)}updateToolbarState(){if(!this.toolbarElement)return;let t=this.toolbarElement.querySelector("#bt-mode-element"),r=this.toolbarElement.querySelector("#bt-mode-region"),n=this.toolbarElement.querySelector("#bt-mode-page");t?.classList.toggle("active",this.activeMode==="element"),r?.classList.toggle("active",this.activeMode==="region"),n?.classList.toggle("active",this.activeMode==="page")}setupListeners(){let t=o=>{if(!(this.modalOverlay||this.isDraggingRegion||this.activeMode==="region")){if(o.altKey||this.activeMode==="element"){let i=document.elementFromPoint(o.clientX,o.clientY);if(i&&i!==this.container&&!this.container?.contains(i)){this.hoveredElement=i,this.updateHighlight(i);return}}!o.altKey&&this.activeMode!=="element"&&this.hideHighlight()}},r=o=>{if(!(this.modalOverlay||this.activeMode==="region")&&(o.altKey||this.activeMode==="element")){o.preventDefault(),o.stopPropagation();let i=this.hoveredElement||document.elementFromPoint(o.clientX,o.clientY);i&&i!==this.container&&!this.container?.contains(i)&&(this.selectedElement=i,this.openNoteEditor(i,"element"),this.activeMode==="element"&&this.setMode("idle"))}},n=o=>{o.key==="Alt"&&!this.modalOverlay&&this.activeMode!=="element"&&this.hideHighlight()};window.addEventListener("mousemove",t,{capture:!0,passive:!0}),window.addEventListener("click",r,{capture:!0}),window.addEventListener("keyup",n,{capture:!0}),this.cleanups.push(()=>{window.removeEventListener("mousemove",t,{capture:!0}),window.removeEventListener("click",r,{capture:!0}),window.removeEventListener("keyup",n,{capture:!0})})}showRegionOverlay(){let t=this.ensureContainer();t&&(this.regionOverlay||(this.regionOverlay=document.createElement("div"),this.regionOverlay.className="bt-region-overlay",this.regionBox=document.createElement("div"),this.regionBox.className="bt-region-box",this.regionBox.style.display="none",this.regionOverlay.appendChild(this.regionBox),this.regionOverlay.onmousedown=r=>{this.isDraggingRegion=!0,this.dragStartX=r.clientX,this.dragStartY=r.clientY,this.regionBox&&(this.regionBox.style.display="block",this.regionBox.style.left=`${r.clientX}px`,this.regionBox.style.top=`${r.clientY}px`,this.regionBox.style.width="0px",this.regionBox.style.height="0px")},this.regionOverlay.onmousemove=r=>{if(!this.isDraggingRegion||!this.regionBox)return;let n=r.clientX,o=r.clientY,i=Math.min(this.dragStartX,n),a=Math.min(this.dragStartY,o),l=Math.abs(n-this.dragStartX),s=Math.abs(o-this.dragStartY);this.regionBox.style.left=`${i}px`,this.regionBox.style.top=`${a}px`,this.regionBox.style.width=`${l}px`,this.regionBox.style.height=`${s}px`;let c=this.regionBox.querySelector(".bt-region-badge");c||(c=document.createElement("div"),c.className="bt-region-badge",this.regionBox.appendChild(c)),c.textContent=`Region: ${Math.round(l)} \xD7 ${Math.round(s)} px`},this.regionOverlay.onmouseup=r=>{if(!this.isDraggingRegion)return;this.isDraggingRegion=!1;let n=r.clientX,o=r.clientY,i=Math.min(this.dragStartX,n),a=Math.min(this.dragStartY,o),l=Math.abs(n-this.dragStartX),s=Math.abs(o-this.dragStartY);l>20&&s>20?(this.selectedRegion={x:Math.round(i),y:Math.round(a),width:Math.round(l),height:Math.round(s)},this.hideRegionOverlay(),this.setMode("idle"),this.openRegionNoteEditor(this.selectedRegion)):(this.hideRegionOverlay(),this.setMode("idle"))}),t.appendChild(this.regionOverlay))}hideRegionOverlay(){this.regionOverlay&&this.regionOverlay.parentElement&&this.regionOverlay.parentElement.removeChild(this.regionOverlay),this.regionBox&&(this.regionBox.style.display="none")}updateHighlight(t){if(!this.ensureContainer()||!this.highlightOverlay)return;let n=t.getBoundingClientRect();this.highlightOverlay.style.display="block",this.highlightOverlay.style.top=`${n.top}px`,this.highlightOverlay.style.left=`${n.left}px`,this.highlightOverlay.style.width=`${n.width}px`,this.highlightOverlay.style.height=`${n.height}px`;let i=`${ge(t)} \xB7 ${Math.round(n.width)}\xD7${Math.round(n.height)}`,a=this.highlightOverlay.querySelector(".bt-badge");a||(a=document.createElement("div"),a.className="bt-badge",this.highlightOverlay.appendChild(a)),a.textContent=i}hideHighlight(){this.highlightOverlay&&(this.highlightOverlay.style.display="none")}openNoteEditor(t,r="element"){if(!this.ensureContainer())return;let o=t||document.body;this.selectedElement=o,r==="element"&&this.updateHighlight(o),this.renderNoteModal({title:"\u{1F4DD} Add Visual Note",modeBadge:r.toUpperCase(),pillText:r==="page"?`Page Viewport: ${window.innerWidth} \xD7 ${window.innerHeight} px`:`${ge(o)} (${Math.round(o.getBoundingClientRect().width)}\xD7${Math.round(o.getBoundingClientRect().height)}) \xB7 Viewport: ${window.innerWidth}\xD7${window.innerHeight}`,onSave:async i=>{await this.saveVisualNote(o,i,r)}})}openRegionNoteEditor(t){this.renderNoteModal({title:"\u{1F4DD} Add Region Note",modeBadge:"REGION",pillText:`Selected Area: x:${t.x}, y:${t.y} (${t.width} \xD7 ${t.height} px)`,onSave:async r=>{await this.saveRegionVisualNote(t,r)}})}renderNoteModal(t){let r=this.ensureContainer();if(!r)return;this.modalOverlay&&this.modalOverlay.parentElement&&(this.modalOverlay.parentElement.removeChild(this.modalOverlay),this.modalOverlay=null);let n=document.createElement("div");n.className="bt-modal-backdrop",this.modalOverlay=n,n.innerHTML=`
|
|
292
|
+
<div class="bt-modal">
|
|
293
|
+
<div class="bt-modal-header">
|
|
294
|
+
<div class="bt-modal-title">
|
|
295
|
+
<span>${t.title}</span>
|
|
296
|
+
<span class="bt-mode-badge">${t.modeBadge}</span>
|
|
297
|
+
</div>
|
|
298
|
+
<button class="bt-close-btn" id="btn-close" title="Close">\u2715</button>
|
|
299
|
+
</div>
|
|
300
|
+
<div class="bt-target-pill" title="${t.pillText}">
|
|
301
|
+
\u{1F3AF} ${t.pillText}
|
|
302
|
+
</div>
|
|
303
|
+
<textarea class="bt-textarea" placeholder="Describe the layout issue, styling bug, or note for AI agent..." autofocus></textarea>
|
|
304
|
+
<div class="bt-modal-actions">
|
|
305
|
+
<button class="bt-btn bt-btn-cancel" id="btn-cancel">Cancel</button>
|
|
306
|
+
<button class="bt-btn bt-btn-save" id="btn-save">Save Note</button>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
`;let o=n.querySelector("textarea"),i=n.querySelector("#btn-close"),a=n.querySelector("#btn-cancel"),l=n.querySelector("#btn-save"),s=()=>{this.modalOverlay&&(r.removeChild(this.modalOverlay),this.modalOverlay=null,this.hideHighlight(),this.hideRegionOverlay())};i.onclick=s,a.onclick=s,n.onclick=u=>{u.target===n&&s()};let c=async()=>{let u=o.value.trim();if(u){l.textContent="Saving...",l.disabled=!0;try{await t.onSave(u)}finally{s()}}};l.onclick=c,o.onkeydown=u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey||!u.shiftKey)&&(u.preventDefault(),c()),u.key==="Escape"&&s()},r.appendChild(n),setTimeout(()=>o?.focus(),50)}async saveVisualNote(t,r,n="element"){let o=t.getBoundingClientRect(),i=n==="page"?"body":ge(t),a;try{let u=await this.screenshotDriver.captureElement(t);u.ok&&(a=u.dataUrl)}catch{}let l=this.extractElementContext(t),s={selector:i,boundingRect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height),top:Math.round(o.top),left:Math.round(o.left),bottom:Math.round(o.bottom),right:Math.round(o.right)},visible:o.width>0&&o.height>0,confidence:i.startsWith("[data-test")?"high":i.startsWith("#")?"medium":"low"},c={type:"create_note",sessionId:this.transport.getSessionId()||"",noteType:n,message:r,route:window.location.pathname+window.location.search,url:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1},scroll:{scrollX:window.scrollX,scrollY:window.scrollY},target:s,elementContext:l,screenshot:a,timestamp:Date.now()};this.transport.send(c),this.options.onNoteCreated&&this.options.onNoteCreated(c)}async saveRegionVisualNote(t,r){let n;try{let i=await this.screenshotDriver.captureElement(document.body||document.documentElement);i.ok&&i.dataUrl&&(n=await this.cropDataUrl(i.dataUrl,t))}catch{}let o={type:"create_note",sessionId:this.transport.getSessionId()||"",noteType:"region",message:r,route:window.location.pathname+window.location.search,url:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1},scroll:{scrollX:window.scrollX,scrollY:window.scrollY},region:t,screenshot:n,timestamp:Date.now()};this.transport.send(o),this.options.onNoteCreated&&this.options.onNoteCreated(o)}async cropDataUrl(t,r){return new Promise(n=>{let o=new Image;o.onload=()=>{try{let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let a=i.getContext("2d");if(!a){n(t);return}let l=window.devicePixelRatio||1;a.drawImage(o,r.x*l,r.y*l,r.width*l,r.height*l,0,0,r.width,r.height),n(i.toDataURL("image/webp",.9))}catch{n(t)}},o.onerror=()=>n(t),o.src=t})}extractElementContext(t){let r=ge(t),n=t.tagName.toLowerCase(),o={};for(let l=0;l<t.attributes.length;l++){let s=t.attributes[l];s.name==="value"&&t.type==="password"?o[s.name]="[REDACTED]":o[s.name]=s.value}let i="";try{let l=t.cloneNode(!0);for(let s of Array.from(l.querySelectorAll('input[type="password"]')))s.setAttribute("value","[REDACTED]");i=Me(l.outerHTML,10240)}catch{i=Me(t.outerHTML,10240)}let a;return t.parentElement&&t.parentElement!==document.body&&(a={selector:ge(t.parentElement),tag:t.parentElement.tagName.toLowerCase()}),{selector:r,tag:n,attributes:o,outerHTML:i,innerText:Me(t.textContent?.trim(),200),parent:a}}destroy(){for(let t of this.cleanups)try{t()}catch{}this.cleanups=[],this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container),this.container=null,this.shadowRoot=null,this.toolbarElement=null}};var ze=class{constructor(t={}){L(this,"options");L(this,"breadcrumbs");L(this,"transport");L(this,"screenshotDriver");L(this,"commandHandler");L(this,"inspector");L(this,"lastElement");L(this,"currentRoute","/");L(this,"cleanups",[]);L(this,"isInitialized",!1);this.options={...ot,...t,notes:{...ot.notes,...t.notes||{}}},this.breadcrumbs=new Pe(this.options.maxBreadcrumbs),this.transport=new Lt({url:this.options.daemonUrl,projectId:this.options.projectId,debug:this.options.debug}),this.screenshotDriver=new Ue,this.commandHandler=new nt(this.screenshotDriver),this.transport.setCommandHandler(this.commandHandler),this.options.notes.enabled&&(this.inspector=new qe(this.transport,this.screenshotDriver,{shortcut:this.options.notes.shortcut,maskSelectors:this.options.notes.maskSelectors}))}init(){if(this.isInitialized||typeof window>"u")return this;this.isInitialized=!0;try{this.currentRoute=window.location.pathname+window.location.search}catch{this.currentRoute="/"}if(this.transport.connect(),this.options.captureErrors){let t=Ar(async r=>{await this.handleRuntimeError(r)});this.cleanups.push(t)}if(this.options.captureConsole){let t=kr(async r=>{await this.handleConsole(r)});this.cleanups.push(t)}if(this.options.captureNetwork){let t=$r(r=>{this.handleNetwork(r)});this.cleanups.push(t)}if(this.options.captureNavigation){let t=Er(r=>{this.handleNavigation(r)});this.cleanups.push(t)}if(this.options.captureInteractions){let t=Mr((r,n)=>{n&&(this.lastElement=n),this.breadcrumbs.add(r)});this.cleanups.push(t)}return this.inspector&&this.inspector.init(),this}openNoteEditor(t,r="element"){this.inspector&&this.inspector.openNoteEditor(t,r)}startRegionSelection(){this.inspector&&this.inspector.setMode("region")}startElementSelection(){this.inspector&&this.inspector.setMode("element")}setInspectMode(t){this.inspector&&this.inspector.setMode(t)}async createNote(t,r,n="element"){this.inspector&&await this.inspector.saveVisualNote(t,r,n)}async handleRuntimeError(t){this.breadcrumbs.add({type:"error",category:"runtime",message:`${t.errorType}: ${t.message}`,timestamp:t.timestamp,level:"error",data:{filename:t.filename,lineno:t.lineno,colno:t.colno}});let r;if(this.options.onErrorScreenshot&&this.lastElement?.selector)try{let n=await this.screenshotDriver.captureSelector(this.lastElement.selector);n.ok&&(r=n.dataUrl)}catch{}this.sendEvent("runtime_error",t,r)}async handleConsole(t){this.breadcrumbs.add({type:"console",category:"console",message:`console.${t.level}: ${t.message}`,timestamp:t.timestamp,level:t.level==="error"?"error":t.level==="warn"?"warn":"info"}),(t.level==="error"||t.level==="warn")&&this.sendEvent("console",t)}handleNetwork(t){let r=t.status&&t.status>=400||!!t.error,n=`${t.method} ${t.url} -> ${t.status||"ERR"} (${t.durationMs}ms)`;this.breadcrumbs.add({type:t.id?.startsWith("xhr")?"xhr":"fetch",category:"network",message:n,timestamp:t.timestamp,level:r?"error":"info",data:{status:t.status,durationMs:t.durationMs,error:t.error,aborted:t.aborted}}),this.sendEvent("fetch",t)}handleNavigation(t){this.currentRoute=t.to,this.breadcrumbs.add({type:"navigation",category:"navigation",message:`navigate ${t.to} (${t.type})`,timestamp:t.timestamp,level:"info",data:{from:t.from,to:t.to,type:t.type}}),this.sendEvent("navigation",t)}sendEvent(t,r,n){if(typeof window>"u")return;let o={type:"event",sessionId:this.transport.getSessionId()||"",eventType:t,payload:r,breadcrumbs:this.breadcrumbs.getRecent(),lastElement:this.lastElement,route:this.currentRoute,url:window.location.href,title:document.title,timestamp:Date.now(),screenshot:n};this.transport.send(o)}getBreadcrumbs(){return this.breadcrumbs.getRecent()}getLastElement(){return this.lastElement}destroy(){for(let t of this.cleanups)try{t()}catch{}this.cleanups=[],this.transport.destroy(),this.inspector&&this.inspector.destroy(),this.breadcrumbs.clear(),this.isInitialized=!1}};var Fe=null;function fr(e={}){return Fe||(Fe=new ze(e),Fe.init(),Fe)}function no(){return Fe}if(typeof window<"u"){window.__BROWSERTRACK__={init:fr,getClient:no};try{let e=document.currentScript,t=e?.getAttribute("data-auto-init")!=="false",r=e?.getAttribute("data-daemon-url")||void 0,n=e?.getAttribute("data-project-id")||void 0;t&&fr({daemonUrl:r,projectId:n})}catch{}}return So(fs);})();
|