feat(Dom2Image): add IDom2ImageService interface#540
Conversation
Reviewer's GuideThis PR introduces a Dom2Image capture service by defining a JSON-serializable options class, a service interface, and a default implementation that uses JS interop to call a new dom2image JavaScript module. It registers the service in DI, includes the dom2image.js wrapper and the underlying snapdom library, and updates project and solution files accordingly. Sequence diagram for GetUrlAsync interaction via JS interopsequenceDiagram
participant C# as DefaultDom2ImageService
participant JS as dom2image.js
participant Lib as snapdom.mjs
C#->>JS: getUrl(selector, options)
JS->>Lib: snapdom(element, options)
Lib-->>JS: url
JS-->>C#: url
Sequence diagram for DownloadAsync interaction via JS interopsequenceDiagram
participant C# as DefaultDom2ImageService
participant JS as dom2image.js
participant Lib as snapdom.mjs
C#->>JS: downloadAsync(selector, filename, format, backgroundColor, options)
JS->>Lib: snapdom(element, options)
Lib-->>JS: result
JS->>Lib: result.download({format, filename, backgroundColor})
JS-->>C#: (async completion)
Class diagram for Dom2Image service interface and implementationclassDiagram
class IDom2ImageService {
+Task<string?> GetUrlAsync(string selector, Dom2ImageOptions? options = null, CancellationToken token = default)
+Task<Stream?> GetStreamAsync(string selector, Dom2ImageOptions? options = null, CancellationToken token = default)
+Task DownloadAsync(string selector, string fileName = "capture", string? format = "png", string? backgroundColor = null, Dom2ImageOptions? options = null)
}
class DefaultDom2ImageService {
-JSModule? _jsModule
+Task<string?> GetUrlAsync(string selector, Dom2ImageOptions? options = null, CancellationToken token = default)
+Task<Stream?> GetStreamAsync(string selector, Dom2ImageOptions? options = null, CancellationToken token = default)
+Task DownloadAsync(string selector, string fileName = "capture", string? format = "png", string? backgroundColor = null, Dom2ImageOptions? options = null)
-Task<JSModule> LoadModule()
}
IDom2ImageService <|.. DefaultDom2ImageService
Class diagram for Dom2ImageOptions data structureclassDiagram
class Dom2ImageOptions {
+bool? Compress
+bool? Fast
+bool? EmbedFonts
+int? Scale
+int? Dpr
+int? Width
+int? Height
+string? BackgroundColor
+float? Quality
+string? Type
+string[]? Exclude
+string[]? LocalFonts
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The PR vendors the entire unminified Snapdom library—which makes the diff huge—consider referencing it as an external package or including only the minified bundle to reduce noise and simplify updates.
- The ServiceCollectionExtensions class and XML docs still mention AzureOpenAI/Html2Pdf—please update class names and summaries so they correctly describe the Dom2Image service.
- Double-check that GetStreamAsync’s use of IJSStreamReference matches the JS getStream implementation (which returns a Blob) to ensure streaming interop works as expected.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The PR vendors the entire unminified Snapdom library—which makes the diff huge—consider referencing it as an external package or including only the minified bundle to reduce noise and simplify updates.
- The ServiceCollectionExtensions class and XML docs still mention AzureOpenAI/Html2Pdf—please update class names and summaries so they correctly describe the Dom2Image service.
- Double-check that GetStreamAsync’s use of IJSStreamReference matches the JS getStream implementation (which returns a Blob) to ensure streaming interop works as expected.
## Individual Comments
### Comment 1
<location> `src/components/BootstrapBlazor.Dom2Image/Extensions/ServiceCollectionExtensions.cs:12` </location>
<code_context>
+/// <summary>
+/// BootstrapBlazor 服务扩展类
+/// </summary>
+public static class BootstrapBlazorHtml2PdfServiceExtensions
+{
+ /// <summary>
</code_context>
<issue_to_address>
Class name does not match the feature (Dom2Image).
Consider renaming the class to 'BootstrapBlazorDom2ImageServiceExtensions' to better reflect its purpose and maintain consistency.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
/// <summary>
/// BootstrapBlazor 服务扩展类
/// </summary>
public static class BootstrapBlazorHtml2PdfServiceExtensions
=======
/// <summary>
/// BootstrapBlazor Dom2Image 服务扩展类
/// </summary>
public static class BootstrapBlazorDom2ImageServiceExtensions
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `src/components/BootstrapBlazor.Dom2Image/Services/Dom2ImageOptions.cs:10` </location>
<code_context>
+
+namespace Microsoft.Extensions.DependencyInjection;
+
+/// <summary>
+/// BootstrapBlazor 服务扩展类
+/// </summary>
</code_context>
<issue_to_address>
LocalFonts property type may be too restrictive.
Consider updating LocalFonts to use a type that represents font metadata, such as a class or record with properties like family and src, to better align with the JS API requirements.
Suggested implementation:
```csharp
public class Dom2ImageOptions
{
/// <summary>
/// Represents font metadata for local fonts.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<LocalFont>? LocalFonts { get; set; }
/// <summary>
/// Removes redundant styles. Default value is true
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? Compress { get; set; }
/// <summary>
/// Skips idle delay for faster results. Default value is true
```
```csharp
/// <summary>
/// Represents metadata for a local font.
/// </summary>
public class LocalFont
{
/// <summary>
/// The font family name.
/// </summary>
public string Family { get; set; } = string.Empty;
/// <summary>
/// The source URL or path for the font.
/// </summary>
public string Src { get; set; } = string.Empty;
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
# Conflicts: # BootstrapBlazor.Extensions.sln
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new Dom2Image component that enables capturing HTML elements as images using the snapdom JavaScript library. The implementation provides a C# service interface with JSInterop integration.
- Adds
IDom2ImageServiceinterface and default implementation for converting DOM elements to images - Integrates the snapdom JavaScript library for client-side DOM rendering
- Provides options configuration for customizing capture behavior (scale, dimensions, format, fonts, etc.)
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
wwwroot/lib/snapdom.min.mjs |
Third-party minified library for DOM-to-image conversion |
wwwroot/dom2image.js |
JavaScript wrapper providing getUrl, getStream, and downloadAsync functions |
Services/IDom2ImageService.cs |
Service interface defining methods for URL generation, stream retrieval, and download |
Services/Dom2ImageOptions.cs |
Configuration class with properties for controlling capture settings |
Services/DefaultDom2ImageService.cs |
Default service implementation using IJSRuntime for interop calls |
Extensions/ServiceCollectionExtensions.cs |
DI extension method for registering the Dom2Image service |
BootstrapBlazor.Dom2Image.csproj |
Project file defining package metadata and dependencies |
BootstrapBlazor.Extensions.slnx |
Solution file updated to include the new Dom2Image project |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public string[]? Exclude { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// |
There was a problem hiding this comment.
Missing documentation for the LocalFonts property. The XML comment is empty and should describe what this property does and how it should be used.
| /// | |
| /// Specifies a list of local font file URLs or font names to embed in the output image. | |
| /// Use this to include custom fonts that are not loaded by default. Provide font file paths or names as strings. |
| public static class BootstrapBlazorDom2ImageServiceExtensions | ||
| { | ||
| /// <summary> | ||
| /// 添加 AzureOpenAIService 服务 |
There was a problem hiding this comment.
The XML comment states "添加 AzureOpenAIService 服务" (Add AzureOpenAIService service), but this method is adding IDom2ImageService. This appears to be a copy-paste error from another service extension.
| /// 添加 AzureOpenAIService 服务 | |
| /// 添加 Dom2Image 服务 |
| const el = document.querySelector(selector); | ||
| if (el) { | ||
| const result = await snapdom(el, options || {}); | ||
| data = result.toBlob(); |
There was a problem hiding this comment.
The getStream function returns result.toBlob() which is a Promise, but the function doesn't await it. This should be await result.toBlob() to properly handle the asynchronous operation.
| data = result.toBlob(); | |
| data = await result.toBlob(); |
| _jsModule ??= await LoadModule(); | ||
| data = await _jsModule.InvokeAsync<string?>("getUrl", token, selector, options); | ||
| } | ||
| catch (OperationCanceledException) { } |
There was a problem hiding this comment.
Poor error handling: empty catch block.
| data = await streamReference.OpenReadStreamAsync(streamReference.Length, token); | ||
| } | ||
| } | ||
| catch (OperationCanceledException) { } |
There was a problem hiding this comment.
Poor error handling: empty catch block.
| catch (OperationCanceledException) { } | |
| catch (OperationCanceledException ex) | |
| { | |
| logger.LogWarning(ex, "{GetStreamAsync} operation was canceled.", nameof(GetStreamAsync)); | |
| } |
| `:""}function Pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function _n(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)await new Promise(a=>setTimeout(a,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null}function Wn(t){let e=t.getBoundingClientRect(),n=0,r=0,o=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,r=parseFloat(i.borderRightWidth)||0,o=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),l=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:l,rect:e}}function Un(t,e,n){let r=t.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Bn(t,e,n){let r=await _n(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=Wn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i={...n,scale:1},c=Un(r,o,a),u;try{u=await l.toPng(r.documentElement,i)}finally{c()}u.style.display="block",u.style.width=`${o}px`,u.style.height=`${a}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),st(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(u),f}async function gt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||At.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide"){let u=document.createElement("div"),f=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Bn(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,st(t,u,e,n),u}else{let u=t.getBoundingClientRect(),f=document.createElement("div");return f.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,st(t,f,e,n),f}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),st(t,c,e,n);let u=document.createElement("div");return u.textContent=t.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}if(t.tagName==="CANVAS"){let c=t.toDataURL(),u=document.createElement("img");return u.src=c,u.width=t.width,u.height=t.height,e.nodeMap.set(u,t),st(t,u,e,n),u}let s;try{if(s=t.cloneNode(!1),xe(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){Ln(t,s);try{let c=t.getBoundingClientRect(),u=Math.round(c.width||0),f=Math.round(c.height||0);if(!u||!f){let m=window.getComputedStyle(t),y=parseFloat(m.width)||0,b=parseFloat(m.height)||0,d=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,p=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;u=Math.round(u||y||d||p||0),f=Math.round(f||b||h||g||0)}u&&(s.dataset.snapdomWidth=String(u)),f&&(s.dataset.snapdomHeight=String(f))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(o=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),st(t,s,e,n),t.shadowRoot){let h=function(g,S){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return S(null);gt(g,e,n).then(x=>{S(x||null)}).catch(()=>{S(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let S of g){let x=[];try{x=S.assignedNodes?.({flatten:!0})||S.assignedNodes?.()||[]}catch{x=S.assignedNodes?.()||[]}for(let C of x)r.add(C)}}catch{}let c=En(e),u=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let f=Fn(t.shadowRoot),m=vn(f,u),y=Rn(f),b=Tn(t,y,u);Nn(s,b+m,c);let d=document.createDocumentFragment(),p=await Zt(Array.from(t.shadowRoot.childNodes),h,n.fast);d.append(...p.filter(g=>!!g)),s.appendChild(d)}if(t.tagName==="SLOT"){let m=function(b,d){gt(b,e,n).then(h=>{h&&Pn(h),d(h||null)}).catch(()=>{d(null)})},c=t.assignedNodes?.({flatten:!0})||[],u=c.length>0?c:Array.from(t.childNodes),f=document.createDocumentFragment(),y=await Zt(Array.from(u),m,n.fast);return f.append(...y.filter(b=>!!b)),f}function l(c,u){if(r.has(c))return u(null);gt(c,e,n).then(f=>{u(f||null)}).catch(()=>{u(null)})}let i=await Zt(Array.from(t.childNodes),l,n.fast);if(s.append(...i.filter(c=>!!c)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let c of s.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s}var On=[/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=[];function Ce(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...On,...te];for(let r of n)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function Ae(t,e,n,r=32,o="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let l=s.getBoundingClientRect(),i=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,i*a),u.height=Math.max(1,c*a);let f=u.getContext("2d");return f.scale(a,a),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=o,f.fillText(t,0,0),{dataUrl:u.toDataURL(),width:i,height:c}}var Dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Ft(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Dn.has(n.toLowerCase()))return n}return""}function vt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Hn(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function qn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=vt(n[1]),a=vt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=vt(e);return{min:r,max:r}}function jn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Vn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),o=r?parseFloat(r[1]):100;return{min:o,max:o}}function zn(t,e){if(!t)return!1;try{let n=new URL(t,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"].some(l=>o.endsWith(l)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let l of e){let i=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(c))return!0}return!1}catch{return!1}}function Xn(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function Me(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,o)=>{let a=(o||"").trim();if(!a||/^data:|^blob:|^https?:|^file:|^about:/i.test(a))return n;let s=a;try{s=new URL(a,e||location.href).href}catch{}return`url("${s}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function Yn(t,e,n){if(!t)return t;let r=new Set;function o(l,i){try{return new URL(l,i||location.href).href}catch{return l}}async function a(l,i,c=0){if(c>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${i}`),l;let u="",f=0,m;for(;m=ne.exec(l);){u+=l.slice(f,m.index),f=ne.lastIndex;let y=(m[2]||m[4]||"").trim(),b=o(y,i);if(r.has(b)){console.warn(`[snapDOM] Skipping circular @import: ${b}`);continue}r.add(b);let d="";try{let h=await L(b,{as:"text",useProxy:n,silent:!0});h.ok&&typeof h.data=="string"&&(d=h.data)}catch{}d?(d=Me(d,b),d=await a(d,b,c+1),u+=` | ||
| /* inlined: ${b} */ | ||
| ${d} | ||
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
There was a problem hiding this comment.
The initial value of $ is unused, since it is always overwritten.
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; | |
| `):u+=m[0]}return u+=l.slice(f),u}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
| `:""}function Pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function _n(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)await new Promise(a=>setTimeout(a,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null}function Wn(t){let e=t.getBoundingClientRect(),n=0,r=0,o=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,r=parseFloat(i.borderRightWidth)||0,o=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),l=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:l,rect:e}}function Un(t,e,n){let r=t.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Bn(t,e,n){let r=await _n(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=Wn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i={...n,scale:1},c=Un(r,o,a),u;try{u=await l.toPng(r.documentElement,i)}finally{c()}u.style.display="block",u.style.width=`${o}px`,u.style.height=`${a}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),st(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(u),f}async function gt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||At.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide"){let u=document.createElement("div"),f=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Bn(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,st(t,u,e,n),u}else{let u=t.getBoundingClientRect(),f=document.createElement("div");return f.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,st(t,f,e,n),f}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),st(t,c,e,n);let u=document.createElement("div");return u.textContent=t.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}if(t.tagName==="CANVAS"){let c=t.toDataURL(),u=document.createElement("img");return u.src=c,u.width=t.width,u.height=t.height,e.nodeMap.set(u,t),st(t,u,e,n),u}let s;try{if(s=t.cloneNode(!1),xe(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){Ln(t,s);try{let c=t.getBoundingClientRect(),u=Math.round(c.width||0),f=Math.round(c.height||0);if(!u||!f){let m=window.getComputedStyle(t),y=parseFloat(m.width)||0,b=parseFloat(m.height)||0,d=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,p=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;u=Math.round(u||y||d||p||0),f=Math.round(f||b||h||g||0)}u&&(s.dataset.snapdomWidth=String(u)),f&&(s.dataset.snapdomHeight=String(f))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(o=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),st(t,s,e,n),t.shadowRoot){let h=function(g,S){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return S(null);gt(g,e,n).then(x=>{S(x||null)}).catch(()=>{S(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let S of g){let x=[];try{x=S.assignedNodes?.({flatten:!0})||S.assignedNodes?.()||[]}catch{x=S.assignedNodes?.()||[]}for(let C of x)r.add(C)}}catch{}let c=En(e),u=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let f=Fn(t.shadowRoot),m=vn(f,u),y=Rn(f),b=Tn(t,y,u);Nn(s,b+m,c);let d=document.createDocumentFragment(),p=await Zt(Array.from(t.shadowRoot.childNodes),h,n.fast);d.append(...p.filter(g=>!!g)),s.appendChild(d)}if(t.tagName==="SLOT"){let m=function(b,d){gt(b,e,n).then(h=>{h&&Pn(h),d(h||null)}).catch(()=>{d(null)})},c=t.assignedNodes?.({flatten:!0})||[],u=c.length>0?c:Array.from(t.childNodes),f=document.createDocumentFragment(),y=await Zt(Array.from(u),m,n.fast);return f.append(...y.filter(b=>!!b)),f}function l(c,u){if(r.has(c))return u(null);gt(c,e,n).then(f=>{u(f||null)}).catch(()=>{u(null)})}let i=await Zt(Array.from(t.childNodes),l,n.fast);if(s.append(...i.filter(c=>!!c)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let c of s.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s}var On=[/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=[];function Ce(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...On,...te];for(let r of n)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function Ae(t,e,n,r=32,o="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let l=s.getBoundingClientRect(),i=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,i*a),u.height=Math.max(1,c*a);let f=u.getContext("2d");return f.scale(a,a),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=o,f.fillText(t,0,0),{dataUrl:u.toDataURL(),width:i,height:c}}var Dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Ft(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Dn.has(n.toLowerCase()))return n}return""}function vt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Hn(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function qn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=vt(n[1]),a=vt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=vt(e);return{min:r,max:r}}function jn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Vn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),o=r?parseFloat(r[1]):100;return{min:o,max:o}}function zn(t,e){if(!t)return!1;try{let n=new URL(t,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"].some(l=>o.endsWith(l)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let l of e){let i=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(c))return!0}return!1}catch{return!1}}function Xn(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function Me(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,o)=>{let a=(o||"").trim();if(!a||/^data:|^blob:|^https?:|^file:|^about:/i.test(a))return n;let s=a;try{s=new URL(a,e||location.href).href}catch{}return`url("${s}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function Yn(t,e,n){if(!t)return t;let r=new Set;function o(l,i){try{return new URL(l,i||location.href).href}catch{return l}}async function a(l,i,c=0){if(c>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${i}`),l;let u="",f=0,m;for(;m=ne.exec(l);){u+=l.slice(f,m.index),f=ne.lastIndex;let y=(m[2]||m[4]||"").trim(),b=o(y,i);if(r.has(b)){console.warn(`[snapDOM] Skipping circular @import: ${b}`);continue}r.add(b);let d="";try{let h=await L(b,{as:"text",useProxy:n,silent:!0});h.ok&&typeof h.data=="string"&&(d=h.data)}catch{}d?(d=Me(d,b),d=await a(d,b,c+1),u+=` | ||
| /* inlined: ${b} */ | ||
| ${d} | ||
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
There was a problem hiding this comment.
Superfluous argument passed to function gt.
| `:""}function Pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function _n(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)await new Promise(a=>setTimeout(a,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null}function Wn(t){let e=t.getBoundingClientRect(),n=0,r=0,o=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,r=parseFloat(i.borderRightWidth)||0,o=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),l=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:l,rect:e}}function Un(t,e,n){let r=t.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Bn(t,e,n){let r=await _n(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=Wn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i={...n,scale:1},c=Un(r,o,a),u;try{u=await l.toPng(r.documentElement,i)}finally{c()}u.style.display="block",u.style.width=`${o}px`,u.style.height=`${a}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),st(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(u),f}async function gt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||At.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide"){let u=document.createElement("div"),f=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Bn(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,st(t,u,e,n),u}else{let u=t.getBoundingClientRect(),f=document.createElement("div");return f.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,st(t,f,e,n),f}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),st(t,c,e,n);let u=document.createElement("div");return u.textContent=t.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}if(t.tagName==="CANVAS"){let c=t.toDataURL(),u=document.createElement("img");return u.src=c,u.width=t.width,u.height=t.height,e.nodeMap.set(u,t),st(t,u,e,n),u}let s;try{if(s=t.cloneNode(!1),xe(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){Ln(t,s);try{let c=t.getBoundingClientRect(),u=Math.round(c.width||0),f=Math.round(c.height||0);if(!u||!f){let m=window.getComputedStyle(t),y=parseFloat(m.width)||0,b=parseFloat(m.height)||0,d=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,p=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;u=Math.round(u||y||d||p||0),f=Math.round(f||b||h||g||0)}u&&(s.dataset.snapdomWidth=String(u)),f&&(s.dataset.snapdomHeight=String(f))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(o=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),st(t,s,e,n),t.shadowRoot){let h=function(g,S){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return S(null);gt(g,e,n).then(x=>{S(x||null)}).catch(()=>{S(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let S of g){let x=[];try{x=S.assignedNodes?.({flatten:!0})||S.assignedNodes?.()||[]}catch{x=S.assignedNodes?.()||[]}for(let C of x)r.add(C)}}catch{}let c=En(e),u=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let f=Fn(t.shadowRoot),m=vn(f,u),y=Rn(f),b=Tn(t,y,u);Nn(s,b+m,c);let d=document.createDocumentFragment(),p=await Zt(Array.from(t.shadowRoot.childNodes),h,n.fast);d.append(...p.filter(g=>!!g)),s.appendChild(d)}if(t.tagName==="SLOT"){let m=function(b,d){gt(b,e,n).then(h=>{h&&Pn(h),d(h||null)}).catch(()=>{d(null)})},c=t.assignedNodes?.({flatten:!0})||[],u=c.length>0?c:Array.from(t.childNodes),f=document.createDocumentFragment(),y=await Zt(Array.from(u),m,n.fast);return f.append(...y.filter(b=>!!b)),f}function l(c,u){if(r.has(c))return u(null);gt(c,e,n).then(f=>{u(f||null)}).catch(()=>{u(null)})}let i=await Zt(Array.from(t.childNodes),l,n.fast);if(s.append(...i.filter(c=>!!c)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let c of s.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s}var On=[/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=[];function Ce(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...On,...te];for(let r of n)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function Ae(t,e,n,r=32,o="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let l=s.getBoundingClientRect(),i=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,i*a),u.height=Math.max(1,c*a);let f=u.getContext("2d");return f.scale(a,a),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=o,f.fillText(t,0,0),{dataUrl:u.toDataURL(),width:i,height:c}}var Dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Ft(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Dn.has(n.toLowerCase()))return n}return""}function vt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Hn(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function qn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=vt(n[1]),a=vt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=vt(e);return{min:r,max:r}}function jn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Vn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),o=r?parseFloat(r[1]):100;return{min:o,max:o}}function zn(t,e){if(!t)return!1;try{let n=new URL(t,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"].some(l=>o.endsWith(l)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let l of e){let i=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(c))return!0}return!1}catch{return!1}}function Xn(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function Me(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,o)=>{let a=(o||"").trim();if(!a||/^data:|^blob:|^https?:|^file:|^about:/i.test(a))return n;let s=a;try{s=new URL(a,e||location.href).href}catch{}return`url("${s}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function Yn(t,e,n){if(!t)return t;let r=new Set;function o(l,i){try{return new URL(l,i||location.href).href}catch{return l}}async function a(l,i,c=0){if(c>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${i}`),l;let u="",f=0,m;for(;m=ne.exec(l);){u+=l.slice(f,m.index),f=ne.lastIndex;let y=(m[2]||m[4]||"").trim(),b=o(y,i);if(r.has(b)){console.warn(`[snapDOM] Skipping circular @import: ${b}`);continue}r.add(b);let d="";try{let h=await L(b,{as:"text",useProxy:n,silent:!0});h.ok&&typeof h.data=="string"&&(d=h.data)}catch{}d?(d=Me(d,b),d=await a(d,b,c+1),u+=` | ||
| /* inlined: ${b} */ | ||
| ${d} | ||
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
There was a problem hiding this comment.
Avoid automated semicolon insertion (94% of all statements in the enclosing function have an explicit semicolon).
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; | |
| `):u+=m[0]} | |
| u += l.slice(f); | |
| return u; | |
| } | |
| let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
| `:""}function Pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function _n(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)await new Promise(a=>setTimeout(a,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null}function Wn(t){let e=t.getBoundingClientRect(),n=0,r=0,o=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,r=parseFloat(i.borderRightWidth)||0,o=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),l=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:l,rect:e}}function Un(t,e,n){let r=t.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Bn(t,e,n){let r=await _n(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=Wn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i={...n,scale:1},c=Un(r,o,a),u;try{u=await l.toPng(r.documentElement,i)}finally{c()}u.style.display="block",u.style.width=`${o}px`,u.style.height=`${a}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),st(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(u),f}async function gt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||At.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide"){let u=document.createElement("div"),f=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Bn(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,st(t,u,e,n),u}else{let u=t.getBoundingClientRect(),f=document.createElement("div");return f.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,st(t,f,e,n),f}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),st(t,c,e,n);let u=document.createElement("div");return u.textContent=t.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}if(t.tagName==="CANVAS"){let c=t.toDataURL(),u=document.createElement("img");return u.src=c,u.width=t.width,u.height=t.height,e.nodeMap.set(u,t),st(t,u,e,n),u}let s;try{if(s=t.cloneNode(!1),xe(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){Ln(t,s);try{let c=t.getBoundingClientRect(),u=Math.round(c.width||0),f=Math.round(c.height||0);if(!u||!f){let m=window.getComputedStyle(t),y=parseFloat(m.width)||0,b=parseFloat(m.height)||0,d=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,p=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;u=Math.round(u||y||d||p||0),f=Math.round(f||b||h||g||0)}u&&(s.dataset.snapdomWidth=String(u)),f&&(s.dataset.snapdomHeight=String(f))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(o=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),st(t,s,e,n),t.shadowRoot){let h=function(g,S){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return S(null);gt(g,e,n).then(x=>{S(x||null)}).catch(()=>{S(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let S of g){let x=[];try{x=S.assignedNodes?.({flatten:!0})||S.assignedNodes?.()||[]}catch{x=S.assignedNodes?.()||[]}for(let C of x)r.add(C)}}catch{}let c=En(e),u=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let f=Fn(t.shadowRoot),m=vn(f,u),y=Rn(f),b=Tn(t,y,u);Nn(s,b+m,c);let d=document.createDocumentFragment(),p=await Zt(Array.from(t.shadowRoot.childNodes),h,n.fast);d.append(...p.filter(g=>!!g)),s.appendChild(d)}if(t.tagName==="SLOT"){let m=function(b,d){gt(b,e,n).then(h=>{h&&Pn(h),d(h||null)}).catch(()=>{d(null)})},c=t.assignedNodes?.({flatten:!0})||[],u=c.length>0?c:Array.from(t.childNodes),f=document.createDocumentFragment(),y=await Zt(Array.from(u),m,n.fast);return f.append(...y.filter(b=>!!b)),f}function l(c,u){if(r.has(c))return u(null);gt(c,e,n).then(f=>{u(f||null)}).catch(()=>{u(null)})}let i=await Zt(Array.from(t.childNodes),l,n.fast);if(s.append(...i.filter(c=>!!c)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let c of s.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s}var On=[/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=[];function Ce(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...On,...te];for(let r of n)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function Ae(t,e,n,r=32,o="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let l=s.getBoundingClientRect(),i=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,i*a),u.height=Math.max(1,c*a);let f=u.getContext("2d");return f.scale(a,a),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=o,f.fillText(t,0,0),{dataUrl:u.toDataURL(),width:i,height:c}}var Dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Ft(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Dn.has(n.toLowerCase()))return n}return""}function vt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Hn(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function qn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=vt(n[1]),a=vt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=vt(e);return{min:r,max:r}}function jn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Vn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),o=r?parseFloat(r[1]):100;return{min:o,max:o}}function zn(t,e){if(!t)return!1;try{let n=new URL(t,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"].some(l=>o.endsWith(l)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let l of e){let i=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(c))return!0}return!1}catch{return!1}}function Xn(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function Me(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,o)=>{let a=(o||"").trim();if(!a||/^data:|^blob:|^https?:|^file:|^about:/i.test(a))return n;let s=a;try{s=new URL(a,e||location.href).href}catch{}return`url("${s}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function Yn(t,e,n){if(!t)return t;let r=new Set;function o(l,i){try{return new URL(l,i||location.href).href}catch{return l}}async function a(l,i,c=0){if(c>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${i}`),l;let u="",f=0,m;for(;m=ne.exec(l);){u+=l.slice(f,m.index),f=ne.lastIndex;let y=(m[2]||m[4]||"").trim(),b=o(y,i);if(r.has(b)){console.warn(`[snapDOM] Skipping circular @import: ${b}`);continue}r.add(b);let d="";try{let h=await L(b,{as:"text",useProxy:n,silent:!0});h.ok&&typeof h.data=="string"&&(d=h.data)}catch{}d?(d=Me(d,b),d=await a(d,b,c+1),u+=` | ||
| /* inlined: ${b} */ | ||
| ${d} | ||
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
There was a problem hiding this comment.
This expression always evaluates to false.
| `:""}function Pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function _n(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)await new Promise(a=>setTimeout(a,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null}function Wn(t){let e=t.getBoundingClientRect(),n=0,r=0,o=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,r=parseFloat(i.borderRightWidth)||0,o=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),l=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:l,rect:e}}function Un(t,e,n){let r=t.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Bn(t,e,n){let r=await _n(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=Wn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i={...n,scale:1},c=Un(r,o,a),u;try{u=await l.toPng(r.documentElement,i)}finally{c()}u.style.display="block",u.style.width=`${o}px`,u.style.height=`${a}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),st(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(u),f}async function gt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||At.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide"){let u=document.createElement("div"),f=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${c}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),u=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,c}else if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Bn(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,st(t,u,e,n),u}else{let u=t.getBoundingClientRect(),f=document.createElement("div");return f.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,st(t,f,e,n),f}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),st(t,c,e,n);let u=document.createElement("div");return u.textContent=t.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}if(t.tagName==="CANVAS"){let c=t.toDataURL(),u=document.createElement("img");return u.src=c,u.width=t.width,u.height=t.height,e.nodeMap.set(u,t),st(t,u,e,n),u}let s;try{if(s=t.cloneNode(!1),xe(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){Ln(t,s);try{let c=t.getBoundingClientRect(),u=Math.round(c.width||0),f=Math.round(c.height||0);if(!u||!f){let m=window.getComputedStyle(t),y=parseFloat(m.width)||0,b=parseFloat(m.height)||0,d=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,p=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;u=Math.round(u||y||d||p||0),f=Math.round(f||b||h||g||0)}u&&(s.dataset.snapdomWidth=String(u)),f&&(s.dataset.snapdomHeight=String(f))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(o=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),st(t,s,e,n),t.shadowRoot){let h=function(g,S){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return S(null);gt(g,e,n).then(x=>{S(x||null)}).catch(()=>{S(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let S of g){let x=[];try{x=S.assignedNodes?.({flatten:!0})||S.assignedNodes?.()||[]}catch{x=S.assignedNodes?.()||[]}for(let C of x)r.add(C)}}catch{}let c=En(e),u=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let f=Fn(t.shadowRoot),m=vn(f,u),y=Rn(f),b=Tn(t,y,u);Nn(s,b+m,c);let d=document.createDocumentFragment(),p=await Zt(Array.from(t.shadowRoot.childNodes),h,n.fast);d.append(...p.filter(g=>!!g)),s.appendChild(d)}if(t.tagName==="SLOT"){let m=function(b,d){gt(b,e,n).then(h=>{h&&Pn(h),d(h||null)}).catch(()=>{d(null)})},c=t.assignedNodes?.({flatten:!0})||[],u=c.length>0?c:Array.from(t.childNodes),f=document.createDocumentFragment(),y=await Zt(Array.from(u),m,n.fast);return f.append(...y.filter(b=>!!b)),f}function l(c,u){if(r.has(c))return u(null);gt(c,e,n).then(f=>{u(f||null)}).catch(()=>{u(null)})}let i=await Zt(Array.from(t.childNodes),l,n.fast);if(s.append(...i.filter(c=>!!c)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let c of s.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s}var On=[/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=[];function Ce(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...On,...te];for(let r of n)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function Ae(t,e,n,r=32,o="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let l=s.getBoundingClientRect(),i=Math.ceil(l.width),c=Math.ceil(l.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,i*a),u.height=Math.max(1,c*a);let f=u.getContext("2d");return f.scale(a,a),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=o,f.fillText(t,0,0),{dataUrl:u.toDataURL(),width:i,height:c}}var Dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Ft(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Dn.has(n.toLowerCase()))return n}return""}function vt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Hn(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function qn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=vt(n[1]),a=vt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=vt(e);return{min:r,max:r}}function jn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Vn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),o=r?parseFloat(r[1]):100;return{min:o,max:o}}function zn(t,e){if(!t)return!1;try{let n=new URL(t,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"].some(l=>o.endsWith(l)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let l of e){let i=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(c))return!0}return!1}catch{return!1}}function Xn(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function Me(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,o)=>{let a=(o||"").trim();if(!a||/^data:|^blob:|^https?:|^file:|^about:/i.test(a))return n;let s=a;try{s=new URL(a,e||location.href).href}catch{}return`url("${s}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function Yn(t,e,n){if(!t)return t;let r=new Set;function o(l,i){try{return new URL(l,i||location.href).href}catch{return l}}async function a(l,i,c=0){if(c>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${i}`),l;let u="",f=0,m;for(;m=ne.exec(l);){u+=l.slice(f,m.index),f=ne.lastIndex;let y=(m[2]||m[4]||"").trim(),b=o(y,i);if(r.has(b)){console.warn(`[snapDOM] Skipping circular @import: ${b}`);continue}r.add(b);let d="";try{let h=await L(b,{as:"text",useProxy:n,silent:!0});h.ok&&typeof h.data=="string"&&(d=h.data)}catch{}d?(d=Me(d,b),d=await a(d,b,c+1),u+=` | ||
| /* inlined: ${b} */ | ||
| ${d} | ||
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
There was a problem hiding this comment.
This expression always evaluates to false.
| `):u+=m[0]}return u+=l.slice(f),u}let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; | |
| `):u+=m[0]} | |
| u += l.slice(f); | |
| return u; | |
| }let s=Me(t,e||location.href);return s=await a(s,e||location.href,0),s}var $e=/url\((["']?)([^"')]+)\1\)/g,Gn=/@font-face[^{}]*\{[^}]*\}/g;function ve(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let o=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let a=o[1],s=o[2],l=i=>{if(!i.includes("?"))return parseInt(i,16);let c=parseInt(i.replace(/\?/g,"0"),16),u=parseInt(i.replace(/\?/g,"F"),16);return[c,u]};if(s){let i=l(a),c=l(s),u=Array.isArray(i)?i[0]:i,f=Array.isArray(c)?c[1]:c;e.push([Math.min(u,f),Math.max(u,f)])}else{let i=l(a);Array.isArray(i)?e.push([i[0],i[1]]):e.push([i,i])}}return e}function Ee(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,o]of e)if(n>=r&&n<=o)return!0;return!1}function re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll($e)){let o=(r[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,e||location.href).href}catch{}n.push(o)}}return n}async function Fe(t,e,n=""){let r=t;for(let o of t.matchAll($e)){let a=tt(o[0]);if(!a)continue;let s=a;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!B(s)){if(w.resource?.has(s)){w.font?.add(s),r=r.replace(o[0],`url(${w.resource.get(s)})`);continue}if(!w.font?.has(s))try{let l=await L(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let i=l.data;w.resource?.set(s,i),w.font?.add(s),r=r.replace(o[0],`url(${i})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Kn(t){if(!t.length)return null;let e=(l,i)=>t.some(([c,u])=>!(u<l||c>i)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),o=e(880,1023),a=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":a?"cyrillic":o?"greek":r?"latin-ext":n?"latin":null}function ke(t={}){let e=new Set((t.families||[]).map(o=>String(o).toLowerCase())),n=new Set((t.domains||[]).map(o=>String(o).toLowerCase())),r=new Set((t.subsets||[]).map(o=>String(o).toLowerCase()));return(o,a)=>{if(e.size&&e.has(o.family.toLowerCase()))return!0;if(n.size)for(let s of o.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Kn(a);if(s&&r.has(s))return!0}return!1}}function Jn(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let a of t.match(e)||[]){let s=a.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Ft(s),i=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),c=(a.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(a.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),y=re(m,location.href),b=y.length?y.map(h=>String(h).toLowerCase()).sort().join("|"):m.toLowerCase(),d=[String(l||"").toLowerCase(),i,c,u,f.toLowerCase(),b].join("|");n.has(d)||(n.add(d),r.push(a))}if(r.length===0)return t;let o=0;return t.replace(e,()=>r[o++]||"")}function Qn(t,e,n,r){let o=Array.from(t||[]).sort().join("|"),a=e?JSON.stringify({families:(e.families||[]).map(i=>String(i).toLowerCase()).sort(),domains:(e.domains||[]).map(i=>String(i).toLowerCase()).sort(),subsets:(e.subsets||[]).map(i=>String(i).toLowerCase()).sort()}):"",s=(n||[]).map(i=>`${(i.family||"").toLowerCase()}::${i.weight||"normal"}::${i.style||"normal"}::${i.src||""}`).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${r||""}`}async function Ne(t,e,n,r){let o;try{o=t.cssRules||[]}catch{return}let a=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of o){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?a(s.href,e):e;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${l}`);continue}if(l&&r.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&r.visitedSheets.add(l);let i={...r,depth:(r.depth||0)+1};await Ne(s.styleSheet,l,n,i);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),i=Ft(l);if(!i||B(i))continue;let c=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),y=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(i,u,c,f))continue;let b=ve(y);if(!Ee(r.usedCodepoints,b))continue;let d={family:i,weightSpec:c,styleSpec:u,stretchSpec:f,unicodeRange:y,srcRaw:m,srcUrls:re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,b))continue;if(/url\(/i.test(m)){let h=await Fe(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${i};src:${h};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}else await n(`@font-face{font-family:${i};src:${m};font-style:${u};font-weight:${c};font-stretch:${f};${y?`unicode-range:${y};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let d of t){let[h,p,g,S]=String(d).split("__");if(!h)continue;let x=a.get(h)||[];x.push({w:parseInt(p,10),s:g,st:parseInt(S,10)}),a.set(h,x)}function s(d,h,p,g){if(!a.has(d))return!1;let S=a.get(d),x=qn(p),C=jn(h),M=Vn(g),A=x.min!==x.max,P=x.min,W=$=>C.kind==="normal"&&$==="normal"||C.kind!=="normal"&&($==="italic"||$==="oblique"),N=!1;for(let $ of S){let k=A?$.w>=x.min&&$.w<=x.max:$.w===P,_=W(ee($.s)),O=$.st>=M.min&&$.st<=M.max;if(k&&_&&O){N=!0;break}}if(N)return!0;if(!A)for(let $ of S){let k=W(ee($.s)),_=$.st>=M.min&&$.st<=M.max;if(Math.abs(P-$.w)<=300&&k&&_)return!0}return!1}let l=ke(n),i=Qn(t,n,r,o);if(w.resource?.has(i))return w.resource.get(i);let c=Xn(t),u=[],f=ne;for(let d of document.querySelectorAll("style")){let h=d.textContent||"";for(let p of h.matchAll(f)){let g=(p[2]||p[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||u.push(g)}}u.length&&await Promise.all(u.map(d=>new Promise(h=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return h(null);let p=document.createElement("link");p.rel="stylesheet",p.href=d,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>h(p),p.onerror=()=>h(null),document.head.appendChild(p)})));let m="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(B(d.href))continue;let h="",p=!1;try{p=new URL(d.href,location.href).origin===location.origin}catch{}if(!p&&!zn(d.href,c))continue;if(p){let S=Array.from(document.styleSheets).find(x=>x.href===d.href);if(S)try{let x=S.cssRules||[];h=Array.from(x).map(C=>C.cssText).join("")}catch{}}if(!h&&(h=(await L(d.href,{as:"text",useProxy:o})).data,B(d.href)))continue;h=await Yn(h,d.href,o);let g="";for(let S of h.match(Gn)||[]){let x=(S.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Ft(x);if(!C||B(C))continue;let M=(S.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),A=(S.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(S.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(S.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(S.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=re(N,d.href);if(!s(C,A,M,P))continue;let k=ve(W);if(!Ee(e,k))continue;let _={family:C,weightSpec:M,styleSpec:A,stretchSpec:P,unicodeRange:W,srcRaw:N,srcUrls:$,href:d.href};if(n&&l(_,k))continue;let O=/url\(/i.test(N)?await Fe(S,d.href,o):S;g+=O}g.trim()&&(m+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let b={requiredIndex:a,usedCodepoints:e,faceMatchesRequired:s,simpleExcluder:n?ke(n):null,useProxy:o,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(h=>h.href===d.href)))try{let h=d.href||location.href;h&&b.visitedSheets.add(h),await Ne(d,h,async p=>{m+=p},b)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let h=String(d.family).replace(/^['"]+|['"]+$/g,"");if(B(h)||!a.has(h)||n?.families&&n.families.some(g=>String(g).toLowerCase()===h.toLowerCase()))continue;let p=d._snapdomSrc;if(!String(p).startsWith("data:")){if(w.resource?.has(d._snapdomSrc))p=w.resource.get(d._snapdomSrc),w.font?.add(d._snapdomSrc);else if(!w.font?.has(d._snapdomSrc))try{let g=await L(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(g.ok&&typeof g.data=="string")p=g.data,w.resource?.set(d._snapdomSrc,p),w.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}m+=`@font-face{font-family:'${h}';src:url(${p});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let h=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!h||B(h)||!a.has(h)||n?.families&&n.families.some(M=>String(M).toLowerCase()===h.toLowerCase()))continue;let p=d.weight!=null?String(d.weight):"normal",g=d.style!=null?String(d.style):"normal",S=d.stretchPct!=null?`${d.stretchPct}%`:"100%",x=String(d.src||""),C=x;if(!C.startsWith("data:")){if(w.resource?.has(x))C=w.resource.get(x),w.font?.add(x);else if(!w.font?.has(x))try{let M=await L(x,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")C=M.data,w.resource?.set(x,C),w.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${h}';src:url(${C});font-style:${g};font-weight:${p};font-stretch:${S};}`}return m&&(m=Jn(m),w.resource?.set(i,m)),m}function Lt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let l=Ft(s.fontFamily);if(!l)return;let i=(c,u,f)=>`${l}__${vt(c)}__${ee(u)}__${Hn(f)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&r(a);n.nextNode();){let s=n.currentNode,l=getComputedStyle(s);r(l);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function Rt(t){let e=new Set,n=o=>{if(o)for(let a of o)e.add(a.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let o=r.currentNode;if(o.nodeType===Node.TEXT_NODE)n(o.nodeValue||"");else if(o.nodeType===Node.ELEMENT_NODE){let a=o;for(let s of["::before","::after"]){let i=getComputedStyle(a,s)?.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let c=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let u of c)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function It(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let o=document.createElement("div");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=document.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)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Zn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Le(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Re(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),o="";for(let[a,s]of n)for(;r>=a;)o+=s,r-=a;return e?o:o.toLowerCase()}function Ie(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Le(t,!1);case"upper-alpha":return Le(t,!0);case"lower-roman":return Re(t,!1);case"upper-roman":return Re(t,!0);default:return String(Math.max(0,t))}}function Pe(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let u=0,f=c?.parentElement;if(!f)return 0;for(let m of f.children){if(m===c)break;m.tagName==="LI"&&u++}return u},a=c=>{let u=new Map;for(let[f,m]of c)u.set(f,m.slice());return u},s=(c,u,f)=>{let m=a(c),y;try{y=f.style?.counterReset||getComputedStyle(f).counterReset}catch{}if(y&&y!=="none")for(let d of y.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!p)continue;let S=u.get(p);if(S&&S.length){let x=S.slice();x.push(g),m.set(p,x)}else m.set(p,[g])}let b;try{b=f.style?.counterIncrement||getComputedStyle(f).counterIncrement}catch{}if(b&&b!=="none")for(let d of b.split(",")){let h=d.trim().split(/\s+/),p=h[0],g=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!p)continue;let S=m.get(p)||[];S.length===0&&S.push(0),S[S.length-1]+=g,m.set(p,S)}try{if(getComputedStyle(f).display==="list-item"&&r(f)){let h=f.parentElement,p=1;if(h&&h.tagName==="OL"){let S=h.getAttribute("start"),x=Number.isFinite(Number(S))?Number(S):1,C=o(f),M=f.getAttribute("value");p=Number.isFinite(Number(M))?Number(M):x+C}else p=1+o(f);let g=m.get("list-item")||[];g.length===0&&g.push(0),g[g.length-1]=p,m.set("list-item",g)}}catch{}return m},l=(c,u,f)=>{let m=s(f,u,c);e.set(c,m);let y=m;for(let b of c.children)y=l(b,m,y);return m},i=new Map;return l(n,i,i),{get(c,u){let f=e.get(c)?.get(u);return f&&f.length?f[f.length-1]:0},getStack(c,u){let f=e.get(c)?.get(u);return f?f.slice():[]}}}function _e(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,l)=>{let i=String(l).split(",").map(c=>c.trim());if(s==="counter"){let c=i[0]?.replace(/^["']|["']$/g,""),u=(i[1]||"decimal").toLowerCase(),f=n.get(e,c);return Ie(f,u)}else{let c=i[0]?.replace(/^["']|["']$/g,""),u=i[1]?.replace(/^["']|["']$/g,"")??"",f=(i[2]||"decimal").toLowerCase(),m=n.getStack(e,c);return m.length?m.map(b=>Ie(b,f)).join(u):""}});return Zn(o)}catch{return"- "}}var yt=null,wt=new WeakMap;function tr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function er(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):tr(t)}function oe(t,e){let n=t.parentElement,r=n?wt.get(n):null;return r?{get(o,a){let s=e.get(o,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(o,a){let s=e.getStack(o,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let i=s.slice();return i[i.length-1]=Math.max(i[i.length-1],l),i}return s}}:e}function se(t,e,n){let r=new Map;function o(i){let c=[];if(!i||i==="none")return c;for(let u of String(i).split(",")){let f=u.trim().split(/\s+/),m=f[0],y=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&c.push({name:m,num:y})}return c}let a=o(e?.counterReset),s=o(e?.counterIncrement);function l(i){if(r.has(i))return r.get(i).slice();let c=n.getStack(t,i);c=c.length?c.slice():[];let u=a.find(m=>m.name===i);if(u){let m=Number.isFinite(u.num)?u.num:0;c=c.length?[...c,m]:[m]}let f=s.find(m=>m.name===i);if(f){let m=Number.isFinite(f.num)?f.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return r.set(i,c.slice()),c}return{get(i,c){let u=l(c);return u.length?u[u.length-1]:0},getStack(i,c){return l(c)},__incs:s}}function nr(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let o=r?.content;if(!o||o==="none"||o==="normal")return{text:"",incs:[]};let a=oe(t,n),s=se(t,r,a),l=Te(o)?_e(o,t,s):o;return{text:er(l),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;if(!yt)try{yt=Pe(t.ownerDocument||document)}catch{}for(let s of["::before","::after","::first-letter"])try{let l=rt(t,s);if(!l||typeof l[Symbol.iterator]!="function"||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let v=getComputedStyle(t);if(!(l.color!==v.color||l.fontSize!==v.fontSize||l.fontWeight!==v.fontWeight))continue;let R=Array.from(e.childNodes).find(ft=>ft.nodeType===Node.TEXT_NODE&&ft.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,H=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],it=I.slice(H?.length||0);if(!H||/[\uD800-\uDFFF]/.test(H))continue;let J=document.createElement("span");J.textContent=H,J.dataset.snapdomPseudo="::first-letter";let xt=$t(l),Bt=ut(xt,"span");n.styleMap.set(J,Bt);let Ct=document.createTextNode(it);e.replaceChild(Ct,R),e.insertBefore(J,Ct);continue}let c=l.content,{text:u,incs:f}=nr(t,s,yt),m=l.backgroundImage,y=l.backgroundColor,b=l.fontFamily,d=parseInt(l.fontSize)||32,h=parseInt(l.fontWeight)||!1,p=l.color||"#000",g=l.borderStyle,S=parseFloat(l.borderWidth),x=l.transform,C=B(b),M=c!=="none"&&u!=="",A=m&&m!=="none",P=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",W=g&&g!=="none"&&S>0,N=x&&x!=="none";if(!(M||A||P||W||N)){if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map;for(let{name:F}of f){if(!F)continue;let R=oe(t,yt),D=se(t,getComputedStyle(t,s),R).get(t,F);v.set(F,D)}wt.set(t.parentElement,v)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=s,k.style.verticalAlign="middle",k.style.pointerEvents="none";let _=$t(l),O=ut(_,"span");if(n.styleMap.set(k,O),C&&u&&u.length===1){let{dataUrl:v,width:F,height:R}=await Ae(u,b,h,d,p),I=document.createElement("img");I.src=v,I.style=`height:${d}px;width:${F/R*d}px;object-fit:contain;`,k.appendChild(I),e.dataset.snapdomHasIcon="true"}else if(u&&u.startsWith("url(")){let v=tt(u);if(v?.trim())try{let F=document.createElement("img"),R=await L(Y(v),{as:"dataURL",useProxy:r.useProxy});F.src=R.data,F.style=`width:${d}px;height:auto;object-fit:contain;`,k.appendChild(F)}catch(F){console.error(`[snapdom] Error in pseudo ${s} for`,t,F)}}else!C&&M&&(k.textContent=u);if(k.style.background="none","mask"in k.style&&(k.style.mask="none"),A)try{let v=ot(m),F=await Promise.all(v.map(nt));k.style.backgroundImage=F.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${s}`,v)}P&&(k.style.backgroundColor=y);let K=k.childNodes.length>0||k.textContent?.trim()!==""||A||P||W||N;if(f&&f.length&&t.parentElement){let v=wt.get(t.parentElement)||new Map,F=oe(t,yt),R=se(t,getComputedStyle(t,s),F);for(let{name:I}of f){if(!I)continue;let D=R.get(t,I);v.set(I,D)}wt.set(t.parentElement,v)}if(!K)continue;s==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,t,l)}let o=Array.from(t.children),a=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(o.length,a.length);s++)await ae(o[s],a[s],n,r)}function We(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(l=>{let i=l.getAttribute("xlink:href")||l.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(l=>l.tagName.toLowerCase()==="symbol"),o=n.filter(l=>l.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(l=>{s.add(l.id)}),e.forEach(l=>{if(s.has(l))return;let i=r.find(c=>c.id===l);if(i){a.appendChild(i.cloneNode(!0)),s.add(l);return}for(let c of o){let u=c.querySelector(`#${CSS.escape(l)}`);if(u){let f=a.querySelector("defs");f||(f=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(f)),f.appendChild(u.cloneNode(!0)),s.add(l);break}}})}function Be(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),o=t.clientHeight,a="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let l=s.currentNode,i=getComputedStyle(l),c=i.position;if(c!=="sticky"&&c!=="-webkit-sticky")continue;let u=Ue(i.top),f=Ue(i.bottom);if(u==null&&f==null)continue;let m=rr(l,t),y=or(e,m,a);if(!y)continue;let b=l.getBoundingClientRect(),d=b.width,h=b.height,p=b.left-r.left;if(!(d>0&&h>0)||!Number.isFinite(p))continue;let g=u!=null?u+n:n+(o-h-f);if(!Number.isFinite(g))continue;let S=Number.parseInt(i.zIndex,10),x=Number.isFinite(S),C=x?Math.max(S,1)+1:2,M=x?S-1:0,A=y.cloneNode(!1);A.setAttribute(a,"1"),A.style.position="sticky",A.style.left=`${p}px`,A.style.top=`${g}px`,A.style.width=`${d}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(M),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",y.parentElement?.insertBefore(A,y),y.style.position="absolute",y.style.left=`${p}px`,y.style.top=`${g}px`,y.style.bottom="auto",y.style.zIndex=String(C),y.style.pointerEvents="none"}}function Ue(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function rr(t,e){let n=[];for(let r=t;r&&r!==e;){let o=r.parentElement;if(!o)break;n.push(Array.prototype.indexOf.call(o.children,r)),r=o}return n.reverse()}function or(t,e,n){let r=t;for(let o=0;o<e.length;o++)if(r=sr(r,n)[e[o]],!r)return null;return r instanceof HTMLElement?r:null}function sr(t,e){let n=[],r=t.children;for(let o=0;o<r.length;o++){let a=r[o];a.hasAttribute(e)||n.push(a)}return n}async function De(t,e={}){let n={styleMap:w.session.styleMap,styleCache:w.session.styleCache,nodeMap:w.session.nodeMap},r,o="",a="";ar(t);try{We(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await gt(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await ae(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await ur(r);try{let i=r.querySelectorAll("style[data-sd]");for(let c of i)a+=c.textContent||"",c.remove()}catch{}let s=Kt(n.styleMap);o=Array.from(s.entries()).map(([i,c])=>`.${c}{${i}}`).join(""),o=a+o;for(let[i,c]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",c.replace(/;/g,"; "));continue}let u=s.get(c);u&&i.classList.add(u);let f=i.style?.backgroundImage,m=i.dataset?.snapdomHasIcon;f&&f!=="none"&&(i.style.backgroundImage=f),m&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,c]of n.nodeMap.entries()){let u=c.scrollLeft,f=c.scrollTop;if((u||f)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-u}px, ${-f}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";i.firstChild;)y.appendChild(i.firstChild);i.appendChild(y)}}let l=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Be(t,l),t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let c=jt(i.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=c||""}for(let[i,c]of n.nodeMap.entries())c.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function ar(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,l=o==="none"||parseFloat(a)===0;s&&l&&(t.style.border=`${r} solid transparent`)}var bt=new Map;async function St(t){if(w.resource?.has(t))return w.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await L(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return w.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await St(r);n=n.split(r).join(o)}catch{}return n}function Tt(t){return typeof t=="string"&&t.startsWith("blob:")}function cr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function lr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ur(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let i=s.getAttribute("src")||s.currentSrc||"";if(Tt(i)){let u=await St(i);s.setAttribute("src",u)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let u=cr(c),f=!1;for(let m of u)if(Tt(m.url))try{m.url=await St(m.url),f=!0}catch{}f&&s.setAttribute("srcset",lr(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let l="http://www.w3.org/1999/xlink",i=s.getAttribute("href")||s.getAttributeNS?.(l,"href");if(Tt(i)){let c=await St(i);s.setAttribute("href",c),s.removeAttributeNS?.(l,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let l=s.getAttribute("style");if(l&&l.includes("blob:")){let i=await Oe(l);s.setAttribute("style",i)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of o)try{let l=s.textContent||"";l.includes("blob:")&&(s.textContent=await Oe(l))}catch{}let a=["poster"];for(let s of a){let l=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let i of l)try{let c=i.getAttribute(s);Tt(c)&&i.setAttribute(s,await St(c))}catch{}}}async function He(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let u=o.currentSrc||o.src||"";u&&o.setAttribute("src",u)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let a=o.src||"";if(!a)return;let s=await L(a,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){o.src=s.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let u=parseInt(o.dataset?.snapdomWidth||"",10)||0,f=parseInt(o.dataset?.snapdomHeight||"",10)||0,m=parseInt(o.getAttribute("width")||"",10)||0,y=parseInt(o.getAttribute("height")||"",10)||0,b=parseFloat(o.style?.width||"")||0,d=parseFloat(o.style?.height||"")||0,h=u||b||m||o.width||void 0,p=f||d||y||o.height||void 0,g=typeof l=="function"?await l({width:h,height:p,src:a,element:o}):l;if(g){let S=await L(g,{as:"dataURL",useProxy:e.useProxy});o.src=S.data,!o.width&&h&&(o.width=h),!o.height&&p&&(o.height=p),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let i=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${i}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",o.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${i}px;height:${c}px;visibility:hidden;`,o.replaceWith(u)}};for(let o=0;o<n.length;o+=4){let a=n.slice(o,o+4).map(r);await Promise.allSettled(a)}}async function Pt(t,e,n,r={}){let o=[[t,e]],a=["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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[i,c]=o.shift(),u=n.get(i)||rt(i);n.has(i)||n.set(i,u);let f=(()=>{let b=u.getPropertyValue("border-image"),d=u.getPropertyValue("border-image-source");return b&&b!=="none"||d&&d!=="none"})();for(let b of a){let d=u.getPropertyValue(b);if(!d||d==="none")continue;let h=ot(d),p=await Promise.all(h.map(g=>nt(g,r)));p.some(g=>g&&g!=="none"&&!/^url\(undefined/.test(g))&&c.style.setProperty(b,p.join(", "))}for(let b of s){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}if(f)for(let b of l){let d=u.getPropertyValue(b);!d||d==="initial"||c.style.setProperty(b,d)}let m=Array.from(i.children),y=Array.from(c.children);for(let b=0;b<Math.min(m.length,y.length);b++)o.push([m[b],y[b]])}}function qe(t){if(!t)return()=>{};let e=fr(t);if(e<=0)return()=>{};if(!hr(t))return()=>{};let n=getComputedStyle(t),r=Math.round(dr(n)*e+mr(n)),o=t.textContent??"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,l=o.length,i=-1;for(;s<=l;){let c=s+l>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(i=c,s=c+1):l=c-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function fr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function dr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function mr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function pr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}async function ce(t,e){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,r=!!e.straighten,o=!!e.noShadows,a,s,l,i="",c="",u,f,m=null,y=qe(t);try{({clone:a,classCSS:s,styleCache:l}=await De(t,e)),r&&a&&(m=gr(t,a)),o&&a&&pr(t,a)}finally{y()}await new Promise(p=>{j(async()=>{await He(a,e),p()},{fast:n})}),await new Promise(p=>{j(async()=>{await Pt(t,a,l,e),p()},{fast:n})}),e.embedFonts&&await new Promise(p=>{j(async()=>{let g=Lt(t),S=Rt(t);if(T()){let x=new Set(Array.from(g).map(C=>String(C).split("__")[0]).filter(Boolean));await It(x,1)}i=await Nt({required:g,usedCodepoints:S,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),p()},{fast:n})});let b=Yt(a).sort(),d=b.join(",");w.baseStyle.has(d)?c=w.baseStyle.get(d):await new Promise(p=>{j(()=>{c=Gt(b),w.baseStyle.set(d,c),p()},{fast:n})}),await new Promise(p=>{j(()=>{let g=getComputedStyle(t);function S(q){let U=`${q.filter||""} ${q.webkitFilter||""}`.trim();if(!U||U==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let X=U.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],Q=0,dt=0,mt=0,ht=0,Z=!1;for(let en of X){Z=!0;let nn=en.match(/-?\d+(?:\.\d+)?px/gi)?.map(rn=>parseFloat(rn))||[],[Ht=0,qt=0,de=0]=nn,me=Math.abs(Ht)+de,he=Math.abs(qt)+de;dt=Math.max(dt,me+Math.max(Ht,0)),ht=Math.max(ht,me+Math.max(-Ht,0)),mt=Math.max(mt,he+Math.max(qt,0)),Q=Math.max(Q,he+Math.max(-qt,0))}return{bleed:{top:Math.ceil(Q),right:Math.ceil(dt),bottom:Math.ceil(mt),left:Math.ceil(ht)},has:Z}}let x=t.getBoundingClientRect(),C=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(g.width)||x.width||1)),M=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(g.height)||x.height||1)),A=(q,U=NaN)=>{let X=typeof q=="string"?parseFloat(q):q;return Number.isFinite(X)?X:U},P=A(e.width),W=A(e.height),N=C,$=M,k=Number.isFinite(P),_=Number.isFinite(W),O=M>0?C/M:1;k&&_?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(W))):k?(N=Math.max(1,Math.ceil(P)),$=Math.max(1,Math.ceil(N/(O||1)))):_?($=Math.max(1,Math.ceil(W)),N=Math.max(1,Math.ceil($*(O||1)))):(N=C,$=M);let at=0,K=0,v=C,F=M;if(r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=je(C,M,q,0,0);at=U.minX,K=U.minY,v=U.maxX,F=U.maxY}else if(!r&&Sr(t)){let U=g.transform&&g.transform!=="none"?g.transform:"",X=xr(t),Q=Ar({baseTransform:U,rotate:X.rotate||"0deg",scale:X.scale,translate:X.translate}),{ox:dt,oy:mt}=Mr(g,C,M),ht=Q.is2D?Q:new DOMMatrix(Q.toString()),Z=je(C,M,ht,dt,mt);at=Z.minX,K=Z.minY,v=Z.maxX,F=Z.maxY}let R=yr(g),I=wr(g),D=br(g),H=S(g),it=o?{top:0,right:0,bottom:0,left:0}:{top:R.top+I.top+D.top+H.bleed.top,right:R.right+I.right+D.right+H.bleed.right,bottom:R.bottom+I.bottom+D.bottom+H.bleed.bottom,left:R.left+I.left+D.left+H.bleed.left};at-=it.left,K-=it.top,v+=it.right,F+=it.bottom;let J=Math.max(1,Math.ceil(v-at)),xt=Math.max(1,Math.ceil(F-K)),Bt=Math.max(1,Math.round(J*(k||_?N/C:1))),Ct=Math.max(1,Math.round(xt*(_||k?$/M:1))),ft="http://www.w3.org/2000/svg",V=(T()?1:0)+(r?1:0),z=document.createElementNS(ft,"foreignObject"),Ke=Math.floor(at),Je=Math.floor(K);z.setAttribute("x",String(-(Ke-V))),z.setAttribute("y",String(-(Je-V))),z.setAttribute("width",String(Math.ceil(C+V*2))),z.setAttribute("height",String(Math.ceil(M+V*2))),z.style.overflow="visible";let ue=document.createElement("style");ue.textContent=c+i+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s,z.appendChild(ue);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${C}px`,ct.style.height=`${M}px`,ct.style.overflow="visible",a.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(a),z.appendChild(ct);let Qe=new XMLSerializer().serializeToString(z),Ot=J+V*2,Dt=xt+V*2,fe=k||_;e.meta={w0:C,h0:M,vbW:Ot,vbH:Dt,targetW:N,targetH:$};let Ze=T()&&fe?Ot:Bt+V*2,tn=T()&&fe?Dt:Ct+V*2;f=`<svg xmlns="${ft}" width="${Ze}" height="${tn}" viewBox="0 0 ${Ot} ${Dt}">`+Qe+"</svg>",u=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,p()},{fast:n})});let h=document.getElementById("snapdom-sandbox");return h&&h.style.position==="absolute"&&h.remove(),u}function gr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let a=Ve(t);if(a.a===1&&a.b===0&&a.c===0&&a.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(s=>parseFloat(s.trim()));if(a.length===6&&a.every(Number.isFinite)){let[s,l,i,c]=a,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,y=0,b=0,d=0,h=0;u>0&&(f=s/u,m=l/u,y=f*i+m*c,b=i-f*y,d=c-m*y,h=Math.sqrt(b*b+d*d)||0,h>0?y=y/h:y=0);let p=u,g=0,S=y*h,x=h;try{e.style.transform=`matrix(${p}, ${g}, ${S}, ${x}, 0, 0)`}catch{}return{a:p,b:g,c:S,d:x}}}try{let a=String(r).trim();return e.style.transform=a+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function yr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),r=0,o=0,a=0,s=0;for(let l of n){let i=l.match(/-?\d+(\.\d+)?px/g)?.map(d=>parseFloat(d))||[];if(i.length<2)continue;let[c,u,f=0,m=0]=i,y=Math.abs(c)+f+m,b=Math.abs(u)+f+m;o=Math.max(o,y+Math.max(c,0)),s=Math.max(s,y+Math.max(-c,0)),a=Math.max(a,b+Math.max(u,0)),r=Math.max(r,b+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(o),bottom:Math.ceil(a),left:Math.ceil(s)}}function wr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function br(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function je(t,e,n,r,o){let a=n.a,s=n.b,l=n.c,i=n.d,c=n.e||0,u=n.f||0;function f(p,g){let S=p-r,x=g-o,C=a*S+l*x,M=s*S+i*x;return C+=r+c,M+=o+u,[C,M]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],y=1/0,b=1/0,d=-1/0,h=-1/0;for(let[p,g]of m)p<y&&(y=p),g<b&&(b=g),p>d&&(d=p),g>h&&(h=g);return{minX:y,minY:b,maxX:d,maxY:h,width:d-y,height:h-b}}function Sr(t){return Cr(t)}function Ve(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=i=>{try{return typeof n.has=="function"&&!n.has(i)||typeof n.get!="function"?null:n.get(i)}catch{return null}},a=o("rotate");if(a)if(a.angle){let i=a.angle;e.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit}else a.unit?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(a);else{let i=getComputedStyle(t);e.rotate=i.rotate&&i.rotate!=="none"?i.rotate:"0deg"}let s=o("scale");if(s){let i="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,c="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:i;e.scale=`${i} ${c}`}else{let i=getComputedStyle(t);e.scale=i.scale&&i.scale!=="none"?i.scale:null}let l=o("translate");if(l){let i="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,c="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${i}${u} ${c}${f}`}else{let i=getComputedStyle(t);e.translate=i.translate&&i.translate!=="none"?i.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}function Cr(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let o=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",a=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(o||a||s)}function Mr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[o,a]=[r[0]||"0",r[1]||"0"],s=(l,i)=>{let c=l.toLowerCase();return c==="left"||c==="top"?0:c==="center"?i/2:c==="right"||c==="bottom"?i:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*i/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:s(o,e),oy:s(a,n)}}var ie=null;function kr(){if(ie)return ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),ie=t,t}function Ar(t){let e=kr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ve(n);return e.removeChild(n),r}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ze(t={}){let e=t.format??"png",n=$r(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}function vr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Er(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Fr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===";"&&r===0?(e.push(n),n=""):n+=a}return n.trim()&&e.push(n),e.map(o=>o.trim()).filter(Boolean)}function Lr(t){let e=[],n="",r=0;for(let a=0;a<t.length;a++){let s=t[a];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let o=[];for(let a of e){if(/\binset\b/i.test(a))continue;let s=a.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",i="0px",c="0px"]=s,u=a.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";o.push(`drop-shadow(${l} ${i} ${c}${f?` ${u}`:""})`)}return o.join(" ")}function Xe(t){let e=Nr(t),n=null,r=null,o=null,a=[];for(let l of e){let i=l.indexOf(":");if(i<0)continue;let c=l.slice(0,i).trim().toLowerCase(),u=l.slice(i+1).trim();c==="box-shadow"?o=u:c==="filter"?n=u:c==="-webkit-filter"?r=u:a.push([c,u])}if(o){let l=Lr(o);l&&(n=n?`${n} ${l}`:l,r=r?`${r} ${l}`:l)}let s=[...a];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([l,i])=>`${l}:${i}`).join(";")}function Rr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${Xe(r)}}`)}function Ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Rr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${Xe(r)}${n}`),t}function Tr(t){if(!T()||!vr(t))return t;try{let e=Er(t),n=Ir(e);return Fr(n)}catch{return t}}async function G(t,e){let{width:n,height:r,scale:o=1,dpr:a=1,meta:s={}}=e;t=Tr(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let i=l.naturalWidth,c=l.naturalHeight,u=Number.isFinite(s.w0)?s.w0:i,f=Number.isFinite(s.h0)?s.h0:c,m,y,b=Number.isFinite(n),d=Number.isFinite(r);if(b&&d)m=Math.max(1,n),y=Math.max(1,r);else if(b){let g=n/Math.max(1,u);m=n,y=Math.round(f*g)}else if(d){let g=r/Math.max(1,f);y=r,m=Math.round(u*g)}else m=i,y=c;m=Math.round(m*o),y=Math.round(y*o);let h=document.createElement("canvas");h.width=Math.ceil(m*a),h.height=Math.ceil(y*a),h.style.width=`${m}px`,h.style.height=`${y}px`;let p=h.getContext("2d");return a!==1&&p.scale(a,a),p.drawImage(l,0,0,m,y),h}async function _t(t,e){let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o}async function Wt(t,e){let{scale:n=1,width:r,height:o,meta:a={}}=e,s=Number.isFinite(r),l=Number.isFinite(o),i=Number.isFinite(n)&&n!==1||s||l;if(T()&&i)return await _t(t,{...e,format:"png",quality:1,meta:a});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),s&&l)c.style.width=`${r}px`,c.style.height=`${o}px`;else if(s){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=r/Math.max(1,u);c.style.width=`${r}px`,c.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(a.w0)?a.w0:c.naturalWidth,f=Number.isFinite(a.h0)?a.h0:c.naturalHeight,m=o/Math.max(1,f);c.style.height=`${o}px`,c.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(c.naturalWidth*n),f=Math.round(c.naturalHeight*n);if(c.style.width=`${u}px`,c.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let y=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,c.src=t}catch{}}return c}async function Ut(t,e){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=await G(t,e),o=e.backgroundColor?et(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))}async function Ye(t,e){if(e.dpr=1,e.format==="svg"){let a=await Ut(t,{...e,type:"svg"}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e.filename,l.click(),URL.revokeObjectURL(s);return}let n=await G(t,e),r=e.backgroundColor?et(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var Ge=Symbol("snapdom.internal"),le=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=ze(e);if(T()&&(n.embedFonts===!0||_r(t)))for(let r=0;r<3;r++)try{await Pr(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),le=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>E.toPng(r,o),toSvg:(r,o)=>E.toSvg(r,o)}),E.capture(t,n,Ge)}E.capture=async(t,e,n)=>{if(n!==Ge)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await ce(t,e),o=s=>({...e,...s||{}}),a=s=>l=>{let i=o({...l||{},format:s}),c=s==="jpeg"||s==="jpg",u=i.backgroundColor==null||i.backgroundColor==="transparent";return c&&u&&(i.backgroundColor="#ffffff"),_t(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Wt(r,o(s)),toSvg:s=>Wt(r,o(s)),toCanvas:s=>G(r,o(s)),toBlob:s=>Ut(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ye(r,o(s))}};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Pr(t,e){if(le)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await ce(t,n)}catch{return}await new Promise(o=>{let a=new Image;a.decoding="sync",a.loading="eager",a.style.position="fixed",a.style.left=0,a.style.top=0,a.style.width="10px",a.style.height="10px",a.style.opacity="0.01",a.style.transform="translateZ(10px)",a.style.willChange="transform,opacity;",a.src=r;let s=async()=>{await new Promise(l=>setTimeout(l,100)),a&&a.parentNode&&a.parentNode.removeChild(a),le=!0,o()};document.body.appendChild(a),s()})}function _r(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),o=r.backgroundImage&&r.backgroundImage!=="none",a=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(o||a)return!0}return!1}async function Wr(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";Mt(o);try{await document.fonts?.ready}catch{}try{zt()}catch{}w.session=w.session||{},w.session.styleCache||(w.session.styleCache=new WeakMap),w.image=w.image||new Map;try{await Pt(t,void 0,w.session.styleCache,{useProxy:r})}catch{}let a=[],s=[];try{t?.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let i of a){let c=i?.currentSrc||i?.src;if(c&&!w.image.has(c)){let u=Promise.resolve().then(async()=>{let f=await L(c,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&w.image.set(c,f.data)}).catch(()=>{});l.push(u)}}for(let i of s){let c="";try{c=rt(i).backgroundImage}catch{}if(c&&c!=="none"){let u=ot(c);for(let f of u)if(f.startsWith("url(")){let m=Promise.resolve().then(()=>nt(f,{...e,useProxy:r})).catch(()=>{});l.push(m)}}}if(n)try{let i=Lt(t),c=Rt(t);if(typeof T=="function"?T():!!T){let f=new Set(Array.from(i).map(m=>String(m).split("__")[0]).filter(Boolean));await It(f,3)}await Nt({required:i,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(l)}export{Wr as preCache,E as snapdom}; |
Link issues
fixes #539
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add new Dom2Image functionality to generate images from HTML elements using JSInterop and the snapdom library
New Features:
Build: