@zumer/snapdom 1.9.12-dev.1 → 1.9.12-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/snapdom.js +48 -4
- package/dist/snapdom.min.js +4 -4
- package/dist/snapdom.min.mjs +5 -5
- package/dist/snapdom.mjs +48 -4
- package/package.json +1 -1
package/dist/snapdom.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
3
|
* snapdom
|
|
4
|
-
* v.1.9.12-dev.
|
|
4
|
+
* v.1.9.12-dev.2
|
|
5
5
|
* Author Juan Martin Muda
|
|
6
6
|
* License MIT
|
|
7
7
|
**/
|
|
@@ -757,6 +757,7 @@
|
|
|
757
757
|
if (rec && rec.epoch === __epoch) return rec.snapshot;
|
|
758
758
|
const style = preStyle || getComputedStyle(el);
|
|
759
759
|
const snap = snapshotComputedStyleFull(style, options);
|
|
760
|
+
stripHeightForWrappers(el, style, snap);
|
|
760
761
|
snapshotCache.set(el, { epoch: __epoch, snapshot: snap });
|
|
761
762
|
return snap;
|
|
762
763
|
}
|
|
@@ -823,6 +824,49 @@
|
|
|
823
824
|
session.styleMap.set(clone, key);
|
|
824
825
|
});
|
|
825
826
|
}
|
|
827
|
+
function isReplaced(el) {
|
|
828
|
+
return el instanceof HTMLImageElement || el instanceof HTMLCanvasElement || el instanceof HTMLVideoElement || el instanceof HTMLIFrameElement || el instanceof SVGElement || el instanceof HTMLObjectElement || el instanceof HTMLEmbedElement;
|
|
829
|
+
}
|
|
830
|
+
function hasBox(cs) {
|
|
831
|
+
if (cs.backgroundImage && cs.backgroundImage !== "none") return true;
|
|
832
|
+
if (cs.backgroundColor && cs.backgroundColor !== "rgba(0, 0, 0, 0)" && cs.backgroundColor !== "transparent") return true;
|
|
833
|
+
if ((parseFloat(cs.borderTopWidth) || 0) > 0) return true;
|
|
834
|
+
if ((parseFloat(cs.borderBottomWidth) || 0) > 0) return true;
|
|
835
|
+
if ((parseFloat(cs.paddingTop) || 0) > 0) return true;
|
|
836
|
+
if ((parseFloat(cs.paddingBottom) || 0) > 0) return true;
|
|
837
|
+
const ob = cs.overflowBlock || cs.overflowY || "visible";
|
|
838
|
+
return ob !== "visible";
|
|
839
|
+
}
|
|
840
|
+
function isFlexOrGridItem(el) {
|
|
841
|
+
const p = el.parentElement;
|
|
842
|
+
if (!p) return false;
|
|
843
|
+
const pd = getComputedStyle(p).display || "";
|
|
844
|
+
return pd.includes("flex") || pd.includes("grid");
|
|
845
|
+
}
|
|
846
|
+
function hasFlowFast(el, cs) {
|
|
847
|
+
if (el.textContent && /\S/.test(el.textContent)) return true;
|
|
848
|
+
const f = el.firstElementChild, l = el.lastElementChild;
|
|
849
|
+
if (f && f.tagName === "BR" || l && l.tagName === "BR") return true;
|
|
850
|
+
const sh = el.scrollHeight;
|
|
851
|
+
if (sh === 0) return false;
|
|
852
|
+
const pt = parseFloat(cs.paddingTop) || 0;
|
|
853
|
+
const pb = parseFloat(cs.paddingBottom) || 0;
|
|
854
|
+
return sh > pt + pb;
|
|
855
|
+
}
|
|
856
|
+
function stripHeightForWrappers(el, cs, snap) {
|
|
857
|
+
if (el instanceof HTMLElement && el.style && el.style.height) return;
|
|
858
|
+
const disp = cs.display || "";
|
|
859
|
+
if (disp.includes("flex") || disp.includes("grid")) return;
|
|
860
|
+
if (isReplaced(el)) return;
|
|
861
|
+
const pos = cs.position;
|
|
862
|
+
if (pos === "absolute" || pos === "fixed" || pos === "sticky") return;
|
|
863
|
+
if (cs.transform !== "none") return;
|
|
864
|
+
if (hasBox(cs)) return;
|
|
865
|
+
if (isFlexOrGridItem(el)) return;
|
|
866
|
+
if (!hasFlowFast(el, cs)) return;
|
|
867
|
+
delete snap.height;
|
|
868
|
+
delete snap["block-size"];
|
|
869
|
+
}
|
|
826
870
|
|
|
827
871
|
// src/core/clone.js
|
|
828
872
|
function idleCallback(childList, callback, fast) {
|
|
@@ -2229,10 +2273,10 @@
|
|
|
2229
2273
|
const hasExplicitContent = content !== "none" && cleanContent !== "";
|
|
2230
2274
|
const hasBg = bg && bg !== "none";
|
|
2231
2275
|
const hasBgColor = bgColor && bgColor !== "transparent" && bgColor !== "rgba(0, 0, 0, 0)";
|
|
2232
|
-
const
|
|
2276
|
+
const hasBox2 = display !== "inline" && (width > 0 || height > 0);
|
|
2233
2277
|
const hasBorder = borderStyle && borderStyle !== "none" && borderWidth > 0;
|
|
2234
2278
|
const hasTransform = transform && transform !== "none";
|
|
2235
|
-
const shouldRender = hasExplicitContent || hasBg || hasBgColor ||
|
|
2279
|
+
const shouldRender = hasExplicitContent || hasBg || hasBgColor || hasBox2 || hasBorder || hasTransform;
|
|
2236
2280
|
if (!shouldRender) continue;
|
|
2237
2281
|
const pseudoEl = document.createElement("span");
|
|
2238
2282
|
pseudoEl.dataset.snapdomPseudo = pseudo;
|
|
@@ -2274,7 +2318,7 @@
|
|
|
2274
2318
|
}
|
|
2275
2319
|
if (hasBgColor) pseudoEl.style.backgroundColor = bgColor;
|
|
2276
2320
|
const hasContent2 = pseudoEl.childNodes.length > 0 || ((_a = pseudoEl.textContent) == null ? void 0 : _a.trim()) !== "";
|
|
2277
|
-
const hasVisibleBox = hasContent2 || hasBg || hasBgColor ||
|
|
2321
|
+
const hasVisibleBox = hasContent2 || hasBg || hasBgColor || hasBox2 || hasBorder || hasTransform;
|
|
2278
2322
|
if (!hasVisibleBox) continue;
|
|
2279
2323
|
if (pseudo === "::before") {
|
|
2280
2324
|
clone.insertBefore(pseudoEl, clone.firstChild);
|
package/dist/snapdom.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(()=>{var Be=Object.defineProperty,Oe=Object.defineProperties;var De=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var qe=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable;var ie=(t,e,n)=>e in t?Be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,z=(t,e)=>{for(var n in e||(e={}))qe.call(e,n)&&ie(t,n,e[n]);if(se)for(var n of se(e))He.call(e,n)&&ie(t,n,e[n]);return t},G=(t,e)=>Oe(t,De(e));var v=(t,e,n)=>new Promise((r,o)=>{var a=i=>{try{c(n.next(i))}catch(f){o(f)}},s=i=>{try{c(n.throw(i))}catch(f){o(f)}},c=i=>i.done?r(i.value):Promise.resolve(i.value).then(a,s);c((n=n.apply(t,e)).next())});var g={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function Et(t="soft"){switch(t){case"auto":{g.session.styleMap=new Map,g.session.nodeMap=new Map;return}case"soft":{g.session.styleMap=new Map,g.session.nodeMap=new Map,g.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{g.session.styleMap=new Map,g.session.nodeMap=new Map,g.session.styleCache=new WeakMap,g.computedStyle=new WeakMap,g.baseStyle=new Map,g.defaultStyle=new Map,g.image=new Map,g.background=new Map,g.resource=new Map,g.font=new Set;return}default:{g.session.styleMap=new Map,g.session.nodeMap=new Map,g.session.styleCache=new WeakMap;return}}}function dt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Ot(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(a=>a.trim());return o.length!==6?`matrix(${r})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(a=>a.trim());return o.length!==16?`matrix3d(${r})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function it(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch(e){return t}}function je(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,o=0;function a(s,c,i){if(o>=n)return;let f=Date.now();(r.get(c)||0)>f||(r.set(c,f+e),o++,s==="warn"&&console&&console.warn?console.warn(`${t} ${i}`):console&&console.error&&console.error(`${t} ${i}`))}return{warnOnce(s,c){a("warn",s,c)},errorOnce(s,c){a("error",s,c)},reset(){r.clear(),o=0}}}var ce=je("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Dt=new Map,vt=new Map;function ze(t){return/^data:|^blob:|^about:blank$/i.test(t)}function Ve(t,e){try{let n=typeof location!="undefined"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,o=new URL(r||".",n),a=new URL(t,n);if(a.origin===o.origin)return!0;let s=a.searchParams;if(s&&(s.has("url")||s.has("target")))return!0}catch(n){}return!1}function Xe(t,e){if(!e||ze(t)||Ve(t,e))return!1;try{let n=typeof location!="undefined"&&location.href?location.href:"http://localhost/",r=new URL(t,n);return typeof location!="undefined"?r.origin!==location.origin:!0}catch(n){return!!e}}function Ge(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",it(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${it(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function le(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(t)})}function Ke(t,e){var n,r;return[e.as||"blob",(n=e.timeout)!=null?n:3e3,e.useProxy||"",(r=e.errorTTL)!=null?r:8e3,t].join("|")}function V(n){return v(this,arguments,function*(t,e={}){var y,$,L;let r=(y=e.as)!=null?y:"blob",o=($=e.timeout)!=null?$:3e3,a=e.useProxy||"",s=(L=e.errorTTL)!=null?L:8e3,c=e.headers||{},i=!!e.silent;if(/^data:/i.test(t))try{if(r==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(r==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,M="",S=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],P=/;base64/i.test(M)?atob(S):decodeURIComponent(S),N=new Uint8Array([...P].map(O=>O.charCodeAt(0))),_=new Blob([N],{type:(M||"").split(";")[0]||""});return{ok:!0,data:_,status:200,url:t,fromCache:!1,mime:_.type||""}}catch(M){return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let M=yield fetch(t);if(!M.ok)return{ok:!1,data:null,status:M.status,url:t,fromCache:!1,reason:"http_error"};let S=yield M.blob(),k=S.type||M.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:yield le(S),status:M.status,url:t,fromCache:!1,mime:k}:r==="text"?{ok:!0,data:yield S.text(),status:M.status,url:t,fromCache:!1,mime:k}:{ok:!0,data:S,status:M.status,url:t,fromCache:!1,mime:k}}catch(M){return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return r==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:r==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let f=Ke(t,{as:r,timeout:o,useProxy:a,errorTTL:s}),l=vt.get(f);if(l&&l.until>Date.now())return G(z({},l.result),{fromCache:!0});l&&vt.delete(f);let u=Dt.get(f);if(u)return u;let h=Xe(t,a)?Ge(t,a):t,w=e.credentials;if(!w)try{let M=typeof location!="undefined"&&location.href?location.href:"http://localhost/",S=new URL(t,M);w=typeof location!="undefined"&&S.origin===location.origin?"include":"omit"}catch(M){w="omit"}let E=new AbortController,d=setTimeout(()=>E.abort("timeout"),o),p=v(null,null,function*(){var M,S;try{let k=yield fetch(h,{signal:E.signal,credentials:w,headers:c});if(!k.ok){let _={ok:!1,data:null,status:k.status,url:h,fromCache:!1,reason:"http_error"};if(s>0&&vt.set(f,{until:Date.now()+s,result:_}),!i){let O=`${k.status} ${k.statusText||""}`.trim();ce.warnOnce(`http:${k.status}:${r}:${new URL(t,(M=location==null?void 0:location.href)!=null?M:"http://localhost/").origin}`,`HTTP error ${O} while fetching ${r} ${t}`)}return e.onError&&e.onError(_),_}if(r==="text")return{ok:!0,data:yield k.text(),status:k.status,url:h,fromCache:!1};let P=yield k.blob(),N=P.type||k.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:yield le(P),status:k.status,url:h,fromCache:!1,mime:N}:{ok:!0,data:P,status:k.status,url:h,fromCache:!1,mime:N}}catch(k){let P=k&&typeof k=="object"&&"name"in k&&k.name==="AbortError"?String(k.message||"").includes("timeout")?"timeout":"abort":"network",N={ok:!1,data:null,status:0,url:h,fromCache:!1,reason:P};if(!/^blob:/i.test(t)&&s>0&&vt.set(f,{until:Date.now()+s,result:N}),!i){let _=`${P}:${r}:${new URL(t,(S=location==null?void 0:location.href)!=null?S:"http://localhost/").origin}`,O=P==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:P==="abort"?`Request aborted while fetching ${r} ${t}`:`Network/CORS issue while fetching ${r} ${t}. A proxy may be required`;ce.errorOnce(_,O)}return e.onError&&e.onError(N),N}finally{clearTimeout(d),Dt.delete(f)}});return Dt.set(f,p),p})}function mt(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let r=n.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,n.width,n.height),r.drawImage(t,0,0),n}function ht(n){return v(this,arguments,function*(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=dt(t);if(!o)return t;let a=it(o);if(g.background.has(a)){let s=g.background.get(a);return s?`url("${s}")`:"none"}try{let s=yield V(a,{as:"dataURL",useProxy:e.useProxy});return s.ok?(g.background.set(a,s.data),`url("${s.data}")`):(g.background.set(a,null),"none")}catch(s){return g.background.set(a,null),"none"}})}var Ft=new Set(["meta","script","noscript","title","link","template"]),St=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),Ye=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function qt(){for(let t of Ye){let e=String(t).toLowerCase();Ft.has(e)||St.has(e)||Ht(e)}}function Ht(t){if(t=String(t).toLowerCase(),St.has(t)){let a={};return g.defaultStyle.set(t,a),a}if(g.defaultStyle.has(t))return g.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let r=getComputedStyle(n),o={};for(let a of r){if(fe(a))continue;let s=r.getPropertyValue(a);o[a]=s}return e.removeChild(n),g.defaultStyle.set(t,o),o}var Je=/(?:^|-)(animation|transition)(?:-|$)/i,Qe=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Ze=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function fe(t){let e=String(t).toLowerCase();return!!(Ze.has(e)||Qe.test(e)||Je.test(e))}function xt(t,e){if(e=String(e||"").toLowerCase(),St.has(e))return"";let n=[],r=Ht(e);for(let[o,a]of Object.entries(t)){if(fe(o))continue;let s=r[o];a&&a!==s&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function jt(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function zt(t){let e=new Map;for(let r of t){let o=g.defaultStyle.get(r);if(!o)continue;let a=Object.entries(o).map(([s,c])=>`${s}:${c};`).sort().join("");a&&(e.has(a)||e.set(a,[]),e.get(a).push(r))}let n="";for(let[r,o]of e.entries())n+=`${o.join(",")} { ${r} }
|
|
2
|
-
`;return n}function Vt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,r=1;for(let o of e)n.set(o,`c${r++}`);return n}function pt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=g.computedStyle.get(t);if(n||(n=new Map,g.computedStyle.set(t,n)),!n.has(e)){let r=window.getComputedStyle(t,e);n.set(e,r)}return n.get(e)}function Xt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch(n){return e}return e}function
|
|
1
|
+
(()=>{var Be=Object.defineProperty,Oe=Object.defineProperties;var De=Object.getOwnPropertyDescriptors;var se=Object.getOwnPropertySymbols;var He=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var ie=(t,e,n)=>e in t?Be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,z=(t,e)=>{for(var n in e||(e={}))He.call(e,n)&&ie(t,n,e[n]);if(se)for(var n of se(e))qe.call(e,n)&&ie(t,n,e[n]);return t},G=(t,e)=>Oe(t,De(e));var F=(t,e,n)=>new Promise((r,o)=>{var a=i=>{try{c(n.next(i))}catch(f){o(f)}},s=i=>{try{c(n.throw(i))}catch(f){o(f)}},c=i=>i.done?r(i.value):Promise.resolve(i.value).then(a,s);c((n=n.apply(t,e)).next())});var g={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function $t(t="soft"){switch(t){case"auto":{g.session.styleMap=new Map,g.session.nodeMap=new Map;return}case"soft":{g.session.styleMap=new Map,g.session.nodeMap=new Map,g.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{g.session.styleMap=new Map,g.session.nodeMap=new Map,g.session.styleCache=new WeakMap,g.computedStyle=new WeakMap,g.baseStyle=new Map,g.defaultStyle=new Map,g.image=new Map,g.background=new Map,g.resource=new Map,g.font=new Set;return}default:{g.session.styleMap=new Map,g.session.nodeMap=new Map,g.session.styleCache=new WeakMap;return}}}function dt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Ot(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(a=>a.trim());return o.length!==6?`matrix(${r})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(a=>a.trim());return o.length!==16?`matrix3d(${r})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function it(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch(e){return t}}function je(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,o=0;function a(s,c,i){if(o>=n)return;let f=Date.now();(r.get(c)||0)>f||(r.set(c,f+e),o++,s==="warn"&&console&&console.warn?console.warn(`${t} ${i}`):console&&console.error&&console.error(`${t} ${i}`))}return{warnOnce(s,c){a("warn",s,c)},errorOnce(s,c){a("error",s,c)},reset(){r.clear(),o=0}}}var ce=je("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Dt=new Map,Ft=new Map;function ze(t){return/^data:|^blob:|^about:blank$/i.test(t)}function Ve(t,e){try{let n=typeof location!="undefined"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,o=new URL(r||".",n),a=new URL(t,n);if(a.origin===o.origin)return!0;let s=a.searchParams;if(s&&(s.has("url")||s.has("target")))return!0}catch(n){}return!1}function Xe(t,e){if(!e||ze(t)||Ve(t,e))return!1;try{let n=typeof location!="undefined"&&location.href?location.href:"http://localhost/",r=new URL(t,n);return typeof location!="undefined"?r.origin!==location.origin:!0}catch(n){return!!e}}function Ge(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",it(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${it(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function le(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(t)})}function Ke(t,e){var n,r;return[e.as||"blob",(n=e.timeout)!=null?n:3e3,e.useProxy||"",(r=e.errorTTL)!=null?r:8e3,t].join("|")}function V(n){return F(this,arguments,function*(t,e={}){var y,E,R;let r=(y=e.as)!=null?y:"blob",o=(E=e.timeout)!=null?E:3e3,a=e.useProxy||"",s=(R=e.errorTTL)!=null?R:8e3,c=e.headers||{},i=!!e.silent;if(/^data:/i.test(t))try{if(r==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(r==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,M="",S=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],P=/;base64/i.test(M)?atob(S):decodeURIComponent(S),N=new Uint8Array([...P].map(O=>O.charCodeAt(0))),_=new Blob([N],{type:(M||"").split(";")[0]||""});return{ok:!0,data:_,status:200,url:t,fromCache:!1,mime:_.type||""}}catch(M){return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let M=yield fetch(t);if(!M.ok)return{ok:!1,data:null,status:M.status,url:t,fromCache:!1,reason:"http_error"};let S=yield M.blob(),A=S.type||M.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:yield le(S),status:M.status,url:t,fromCache:!1,mime:A}:r==="text"?{ok:!0,data:yield S.text(),status:M.status,url:t,fromCache:!1,mime:A}:{ok:!0,data:S,status:M.status,url:t,fromCache:!1,mime:A}}catch(M){return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return r==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:r==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let f=Ke(t,{as:r,timeout:o,useProxy:a,errorTTL:s}),l=Ft.get(f);if(l&&l.until>Date.now())return G(z({},l.result),{fromCache:!0});l&&Ft.delete(f);let u=Dt.get(f);if(u)return u;let h=Xe(t,a)?Ge(t,a):t,w=e.credentials;if(!w)try{let M=typeof location!="undefined"&&location.href?location.href:"http://localhost/",S=new URL(t,M);w=typeof location!="undefined"&&S.origin===location.origin?"include":"omit"}catch(M){w="omit"}let $=new AbortController,d=setTimeout(()=>$.abort("timeout"),o),p=F(null,null,function*(){var M,S;try{let A=yield fetch(h,{signal:$.signal,credentials:w,headers:c});if(!A.ok){let _={ok:!1,data:null,status:A.status,url:h,fromCache:!1,reason:"http_error"};if(s>0&&Ft.set(f,{until:Date.now()+s,result:_}),!i){let O=`${A.status} ${A.statusText||""}`.trim();ce.warnOnce(`http:${A.status}:${r}:${new URL(t,(M=location==null?void 0:location.href)!=null?M:"http://localhost/").origin}`,`HTTP error ${O} while fetching ${r} ${t}`)}return e.onError&&e.onError(_),_}if(r==="text")return{ok:!0,data:yield A.text(),status:A.status,url:h,fromCache:!1};let P=yield A.blob(),N=P.type||A.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:yield le(P),status:A.status,url:h,fromCache:!1,mime:N}:{ok:!0,data:P,status:A.status,url:h,fromCache:!1,mime:N}}catch(A){let P=A&&typeof A=="object"&&"name"in A&&A.name==="AbortError"?String(A.message||"").includes("timeout")?"timeout":"abort":"network",N={ok:!1,data:null,status:0,url:h,fromCache:!1,reason:P};if(!/^blob:/i.test(t)&&s>0&&Ft.set(f,{until:Date.now()+s,result:N}),!i){let _=`${P}:${r}:${new URL(t,(S=location==null?void 0:location.href)!=null?S:"http://localhost/").origin}`,O=P==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:P==="abort"?`Request aborted while fetching ${r} ${t}`:`Network/CORS issue while fetching ${r} ${t}. A proxy may be required`;ce.errorOnce(_,O)}return e.onError&&e.onError(N),N}finally{clearTimeout(d),Dt.delete(f)}});return Dt.set(f,p),p})}function mt(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let r=n.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,n.width,n.height),r.drawImage(t,0,0),n}function ht(n){return F(this,arguments,function*(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=dt(t);if(!o)return t;let a=it(o);if(g.background.has(a)){let s=g.background.get(a);return s?`url("${s}")`:"none"}try{let s=yield V(a,{as:"dataURL",useProxy:e.useProxy});return s.ok?(g.background.set(a,s.data),`url("${s.data}")`):(g.background.set(a,null),"none")}catch(s){return g.background.set(a,null),"none"}})}var vt=new Set(["meta","script","noscript","title","link","template"]),St=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),Ye=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function Ht(){for(let t of Ye){let e=String(t).toLowerCase();vt.has(e)||St.has(e)||qt(e)}}function qt(t){if(t=String(t).toLowerCase(),St.has(t)){let a={};return g.defaultStyle.set(t,a),a}if(g.defaultStyle.has(t))return g.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let r=getComputedStyle(n),o={};for(let a of r){if(fe(a))continue;let s=r.getPropertyValue(a);o[a]=s}return e.removeChild(n),g.defaultStyle.set(t,o),o}var Je=/(?:^|-)(animation|transition)(?:-|$)/i,Qe=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Ze=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function fe(t){let e=String(t).toLowerCase();return!!(Ze.has(e)||Qe.test(e)||Je.test(e))}function xt(t,e){if(e=String(e||"").toLowerCase(),St.has(e))return"";let n=[],r=qt(e);for(let[o,a]of Object.entries(t)){if(fe(o))continue;let s=r[o];a&&a!==s&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function jt(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function zt(t){let e=new Map;for(let r of t){let o=g.defaultStyle.get(r);if(!o)continue;let a=Object.entries(o).map(([s,c])=>`${s}:${c};`).sort().join("");a&&(e.has(a)||e.set(a,[]),e.get(a).push(r))}let n="";for(let[r,o]of e.entries())n+=`${o.join(",")} { ${r} }
|
|
2
|
+
`;return n}function Vt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,r=1;for(let o of e)n.set(o,`c${r++}`);return n}function pt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=g.computedStyle.get(t);if(n||(n=new Map,g.computedStyle.set(t,n)),!n.has(e)){let r=window.getComputedStyle(t,e);n.set(e,r)}return n.get(e)}function Xt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch(n){return e}return e}function Lt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function gt(t){let e=[],n=0,r=0;for(let o=0;o<t.length;o++){let a=t[o];a==="("&&n++,a===")"&&n--,a===","&&n===0&&(e.push(t.slice(r,o).trim()),r=o+1)}return e.push(t.slice(r).trim()),e}function at(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function st(){let t=typeof navigator!="undefined"&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(t),n=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(t);return e||n}var ue=new WeakMap,Gt=new Map,Kt=0;function Ct(){Kt++}var de=!1;function tn(t=document.documentElement){var e,n;if(!de){de=!0;try{new MutationObserver(()=>Ct()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch(r){}try{new MutationObserver(()=>Ct()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch(r){}try{let r=document.fonts;r&&((e=r.addEventListener)==null||e.call(r,"loadingdone",Ct),(n=r.ready)==null||n.then(()=>Ct()).catch(()=>{}))}catch(r){}}}function en(t,e={}){let n={},r=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let a=t[o],s=t.getPropertyValue(a);(a==="background-image"||a==="content")&&s.includes("url(")&&!s.includes("data:")&&(s="none"),n[a]=s}if(e.embedFonts){let o=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let a of o)if(!n[a])try{let s=t.getPropertyValue(a);s&&(n[a]=s)}catch(s){}}return r==="hidden"&&(n.opacity="0"),n}var me=new WeakMap;function nn(t){let e=me.get(t);return e||(e=Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:r[0]>o[0]?1:0).map(([r,o])=>`${r}:${o}`).join(";"),me.set(t,e),e)}function rn(t,e=null,n={}){let r=ue.get(t);if(r&&r.epoch===Kt)return r.snapshot;let o=e||getComputedStyle(t),a=en(o,n);return fn(t,o,a),ue.set(t,{epoch:Kt,snapshot:a}),a}function on(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Gt,defaultStyle:g.defaultStyle,baseStyle:g.baseStyle,image:g.image,resource:g.resource,background:g.background,font:g.font},options:e||{}}:{session:g.session,persist:{snapshotKeyCache:Gt,defaultStyle:g.defaultStyle,baseStyle:g.baseStyle,image:g.image,resource:g.resource,background:g.background,font:g.font},options:t||e||{}}}function yt(t,e,n,r){return F(this,null,function*(){var h,w,$;if(t.tagName==="STYLE")return;let o=on(n,r),a=o.options&&o.options.cache||"auto";if(a!=="disabled"&&tn(document.documentElement),a==="disabled"&&!o.session.__bumpedForDisabled&&(Ct(),Gt.clear(),o.session.__bumpedForDisabled=!0),St.has((h=t.tagName)==null?void 0:h.toLowerCase())){let d=(w=t.getAttribute)==null?void 0:w.call(t,"style");d&&e.setAttribute("style",d)}let{session:s,persist:c}=o;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let i=s.styleCache.get(t),f=rn(t,i,o.options),l=nn(f),u=c.snapshotKeyCache.get(l);if(!u){let d=(($=t.tagName)==null?void 0:$.toLowerCase())||"div";u=xt(f,d),c.snapshotKeyCache.set(l,u)}s.styleMap.set(e,u)})}function an(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function sn(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function cn(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function ln(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,r=t.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let o=t.scrollHeight;if(o===0)return!1;let a=parseFloat(e.paddingTop)||0,s=parseFloat(e.paddingBottom)||0;return o>a+s}function fn(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let r=e.display||"";if(r.includes("flex")||r.includes("grid")||an(t))return;let o=e.position;o==="absolute"||o==="fixed"||o==="sticky"||e.transform==="none"&&(sn(e)||cn(t)||ln(t,e)&&(delete n.height,delete n["block-size"]))}function Yt(t,e,n){return Promise.all(t.map(r=>new Promise(o=>{function a(){at(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(r,o):a()},{fast:n})}a()})))}function un(t){return t=t.trim(),!t||/\:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function dn(t,e,n=!0){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let o=n?un(r):r;return`:where(${e} ${o})`}).join(", ")}function mn(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${e}:is(${r.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${e} ${r.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,o,a)=>{let s=dn(a,e,!0);return`${r}${o}${s}{`}),t):""}function hn(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function pn(t){let e="";try{t.querySelectorAll("style").forEach(r=>{e+=(r.textContent||"")+`
|
|
3
3
|
`});let n=t.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let o of r.cssRules)e+=o.cssText+`
|
|
4
|
-
`}catch(o){}}catch(n){}return e}function
|
|
5
|
-
`:""}function gn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}function yn(t,e=3){return v(this,null,function*(){let n=()=>{var a;try{return t.contentDocument||((a=t.contentWindow)==null?void 0:a.document)||null}catch(s){return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)yield 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(i){}let s=Math.max(0,Math.round(e.width-(n+r))),c=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:c,rect:e}}function bn(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(o){}}}function Sn(t,e,n){return v(this,null,function*(){let r=yield yn(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=wn(t),c=n==null?void 0:n.snap;if(!c||typeof c.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i=G(z({},n),{scale:1}),f=bn(r,o,a),l;try{l=yield c.toPng(r.documentElement,i)}finally{f()}l.style.display="block",l.style.width=`${o}px`,l.style.height=`${a}px`;let u=document.createElement("div");return e.nodeMap.set(u,t),yt(t,u,e,n),u.style.overflow="hidden",u.style.display="block",u.style.width||(u.style.width=`${Math.round(s.width)}px`),u.style.height||(u.style.height=`${Math.round(s.height)}px`),u.appendChild(l),u})}function At(t,e,n){return v(this,null,function*(){var f,l,u,h,w,E;if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let d=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ft.has(d))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 d=document.createElement("div"),p=t.getBoundingClientRect();return d.style.cssText=`display:inline-block;width:${p.width}px;height:${p.height}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let d of n.exclude)try{if((f=t.matches)!=null&&f.call(t,d)){if(n.excludeMode==="hide"){let p=document.createElement("div"),y=t.getBoundingClientRect();return p.style.cssText=`display:inline-block;width:${y.width}px;height:${y.height}px;visibility:hidden;`,p}else if(n.excludeMode==="remove")return null}}catch(p){console.warn(`Invalid selector in exclude option: ${d}`,p)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let d=document.createElement("div"),p=t.getBoundingClientRect();return d.style.cssText=`display:inline-block;width:${p.width}px;height:${p.height}px;visibility:hidden;`,d}else if(n.filterMode==="remove")return null}}catch(d){console.warn("Error in filter function:",d)}if(t.tagName==="IFRAME"){let d=!1;try{d=!!(t.contentDocument||(l=t.contentWindow)!=null&&l.document)}catch(p){d=!1}if(d)try{return yield Sn(t,e,n)}catch(p){console.warn("[SnapDOM] iframe rasterization failed, fallback:",p)}if(n.placeholders){let p=document.createElement("div");return p.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;`,yt(t,p,e,n),p}else{let p=t.getBoundingClientRect(),y=document.createElement("div");return y.style.cssText=`display:inline-block;width:${p.width}px;height:${p.height}px;visibility:hidden;`,yt(t,y,e,n),y}}if(t.getAttribute("data-capture")==="placeholder"){let d=t.cloneNode(!1);e.nodeMap.set(d,t),yt(t,d,e,n);let p=document.createElement("div");return p.textContent=t.getAttribute("data-placeholder-text")||"",p.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",d.appendChild(p),d}if(t.tagName==="CANVAS"){let d=t.toDataURL(),p=document.createElement("img");return p.src=d,p.width=t.width,p.height=t.height,e.nodeMap.set(p,t),yt(t,p,e,n),p}let s;try{if(s=t.cloneNode(!1),e.nodeMap.set(s,t),t.tagName==="IMG"){dn(t,s);try{let d=t.getBoundingClientRect(),p=Math.round(d.width||0),y=Math.round(d.height||0);if(!p||!y){let $=window.getComputedStyle(t),L=parseFloat($.width)||0,M=parseFloat($.height)||0,S=parseInt(t.getAttribute("width")||"",10)||0,k=parseInt(t.getAttribute("height")||"",10)||0,P=t.width||t.naturalWidth||0,N=t.height||t.naturalHeight||0;p=Math.round(p||L||S||P||0),y=Math.round(y||M||k||N||0)}p&&(s.dataset.snapdomWidth=String(p)),y&&(s.dataset.snapdomHeight=String(y))}catch(d){}}}catch(d){throw console.error("[Snapdom] Failed to clone node:",t,d),d}if(t instanceof HTMLTextAreaElement){let d=t.getBoundingClientRect();s.style.width=`${d.width}px`,s.style.height=`${d.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),yt(t,s,e,n),t.shadowRoot){let k=function(N,_){if(N.nodeType===Node.ELEMENT_NODE&&N.tagName==="STYLE")return _(null);At(N,e,n).then(O=>{_(O||null)}).catch(O=>{_(null)})};try{let N=t.shadowRoot.querySelectorAll("slot");for(let _ of N){let O=[];try{O=((u=_.assignedNodes)==null?void 0:u.call(_,{flatten:!0}))||((h=_.assignedNodes)==null?void 0:h.call(_))||[]}catch(K){O=((w=_.assignedNodes)==null?void 0:w.call(_))||[]}for(let K of O)r.add(K)}}catch(N){}let d=ln(e),p=`[data-sd="${d}"]`;try{s.setAttribute("data-sd",d)}catch(N){}let y=fn(t.shadowRoot),$=cn(y,p),L=mn(y),M=pn(t,L,p);un(s,M+$,d);let S=document.createDocumentFragment(),P=yield Yt(Array.from(t.shadowRoot.childNodes),k,n.fast);S.append(...P.filter(N=>!!N)),s.appendChild(S)}if(t.tagName==="SLOT"){let $=function(M,S){At(M,e,n).then(k=>{k&&gn(k),S(k||null)}).catch(k=>{S(null)})},d=((E=t.assignedNodes)==null?void 0:E.call(t,{flatten:!0}))||[],p=d.length>0?d:Array.from(t.childNodes),y=document.createDocumentFragment(),L=yield Yt(Array.from(p),$,n.fast);return y.append(...L.filter(M=>!!M)),y}function c(d,p){if(r.has(d))return p(null);At(d,e,n).then(y=>{p(y||null)}).catch(y=>{p(null)})}let i=yield Yt(Array.from(t.childNodes),c,n.fast);if(s.append(...i.filter(d=>!!d)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let d of s.options)d.value===o?d.setAttribute("selected",""):d.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s})}var xn=[/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],Jt=[];function he(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Jt.push(n):typeof n=="string"?Jt.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function Q(t){let e=typeof t=="string"?t:"",n=[...xn,...Jt];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))}function pe(t,e,n,r=32,o="#000"){return v(this,null,function*(){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;yield document.fonts.ready;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 c=s.getBoundingClientRect(),i=Math.ceil(c.width),f=Math.ceil(c.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=i*a,l.height=f*a;let u=l.getContext("2d");return u.scale(a,a),u.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=o,u.fillText(t,0,0),{dataUrl:l.toDataURL(),width:i,height:f}})}var Cn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Lt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Cn.has(n.toLowerCase()))return n}return""}function Nt(t){let e=String(t!=null?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 Qt(t){let e=String(t!=null?t:"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function An(t){let e=String(t!=null?t:"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function kn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=Nt(n[1]),a=Nt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=Nt(e);return{min:r,max:r}}function $n(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Mn(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 En(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(c=>o.endsWith(c)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let c of e){let i=c.toLowerCase().replace(/\s+/g,"+"),f=c.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(f))return!0}return!1}catch(n){return!1}}function vn(t){var n;let e=new Set;for(let r of t||[]){let o=(n=String(r).split("__")[0])==null?void 0:n.trim();o&&e.add(o)}return e}function Tt(){return v(this,arguments,function*({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){var N,_,O,K,et,nt,rt,wt,D,lt,Y,ot,Mt,j,X,J,Z,ft;t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let m of t){let[C,x,F,b]=String(m).split("__");if(!C)continue;let A=a.get(C)||[];A.push({w:parseInt(x,10),s:F,st:parseInt(b,10)}),a.set(C,A)}let s=/@import\s+url\(["']?([^"')]+)["']?\)/g,c=/url\((["']?)([^"')]+)\1\)/g,i=/@font-face[^{}]*\{[^}]*\}/g;function f(m,C,x,F){if(!a.has(m))return!1;let b=a.get(m),A=kn(x),R=$n(C),T=Mn(F),I=A.min!==A.max,U=A.min,W=q=>R.kind==="normal"&&q==="normal"||R.kind!=="normal"&&(q==="italic"||q==="oblique"),B=!1;for(let q of b){let tt=I?q.w>=A.min&&q.w<=A.max:q.w===U,ut=W(Qt(q.s)),bt=q.st>=T.min&&q.st<=T.max;if(tt&&ut&&bt){B=!0;break}}if(B)return!0;if(!I)for(let q of b){let tt=W(Qt(q.s)),ut=q.st>=T.min&&q.st<=T.max;if(Math.abs(U-q.w)<=300&&tt&&ut)return!0}return!1}function l(m){if(!m)return[];let C=[],x=m.split(",").map(F=>F.trim()).filter(Boolean);for(let F of x){let b=F.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!b)continue;let A=b[1],R=b[2],T=I=>{if(!I.includes("?"))return parseInt(I,16);let U=parseInt(I.replace(/\?/g,"0"),16),W=parseInt(I.replace(/\?/g,"F"),16);return[U,W]};if(R){let I=T(A),U=T(R),W=Array.isArray(I)?I[0]:I,B=Array.isArray(U)?U[1]:U;C.push([Math.min(W,B),Math.max(W,B)])}else{let I=T(A);Array.isArray(I)?C.push([I[0],I[1]]):C.push([I,I])}}return C}function u(m,C){if(!C.length||!m||m.size===0)return!0;for(let x of m)for(let[F,b]of C)if(x>=F&&x<=b)return!0;return!1}function h(m,C){let x=[];if(!m)return x;for(let F of m.matchAll(c)){let b=(F[2]||"").trim();if(!(!b||b.startsWith("data:"))){if(!/^https?:/i.test(b))try{b=new URL(b,C||location.href).href}catch(A){}x.push(b)}}return x}function w(m,C){return v(this,null,function*(){var F,b,A,R,T;let x=m;for(let I of m.matchAll(c)){let U=dt(I[0]);if(!U)continue;let W=U;if(!W.startsWith("http")&&!W.startsWith("data:"))try{W=new URL(W,C||location.href).href}catch(B){}if(!Q(W)){if((F=g.resource)!=null&&F.has(W)){(b=g.font)==null||b.add(W),x=x.replace(I[0],`url(${g.resource.get(W)})`);continue}if(!((A=g.font)!=null&&A.has(W)))try{let B=yield V(W,{as:"dataURL",useProxy:o,silent:!0});if(B.ok&&typeof B.data=="string"){let q=B.data;(R=g.resource)==null||R.set(W,q),(T=g.font)==null||T.add(W),x=x.replace(I[0],`url(${q})`)}}catch(B){console.warn("[snapDOM] Failed to fetch font resource:",W)}}}return x})}function E(m){if(!m.length)return null;let C=(T,I)=>m.some(([U,W])=>!(W<T||U>I)),x=C(0,255)||C(305,305),F=C(256,591)||C(7680,7935),b=C(880,1023),A=C(1024,1279);return C(7840,7929)||C(258,259)||C(416,417)||C(431,432)?"vietnamese":A?"cyrillic":b?"greek":F?"latin-ext":x?"latin":null}function d(m={}){let C=new Set((m.families||[]).map(b=>String(b).toLowerCase())),x=new Set((m.domains||[]).map(b=>String(b).toLowerCase())),F=new Set((m.subsets||[]).map(b=>String(b).toLowerCase()));return(b,A)=>{if(C.size&&C.has(b.family.toLowerCase()))return!0;if(x.size)for(let R of b.srcUrls)try{if(x.has(new URL(R).host.toLowerCase()))return!0}catch(T){}if(F.size){let R=E(A);if(R&&F.has(R))return!0}return!1}}let p=d(n);function y(m){var A,R,T,I,U,W;if(!m)return m;let C=/@font-face[^{}]*\{[^}]*\}/gi,x=new Set,F=[];for(let B of m.match(C)||[]){let q=((A=B.match(/font-family:\s*([^;]+);/i))==null?void 0:A[1])||"",tt=Lt(q),ut=(((R=B.match(/font-weight:\s*([^;]+);/i))==null?void 0:R[1])||"400").trim(),bt=(((T=B.match(/font-style:\s*([^;]+);/i))==null?void 0:T[1])||"normal").trim(),_e=(((I=B.match(/font-stretch:\s*([^;]+);/i))==null?void 0:I[1])||"100%").trim(),Pe=(((U=B.match(/unicode-range:\s*([^;]+);/i))==null?void 0:U[1])||"").trim(),re=(((W=B.match(/src\s*:\s*([^;]+);/i))==null?void 0:W[1])||"").trim(),oe=h(re,location.href),Ue=oe.length?oe.map(We=>String(We).toLowerCase()).sort().join("|"):re.toLowerCase(),ae=[String(tt||"").toLowerCase(),ut,bt,_e,Pe.toLowerCase(),Ue].join("|");x.has(ae)||(x.add(ae),F.push(B))}if(F.length===0)return m;let b=0;return m.replace(C,()=>F[b++]||"")}function $(){let m=Array.from(t||[]).sort().join("|"),C=n?JSON.stringify({families:(n.families||[]).map(b=>String(b).toLowerCase()).sort(),domains:(n.domains||[]).map(b=>String(b).toLowerCase()).sort(),subsets:(n.subsets||[]).map(b=>String(b).toLowerCase()).sort()}):"",x=(r||[]).map(b=>`${(b.family||"").toLowerCase()}::${b.weight||"normal"}::${b.style||"normal"}::${b.src||""}`).sort().join("|");return`fonts-embed-css::req=${m}::ex=${C}::lf=${x}::px=${o||""}`}let L=$();if((N=g.resource)!=null&&N.has(L))return g.resource.get(L);let M=vn(t),S=[];for(let m of document.querySelectorAll("style")){let C=m.textContent||"";for(let x of C.matchAll(s)){let F=x[1];if(!F||Q(F))continue;!!document.querySelector(`link[rel="stylesheet"][href="${F}"]`)||S.push(F)}}S.length&&(yield Promise.all(S.map(m=>new Promise(C=>{if(document.querySelector(`link[rel="stylesheet"][href="${m}"]`))return C(null);let x=document.createElement("link");x.rel="stylesheet",x.href=m,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>C(x),x.onerror=()=>C(null),document.head.appendChild(x)}))));let k="",P=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(m=>!!m.href);for(let m of P)try{if(Q(m.href))continue;let C="",x=!1;try{x=new URL(m.href,location.href).origin===location.origin}catch(b){}if(!x&&!En(m.href,M))continue;if(x){let b=Array.from(document.styleSheets).find(A=>A.href===m.href);if(b)try{let A=b.cssRules||[];C=Array.from(A).map(R=>R.cssText).join("")}catch(A){}}if(!C&&(C=(yield V(m.href,{as:"text",useProxy:o})).data,Q(m.href)))continue;let F="";for(let b of C.match(i)||[]){let A=(((_=b.match(/font-family:\s*([^;]+);/i))==null?void 0:_[1])||"").trim(),R=Lt(A);if(!R||Q(R))continue;let T=(((O=b.match(/font-weight:\s*([^;]+);/i))==null?void 0:O[1])||"400").trim(),I=(((K=b.match(/font-style:\s*([^;]+);/i))==null?void 0:K[1])||"normal").trim(),U=(((et=b.match(/font-stretch:\s*([^;]+);/i))==null?void 0:et[1])||"100%").trim(),W=(((nt=b.match(/unicode-range:\s*([^;]+);/i))==null?void 0:nt[1])||"").trim(),B=(((rt=b.match(/src\s*:\s*([^;]+);/i))==null?void 0:rt[1])||"").trim(),q=h(B,m.href);if(!f(R,I,T,U))continue;let tt=l(W);if(!u(e,tt))continue;let ut={family:R,weightSpec:T,styleSpec:I,stretchSpec:U,unicodeRange:W,srcRaw:B,srcUrls:q,href:m.href};if(n&&p(ut,tt))continue;let bt=/url\(/i.test(B)?yield w(b,m.href):b;F+=bt+""}F.trim()&&(k+=F+"")}catch(C){console.warn("[snapdom] Failed to process stylesheet:",m.href)}for(let m of document.styleSheets)try{if(m.href&&P.some(x=>x.href===m.href))continue;let C=m.cssRules||[];for(let x of C){if(x.type!==CSSRule.FONT_FACE_RULE)continue;let F=(x.style.getPropertyValue("font-family")||"").trim(),b=Lt(F);if(!b||Q(b))continue;let A=(x.style.getPropertyValue("font-weight")||"400").trim(),R=(x.style.getPropertyValue("font-style")||"normal").trim(),T=(x.style.getPropertyValue("font-stretch")||"100%").trim(),I=(x.style.getPropertyValue("src")||"").trim(),U=(x.style.getPropertyValue("unicode-range")||"").trim(),W=h(I,m.href||location.href);if(!f(b,R,A,T))continue;let B=l(U);if(!u(e,B))continue;let q={family:b,weightSpec:A,styleSpec:R,stretchSpec:T,unicodeRange:U,srcRaw:I,srcUrls:W,href:m.href||location.href};if(!(n&&p(q,B)))if(/url\(/i.test(I)){let tt=yield w(I,m.href||location.href);k+=`@font-face{font-family:${b};src:${tt};font-style:${R};font-weight:${A};font-stretch:${T};${U?`unicode-range:${U};`:""}}`}else k+=`@font-face{font-family:${b};src:${I};font-style:${R};font-weight:${A};font-stretch:${T};${U?`unicode-range:${U};`:""}}`}}catch(C){}try{for(let m of document.fonts||[]){if(!m||!m.family||m.status!=="loaded"||!m._snapdomSrc)continue;let C=String(m.family).replace(/^['"]+|['"]+$/g,"");if(Q(C)||!a.has(C)||n!=null&&n.families&&n.families.some(F=>String(F).toLowerCase()===C.toLowerCase()))continue;let x=m._snapdomSrc;if(!String(x).startsWith("data:")){if((wt=g.resource)!=null&&wt.has(m._snapdomSrc))x=g.resource.get(m._snapdomSrc),(D=g.font)==null||D.add(m._snapdomSrc);else if(!((lt=g.font)!=null&<.has(m._snapdomSrc)))try{let F=yield V(m._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(F.ok&&typeof F.data=="string")x=F.data,(Y=g.resource)==null||Y.set(m._snapdomSrc,x),(ot=g.font)==null||ot.add(m._snapdomSrc);else continue}catch(F){console.warn("[snapdom] Failed to fetch dynamic font src:",m._snapdomSrc);continue}}k+=`@font-face{font-family:'${C}';src:url(${x});font-style:${m.style||"normal"};font-weight:${m.weight||"normal"};}`}}catch(m){}for(let m of r){if(!m||typeof m!="object")continue;let C=String(m.family||"").replace(/^['"]+|['"]+$/g,"");if(!C||Q(C)||!a.has(C)||n!=null&&n.families&&n.families.some(T=>String(T).toLowerCase()===C.toLowerCase()))continue;let x=m.weight!=null?String(m.weight):"normal",F=m.style!=null?String(m.style):"normal",b=m.stretchPct!=null?`${m.stretchPct}%`:"100%",A=String(m.src||""),R=A;if(!R.startsWith("data:")){if((Mt=g.resource)!=null&&Mt.has(A))R=g.resource.get(A),(j=g.font)==null||j.add(A);else if(!((X=g.font)!=null&&X.has(A)))try{let T=yield V(A,{as:"dataURL",useProxy:o,silent:!0});if(T.ok&&typeof T.data=="string")R=T.data,(J=g.resource)==null||J.set(A,R),(Z=g.font)==null||Z.add(A);else continue}catch(T){console.warn("[snapdom] Failed to fetch localFonts src:",A);continue}}k+=`@font-face{font-family:'${C}';src:url(${R});font-style:${F};font-weight:${x};font-stretch:${b};}`}return k&&(k=y(k),(ft=g.resource)==null||ft.set(L,k)),k})}function It(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let c=Lt(s.fontFamily);if(!c)return;let i=(f,l,u)=>`${c}__${Nt(f)}__${Qt(l)}__${An(u)}`;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,c=getComputedStyle(s);r(c);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let f=getComputedStyle(s,"::after");f&&f.content&&f.content!=="none"&&r(f)}return e}function _t(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 c=getComputedStyle(a,s),i=c==null?void 0:c.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let f=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(f)for(let l of f)try{e.add(parseInt(l.slice(1),16))}catch(u){}}}}}return e}function Pt(t,e=2){return v(this,null,function*(){try{yield document.fonts.ready}catch(o){}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(),yield new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))})}function be(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Fn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function ge(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 ye(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 we(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 ge(t,!1);case"upper-alpha":return ge(t,!0);case"lower-roman":return ye(t,!1);case"upper-roman":return ye(t,!0);default:return String(Math.max(0,t))}}function Se(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=f=>f&&f.tagName==="LI",o=f=>{let l=0,u=f==null?void 0:f.parentElement;if(!u)return 0;for(let h of u.children){if(h===f)break;h.tagName==="LI"&&l++}return l},a=f=>{let l=new Map;for(let[u,h]of f)l.set(u,h.slice());return l},s=(f,l,u)=>{var d,p;let h=a(f),w;try{w=((d=u.style)==null?void 0:d.counterReset)||getComputedStyle(u).counterReset}catch(y){}if(w&&w!=="none")for(let y of w.split(",")){let $=y.trim().split(/\s+/),L=$[0],M=Number.isFinite(Number($[1]))?Number($[1]):0;if(!L)continue;let S=l.get(L);if(S&&S.length){let k=S.slice();k.push(M),h.set(L,k)}else h.set(L,[M])}let E;try{E=((p=u.style)==null?void 0:p.counterIncrement)||getComputedStyle(u).counterIncrement}catch(y){}if(E&&E!=="none")for(let y of E.split(",")){let $=y.trim().split(/\s+/),L=$[0],M=Number.isFinite(Number($[1]))?Number($[1]):1;if(!L)continue;let S=h.get(L)||[];S.length===0&&S.push(0),S[S.length-1]+=M,h.set(L,S)}try{if(getComputedStyle(u).display==="list-item"&&r(u)){let $=u.parentElement,L=1;if($&&$.tagName==="OL"){let S=$.getAttribute("start"),k=Number.isFinite(Number(S))?Number(S):1,P=o(u),N=u.getAttribute("value");L=Number.isFinite(Number(N))?Number(N):k+P}else L=1+o(u);let M=h.get("list-item")||[];M.length===0&&M.push(0),M[M.length-1]=L,h.set("list-item",M)}}catch(y){}return h},c=(f,l,u)=>{let h=s(u,l,f);e.set(f,h);let w=h;for(let E of f.children)w=c(E,h,w);return h},i=new Map;return c(n,i,i),{get(f,l){var h;let u=(h=e.get(f))==null?void 0:h.get(l);return u&&u.length?u[u.length-1]:0},getStack(f,l){var h;let u=(h=e.get(f))==null?void 0:h.get(l);return u?u.slice():[]}}}function xe(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,c)=>{var f,l,u,h;let i=String(c).split(",").map(w=>w.trim());if(s==="counter"){let w=(f=i[0])==null?void 0:f.replace(/^["']|["']$/g,""),E=(i[1]||"decimal").toLowerCase(),d=n.get(e,w);return we(d,E)}else{let w=(l=i[0])==null?void 0:l.replace(/^["']|["']$/g,""),E=(h=(u=i[1])==null?void 0:u.replace(/^["']|["']$/g,""))!=null?h:"",d=(i[2]||"decimal").toLowerCase(),p=n.getStack(e,w);return p.length?p.map($=>we($,d)).join(E):""}});return Fn(o)}catch(r){return"- "}}var Ce=null;function Zt(t,e,n,r){return v(this,null,function*(){var s;if(!(t instanceof Element)||!(e instanceof Element))return;for(let c of["::before","::after","::first-letter"])try{let i=pt(t,c);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(c==="::first-letter"){let j=getComputedStyle(t);if(!(i.color!==j.color||i.fontSize!==j.fontSize||i.fontWeight!==j.fontWeight))continue;let J=Array.from(e.childNodes).find(R=>{var T;return R.nodeType===Node.TEXT_NODE&&((T=R.textContent)==null?void 0:T.trim().length)>0});if(!J)continue;let Z=J.textContent,ft=Z.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),m=ft==null?void 0:ft[0],C=Z.slice((m==null?void 0:m.length)||0);if(!m||/[\uD800-\uDFFF]/.test(m))continue;let x=document.createElement("span");x.textContent=m,x.dataset.snapdomPseudo="::first-letter";let F=Rt(i),b=xt(F,"span");n.styleMap.set(x,b);let A=document.createTextNode(C);e.replaceChild(A,J),e.insertBefore(x,A);continue}let l=i.content,u=Xt(l);be(l)&&(Ce=Se(t.ownerDocument||document),u=xe(u,t,Ce));let h=i.backgroundImage,w=i.backgroundColor,E=i.fontFamily,d=parseInt(i.fontSize)||32,p=parseInt(i.fontWeight)||!1,y=i.color||"#000",$=i.display,L=parseFloat(i.width),M=parseFloat(i.height),S=i.borderStyle,k=parseFloat(i.borderWidth),P=i.transform,N=Q(E),_=l!=="none"&&u!=="",O=h&&h!=="none",K=w&&w!=="transparent"&&w!=="rgba(0, 0, 0, 0)",et=$!=="inline"&&(L>0||M>0),nt=S&&S!=="none"&&k>0,rt=P&&P!=="none";if(!(_||O||K||et||nt||rt))continue;let D=document.createElement("span");D.dataset.snapdomPseudo=c,D.style.verticalAlign="middle";let lt=Rt(i),Y=xt(lt,"span");if(n.styleMap.set(D,Y),N&&u.length===1){let{dataUrl:j,width:X,height:J}=yield pe(u,E,p,d,y),Z=document.createElement("img");Z.src=j,Z.style=`height:${d}px;width:${X/J*d}px;object-fit:contain;`,D.appendChild(Z),e.dataset.snapdomHasIcon="true"}else if(u.startsWith("url(")){let j=dt(u);if(j!=null&&j.trim())try{let X=document.createElement("img"),J=yield V(it(j),{as:"dataURL",useProxy:r.useProxy});X.src=J.data,X.style=`width:${d}px;height:auto;object-fit:contain;`,D.appendChild(X)}catch(X){console.error(`[snapdom] Error in pseudo ${c} for`,t,X)}}else!N&&_&&(D.textContent=u);if(O)try{let j=gt(h),X=yield Promise.all(j.map(ht));D.style.backgroundImage=X.join(", ")}catch(j){console.warn(`[snapdom] Failed to inline background-image for ${c}`,j)}if(K&&(D.style.backgroundColor=w),!(D.childNodes.length>0||((s=D.textContent)==null?void 0:s.trim())!==""||O||K||et||nt||rt))continue;c==="::before"?e.insertBefore(D,e.firstChild):e.appendChild(D)}catch(i){console.warn(`[snapdom] Failed to capture ${c} for`,t,i)}let o=Array.from(t.children),a=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);for(let c=0;c<Math.min(o.length,a.length);c++)yield Zt(o[c],a[c],n,r)})}function Ae(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(c=>{let i=c.getAttribute("xlink:href")||c.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(c=>c.tagName.toLowerCase()==="symbol"),o=n.filter(c=>c.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(c=>{s.add(c.id)}),e.forEach(c=>{if(s.has(c))return;let i=r.find(f=>f.id===c);if(i){a.appendChild(i.cloneNode(!0)),s.add(c);return}for(let f of o){let l=f.querySelector(`#${CSS.escape(c)}`);if(l){let u=a.querySelector("defs");u||(u=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(u)),u.appendChild(l.cloneNode(!0)),s.add(c);break}}})}function $e(n){return v(this,arguments,function*(t,e={}){var i,f;let r={styleMap:g.session.styleMap,styleCache:g.session.styleCache,nodeMap:g.session.nodeMap},o,a="",s="";Rn(t);try{Ae(t)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{o=yield At(t,r,e,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{yield Zt(t,o,r,e)}catch(l){console.warn("inlinePseudoElements failed:",l)}yield In(o);try{let l=o.querySelectorAll("style[data-sd]");for(let u of l)s+=u.textContent||"",u.remove()}catch(l){}let c=Vt(r.styleMap);a=Array.from(c.entries()).map(([l,u])=>`.${u}{${l}}`).join(""),a=s+a;for(let[l,u]of r.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",u.replace(/;/g,"; "));continue}let h=c.get(u);h&&l.classList.add(h);let w=(i=l.style)==null?void 0:i.backgroundImage,E=(f=l.dataset)==null?void 0:f.snapdomHasIcon;w&&w!=="none"&&(l.style.backgroundImage=w),E&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,u]of r.nodeMap.entries()){let h=u.scrollLeft,w=u.scrollTop;if((h||w)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let d=document.createElement("div");for(d.style.transform=`translate(${-h}px, ${-w}px)`,d.style.willChange="transform",d.style.display="inline-block",d.style.width="100%";l.firstChild;)d.appendChild(l.firstChild);l.appendChild(d)}}if(t===r.nodeMap.get(o)){let l=r.styleCache.get(t)||window.getComputedStyle(t);r.styleCache.set(t,l);let u=Ot(l.transform);o.style.margin="0",o.style.position="static",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.zIndex="auto",o.style.float="none",o.style.clear="none",o.style.transform=u||""}for(let[l,u]of r.nodeMap.entries())u.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:o,classCSS:a,styleCache:r.styleCache}})}function Rn(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,c=o==="none"||parseFloat(a)===0;s&&c&&(t.style.border=`${r} solid transparent`)}var kt=new Map;function $t(t){return v(this,null,function*(){var n;if((n=g.resource)!=null&&n.has(t))return g.resource.get(t);if(kt.has(t))return kt.get(t);let e=v(null,null,function*(){var o;let r=yield V(t,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return(o=g.resource)==null||o.set(t,r.data),r.data});kt.set(t,e);try{let r=yield e;return kt.set(t,r),r}catch(r){throw kt.delete(t),r}})}var Ln=/\bblob:[^)"'\s]+/g;function ke(t){return v(this,null,function*(){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Ln)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=yield $t(r);n=n.split(r).join(o)}catch(o){}return n})}function Ut(t){return typeof t=="string"&&t.startsWith("blob:")}function Nn(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 Tn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}function In(t){return v(this,null,function*(){var s,c;if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let l=i.getAttribute("src")||i.currentSrc||"";if(Ut(l)){let h=yield $t(l);i.setAttribute("src",h)}let u=i.getAttribute("srcset");if(u&&u.includes("blob:")){let h=Nn(u),w=!1;for(let E of h)if(Ut(E.url))try{E.url=yield $t(E.url),w=!0}catch(d){}w&&i.setAttribute("srcset",Tn(h))}}catch(f){}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let f="http://www.w3.org/1999/xlink",l=i.getAttribute("href")||((s=i.getAttributeNS)==null?void 0:s.call(i,f,"href"));if(Ut(l)){let u=yield $t(l);i.setAttribute("href",u),(c=i.removeAttributeNS)==null||c.call(i,f,"href")}}catch(f){}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of r)try{let f=i.getAttribute("style");if(f&&f.includes("blob:")){let l=yield ke(f);i.setAttribute("style",l)}}catch(f){}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of o)try{let f=i.textContent||"";f.includes("blob:")&&(i.textContent=yield ke(f))}catch(f){}let a=["poster"];for(let i of a){let f=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let l of f)try{let u=l.getAttribute(i);Ut(u)&&l.setAttribute(i,yield $t(u))}catch(u){}}})}function Me(n){return v(this,arguments,function*(t,e={}){let r=Array.from(t.querySelectorAll("img")),o=a=>v(null,null,function*(){var u,h,w,E;if(!a.getAttribute("src")){let d=a.currentSrc||a.src||"";d&&a.setAttribute("src",d)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let s=a.src||"";if(!s)return;let c=yield V(s,{as:"dataURL",useProxy:e.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){a.src=c.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{fallbackURL:i}=e||{};if(i)try{let d=parseInt(((u=a.dataset)==null?void 0:u.snapdomWidth)||"",10)||0,p=parseInt(((h=a.dataset)==null?void 0:h.snapdomHeight)||"",10)||0,y=parseInt(a.getAttribute("width")||"",10)||0,$=parseInt(a.getAttribute("height")||"",10)||0,L=parseFloat(((w=a.style)==null?void 0:w.width)||"")||0,M=parseFloat(((E=a.style)==null?void 0:E.height)||"")||0,S=d||L||y||a.width||void 0,k=p||M||$||a.height||void 0,P=typeof i=="function"?yield i({width:S,height:k,src:s,element:a}):i;if(P){let N=yield V(P,{as:"dataURL",useProxy:e.useProxy});a.src=N.data,!a.width&&S&&(a.width=S),!a.height&&k&&(a.height=k),a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}}catch(d){}let f=a.width||a.naturalWidth||100,l=a.height||a.naturalHeight||100;if(e.placeholders!==!1){let d=document.createElement("div");d.style.cssText=[`width:${f}px`,`height:${l}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${l}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),d.textContent="img",a.replaceWith(d)}else{let d=document.createElement("div");d.style.cssText=`display:inline-block;width:${f}px;height:${l}px;visibility:hidden;`,a.replaceWith(d)}});for(let a=0;a<r.length;a+=4){let s=r.slice(a,a+4).map(o);yield Promise.allSettled(s)}})}function Wt(o,a,s){return v(this,arguments,function*(t,e,n,r={}){let c=[[t,e]],i=["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"],f=["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(;c.length;){let[u,h]=c.shift(),w=n.get(u)||pt(u);n.has(u)||n.set(u,w);let E=(()=>{let y=w.getPropertyValue("border-image"),$=w.getPropertyValue("border-image-source");return y&&y!=="none"||$&&$!=="none"})();for(let y of i){let $=w.getPropertyValue(y);if(!$||$==="none")continue;let L=gt($),M=yield Promise.all(L.map(S=>ht(S,r)));M.some(S=>S&&S!=="none"&&!/^url\(undefined/.test(S))&&h.style.setProperty(y,M.join(", "))}for(let y of f){let $=w.getPropertyValue(y);!$||$==="initial"||h.style.setProperty(y,$)}if(E)for(let y of l){let $=w.getPropertyValue(y);!$||$==="initial"||h.style.setProperty(y,$)}let d=Array.from(u.children),p=Array.from(h.children);for(let y=0;y<Math.min(d.length,p.length);y++)c.push([d[y],p[y]])}})}function Ee(t){var f;if(!t)return()=>{};let e=_n(t);if(e<=0)return()=>{};if(!Wn(t))return()=>{};let n=getComputedStyle(t),r=Math.round(Pn(n)*e+Un(n)),o=(f=t.textContent)!=null?f:"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,c=o.length,i=-1;for(;s<=c;){let l=s+c>>1;t.textContent=o.slice(0,l)+"\u2026",t.scrollHeight<=r+.5?(i=l,s=l+1):c=l-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function _n(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 Pn(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 Un(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Wn(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function ee(t,e){return v(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");Et(e.cache);let n=e.fast,r,o,a,s="",c="",i,f,l=Ee(t);try{({clone:r,classCSS:o,styleCache:a}=yield $e(t,e))}finally{l()}yield new Promise(E=>{at(()=>v(null,null,function*(){yield Me(r,e),E()}),{fast:n})}),yield new Promise(E=>{at(()=>v(null,null,function*(){yield Wt(t,r,a,e),E()}),{fast:n})}),e.embedFonts&&(yield new Promise(E=>{at(()=>v(null,null,function*(){let d=It(t),p=_t(t);if(st){let y=new Set(Array.from(d).map($=>String($).split("__")[0]).filter(Boolean));yield Pt(y,2)}s=yield Tt({required:d,usedCodepoints:p,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),E()}),{fast:n})}));let u=jt(r).sort(),h=u.join(",");g.baseStyle.has(h)?c=g.baseStyle.get(h):yield new Promise(E=>{at(()=>{c=zt(u),g.baseStyle.set(h,c),E()},{fast:n})}),yield new Promise(E=>{at(()=>{var m,C,x,F,b;let d=t.getBoundingClientRect(),p=Number(d.width)||0,y=Number(d.height)||0,$=Number.isFinite(e.width),L=Number.isFinite(e.height),M=(m=e.scale)!=null?m:1,S=typeof M=="number"&&M!==1;if(!S){let A=y>0?p/y:1;$&&L?(p=Number(e.width),y=Number(e.height)):$?(p=Number(e.width),y=p/(A||1)):L&&(y=Number(e.height),p=y*(A||1))}p=Math.max(1,Math.ceil(Number.isFinite(p)?p:1)),y=Math.max(1,Math.ceil(Number.isFinite(y)?y:1));let k=getComputedStyle(t),P=k.transform&&k.transform!=="none"?k.transform:"",N=Dn(t),_,O,K,et,nt=0,rt=0;if(qn(t)){let A=zn({baseTransform:P,rotate:N.rotate||"0deg",scale:N.scale,translate:N.translate}),R=(x=(C=A.e)!=null?C:A.m41)!=null?x:0,T=(b=(F=A.f)!=null?F:A.m42)!=null?b:0;nt=-R,rt=-T;let I=A.is2D?ve(A):ve(new DOMMatrix(A.toString())),U=On(p,y,I);_=Math.max(1,Math.ceil(U.width)),O=Math.max(1,Math.ceil(U.height)),K=-U.minX,et=-U.minY}else{let A=t.getBoundingClientRect(),R=Hn(A,{top:0,right:0,bottom:0,left:0});_=Math.max(1,R.width),O=Math.max(1,R.height),K=-(R.x-Math.floor(A.left)),et=-(R.y-Math.floor(A.top))}let wt="http://www.w3.org/2000/svg",D=document.createElementNS(wt,"foreignObject");D.setAttribute("width","100%"),D.setAttribute("height","100%"),D.setAttribute("x",String(K)),D.setAttribute("y",String(et)),D.style.overflow="visible";let lt=document.createElement("style");lt.textContent=c+s+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o,D.appendChild(lt);let Y=document.createElement("div");Y.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Y.style.width=`${p}px`,Y.style.height=`${y}px`,Y.style.overflow="visible",Y.style.transformOrigin="0 0";let ot=[];if((nt||rt)&&ot.push(`translate(${nt}px, ${rt}px)`),!S&&($||L)){let A=d.width?p/d.width:1,R=d.height?y/d.height:1;ot.push(`scale(${A}, ${R})`)}else S&&ot.push(`scale(${M})`);ot.length&&(Y.style.transform=ot.join(" ")),r.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),r.style.transformOrigin="0 0",r.style.position="static",r.style.left="0",r.style.top="0",P&&(r.style.transform=P),r.style.rotate=N.rotate||"0deg",r.style.scale=N.scale||"1",r.style.translate=N.translate||"0 0",Y.appendChild(r),D.appendChild(Y);let j=new XMLSerializer().serializeToString(D);f=`<svg xmlns="${wt}" width="${!S&&($||L)?p:_}" height="${!S&&(L||$)?y:O}" viewBox="0 0 ${_} ${O}">`+j+"</svg>",i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,E()},{fast:n})});let w=document.getElementById("snapdom-sandbox");return w&&w.style.position==="absolute"&&w.remove(),i})}function Bn(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch(n){return new WebKitCSSMatrix(e)}}function ve(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function On(t,e,n){let o=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(f=>({x:n.a*f.x+n.c*f.y,y:n.b*f.x+n.d*f.y})),a=Math.min(...o.map(f=>f.x)),s=Math.max(...o.map(f=>f.x)),c=Math.min(...o.map(f=>f.y)),i=Math.max(...o.map(f=>f.y));return{minX:a,minY:c,width:s-a,height:i-c}}function Dn(t){var o,a,s,c,i,f,l,u,h,w,E,d,p;let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let y=S=>{try{return typeof n.has=="function"&&!n.has(S)||typeof n.get!="function"?null:n.get(S)}catch(k){return null}},$=y("rotate");if($){let S=(o=$.angle)!=null?o:$;S&&typeof S=="object"&&"unit"in S?e.rotate=S.unit==="rad"?S.value*180/Math.PI+"deg":S.value+S.unit:e.rotate=String($)}let L=y("scale");if(L&&L.length){let S=(s=(a=L[0])==null?void 0:a.value)!=null?s:1,k=(i=(c=L[1])==null?void 0:c.value)!=null?i:S;e.scale=`${S} ${k}`}let M=y("translate");if(M&&M.length){let S=(l=(f=M[0])==null?void 0:f.value)!=null?l:0,k=(h=(u=M[1])==null?void 0:u.value)!=null?h:0,P=(E=(w=M[0])==null?void 0:w.unit)!=null?E:"px",N=(p=(d=M[1])==null?void 0:d.unit)!=null?p:"px";e.translate=`${S}${P} ${k}${N}`}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 qn(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function Hn(t,e){let n=Math.floor(t.left-e.left),r=Math.floor(t.top-e.top),o=Math.ceil(t.width+e.left+e.right),a=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:r,width:o,height:a}}var te=null;function jn(){if(te)return te;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),te=t,t}function zn(t){let e=jn(),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=Bn(n);return e.removeChild(n),r}function Vn(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Fe(t={}){var r,o,a,s,c,i,f,l,u,h,w,E,d,p,y,$,L,M;let e=(r=t.format)!=null?r:"png",n=Vn(t.cache);return{debug:(o=t.debug)!=null?o:!1,fast:(a=t.fast)!=null?a:!0,scale:(s=t.scale)!=null?s:1,exclude:(c=t.exclude)!=null?c:[],excludeMode:(i=t.excludeMode)!=null?i:"hide",filter:(f=t.filter)!=null?f:null,filterMode:(l=t.filterMode)!=null?l:"hide",placeholders:t.placeholders!==!1,embedFonts:(u=t.embedFonts)!=null?u:!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:(h=t.excludeFonts)!=null?h:void 0,fallbackURL:(w=t.fallbackURL)!=null?w:void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:(E=t.width)!=null?E:null,height:(d=t.height)!=null?d:null,format:e,type:(p=t.type)!=null?p:"svg",quality:(y=t.quality)!=null?y:.92,dpr:($=t.dpr)!=null?$:window.devicePixelRatio||1,backgroundColor:(L=t.backgroundColor)!=null?L:["jpg","jpeg","webp"].includes(e)?"#ffffff":null,filename:(M=t.filename)!=null?M:"snapDOM"}}function Re(t,e){return v(this,null,function*(){let n=new Image;return n.src=t,yield n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n})}function ct(t,e){return v(this,null,function*(){let{scale:n,dpr:r}=e,o=new Image;o.crossOrigin="anonymous",o.loading="eager",o.decoding="sync",o.src=t,yield o.decode();let a=o.naturalWidth*n,s=o.naturalHeight*n,c=document.createElement("canvas");c.width=Math.ceil(a*r),c.height=Math.ceil(s*r),c.style.width=`${a}px`,c.style.height=`${s}px`;let i=c.getContext("2d");return r!==1&&i.scale(r,r),i.drawImage(o,0,0,a,s),c})}function Bt(t,e){return v(this,null,function*(){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=yield ct(t,e),o=e.backgroundColor?mt(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))})}function Le(t,e){return v(this,null,function*(){let n=yield ct(t,e),r=e.backgroundColor?mt(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),yield o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o})}function Ne(t,e){return v(this,null,function*(){if(e.dpr=1,e.format==="svg"){let a=yield Bt(t,G(z({},e),{type:"svg"})),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.filename,c.click(),URL.revokeObjectURL(s);return}let n=yield ct(t,e),r=e.backgroundColor?mt(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()})}var Te=Symbol("snapdom.internal"),ne=!1;function H(t,e){return v(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");if(st())for(let r=0;r<3;r++)try{yield Xn(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),ne=!1}catch(o){}let n=Fe(e);return n.iconFonts&&n.iconFonts.length>0&&he(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>H.toPng(r,o),toImg:(r,o)=>H.toImg(r,o)}),H.capture(t,n,Te)})}H.capture=(t,e,n)=>v(null,null,function*(){if(n!==Te)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=yield ee(t,e),o=s=>z(z({},e),s||{}),a=s=>c=>{let i=o(G(z({},c||{}),{format:s})),f=s==="jpeg"||s==="jpg",l=i.backgroundColor==null||i.backgroundColor==="transparent";return f&&l&&(i.backgroundColor="#ffffff"),Le(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Re(r,o(s)),toCanvas:s=>ct(r,o(s)),toBlob:s=>Bt(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ne(r,o(s))}});H.toRaw=(t,e)=>H(t,e).then(n=>n.toRaw());H.toImg=(t,e)=>H(t,e).then(n=>n.toImg());H.toCanvas=(t,e)=>H(t,e).then(n=>n.toCanvas());H.toBlob=(t,e)=>H(t,e).then(n=>n.toBlob());H.toPng=(t,e)=>H(t,G(z({},e),{format:"png"})).then(n=>n.toPng());H.toJpg=(t,e)=>H(t,G(z({},e),{format:"jpeg"})).then(n=>n.toJpg());H.toWebp=(t,e)=>H(t,G(z({},e),{format:"webp"})).then(n=>n.toWebp());H.download=(t,e)=>H(t,e).then(n=>n.download());function Xn(t,e){return v(this,null,function*(){if(ne)return;let n=G(z({},e),{fast:!0,embedFonts:!0,scale:.2}),r;try{r=yield ee(t,n)}catch(o){return}yield 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=()=>v(null,null,function*(){yield new Promise(c=>setTimeout(c,100)),a&&a.parentNode&&a.parentNode.removeChild(a),ne=!0,o()});document.body.appendChild(a),s()})})}function Ie(){return v(this,arguments,function*(t=document,e={}){var i,f,l,u;let{embedFonts:n=!0,useProxy:r=""}=e,o=(f=(i=e.cache)!=null?i:e.cacheOpt)!=null?f:"full";Et(o);try{yield(l=document.fonts)==null?void 0:l.ready}catch(h){}try{qt()}catch(h){}g.session=g.session||{},g.session.styleCache||(g.session.styleCache=new WeakMap),g.image=g.image||new Map;try{yield Wt(t,void 0,g.session.styleCache,{useProxy:r})}catch(h){}let a=[],s=[];try{t!=null&&t.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch(h){}let c=[];for(let h of a){let w=(h==null?void 0:h.currentSrc)||(h==null?void 0:h.src);if(w&&!g.image.has(w)){let E=Promise.resolve().then(()=>v(null,null,function*(){let d=yield V(w,{as:"dataURL",useProxy:r});d!=null&&d.ok&&typeof d.data=="string"&&g.image.set(w,d.data)})).catch(()=>{});c.push(E)}}for(let h of s){let w="";try{w=pt(h).backgroundImage}catch(E){}if(w&&w!=="none"){let E=gt(w);for(let d of E)if(d.startsWith("url(")){let p=Promise.resolve().then(()=>ht(d,G(z({},e),{useProxy:r}))).catch(()=>{});c.push(p)}}}if(n)try{let h=It(t),w=_t(t);if(typeof st=="function"?st():!!st){let d=new Set(Array.from(h).map(p=>String(p).split("__")[0]).filter(Boolean));yield Pt(d,2)}yield Tt({required:h,usedCodepoints:w,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:(u=e.useProxy)!=null?u:r})}catch(h){}yield Promise.allSettled(c)})}typeof window!="undefined"&&(window.snapdom=H,window.preCache=Ie);})();
|
|
4
|
+
`}catch(o){}}catch(n){}return e}function gn(t,e,n){if(!e)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=e,t.insertBefore(r,t.firstChild||null)}function yn(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch(n){}}function wn(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(t);)e.add(r[1]);return e}function bn(t,e){try{let r=getComputedStyle(t).getPropertyValue(e).trim();if(r)return r}catch(n){}try{let r=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(r)return r}catch(n){}return""}function Sn(t,e,n){let r=[];for(let o of e){let a=bn(t,o);a&&r.push(`${o}: ${a};`)}return r.length?`${n}{${r.join("")}}
|
|
5
|
+
`:""}function xn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}function Cn(t,e=3){return F(this,null,function*(){let n=()=>{var a;try{return t.contentDocument||((a=t.contentWindow)==null?void 0:a.document)||null}catch(s){return null}},r=n(),o=0;for(;o<e&&(!r||!r.body&&!r.documentElement);)yield new Promise(a=>setTimeout(a,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null})}function kn(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(i){}let s=Math.max(0,Math.round(e.width-(n+r))),c=Math.max(0,Math.round(e.height-(o+a)));return{contentWidth:s,contentHeight:c,rect:e}}function An(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(o){}}}function En(t,e,n){return F(this,null,function*(){let r=yield Cn(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:a,rect:s}=kn(t),c=n==null?void 0:n.snap;if(!c||typeof c.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i=G(z({},n),{scale:1}),f=An(r,o,a),l;try{l=yield c.toPng(r.documentElement,i)}finally{f()}l.style.display="block",l.style.width=`${o}px`,l.style.height=`${a}px`;let u=document.createElement("div");return e.nodeMap.set(u,t),yt(t,u,e,n),u.style.overflow="hidden",u.style.display="block",u.style.width||(u.style.width=`${Math.round(s.width)}px`),u.style.height||(u.style.height=`${Math.round(s.height)}px`),u.appendChild(l),u})}function kt(t,e,n){return F(this,null,function*(){var f,l,u,h,w,$;if(!t)throw new Error("Invalid node");let r=new Set,o=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let d=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||vt.has(d))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 d=document.createElement("div"),p=t.getBoundingClientRect();return d.style.cssText=`display:inline-block;width:${p.width}px;height:${p.height}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let d of n.exclude)try{if((f=t.matches)!=null&&f.call(t,d)){if(n.excludeMode==="hide"){let p=document.createElement("div"),y=t.getBoundingClientRect();return p.style.cssText=`display:inline-block;width:${y.width}px;height:${y.height}px;visibility:hidden;`,p}else if(n.excludeMode==="remove")return null}}catch(p){console.warn(`Invalid selector in exclude option: ${d}`,p)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let d=document.createElement("div"),p=t.getBoundingClientRect();return d.style.cssText=`display:inline-block;width:${p.width}px;height:${p.height}px;visibility:hidden;`,d}else if(n.filterMode==="remove")return null}}catch(d){console.warn("Error in filter function:",d)}if(t.tagName==="IFRAME"){let d=!1;try{d=!!(t.contentDocument||(l=t.contentWindow)!=null&&l.document)}catch(p){d=!1}if(d)try{return yield En(t,e,n)}catch(p){console.warn("[SnapDOM] iframe rasterization failed, fallback:",p)}if(n.placeholders){let p=document.createElement("div");return p.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;`,yt(t,p,e,n),p}else{let p=t.getBoundingClientRect(),y=document.createElement("div");return y.style.cssText=`display:inline-block;width:${p.width}px;height:${p.height}px;visibility:hidden;`,yt(t,y,e,n),y}}if(t.getAttribute("data-capture")==="placeholder"){let d=t.cloneNode(!1);e.nodeMap.set(d,t),yt(t,d,e,n);let p=document.createElement("div");return p.textContent=t.getAttribute("data-placeholder-text")||"",p.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",d.appendChild(p),d}if(t.tagName==="CANVAS"){let d=t.toDataURL(),p=document.createElement("img");return p.src=d,p.width=t.width,p.height=t.height,e.nodeMap.set(p,t),yt(t,p,e,n),p}let s;try{if(s=t.cloneNode(!1),e.nodeMap.set(s,t),t.tagName==="IMG"){yn(t,s);try{let d=t.getBoundingClientRect(),p=Math.round(d.width||0),y=Math.round(d.height||0);if(!p||!y){let E=window.getComputedStyle(t),R=parseFloat(E.width)||0,M=parseFloat(E.height)||0,S=parseInt(t.getAttribute("width")||"",10)||0,A=parseInt(t.getAttribute("height")||"",10)||0,P=t.width||t.naturalWidth||0,N=t.height||t.naturalHeight||0;p=Math.round(p||R||S||P||0),y=Math.round(y||M||A||N||0)}p&&(s.dataset.snapdomWidth=String(p)),y&&(s.dataset.snapdomHeight=String(y))}catch(d){}}}catch(d){throw console.error("[Snapdom] Failed to clone node:",t,d),d}if(t instanceof HTMLTextAreaElement){let d=t.getBoundingClientRect();s.style.width=`${d.width}px`,s.style.height=`${d.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),yt(t,s,e,n),t.shadowRoot){let A=function(N,_){if(N.nodeType===Node.ELEMENT_NODE&&N.tagName==="STYLE")return _(null);kt(N,e,n).then(O=>{_(O||null)}).catch(O=>{_(null)})};try{let N=t.shadowRoot.querySelectorAll("slot");for(let _ of N){let O=[];try{O=((u=_.assignedNodes)==null?void 0:u.call(_,{flatten:!0}))||((h=_.assignedNodes)==null?void 0:h.call(_))||[]}catch(K){O=((w=_.assignedNodes)==null?void 0:w.call(_))||[]}for(let K of O)r.add(K)}}catch(N){}let d=hn(e),p=`[data-sd="${d}"]`;try{s.setAttribute("data-sd",d)}catch(N){}let y=pn(t.shadowRoot),E=mn(y,p),R=wn(y),M=Sn(t,R,p);gn(s,M+E,d);let S=document.createDocumentFragment(),P=yield Yt(Array.from(t.shadowRoot.childNodes),A,n.fast);S.append(...P.filter(N=>!!N)),s.appendChild(S)}if(t.tagName==="SLOT"){let E=function(M,S){kt(M,e,n).then(A=>{A&&xn(A),S(A||null)}).catch(A=>{S(null)})},d=(($=t.assignedNodes)==null?void 0:$.call(t,{flatten:!0}))||[],p=d.length>0?d:Array.from(t.childNodes),y=document.createDocumentFragment(),R=yield Yt(Array.from(p),E,n.fast);return y.append(...R.filter(M=>!!M)),y}function c(d,p){if(r.has(d))return p(null);kt(d,e,n).then(y=>{p(y||null)}).catch(y=>{p(null)})}let i=yield Yt(Array.from(t.childNodes),c,n.fast);if(s.append(...i.filter(d=>!!d)),o!==null&&s instanceof HTMLSelectElement){s.value=o;for(let d of s.options)d.value===o?d.setAttribute("selected",""):d.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s})}var Mn=[/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],Jt=[];function he(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Jt.push(n):typeof n=="string"?Jt.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function Q(t){let e=typeof t=="string"?t:"",n=[...Mn,...Jt];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))}function pe(t,e,n,r=32,o="#000"){return F(this,null,function*(){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;yield document.fonts.ready;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 c=s.getBoundingClientRect(),i=Math.ceil(c.width),f=Math.ceil(c.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=i*a,l.height=f*a;let u=l.getContext("2d");return u.scale(a,a),u.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=o,u.fillText(t,0,0),{dataUrl:l.toDataURL(),width:i,height:f}})}var $n=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Rt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!$n.has(n.toLowerCase()))return n}return""}function Nt(t){let e=String(t!=null?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 Qt(t){let e=String(t!=null?t:"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Fn(t){let e=String(t!=null?t:"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function vn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=Nt(n[1]),a=Nt(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=Nt(e);return{min:r,max:r}}function Ln(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Rn(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 Nn(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(c=>o.endsWith(c)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let c of e){let i=c.toLowerCase().replace(/\s+/g,"+"),f=c.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(f))return!0}return!1}catch(n){return!1}}function Tn(t){var n;let e=new Set;for(let r of t||[]){let o=(n=String(r).split("__")[0])==null?void 0:n.trim();o&&e.add(o)}return e}function Tt(){return F(this,arguments,function*({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:o=""}={}){var N,_,O,K,et,nt,rt,wt,D,lt,Y,ot,Mt,j,X,J,Z,ft;t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let m of t){let[C,x,v,b]=String(m).split("__");if(!C)continue;let k=a.get(C)||[];k.push({w:parseInt(x,10),s:v,st:parseInt(b,10)}),a.set(C,k)}let s=/@import\s+url\(["']?([^"')]+)["']?\)/g,c=/url\((["']?)([^"')]+)\1\)/g,i=/@font-face[^{}]*\{[^}]*\}/g;function f(m,C,x,v){if(!a.has(m))return!1;let b=a.get(m),k=vn(x),L=Ln(C),T=Rn(v),I=k.min!==k.max,U=k.min,W=H=>L.kind==="normal"&&H==="normal"||L.kind!=="normal"&&(H==="italic"||H==="oblique"),B=!1;for(let H of b){let tt=I?H.w>=k.min&&H.w<=k.max:H.w===U,ut=W(Qt(H.s)),bt=H.st>=T.min&&H.st<=T.max;if(tt&&ut&&bt){B=!0;break}}if(B)return!0;if(!I)for(let H of b){let tt=W(Qt(H.s)),ut=H.st>=T.min&&H.st<=T.max;if(Math.abs(U-H.w)<=300&&tt&&ut)return!0}return!1}function l(m){if(!m)return[];let C=[],x=m.split(",").map(v=>v.trim()).filter(Boolean);for(let v of x){let b=v.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!b)continue;let k=b[1],L=b[2],T=I=>{if(!I.includes("?"))return parseInt(I,16);let U=parseInt(I.replace(/\?/g,"0"),16),W=parseInt(I.replace(/\?/g,"F"),16);return[U,W]};if(L){let I=T(k),U=T(L),W=Array.isArray(I)?I[0]:I,B=Array.isArray(U)?U[1]:U;C.push([Math.min(W,B),Math.max(W,B)])}else{let I=T(k);Array.isArray(I)?C.push([I[0],I[1]]):C.push([I,I])}}return C}function u(m,C){if(!C.length||!m||m.size===0)return!0;for(let x of m)for(let[v,b]of C)if(x>=v&&x<=b)return!0;return!1}function h(m,C){let x=[];if(!m)return x;for(let v of m.matchAll(c)){let b=(v[2]||"").trim();if(!(!b||b.startsWith("data:"))){if(!/^https?:/i.test(b))try{b=new URL(b,C||location.href).href}catch(k){}x.push(b)}}return x}function w(m,C){return F(this,null,function*(){var v,b,k,L,T;let x=m;for(let I of m.matchAll(c)){let U=dt(I[0]);if(!U)continue;let W=U;if(!W.startsWith("http")&&!W.startsWith("data:"))try{W=new URL(W,C||location.href).href}catch(B){}if(!Q(W)){if((v=g.resource)!=null&&v.has(W)){(b=g.font)==null||b.add(W),x=x.replace(I[0],`url(${g.resource.get(W)})`);continue}if(!((k=g.font)!=null&&k.has(W)))try{let B=yield V(W,{as:"dataURL",useProxy:o,silent:!0});if(B.ok&&typeof B.data=="string"){let H=B.data;(L=g.resource)==null||L.set(W,H),(T=g.font)==null||T.add(W),x=x.replace(I[0],`url(${H})`)}}catch(B){console.warn("[snapDOM] Failed to fetch font resource:",W)}}}return x})}function $(m){if(!m.length)return null;let C=(T,I)=>m.some(([U,W])=>!(W<T||U>I)),x=C(0,255)||C(305,305),v=C(256,591)||C(7680,7935),b=C(880,1023),k=C(1024,1279);return C(7840,7929)||C(258,259)||C(416,417)||C(431,432)?"vietnamese":k?"cyrillic":b?"greek":v?"latin-ext":x?"latin":null}function d(m={}){let C=new Set((m.families||[]).map(b=>String(b).toLowerCase())),x=new Set((m.domains||[]).map(b=>String(b).toLowerCase())),v=new Set((m.subsets||[]).map(b=>String(b).toLowerCase()));return(b,k)=>{if(C.size&&C.has(b.family.toLowerCase()))return!0;if(x.size)for(let L of b.srcUrls)try{if(x.has(new URL(L).host.toLowerCase()))return!0}catch(T){}if(v.size){let L=$(k);if(L&&v.has(L))return!0}return!1}}let p=d(n);function y(m){var k,L,T,I,U,W;if(!m)return m;let C=/@font-face[^{}]*\{[^}]*\}/gi,x=new Set,v=[];for(let B of m.match(C)||[]){let H=((k=B.match(/font-family:\s*([^;]+);/i))==null?void 0:k[1])||"",tt=Rt(H),ut=(((L=B.match(/font-weight:\s*([^;]+);/i))==null?void 0:L[1])||"400").trim(),bt=(((T=B.match(/font-style:\s*([^;]+);/i))==null?void 0:T[1])||"normal").trim(),_e=(((I=B.match(/font-stretch:\s*([^;]+);/i))==null?void 0:I[1])||"100%").trim(),Pe=(((U=B.match(/unicode-range:\s*([^;]+);/i))==null?void 0:U[1])||"").trim(),re=(((W=B.match(/src\s*:\s*([^;]+);/i))==null?void 0:W[1])||"").trim(),oe=h(re,location.href),Ue=oe.length?oe.map(We=>String(We).toLowerCase()).sort().join("|"):re.toLowerCase(),ae=[String(tt||"").toLowerCase(),ut,bt,_e,Pe.toLowerCase(),Ue].join("|");x.has(ae)||(x.add(ae),v.push(B))}if(v.length===0)return m;let b=0;return m.replace(C,()=>v[b++]||"")}function E(){let m=Array.from(t||[]).sort().join("|"),C=n?JSON.stringify({families:(n.families||[]).map(b=>String(b).toLowerCase()).sort(),domains:(n.domains||[]).map(b=>String(b).toLowerCase()).sort(),subsets:(n.subsets||[]).map(b=>String(b).toLowerCase()).sort()}):"",x=(r||[]).map(b=>`${(b.family||"").toLowerCase()}::${b.weight||"normal"}::${b.style||"normal"}::${b.src||""}`).sort().join("|");return`fonts-embed-css::req=${m}::ex=${C}::lf=${x}::px=${o||""}`}let R=E();if((N=g.resource)!=null&&N.has(R))return g.resource.get(R);let M=Tn(t),S=[];for(let m of document.querySelectorAll("style")){let C=m.textContent||"";for(let x of C.matchAll(s)){let v=x[1];if(!v||Q(v))continue;!!document.querySelector(`link[rel="stylesheet"][href="${v}"]`)||S.push(v)}}S.length&&(yield Promise.all(S.map(m=>new Promise(C=>{if(document.querySelector(`link[rel="stylesheet"][href="${m}"]`))return C(null);let x=document.createElement("link");x.rel="stylesheet",x.href=m,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>C(x),x.onerror=()=>C(null),document.head.appendChild(x)}))));let A="",P=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(m=>!!m.href);for(let m of P)try{if(Q(m.href))continue;let C="",x=!1;try{x=new URL(m.href,location.href).origin===location.origin}catch(b){}if(!x&&!Nn(m.href,M))continue;if(x){let b=Array.from(document.styleSheets).find(k=>k.href===m.href);if(b)try{let k=b.cssRules||[];C=Array.from(k).map(L=>L.cssText).join("")}catch(k){}}if(!C&&(C=(yield V(m.href,{as:"text",useProxy:o})).data,Q(m.href)))continue;let v="";for(let b of C.match(i)||[]){let k=(((_=b.match(/font-family:\s*([^;]+);/i))==null?void 0:_[1])||"").trim(),L=Rt(k);if(!L||Q(L))continue;let T=(((O=b.match(/font-weight:\s*([^;]+);/i))==null?void 0:O[1])||"400").trim(),I=(((K=b.match(/font-style:\s*([^;]+);/i))==null?void 0:K[1])||"normal").trim(),U=(((et=b.match(/font-stretch:\s*([^;]+);/i))==null?void 0:et[1])||"100%").trim(),W=(((nt=b.match(/unicode-range:\s*([^;]+);/i))==null?void 0:nt[1])||"").trim(),B=(((rt=b.match(/src\s*:\s*([^;]+);/i))==null?void 0:rt[1])||"").trim(),H=h(B,m.href);if(!f(L,I,T,U))continue;let tt=l(W);if(!u(e,tt))continue;let ut={family:L,weightSpec:T,styleSpec:I,stretchSpec:U,unicodeRange:W,srcRaw:B,srcUrls:H,href:m.href};if(n&&p(ut,tt))continue;let bt=/url\(/i.test(B)?yield w(b,m.href):b;v+=bt+""}v.trim()&&(A+=v+"")}catch(C){console.warn("[snapdom] Failed to process stylesheet:",m.href)}for(let m of document.styleSheets)try{if(m.href&&P.some(x=>x.href===m.href))continue;let C=m.cssRules||[];for(let x of C){if(x.type!==CSSRule.FONT_FACE_RULE)continue;let v=(x.style.getPropertyValue("font-family")||"").trim(),b=Rt(v);if(!b||Q(b))continue;let k=(x.style.getPropertyValue("font-weight")||"400").trim(),L=(x.style.getPropertyValue("font-style")||"normal").trim(),T=(x.style.getPropertyValue("font-stretch")||"100%").trim(),I=(x.style.getPropertyValue("src")||"").trim(),U=(x.style.getPropertyValue("unicode-range")||"").trim(),W=h(I,m.href||location.href);if(!f(b,L,k,T))continue;let B=l(U);if(!u(e,B))continue;let H={family:b,weightSpec:k,styleSpec:L,stretchSpec:T,unicodeRange:U,srcRaw:I,srcUrls:W,href:m.href||location.href};if(!(n&&p(H,B)))if(/url\(/i.test(I)){let tt=yield w(I,m.href||location.href);A+=`@font-face{font-family:${b};src:${tt};font-style:${L};font-weight:${k};font-stretch:${T};${U?`unicode-range:${U};`:""}}`}else A+=`@font-face{font-family:${b};src:${I};font-style:${L};font-weight:${k};font-stretch:${T};${U?`unicode-range:${U};`:""}}`}}catch(C){}try{for(let m of document.fonts||[]){if(!m||!m.family||m.status!=="loaded"||!m._snapdomSrc)continue;let C=String(m.family).replace(/^['"]+|['"]+$/g,"");if(Q(C)||!a.has(C)||n!=null&&n.families&&n.families.some(v=>String(v).toLowerCase()===C.toLowerCase()))continue;let x=m._snapdomSrc;if(!String(x).startsWith("data:")){if((wt=g.resource)!=null&&wt.has(m._snapdomSrc))x=g.resource.get(m._snapdomSrc),(D=g.font)==null||D.add(m._snapdomSrc);else if(!((lt=g.font)!=null&<.has(m._snapdomSrc)))try{let v=yield V(m._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(v.ok&&typeof v.data=="string")x=v.data,(Y=g.resource)==null||Y.set(m._snapdomSrc,x),(ot=g.font)==null||ot.add(m._snapdomSrc);else continue}catch(v){console.warn("[snapdom] Failed to fetch dynamic font src:",m._snapdomSrc);continue}}A+=`@font-face{font-family:'${C}';src:url(${x});font-style:${m.style||"normal"};font-weight:${m.weight||"normal"};}`}}catch(m){}for(let m of r){if(!m||typeof m!="object")continue;let C=String(m.family||"").replace(/^['"]+|['"]+$/g,"");if(!C||Q(C)||!a.has(C)||n!=null&&n.families&&n.families.some(T=>String(T).toLowerCase()===C.toLowerCase()))continue;let x=m.weight!=null?String(m.weight):"normal",v=m.style!=null?String(m.style):"normal",b=m.stretchPct!=null?`${m.stretchPct}%`:"100%",k=String(m.src||""),L=k;if(!L.startsWith("data:")){if((Mt=g.resource)!=null&&Mt.has(k))L=g.resource.get(k),(j=g.font)==null||j.add(k);else if(!((X=g.font)!=null&&X.has(k)))try{let T=yield V(k,{as:"dataURL",useProxy:o,silent:!0});if(T.ok&&typeof T.data=="string")L=T.data,(J=g.resource)==null||J.set(k,L),(Z=g.font)==null||Z.add(k);else continue}catch(T){console.warn("[snapdom] Failed to fetch localFonts src:",k);continue}}A+=`@font-face{font-family:'${C}';src:url(${L});font-style:${v};font-weight:${x};font-stretch:${b};}`}return A&&(A=y(A),(ft=g.resource)==null||ft.set(R,A)),A})}function It(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let c=Rt(s.fontFamily);if(!c)return;let i=(f,l,u)=>`${c}__${Nt(f)}__${Qt(l)}__${Fn(u)}`;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,c=getComputedStyle(s);r(c);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&r(i);let f=getComputedStyle(s,"::after");f&&f.content&&f.content!=="none"&&r(f)}return e}function _t(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 c=getComputedStyle(a,s),i=c==null?void 0:c.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let f=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(f)for(let l of f)try{e.add(parseInt(l.slice(1),16))}catch(u){}}}}}return e}function Pt(t,e=2){return F(this,null,function*(){try{yield document.fonts.ready}catch(o){}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(),yield new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))})}function be(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function In(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function ge(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 ye(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 we(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 ge(t,!1);case"upper-alpha":return ge(t,!0);case"lower-roman":return ye(t,!1);case"upper-roman":return ye(t,!0);default:return String(Math.max(0,t))}}function Se(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=f=>f&&f.tagName==="LI",o=f=>{let l=0,u=f==null?void 0:f.parentElement;if(!u)return 0;for(let h of u.children){if(h===f)break;h.tagName==="LI"&&l++}return l},a=f=>{let l=new Map;for(let[u,h]of f)l.set(u,h.slice());return l},s=(f,l,u)=>{var d,p;let h=a(f),w;try{w=((d=u.style)==null?void 0:d.counterReset)||getComputedStyle(u).counterReset}catch(y){}if(w&&w!=="none")for(let y of w.split(",")){let E=y.trim().split(/\s+/),R=E[0],M=Number.isFinite(Number(E[1]))?Number(E[1]):0;if(!R)continue;let S=l.get(R);if(S&&S.length){let A=S.slice();A.push(M),h.set(R,A)}else h.set(R,[M])}let $;try{$=((p=u.style)==null?void 0:p.counterIncrement)||getComputedStyle(u).counterIncrement}catch(y){}if($&&$!=="none")for(let y of $.split(",")){let E=y.trim().split(/\s+/),R=E[0],M=Number.isFinite(Number(E[1]))?Number(E[1]):1;if(!R)continue;let S=h.get(R)||[];S.length===0&&S.push(0),S[S.length-1]+=M,h.set(R,S)}try{if(getComputedStyle(u).display==="list-item"&&r(u)){let E=u.parentElement,R=1;if(E&&E.tagName==="OL"){let S=E.getAttribute("start"),A=Number.isFinite(Number(S))?Number(S):1,P=o(u),N=u.getAttribute("value");R=Number.isFinite(Number(N))?Number(N):A+P}else R=1+o(u);let M=h.get("list-item")||[];M.length===0&&M.push(0),M[M.length-1]=R,h.set("list-item",M)}}catch(y){}return h},c=(f,l,u)=>{let h=s(u,l,f);e.set(f,h);let w=h;for(let $ of f.children)w=c($,h,w);return h},i=new Map;return c(n,i,i),{get(f,l){var h;let u=(h=e.get(f))==null?void 0:h.get(l);return u&&u.length?u[u.length-1]:0},getStack(f,l){var h;let u=(h=e.get(f))==null?void 0:h.get(l);return u?u.slice():[]}}}function xe(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(a,s,c)=>{var f,l,u,h;let i=String(c).split(",").map(w=>w.trim());if(s==="counter"){let w=(f=i[0])==null?void 0:f.replace(/^["']|["']$/g,""),$=(i[1]||"decimal").toLowerCase(),d=n.get(e,w);return we(d,$)}else{let w=(l=i[0])==null?void 0:l.replace(/^["']|["']$/g,""),$=(h=(u=i[1])==null?void 0:u.replace(/^["']|["']$/g,""))!=null?h:"",d=(i[2]||"decimal").toLowerCase(),p=n.getStack(e,w);return p.length?p.map(E=>we(E,d)).join($):""}});return In(o)}catch(r){return"- "}}var Ce=null;function Zt(t,e,n,r){return F(this,null,function*(){var s;if(!(t instanceof Element)||!(e instanceof Element))return;for(let c of["::before","::after","::first-letter"])try{let i=pt(t,c);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(c==="::first-letter"){let j=getComputedStyle(t);if(!(i.color!==j.color||i.fontSize!==j.fontSize||i.fontWeight!==j.fontWeight))continue;let J=Array.from(e.childNodes).find(L=>{var T;return L.nodeType===Node.TEXT_NODE&&((T=L.textContent)==null?void 0:T.trim().length)>0});if(!J)continue;let Z=J.textContent,ft=Z.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),m=ft==null?void 0:ft[0],C=Z.slice((m==null?void 0:m.length)||0);if(!m||/[\uD800-\uDFFF]/.test(m))continue;let x=document.createElement("span");x.textContent=m,x.dataset.snapdomPseudo="::first-letter";let v=Lt(i),b=xt(v,"span");n.styleMap.set(x,b);let k=document.createTextNode(C);e.replaceChild(k,J),e.insertBefore(x,k);continue}let l=i.content,u=Xt(l);be(l)&&(Ce=Se(t.ownerDocument||document),u=xe(u,t,Ce));let h=i.backgroundImage,w=i.backgroundColor,$=i.fontFamily,d=parseInt(i.fontSize)||32,p=parseInt(i.fontWeight)||!1,y=i.color||"#000",E=i.display,R=parseFloat(i.width),M=parseFloat(i.height),S=i.borderStyle,A=parseFloat(i.borderWidth),P=i.transform,N=Q($),_=l!=="none"&&u!=="",O=h&&h!=="none",K=w&&w!=="transparent"&&w!=="rgba(0, 0, 0, 0)",et=E!=="inline"&&(R>0||M>0),nt=S&&S!=="none"&&A>0,rt=P&&P!=="none";if(!(_||O||K||et||nt||rt))continue;let D=document.createElement("span");D.dataset.snapdomPseudo=c,D.style.verticalAlign="middle";let lt=Lt(i),Y=xt(lt,"span");if(n.styleMap.set(D,Y),N&&u.length===1){let{dataUrl:j,width:X,height:J}=yield pe(u,$,p,d,y),Z=document.createElement("img");Z.src=j,Z.style=`height:${d}px;width:${X/J*d}px;object-fit:contain;`,D.appendChild(Z),e.dataset.snapdomHasIcon="true"}else if(u.startsWith("url(")){let j=dt(u);if(j!=null&&j.trim())try{let X=document.createElement("img"),J=yield V(it(j),{as:"dataURL",useProxy:r.useProxy});X.src=J.data,X.style=`width:${d}px;height:auto;object-fit:contain;`,D.appendChild(X)}catch(X){console.error(`[snapdom] Error in pseudo ${c} for`,t,X)}}else!N&&_&&(D.textContent=u);if(O)try{let j=gt(h),X=yield Promise.all(j.map(ht));D.style.backgroundImage=X.join(", ")}catch(j){console.warn(`[snapdom] Failed to inline background-image for ${c}`,j)}if(K&&(D.style.backgroundColor=w),!(D.childNodes.length>0||((s=D.textContent)==null?void 0:s.trim())!==""||O||K||et||nt||rt))continue;c==="::before"?e.insertBefore(D,e.firstChild):e.appendChild(D)}catch(i){console.warn(`[snapdom] Failed to capture ${c} for`,t,i)}let o=Array.from(t.children),a=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);for(let c=0;c<Math.min(o.length,a.length);c++)yield Zt(o[c],a[c],n,r)})}function ke(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(c=>{let i=c.getAttribute("xlink:href")||c.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(c=>c.tagName.toLowerCase()==="symbol"),o=n.filter(c=>c.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(c=>{s.add(c.id)}),e.forEach(c=>{if(s.has(c))return;let i=r.find(f=>f.id===c);if(i){a.appendChild(i.cloneNode(!0)),s.add(c);return}for(let f of o){let l=f.querySelector(`#${CSS.escape(c)}`);if(l){let u=a.querySelector("defs");u||(u=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(u)),u.appendChild(l.cloneNode(!0)),s.add(c);break}}})}function Ee(n){return F(this,arguments,function*(t,e={}){var i,f;let r={styleMap:g.session.styleMap,styleCache:g.session.styleCache,nodeMap:g.session.nodeMap},o,a="",s="";_n(t);try{ke(t)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{o=yield kt(t,r,e,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{yield Zt(t,o,r,e)}catch(l){console.warn("inlinePseudoElements failed:",l)}yield Bn(o);try{let l=o.querySelectorAll("style[data-sd]");for(let u of l)s+=u.textContent||"",u.remove()}catch(l){}let c=Vt(r.styleMap);a=Array.from(c.entries()).map(([l,u])=>`.${u}{${l}}`).join(""),a=s+a;for(let[l,u]of r.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",u.replace(/;/g,"; "));continue}let h=c.get(u);h&&l.classList.add(h);let w=(i=l.style)==null?void 0:i.backgroundImage,$=(f=l.dataset)==null?void 0:f.snapdomHasIcon;w&&w!=="none"&&(l.style.backgroundImage=w),$&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,u]of r.nodeMap.entries()){let h=u.scrollLeft,w=u.scrollTop;if((h||w)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let d=document.createElement("div");for(d.style.transform=`translate(${-h}px, ${-w}px)`,d.style.willChange="transform",d.style.display="inline-block",d.style.width="100%";l.firstChild;)d.appendChild(l.firstChild);l.appendChild(d)}}if(t===r.nodeMap.get(o)){let l=r.styleCache.get(t)||window.getComputedStyle(t);r.styleCache.set(t,l);let u=Ot(l.transform);o.style.margin="0",o.style.position="static",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.zIndex="auto",o.style.float="none",o.style.clear="none",o.style.transform=u||""}for(let[l,u]of r.nodeMap.entries())u.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:o,classCSS:a,styleCache:r.styleCache}})}function _n(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,c=o==="none"||parseFloat(a)===0;s&&c&&(t.style.border=`${r} solid transparent`)}var At=new Map;function Et(t){return F(this,null,function*(){var n;if((n=g.resource)!=null&&n.has(t))return g.resource.get(t);if(At.has(t))return At.get(t);let e=F(null,null,function*(){var o;let r=yield V(t,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return(o=g.resource)==null||o.set(t,r.data),r.data});At.set(t,e);try{let r=yield e;return At.set(t,r),r}catch(r){throw At.delete(t),r}})}var Pn=/\bblob:[^)"'\s]+/g;function Ae(t){return F(this,null,function*(){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Pn)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=yield Et(r);n=n.split(r).join(o)}catch(o){}return n})}function Ut(t){return typeof t=="string"&&t.startsWith("blob:")}function Un(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 Wn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}function Bn(t){return F(this,null,function*(){var s,c;if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let l=i.getAttribute("src")||i.currentSrc||"";if(Ut(l)){let h=yield Et(l);i.setAttribute("src",h)}let u=i.getAttribute("srcset");if(u&&u.includes("blob:")){let h=Un(u),w=!1;for(let $ of h)if(Ut($.url))try{$.url=yield Et($.url),w=!0}catch(d){}w&&i.setAttribute("srcset",Wn(h))}}catch(f){}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let f="http://www.w3.org/1999/xlink",l=i.getAttribute("href")||((s=i.getAttributeNS)==null?void 0:s.call(i,f,"href"));if(Ut(l)){let u=yield Et(l);i.setAttribute("href",u),(c=i.removeAttributeNS)==null||c.call(i,f,"href")}}catch(f){}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of r)try{let f=i.getAttribute("style");if(f&&f.includes("blob:")){let l=yield Ae(f);i.setAttribute("style",l)}}catch(f){}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of o)try{let f=i.textContent||"";f.includes("blob:")&&(i.textContent=yield Ae(f))}catch(f){}let a=["poster"];for(let i of a){let f=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let l of f)try{let u=l.getAttribute(i);Ut(u)&&l.setAttribute(i,yield Et(u))}catch(u){}}})}function Me(n){return F(this,arguments,function*(t,e={}){let r=Array.from(t.querySelectorAll("img")),o=a=>F(null,null,function*(){var u,h,w,$;if(!a.getAttribute("src")){let d=a.currentSrc||a.src||"";d&&a.setAttribute("src",d)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let s=a.src||"";if(!s)return;let c=yield V(s,{as:"dataURL",useProxy:e.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){a.src=c.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{fallbackURL:i}=e||{};if(i)try{let d=parseInt(((u=a.dataset)==null?void 0:u.snapdomWidth)||"",10)||0,p=parseInt(((h=a.dataset)==null?void 0:h.snapdomHeight)||"",10)||0,y=parseInt(a.getAttribute("width")||"",10)||0,E=parseInt(a.getAttribute("height")||"",10)||0,R=parseFloat(((w=a.style)==null?void 0:w.width)||"")||0,M=parseFloat((($=a.style)==null?void 0:$.height)||"")||0,S=d||R||y||a.width||void 0,A=p||M||E||a.height||void 0,P=typeof i=="function"?yield i({width:S,height:A,src:s,element:a}):i;if(P){let N=yield V(P,{as:"dataURL",useProxy:e.useProxy});a.src=N.data,!a.width&&S&&(a.width=S),!a.height&&A&&(a.height=A),a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}}catch(d){}let f=a.width||a.naturalWidth||100,l=a.height||a.naturalHeight||100;if(e.placeholders!==!1){let d=document.createElement("div");d.style.cssText=[`width:${f}px`,`height:${l}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${l}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),d.textContent="img",a.replaceWith(d)}else{let d=document.createElement("div");d.style.cssText=`display:inline-block;width:${f}px;height:${l}px;visibility:hidden;`,a.replaceWith(d)}});for(let a=0;a<r.length;a+=4){let s=r.slice(a,a+4).map(o);yield Promise.allSettled(s)}})}function Wt(o,a,s){return F(this,arguments,function*(t,e,n,r={}){let c=[[t,e]],i=["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"],f=["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(;c.length;){let[u,h]=c.shift(),w=n.get(u)||pt(u);n.has(u)||n.set(u,w);let $=(()=>{let y=w.getPropertyValue("border-image"),E=w.getPropertyValue("border-image-source");return y&&y!=="none"||E&&E!=="none"})();for(let y of i){let E=w.getPropertyValue(y);if(!E||E==="none")continue;let R=gt(E),M=yield Promise.all(R.map(S=>ht(S,r)));M.some(S=>S&&S!=="none"&&!/^url\(undefined/.test(S))&&h.style.setProperty(y,M.join(", "))}for(let y of f){let E=w.getPropertyValue(y);!E||E==="initial"||h.style.setProperty(y,E)}if($)for(let y of l){let E=w.getPropertyValue(y);!E||E==="initial"||h.style.setProperty(y,E)}let d=Array.from(u.children),p=Array.from(h.children);for(let y=0;y<Math.min(d.length,p.length);y++)c.push([d[y],p[y]])}})}function $e(t){var f;if(!t)return()=>{};let e=On(t);if(e<=0)return()=>{};if(!qn(t))return()=>{};let n=getComputedStyle(t),r=Math.round(Dn(n)*e+Hn(n)),o=(f=t.textContent)!=null?f:"",a=o;if(t.scrollHeight<=r+.5)return()=>{};let s=0,c=o.length,i=-1;for(;s<=c;){let l=s+c>>1;t.textContent=o.slice(0,l)+"\u2026",t.scrollHeight<=r+.5?(i=l,s=l+1):c=l-1}return t.textContent=(i>=0?o.slice(0,i):"")+"\u2026",()=>{t.textContent=a}}function On(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 Dn(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 Hn(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function qn(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function ee(t,e){return F(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");$t(e.cache);let n=e.fast,r,o,a,s="",c="",i,f,l=$e(t);try{({clone:r,classCSS:o,styleCache:a}=yield Ee(t,e))}finally{l()}yield new Promise($=>{at(()=>F(null,null,function*(){yield Me(r,e),$()}),{fast:n})}),yield new Promise($=>{at(()=>F(null,null,function*(){yield Wt(t,r,a,e),$()}),{fast:n})}),e.embedFonts&&(yield new Promise($=>{at(()=>F(null,null,function*(){let d=It(t),p=_t(t);if(st){let y=new Set(Array.from(d).map(E=>String(E).split("__")[0]).filter(Boolean));yield Pt(y,2)}s=yield Tt({required:d,usedCodepoints:p,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),$()}),{fast:n})}));let u=jt(r).sort(),h=u.join(",");g.baseStyle.has(h)?c=g.baseStyle.get(h):yield new Promise($=>{at(()=>{c=zt(u),g.baseStyle.set(h,c),$()},{fast:n})}),yield new Promise($=>{at(()=>{var m,C,x,v,b;let d=t.getBoundingClientRect(),p=Number(d.width)||0,y=Number(d.height)||0,E=Number.isFinite(e.width),R=Number.isFinite(e.height),M=(m=e.scale)!=null?m:1,S=typeof M=="number"&&M!==1;if(!S){let k=y>0?p/y:1;E&&R?(p=Number(e.width),y=Number(e.height)):E?(p=Number(e.width),y=p/(k||1)):R&&(y=Number(e.height),p=y*(k||1))}p=Math.max(1,Math.ceil(Number.isFinite(p)?p:1)),y=Math.max(1,Math.ceil(Number.isFinite(y)?y:1));let A=getComputedStyle(t),P=A.transform&&A.transform!=="none"?A.transform:"",N=Vn(t),_,O,K,et,nt=0,rt=0;if(Xn(t)){let k=Yn({baseTransform:P,rotate:N.rotate||"0deg",scale:N.scale,translate:N.translate}),L=(x=(C=k.e)!=null?C:k.m41)!=null?x:0,T=(b=(v=k.f)!=null?v:k.m42)!=null?b:0;nt=-L,rt=-T;let I=k.is2D?Fe(k):Fe(new DOMMatrix(k.toString())),U=zn(p,y,I);_=Math.max(1,Math.ceil(U.width)),O=Math.max(1,Math.ceil(U.height)),K=-U.minX,et=-U.minY}else{let k=t.getBoundingClientRect(),L=Gn(k,{top:0,right:0,bottom:0,left:0});_=Math.max(1,L.width),O=Math.max(1,L.height),K=-(L.x-Math.floor(k.left)),et=-(L.y-Math.floor(k.top))}let wt="http://www.w3.org/2000/svg",D=document.createElementNS(wt,"foreignObject");D.setAttribute("width","100%"),D.setAttribute("height","100%"),D.setAttribute("x",String(K)),D.setAttribute("y",String(et)),D.style.overflow="visible";let lt=document.createElement("style");lt.textContent=c+s+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o,D.appendChild(lt);let Y=document.createElement("div");Y.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Y.style.width=`${p}px`,Y.style.height=`${y}px`,Y.style.overflow="visible",Y.style.transformOrigin="0 0";let ot=[];if((nt||rt)&&ot.push(`translate(${nt}px, ${rt}px)`),!S&&(E||R)){let k=d.width?p/d.width:1,L=d.height?y/d.height:1;ot.push(`scale(${k}, ${L})`)}else S&&ot.push(`scale(${M})`);ot.length&&(Y.style.transform=ot.join(" ")),r.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),r.style.transformOrigin="0 0",r.style.position="static",r.style.left="0",r.style.top="0",P&&(r.style.transform=P),r.style.rotate=N.rotate||"0deg",r.style.scale=N.scale||"1",r.style.translate=N.translate||"0 0",Y.appendChild(r),D.appendChild(Y);let j=new XMLSerializer().serializeToString(D);f=`<svg xmlns="${wt}" width="${!S&&(E||R)?p:_}" height="${!S&&(R||E)?y:O}" viewBox="0 0 ${_} ${O}">`+j+"</svg>",i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,$()},{fast:n})});let w=document.getElementById("snapdom-sandbox");return w&&w.style.position==="absolute"&&w.remove(),i})}function jn(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch(n){return new WebKitCSSMatrix(e)}}function Fe(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function zn(t,e,n){let o=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(f=>({x:n.a*f.x+n.c*f.y,y:n.b*f.x+n.d*f.y})),a=Math.min(...o.map(f=>f.x)),s=Math.max(...o.map(f=>f.x)),c=Math.min(...o.map(f=>f.y)),i=Math.max(...o.map(f=>f.y));return{minX:a,minY:c,width:s-a,height:i-c}}function Vn(t){var o,a,s,c,i,f,l,u,h,w,$,d,p;let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let y=S=>{try{return typeof n.has=="function"&&!n.has(S)||typeof n.get!="function"?null:n.get(S)}catch(A){return null}},E=y("rotate");if(E){let S=(o=E.angle)!=null?o:E;S&&typeof S=="object"&&"unit"in S?e.rotate=S.unit==="rad"?S.value*180/Math.PI+"deg":S.value+S.unit:e.rotate=String(E)}let R=y("scale");if(R&&R.length){let S=(s=(a=R[0])==null?void 0:a.value)!=null?s:1,A=(i=(c=R[1])==null?void 0:c.value)!=null?i:S;e.scale=`${S} ${A}`}let M=y("translate");if(M&&M.length){let S=(l=(f=M[0])==null?void 0:f.value)!=null?l:0,A=(h=(u=M[1])==null?void 0:u.value)!=null?h:0,P=($=(w=M[0])==null?void 0:w.unit)!=null?$:"px",N=(p=(d=M[1])==null?void 0:d.unit)!=null?p:"px";e.translate=`${S}${P} ${A}${N}`}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 Xn(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function Gn(t,e){let n=Math.floor(t.left-e.left),r=Math.floor(t.top-e.top),o=Math.ceil(t.width+e.left+e.right),a=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:r,width:o,height:a}}var te=null;function Kn(){if(te)return te;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),te=t,t}function Yn(t){let e=Kn(),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=jn(n);return e.removeChild(n),r}function Jn(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ve(t={}){var r,o,a,s,c,i,f,l,u,h,w,$,d,p,y,E,R,M;let e=(r=t.format)!=null?r:"png",n=Jn(t.cache);return{debug:(o=t.debug)!=null?o:!1,fast:(a=t.fast)!=null?a:!0,scale:(s=t.scale)!=null?s:1,exclude:(c=t.exclude)!=null?c:[],excludeMode:(i=t.excludeMode)!=null?i:"hide",filter:(f=t.filter)!=null?f:null,filterMode:(l=t.filterMode)!=null?l:"hide",placeholders:t.placeholders!==!1,embedFonts:(u=t.embedFonts)!=null?u:!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:(h=t.excludeFonts)!=null?h:void 0,fallbackURL:(w=t.fallbackURL)!=null?w:void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:($=t.width)!=null?$:null,height:(d=t.height)!=null?d:null,format:e,type:(p=t.type)!=null?p:"svg",quality:(y=t.quality)!=null?y:.92,dpr:(E=t.dpr)!=null?E:window.devicePixelRatio||1,backgroundColor:(R=t.backgroundColor)!=null?R:["jpg","jpeg","webp"].includes(e)?"#ffffff":null,filename:(M=t.filename)!=null?M:"snapDOM"}}function Le(t,e){return F(this,null,function*(){let n=new Image;return n.src=t,yield n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n})}function ct(t,e){return F(this,null,function*(){let{scale:n,dpr:r}=e,o=new Image;o.crossOrigin="anonymous",o.loading="eager",o.decoding="sync",o.src=t,yield o.decode();let a=o.naturalWidth*n,s=o.naturalHeight*n,c=document.createElement("canvas");c.width=Math.ceil(a*r),c.height=Math.ceil(s*r),c.style.width=`${a}px`,c.style.height=`${s}px`;let i=c.getContext("2d");return r!==1&&i.scale(r,r),i.drawImage(o,0,0,a,s),c})}function Bt(t,e){return F(this,null,function*(){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let r=yield ct(t,e),o=e.backgroundColor?mt(r,e.backgroundColor):r;return new Promise(a=>o.toBlob(s=>a(s),`image/${n}`,e.quality))})}function Re(t,e){return F(this,null,function*(){let n=yield ct(t,e),r=e.backgroundColor?mt(n,e.backgroundColor):n,o=new Image;return o.src=r.toDataURL(`image/${e.format}`,e.quality),yield o.decode(),o.style.width=`${r.width/e.dpr}px`,o.style.height=`${r.height/e.dpr}px`,o})}function Ne(t,e){return F(this,null,function*(){if(e.dpr=1,e.format==="svg"){let a=yield Bt(t,G(z({},e),{type:"svg"})),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.filename,c.click(),URL.revokeObjectURL(s);return}let n=yield ct(t,e),r=e.backgroundColor?mt(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()})}var Te=Symbol("snapdom.internal"),ne=!1;function q(t,e){return F(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");if(st())for(let r=0;r<3;r++)try{yield Qn(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),ne=!1}catch(o){}let n=ve(e);return n.iconFonts&&n.iconFonts.length>0&&he(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>q.toPng(r,o),toImg:(r,o)=>q.toImg(r,o)}),q.capture(t,n,Te)})}q.capture=(t,e,n)=>F(null,null,function*(){if(n!==Te)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=yield ee(t,e),o=s=>z(z({},e),s||{}),a=s=>c=>{let i=o(G(z({},c||{}),{format:s})),f=s==="jpeg"||s==="jpg",l=i.backgroundColor==null||i.backgroundColor==="transparent";return f&&l&&(i.backgroundColor="#ffffff"),Re(r,i)};return{url:r,toRaw:()=>r,toImg:s=>Le(r,o(s)),toCanvas:s=>ct(r,o(s)),toBlob:s=>Bt(r,o(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ne(r,o(s))}});q.toRaw=(t,e)=>q(t,e).then(n=>n.toRaw());q.toImg=(t,e)=>q(t,e).then(n=>n.toImg());q.toCanvas=(t,e)=>q(t,e).then(n=>n.toCanvas());q.toBlob=(t,e)=>q(t,e).then(n=>n.toBlob());q.toPng=(t,e)=>q(t,G(z({},e),{format:"png"})).then(n=>n.toPng());q.toJpg=(t,e)=>q(t,G(z({},e),{format:"jpeg"})).then(n=>n.toJpg());q.toWebp=(t,e)=>q(t,G(z({},e),{format:"webp"})).then(n=>n.toWebp());q.download=(t,e)=>q(t,e).then(n=>n.download());function Qn(t,e){return F(this,null,function*(){if(ne)return;let n=G(z({},e),{fast:!0,embedFonts:!0,scale:.2}),r;try{r=yield ee(t,n)}catch(o){return}yield 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=()=>F(null,null,function*(){yield new Promise(c=>setTimeout(c,100)),a&&a.parentNode&&a.parentNode.removeChild(a),ne=!0,o()});document.body.appendChild(a),s()})})}function Ie(){return F(this,arguments,function*(t=document,e={}){var i,f,l,u;let{embedFonts:n=!0,useProxy:r=""}=e,o=(f=(i=e.cache)!=null?i:e.cacheOpt)!=null?f:"full";$t(o);try{yield(l=document.fonts)==null?void 0:l.ready}catch(h){}try{Ht()}catch(h){}g.session=g.session||{},g.session.styleCache||(g.session.styleCache=new WeakMap),g.image=g.image||new Map;try{yield Wt(t,void 0,g.session.styleCache,{useProxy:r})}catch(h){}let a=[],s=[];try{t!=null&&t.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch(h){}let c=[];for(let h of a){let w=(h==null?void 0:h.currentSrc)||(h==null?void 0:h.src);if(w&&!g.image.has(w)){let $=Promise.resolve().then(()=>F(null,null,function*(){let d=yield V(w,{as:"dataURL",useProxy:r});d!=null&&d.ok&&typeof d.data=="string"&&g.image.set(w,d.data)})).catch(()=>{});c.push($)}}for(let h of s){let w="";try{w=pt(h).backgroundImage}catch($){}if(w&&w!=="none"){let $=gt(w);for(let d of $)if(d.startsWith("url(")){let p=Promise.resolve().then(()=>ht(d,G(z({},e),{useProxy:r}))).catch(()=>{});c.push(p)}}}if(n)try{let h=It(t),w=_t(t);if(typeof st=="function"?st():!!st){let d=new Set(Array.from(h).map(p=>String(p).split("__")[0]).filter(Boolean));yield Pt(d,2)}yield Tt({required:h,usedCodepoints:w,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:(u=e.useProxy)!=null?u:r})}catch(h){}yield Promise.allSettled(c)})}typeof window!="undefined"&&(window.snapdom=q,window.preCache=Ie);})();
|
package/dist/snapdom.min.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var m={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function ft(t="soft"){switch(t){case"auto":{m.session.styleMap=new Map,m.session.nodeMap=new Map;return}case"soft":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap,m.computedStyle=new WeakMap,m.baseStyle=new Map,m.defaultStyle=new Map,m.image=new Map,m.background=new Map,m.resource=new Map,m.font=new Set;return}default:{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}}}function J(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Mt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,
|
|
2
|
-
`;return n}function Nt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,
|
|
3
|
-
`});let n=t.adoptedStyleSheets||[];for(let
|
|
4
|
-
`}catch{}}catch{}return e}function
|
|
5
|
-
`:""}function De(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 qe(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)await new Promise(s=>setTimeout(s,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}function He(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,s=0;try{let f=getComputedStyle(t);n=parseFloat(f.borderLeftWidth)||0,o=parseFloat(f.borderRightWidth)||0,r=parseFloat(f.borderTopWidth)||0,s=parseFloat(f.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(e.width-(n+o))),i=Math.max(0,Math.round(e.height-(r+s)));return{contentWidth:a,contentHeight:i,rect:e}}function je(t,e,n){let o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.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(o),()=>{try{o.remove()}catch{}}}async function ze(t,e,n){let o=await qe(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:s,rect:a}=He(t),i=n?.snap;if(!i||typeof i.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let f={...n,scale:1},c=je(o,r,s),l;try{l=await i.toPng(o.documentElement,f)}finally{c()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${s}px`;let u=document.createElement("div");return e.nodeMap.set(u,t),nt(t,u,e,n),u.style.overflow="hidden",u.style.display="block",u.style.width||(u.style.width=`${Math.round(a.width)}px`),u.style.height||(u.style.height=`${Math.round(a.height)}px`),u.appendChild(l),u}async function it(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,r=null,s=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||dt.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"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.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 l=document.createElement("div"),u=t.getBoundingClientRect();return l.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,l}else if(n.excludeMode==="remove")return null}}catch(l){console.warn(`Invalid selector in exclude option: ${c}`,l)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.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 ze(t,e,n)}catch(l){console.warn("[SnapDOM] iframe rasterization failed, fallback:",l)}if(n.placeholders){let l=document.createElement("div");return l.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;`,nt(t,l,e,n),l}else{let l=t.getBoundingClientRect(),u=document.createElement("div");return u.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,nt(t,u,e,n),u}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),nt(t,c,e,n);let l=document.createElement("div");return l.textContent=t.getAttribute("data-placeholder-text")||"",l.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(l),c}if(t.tagName==="CANVAS"){let c=t.toDataURL(),l=document.createElement("img");return l.src=c,l.width=t.width,l.height=t.height,e.nodeMap.set(l,t),nt(t,l,e,n),l}let a;try{if(a=t.cloneNode(!1),e.nodeMap.set(a,t),t.tagName==="IMG"){Ue(t,a);try{let c=t.getBoundingClientRect(),l=Math.round(c.width||0),u=Math.round(c.height||0);if(!l||!u){let g=window.getComputedStyle(t),R=parseFloat(g.width)||0,x=parseFloat(g.height)||0,k=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,S=t.width||t.naturalWidth||0,C=t.height||t.naturalHeight||0;l=Math.round(l||R||k||S||0),u=Math.round(u||x||h||C||0)}l&&(a.dataset.snapdomWidth=String(l)),u&&(a.dataset.snapdomHeight=String(u))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();a.style.width=`${c.width}px`,a.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(a.value=t.value,a.setAttribute("value",t.value),t.checked!==void 0&&(a.checked=t.checked,t.checked&&a.setAttribute("checked",""),t.indeterminate&&(a.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(s=t.value),nt(t,a,e,n),t.shadowRoot){let h=function(C,$){if(C.nodeType===Node.ELEMENT_NODE&&C.tagName==="STYLE")return $(null);it(C,e,n).then(N=>{$(N||null)}).catch(N=>{$(null)})};try{let C=t.shadowRoot.querySelectorAll("slot");for(let $ of C){let N=[];try{N=$.assignedNodes?.({flatten:!0})||$.assignedNodes?.()||[]}catch{N=$.assignedNodes?.()||[]}for(let W of N)o.add(W)}}catch{}let c=Ie(e),l=`[data-sd="${c}"]`;try{a.setAttribute("data-sd",c)}catch{}let u=_e(t.shadowRoot),g=Te(u,l),R=We(u),x=Oe(t,R,l);Pe(a,x+g,c);let k=document.createDocumentFragment(),S=await Pt(Array.from(t.shadowRoot.childNodes),h,n.fast);k.append(...S.filter(C=>!!C)),a.appendChild(k)}if(t.tagName==="SLOT"){let g=function(x,k){it(x,e,n).then(h=>{h&&De(h),k(h||null)}).catch(h=>{k(null)})},c=t.assignedNodes?.({flatten:!0})||[],l=c.length>0?c:Array.from(t.childNodes),u=document.createDocumentFragment(),R=await Pt(Array.from(l),g,n.fast);return u.append(...R.filter(x=>!!x)),u}function i(c,l){if(o.has(c))return l(null);it(c,e,n).then(u=>{l(u||null)}).catch(u=>{l(null)})}let f=await Pt(Array.from(t.childNodes),i,n.fast);if(a.append(...f.filter(c=>!!c)),r!==null&&a instanceof HTMLSelectElement){a.value=r;for(let c of a.options)c.value===r?c.setAttribute("selected",""):c.removeAttribute("selected")}return s!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=s),a}var Ve=[/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],Ut=[];function Yt(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Ut.push(n):typeof n=="string"?Ut.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function j(t){let e=typeof t=="string"?t:"",n=[...Ve,...Ut];for(let o of n)if(o instanceof RegExp&&o.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 Jt(t,e,n,o=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let s=window.devicePixelRatio||1;await document.fonts.ready;let a=document.createElement("span");a.textContent=t,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${e}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${o}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let i=a.getBoundingClientRect(),f=Math.ceil(i.width),c=Math.ceil(i.height);document.body.removeChild(a);let l=document.createElement("canvas");l.width=f*s,l.height=c*s;let u=l.getContext("2d");return u.scale(s,s),u.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=r,u.fillText(t,0,0),{dataUrl:l.toDataURL(),width:f,height:c}}var Xe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function ht(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Xe.has(n.toLowerCase()))return n}return""}function pt(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 Wt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Ge(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Ke(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=pt(n[1]),s=pt(n[2]);return{min:Math.min(r,s),max:Math.max(r,s)}}let o=pt(e);return{min:o,max:o}}function Ye(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Je(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let s=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(s,a),max:Math.max(s,a)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function Qe(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(i=>r.endsWith(i)))return!0;let a=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a))return!0;for(let i of e){let f=i.toLowerCase().replace(/\s+/g,"+"),c=i.toLowerCase().replace(/\s+/g,"-");if(a.includes(f)||a.includes(c))return!0}return!1}catch{return!1}}function Ze(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}async function gt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let s=new Map;for(let d of t){let[y,w,A,p]=String(d).split("__");if(!y)continue;let b=s.get(y)||[];b.push({w:parseInt(w,10),s:A,st:parseInt(p,10)}),s.set(y,b)}let a=/@import\s+url\(["']?([^"')]+)["']?\)/g,i=/url\((["']?)([^"')]+)\1\)/g,f=/@font-face[^{}]*\{[^}]*\}/g;function c(d,y,w,A){if(!s.has(d))return!1;let p=s.get(d),b=Ke(w),v=Ye(y),M=Je(A),E=b.min!==b.max,L=b.min,T=F=>v.kind==="normal"&&F==="normal"||v.kind!=="normal"&&(F==="italic"||F==="oblique"),P=!1;for(let F of p){let I=E?F.w>=b.min&&F.w<=b.max:F.w===L,O=T(Wt(F.s)),q=F.st>=M.min&&F.st<=M.max;if(I&&O&&q){P=!0;break}}if(P)return!0;if(!E)for(let F of p){let I=T(Wt(F.s)),O=F.st>=M.min&&F.st<=M.max;if(Math.abs(L-F.w)<=300&&I&&O)return!0}return!1}function l(d){if(!d)return[];let y=[],w=d.split(",").map(A=>A.trim()).filter(Boolean);for(let A of w){let p=A.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!p)continue;let b=p[1],v=p[2],M=E=>{if(!E.includes("?"))return parseInt(E,16);let L=parseInt(E.replace(/\?/g,"0"),16),T=parseInt(E.replace(/\?/g,"F"),16);return[L,T]};if(v){let E=M(b),L=M(v),T=Array.isArray(E)?E[0]:E,P=Array.isArray(L)?L[1]:L;y.push([Math.min(T,P),Math.max(T,P)])}else{let E=M(b);Array.isArray(E)?y.push([E[0],E[1]]):y.push([E,E])}}return y}function u(d,y){if(!y.length||!d||d.size===0)return!0;for(let w of d)for(let[A,p]of y)if(w>=A&&w<=p)return!0;return!1}function g(d,y){let w=[];if(!d)return w;for(let A of d.matchAll(i)){let p=(A[2]||"").trim();if(!(!p||p.startsWith("data:"))){if(!/^https?:/i.test(p))try{p=new URL(p,y||location.href).href}catch{}w.push(p)}}return w}async function R(d,y){let w=d;for(let A of d.matchAll(i)){let p=J(A[0]);if(!p)continue;let b=p;if(!b.startsWith("http")&&!b.startsWith("data:"))try{b=new URL(b,y||location.href).href}catch{}if(!j(b)){if(m.resource?.has(b)){m.font?.add(b),w=w.replace(A[0],`url(${m.resource.get(b)})`);continue}if(!m.font?.has(b))try{let v=await D(b,{as:"dataURL",useProxy:r,silent:!0});if(v.ok&&typeof v.data=="string"){let M=v.data;m.resource?.set(b,M),m.font?.add(b),w=w.replace(A[0],`url(${M})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",b)}}}return w}function x(d){if(!d.length)return null;let y=(M,E)=>d.some(([L,T])=>!(T<M||L>E)),w=y(0,255)||y(305,305),A=y(256,591)||y(7680,7935),p=y(880,1023),b=y(1024,1279);return y(7840,7929)||y(258,259)||y(416,417)||y(431,432)?"vietnamese":b?"cyrillic":p?"greek":A?"latin-ext":w?"latin":null}function k(d={}){let y=new Set((d.families||[]).map(p=>String(p).toLowerCase())),w=new Set((d.domains||[]).map(p=>String(p).toLowerCase())),A=new Set((d.subsets||[]).map(p=>String(p).toLowerCase()));return(p,b)=>{if(y.size&&y.has(p.family.toLowerCase()))return!0;if(w.size)for(let v of p.srcUrls)try{if(w.has(new URL(v).host.toLowerCase()))return!0}catch{}if(A.size){let v=x(b);if(v&&A.has(v))return!0}return!1}}let h=k(n);function S(d){if(!d)return d;let y=/@font-face[^{}]*\{[^}]*\}/gi,w=new Set,A=[];for(let b of d.match(y)||[]){let v=b.match(/font-family:\s*([^;]+);/i)?.[1]||"",M=ht(v),E=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),L=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),T=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),P=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),F=(b.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),I=g(F,location.href),O=I.length?I.map(At=>String(At).toLowerCase()).sort().join("|"):F.toLowerCase(),q=[String(M||"").toLowerCase(),E,L,T,P.toLowerCase(),O].join("|");w.has(q)||(w.add(q),A.push(b))}if(A.length===0)return d;let p=0;return d.replace(y,()=>A[p++]||"")}function C(){let d=Array.from(t||[]).sort().join("|"),y=n?JSON.stringify({families:(n.families||[]).map(p=>String(p).toLowerCase()).sort(),domains:(n.domains||[]).map(p=>String(p).toLowerCase()).sort(),subsets:(n.subsets||[]).map(p=>String(p).toLowerCase()).sort()}):"",w=(o||[]).map(p=>`${(p.family||"").toLowerCase()}::${p.weight||"normal"}::${p.style||"normal"}::${p.src||""}`).sort().join("|");return`fonts-embed-css::req=${d}::ex=${y}::lf=${w}::px=${r||""}`}let $=C();if(m.resource?.has($))return m.resource.get($);let N=Ze(t),W=[];for(let d of document.querySelectorAll("style")){let y=d.textContent||"";for(let w of y.matchAll(a)){let A=w[1];if(!A||j(A))continue;!!document.querySelector(`link[rel="stylesheet"][href="${A}"]`)||W.push(A)}}W.length&&await Promise.all(W.map(d=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return y(null);let w=document.createElement("link");w.rel="stylesheet",w.href=d,w.setAttribute("data-snapdom","injected-import"),w.onload=()=>y(w),w.onerror=()=>y(null),document.head.appendChild(w)})));let _="",z=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of z)try{if(j(d.href))continue;let y="",w=!1;try{w=new URL(d.href,location.href).origin===location.origin}catch{}if(!w&&!Qe(d.href,N))continue;if(w){let p=Array.from(document.styleSheets).find(b=>b.href===d.href);if(p)try{let b=p.cssRules||[];y=Array.from(b).map(v=>v.cssText).join("")}catch{}}if(!y&&(y=(await D(d.href,{as:"text",useProxy:r})).data,j(d.href)))continue;let A="";for(let p of y.match(f)||[]){let b=(p.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),v=ht(b);if(!v||j(v))continue;let M=(p.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),E=(p.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),L=(p.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),T=(p.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),P=(p.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),F=g(P,d.href);if(!c(v,E,M,L))continue;let I=l(T);if(!u(e,I))continue;let O={family:v,weightSpec:M,styleSpec:E,stretchSpec:L,unicodeRange:T,srcRaw:P,srcUrls:F,href:d.href};if(n&&h(O,I))continue;let q=/url\(/i.test(P)?await R(p,d.href):p;A+=q+""}A.trim()&&(_+=A+"")}catch{console.warn("[snapdom] Failed to process stylesheet:",d.href)}for(let d of document.styleSheets)try{if(d.href&&z.some(w=>w.href===d.href))continue;let y=d.cssRules||[];for(let w of y){if(w.type!==CSSRule.FONT_FACE_RULE)continue;let A=(w.style.getPropertyValue("font-family")||"").trim(),p=ht(A);if(!p||j(p))continue;let b=(w.style.getPropertyValue("font-weight")||"400").trim(),v=(w.style.getPropertyValue("font-style")||"normal").trim(),M=(w.style.getPropertyValue("font-stretch")||"100%").trim(),E=(w.style.getPropertyValue("src")||"").trim(),L=(w.style.getPropertyValue("unicode-range")||"").trim(),T=g(E,d.href||location.href);if(!c(p,v,b,M))continue;let P=l(L);if(!u(e,P))continue;let F={family:p,weightSpec:b,styleSpec:v,stretchSpec:M,unicodeRange:L,srcRaw:E,srcUrls:T,href:d.href||location.href};if(!(n&&h(F,P)))if(/url\(/i.test(E)){let I=await R(E,d.href||location.href);_+=`@font-face{font-family:${p};src:${I};font-style:${v};font-weight:${b};font-stretch:${M};${L?`unicode-range:${L};`:""}}`}else _+=`@font-face{font-family:${p};src:${E};font-style:${v};font-weight:${b};font-stretch:${M};${L?`unicode-range:${L};`:""}}`}}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let y=String(d.family).replace(/^['"]+|['"]+$/g,"");if(j(y)||!s.has(y)||n?.families&&n.families.some(A=>String(A).toLowerCase()===y.toLowerCase()))continue;let w=d._snapdomSrc;if(!String(w).startsWith("data:")){if(m.resource?.has(d._snapdomSrc))w=m.resource.get(d._snapdomSrc),m.font?.add(d._snapdomSrc);else if(!m.font?.has(d._snapdomSrc))try{let A=await D(d._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(A.ok&&typeof A.data=="string")w=A.data,m.resource?.set(d._snapdomSrc,w),m.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapdom] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}_+=`@font-face{font-family:'${y}';src:url(${w});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of o){if(!d||typeof d!="object")continue;let y=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||j(y)||!s.has(y)||n?.families&&n.families.some(M=>String(M).toLowerCase()===y.toLowerCase()))continue;let w=d.weight!=null?String(d.weight):"normal",A=d.style!=null?String(d.style):"normal",p=d.stretchPct!=null?`${d.stretchPct}%`:"100%",b=String(d.src||""),v=b;if(!v.startsWith("data:")){if(m.resource?.has(b))v=m.resource.get(b),m.font?.add(b);else if(!m.font?.has(b))try{let M=await D(b,{as:"dataURL",useProxy:r,silent:!0});if(M.ok&&typeof M.data=="string")v=M.data,m.resource?.set(b,v),m.font?.add(b);else continue}catch{console.warn("[snapdom] Failed to fetch localFonts src:",b);continue}}_+=`@font-face{font-family:'${y}';src:url(${v});font-style:${A};font-weight:${w};font-stretch:${p};}`}return _&&(_=S(_),m.resource?.set($,_)),_}function yt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=a=>{let i=ht(a.fontFamily);if(!i)return;let f=(c,l,u)=>`${i}__${pt(c)}__${Wt(l)}__${Ge(u)}`;e.add(f(a.fontWeight,a.fontStyle,a.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let s=getComputedStyle(t,"::after");for(s&&s.content&&s.content!=="none"&&o(s);n.nextNode();){let a=n.currentNode,i=getComputedStyle(a);o(i);let f=getComputedStyle(a,"::before");f&&f.content&&f.content!=="none"&&o(f);let c=getComputedStyle(a,"::after");c&&c.content&&c.content!=="none"&&o(c)}return e}function wt(t){let e=new Set,n=r=>{if(r)for(let s of r)e.add(s.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let s=r;for(let a of["::before","::after"]){let f=getComputedStyle(s,a)?.getPropertyValue("content");if(!(!f||f==="none"))if(/^"/.test(f)||/^'/.test(f))n(f.slice(1,-1));else{let c=f.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let l of c)try{e.add(parseInt(l.slice(1),16))}catch{}}}}}return e}async function bt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position: absolute !important;left: -9999px !important;top: 0 !important;opacity: 0 !important;pointer-events: none !important;contain: layout size style;";for(let s of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${s}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",r.appendChild(a)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s)))}function ee(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function tn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Qt(t,e=!1){let n="",o=Math.max(1,t);for(;o>0;)o--,n=String.fromCharCode(97+o%26)+n,o=Math.floor(o/26);return e?n.toUpperCase():n}function Zt(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"]],o=Math.max(1,Math.min(3999,t)),r="";for(let[s,a]of n)for(;o>=s;)r+=a,o-=s;return e?r:r.toLowerCase()}function te(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 Qt(t,!1);case"upper-alpha":return Qt(t,!0);case"lower-roman":return Zt(t,!1);case"upper-roman":return Zt(t,!0);default:return String(Math.max(0,t))}}function ne(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,o=c=>c&&c.tagName==="LI",r=c=>{let l=0,u=c?.parentElement;if(!u)return 0;for(let g of u.children){if(g===c)break;g.tagName==="LI"&&l++}return l},s=c=>{let l=new Map;for(let[u,g]of c)l.set(u,g.slice());return l},a=(c,l,u)=>{let g=s(c),R;try{R=u.style?.counterReset||getComputedStyle(u).counterReset}catch{}if(R&&R!=="none")for(let k of R.split(",")){let h=k.trim().split(/\s+/),S=h[0],C=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!S)continue;let $=l.get(S);if($&&$.length){let N=$.slice();N.push(C),g.set(S,N)}else g.set(S,[C])}let x;try{x=u.style?.counterIncrement||getComputedStyle(u).counterIncrement}catch{}if(x&&x!=="none")for(let k of x.split(",")){let h=k.trim().split(/\s+/),S=h[0],C=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!S)continue;let $=g.get(S)||[];$.length===0&&$.push(0),$[$.length-1]+=C,g.set(S,$)}try{if(getComputedStyle(u).display==="list-item"&&o(u)){let h=u.parentElement,S=1;if(h&&h.tagName==="OL"){let $=h.getAttribute("start"),N=Number.isFinite(Number($))?Number($):1,W=r(u),_=u.getAttribute("value");S=Number.isFinite(Number(_))?Number(_):N+W}else S=1+r(u);let C=g.get("list-item")||[];C.length===0&&C.push(0),C[C.length-1]=S,g.set("list-item",C)}}catch{}return g},i=(c,l,u)=>{let g=a(u,l,c);e.set(c,g);let R=g;for(let x of c.children)R=i(x,g,R);return g},f=new Map;return i(n,f,f),{get(c,l){let u=e.get(c)?.get(l);return u&&u.length?u[u.length-1]:0},getStack(c,l){let u=e.get(c)?.get(l);return u?u.slice():[]}}}function oe(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,r=t.replace(o,(s,a,i)=>{let f=String(i).split(",").map(c=>c.trim());if(a==="counter"){let c=f[0]?.replace(/^["']|["']$/g,""),l=(f[1]||"decimal").toLowerCase(),u=n.get(e,c);return te(u,l)}else{let c=f[0]?.replace(/^["']|["']$/g,""),l=f[1]?.replace(/^["']|["']$/g,"")??"",u=(f[2]||"decimal").toLowerCase(),g=n.getStack(e,c);return g.length?g.map(x=>te(x,u)).join(l):""}});return tn(r)}catch{return"- "}}var re=null;async function Bt(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;for(let a of["::before","::after","::first-letter"])try{let i=tt(t,a);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(a==="::first-letter"){let F=getComputedStyle(t);if(!(i.color!==F.color||i.fontSize!==F.fontSize||i.fontWeight!==F.fontWeight))continue;let O=Array.from(e.childNodes).find(Ht=>Ht.nodeType===Node.TEXT_NODE&&Ht.textContent?.trim().length>0);if(!O)continue;let q=O.textContent,at=q.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],B=q.slice(at?.length||0);if(!at||/[\uD800-\uDFFF]/.test(at))continue;let H=document.createElement("span");H.textContent=at,H.dataset.snapdomPseudo="::first-letter";let kt=mt(i),$t=rt(kt,"span");n.styleMap.set(H,$t);let Y=document.createTextNode(B);e.replaceChild(Y,O),e.insertBefore(H,Y);continue}let c=i.content,l=Tt(c);ee(c)&&(re=ne(t.ownerDocument||document),l=oe(l,t,re));let u=i.backgroundImage,g=i.backgroundColor,R=i.fontFamily,x=parseInt(i.fontSize)||32,k=parseInt(i.fontWeight)||!1,h=i.color||"#000",S=i.display,C=parseFloat(i.width),$=parseFloat(i.height),N=i.borderStyle,W=parseFloat(i.borderWidth),_=i.transform,z=j(R),d=c!=="none"&&l!=="",y=u&&u!=="none",w=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)",A=S!=="inline"&&(C>0||$>0),p=N&&N!=="none"&&W>0,b=_&&_!=="none";if(!(d||y||w||A||p||b))continue;let M=document.createElement("span");M.dataset.snapdomPseudo=a,M.style.verticalAlign="middle";let E=mt(i),L=rt(E,"span");if(n.styleMap.set(M,L),z&&l.length===1){let{dataUrl:F,width:I,height:O}=await Jt(l,R,k,x,h),q=document.createElement("img");q.src=F,q.style=`height:${x}px;width:${I/O*x}px;object-fit:contain;`,M.appendChild(q),e.dataset.snapdomHasIcon="true"}else if(l.startsWith("url(")){let F=J(l);if(F?.trim())try{let I=document.createElement("img"),O=await D(G(F),{as:"dataURL",useProxy:o.useProxy});I.src=O.data,I.style=`width:${x}px;height:auto;object-fit:contain;`,M.appendChild(I)}catch(I){console.error(`[snapdom] Error in pseudo ${a} for`,t,I)}}else!z&&d&&(M.textContent=l);if(y)try{let F=et(u),I=await Promise.all(F.map(Z));M.style.backgroundImage=I.join(", ")}catch(F){console.warn(`[snapdom] Failed to inline background-image for ${a}`,F)}if(w&&(M.style.backgroundColor=g),!(M.childNodes.length>0||M.textContent?.trim()!==""||y||w||A||p||b))continue;a==="::before"?e.insertBefore(M,e.firstChild):e.appendChild(M)}catch(i){console.warn(`[snapdom] Failed to capture ${a} for`,t,i)}let r=Array.from(t.children),s=Array.from(e.children).filter(a=>!a.dataset.snapdomPseudo);for(let a=0;a<Math.min(r.length,s.length);a++)await Bt(r[a],s[a],n,o)}function ae(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(i=>{let f=i.getAttribute("xlink:href")||i.getAttribute("href");f&&f.startsWith("#")&&e.add(f.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(i=>i.tagName.toLowerCase()==="symbol"),r=n.filter(i=>i.tagName.toLowerCase()==="defs"),s=t.querySelector("svg.inline-defs-container");s||(s=document.createElementNS("http://www.w3.org/2000/svg","svg"),s.setAttribute("aria-hidden","true"),s.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),s.classList.add("inline-defs-container"),t.insertBefore(s,t.firstChild));let a=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(i=>{a.add(i.id)}),e.forEach(i=>{if(a.has(i))return;let f=o.find(c=>c.id===i);if(f){s.appendChild(f.cloneNode(!0)),a.add(i);return}for(let c of r){let l=c.querySelector(`#${CSS.escape(i)}`);if(l){let u=s.querySelector("defs");u||(u=document.createElementNS("http://www.w3.org/2000/svg","defs"),s.appendChild(u)),u.appendChild(l.cloneNode(!0)),a.add(i);break}}})}async function ie(t,e={}){let n={styleMap:m.session.styleMap,styleCache:m.session.styleCache,nodeMap:m.session.nodeMap},o,r="",s="";en(t);try{ae(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{o=await it(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await Bt(t,o,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await an(o);try{let i=o.querySelectorAll("style[data-sd]");for(let f of i)s+=f.textContent||"",f.remove()}catch{}let a=Nt(n.styleMap);r=Array.from(a.entries()).map(([i,f])=>`.${f}{${i}}`).join(""),r=s+r;for(let[i,f]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",f.replace(/;/g,"; "));continue}let c=a.get(f);c&&i.classList.add(c);let l=i.style?.backgroundImage,u=i.dataset?.snapdomHasIcon;l&&l!=="none"&&(i.style.backgroundImage=l),u&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,f]of n.nodeMap.entries()){let c=f.scrollLeft,l=f.scrollTop;if((c||l)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let g=document.createElement("div");for(g.style.transform=`translate(${-c}px, ${-l}px)`,g.style.willChange="transform",g.style.display="inline-block",g.style.width="100%";i.firstChild;)g.appendChild(i.firstChild);i.appendChild(g)}}if(t===n.nodeMap.get(o)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let f=Mt(i.transform);o.style.margin="0",o.style.position="static",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.zIndex="auto",o.style.float="none",o.style.clear="none",o.style.transform=f||""}for(let[i,f]of n.nodeMap.entries())f.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:o,classCSS:r,styleCache:n.styleCache}}function en(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,s=e.borderWidth,a=n!=="none"&&parseFloat(o)>0,i=r==="none"||parseFloat(s)===0;a&&i&&(t.style.border=`${o} solid transparent`)}var ct=new Map;async function lt(t){if(m.resource?.has(t))return m.resource.get(t);if(ct.has(t))return ct.get(t);let e=(async()=>{let n=await D(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return m.resource?.set(t,n.data),n.data})();ct.set(t,e);try{let n=await e;return ct.set(t,n),n}catch(n){throw ct.delete(t),n}}var nn=/\bblob:[^)"'\s]+/g;async function se(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(nn)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=await lt(o);n=n.split(o).join(r)}catch{}return n}function St(t){return typeof t=="string"&&t.startsWith("blob:")}function on(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 rn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function an(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of e)try{let f=a.getAttribute("src")||a.currentSrc||"";if(St(f)){let l=await lt(f);a.setAttribute("src",l)}let c=a.getAttribute("srcset");if(c&&c.includes("blob:")){let l=on(c),u=!1;for(let g of l)if(St(g.url))try{g.url=await lt(g.url),u=!0}catch{}u&&a.setAttribute("srcset",rn(l))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of n)try{let i="http://www.w3.org/1999/xlink",f=a.getAttribute("href")||a.getAttributeNS?.(i,"href");if(St(f)){let c=await lt(f);a.setAttribute("href",c),a.removeAttributeNS?.(i,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of o)try{let i=a.getAttribute("style");if(i&&i.includes("blob:")){let f=await se(i);a.setAttribute("style",f)}}catch{}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of r)try{let i=a.textContent||"";i.includes("blob:")&&(a.textContent=await se(i))}catch{}let s=["poster"];for(let a of s){let i=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let f of i)try{let c=f.getAttribute(a);St(c)&&f.setAttribute(a,await lt(c))}catch{}}}async function ce(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async r=>{if(!r.getAttribute("src")){let l=r.currentSrc||r.src||"";l&&r.setAttribute("src",l)}r.removeAttribute("srcset"),r.removeAttribute("sizes");let s=r.src||"";if(!s)return;let a=await D(s,{as:"dataURL",useProxy:e.useProxy});if(a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")){r.src=a.data,r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}let{fallbackURL:i}=e||{};if(i)try{let l=parseInt(r.dataset?.snapdomWidth||"",10)||0,u=parseInt(r.dataset?.snapdomHeight||"",10)||0,g=parseInt(r.getAttribute("width")||"",10)||0,R=parseInt(r.getAttribute("height")||"",10)||0,x=parseFloat(r.style?.width||"")||0,k=parseFloat(r.style?.height||"")||0,h=l||x||g||r.width||void 0,S=u||k||R||r.height||void 0,C=typeof i=="function"?await i({width:h,height:S,src:s,element:r}):i;if(C){let $=await D(C,{as:"dataURL",useProxy:e.useProxy});r.src=$.data,!r.width&&h&&(r.width=h),!r.height&&S&&(r.height=S),r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}}catch{}let f=r.width||r.naturalWidth||100,c=r.height||r.naturalHeight||100;if(e.placeholders!==!1){let l=document.createElement("div");l.style.cssText=[`width:${f}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),l.textContent="img",r.replaceWith(l)}else{let l=document.createElement("div");l.style.cssText=`display:inline-block;width:${f}px;height:${c}px;visibility:hidden;`,r.replaceWith(l)}};for(let r=0;r<n.length;r+=4){let s=n.slice(r,r+4).map(o);await Promise.allSettled(s)}}async function xt(t,e,n,o={}){let r=[[t,e]],s=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],i=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){let[f,c]=r.shift(),l=n.get(f)||tt(f);n.has(f)||n.set(f,l);let u=(()=>{let x=l.getPropertyValue("border-image"),k=l.getPropertyValue("border-image-source");return x&&x!=="none"||k&&k!=="none"})();for(let x of s){let k=l.getPropertyValue(x);if(!k||k==="none")continue;let h=et(k),S=await Promise.all(h.map(C=>Z(C,o)));S.some(C=>C&&C!=="none"&&!/^url\(undefined/.test(C))&&c.style.setProperty(x,S.join(", "))}for(let x of a){let k=l.getPropertyValue(x);!k||k==="initial"||c.style.setProperty(x,k)}if(u)for(let x of i){let k=l.getPropertyValue(x);!k||k==="initial"||c.style.setProperty(x,k)}let g=Array.from(f.children),R=Array.from(c.children);for(let x=0;x<Math.min(g.length,R.length);x++)r.push([g[x],R[x]])}}function le(t){if(!t)return()=>{};let e=sn(t);if(e<=0)return()=>{};if(!fn(t))return()=>{};let n=getComputedStyle(t),o=Math.round(cn(n)*e+ln(n)),r=t.textContent??"",s=r;if(t.scrollHeight<=o+.5)return()=>{};let a=0,i=r.length,f=-1;for(;a<=i;){let c=a+i>>1;t.textContent=r.slice(0,c)+"\u2026",t.scrollHeight<=o+.5?(f=c,a=c+1):i=c-1}return t.textContent=(f>=0?r.slice(0,f):"")+"\u2026",()=>{t.textContent=s}}function sn(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let o=parseInt(n,10);return Number.isFinite(o)&&o>0?o:0}function cn(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 ln(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function fn(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}async function Dt(t,e){if(!t)throw new Error("Element cannot be null or undefined");ft(e.cache);let n=e.fast,o,r,s,a="",i="",f,c,l=le(t);try{({clone:o,classCSS:r,styleCache:s}=await ie(t,e))}finally{l()}await new Promise(x=>{V(async()=>{await ce(o,e),x()},{fast:n})}),await new Promise(x=>{V(async()=>{await xt(t,o,s,e),x()},{fast:n})}),e.embedFonts&&await new Promise(x=>{V(async()=>{let k=yt(t),h=wt(t);if(X){let S=new Set(Array.from(k).map(C=>String(C).split("__")[0]).filter(Boolean));await bt(S,2)}a=await gt({required:k,usedCodepoints:h,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),x()},{fast:n})});let u=Rt(o).sort(),g=u.join(",");m.baseStyle.has(g)?i=m.baseStyle.get(g):await new Promise(x=>{V(()=>{i=Lt(u),m.baseStyle.set(g,i),x()},{fast:n})}),await new Promise(x=>{V(()=>{let k=t.getBoundingClientRect(),h=Number(k.width)||0,S=Number(k.height)||0,C=Number.isFinite(e.width),$=Number.isFinite(e.height),N=e.scale??1,W=typeof N=="number"&&N!==1;if(!W){let B=S>0?h/S:1;C&&$?(h=Number(e.width),S=Number(e.height)):C?(h=Number(e.width),S=h/(B||1)):$&&(S=Number(e.height),h=S*(B||1))}h=Math.max(1,Math.ceil(Number.isFinite(h)?h:1)),S=Math.max(1,Math.ceil(Number.isFinite(S)?S:1));let _=getComputedStyle(t),z=_.transform&&_.transform!=="none"?_.transform:"",d=mn(t),y,w,A,p,b=0,v=0;if(hn(t)){let B=yn({baseTransform:z,rotate:d.rotate||"0deg",scale:d.scale,translate:d.translate}),H=B.e??B.m41??0,kt=B.f??B.m42??0;b=-H,v=-kt;let $t=B.is2D?fe(B):fe(new DOMMatrix(B.toString())),Y=dn(h,S,$t);y=Math.max(1,Math.ceil(Y.width)),w=Math.max(1,Math.ceil(Y.height)),A=-Y.minX,p=-Y.minY}else{let B=t.getBoundingClientRect(),H=pn(B,{top:0,right:0,bottom:0,left:0});y=Math.max(1,H.width),w=Math.max(1,H.height),A=-(H.x-Math.floor(B.left)),p=-(H.y-Math.floor(B.top))}let M="http://www.w3.org/2000/svg",E=document.createElementNS(M,"foreignObject");E.setAttribute("width","100%"),E.setAttribute("height","100%"),E.setAttribute("x",String(A)),E.setAttribute("y",String(p)),E.style.overflow="visible";let L=document.createElement("style");L.textContent=i+a+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,E.appendChild(L);let T=document.createElement("div");T.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),T.style.width=`${h}px`,T.style.height=`${S}px`,T.style.overflow="visible",T.style.transformOrigin="0 0";let P=[];if((b||v)&&P.push(`translate(${b}px, ${v}px)`),!W&&(C||$)){let B=k.width?h/k.width:1,H=k.height?S/k.height:1;P.push(`scale(${B}, ${H})`)}else W&&P.push(`scale(${N})`);P.length&&(T.style.transform=P.join(" ")),o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),o.style.transformOrigin="0 0",o.style.position="static",o.style.left="0",o.style.top="0",z&&(o.style.transform=z),o.style.rotate=d.rotate||"0deg",o.style.scale=d.scale||"1",o.style.translate=d.translate||"0 0",T.appendChild(o),E.appendChild(T);let I=new XMLSerializer().serializeToString(E);c=`<svg xmlns="${M}" width="${!W&&(C||$)?h:y}" height="${!W&&($||C)?S:w}" viewBox="0 0 ${y} ${w}">`+I+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,x()},{fast:n})});let R=document.getElementById("snapdom-sandbox");return R&&R.style.position==="absolute"&&R.remove(),f}function un(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function fe(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function dn(t,e,n){let r=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(c=>({x:n.a*c.x+n.c*c.y,y:n.b*c.x+n.d*c.y})),s=Math.min(...r.map(c=>c.x)),a=Math.max(...r.map(c=>c.x)),i=Math.min(...r.map(c=>c.y)),f=Math.max(...r.map(c=>c.y));return{minX:s,minY:i,width:a-s,height:f-i}}function mn(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let r=f=>{try{return typeof n.has=="function"&&!n.has(f)||typeof n.get!="function"?null:n.get(f)}catch{return null}},s=r("rotate");if(s){let f=s.angle??s;f&&typeof f=="object"&&"unit"in f?e.rotate=f.unit==="rad"?f.value*180/Math.PI+"deg":f.value+f.unit:e.rotate=String(s)}let a=r("scale");if(a&&a.length){let f=a[0]?.value??1,c=a[1]?.value??f;e.scale=`${f} ${c}`}let i=r("translate");if(i&&i.length){let f=i[0]?.value??0,c=i[1]?.value??0,l=i[0]?.unit??"px",u=i[1]?.unit??"px";e.translate=`${f}${l} ${c}${u}`}return e}let o=getComputedStyle(t);return e.rotate=o.rotate&&o.rotate!=="none"?o.rotate:"0deg",e.scale=o.scale&&o.scale!=="none"?o.scale:null,e.translate=o.translate&&o.translate!=="none"?o.translate:null,e}function hn(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function pn(t,e){let n=Math.floor(t.left-e.left),o=Math.floor(t.top-e.top),r=Math.ceil(t.width+e.left+e.right),s=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:o,width:r,height:s}}var Ot=null;function gn(){if(Ot)return Ot;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),Ot=t,t}function yn(t){let e=gn(),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 o=un(n);return e.removeChild(n),o}function wn(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ue(t={}){let e=t.format??"png",n=wn(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"}}async function de(t,e){let n=new Image;return n.src=t,await n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n}async function K(t,e){let{scale:n,dpr:o}=e,r=new Image;r.crossOrigin="anonymous",r.loading="eager",r.decoding="sync",r.src=t,await r.decode();let s=r.naturalWidth*n,a=r.naturalHeight*n,i=document.createElement("canvas");i.width=Math.ceil(s*o),i.height=Math.ceil(a*o),i.style.width=`${s}px`,i.style.height=`${a}px`;let f=i.getContext("2d");return o!==1&&f.scale(o,o),f.drawImage(r,0,0,s,a),i}async function Ct(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await K(t,e),r=e.backgroundColor?Q(o,e.backgroundColor):o;return new Promise(s=>r.toBlob(a=>s(a),`image/${n}`,e.quality))}async function me(t,e){let n=await K(t,e),o=e.backgroundColor?Q(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=`${o.width/e.dpr}px`,r.style.height=`${o.height/e.dpr}px`,r}async function he(t,e){if(e.dpr=1,e.format==="svg"){let s=await Ct(t,{...e,type:"svg"}),a=URL.createObjectURL(s),i=document.createElement("a");i.href=a,i.download=e.filename,i.click(),URL.revokeObjectURL(a);return}let n=await K(t,e),o=e.backgroundColor?Q(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}var pe=Symbol("snapdom.internal"),qt=!1;async function U(t,e){if(!t)throw new Error("Element cannot be null or undefined");if(X())for(let o=0;o<3;o++)try{await bn(t,e),console.log("Iteraci\xF3n n\xFAmero:",o),qt=!1}catch{}let n=ue(e);return n.iconFonts&&n.iconFonts.length>0&&Yt(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>U.toPng(o,r),toImg:(o,r)=>U.toImg(o,r)}),U.capture(t,n,pe)}U.capture=async(t,e,n)=>{if(n!==pe)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Dt(t,e),r=a=>({...e,...a||{}}),s=a=>i=>{let f=r({...i||{},format:a}),c=a==="jpeg"||a==="jpg",l=f.backgroundColor==null||f.backgroundColor==="transparent";return c&&l&&(f.backgroundColor="#ffffff"),me(o,f)};return{url:o,toRaw:()=>o,toImg:a=>de(o,r(a)),toCanvas:a=>K(o,r(a)),toBlob:a=>Ct(o,r(a)),toPng:s("png"),toJpg:s("jpeg"),toWebp:s("webp"),download:a=>he(o,r(a))}};U.toRaw=(t,e)=>U(t,e).then(n=>n.toRaw());U.toImg=(t,e)=>U(t,e).then(n=>n.toImg());U.toCanvas=(t,e)=>U(t,e).then(n=>n.toCanvas());U.toBlob=(t,e)=>U(t,e).then(n=>n.toBlob());U.toPng=(t,e)=>U(t,{...e,format:"png"}).then(n=>n.toPng());U.toJpg=(t,e)=>U(t,{...e,format:"jpeg"}).then(n=>n.toJpg());U.toWebp=(t,e)=>U(t,{...e,format:"webp"}).then(n=>n.toWebp());U.download=(t,e)=>U(t,e).then(n=>n.download());async function bn(t,e){if(qt)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await Dt(t,n)}catch{return}await new Promise(r=>{let s=new Image;s.decoding="sync",s.loading="eager",s.style.position="fixed",s.style.left=0,s.style.top=0,s.style.width="10px",s.style.height="10px",s.style.opacity="0.01",s.style.transform="translateZ(10px)",s.style.willChange="transform,opacity;",s.src=o;let a=async()=>{await new Promise(i=>setTimeout(i,100)),s&&s.parentNode&&s.parentNode.removeChild(s),qt=!0,r()};document.body.appendChild(s),a()})}async function Sn(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,r=e.cache??e.cacheOpt??"full";ft(r);try{await document.fonts?.ready}catch{}try{vt()}catch{}m.session=m.session||{},m.session.styleCache||(m.session.styleCache=new WeakMap),m.image=m.image||new Map;try{await xt(t,void 0,m.session.styleCache,{useProxy:o})}catch{}let s=[],a=[];try{t?.querySelectorAll&&(s=Array.from(t.querySelectorAll("img[src]")),a=Array.from(t.querySelectorAll("*")))}catch{}let i=[];for(let f of s){let c=f?.currentSrc||f?.src;if(c&&!m.image.has(c)){let l=Promise.resolve().then(async()=>{let u=await D(c,{as:"dataURL",useProxy:o});u?.ok&&typeof u.data=="string"&&m.image.set(c,u.data)}).catch(()=>{});i.push(l)}}for(let f of a){let c="";try{c=tt(f).backgroundImage}catch{}if(c&&c!=="none"){let l=et(c);for(let u of l)if(u.startsWith("url(")){let g=Promise.resolve().then(()=>Z(u,{...e,useProxy:o})).catch(()=>{});i.push(g)}}}if(n)try{let f=yt(t),c=wt(t);if(typeof X=="function"?X():!!X){let u=new Set(Array.from(f).map(g=>String(g).split("__")[0]).filter(Boolean));await bt(u,2)}await gt({required:f,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o})}catch{}await Promise.allSettled(i)}export{Sn as preCache,U as snapdom};
|
|
1
|
+
var m={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function ft(t="soft"){switch(t){case"auto":{m.session.styleMap=new Map,m.session.nodeMap=new Map;return}case"soft":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap,m.computedStyle=new WeakMap,m.baseStyle=new Map,m.defaultStyle=new Map,m.image=new Map,m.background=new Map,m.resource=new Map,m.font=new Set;return}default:{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}}}function J(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Mt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(s=>s.trim());return o.length!==6?`matrix(${r})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(s=>s.trim());return o.length!==16?`matrix3d(${r})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function G(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ge(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,o=0;function s(a,i,f){if(o>=n)return;let c=Date.now();(r.get(i)||0)>c||(r.set(i,c+e),o++,a==="warn"&&console&&console.warn?console.warn(`${t} ${f}`):console&&console.error&&console.error(`${t} ${f}`))}return{warnOnce(a,i){s("warn",a,i)},errorOnce(a,i){s("error",a,i)},reset(){r.clear(),o=0}}}var jt=ge("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),$t=new Map,ut=new Map;function ye(t){return/^data:|^blob:|^about:blank$/i.test(t)}function we(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,o=new URL(r||".",n),s=new URL(t,n);if(s.origin===o.origin)return!0;let a=s.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function be(t,e){if(!e||ye(t)||we(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(t,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function Se(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",G(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${G(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function zt(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(t)})}function xe(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function D(t,e={}){let n=e.as??"blob",r=e.timeout??3e3,o=e.useProxy||"",s=e.errorTTL??8e3,a=e.headers||{},i=!!e.silent;if(/^data:/i.test(t))try{if(n==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,h="",S=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],E=/;base64/i.test(h)?atob(S):decodeURIComponent(S),N=new Uint8Array([...E].map(_=>_.charCodeAt(0))),W=new Blob([N],{type:(h||"").split(";")[0]||""});return{ok:!0,data:W,status:200,url:t,fromCache:!1,mime:W.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let h=await fetch(t);if(!h.ok)return{ok:!1,data:null,status:h.status,url:t,fromCache:!1,reason:"http_error"};let S=await h.blob(),C=S.type||h.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await zt(S),status:h.status,url:t,fromCache:!1,mime:C}:n==="text"?{ok:!0,data:await S.text(),status:h.status,url:t,fromCache:!1,mime:C}:{ok:!0,data:S,status:h.status,url:t,fromCache:!1,mime:C}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let f=xe(t,{as:n,timeout:r,useProxy:o,errorTTL:s}),c=ut.get(f);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&ut.delete(f);let l=$t.get(f);if(l)return l;let u=be(t,o)?Se(t,o):t,g=e.credentials;if(!g)try{let h=typeof location<"u"&&location.href?location.href:"http://localhost/",S=new URL(t,h);g=typeof location<"u"&&S.origin===location.origin?"include":"omit"}catch{g="omit"}let L=new AbortController,x=setTimeout(()=>L.abort("timeout"),r),A=(async()=>{try{let h=await fetch(u,{signal:L.signal,credentials:g,headers:a});if(!h.ok){let E={ok:!1,data:null,status:h.status,url:u,fromCache:!1,reason:"http_error"};if(s>0&&ut.set(f,{until:Date.now()+s,result:E}),!i){let N=`${h.status} ${h.statusText||""}`.trim();jt.warnOnce(`http:${h.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${N} while fetching ${n} ${t}`)}return e.onError&&e.onError(E),E}if(n==="text")return{ok:!0,data:await h.text(),status:h.status,url:u,fromCache:!1};let S=await h.blob(),C=S.type||h.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await zt(S),status:h.status,url:u,fromCache:!1,mime:C}:{ok:!0,data:S,status:h.status,url:u,fromCache:!1,mime:C}}catch(h){let S=h&&typeof h=="object"&&"name"in h&&h.name==="AbortError"?String(h.message||"").includes("timeout")?"timeout":"abort":"network",C={ok:!1,data:null,status:0,url:u,fromCache:!1,reason:S};if(!/^blob:/i.test(t)&&s>0&&ut.set(f,{until:Date.now()+s,result:C}),!i){let E=`${S}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,N=S==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:S==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;jt.errorOnce(E,N)}return e.onError&&e.onError(C),C}finally{clearTimeout(x),$t.delete(f)}})();return $t.set(f,A),A}function Q(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let r=n.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,n.width,n.height),r.drawImage(t,0,0),n}async function Z(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=J(t);if(!r)return t;let o=G(r);if(m.background.has(o)){let s=m.background.get(o);return s?`url("${s}")`:"none"}try{let s=await D(o,{as:"dataURL",useProxy:e.useProxy});return s.ok?(m.background.set(o,s.data),`url("${s.data}")`):(m.background.set(o,null),"none")}catch{return m.background.set(o,null),"none"}}var dt=new Set(["meta","script","noscript","title","link","template"]),rt=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),Ce=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function Ft(){for(let t of Ce){let e=String(t).toLowerCase();dt.has(e)||rt.has(e)||vt(e)}}function vt(t){if(t=String(t).toLowerCase(),rt.has(t)){let s={};return m.defaultStyle.set(t,s),s}if(m.defaultStyle.has(t))return m.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let r=getComputedStyle(n),o={};for(let s of r){if(Vt(s))continue;let a=r.getPropertyValue(s);o[s]=a}return e.removeChild(n),m.defaultStyle.set(t,o),o}var ke=/(?:^|-)(animation|transition)(?:-|$)/i,Ae=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Ee=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function Vt(t){let e=String(t).toLowerCase();return!!(Ee.has(e)||Ae.test(e)||ke.test(e))}function ot(t,e){if(e=String(e||"").toLowerCase(),rt.has(e))return"";let n=[],r=vt(e);for(let[o,s]of Object.entries(t)){if(Vt(o))continue;let a=r[o];s&&s!==a&&n.push(`${o}:${s}`)}return n.sort(),n.join(";")}function Lt(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function Rt(t){let e=new Map;for(let r of t){let o=m.defaultStyle.get(r);if(!o)continue;let s=Object.entries(o).map(([a,i])=>`${a}:${i};`).sort().join("");s&&(e.has(s)||e.set(s,[]),e.get(s).push(r))}let n="";for(let[r,o]of e.entries())n+=`${o.join(",")} { ${r} }
|
|
2
|
+
`;return n}function Nt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,r=1;for(let o of e)n.set(o,`c${r++}`);return n}function tt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=m.computedStyle.get(t);if(n||(n=new Map,m.computedStyle.set(t,n)),!n.has(e)){let r=window.getComputedStyle(t,e);n.set(e,r)}return n.get(e)}function Tt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch{return e}return e}function mt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function et(t){let e=[],n=0,r=0;for(let o=0;o<t.length;o++){let s=t[o];s==="("&&n++,s===")"&&n--,s===","&&n===0&&(e.push(t.slice(r,o).trim()),r=o+1)}return e.push(t.slice(r).trim()),e}function V(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function X(){let t=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(t),n=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(t);return e||n}var Xt=new WeakMap,It=new Map,_t=0;function st(){_t++}var Gt=!1;function Me(t=document.documentElement){if(!Gt){Gt=!0;try{new MutationObserver(()=>st()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>st()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",st),e.ready?.then(()=>st()).catch(()=>{}))}catch{}}}function $e(t,e={}){let n={},r=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let s=t[o],a=t.getPropertyValue(s);(s==="background-image"||s==="content")&&a.includes("url(")&&!a.includes("data:")&&(a="none"),n[s]=a}if(e.embedFonts){let o=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let s of o)if(!n[s])try{let a=t.getPropertyValue(s);a&&(n[s]=a)}catch{}}return r==="hidden"&&(n.opacity="0"),n}var Kt=new WeakMap;function Fe(t){let e=Kt.get(t);return e||(e=Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:r[0]>o[0]?1:0).map(([r,o])=>`${r}:${o}`).join(";"),Kt.set(t,e),e)}function ve(t,e=null,n={}){let r=Xt.get(t);if(r&&r.epoch===_t)return r.snapshot;let o=e||getComputedStyle(t),s=$e(o,n);return _e(t,o,s),Xt.set(t,{epoch:_t,snapshot:s}),s}function Le(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:It,defaultStyle:m.defaultStyle,baseStyle:m.baseStyle,image:m.image,resource:m.resource,background:m.background,font:m.font},options:e||{}}:{session:m.session,persist:{snapshotKeyCache:It,defaultStyle:m.defaultStyle,baseStyle:m.baseStyle,image:m.image,resource:m.resource,background:m.background,font:m.font},options:t||e||{}}}async function nt(t,e,n,r){if(t.tagName==="STYLE")return;let o=Le(n,r),s=o.options&&o.options.cache||"auto";if(s!=="disabled"&&Me(document.documentElement),s==="disabled"&&!o.session.__bumpedForDisabled&&(st(),It.clear(),o.session.__bumpedForDisabled=!0),rt.has(t.tagName?.toLowerCase())){let g=t.getAttribute?.("style");g&&e.setAttribute("style",g)}let{session:a,persist:i}=o;a.styleCache.has(t)||a.styleCache.set(t,getComputedStyle(t));let f=a.styleCache.get(t),c=ve(t,f,o.options),l=Fe(c),u=i.snapshotKeyCache.get(l);if(!u){let g=t.tagName?.toLowerCase()||"div";u=ot(c,g),i.snapshotKeyCache.set(l,u)}a.styleMap.set(e,u)}function Re(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Ne(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function Te(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Ie(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,r=t.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let o=t.scrollHeight;if(o===0)return!1;let s=parseFloat(e.paddingTop)||0,a=parseFloat(e.paddingBottom)||0;return o>s+a}function _e(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let r=e.display||"";if(r.includes("flex")||r.includes("grid")||Re(t))return;let o=e.position;o==="absolute"||o==="fixed"||o==="sticky"||e.transform==="none"&&(Ne(e)||Te(t)||Ie(t,e)&&(delete n.height,delete n["block-size"]))}function Pt(t,e,n){return Promise.all(t.map(r=>new Promise(o=>{function s(){V(a=>{(a&&typeof a.timeRemaining=="function"?a.timeRemaining()>0:!0)?e(r,o):s()},{fast:n})}s()})))}function Pe(t){return t=t.trim(),!t||/\:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Ue(t,e,n=!0){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let o=n?Pe(r):r;return`:where(${e} ${o})`}).join(", ")}function We(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${e}:is(${r.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${e} ${r.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,o,s)=>{let a=Ue(s,e,!0);return`${r}${o}${a}{`}),t):""}function Be(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Oe(t){let e="";try{t.querySelectorAll("style").forEach(r=>{e+=(r.textContent||"")+`
|
|
3
|
+
`});let n=t.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let o of r.cssRules)e+=o.cssText+`
|
|
4
|
+
`}catch{}}catch{}return e}function De(t,e,n){if(!e)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=e,t.insertBefore(r,t.firstChild||null)}function He(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function qe(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(t);)e.add(r[1]);return e}function je(t,e){try{let r=getComputedStyle(t).getPropertyValue(e).trim();if(r)return r}catch{}try{let r=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(r)return r}catch{}return""}function ze(t,e,n){let r=[];for(let o of e){let s=je(t,o);s&&r.push(`${o}: ${s};`)}return r.length?`${n}{${r.join("")}}
|
|
5
|
+
`:""}function Ve(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 Xe(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(s=>setTimeout(s,0)),r=n(),o++;return r&&(r.body||r.documentElement)?r:null}function Ge(t){let e=t.getBoundingClientRect(),n=0,r=0,o=0,s=0;try{let f=getComputedStyle(t);n=parseFloat(f.borderLeftWidth)||0,r=parseFloat(f.borderRightWidth)||0,o=parseFloat(f.borderTopWidth)||0,s=parseFloat(f.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(e.width-(n+r))),i=Math.max(0,Math.round(e.height-(o+s)));return{contentWidth:a,contentHeight:i,rect:e}}function Ke(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 Ye(t,e,n){let r=await Xe(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:s,rect:a}=Ge(t),i=n?.snap;if(!i||typeof i.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let f={...n,scale:1},c=Ke(r,o,s),l;try{l=await i.toPng(r.documentElement,f)}finally{c()}l.style.display="block",l.style.width=`${o}px`,l.style.height=`${s}px`;let u=document.createElement("div");return e.nodeMap.set(u,t),nt(t,u,e,n),u.style.overflow="hidden",u.style.display="block",u.style.width||(u.style.width=`${Math.round(a.width)}px`),u.style.height||(u.style.height=`${Math.round(a.height)}px`),u.appendChild(l),u}async function it(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,o=null,s=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||dt.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"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.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 l=document.createElement("div"),u=t.getBoundingClientRect();return l.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,l}else if(n.excludeMode==="remove")return null}}catch(l){console.warn(`Invalid selector in exclude option: ${c}`,l)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.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 Ye(t,e,n)}catch(l){console.warn("[SnapDOM] iframe rasterization failed, fallback:",l)}if(n.placeholders){let l=document.createElement("div");return l.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;`,nt(t,l,e,n),l}else{let l=t.getBoundingClientRect(),u=document.createElement("div");return u.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,nt(t,u,e,n),u}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),nt(t,c,e,n);let l=document.createElement("div");return l.textContent=t.getAttribute("data-placeholder-text")||"",l.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(l),c}if(t.tagName==="CANVAS"){let c=t.toDataURL(),l=document.createElement("img");return l.src=c,l.width=t.width,l.height=t.height,e.nodeMap.set(l,t),nt(t,l,e,n),l}let a;try{if(a=t.cloneNode(!1),e.nodeMap.set(a,t),t.tagName==="IMG"){He(t,a);try{let c=t.getBoundingClientRect(),l=Math.round(c.width||0),u=Math.round(c.height||0);if(!l||!u){let g=window.getComputedStyle(t),L=parseFloat(g.width)||0,x=parseFloat(g.height)||0,A=parseInt(t.getAttribute("width")||"",10)||0,h=parseInt(t.getAttribute("height")||"",10)||0,S=t.width||t.naturalWidth||0,C=t.height||t.naturalHeight||0;l=Math.round(l||L||A||S||0),u=Math.round(u||x||h||C||0)}l&&(a.dataset.snapdomWidth=String(l)),u&&(a.dataset.snapdomHeight=String(u))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();a.style.width=`${c.width}px`,a.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(a.value=t.value,a.setAttribute("value",t.value),t.checked!==void 0&&(a.checked=t.checked,t.checked&&a.setAttribute("checked",""),t.indeterminate&&(a.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(o=t.value),t instanceof HTMLTextAreaElement&&(s=t.value),nt(t,a,e,n),t.shadowRoot){let h=function(C,E){if(C.nodeType===Node.ELEMENT_NODE&&C.tagName==="STYLE")return E(null);it(C,e,n).then(N=>{E(N||null)}).catch(N=>{E(null)})};try{let C=t.shadowRoot.querySelectorAll("slot");for(let E of C){let N=[];try{N=E.assignedNodes?.({flatten:!0})||E.assignedNodes?.()||[]}catch{N=E.assignedNodes?.()||[]}for(let W of N)r.add(W)}}catch{}let c=Be(e),l=`[data-sd="${c}"]`;try{a.setAttribute("data-sd",c)}catch{}let u=Oe(t.shadowRoot),g=We(u,l),L=qe(u),x=ze(t,L,l);De(a,x+g,c);let A=document.createDocumentFragment(),S=await Pt(Array.from(t.shadowRoot.childNodes),h,n.fast);A.append(...S.filter(C=>!!C)),a.appendChild(A)}if(t.tagName==="SLOT"){let g=function(x,A){it(x,e,n).then(h=>{h&&Ve(h),A(h||null)}).catch(h=>{A(null)})},c=t.assignedNodes?.({flatten:!0})||[],l=c.length>0?c:Array.from(t.childNodes),u=document.createDocumentFragment(),L=await Pt(Array.from(l),g,n.fast);return u.append(...L.filter(x=>!!x)),u}function i(c,l){if(r.has(c))return l(null);it(c,e,n).then(u=>{l(u||null)}).catch(u=>{l(null)})}let f=await Pt(Array.from(t.childNodes),i,n.fast);if(a.append(...f.filter(c=>!!c)),o!==null&&a instanceof HTMLSelectElement){a.value=o;for(let c of a.options)c.value===o?c.setAttribute("selected",""):c.removeAttribute("selected")}return s!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=s),a}var Je=[/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],Ut=[];function Yt(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Ut.push(n):typeof n=="string"?Ut.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function j(t){let e=typeof t=="string"?t:"",n=[...Je,...Ut];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 Jt(t,e,n,r=32,o="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let s=window.devicePixelRatio||1;await document.fonts.ready;let a=document.createElement("span");a.textContent=t,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${e}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${r}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let i=a.getBoundingClientRect(),f=Math.ceil(i.width),c=Math.ceil(i.height);document.body.removeChild(a);let l=document.createElement("canvas");l.width=f*s,l.height=c*s;let u=l.getContext("2d");return u.scale(s,s),u.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=o,u.fillText(t,0,0),{dataUrl:l.toDataURL(),width:f,height:c}}var Qe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function ht(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Qe.has(n.toLowerCase()))return n}return""}function pt(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 Wt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Ze(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function tn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let o=pt(n[1]),s=pt(n[2]);return{min:Math.min(o,s),max:Math.max(o,s)}}let r=pt(e);return{min:r,max:r}}function en(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function nn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let s=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(s,a),max:Math.max(s,a)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),o=r?parseFloat(r[1]):100;return{min:o,max:o}}function rn(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(i=>o.endsWith(i)))return!0;let a=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a))return!0;for(let i of e){let f=i.toLowerCase().replace(/\s+/g,"+"),c=i.toLowerCase().replace(/\s+/g,"-");if(a.includes(f)||a.includes(c))return!0}return!1}catch{return!1}}function on(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}async function gt({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 s=new Map;for(let d of t){let[y,w,k,p]=String(d).split("__");if(!y)continue;let b=s.get(y)||[];b.push({w:parseInt(w,10),s:k,st:parseInt(p,10)}),s.set(y,b)}let a=/@import\s+url\(["']?([^"')]+)["']?\)/g,i=/url\((["']?)([^"')]+)\1\)/g,f=/@font-face[^{}]*\{[^}]*\}/g;function c(d,y,w,k){if(!s.has(d))return!1;let p=s.get(d),b=tn(w),F=en(y),M=nn(k),$=b.min!==b.max,R=b.min,T=v=>F.kind==="normal"&&v==="normal"||F.kind!=="normal"&&(v==="italic"||v==="oblique"),P=!1;for(let v of p){let I=$?v.w>=b.min&&v.w<=b.max:v.w===R,O=T(Wt(v.s)),H=v.st>=M.min&&v.st<=M.max;if(I&&O&&H){P=!0;break}}if(P)return!0;if(!$)for(let v of p){let I=T(Wt(v.s)),O=v.st>=M.min&&v.st<=M.max;if(Math.abs(R-v.w)<=300&&I&&O)return!0}return!1}function l(d){if(!d)return[];let y=[],w=d.split(",").map(k=>k.trim()).filter(Boolean);for(let k of w){let p=k.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!p)continue;let b=p[1],F=p[2],M=$=>{if(!$.includes("?"))return parseInt($,16);let R=parseInt($.replace(/\?/g,"0"),16),T=parseInt($.replace(/\?/g,"F"),16);return[R,T]};if(F){let $=M(b),R=M(F),T=Array.isArray($)?$[0]:$,P=Array.isArray(R)?R[1]:R;y.push([Math.min(T,P),Math.max(T,P)])}else{let $=M(b);Array.isArray($)?y.push([$[0],$[1]]):y.push([$,$])}}return y}function u(d,y){if(!y.length||!d||d.size===0)return!0;for(let w of d)for(let[k,p]of y)if(w>=k&&w<=p)return!0;return!1}function g(d,y){let w=[];if(!d)return w;for(let k of d.matchAll(i)){let p=(k[2]||"").trim();if(!(!p||p.startsWith("data:"))){if(!/^https?:/i.test(p))try{p=new URL(p,y||location.href).href}catch{}w.push(p)}}return w}async function L(d,y){let w=d;for(let k of d.matchAll(i)){let p=J(k[0]);if(!p)continue;let b=p;if(!b.startsWith("http")&&!b.startsWith("data:"))try{b=new URL(b,y||location.href).href}catch{}if(!j(b)){if(m.resource?.has(b)){m.font?.add(b),w=w.replace(k[0],`url(${m.resource.get(b)})`);continue}if(!m.font?.has(b))try{let F=await D(b,{as:"dataURL",useProxy:o,silent:!0});if(F.ok&&typeof F.data=="string"){let M=F.data;m.resource?.set(b,M),m.font?.add(b),w=w.replace(k[0],`url(${M})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",b)}}}return w}function x(d){if(!d.length)return null;let y=(M,$)=>d.some(([R,T])=>!(T<M||R>$)),w=y(0,255)||y(305,305),k=y(256,591)||y(7680,7935),p=y(880,1023),b=y(1024,1279);return y(7840,7929)||y(258,259)||y(416,417)||y(431,432)?"vietnamese":b?"cyrillic":p?"greek":k?"latin-ext":w?"latin":null}function A(d={}){let y=new Set((d.families||[]).map(p=>String(p).toLowerCase())),w=new Set((d.domains||[]).map(p=>String(p).toLowerCase())),k=new Set((d.subsets||[]).map(p=>String(p).toLowerCase()));return(p,b)=>{if(y.size&&y.has(p.family.toLowerCase()))return!0;if(w.size)for(let F of p.srcUrls)try{if(w.has(new URL(F).host.toLowerCase()))return!0}catch{}if(k.size){let F=x(b);if(F&&k.has(F))return!0}return!1}}let h=A(n);function S(d){if(!d)return d;let y=/@font-face[^{}]*\{[^}]*\}/gi,w=new Set,k=[];for(let b of d.match(y)||[]){let F=b.match(/font-family:\s*([^;]+);/i)?.[1]||"",M=ht(F),$=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),R=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),T=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),P=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),v=(b.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),I=g(v,location.href),O=I.length?I.map(kt=>String(kt).toLowerCase()).sort().join("|"):v.toLowerCase(),H=[String(M||"").toLowerCase(),$,R,T,P.toLowerCase(),O].join("|");w.has(H)||(w.add(H),k.push(b))}if(k.length===0)return d;let p=0;return d.replace(y,()=>k[p++]||"")}function C(){let d=Array.from(t||[]).sort().join("|"),y=n?JSON.stringify({families:(n.families||[]).map(p=>String(p).toLowerCase()).sort(),domains:(n.domains||[]).map(p=>String(p).toLowerCase()).sort(),subsets:(n.subsets||[]).map(p=>String(p).toLowerCase()).sort()}):"",w=(r||[]).map(p=>`${(p.family||"").toLowerCase()}::${p.weight||"normal"}::${p.style||"normal"}::${p.src||""}`).sort().join("|");return`fonts-embed-css::req=${d}::ex=${y}::lf=${w}::px=${o||""}`}let E=C();if(m.resource?.has(E))return m.resource.get(E);let N=on(t),W=[];for(let d of document.querySelectorAll("style")){let y=d.textContent||"";for(let w of y.matchAll(a)){let k=w[1];if(!k||j(k))continue;!!document.querySelector(`link[rel="stylesheet"][href="${k}"]`)||W.push(k)}}W.length&&await Promise.all(W.map(d=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return y(null);let w=document.createElement("link");w.rel="stylesheet",w.href=d,w.setAttribute("data-snapdom","injected-import"),w.onload=()=>y(w),w.onerror=()=>y(null),document.head.appendChild(w)})));let _="",z=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of z)try{if(j(d.href))continue;let y="",w=!1;try{w=new URL(d.href,location.href).origin===location.origin}catch{}if(!w&&!rn(d.href,N))continue;if(w){let p=Array.from(document.styleSheets).find(b=>b.href===d.href);if(p)try{let b=p.cssRules||[];y=Array.from(b).map(F=>F.cssText).join("")}catch{}}if(!y&&(y=(await D(d.href,{as:"text",useProxy:o})).data,j(d.href)))continue;let k="";for(let p of y.match(f)||[]){let b=(p.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),F=ht(b);if(!F||j(F))continue;let M=(p.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),$=(p.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),R=(p.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),T=(p.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),P=(p.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),v=g(P,d.href);if(!c(F,$,M,R))continue;let I=l(T);if(!u(e,I))continue;let O={family:F,weightSpec:M,styleSpec:$,stretchSpec:R,unicodeRange:T,srcRaw:P,srcUrls:v,href:d.href};if(n&&h(O,I))continue;let H=/url\(/i.test(P)?await L(p,d.href):p;k+=H+""}k.trim()&&(_+=k+"")}catch{console.warn("[snapdom] Failed to process stylesheet:",d.href)}for(let d of document.styleSheets)try{if(d.href&&z.some(w=>w.href===d.href))continue;let y=d.cssRules||[];for(let w of y){if(w.type!==CSSRule.FONT_FACE_RULE)continue;let k=(w.style.getPropertyValue("font-family")||"").trim(),p=ht(k);if(!p||j(p))continue;let b=(w.style.getPropertyValue("font-weight")||"400").trim(),F=(w.style.getPropertyValue("font-style")||"normal").trim(),M=(w.style.getPropertyValue("font-stretch")||"100%").trim(),$=(w.style.getPropertyValue("src")||"").trim(),R=(w.style.getPropertyValue("unicode-range")||"").trim(),T=g($,d.href||location.href);if(!c(p,F,b,M))continue;let P=l(R);if(!u(e,P))continue;let v={family:p,weightSpec:b,styleSpec:F,stretchSpec:M,unicodeRange:R,srcRaw:$,srcUrls:T,href:d.href||location.href};if(!(n&&h(v,P)))if(/url\(/i.test($)){let I=await L($,d.href||location.href);_+=`@font-face{font-family:${p};src:${I};font-style:${F};font-weight:${b};font-stretch:${M};${R?`unicode-range:${R};`:""}}`}else _+=`@font-face{font-family:${p};src:${$};font-style:${F};font-weight:${b};font-stretch:${M};${R?`unicode-range:${R};`:""}}`}}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let y=String(d.family).replace(/^['"]+|['"]+$/g,"");if(j(y)||!s.has(y)||n?.families&&n.families.some(k=>String(k).toLowerCase()===y.toLowerCase()))continue;let w=d._snapdomSrc;if(!String(w).startsWith("data:")){if(m.resource?.has(d._snapdomSrc))w=m.resource.get(d._snapdomSrc),m.font?.add(d._snapdomSrc);else if(!m.font?.has(d._snapdomSrc))try{let k=await D(d._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(k.ok&&typeof k.data=="string")w=k.data,m.resource?.set(d._snapdomSrc,w),m.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapdom] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}_+=`@font-face{font-family:'${y}';src:url(${w});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of r){if(!d||typeof d!="object")continue;let y=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||j(y)||!s.has(y)||n?.families&&n.families.some(M=>String(M).toLowerCase()===y.toLowerCase()))continue;let w=d.weight!=null?String(d.weight):"normal",k=d.style!=null?String(d.style):"normal",p=d.stretchPct!=null?`${d.stretchPct}%`:"100%",b=String(d.src||""),F=b;if(!F.startsWith("data:")){if(m.resource?.has(b))F=m.resource.get(b),m.font?.add(b);else if(!m.font?.has(b))try{let M=await D(b,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")F=M.data,m.resource?.set(b,F),m.font?.add(b);else continue}catch{console.warn("[snapdom] Failed to fetch localFonts src:",b);continue}}_+=`@font-face{font-family:'${y}';src:url(${F});font-style:${k};font-weight:${w};font-stretch:${p};}`}return _&&(_=S(_),m.resource?.set(E,_)),_}function yt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=a=>{let i=ht(a.fontFamily);if(!i)return;let f=(c,l,u)=>`${i}__${pt(c)}__${Wt(l)}__${Ze(u)}`;e.add(f(a.fontWeight,a.fontStyle,a.fontStretch))};r(getComputedStyle(t));let o=getComputedStyle(t,"::before");o&&o.content&&o.content!=="none"&&r(o);let s=getComputedStyle(t,"::after");for(s&&s.content&&s.content!=="none"&&r(s);n.nextNode();){let a=n.currentNode,i=getComputedStyle(a);r(i);let f=getComputedStyle(a,"::before");f&&f.content&&f.content!=="none"&&r(f);let c=getComputedStyle(a,"::after");c&&c.content&&c.content!=="none"&&r(c)}return e}function wt(t){let e=new Set,n=o=>{if(o)for(let s of o)e.add(s.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 s=o;for(let a of["::before","::after"]){let f=getComputedStyle(s,a)?.getPropertyValue("content");if(!(!f||f==="none"))if(/^"/.test(f)||/^'/.test(f))n(f.slice(1,-1));else{let c=f.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let l of c)try{e.add(parseInt(l.slice(1),16))}catch{}}}}}return e}async function bt(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 s of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${s}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",o.appendChild(a)}document.body.appendChild(o),o.offsetWidth,document.body.removeChild(o)};for(let o=0;o<Math.max(1,e);o++)r(),await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s)))}function ee(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function an(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Qt(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 Zt(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[s,a]of n)for(;r>=s;)o+=a,r-=s;return e?o:o.toLowerCase()}function te(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 Qt(t,!1);case"upper-alpha":return Qt(t,!0);case"lower-roman":return Zt(t,!1);case"upper-roman":return Zt(t,!0);default:return String(Math.max(0,t))}}function ne(t){let e=new WeakMap,n=t instanceof Document?t.documentElement:t,r=c=>c&&c.tagName==="LI",o=c=>{let l=0,u=c?.parentElement;if(!u)return 0;for(let g of u.children){if(g===c)break;g.tagName==="LI"&&l++}return l},s=c=>{let l=new Map;for(let[u,g]of c)l.set(u,g.slice());return l},a=(c,l,u)=>{let g=s(c),L;try{L=u.style?.counterReset||getComputedStyle(u).counterReset}catch{}if(L&&L!=="none")for(let A of L.split(",")){let h=A.trim().split(/\s+/),S=h[0],C=Number.isFinite(Number(h[1]))?Number(h[1]):0;if(!S)continue;let E=l.get(S);if(E&&E.length){let N=E.slice();N.push(C),g.set(S,N)}else g.set(S,[C])}let x;try{x=u.style?.counterIncrement||getComputedStyle(u).counterIncrement}catch{}if(x&&x!=="none")for(let A of x.split(",")){let h=A.trim().split(/\s+/),S=h[0],C=Number.isFinite(Number(h[1]))?Number(h[1]):1;if(!S)continue;let E=g.get(S)||[];E.length===0&&E.push(0),E[E.length-1]+=C,g.set(S,E)}try{if(getComputedStyle(u).display==="list-item"&&r(u)){let h=u.parentElement,S=1;if(h&&h.tagName==="OL"){let E=h.getAttribute("start"),N=Number.isFinite(Number(E))?Number(E):1,W=o(u),_=u.getAttribute("value");S=Number.isFinite(Number(_))?Number(_):N+W}else S=1+o(u);let C=g.get("list-item")||[];C.length===0&&C.push(0),C[C.length-1]=S,g.set("list-item",C)}}catch{}return g},i=(c,l,u)=>{let g=a(u,l,c);e.set(c,g);let L=g;for(let x of c.children)L=i(x,g,L);return g},f=new Map;return i(n,f,f),{get(c,l){let u=e.get(c)?.get(l);return u&&u.length?u[u.length-1]:0},getStack(c,l){let u=e.get(c)?.get(l);return u?u.slice():[]}}}function re(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,o=t.replace(r,(s,a,i)=>{let f=String(i).split(",").map(c=>c.trim());if(a==="counter"){let c=f[0]?.replace(/^["']|["']$/g,""),l=(f[1]||"decimal").toLowerCase(),u=n.get(e,c);return te(u,l)}else{let c=f[0]?.replace(/^["']|["']$/g,""),l=f[1]?.replace(/^["']|["']$/g,"")??"",u=(f[2]||"decimal").toLowerCase(),g=n.getStack(e,c);return g.length?g.map(x=>te(x,u)).join(l):""}});return an(o)}catch{return"- "}}var oe=null;async function Bt(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;for(let a of["::before","::after","::first-letter"])try{let i=tt(t,a);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(a==="::first-letter"){let v=getComputedStyle(t);if(!(i.color!==v.color||i.fontSize!==v.fontSize||i.fontWeight!==v.fontWeight))continue;let O=Array.from(e.childNodes).find(qt=>qt.nodeType===Node.TEXT_NODE&&qt.textContent?.trim().length>0);if(!O)continue;let H=O.textContent,at=H.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],B=H.slice(at?.length||0);if(!at||/[\uD800-\uDFFF]/.test(at))continue;let q=document.createElement("span");q.textContent=at,q.dataset.snapdomPseudo="::first-letter";let At=mt(i),Et=ot(At,"span");n.styleMap.set(q,Et);let Y=document.createTextNode(B);e.replaceChild(Y,O),e.insertBefore(q,Y);continue}let c=i.content,l=Tt(c);ee(c)&&(oe=ne(t.ownerDocument||document),l=re(l,t,oe));let u=i.backgroundImage,g=i.backgroundColor,L=i.fontFamily,x=parseInt(i.fontSize)||32,A=parseInt(i.fontWeight)||!1,h=i.color||"#000",S=i.display,C=parseFloat(i.width),E=parseFloat(i.height),N=i.borderStyle,W=parseFloat(i.borderWidth),_=i.transform,z=j(L),d=c!=="none"&&l!=="",y=u&&u!=="none",w=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)",k=S!=="inline"&&(C>0||E>0),p=N&&N!=="none"&&W>0,b=_&&_!=="none";if(!(d||y||w||k||p||b))continue;let M=document.createElement("span");M.dataset.snapdomPseudo=a,M.style.verticalAlign="middle";let $=mt(i),R=ot($,"span");if(n.styleMap.set(M,R),z&&l.length===1){let{dataUrl:v,width:I,height:O}=await Jt(l,L,A,x,h),H=document.createElement("img");H.src=v,H.style=`height:${x}px;width:${I/O*x}px;object-fit:contain;`,M.appendChild(H),e.dataset.snapdomHasIcon="true"}else if(l.startsWith("url(")){let v=J(l);if(v?.trim())try{let I=document.createElement("img"),O=await D(G(v),{as:"dataURL",useProxy:r.useProxy});I.src=O.data,I.style=`width:${x}px;height:auto;object-fit:contain;`,M.appendChild(I)}catch(I){console.error(`[snapdom] Error in pseudo ${a} for`,t,I)}}else!z&&d&&(M.textContent=l);if(y)try{let v=et(u),I=await Promise.all(v.map(Z));M.style.backgroundImage=I.join(", ")}catch(v){console.warn(`[snapdom] Failed to inline background-image for ${a}`,v)}if(w&&(M.style.backgroundColor=g),!(M.childNodes.length>0||M.textContent?.trim()!==""||y||w||k||p||b))continue;a==="::before"?e.insertBefore(M,e.firstChild):e.appendChild(M)}catch(i){console.warn(`[snapdom] Failed to capture ${a} for`,t,i)}let o=Array.from(t.children),s=Array.from(e.children).filter(a=>!a.dataset.snapdomPseudo);for(let a=0;a<Math.min(o.length,s.length);a++)await Bt(o[a],s[a],n,r)}function ae(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(i=>{let f=i.getAttribute("xlink:href")||i.getAttribute("href");f&&f.startsWith("#")&&e.add(f.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),r=n.filter(i=>i.tagName.toLowerCase()==="symbol"),o=n.filter(i=>i.tagName.toLowerCase()==="defs"),s=t.querySelector("svg.inline-defs-container");s||(s=document.createElementNS("http://www.w3.org/2000/svg","svg"),s.setAttribute("aria-hidden","true"),s.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),s.classList.add("inline-defs-container"),t.insertBefore(s,t.firstChild));let a=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(i=>{a.add(i.id)}),e.forEach(i=>{if(a.has(i))return;let f=r.find(c=>c.id===i);if(f){s.appendChild(f.cloneNode(!0)),a.add(i);return}for(let c of o){let l=c.querySelector(`#${CSS.escape(i)}`);if(l){let u=s.querySelector("defs");u||(u=document.createElementNS("http://www.w3.org/2000/svg","defs"),s.appendChild(u)),u.appendChild(l.cloneNode(!0)),a.add(i);break}}})}async function ie(t,e={}){let n={styleMap:m.session.styleMap,styleCache:m.session.styleCache,nodeMap:m.session.nodeMap},r,o="",s="";sn(t);try{ae(t)}catch(i){console.warn("inlineExternal defs or symbol failed:",i)}try{r=await it(t,n,e,t)}catch(i){throw console.warn("deepClone failed:",i),i}try{await Bt(t,r,n,e)}catch(i){console.warn("inlinePseudoElements failed:",i)}await un(r);try{let i=r.querySelectorAll("style[data-sd]");for(let f of i)s+=f.textContent||"",f.remove()}catch{}let a=Nt(n.styleMap);o=Array.from(a.entries()).map(([i,f])=>`.${f}{${i}}`).join(""),o=s+o;for(let[i,f]of n.styleMap.entries()){if(i.tagName==="STYLE")continue;if(i.getRootNode&&i.getRootNode()instanceof ShadowRoot){i.setAttribute("style",f.replace(/;/g,"; "));continue}let c=a.get(f);c&&i.classList.add(c);let l=i.style?.backgroundImage,u=i.dataset?.snapdomHasIcon;l&&l!=="none"&&(i.style.backgroundImage=l),u&&(i.style.verticalAlign="middle",i.style.display="inline")}for(let[i,f]of n.nodeMap.entries()){let c=f.scrollLeft,l=f.scrollTop;if((c||l)&&i instanceof HTMLElement){i.style.overflow="hidden",i.style.scrollbarWidth="none",i.style.msOverflowStyle="none";let g=document.createElement("div");for(g.style.transform=`translate(${-c}px, ${-l}px)`,g.style.willChange="transform",g.style.display="inline-block",g.style.width="100%";i.firstChild;)g.appendChild(i.firstChild);i.appendChild(g)}}if(t===n.nodeMap.get(r)){let i=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,i);let f=Mt(i.transform);r.style.margin="0",r.style.position="static",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.zIndex="auto",r.style.float="none",r.style.clear="none",r.style.transform=f||""}for(let[i,f]of n.nodeMap.entries())f.tagName==="PRE"&&(i.style.marginTop="0",i.style.marginBlockStart="0");return{clone:r,classCSS:o,styleCache:n.styleCache}}function sn(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,o=e.borderStyle,s=e.borderWidth,a=n!=="none"&&parseFloat(r)>0,i=o==="none"||parseFloat(s)===0;a&&i&&(t.style.border=`${r} solid transparent`)}var ct=new Map;async function lt(t){if(m.resource?.has(t))return m.resource.get(t);if(ct.has(t))return ct.get(t);let e=(async()=>{let n=await D(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return m.resource?.set(t,n.data),n.data})();ct.set(t,e);try{let n=await e;return ct.set(t,n),n}catch(n){throw ct.delete(t),n}}var cn=/\bblob:[^)"'\s]+/g;async function se(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(cn)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let o=await lt(r);n=n.split(r).join(o)}catch{}return n}function St(t){return typeof t=="string"&&t.startsWith("blob:")}function ln(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 fn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function un(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of e)try{let f=a.getAttribute("src")||a.currentSrc||"";if(St(f)){let l=await lt(f);a.setAttribute("src",l)}let c=a.getAttribute("srcset");if(c&&c.includes("blob:")){let l=ln(c),u=!1;for(let g of l)if(St(g.url))try{g.url=await lt(g.url),u=!0}catch{}u&&a.setAttribute("srcset",fn(l))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of n)try{let i="http://www.w3.org/1999/xlink",f=a.getAttribute("href")||a.getAttributeNS?.(i,"href");if(St(f)){let c=await lt(f);a.setAttribute("href",c),a.removeAttributeNS?.(i,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of r)try{let i=a.getAttribute("style");if(i&&i.includes("blob:")){let f=await se(i);a.setAttribute("style",f)}}catch{}let o=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of o)try{let i=a.textContent||"";i.includes("blob:")&&(a.textContent=await se(i))}catch{}let s=["poster"];for(let a of s){let i=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let f of i)try{let c=f.getAttribute(a);St(c)&&f.setAttribute(a,await lt(c))}catch{}}}async function ce(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async o=>{if(!o.getAttribute("src")){let l=o.currentSrc||o.src||"";l&&o.setAttribute("src",l)}o.removeAttribute("srcset"),o.removeAttribute("sizes");let s=o.src||"";if(!s)return;let a=await D(s,{as:"dataURL",useProxy:e.useProxy});if(a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")){o.src=a.data,o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}let{fallbackURL:i}=e||{};if(i)try{let l=parseInt(o.dataset?.snapdomWidth||"",10)||0,u=parseInt(o.dataset?.snapdomHeight||"",10)||0,g=parseInt(o.getAttribute("width")||"",10)||0,L=parseInt(o.getAttribute("height")||"",10)||0,x=parseFloat(o.style?.width||"")||0,A=parseFloat(o.style?.height||"")||0,h=l||x||g||o.width||void 0,S=u||A||L||o.height||void 0,C=typeof i=="function"?await i({width:h,height:S,src:s,element:o}):i;if(C){let E=await D(C,{as:"dataURL",useProxy:e.useProxy});o.src=E.data,!o.width&&h&&(o.width=h),!o.height&&S&&(o.height=S),o.width||(o.width=o.naturalWidth||100),o.height||(o.height=o.naturalHeight||100);return}}catch{}let f=o.width||o.naturalWidth||100,c=o.height||o.naturalHeight||100;if(e.placeholders!==!1){let l=document.createElement("div");l.style.cssText=[`width:${f}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),l.textContent="img",o.replaceWith(l)}else{let l=document.createElement("div");l.style.cssText=`display:inline-block;width:${f}px;height:${c}px;visibility:hidden;`,o.replaceWith(l)}};for(let o=0;o<n.length;o+=4){let s=n.slice(o,o+4).map(r);await Promise.allSettled(s)}}async function xt(t,e,n,r={}){let o=[[t,e]],s=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],i=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;o.length;){let[f,c]=o.shift(),l=n.get(f)||tt(f);n.has(f)||n.set(f,l);let u=(()=>{let x=l.getPropertyValue("border-image"),A=l.getPropertyValue("border-image-source");return x&&x!=="none"||A&&A!=="none"})();for(let x of s){let A=l.getPropertyValue(x);if(!A||A==="none")continue;let h=et(A),S=await Promise.all(h.map(C=>Z(C,r)));S.some(C=>C&&C!=="none"&&!/^url\(undefined/.test(C))&&c.style.setProperty(x,S.join(", "))}for(let x of a){let A=l.getPropertyValue(x);!A||A==="initial"||c.style.setProperty(x,A)}if(u)for(let x of i){let A=l.getPropertyValue(x);!A||A==="initial"||c.style.setProperty(x,A)}let g=Array.from(f.children),L=Array.from(c.children);for(let x=0;x<Math.min(g.length,L.length);x++)o.push([g[x],L[x]])}}function le(t){if(!t)return()=>{};let e=dn(t);if(e<=0)return()=>{};if(!pn(t))return()=>{};let n=getComputedStyle(t),r=Math.round(mn(n)*e+hn(n)),o=t.textContent??"",s=o;if(t.scrollHeight<=r+.5)return()=>{};let a=0,i=o.length,f=-1;for(;a<=i;){let c=a+i>>1;t.textContent=o.slice(0,c)+"\u2026",t.scrollHeight<=r+.5?(f=c,a=c+1):i=c-1}return t.textContent=(f>=0?o.slice(0,f):"")+"\u2026",()=>{t.textContent=s}}function dn(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 mn(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 hn(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function pn(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}async function Dt(t,e){if(!t)throw new Error("Element cannot be null or undefined");ft(e.cache);let n=e.fast,r,o,s,a="",i="",f,c,l=le(t);try{({clone:r,classCSS:o,styleCache:s}=await ie(t,e))}finally{l()}await new Promise(x=>{V(async()=>{await ce(r,e),x()},{fast:n})}),await new Promise(x=>{V(async()=>{await xt(t,r,s,e),x()},{fast:n})}),e.embedFonts&&await new Promise(x=>{V(async()=>{let A=yt(t),h=wt(t);if(X){let S=new Set(Array.from(A).map(C=>String(C).split("__")[0]).filter(Boolean));await bt(S,2)}a=await gt({required:A,usedCodepoints:h,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),x()},{fast:n})});let u=Lt(r).sort(),g=u.join(",");m.baseStyle.has(g)?i=m.baseStyle.get(g):await new Promise(x=>{V(()=>{i=Rt(u),m.baseStyle.set(g,i),x()},{fast:n})}),await new Promise(x=>{V(()=>{let A=t.getBoundingClientRect(),h=Number(A.width)||0,S=Number(A.height)||0,C=Number.isFinite(e.width),E=Number.isFinite(e.height),N=e.scale??1,W=typeof N=="number"&&N!==1;if(!W){let B=S>0?h/S:1;C&&E?(h=Number(e.width),S=Number(e.height)):C?(h=Number(e.width),S=h/(B||1)):E&&(S=Number(e.height),h=S*(B||1))}h=Math.max(1,Math.ceil(Number.isFinite(h)?h:1)),S=Math.max(1,Math.ceil(Number.isFinite(S)?S:1));let _=getComputedStyle(t),z=_.transform&&_.transform!=="none"?_.transform:"",d=wn(t),y,w,k,p,b=0,F=0;if(bn(t)){let B=Cn({baseTransform:z,rotate:d.rotate||"0deg",scale:d.scale,translate:d.translate}),q=B.e??B.m41??0,At=B.f??B.m42??0;b=-q,F=-At;let Et=B.is2D?fe(B):fe(new DOMMatrix(B.toString())),Y=yn(h,S,Et);y=Math.max(1,Math.ceil(Y.width)),w=Math.max(1,Math.ceil(Y.height)),k=-Y.minX,p=-Y.minY}else{let B=t.getBoundingClientRect(),q=Sn(B,{top:0,right:0,bottom:0,left:0});y=Math.max(1,q.width),w=Math.max(1,q.height),k=-(q.x-Math.floor(B.left)),p=-(q.y-Math.floor(B.top))}let M="http://www.w3.org/2000/svg",$=document.createElementNS(M,"foreignObject");$.setAttribute("width","100%"),$.setAttribute("height","100%"),$.setAttribute("x",String(k)),$.setAttribute("y",String(p)),$.style.overflow="visible";let R=document.createElement("style");R.textContent=i+a+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o,$.appendChild(R);let T=document.createElement("div");T.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),T.style.width=`${h}px`,T.style.height=`${S}px`,T.style.overflow="visible",T.style.transformOrigin="0 0";let P=[];if((b||F)&&P.push(`translate(${b}px, ${F}px)`),!W&&(C||E)){let B=A.width?h/A.width:1,q=A.height?S/A.height:1;P.push(`scale(${B}, ${q})`)}else W&&P.push(`scale(${N})`);P.length&&(T.style.transform=P.join(" ")),r.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),r.style.transformOrigin="0 0",r.style.position="static",r.style.left="0",r.style.top="0",z&&(r.style.transform=z),r.style.rotate=d.rotate||"0deg",r.style.scale=d.scale||"1",r.style.translate=d.translate||"0 0",T.appendChild(r),$.appendChild(T);let I=new XMLSerializer().serializeToString($);c=`<svg xmlns="${M}" width="${!W&&(C||E)?h:y}" height="${!W&&(E||C)?S:w}" viewBox="0 0 ${y} ${w}">`+I+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,x()},{fast:n})});let L=document.getElementById("snapdom-sandbox");return L&&L.style.position==="absolute"&&L.remove(),f}function gn(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function fe(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function yn(t,e,n){let o=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(c=>({x:n.a*c.x+n.c*c.y,y:n.b*c.x+n.d*c.y})),s=Math.min(...o.map(c=>c.x)),a=Math.max(...o.map(c=>c.x)),i=Math.min(...o.map(c=>c.y)),f=Math.max(...o.map(c=>c.y));return{minX:s,minY:i,width:a-s,height:f-i}}function wn(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let o=f=>{try{return typeof n.has=="function"&&!n.has(f)||typeof n.get!="function"?null:n.get(f)}catch{return null}},s=o("rotate");if(s){let f=s.angle??s;f&&typeof f=="object"&&"unit"in f?e.rotate=f.unit==="rad"?f.value*180/Math.PI+"deg":f.value+f.unit:e.rotate=String(s)}let a=o("scale");if(a&&a.length){let f=a[0]?.value??1,c=a[1]?.value??f;e.scale=`${f} ${c}`}let i=o("translate");if(i&&i.length){let f=i[0]?.value??0,c=i[1]?.value??0,l=i[0]?.unit??"px",u=i[1]?.unit??"px";e.translate=`${f}${l} ${c}${u}`}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 bn(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function Sn(t,e){let n=Math.floor(t.left-e.left),r=Math.floor(t.top-e.top),o=Math.ceil(t.width+e.left+e.right),s=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:r,width:o,height:s}}var Ot=null;function xn(){if(Ot)return Ot;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),Ot=t,t}function Cn(t){let e=xn(),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=gn(n);return e.removeChild(n),r}function kn(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function ue(t={}){let e=t.format??"png",n=kn(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"}}async function de(t,e){let n=new Image;return n.src=t,await n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n}async function K(t,e){let{scale:n,dpr:r}=e,o=new Image;o.crossOrigin="anonymous",o.loading="eager",o.decoding="sync",o.src=t,await o.decode();let s=o.naturalWidth*n,a=o.naturalHeight*n,i=document.createElement("canvas");i.width=Math.ceil(s*r),i.height=Math.ceil(a*r),i.style.width=`${s}px`,i.style.height=`${a}px`;let f=i.getContext("2d");return r!==1&&f.scale(r,r),f.drawImage(o,0,0,s,a),i}async function Ct(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let r=await K(t,e),o=e.backgroundColor?Q(r,e.backgroundColor):r;return new Promise(s=>o.toBlob(a=>s(a),`image/${n}`,e.quality))}async function me(t,e){let n=await K(t,e),r=e.backgroundColor?Q(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 he(t,e){if(e.dpr=1,e.format==="svg"){let s=await Ct(t,{...e,type:"svg"}),a=URL.createObjectURL(s),i=document.createElement("a");i.href=a,i.download=e.filename,i.click(),URL.revokeObjectURL(a);return}let n=await K(t,e),r=e.backgroundColor?Q(n,e.backgroundColor):n,o=document.createElement("a");o.href=r.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}var pe=Symbol("snapdom.internal"),Ht=!1;async function U(t,e){if(!t)throw new Error("Element cannot be null or undefined");if(X())for(let r=0;r<3;r++)try{await An(t,e),console.log("Iteraci\xF3n n\xFAmero:",r),Ht=!1}catch{}let n=ue(e);return n.iconFonts&&n.iconFonts.length>0&&Yt(n.iconFonts),n.snap||(n.snap={toPng:(r,o)=>U.toPng(r,o),toImg:(r,o)=>U.toImg(r,o)}),U.capture(t,n,pe)}U.capture=async(t,e,n)=>{if(n!==pe)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Dt(t,e),o=a=>({...e,...a||{}}),s=a=>i=>{let f=o({...i||{},format:a}),c=a==="jpeg"||a==="jpg",l=f.backgroundColor==null||f.backgroundColor==="transparent";return c&&l&&(f.backgroundColor="#ffffff"),me(r,f)};return{url:r,toRaw:()=>r,toImg:a=>de(r,o(a)),toCanvas:a=>K(r,o(a)),toBlob:a=>Ct(r,o(a)),toPng:s("png"),toJpg:s("jpeg"),toWebp:s("webp"),download:a=>he(r,o(a))}};U.toRaw=(t,e)=>U(t,e).then(n=>n.toRaw());U.toImg=(t,e)=>U(t,e).then(n=>n.toImg());U.toCanvas=(t,e)=>U(t,e).then(n=>n.toCanvas());U.toBlob=(t,e)=>U(t,e).then(n=>n.toBlob());U.toPng=(t,e)=>U(t,{...e,format:"png"}).then(n=>n.toPng());U.toJpg=(t,e)=>U(t,{...e,format:"jpeg"}).then(n=>n.toJpg());U.toWebp=(t,e)=>U(t,{...e,format:"webp"}).then(n=>n.toWebp());U.download=(t,e)=>U(t,e).then(n=>n.download());async function An(t,e){if(Ht)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Dt(t,n)}catch{return}await new Promise(o=>{let s=new Image;s.decoding="sync",s.loading="eager",s.style.position="fixed",s.style.left=0,s.style.top=0,s.style.width="10px",s.style.height="10px",s.style.opacity="0.01",s.style.transform="translateZ(10px)",s.style.willChange="transform,opacity;",s.src=r;let a=async()=>{await new Promise(i=>setTimeout(i,100)),s&&s.parentNode&&s.parentNode.removeChild(s),Ht=!0,o()};document.body.appendChild(s),a()})}async function En(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,o=e.cache??e.cacheOpt??"full";ft(o);try{await document.fonts?.ready}catch{}try{Ft()}catch{}m.session=m.session||{},m.session.styleCache||(m.session.styleCache=new WeakMap),m.image=m.image||new Map;try{await xt(t,void 0,m.session.styleCache,{useProxy:r})}catch{}let s=[],a=[];try{t?.querySelectorAll&&(s=Array.from(t.querySelectorAll("img[src]")),a=Array.from(t.querySelectorAll("*")))}catch{}let i=[];for(let f of s){let c=f?.currentSrc||f?.src;if(c&&!m.image.has(c)){let l=Promise.resolve().then(async()=>{let u=await D(c,{as:"dataURL",useProxy:r});u?.ok&&typeof u.data=="string"&&m.image.set(c,u.data)}).catch(()=>{});i.push(l)}}for(let f of a){let c="";try{c=tt(f).backgroundImage}catch{}if(c&&c!=="none"){let l=et(c);for(let u of l)if(u.startsWith("url(")){let g=Promise.resolve().then(()=>Z(u,{...e,useProxy:r})).catch(()=>{});i.push(g)}}}if(n)try{let f=yt(t),c=wt(t);if(typeof X=="function"?X():!!X){let u=new Set(Array.from(f).map(g=>String(g).split("__")[0]).filter(Boolean));await bt(u,2)}await gt({required:f,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(i)}export{En as preCache,U as snapdom};
|
package/dist/snapdom.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
3
|
* snapdom
|
|
4
|
-
* v.1.9.12-dev.
|
|
4
|
+
* v.1.9.12-dev.2
|
|
5
5
|
* Author Juan Martin Muda
|
|
6
6
|
* License MIT
|
|
7
7
|
**/
|
|
@@ -709,6 +709,7 @@ function getSnapshot(el, preStyle = null, options = {}) {
|
|
|
709
709
|
if (rec && rec.epoch === __epoch) return rec.snapshot;
|
|
710
710
|
const style = preStyle || getComputedStyle(el);
|
|
711
711
|
const snap = snapshotComputedStyleFull(style, options);
|
|
712
|
+
stripHeightForWrappers(el, style, snap);
|
|
712
713
|
snapshotCache.set(el, { epoch: __epoch, snapshot: snap });
|
|
713
714
|
return snap;
|
|
714
715
|
}
|
|
@@ -772,6 +773,49 @@ async function inlineAllStyles(source, clone, sessionOrCtx, opts) {
|
|
|
772
773
|
}
|
|
773
774
|
session.styleMap.set(clone, key);
|
|
774
775
|
}
|
|
776
|
+
function isReplaced(el) {
|
|
777
|
+
return el instanceof HTMLImageElement || el instanceof HTMLCanvasElement || el instanceof HTMLVideoElement || el instanceof HTMLIFrameElement || el instanceof SVGElement || el instanceof HTMLObjectElement || el instanceof HTMLEmbedElement;
|
|
778
|
+
}
|
|
779
|
+
function hasBox(cs) {
|
|
780
|
+
if (cs.backgroundImage && cs.backgroundImage !== "none") return true;
|
|
781
|
+
if (cs.backgroundColor && cs.backgroundColor !== "rgba(0, 0, 0, 0)" && cs.backgroundColor !== "transparent") return true;
|
|
782
|
+
if ((parseFloat(cs.borderTopWidth) || 0) > 0) return true;
|
|
783
|
+
if ((parseFloat(cs.borderBottomWidth) || 0) > 0) return true;
|
|
784
|
+
if ((parseFloat(cs.paddingTop) || 0) > 0) return true;
|
|
785
|
+
if ((parseFloat(cs.paddingBottom) || 0) > 0) return true;
|
|
786
|
+
const ob = cs.overflowBlock || cs.overflowY || "visible";
|
|
787
|
+
return ob !== "visible";
|
|
788
|
+
}
|
|
789
|
+
function isFlexOrGridItem(el) {
|
|
790
|
+
const p = el.parentElement;
|
|
791
|
+
if (!p) return false;
|
|
792
|
+
const pd = getComputedStyle(p).display || "";
|
|
793
|
+
return pd.includes("flex") || pd.includes("grid");
|
|
794
|
+
}
|
|
795
|
+
function hasFlowFast(el, cs) {
|
|
796
|
+
if (el.textContent && /\S/.test(el.textContent)) return true;
|
|
797
|
+
const f = el.firstElementChild, l = el.lastElementChild;
|
|
798
|
+
if (f && f.tagName === "BR" || l && l.tagName === "BR") return true;
|
|
799
|
+
const sh = el.scrollHeight;
|
|
800
|
+
if (sh === 0) return false;
|
|
801
|
+
const pt = parseFloat(cs.paddingTop) || 0;
|
|
802
|
+
const pb = parseFloat(cs.paddingBottom) || 0;
|
|
803
|
+
return sh > pt + pb;
|
|
804
|
+
}
|
|
805
|
+
function stripHeightForWrappers(el, cs, snap) {
|
|
806
|
+
if (el instanceof HTMLElement && el.style && el.style.height) return;
|
|
807
|
+
const disp = cs.display || "";
|
|
808
|
+
if (disp.includes("flex") || disp.includes("grid")) return;
|
|
809
|
+
if (isReplaced(el)) return;
|
|
810
|
+
const pos = cs.position;
|
|
811
|
+
if (pos === "absolute" || pos === "fixed" || pos === "sticky") return;
|
|
812
|
+
if (cs.transform !== "none") return;
|
|
813
|
+
if (hasBox(cs)) return;
|
|
814
|
+
if (isFlexOrGridItem(el)) return;
|
|
815
|
+
if (!hasFlowFast(el, cs)) return;
|
|
816
|
+
delete snap.height;
|
|
817
|
+
delete snap["block-size"];
|
|
818
|
+
}
|
|
775
819
|
|
|
776
820
|
// src/core/clone.js
|
|
777
821
|
function idleCallback(childList, callback, fast) {
|
|
@@ -2149,10 +2193,10 @@ async function inlinePseudoElements(source, clone, sessionCache, options) {
|
|
|
2149
2193
|
const hasExplicitContent = content !== "none" && cleanContent !== "";
|
|
2150
2194
|
const hasBg = bg && bg !== "none";
|
|
2151
2195
|
const hasBgColor = bgColor && bgColor !== "transparent" && bgColor !== "rgba(0, 0, 0, 0)";
|
|
2152
|
-
const
|
|
2196
|
+
const hasBox2 = display !== "inline" && (width > 0 || height > 0);
|
|
2153
2197
|
const hasBorder = borderStyle && borderStyle !== "none" && borderWidth > 0;
|
|
2154
2198
|
const hasTransform = transform && transform !== "none";
|
|
2155
|
-
const shouldRender = hasExplicitContent || hasBg || hasBgColor ||
|
|
2199
|
+
const shouldRender = hasExplicitContent || hasBg || hasBgColor || hasBox2 || hasBorder || hasTransform;
|
|
2156
2200
|
if (!shouldRender) continue;
|
|
2157
2201
|
const pseudoEl = document.createElement("span");
|
|
2158
2202
|
pseudoEl.dataset.snapdomPseudo = pseudo;
|
|
@@ -2194,7 +2238,7 @@ async function inlinePseudoElements(source, clone, sessionCache, options) {
|
|
|
2194
2238
|
}
|
|
2195
2239
|
if (hasBgColor) pseudoEl.style.backgroundColor = bgColor;
|
|
2196
2240
|
const hasContent2 = pseudoEl.childNodes.length > 0 || pseudoEl.textContent?.trim() !== "";
|
|
2197
|
-
const hasVisibleBox = hasContent2 || hasBg || hasBgColor ||
|
|
2241
|
+
const hasVisibleBox = hasContent2 || hasBg || hasBgColor || hasBox2 || hasBorder || hasTransform;
|
|
2198
2242
|
if (!hasVisibleBox) continue;
|
|
2199
2243
|
if (pseudo === "::before") {
|
|
2200
2244
|
clone.insertBefore(pseudoEl, clone.firstChild);
|
package/package.json
CHANGED