browsertrack 0.2.0 → 0.2.1
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/AGENTS.md +2 -0
- package/dist/{chunk-UP5JKCFY.js → chunk-464D4U2U.js} +3 -2
- package/dist/chunk-464D4U2U.js.map +1 -0
- package/dist/{chunk-WB7ZKWK7.js → chunk-INXDWPJW.js} +354 -9
- package/dist/chunk-INXDWPJW.js.map +1 -0
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/client/index.cjs +357 -10
- package/dist/client/index.d.ts +36 -4
- package/dist/client/index.js +7 -3
- package/dist/client.iife.js +42 -19
- package/dist/{notes-BMnonq46.d.ts → commands-fjuqKzkm.d.ts} +125 -114
- package/dist/core/index.d.ts +2 -2
- package/dist/daemon/index.d.ts +3 -3
- package/dist/{engine-B43IohQY.d.ts → engine-CmchnMDq.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/mcp/index.d.ts +4 -4
- package/dist/mcp/index.js +1 -1
- package/dist/{projects-D5J-egVN.d.ts → projects-DB7S312i.d.ts} +1 -1
- package/dist/{server-BztYp1Zc.d.ts → server-DiVmTrIR.d.ts} +1 -1
- package/docs/component-resolver.md +108 -0
- package/docs/index.md +1 -0
- package/docs/mcp-reference.md +2 -2
- package/docs/visual-notes.md +36 -0
- package/package.json +1 -1
- package/packages/client/src/client.ts +18 -1
- package/packages/client/src/config.ts +84 -1
- package/packages/client/src/index.ts +4 -1
- package/packages/client/src/interceptors/interaction.ts +3 -0
- package/packages/client/src/notes/inspector.ts +107 -5
- package/packages/client/src/source/resolver.ts +272 -0
- package/packages/core/src/types/events.ts +3 -0
- package/packages/core/src/types/notes.ts +11 -0
- package/packages/mcp/src/handlers.ts +1 -0
- package/test/client/component-resolver.test.ts +141 -0
- package/test/client/interceptors.test.ts +56 -0
- package/dist/chunk-UP5JKCFY.js.map +0 -1
- package/dist/chunk-WB7ZKWK7.js.map +0 -1
package/dist/client.iife.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";var BrowserTrack=(()=>{var tt=Object.defineProperty;var mi=Object.getOwnPropertyDescriptor;var gi=Object.getOwnPropertyNames;var bi=Object.prototype.hasOwnProperty;var yi=(e,t,r)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var wi=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},xi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gi(t))!bi.call(e,i)&&i!==r&&tt(e,i,{get:()=>t[i],enumerable:!(n=mi(t,i))||n.enumerable});return e};var vi=e=>xi(tt({},"__esModule",{value:!0}),e);var N=(e,t,r)=>yi(e,typeof t!="symbol"?t+"":t,r);var hl={};wi(hl,{BreadcrumbBuffer:()=>Pe,BrowserScriptScreenshotDriver:()=>Ue,BrowserTrackClient:()=>ze,DEFAULT_OPTIONS:()=>it,NoteInspector:()=>qe,getClient:()=>ni,init:()=>hr});var Pe=class{constructor(t=50){N(this,"capacity");N(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 rt="[REDACTED]",Si=[/^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],kr=["token","auth","key","apikey","api_key","secret","password","access_token","refresh_token","code","signature"];function ki(e){if(!e)return!1;let t=e.replace(/[-_]/g,"");return Si.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),i=!1;for(let a of kr)n.searchParams.has(a)&&(n.searchParams.set(a,rt),i=!0);for(let a of Array.from(n.searchParams.keys()))ki(a)&&(n.searchParams.set(a,rt),i=!0);if(!i)return e;let o=t?n.pathname+n.search+n.hash:n.toString();return o=o.replace(/%5BREDACTED%5D/g,rt),o}catch{let t=e;for(let r of kr){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 i=e.id;if(i&&!/^[0-9]+$/.test(i)&&!/[0-9a-f]{8}-[0-9a-f]{4}/i.test(i))return`#${i}`;let o=e.getAttribute("aria-label");if(o&&o.length<30)return`${e.tagName.toLowerCase()}[aria-label="${o}"]`;let a=e.getAttribute("name");if(a)return`${e.tagName.toLowerCase()}[name="${a}"]`;let s=e.tagName.toLowerCase(),l=Array.from(e.classList||[]).filter(c=>!c.startsWith("css-")&&!c.startsWith("_")&&!/^[a-z0-9]{5,}$/i.test(c)).slice(0,r);if(l.length>0){let c=l.map(d=>`.${d}`).join("");return`${s}${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} > ${s}`}return s}function Ce(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,i=Array.from(e.classList||[]),o,a=!0;try{let c=e.getBoundingClientRect();o={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 d=window.getComputedStyle(e);a=d.display!=="none"&&d.visibility!=="hidden"&&d.opacity!=="0"&&c.width>0&&c.height>0}catch{}let s;r!=="input"&&r!=="textarea"&&r!=="select"&&(s=Ce(e.textContent?.trim(),80));let l=Ce(e.outerHTML?.trim(),200);return{selector:t,tag:r,id:n,classes:i,boundingRect:o,visible:a,innerText:s,outerHTML:l}}function Cr(e){if(typeof document>"u")return()=>{};let t=n=>{try{let i=n.target;if(!i||!(i instanceof Element))return;let o=Ie(i),a=`click ${o.selector}${o.innerText?` ("${o.innerText}")`:""}`;e({type:"click",category:"ui",message:a,timestamp:Date.now(),element:o},o)}catch{}},r=n=>{try{let i=n.target;if(!i||!(i instanceof Element))return;let o=Ie(i),a=i.getAttribute("action")||"",s=`submit form ${o.selector}${a?` (action: ${a})`:""}`;e({type:"submit",category:"ui",message:s,timestamp:Date.now(),element:o},o)}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){N(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 i=Ie(n);return{id:t.id,ok:!0,result:{exists:!0,visible:i.visible,tag:i.tag,id:i.id,classes:i.classes,boundingRect:i.boundingRect,innerText:i.innerText,outerHTML:i.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 i=await this.screenshotDriver.captureElement(n);return i.ok?{id:t.id,ok:!0,result:{dataUrl:i.dataUrl,format:i.format,width:i.width,height:i.height}}:{id:t.id,ok:!1,reason:i.reason||"CAPTURE_FAILED",error:i.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 i=n.getBoundingClientRect(),o=window.innerWidth,a=window.innerHeight,s=Math.max(0,Math.round(i.right-o)),l=Math.max(0,Math.round(i.bottom-a)),c=s>0||i.left<0,d=!1;return n.parentElement&&(d=n.parentElement.scrollWidth>n.parentElement.clientWidth),{id:t.id,ok:!0,result:{selector:r,overflow:c||d,viewportWidth:o,viewportHeight:a,rect:{x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),top:Math.round(i.top),left:Math.round(i.left),bottom:Math.round(i.bottom),right:Math.round(i.right)},overflowRightPx:s,overflowBottomPx:l,parentOverflow:d}}}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 i=n.getBoundingClientRect();return{id:t.id,ok:!0,result:{x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),top:Math.round(i.top),left:Math.round(i.left),bottom:Math.round(i.bottom),right:Math.round(i.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 i=window.getComputedStyle(n),o=t.params?.properties||["overflow","overflowX","overflowY","width","maxWidth","display","position"],a={};for(let s of o)a[s]=i.getPropertyValue(s)||i[s]||"";return{id:t.id,ok:!0,result:{selector:r,styles:a}}}};var it={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 Mr(e){if(typeof console>"u")return()=>{};let t=console.error,r=console.warn;function n(i){return i.map(o=>{if(o instanceof Error)return o.stack||`${o.name}: ${o.message}`;if(typeof o=="object"&&o!==null)try{return JSON.stringify(o)}catch{return String(o)}return String(o)}).join(" ")}return console.error=function(...i){try{let o=n(i),a=new Error().stack;e({level:"error",message:o,stack:a,timestamp:Date.now()})}catch{}return t.apply(console,i)},console.warn=function(...i){try{let o=n(i),a=new Error().stack;e({level:"warn",message:o,stack:a,timestamp:Date.now()})}catch{}return r.apply(console,i)},()=>{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,s,l){let c=t,d=r.apply(history,[a,s,l]);try{let u=me(window.location.href);t=u,e({from:c,to:u,type:"pushState",timestamp:Date.now()})}catch{}return d},history.replaceState=function(a,s,l){let c=t,d=n.apply(history,[a,s,l]);try{let u=me(window.location.href);t=u,e({from:c,to:u,type:"replaceState",timestamp:Date.now()})}catch{}return d};let i=()=>{let a=t,s=me(window.location.href);t=s,e({from:a,to:s,type:"popstate",timestamp:Date.now()})},o=()=>{let a=t,s=me(window.location.href);t=s,e({from:a,to:s,type:"hashchange",timestamp:Date.now()})};return window.addEventListener("popstate",i),window.addEventListener("hashchange",o),()=>{history.pushState=r,history.replaceState=n,window.removeEventListener("popstate",i),window.removeEventListener("hashchange",o)}}function $r(e){let t=[];if(typeof window<"u"&&typeof window.fetch=="function"){let r=window.fetch;window.fetch=async function(n,i){let o=Date.now(),a="",s="GET";try{typeof n=="string"?a=n:n instanceof URL?a=n.toString():n&&typeof n=="object"&&"url"in n&&(a=n.url,s=n.method||"GET"),i&&i.method&&(s=i.method.toUpperCase())}catch{a="unknown_url"}let l=me(a);try{let c=await r.apply(window,[n,i]),d=Date.now()-o;return e({url:l,method:s,status:c.status,statusText:c.statusText,durationMs:d,timestamp:o}),c}catch(c){let d=Date.now()-o,u=c?.name==="AbortError";throw e({url:l,method:s,durationMs:d,error:c?.message||"Network request failed",aborted:u,timestamp:o}),c}},t.push(()=>{window.fetch=r})}if(typeof window<"u"&&typeof window.XMLHttpRequest=="function"){let r=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.send,i=XMLHttpRequest.prototype.abort,o=new WeakMap;XMLHttpRequest.prototype.open=function(...a){try{let s=String(a[0]||"GET").toUpperCase(),l=String(a[1]||"");o.set(this,{url:me(l),method:s,startTime:Date.now()})}catch{}return r.apply(this,a)},XMLHttpRequest.prototype.abort=function(){let a=o.get(this);return a&&(a.aborted=!0),i.apply(this)},XMLHttpRequest.prototype.send=function(a){let s=o.get(this)||{url:"unknown_url",method:"GET",startTime:Date.now()},l=()=>{try{let d=Date.now()-s.startTime;e({url:s.url,method:s.method,status:this.status,statusText:this.statusText,durationMs:d,aborted:s.aborted,timestamp:s.startTime})}catch{}},c=()=>{try{let d=Date.now()-s.startTime;e({url:s.url,method:s.method,status:this.status||0,durationMs:d,error:"XHR Network Error",aborted:s.aborted,timestamp:s.startTime})}catch{}};return this.addEventListener("load",l,{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=i})}return()=>{for(let r of t)try{r()}catch{}}}function Ar(e){if(typeof window>"u")return()=>{};let t=n=>{try{let i={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(i,n.error)}catch{}},r=n=>{try{let i=n.reason,o="Unhandled Promise Rejection",a,s="UnhandledRejection";if(i instanceof Error)o=i.message,a=i.stack,s=i.name||"UnhandledRejection";else if(typeof i=="string")o=i;else if(i&&typeof i=="object")try{o=JSON.stringify(i)}catch{o=String(i)}let l={message:o,stack:a,errorType:s,timestamp:Date.now()};e(l,i)}catch{}};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",r)}}var Ci=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)Ci(e,r,{get:t[r],enumerable:!0})};function Mi(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 Ei(e="soft"){switch(e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.measureHints=new WeakMap,C.baseStyle=new re(50),C.defaultStyle=new re(30),C.image=new re(100),C.background=new re(100),C.resource=new re(150),C.compress=new re(50),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var re,C,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)}},C={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 i of r[1].split(",")){let o=i.match(/url\((['"]?)(.*?)(\1)\)/);if(!o)continue;let a=i.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!dn.test(a[1].trim()))continue;let s=i.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),l=1;if(s){let c=parseFloat(s[1]);l=/dpi/i.test(s[2])?c/96:c}n.push({url:o[2].trim(),dppx:l})}return n.length?(n.sort((i,o)=>i.dppx-o.dppx),(n.find(i=>i.dppx>=t)||n[n.length-1]).url):null}function $i(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(r,n)=>{let i=n.split(",").map(o=>o.trim());return i.length!==6?`matrix(${n})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(r,n)=>{let i=n.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${n})`:(i[12]="0",i[13]="0",`matrix3d(${i.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 Ai(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 dn,Et=ae(()=>{"use strict";dn=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function Ri(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:r=12}={}){let n=new Map,i=0;function o(a,s,l){if(i>=r)return;let c=Date.now();(n.get(s)||0)>c||(n.set(s,c+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,s){o("warn",a,s)},errorOnce(a,s){o("error",a,s)},reset(){n.clear(),i=0}}}function Ni(e){return/^data:|^blob:|^about:blank$/i.test(e)}function Ti(e,t){try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=t.includes("{url}")?t.split("{url}")[0]:t,i=new URL(n||".",r),o=new URL(e,r);if(o.origin===i.origin)return!0;let a=o.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function Li(e,t){if(!t||Ni(e)||Ti(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 Fi(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 Pi(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function le(e,t={}){let r=t.as??"blob",n=t.timeout??3e3,i=t.useProxy||"",o=t.errorTTL??8e3,a=t.headers||{},s=!!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[,g="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(g)?atob(y):decodeURIComponent(y),v=new Uint8Array([...x].map(w=>w.charCodeAt(0))),b=new Blob([v],{type:(g||"").split(";")[0]||""});return{ok:!0,data:b,status:200,url:e,fromCache:!1,mime:b.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let g=await fetch(e);if(!g.ok)return{ok:!1,data:null,status:g.status,url:e,fromCache:!1,reason:"http_error"};let y=await g.blob(),x=y.type||g.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Rr(y),status:g.status,url:e,fromCache:!1,mime:x}:r==="text"?{ok:!0,data:await y.text(),status:g.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:g.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 l=Pi(e,{as:r,timeout:n,useProxy:i,errorTTL:o}),c=De.get(l);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&De.delete(l);let d=dt.get(l);if(d)return d;let u=Li(e,i)?Fi(e,i):e,p=t.credentials;if(!p)try{let g=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,g);p=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,f=setTimeout(()=>h.abort("timeout"),n),m=(async()=>{try{let g=await fetch(u,{signal:h.signal,credentials:p,headers:a});if(!g.ok){let v={ok:!1,data:null,status:g.status,url:u,fromCache:!1,reason:"http_error"};if(o>0&&De.set(l,{until:Date.now()+o,result:v}),!s){let b=`${g.status} ${g.statusText||""}`.trim();Wt.warnOnce(`http:${g.status}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${b} while fetching ${r} ${e}`)}return t.onError&&t.onError(v),v}if(r==="text")return{ok:!0,data:await g.text(),status:g.status,url:u,fromCache:!1};let y=await g.blob(),x=y.type||g.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Rr(y),status:g.status,url:u,fromCache:!1,mime:x}:{ok:!0,data:y,status:g.status,url:u,fromCache:!1,mime:x}}catch(g){let y=g&&typeof g=="object"&&"name"in g&&g.name==="AbortError"?String(g.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:u,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&De.set(l,{until:Date.now()+o,result:x}),!s){let v=`${y}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,b=y==="timeout"?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${r} ${e}`:`Network/CORS issue while fetching ${r} ${e}. A proxy may be required`;Wt.errorOnce(v,b)}return t.onError&&t.onError(x),x}finally{clearTimeout(f),dt.delete(l)}})();return dt.set(l,m),m}var Wt,dt,De,$e=ae(()=>{"use strict";Et(),Wt=Ri("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),dt=new Map,De=new Map});async function un(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=Ai(r),i=xt(n),o=(t.useProxy||"")+"|"+i;if(C.background.has(o)){let a=C.background.get(o);return a?`url("${a}")`:"none"}try{let a=await le(i,{as:"dataURL",useProxy:t.useProxy});return a.ok?(C.background.set(o,a.data),`url("${a.data}")`):(C.background.set(o,null),"none")}catch{return C.background.set(o,null),"none"}}var Ii=ae(()=>{"use strict";ne(),Et(),$e()});function pn(e){if(e=String(e).toLowerCase(),or.has(e)){let o={};return C.defaultStyle.set(e,o),o}if(C.defaultStyle.has(e))return C.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let r=document.createElement(e);r.style.all="initial",t.appendChild(r);let n=getComputedStyle(r),i={};for(let o of n){if(ir(o))continue;let a=n.getPropertyValue(o);i[o]=a}return t.removeChild(r),C.defaultStyle.set(e,i),i}function ir(e){let t=_t.get(e);if(t===void 0){let r=String(e).toLowerCase();t=bn.has(r)||gn.test(r)||mn.test(r),_t.set(e,t)}return t}function hn(e,t){return!wn.has(e)&&(t==="inline"||yn.has(e)||ar.has(e))}function Oi(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 i=(t.position||"static").toLowerCase();return i==="absolute"||i==="fixed"?!1:!kn.has(n)}function Ht(e,t,r=!0,n=!1){if(t=String(t||"").toLowerCase(),or.has(t))return"";let i=[],o=pn(t),a=(e.display||"").toLowerCase(),s=a==="inline",l=hn(t,a),c=e["text-wrap-mode"]||e["white-space"]||"",d=c==="nowrap"||c==="pre",u=l&&r&&!(l&&r&&!s&&d),p=!1;for(let h in e){if(ir(h))continue;let f=e[h];if(u){if(xn.has(h))continue;if(vn.has(h)){f&&f!==o[h]&&(i.push(`${h}:${f}`),f!=="auto"&&(p=!0));continue}}if(f&&f!==o[h]){if(!d&&(h==="width"||h==="inline-size")&&f.endsWith("px")&&f.includes(".")){let m=parseFloat(f);if(Number.isFinite(m)){i.push(`${h}:${(m+Sn).toFixed(3)}px`);continue}}i.push(`${h}:${f}`)}}if(u&&!s&&!n&&!p){let h=e.width;h&&h!=="auto"&&h!==o.width&&i.push(`min-width:${h}`)}return i.sort(),i.join(";")}function Di(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 Wi(e){let t=new Map;for(let n of e){let i=pn(n);if(!i)continue;let o=Object.entries(i).map(([a,s])=>`${a}:${s};`).sort().join("");o&&(t.has(o)||t.set(o,[]),t.get(o).push(n))}let r="";for(let[n,i]of t.entries())r+=`${i.join(",")} { ${n} }
|
|
2
|
-
`;return r}function Hi(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),r=new Map,n=1;for(let i of t)r.set(i,`c${n++}`);return r}function Bi(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 o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(e?.nodeType!==1){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(e,t)||r()}catch{return r()}return r()}let n=C.computedStyle.get(e);n||(n=new Map,C.computedStyle.set(e,n));let i=n.get(t);if(!i){let o=Bi(e),a=null;try{a=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}i=a||r(),n.set(t,i)}return i}function Nr(e){let t={};for(let r of e)t[r]=e.getPropertyValue(r);for(let r of Cn){let n=t[`border-${r}-style`],i=t[`border-${r}-width`];(n==="none"||n==="hidden"||i==="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 i=0;i<e.length;i++){let o=e[i];o==="("&&r++,o===")"&&r--,o===","&&r===0&&(t.push(e.slice(n,i).trim()),n=i+1)}return t.push(e.slice(n).trim()),t}var fn,or,_i,mn,gn,bn,_t,yn,ar,wn,xn,vn,Sn,kn,Cn,$t=ae(()=>{"use strict";ne(),fn=new Set(["meta","script","noscript","title","link","template"]),or=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"]),_i=["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,bn=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,yn=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,kn=new Set(["inline-block","inline-flex","inline-grid","inline-table","inline-flow-root","table"]),Cn=["top","right","bottom","left"]});function ut(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function Me(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 ji(){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),i=/mobile/i.test(e),o=!/safari/i.test(e),a=n&&i&&o,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),c=/ipad|iphone|ipod/.test(t)&&n;return r||a||s||l||c}function Ui(){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 Mn=ae(()=>{"use strict"}),de=ae(()=>{"use strict";Ii(),$t(),Ae(),Et(),Mn()}),En={};_e(En,{decodeSvgFromDataURL:()=>sr,encodeSvgToDataURL:()=>lr,fixSafariShadows:()=>cr,toCanvas:()=>At});function qi(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]),i=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0)return e;let o=Math.min(1,ye/n,ye/i,Math.sqrt(vt/(n*i)));if(o>=1)return e;let a=Math.max(1,Math.floor(n*o)),s=Math.max(1,Math.floor(i*o));return console.warn(`[snapDOM] Capture ${Math.round(n)}\xD7${Math.round(i)}px exceeds the browser image-decode limit (${ye}px/side); downscaling to ${a}\xD7${s}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${s}`))}catch{return e}}function zi(e,t){let r=["x","y","width","height"].map(S=>Number(t?.[S]));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 i=n[0],o=(i.match(/\bviewBox="([^"]+)"/i)||[])[1],a=String(o||"").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[s,l,c,d]=a,u=Math.max(s,r[0]),p=Math.max(l,r[1]),h=Math.min(s+c,r[0]+r[2]),f=Math.min(l+d,r[1]+r[3]);if(!(h>u)||!(f>p))throw new RangeError("[snapdom] canvas crop does not intersect the SVG viewBox");let m=parseFloat((i.match(/\bwidth="([\d.]+)/i)||[])[1]),g=parseFloat((i.match(/\bheight="([\d.]+)/i)||[])[1]),y=Number.isFinite(m)&&m>0?m/c:1,x=Number.isFinite(g)&&g>0?g/d:1,v=Math.max(1,(h-u)*y),b=Math.max(1,(f-p)*x),w=i.replace(/(\bwidth=")[^"]*/i,`$1${v}`).replace(/(\bheight=")[^"]*/i,`$1${b}`).replace(/(\bviewBox=")[^"]*/i,`$1${u} ${p} ${h-u} ${f-p}`);return e.replace(i,w)}function Tr(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function sr(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function Vi(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 lr(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function $n(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&n++,o===")"&&(n=Math.max(0,n-1)),o===";"&&n===0?(t.push(r),r=""):r+=o}return r.trim()&&t.push(r),t.map(i=>i.trim()).filter(Boolean)}function Xi(e){let t=[],r="",n=0;for(let o=0;o<e.length;o++){let a=e[o];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 i=[];for(let o of t){if(/\binset\b/i.test(o))continue;let a=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[s="0px",l="0px",c="0px"]=a;c=`${parseFloat(c)/2}px`;let d=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),u=!!d&&d!==",";i.push(`drop-shadow(${s} ${l} ${c}${u?` ${d}`:""})`)}return i.join(" ")}function An(e){let t=$n(e),r=null,n=null,i=null,o=[];for(let s of t){let l=s.indexOf(":");if(l<0)continue;let c=s.slice(0,l).trim().toLowerCase(),d=s.slice(l+1).trim();c==="box-shadow"?i=d:c==="filter"?r=d:c==="-webkit-filter"?n=d:o.push([c,d])}if(i){let s=Xi(i);s&&(r=r?`${r} ${s}`:s,n=n?`${n} ${s}`:s)}let a=[...o];return r&&a.push(["filter",r]),n&&a.push(["-webkit-filter",n]),a.map(([s,l])=>`${s}:${l}`).join(";")}function Yi(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,r,n)=>`${r}{${An(n)}}`)}function Gi(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,r)=>t.replace(r,Yi(r))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,r,n)=>`style=${r}${An(n)}${r}`),e}function Ki(){return pt||(pt=(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 i=n.getImageData(2,18,1,1).data[3]>128,o=n.getImageData(2,2,1,1).data[3]>128;return{native:i||o,flippedY:o&&!i}}catch{return{native:!1,flippedY:!1}}})(),pt)}function Qi(e){let t=[],r=0,n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r++:o===")"?r=Math.max(0,r-1):o===","&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t.map(i=>{let o=0,a=0,s="",l=0;for(;l<i.length;){let c=i[l];if(c==="("?o++:c===")"&&(o=Math.max(0,o-1)),o===0&&(l===0||i[l-1]===" ")){let d=/^-?\d*\.?\d+px/.exec(i.slice(l));if(d){a++,s+=a===2?`${-parseFloat(d[0])}px`:d[0],l+=d[0].length;continue}}s+=c,l++}return s}).join(",")}function Ji(e,t){let r=n=>$n(n).map(i=>{let o=i.indexOf(":");if(o<0)return i;let a=i.slice(0,o).trim().toLowerCase();return a==="text-shadow"||t&&a==="box-shadow"?`${a}:${Qi(i.slice(o+1))}`:i}).join(";");return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(n,i)=>n.replace(i,i.replace(/([^{}]+)\{([^}]*)\}/g,(o,a,s)=>`${a}{${r(s)}}`))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(n,i,o)=>`style=${i}${r(o)}${i}`),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 Ki();try{let n=e;return t||(n=Gi(n)),r&&(n=Ji(n,t)),{svg:n,naturalOnly:!0}}catch{return{svg:e,naturalOnly:!0}}}async function Zi(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)}),i=r.getContext("2d",{willReadFrequently:!0});if(!i){await n(),await n();return}let o=performance.now()+(t?600:150);for(;;){i.clearRect(0,0,16,16);try{i.drawImage(e,0,0,16,16)}catch{return}let a=i.getImageData(0,0,16,16).data,s=!1;for(let l=3;l<a.length;l+=4)if(a[l]>0){s=!0;break}if(s||performance.now()>o)return;await n()}}finally{try{e.remove()}catch{}}}async function At(e,t){let{width:r,height:n,scale:i=1,dpr:o=1,meta:a={},backgroundColor:s,crop:l=null}=t,c=e,d=!1,u=!1;if(l&&!Tr(e))throw new RangeError("[snapdom] canvas crop requires an SVG capture payload");if(Tr(e)){let $=(Vi(e).match(/<svg\b[^>]*>/i)||[])[0]||"",R=parseFloat(($.match(/\bwidth="([\d.]+)/i)||[])[1]),L=parseFloat(($.match(/\bheight="([\d.]+)/i)||[])[1]),D=Number.isFinite(R)&&Number.isFinite(L)&&R>0&&L>0&&Math.min(1,ye/R,ye/L,Math.sqrt(vt/(R*L)))<1;if(l||D||we())try{let F=sr(e);if(l&&(F=zi(F,l)),we()){let I=await cr(F);F=I.svg,d=I.naturalOnly,u=/@font-face|data:image\//i.test(F)}(D||l)&&(F=qi(F)),c=lr(F)}catch(F){if(l)throw F;c=e}}let p=new Image;p.loading="eager",p.decoding="sync",p.crossOrigin="anonymous",p.src=c,await p.decode(),we()&&await Zi(p,u);let h=p.naturalWidth,f=p.naturalHeight,m=l?h:Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:h,g=l?f:Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:f,y,x,v=Number.isFinite(r),b=Number.isFinite(n);if(v&&b)y=Math.max(1,r),x=Math.max(1,n);else if(v){let $=r/Math.max(1,m);y=r,x=g*$}else if(b){let $=n/Math.max(1,g);x=n,y=m*$}else y=h,x=f;y=y*i,x=x*i;let w=y*o,S=x*o,M=Math.max(w/ye,S/ye,Math.sqrt(w*S/vt));M>1&&(console.warn(`[snapDOM] Output ${Math.round(w)}\xD7${Math.round(S)}px exceeds the browser canvas limit (${ye}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),y/=M,x/=M);let k=document.createElement("canvas");k.width=y*o,k.height=x*o,k.style.width=`${y}px`,k.style.height=`${x}px`;let E=k.getContext("2d");if(o!==1&&E.scale(o,o),s&&(E.save(),E.fillStyle=s,E.fillRect(0,0,y,x),E.restore()),d&&(Math.round(y*o)!==h||Math.round(x*o)!==f)){let $=document.createElement("canvas");$.width=h,$.height=f,$.getContext("2d").drawImage(p,0,0),E.drawImage($,0,0,y,x)}else E.drawImage(p,0,0,y,x);return k}var ye,vt,pt,je=ae(()=>{"use strict";Ae(),ye=16384,vt=16384*16384,pt=null}),ht={};_e(ht,{rasterize:()=>Rn});async function Rn(e,t){let r=await At(e,t),n=await new Promise(o=>{let a=()=>o(r.toDataURL(`image/${t.format}`,t.quality));try{r.toBlob(s=>{if(!s)return a();let l=new FileReader;l.onload=()=>o(String(l.result||"")),l.onerror=a,l.readAsDataURL(s)},`image/${t.format}`,t.quality)}catch{a()}}),i=new Image;return i.src=n,await i.decode(),i.style.width=`${r.width/t.dpr}px`,i.style.height=`${r.height/t.dpr}px`,i}var ft=ae(()=>{"use strict";je()}),jt={};_e(jt,{toImg:()=>Lr,toSvg:()=>Lr});async function Lr(e,t){let{scale:r=1,width:n,height:i,meta:o={}}=t,a=Number.isFinite(n),s=Number.isFinite(i),l=Number.isFinite(r)&&r!==1||a||s;if(we()&&l)try{let{svg:d}=await cr(sr(e)),u=(d.match(/<svg\b[^>]*>/i)||[])[0]||"",p=parseFloat((u.match(/\bwidth="([\d.]+)/i)||[])[1]),h=parseFloat((u.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(p)||!Number.isFinite(h))throw new Error("svg without dimensions");let f=Number.isFinite(o.vbW)?o.vbW:Number.isFinite(o.w0)?o.w0:p,m=Number.isFinite(o.vbH)?o.vbH:Number.isFinite(o.h0)?o.h0:h,g,y;a&&s?(g=n,y=i):a?(g=n,y=Math.round(m*(n/Math.max(1,f)))):s?(y=i,g=Math.round(f*(i/Math.max(1,m)))):(g=Math.round(p*r),y=Math.round(h*r));let x=d.replace(/width="[^"]*"/,`width="${g}"`).replace(/height="[^"]*"/,`height="${y}"`),v=new Image;return v.decoding="sync",v.loading="eager",v.src=lr(x),await v.decode(),v.style.width=`${g}px`,v.style.height=`${y}px`,v}catch(d){return j(t,"safari vector toImg failed, falling back to PNG",d),Rn(e,{...t,format:"png",quality:1,meta:o})}let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=e,await c.decode(),a&&s)c.style.width=`${n}px`,c.style.height=`${i}px`;else if(a){let d=Number.isFinite(o.vbW)?o.vbW:Number.isFinite(o.w0)?o.w0:c.naturalWidth,u=Number.isFinite(o.vbH)?o.vbH:Number.isFinite(o.h0)?o.h0:c.naturalHeight,p=n/Math.max(1,d);c.style.width=`${n}px`,c.style.height=`${Math.round(u*p)}px`}else if(s){let d=Number.isFinite(o.vbW)?o.vbW:Number.isFinite(o.w0)?o.w0:c.naturalWidth,u=Number.isFinite(o.vbH)?o.vbH:Number.isFinite(o.h0)?o.h0:c.naturalHeight,p=i/Math.max(1,u);c.style.height=`${i}px`,c.style.width=`${Math.round(d*p)}px`}else{let d=Math.round(c.naturalWidth*r),u=Math.round(c.naturalHeight*r);if(c.style.width=`${d}px`,c.style.height=`${u}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let p=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${d}"`).replace(/height="[^"]*"/,`height="${u}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,c.src=e}catch(p){j(t,"SVG width/height patch in toImg failed",p)}}return c}var Fr=ae(()=>{"use strict";de(),ft(),je()}),Nn={};_e(Nn,{toBlob:()=>Tn});async function Tn(e,t){let r=t.type;if(r==="svg"){let i=decodeURIComponent(e.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let n=await At(e,t);return new Promise(i=>n.toBlob(o=>i(o),`image/${r}`,t.quality))}var Ln=ae(()=>{"use strict";je()}),Fn={};_e(Fn,{download:()=>eo});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 eo(e,t){let r=new Set(["png","jpeg","jpg","webp","svg"]),n=(t?.type||"").toLowerCase(),i=r.has(n)?n:"",o=(t?.format||i||"").toLowerCase(),a=o==="jpg"?"jpeg":o||"png",s=t?.filename||`snapdom.${a}`,l={...t||{},format:a,type:a};l.dpr=1;let c=ji();if(a==="svg"){let p=await Tn(e,{...l,type:"svg"});if(c&&await Pr(p,s))return;let h=URL.createObjectURL(p),f=document.createElement("a");f.href=h,f.download=s,document.body.appendChild(f),f.click(),URL.revokeObjectURL(h),f.remove();return}let d=await At(e,l);if(c){let p=`image/${a}`,h=await new Promise(f=>d.toBlob(f,p,t?.quality));if(h&&await Pr(h,s))return}let u=document.createElement("a");u.href=d.toDataURL(`image/${a}`,t?.quality),u.download=s,document.body.appendChild(u),u.click(),u.remove()}var to=ae(()=>{"use strict";Ln(),je(),Ae()});de();de();ne();var Ut=new WeakMap,He=new Map,ro=2e3,St=0;function mt(){St++,He.size>ro&&He.clear()}var no="[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(no))}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 io(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 oo=["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 ao(e,t={}){let r={},n=t.excludeStyleProps;for(let u=0;u<e.length;u++){let p=e[u];if(ir(p)||n&&(n instanceof RegExp&&n.test(p)||typeof n=="function"&&n(p)))continue;let h=e.getPropertyValue(p);(p==="background-image"||p==="content")&&h.includes("url(")&&!h.includes("data:")&&(h="none"),r[p]=h}let i=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let u of i)if(!r[u])try{let p=e.getPropertyValue(u);p&&(r[u]=p)}catch{}let o=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let u of o)if(!r[u])try{let p=e.getPropertyValue(u);p&&(r[u]=p)}catch{}if(t.embedFonts){let u=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let p of u)if(!r[p])try{let h=e.getPropertyValue(p);h&&(r[p]=h)}catch{}}try{(r["content-visibility"]||e.getPropertyValue("content-visibility"))==="hidden"&&(r["content-visibility"]="hidden")}catch{}let a=!1;{let u=e.getPropertyValue("background-image");if(u&&u!=="none"&&(a=!0),!a){let p=e.getPropertyValue("background-color");p&&p!=="rgba(0, 0, 0, 0)"&&p!=="transparent"&&(a=!0)}if(!a)for(let p of oo){let h=e.getPropertyValue(p);if(h&&h!=="none"){a=!0;break}}if(!a){let p=e.getPropertyValue("background");p&&/url\s*\(/i.test(p)&&(a=!0)}}Object.defineProperty(r,"__needsBgInline",{value:a,enumerable:!1});let s=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,c=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,d=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(s===0&&l===0&&c===0&&d===0){let u=(e.getPropertyValue("border-image-source")||"").trim(),p=u&&u!=="none",h=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let f of h)delete r[f];p||(r.border="none")}return r}function so(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 lo(e,t,r){try{if(typeof e.computedStyleMap=="function"){let i=e.computedStyleMap().get("width");if(i!=null)return!Dr(String(i).trim().toLowerCase())}}catch{}let n=e.style&&(e.style.width||e.style.inlineSize);return n&&!Dr(String(n).trim().toLowerCase())?!0:uo(e,t)?r||po(e,t):!1}var co=new Set(["auto","min-content","max-content","stretch","fill-available","-webkit-fill-available"]);function Dr(e){return co.has(e)||e.startsWith("fit-content")}function uo(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,i=-1/0,o=null;for(let a=e.firstChild;a;a=a.nextSibling){let s;if(a.nodeType===3){if(!/\S/.test(a.nodeValue||"")||(o=o||document.createRange(),o.selectNode(a),s=o.getBoundingClientRect(),!s.width&&!s.height))continue}else if(a.nodeType===1){let l=_(a);if(l.display==="none"||l.position==="absolute"||l.position==="fixed")continue;s=a.getBoundingClientRect()}else continue;s.left<n&&(n=s.left),s.right>i&&(i=s.right)}return i===-1/0?!1:i-n<r-.5}function po(e,t){let r=e.parentElement;if(!r)return!1;let n=_(r),i=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 i>0?Math.abs(e.getBoundingClientRect().width-i)>.5:!1}var Wr=new WeakMap;function ho(e){let t=Wr.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(";"),Wr.set(e,t),t)}function fo(e,t=null,r={}){let n=Ut.get(e),i=!!(r&&r.embedFonts),o=r&&r.excludeStyleProps||null;if(n&&n.epoch===St&&n.embedFonts===i&&n.excludeStyleProps===o)return n.snapshot;let a=t||getComputedStyle(e),s=ao(a,r);return xo(e,a,s),Ut.set(e,{epoch:St,snapshot:s,embedFonts:i,excludeStyleProps:o}),s}function mo(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:He,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:He,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function go(e,t,r){if(!(!e.style||e.style.length===0))for(let n=0;n<e.style.length;n++){let i=e.style[n],o=r.getPropertyValue(i);o&&t.style.setProperty(i,o)}}async function pe(e,t,r,n){if(e.tagName==="STYLE")return;let i=mo(r,n),o=i.options&&i.options.cache||"auto";o!=="disabled"&&io(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(mt(),He.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:s}=i;if(!a.styleCache.has(e)){let g=null;try{g=getComputedStyle(e)}catch{}a.styleCache.set(e,g||getComputedStyle(document.documentElement))}let l=a.styleCache.get(e);e.getAttribute?.("style")&&go(e,t,l);let c=l.getPropertyValue("animation-name");t&&t.style&&c&&c!=="none"&&t.style.setProperty("animation","none","important");let d=fo(e,l,i.options),u=In(e);if(u){let g=l.getPropertyValue("min-width");(!g||g==="auto"||g==="0px")&&(d["min-width"]="0px")}let p=e.tagName?.toLowerCase()||"div",h=ho(d),f=!0;if(hn(p,(d.display||"").toLowerCase())){f=so(e),f&&Oi(p,d,u)&&lo(e,l,u)&&(f=!1),h=`${h}|${p}${f?"|c":""}${u?"|f":""}`;let g=d["text-wrap-mode"]||d["white-space"]||"";f&&g!=="nowrap"&&g!=="pre"&&(a.reconcileRisk=(a.reconcileRisk||0)+1)}let m=s.snapshotKeyCache.get(h);m===void 0&&(m=Ht(d,p,f,u),s.snapshotKeyCache.set(h,m)),a.styleMap.set(t,m)}function bo(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 yo(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 i=_(n);if(i.display==="none")continue;let o=i.position;if(o!=="absolute"&&o!=="fixed")return!0}return!1}function wo(e){let t=e.getBoundingClientRect().top,r=-1/0,n=null;for(let i=e.firstChild;i;i=i.nextSibling){if(i.nodeType===3){if(!/\S/.test(i.nodeValue||""))continue;n=n||document.createRange(),n.selectNode(i);let s=n.getBoundingClientRect();(s.width||s.height)&&(r=Math.max(r,s.bottom));continue}if(i.nodeType!==1)continue;let o=_(i);if(o.display==="none")continue;let a=o.position;a==="absolute"||a==="fixed"||o.float&&o.float!=="none"||(r=Math.max(r,i.getBoundingClientRect().bottom))}return r===-1/0?NaN:r-t}function xo(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 i=t.display||"";if(i.includes("flex")||i.includes("grid"))return;let o=t.position;if(o==="absolute"||o==="fixed"||o==="sticky"||t.transform!=="none"||bo(t)||In(e))return;let a=t.overflowX||t.overflow||"visible",s=t.overflowY||t.overflow||"visible";if(a!=="visible"||s!=="visible")return;let l=t.clip;if(l&&l!=="auto"&&l!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||!yo(e))return;let c=parseFloat(t.height),d=wo(e);Number.isFinite(c)&&Number.isFinite(d)&&Math.abs(c-d)>2||(delete r.height,delete r["block-size"])}$t();var On=["fill","stroke","color","background-color","stop-color"],vo=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(vo.has(t.localName))return!0}t=t.parentNode}return!1}var Hr=new Map;function So(e,t){let r=t+"::"+e.toLowerCase(),n=Hr.get(r);if(n)return n;let i=document,o=t==="http://www.w3.org/2000/svg"?i.createElementNS(t,e):i.createElement(e),a=i.createElement("div");a.setAttribute("data-snapdom-internal",""),a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(o),i.documentElement.appendChild(a);let s=getComputedStyle(o),l={};for(let c of On)l[c]=s.getPropertyValue(c)||"";return a.remove(),Hr.set(r,l),l}function ko(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 o=e.attributes;for(let a=0;a<o.length;a++){let s=o[a];if(s&&typeof s.value=="string"&&s.value.includes("var(")){n=!0;break}}}let i=null;if(n)try{i=getComputedStyle(e)}catch{}if(n){let o=e.style;if(o&&o.length){let a=new Set;for(let s=0;s<o.length;s++){let l=o[s];if(a.has(l))continue;a.add(l);let c=o.getPropertyValue(l);if(!c||!c.includes("var("))continue;let d=i&&i.getPropertyValue(l);if(d)try{t.style.setProperty(l,d.trim(),o.getPropertyPriority(l))}catch{}}}}if(n&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let s=o[a];if(!s||typeof s.value!="string"||!s.value.includes("var("))continue;let l=s.name,c=i&&i.getPropertyValue(l);if(c)try{t.style.setProperty(l,c.trim())}catch{}}}if(!n){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=So(e.tagName,o);for(let s of On){let l=i.getPropertyValue(s)||"",c=a[s]||"";if(l&&l!==c)try{t.style.setProperty(s,l.trim())}catch{}}}}de();de();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 Co(e,t){return!e||e?.nodeType!==1?!1:e.matches?.("picture")||e.querySelector("picture")?!0:t?!!(e.matches?.(Br)||e.querySelector(Br)):!1}var Mo=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i;function kt(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 o of e.split(",")){let a=o.trim().split(/\s+/);if(!a[0])continue;let s=a[1]||"",l=1;/^\d*\.?\d+x$/i.test(s)?l=parseFloat(s):/^\d+w$/i.test(s)&&(l=parseInt(s,10)/r),n.push({url:a[0],d:l})}if(!n.length)return null;n.sort((o,a)=>o.d-a.d);let i=window.devicePixelRatio||1;return(n.find(o=>o.d>=i)||n[n.length-1]).url}function Dn(e,t){let r=e.currentSrc||"";if(r&&!Ee(r))return r;let n=t.querySelectorAll("source[srcset]"),i=null;for(let o of n){let a=o.getAttribute("srcset");if(!a||Ee(a))continue;let s=o.getAttribute("type");if(s&&!Mo.test(s.trim()))continue;let l=o.getAttribute("media");if(l)try{if(window.matchMedia(l).matches)return kt(a,e)}catch{}i||(i=kt(a,e))}return i}function Eo(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 $o(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 Ao(e,t={}){if(!e||e?.nodeType!==1||t.resolvePicturePlaceholders===!1)return null;let{timeout:r,concurrency:n,resolveLazySrc:i,silent:o,useProxy:a}=$o(t);if(!Co(e,i))return null;let s=[],l=[];async function c(p){let h=await le(p,{as:"dataURL",timeout:r,useProxy:a,silent:!0});return h.ok?h.data:null}async function d(p){for(let h=0;h<p.length;h+=n){let f=p.slice(h,h+n);await Promise.allSettled(f.map(m=>m()))}}let u=Array.from(e.querySelectorAll("picture"));e.matches?.("picture")&&u.unshift(e);for(let p of u){let h=p.querySelector("img");if(!h)continue;let f=h.getAttribute("src")||"";if(!Ee(f))continue;let m=Dn(h,p);m&&l.push(async()=>{let g=await c(m);if(!g){o||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${m.slice(0,60)}`);return}let y=h.getAttribute("src"),x=h.getAttribute("srcset"),v=h.getAttribute("sizes"),b=[];h.src=g,h.setAttribute("src",g),h.removeAttribute("srcset"),h.removeAttribute("sizes");let w=p.querySelectorAll("source");for(let S of w)b.push({el:S,parent:S.parentElement,next:S.nextSibling}),S.remove();s.push(()=>{y!==null?h.setAttribute("src",y):h.removeAttribute("src"),x!==null&&h.setAttribute("srcset",x),v!==null&&h.setAttribute("sizes",v);for(let{el:S,parent:M,next:k}of b)M&&M.insertBefore(S,k)})})}if(i){let p=Array.from(e.querySelectorAll("img"));e.localName==="img"&&p.unshift(e);for(let h of p){if(h.closest("picture")&&Ee(h.getAttribute("src")||""))continue;let f=h.getAttribute("src")||"",m=Eo(h);m&&Ee(f)&&l.push(async()=>{let g=await c(m);if(!g)return;let y=h.getAttribute("src");h.src=g,h.setAttribute("src",g),h.removeAttribute("srcset"),h.removeAttribute("sizes"),s.push(()=>{y!==null?h.setAttribute("src",y):h.removeAttribute("src")})})}}return l.length===0?null:(await d(l),async function(){for(let p of s)try{p()}catch{}})}function Pt(e,t,r){return r?Promise.all(e.map(n=>new Promise(i=>t(n,i)))):Promise.all(e.map(n=>new Promise(i=>{function o(){ut(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(n,i):o()},{fast:r})}o()})))}function Ro(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 No(e,t,r=!0,n){return e.split(",").map(i=>i.trim()).filter(Boolean).map(i=>{if(i.startsWith(":where(")||i.startsWith("@"))return i;let o=r?Ro(i,n):i;return`:where(${t} ${o})`}).join(", ")}function To(e,t,r){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,i)=>`:where(${t}:is(${i.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,i)=>`:where(:where(${i.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,i)=>`:where(${t} ${i.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,i,o,a)=>{let s=No(a,t,!0,r);return`${i}${o}${s}{`}),e):""}function Lo(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Fo(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
|
|
4
|
-
`}catch{}}catch{}return t}function
|
|
5
|
-
`:""}function Ho(e,t){if(!e)return;let r=n=>{let i=n.getAttribute("data-sd-slotted")||"";t?` ${i} `.includes(` ${t} `)||n.setAttribute("data-sd-slotted",i?`${i} ${t}`:t):n.setAttribute("data-sd-slotted",i)};e.nodeType===Node.ELEMENT_NODE&&r(e),e.querySelectorAll?.("*").forEach(r)}async function Bo(e,t=3){let r=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},n=r(),i=0;for(;i<t&&(!n||!n.body&&!n.documentElement);)await new Promise(o=>setTimeout(o,0)),n=r(),i++;return n&&(n.body||n.documentElement)?n:null}function _o(e){let t=e.getBoundingClientRect(),r=0,n=0,i=0,o=0;try{let l=getComputedStyle(e);r=parseFloat(l.borderLeftWidth)||0,n=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(r+n))),s=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:s,rect:t}}function he(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 i=parseFloat(n.width);!isNaN(i)&&i>0&&(t=i)}if(r===0){let i=parseFloat(n.height);!isNaN(i)&&i>0&&(r=i)}}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 jo(e,t,r){let n=e.defaultView,i=n?n.scrollX:0,o=n?n.scrollY:0,a=e.body?e.body.scrollLeft:0,s=e.body?e.body.scrollTop:0,l=e.documentElement?e.documentElement.scrollLeft:0,c=e.documentElement?e.documentElement.scrollTop:0,d=0,u=0,p=0,h=0;try{let m=n&&e.body?n.getComputedStyle(e.body):null;m&&(d=(parseFloat(m.marginTop)||0)+(parseFloat(m.paddingTop)||0),u=(parseFloat(m.marginRight)||0)+(parseFloat(m.paddingRight)||0),p=(parseFloat(m.marginBottom)||0)+(parseFloat(m.paddingBottom)||0),h=(parseFloat(m.marginLeft)||0)+(parseFloat(m.paddingLeft)||0))}catch{}try{e.documentElement.setAttribute("data-sd-pinned","")}catch{}let f=e.createElement("style");return f.setAttribute("data-sd-iframe-pin",""),f.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: ${d}px ${u}px ${p}px ${h}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(f),()=>{try{f.remove()}catch{}try{e.documentElement.removeAttribute("data-sd-pinned")}catch{}try{n&&typeof n.scrollTo=="function"&&n.scrollTo(i,o),e.body&&(e.body.scrollLeft=a,e.body.scrollTop=s),e.documentElement&&(e.documentElement.scrollLeft=l,e.documentElement.scrollTop=c)}catch{}}}async function Uo(e,t,r){let n=await Bo(e,3);if(!n)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=_o(e),s=r?.snap;if(!s&&typeof window<"u"&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let l={...r,scale:1,clip:null},c=jo(n,i,o),d=C.session.nodeMap,u=C.session.styleMap,p=C.session.styleCache,h;try{h=await s.toPng(n.documentElement,l)}finally{c(),C.session.nodeMap=d,C.session.styleMap=u,C.session.styleCache=p}h.style.display="block",h.style.width=`${i}px`,h.style.height=`${o}px`;let f=document.createElement("div");return t.nodeMap.set(f,e),pe(e,f,t,r),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(a.width)}px`),f.style.height||(f.style.height=`${Math.round(a.height)}px`),f.appendChild(h),f}function qo(e){let{width:t,height:r}=he(e),n=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,s=Math.round(t||n.width||0),l=Math.round(r||n.height||0),c=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,s||16),d=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),u=(e.type||"text").toLowerCase()==="checkbox",p=!!e.checked,h=!!e.indeterminate,f=Math.max(Math.min(c,d),12),m="middle";try{i&&i.verticalAlign&&(m=i.verticalAlign)}catch{}let g=document.createElement("div");g.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),g.style.cssText=`display:inline-block;width:${f}px;height:${f}px;vertical-align:${m};flex-shrink:0;line-height:0;`;let y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width",String(f)),y.setAttribute("height",String(f)),y.setAttribute("viewBox",`0 0 ${f} ${f}`),g.appendChild(y);function x(){let v="#0a6ed1";try{i&&(v=i.accentColor||i.color||v)}catch{}let b=2,w=b/2,S=f-b;if(y.innerHTML="",u){let M=document.createElementNS("http://www.w3.org/2000/svg","rect");if(M.setAttribute("x",String(w)),M.setAttribute("y",String(w)),M.setAttribute("width",String(S)),M.setAttribute("height",String(S)),M.setAttribute("rx","2"),M.setAttribute("ry","2"),M.setAttribute("fill",p?v:"none"),M.setAttribute("stroke",v),M.setAttribute("stroke-width",String(b)),y.appendChild(M),p){let k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",`M ${w+2} ${f/2} L ${f/2-1} ${f-w-2} L ${f-w-2} ${w+2}`),k.setAttribute("stroke","white"),k.setAttribute("stroke-width",String(Math.max(1.5,b))),k.setAttribute("fill","none"),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),y.appendChild(k)}else if(h){let k=document.createElementNS("http://www.w3.org/2000/svg","rect"),E=Math.max(6,S-4);k.setAttribute("x",String((f-E)/2)),k.setAttribute("y",String((f-b)/2)),k.setAttribute("width",String(E)),k.setAttribute("height",String(b)),k.setAttribute("fill",v),k.setAttribute("rx","1"),y.appendChild(k)}}else{let M=document.createElementNS("http://www.w3.org/2000/svg","circle");if(M.setAttribute("cx",String(f/2)),M.setAttribute("cy",String(f/2)),M.setAttribute("r",String((f-b)/2)),M.setAttribute("fill",p?v:"none"),M.setAttribute("stroke",v),M.setAttribute("stroke-width",String(b)),y.appendChild(M),p){let k=document.createElementNS("http://www.w3.org/2000/svg","circle"),E=Math.max(2,(f-b*2)*.35);k.setAttribute("cx",String(f/2)),k.setAttribute("cy",String(f/2)),k.setAttribute("r",String(E)),k.setAttribute("fill","white"),y.appendChild(k)}}g.style.setProperty("width",`${f}px`,"important"),g.style.setProperty("height",`${f}px`,"important"),g.style.setProperty("min-width",`${f}px`,"important"),g.style.setProperty("min-height",`${f}px`,"important")}return x(),{el:g,applyVisual:x}}var Oe=new re(80);async function We(e){if(C.resource?.has(e))return C.resource.get(e);if(Oe.has(e))return Oe.get(e);let t=(async()=>{let r=await le(e,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.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 zo=/\bblob:[^)"'\s]+/g;async function _r(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(zo)||[]));if(t.length===0)return e;let r=e;for(let n of t)try{let i=await We(n);r=r.split(n).join(i)}catch{}return r}function ot(e){return typeof e=="string"&&e.startsWith("blob:")}function Vo(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 Xo(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 Yo(e,t=null){if(!e)return;let r=t,n=at(e,"img");for(let l of n)try{let c=l.getAttribute("src")||l.currentSrc||"";if(ot(c)){let u=await We(c);l.setAttribute("src",u)}let d=l.getAttribute("srcset");if(d&&d.includes("blob:")){let u=Vo(d),p=!1;for(let h of u)if(ot(h.url))try{h.url=await We(h.url),p=!0}catch(f){j(r,"blobUrlToDataUrl for srcset item failed",f)}p&&l.setAttribute("srcset",Xo(u))}}catch(c){j(r,"resolveBlobUrls for img failed",c)}let i=at(e,"image");for(let l of i)try{let c="http://www.w3.org/1999/xlink",d=l.getAttribute("href")||l.getAttributeNS?.(c,"href");if(ot(d)){let u=await We(d);l.setAttribute("href",u),l.removeAttributeNS?.(c,"href")}}catch(c){j(r,"resolveBlobUrls for SVG image href failed",c)}let o=at(e,"[style*='blob:']");for(let l of o)try{let c=l.getAttribute("style");if(c&&c.includes("blob:")){let d=await _r(c);l.setAttribute("style",d)}}catch(c){j(r,"replaceBlobUrls in inline style failed",c)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let c=l.textContent||"";c.includes("blob:")&&(l.textContent=await _r(c))}catch(c){j(r,"replaceBlobUrls in style tag failed",c)}let s=["poster"];for(let l of s){let c=at(e,`[${l}^='blob:']`);for(let d of c)try{let u=d.getAttribute(l);ot(u)&&d.setAttribute(l,await We(u))}catch(u){j(r,`resolveBlobUrls for ${l} failed`,u)}}}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}=he(e),n=t,i=r;if(!n||!i){let a=e.getBoundingClientRect();n=n||a.width||0,i=i||a.height||0}let o=document.createElement("div");return o.style.cssText=`display:inline-block;width:${n}px;height:${i}px;visibility:hidden;`,o}var st=200,Go=new Set(["img","canvas","video","iframe","object","embed"]);function Ur(e,t){return e.right>=t.left-st&&e.left<=t.right+st&&e.bottom>=t.top-st&&e.top<=t.bottom+st}function Ko(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"&&!Go.has((e.localName||"").toLowerCase()))return!1;let i=t.rect,o=e.scrollWidth||0,a=e.scrollHeight||0,s={left:n.direction==="rtl"?Math.min(r.left,r.right-o):r.left,top:r.top,right:Math.max(r.right,r.left+o),bottom:Math.max(r.bottom,r.top+a)},l=n.writingMode||"";if((l.startsWith("vertical")||l.startsWith("sideways"))&&(s.top=Math.min(r.top,r.bottom-a),s.left=Math.min(s.left,r.right-o)),Ur(s,i))return!1;let c=(e.ownerDocument||document).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;c.nextNode();){let d=c.currentNode.getBoundingClientRect();if((d.width>0||d.height>0)&&Ur(d,i))return!1}return!0}function Qo(e,t,r){let n=e.cloneNode(!1);e.tagName==="IMG"&&(n.removeAttribute("src"),n.removeAttribute("srcset"),n.removeAttribute("sizes")),pe(e,n,t,r);let{width:i,height:o}=he(e);return i>0&&(n.style.width=`${i}px`,n.style.minWidth=`${i}px`,n.style.maxWidth=`${i}px`),o>0&&(n.style.height=`${o}px`,n.style.minHeight=`${o}px`,n.style.maxHeight=`${o}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,i=null,o=null;if(e.nodeType===Node.ELEMENT_NODE){let d=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||fn.has(d))return null;if(d==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return j(t,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null;if(d==="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 d of r.exclude)try{if(e.matches?.(d)){if(r.excludeMode==="hide")return It(e);if(r.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${d}`,u)}if(typeof r.filter=="function")try{if(!r.filter(e)){if(r.filterMode==="hide")return It(e);if(r.filterMode==="remove")return null}}catch(d){console.warn("Error in filter function:",d)}if(t.clip&&Ko(e,t.clip))return Qo(e,t,r);if(r.__resolveNodeHooks)for(let d of r.__resolveNodeHooks){let u;try{u=await d(e,r)}catch(p){j(t,"resolveNode plugin hook failed",p)}if(u===null)return null;if(u instanceof Node)return u.nodeType===Node.ELEMENT_NODE&&(t.nodeMap.set(u,e),pe(e,u,t,r)),u}{let d=jr.has(e.tagName)&&zt.get(e.tagName);if(d){let u=await d(e,t,r);if(u!==void 0)return u}}if(e.getAttribute("data-capture")==="placeholder"){let d=e.cloneNode(!1);t.nodeMap.set(d,e),pe(e,d,t,r);let u=document.createElement("div");return u.textContent=e.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",d.appendChild(u),d}{let d=!jr.has(e.tagName)&&zt.get(e.tagName);if(d){let u=await d(e,t,r);if(u!==void 0)return u}}let a;try{if(a=e.cloneNode(!1),a.attributes?.length)try{for(let d of a.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(d.value)&&a.setAttribute(d.name,d.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(ko(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Io(e,a);try{let{width:d,height:u}=he(e),p=Math.round(d||0),h=Math.round(u||0);p&&(a.dataset.snapdomWidth=String(p)),h&&(a.dataset.snapdomHeight=String(h))}catch(d){j(t,"getUnscaledDimensions for IMG failed",d)}try{let d=e.getAttribute("style")||"",u=window.getComputedStyle(e),p=v=>{let b=d.match(new RegExp(`${v}\\s*:\\s*([^;]+)`,"i")),w=b?b[1].trim():u.getPropertyValue(v);return/%|auto/i.test(String(w||""))},h=parseInt(a.dataset.snapdomWidth||"0",10),f=parseInt(a.dataset.snapdomHeight||"0",10),m=p("width")||!h,g=p("height")||!f;m&&h&&(a.style.width=`${h}px`),g&&f&&(a.style.height=`${f}px`);let y=u.getPropertyValue("object-fit"),x=u.getPropertyValue("object-position");y&&y!=="fill"?(a.style.objectFit=y,x&&(a.style.objectPosition=x)):(h&&(a.style.minWidth=`${h}px`),f&&(a.style.minHeight=`${f}px`))}catch(d){j(t,"IMG dimension freeze failed",d)}}}catch(d){throw console.error("[Snapdom] Failed to clone node:",e,d),d}let s=null;if(e instanceof HTMLTextAreaElement){let{width:d,height:u}=he(e),p=d||e.getBoundingClientRect().width||0,h=u||e.getBoundingClientRect().height||0;p&&(a.style.width=`${p}px`),h&&(a.style.height=`${h}px`)}if(e instanceof HTMLInputElement){let d=(e.type||"text").toLowerCase();if((d==="checkbox"||d==="radio")&&Ui()){let{el:u,applyVisual:p}=qo(e);t.nodeMap.set(u,e),s=p,a=u}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 d=window.getComputedStyle(e,"::placeholder"),u=d&&d.color;if(u&&u!=="rgba(0, 0, 0, 0)"){let p="snapdom-ph-"+(Math.random()*1e6|0);a.classList.add(p);let h=document.createElement("style");h.textContent=`.${p}::placeholder{color:${u}!important;opacity:${d.opacity||"1"}!important;-webkit-text-fill-color:${u}!important;}`,a.prepend(h)}}catch{}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=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 d=e;d.min!==void 0&&d.min!==""&&a.setAttribute("min",d.min),d.max!==void 0&&d.max!==""&&a.setAttribute("max",d.max),d.pattern!==void 0&&d.pattern!==""&&a.setAttribute("pattern",d.pattern);let u=e.getAttribute("aria-invalid");u!==null&&a.setAttribute("aria-invalid",u)}if(qt(e)||pe(e,a,t,r),s&&s(),e instanceof SVGElement&&!qt(e)){let d=["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 u=window.getComputedStyle(e);for(let p of d){let h=u.getPropertyValue(p);h&&a.style.setProperty(p,h)}}catch{}}if(e.shadowRoot){try{let v=e.shadowRoot.querySelectorAll("slot");for(let b of v){let w=b.assignedNodes?.()||[];for(let S of w)n.add(S)}}catch{}let d=Lo(t),u=`[data-sd="${d}"]`;t.shadowScopes||(t.shadowScopes=new WeakMap),t.shadowScopes.set(e.shadowRoot,d);try{a.setAttribute("data-sd",d)}catch{}let p=Fo(e.shadowRoot),h=To(p,u,d),f=Oo(p),m=Wo(e,f,u);Po(a,m+h,d);let g=document.createDocumentFragment(),y=(v,b)=>{if(v.nodeType===Node.ELEMENT_NODE&&v.tagName==="STYLE")return b(null);gt(v,t,r).then(w=>{b(w||null)}).catch(()=>{b(null)})},x=await Pt(Array.from(e.shadowRoot.childNodes),y,r.fast);g.append(...x.filter(v=>!!v)),a.appendChild(g)}if(e.tagName==="SLOT"){let d=t.shadowScopes?.get(e.getRootNode()),u=e.assignedNodes?.()||[],p=u.length?e.assignedNodes?.({flatten:!0})||u:[],h=p.length?p:Array.from(e.childNodes),f=document.createDocumentFragment(),m=(y,x)=>{gt(y,t,r).then(v=>{v&&u.length&&Ho(v,d),x(v||null)}).catch(()=>{x(null)})},g=await Pt(Array.from(h),m,r.fast);return f.append(...g.filter(y=>!!y)),f}function l(d,u){if(n.has(d)||e.shadowRoot&&!d.assignedSlot)return u(null);gt(d,t,r).then(p=>{u(p||null)}).catch(()=>{u(null)})}let c=await Pt(Array.from(e.childNodes),l,r.fast);if(a.append(...c.filter(d=>!!d)),i!==null&&a instanceof HTMLSelectElement){a.value=i;for(let d of a.options)d.value===i?d.setAttribute("selected",""):d.removeAttribute("selected")}return o!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=o),a}async function Jo(e,t,r){let n=!1;try{n=!!(e.contentDocument||e.contentWindow?.document)}catch(i){j(t,"iframe same-origin probe failed",i)}if(n)try{return await Uo(e,t,r)}catch(i){console.warn("[SnapDOM] iframe rasterization failed, fallback:",i)}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:i,height:o}=he(e),a=document.createElement("div");return a.style.cssText=`width:${i}px;height:${o}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;`,pe(e,a,t,r),a}else{let{width:i,height:o}=he(e),a=document.createElement("div");return a.style.cssText=`display:inline-block;width:${i}px;height:${o}px;visibility:hidden;`,pe(e,a,t,r),a}}function Zo(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 i=n.getContext("2d",{willReadFrequently:!0});if(!i)return!1;i.drawImage(e,0,0,t,r);let o=i.getImageData(0,0,t,r).data;for(let a=3;a<o.length;a+=4)if(o[a]!==0)return!1;return!0}catch{return!1}}async function ea(e,t,r){let n="";try{let s=e.getContext("2d",{willReadFrequently:!0});try{s&&s.getImageData(0,0,1,1)}catch{}if((we()||!s)&&await Me(),n=e.toDataURL("image/png"),!n||n==="data:,"){try{s&&s.getImageData(0,0,1,1)}catch{}if(await Me(),n=e.toDataURL("image/png"),!n||n==="data:,"){let l=document.createElement("canvas");l.width=e.width,l.height=e.height;let c=l.getContext("2d");c&&(c.drawImage(e,0,0),n=l.toDataURL("image/png"))}}}catch(s){j(t,"Canvas toDataURL failed, using empty/fallback",s)}r&&r.debug&&n&&Zo(e)&&j(t,"canvas is empty at capture time \u2014 capture it after its first frame is drawn",e);let i=document.createElement("img");try{i.decoding="sync",i.loading="eager"}catch(s){j(t,"img decoding/loading hints failed",s)}n&&(i.src=n),i.width=e.width,i.height=e.height;let{width:o,height:a}=he(e);return o>0&&(i.style.width=`${o}px`),a>0&&(i.style.height=`${a}px`),t.nodeMap.set(i,e),pe(e,i,t,r),i}async function ta(e,t,r){let n="";try{let s=document.createElement("canvas");s.width=e.videoWidth||e.offsetWidth||320,s.height=e.videoHeight||e.offsetHeight||240;let l=s.getContext("2d");l&&(l.drawImage(e,0,0,s.width,s.height),n=s.toDataURL("image/png"),(!n||n==="data:,")&&(n=""))}catch(s){j(t,"Video frame capture failed, using poster fallback",s)}let i=document.createElement("img");try{i.decoding="sync",i.loading="eager"}catch{}n?i.src=n:e.poster&&(i.src=e.poster),i.width=e.videoWidth||e.offsetWidth||0,i.height=e.videoHeight||e.offsetHeight||0;let{width:o,height:a}=he(e);return o>0&&(i.style.width=`${o}px`),a>0&&(i.style.height=`${a}px`),i.style.objectFit="contain",t.nodeMap.set(i,e),pe(e,i,t,r),i}async function ra(e,t,r){if(!e.controls)return;let{width:n,height:i}=he(e),o=Math.round(n||e.offsetWidth||300),a=Math.round(i||e.offsetHeight||54),s=a/2,l=Math.max(4,a*.16),c=a*.34,d=o-a*.34,u=c+l+a*.55,p=Math.max(0,d-a*.7-u),h=Math.max(9,Math.round(a*.24)),f=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${a}" viewBox="0 0 ${o} ${a}"><rect width="${o}" height="${a}" rx="${Math.min(a/2,10)}" fill="#f1f3f4"/><path d="M ${c} ${s-l} L ${c+l} ${s} L ${c} ${s+l} Z" fill="#5f6368"/><rect x="${u}" y="${s-1.5}" width="${p}" height="3" rx="1.5" fill="#bdc1c6"/><circle cx="${u}" cy="${s}" r="${Math.max(3,a*.09)}" fill="#5f6368"/><text x="${d}" y="${s}" fill="#5f6368" font-family="sans-serif" font-size="${h}" 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(f)}`,m.width=o,m.height=a,m.style.width=`${o}px`,m.style.height=`${a}px`,t.nodeMap.set(m,e),pe(e,m,t,r),m}Rt("IFRAME",Jo);Rt("CANVAS",ea);Rt("VIDEO",ta);Rt("AUDIO",ra);de();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__||{}),Wn=[],qr=new Set;function ia(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oa(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(ia(r),"i");else{console.warn("[snapdom] Ignored invalid iconFont value:",r);continue}let i=`${n.source}/${n.flags}`;qr.has(i)||(qr.add(i),Wn.push(n))}}function be(e){let t=typeof e=="string"?e:"",r=[...na,...Wn];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 sa(e=""){let t=Object.create(null),r=String(e||""),n=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=n.exec(r);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function la(e,t,r){let n=String(e||""),i=n.toLowerCase(),o=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:n,familyForCanvas:n};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:n,familyForCanvas:n};let a=r&&(r.FILL??r.fill),s="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?s="rounded":/\bsharp\b/.test(o)?s="sharp":/\boutlined\b/.test(o)&&(s="outlined");let l=a===1,c=null;if(l&&(s==="outlined"&&Ne.materialIconsFilled?c={url:Ne.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&Ne.materialIconsRound?c={url:Ne.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&Ne.materialIconsSharp&&(c={url:Ne.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:n,familyForCanvas:n};if(!zr.has(c.alias))try{let u=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(u),await u.load(),zr.set(c.alias,!0)}catch{return{familyForMeasure:n,familyForCanvas:n}}let d=`"${c.alias}"`;return{familyForMeasure:d,familyForCanvas:d}}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 da(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 ua(e,{family:t="Material Icons",weight:r="normal",fontSize:n=32,color:i="#000",variation:o="",className:a=""}={}){let s=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,c=sa(o),{familyForMeasure:d,familyForCanvas:u}=await la(s,a,c);await ca(u.replace(/^["']+|["']+$/g,""),n);let p=document.createElement("span");p.setAttribute("data-snapdom-internal",""),p.textContent=e,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=d,p.style.fontWeight=String(r||"normal"),p.style.fontSize=`${n}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=i,document.body.appendChild(p);let h=p.getBoundingClientRect(),f=Math.max(1,Math.ceil(h.width)),m=Math.max(1,Math.ceil(h.height));document.body.removeChild(p);let g=document.createElement("canvas");g.width=f*l,g.height=m*l;let y=g.getContext("2d");y.scale(l,l),y.font=`${r?`${r} `:""}${n}px ${u}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:g.toDataURL(),width:f,height:m}}async function pa(e,t,r=C.session.nodeMap){if(e?.nodeType!==1)return 0;let n='.material-icons, [class*="material-symbols"]',i=Array.from(e.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim());if(e.matches?.(n)&&e.textContent&&e.textContent.trim()&&i.unshift(e),i.length===0)return 0;let o=t?.nodeType===1?Array.from(t.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim()):[];t?.nodeType===1&&t.matches?.(n)&&t.textContent&&t.textContent.trim()&&o.unshift(t);let a=0;for(let s=0;s<i.length;s++){let l=i[s],c=r&&r.get(l)||o[s]||null;try{let d=getComputedStyle(c||l),u=d.fontFamily||"Material Icons";if(!aa(u))continue;let p=(c||l).textContent.trim();if(!p)continue;let h=parseInt(d.fontSize,10)||24,f=d.fontWeight&&d.fontWeight!=="normal"?d.fontWeight:"normal",m=da(d),g=d.fontVariationSettings&&d.fontVariationSettings!=="normal"?d.fontVariationSettings:"",y=(c||l).className||"",{dataUrl:x,width:v,height:b}=await ua(p,{family:u,weight:f,fontSize:h,color:m,variation:g,className:y});l.textContent="";let w=l.ownerDocument.createElement("img");w.src=x,w.alt=p,w.style.height=`${h}px`,w.style.width=`${Math.max(1,Math.round(v/b*h))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(w),a++}catch{}}return a}$e();Ae();async function ha(e,t,r,n=32,i="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let o=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 s=a.getBoundingClientRect(),l=Math.ceil(s.width),c=Math.ceil(s.height);document.body.removeChild(a);let d=document.createElement("canvas");d.width=Math.max(1,l*o),d.height=Math.max(1,c*o);let u=d.getContext("2d");return u.scale(o,o),u.font=r?`${r} ${n}px "${t}"`:`${n}px "${t}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=i,u.fillText(e,0,0),{dataUrl:d.toDataURL(),width:l,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"]),fa=["katex","mathjax","mathml"];function dr(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 bt(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 yt(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 ba(e){let t=String(e||"400").trim(),r=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(r){let i=bt(r[1]),o=bt(r[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let n=bt(t);return{min:n,max:n}}function ya(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 o=parseFloat(r[1]),a=parseFloat(r[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let n=t.match(/(\d+(?:\.\d+)?)\s*%/),i=n?parseFloat(n[1]):100;return{min:i,max:i}}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 i=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=>i.endsWith(a))||r.some(a=>i===a.toLowerCase()||i.endsWith("."+a.toLowerCase())))return!0;let o=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(o)||/\.woff2?(\b|$)/.test(o)||fa.some(a=>o.includes(a)))return!0;for(let a of t){let s=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),c=xa(a);if(o.includes(s)||o.includes(l)||c&&o.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,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return r;let a=o;try{a=new URL(o,t||location.href).href}catch{}return`url("${a}")`})}var Vt=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Ct=4;async function ka(e,t,r){if(!e)return e;let n=new Set;function i(s,l){try{return new URL(s,l||location.href).href}catch{return s}}async function o(s,l,c=0){if(c>Ct)return console.warn(`[snapDOM] @import depth exceeded (${Ct}) at ${l}`),s;let d="",u=0,p;for(;p=Vt.exec(s);){d+=s.slice(u,p.index),u=Vt.lastIndex;let h=(p[2]||p[4]||"").trim(),f=i(h,l);if(n.has(f)){console.warn(`[snapDOM] Skipping circular @import: ${f}`);continue}n.add(f);let m="";try{let g=await le(f,{as:"text",useProxy:r,silent:!0});g.ok&&typeof g.data=="string"&&(m=g.data)}catch{}m?(m=Vr(m,f),m=await o(m,f,c+1),d+=`
|
|
6
|
-
/* inlined: ${
|
|
1
|
+
"use strict";var BrowserTrack=(()=>{var nt=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var ko=Object.getOwnPropertyNames;var Mo=Object.prototype.hasOwnProperty;var Eo=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var $o=(e,t)=>{for(var r in t)nt(e,r,{get:t[r],enumerable:!0})},Ao=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ko(t))!Mo.call(e,o)&&o!==r&&nt(e,o,{get:()=>t[o],enumerable:!(n=Co(t,o))||n.enumerable});return e};var No=e=>Ao(nt({},"__esModule",{value:!0}),e);var R=(e,t,r)=>Eo(e,typeof t!="symbol"?t+"":t,r);var kl={};$o(kl,{BreadcrumbBuffer:()=>Ie,BrowserScriptScreenshotDriver:()=>ze,BrowserTrackClient:()=>Xe,DEFAULT_OPTIONS:()=>st,NoteInspector:()=>Ve,getClient:()=>uo,init:()=>yr,resolveComponentSource:()=>Re,shouldHideUIFromUrl:()=>_t});var Ie=class{constructor(t=50){R(this,"capacity");R(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 ot="[REDACTED]",Ro=[/^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],Ar=["token","auth","key","apikey","api_key","secret","password","access_token","refresh_token","code","signature"];function To(e){if(!e)return!1;let t=e.replace(/[-_]/g,"");return Ro.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 Ar)n.searchParams.has(a)&&(n.searchParams.set(a,ot),o=!0);for(let a of Array.from(n.searchParams.keys()))To(a)&&(n.searchParams.set(a,ot),o=!0);if(!o)return e;let i=t?n.pathname+n.search+n.hash:n.toString();return i=i.replace(/%5BREDACTED%5D/g,ot),i}catch{let t=e;for(let r of Ar){let n=new RegExp(`([?&]${r}=)[^&#]+`,"gi");t=t.replace(n,`$1${ot}`)}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 s=e.tagName.toLowerCase(),l=Array.from(e.classList||[]).filter(d=>!d.startsWith("css-")&&!d.startsWith("_")&&!/^[a-z0-9]{5,}$/i.test(d)).slice(0,r);if(l.length>0){let d=l.map(c=>`.${c}`).join("");return`${s}${d}`}if(e.parentElement&&e.parentElement!==document.body&&e.parentElement!==document.documentElement){let d=ge(e.parentElement,{maxClasses:1});if(d&&d!=="unknown"&&!d.includes(">"))return`${d} > ${s}`}return s}function ke(e,t=200){return e?e.length<=t?e:e.slice(0,t)+"...":""}function Re(e){if(!e||typeof e!="object")return;let t=Lo(e);if(t)return t;let r=Fo(e);if(r)return r;let n=Po(e);if(n)return n;if(e.tagName&&e.tagName.includes("-"))return{framework:"web-component",componentName:e.tagName.toLowerCase(),hierarchy:[e.tagName.toLowerCase()]};let o=Io(e);if(o)return o}function Lo(e){try{let t=Object.keys(e).find(c=>c.startsWith("__reactFiber$")||c.startsWith("__reactInternalInstance$"));if(!t)return;let r=e[t];if(!r)return;let n,o,i,a,s=[],l;if(r._debugSource&&(n=r._debugSource.fileName,o=r._debugSource.lineNumber,i=r._debugSource.columnNumber),r._debugOwner){let c=r._debugOwner.type;a=Nr(c),!n&&r._debugOwner._debugSource&&(n=r._debugOwner._debugSource.fileName,o=r._debugOwner._debugSource.lineNumber,i=r._debugOwner._debugSource.columnNumber)}let d=r;for(;d;){let c=d.type,u=Nr(c);u&&!u.startsWith("html:")&&u!=="Fragment"&&(a||(a=u),s.includes(u)||s.unshift(u),!n&&d._debugSource&&(n=d._debugSource.fileName,o=d._debugSource.lineNumber,i=d._debugSource.columnNumber),!l&&d.memoizedProps&&typeof d.memoizedProps=="object"&&(l=Ot(d.memoizedProps))),d=d.return}return!a&&!n?void 0:{framework:"react",componentName:a,sourceFile:Oe(n),sourceLine:o,sourceColumn:i,hierarchy:s.length>0?s:a?[a]:void 0,props:l}}catch{return}}function Nr(e){if(e&&typeof e!="string"){if(e.displayName)return e.displayName;if(e.name)return e.name;if(e.render?.displayName)return e.render.displayName;if(e.render?.name)return e.render.name}}function Fo(e){try{let t=e.__vueParentComponent||e.__vnode?.ctx;if(t){let n=t.type||{},o=n.name||n.__name||n.displayName||"AnonymousComponent",i=n.__file,a=[],s=t;for(;s;){let l=s.type||{},d=l.name||l.__name||l.displayName;d&&!a.includes(d)&&a.unshift(d),s=s.parent}return{framework:"vue",componentName:o,sourceFile:Oe(i),hierarchy:a.length>0?a:[o],props:t.props?Ot(t.props):void 0}}let r=e.__vue__;if(r){let n=r.$options||{},o=n.name||n._componentTag||"VueComponent",i=n.__file;return{framework:"vue",componentName:o,sourceFile:Oe(i),hierarchy:[o],props:r.$props?Ot(r.$props):void 0}}return}catch{return}}function Po(e){try{let t=e;for(;t;){let r=t.__svelte_meta;if(r&&r.loc)return{framework:"svelte",sourceFile:Oe(r.loc.file),sourceLine:r.loc.line,sourceColumn:r.loc.column,componentName:r.loc.file?Rr(r.loc.file):void 0,hierarchy:r.loc.file?[Rr(r.loc.file)]:void 0};t=t.parentElement}return}catch{return}}function Io(e){try{let t=e.closest("[data-component], [data-component-name], [data-source-file]");if(!t)return;let r=t.getAttribute("data-component")||t.getAttribute("data-component-name")||void 0,n=t.getAttribute("data-source-file")||void 0,o=t.getAttribute("data-source-line"),i=o?parseInt(o,10):void 0;return!r&&!n?void 0:{framework:"vanilla",componentName:r,sourceFile:Oe(n),sourceLine:isNaN(i)?void 0:i,hierarchy:r?[r]:void 0}}catch{return}}function Oe(e){return e?e.split("?")[0]:void 0}function Rr(e){let t=e.split("/"),r=t[t.length-1]||e;return r.split(".")[0]||r}function Ot(e){let t={};for(let[r,n]of Object.entries(e))r.startsWith("__")||typeof n=="function"||(n==null||typeof n=="string"||typeof n=="number"||typeof n=="boolean"?t[r]=n:Array.isArray(n)?t[r]=`Array(${n.length})`:typeof n=="object"&&(t[r]="[Object]"));return t}function _e(e){let t=ge(e),r=e.tagName.toLowerCase(),n=e.id||void 0,o=Array.from(e.classList||[]),i=Re(e),a,s=!0;try{let c=e.getBoundingClientRect();a={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);s=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=ke(e.textContent?.trim(),80));let d=ke(e.outerHTML?.trim(),200);return{selector:t,tag:r,id:n,classes:o,boundingRect:a,visible:s,innerText:l,outerHTML:d,componentSource:i}}function Tr(e){if(typeof document>"u")return()=>{};let t=n=>{try{let o=n.target;if(!o||!(o instanceof Element))return;let i=_e(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=_e(o),a=o.getAttribute("action")||"",s=`submit form ${i.selector}${a?` (action: ${a})`:""}`;e({type:"submit",category:"ui",message:s,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 it=class{constructor(t){R(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?_e(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=_e(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,s=Math.max(0,Math.round(o.right-i)),l=Math.max(0,Math.round(o.bottom-a)),d=s>0||o.left<0,c=!1;return n.parentElement&&(c=n.parentElement.scrollWidth>n.parentElement.clientWidth),{id:t.id,ok:!0,result:{selector:r,overflow:d||c,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:s,overflowBottomPx:l,parentOverflow:c}}}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 s of i)a[s]=o.getPropertyValue(s)||o[s]||"";return{id:t.id,ok:!0,result:{selector:r,styles:a}}}};var st={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,showToolbar:!0,maskSelectors:['input[type="password"]',"[data-sensitive]"]},hidden:!1,hideQueryParam:void 0,debug:!1},at=new Set(["0","false","hidden","hide","off","none","disabled","ui_off","silent"]);function _t(e,t){let r=t;if(r===void 0){if(typeof window>"u"||!window.location)return!1;r=window.location.search}if(!r)return!1;try{let n=new URLSearchParams(r);if(e){let o=Array.isArray(e)?e:[e];for(let i of o)if(n.has(i)){let a=(n.get(i)||"").toLowerCase().trim();if(a===""||a==="1"||a==="true"||at.has(a))return!0}}for(let o of["no_bt","no_browsertrack","hide_bt","hide_browsertrack"])if(n.has(o)){let i=(n.get(o)||"").toLowerCase().trim();if(i===""||i==="1"||i==="true"||i==="yes")return!0}if(n.has("bt")){let o=(n.get("bt")||"").toLowerCase().trim();if(at.has(o))return!0}if(n.has("browsertrack")){let o=(n.get("browsertrack")||"").toLowerCase().trim();if(at.has(o))return!0}if(n.has("bt_ui")){let o=(n.get("bt_ui")||"").toLowerCase().trim();if(at.has(o)||o==="0"||o==="false")return!0}if(n.has("bt_hide")){let o=(n.get("bt_hide")||"").toLowerCase().trim();if(o===""||o==="1"||o==="true")return!0}}catch{}return!1}function Lr(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 Fr(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,s,l){let d=t,c=r.apply(history,[a,s,l]);try{let u=me(window.location.href);t=u,e({from:d,to:u,type:"pushState",timestamp:Date.now()})}catch{}return c},history.replaceState=function(a,s,l){let d=t,c=n.apply(history,[a,s,l]);try{let u=me(window.location.href);t=u,e({from:d,to:u,type:"replaceState",timestamp:Date.now()})}catch{}return c};let o=()=>{let a=t,s=me(window.location.href);t=s,e({from:a,to:s,type:"popstate",timestamp:Date.now()})},i=()=>{let a=t,s=me(window.location.href);t=s,e({from:a,to:s,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 Pr(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="",s="GET";try{typeof n=="string"?a=n:n instanceof URL?a=n.toString():n&&typeof n=="object"&&"url"in n&&(a=n.url,s=n.method||"GET"),o&&o.method&&(s=o.method.toUpperCase())}catch{a="unknown_url"}let l=me(a);try{let d=await r.apply(window,[n,o]),c=Date.now()-i;return e({url:l,method:s,status:d.status,statusText:d.statusText,durationMs:c,timestamp:i}),d}catch(d){let c=Date.now()-i,u=d?.name==="AbortError";throw e({url:l,method:s,durationMs:c,error:d?.message||"Network request failed",aborted:u,timestamp:i}),d}},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 s=String(a[0]||"GET").toUpperCase(),l=String(a[1]||"");i.set(this,{url:me(l),method:s,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 s=i.get(this)||{url:"unknown_url",method:"GET",startTime:Date.now()},l=()=>{try{let c=Date.now()-s.startTime;e({url:s.url,method:s.method,status:this.status,statusText:this.statusText,durationMs:c,aborted:s.aborted,timestamp:s.startTime})}catch{}},d=()=>{try{let c=Date.now()-s.startTime;e({url:s.url,method:s.method,status:this.status||0,durationMs:c,error:"XHR Network Error",aborted:s.aborted,timestamp:s.startTime})}catch{}};return this.addEventListener("load",l,{once:!0}),this.addEventListener("error",d,{once:!0}),this.addEventListener("timeout",d,{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 Ir(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,s="UnhandledRejection";if(o instanceof Error)i=o.message,a=o.stack,s=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 l={message:i,stack:a,errorType:s,timestamp:Date.now()};e(l,o)}catch{}};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",r)}}var Oo=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}},Ue=(e,t)=>{for(var r in t)Oo(e,r,{get:t[r],enumerable:!0})};function _o(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 Do(e="soft"){switch(e){case"auto":{k.session.styleMap=new Map,k.session.nodeMap=new Map;return}case"soft":{k.session.styleMap=new Map,k.session.nodeMap=new Map,k.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{k.session.styleMap=new Map,k.session.nodeMap=new Map,k.session.styleCache=new WeakMap,k.computedStyle=new WeakMap,k.measureHints=new WeakMap,k.baseStyle=new re(50),k.defaultStyle=new re(30),k.image=new re(100),k.background=new re(100),k.resource=new re(150),k.compress=new re(50),k.font=new Set;return}default:{k.session.styleMap=new Map,k.session.nodeMap=new Map,k.session.styleCache=new WeakMap;return}}}var re,k,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)}},k={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 lr(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let r=t[2].trim();return r.startsWith("#")?null:r}function gn(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&&!bn.test(a[1].trim()))continue;let s=o.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),l=1;if(s){let d=parseFloat(s[1]);l=/dpi/i.test(s[2])?d/96:d}n.push({url:i[2].trim(),dppx:l})}return n.length?(n.sort((o,i)=>o.dppx-i.dppx),(n.find(o=>o.dppx>=t)||n[n.length-1]).url):null}function Ho(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 Ct(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function Wo(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 bn,Nt=ae(()=>{"use strict";bn=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function Bo(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:r=12}={}){let n=new Map,o=0;function i(a,s,l){if(o>=r)return;let d=Date.now();(n.get(s)||0)>d||(n.set(s,d+t),o++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,s){i("warn",a,s)},errorOnce(a,s){i("error",a,s)},reset(){n.clear(),o=0}}}function jo(e){return/^data:|^blob:|^about:blank$/i.test(e)}function Uo(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 qo(e,t){if(!t||jo(e)||Uo(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 zo(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",Ct(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}${Ct(e)}`;let r=t.includes("?")?"&":"?";return`${t}${r}url=${encodeURIComponent(e)}`}function Or(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 Vo(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function le(e,t={}){let r=t.as??"blob",n=t.timeout??3e3,o=t.useProxy||"",i=t.errorTTL??8e3,a=t.headers||{},s=!!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[,g="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(g)?atob(y):decodeURIComponent(y),v=new Uint8Array([...x].map(w=>w.charCodeAt(0))),b=new Blob([v],{type:(g||"").split(";")[0]||""});return{ok:!0,data:b,status:200,url:e,fromCache:!1,mime:b.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let g=await fetch(e);if(!g.ok)return{ok:!1,data:null,status:g.status,url:e,fromCache:!1,reason:"http_error"};let y=await g.blob(),x=y.type||g.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Or(y),status:g.status,url:e,fromCache:!1,mime:x}:r==="text"?{ok:!0,data:await y.text(),status:g.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:g.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 l=Vo(e,{as:r,timeout:n,useProxy:o,errorTTL:i}),d=He.get(l);if(d&&d.until>Date.now())return{...d.result,fromCache:!0};d&&He.delete(l);let c=ft.get(l);if(c)return c;let u=qo(e,o)?zo(e,o):e,p=t.credentials;if(!p)try{let g=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,g);p=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{p="omit"}let f=new AbortController,h=setTimeout(()=>f.abort("timeout"),n),m=(async()=>{try{let g=await fetch(u,{signal:f.signal,credentials:p,headers:a});if(!g.ok){let v={ok:!1,data:null,status:g.status,url:u,fromCache:!1,reason:"http_error"};if(i>0&&He.set(l,{until:Date.now()+i,result:v}),!s){let b=`${g.status} ${g.statusText||""}`.trim();Ut.warnOnce(`http:${g.status}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${b} while fetching ${r} ${e}`)}return t.onError&&t.onError(v),v}if(r==="text")return{ok:!0,data:await g.text(),status:g.status,url:u,fromCache:!1};let y=await g.blob(),x=y.type||g.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Or(y),status:g.status,url:u,fromCache:!1,mime:x}:{ok:!0,data:y,status:g.status,url:u,fromCache:!1,mime:x}}catch(g){let y=g&&typeof g=="object"&&"name"in g&&g.name==="AbortError"?String(g.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:u,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&i>0&&He.set(l,{until:Date.now()+i,result:x}),!s){let v=`${y}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,b=y==="timeout"?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${r} ${e}`:`Network/CORS issue while fetching ${r} ${e}. A proxy may be required`;Ut.errorOnce(v,b)}return t.onError&&t.onError(x),x}finally{clearTimeout(h),ft.delete(l)}})();return ft.set(l,m),m}var Ut,ft,He,$e=ae(()=>{"use strict";Nt(),Ut=Bo("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ft=new Map,He=new Map});async function yn(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let r=gn(e,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??lr(e);if(!r)return e;let n=Wo(r),o=Ct(n),i=(t.useProxy||"")+"|"+o;if(k.background.has(i)){let a=k.background.get(i);return a?`url("${a}")`:"none"}try{let a=await le(o,{as:"dataURL",useProxy:t.useProxy});return a.ok?(k.background.set(i,a.data),`url("${a.data}")`):(k.background.set(i,null),"none")}catch{return k.background.set(i,null),"none"}}var Xo=ae(()=>{"use strict";ne(),Nt(),$e()});function wn(e){if(e=String(e).toLowerCase(),dr.has(e)){let i={};return k.defaultStyle.set(e,i),i}if(k.defaultStyle.has(e))return k.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(cr(i))continue;let a=n.getPropertyValue(i);o[i]=a}return t.removeChild(r),k.defaultStyle.set(e,o),o}function cr(e){let t=Vt.get(e);if(t===void 0){let r=String(e).toLowerCase();t=kn.has(r)||Cn.test(r)||Sn.test(r),Vt.set(e,t)}return t}function xn(e,t){return!En.has(e)&&(t==="inline"||Mn.has(e)||ur.has(e))}function Yo(e,t,r){let n=(t.display||"").toLowerCase();if(n==="inline"||ur.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:!Rn.has(n)}function qt(e,t,r=!0,n=!1){if(t=String(t||"").toLowerCase(),dr.has(t))return"";let o=[],i=wn(t),a=(e.display||"").toLowerCase(),s=a==="inline",l=xn(t,a),d=e["text-wrap-mode"]||e["white-space"]||"",c=d==="nowrap"||d==="pre",u=l&&r&&!(l&&r&&!s&&c),p=!1;for(let f in e){if(cr(f))continue;let h=e[f];if(u){if($n.has(f))continue;if(An.has(f)){h&&h!==i[f]&&(o.push(`${f}:${h}`),h!=="auto"&&(p=!0));continue}}if(h&&h!==i[f]){if(!c&&(f==="width"||f==="inline-size")&&h.endsWith("px")&&h.includes(".")){let m=parseFloat(h);if(Number.isFinite(m)){o.push(`${f}:${(m+Nn).toFixed(3)}px`);continue}}o.push(`${f}:${h}`)}}if(u&&!s&&!n&&!p){let f=e.width;f&&f!=="auto"&&f!==i.width&&o.push(`min-width:${f}`)}return o.sort(),o.join(";")}function Go(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 Qo(e){let t=new Map;for(let n of e){let o=wn(n);if(!o)continue;let i=Object.entries(o).map(([a,s])=>`${a}:${s};`).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 Ko(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 Jo(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 B(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=k.computedStyle.get(e);n||(n=new Map,k.computedStyle.set(e,n));let o=n.get(t);if(!o){let i=Jo(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 _r(e){let t={};for(let r of e)t[r]=e.getPropertyValue(r);for(let r of Tn){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 zt(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 vn,dr,Zo,Sn,Cn,kn,Vt,Mn,ur,En,$n,An,Nn,Rn,Tn,Rt=ae(()=>{"use strict";ne(),vn=new Set(["meta","script","noscript","title","link","template"]),dr=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"]),Zo=["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"],Sn=/(?:^|-)(animation|transition)(?:-|$)/i,Cn=/^(--.+|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,kn=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"]),Vt=new Map,Mn=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),ur=new Set(["table","thead","tbody","tfoot","tr","td","th"]),En=new Set(["img","video","canvas","svg","iframe","embed","object","input","textarea","select"]),$n=new Set(["width","max-width","inline-size","max-inline-size"]),An=new Set(["min-width","min-inline-size"]),Nn=.001,Rn=new Set(["inline-block","inline-flex","inline-grid","inline-table","inline-flow-root","table"]),Tn=["top","right","bottom","left"]});function ht(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function Me(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 ei(){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,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),d=/ipad|iphone|ipod/.test(t)&&n;return r||a||s||l||d}function ti(){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 Ln=ae(()=>{"use strict"}),de=ae(()=>{"use strict";Xo(),Rt(),Ae(),Nt(),Ln()}),Fn={};Ue(Fn,{decodeSvgFromDataURL:()=>pr,encodeSvgToDataURL:()=>fr,fixSafariShadows:()=>hr,toCanvas:()=>Tt});function ri(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,ye/n,ye/o,Math.sqrt(kt/(n*o)));if(i>=1)return e;let a=Math.max(1,Math.floor(n*i)),s=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 (${ye}px/side); downscaling to ${a}\xD7${s}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${s}`))}catch{return e}}function ni(e,t){let r=["x","y","width","height"].map(S=>Number(t?.[S]));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[s,l,d,c]=a,u=Math.max(s,r[0]),p=Math.max(l,r[1]),f=Math.min(s+d,r[0]+r[2]),h=Math.min(l+c,r[1]+r[3]);if(!(f>u)||!(h>p))throw new RangeError("[snapdom] canvas crop does not intersect the SVG viewBox");let m=parseFloat((o.match(/\bwidth="([\d.]+)/i)||[])[1]),g=parseFloat((o.match(/\bheight="([\d.]+)/i)||[])[1]),y=Number.isFinite(m)&&m>0?m/d:1,x=Number.isFinite(g)&&g>0?g/c:1,v=Math.max(1,(f-u)*y),b=Math.max(1,(h-p)*x),w=o.replace(/(\bwidth=")[^"]*/i,`$1${v}`).replace(/(\bheight=")[^"]*/i,`$1${b}`).replace(/(\bviewBox=")[^"]*/i,`$1${u} ${p} ${f-u} ${h-p}`);return e.replace(o,w)}function Dr(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function pr(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function oi(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 fr(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function Pn(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 ii(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)||[],[s="0px",l="0px",d="0px"]=a;d=`${parseFloat(d)/2}px`;let c=i.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),u=!!c&&c!==",";o.push(`drop-shadow(${s} ${l} ${d}${u?` ${c}`:""})`)}return o.join(" ")}function In(e){let t=Pn(e),r=null,n=null,o=null,i=[];for(let s of t){let l=s.indexOf(":");if(l<0)continue;let d=s.slice(0,l).trim().toLowerCase(),c=s.slice(l+1).trim();d==="box-shadow"?o=c:d==="filter"?r=c:d==="-webkit-filter"?n=c:i.push([d,c])}if(o){let s=ii(o);s&&(r=r?`${r} ${s}`:s,n=n?`${n} ${s}`:s)}let a=[...i];return r&&a.push(["filter",r]),n&&a.push(["-webkit-filter",n]),a.map(([s,l])=>`${s}:${l}`).join(";")}function ai(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,r,n)=>`${r}{${In(n)}}`)}function si(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,r)=>t.replace(r,ai(r))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,r,n)=>`style=${r}${In(n)}${r}`),e}function li(){return mt||(mt=(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}}})(),mt)}function ci(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,s="",l=0;for(;l<o.length;){let d=o[l];if(d==="("?i++:d===")"&&(i=Math.max(0,i-1)),i===0&&(l===0||o[l-1]===" ")){let c=/^-?\d*\.?\d+px/.exec(o.slice(l));if(c){a++,s+=a===2?`${-parseFloat(c[0])}px`:c[0],l+=c[0].length;continue}}s+=d,l++}return s}).join(",")}function di(e,t){let r=n=>Pn(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}:${ci(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,s)=>`${a}{${r(s)}}`))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(n,o,i)=>`style=${o}${r(i)}${o}`),e}async function hr(e){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(e))return{svg:e,naturalOnly:!1};let{native:t,flippedY:r}=await li();try{let n=e;return t||(n=si(n)),r&&(n=di(n,t)),{svg:n,naturalOnly:!0}}catch{return{svg:e,naturalOnly:!0}}}async function ui(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,s=!1;for(let l=3;l<a.length;l+=4)if(a[l]>0){s=!0;break}if(s||performance.now()>i)return;await n()}}finally{try{e.remove()}catch{}}}async function Tt(e,t){let{width:r,height:n,scale:o=1,dpr:i=1,meta:a={},backgroundColor:s,crop:l=null}=t,d=e,c=!1,u=!1;if(l&&!Dr(e))throw new RangeError("[snapdom] canvas crop requires an SVG capture payload");if(Dr(e)){let $=(oi(e).match(/<svg\b[^>]*>/i)||[])[0]||"",N=parseFloat(($.match(/\bwidth="([\d.]+)/i)||[])[1]),L=parseFloat(($.match(/\bheight="([\d.]+)/i)||[])[1]),_=Number.isFinite(N)&&Number.isFinite(L)&&N>0&&L>0&&Math.min(1,ye/N,ye/L,Math.sqrt(kt/(N*L)))<1;if(l||_||we())try{let F=pr(e);if(l&&(F=ni(F,l)),we()){let I=await hr(F);F=I.svg,c=I.naturalOnly,u=/@font-face|data:image\//i.test(F)}(_||l)&&(F=ri(F)),d=fr(F)}catch(F){if(l)throw F;d=e}}let p=new Image;p.loading="eager",p.decoding="sync",p.crossOrigin="anonymous",p.src=d,await p.decode(),we()&&await ui(p,u);let f=p.naturalWidth,h=p.naturalHeight,m=l?f:Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:f,g=l?h:Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:h,y,x,v=Number.isFinite(r),b=Number.isFinite(n);if(v&&b)y=Math.max(1,r),x=Math.max(1,n);else if(v){let $=r/Math.max(1,m);y=r,x=g*$}else if(b){let $=n/Math.max(1,g);x=n,y=m*$}else y=f,x=h;y=y*o,x=x*o;let w=y*i,S=x*i,M=Math.max(w/ye,S/ye,Math.sqrt(w*S/kt));M>1&&(console.warn(`[snapDOM] Output ${Math.round(w)}\xD7${Math.round(S)}px exceeds the browser canvas limit (${ye}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),y/=M,x/=M);let C=document.createElement("canvas");C.width=y*i,C.height=x*i,C.style.width=`${y}px`,C.style.height=`${x}px`;let E=C.getContext("2d");if(i!==1&&E.scale(i,i),s&&(E.save(),E.fillStyle=s,E.fillRect(0,0,y,x),E.restore()),c&&(Math.round(y*i)!==f||Math.round(x*i)!==h)){let $=document.createElement("canvas");$.width=f,$.height=h,$.getContext("2d").drawImage(p,0,0),E.drawImage($,0,0,y,x)}else E.drawImage(p,0,0,y,x);return C}var ye,kt,mt,qe=ae(()=>{"use strict";Ae(),ye=16384,kt=16384*16384,mt=null}),gt={};Ue(gt,{rasterize:()=>On});async function On(e,t){let r=await Tt(e,t),n=await new Promise(i=>{let a=()=>i(r.toDataURL(`image/${t.format}`,t.quality));try{r.toBlob(s=>{if(!s)return a();let l=new FileReader;l.onload=()=>i(String(l.result||"")),l.onerror=a,l.readAsDataURL(s)},`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 bt=ae(()=>{"use strict";qe()}),Xt={};Ue(Xt,{toImg:()=>Hr,toSvg:()=>Hr});async function Hr(e,t){let{scale:r=1,width:n,height:o,meta:i={}}=t,a=Number.isFinite(n),s=Number.isFinite(o),l=Number.isFinite(r)&&r!==1||a||s;if(we()&&l)try{let{svg:c}=await hr(pr(e)),u=(c.match(/<svg\b[^>]*>/i)||[])[0]||"",p=parseFloat((u.match(/\bwidth="([\d.]+)/i)||[])[1]),f=parseFloat((u.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(p)||!Number.isFinite(f))throw new Error("svg without dimensions");let h=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:p,m=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:f,g,y;a&&s?(g=n,y=o):a?(g=n,y=Math.round(m*(n/Math.max(1,h)))):s?(y=o,g=Math.round(h*(o/Math.max(1,m)))):(g=Math.round(p*r),y=Math.round(f*r));let x=c.replace(/width="[^"]*"/,`width="${g}"`).replace(/height="[^"]*"/,`height="${y}"`),v=new Image;return v.decoding="sync",v.loading="eager",v.src=fr(x),await v.decode(),v.style.width=`${g}px`,v.style.height=`${y}px`,v}catch(c){return j(t,"safari vector toImg failed, falling back to PNG",c),On(e,{...t,format:"png",quality:1,meta:i})}let d=new Image;if(d.decoding="sync",d.loading="eager",d.src=e,await d.decode(),a&&s)d.style.width=`${n}px`,d.style.height=`${o}px`;else if(a){let c=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:d.naturalWidth,u=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:d.naturalHeight,p=n/Math.max(1,c);d.style.width=`${n}px`,d.style.height=`${Math.round(u*p)}px`}else if(s){let c=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:d.naturalWidth,u=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:d.naturalHeight,p=o/Math.max(1,u);d.style.height=`${o}px`,d.style.width=`${Math.round(c*p)}px`}else{let c=Math.round(d.naturalWidth*r),u=Math.round(d.naturalHeight*r);if(d.style.width=`${c}px`,d.style.height=`${u}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let p=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${c}"`).replace(/height="[^"]*"/,`height="${u}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,d.src=e}catch(p){j(t,"SVG width/height patch in toImg failed",p)}}return d}var Wr=ae(()=>{"use strict";de(),bt(),qe()}),_n={};Ue(_n,{toBlob:()=>Dn});async function Dn(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 Tt(e,t);return new Promise(o=>n.toBlob(i=>o(i),`image/${r}`,t.quality))}var Hn=ae(()=>{"use strict";qe()}),Wn={};Ue(Wn,{download:()=>pi});async function Br(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 pi(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",s=t?.filename||`snapdom.${a}`,l={...t||{},format:a,type:a};l.dpr=1;let d=ei();if(a==="svg"){let p=await Dn(e,{...l,type:"svg"});if(d&&await Br(p,s))return;let f=URL.createObjectURL(p),h=document.createElement("a");h.href=f,h.download=s,document.body.appendChild(h),h.click(),URL.revokeObjectURL(f),h.remove();return}let c=await Tt(e,l);if(d){let p=`image/${a}`,f=await new Promise(h=>c.toBlob(h,p,t?.quality));if(f&&await Br(f,s))return}let u=document.createElement("a");u.href=c.toDataURL(`image/${a}`,t?.quality),u.download=s,document.body.appendChild(u),u.click(),u.remove()}var fi=ae(()=>{"use strict";Hn(),qe(),Ae()});de();de();ne();var Yt=new WeakMap,Be=new Map,hi=2e3,Mt=0;function yt(){Mt++,Be.size>hi&&Be.clear()}var mi="[data-snapdom-sandbox],[data-snapdom-internal],[data-snapdom]";function Dt(e){let t=e&&(e.nodeType===1?e:e.parentElement);return!!(t&&t.closest&&t.closest(mi))}function Bn(e){for(let t of e)if(!Dt(t.target)){if(t.type==="childList"){let r=!0;for(let n of t.addedNodes)if(!Dt(n)){r=!1;break}if(r){for(let n of t.removedNodes)if(!Dt(n)){r=!1;break}}if(r)continue}return!0}return!1}var jr=!1;function gi(e=document.documentElement){if(jr)return;jr=!0;let t=r=>{Bn(r)&&yt()};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",yt),r.ready?.then(()=>yt()).catch(()=>{}))}catch{}}var bi=["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 Ur(e){let t=Yt.get(e);if(t&&t.epoch===Mt){let r=t.snapshot&&t.snapshot.__needsBgInline;if(r!==void 0)return r}return!0}function yi(e,t={}){let r={},n=t.excludeStyleProps;for(let u=0;u<e.length;u++){let p=e[u];if(cr(p)||n&&(n instanceof RegExp&&n.test(p)||typeof n=="function"&&n(p)))continue;let f=e.getPropertyValue(p);(p==="background-image"||p==="content")&&f.includes("url(")&&!f.includes("data:")&&(f="none"),r[p]=f}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let u of o)if(!r[u])try{let p=e.getPropertyValue(u);p&&(r[u]=p)}catch{}let i=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let u of i)if(!r[u])try{let p=e.getPropertyValue(u);p&&(r[u]=p)}catch{}if(t.embedFonts){let u=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let p of u)if(!r[p])try{let f=e.getPropertyValue(p);f&&(r[p]=f)}catch{}}try{(r["content-visibility"]||e.getPropertyValue("content-visibility"))==="hidden"&&(r["content-visibility"]="hidden")}catch{}let a=!1;{let u=e.getPropertyValue("background-image");if(u&&u!=="none"&&(a=!0),!a){let p=e.getPropertyValue("background-color");p&&p!=="rgba(0, 0, 0, 0)"&&p!=="transparent"&&(a=!0)}if(!a)for(let p of bi){let f=e.getPropertyValue(p);if(f&&f!=="none"){a=!0;break}}if(!a){let p=e.getPropertyValue("background");p&&/url\s*\(/i.test(p)&&(a=!0)}}Object.defineProperty(r,"__needsBgInline",{value:a,enumerable:!1});let s=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,d=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,c=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(s===0&&l===0&&d===0&&c===0){let u=(e.getPropertyValue("border-image-source")||"").trim(),p=u&&u!=="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 h of f)delete r[h];p||(r.border="none")}return r}function wi(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=B(t).position;if(r!=="absolute"&&r!=="fixed")return!0}}return!1}function xi(e,t,r){try{if(typeof e.computedStyleMap=="function"){let o=e.computedStyleMap().get("width");if(o!=null)return!qr(String(o).trim().toLowerCase())}}catch{}let n=e.style&&(e.style.width||e.style.inlineSize);return n&&!qr(String(n).trim().toLowerCase())?!0:Si(e,t)?r||Ci(e,t):!1}var vi=new Set(["auto","min-content","max-content","stretch","fill-available","-webkit-fill-available"]);function qr(e){return vi.has(e)||e.startsWith("fit-content")}function Si(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 s;if(a.nodeType===3){if(!/\S/.test(a.nodeValue||"")||(i=i||document.createRange(),i.selectNode(a),s=i.getBoundingClientRect(),!s.width&&!s.height))continue}else if(a.nodeType===1){let l=B(a);if(l.display==="none"||l.position==="absolute"||l.position==="fixed")continue;s=a.getBoundingClientRect()}else continue;s.left<n&&(n=s.left),s.right>o&&(o=s.right)}return o===-1/0?!1:o-n<r-.5}function Ci(e,t){let r=e.parentElement;if(!r)return!1;let n=B(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 zr=new WeakMap;function ki(e){let t=zr.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(";"),zr.set(e,t),t)}function Mi(e,t=null,r={}){let n=Yt.get(e),o=!!(r&&r.embedFonts),i=r&&r.excludeStyleProps||null;if(n&&n.epoch===Mt&&n.embedFonts===o&&n.excludeStyleProps===i)return n.snapshot;let a=t||getComputedStyle(e),s=yi(a,r);return Ti(e,a,s),Yt.set(e,{epoch:Mt,snapshot:s,embedFonts:o,excludeStyleProps:i}),s}function Ei(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Be,defaultStyle:k.defaultStyle,baseStyle:k.baseStyle,image:k.image,resource:k.resource,background:k.background,font:k.font},options:t||{}}:{session:k.session,persist:{snapshotKeyCache:Be,defaultStyle:k.defaultStyle,baseStyle:k.baseStyle,image:k.image,resource:k.resource,background:k.background,font:k.font},options:e||t||{}}}function $i(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 pe(e,t,r,n){if(e.tagName==="STYLE")return;let o=Ei(r,n),i=o.options&&o.options.cache||"auto";i!=="disabled"&&gi(document.documentElement),i==="disabled"&&!o.session.__bumpedForDisabled&&(yt(),Be.clear(),o.session.__bumpedForDisabled=!0);let{session:a,persist:s}=o;if(!a.styleCache.has(e)){let g=null;try{g=getComputedStyle(e)}catch{}a.styleCache.set(e,g||getComputedStyle(document.documentElement))}let l=a.styleCache.get(e);e.getAttribute?.("style")&&$i(e,t,l);let d=l.getPropertyValue("animation-name");t&&t.style&&d&&d!=="none"&&t.style.setProperty("animation","none","important");let c=Mi(e,l,o.options),u=jn(e);if(u){let g=l.getPropertyValue("min-width");(!g||g==="auto"||g==="0px")&&(c["min-width"]="0px")}let p=e.tagName?.toLowerCase()||"div",f=ki(c),h=!0;if(xn(p,(c.display||"").toLowerCase())){h=wi(e),h&&Yo(p,c,u)&&xi(e,l,u)&&(h=!1),f=`${f}|${p}${h?"|c":""}${u?"|f":""}`;let g=c["text-wrap-mode"]||c["white-space"]||"";h&&g!=="nowrap"&&g!=="pre"&&(a.reconcileRisk=(a.reconcileRisk||0)+1)}let m=s.snapshotKeyCache.get(f);m===void 0&&(m=qt(c,p,h,u),s.snapshotKeyCache.set(f,m)),a.styleMap.set(t,m)}function Ai(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 jn(e){let t=e.parentElement;if(!t)return!1;let r=B(t).display||"";return r.includes("flex")||r.includes("grid")}function Ni(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=B(n);if(o.display==="none")continue;let i=o.position;if(i!=="absolute"&&i!=="fixed")return!0}return!1}function Ri(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 s=n.getBoundingClientRect();(s.width||s.height)&&(r=Math.max(r,s.bottom));continue}if(o.nodeType!==1)continue;let i=B(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 Ti(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"||Ai(t)||jn(e))return;let a=t.overflowX||t.overflow||"visible",s=t.overflowY||t.overflow||"visible";if(a!=="visible"||s!=="visible")return;let l=t.clip;if(l&&l!=="auto"&&l!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||!Ni(e))return;let d=parseFloat(t.height),c=Ri(e);Number.isFinite(d)&&Number.isFinite(c)&&Math.abs(d-c)>2||(delete r.height,delete r["block-size"])}Rt();var Un=["fill","stroke","color","background-color","stop-color"],Li=new Set(["symbol","defs","pattern","marker","linearGradient","radialGradient","filter"]);function Gt(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(Li.has(t.localName))return!0}t=t.parentNode}return!1}var Vr=new Map;function Fi(e,t){let r=t+"::"+e.toLowerCase(),n=Vr.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 s=getComputedStyle(i),l={};for(let d of Un)l[d]=s.getPropertyValue(d)||"";return a.remove(),Vr.set(r,l),l}function Pi(e,t){if(e?.nodeType!==1||t?.nodeType!==1||Gt(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 s=i[a];if(s&&typeof s.value=="string"&&s.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 s=0;s<i.length;s++){let l=i[s];if(a.has(l))continue;a.add(l);let d=i.getPropertyValue(l);if(!d||!d.includes("var("))continue;let c=o&&o.getPropertyValue(l);if(c)try{t.style.setProperty(l,c.trim(),i.getPropertyPriority(l))}catch{}}}}if(n&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let s=i[a];if(!s||typeof s.value!="string"||!s.value.includes("var("))continue;let l=s.name,d=o&&o.getPropertyValue(l);if(d)try{t.style.setProperty(l,d.trim())}catch{}}}if(!n){if(!o)try{o=getComputedStyle(e)}catch{o=null}if(!o)return;let i=e.namespaceURI||"html",a=Fi(e.tagName,i);for(let s of Un){let l=o.getPropertyValue(s)||"",d=a[s]||"";if(l&&l!==d)try{t.style.setProperty(s,l.trim())}catch{}}}}de();de();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 Xr="img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]";function Ii(e,t){return!e||e?.nodeType!==1?!1:e.matches?.("picture")||e.querySelector("picture")?!0:t?!!(e.matches?.(Xr)||e.querySelector(Xr)):!1}var Oi=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i;function Et(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 s=a[1]||"",l=1;/^\d*\.?\d+x$/i.test(s)?l=parseFloat(s):/^\d+w$/i.test(s)&&(l=parseInt(s,10)/r),n.push({url:a[0],d:l})}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 qn(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 s=i.getAttribute("type");if(s&&!Oi.test(s.trim()))continue;let l=i.getAttribute("media");if(l)try{if(window.matchMedia(l).matches)return Et(a,e)}catch{}o||(o=Et(a,e))}return o}function _i(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 Di(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 Hi(e,t={}){if(!e||e?.nodeType!==1||t.resolvePicturePlaceholders===!1)return null;let{timeout:r,concurrency:n,resolveLazySrc:o,silent:i,useProxy:a}=Di(t);if(!Ii(e,o))return null;let s=[],l=[];async function d(p){let f=await le(p,{as:"dataURL",timeout:r,useProxy:a,silent:!0});return f.ok?f.data:null}async function c(p){for(let f=0;f<p.length;f+=n){let h=p.slice(f,f+n);await Promise.allSettled(h.map(m=>m()))}}let u=Array.from(e.querySelectorAll("picture"));e.matches?.("picture")&&u.unshift(e);for(let p of u){let f=p.querySelector("img");if(!f)continue;let h=f.getAttribute("src")||"";if(!Ee(h))continue;let m=qn(f,p);m&&l.push(async()=>{let g=await d(m);if(!g){i||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${m.slice(0,60)}`);return}let y=f.getAttribute("src"),x=f.getAttribute("srcset"),v=f.getAttribute("sizes"),b=[];f.src=g,f.setAttribute("src",g),f.removeAttribute("srcset"),f.removeAttribute("sizes");let w=p.querySelectorAll("source");for(let S of w)b.push({el:S,parent:S.parentElement,next:S.nextSibling}),S.remove();s.push(()=>{y!==null?f.setAttribute("src",y):f.removeAttribute("src"),x!==null&&f.setAttribute("srcset",x),v!==null&&f.setAttribute("sizes",v);for(let{el:S,parent:M,next:C}of b)M&&M.insertBefore(S,C)})})}if(o){let p=Array.from(e.querySelectorAll("img"));e.localName==="img"&&p.unshift(e);for(let f of p){if(f.closest("picture")&&Ee(f.getAttribute("src")||""))continue;let h=f.getAttribute("src")||"",m=_i(f);m&&Ee(h)&&l.push(async()=>{let g=await d(m);if(!g)return;let y=f.getAttribute("src");f.src=g,f.setAttribute("src",g),f.removeAttribute("srcset"),f.removeAttribute("sizes"),s.push(()=>{y!==null?f.setAttribute("src",y):f.removeAttribute("src")})})}}return l.length===0?null:(await c(l),async function(){for(let p of s)try{p()}catch{}})}function Ht(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(){ht(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(n,o):i()},{fast:r})}i()})))}function Wi(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 Bi(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?Wi(o,n):o;return`:where(${t} ${i})`}).join(", ")}function ji(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 s=Bi(a,t,!0,r);return`${o}${i}${s}{`}),e):""}function Ui(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function qi(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 zi(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 Vi(e,t){try{let r=null,n=B(e).content;if(n&&n.includes("url(")){let a=n.match(/url\(["']?([^"')]+)["']?\)/);a&&(r=a[1])}let o=e.closest?.("picture"),i=r||(o?qn(e,o):e.currentSrc)||e.src||Et(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 Xi(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 Yi(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 Gi(e,t,r){let n=[];for(let o of t){let i=Yi(e,o);i&&n.push(`${o}: ${i};`)}return n.length?`${r}{${n.join("")}}
|
|
5
|
+
`:""}function Qi(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 Ki(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 Ji(e){let t=e.getBoundingClientRect(),r=0,n=0,o=0,i=0;try{let l=getComputedStyle(e);r=parseFloat(l.borderLeftWidth)||0,n=parseFloat(l.borderRightWidth)||0,o=parseFloat(l.borderTopWidth)||0,i=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(r+n))),s=Math.max(0,Math.round(t.height-(o+i)));return{contentWidth:a,contentHeight:s,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 Zi(e,t,r){let n=e.defaultView,o=n?n.scrollX:0,i=n?n.scrollY:0,a=e.body?e.body.scrollLeft:0,s=e.body?e.body.scrollTop:0,l=e.documentElement?e.documentElement.scrollLeft:0,d=e.documentElement?e.documentElement.scrollTop:0,c=0,u=0,p=0,f=0;try{let m=n&&e.body?n.getComputedStyle(e.body):null;m&&(c=(parseFloat(m.marginTop)||0)+(parseFloat(m.paddingTop)||0),u=(parseFloat(m.marginRight)||0)+(parseFloat(m.paddingRight)||0),p=(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 h=e.createElement("style");return h.setAttribute("data-sd-iframe-pin",""),h.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: ${c}px ${u}px ${p}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(h),()=>{try{h.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=s),e.documentElement&&(e.documentElement.scrollLeft=l,e.documentElement.scrollTop=d)}catch{}}}async function ea(e,t,r){let n=await Ki(e,3);if(!n)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:i,rect:a}=Ji(e),s=r?.snap;if(!s&&typeof window<"u"&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let l={...r,scale:1,clip:null},d=Zi(n,o,i),c=k.session.nodeMap,u=k.session.styleMap,p=k.session.styleCache,f;try{f=await s.toPng(n.documentElement,l)}finally{d(),k.session.nodeMap=c,k.session.styleMap=u,k.session.styleCache=p}f.style.display="block",f.style.width=`${o}px`,f.style.height=`${i}px`;let h=document.createElement("div");return t.nodeMap.set(h,e),pe(e,h,t,r),h.style.overflow="hidden",h.style.display="block",h.style.width||(h.style.width=`${Math.round(a.width)}px`),h.style.height||(h.style.height=`${Math.round(a.height)}px`),h.appendChild(f),h}function ta(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,s=Math.round(t||n.width||0),l=Math.round(r||n.height||0),d=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,s||16),c=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),u=(e.type||"text").toLowerCase()==="checkbox",p=!!e.checked,f=!!e.indeterminate,h=Math.max(Math.min(d,c),12),m="middle";try{o&&o.verticalAlign&&(m=o.verticalAlign)}catch{}let g=document.createElement("div");g.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),g.style.cssText=`display:inline-block;width:${h}px;height:${h}px;vertical-align:${m};flex-shrink:0;line-height:0;`;let y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width",String(h)),y.setAttribute("height",String(h)),y.setAttribute("viewBox",`0 0 ${h} ${h}`),g.appendChild(y);function x(){let v="#0a6ed1";try{o&&(v=o.accentColor||o.color||v)}catch{}let b=2,w=b/2,S=h-b;if(y.innerHTML="",u){let M=document.createElementNS("http://www.w3.org/2000/svg","rect");if(M.setAttribute("x",String(w)),M.setAttribute("y",String(w)),M.setAttribute("width",String(S)),M.setAttribute("height",String(S)),M.setAttribute("rx","2"),M.setAttribute("ry","2"),M.setAttribute("fill",p?v:"none"),M.setAttribute("stroke",v),M.setAttribute("stroke-width",String(b)),y.appendChild(M),p){let C=document.createElementNS("http://www.w3.org/2000/svg","path");C.setAttribute("d",`M ${w+2} ${h/2} L ${h/2-1} ${h-w-2} L ${h-w-2} ${w+2}`),C.setAttribute("stroke","white"),C.setAttribute("stroke-width",String(Math.max(1.5,b))),C.setAttribute("fill","none"),C.setAttribute("stroke-linecap","round"),C.setAttribute("stroke-linejoin","round"),y.appendChild(C)}else if(f){let C=document.createElementNS("http://www.w3.org/2000/svg","rect"),E=Math.max(6,S-4);C.setAttribute("x",String((h-E)/2)),C.setAttribute("y",String((h-b)/2)),C.setAttribute("width",String(E)),C.setAttribute("height",String(b)),C.setAttribute("fill",v),C.setAttribute("rx","1"),y.appendChild(C)}}else{let M=document.createElementNS("http://www.w3.org/2000/svg","circle");if(M.setAttribute("cx",String(h/2)),M.setAttribute("cy",String(h/2)),M.setAttribute("r",String((h-b)/2)),M.setAttribute("fill",p?v:"none"),M.setAttribute("stroke",v),M.setAttribute("stroke-width",String(b)),y.appendChild(M),p){let C=document.createElementNS("http://www.w3.org/2000/svg","circle"),E=Math.max(2,(h-b*2)*.35);C.setAttribute("cx",String(h/2)),C.setAttribute("cy",String(h/2)),C.setAttribute("r",String(E)),C.setAttribute("fill","white"),y.appendChild(C)}}g.style.setProperty("width",`${h}px`,"important"),g.style.setProperty("height",`${h}px`,"important"),g.style.setProperty("min-width",`${h}px`,"important"),g.style.setProperty("min-height",`${h}px`,"important")}return x(),{el:g,applyVisual:x}}var De=new re(80);async function We(e){if(k.resource?.has(e))return k.resource.get(e);if(De.has(e))return De.get(e);let t=(async()=>{let r=await le(e,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return k.resource?.set(e,r.data),r.data})();De.set(e,t);try{let r=await t;return De.set(e,r),r}catch(r){throw De.delete(e),r}}var ra=/\bblob:[^)"'\s]+/g;async function Yr(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(ra)||[]));if(t.length===0)return e;let r=e;for(let n of t)try{let o=await We(n);r=r.split(n).join(o)}catch{}return r}function lt(e){return typeof e=="string"&&e.startsWith("blob:")}function na(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 oa(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}function ct(e,t){let r=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&r.unshift(e),r}async function ia(e,t=null){if(!e)return;let r=t,n=ct(e,"img");for(let l of n)try{let d=l.getAttribute("src")||l.currentSrc||"";if(lt(d)){let u=await We(d);l.setAttribute("src",u)}let c=l.getAttribute("srcset");if(c&&c.includes("blob:")){let u=na(c),p=!1;for(let f of u)if(lt(f.url))try{f.url=await We(f.url),p=!0}catch(h){j(r,"blobUrlToDataUrl for srcset item failed",h)}p&&l.setAttribute("srcset",oa(u))}}catch(d){j(r,"resolveBlobUrls for img failed",d)}let o=ct(e,"image");for(let l of o)try{let d="http://www.w3.org/1999/xlink",c=l.getAttribute("href")||l.getAttributeNS?.(d,"href");if(lt(c)){let u=await We(c);l.setAttribute("href",u),l.removeAttributeNS?.(d,"href")}}catch(d){j(r,"resolveBlobUrls for SVG image href failed",d)}let i=ct(e,"[style*='blob:']");for(let l of i)try{let d=l.getAttribute("style");if(d&&d.includes("blob:")){let c=await Yr(d);l.setAttribute("style",c)}}catch(d){j(r,"replaceBlobUrls in inline style failed",d)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let d=l.textContent||"";d.includes("blob:")&&(l.textContent=await Yr(d))}catch(d){j(r,"replaceBlobUrls in style tag failed",d)}let s=["poster"];for(let l of s){let d=ct(e,`[${l}^='blob:']`);for(let c of d)try{let u=c.getAttribute(l);lt(u)&&c.setAttribute(l,await We(u))}catch(u){j(r,`resolveBlobUrls for ${l} failed`,u)}}}Ae();var Qt=new Map,Gr=new Set(["IFRAME"]);function Lt(e,t){Qt.set(String(e).toUpperCase(),t)}function Wt(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 dt=200,aa=new Set(["img","canvas","video","iframe","object","embed"]);function Qr(e,t){return e.right>=t.left-dt&&e.left<=t.right+dt&&e.bottom>=t.top-dt&&e.top<=t.bottom+dt}function sa(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=B(e);if(n.display==="inline"&&!aa.has((e.localName||"").toLowerCase()))return!1;let o=t.rect,i=e.scrollWidth||0,a=e.scrollHeight||0,s={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)},l=n.writingMode||"";if((l.startsWith("vertical")||l.startsWith("sideways"))&&(s.top=Math.min(r.top,r.bottom-a),s.left=Math.min(s.left,r.right-i)),Qr(s,o))return!1;let d=(e.ownerDocument||document).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;d.nextNode();){let c=d.currentNode.getBoundingClientRect();if((c.width>0||c.height>0)&&Qr(c,o))return!1}return!0}function la(e,t,r){let n=e.cloneNode(!1);e.tagName==="IMG"&&(n.removeAttribute("src"),n.removeAttribute("srcset"),n.removeAttribute("sizes")),pe(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 wt(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 c=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||vn.has(c))return null;if(c==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return j(t,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null;if(c==="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 Wt(e);if(r.excludeMode==="remove")return null}if(r.exclude&&Array.isArray(r.exclude))for(let c of r.exclude)try{if(e.matches?.(c)){if(r.excludeMode==="hide")return Wt(e);if(r.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof r.filter=="function")try{if(!r.filter(e)){if(r.filterMode==="hide")return Wt(e);if(r.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.clip&&sa(e,t.clip))return la(e,t,r);if(r.__resolveNodeHooks)for(let c of r.__resolveNodeHooks){let u;try{u=await c(e,r)}catch(p){j(t,"resolveNode plugin hook failed",p)}if(u===null)return null;if(u instanceof Node)return u.nodeType===Node.ELEMENT_NODE&&(t.nodeMap.set(u,e),pe(e,u,t,r)),u}{let c=Gr.has(e.tagName)&&Qt.get(e.tagName);if(c){let u=await c(e,t,r);if(u!==void 0)return u}}if(e.getAttribute("data-capture")==="placeholder"){let c=e.cloneNode(!1);t.nodeMap.set(c,e),pe(e,c,t,r);let u=document.createElement("div");return u.textContent=e.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(u),c}{let c=!Gr.has(e.tagName)&&Qt.get(e.tagName);if(c){let u=await c(e,t,r);if(u!==void 0)return u}}let a;try{if(a=e.cloneNode(!1),a.attributes?.length)try{for(let c of a.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(c.value)&&a.setAttribute(c.name,c.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Pi(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Vi(e,a);try{let{width:c,height:u}=fe(e),p=Math.round(c||0),f=Math.round(u||0);p&&(a.dataset.snapdomWidth=String(p)),f&&(a.dataset.snapdomHeight=String(f))}catch(c){j(t,"getUnscaledDimensions for IMG failed",c)}try{let c=e.getAttribute("style")||"",u=window.getComputedStyle(e),p=v=>{let b=c.match(new RegExp(`${v}\\s*:\\s*([^;]+)`,"i")),w=b?b[1].trim():u.getPropertyValue(v);return/%|auto/i.test(String(w||""))},f=parseInt(a.dataset.snapdomWidth||"0",10),h=parseInt(a.dataset.snapdomHeight||"0",10),m=p("width")||!f,g=p("height")||!h;m&&f&&(a.style.width=`${f}px`),g&&h&&(a.style.height=`${h}px`);let y=u.getPropertyValue("object-fit"),x=u.getPropertyValue("object-position");y&&y!=="fill"?(a.style.objectFit=y,x&&(a.style.objectPosition=x)):(f&&(a.style.minWidth=`${f}px`),h&&(a.style.minHeight=`${h}px`))}catch(c){j(t,"IMG dimension freeze failed",c)}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",e,c),c}let s=null;if(e instanceof HTMLTextAreaElement){let{width:c,height:u}=fe(e),p=c||e.getBoundingClientRect().width||0,f=u||e.getBoundingClientRect().height||0;p&&(a.style.width=`${p}px`),f&&(a.style.height=`${f}px`)}if(e instanceof HTMLInputElement){let c=(e.type||"text").toLowerCase();if((c==="checkbox"||c==="radio")&&ti()){let{el:u,applyVisual:p}=ta(e);t.nodeMap.set(u,e),s=p,a=u}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 c=window.getComputedStyle(e,"::placeholder"),u=c&&c.color;if(u&&u!=="rgba(0, 0, 0, 0)"){let p="snapdom-ph-"+(Math.random()*1e6|0);a.classList.add(p);let f=document.createElement("style");f.textContent=`.${p}::placeholder{color:${u}!important;opacity:${c.opacity||"1"}!important;-webkit-text-fill-color:${u}!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 c=e;c.min!==void 0&&c.min!==""&&a.setAttribute("min",c.min),c.max!==void 0&&c.max!==""&&a.setAttribute("max",c.max),c.pattern!==void 0&&c.pattern!==""&&a.setAttribute("pattern",c.pattern);let u=e.getAttribute("aria-invalid");u!==null&&a.setAttribute("aria-invalid",u)}if(Gt(e)||pe(e,a,t,r),s&&s(),e instanceof SVGElement&&!Gt(e)){let c=["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 u=window.getComputedStyle(e);for(let p of c){let f=u.getPropertyValue(p);f&&a.style.setProperty(p,f)}}catch{}}if(e.shadowRoot){try{let v=e.shadowRoot.querySelectorAll("slot");for(let b of v){let w=b.assignedNodes?.()||[];for(let S of w)n.add(S)}}catch{}let c=Ui(t),u=`[data-sd="${c}"]`;t.shadowScopes||(t.shadowScopes=new WeakMap),t.shadowScopes.set(e.shadowRoot,c);try{a.setAttribute("data-sd",c)}catch{}let p=qi(e.shadowRoot),f=ji(p,u,c),h=Xi(p),m=Gi(e,h,u);zi(a,m+f,c);let g=document.createDocumentFragment(),y=(v,b)=>{if(v.nodeType===Node.ELEMENT_NODE&&v.tagName==="STYLE")return b(null);wt(v,t,r).then(w=>{b(w||null)}).catch(()=>{b(null)})},x=await Ht(Array.from(e.shadowRoot.childNodes),y,r.fast);g.append(...x.filter(v=>!!v)),a.appendChild(g)}if(e.tagName==="SLOT"){let c=t.shadowScopes?.get(e.getRootNode()),u=e.assignedNodes?.()||[],p=u.length?e.assignedNodes?.({flatten:!0})||u:[],f=p.length?p:Array.from(e.childNodes),h=document.createDocumentFragment(),m=(y,x)=>{wt(y,t,r).then(v=>{v&&u.length&&Qi(v,c),x(v||null)}).catch(()=>{x(null)})},g=await Ht(Array.from(f),m,r.fast);return h.append(...g.filter(y=>!!y)),h}function l(c,u){if(n.has(c)||e.shadowRoot&&!c.assignedSlot)return u(null);wt(c,t,r).then(p=>{u(p||null)}).catch(()=>{u(null)})}let d=await Ht(Array.from(e.childNodes),l,r.fast);if(a.append(...d.filter(c=>!!c)),o!==null&&a instanceof HTMLSelectElement){a.value=o;for(let c of a.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return i!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=i),a}async function ca(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 ea(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;`,pe(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;`,pe(e,a,t,r),a}}function da(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 ua(e,t,r){let n="";try{let s=e.getContext("2d",{willReadFrequently:!0});try{s&&s.getImageData(0,0,1,1)}catch{}if((we()||!s)&&await Me(),n=e.toDataURL("image/png"),!n||n==="data:,"){try{s&&s.getImageData(0,0,1,1)}catch{}if(await Me(),n=e.toDataURL("image/png"),!n||n==="data:,"){let l=document.createElement("canvas");l.width=e.width,l.height=e.height;let d=l.getContext("2d");d&&(d.drawImage(e,0,0),n=l.toDataURL("image/png"))}}}catch(s){j(t,"Canvas toDataURL failed, using empty/fallback",s)}r&&r.debug&&n&&da(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(s){j(t,"img decoding/loading hints failed",s)}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),pe(e,o,t,r),o}async function pa(e,t,r){let n="";try{let s=document.createElement("canvas");s.width=e.videoWidth||e.offsetWidth||320,s.height=e.videoHeight||e.offsetHeight||240;let l=s.getContext("2d");l&&(l.drawImage(e,0,0,s.width,s.height),n=s.toDataURL("image/png"),(!n||n==="data:,")&&(n=""))}catch(s){j(t,"Video frame capture failed, using poster fallback",s)}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),pe(e,o,t,r),o}async function fa(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),s=a/2,l=Math.max(4,a*.16),d=a*.34,c=i-a*.34,u=d+l+a*.55,p=Math.max(0,c-a*.7-u),f=Math.max(9,Math.round(a*.24)),h=`<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 ${d} ${s-l} L ${d+l} ${s} L ${d} ${s+l} Z" fill="#5f6368"/><rect x="${u}" y="${s-1.5}" width="${p}" height="3" rx="1.5" fill="#bdc1c6"/><circle cx="${u}" cy="${s}" r="${Math.max(3,a*.09)}" fill="#5f6368"/><text x="${c}" y="${s}" 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(h)}`,m.width=i,m.height=a,m.style.width=`${i}px`,m.style.height=`${a}px`,t.nodeMap.set(m,e),pe(e,m,t,r),m}Lt("IFRAME",ca);Lt("CANVAS",ua);Lt("VIDEO",pa);Lt("AUDIO",fa);de();Nt();Rt();ne();ne();var ha=[/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],Te=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__||{}),zn=[],Kr=new Set;function ma(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ga(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(ma(r),"i");else{console.warn("[snapdom] Ignored invalid iconFont value:",r);continue}let o=`${n.source}/${n.flags}`;Kr.has(o)||(Kr.add(o),zn.push(n))}}function be(e){let t=typeof e=="string"?e:"",r=[...ha,...zn];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 ba(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var Jr=new Map;function ya(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 wa(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),s="outlined";/\brounded\b/.test(i)||/\bround\b/.test(i)?s="rounded":/\bsharp\b/.test(i)?s="sharp":/\boutlined\b/.test(i)&&(s="outlined");let l=a===1,d=null;if(l&&(s==="outlined"&&Te.materialIconsFilled?d={url:Te.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&Te.materialIconsRound?d={url:Te.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&Te.materialIconsSharp&&(d={url:Te.materialIconsSharp,alias:"snapdom-mi-sharp"})),!d)return{familyForMeasure:n,familyForCanvas:n};if(!Jr.has(d.alias))try{let u=new FontFace(d.alias,`url(${d.url})`,{style:"normal",weight:"400"});document.fonts.add(u),await u.load(),Jr.set(d.alias,!0)}catch{return{familyForMeasure:n,familyForCanvas:n}}let c=`"${d.alias}"`;return{familyForMeasure:c,familyForCanvas:c}}async function xa(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function va(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 Sa(e,{family:t="Material Icons",weight:r="normal",fontSize:n=32,color:o="#000",variation:i="",className:a=""}={}){let s=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,d=ya(i),{familyForMeasure:c,familyForCanvas:u}=await wa(s,a,d);await xa(u.replace(/^["']+|["']+$/g,""),n);let p=document.createElement("span");p.setAttribute("data-snapdom-internal",""),p.textContent=e,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=c,p.style.fontWeight=String(r||"normal"),p.style.fontSize=`${n}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=o,document.body.appendChild(p);let f=p.getBoundingClientRect(),h=Math.max(1,Math.ceil(f.width)),m=Math.max(1,Math.ceil(f.height));document.body.removeChild(p);let g=document.createElement("canvas");g.width=h*l,g.height=m*l;let y=g.getContext("2d");y.scale(l,l),y.font=`${r?`${r} `:""}${n}px ${u}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=o;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:g.toDataURL(),width:h,height:m}}async function Ca(e,t,r=k.session.nodeMap){if(e?.nodeType!==1)return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(e.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.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(s=>s&&s.textContent&&s.textContent.trim()):[];t?.nodeType===1&&t.matches?.(n)&&t.textContent&&t.textContent.trim()&&i.unshift(t);let a=0;for(let s=0;s<o.length;s++){let l=o[s],d=r&&r.get(l)||i[s]||null;try{let c=getComputedStyle(d||l),u=c.fontFamily||"Material Icons";if(!ba(u))continue;let p=(d||l).textContent.trim();if(!p)continue;let f=parseInt(c.fontSize,10)||24,h=c.fontWeight&&c.fontWeight!=="normal"?c.fontWeight:"normal",m=va(c),g=c.fontVariationSettings&&c.fontVariationSettings!=="normal"?c.fontVariationSettings:"",y=(d||l).className||"",{dataUrl:x,width:v,height:b}=await Sa(p,{family:u,weight:h,fontSize:f,color:m,variation:g,className:y});l.textContent="";let w=l.ownerDocument.createElement("img");w.src=x,w.alt=p,w.style.height=`${f}px`,w.style.width=`${Math.max(1,Math.round(v/b*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(w),a++}catch{}}return a}$e();Ae();async function ka(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 s=a.getBoundingClientRect(),l=Math.ceil(s.width),d=Math.ceil(s.height);document.body.removeChild(a);let c=document.createElement("canvas");c.width=Math.max(1,l*i),c.height=Math.max(1,d*i);let u=c.getContext("2d");return u.scale(i,i),u.font=r?`${r} ${n}px "${t}"`:`${n}px "${t}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=o,u.fillText(e,0,0),{dataUrl:c.toDataURL(),width:l,height:d}}var Vn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),Ma=["katex","mathjax","mathml"];function mr(e){if(!e)return"";for(let t of e.split(",")){let r=t.trim().replace(/^['"]+|['"]+$/g,"");if(r&&!Vn.has(r.toLowerCase()))return r}return""}function Ea(e){if(!e)return[];let t=[];for(let r of e.split(",")){let n=r.trim().replace(/^['"]+|['"]+$/g,"");n&&(Vn.has(n.toLowerCase())||t.push(n))}return t}function xt(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 vt(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function $a(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function Aa(e){let t=String(e||"400").trim(),r=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(r){let o=xt(r[1]),i=xt(r[2]);return{min:Math.min(o,i),max:Math.max(o,i)}}let n=xt(t);return{min:n,max:n}}function Na(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Ra(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 Ta(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function La(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)||Ma.some(a=>i.includes(a)))return!0;for(let a of t){let s=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),d=Ta(a);if(i.includes(s)||i.includes(l)||d&&i.includes(d))return!0}return!1}catch{return!1}}function Fa(e){let t=new Set;for(let r of e||[]){let n=String(r).split("__")[0]?.trim();n&&t.add(n)}return t}function Zr(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 Kt=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,$t=4;async function Pa(e,t,r){if(!e)return e;let n=new Set;function o(s,l){try{return new URL(s,l||location.href).href}catch{return s}}async function i(s,l,d=0){if(d>$t)return console.warn(`[snapDOM] @import depth exceeded (${$t}) at ${l}`),s;let c="",u=0,p;for(;p=Kt.exec(s);){c+=s.slice(u,p.index),u=Kt.lastIndex;let f=(p[2]||p[4]||"").trim(),h=o(f,l);if(n.has(h)){console.warn(`[snapDOM] Skipping circular @import: ${h}`);continue}n.add(h);let m="";try{let g=await le(h,{as:"text",useProxy:r,silent:!0});g.ok&&typeof g.data=="string"&&(m=g.data)}catch{}m?(m=Zr(m,h),m=await i(m,h,d+1),c+=`
|
|
6
|
+
/* inlined: ${h} */
|
|
7
7
|
${m}
|
|
8
|
-
`):d+=p[0]}return d+=s.slice(u),d}let a=Vr(e,t||location.href);return a=await o(a,t||location.href,0),a}var Bn=/url\((["']?)([^"')]+)\1\)/g,Ca=/@font-face[^{}]*\{[^}]*\}/g;function se(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 i=n.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],a=i[2],s=l=>{if(!l.includes("?"))return parseInt(l,16);let c=parseInt(l.replace(/\?/g,"0"),16),d=parseInt(l.replace(/\?/g,"F"),16);return[c,d]};if(a){let l=s(o),c=s(a),d=Array.isArray(l)?l[0]:l,u=Array.isArray(c)?c[1]:c;t.push([Math.min(d,u),Math.max(d,u)])}else{let l=s(o);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function jn(e,t){if(!t.length||!e||e.size===0)return!0;for(let r of e)for(let[n,i]of t)if(r>=n&&r<=i)return!0;return!1}function ur(e,t){let r=[];if(!e)return r;for(let n of e.matchAll(Bn)){let i=(n[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,t||location.href).href}catch{}r.push(i)}}return r}async function Xt(e,t,r=""){let n=e;for(let i of e.matchAll(Bn)){let o=nr(i[0]);if(!o)continue;let a=o;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!be(a)){if(C.resource?.has(a)){C.font?.add(a),n=n.replace(i[0],`url(${C.resource.get(a)})`);continue}try{let s=await le(a,{as:"dataURL",useProxy:r,silent:!0});if(s.ok&&typeof s.data=="string"){let l=s.data;C.resource?.set(a,l),C.font?.add(a),n=n.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return n}function Ma(e){if(!e.length)return null;let t=(a,s)=>e.some(([l,c])=>!(c<a||l>s)),r=t(0,255)||t(305,305),n=t(256,591)||t(7680,7935),i=t(880,1023),o=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":o?"cyrillic":i?"greek":n?"latin-ext":r?"latin":null}function Xr(e={}){let t=new Set((e.families||[]).map(i=>String(i).toLowerCase())),r=new Set((e.domains||[]).map(i=>String(i).toLowerCase())),n=new Set((e.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(t.size&&t.has(i.family.toLowerCase()))return!0;if(r.size)for(let a of i.srcUrls)try{if(r.has(new URL(a).host.toLowerCase()))return!0}catch{}if(n.size){let a=Ma(o);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 o of e.match(t)||[]){let a=se(o,"font-family"),s=dr(a),l=se(o,"font-weight","400"),c=se(o,"font-style","normal"),d=se(o,"font-stretch","100%"),u=se(o,"unicode-range"),p=se(o,"src"),h=ur(p,location.href),f=h.length?h.map(g=>String(g).toLowerCase()).sort().join("|"):p.toLowerCase(),m=[String(s||"").toLowerCase(),l,c,d,u.toLowerCase(),f].join("|");r.has(m)||(r.add(m),n.push(o))}if(n.length===0)return e;let i=0;return e.replace(t,()=>n[i++]||"")}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,i,o){let a=Array.from(e||[]).sort().join("|"),s=t?JSON.stringify({families:(t.families||[]).map(p=>String(p).toLowerCase()).sort(),domains:(t.domains||[]).map(p=>String(p).toLowerCase()).sort(),subsets:(t.subsets||[]).map(p=>String(p).toLowerCase()).sort()}):"",l=(r||[]).map(p=>`${(p.family||"").toLowerCase()}::${p.weight||"normal"}::${p.style||"normal"}::${p.src||""}`).sort().join("|"),c=n||"",d=(i||[]).map(p=>String(p).toLowerCase()).sort().join("|"),u=Aa(o||document);return`fonts-embed-css::req=${a}::ex=${s}::lf=${l}::px=${c}::fd=${d}::doc=${u}`}async function Un(e,t,r,n){let i;try{i=e.cssRules||[]}catch{return}let o=(a,s)=>{try{return new URL(a,s||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let s=a.href?o(a.href,t):t;if(n.depth>=Ct){console.warn(`[snapDOM] CSSOM import depth exceeded (${Ct}) at ${s}`);continue}if(s&&n.visitedSheets.has(s)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${s}`);continue}s&&n.visitedSheets.add(s);let l={...n,depth:(n.depth||0)+1};await Un(a.styleSheet,s,r,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let s=(a.style.getPropertyValue("font-family")||"").trim(),l=dr(s);if(!l||be(l))continue;let c=(a.style.getPropertyValue("font-weight")||"").trim(),d=(a.style.getPropertyValue("font-style")||"").trim(),u=(a.style.getPropertyValue("font-stretch")||"").trim(),p=(a.style.getPropertyValue("font-variation-settings")||"").trim(),h=(a.style.getPropertyValue("src")||"").trim(),f=(a.style.getPropertyValue("unicode-range")||"").trim(),m=c||"400",g=d||"normal",y=u||"100%",x=(d?`font-style:${d};`:"")+(c?`font-weight:${c};`:"")+(u?`font-stretch:${u};`:"")+(p?`font-variation-settings:${p};`:"")+(f?`unicode-range:${f};`:""),v=n.faceMatchesRequired(l,g,m,y);if(!v&&!n.requiredIndex.has(l.toLowerCase()))continue;let b=_n(f);if(!jn(n.usedCodepoints,b))continue;let w={family:l,weightSpec:m,styleSpec:g,stretchSpec:y,unicodeRange:f,srcRaw:h,srcUrls:ur(h,t||location.href),href:t||location.href};if(n.simpleExcluder&&n.simpleExcluder(w,b))continue;if(!v){n.provisionalFaces.push({family:l.toLowerCase(),block:`@font-face{font-family:${l};src:${h};${x}}`,srcRaw:h,baseHref:t||location.href});continue}if(n.coveredFamilies.add(l.toLowerCase()),/url\(/i.test(h)){let S=await Xt(h,t||location.href,n.useProxy);await r(`@font-face{font-family:${l};src:${S};${x}}`)}else await r(`@font-face{font-family:${l};src:${h};${x}}`)}}}async function Na({required:e,usedCodepoints:t,exclude:r=void 0,localFonts:n=[],useProxy:i="",fontStylesheetDomains:o=[],doc:a=document}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let s=new Map;for(let b of e){let[w,S,M,k]=String(b).split("__");if(!w)continue;let E=w.toLowerCase(),$=s.get(E)||[];$.push({w:parseInt(S,10),s:M,st:parseInt(k,10)}),s.set(E,$)}function l(b,w,S,M){let k=String(b).toLowerCase();if(!s.has(k))return!1;let E=s.get(k),$=ba(S),R=ya(w),L=wa(M),D=$.min!==$.max,F=$.min,I=O=>R.kind==="normal"&&O==="normal"||R.kind!=="normal"&&(O==="italic"||O==="oblique"),T=!1;for(let O of E){let X=D?O.w>=$.min&&O.w<=$.max:O.w===F,U=I(yt(O.s)),V=O.st>=L.min&&O.st<=L.max;if(X&&U&&V){T=!0;break}}if(T)return!0;if(!D)for(let O of E){let X=I(yt(O.s)),U=O.st>=L.min&&O.st<=L.max;if(Math.abs(F-O.w)<=300&&X&&U)return!0}if(!D&&R.kind==="normal"&&E.some(O=>yt(O.s)!=="normal"))for(let O of E){let X=Math.abs(F-O.w)<=300,U=O.st>=L.min&&O.st<=L.max;if(X&&U)return!0}return!1}let c=Xr(r),d=Ra(e,r,n,i,o,a);if(C.resource?.has(d))return C.resource.get(d);let u=Sa(e),p=[],h=Vt;for(let b of a.querySelectorAll("style")){let w=b.textContent||"";for(let S of w.matchAll(h)){let M=(S[2]||S[4]||"").trim();!M||be(M)||a.querySelector(`link[rel="stylesheet"][href="${M}"]`)||p.push(M)}}let f=[];p.length&&await Promise.all(p.map(b=>new Promise(w=>{if(a.querySelector(`link[rel="stylesheet"][href="${b}"]`))return w(null);let S=a.createElement("link");S.rel="stylesheet",S.href=b,S.setAttribute("data-snapdom","injected-import"),S.onload=()=>w(S),S.onerror=()=>w(null),a.head.appendChild(S),f.push(S)})));let m="",g=new Set,y=[],x=Array.from(a.querySelectorAll('link[rel="stylesheet"]')).filter(b=>!!b.href);for(let b of f)try{b.remove()}catch{}for(let b of x)try{if(be(b.href))continue;let w="",S=!1;try{S=new URL(b.href,location.href).origin===location.origin}catch{}if(!S){let k=Array.isArray(o)?o:[];if(!va(b.href,u,k))continue}if(S){let k=Array.from(a.styleSheets).find(E=>E.href===b.href);if(k)try{let E=k.cssRules||[];w=Array.from(E).map($=>$.cssText).join("")}catch{}}if(!w){let k=await le(b.href,{as:"text",useProxy:i});if(k?.ok&&typeof k.data=="string"&&(w=k.data),be(b.href))continue}w=await ka(w,b.href,i);let M="";for(let k of w.match(Ca)||[]){let E=se(k,"font-family"),$=dr(E);if(!$||be($))continue;let R=se(k,"font-weight","400"),L=se(k,"font-style","normal"),D=se(k,"font-stretch","100%"),F=se(k,"unicode-range"),I=se(k,"src"),T=ur(I,b.href),O=l($,L,R,D);if(!O&&!s.has($.toLowerCase()))continue;let X=_n(F);if(!jn(t,X))continue;let U={family:$,weightSpec:R,styleSpec:L,stretchSpec:D,unicodeRange:F,srcRaw:I,srcUrls:T,href:b.href};if(r&&c(U,X))continue;if(!O){y.push({family:$.toLowerCase(),block:k,srcRaw:I,baseHref:b.href});continue}g.add($.toLowerCase());let V=/url\(/i.test(I)?await Xt(k,b.href,i):k;M+=V}M.trim()&&(m+=M)}catch{console.warn("[snapDOM] Failed to process stylesheet:",b.href)}let v={requiredIndex:s,usedCodepoints:t,faceMatchesRequired:l,coveredFamilies:g,provisionalFaces:y,simpleExcluder:r?Xr(r):null,useProxy:i,visitedSheets:new Set,depth:0};for(let b of a.styleSheets)if(!(b.href&&x.some(w=>w.href===b.href)))try{let w=b.href||location.origin+"/";w&&v.visitedSheets.add(w),await Un(b,w,async S=>{m+=S},v)}catch{}for(let b of y)g.has(b.family)||(m+=/url\(/i.test(b.srcRaw)?await Xt(b.block,b.baseHref,i):b.block);try{for(let b of a.fonts||[]){if(!b||!b.family||b.status!=="loaded"||!b._snapdomSrc)continue;let w=String(b.family).replace(/^['"]+|['"]+$/g,"");if(be(w)||!s.has(w.toLowerCase())||r?.families&&r.families.some(M=>String(M).toLowerCase()===w.toLowerCase()))continue;let S=b._snapdomSrc;if(!String(S).startsWith("data:")){if(C.resource?.has(b._snapdomSrc))S=C.resource.get(b._snapdomSrc),C.font?.add(b._snapdomSrc);else if(!C.font?.has(b._snapdomSrc))try{let M=await le(b._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(M.ok&&typeof M.data=="string")S=M.data,C.resource?.set(b._snapdomSrc,S),C.font?.add(b._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",b._snapdomSrc);continue}}m+=`@font-face{font-family:'${w}';src:url(${S});font-style:${b.style||"normal"};font-weight:${b.weight||"normal"};}`}}catch{}for(let b of n){if(!b||typeof b!="object")continue;let w=String(b.family||"").replace(/^['"]+|['"]+$/g,"");if(!w||be(w)||!s.has(w.toLowerCase())||r?.families&&r.families.some(R=>String(R).toLowerCase()===w.toLowerCase()))continue;let S=b.weight!=null?String(b.weight):"normal",M=b.style!=null?String(b.style):"normal",k=b.stretchPct!=null?`${b.stretchPct}%`:"100%",E=String(b.src||""),$=E;if(!$.startsWith("data:")){if(C.resource?.has(E))$=C.resource.get(E),C.font?.add(E);else if(!C.font?.has(E))try{let R=await le(E,{as:"dataURL",useProxy:i,silent:!0});if(R.ok&&typeof R.data=="string")$=R.data,C.resource?.set(E,$),C.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:${M};font-weight:${S};font-stretch:${k};}`}return m&&(m=Ea(m),C.resource?.set(d,m)),m}function qn(e,t){let r=new Set,n=new Set;if(!e)return{required:r,usedCodepoints:n};let i=l=>{if(l)for(let c of l)n.add(c.codePointAt(0))},o=l=>{let c=ma(l.fontFamily);if(c.length)for(let d of c)r.add(`${d}__${bt(l.fontWeight)}__${yt(l.fontStyle)}__${ga(l.fontStretch)}`)},a=l=>{o(_(l));for(let c of["::before","::after"]){let d=_(l,c),u=d&&d.content;if(!(!u||u==="none"||u==="normal"))if(o(d),/^["']/.test(u))i(u.slice(1,-1));else{let p=u.match(/\\[0-9A-Fa-f]{1,6}/g);if(p)for(let h of p)try{n.add(parseInt(h.slice(1),16))}catch{}}}};a(e);let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;s.nextNode();){let l=s.currentNode;if(l.nodeType===Node.TEXT_NODE){if(t&&l.parentElement&&!t(l.parentElement))continue;i(l.nodeValue||"")}else{if(t&&!t(l))continue;a(l)}}return{required:r,usedCodepoints:n}}function Ta(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 i=()=>{let o=r.createElement("div");o.setAttribute("data-snapdom-internal",""),o.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 s=r.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${a}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",o.appendChild(s)}r.body.appendChild(o),o.offsetWidth,r.body.removeChild(o)};for(let o=0;o<Math.max(1,t);o++)i(),await Me(),await Me()}function La(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 Kr(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)),i="";for(let[o,a]of r)for(;n>=o;)i+=a,n-=o;return t?i:i.toLowerCase()}function Qr(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 Kr(e,!1);case"upper-roman":return Kr(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",i=c=>{let d=0,u=c?.parentElement;if(!u)return 0;for(let p of u.children){if(p===c)break;p.tagName==="LI"&&d++}return d},o=c=>{let d=new Map;for(let[u,p]of c)d.set(u,p.slice());return d},a=(c,d,u)=>{let p=o(c),h;try{h=u.style?.counterReset||getComputedStyle(u).counterReset}catch{}if(h&&h!=="none")for(let g of h.split(",")){let y=g.trim().split(/\s+/),x=y[0],v=Number.isFinite(Number(y[1]))?Number(y[1]):0;if(!x)continue;let b=d.get(x);if(b&&b.length){let w=b.slice();w.push(v),p.set(x,w)}else p.set(x,[v])}let f;try{f=u.style?.counterSet||getComputedStyle(u).counterSet}catch{}if(f&&f!=="none")for(let g of f.split(",")){let y=g.trim().split(/\s+/),x=y[0],v=Number.isFinite(Number(y[1]))?Number(y[1]):0;if(!x)continue;let b=p.get(x)||[];b.length===0&&b.push(0),b[b.length-1]=v,p.set(x,b)}let m;try{m=u.style?.counterIncrement||getComputedStyle(u).counterIncrement}catch{}if(m&&m!=="none")for(let g of m.split(",")){let y=g.trim().split(/\s+/),x=y[0],v=Number.isFinite(Number(y[1]))?Number(y[1]):1;if(!x)continue;let b=p.get(x)||[];b.length===0&&b.push(0),b[b.length-1]+=v,p.set(x,b)}try{if(getComputedStyle(u).display==="list-item"&&n(u)){let g=u.parentElement,y=1;if(g&&g.tagName==="OL"){let v=g.getAttribute("start"),b=Number.isFinite(Number(v))?Number(v):1,w=i(u),S=u.getAttribute("value");y=Number.isFinite(Number(S))?Number(S):b+w}else y=1+i(u);let x=p.get("list-item")||[];x.length===0&&x.push(0),x[x.length-1]=y,p.set("list-item",x)}}catch{}return p},s=(c,d,u)=>{let p=a(u,d,c);t.set(c,p);let h=p;for(let m of c.children)h=s(m,p,h);let f=new Map;for(let[m,g]of u){let y=g.length,x=h.get(m);f.set(m,x&&x.length?x.slice(0,y):g.slice())}for(let[m,g]of h)!f.has(m)&&g.length&&!d.has(m)&&f.set(m,g.slice(0,1));return f},l=new Map;return s(r,l,l),{get(c,d){let u=t.get(c)?.get(d);return u&&u.length?u[u.length-1]:0},getStack(c,d){let u=t.get(c)?.get(d);return u?u.slice():[]}}}function Pa(e,t,r){if(!e||e==="none")return e;try{let n=/\b(counter|counters)\s*\(([^)]+)\)/g;return e.replace(n,(i,o,a)=>{let s=String(a).split(",").map(l=>l.trim());if(o==="counter"){let l=s[0]?.replace(/^["']|["']$/g,""),c=(s[1]||"decimal").toLowerCase(),d=r.get(t,l);return Qr(d,c)}else{let l=s[0]?.replace(/^["']|["']$/g,""),c=s[1]?.replace(/^["']|["']$/g,"")??"",d=(s[2]||"decimal").toLowerCase(),u=r.getStack(t,l);return u.length?u.map(p=>Qr(p,d)).join(c):""}})}catch{return"- "}}$e();var Te=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 o=0;o<t.length;o++){let a=t[o];if(a.tagName==="STYLE"){let s=a.textContent?a.textContent.length:0;r+=`S${s}|`;let l=a.sheet,c=l?Yt(l):null;c&&(n+=c.length)}else{let s=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";r+=`L${s}|m:${l}|`;let c=a.sheet,d=c?Yt(c):null;d&&(n+=d.length)}}let i=e.adoptedStyleSheets;return r+=`ass:${Array.isArray(i)?i.length:0}|tr:${n}`,r}function Zr(e,t,r){let n=Yt(e);if(!n)return!1;for(let i=0;i<n.length;i++){if(r.budget<=0)return!1;let o=n[i],a=o&&o.cssText?o.cssText:"";r.budget--;for(let s of t)if(a.includes(s))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let s=0;s<o.cssRules.length&&r.budget>0;s++){let l=o.cssRules[s],c=l&&l.cssText?l.cssText:"";r.budget--;for(let d of t)if(c.includes(d))return!0}if(r.budget<=0)return!1}return!1}function en(e=document,t=Vn(e)){let r=Te.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"],i=e.querySelectorAll("style");for(let a=0;a<i.length;a++){let s=i[a].textContent||"";for(let l of n)if(s.includes(l))return Te.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:Jr};try{for(let s of o)if(Zr(s,n,a))return Te.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),s={budget:Jr};for(let l=0;l<a.length&&s.budget>0;l++){let c=a[l],d=null;if(c.tagName,d=c.sheet||null,d&&Zr(d,n,s))return Te.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Te.set(e,{fingerprint:t,result:!0}),!0):(Te.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(i){j(t,"buildCounterContext failed",i),r={get:()=>0,getStack:()=>[]}}return r};return{get(i,o){return n().get(i,o)},getStack(i,o){return n().getStack(i,o)}}}function Da(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 Wa(e){if(!e)return"";let t=[],r=/"([^"]*)"/g,n=0,i;for(;i=r.exec(e);){let a=e.slice(n,i.index).trim();a&&t.push(a),t.push(i[1]),n=r.lastIndex}let o=e.slice(n).trim();return o&&t.push(o),t.join("")}function Gt(e,t,r){let n=e.parentElement,i=n&&r?r.get(n):null;return i?{get(o,a){let s=t.get(o,a),l=i.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=t.getStack(o,a);if(!s.length)return s;let l=i.get(a);if(typeof l=="number"){let c=s.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return s}}:t}function Kt(e,t,r){let n=new Map;function i(c){let d=[];if(!c||c==="none")return d;for(let u of String(c).split(",")){let p=u.trim().split(/\s+/),h=p[0],f=Number.isFinite(Number(p[1]))?Number(p[1]):void 0;h&&d.push({name:h,num:f})}return d}let o=i(t?.counterReset),a=i(t?.counterSet),s=i(t?.counterIncrement);function l(c){if(n.has(c))return n.get(c).slice();let d=r.getStack(e,c);d=d.length?d.slice():[];let u=o.find(f=>f.name===c);if(u){let f=Number.isFinite(u.num)?u.num:0;d=d.length?[...d,f]:[f]}let p=a.find(f=>f.name===c);if(p){let f=Number.isFinite(p.num)?p.num:0;d.length===0&&(d=[0]),d[d.length-1]=f}let h=s.find(f=>f.name===c);if(h){let f=Number.isFinite(h.num)?h.num:1;d.length===0&&(d=[0]),d[d.length-1]+=f}return n.set(c,d.slice()),d}return{get(c,d){let u=l(d);return u.length?u[u.length-1]:0},getStack(c,d){return l(d)},__incs:s}}function Ha(e,t,r,n){let i;try{i=_(e,t)}catch{}let o=i?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};o=Da(o);let a=Gt(e,r,n),s=Kt(e,i,a),l=La(o)?Pa(o,e,s):o;return{text:Wa(l),incs:s.__incs||[]}}async function Qt(e,t,r,n){if(e?.nodeType!==1||t?.nodeType!==1||e.tagName==="TEXTAREA")return;let i=e.ownerDocument||document;if(!Ia(i,r))return;r.__siblingCounters||(r.__siblingCounters=new WeakMap),r.__counterCtx||(r.__counterCtx=Oa(e.ownerDocument||document,r));let o=r.__counterCtx;for(let s of["::before","::after","::first-letter"])try{let l=_(e,s);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&!tn(l)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let P=_(e),B=(P?.display||"").toLowerCase();if(B.includes("flex")||B.includes("grid"))continue;let W=ee=>l[ee]!==P[ee]&&(parseFloat(l[ee])||0)!==0;if(!(l.color!==P.color||l.fontSize!==P.fontSize||l.fontWeight!==P.fontWeight||l.fontFamily!==P.fontFamily||l.fontStyle!==P.fontStyle||l.textTransform!==P.textTransform||l.float!==P.float&&l.float!=="none"||W("paddingTop")||W("paddingRight")||W("paddingBottom")||W("paddingLeft")||W("marginTop")||W("marginRight")||W("marginBottom")||W("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,K=ce.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],te=ce.slice(K?.length||0);if(!K||/[\uD800-\uDFFF]/.test(K))continue;let ie=document.createElement("span");ie.textContent=K,ie.dataset.snapdomPseudo="::first-letter";let J=Nr(l),fe=Ht(J,"span");r.styleMap.set(ie,fe);let ke=document.createTextNode(te);t.replaceChild(ke,q),t.insertBefore(ie,ke);continue}let c=l.content??"",d=c===""||c==="none"||c==="normal",{text:u,incs:p}=Ha(e,s,o,r.__siblingCounters),h=l.backgroundImage,f=l.backgroundColor,m=l.fontFamily,g=parseInt(l.fontSize)||32,y=parseInt(l.fontWeight)||!1,x=l.color||"#000",v=l.transform,b=be(m),w=!d&&u!=="",S=h&&h!=="none",M=f&&f!=="transparent"&&f!=="rgba(0, 0, 0, 0)",k=tn(l),E=v&&v!=="none",$=c!=="none"&&c!=="normal",R=$&&((parseFloat(l.width)||0)>0||(parseFloat(l.height)||0)>0),L=$&&l.boxShadow&&l.boxShadow!=="none",D=$&&l.outlineStyle&&l.outlineStyle!=="none"&&(parseFloat(l.outlineWidth)||0)>0;if(!(w||S||M||k||E||R||L||D)){if(p&&p.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map;for(let{name:B}of p){if(!B)continue;let W=Gt(e,o,r.__siblingCounters),q=Kt(e,_(e,s),W).get(e,B);P.set(B,q)}r.__siblingCounters.set(e.parentElement,P)}continue}let F=u.startsWith("url(")||/^-?(?:webkit-)?image-set\(/i.test(u),I=!1;if(w&&!b&&u.length>1&&!F){let P=_(e),B=parseFloat(P.fontSize)||16,W=parseFloat(P.lineHeight);Number.isFinite(W)||(W=B*1.5),e.getBoundingClientRect().height<W*1.6&&(t.style.whiteSpace="nowrap",I=!0)}let T=document.createElement("span");T.dataset.snapdomPseudo=s,T.style.pointerEvents="none",I&&(T.style.whiteSpace="nowrap");let O=Nr(l),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(T,V),b&&u&&u.length===1){let{dataUrl:P,width:B,height:W}=await ha(u,m,y,g,x),q=document.createElement("img");q.src=P,q.style=`height:${g}px;width:${B/W*g}px;object-fit:contain;`,T.appendChild(q),t.dataset.snapdomHasIcon="true"}else if(u&&F){let P=cn(u,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??nr(u);if(P?.trim())try{let B=await le(xt(P),{as:"dataURL",useProxy:n.useProxy});if(B?.ok&&typeof B.data=="string"){let W=document.createElement("img");W.src=B.data,W.style=`width:${g}px;height:auto;object-fit:contain;`,T.appendChild(W)}}catch(B){console.error(`[snapdom] Error in pseudo ${s} for`,e,B)}}else!b&&w&&(T.textContent=u);T.style.backgroundImage="none","maskImage"in T.style&&(T.style.maskImage="none"),"webkitMaskImage"in T.style&&(T.style.webkitMaskImage="none");try{T.style.backgroundRepeat=l.backgroundRepeat,T.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?(T.style.backgroundPositionX=l.backgroundPositionX,T.style.backgroundPositionY=l.backgroundPositionY):T.style.backgroundPosition=l.backgroundPosition,T.style.backgroundOrigin=l.backgroundOrigin,T.style.backgroundClip=l.backgroundClip,T.style.backgroundAttachment=l.backgroundAttachment,T.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(S)try{let P=Bt(h),B=await Promise.all(P.map(un));T.style.backgroundImage=B.join(", ")}catch(P){console.warn(`[snapdom] Failed to inline background-image for ${s}`,P)}M&&(T.style.backgroundColor=f);let Q=T.childNodes.length>0||T.textContent?.trim()!==""||S||M||k||E||R||L||D;if(p&&p.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map,B=Gt(e,o,r.__siblingCounters),W=Kt(e,_(e,s),B);for(let{name:q}of p){if(!q)continue;let ce=W.get(e,q);P.set(q,ce)}r.__siblingCounters.set(e.parentElement,P)}if(!Q)continue;s==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(T,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(T))}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,e,l)}let a=Array.from(t.children).filter(s=>!s.dataset.snapdomPseudo);if(r.nodeMap)for(let s of a){let l=r.nodeMap.get(s);l?.nodeType===1&&await Qt(l,s,r,n)}else{let s=Array.from(e.children);for(let l=0;l<Math.min(s.length,a.length);l++)await Qt(s[l],a[l],r,n)}}function Ba(e,t){if(!e||e?.nodeType!==1)return;let r=e.ownerDocument||document,n=t||r,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],s=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",c=b=>{if(!b||!b.getAttribute)return null;let w=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(l,"href"):null);if(w)return w;let S=b.attributes;if(!S)return null;for(let M=0;M<S.length;M++){let k=S[M];if(!k||!k.name)continue;if(k.name==="href")return k.value;let E=k.name.indexOf(":");if(E!==-1&&k.name.slice(E+1)==="href")return k.value}return null},d=new Set(Array.from(e.querySelectorAll("[id]")).map(b=>b.id)),u=new Set,p=!1,h=(b,w=null)=>{if(!b)return;o.lastIndex=0;let S;for(;S=o.exec(b);){p=!0;let M=(S[1]||"").trim();M&&(d.has(M)||(u.add(M),w&&!w.has(M)&&w.add(M)))}},f=b=>{let w=b.querySelectorAll("use");for(let k of w){let E=c(k);if(!E||!E.startsWith("#"))continue;p=!0;let $=E.slice(1).trim();$&&!d.has($)&&u.add($)}let S='*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]';h(b.getAttribute("style")||"");for(let k of a)h(b.getAttribute(k));let M=b.querySelectorAll(S);for(let k of M){h(k.getAttribute("style")||"");for(let E of a)h(k.getAttribute(E))}};for(let b of i)f(b);if(!p)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 g=m.querySelector("defs")||null,y=b=>{if(!b||d.has(b))return null;let w=s(b),S=M=>{let k=n.querySelector(M);return k&&!e.contains(k)?k:null};return S(`svg defs > *#${w}`)||S(`svg > symbol#${w}`)||S(`*#${w}`)};if(!u.size)return;let x=new Set(u),v=new Set;for(;x.size;){let b=x.values().next().value;if(x.delete(b),!b||d.has(b)||v.has(b))continue;let w=y(b);if(!w){v.add(b);continue}g||(g=r.createElementNS("http://www.w3.org/2000/svg","defs"),m.appendChild(g));let S=w.cloneNode(!0);S.id||S.setAttribute("id",b),g.appendChild(S),v.add(b),d.add(b);let M=[S,...S.querySelectorAll("*")];for(let k of M){let E=c(k);if(E&&E.startsWith("#")){let R=E.slice(1).trim();R&&!d.has(R)&&!v.has(R)&&x.add(R)}let $=k.getAttribute?.("style")||"";$&&h($,x);for(let R of a){let L=k.getAttribute?.(R);L&&h(L,x)}}}}ne();function _a(e){let t=getComputedStyle(e),r=t.outlineStyle,n=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=r!=="none"&&parseFloat(n)>0,s=i==="none"||parseFloat(o)===0;if(a&&s){let l=e.style.border;return e.style.border=`${n} solid transparent`,()=>{e.style.border=l}}return()=>{}}function ja(e){let t=[];try{let r=e.querySelectorAll("*");for(let n of r){if(!(n instanceof HTMLElement))continue;let i=n.style.contentVisibility||"",o=getComputedStyle(n);(o.contentVisibility||o.getPropertyValue("content-visibility")||"")==="auto"&&(t.push({el:n,original:i}),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{}}}de();$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 l=0;l<e.length;l++){let c=e[l];c==="("?n++:c===")"&&(n=Math.max(0,n-1)),c===","&&n===0?(t.push(r),r=""):r+=c}r.trim()&&t.push(r);let i=0,o=0,a=0,s=0;for(let l of t){if(/\binset\b/i.test(l))continue;let c=l.match(/-?\d+(\.\d+)?px/g)?.map(g=>parseFloat(g))||[];if(c.length<2)continue;let[d,u,p=0,h=0]=c,f=Math.abs(d)+p+h,m=Math.abs(u)+p+h;o=Math.max(o,f+Math.max(d,0)),s=Math.max(s,f+Math.max(-d,0)),a=Math.max(a,m+Math.max(u,0)),i=Math.max(i,m+Math.max(-u,0))}return{top:Math.ceil(i),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function za(e){let t=e.filter&&e.filter!=="none"?e.filter:e.webkitFilter||"",r=/blur\(\s*([0-9.]+)px\s*\)/gi,n=0,i;for(;i=r.exec(t);)n+=parseFloat(i[1])||0;let o=Math.ceil(n);return{top:o,right:o,bottom:o,left:o}}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,i=0,o=0,a=0,s=!1;for(let l of r){s=!0;let c=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(m=>parseFloat(m))||[],[d=0,u=0,p=0]=c,h=Math.abs(d)+p,f=Math.abs(u)+p;i=Math.max(i,h+Math.max(d,0)),a=Math.max(a,h+Math.max(-d,0)),o=Math.max(o,f+Math.max(u,0)),n=Math.max(n,f+Math.max(-u,0))}return{bleed:{top:A(n),right:A(i),bottom:A(o),left:A(a)},has:s}}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 s=null;try{s=Mt(e).scale}catch{}try{t.style.transform="none"}catch{}if(!s)return{a:1,b:0,c:0,d:1};let l=s.trim().split(/\s+/).map(parseFloat),c=Number.isFinite(l[0])?l[0]:1,d=Number.isFinite(l[1])?l[1]:c;return{a:c,b:0,c:0,d}}function i(s,l,c,d){let u=Math.sqrt(s*s+l*l)||0,p=0,h=0;if(u>0){let f=s/u,m=l/u;p=f*c+m*d;let g=c-f*p,y=d-m*p;h=Math.sqrt(g*g+y*y)||0,h>0?p=p/h:p=0}return{a:u,b:0,c:p*h,d:h}}let o=n.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let s=o[1].split(",").map(l=>parseFloat(l.trim()));if(s.length===6&&s.every(Number.isFinite)){let[l,c,d,u]=s,p=i(l,c,d,u);try{t.style.transform=`matrix(${p.a}, ${p.b}, ${p.c}, ${p.d}, 0, 0)`}catch{}return p}}let a=n.match(/^matrix3d\(\s*([^)]+)\)$/i);if(a){let s=a[1].split(",").map(l=>parseFloat(l.trim()));if(s.length===16&&s.every(Number.isFinite)){let l=s[0],c=s[1],d=s[4],u=s[5],p=i(l,c,d,u);try{t.style.transform=`matrix(${p.a}, ${p.b}, ${p.c}, ${p.d}, 0, 0)`}catch{}return p}}try{let s=new DOMMatrix(n),l=i(s.a,s.b,s.c,s.d);try{t.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, 0, 0)`}catch{}return l}catch{return null}}function wt(e,t,r,n,i){let o=r.a,a=r.b,s=r.c,l=r.d,c=r.e||0,d=r.f||0;function u(y,x){let v=y-n,b=x-i,w=o*v+s*b,S=a*v+l*b;return w+=n+c,S+=i+d,[w,S]}let p=[u(0,0),u(e,0),u(0,t),u(e,t)],h=1/0,f=1/0,m=-1/0,g=-1/0;for(let[y,x]of p)y<h&&(h=y),x<f&&(f=x),y>m&&(m=y),x>g&&(g=x);return{minX:h,minY:f,maxX:m,maxY:g,width:m-h,height:g-f}}function Jt(e,t,r){let n=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[n[0]||"0",n[1]||"0"],a=(s,l)=>{let c=s.toLowerCase();return c==="left"||c==="top"?0:c==="center"?l/2:c==="right"||c==="bottom"?l:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*l/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:a(i,t),oy:a(o,r)}}function Mt(e){let t={rotate:"0deg",scale:null,translate:null},r=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(r){let i=l=>{try{return typeof r.has=="function"&&!r.has(l)||typeof r.get!="function"?null:r.get(l)}catch{return null}},o=i("rotate");if(o)if(o.angle){let l=o.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else o.unit?t.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:t.rotate=String(o);else{let l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=i("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,c="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${c}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let s=i("translate");if(s){let l="x"in s&&"value"in s.x?s.x.value:Array.isArray(s)?s[0]?.value:0,c="y"in s&&"value"in s.y?s.y.value:Array.isArray(s)?s[1]?.value:0,d="x"in s&&s.x?.unit?s.x.unit:"px",u="y"in s&&s.y?.unit?s.y.unit:"px";t.translate=`${l}${d} ${c}${u}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.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 Ka(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 Qa(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",i=t.scale&&t.scale!=="none"&&t.scale!=="1",o=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(n||i||o)}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,i,o,a,s;if(t==="viewport")i=0,o=0,a=r.documentElement?.clientWidth||n.innerWidth,s=r.documentElement?.clientHeight||n.innerHeight;else if(typeof t=="object")i=(Number(t.x)||0)-(n.scrollX||0),o=(Number(t.y)||0)-(n.scrollY||0),a=Number(t.width),s=Number(t.height);else return null;return a>0&&s>0?{left:i,top:o,width:a,height:s,right:i+a,bottom:o+s}: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 es(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 Kn(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(i=>Number.isFinite(Number(i)))&&(r=r.multiply(new DOMMatrix(`scale(${n.join(",")})`)))}return e&&(r=r.multiply(new DOMMatrix(e))),r}catch{return null}}function ts(e,t,r,n,i){let o=e.getBoundingClientRect();t?.nodeType===1&&t.namespaceURI===Zt&&_(e).position==="static"&&(t.style.position="relative");let a=[];for(let[s,l]of r){if(s?.nodeType!==1||s.namespaceURI!==Zt||l?.nodeType!==1||l===e||!Za(e,l))continue;let c=n.get(l)||_(l),d=c.position;if(d!=="fixed"&&d!=="sticky"&&d!=="-webkit-sticky"||s.style.position==="absolute")continue;let u=l.getBoundingClientRect();if(!(u.width>0&&u.height>0))continue;Yn.add(s);let p=c.transform&&c.transform!=="none"?c.transform:"",h=Mt(l),f=!!(p||h.rotate!=="0deg"||h.scale||h.translate),m=f?Kn(p,h):null,g=!m||!m.is2D||m.a===1&&m.b===0&&m.c===0&&m.d===1,y=u.width,x=u.height;g||(y=l.offsetWidth||u.width,x=l.offsetHeight||u.height);let v=l.getRootNode&&l.getRootNode()instanceof ShadowRoot,b=o,w=e.clientLeft||0,S=e.clientTop||0;if(v){let R=es(l,e);R&&(b=R.getBoundingClientRect(),w=R.clientLeft||0,S=R.clientTop||0)}let M=u.left-b.left-w,k=u.top-b.top-S;if(f)if(s.style.translate="none",s.style.rotate="none",s.style.scale="none",g)s.style.transform="none";else{s.style.transform=`matrix(${m.a},${m.b},${m.c},${m.d},0,0)`;let{ox:R,oy:L}=Jt(c,y,x),D=wt(y,x,{a:m.a,b:m.b,c:m.c,d:m.d,e:0,f:0},R,L);M-=D.minX,k-=D.minY}if(d!=="fixed"){let R=s.cloneNode(!1);R.setAttribute("data-snap-ph","1"),R.style.position="static",R.style.visibility="hidden",R.style.width=`${y}px`,R.style.height=`${x}px`,R.style.boxSizing="border-box",s.parentElement?.insertBefore(R,s)}let E=y+2,$=x;i&&(Math.abs(k-i.y)<.5&&(k-=1,$+=1),Math.abs(M-i.x)<.5&&(M-=1,E+=1)),s.style.position="absolute",s.style.left=`${M}px`,s.style.top=`${k}px`,s.style.right="auto",s.style.bottom="auto",s.style.margin="0",s.style.width=`${E}px`,s.style.height=`${$}px`,s.style.boxSizing="border-box",v||a.push(s)}for(let s of a)t.appendChild(s)}function rs(e,t,r={}){if(!e||!t||!t.style)return;let n=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){j(r,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){j(r,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){j(r,"stripRootShadows outline",o)}let i=(n.filter||"").replace(/\bdrop-shadow\((?:[^()]|\([^()]*\))*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=i.length?i:"none"}catch(o){j(r,"stripRootShadows filter",o)}}function ns(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 is(e,t){let r=Array.from(e.childNodes),n=t==="top"?r:r.reverse();for(let i of n){if(i.nodeType===Node.TEXT_NODE){if(/\S/.test(i.textContent||""))return null;continue}if(i.nodeType!==Node.ELEMENT_NODE)continue;let o=getComputedStyle(i),a=String(o.display||"");if(!(a==="none"||a==="contents")&&!(o.position==="absolute"||o.position==="fixed"))return o.float&&o.float!=="none"||a.startsWith("inline")?null:i}return null}function os(e,t,r){if(!e||!t||!t.style)return;let n=getComputedStyle(e);if(!rn(n))for(let i of["top","bottom"]){let o=i==="top"?"Top":"Bottom";if((parseFloat(n[`border${o}Width`])||0)>0||(parseFloat(n[`padding${o}`])||0)>0)continue;let a=e,s=t;for(;a&&s;){let l=is(a,i);if(!l)break;let c=r?Array.from(s.children).find(p=>r.get(p)===l)||null:s.children[Array.from(a.children).indexOf(l)]||null,d=getComputedStyle(l),u=parseFloat(d[`margin${o}`])||0;if(c&&c.style&&u>0&&(c.style[`margin${o}`]="0px"),rn(d)||(parseFloat(d[`border${o}Width`])||0)>0||(parseFloat(d[`padding${o}`])||0)>0)break;a=l,s=c}}}function as(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 ss(e,t={}){let{stripFrameworkDirectives:r=!0}=t,n=new Set(["xml","xlink"]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let a of Array.from(o.attributes)){let s=a.name;if(s.startsWith("*")){o.removeAttribute(s);continue}if(s.includes("@")){o.removeAttribute(s);continue}if(s.includes(":")){let l=s.split(":",1)[0];if(!n.has(l)){o.removeAttribute(s);continue}}if(r&&(s.startsWith("x-")||s.startsWith("v-")||s.startsWith(":")||s.startsWith("on:")||s.startsWith("bind:")||s.startsWith("let:")||s.startsWith("class:"))){o.removeAttribute(s);continue}}}}var nn=/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;function ls(e){if(!e)return;let t=i=>{if(i.nodeType===Node.ELEMENT_NODE){if(i.attributes)for(let o of Array.from(i.attributes)){let a=o.value.replace(nn,"");if(a!==o.value)try{i.setAttribute(o.name,a)}catch{}}}else if(i.nodeType===Node.TEXT_NODE||i.nodeType===Node.CDATA_SECTION_NODE){let o=i.data.replace(nn,"");o!==i.data&&(i.data=o)}};t(e);let r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),n;for(;n=r.nextNode();)t(n)}function cs(e,t={}){e&&(ss(e,t),as(e),ls(e))}function ds(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function us(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function ps(e,t){if(e?.nodeType!==1||ds(e)||us(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 hs(e,t,r=new Map){function n(i,o){if(i?.nodeType!==1||o?.nodeType!==1)return;let a=i.childElementCount>o.childElementCount,s=r.get(i)||getComputedStyle(i);if(r.has(i)||r.set(i,s),a&&ps(i,s)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let d=s.overflowY||s.overflowBlock||"visible",u=s.overflowX||s.overflowInline||"visible";(d!=="visible"||u!=="visible")&&(o.style.overflow="visible")}let l=Array.from(i.children),c=Array.from(o.children);for(let d=0;d<Math.min(l.length,c.length);d++)n(l[d],c[d])}n(e,t)}function fs(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function ms(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 gs(e,t){let r=getComputedStyle(e),n=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,s=Array.from(e.children);for(let h of s){if(ms(h,t)||!fs(h))continue;let f=h.getBoundingClientRect(),m=f.top-n.top,g=f.bottom-n.top;g<=m||(m<i&&(i=m),g>o&&(o=g),a=!0)}let l=a?Math.max(0,o-i):0,c=parseFloat(r.borderTopWidth)||0,d=parseFloat(r.borderBottomWidth)||0,u=parseFloat(r.paddingTop)||0,p=parseFloat(r.paddingBottom)||0;return c+d+u+p+l}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,Le=.75;function bs(e,t,r,n,i,o){let a=e.ownerDocument||document,s=e.getBoundingClientRect(),l=i>0&&s.width>0?s.width/i:1,c=o>0&&s.height>0?s.height/o:1;if(Math.abs(l-c)>.02)return 0;let d=a.createElement("div");d.setAttribute("data-snapdom-internal",""),d.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+i+"px!important;overflow:visible!important;visibility:hidden!important;";let u=d.attachShadow({mode:"open"}),p=a.createElement("style");p.textContent=r,u.appendChild(p);let h=t.cloneNode(!0);u.appendChild(h),a.body.appendChild(d);let f=0,m=(g,y,x)=>{let v=_(g),b=v.boxSizing==="border-box",w=(S,M,...k)=>{let E=parseFloat(S);if(!Number.isFinite(E))return M;let $=E+(b?0:k.reduce((R,L)=>R+(parseFloat(L)||0),0));return Math.abs($-M)<=.51?$:M};return{width:w(v.width,y,v.paddingLeft,v.paddingRight,v.borderLeftWidth,v.borderRightWidth),height:w(v.height,x,v.paddingTop,v.paddingBottom,v.borderTopWidth,v.borderBottomWidth)}};try{let g=h.getBoundingClientRect(),y=h.offsetWidth||i,x=h.offsetHeight||o,v=y>0&&g.width>0?g.width/y:1,b=x>0&&g.height>0?g.height/x:1,w=(S,M,k=!1)=>{let E=S.children,$=M.children,R=Math.min(E.length,$.length);for(let L=0;L<R;L++){let D=E[L],F=$[L],I=n.get(D),T=k||Yn.has(D);if(I?.nodeType===1&&D?.namespaceURI===Zt&&D.style&&I.isConnected){let O=I.getBoundingClientRect();if(O.width>0&&O.height>0){let X=F.getBoundingClientRect(),U=O.width/l,V=O.height/c,Q=X.width,P=X.height,B=I.offsetWidth||U,W=I.offsetHeight||V,q=F.offsetWidth||Q,ce=F.offsetHeight||P,K=Math.abs(U-B)>Le||Math.abs(V-W)>Le||Math.abs(Q-q)>Le||Math.abs(P-ce)>Le;if(T){let J=m(F,q,ce);U=Q>0?U*v*J.width/Q:U,V=P>0?V*b*J.height/P:V,Q=J.width,P=J.height}else if(K){let J=m(I,B,W),fe=m(F,q,ce);U=J.width,V=J.height,Q=fe.width,P=fe.height}let te=Q-U,ie=P-V;(Math.abs(te)>Le||Math.abs(ie)>Le)&&(D.style.boxSizing="border-box",D.style.width=`${A(U)}px`,D.style.height=`${A(V)}px`,f++)}}w(D,F,T)}};w(t,h)}finally{d.remove()}return f}var ys=/::-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 i=e[n];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){r+=tr(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=tr(i.cssRules,t);o&&(r+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(ys.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),r+=a)}}}catch{}}return r}var on=new WeakMap;function ws(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 xs(e){if(!e||!e.styleSheets)return"";let t=ws(e),r=on.get(e);if(r&&r.fp===t)return r.css;let n=new Set,i="";for(let o of Array.from(e.styleSheets))try{let a=o.cssRules;a&&(i+=tr(a,n))}catch{}return on.set(e,{fp:t,css:i}),i}Ae();var lt=new Set;async function vs(e,t={}){let r=t.__session||C.session,n={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:t},i=null;if(t.clip){let u=Gn(e,t.clip);if(u){n.clip={rect:u,root:e};let p=e.getBoundingClientRect();i={x:u.left-p.left,y:u.top-p.top,width:u.width,height:u.height}}}let o,a="",s="";if(lt.size){let u=(p,h)=>{for(let f=h;f;f=f.assignedSlot||f.parentElement||f.getRootNode()?.host)if(f===p)return!0;return!1};for(;;){let p=[...lt].filter(({root:h})=>u(h,e)||u(e,h)).map(({promise:h})=>h.catch(()=>{}));if(!p.length)break;await Promise.all(p)}}if(!n.clip&&e.isConnected&&e.ownerDocument?.visibilityState!=="hidden")try{let u=e.getBoundingClientRect(),p=e.ownerDocument?.defaultView||window,h=u.right<=0||u.bottom<=0||u.left>=p.innerWidth||u.top>=p.innerHeight,f=[];if(h&&(()=>{let m=[];e.shadowRoot&&m.push(e.shadowRoot);for(let g of e.querySelectorAll("*"))g.shadowRoot&&m.push(g.shadowRoot);for(;m.length;){let g=m.pop(),y=g.host?.localName==="calcite-icon";for(let x of g.querySelectorAll("*")){if(x.shadowRoot&&m.push(x.shadowRoot),!y||x.localName!=="svg")continue;let v=x.querySelectorAll("path");if(!v.length||[...v].some(w=>w.getAttribute("d")?.trim()))continue;let b=x.getBoundingClientRect();b.width&&b.height&&f.push(x)}}})(),f.length){let m=(async()=>{let y=e.style,x=e.hasAttribute("style"),v=new Map,b=(w,S)=>{v.has(w)||v.set(w,{value:y.getPropertyValue(w),priority:y.getPropertyPriority(w)}),y.setProperty(w,S,"important");let M=v.get(w);M.forcedValue=y.getPropertyValue(w),M.forcedPriority=y.getPropertyPriority(w)};try{b("left","0"),b("top","0"),b("right","auto"),b("bottom","auto"),b("margin-top","0"),b("margin-right","0"),b("margin-bottom","0"),b("margin-left","0"),b("transform","none"),b("translate","none"),b("opacity","0"),b("pointer-events","none");let w=e.getBoundingClientRect();if(w.right<=0||w.bottom<=0||w.left>=p.innerWidth||w.top>=p.innerHeight){let k=e.parentElement?.getBoundingClientRect(),E=k&&k.right>0&&k.left<p.innerWidth?Math.max(0,k.left):0,$=k&&k.bottom>0&&k.top<p.innerHeight?Math.max(0,k.top):0;b("position","fixed"),b("left",`${E}px`),b("top",`${$}px`)}await Me(100);let S=Date.now()+1500,M=()=>f.some(k=>{if([...k.querySelectorAll("path")].some($=>$.getAttribute("d")?.trim()))return!1;let E=k.getBoundingClientRect();return E.width&&E.height&&E.right>0&&E.bottom>0&&E.left<p.innerWidth&&E.top<p.innerHeight});for(;Date.now()<S&&M();)await new Promise(k=>setTimeout(k,25));await Me(100)}finally{for(let[w,S]of v)y.getPropertyValue(w)!==S.forcedValue||y.getPropertyPriority(w)!==S.forcedPriority||(S.value?y.setProperty(w,S.value,S.priority):y.removeProperty(w));!x&&!y.length&&e.removeAttribute("style"),await Me(100)}})(),g={root:e,promise:m};lt.add(g);try{await m}finally{lt.delete(g)}}}catch{}let l=_a(e),c=n.clip?()=>{}:ja(e);try{o=await gt(e,n,t)}catch(u){throw console.warn("deepClone failed:",u),u}finally{c(),l()}try{Ba(o)}catch(u){console.warn("inlineExternal defs or symbol failed:",u)}try{await Qt(e,o,n,t)}catch(u){console.warn("inlinePseudoElements failed:",u)}await Yo(o,n);try{let u=o.querySelectorAll("style[data-sd]");for(let p of u)s+=p.textContent||"",p.remove()}catch(u){j(n,"Failed to extract shadow CSS from style[data-sd]",u)}let d=Hi(n.styleMap);a=Array.from(d.entries()).map(([u,p])=>`.${p}{${u}}`).join(""),a=s+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+a;for(let[u,p]of n.styleMap.entries()){if(u.tagName==="STYLE")continue;if(u.getRootNode&&u.getRootNode()instanceof ShadowRoot){u.setAttribute("style",p.replace(/;/g,"; "));continue}let h=d.get(p);h&&u.classList.add(h);let f=u.style?.backgroundImage,m=u.dataset?.snapdomHasIcon;f&&f!=="none"&&(u.style.backgroundImage=f),m&&(u.style.verticalAlign="middle",u.style.display="inline")}if((n.clip||e.scrollTop||e.scrollLeft)&&o?.nodeType===1)try{let u=n.clip&&i?{x:i.x,y:i.y}:{x:0,y:0};ts(e,o,n.nodeMap,n.styleCache,u)}catch(u){j(n,"freezeViewportPositioned failed",u)}for(let[u,p]of n.nodeMap.entries()){if(n.clip&&p===e)continue;let h=p.scrollLeft,f=p.scrollTop;if((h||f)&&u?.nodeType===1&&u.namespaceURI==="http://www.w3.org/1999/xhtml"){u.style.overflow="hidden",u.style.scrollbarWidth="none",u.style.msOverflowStyle="none";try{let g=u.querySelectorAll("*");for(let y of g){if(y.nodeType!==1||y.namespaceURI!=="http://www.w3.org/1999/xhtml")continue;let x=y.style.position;if(x==="fixed"||x==="absolute"){let v=parseFloat(y.style.top)||0,b=parseFloat(y.style.left)||0;y.style.top=`${v+f}px`,y.style.left=`${b+h}px`,x==="fixed"&&(y.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.all="unset",m.style.transform=`translate(${-h}px, ${-f}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";u.firstChild;)m.appendChild(u.firstChild);u.appendChild(m)}}if(e===n.nodeMap.get(o)){let u=n.styleCache.get(e)||_(e);n.styleCache.set(e,u);let p=$i(u.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=p||""}for(let[u,p]of n.nodeMap.entries())p.tagName==="PRE"&&(u.style.marginTop="0",u.style.marginBlockStart="0");return{clone:o,classCSS:a,styleCache:n.styleCache,nodeMap:n.nodeMap,reconcileRisk:n.reconcileRisk||0,clipWindow:i}}$e();ne();var Qn="http://www.w3.org/1999/xlink";function Ss(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Qn,"href"):null)}function ks(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,r=parseInt(e.dataset?.snapdomHeight||"",10)||0,n=parseInt(e.getAttribute("width")||"",10)||0,i=parseInt(e.getAttribute("height")||"",10)||0,o=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,s=t||o||n||e.width||e.naturalWidth||100,l=r||a||i||e.height||e.naturalHeight||100;return{width:s,height:l}}async function Cs(e,t={}){let r=Array.from(e.querySelectorAll("img"));e.tagName==="IMG"&&r.unshift(e);let n=async s=>{if(!s.getAttribute("src")){let f=s.currentSrc||s.src||kt(s.getAttribute("srcset"),s)||"";f&&s.setAttribute("src",f)}s.removeAttribute("srcset"),s.removeAttribute("sizes");let l=s.src||"";if(!l)return;let c=C.image?.get(l);if(c){s.src=c,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let d=await le(l,{as:"dataURL",useProxy:t.useProxy});if(d.ok&&typeof d.data=="string"&&d.data.startsWith("data:")){C.image?.set(l,d.data),s.src=d.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:u,height:p}=ks(s),{fallbackURL:h}=t||{};if(h)try{let f=typeof h=="function"?await h({width:u,height:p,src:l,element:s}):h;if(f){let m=await le(f,{as:"dataURL",useProxy:t.useProxy});if(m?.ok&&typeof m.data=="string"){s.src=m.data,s.width||(s.width=u),s.height||(s.height=p);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${u}px`,`height:${p}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${p}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",s.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${u}px;height:${p}px;visibility:hidden;`,s.replaceWith(f)}},i=6;for(let s=0;s<r.length;s+=i){let l=r.slice(s,s+i).map(n);await Promise.allSettled(l)}let o=Array.from(e.querySelectorAll("image"));e.localName==="image"&&o.unshift(e);let a=async s=>{let l=Ss(s);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let c=await le(l,{as:"dataURL",useProxy:t.useProxy});c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")&&(s.setAttribute("href",c.data),s.removeAttribute("xlink:href"),typeof s.removeAttributeNS=="function"&&s.removeAttributeNS(Qn,"href"))};for(let s=0;s<o.length;s+=i){let l=o.slice(s,s+i).map(a);await Promise.allSettled(l)}}de();ne();var Ms=["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"],Es=["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"],$s=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],As=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];async function Rs(e,t,r,n){let i=r.get(e)||_(e);r.has(e)||r.set(e,i);let o=i.getPropertyValue("border-image"),a=i.getPropertyValue("border-image-source"),s=o&&o!=="none"||a&&a!=="none",l=i.getPropertyValue("background-image"),c=i.getPropertyValue("background-color");if(l&&l!=="none"||c&&c!=="rgba(0, 0, 0, 0)"&&c!=="transparent"||/url\s*\(|gradient\s*\(/i.test(i.getPropertyValue("background")||""))for(let d of $s){let u=i.getPropertyValue(d);u&&t.style.setProperty(d,u)}for(let d of Ms){let u=i.getPropertyValue(d);if(d==="background-image"&&(!u||u==="none")){let f=i.getPropertyValue("background");f&&/url\s*\(/.test(f)&&(u=Bt(f).filter(m=>/url\s*\(/.test(m)).join(", ")||u)}if(!u||u==="none")continue;let p=Bt(u),h=await Promise.all(p.map(f=>un(f,n)));h.some(f=>f&&f!=="none"&&!/^url\(undefined/.test(f))&&t.style.setProperty(d,h.join(", "))}for(let d of Es){let u=i.getPropertyValue(d);!u||u==="initial"||t.style.setProperty(d,u)}if(s)for(let d of As){let u=i.getPropertyValue(d);!u||u==="initial"||t.style.setProperty(d,u)}}async function Ns(e,t,r,n={},i=C.session.nodeMap){if(!t)return;let o=[];e&&Or(e)&&o.push([e,t]);let a=[t];for(;a.length;){let l=a.pop();if(l.children)for(let c of l.children){if(c.tagName==="STYLE")continue;let d=i.get(c);d&&Or(d)&&o.push([d,c]),a.push(c)}}let s=6;for(let l=0;l<o.length;l+=s)await Promise.allSettled(o.slice(l,l+s).map(([c,d])=>Rs(c,d,r,n)))}ne();de();function Ts(e,t,r=C.session.nodeMap){let n=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let s=i.currentNode;s;s=i.nextNode()){let l=r.get(s);if(l?.nodeType!==1)continue;let c=_(l),d=c.getPropertyValue("backdrop-filter")||c.getPropertyValue("-webkit-backdrop-filter");d&&d!=="none"&&s!==t&&n.push({cloneEl:s,orig:l,bf:d,path:Ps(t,s)})}if(!n.length)return;let o=e.getBoundingClientRect(),a=n.map((s,l)=>{let c=t.cloneNode(!0);Fs(c,t,s.orig.getBoundingClientRect(),r),Is(an(c,s.path));for(let d=0;d<l;d++){let u=an(c,n[d].path);u&&(u.style.setProperty("backdrop-filter","none","important"),u.style.setProperty("-webkit-backdrop-filter","none","important"))}return{...s,copy:c}});for(let{cloneEl:s,orig:l,bf:c,copy:d}of a)Ls(s,l,c,d,o)}function Ls(e,t,r,n,i){let o=t.getBoundingClientRect();if(!o.width||!o.height)return;let a=_(t),s=t.offsetWidth?o.width/t.offsetWidth:1,l=Math.abs(s-1)>.001?1/s:1;n.style.position="absolute",n.style.left=`${(i.left-o.left)*l}px`,n.style.top=`${(i.top-o.top)*l}px`,n.style.width=`${i.width}px`,n.style.height=`${i.height}px`,n.style.margin="0",n.style.filter=r,l!==1&&(n.style.transform=`scale(${l})`,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 d=document.createElement("div");d.style.cssText="position:absolute;inset:0;border-radius:inherit;z-index:-1",d.style.backgroundColor=a.backgroundColor,d.style.backgroundImage=e.style.backgroundImage||a.backgroundImage;for(let u of["background-size","background-position","background-repeat","background-origin","background-clip"])d.style.setProperty(u,a.getPropertyValue(u));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(d),e.prepend(c)}var ct=128;function Fs(e,t,r,n){let i=[[e,t]];for(;i.length;){let[o,a]=i.pop(),s=n.get(a);if(s?.nodeType===1){let d=s.getBoundingClientRect();(d.left>r.right+ct||d.right<r.left-ct||d.top>r.bottom+ct||d.bottom<r.top-ct)&&(o.tagName==="IMG"&&o.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="),o.style&&(o.style.backgroundImage="none"))}let l=o.children,c=a.children;for(let d=0;d<l.length;d++)i.push([l[d],c[d]])}}function Ps(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 Is(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}}de();ne();function Os(e,t){if(!e)return()=>{};let r=[],n=200;function i(o){if(t){let c=o.getBoundingClientRect();if(c.width>0||c.height>0){let d=Math.max(c.right,c.left+(o.scrollWidth||0)),u=Math.max(c.bottom,c.top+(o.scrollHeight||0));if(d<t.left-n||c.left>t.right+n||u<t.top-n||c.top>t.bottom+n)return}}let a=getComputedStyle(o),s=Ds(o,a);s&&r.push(s);let l=Ws(o,a);l&&r.push(l);for(let c of o.children||[])i(c)}return i(e),()=>r.forEach(o=>o())}function Ds(e,t){if(!e)return()=>{};t=t||getComputedStyle(e);let r=Hs(t);if(r<=0)return()=>{};if(!Zn(e))return()=>{};let n=Jn(e),i=n.text,o=_s(t);n.write("X");let a=e.scrollHeight-o;n.restore();let s=a>0?a:Bs(t),l=Math.round(s*r+o);if(e.scrollHeight<=l+.5)return()=>{};let c=0,d=i.length,u=-1;for(;c<=d;){let p=c+d>>1;n.write(i.slice(0,p)+"\u2026"),e.scrollHeight<=l+.5?(u=p,c=p+1):d=p-1}return n.write((u>=0?i.slice(0,u):"")+"\u2026"),()=>{n.restore()}}function Ws(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,i=0,o=n.length,a=-1;for(;i<=o;){let s=i+o>>1;r.write(n.slice(0,s)+"\u2026"),e.scrollWidth<=e.clientWidth+.5?(a=s,i=s+1):o=s-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 i=1;i<t.length;i++)t[i].data=""},restore(){for(let n=0;n<t.length;n++)t[n].data=r[n]}}}function Hs(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 Bs(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 _s(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 js(...e){let t=e.flat();for(let r of t){let n=Nt(r);n&&(Be.some(i=>i&&i.name&&n.name&&i.name===n.name)||Be.push(n))}}function ei(e){return e&&Array.isArray(e.plugins)?e.plugins:Be}async function Se(e,t,r){let n=r,i=ei(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let s=await a(t,n);typeof s<"u"&&(n=s)}return n}async function Us(e,t,r){let n=[],i=ei(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let s=await a(t,r);typeof s<"u"&&n.push(s)}return n}function qs(e){let t=[];if(Array.isArray(e))for(let r of e){let n=Nt(r);if(!n||!n.name)continue;let i=t.findIndex(o=>o&&o.name===n.name);i>=0&&t.splice(i,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 zs(e,t,r=!1){return!e||e.plugins&&!r||(e.plugins=qs(t)),e}function ti(){return Be.slice()}ne();var Vs=.92,Xs=.95;async function Ys(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 Gs(e){let t=/^data:([^;,]+)/.exec(e);return t?t[1]:""}async function pr(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(C.compress.has(n))return C.compress.get(n);let i=await(async()=>{let o;try{o=await Ys(e)}catch{return null}let a=o.naturalWidth||o.width,s=o.naturalHeight||o.height;if(!a||!s)return null;let l=Math.min(1,Math.max(t/a,r/s));if(!(l>0)||l>=.95)return null;let c=l*Xs,d=Math.max(1,Math.round(a*c)),u=Math.max(1,Math.round(s*c)),p=document.createElement("canvas");p.width=d,p.height=u;let h=p.getContext("2d");if(!h)return null;h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(o,0,0,d,u);let f=Gs(e),m=f==="image/jpeg"?"image/jpeg":f==="image/webp"?"image/webp":"image/png";try{let g=p.toDataURL(m,Vs);if(typeof g=="string"&&g.startsWith("data:image")&&g.length<e.length)return g}catch{}return null})();return C.compress.set(n,i),i}async function Ks(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 i=0,o=0,a=0,s=async c=>{let d=c.getAttribute("src")||"";if(!d.startsWith("data:image")||d.startsWith("data:image/svg"))return;let u=parseFloat(c.dataset.snapdomWidth)||parseFloat(c.style.width)||c.width||0,p=parseFloat(c.dataset.snapdomHeight)||parseFloat(c.style.height)||c.height||0;if(!u||!p)return;let h=await pr(d,u*r,p*r);h&&(i++,o+=d.length,a+=h.length,c.setAttribute("src",h))},l=6;for(let c=0;c<n.length;c+=l)await Promise.allSettled(n.slice(c,c+l).map(s));return{count:i,before:o,after:a}}function Qs(e){let t=e.offsetWidth||e.getBoundingClientRect().width||0,r=e.offsetHeight||e.getBoundingClientRect().height||0;return{w:t,h:r}}async function Js(e,t,r=C.session.nodeMap){if(!t.compress)return{count:0};let n=(t.scale||1)*(t.dpr||1),i=[],o=[e,...e.querySelectorAll("*")];for(let c of o){let d=c.style&&c.style.backgroundImage;d&&d.includes("data:image")&&i.push(c)}let a=0,s=async c=>{let d=r.get(c);if(!d||!d.isConnected)return;let u;try{u=getComputedStyle(d)}catch{return}if((u.backgroundRepeat||"repeat").toLowerCase().split(",").some(v=>v.trim()!=="no-repeat"))return;let{w:p,h}=Qs(d);if(!p||!h)return;let f=p*n,m=h*n,g=c.style.backgroundImage,y=[...g.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],x=g;for(let v of y){let b=v[2];if(b.startsWith("data:image/svg"))continue;let w=await pr(b,f,m);w&&(x=x.split(b).join(w),a++)}x!==g&&(c.style.backgroundImage=x)},l=6;for(let c=0;c<i.length;c+=l)await Promise.allSettled(i.slice(c,c+l).map(s));return{count:a}}async function Zs(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 i=0,o=async s=>{let l=s.getAttribute("href")||(typeof s.getAttributeNS=="function"?s.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!l||!l.startsWith("data:image")||l.startsWith("data:image/svg"))return;let c=parseFloat(s.getAttribute("width"))||0,d=parseFloat(s.getAttribute("height"))||0;if(!c||!d)return;let u=await pr(l,c*r,d*r);u&&(s.setAttribute("href",u),s.hasAttribute("xlink:href")&&s.setAttribute("xlink:href",u),i++)},a=6;for(let s=0;s<n.length;s+=a)await Promise.allSettled(n.slice(s,s+a).map(o));return{count:i}}async function el(e,t,r){t.compress&&(await Ks(e,t),await Js(e,t,r),await Zs(e,t))}function tl(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(Nt(t)?.name==="picture-resolver")return!0}return ti().some(t=>t?.name==="picture-resolver")}function rl(e){let t=Array.isArray(e.plugins)?e.plugins:ti(),r=[];for(let n of t){let i=Nt(n);i&&typeof i.resolveNode=="function"&&r.push(i.resolveNode.bind(i))}return r.length?r:null}var nl=2e3,il=3;function ol(e){let t=Date.now(),r=C.burstAdvice.get(e);if(!r||t-r.firstTs>nl){C.burstAdvice.set(e,{count:1,firstTs:t,warned:!1});return}r.count++,r.count>=il&&!r.warned&&(r.warned=!0,console.warn("[snapdom] Captured this element multiple times. Pass { burst: true } to increase the speed."))}async function al(e,t){if(!e)throw new Error("Element cannot be null or undefined");Ei(t.cache),t.__session={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap},t.burst||ol(e),t.__resolveNodeHooks=rl(t);let r=t.fast,n=t.outerTransforms!==!1,i=!!t.outerShadows,o=t.clip?Gn(e,t.clip):null,a={element:e,options:t,plugins:t.plugins},s,l,c,d,u,p,h="",f="",m,g,y=null;await Se("beforeSnap",a);let x=null;t.resolvePicturePlaceholders!==!1&&!tl(t)&&(x=await Ao(a.element,a.options)),await Se("beforeClone",a);let v=Os(a.element,o);try{({clone:s,classCSS:l,styleCache:c,nodeMap:d,reconcileRisk:u,clipWindow:p}=await vs(a.element,a.options)),u>0&&!t.reconcile&&!C.warnedReconcile&&(C.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&&s&&(y=Ya(a.element,s)),!i&&s&&rs(a.element,s,a.options),s&&(os(a.element,s,d),ns(a.element,s))}finally{v()}if(a={clone:s,classCSS:l,styleCache:c,nodeMap:d,...a},await Se("afterClone",a),x&&await x(),cs(a.clone),a.options?.excludeMode==="remove"||a.options?.filterMode==="remove")try{hs(a.element,a.clone,a.styleCache)}catch(R){console.warn("[snapdom] shrink pass failed:",R)}try{await pa(a.clone,a.element,a.nodeMap)}catch{}let b=R=>new Promise((L,D)=>{ut(()=>{Promise.resolve().then(R).then(L,D)},{fast:r})}),w=(async()=>{await Promise.all([b(()=>Cs(a.clone,a.options)),b(()=>Ns(a.element,a.clone,a.styleCache,a.options,a.nodeMap))]);try{Ts(a.element,a.clone,a.nodeMap)}catch(R){console.warn("[snapdom] backdrop-filter emulation failed:",R)}t.compress&&await b(()=>el(a.clone,a.options,a.nodeMap))})(),S=Promise.resolve();t.embedFonts&&(S=b(async()=>{let R=a.element.ownerDocument||document,L=o?I=>{try{let T=I.getBoundingClientRect();return T.right>=o.left-200&&T.left<=o.right+200&&T.bottom>=o.top-200&&T.top<=o.bottom+200}catch{return!0}}:null,{required:D,usedCodepoints:F}=qn(a.element,L);if(we()){let I=new Set(Array.from(D).map(T=>String(T).split("__")[0]).filter(Boolean));await zn(I,1,R)}h=await Na({required:D,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,S]);let M=Di(a.clone).sort(),k=M.join(",");C.baseStyle.has(k)?f=C.baseStyle.get(k):await new Promise(R=>{ut(()=>{f=Wi(M),C.baseStyle.set(k,f),R()},{fast:r})});let E=xs(a.element?.ownerDocument||document);a={fontsCSS:h,baseCSS:f,scrollbarCSS:E,...a},await Se("beforeRender",a),await new Promise(R=>{ut(()=>{let L=_(a.element),D=a.element.getBoundingClientRect(),F=Math.max(1,A(a.element.offsetWidth||parseFloat(L.width)||D.width||1)),I=Math.max(1,A(a.element.offsetHeight||parseFloat(L.height)||D.height||1)),T=a.element.ownerDocument||document;if(!p&&(a.element===T.body||a.element===T.documentElement)&&!T.documentElement.hasAttribute("data-sd-pinned")){let z=Math.max(a.element.scrollHeight||0,T.documentElement?.scrollHeight||0,T.body?.scrollHeight||0),Z=Math.max(a.element.scrollWidth||0,T.documentElement?.scrollWidth||0,T.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,oe=C.measureHints.get(a.element);if(oe&&oe.cssLen===Y&&oe.w0===F)oe.csh>0&&(I=Math.max(I,A(oe.csh))),oe.csw>0&&(F=Math.max(F,A(oe.csw)));else{let G=T.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 ue=G.attachShadow({mode:"open"}),et=T.createElement("style");et.textContent=(a.scrollbarCSS||"")+a.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a.classCSS,ue.appendChild(et),ue.appendChild(a.clone.cloneNode(!0)),T.body.appendChild(G);let ve=G.scrollHeight,Lt=G.scrollWidth;T.body.removeChild(G),C.measureHints.set(a.element,{cssLen:Y,w0:F,csh:ve,csw:Lt}),ve>0&&(I=Math.max(I,A(ve))),Lt>0&&(F=Math.max(F,A(Lt)))}}catch{}}if(a.options?.excludeMode==="remove"||a.options?.filterMode==="remove"){let z=gs(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;bs(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=p?A(p.width):F,Q=p?A(p.height):I,P=V,B=Q,W=Number.isFinite(X),q=Number.isFinite(U),ce=Q>0?V/Q:1;W&&q?(P=Math.max(1,A(X)),B=Math.max(1,A(U))):W?(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 K=0,te=0,ie=F,J=I;if(p){let z=0,Z=0;if(Dt(a.element)){let Y=null;if(!n&&y&&Number.isFinite(y.a))Y={a:y.a,b:y.b||0,c:y.c||0,d:y.d||1,e:0,f:0};else{let oe=Mt(a.element),G=Kn(L.transform&&L.transform!=="none"?L.transform:"",oe);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:oe,oy:G}=Jt(L,F,I),ue=wt(F,I,Y,oe,G);z=ue.minX,Z=ue.minY}}K=A(p.x+z),te=A(p.y+Z),ie=A(K+p.width),J=A(te+p.height)}else if(!n&&y&&Number.isFinite(y.a)){let z={a:y.a,b:y.b||0,c:y.c||0,d:y.d||1,e:0,f:0},Z=wt(F,I,z,0,0);K=A(Z.minX),te=A(Z.minY),ie=A(Z.maxX),J=A(Z.maxY)}else if(n&&Dt(a.element)){let z=L.transform&&L.transform!=="none"?L.transform:"",Z=Mt(a.element),Y=Ka({baseTransform:z,rotate:Z.rotate||"0deg",scale:Z.scale,translate:Z.translate}),{ox:oe,oy:G}=Jt(L,F,I),ue=Y.is2D?Y:new DOMMatrix(Y.toString()),et={a:ue.a,b:ue.b,c:ue.c,d:ue.d,e:0,f:0},ve=wt(F,I,et,oe,G);K=A(ve.minX),te=A(ve.minY),ie=A(ve.maxX),J=A(ve.maxY)}let fe=Ua(L),ke=qa(L),ee=za(L),Ve=Va(L),Xe=Xa(L),Ye=p?{top:0,right:0,bottom:0,left:0}:i?{top:A(Math.max(fe.top,ke.top)+ee.top+Ve.top+Xe.bleed.top),right:A(Math.max(fe.right,ke.right)+ee.right+Ve.right+Xe.bleed.right),bottom:A(Math.max(fe.bottom,ke.bottom)+ee.bottom+Ve.bottom+Xe.bleed.bottom),left:A(Math.max(fe.left,ke.left)+ee.left+Ve.left+Xe.bleed.left)}:{top:ee.top,right:ee.right,bottom:ee.bottom,left:ee.left};K=A(K-Ye.left),te=A(te-Ye.top),ie=A(ie+Ye.right),J=A(J+Ye.bottom);let fr=Math.max(1,A(ie-K)),mr=Math.max(1,A(J-te)),ii=W||q?A(P/V):1,oi=q||W?A(B/Q):1,ai=Math.max(1,A(fr*ii)),si=Math.max(1,A(mr*oi)),gr="http://www.w3.org/2000/svg",li=Dt(a.element)?2:0,Re=A(li+(n?0:1)),Ge=Math.ceil(fr+Re*2),Ke=Math.ceil(mr+Re*2),Qe=A(-(A(K)-Re)),Je=A(-(A(te)-Re)),br=Math.max(0,Qe),yr=Math.max(0,Je),wr=A(Ge-Math.min(0,Qe)),xr=A(Ke-Math.min(0,Je)),xe=document.createElementNS(gr,"foreignObject");xe.setAttribute("x",String(Math.min(0,Qe))),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"),ci="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+ci+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`+(br!==0||yr!==0?`;padding:${yr}px 0 0 ${br}px !important`:""),Ze.appendChild(a.clone),xe.appendChild(Ze);let di=new XMLSerializer().serializeToString(xe),Sr=W||q,ui=Object.freeze({w0:V,h0:Q,vbW:Ge,vbH:Ke,targetW:P,targetH:B,contentX:A(Qe+(p?K:0)),contentY:A(Je+(p?te:0)),clip:p?Object.freeze({x:A(K),y:A(te),width:V,height:Q}):null});Object.defineProperty(t,"meta",{value:ui,enumerable:!0,writable:!1,configurable:!0});let pi=!Sr||we()?Ge:A(ai+Re*2),hi=!Sr||we()?Ke:A(si+Re*2),fi=parseFloat(_(T.documentElement)?.fontSize)||16;g=`<svg xmlns="${gr}" width="${pi}" height="${hi}" viewBox="0 0 ${Ge} ${Ke}" font-size="${fi}px">`+di+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(g)}`,a={svgString:g,dataURL:m,...a},R()},{fast:r})}),await Se("afterRender",a);let $=document.getElementById("snapdom-sandbox");return $&&$.style.position==="absolute"&&$.remove(),a.dataURL}function Dt(e){return Qa(e)}ne();function sl(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let r=Mi(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();Mn();var sn=new WeakMap;function ri(e,t,r){let n=new Set;if(e instanceof HTMLVideoElement&&n.add(e),e.querySelectorAll)for(let i of e.querySelectorAll("video"))n.add(i);for(let i of t.trackedVideos)n.has(i)||(i.removeEventListener("timeupdate",r),i.removeEventListener("seeked",r),t.trackedVideos.delete(i));for(let i of n)t.trackedVideos.has(i)||(i.addEventListener("timeupdate",r),i.addEventListener("seeked",r),t.trackedVideos.add(i))}function ll(e){let t={dirty:!0,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedVideos:new Set},r=o=>{t.capturing||Pn(o)&&(t.dirty=!0)},n=()=>{t.capturing||(t.dirty=!0)},i=e.ownerDocument||document;try{let o=new MutationObserver(r);o.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),t.observers.push(o)}catch{}try{if(i.head){let o=new MutationObserver(r);o.observe(i.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),t.observers.push(o)}}catch{}return t.markDirty=r,t.onMediaDirty=n,ri(e,t,n),t}function ln(e){let{burst:t,invalidate:r,...n}=e||{};try{return JSON.stringify(n,Object.keys(n).sort())}catch{return null}}function cl(e,t,r,n){let i=sn.get(e);i||(i=ll(e),i.baselineSignature=ln(t),sn.set(e,i));let o=ln(t),a=o===null||o!==i.baselineSignature,s=async()=>{for(let c of i.observers)i.markDirty(c.takeRecords());if(r.invalidate&&(i.dirty=!0),!a&&!i.dirty&&i.last)return i.last;i.capturing=!0,a||(i.dirty=!1);try{let c=await n();return a||(i.last=c),c}finally{for(let c of i.observers)c.takeRecords();i.capturing=!1,ri(e,i,i.onMediaDirty)}},l=i.inflight.then(s,s);return i.inflight=l.catch(()=>{}),l}de();$e();ne();function dl(...e){return js(...e),H}var H=Object.assign(pl,{plugins:dl}),rr=Symbol("snapdom.internal"),ul=Symbol("snapdom.internal.silent");async function pl(e,t){if(!e)throw new Error("Element cannot be null or undefined");let r=sl(t);if(zs(r,t&&t.plugins),we()){if(r.embedFonts===!0)try{let i=Ta(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await zn(o,1)}catch{}let n=Array.from(e.querySelectorAll("canvas"));e.tagName==="CANVAS"&&n.unshift(e);for(let i of n)try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){j(t,"safari canvas poke failed",o)}}return r.iconFonts&&r.iconFonts.length>0&&oa(r.iconFonts),r.snap||(r.snap={toPng:(n,i)=>H.toPng(n,i),toSvg:(n,i)=>H.toSvg(n,i)}),r.burst?cl(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 al(e,t),i={img:async(m,g)=>{let{toImg:y}=await Promise.resolve().then(()=>(Fr(),jt));return y(n,{...m,...g||{}})},svg:async(m,g)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Fr(),jt));return y(n,{...m,...g||{}})},canvas:async(m,g)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(je(),En));return y(n,{...m,...g||{}})},blob:async(m,g)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Ln(),Nn));return y(n,{...m,...g||{}})},png:async(m,g)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ft(),ht));return y(n,{...m,...g||{},format:"png"})},jpeg:async(m,g)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ft(),ht));return y(n,{...m,...g||{},format:"jpeg"})},webp:async(m,g)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ft(),ht));return y(n,{...m,...g||{},format:"webp"})},download:async(m,g)=>{let{download:y}=await Promise.resolve().then(()=>(to(),Fn));return y(n,{...m,...g||{}})}},o={};for(let m of["img","svg","canvas","blob","png","jpeg","webp"])o[m]=async g=>i[m](t,{...g||{},[ul]:!0});o.jpg=o.jpeg;let a={...t,export:{url:n},exports:o},s=await Us("defineExports",a),l=Object.assign({},...s.filter(m=>m&&typeof m=="object").reverse()),c={...i,...l};c.jpeg&&!c.jpg&&(c.jpg=(m,g)=>c.jpeg(m,g));function d(m,g){let y={...t,...g||{}},x=v=>v==="jpeg"||v==="jpg"||v==="webp";return[m,y.format,y.type].map(v=>typeof v=="string"?v.toLowerCase():"").find(x)&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let u=!1,p=Promise.resolve();async function h(m,g){let y=Object.freeze(g&&typeof g=="object"?{...g}:{}),x=async()=>{let b=c[m];if(!b)throw new Error(`[snapdom] Unknown export type: ${m}`);let w=d(m,y),S={...t,export:{type:m,options:w,requestedOptions:y,url:n}};await Se("beforeExport",S,{format:m,options:w});let M=await b(S,w);return await Se("afterExport",S,{format:m,options:w,result:M}),u||(u=!0,await Se("afterSnap",t)),M},v=p.then(x);return p=v.catch(()=>{}),v}let f={url:n,toRaw:()=>n,to:(m,g)=>h(m,g),toImg:m=>h("img",m),toSvg:m=>h("svg",m),toCanvas:m=>h("canvas",m),toBlob:m=>h("blob",m),toPng:m=>h("png",m),toJpg:m=>h("jpg",m),toWebp:m=>h("webp",m),download:m=>h("download",m)};Object.defineProperty(f,"meta",{value:t.meta,enumerable:!0,writable:!1,configurable:!1});for(let m of Object.keys(c)){let g="to"+m.charAt(0).toUpperCase()+m.slice(1);f[g]||(f[g]=y=>h(m,y))}return f};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(){N(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),i=Math.max(Math.round(r.height),10),o=(async()=>{try{let s,l="webp";try{if(typeof H=="function"){let c=await H(t,{scale:1,embedFonts:!1});if(c&&typeof c.toWebp=="function")s=await c.toWebp();else if(c&&typeof c.toPng=="function")s=await c.toPng(),l="png";else if(c?.url)return{ok:!0,dataUrl:c.url,format:"webp",width:n,height:i}}else H?.toWebp?s=await H.toWebp(t,{scale:1,embedFonts:!1}):H?.toPng&&(s=await H.toPng(t,{scale:1,embedFonts:!1}),l="png")}catch{}if(s&&s.src)return{ok:!0,dataUrl:s.src,format:s.src.startsWith("data:image/webp")?"webp":l,width:s.naturalWidth||n,height:s.naturalHeight||i}}catch(s){let l=String(s?.message||s);if(l.includes("CORS")||l.includes("SecurityError")||l.includes("tainted"))return{ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}}return await this.captureWithSvgFallback(t,n,i)})(),a=new Promise(s=>{setTimeout(()=>s({ok:!1,reason:"CAPTURE_TIMEOUT"}),3e3)});return await Promise.race([o,a])}catch(r){return{ok:!1,reason:r?.message||"CAPTURE_EXCEPTION"}}}async captureWithSvgFallback(t,r,n){try{let i=t.cloneNode(!0),o=window.getComputedStyle(t),a="";for(let d=0;d<o.length;d++){let u=o[d];a+=`${u}:${o.getPropertyValue(u)};`}i.style.cssText=a,i.style.margin="0",i.style.position="static";let s=`
|
|
8
|
+
`):c+=p[0]}return c+=s.slice(u),c}let a=Zr(e,t||location.href);return a=await i(a,t||location.href,0),a}var Xn=/url\((["']?)([^"')]+)\1\)/g,Ia=/@font-face[^{}]*\{[^}]*\}/g;function se(e,t,r=""){return(e.match(new RegExp(`${t}\\s*:\\s*([^;}]+)[;}]`,"i"))?.[1]||r).trim()}function Yn(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],s=l=>{if(!l.includes("?"))return parseInt(l,16);let d=parseInt(l.replace(/\?/g,"0"),16),c=parseInt(l.replace(/\?/g,"F"),16);return[d,c]};if(a){let l=s(i),d=s(a),c=Array.isArray(l)?l[0]:l,u=Array.isArray(d)?d[1]:d;t.push([Math.min(c,u),Math.max(c,u)])}else{let l=s(i);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function Gn(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 gr(e,t){let r=[];if(!e)return r;for(let n of e.matchAll(Xn)){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 Jt(e,t,r=""){let n=e;for(let o of e.matchAll(Xn)){let i=lr(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(!be(a)){if(k.resource?.has(a)){k.font?.add(a),n=n.replace(o[0],`url(${k.resource.get(a)})`);continue}try{let s=await le(a,{as:"dataURL",useProxy:r,silent:!0});if(s.ok&&typeof s.data=="string"){let l=s.data;k.resource?.set(a,l),k.font?.add(a),n=n.replace(o[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return n}function Oa(e){if(!e.length)return null;let t=(a,s)=>e.some(([l,d])=>!(d<a||l>s)),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 en(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=Oa(i);if(a&&n.has(a))return!0}return!1}}function _a(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,r=new Set,n=[];for(let i of e.match(t)||[]){let a=se(i,"font-family"),s=mr(a),l=se(i,"font-weight","400"),d=se(i,"font-style","normal"),c=se(i,"font-stretch","100%"),u=se(i,"unicode-range"),p=se(i,"src"),f=gr(p,location.href),h=f.length?f.map(g=>String(g).toLowerCase()).sort().join("|"):p.toLowerCase(),m=[String(s||"").toLowerCase(),l,d,c,u.toLowerCase(),h].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 tn=new WeakMap,Da=0;function Ha(e){let t=tn.get(e);return t===void 0&&(t=Da++,tn.set(e,t)),t}function Wa(e,t,r,n,o,i){let a=Array.from(e||[]).sort().join("|"),s=t?JSON.stringify({families:(t.families||[]).map(p=>String(p).toLowerCase()).sort(),domains:(t.domains||[]).map(p=>String(p).toLowerCase()).sort(),subsets:(t.subsets||[]).map(p=>String(p).toLowerCase()).sort()}):"",l=(r||[]).map(p=>`${(p.family||"").toLowerCase()}::${p.weight||"normal"}::${p.style||"normal"}::${p.src||""}`).sort().join("|"),d=n||"",c=(o||[]).map(p=>String(p).toLowerCase()).sort().join("|"),u=Ha(i||document);return`fonts-embed-css::req=${a}::ex=${s}::lf=${l}::px=${d}::fd=${c}::doc=${u}`}async function Qn(e,t,r,n){let o;try{o=e.cssRules||[]}catch{return}let i=(a,s)=>{try{return new URL(a,s||location.href).href}catch{return a}};for(let a of o){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let s=a.href?i(a.href,t):t;if(n.depth>=$t){console.warn(`[snapDOM] CSSOM import depth exceeded (${$t}) at ${s}`);continue}if(s&&n.visitedSheets.has(s)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${s}`);continue}s&&n.visitedSheets.add(s);let l={...n,depth:(n.depth||0)+1};await Qn(a.styleSheet,s,r,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let s=(a.style.getPropertyValue("font-family")||"").trim(),l=mr(s);if(!l||be(l))continue;let d=(a.style.getPropertyValue("font-weight")||"").trim(),c=(a.style.getPropertyValue("font-style")||"").trim(),u=(a.style.getPropertyValue("font-stretch")||"").trim(),p=(a.style.getPropertyValue("font-variation-settings")||"").trim(),f=(a.style.getPropertyValue("src")||"").trim(),h=(a.style.getPropertyValue("unicode-range")||"").trim(),m=d||"400",g=c||"normal",y=u||"100%",x=(c?`font-style:${c};`:"")+(d?`font-weight:${d};`:"")+(u?`font-stretch:${u};`:"")+(p?`font-variation-settings:${p};`:"")+(h?`unicode-range:${h};`:""),v=n.faceMatchesRequired(l,g,m,y);if(!v&&!n.requiredIndex.has(l.toLowerCase()))continue;let b=Yn(h);if(!Gn(n.usedCodepoints,b))continue;let w={family:l,weightSpec:m,styleSpec:g,stretchSpec:y,unicodeRange:h,srcRaw:f,srcUrls:gr(f,t||location.href),href:t||location.href};if(n.simpleExcluder&&n.simpleExcluder(w,b))continue;if(!v){n.provisionalFaces.push({family:l.toLowerCase(),block:`@font-face{font-family:${l};src:${f};${x}}`,srcRaw:f,baseHref:t||location.href});continue}if(n.coveredFamilies.add(l.toLowerCase()),/url\(/i.test(f)){let S=await Jt(f,t||location.href,n.useProxy);await r(`@font-face{font-family:${l};src:${S};${x}}`)}else await r(`@font-face{font-family:${l};src:${f};${x}}`)}}}async function Ba({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 s=new Map;for(let b of e){let[w,S,M,C]=String(b).split("__");if(!w)continue;let E=w.toLowerCase(),$=s.get(E)||[];$.push({w:parseInt(S,10),s:M,st:parseInt(C,10)}),s.set(E,$)}function l(b,w,S,M){let C=String(b).toLowerCase();if(!s.has(C))return!1;let E=s.get(C),$=Aa(S),N=Na(w),L=Ra(M),_=$.min!==$.max,F=$.min,I=O=>N.kind==="normal"&&O==="normal"||N.kind!=="normal"&&(O==="italic"||O==="oblique"),T=!1;for(let O of E){let X=_?O.w>=$.min&&O.w<=$.max:O.w===F,U=I(vt(O.s)),V=O.st>=L.min&&O.st<=L.max;if(X&&U&&V){T=!0;break}}if(T)return!0;if(!_)for(let O of E){let X=I(vt(O.s)),U=O.st>=L.min&&O.st<=L.max;if(Math.abs(F-O.w)<=300&&X&&U)return!0}if(!_&&N.kind==="normal"&&E.some(O=>vt(O.s)!=="normal"))for(let O of E){let X=Math.abs(F-O.w)<=300,U=O.st>=L.min&&O.st<=L.max;if(X&&U)return!0}return!1}let d=en(r),c=Wa(e,r,n,o,i,a);if(k.resource?.has(c))return k.resource.get(c);let u=Fa(e),p=[],f=Kt;for(let b of a.querySelectorAll("style")){let w=b.textContent||"";for(let S of w.matchAll(f)){let M=(S[2]||S[4]||"").trim();!M||be(M)||a.querySelector(`link[rel="stylesheet"][href="${M}"]`)||p.push(M)}}let h=[];p.length&&await Promise.all(p.map(b=>new Promise(w=>{if(a.querySelector(`link[rel="stylesheet"][href="${b}"]`))return w(null);let S=a.createElement("link");S.rel="stylesheet",S.href=b,S.setAttribute("data-snapdom","injected-import"),S.onload=()=>w(S),S.onerror=()=>w(null),a.head.appendChild(S),h.push(S)})));let m="",g=new Set,y=[],x=Array.from(a.querySelectorAll('link[rel="stylesheet"]')).filter(b=>!!b.href);for(let b of h)try{b.remove()}catch{}for(let b of x)try{if(be(b.href))continue;let w="",S=!1;try{S=new URL(b.href,location.href).origin===location.origin}catch{}if(!S){let C=Array.isArray(i)?i:[];if(!La(b.href,u,C))continue}if(S){let C=Array.from(a.styleSheets).find(E=>E.href===b.href);if(C)try{let E=C.cssRules||[];w=Array.from(E).map($=>$.cssText).join("")}catch{}}if(!w){let C=await le(b.href,{as:"text",useProxy:o});if(C?.ok&&typeof C.data=="string"&&(w=C.data),be(b.href))continue}w=await Pa(w,b.href,o);let M="";for(let C of w.match(Ia)||[]){let E=se(C,"font-family"),$=mr(E);if(!$||be($))continue;let N=se(C,"font-weight","400"),L=se(C,"font-style","normal"),_=se(C,"font-stretch","100%"),F=se(C,"unicode-range"),I=se(C,"src"),T=gr(I,b.href),O=l($,L,N,_);if(!O&&!s.has($.toLowerCase()))continue;let X=Yn(F);if(!Gn(t,X))continue;let U={family:$,weightSpec:N,styleSpec:L,stretchSpec:_,unicodeRange:F,srcRaw:I,srcUrls:T,href:b.href};if(r&&d(U,X))continue;if(!O){y.push({family:$.toLowerCase(),block:C,srcRaw:I,baseHref:b.href});continue}g.add($.toLowerCase());let V=/url\(/i.test(I)?await Jt(C,b.href,o):C;M+=V}M.trim()&&(m+=M)}catch{console.warn("[snapDOM] Failed to process stylesheet:",b.href)}let v={requiredIndex:s,usedCodepoints:t,faceMatchesRequired:l,coveredFamilies:g,provisionalFaces:y,simpleExcluder:r?en(r):null,useProxy:o,visitedSheets:new Set,depth:0};for(let b of a.styleSheets)if(!(b.href&&x.some(w=>w.href===b.href)))try{let w=b.href||location.origin+"/";w&&v.visitedSheets.add(w),await Qn(b,w,async S=>{m+=S},v)}catch{}for(let b of y)g.has(b.family)||(m+=/url\(/i.test(b.srcRaw)?await Jt(b.block,b.baseHref,o):b.block);try{for(let b of a.fonts||[]){if(!b||!b.family||b.status!=="loaded"||!b._snapdomSrc)continue;let w=String(b.family).replace(/^['"]+|['"]+$/g,"");if(be(w)||!s.has(w.toLowerCase())||r?.families&&r.families.some(M=>String(M).toLowerCase()===w.toLowerCase()))continue;let S=b._snapdomSrc;if(!String(S).startsWith("data:")){if(k.resource?.has(b._snapdomSrc))S=k.resource.get(b._snapdomSrc),k.font?.add(b._snapdomSrc);else if(!k.font?.has(b._snapdomSrc))try{let M=await le(b._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")S=M.data,k.resource?.set(b._snapdomSrc,S),k.font?.add(b._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",b._snapdomSrc);continue}}m+=`@font-face{font-family:'${w}';src:url(${S});font-style:${b.style||"normal"};font-weight:${b.weight||"normal"};}`}}catch{}for(let b of n){if(!b||typeof b!="object")continue;let w=String(b.family||"").replace(/^['"]+|['"]+$/g,"");if(!w||be(w)||!s.has(w.toLowerCase())||r?.families&&r.families.some(N=>String(N).toLowerCase()===w.toLowerCase()))continue;let S=b.weight!=null?String(b.weight):"normal",M=b.style!=null?String(b.style):"normal",C=b.stretchPct!=null?`${b.stretchPct}%`:"100%",E=String(b.src||""),$=E;if(!$.startsWith("data:")){if(k.resource?.has(E))$=k.resource.get(E),k.font?.add(E);else if(!k.font?.has(E))try{let N=await le(E,{as:"dataURL",useProxy:o,silent:!0});if(N.ok&&typeof N.data=="string")$=N.data,k.resource?.set(E,$),k.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:${M};font-weight:${S};font-stretch:${C};}`}return m&&(m=_a(m),k.resource?.set(c,m)),m}function Kn(e,t){let r=new Set,n=new Set;if(!e)return{required:r,usedCodepoints:n};let o=l=>{if(l)for(let d of l)n.add(d.codePointAt(0))},i=l=>{let d=Ea(l.fontFamily);if(d.length)for(let c of d)r.add(`${c}__${xt(l.fontWeight)}__${vt(l.fontStyle)}__${$a(l.fontStretch)}`)},a=l=>{i(B(l));for(let d of["::before","::after"]){let c=B(l,d),u=c&&c.content;if(!(!u||u==="none"||u==="normal"))if(i(c),/^["']/.test(u))o(u.slice(1,-1));else{let p=u.match(/\\[0-9A-Fa-f]{1,6}/g);if(p)for(let f of p)try{n.add(parseInt(f.slice(1),16))}catch{}}}};a(e);let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;s.nextNode();){let l=s.currentNode;if(l.nodeType===Node.TEXT_NODE){if(t&&l.parentElement&&!t(l.parentElement))continue;o(l.nodeValue||"")}else{if(t&&!t(l))continue;a(l)}}return{required:r,usedCodepoints:n}}function ja(e,t){return Kn(e,t).required}async function Jn(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 s=r.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${a}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",i.appendChild(s)}r.body.appendChild(i),i.offsetWidth,r.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)o(),await Me(),await Me()}function Ua(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function rn(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 nn(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 on(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 rn(e,!1);case"upper-alpha":return rn(e,!0);case"lower-roman":return nn(e,!1);case"upper-roman":return nn(e,!0);default:return String(e)}}function qa(e){let t=new WeakMap,r=e instanceof Document?e.documentElement:e,n=d=>d&&d.tagName==="LI",o=d=>{let c=0,u=d?.parentElement;if(!u)return 0;for(let p of u.children){if(p===d)break;p.tagName==="LI"&&c++}return c},i=d=>{let c=new Map;for(let[u,p]of d)c.set(u,p.slice());return c},a=(d,c,u)=>{let p=i(d),f;try{f=u.style?.counterReset||getComputedStyle(u).counterReset}catch{}if(f&&f!=="none")for(let g of f.split(",")){let y=g.trim().split(/\s+/),x=y[0],v=Number.isFinite(Number(y[1]))?Number(y[1]):0;if(!x)continue;let b=c.get(x);if(b&&b.length){let w=b.slice();w.push(v),p.set(x,w)}else p.set(x,[v])}let h;try{h=u.style?.counterSet||getComputedStyle(u).counterSet}catch{}if(h&&h!=="none")for(let g of h.split(",")){let y=g.trim().split(/\s+/),x=y[0],v=Number.isFinite(Number(y[1]))?Number(y[1]):0;if(!x)continue;let b=p.get(x)||[];b.length===0&&b.push(0),b[b.length-1]=v,p.set(x,b)}let m;try{m=u.style?.counterIncrement||getComputedStyle(u).counterIncrement}catch{}if(m&&m!=="none")for(let g of m.split(",")){let y=g.trim().split(/\s+/),x=y[0],v=Number.isFinite(Number(y[1]))?Number(y[1]):1;if(!x)continue;let b=p.get(x)||[];b.length===0&&b.push(0),b[b.length-1]+=v,p.set(x,b)}try{if(getComputedStyle(u).display==="list-item"&&n(u)){let g=u.parentElement,y=1;if(g&&g.tagName==="OL"){let v=g.getAttribute("start"),b=Number.isFinite(Number(v))?Number(v):1,w=o(u),S=u.getAttribute("value");y=Number.isFinite(Number(S))?Number(S):b+w}else y=1+o(u);let x=p.get("list-item")||[];x.length===0&&x.push(0),x[x.length-1]=y,p.set("list-item",x)}}catch{}return p},s=(d,c,u)=>{let p=a(u,c,d);t.set(d,p);let f=p;for(let m of d.children)f=s(m,p,f);let h=new Map;for(let[m,g]of u){let y=g.length,x=f.get(m);h.set(m,x&&x.length?x.slice(0,y):g.slice())}for(let[m,g]of f)!h.has(m)&&g.length&&!c.has(m)&&h.set(m,g.slice(0,1));return h},l=new Map;return s(r,l,l),{get(d,c){let u=t.get(d)?.get(c);return u&&u.length?u[u.length-1]:0},getStack(d,c){let u=t.get(d)?.get(c);return u?u.slice():[]}}}function za(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 s=String(a).split(",").map(l=>l.trim());if(i==="counter"){let l=s[0]?.replace(/^["']|["']$/g,""),d=(s[1]||"decimal").toLowerCase(),c=r.get(t,l);return on(c,d)}else{let l=s[0]?.replace(/^["']|["']$/g,""),d=s[1]?.replace(/^["']|["']$/g,"")??"",c=(s[2]||"decimal").toLowerCase(),u=r.getStack(t,l);return u.length?u.map(p=>on(p,c)).join(d):""}})}catch{return"- "}}$e();var Le=new WeakMap,an=1e3;function Va(e,t){let r=Zn(e);return t?(t.__pseudoPreflightFp!==r&&(t.__pseudoPreflight=ln(e,r),t.__pseudoPreflightFp=r),!!t.__pseudoPreflight):ln(e,r)}function Zt(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Zn(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 s=a.textContent?a.textContent.length:0;r+=`S${s}|`;let l=a.sheet,d=l?Zt(l):null;d&&(n+=d.length)}else{let s=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";r+=`L${s}|m:${l}|`;let d=a.sheet,c=d?Zt(d):null;c&&(n+=c.length)}}let o=e.adoptedStyleSheets;return r+=`ass:${Array.isArray(o)?o.length:0}|tr:${n}`,r}function sn(e,t,r){let n=Zt(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 s of t)if(a.includes(s))return!0;if(i&&i.cssRules&&i.cssRules.length)for(let s=0;s<i.cssRules.length&&r.budget>0;s++){let l=i.cssRules[s],d=l&&l.cssText?l.cssText:"";r.budget--;for(let c of t)if(d.includes(c))return!0}if(r.budget<=0)return!1}return!1}function ln(e=document,t=Zn(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 s=o[a].textContent||"";for(let l of n)if(s.includes(l))return Le.set(e,{fingerprint:t,result:!0}),!0}let i=e.adoptedStyleSheets;if(Array.isArray(i)&&i.length){let a={budget:an};try{for(let s of i)if(sn(s,n,a))return Le.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),s={budget:an};for(let l=0;l<a.length&&s.budget>0;l++){let d=a[l],c=null;if(d.tagName,c=d.sheet||null,c&&sn(c,n,s))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 cn(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 Xa(e,t){let r=null,n=()=>{if(!r)try{r=qa(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 Ya(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 Ga(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 er(e,t,r){let n=e.parentElement,o=n&&r?r.get(n):null;return o?{get(i,a){let s=t.get(i,a),l=o.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(i,a){let s=t.getStack(i,a);if(!s.length)return s;let l=o.get(a);if(typeof l=="number"){let d=s.slice();return d[d.length-1]=Math.max(d[d.length-1],l),d}return s}}:t}function tr(e,t,r){let n=new Map;function o(d){let c=[];if(!d||d==="none")return c;for(let u of String(d).split(",")){let p=u.trim().split(/\s+/),f=p[0],h=Number.isFinite(Number(p[1]))?Number(p[1]):void 0;f&&c.push({name:f,num:h})}return c}let i=o(t?.counterReset),a=o(t?.counterSet),s=o(t?.counterIncrement);function l(d){if(n.has(d))return n.get(d).slice();let c=r.getStack(e,d);c=c.length?c.slice():[];let u=i.find(h=>h.name===d);if(u){let h=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,h]:[h]}let p=a.find(h=>h.name===d);if(p){let h=Number.isFinite(p.num)?p.num:0;c.length===0&&(c=[0]),c[c.length-1]=h}let f=s.find(h=>h.name===d);if(f){let h=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=h}return n.set(d,c.slice()),c}return{get(d,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(d,c){return l(c)},__incs:s}}function Qa(e,t,r,n){let o;try{o=B(e,t)}catch{}let i=o?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};i=Ya(i);let a=er(e,r,n),s=tr(e,o,a),l=Ua(i)?za(i,e,s):i;return{text:Ga(l),incs:s.__incs||[]}}async function rr(e,t,r,n){if(e?.nodeType!==1||t?.nodeType!==1||e.tagName==="TEXTAREA")return;let o=e.ownerDocument||document;if(!Va(o,r))return;r.__siblingCounters||(r.__siblingCounters=new WeakMap),r.__counterCtx||(r.__counterCtx=Xa(e.ownerDocument||document,r));let i=r.__counterCtx;for(let s of["::before","::after","::first-letter"])try{let l=B(e,s);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&!cn(l)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let P=B(e),W=(P?.display||"").toLowerCase();if(W.includes("flex")||W.includes("grid"))continue;let D=ee=>l[ee]!==P[ee]&&(parseFloat(l[ee])||0)!==0;if(!(l.color!==P.color||l.fontSize!==P.fontSize||l.fontWeight!==P.fontWeight||l.fontFamily!==P.fontFamily||l.fontStyle!==P.fontStyle||l.textTransform!==P.textTransform||l.float!==P.float&&l.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=_r(l),he=qt(J,"span");r.styleMap.set(oe,he);let Ce=document.createTextNode(te);t.replaceChild(Ce,q),t.insertBefore(oe,Ce);continue}let d=l.content??"",c=d===""||d==="none"||d==="normal",{text:u,incs:p}=Qa(e,s,i,r.__siblingCounters),f=l.backgroundImage,h=l.backgroundColor,m=l.fontFamily,g=parseInt(l.fontSize)||32,y=parseInt(l.fontWeight)||!1,x=l.color||"#000",v=l.transform,b=be(m),w=!c&&u!=="",S=f&&f!=="none",M=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",C=cn(l),E=v&&v!=="none",$=d!=="none"&&d!=="normal",N=$&&((parseFloat(l.width)||0)>0||(parseFloat(l.height)||0)>0),L=$&&l.boxShadow&&l.boxShadow!=="none",_=$&&l.outlineStyle&&l.outlineStyle!=="none"&&(parseFloat(l.outlineWidth)||0)>0;if(!(w||S||M||C||E||N||L||_)){if(p&&p.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map;for(let{name:W}of p){if(!W)continue;let D=er(e,i,r.__siblingCounters),q=tr(e,B(e,s),D).get(e,W);P.set(W,q)}r.__siblingCounters.set(e.parentElement,P)}continue}let F=u.startsWith("url(")||/^-?(?:webkit-)?image-set\(/i.test(u),I=!1;if(w&&!b&&u.length>1&&!F){let P=B(e),W=parseFloat(P.fontSize)||16,D=parseFloat(P.lineHeight);Number.isFinite(D)||(D=W*1.5),e.getBoundingClientRect().height<D*1.6&&(t.style.whiteSpace="nowrap",I=!0)}let T=document.createElement("span");T.dataset.snapdomPseudo=s,T.style.pointerEvents="none",I&&(T.style.whiteSpace="nowrap");let O=_r(l),X=(B(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=qt(O,"span",w,U);if(r.styleMap.set(T,V),b&&u&&u.length===1){let{dataUrl:P,width:W,height:D}=await ka(u,m,y,g,x),q=document.createElement("img");q.src=P,q.style=`height:${g}px;width:${W/D*g}px;object-fit:contain;`,T.appendChild(q),t.dataset.snapdomHasIcon="true"}else if(u&&F){let P=gn(u,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??lr(u);if(P?.trim())try{let W=await le(Ct(P),{as:"dataURL",useProxy:n.useProxy});if(W?.ok&&typeof W.data=="string"){let D=document.createElement("img");D.src=W.data,D.style=`width:${g}px;height:auto;object-fit:contain;`,T.appendChild(D)}}catch(W){console.error(`[snapdom] Error in pseudo ${s} for`,e,W)}}else!b&&w&&(T.textContent=u);T.style.backgroundImage="none","maskImage"in T.style&&(T.style.maskImage="none"),"webkitMaskImage"in T.style&&(T.style.webkitMaskImage="none");try{T.style.backgroundRepeat=l.backgroundRepeat,T.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?(T.style.backgroundPositionX=l.backgroundPositionX,T.style.backgroundPositionY=l.backgroundPositionY):T.style.backgroundPosition=l.backgroundPosition,T.style.backgroundOrigin=l.backgroundOrigin,T.style.backgroundClip=l.backgroundClip,T.style.backgroundAttachment=l.backgroundAttachment,T.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(S)try{let P=zt(f),W=await Promise.all(P.map(yn));T.style.backgroundImage=W.join(", ")}catch(P){console.warn(`[snapdom] Failed to inline background-image for ${s}`,P)}M&&(T.style.backgroundColor=h);let K=T.childNodes.length>0||T.textContent?.trim()!==""||S||M||C||E||N||L||_;if(p&&p.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map,W=er(e,i,r.__siblingCounters),D=tr(e,B(e,s),W);for(let{name:q}of p){if(!q)continue;let ce=D.get(e,q);P.set(q,ce)}r.__siblingCounters.set(e.parentElement,P)}if(!K)continue;s==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(T,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(T))}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,e,l)}let a=Array.from(t.children).filter(s=>!s.dataset.snapdomPseudo);if(r.nodeMap)for(let s of a){let l=r.nodeMap.get(s);l?.nodeType===1&&await rr(l,s,r,n)}else{let s=Array.from(e.children);for(let l=0;l<Math.min(s.length,a.length);l++)await rr(s[l],a[l],r,n)}}function Ka(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"],s=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",d=b=>{if(!b||!b.getAttribute)return null;let w=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(l,"href"):null);if(w)return w;let S=b.attributes;if(!S)return null;for(let M=0;M<S.length;M++){let C=S[M];if(!C||!C.name)continue;if(C.name==="href")return C.value;let E=C.name.indexOf(":");if(E!==-1&&C.name.slice(E+1)==="href")return C.value}return null},c=new Set(Array.from(e.querySelectorAll("[id]")).map(b=>b.id)),u=new Set,p=!1,f=(b,w=null)=>{if(!b)return;i.lastIndex=0;let S;for(;S=i.exec(b);){p=!0;let M=(S[1]||"").trim();M&&(c.has(M)||(u.add(M),w&&!w.has(M)&&w.add(M)))}},h=b=>{let w=b.querySelectorAll("use");for(let C of w){let E=d(C);if(!E||!E.startsWith("#"))continue;p=!0;let $=E.slice(1).trim();$&&!c.has($)&&u.add($)}let S='*[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(b.getAttribute("style")||"");for(let C of a)f(b.getAttribute(C));let M=b.querySelectorAll(S);for(let C of M){f(C.getAttribute("style")||"");for(let E of a)f(C.getAttribute(E))}};for(let b of o)h(b);if(!p)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 g=m.querySelector("defs")||null,y=b=>{if(!b||c.has(b))return null;let w=s(b),S=M=>{let C=n.querySelector(M);return C&&!e.contains(C)?C:null};return S(`svg defs > *#${w}`)||S(`svg > symbol#${w}`)||S(`*#${w}`)};if(!u.size)return;let x=new Set(u),v=new Set;for(;x.size;){let b=x.values().next().value;if(x.delete(b),!b||c.has(b)||v.has(b))continue;let w=y(b);if(!w){v.add(b);continue}g||(g=r.createElementNS("http://www.w3.org/2000/svg","defs"),m.appendChild(g));let S=w.cloneNode(!0);S.id||S.setAttribute("id",b),g.appendChild(S),v.add(b),c.add(b);let M=[S,...S.querySelectorAll("*")];for(let C of M){let E=d(C);if(E&&E.startsWith("#")){let N=E.slice(1).trim();N&&!c.has(N)&&!v.has(N)&&x.add(N)}let $=C.getAttribute?.("style")||"";$&&f($,x);for(let N of a){let L=C.getAttribute?.(N);L&&f(L,x)}}}}ne();function Ja(e){let t=getComputedStyle(e),r=t.outlineStyle,n=t.outlineWidth,o=t.borderStyle,i=t.borderWidth,a=r!=="none"&&parseFloat(n)>0,s=o==="none"||parseFloat(i)===0;if(a&&s){let l=e.style.border;return e.style.border=`${n} solid transparent`,()=>{e.style.border=l}}return()=>{}}function Za(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{}}}de();Rt();function es(e){return eo(e.boxShadow)}function ts(e){return eo(e.textShadow)}function eo(e){if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let t=[],r="",n=0;for(let l=0;l<e.length;l++){let d=e[l];d==="("?n++:d===")"&&(n=Math.max(0,n-1)),d===","&&n===0?(t.push(r),r=""):r+=d}r.trim()&&t.push(r);let o=0,i=0,a=0,s=0;for(let l of t){if(/\binset\b/i.test(l))continue;let d=l.match(/-?\d+(\.\d+)?px/g)?.map(g=>parseFloat(g))||[];if(d.length<2)continue;let[c,u,p=0,f=0]=d,h=Math.abs(c)+p+f,m=Math.abs(u)+p+f;i=Math.max(i,h+Math.max(c,0)),s=Math.max(s,h+Math.max(-c,0)),a=Math.max(a,m+Math.max(u,0)),o=Math.max(o,m+Math.max(-u,0))}return{top:Math.ceil(o),right:Math.ceil(i),bottom:Math.ceil(a),left:Math.ceil(s)}}function rs(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 ns(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 os(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,s=!1;for(let l of r){s=!0;let d=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(m=>parseFloat(m))||[],[c=0,u=0,p=0]=d,f=Math.abs(c)+p,h=Math.abs(u)+p;o=Math.max(o,f+Math.max(c,0)),a=Math.max(a,f+Math.max(-c,0)),i=Math.max(i,h+Math.max(u,0)),n=Math.max(n,h+Math.max(-u,0))}return{bleed:{top:A(n),right:A(o),bottom:A(i),left:A(a)},has:s}}function is(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 s=null;try{s=At(e).scale}catch{}try{t.style.transform="none"}catch{}if(!s)return{a:1,b:0,c:0,d:1};let l=s.trim().split(/\s+/).map(parseFloat),d=Number.isFinite(l[0])?l[0]:1,c=Number.isFinite(l[1])?l[1]:d;return{a:d,b:0,c:0,d:c}}function o(s,l,d,c){let u=Math.sqrt(s*s+l*l)||0,p=0,f=0;if(u>0){let h=s/u,m=l/u;p=h*d+m*c;let g=d-h*p,y=c-m*p;f=Math.sqrt(g*g+y*y)||0,f>0?p=p/f:p=0}return{a:u,b:0,c:p*f,d:f}}let i=n.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let s=i[1].split(",").map(l=>parseFloat(l.trim()));if(s.length===6&&s.every(Number.isFinite)){let[l,d,c,u]=s,p=o(l,d,c,u);try{t.style.transform=`matrix(${p.a}, ${p.b}, ${p.c}, ${p.d}, 0, 0)`}catch{}return p}}let a=n.match(/^matrix3d\(\s*([^)]+)\)$/i);if(a){let s=a[1].split(",").map(l=>parseFloat(l.trim()));if(s.length===16&&s.every(Number.isFinite)){let l=s[0],d=s[1],c=s[4],u=s[5],p=o(l,d,c,u);try{t.style.transform=`matrix(${p.a}, ${p.b}, ${p.c}, ${p.d}, 0, 0)`}catch{}return p}}try{let s=new DOMMatrix(n),l=o(s.a,s.b,s.c,s.d);try{t.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, 0, 0)`}catch{}return l}catch{return null}}function St(e,t,r,n,o){let i=r.a,a=r.b,s=r.c,l=r.d,d=r.e||0,c=r.f||0;function u(y,x){let v=y-n,b=x-o,w=i*v+s*b,S=a*v+l*b;return w+=n+d,S+=o+c,[w,S]}let p=[u(0,0),u(e,0),u(0,t),u(e,t)],f=1/0,h=1/0,m=-1/0,g=-1/0;for(let[y,x]of p)y<f&&(f=y),x<h&&(h=x),y>m&&(m=y),x>g&&(g=x);return{minX:f,minY:h,maxX:m,maxY:g,width:m-f,height:g-h}}function nr(e,t,r){let n=(e.transformOrigin||"0 0").trim().split(/\s+/),[o,i]=[n[0]||"0",n[1]||"0"],a=(s,l)=>{let d=s.toLowerCase();return d==="left"||d==="top"?0:d==="center"?l/2:d==="right"||d==="bottom"?l:d.endsWith("px")?parseFloat(d)||0:d.endsWith("%")?(parseFloat(d)||0)*l/100:/^-?\d+(\.\d+)?$/.test(d)&&parseFloat(d)||0};return{ox:a(o,t),oy:a(i,r)}}function At(e){let t={rotate:"0deg",scale:null,translate:null},r=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(r){let o=l=>{try{return typeof r.has=="function"&&!r.has(l)||typeof r.get!="function"?null:r.get(l)}catch{return null}},i=o("rotate");if(i)if(i.angle){let l=i.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.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 l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=o("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,d="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${d}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let s=o("translate");if(s){let l="x"in s&&"value"in s.x?s.x.value:Array.isArray(s)?s[0]?.value:0,d="y"in s&&"value"in s.y?s.y.value:Array.isArray(s)?s[1]?.value:0,c="x"in s&&s.x?.unit?s.x.unit:"px",u="y"in s&&s.y?.unit?s.y.unit:"px";t.translate=`${l}${c} ${d}${u}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.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 Bt=null;function as(){if(Bt)return Bt;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),Bt=e,e}function ss(e){let t=as(),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=cs(r);return t.removeChild(r),n}function ls(e){let t=B(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 cs(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}var or="http://www.w3.org/1999/xhtml",to=new WeakSet;function ro(e,t){if(!t)return null;let r=e.ownerDocument||document,n=r.defaultView||window,o,i,a,s;if(t==="viewport")o=0,i=0,a=r.documentElement?.clientWidth||n.innerWidth,s=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),s=Number(t.height);else return null;return a>0&&s>0?{left:o,top:i,width:a,height:s,right:o+a,bottom:i+s}:null}function ir(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode&&e.getRootNode();return t instanceof ShadowRoot?t.host:null}function ds(e,t){for(let r=t;r;r=ir(r))if(r===e)return!0;return!1}function us(e,t){for(let r=ir(e);r&&r!==t&&r?.nodeType===1;r=ir(r)){let n=B(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 no(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 ps(e,t,r,n,o){let i=e.getBoundingClientRect();t?.nodeType===1&&t.namespaceURI===or&&B(e).position==="static"&&(t.style.position="relative");let a=[];for(let[s,l]of r){if(s?.nodeType!==1||s.namespaceURI!==or||l?.nodeType!==1||l===e||!ds(e,l))continue;let d=n.get(l)||B(l),c=d.position;if(c!=="fixed"&&c!=="sticky"&&c!=="-webkit-sticky"||s.style.position==="absolute")continue;let u=l.getBoundingClientRect();if(!(u.width>0&&u.height>0))continue;to.add(s);let p=d.transform&&d.transform!=="none"?d.transform:"",f=At(l),h=!!(p||f.rotate!=="0deg"||f.scale||f.translate),m=h?no(p,f):null,g=!m||!m.is2D||m.a===1&&m.b===0&&m.c===0&&m.d===1,y=u.width,x=u.height;g||(y=l.offsetWidth||u.width,x=l.offsetHeight||u.height);let v=l.getRootNode&&l.getRootNode()instanceof ShadowRoot,b=i,w=e.clientLeft||0,S=e.clientTop||0;if(v){let N=us(l,e);N&&(b=N.getBoundingClientRect(),w=N.clientLeft||0,S=N.clientTop||0)}let M=u.left-b.left-w,C=u.top-b.top-S;if(h)if(s.style.translate="none",s.style.rotate="none",s.style.scale="none",g)s.style.transform="none";else{s.style.transform=`matrix(${m.a},${m.b},${m.c},${m.d},0,0)`;let{ox:N,oy:L}=nr(d,y,x),_=St(y,x,{a:m.a,b:m.b,c:m.c,d:m.d,e:0,f:0},N,L);M-=_.minX,C-=_.minY}if(c!=="fixed"){let N=s.cloneNode(!1);N.setAttribute("data-snap-ph","1"),N.style.position="static",N.style.visibility="hidden",N.style.width=`${y}px`,N.style.height=`${x}px`,N.style.boxSizing="border-box",s.parentElement?.insertBefore(N,s)}let E=y+2,$=x;o&&(Math.abs(C-o.y)<.5&&(C-=1,$+=1),Math.abs(M-o.x)<.5&&(M-=1,E+=1)),s.style.position="absolute",s.style.left=`${M}px`,s.style.top=`${C}px`,s.style.right="auto",s.style.bottom="auto",s.style.margin="0",s.style.width=`${E}px`,s.style.height=`${$}px`,s.style.boxSizing="border-box",v||a.push(s)}for(let s of a)t.appendChild(s)}function fs(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 hs(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 dn(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 ms(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 gs(e,t,r){if(!e||!t||!t.style)return;let n=getComputedStyle(e);if(!dn(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,s=t;for(;a&&s;){let l=ms(a,o);if(!l)break;let d=r?Array.from(s.children).find(p=>r.get(p)===l)||null:s.children[Array.from(a.children).indexOf(l)]||null,c=getComputedStyle(l),u=parseFloat(c[`margin${i}`])||0;if(d&&d.style&&u>0&&(d.style[`margin${i}`]="0px"),dn(c)||(parseFloat(c[`border${i}Width`])||0)>0||(parseFloat(c[`padding${i}`])||0)>0)break;a=l,s=d}}}function bs(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 ys(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 s=a.name;if(s.startsWith("*")){i.removeAttribute(s);continue}if(s.includes("@")){i.removeAttribute(s);continue}if(s.includes(":")){let l=s.split(":",1)[0];if(!n.has(l)){i.removeAttribute(s);continue}}if(r&&(s.startsWith("x-")||s.startsWith("v-")||s.startsWith(":")||s.startsWith("on:")||s.startsWith("bind:")||s.startsWith("let:")||s.startsWith("class:"))){i.removeAttribute(s);continue}}}}var un=/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;function ws(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(un,"");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(un,"");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 xs(e,t={}){e&&(ys(e,t),bs(e),ws(e))}function vs(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function Ss(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Cs(e,t){if(e?.nodeType!==1||vs(e)||Ss(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 ks(e,t,r=new Map){function n(o,i){if(o?.nodeType!==1||i?.nodeType!==1)return;let a=o.childElementCount>i.childElementCount,s=r.get(o)||getComputedStyle(o);if(r.has(o)||r.set(o,s),a&&Cs(o,s)){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 c=s.overflowY||s.overflowBlock||"visible",u=s.overflowX||s.overflowInline||"visible";(c!=="visible"||u!=="visible")&&(i.style.overflow="visible")}let l=Array.from(o.children),d=Array.from(i.children);for(let c=0;c<Math.min(l.length,d.length);c++)n(l[c],d[c])}n(e,t)}function Ms(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function Es(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 $s(e,t){let r=getComputedStyle(e),n=e.getBoundingClientRect(),o=1/0,i=-1/0,a=!1,s=Array.from(e.children);for(let f of s){if(Es(f,t)||!Ms(f))continue;let h=f.getBoundingClientRect(),m=h.top-n.top,g=h.bottom-n.top;g<=m||(m<o&&(o=m),g>i&&(i=g),a=!0)}let l=a?Math.max(0,i-o):0,d=parseFloat(r.borderTopWidth)||0,c=parseFloat(r.borderBottomWidth)||0,u=parseFloat(r.paddingTop)||0,p=parseFloat(r.paddingBottom)||0;return d+c+u+p+l}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,Fe=.75;function As(e,t,r,n,o,i){let a=e.ownerDocument||document,s=e.getBoundingClientRect(),l=o>0&&s.width>0?s.width/o:1,d=i>0&&s.height>0?s.height/i:1;if(Math.abs(l-d)>.02)return 0;let c=a.createElement("div");c.setAttribute("data-snapdom-internal",""),c.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+o+"px!important;overflow:visible!important;visibility:hidden!important;";let u=c.attachShadow({mode:"open"}),p=a.createElement("style");p.textContent=r,u.appendChild(p);let f=t.cloneNode(!0);u.appendChild(f),a.body.appendChild(c);let h=0,m=(g,y,x)=>{let v=B(g),b=v.boxSizing==="border-box",w=(S,M,...C)=>{let E=parseFloat(S);if(!Number.isFinite(E))return M;let $=E+(b?0:C.reduce((N,L)=>N+(parseFloat(L)||0),0));return Math.abs($-M)<=.51?$:M};return{width:w(v.width,y,v.paddingLeft,v.paddingRight,v.borderLeftWidth,v.borderRightWidth),height:w(v.height,x,v.paddingTop,v.paddingBottom,v.borderTopWidth,v.borderBottomWidth)}};try{let g=f.getBoundingClientRect(),y=f.offsetWidth||o,x=f.offsetHeight||i,v=y>0&&g.width>0?g.width/y:1,b=x>0&&g.height>0?g.height/x:1,w=(S,M,C=!1)=>{let E=S.children,$=M.children,N=Math.min(E.length,$.length);for(let L=0;L<N;L++){let _=E[L],F=$[L],I=n.get(_),T=C||to.has(_);if(I?.nodeType===1&&_?.namespaceURI===or&&_.style&&I.isConnected){let O=I.getBoundingClientRect();if(O.width>0&&O.height>0){let X=F.getBoundingClientRect(),U=O.width/l,V=O.height/d,K=X.width,P=X.height,W=I.offsetWidth||U,D=I.offsetHeight||V,q=F.offsetWidth||K,ce=F.offsetHeight||P,Q=Math.abs(U-W)>Fe||Math.abs(V-D)>Fe||Math.abs(K-q)>Fe||Math.abs(P-ce)>Fe;if(T){let J=m(F,q,ce);U=K>0?U*v*J.width/K:U,V=P>0?V*b*J.height/P:V,K=J.width,P=J.height}else if(Q){let J=m(I,W,D),he=m(F,q,ce);U=J.width,V=J.height,K=he.width,P=he.height}let te=K-U,oe=P-V;(Math.abs(te)>Fe||Math.abs(oe)>Fe)&&(_.style.boxSizing="border-box",_.style.width=`${A(U)}px`,_.style.height=`${A(V)}px`,h++)}}w(_,F,T)}};w(t,f)}finally{c.remove()}return h}var Ns=/::-webkit-scrollbar(-[a-z]+)?\b/i;function ar(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+=ar(o.styleSheet.cssRules,t);continue}if(o.type===CSSRule.MEDIA_RULE&&o.cssRules){let i=ar(o.cssRules,t);i&&(r+=`@media ${o.conditionText}{${i}}`);continue}if(o.type===CSSRule.STYLE_RULE){let i=o.selectorText||"";if(Ns.test(i)){let a=o.cssText;a&&!t.has(a)&&(t.add(a),r+=a)}}}catch{}}return r}var pn=new WeakMap;function Rs(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 Ts(e){if(!e||!e.styleSheets)return"";let t=Rs(e),r=pn.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+=ar(a,n))}catch{}return pn.set(e,{fp:t,css:o}),o}Ae();var ut=new Set;async function Ls(e,t={}){let r=t.__session||k.session,n={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:t},o=null;if(t.clip){let u=ro(e,t.clip);if(u){n.clip={rect:u,root:e};let p=e.getBoundingClientRect();o={x:u.left-p.left,y:u.top-p.top,width:u.width,height:u.height}}}let i,a="",s="";if(ut.size){let u=(p,f)=>{for(let h=f;h;h=h.assignedSlot||h.parentElement||h.getRootNode()?.host)if(h===p)return!0;return!1};for(;;){let p=[...ut].filter(({root:f})=>u(f,e)||u(e,f)).map(({promise:f})=>f.catch(()=>{}));if(!p.length)break;await Promise.all(p)}}if(!n.clip&&e.isConnected&&e.ownerDocument?.visibilityState!=="hidden")try{let u=e.getBoundingClientRect(),p=e.ownerDocument?.defaultView||window,f=u.right<=0||u.bottom<=0||u.left>=p.innerWidth||u.top>=p.innerHeight,h=[];if(f&&(()=>{let m=[];e.shadowRoot&&m.push(e.shadowRoot);for(let g of e.querySelectorAll("*"))g.shadowRoot&&m.push(g.shadowRoot);for(;m.length;){let g=m.pop(),y=g.host?.localName==="calcite-icon";for(let x of g.querySelectorAll("*")){if(x.shadowRoot&&m.push(x.shadowRoot),!y||x.localName!=="svg")continue;let v=x.querySelectorAll("path");if(!v.length||[...v].some(w=>w.getAttribute("d")?.trim()))continue;let b=x.getBoundingClientRect();b.width&&b.height&&h.push(x)}}})(),h.length){let m=(async()=>{let y=e.style,x=e.hasAttribute("style"),v=new Map,b=(w,S)=>{v.has(w)||v.set(w,{value:y.getPropertyValue(w),priority:y.getPropertyPriority(w)}),y.setProperty(w,S,"important");let M=v.get(w);M.forcedValue=y.getPropertyValue(w),M.forcedPriority=y.getPropertyPriority(w)};try{b("left","0"),b("top","0"),b("right","auto"),b("bottom","auto"),b("margin-top","0"),b("margin-right","0"),b("margin-bottom","0"),b("margin-left","0"),b("transform","none"),b("translate","none"),b("opacity","0"),b("pointer-events","none");let w=e.getBoundingClientRect();if(w.right<=0||w.bottom<=0||w.left>=p.innerWidth||w.top>=p.innerHeight){let C=e.parentElement?.getBoundingClientRect(),E=C&&C.right>0&&C.left<p.innerWidth?Math.max(0,C.left):0,$=C&&C.bottom>0&&C.top<p.innerHeight?Math.max(0,C.top):0;b("position","fixed"),b("left",`${E}px`),b("top",`${$}px`)}await Me(100);let S=Date.now()+1500,M=()=>h.some(C=>{if([...C.querySelectorAll("path")].some($=>$.getAttribute("d")?.trim()))return!1;let E=C.getBoundingClientRect();return E.width&&E.height&&E.right>0&&E.bottom>0&&E.left<p.innerWidth&&E.top<p.innerHeight});for(;Date.now()<S&&M();)await new Promise(C=>setTimeout(C,25));await Me(100)}finally{for(let[w,S]of v)y.getPropertyValue(w)!==S.forcedValue||y.getPropertyPriority(w)!==S.forcedPriority||(S.value?y.setProperty(w,S.value,S.priority):y.removeProperty(w));!x&&!y.length&&e.removeAttribute("style"),await Me(100)}})(),g={root:e,promise:m};ut.add(g);try{await m}finally{ut.delete(g)}}}catch{}let l=Ja(e),d=n.clip?()=>{}:Za(e);try{i=await wt(e,n,t)}catch(u){throw console.warn("deepClone failed:",u),u}finally{d(),l()}try{Ka(i)}catch(u){console.warn("inlineExternal defs or symbol failed:",u)}try{await rr(e,i,n,t)}catch(u){console.warn("inlinePseudoElements failed:",u)}await ia(i,n);try{let u=i.querySelectorAll("style[data-sd]");for(let p of u)s+=p.textContent||"",p.remove()}catch(u){j(n,"Failed to extract shadow CSS from style[data-sd]",u)}let c=Ko(n.styleMap);a=Array.from(c.entries()).map(([u,p])=>`.${p}{${u}}`).join(""),a=s+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+a;for(let[u,p]of n.styleMap.entries()){if(u.tagName==="STYLE")continue;if(u.getRootNode&&u.getRootNode()instanceof ShadowRoot){u.setAttribute("style",p.replace(/;/g,"; "));continue}let f=c.get(p);f&&u.classList.add(f);let h=u.style?.backgroundImage,m=u.dataset?.snapdomHasIcon;h&&h!=="none"&&(u.style.backgroundImage=h),m&&(u.style.verticalAlign="middle",u.style.display="inline")}if((n.clip||e.scrollTop||e.scrollLeft)&&i?.nodeType===1)try{let u=n.clip&&o?{x:o.x,y:o.y}:{x:0,y:0};ps(e,i,n.nodeMap,n.styleCache,u)}catch(u){j(n,"freezeViewportPositioned failed",u)}for(let[u,p]of n.nodeMap.entries()){if(n.clip&&p===e)continue;let f=p.scrollLeft,h=p.scrollTop;if((f||h)&&u?.nodeType===1&&u.namespaceURI==="http://www.w3.org/1999/xhtml"){u.style.overflow="hidden",u.style.scrollbarWidth="none",u.style.msOverflowStyle="none";try{let g=u.querySelectorAll("*");for(let y of g){if(y.nodeType!==1||y.namespaceURI!=="http://www.w3.org/1999/xhtml")continue;let x=y.style.position;if(x==="fixed"||x==="absolute"){let v=parseFloat(y.style.top)||0,b=parseFloat(y.style.left)||0;y.style.top=`${v+h}px`,y.style.left=`${b+f}px`,x==="fixed"&&(y.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.all="unset",m.style.transform=`translate(${-f}px, ${-h}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";u.firstChild;)m.appendChild(u.firstChild);u.appendChild(m)}}if(e===n.nodeMap.get(i)){let u=n.styleCache.get(e)||B(e);n.styleCache.set(e,u);let p=Ho(u.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=p||""}for(let[u,p]of n.nodeMap.entries())p.tagName==="PRE"&&(u.style.marginTop="0",u.style.marginBlockStart="0");return{clone:i,classCSS:a,styleCache:n.styleCache,nodeMap:n.nodeMap,reconcileRisk:n.reconcileRisk||0,clipWindow:o}}$e();ne();var oo="http://www.w3.org/1999/xlink";function Fs(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(oo,"href"):null)}function Ps(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,s=t||i||n||e.width||e.naturalWidth||100,l=r||a||o||e.height||e.naturalHeight||100;return{width:s,height:l}}async function Is(e,t={}){let r=Array.from(e.querySelectorAll("img"));e.tagName==="IMG"&&r.unshift(e);let n=async s=>{if(!s.getAttribute("src")){let h=s.currentSrc||s.src||Et(s.getAttribute("srcset"),s)||"";h&&s.setAttribute("src",h)}s.removeAttribute("srcset"),s.removeAttribute("sizes");let l=s.src||"";if(!l)return;let d=k.image?.get(l);if(d){s.src=d,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let c=await le(l,{as:"dataURL",useProxy:t.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){k.image?.set(l,c.data),s.src=c.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:u,height:p}=Ps(s),{fallbackURL:f}=t||{};if(f)try{let h=typeof f=="function"?await f({width:u,height:p,src:l,element:s}):f;if(h){let m=await le(h,{as:"dataURL",useProxy:t.useProxy});if(m?.ok&&typeof m.data=="string"){s.src=m.data,s.width||(s.width=u),s.height||(s.height=p);return}}}catch{}if(t.placeholders!==!1){let h=document.createElement("div");h.style.cssText=[`width:${u}px`,`height:${p}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${p}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),h.textContent="img",s.replaceWith(h)}else{let h=document.createElement("div");h.style.cssText=`display:inline-block;width:${u}px;height:${p}px;visibility:hidden;`,s.replaceWith(h)}},o=6;for(let s=0;s<r.length;s+=o){let l=r.slice(s,s+o).map(n);await Promise.allSettled(l)}let i=Array.from(e.querySelectorAll("image"));e.localName==="image"&&i.unshift(e);let a=async s=>{let l=Fs(s);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let d=await le(l,{as:"dataURL",useProxy:t.useProxy});d.ok&&typeof d.data=="string"&&d.data.startsWith("data:")&&(s.setAttribute("href",d.data),s.removeAttribute("xlink:href"),typeof s.removeAttributeNS=="function"&&s.removeAttributeNS(oo,"href"))};for(let s=0;s<i.length;s+=o){let l=i.slice(s,s+o).map(a);await Promise.allSettled(l)}}de();ne();var Os=["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"],_s=["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"],Ds=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],Hs=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];async function Ws(e,t,r,n){let o=r.get(e)||B(e);r.has(e)||r.set(e,o);let i=o.getPropertyValue("border-image"),a=o.getPropertyValue("border-image-source"),s=i&&i!=="none"||a&&a!=="none",l=o.getPropertyValue("background-image"),d=o.getPropertyValue("background-color");if(l&&l!=="none"||d&&d!=="rgba(0, 0, 0, 0)"&&d!=="transparent"||/url\s*\(|gradient\s*\(/i.test(o.getPropertyValue("background")||""))for(let c of Ds){let u=o.getPropertyValue(c);u&&t.style.setProperty(c,u)}for(let c of Os){let u=o.getPropertyValue(c);if(c==="background-image"&&(!u||u==="none")){let h=o.getPropertyValue("background");h&&/url\s*\(/.test(h)&&(u=zt(h).filter(m=>/url\s*\(/.test(m)).join(", ")||u)}if(!u||u==="none")continue;let p=zt(u),f=await Promise.all(p.map(h=>yn(h,n)));f.some(h=>h&&h!=="none"&&!/^url\(undefined/.test(h))&&t.style.setProperty(c,f.join(", "))}for(let c of _s){let u=o.getPropertyValue(c);!u||u==="initial"||t.style.setProperty(c,u)}if(s)for(let c of Hs){let u=o.getPropertyValue(c);!u||u==="initial"||t.style.setProperty(c,u)}}async function Bs(e,t,r,n={},o=k.session.nodeMap){if(!t)return;let i=[];e&&Ur(e)&&i.push([e,t]);let a=[t];for(;a.length;){let l=a.pop();if(l.children)for(let d of l.children){if(d.tagName==="STYLE")continue;let c=o.get(d);c&&Ur(c)&&i.push([c,d]),a.push(d)}}let s=6;for(let l=0;l<i.length;l+=s)await Promise.allSettled(i.slice(l,l+s).map(([d,c])=>Ws(d,c,r,n)))}ne();de();function js(e,t,r=k.session.nodeMap){let n=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let s=o.currentNode;s;s=o.nextNode()){let l=r.get(s);if(l?.nodeType!==1)continue;let d=B(l),c=d.getPropertyValue("backdrop-filter")||d.getPropertyValue("-webkit-backdrop-filter");c&&c!=="none"&&s!==t&&n.push({cloneEl:s,orig:l,bf:c,path:zs(t,s)})}if(!n.length)return;let i=e.getBoundingClientRect(),a=n.map((s,l)=>{let d=t.cloneNode(!0);qs(d,t,s.orig.getBoundingClientRect(),r),Vs(fn(d,s.path));for(let c=0;c<l;c++){let u=fn(d,n[c].path);u&&(u.style.setProperty("backdrop-filter","none","important"),u.style.setProperty("-webkit-backdrop-filter","none","important"))}return{...s,copy:d}});for(let{cloneEl:s,orig:l,bf:d,copy:c}of a)Us(s,l,d,c,i)}function Us(e,t,r,n,o){let i=t.getBoundingClientRect();if(!i.width||!i.height)return;let a=B(t),s=t.offsetWidth?i.width/t.offsetWidth:1,l=Math.abs(s-1)>.001?1/s:1;n.style.position="absolute",n.style.left=`${(o.left-i.left)*l}px`,n.style.top=`${(o.top-i.top)*l}px`,n.style.width=`${o.width}px`,n.style.height=`${o.height}px`,n.style.margin="0",n.style.filter=r,l!==1&&(n.style.transform=`scale(${l})`,n.style.transformOrigin="top left");let d=document.createElement("div");d.style.cssText="position:absolute;inset:0;overflow:hidden;border-radius:inherit;z-index:-2",d.appendChild(n);let c=document.createElement("div");c.style.cssText="position:absolute;inset:0;border-radius:inherit;z-index:-1",c.style.backgroundColor=a.backgroundColor,c.style.backgroundImage=e.style.backgroundImage||a.backgroundImage;for(let u of["background-size","background-position","background-repeat","background-origin","background-clip"])c.style.setProperty(u,a.getPropertyValue(u));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(c),e.prepend(d)}var pt=128;function qs(e,t,r,n){let o=[[e,t]];for(;o.length;){let[i,a]=o.pop(),s=n.get(a);if(s?.nodeType===1){let c=s.getBoundingClientRect();(c.left>r.right+pt||c.right<r.left-pt||c.top>r.bottom+pt||c.bottom<r.top-pt)&&(i.tagName==="IMG"&&i.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="),i.style&&(i.style.backgroundImage="none"))}let l=i.children,d=a.children;for(let c=0;c<l.length;c++)o.push([l[c],d[c]])}}function zs(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 fn(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 Vs(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}}de();ne();function Xs(e,t){if(!e)return()=>{};let r=[],n=200;function o(i){if(t){let d=i.getBoundingClientRect();if(d.width>0||d.height>0){let c=Math.max(d.right,d.left+(i.scrollWidth||0)),u=Math.max(d.bottom,d.top+(i.scrollHeight||0));if(c<t.left-n||d.left>t.right+n||u<t.top-n||d.top>t.bottom+n)return}}let a=getComputedStyle(i),s=Ys(i,a);s&&r.push(s);let l=Gs(i,a);l&&r.push(l);for(let d of i.children||[])o(d)}return o(e),()=>r.forEach(i=>i())}function Ys(e,t){if(!e)return()=>{};t=t||getComputedStyle(e);let r=Qs(t);if(r<=0)return()=>{};if(!ao(e))return()=>{};let n=io(e),o=n.text,i=Js(t);n.write("X");let a=e.scrollHeight-i;n.restore();let s=a>0?a:Ks(t),l=Math.round(s*r+i);if(e.scrollHeight<=l+.5)return()=>{};let d=0,c=o.length,u=-1;for(;d<=c;){let p=d+c>>1;n.write(o.slice(0,p)+"\u2026"),e.scrollHeight<=l+.5?(u=p,d=p+1):c=p-1}return n.write((u>=0?o.slice(0,u):"")+"\u2026"),()=>{n.restore()}}function Gs(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(!ao(e))return()=>{};if(e.scrollWidth<=e.clientWidth+.5)return()=>{};let r=io(e),n=r.text,o=0,i=n.length,a=-1;for(;o<=i;){let s=o+i>>1;r.write(n.slice(0,s)+"\u2026"),e.scrollWidth<=e.clientWidth+.5?(a=s,o=s+1):i=s-1}return r.write((a>=0?n.slice(0,a):"")+"\u2026"),()=>{r.restore()}}function io(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 Qs(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 Ks(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 Js(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ao(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var je=[];function Ft(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 Zs(...e){let t=e.flat();for(let r of t){let n=Ft(r);n&&(je.some(o=>o&&o.name&&n.name&&o.name===n.name)||je.push(n))}}function so(e){return e&&Array.isArray(e.plugins)?e.plugins:je}async function Se(e,t,r){let n=r,o=so(t);for(let i of o){let a=i&&typeof i[e]=="function"?i[e]:null;if(!a)continue;let s=await a(t,n);typeof s<"u"&&(n=s)}return n}async function el(e,t,r){let n=[],o=so(t);for(let i of o){let a=i&&typeof i[e]=="function"?i[e]:null;if(!a)continue;let s=await a(t,r);typeof s<"u"&&n.push(s)}return n}function tl(e){let t=[];if(Array.isArray(e))for(let r of e){let n=Ft(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 je)r&&r.name&&!t.some(n=>n.name===r.name)&&t.push(r);return Object.freeze(t)}function rl(e,t,r=!1){return!e||e.plugins&&!r||(e.plugins=tl(t)),e}function lo(){return je.slice()}ne();var nl=.92,ol=.95;async function il(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 al(e){let t=/^data:([^;,]+)/.exec(e);return t?t[1]:""}async function br(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(k.compress.has(n))return k.compress.get(n);let o=await(async()=>{let i;try{i=await il(e)}catch{return null}let a=i.naturalWidth||i.width,s=i.naturalHeight||i.height;if(!a||!s)return null;let l=Math.min(1,Math.max(t/a,r/s));if(!(l>0)||l>=.95)return null;let d=l*ol,c=Math.max(1,Math.round(a*d)),u=Math.max(1,Math.round(s*d)),p=document.createElement("canvas");p.width=c,p.height=u;let f=p.getContext("2d");if(!f)return null;f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(i,0,0,c,u);let h=al(e),m=h==="image/jpeg"?"image/jpeg":h==="image/webp"?"image/webp":"image/png";try{let g=p.toDataURL(m,nl);if(typeof g=="string"&&g.startsWith("data:image")&&g.length<e.length)return g}catch{}return null})();return k.compress.set(n,o),o}async function sl(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,s=async d=>{let c=d.getAttribute("src")||"";if(!c.startsWith("data:image")||c.startsWith("data:image/svg"))return;let u=parseFloat(d.dataset.snapdomWidth)||parseFloat(d.style.width)||d.width||0,p=parseFloat(d.dataset.snapdomHeight)||parseFloat(d.style.height)||d.height||0;if(!u||!p)return;let f=await br(c,u*r,p*r);f&&(o++,i+=c.length,a+=f.length,d.setAttribute("src",f))},l=6;for(let d=0;d<n.length;d+=l)await Promise.allSettled(n.slice(d,d+l).map(s));return{count:o,before:i,after:a}}function ll(e){let t=e.offsetWidth||e.getBoundingClientRect().width||0,r=e.offsetHeight||e.getBoundingClientRect().height||0;return{w:t,h:r}}async function cl(e,t,r=k.session.nodeMap){if(!t.compress)return{count:0};let n=(t.scale||1)*(t.dpr||1),o=[],i=[e,...e.querySelectorAll("*")];for(let d of i){let c=d.style&&d.style.backgroundImage;c&&c.includes("data:image")&&o.push(d)}let a=0,s=async d=>{let c=r.get(d);if(!c||!c.isConnected)return;let u;try{u=getComputedStyle(c)}catch{return}if((u.backgroundRepeat||"repeat").toLowerCase().split(",").some(v=>v.trim()!=="no-repeat"))return;let{w:p,h:f}=ll(c);if(!p||!f)return;let h=p*n,m=f*n,g=d.style.backgroundImage,y=[...g.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],x=g;for(let v of y){let b=v[2];if(b.startsWith("data:image/svg"))continue;let w=await br(b,h,m);w&&(x=x.split(b).join(w),a++)}x!==g&&(d.style.backgroundImage=x)},l=6;for(let d=0;d<o.length;d+=l)await Promise.allSettled(o.slice(d,d+l).map(s));return{count:a}}async function dl(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 s=>{let l=s.getAttribute("href")||(typeof s.getAttributeNS=="function"?s.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!l||!l.startsWith("data:image")||l.startsWith("data:image/svg"))return;let d=parseFloat(s.getAttribute("width"))||0,c=parseFloat(s.getAttribute("height"))||0;if(!d||!c)return;let u=await br(l,d*r,c*r);u&&(s.setAttribute("href",u),s.hasAttribute("xlink:href")&&s.setAttribute("xlink:href",u),o++)},a=6;for(let s=0;s<n.length;s+=a)await Promise.allSettled(n.slice(s,s+a).map(i));return{count:o}}async function ul(e,t,r){t.compress&&(await sl(e,t),await cl(e,t,r),await dl(e,t))}function pl(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(Ft(t)?.name==="picture-resolver")return!0}return lo().some(t=>t?.name==="picture-resolver")}function fl(e){let t=Array.isArray(e.plugins)?e.plugins:lo(),r=[];for(let n of t){let o=Ft(n);o&&typeof o.resolveNode=="function"&&r.push(o.resolveNode.bind(o))}return r.length?r:null}var hl=2e3,ml=3;function gl(e){let t=Date.now(),r=k.burstAdvice.get(e);if(!r||t-r.firstTs>hl){k.burstAdvice.set(e,{count:1,firstTs:t,warned:!1});return}r.count++,r.count>=ml&&!r.warned&&(r.warned=!0,console.warn("[snapdom] Captured this element multiple times. Pass { burst: true } to increase the speed."))}async function bl(e,t){if(!e)throw new Error("Element cannot be null or undefined");Do(t.cache),t.__session={styleMap:k.session.styleMap,styleCache:k.session.styleCache,nodeMap:k.session.nodeMap},t.burst||gl(e),t.__resolveNodeHooks=fl(t);let r=t.fast,n=t.outerTransforms!==!1,o=!!t.outerShadows,i=t.clip?ro(e,t.clip):null,a={element:e,options:t,plugins:t.plugins},s,l,d,c,u,p,f="",h="",m,g,y=null;await Se("beforeSnap",a);let x=null;t.resolvePicturePlaceholders!==!1&&!pl(t)&&(x=await Hi(a.element,a.options)),await Se("beforeClone",a);let v=Xs(a.element,i);try{({clone:s,classCSS:l,styleCache:d,nodeMap:c,reconcileRisk:u,clipWindow:p}=await Ls(a.element,a.options)),u>0&&!t.reconcile&&!k.warnedReconcile&&(k.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&&s&&(y=is(a.element,s)),!o&&s&&fs(a.element,s,a.options),s&&(gs(a.element,s,c),hs(a.element,s))}finally{v()}if(a={clone:s,classCSS:l,styleCache:d,nodeMap:c,...a},await Se("afterClone",a),x&&await x(),xs(a.clone),a.options?.excludeMode==="remove"||a.options?.filterMode==="remove")try{ks(a.element,a.clone,a.styleCache)}catch(N){console.warn("[snapdom] shrink pass failed:",N)}try{await Ca(a.clone,a.element,a.nodeMap)}catch{}let b=N=>new Promise((L,_)=>{ht(()=>{Promise.resolve().then(N).then(L,_)},{fast:r})}),w=(async()=>{await Promise.all([b(()=>Is(a.clone,a.options)),b(()=>Bs(a.element,a.clone,a.styleCache,a.options,a.nodeMap))]);try{js(a.element,a.clone,a.nodeMap)}catch(N){console.warn("[snapdom] backdrop-filter emulation failed:",N)}t.compress&&await b(()=>ul(a.clone,a.options,a.nodeMap))})(),S=Promise.resolve();t.embedFonts&&(S=b(async()=>{let N=a.element.ownerDocument||document,L=i?I=>{try{let T=I.getBoundingClientRect();return T.right>=i.left-200&&T.left<=i.right+200&&T.bottom>=i.top-200&&T.top<=i.bottom+200}catch{return!0}}:null,{required:_,usedCodepoints:F}=Kn(a.element,L);if(we()){let I=new Set(Array.from(_).map(T=>String(T).split("__")[0]).filter(Boolean));await Jn(I,1,N)}f=await Ba({required:_,usedCodepoints:F,preCached:!1,exclude:a.options.excludeFonts,localFonts:a.options.localFonts,useProxy:a.options.useProxy,fontStylesheetDomains:a.options.fontStylesheetDomains,doc:N})})),await Promise.all([w,S]);let M=Go(a.clone).sort(),C=M.join(",");k.baseStyle.has(C)?h=k.baseStyle.get(C):await new Promise(N=>{ht(()=>{h=Qo(M),k.baseStyle.set(C,h),N()},{fast:r})});let E=Ts(a.element?.ownerDocument||document);a={fontsCSS:f,baseCSS:h,scrollbarCSS:E,...a},await Se("beforeRender",a),await new Promise(N=>{ht(()=>{let L=B(a.element),_=a.element.getBoundingClientRect(),F=Math.max(1,A(a.element.offsetWidth||parseFloat(L.width)||_.width||1)),I=Math.max(1,A(a.element.offsetHeight||parseFloat(L.height)||_.height||1)),T=a.element.ownerDocument||document;if(!p&&(a.element===T.body||a.element===T.documentElement)&&!T.documentElement.hasAttribute("data-sd-pinned")){let z=Math.max(a.element.scrollHeight||0,T.documentElement?.scrollHeight||0,T.body?.scrollHeight||0),Z=Math.max(a.element.scrollWidth||0,T.documentElement?.scrollWidth||0,T.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=k.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=T.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 ue=G.attachShadow({mode:"open"}),rt=T.createElement("style");rt.textContent=(a.scrollbarCSS||"")+a.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a.classCSS,ue.appendChild(rt),ue.appendChild(a.clone.cloneNode(!0)),T.body.appendChild(G);let ve=G.scrollHeight,It=G.scrollWidth;T.body.removeChild(G),k.measureHints.set(a.element,{cssLen:Y,w0:F,csh:ve,csw:It}),ve>0&&(I=Math.max(I,A(ve))),It>0&&(F=Math.max(F,A(It)))}}catch{}}if(a.options?.excludeMode==="remove"||a.options?.filterMode==="remove"){let z=$s(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;As(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=p?A(p.width):F,K=p?A(p.height):I,P=V,W=K,D=Number.isFinite(X),q=Number.isFinite(U),ce=K>0?V/K:1;D&&q?(P=Math.max(1,A(X)),W=Math.max(1,A(U))):D?(P=Math.max(1,A(X)),W=Math.max(1,A(P/(ce||1)))):q&&(W=Math.max(1,A(U)),P=Math.max(1,A(W*(ce||1))));let Q=0,te=0,oe=F,J=I;if(p){let z=0,Z=0;if(jt(a.element)){let Y=null;if(!n&&y&&Number.isFinite(y.a))Y={a:y.a,b:y.b||0,c:y.c||0,d:y.d||1,e:0,f:0};else{let ie=At(a.element),G=no(L.transform&&L.transform!=="none"?L.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}=nr(L,F,I),ue=St(F,I,Y,ie,G);z=ue.minX,Z=ue.minY}}Q=A(p.x+z),te=A(p.y+Z),oe=A(Q+p.width),J=A(te+p.height)}else if(!n&&y&&Number.isFinite(y.a)){let z={a:y.a,b:y.b||0,c:y.c||0,d:y.d||1,e:0,f:0},Z=St(F,I,z,0,0);Q=A(Z.minX),te=A(Z.minY),oe=A(Z.maxX),J=A(Z.maxY)}else if(n&&jt(a.element)){let z=L.transform&&L.transform!=="none"?L.transform:"",Z=At(a.element),Y=ss({baseTransform:z,rotate:Z.rotate||"0deg",scale:Z.scale,translate:Z.translate}),{ox:ie,oy:G}=nr(L,F,I),ue=Y.is2D?Y:new DOMMatrix(Y.toString()),rt={a:ue.a,b:ue.b,c:ue.c,d:ue.d,e:0,f:0},ve=St(F,I,rt,ie,G);Q=A(ve.minX),te=A(ve.minY),oe=A(ve.maxX),J=A(ve.maxY)}let he=es(L),Ce=ts(L),ee=rs(L),Ye=ns(L),Ge=os(L),Qe=p?{top:0,right:0,bottom:0,left:0}:o?{top:A(Math.max(he.top,Ce.top)+ee.top+Ye.top+Ge.bleed.top),right:A(Math.max(he.right,Ce.right)+ee.right+Ye.right+Ge.bleed.right),bottom:A(Math.max(he.bottom,Ce.bottom)+ee.bottom+Ye.bottom+Ge.bleed.bottom),left:A(Math.max(he.left,Ce.left)+ee.left+Ye.left+Ge.bleed.left)}:{top:ee.top,right:ee.right,bottom:ee.bottom,left:ee.left};Q=A(Q-Qe.left),te=A(te-Qe.top),oe=A(oe+Qe.right),J=A(J+Qe.bottom);let wr=Math.max(1,A(oe-Q)),xr=Math.max(1,A(J-te)),po=D||q?A(P/V):1,fo=q||D?A(W/K):1,ho=Math.max(1,A(wr*po)),mo=Math.max(1,A(xr*fo)),vr="http://www.w3.org/2000/svg",go=jt(a.element)?2:0,Ne=A(go+(n?0:1)),Ke=Math.ceil(wr+Ne*2),Je=Math.ceil(xr+Ne*2),Ze=A(-(A(Q)-Ne)),et=A(-(A(te)-Ne)),Sr=Math.max(0,Ze),Cr=Math.max(0,et),kr=A(Ke-Math.min(0,Ze)),Mr=A(Je-Math.min(0,et)),xe=document.createElementNS(vr,"foreignObject");xe.setAttribute("x",String(Math.min(0,Ze))),xe.setAttribute("y",String(Math.min(0,et))),xe.setAttribute("width",String(kr)),xe.setAttribute("height",String(Mr)),xe.style.overflow="visible";let Er=document.createElement("style"),bo="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";Er.textContent=(a.scrollbarCSS||"")+a.baseCSS+a.fontsCSS+bo+a.classCSS,xe.appendChild(Er);let tt=document.createElement("div");tt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),tt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${kr}px;height:${Mr}px`+(Sr!==0||Cr!==0?`;padding:${Cr}px 0 0 ${Sr}px !important`:""),tt.appendChild(a.clone),xe.appendChild(tt);let yo=new XMLSerializer().serializeToString(xe),$r=D||q,wo=Object.freeze({w0:V,h0:K,vbW:Ke,vbH:Je,targetW:P,targetH:W,contentX:A(Ze+(p?Q:0)),contentY:A(et+(p?te:0)),clip:p?Object.freeze({x:A(Q),y:A(te),width:V,height:K}):null});Object.defineProperty(t,"meta",{value:wo,enumerable:!0,writable:!1,configurable:!0});let xo=!$r||we()?Ke:A(ho+Ne*2),vo=!$r||we()?Je:A(mo+Ne*2),So=parseFloat(B(T.documentElement)?.fontSize)||16;g=`<svg xmlns="${vr}" width="${xo}" height="${vo}" viewBox="0 0 ${Ke} ${Je}" font-size="${So}px">`+yo+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(g)}`,a={svgString:g,dataURL:m,...a},N()},{fast:r})}),await Se("afterRender",a);let $=document.getElementById("snapdom-sandbox");return $&&$.style.position==="absolute"&&$.remove(),a.dataURL}function jt(e){return ls(e)}ne();function yl(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let r=_o(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();Ln();var hn=new WeakMap;function co(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 wl(e){let t={dirty:!0,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedVideos:new Set},r=i=>{t.capturing||Bn(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,co(e,t,n),t}function mn(e){let{burst:t,invalidate:r,...n}=e||{};try{return JSON.stringify(n,Object.keys(n).sort())}catch{return null}}function xl(e,t,r,n){let o=hn.get(e);o||(o=wl(e),o.baselineSignature=mn(t),hn.set(e,o));let i=mn(t),a=i===null||i!==o.baselineSignature,s=async()=>{for(let d of o.observers)o.markDirty(d.takeRecords());if(r.invalidate&&(o.dirty=!0),!a&&!o.dirty&&o.last)return o.last;o.capturing=!0,a||(o.dirty=!1);try{let d=await n();return a||(o.last=d),d}finally{for(let d of o.observers)d.takeRecords();o.capturing=!1,co(e,o,o.onMediaDirty)}},l=o.inflight.then(s,s);return o.inflight=l.catch(()=>{}),l}de();$e();ne();function vl(...e){return Zs(...e),H}var H=Object.assign(Cl,{plugins:vl}),sr=Symbol("snapdom.internal"),Sl=Symbol("snapdom.internal.silent");async function Cl(e,t){if(!e)throw new Error("Element cannot be null or undefined");let r=yl(t);if(rl(r,t&&t.plugins),we()){if(r.embedFonts===!0)try{let o=ja(e),i=new Set([...o].map(a=>String(a).split("__")[0]).filter(Boolean));await Jn(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&&ga(r.iconFonts),r.snap||(r.snap={toPng:(n,o)=>H.toPng(n,o),toSvg:(n,o)=>H.toSvg(n,o)}),r.burst?xl(e,t,r,()=>H.capture(e,r,sr)):H.capture(e,r,sr)}H.capture=async(e,t,r)=>{if(r!==sr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");t.element=e;let n=await bl(e,t),o={img:async(m,g)=>{let{toImg:y}=await Promise.resolve().then(()=>(Wr(),Xt));return y(n,{...m,...g||{}})},svg:async(m,g)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Wr(),Xt));return y(n,{...m,...g||{}})},canvas:async(m,g)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(qe(),Fn));return y(n,{...m,...g||{}})},blob:async(m,g)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Hn(),_n));return y(n,{...m,...g||{}})},png:async(m,g)=>{let{rasterize:y}=await Promise.resolve().then(()=>(bt(),gt));return y(n,{...m,...g||{},format:"png"})},jpeg:async(m,g)=>{let{rasterize:y}=await Promise.resolve().then(()=>(bt(),gt));return y(n,{...m,...g||{},format:"jpeg"})},webp:async(m,g)=>{let{rasterize:y}=await Promise.resolve().then(()=>(bt(),gt));return y(n,{...m,...g||{},format:"webp"})},download:async(m,g)=>{let{download:y}=await Promise.resolve().then(()=>(fi(),Wn));return y(n,{...m,...g||{}})}},i={};for(let m of["img","svg","canvas","blob","png","jpeg","webp"])i[m]=async g=>o[m](t,{...g||{},[Sl]:!0});i.jpg=i.jpeg;let a={...t,export:{url:n},exports:i},s=await el("defineExports",a),l=Object.assign({},...s.filter(m=>m&&typeof m=="object").reverse()),d={...o,...l};d.jpeg&&!d.jpg&&(d.jpg=(m,g)=>d.jpeg(m,g));function c(m,g){let y={...t,...g||{}},x=v=>v==="jpeg"||v==="jpg"||v==="webp";return[m,y.format,y.type].map(v=>typeof v=="string"?v.toLowerCase():"").find(x)&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let u=!1,p=Promise.resolve();async function f(m,g){let y=Object.freeze(g&&typeof g=="object"?{...g}:{}),x=async()=>{let b=d[m];if(!b)throw new Error(`[snapdom] Unknown export type: ${m}`);let w=c(m,y),S={...t,export:{type:m,options:w,requestedOptions:y,url:n}};await Se("beforeExport",S,{format:m,options:w});let M=await b(S,w);return await Se("afterExport",S,{format:m,options:w,result:M}),u||(u=!0,await Se("afterSnap",t)),M},v=p.then(x);return p=v.catch(()=>{}),v}let h={url:n,toRaw:()=>n,to:(m,g)=>f(m,g),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(h,"meta",{value:t.meta,enumerable:!0,writable:!1,configurable:!1});for(let m of Object.keys(d)){let g="to"+m.charAt(0).toUpperCase()+m.slice(1);h[g]||(h[g]=y=>f(m,y))}return h};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 ze=class{constructor(){R(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 s,l="webp";try{if(typeof H=="function"){let d=await H(t,{scale:1,embedFonts:!1});if(d&&typeof d.toWebp=="function")s=await d.toWebp();else if(d&&typeof d.toPng=="function")s=await d.toPng(),l="png";else if(d?.url)return{ok:!0,dataUrl:d.url,format:"webp",width:n,height:o}}else H?.toWebp?s=await H.toWebp(t,{scale:1,embedFonts:!1}):H?.toPng&&(s=await H.toPng(t,{scale:1,embedFonts:!1}),l="png")}catch{}if(s&&s.src)return{ok:!0,dataUrl:s.src,format:s.src.startsWith("data:image/webp")?"webp":l,width:s.naturalWidth||n,height:s.naturalHeight||o}}catch(s){let l=String(s?.message||s);if(l.includes("CORS")||l.includes("SecurityError")||l.includes("tainted"))return{ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}}return await this.captureWithSvgFallback(t,n,o)})(),a=new Promise(s=>{setTimeout(()=>s({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 c=0;c<i.length;c++){let u=i[c];a+=`${u}:${i.getPropertyValue(u)};`}o.style.cssText=a,o.style.margin="0",o.style.position="static";let s=`
|
|
9
9
|
<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">
|
|
10
10
|
<foreignObject width="100%" height="100%">
|
|
11
11
|
<div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px;height:${n}px;">
|
|
12
|
-
${
|
|
12
|
+
${o.outerHTML}
|
|
13
13
|
</div>
|
|
14
14
|
</foreignObject>
|
|
15
15
|
</svg>
|
|
16
|
-
`.trim(),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),
|
|
16
|
+
`.trim(),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),d=URL.createObjectURL(l);return await new Promise(c=>{let u=new Image;u.onload=()=>{try{let p=document.createElement("canvas");p.width=r,p.height=n;let f=p.getContext("2d");if(!f){URL.revokeObjectURL(d),c({ok:!1,reason:"CANVAS_CONTEXT_UNAVAILABLE"});return}f.drawImage(u,0,0),URL.revokeObjectURL(d);let h;try{h=p.toDataURL("image/webp",.85)}catch{h=p.toDataURL("image/png")}c({ok:!0,dataUrl:h,format:h.startsWith("data:image/webp")?"webp":"png",width:r,height:n})}catch(p){URL.revokeObjectURL(d),p?.name==="SecurityError"||String(p).includes("tainted")?c({ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}):c({ok:!1,reason:p?.message||"CANVAS_EXPORT_FAILED"})}},u.onerror=()=>{URL.revokeObjectURL(d),c({ok:!1,reason:"IMAGE_LOAD_FAILED"})},u.src=d})}catch(o){return{ok:!1,reason:o?.message||"FALLBACK_CAPTURE_FAILED"}}}};var Pt=class{constructor(t){R(this,"wsUrl");R(this,"projectId");R(this,"debug");R(this,"ws",null);R(this,"sessionId",null);R(this,"queue",[]);R(this,"maxQueueSize",50);R(this,"reconnectAttempts",0);R(this,"maxReconnectDelay",1e4);R(this,"reconnectTimer",null);R(this,"commandHandler");R(this,"messageListeners",[]);R(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}onMessage(t){return this.messageListeners.push(t),()=>{this.messageListeners=this.messageListeners.filter(r=>r!==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);for(let o of this.messageListeners)try{o(n)}catch{}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 Ve=class{constructor(t,r,n={}){R(this,"transport");R(this,"screenshotDriver");R(this,"options");R(this,"container",null);R(this,"shadowRoot",null);R(this,"highlightOverlay",null);R(this,"regionOverlay",null);R(this,"regionBox",null);R(this,"regionBanner",null);R(this,"markersContainer",null);R(this,"toolbarElement",null);R(this,"modalOverlay",null);R(this,"cardOverlay",null);R(this,"toastContainer",null);R(this,"activeMode","idle");R(this,"activeScenario",null);R(this,"hoveredElement",null);R(this,"selectedElement",null);R(this,"selectedRegion",null);R(this,"isDraggingRegion",!1);R(this,"dragStartX",0);R(this,"dragStartY",0);R(this,"savedNotes",[]);R(this,"showMarkers",!0);R(this,"isHidden",!1);R(this,"cleanups",[]);this.transport=t,this.screenshotDriver=r;let o=_t(n.hideQueryParam);this.isHidden=n.hidden===!0||o,this.showMarkers=n.showBadges!==!1&&!this.isHidden,this.options={shortcut:"Alt+Click",maskSelectors:['input[type="password"]',"[data-sensitive]"],showToolbar:!0,showBadges:!0,...n}}init(){if(typeof window>"u"||typeof document>"u")return;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{this.ensureContainer()}):this.ensureContainer();let t=this.transport.onMessage(r=>{r&&r.type==="notes_sync"&&Array.isArray(r.notes)&&this.syncNotes(r.notes)});this.cleanups.push(t),this.setupListeners()}syncNotes(t){this.savedNotes=t,this.updateToolbarCount(),this.renderMarkers()}showToast(t,r="\u2728",n=2500){if(typeof document>"u"||!this.ensureContainer()||!this.toastContainer)return;let i=document.createElement("div");i.className="bt-toast",i.innerHTML=`<span>${r}</span> <span>${t}</span>`,this.toastContainer.appendChild(i),setTimeout(()=>{i.classList.add("bt-toast-fadeout"),setTimeout(()=>{i.parentElement&&i.parentElement.removeChild(i)},250)},n)}startScenario(t){let r=t||`Scenario ${new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`;this.activeScenario={id:`scen_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,6)}`,title:r,stepNumber:1},this.updateToolbarState(),this.setMode("element"),this.showToast(`Started flow: "${r}"`,"\u{1F3AC}")}finishScenario(){let t=this.activeScenario?.title;this.activeScenario=null,this.updateToolbarState(),this.setMode("idle"),this.showToast(t?`Finished flow: "${t}"`:"Flow recording finished","\u2713")}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())}isVisible(){return!this.isHidden}setVisible(t){this.isHidden=!t,this.showMarkers=this.options.showBadges!==!1&&!this.isHidden,this.container&&(this.container.style.display=this.isHidden?"none":"block"),this.toolbarElement?this.toolbarElement.style.display=this.isHidden?"none":"flex":!this.isHidden&&this.options.showToolbar!==!1&&this.createToolbar(),this.isHidden?(this.hideHighlight(),this.hideRegionOverlay(),this.modalOverlay&&this.shadowRoot&&(this.shadowRoot.removeChild(this.modalOverlay),this.modalOverlay=null),this.cardOverlay&&this.shadowRoot&&(this.shadowRoot.removeChild(this.cardOverlay),this.cardOverlay=null),this.markersContainer&&(this.markersContainer.innerHTML="")):(this.renderMarkers(),this.updateToolbarCount())}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.isHidden&&(this.container.style.display="none"),this.shadowRoot=this.container.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=`
|
|
17
17
|
:host {
|
|
18
18
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
19
19
|
color-scheme: dark;
|
|
@@ -453,6 +453,22 @@ ${m}
|
|
|
453
453
|
color: #cbd5e1;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
+
.bt-component-pill {
|
|
457
|
+
display: flex;
|
|
458
|
+
align-items: center;
|
|
459
|
+
gap: 6px;
|
|
460
|
+
background: rgba(15, 23, 42, 0.95);
|
|
461
|
+
border: 1px solid rgba(99, 102, 241, 0.35);
|
|
462
|
+
border-radius: 6px;
|
|
463
|
+
padding: 6px 10px;
|
|
464
|
+
font-size: 11.5px;
|
|
465
|
+
color: #c7d2fe;
|
|
466
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
467
|
+
overflow: hidden;
|
|
468
|
+
text-overflow: ellipsis;
|
|
469
|
+
white-space: nowrap;
|
|
470
|
+
}
|
|
471
|
+
|
|
456
472
|
.bt-scenario-stepper {
|
|
457
473
|
display: flex;
|
|
458
474
|
align-items: center;
|
|
@@ -680,7 +696,7 @@ ${m}
|
|
|
680
696
|
from { opacity: 0; transform: translateY(8px) scale(0.95); }
|
|
681
697
|
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
682
698
|
}
|
|
683
|
-
`,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.markersContainer=document.createElement("div"),this.markersContainer.className="bt-markers-layer",this.shadowRoot.appendChild(this.markersContainer),this.toastContainer=document.createElement("div"),this.toastContainer.className="bt-toast-container",this.shadowRoot.appendChild(this.toastContainer),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=`
|
|
699
|
+
`,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.markersContainer=document.createElement("div"),this.markersContainer.className="bt-markers-layer",this.shadowRoot.appendChild(this.markersContainer),this.toastContainer=document.createElement("div"),this.toastContainer.className="bt-toast-container",this.shadowRoot.appendChild(this.toastContainer),this.options.showToolbar&&!this.isHidden&&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=`
|
|
684
700
|
<button class="bt-toolbar-btn" id="bt-mode-element" title="Inspect element (or hold Alt+Click)">
|
|
685
701
|
<span>\u{1F3AF}</span> Element
|
|
686
702
|
</button>
|
|
@@ -698,12 +714,12 @@ ${m}
|
|
|
698
714
|
<button class="bt-toolbar-btn active" id="bt-toggle-notes" title="Toggle visible note markers on screen">
|
|
699
715
|
<span>\u{1F4CC}</span> Notes <span class="bt-count-pill" id="bt-notes-count">0</span>
|
|
700
716
|
</button>
|
|
701
|
-
`;let t=this.toolbarElement.querySelector("#bt-mode-element"),r=this.toolbarElement.querySelector("#bt-mode-region"),n=this.toolbarElement.querySelector("#bt-mode-page"),
|
|
717
|
+
`;let t=this.toolbarElement.querySelector("#bt-mode-element"),r=this.toolbarElement.querySelector("#bt-mode-region"),n=this.toolbarElement.querySelector("#bt-mode-page"),o=this.toolbarElement.querySelector("#bt-mode-flow"),i=this.toolbarElement.querySelector("#bt-toggle-notes");t.onclick=a=>{a.stopPropagation(),this.setMode(this.activeMode==="element"?"idle":"element")},r.onclick=a=>{a.stopPropagation(),this.setMode(this.activeMode==="region"?"idle":"region")},n.onclick=a=>{a.stopPropagation(),this.setMode("page")},o.onclick=a=>{a.stopPropagation(),this.activeScenario?this.finishScenario():this.startScenario()},i.onclick=a=>{a.stopPropagation(),this.showMarkers=!this.showMarkers,i.classList.toggle("active",this.showMarkers),this.renderMarkers()},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"),o=this.toolbarElement.querySelector("#bt-mode-flow");t?.classList.toggle("active",this.activeMode==="element"),r?.classList.toggle("active",this.activeMode==="region"),n?.classList.toggle("active",this.activeMode==="page"),o&&(this.activeScenario?(o.className="bt-toolbar-btn active-scenario",o.innerHTML=`<span>\u{1F3AC}</span> Step ${this.activeScenario.stepNumber} (Finish)`,o.setAttribute("title",`Click to finish recording "${this.activeScenario.title}"`)):(o.className="bt-toolbar-btn",o.innerHTML="<span>\u{1F3AC}</span> Flow",o.setAttribute("title","Record multi-step reproduction flow")))}updateToolbarCount(){if(!this.toolbarElement)return;let t=this.toolbarElement.querySelector("#bt-notes-count");if(t){let r=this.savedNotes.filter(n=>n.status==="OPEN").length;t.textContent=String(r)}}renderMarkers(){if(!this.ensureContainer()||!this.markersContainer||(this.markersContainer.innerHTML="",!this.showMarkers||this.isHidden))return;let r=window.location.pathname,n=this.savedNotes.filter(i=>i.status==="OPEN"&&(i.route===r||!i.route||i.route==="/"||window.location.href.includes(i.route))),o=[];if(n.forEach((i,a)=>{if(i.type==="page"){o.push(i);return}let s=!!i.scenarioId&&i.stepNumber!=null,l=s?`\u{1F3AC} Step ${i.stepNumber}`:`#${a+1}`,d=`bt-note-marker ${s?"bt-note-marker-step":""}`;if(i.type==="region"&&i.region){let p=document.createElement("div");p.className="bt-region-marker-box",p.style.left=`${i.region.x}px`,p.style.top=`${i.region.y}px`,p.style.width=`${i.region.width}px`,p.style.height=`${i.region.height}px`,this.markersContainer.appendChild(p);let f=document.createElement("div");f.className=d,f.style.left=`${Math.max(4,i.region.x-12)}px`,f.style.top=`${Math.max(4,i.region.y-12)}px`,f.title=s?`[${i.scenarioTitle||"Scenario"}] Step ${i.stepNumber}: ${i.message}`:i.message,f.innerHTML=`<span>${s?"\u{1F3AC}":"\u{1F4D0}"}</span> <span>${l}</span>`,f.onclick=h=>{h.stopPropagation(),this.openNoteCard(i)},this.markersContainer.appendChild(f);return}let c=null;if(i.target?.selector)try{c=document.querySelector(i.target.selector)}catch{}let u=c?c.getBoundingClientRect():i.target?.boundingRect;if(u){let p=document.createElement("div");p.className=d,p.setAttribute("data-note-id",i.id),p.title=s?`[${i.scenarioTitle||"Scenario"}] Step ${i.stepNumber}: ${i.message}`:i.message,p.style.left=`${Math.max(4,u.left-10)}px`,p.style.top=`${Math.max(4,u.top-12)}px`,p.innerHTML=`<span>${s?"\u{1F3AC}":"\u{1F4DD}"}</span> <span>${l}</span>`,p.onclick=f=>{f.stopPropagation(),this.openNoteCard(i)},c&&(p.onmouseenter=()=>this.updateHighlight(c),p.onmouseleave=()=>this.hideHighlight()),this.markersContainer.appendChild(p)}}),o.length>0){let i=document.createElement("div");i.className="bt-page-notes-dock",o.forEach(a=>{let s=document.createElement("div");s.className="bt-page-note-pill";let l=a.scenarioId&&a.stepNumber?`Step ${a.stepNumber}: `:"";s.innerHTML=`<span>\u{1F4C4}</span> <span>${l}${ke(a.message,25)}</span>`,s.onclick=d=>{d.stopPropagation(),this.openNoteCard(a)},i.appendChild(s)}),this.markersContainer.appendChild(i)}}updateMarkerPositions(){!this.showMarkers||!this.markersContainer||this.renderMarkers()}openNoteCard(t){let r=this.ensureContainer();if(!r)return;this.cardOverlay&&this.cardOverlay.parentElement&&(this.cardOverlay.parentElement.removeChild(this.cardOverlay),this.cardOverlay=null);let n=document.createElement("div");n.className="bt-modal-backdrop",this.cardOverlay=n;let o=`bt-badge-${t.type.toLowerCase()}`,i=t.status==="OPEN"?"bt-badge-status-open":"bt-badge-status-resolved",a=t.type==="region"?"\u{1F4D0}":t.type==="page"?"\u{1F4C4}":"\u{1F3AF}",s=t.type==="region"&&t.region?`Region: ${t.region.width} \xD7 ${t.region.height} px \xB7 Route: ${t.route}`:t.type==="page"?`Page Note \xB7 Route: ${t.route}`:`${t.target?.selector||"Element"} (${t.target?.boundingRect?.width||0}\xD7${t.target?.boundingRect?.height||0}px) \xB7 ${t.route}`,l=new Date(t.createdAt).toLocaleString(),d="",c=[];if(t.scenarioId){c=this.savedNotes.filter(S=>S.scenarioId===t.scenarioId).sort((S,M)=>(S.stepNumber||0)-(M.stepNumber||0));let v=c.findIndex(S=>S.id===t.id),b=v>0?c[v-1]:null,w=v>=0&&v<c.length-1?c[v+1]:null;d=`
|
|
702
718
|
<div class="bt-scenario-stepper">
|
|
703
719
|
<button class="bt-step-nav-btn" id="btn-prev-step" ${b?"":"disabled"}>
|
|
704
720
|
\u25C0 Step ${b?b.stepNumber:""}
|
|
705
721
|
</button>
|
|
706
|
-
<span>\u{1F3AC} Step ${t.stepNumber||1} of ${
|
|
722
|
+
<span>\u{1F3AC} Step ${t.stepNumber||1} of ${c.length}</span>
|
|
707
723
|
<button class="bt-step-nav-btn" id="btn-next-step-card" ${w?"":"disabled"}>
|
|
708
724
|
Step ${w?w.stepNumber:""} \u25B6
|
|
709
725
|
</button>
|
|
@@ -713,14 +729,21 @@ ${m}
|
|
|
713
729
|
<div class="bt-modal-header">
|
|
714
730
|
<div class="bt-modal-title">
|
|
715
731
|
<span>${t.scenarioId?"\u{1F3AC} "+(t.scenarioTitle||"Scenario Flow"):a+" Visual Note Details"}</span>
|
|
716
|
-
<span class="bt-mode-badge ${
|
|
732
|
+
<span class="bt-mode-badge ${o}">${t.type.toUpperCase()}</span>
|
|
717
733
|
${t.scenarioId&&t.stepNumber?`<span class="bt-mode-badge bt-badge-step">STEP ${t.stepNumber}</span>`:""}
|
|
718
|
-
<span class="bt-mode-badge ${
|
|
734
|
+
<span class="bt-mode-badge ${i}">${t.status}</span>
|
|
719
735
|
</div>
|
|
720
736
|
<button class="bt-close-btn" id="btn-card-close" title="Close (Esc)">\u2715</button>
|
|
721
737
|
</div>
|
|
722
738
|
|
|
723
|
-
${
|
|
739
|
+
${d}
|
|
740
|
+
|
|
741
|
+
${t.elementContext?.componentSource?.componentName?`<div class="bt-component-pill" title="${t.elementContext.componentSource.sourceFile?t.elementContext.componentSource.sourceFile+(t.elementContext.componentSource.sourceLine?":"+t.elementContext.componentSource.sourceLine:""):t.elementContext.componentSource.componentName}">
|
|
742
|
+
<span>\u{1F9EC}</span>
|
|
743
|
+
<span style="font-weight: 600; color: #a5b4fc;"><${t.elementContext.componentSource.componentName}></span>
|
|
744
|
+
${t.elementContext.componentSource.sourceFile?`<span style="color: #64748b; font-size: 11px; margin-left: 4px;">${t.elementContext.componentSource.sourceFile}${t.elementContext.componentSource.sourceLine?":"+t.elementContext.componentSource.sourceLine:""}</span>`:""}
|
|
745
|
+
${t.elementContext.componentSource.framework?`<span class="bt-mode-badge" style="background: rgba(99, 102, 241, 0.15); color: #818cf8; margin-left: auto; font-size: 10px;">${t.elementContext.componentSource.framework.toUpperCase()}</span>`:""}
|
|
746
|
+
</div>`:""}
|
|
724
747
|
|
|
725
748
|
<div class="bt-target-pill" title="${s}">
|
|
726
749
|
<span>\u{1F3F7}\uFE0F</span>
|
|
@@ -751,15 +774,15 @@ ${m}
|
|
|
751
774
|
</div>
|
|
752
775
|
</div>
|
|
753
776
|
</div>
|
|
754
|
-
`;let u=n.querySelector("#btn-card-close"),p=n.querySelector("#btn-card-dismiss"),
|
|
777
|
+
`;let u=n.querySelector("#btn-card-close"),p=n.querySelector("#btn-card-dismiss"),f=n.querySelector("#btn-card-resolve"),h=n.querySelector("#btn-card-delete"),m=n.querySelector("#btn-card-delete-flow"),g=n.querySelector("#btn-prev-step"),y=n.querySelector("#btn-next-step-card"),x=()=>{this.cardOverlay&&(r.removeChild(this.cardOverlay),this.cardOverlay=null,this.hideHighlight())};if(u.onclick=x,p.onclick=x,n.onclick=v=>{v.target===n&&x()},g&&c.length>0){let v=c.findIndex(b=>b.id===t.id);v>0&&(g.onclick=()=>{this.openNoteCard(c[v-1])})}if(y&&c.length>0){let v=c.findIndex(b=>b.id===t.id);v>=0&&v<c.length-1&&(y.onclick=()=>{this.openNoteCard(c[v+1])})}f.onclick=()=>{t.status==="OPEN"?(this.transport.send({type:"resolve_note",noteId:t.id}),this.showToast("Note marked as resolved","\u2705")):(this.transport.send({type:"reopen_note",noteId:t.id}),this.showToast("Note reopened","\u21BA")),x()},h.onclick=()=>{this.transport.send({type:"delete_note",noteId:t.id}),this.showToast("Note deleted","\u{1F5D1}\uFE0F"),x()},m&&t.scenarioId&&(m.onclick=()=>{this.transport.send({type:"delete_scenario",scenarioId:t.scenarioId}),this.showToast("Scenario flow deleted","\u{1F5D1}\uFE0F"),x()}),r.appendChild(n)}setupListeners(){let t=a=>{if(this.isHidden||this.modalOverlay||this.cardOverlay||this.isDraggingRegion||this.activeMode==="region")return;let s=a.composedPath?a.composedPath():[];if(this.container&&s.includes(this.container)){this.hideHighlight();return}if(a.altKey||this.activeMode==="element"){let l=document.elementFromPoint(a.clientX,a.clientY);if(l&&l!==this.container&&!this.container?.contains(l)){this.hoveredElement=l,this.updateHighlight(l);return}}!a.altKey&&this.activeMode!=="element"&&this.hideHighlight()},r=a=>{if(this.isHidden||this.modalOverlay||this.cardOverlay)return;let s=a.composedPath?a.composedPath():[];if(!(this.container&&s.includes(this.container))&&this.activeMode!=="region"&&(a.altKey||this.activeMode==="element")){a.preventDefault(),a.stopPropagation();let l=this.hoveredElement||document.elementFromPoint(a.clientX,a.clientY);l&&l!==this.container&&!this.container?.contains(l)&&(this.selectedElement=l,this.openNoteEditor(l,"element"),this.activeMode==="element"&&!this.activeScenario&&this.setMode("idle"))}},n=a=>{a.key==="Escape"&&(this.cardOverlay&&this.cardOverlay.parentElement&&this.shadowRoot?(this.shadowRoot.removeChild(this.cardOverlay),this.cardOverlay=null):(this.activeMode==="region"||this.activeMode==="element")&&(this.activeScenario||this.setMode("idle")))},o=a=>{a.key==="Alt"&&!this.modalOverlay&&!this.cardOverlay&&this.activeMode!=="element"&&this.hideHighlight()},i=()=>{requestAnimationFrame(()=>{this.updateMarkerPositions()})};window.addEventListener("mousemove",t,{capture:!0,passive:!0}),window.addEventListener("click",r,{capture:!0}),window.addEventListener("keydown",n,{capture:!0}),window.addEventListener("keyup",o,{capture:!0}),window.addEventListener("scroll",i,{capture:!0,passive:!0}),window.addEventListener("resize",i,{passive:!0}),this.cleanups.push(()=>{window.removeEventListener("mousemove",t,{capture:!0}),window.removeEventListener("click",r,{capture:!0}),window.removeEventListener("keydown",n,{capture:!0}),window.removeEventListener("keyup",o,{capture:!0}),window.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("resize",i)})}showRegionOverlay(){let t=this.ensureContainer();if(t)if(this.regionOverlay)this.regionOverlay.style.display="block";else{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.regionBanner=document.createElement("div"),this.regionBanner.className="bt-region-banner",this.regionBanner.innerHTML=`
|
|
755
778
|
<span>\u{1F4D0} Drag rectangle on screen to select region</span>
|
|
756
779
|
<button class="bt-region-cancel-btn" id="bt-region-cancel">\u2715 Cancel (Esc)</button>
|
|
757
|
-
`;let r=this.regionBanner.querySelector("#bt-region-cancel");r.onclick=n=>{n.stopPropagation(),this.setMode("idle")},this.regionOverlay.appendChild(this.regionBanner),this.regionOverlay.oncontextmenu=n=>{n.preventDefault(),this.setMode("idle")},this.regionOverlay.onmousedown=n=>{let
|
|
780
|
+
`;let r=this.regionBanner.querySelector("#bt-region-cancel");r.onclick=n=>{n.stopPropagation(),this.setMode("idle")},this.regionOverlay.appendChild(this.regionBanner),this.regionOverlay.oncontextmenu=n=>{n.preventDefault(),this.setMode("idle")},this.regionOverlay.onmousedown=n=>{let o=n.composedPath?n.composedPath():[];this.regionBanner&&o.includes(this.regionBanner)||this.toolbarElement&&o.includes(this.toolbarElement)||(this.isDraggingRegion=!0,this.dragStartX=n.clientX,this.dragStartY=n.clientY,this.regionBox&&(this.regionBox.style.display="block",this.regionBox.style.left=`${n.clientX}px`,this.regionBox.style.top=`${n.clientY}px`,this.regionBox.style.width="0px",this.regionBox.style.height="0px"))},this.regionOverlay.onmousemove=n=>{if(!this.isDraggingRegion||!this.regionBox)return;let o=n.clientX,i=n.clientY,a=Math.min(this.dragStartX,o),s=Math.min(this.dragStartY,i),l=Math.abs(o-this.dragStartX),d=Math.abs(i-this.dragStartY);this.regionBox.style.left=`${a}px`,this.regionBox.style.top=`${s}px`,this.regionBox.style.width=`${l}px`,this.regionBox.style.height=`${d}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(d)} px`},this.regionOverlay.onmouseup=n=>{if(!this.isDraggingRegion)return;this.isDraggingRegion=!1;let o=n.clientX,i=n.clientY,a=Math.min(this.dragStartX,o),s=Math.min(this.dragStartY,i),l=Math.abs(o-this.dragStartX),d=Math.abs(i-this.dragStartY);l>15&&d>15&&(this.selectedRegion={x:Math.round(a),y:Math.round(s),width:Math.round(l),height:Math.round(d)},this.openRegionNoteEditor(this.selectedRegion)),this.regionBox&&(this.regionBox.style.display="none"),this.activeScenario||this.setMode("idle")},t.appendChild(this.regionOverlay)}}hideRegionOverlay(){this.regionOverlay&&(this.regionOverlay.style.display="none",this.isDraggingRegion=!1,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.left=`${n.left}px`,this.highlightOverlay.style.top=`${n.top}px`,this.highlightOverlay.style.width=`${n.width}px`,this.highlightOverlay.style.height=`${n.height}px`;let o=this.highlightOverlay.querySelector(".bt-badge");o||(o=document.createElement("div"),o.className="bt-badge",this.highlightOverlay.appendChild(o));let i=ge(t),a=this.activeScenario?`\u{1F3AC} Step ${this.activeScenario.stepNumber} \xB7 ${i}`:i;o.textContent=`${a} (${Math.round(n.width)} \xD7 ${Math.round(n.height)} px)`}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);let i=r==="element"?Re(o):void 0,a=i?.componentName?`\u{1F9EC} <${i.componentName}>${i.sourceFile?" ("+i.sourceFile+(i.sourceLine?":"+i.sourceLine:"")+")":""} \xB7 `:"";this.renderNoteModal({title:this.activeScenario?`Step ${this.activeScenario.stepNumber}: ${this.activeScenario.title}`:"Add Visual Note",modeBadge:this.activeScenario?`STEP ${this.activeScenario.stepNumber}`:r.toUpperCase(),pillText:r==="page"?`Page Viewport: ${window.innerWidth} \xD7 ${window.innerHeight} px`:`${a}${ge(o)} (${Math.round(o.getBoundingClientRect().width)}\xD7${Math.round(o.getBoundingClientRect().height)}) \xB7 Viewport: ${window.innerWidth}\xD7${window.innerHeight}`,onSave:async(s,l)=>{let d;l==="next_step"&&!this.activeScenario&&this.startScenario(),this.activeScenario&&(d={scenarioId:this.activeScenario.id,stepNumber:this.activeScenario.stepNumber,scenarioTitle:this.activeScenario.title}),await this.saveVisualNote(o,s,r,d),l==="next_step"&&this.activeScenario?(this.activeScenario.stepNumber++,this.updateToolbarState(),this.setMode("element")):l==="finish_flow"&&this.activeScenario&&this.finishScenario()}})}openRegionNoteEditor(t){this.renderNoteModal({title:this.activeScenario?`Step ${this.activeScenario.stepNumber}: ${this.activeScenario.title}`:"Add Region Note",modeBadge:this.activeScenario?`STEP ${this.activeScenario.stepNumber}`:"REGION",pillText:`Selected Area: x:${t.x}, y:${t.y} (${t.width} \xD7 ${t.height} px)`,onSave:async(r,n)=>{let o;n==="next_step"&&!this.activeScenario&&this.startScenario(),this.activeScenario&&(o={scenarioId:this.activeScenario.id,stepNumber:this.activeScenario.stepNumber,scenarioTitle:this.activeScenario.title}),await this.saveRegionVisualNote(t,r,o),n==="next_step"&&this.activeScenario?(this.activeScenario.stepNumber++,this.updateToolbarState(),this.setMode("element")):n==="finish_flow"&&this.activeScenario&&this.finishScenario()}})}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;let o=t.modeBadge.startsWith("STEP"),i=o?"bt-badge-step":`bt-badge-${t.modeBadge.toLowerCase()}`,a=o?"\u{1F3AC}":t.modeBadge==="REGION"?"\u{1F4D0}":t.modeBadge==="PAGE"?"\u{1F4C4}":"\u{1F3AF}",s=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);n.innerHTML=`
|
|
758
781
|
<div class="bt-modal">
|
|
759
782
|
<div class="bt-modal-header">
|
|
760
783
|
<div class="bt-modal-title">
|
|
761
784
|
<span>${a} ${t.title}</span>
|
|
762
|
-
<span class="bt-mode-badge ${
|
|
785
|
+
<span class="bt-mode-badge ${i}">${t.modeBadge}</span>
|
|
763
786
|
</div>
|
|
764
787
|
<button class="bt-close-btn" id="btn-close" title="Close (Esc)">\u2715</button>
|
|
765
788
|
</div>
|
|
@@ -783,4 +806,4 @@ ${m}
|
|
|
783
806
|
</div>
|
|
784
807
|
</div>
|
|
785
808
|
</div>
|
|
786
|
-
`;let l=n.querySelector("textarea"),
|
|
809
|
+
`;let l=n.querySelector("textarea"),d=n.querySelector("#btn-close"),c=n.querySelector("#btn-cancel"),u=n.querySelector("#btn-save"),p=n.querySelector("#btn-next-step"),f=n.querySelector("#btn-finish-flow"),h=()=>{this.modalOverlay&&(r.removeChild(this.modalOverlay),this.modalOverlay=null,this.hideHighlight(),this.hideRegionOverlay())};d.onclick=h,c.onclick=h,n.onclick=g=>{g.target===n&&h()};let m=async g=>{let y=l.value.trim();if(y){p.disabled=!0,u&&(u.disabled=!0),f&&(f.disabled=!0);try{await t.onSave(y,g)}finally{h()}}};u&&(u.onclick=()=>m("save")),p.onclick=()=>m("next_step"),f&&(f.onclick=()=>m("finish_flow")),l.onkeydown=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),m(this.activeScenario?"next_step":"save")),g.key==="Escape"&&h()},r.appendChild(n),setTimeout(()=>l?.focus(),50)}async saveVisualNote(t,r,n="element",o){let i=t.getBoundingClientRect(),a=n==="page"?"body":ge(t),s;try{let m=await this.screenshotDriver.captureElement(t);m.ok&&(s=m.dataUrl)}catch{}let l=this.extractElementContext(t),d={selector:a,boundingRect:{x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),top:Math.round(i.top),left:Math.round(i.left),bottom:Math.round(i.bottom),right:Math.round(i.right)},visible:i.width>0&&i.height>0,confidence:a.startsWith("[data-test")?"high":a.startsWith("#")?"medium":"low"},c=typeof window<"u"?window.location.pathname+window.location.search:"/",u=typeof window<"u"?window.location.href:"http://localhost/",p=typeof window<"u"?{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1}:{width:1280,height:800,devicePixelRatio:1},f=typeof window<"u"?{scrollX:window.scrollX,scrollY:window.scrollY}:{scrollX:0,scrollY:0},h={type:"create_note",sessionId:this.transport.getSessionId()||"",noteType:n,message:r,route:c,url:u,viewport:p,scroll:f,target:d,elementContext:l,screenshot:s,scenarioId:o?.scenarioId,stepNumber:o?.stepNumber,scenarioTitle:o?.scenarioTitle,timestamp:Date.now()};this.transport.send(h),this.options.onNoteCreated&&this.options.onNoteCreated(h),o?.scenarioId?this.showToast(`Step ${o.stepNumber||1} recorded`,"\u{1F3AC}"):this.showToast("Visual note saved","\u2728")}async saveRegionVisualNote(t,r,n){let o;try{let c=await this.screenshotDriver.captureElement(document.body||document.documentElement);c.ok&&c.dataUrl&&(o=await this.cropDataUrl(c.dataUrl,t))}catch{}let i=typeof window<"u"?window.location.pathname+window.location.search:"/",a=typeof window<"u"?window.location.href:"http://localhost/",s=typeof window<"u"?{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1}:{width:1280,height:800,devicePixelRatio:1},l=typeof window<"u"?{scrollX:window.scrollX,scrollY:window.scrollY}:{scrollX:0,scrollY:0},d={type:"create_note",sessionId:this.transport.getSessionId()||"",noteType:"region",message:r,route:i,url:a,viewport:s,scroll:l,region:t,screenshot:o,scenarioId:n?.scenarioId,stepNumber:n?.stepNumber,scenarioTitle:n?.scenarioTitle,timestamp:Date.now()};this.transport.send(d),this.options.onNoteCreated&&this.options.onNoteCreated(d),n?.scenarioId?this.showToast(`Step ${n.stepNumber||1} region recorded`,"\u{1F3AC}"):this.showToast("Region note saved","\u{1F4D0}")}extractElementContext(t){let r=ge(t),n={};for(let s=0;s<t.attributes.length;s++){let l=t.attributes[s];this.options.maskSelectors?.some(d=>{try{return t.matches(d)}catch{return!1}})&&(l.name==="value"||l.name==="data-secret")?n[l.name]="[REDACTED]":n[l.name]=l.value}let o=t.outerHTML;o&&o.length>1e3&&(o=ke(o,1e3));let i=t.innerText||t.textContent||"";i&&i.length>200&&(i=ke(i,200));let a=Re(t);return{selector:r,tag:t.tagName.toLowerCase(),attributes:n,outerHTML:o,innerText:i,componentSource:a,parent:t.parentElement?{selector:ge(t.parentElement),tag:t.parentElement.tagName.toLowerCase()}:void 0}}async cropDataUrl(t,r){return new Promise(n=>{let o=new Image;o.onload=()=>{let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let a=i.getContext("2d");if(!a){n(t);return}let s=window.devicePixelRatio||1;a.drawImage(o,r.x*s,r.y*s,r.width*s,r.height*s,0,0,r.width,r.height),n(i.toDataURL("image/png"))},o.onerror=()=>n(t),o.src=t})}destroy(){for(let t of this.cleanups)t();this.cleanups=[],this.container&&this.container.parentNode&&(this.container.parentNode.removeChild(this.container),this.container=null,this.shadowRoot=null)}};var Xe=class{constructor(t={}){R(this,"options");R(this,"breadcrumbs");R(this,"transport");R(this,"screenshotDriver");R(this,"commandHandler");R(this,"inspector");R(this,"lastElement");R(this,"currentRoute","/");R(this,"cleanups",[]);R(this,"isInitialized",!1);this.options={...st,...t,notes:{...st.notes,...t.notes||{}}},this.breadcrumbs=new Ie(this.options.maxBreadcrumbs),this.transport=new Pt({url:this.options.daemonUrl,projectId:this.options.projectId,debug:this.options.debug}),this.screenshotDriver=new ze,this.commandHandler=new it(this.screenshotDriver),this.transport.setCommandHandler(this.commandHandler),this.options.notes.enabled&&(this.inspector=new Ve(this.transport,this.screenshotDriver,{shortcut:this.options.notes.shortcut,maskSelectors:this.options.notes.maskSelectors,showToolbar:this.options.notes.showToolbar,showBadges:this.options.notes.showBadges,hidden:this.options.hidden,hideQueryParam:this.options.hideQueryParam}))}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=Ir(async r=>{await this.handleRuntimeError(r)});this.cleanups.push(t)}if(this.options.captureConsole){let t=Lr(async r=>{await this.handleConsole(r)});this.cleanups.push(t)}if(this.options.captureNetwork){let t=Pr(r=>{this.handleNetwork(r)});this.cleanups.push(t)}if(this.options.captureNavigation){let t=Fr(r=>{this.handleNavigation(r)});this.cleanups.push(t)}if(this.options.captureInteractions){let t=Tr((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")}isUIVisible(){return this.inspector?this.inspector.isVisible():!1}setUIVisible(t){this.inspector&&this.inspector.setVisible(t)}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 Pe=null;function yr(e={}){return Pe||(Pe=new Xe(e),Pe.init(),Pe)}function uo(){return Pe}if(typeof window<"u"){window.__BROWSERTRACK__={init:yr,getClient:uo};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,o=e?.getAttribute("data-hidden")==="true",i=e?.getAttribute("data-hide-query-param")||void 0;t&&yr({daemonUrl:r,projectId:n,hidden:o,hideQueryParam:i})}catch{}}return No(kl);})();
|