@zumer/snapdom 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -5
- package/dist/plugins.mjs +1 -1
- package/dist/preCache.mjs +3 -3
- package/dist/snapdom.js +9 -9
- package/dist/snapdom.mjs +9 -9
- package/package.json +1 -1
- package/types/snapdom.d.ts +13 -0
package/dist/snapdom.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* SnapDOM
|
|
3
|
-
* v2.
|
|
3
|
+
* v2.9.0
|
|
4
4
|
* Author: Juan Martin Muda
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
|
-
var
|
|
8
|
-
`;return n}function he(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let s of e)n.set(s,`c${o++}`);return n}function Oo(t){try{let e=t?.ownerDocument;if(!e)return typeof window<"u"?window:null;let n=e.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let o=0;o<window.frames.length;o++)try{if(window.frames[o]?.document===e)return window.frames[o]}catch{}}catch{}return typeof window<"u"?window:null}function H(t,e=null){let n=()=>{let r={length:0,getPropertyValue:()=>"",item:()=>""};return r[Symbol.iterator]=function*(){},r};if(!(t instanceof Element)){let r=typeof window<"u"?window:null;if(r&&typeof r.getComputedStyle=="function")try{return r.getComputedStyle(t,e)||n()}catch{return n()}return n()}let o=x.computedStyle.get(t);o||(o=new Map,x.computedStyle.set(t,o));let s=o.get(e);if(!s){let r=Oo(t),i=null;try{i=r&&typeof r.getComputedStyle=="function"?r.getComputedStyle(t,e):null}catch{}if(!i&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(i=window.getComputedStyle(t,e))}catch{}s=i||n(),o.set(e,s)}return s}function Yt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function wt(t){let e=[],n=0,o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}var zt,Xt,Io,Po,_o,Wo,ge=q(()=>{X();zt=new Set(["meta","script","noscript","title","link","template"]),Xt=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"]),Io=["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"];Po=/(?:^|-)(animation|transition)(?:-|$)/i,_o=/^(--.+|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,Wo=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom"])});function ot(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function ye(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let t=navigator.userAgent||"",e=/iPhone|iPad|iPod/.test(t),n=navigator.maxTouchPoints>2&&/Macintosh/.test(t);return e||n}function V(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),o=/applewebkit/i.test(t),s=/mobile/i.test(t),r=!/safari/i.test(t),i=o&&s&&r,u=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),a=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),l=/ipad|iphone|ipod/.test(e)&&o;return n||i||u||a||l}function Ve(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var St=q(()=>{});function R(t,e,n){let o=t&&typeof t=="object"&&(t.options||t);o&&o.debug&&(n!==void 0?console.warn("[snapdom]",e,n):console.warn("[snapdom]",e))}var be=q(()=>{});var G=q(()=>{He();ge();St();Ft();be()});var uo={};Mt(uo,{toCanvas:()=>gt});function ti(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function ei(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function ni(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function oi(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&o++,r===")"&&(o=Math.max(0,o-1)),r===";"&&o===0?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(s=>s.trim()).filter(Boolean)}function ri(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&o++,i===")"&&(o=Math.max(0,o-1)),i===","&&o===0?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());let s=[];for(let r of e){if(/\binset\b/i.test(r))continue;let i=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[u="0px",a="0px",l="0px"]=i,c=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!c&&c!==",";s.push(`drop-shadow(${u} ${a} ${l}${f?` ${c}`:""})`)}return s.join(" ")}function lo(t){let e=oi(t),n=null,o=null,s=null,r=[];for(let u of e){let a=u.indexOf(":");if(a<0)continue;let l=u.slice(0,a).trim().toLowerCase(),c=u.slice(a+1).trim();l==="box-shadow"?s=c:l==="filter"?n=c:l==="-webkit-filter"?o=c:r.push([l,c])}if(s){let u=ri(s);u&&(n=n?`${n} ${u}`:u,o=o?`${o} ${u}`:u)}let i=[...r];return n&&i.push(["filter",n]),o&&i.push(["-webkit-filter",o]),i.map(([u,a])=>`${u}:${a}`).join(";")}function ii(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${lo(o)}}`)}function si(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,ii(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${lo(o)}${n}`),t}function ai(t){if(!V()||!ti(t))return t;try{let e=ei(t),n=si(e);return ni(n)}catch{return t}}async function gt(t,e){let{width:n,height:o,scale:s=1,dpr:r=1,meta:i={},backgroundColor:u}=e;t=ai(t);let a=new Image;a.loading="eager",a.decoding="sync",a.crossOrigin="anonymous",a.src=t,await a.decode();let l=a.naturalWidth,c=a.naturalHeight,f=Number.isFinite(i.w0)?i.w0:l,d=Number.isFinite(i.h0)?i.h0:c,h,y,m=Number.isFinite(n),p=Number.isFinite(o);if(m&&p)h=Math.max(1,n),y=Math.max(1,o);else if(m){let S=n/Math.max(1,f);h=n,y=d*S}else if(p){let S=o/Math.max(1,d);y=o,h=f*S}else h=l,y=c;h=h*s,y=y*s;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let w=g.getContext("2d");return r!==1&&w.scale(r,r),u&&(w.save(),w.fillStyle=u,w.fillRect(0,0,h,y),w.restore()),w.drawImage(a,0,0,h,y),g}var _t=q(()=>{St()});var re={};Mt(re,{rasterize:()=>Le});async function Le(t,e){let n=await gt(t,e),o=new Image;return o.src=n.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${n.width/e.dpr}px`,o.style.height=`${n.height/e.dpr}px`,o}var Wt=q(()=>{_t()});var Ne={};Mt(Ne,{toImg:()=>ci,toSvg:()=>ci});async function ci(t,e){let{scale:n=1,width:o,height:s,meta:r={}}=e,i=Number.isFinite(o),u=Number.isFinite(s),a=Number.isFinite(n)&&n!==1||i||u;if(V()&&a)return await Le(t,{...e,format:"png",quality:1,meta:r});let l=new Image;if(l.decoding="sync",l.loading="eager",l.src=t,await l.decode(),i&&u)l.style.width=`${o}px`,l.style.height=`${s}px`;else if(i){let c=Number.isFinite(r.w0)?r.w0:l.naturalWidth,f=Number.isFinite(r.h0)?r.h0:l.naturalHeight,d=o/Math.max(1,c);l.style.width=`${o}px`,l.style.height=`${Math.round(f*d)}px`}else if(u){let c=Number.isFinite(r.w0)?r.w0:l.naturalWidth,f=Number.isFinite(r.h0)?r.h0:l.naturalHeight,d=s/Math.max(1,f);l.style.height=`${s}px`,l.style.width=`${Math.round(c*d)}px`}else{let c=Math.round(l.naturalWidth*n),f=Math.round(l.naturalHeight*n);if(l.style.width=`${c}px`,l.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${c}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,l.src=t}catch(d){R(e,"SVG width/height patch in toImg failed",d)}}return l}var Te=q(()=>{G();Wt()});var fo={};Mt(fo,{toBlob:()=>Ie});async function Ie(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 gt(t,e);return new Promise(s=>o.toBlob(r=>s(r),`image/${n}`,e.quality))}var Pe=q(()=>{_t()});var po={};Mt(po,{download:()=>li});async function mo(t,e){let n=new File([t],e,{type:t.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:e})}catch(o){if(o.name!=="AbortError")return!1}return!0}async function li(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),o=(e?.type||"").toLowerCase(),s=n.has(o)?o:"",r=(e?.format||s||"").toLowerCase(),i=r==="jpg"?"jpeg":r||"png",u=e?.filename||`snapdom.${i}`,a={...e||{},format:i,type:i};a.dpr=1;let l=ye();if(i==="svg"){let d=await Ie(t,{...a,type:"svg"});if(l&&await mo(d,u))return;let h=URL.createObjectURL(d),y=document.createElement("a");y.href=h,y.download=u,document.body.appendChild(y),y.click(),URL.revokeObjectURL(h),y.remove();return}let c=await gt(t,a);if(l){let d=`image/${i}`,h=await new Promise(y=>c.toBlob(y,d,e?.quality));if(h&&await mo(h,u))return}let f=document.createElement("a");f.href=c.toDataURL(`image/${i}`,e?.quality),f.download=u,document.body.appendChild(f),f.click(),f.remove()}var ho=q(()=>{Pe();_t();St()});G();G();X();var je=new WeakMap,Lt=new Map,Uo=2e3,we=0;function Rt(){we++,Lt.size>Uo&&Lt.clear()}var qe=!1;function Bo(t=document.documentElement){if(!qe){qe=!0;try{new MutationObserver(()=>Rt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Rt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Rt),e.ready?.then(()=>Rt()).catch(()=>{}))}catch{}}}function Do(t,e={}){let n={},o=t.getPropertyValue("visibility"),s=e.excludeStyleProps;for(let f=0;f<t.length;f++){let d=t[f];if($t(d)||s&&(s instanceof RegExp&&s.test(d)||typeof s=="function"&&s(d)))continue;let h=t.getPropertyValue(d);(d==="background-image"||d==="content")&&h.includes("url(")&&!h.includes("data:")&&(h="none"),n[d]=h}let r=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let f of r)if(!n[f])try{let d=t.getPropertyValue(f);d&&(n[f]=d)}catch{}let i=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let f of i)if(!n[f])try{let d=t.getPropertyValue(f);d&&(n[f]=d)}catch{}if(e.embedFonts){let f=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let d of f)if(!n[d])try{let h=t.getPropertyValue(d);h&&(n[d]=h)}catch{}}o==="hidden"&&(n.opacity="0");try{(n["content-visibility"]||t.getPropertyValue("content-visibility"))==="hidden"&&(n.visibility="hidden")}catch{}let u=parseFloat(t.getPropertyValue("border-top-width")||0)||0,a=parseFloat(t.getPropertyValue("border-right-width")||0)||0,l=parseFloat(t.getPropertyValue("border-bottom-width")||0)||0,c=parseFloat(t.getPropertyValue("border-left-width")||0)||0;if(u===0&&a===0&&l===0&&c===0){let f=(t.getPropertyValue("border-image-source")||"").trim(),d=f&&f!=="none",h=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let y of h)delete n[y];d||(n.border="none")}return n}var ze=new WeakMap;function Ho(t){let e=ze.get(t);return e||(e=Object.entries(t).sort((o,s)=>o[0]<s[0]?-1:o[0]>s[0]?1:0).map(([o,s])=>`${o}:${s}`).join(";"),ze.set(t,e),e)}function Vo(t,e=null,n={}){let o=je.get(t);if(o&&o.epoch===we)return o.snapshot;let s=e||getComputedStyle(t),r=Do(s,n);return Ko(t,s,r),je.set(t,{epoch:we,snapshot:r}),r}function jo(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Lt,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:e||{}}:{session:x.session,persist:{snapshotKeyCache:Lt,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:t||e||{}}}function qo(t,e,n){if(!(!t.style||t.style.length===0))for(let o=0;o<t.style.length;o++){let s=t.style[o],r=n.getPropertyValue(s);r&&e.style.setProperty(s,r)}}async function rt(t,e,n,o){if(t.tagName==="STYLE")return;let s=jo(n,o),r=s.options&&s.options.cache||"auto";r!=="disabled"&&Bo(document.documentElement),r==="disabled"&&!s.session.__bumpedForDisabled&&(Rt(),Lt.clear(),s.session.__bumpedForDisabled=!0);let{session:i,persist:u}=s;if(!i.styleCache.has(t)){let d=null;try{d=getComputedStyle(t)}catch{}i.styleCache.set(t,d||getComputedStyle(document.documentElement))}let a=i.styleCache.get(t);t.getAttribute?.("style")&&qo(t,e,a);let l=Vo(t,a,s.options),c=Ho(l),f=u.snapshotKeyCache.get(c);if(!f){let d=t.tagName?.toLowerCase()||"div";f=bt(l,d),u.snapshotKeyCache.set(c,f)}i.styleMap.set(e,f)}function zo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Xo(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 Yo(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Go(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let s=t.scrollHeight;if(s===0)return!1;let r=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return s>r+i}function Ko(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||!["div","section","article","main","aside","header","footer","nav"].includes(o))return;let r=parseFloat(e.height);if(Number.isFinite(r)&&t.scrollHeight>0&&Math.abs(r-t.scrollHeight)>2||e.aspectRatio&&e.aspectRatio!=="none"&&e.aspectRatio!=="auto")return;let u=e.display||"";if(u.includes("flex")||u.includes("grid")||zo(t))return;let a=e.position;if(a==="absolute"||a==="fixed"||a==="sticky"||e.transform!=="none"||Xo(e)||Yo(t))return;let l=e.overflowX||e.overflow||"visible",c=e.overflowY||e.overflow||"visible";if(l!=="visible"||c!=="visible")return;let f=e.clip;f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Go(t,e)&&(delete n.height,delete n["block-size"])}ge();var Ye=["fill","stroke","color","background-color","stop-color"],Xe=new Map;function Qo(t,e){let n=e+"::"+t.toLowerCase(),o=Xe.get(n);if(o)return o;let s=document,r=e==="http://www.w3.org/2000/svg"?s.createElementNS(e,t):s.createElement(t),i=s.createElement("div");i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(r),s.documentElement.appendChild(i);let u=getComputedStyle(r),a={};for(let l of Ye)a[l]=u.getPropertyValue(l)||"";return i.remove(),Xe.set(n,a),a}function Ge(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let u=r[i];if(u&&typeof u.value=="string"&&u.value.includes("var(")){o=!0;break}}}let s=null;if(o)try{s=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length){let i=new Set;for(let u=0;u<r.length;u++){let a=r[u];if(i.has(a))continue;i.add(a);let l=r.getPropertyValue(a);if(!l||!l.includes("var("))continue;let c=s&&s.getPropertyValue(a);if(c)try{e.style.setProperty(a,c.trim(),r.getPropertyPriority(a))}catch{}}}}if(o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let u=r[i];if(!u||typeof u.value!="string"||!u.value.includes("var("))continue;let a=u.name,l=s&&s.getPropertyValue(a);if(l)try{e.style.setProperty(a,l.trim())}catch{}}}if(!o){if(!s)try{s=getComputedStyle(t)}catch{s=null}if(!s)return;let r=t.namespaceURI||"html",i=Qo(t.tagName,r);for(let u of Ye){let a=s.getPropertyValue(u)||"",l=i[u]||"";if(a&&a!==l)try{e.style.setProperty(u,a.trim())}catch{}}}}G();G();X();pt();function Kt(t,e,n){return Promise.all(t.map(o=>new Promise(s=>{function r(){ot(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,s):r()},{fast:n})}r()})))}function Jo(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Zo(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let s=n?Jo(o):o;return`:where(${e} ${s})`}).join(", ")}function Qe(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,s,r)=>{let i=Zo(r,e,!0);return`${o}${s}${i}{`}),t):""}function Je(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Ze(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
|
|
9
|
-
`});let n=t.adoptedStyleSheets||[];for(let
|
|
10
|
-
`}catch{}}catch{}return e}function
|
|
11
|
-
`:""}function rn(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 er(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),s=0;for(;s<e&&(!o||!o.body&&!o.documentElement);)await new Promise(r=>setTimeout(r,0)),o=n(),s++;return o&&(o.body||o.documentElement)?o:null}function nr(t){let e=t.getBoundingClientRect(),n=0,o=0,s=0,r=0;try{let a=getComputedStyle(t);n=parseFloat(a.borderLeftWidth)||0,o=parseFloat(a.borderRightWidth)||0,s=parseFloat(a.borderTopWidth)||0,r=parseFloat(a.borderBottomWidth)||0}catch{}let i=Math.max(0,Math.round(e.width-(n+o))),u=Math.max(0,Math.round(e.height-(s+r)));return{contentWidth:i,contentHeight:u,rect:e}}function K(t){let e=0,n=0;if(t.offsetWidth>0&&(e=t.offsetWidth),t.offsetHeight>0&&(n=t.offsetHeight),e===0||n===0)try{let o=getComputedStyle(t);if(e===0){let s=parseFloat(o.width);!isNaN(s)&&s>0&&(e=s)}if(n===0){let s=parseFloat(o.height);!isNaN(s)&&s>0&&(n=s)}}catch{}if(e===0||n===0)try{if(e===0){let o=parseFloat(t.getAttribute("width"));!isNaN(o)&&o>0&&(e=o)}if(n===0){let o=parseFloat(t.getAttribute("height"));!isNaN(o)&&o>0&&(n=o)}}catch{}if((e===0||n===0)&&(t.naturalWidth||t.naturalHeight))try{e===0&&t.naturalWidth>0&&(e=t.naturalWidth),n===0&&t.naturalHeight>0&&(n=t.naturalHeight)}catch{}return{width:e,height:n}}function or(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 sn(t,e,n){let o=await er(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:s,contentHeight:r,rect:i}=nr(t),u=n?.snap;if(!u&&typeof window<"u"&&window.snapdom&&(u=window.snapdom),!u||typeof u.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let a={...n,scale:1},l=or(o,s,r),c;try{c=await u.toPng(o.documentElement,a)}finally{l()}c.style.display="block",c.style.width=`${s}px`,c.style.height=`${r}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),rt(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(i.width)}px`),f.style.height||(f.style.height=`${Math.round(i.height)}px`),f.appendChild(c),f}function an(t){let{width:e,height:n}=K(t),o=t.getBoundingClientRect(),s;try{s=window.getComputedStyle(t)}catch{}let r=s?parseFloat(s.width):NaN,i=s?parseFloat(s.height):NaN,u=Math.round(e||o.width||0),a=Math.round(n||o.height||0),l=Number.isFinite(r)&&r>0?Math.round(r):Math.max(12,u||16),c=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,a||16),f=(t.type||"text").toLowerCase()==="checkbox",d=!!t.checked,h=!!t.indeterminate,m=Math.max(Math.min(l,c),12),p="middle";try{s&&s.verticalAlign&&(p=s.verticalAlign)}catch{}let g=document.createElement("div");g.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),g.style.cssText=`display:inline-block;width:${m}px;height:${m}px;vertical-align:${p};flex-shrink:0;line-height:0;`;let w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",String(m)),w.setAttribute("height",String(m)),w.setAttribute("viewBox",`0 0 ${m} ${m}`),g.appendChild(w);function S(){let b="#0a6ed1";try{s&&(b=s.accentColor||s.color||b)}catch{}let C=2,A=C/2,k=m-C;if(w.innerHTML="",f){let v=document.createElementNS("http://www.w3.org/2000/svg","rect");if(v.setAttribute("x",String(A)),v.setAttribute("y",String(A)),v.setAttribute("width",String(k)),v.setAttribute("height",String(k)),v.setAttribute("rx","2"),v.setAttribute("ry","2"),v.setAttribute("fill",d?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(C)),w.appendChild(v),d){let M=document.createElementNS("http://www.w3.org/2000/svg","path");M.setAttribute("d",`M ${A+2} ${m/2} L ${m/2-1} ${m-A-2} L ${m-A-2} ${A+2}`),M.setAttribute("stroke","white"),M.setAttribute("stroke-width",String(Math.max(1.5,C))),M.setAttribute("fill","none"),M.setAttribute("stroke-linecap","round"),M.setAttribute("stroke-linejoin","round"),w.appendChild(M)}else if(h){let M=document.createElementNS("http://www.w3.org/2000/svg","rect"),N=Math.max(6,k-4);M.setAttribute("x",String((m-N)/2)),M.setAttribute("y",String((m-C)/2)),M.setAttribute("width",String(N)),M.setAttribute("height",String(C)),M.setAttribute("fill",b),M.setAttribute("rx","1"),w.appendChild(M)}}else{let v=document.createElementNS("http://www.w3.org/2000/svg","circle");if(v.setAttribute("cx",String(m/2)),v.setAttribute("cy",String(m/2)),v.setAttribute("r",String((m-C)/2)),v.setAttribute("fill",d?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(C)),w.appendChild(v),d){let M=document.createElementNS("http://www.w3.org/2000/svg","circle"),N=Math.max(2,(m-C*2)*.35);M.setAttribute("cx",String(m/2)),M.setAttribute("cy",String(m/2)),M.setAttribute("r",String(N)),M.setAttribute("fill","white"),w.appendChild(M)}}g.style.setProperty("width",`${m}px`,"important"),g.style.setProperty("height",`${m}px`,"important"),g.style.setProperty("min-width",`${m}px`,"important"),g.style.setProperty("min-height",`${m}px`,"important")}return S(),{el:g,applyVisual:S}}var Nt=new U(80);async function Tt(t){if(x.resource?.has(t))return x.resource.get(t);if(Nt.has(t))return Nt.get(t);let e=(async()=>{let n=await O(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return x.resource?.set(t,n.data),n.data})();Nt.set(t,e);try{let n=await e;return Nt.set(t,n),n}catch(n){throw Nt.delete(t),n}}var rr=/\bblob:[^)"'\s]+/g;async function Ke(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(rr)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let s=await Tt(o);n=n.split(o).join(s)}catch{}return n}function Gt(t){return typeof t=="string"&&t.startsWith("blob:")}function ir(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 sr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function cn(t,e=null){if(!t)return;let n=e,o=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of o)try{let c=a.getAttribute("src")||a.currentSrc||"";if(Gt(c)){let d=await Tt(c);a.setAttribute("src",d)}let f=a.getAttribute("srcset");if(f&&f.includes("blob:")){let d=ir(f),h=!1;for(let y of d)if(Gt(y.url))try{y.url=await Tt(y.url),h=!0}catch(m){R(n,"blobUrlToDataUrl for srcset item failed",m)}h&&a.setAttribute("srcset",sr(d))}}catch(l){R(n,"resolveBlobUrls for img failed",l)}let s=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of s)try{let l="http://www.w3.org/1999/xlink",c=a.getAttribute("href")||a.getAttributeNS?.(l,"href");if(Gt(c)){let f=await Tt(c);a.setAttribute("href",f),a.removeAttributeNS?.(l,"href")}}catch(l){R(n,"resolveBlobUrls for SVG image href failed",l)}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of r)try{let l=a.getAttribute("style");if(l&&l.includes("blob:")){let c=await Ke(l);a.setAttribute("style",c)}}catch(l){R(n,"replaceBlobUrls in inline style failed",l)}let i=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of i)try{let l=a.textContent||"";l.includes("blob:")&&(a.textContent=await Ke(l))}catch(l){R(n,"replaceBlobUrls in style tag failed",l)}let u=["poster"];for(let a of u){let l=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let c of l)try{let f=c.getAttribute(a);Gt(f)&&c.setAttribute(a,await Tt(f))}catch(f){R(n,`resolveBlobUrls for ${a} failed`,f)}}}St();async function It(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,s=null,r=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||zt.has(c))return null;if(c==="foreignobject"&&t.parentElement?.closest?.("foreignObject"))return R(e,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),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"),{width:f,height:d}=K(t),h=f||t.getBoundingClientRect().width||0,y=d||t.getBoundingClientRect().height||0;return c.style.cssText=`display:inline-block;width:${h}px;height:${y}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 f=document.createElement("div"),{width:d,height:h}=K(t),y=d||t.getBoundingClientRect().width||0,m=h||t.getBoundingClientRect().height||0;return f.style.cssText=`display:inline-block;width:${y}px;height:${m}px;visibility:hidden;`,f}else if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${c}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let c=document.createElement("div"),{width:f,height:d}=K(t),h=f||t.getBoundingClientRect().width||0,y=d||t.getBoundingClientRect().height||0;return c.style.cssText=`display:inline-block;width:${h}px;height:${y}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(f){R(e,"iframe same-origin probe failed",f)}if(c)try{return await sn(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(c||console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.",t),n.placeholders){let{width:f,height:d}=K(t),h=document.createElement("div");return h.style.cssText=`width:${f}px;height:${d}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;`,rt(t,h,e,n),h}else{let{width:f,height:d}=K(t),h=document.createElement("div");return h.style.cssText=`display:inline-block;width:${f}px;height:${d}px;visibility:hidden;`,rt(t,h,e,n),h}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),rt(t,c,e,n);let f=document.createElement("div");return f.textContent=t.getAttribute("data-placeholder-text")||"",f.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(f),c}if(t.tagName==="CANVAS"){let c="";try{let y=t.getContext("2d",{willReadFrequently:!0});try{y&&y.getImageData(0,0,1,1)}catch{}if(await new Promise(m=>requestAnimationFrame(m)),c=t.toDataURL("image/png"),!c||c==="data:,"){try{y&&y.getImageData(0,0,1,1)}catch{}if(await new Promise(m=>requestAnimationFrame(m)),c=t.toDataURL("image/png"),!c||c==="data:,"){let m=document.createElement("canvas");m.width=t.width,m.height=t.height;let p=m.getContext("2d");p&&(p.drawImage(t,0,0),c=m.toDataURL("image/png"))}}}catch(y){R(e,"Canvas toDataURL failed, using empty/fallback",y)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch(y){R(e,"img decoding/loading hints failed",y)}c&&(f.src=c),f.width=t.width,f.height=t.height;let{width:d,height:h}=K(t);return d>0&&(f.style.width=`${d}px`),h>0&&(f.style.height=`${h}px`),e.nodeMap.set(f,t),rt(t,f,e,n),f}if(t.tagName==="VIDEO"){let c="";try{let y=document.createElement("canvas");y.width=t.videoWidth||t.offsetWidth||320,y.height=t.videoHeight||t.offsetHeight||240;let m=y.getContext("2d");m&&(m.drawImage(t,0,0,y.width,y.height),c=y.toDataURL("image/png"),(!c||c==="data:,")&&(c=""))}catch(y){R(e,"Video frame capture failed, using poster fallback",y)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch{}c?f.src=c:t.poster&&(f.src=t.poster),f.width=t.videoWidth||t.offsetWidth||0,f.height=t.videoHeight||t.offsetHeight||0;let{width:d,height:h}=K(t);return d>0&&(f.style.width=`${d}px`),h>0&&(f.style.height=`${h}px`),f.style.objectFit="contain",e.nodeMap.set(f,t),rt(t,f,e,n),f}let i;try{if(i=t.cloneNode(!1),i.attributes?.length)try{for(let c of i.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(c.value)&&i.setAttribute(c.name,c.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Ge(t,i),e.nodeMap.set(i,t),t.tagName==="IMG"){en(t,i);try{let{width:c,height:f}=K(t),d=Math.round(c||0),h=Math.round(f||0);d&&(i.dataset.snapdomWidth=String(d)),h&&(i.dataset.snapdomHeight=String(h))}catch(c){R(e,"getUnscaledDimensions for IMG failed",c)}try{let c=t.getAttribute("style")||"",f=window.getComputedStyle(t),d=S=>{let b=c.match(new RegExp(`${S}\\s*:\\s*([^;]+)`,"i")),C=b?b[1].trim():f.getPropertyValue(S);return/%|auto/i.test(String(C||""))},h=parseInt(i.dataset.snapdomWidth||"0",10),y=parseInt(i.dataset.snapdomHeight||"0",10),m=d("width")||!h,p=d("height")||!y;m&&h&&(i.style.width=`${h}px`),p&&y&&(i.style.height=`${y}px`);let g=f.getPropertyValue("object-fit"),w=f.getPropertyValue("object-position");g&&g!=="fill"?(i.style.objectFit=g,w&&(i.style.objectPosition=w)):(h&&(i.style.minWidth=`${h}px`),y&&(i.style.minHeight=`${y}px`))}catch(c){R(e,"IMG dimension freeze failed",c)}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}let u=null;if(t instanceof HTMLTextAreaElement){let{width:c,height:f}=K(t),d=c||t.getBoundingClientRect().width||0,h=f||t.getBoundingClientRect().height||0;d&&(i.style.width=`${d}px`),h&&(i.style.height=`${h}px`)}if(t instanceof HTMLInputElement){let c=(t.type||"text").toLowerCase();if((c==="checkbox"||c==="radio")&&Ve()){let{el:d,applyVisual:h}=an(t);e.nodeMap.set(d,t),u=h,i=d}else i.value=t.value,i.setAttribute("value",t.value),t.checked!==void 0&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.indeterminate=t.indeterminate))}if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&!t.value&&t.placeholder)try{let c=window.getComputedStyle(t,"::placeholder"),f=c&&c.color;if(f&&f!=="rgba(0, 0, 0, 0)"){let d="snapdom-ph-"+(Math.random()*1e6|0);i.classList.add(d);let h=document.createElement("style");h.textContent=`.${d}::placeholder{color:${f}!important;opacity:${c.opacity||"1"}!important;}`,i.prepend(h)}}catch{}if(t instanceof HTMLSelectElement&&(s=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){t.disabled&&i.setAttribute("disabled",""),t.required&&i.setAttribute("required",""),t.readOnly&&i.setAttribute("readonly","");let c=t;c.min!==void 0&&c.min!==""&&i.setAttribute("min",c.min),c.max!==void 0&&c.max!==""&&i.setAttribute("max",c.max),c.pattern!==void 0&&c.pattern!==""&&i.setAttribute("pattern",c.pattern);let f=t.getAttribute("aria-invalid");f!==null&&i.setAttribute("aria-invalid",f)}if(rt(t,i,e,n),u&&u(),t instanceof SVGElement){let c=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let f=window.getComputedStyle(t);for(let d of c){let h=f.getPropertyValue(d);h&&i.style.setProperty(d,h)}}catch{}}if(t.shadowRoot){let g=function(S,b){if(S.nodeType===Node.ELEMENT_NODE&&S.tagName==="STYLE")return b(null);It(S,e,n).then(C=>{b(C||null)}).catch(()=>{b(null)})};try{let S=t.shadowRoot.querySelectorAll("slot");for(let b of S){let C=[];try{C=b.assignedNodes?.({flatten:!0})||b.assignedNodes?.()||[]}catch{C=b.assignedNodes?.()||[]}for(let A of C)o.add(A)}}catch{}let c=Je(e),f=`[data-sd="${c}"]`;try{i.setAttribute("data-sd",c)}catch{}let d=Ze(t.shadowRoot),h=Qe(d,f),y=nn(d),m=on(t,y,f);tn(i,m+h,c);let p=document.createDocumentFragment(),w=await Kt(Array.from(t.shadowRoot.childNodes),g,n.fast);p.append(...w.filter(S=>!!S)),i.appendChild(p)}if(t.tagName==="SLOT"){let h=function(m,p){It(m,e,n).then(g=>{g&&rn(g),p(g||null)}).catch(()=>{p(null)})},c=t.assignedNodes?.({flatten:!0})||[],f=c.length>0?c:Array.from(t.childNodes),d=document.createDocumentFragment(),y=await Kt(Array.from(f),h,n.fast);return d.append(...y.filter(m=>!!m)),d}function a(c,f){if(o.has(c))return f(null);It(c,e,n).then(d=>{f(d||null)}).catch(()=>{f(null)})}let l=await Kt(Array.from(t.childNodes),a,n.fast);if(i.append(...l.filter(c=>!!c)),s!==null&&i instanceof HTMLSelectElement){i.value=s;for(let c of i.options)c.value===s?c.setAttribute("selected",""):c.removeAttribute("selected")}return r!==null&&i instanceof HTMLTextAreaElement&&(i.textContent=r),i}G();Ft();X();var ar=[/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],xt=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),Se=[];function un(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Se.push(n):typeof n=="string"?Se.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function Q(t){let e=typeof t=="string"?t:"",n=[...ar,...Se];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))}function cr(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var ln=new Map;function lr(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,s;for(;s=o.exec(n);)e[s[1].toUpperCase()]=Number(s[2]);return e}async function ur(t,e,n){let o=String(t||""),s=o.toLowerCase(),r=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(s)&&!/\bsymbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};let u=n&&(n.FILL??n.fill),a="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?a="rounded":/\bsharp\b/.test(r)?a="sharp":/\boutlined\b/.test(r)&&(a="outlined");let l=u===1,c=null;if(l&&(a==="outlined"&&xt.materialIconsFilled?c={url:xt.materialIconsFilled,alias:"snapdom-mi-filled"}:a==="rounded"&&xt.materialIconsRound?c={url:xt.materialIconsRound,alias:"snapdom-mi-round"}:a==="sharp"&&xt.materialIconsSharp&&(c={url:xt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:o,familyForCanvas:o};if(!ln.has(c.alias))try{let d=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),ln.set(c.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let f=`"${c.alias}"`;return{familyForMeasure:f,familyForCanvas:f}}async function fr(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function dr(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let o=t.color?.trim();return o&&o!=="inherit"?o:"#000"}async function mr(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:s="#000",variation:r="",className:i=""}={}){let u=String(e||"").replace(/^['"]+|['"]+$/g,""),a=window.devicePixelRatio||1,l=lr(r),{familyForMeasure:c,familyForCanvas:f}=await ur(u,i,l);await fr(f.replace(/^["']+|["']+$/g,""),o);let d=document.createElement("span");d.textContent=t,d.style.position="absolute",d.style.visibility="hidden",d.style.left="-99999px",d.style.whiteSpace="nowrap",d.style.fontFamily=c,d.style.fontWeight=String(n||"normal"),d.style.fontSize=`${o}px`,d.style.lineHeight="1",d.style.margin="0",d.style.padding="0",d.style.fontFeatureSettings="'liga' 1",d.style.fontVariantLigatures="normal",d.style.color=s,document.body.appendChild(d);let h=d.getBoundingClientRect(),y=Math.max(1,Math.ceil(h.width)),m=Math.max(1,Math.ceil(h.height));document.body.removeChild(d);let p=document.createElement("canvas");p.width=y*a,p.height=m*a;let g=p.getContext("2d");g.scale(a,a),g.font=`${n?`${n} `:""}${o}px ${f}`,g.textAlign="left",g.textBaseline="top",g.fillStyle=s;try{g.fontKerning="normal"}catch{}return g.fillText(t,0,0),{dataUrl:p.toDataURL(),width:y,height:m}}async function fn(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim());if(o.length===0)return 0;let s=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim()):[],r=0;for(let i=0;i<o.length;i++){let u=o[i],a=s[i]||null;try{let l=getComputedStyle(a||u),c=l.fontFamily||"Material Icons";if(!cr(c))continue;let f=(a||u).textContent.trim();if(!f)continue;let d=parseInt(l.fontSize,10)||24,h=l.fontWeight&&l.fontWeight!=="normal"?l.fontWeight:"normal",y=dr(l),m=l.fontVariationSettings&&l.fontVariationSettings!=="normal"?l.fontVariationSettings:"",p=(a||u).className||"",{dataUrl:g,width:w,height:S}=await mr(f,{family:c,weight:h,fontSize:d,color:y,variation:m,className:p});u.textContent="";let b=u.ownerDocument.createElement("img");b.src=g,b.alt=f,b.style.height=`${d}px`,b.style.width=`${Math.max(1,Math.round(w/S*d))}px`,b.style.objectFit="contain",b.style.verticalAlign=getComputedStyle(u).verticalAlign||"baseline",u.appendChild(b),r++}catch{}}return r}pt();async function pn(t,e,n,o=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let i=document.createElement("span");i.textContent=t,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=n||"normal",i.style.fontSize=`${o}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);let u=i.getBoundingClientRect(),a=Math.ceil(u.width),l=Math.ceil(u.height);document.body.removeChild(i);let c=document.createElement("canvas");c.width=Math.max(1,a*r),c.height=Math.max(1,l*r);let f=c.getContext("2d");return f.scale(r,r),f.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=s,f.fillText(t,0,0),{dataUrl:c.toDataURL(),width:a,height:l}}var hn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),pr=["katex","mathjax","mathml"];function Ce(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!hn.has(n.toLowerCase()))return n}return""}function hr(t){if(!t)return[];let e=[];for(let n of t.split(",")){let o=n.trim().replace(/^['"]+|['"]+$/g,"");o&&(hn.has(o.toLowerCase())||e.push(o))}return e}function Qt(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 Jt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function gr(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function yr(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let s=Qt(n[1]),r=Qt(n[2]);return{min:Math.min(s,r),max:Math.max(s,r)}}let o=Qt(e);return{min:o,max:o}}function br(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function wr(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let r=parseFloat(n[1]),i=parseFloat(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),s=o?parseFloat(o[1]):100;return{min:s,max:s}}function Sr(t){return!t||typeof t!="string"?"":t.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function xr(t,e,n=[]){if(!t)return!1;try{let o=new URL(t,location.href);if(o.origin===location.origin)return!0;let r=o.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>r.endsWith(a))||n.some(a=>r===a.toLowerCase()||r.endsWith("."+a.toLowerCase())))return!0;let u=(o.pathname+o.search).toLowerCase();if(/\bfont(s)?\b/.test(u)||/\.woff2?(\b|$)/.test(u)||pr.some(a=>u.includes(a)))return!0;for(let a of e){let l=a.toLowerCase().replace(/\s+/g,"+"),c=a.toLowerCase().replace(/\s+/g,"-"),f=Sr(a);if(u.includes(l)||u.includes(c)||f&&u.includes(f))return!0}return!1}catch{return!1}}function Cr(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function dn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,s)=>{let r=(s||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return n;let i=r;try{i=new URL(r,e||location.href).href}catch{}return`url("${i}")`})}var xe=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Zt=4;async function kr(t,e,n){if(!t)return t;let o=new Set;function s(u,a){try{return new URL(u,a||location.href).href}catch{return u}}async function r(u,a,l=0){if(l>Zt)return console.warn(`[snapDOM] @import depth exceeded (${Zt}) at ${a}`),u;let c="",f=0,d;for(;d=xe.exec(u);){c+=u.slice(f,d.index),f=xe.lastIndex;let h=(d[2]||d[4]||"").trim(),y=s(h,a);if(o.has(y)){console.warn(`[snapDOM] Skipping circular @import: ${y}`);continue}o.add(y);let m="";try{let p=await O(y,{as:"text",useProxy:n,silent:!0});p.ok&&typeof p.data=="string"&&(m=p.data)}catch{}m?(m=dn(m,y),m=await r(m,y,l+1),c+=`
|
|
12
|
-
/* inlined: ${
|
|
13
|
-
${
|
|
14
|
-
`):c+=d[0]}return c+=u.slice(f),c}let i=dn(t,e||location.href);return i=await r(i,e||location.href,0),i}var gn=/url\((["']?)([^"')]+)\1\)/g,Ar=/@font-face[^{}]*\{[^}]*\}/g;function yn(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let s=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!s)continue;let r=s[1],i=s[2],u=a=>{if(!a.includes("?"))return parseInt(a,16);let l=parseInt(a.replace(/\?/g,"0"),16),c=parseInt(a.replace(/\?/g,"F"),16);return[l,c]};if(i){let a=u(r),l=u(i),c=Array.isArray(a)?a[0]:a,f=Array.isArray(l)?l[1]:l;e.push([Math.min(c,f),Math.max(c,f)])}else{let a=u(r);Array.isArray(a)?e.push([a[0],a[1]]):e.push([a,a])}}return e}function bn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,s]of e)if(n>=o&&n<=s)return!0;return!1}function ke(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(gn)){let s=(o[2]||"").trim();if(!(!s||s.startsWith("data:"))){if(!/^https?:/i.test(s))try{s=new URL(s,e||location.href).href}catch{}n.push(s)}}return n}async function wn(t,e,n=""){let o=t;for(let s of t.matchAll(gn)){let r=mt(s[0]);if(!r)continue;let i=r;if(!i.startsWith("http")&&!i.startsWith("data:"))try{i=new URL(i,e||location.href).href}catch{}if(!Q(i)){if(x.resource?.has(i)){x.font?.add(i),o=o.replace(s[0],`url(${x.resource.get(i)})`);continue}if(!x.font?.has(i))try{let u=await O(i,{as:"dataURL",useProxy:n,silent:!0});if(u.ok&&typeof u.data=="string"){let a=u.data;x.resource?.set(i,a),x.font?.add(i),o=o.replace(s[0],`url(${a})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",i)}}}return o}function vr(t){if(!t.length)return null;let e=(u,a)=>t.some(([l,c])=>!(c<u||l>a)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),s=e(880,1023),r=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":r?"cyrillic":s?"greek":o?"latin-ext":n?"latin":null}function mn(t={}){let e=new Set((t.families||[]).map(s=>String(s).toLowerCase())),n=new Set((t.domains||[]).map(s=>String(s).toLowerCase())),o=new Set((t.subsets||[]).map(s=>String(s).toLowerCase()));return(s,r)=>{if(e.size&&e.has(s.family.toLowerCase()))return!0;if(n.size)for(let i of s.srcUrls)try{if(n.has(new URL(i).host.toLowerCase()))return!0}catch{}if(o.size){let i=vr(r);if(i&&o.has(i))return!0}return!1}}function Er(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let r of t.match(e)||[]){let i=r.match(/font-family:\s*([^;]+);/i)?.[1]||"",u=Ce(i),a=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),l=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),c=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),d=(r.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),h=ke(d,location.href),y=h.length?h.map(p=>String(p).toLowerCase()).sort().join("|"):d.toLowerCase(),m=[String(u||"").toLowerCase(),a,l,c,f.toLowerCase(),y].join("|");n.has(m)||(n.add(m),o.push(r))}if(o.length===0)return t;let s=0;return t.replace(e,()=>o[s++]||"")}function Mr(t,e,n,o,s){let r=Array.from(t||[]).sort().join("|"),i=e?JSON.stringify({families:(e.families||[]).map(c=>String(c).toLowerCase()).sort(),domains:(e.domains||[]).map(c=>String(c).toLowerCase()).sort(),subsets:(e.subsets||[]).map(c=>String(c).toLowerCase()).sort()}):"",u=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|"),a=o||"",l=(s||[]).map(c=>String(c).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${r}::ex=${i}::lf=${u}::px=${a}::fd=${l}`}async function Sn(t,e,n,o){let s;try{s=t.cssRules||[]}catch{return}let r=(i,u)=>{try{return new URL(i,u||location.href).href}catch{return i}};for(let i of s){if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){let u=i.href?r(i.href,e):e;if(o.depth>=Zt){console.warn(`[snapDOM] CSSOM import depth exceeded (${Zt}) at ${u}`);continue}if(u&&o.visitedSheets.has(u)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${u}`);continue}u&&o.visitedSheets.add(u);let a={...o,depth:(o.depth||0)+1};await Sn(i.styleSheet,u,n,a);continue}if(i.type===CSSRule.FONT_FACE_RULE){let u=(i.style.getPropertyValue("font-family")||"").trim(),a=Ce(u);if(!a||Q(a))continue;let l=(i.style.getPropertyValue("font-weight")||"400").trim(),c=(i.style.getPropertyValue("font-style")||"normal").trim(),f=(i.style.getPropertyValue("font-stretch")||"100%").trim(),d=(i.style.getPropertyValue("src")||"").trim(),h=(i.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(a,c,l,f))continue;let y=yn(h);if(!bn(o.usedCodepoints,y))continue;let m={family:a,weightSpec:l,styleSpec:c,stretchSpec:f,unicodeRange:h,srcRaw:d,srcUrls:ke(d,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(m,y))continue;if(/url\(/i.test(d)){let p=await wn(d,e||location.href,o.useProxy);await n(`@font-face{font-family:${a};src:${p};font-style:${c};font-weight:${l};font-stretch:${f};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${a};src:${d};font-style:${c};font-weight:${l};font-stretch:${f};${h?`unicode-range:${h};`:""}}`)}}}async function te({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:s="",fontStylesheetDomains:r=[]}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let i=new Map;for(let p of t){let[g,w,S,b]=String(p).split("__");if(!g)continue;let C=i.get(g)||[];C.push({w:parseInt(w,10),s:S,st:parseInt(b,10)}),i.set(g,C)}function u(p,g,w,S){if(!i.has(p))return!1;let b=i.get(p),C=yr(w),A=br(g),k=wr(S),v=C.min!==C.max,M=C.min,N=L=>A.kind==="normal"&&L==="normal"||A.kind!=="normal"&&(L==="italic"||L==="oblique"),_=!1;for(let L of b){let I=v?L.w>=C.min&&L.w<=C.max:L.w===M,B=N(Jt(L.s)),F=L.st>=k.min&&L.st<=k.max;if(I&&B&&F){_=!0;break}}if(_)return!0;if(!v)for(let L of b){let I=N(Jt(L.s)),B=L.st>=k.min&&L.st<=k.max;if(Math.abs(M-L.w)<=300&&I&&B)return!0}if(!v&&A.kind==="normal"&&b.some(I=>Jt(I.s)!=="normal"))for(let I of b){let B=Math.abs(M-I.w)<=300,F=I.st>=k.min&&I.st<=k.max;if(B&&F)return!0}return!1}let a=mn(n),l=Mr(t,n,o,s,r);if(x.resource?.has(l))return x.resource.get(l);let c=Cr(t),f=[],d=xe;for(let p of document.querySelectorAll("style")){let g=p.textContent||"";for(let w of g.matchAll(d)){let S=(w[2]||w[4]||"").trim();if(!S||Q(S))continue;!!document.querySelector(`link[rel="stylesheet"][href="${S}"]`)||f.push(S)}}f.length&&await Promise.all(f.map(p=>new Promise(g=>{if(document.querySelector(`link[rel="stylesheet"][href="${p}"]`))return g(null);let w=document.createElement("link");w.rel="stylesheet",w.href=p,w.setAttribute("data-snapdom","injected-import"),w.onload=()=>g(w),w.onerror=()=>g(null),document.head.appendChild(w)})));let h="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(p=>!!p.href);for(let p of y)try{if(Q(p.href))continue;let g="",w=!1;try{w=new URL(p.href,location.href).origin===location.origin}catch{}if(!w){let b=Array.isArray(r)?r:[];if(!xr(p.href,c,b))continue}if(w){let b=Array.from(document.styleSheets).find(C=>C.href===p.href);if(b)try{let C=b.cssRules||[];g=Array.from(C).map(A=>A.cssText).join("")}catch{}}if(!g){let b=await O(p.href,{as:"text",useProxy:s});if(b?.ok&&typeof b.data=="string"&&(g=b.data),Q(p.href))continue}g=await kr(g,p.href,s);let S="";for(let b of g.match(Ar)||[]){let C=(b.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),A=Ce(C);if(!A||Q(A))continue;let k=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),M=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),N=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),_=(b.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=ke(_,p.href);if(!u(A,v,k,M))continue;let I=yn(N);if(!bn(e,I))continue;let B={family:A,weightSpec:k,styleSpec:v,stretchSpec:M,unicodeRange:N,srcRaw:_,srcUrls:L,href:p.href};if(n&&a(B,I))continue;let F=/url\(/i.test(_)?await wn(b,p.href,s):b;S+=F}S.trim()&&(h+=S)}catch{console.warn("[snapDOM] Failed to process stylesheet:",p.href)}let m={requiredIndex:i,usedCodepoints:e,faceMatchesRequired:u,simpleExcluder:n?mn(n):null,useProxy:s,visitedSheets:new Set,depth:0};for(let p of document.styleSheets)if(!(p.href&&y.some(g=>g.href===p.href)))try{let g=p.href||location.origin+"/";g&&m.visitedSheets.add(g),await Sn(p,g,async w=>{h+=w},m)}catch{}try{for(let p of document.fonts||[]){if(!p||!p.family||p.status!=="loaded"||!p._snapdomSrc)continue;let g=String(p.family).replace(/^['"]+|['"]+$/g,"");if(Q(g)||!i.has(g)||n?.families&&n.families.some(S=>String(S).toLowerCase()===g.toLowerCase()))continue;let w=p._snapdomSrc;if(!String(w).startsWith("data:")){if(x.resource?.has(p._snapdomSrc))w=x.resource.get(p._snapdomSrc),x.font?.add(p._snapdomSrc);else if(!x.font?.has(p._snapdomSrc))try{let S=await O(p._snapdomSrc,{as:"dataURL",useProxy:s,silent:!0});if(S.ok&&typeof S.data=="string")w=S.data,x.resource?.set(p._snapdomSrc,w),x.font?.add(p._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",p._snapdomSrc);continue}}h+=`@font-face{font-family:'${g}';src:url(${w});font-style:${p.style||"normal"};font-weight:${p.weight||"normal"};}`}}catch{}for(let p of o){if(!p||typeof p!="object")continue;let g=String(p.family||"").replace(/^['"]+|['"]+$/g,"");if(!g||Q(g)||!i.has(g)||n?.families&&n.families.some(k=>String(k).toLowerCase()===g.toLowerCase()))continue;let w=p.weight!=null?String(p.weight):"normal",S=p.style!=null?String(p.style):"normal",b=p.stretchPct!=null?`${p.stretchPct}%`:"100%",C=String(p.src||""),A=C;if(!A.startsWith("data:")){if(x.resource?.has(C))A=x.resource.get(C),x.font?.add(C);else if(!x.font?.has(C))try{let k=await O(C,{as:"dataURL",useProxy:s,silent:!0});if(k.ok&&typeof k.data=="string")A=k.data,x.resource?.set(C,A),x.font?.add(C);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",C);continue}}h+=`@font-face{font-family:'${g}';src:url(${A});font-style:${S};font-weight:${w};font-stretch:${b};}`}return h&&(h=Er(h),x.resource?.set(l,h)),h}function Ct(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=i=>{let u=hr(i.fontFamily);if(u.length)for(let a of u){let l=(c,f,d)=>`${a}__${Qt(c)}__${Jt(f)}__${gr(d)}`;e.add(l(i.fontWeight,i.fontStyle,i.fontStretch))}};o(getComputedStyle(t));let s=getComputedStyle(t,"::before");s&&s.content&&s.content!=="none"&&o(s);let r=getComputedStyle(t,"::after");for(r&&r.content&&r.content!=="none"&&o(r);n.nextNode();){let i=n.currentNode,u=getComputedStyle(i);o(u);let a=getComputedStyle(i,"::before");a&&a.content&&a.content!=="none"&&o(a);let l=getComputedStyle(i,"::after");l&&l.content&&l.content!=="none"&&o(l)}return e}function ee(t){let e=new Set,n=s=>{if(s)for(let r of s)e.add(r.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let s=o.currentNode;if(s.nodeType===Node.TEXT_NODE)n(s.nodeValue||"");else if(s.nodeType===Node.ELEMENT_NODE){let r=s;for(let i of["::before","::after"]){let a=getComputedStyle(r,i)?.getPropertyValue("content");if(!(!a||a==="none"))if(/^"/.test(a)||/^'/.test(a))n(a.slice(1,-1));else{let l=a.match(/\\[0-9A-Fa-f]{1,6}/g);if(l)for(let c of l)try{e.add(parseInt(c.slice(1),16))}catch{}}}}}return e}async function kt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let s=document.createElement("div");s.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let r of n){let i=document.createElement("span");i.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",i.style.fontFamily=`"${r}"`,i.style.fontWeight="700",i.style.fontStyle="italic",i.style.fontSize="32px",i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.margin="0",i.style.padding="0",s.appendChild(i)}document.body.appendChild(s),s.offsetWidth,document.body.removeChild(s)};for(let s=0;s<Math.max(1,e);s++)o(),await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)))}X();function An(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Fr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function xn(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 Cn(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)),s="";for(let[r,i]of n)for(;o>=r;)s+=i,o-=r;return e?s:s.toLowerCase()}function kn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(t);case"decimal-leading-zero":{let n=Math.abs(t);return(t<0?"-":"")+(n<10?"0":"")+String(n)}case"lower-alpha":return xn(t,!1);case"upper-alpha":return xn(t,!0);case"lower-roman":return Cn(t,!1);case"upper-roman":return Cn(t,!0);default:return String(t)}}function vn(t){let e=()=>x?.session?.__counterEpoch??0,n=e(),o=new WeakMap,s=t instanceof Document?t.documentElement:t,r=d=>d&&d.tagName==="LI",i=d=>{let h=0,y=d?.parentElement;if(!y)return 0;for(let m of y.children){if(m===d)break;m.tagName==="LI"&&h++}return h},u=d=>{let h=new Map;for(let[y,m]of d)h.set(y,m.slice());return h},a=(d,h,y)=>{let m=u(d),p;try{p=y.style?.counterReset||getComputedStyle(y).counterReset}catch{}if(p&&p!=="none")for(let S of p.split(",")){let b=S.trim().split(/\s+/),C=b[0],A=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!C)continue;let k=h.get(C);if(k&&k.length){let v=k.slice();v.push(A),m.set(C,v)}else m.set(C,[A])}let g;try{g=y.style?.counterSet||getComputedStyle(y).counterSet}catch{}if(g&&g!=="none")for(let S of g.split(",")){let b=S.trim().split(/\s+/),C=b[0],A=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!C)continue;let k=m.get(C)||[];k.length===0&&k.push(0),k[k.length-1]=A,m.set(C,k)}let w;try{w=y.style?.counterIncrement||getComputedStyle(y).counterIncrement}catch{}if(w&&w!=="none")for(let S of w.split(",")){let b=S.trim().split(/\s+/),C=b[0],A=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!C)continue;let k=m.get(C)||[];k.length===0&&k.push(0),k[k.length-1]+=A,m.set(C,k)}try{if(getComputedStyle(y).display==="list-item"&&r(y)){let b=y.parentElement,C=1;if(b&&b.tagName==="OL"){let k=b.getAttribute("start"),v=Number.isFinite(Number(k))?Number(k):1,M=i(y),N=y.getAttribute("value");C=Number.isFinite(Number(N))?Number(N):v+M}else C=1+i(y);let A=m.get("list-item")||[];A.length===0&&A.push(0),A[A.length-1]=C,m.set("list-item",A)}}catch{}return m},l=(d,h,y)=>{let m=a(y,h,d);o.set(d,m);let p=m;for(let w of d.children)p=l(w,m,p);let g=new Map;for(let[w,S]of y){let b=S.length,C=p.get(w);g.set(w,C&&C.length?C.slice(0,b):S.slice())}for(let[w,S]of p)!g.has(w)&&S.length&&!h.has(w)&&g.set(w,S.slice(0,1));return g},c=new Map;l(s,c,c);function f(){let d=e();if(d!==n){n=d;let h=new Map;l(s,h,h)}}return{get(d,h){f();let y=o.get(d)?.get(h);return y&&y.length?y[y.length-1]:0},getStack(d,h){f();let y=o.get(d)?.get(h);return y?y.slice():[]}}}function En(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,s=t.replace(o,(r,i,u)=>{let a=String(u).split(",").map(l=>l.trim());if(i==="counter"){let l=a[0]?.replace(/^["']|["']$/g,""),c=(a[1]||"decimal").toLowerCase(),f=n.get(e,l);return kn(f,c)}else{let l=a[0]?.replace(/^["']|["']$/g,""),c=a[1]?.replace(/^["']|["']$/g,"")??"",f=(a[2]||"decimal").toLowerCase(),d=n.getStack(e,l);return d.length?d.map(y=>kn(y,f)).join(c):""}});return Fr(s)}catch{return"- "}}pt();X();var At=new WeakMap,Mn=1e3;function $r(t,e){let n=Ln(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=$n(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):$n(t)}function Ae(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Ln(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,o=0;for(let r=0;r<e.length;r++){let i=e[r];if(i.tagName==="STYLE"){let u=i.textContent?i.textContent.length:0;n+=`S${u}|`;let a=i.sheet,l=a?Ae(a):null;l&&(o+=l.length)}else{let u=i.getAttribute("href")||"",a=i.getAttribute("media")||"all";n+=`L${u}|m:${a}|`;let l=i.sheet,c=l?Ae(l):null;c&&(o+=c.length)}}let s=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(s)?s.length:0}|tr:${o}`,n}function Fn(t,e,n){let o=Ae(t);if(!o)return!1;for(let s=0;s<o.length;s++){if(n.budget<=0)return!1;let r=o[s],i=r&&r.cssText?r.cssText:"";n.budget--;for(let u of e)if(i.includes(u))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let u=0;u<r.cssRules.length&&n.budget>0;u++){let a=r.cssRules[u],l=a&&a.cssText?a.cssText:"";n.budget--;for(let c of e)if(l.includes(c))return!0}if(n.budget<=0)return!1}return!1}function $n(t=document){let e=Ln(t),n=At.get(t);if(n&&n.fingerprint===e)return n.result;let o=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],s=t.querySelectorAll("style");for(let i=0;i<s.length;i++){let u=s[i].textContent||"";for(let a of o)if(u.includes(a))return At.set(t,{fingerprint:e,result:!0}),!0}let r=t.adoptedStyleSheets;if(Array.isArray(r)&&r.length){let i={budget:Mn};try{for(let u of r)if(Fn(u,o,i))return At.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let i=t.querySelectorAll('style,link[rel~="stylesheet"]'),u={budget:Mn};for(let a=0;a<i.length&&u.budget>0;a++){let l=i[a],c=null;if(l.tagName,c=l.sheet||null,c&&Fn(c,o,u))return At.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(At.set(t,{fingerprint:e,result:!0}),!0):(At.set(t,{fingerprint:e,result:!1}),!1)}var vt=new WeakMap,Rn=-1;function Rr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Lr(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):Rr(t)}function ve(t,e){let n=t.parentElement,o=n?vt.get(n):null;return o?{get(s,r){let i=e.get(s,r),u=o.get(r);return typeof u=="number"?Math.max(i,u):i},getStack(s,r){let i=e.getStack(s,r);if(!i.length)return i;let u=o.get(r);if(typeof u=="number"){let a=i.slice();return a[a.length-1]=Math.max(a[a.length-1],u),a}return i}}:e}function Ee(t,e,n){let o=new Map;function s(a){let l=[];if(!a||a==="none")return l;for(let c of String(a).split(",")){let f=c.trim().split(/\s+/),d=f[0],h=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;d&&l.push({name:d,num:h})}return l}let r=s(e?.counterReset),i=s(e?.counterIncrement);function u(a){if(o.has(a))return o.get(a).slice();let l=n.getStack(t,a);l=l.length?l.slice():[];let c=r.find(d=>d.name===a);if(c){let d=Number.isFinite(c.num)?c.num:0;l=l.length?[...l,d]:[d]}let f=i.find(d=>d.name===a);if(f){let d=Number.isFinite(f.num)?f.num:1;l.length===0&&(l=[0]),l[l.length-1]+=d}return o.set(a,l.slice()),l}return{get(a,l){let c=u(l);return c.length?c[c.length-1]:0},getStack(a,l){return u(l)},__incs:i}}function Nr(t,e,n){let o;try{o=H(t,e)}catch{}let s=o?.content;if(!s||s==="none"||s==="normal")return{text:"",incs:[]};let r=ve(t,n),i=Ee(t,o,r),u=An(s)?En(s,t,i):s;return{text:Lr(u),incs:i.__incs||[]}}async function ne(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let s=t.ownerDocument||document;if(!$r(s,n))return;let r=x?.session?.__counterEpoch??0;if(Rn!==r&&(vt=new WeakMap,n&&(n.__counterCtx=null),Rn=r),!n.__counterCtx)try{n.__counterCtx=vn(t.ownerDocument||document)}catch(a){R(n,"buildCounterContext failed",a)}let i=n.__counterCtx;for(let a of["::before","::after","::first-letter"])try{let l=H(t,a);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(a==="::first-letter"){let $=H(t);if(!(l.color!==$.color||l.fontSize!==$.fontSize||l.fontWeight!==$.fontWeight||l.fontFamily!==$.fontFamily||l.fontStyle!==$.fontStyle||l.textTransform!==$.textTransform||l.float!==$.float||l.paddingTop!==$.paddingTop||l.paddingRight!==$.paddingRight||l.paddingBottom!==$.paddingBottom||l.paddingLeft!==$.paddingLeft||l.marginTop!==$.marginTop||l.marginRight!==$.marginRight||l.marginBottom!==$.marginBottom||l.marginLeft!==$.marginLeft))continue;let W=Array.from(e.childNodes).find(Dt=>Dt.nodeType===Node.TEXT_NODE&&Dt.textContent?.trim().length>0);if(!W)continue;let D=W.textContent,tt=D.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],yt=D.slice(tt?.length||0);if(!tt||/[\uD800-\uDFFF]/.test(tt))continue;let dt=document.createElement("span");dt.textContent=tt,dt.dataset.snapdomPseudo="::first-letter";let Ut=Yt(l),ie=bt(Ut,"span");n.styleMap.set(dt,ie);let Bt=document.createTextNode(yt);e.replaceChild(Bt,W),e.insertBefore(dt,Bt);continue}let f=l.content??"",d=f===""||f==="none"||f==="normal",{text:h,incs:y}=Nr(t,a,i),m=l.backgroundImage,p=l.backgroundColor,g=l.fontFamily,w=parseInt(l.fontSize)||32,S=parseInt(l.fontWeight)||!1,b=l.color||"#000",C=l.borderStyle,A=parseFloat(l.borderWidth),k=l.transform,v=Q(g),M=!d&&h!=="",N=m&&m!=="none",_=p&&p!=="transparent"&&p!=="rgba(0, 0, 0, 0)",L=C&&C!=="none"&&A>0,I=k&&k!=="none";if(!(M||N||_||L||I)){if(y&&y.length&&t.parentElement){let $=vt.get(t.parentElement)||new Map;for(let{name:P}of y){if(!P)continue;let W=ve(t,i),Z=Ee(t,H(t,a),W).get(t,P);$.set(P,Z)}vt.set(t.parentElement,$)}continue}let F=document.createElement("span");F.dataset.snapdomPseudo=a,F.style.pointerEvents="none";let ut=Yt(l),Ot=bt(ut,"span");if(n.styleMap.set(F,Ot),v&&h&&h.length===1){let{dataUrl:$,width:P,height:W}=await pn(h,g,S,w,b),D=document.createElement("img");D.src=$,D.style=`height:${w}px;width:${P/W*w}px;object-fit:contain;`,F.appendChild(D),e.dataset.snapdomHasIcon="true"}else if(h&&h.startsWith("url(")){let $=mt(h);if($?.trim())try{let P=await O(lt($),{as:"dataURL",useProxy:o.useProxy});if(P?.ok&&typeof P.data=="string"){let W=document.createElement("img");W.src=P.data,W.style=`width:${w}px;height:auto;object-fit:contain;`,F.appendChild(W)}}catch(P){console.error(`[snapdom] Error in pseudo ${a} for`,t,P)}}else!v&&M&&(F.textContent=h);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=l.backgroundRepeat,F.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?(F.style.backgroundPositionX=l.backgroundPositionX,F.style.backgroundPositionY=l.backgroundPositionY):F.style.backgroundPosition=l.backgroundPosition,F.style.backgroundOrigin=l.backgroundOrigin,F.style.backgroundClip=l.backgroundClip,F.style.backgroundAttachment=l.backgroundAttachment,F.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(N)try{let $=wt(m),P=await Promise.all($.map(ht));F.style.backgroundImage=P.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${a}`,$)}_&&(F.style.backgroundColor=p);let it=F.childNodes.length>0||F.textContent?.trim()!==""||N||_||L||I;if(y&&y.length&&t.parentElement){let $=vt.get(t.parentElement)||new Map,P=ve(t,i),W=Ee(t,H(t,a),P);for(let{name:D}of y){if(!D)continue;let Z=W.get(t,D);$.set(D,Z)}vt.set(t.parentElement,$)}if(!it)continue;a==="::before"?(e.dataset.snapdomHasBefore="1",e.insertBefore(F,e.firstChild)):(e.dataset.snapdomHasAfter="1",e.appendChild(F))}catch(l){console.warn(`[snapdom] Failed to capture ${a} for`,t,l)}let u=Array.from(e.children).filter(a=>!a.dataset.snapdomPseudo);if(n.nodeMap)for(let a of u){let l=n.nodeMap.get(a);l instanceof Element&&await ne(l,a,n,o)}else{let a=Array.from(t.children);for(let l=0;l<Math.min(a.length,u.length);l++)await ne(a[l],u[l],n,o)}}function Nn(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,s=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(s.length===0)return;let r=/url\(\s*#([^)]+)\)/g,i=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],u=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),a="http://www.w3.org/1999/xlink",l=b=>{if(!b||!b.getAttribute)return null;let C=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(a,"href"):null);if(C)return C;let A=b.attributes;if(!A)return null;for(let k=0;k<A.length;k++){let v=A[k];if(!v||!v.name)continue;if(v.name==="href")return v.value;let M=v.name.indexOf(":");if(M!==-1&&v.name.slice(M+1)==="href")return v.value}return null},c=new Set(Array.from(t.querySelectorAll("[id]")).map(b=>b.id)),f=new Set,d=!1,h=(b,C=null)=>{if(!b)return;r.lastIndex=0;let A;for(;A=r.exec(b);){d=!0;let k=(A[1]||"").trim();k&&(c.has(k)||(f.add(k),C&&!C.has(k)&&C.add(k)))}},y=b=>{let C=b.querySelectorAll("use");for(let v of C){let M=l(v);if(!M||!M.startsWith("#"))continue;d=!0;let N=M.slice(1).trim();N&&!c.has(N)&&f.add(N)}let k=b.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of k){h(v.getAttribute("style")||"");for(let M of i)h(v.getAttribute(M))}};for(let b of s)y(b);if(!d)return;let m=t.querySelector("svg.inline-defs-container");m||(m=n.createElementNS("http://www.w3.org/2000/svg","svg"),m.classList.add("inline-defs-container"),m.setAttribute("aria-hidden","true"),m.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(m,t.firstChild||null));let p=m.querySelector("defs")||null,g=b=>{if(!b||c.has(b))return null;let C=u(b),A=k=>{let v=o.querySelector(k);return v&&!t.contains(v)?v:null};return A(`svg defs > *#${C}`)||A(`svg > symbol#${C}`)||A(`*#${C}`)};if(!f.size)return;let w=new Set(f),S=new Set;for(;w.size;){let b=w.values().next().value;if(w.delete(b),!b||c.has(b)||S.has(b))continue;let C=g(b);if(!C){S.add(b);continue}p||(p=n.createElementNS("http://www.w3.org/2000/svg","defs"),m.appendChild(p));let A=C.cloneNode(!0);A.id||A.setAttribute("id",b),p.appendChild(A),S.add(b),c.add(b);let k=[A,...A.querySelectorAll("*")];for(let v of k){let M=l(v);if(M&&M.startsWith("#")){let _=M.slice(1).trim();_&&!c.has(_)&&!S.has(_)&&w.add(_)}let N=v.getAttribute?.("style")||"";N&&h(N,w);for(let _ of i){let L=v.getAttribute?.(_);L&&h(L,w)}}}}X();function In(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let o=t.getBoundingClientRect(),s=t.clientHeight,r="data-snap-ph",i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let u=i.currentNode,a=getComputedStyle(u),l=a.position;if(l!=="sticky"&&l!=="-webkit-sticky")continue;let c=Tn(a.top),f=Tn(a.bottom);if(c==null&&f==null)continue;let d=Tr(u,t),h=Ir(e,d,r);if(!h)continue;let y=u.getBoundingClientRect(),m=y.width,p=y.height,g=y.left-o.left;if(!(m>0&&p>0)||!Number.isFinite(g))continue;let w=c!=null?c+n:n+(s-p-f);if(!Number.isFinite(w))continue;let S=Number.parseInt(a.zIndex,10),b=Number.isFinite(S),C=b?Math.max(S,1)+1:2,A=b?S-1:0,k=h.cloneNode(!1);k.setAttribute(r,"1"),k.style.position="sticky",k.style.left=`${g}px`,k.style.top=`${w}px`,k.style.width=`${m}px`,k.style.height=`${p}px`,k.style.visibility="hidden",k.style.zIndex=String(A),k.style.overflow="hidden",k.style.background="transparent",k.style.boxShadow="none",k.style.filter="none",h.parentElement?.insertBefore(k,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${w}px`,h.style.bottom="auto",h.style.zIndex=String(C),h.style.pointerEvents="none"}}function Tn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Tr(t,e){let n=[];for(let o=t;o&&o!==e;){let s=o.parentElement;if(!s)break;n.push(Array.prototype.indexOf.call(s.children,o)),o=s}return n.reverse()}function Ir(t,e,n){let o=t;for(let s=0;s<e.length;s++)if(o=Pr(o,n)[e[s]],!o)return null;return o instanceof HTMLElement?o:null}function Pr(t,e){let n=[],o=t.children;for(let s=0;s<o.length;s++){let r=o[s];r.hasAttribute(e)||n.push(r)}return n}function Pn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,s=e.borderStyle,r=e.borderWidth,i=n!=="none"&&parseFloat(o)>0,u=s==="none"||parseFloat(r)===0;i&&u&&(t.style.border=`${o} solid transparent`)}function _n(t){let e=[];try{let n=t.querySelectorAll("*");for(let o of n){if(!(o instanceof HTMLElement))continue;let s=o.style.contentVisibility||"",r=getComputedStyle(o),i=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(e.push({el:o,original:s}),o.style.contentVisibility="visible")}if(t instanceof HTMLElement){let o=getComputedStyle(t),s=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(s==="auto"||s==="hidden")&&(e.push({el:t,original:t.style.contentVisibility||""}),t.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:n,original:o}of e)try{n.style.contentVisibility=o}catch{}}}async function Wn(t,e={}){let n={styleMap:x.session.styleMap,styleCache:x.session.styleCache,nodeMap:x.session.nodeMap,options:e},o,s="",r="";Pn(t);let i=_n(t);try{Nn(t)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{o=await It(t,n,e)}catch(c){throw console.warn("deepClone failed:",c),c}finally{i()}try{await ne(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await cn(o,n);try{let c=o.querySelectorAll("style[data-sd]");for(let f of c)r+=f.textContent||"",f.remove()}catch(c){R(n,"Failed to extract shadow CSS from style[data-sd]",c)}let u=he(n.styleMap);s=Array.from(u.entries()).map(([c,f])=>`.${f}{${c}}`).join(""),s=r+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+s;for(let[c,f]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",f.replace(/;/g,"; "));continue}let d=u.get(f);d&&c.classList.add(d);let h=c.style?.backgroundImage,y=c.dataset?.snapdomHasIcon;h&&h!=="none"&&(c.style.backgroundImage=h),y&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,f]of n.nodeMap.entries()){let d=f.scrollLeft,h=f.scrollTop;if((d||h)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";try{let p=c.querySelectorAll("*");for(let g of p){if(!(g instanceof HTMLElement))continue;let w=g.style.position;if(w==="fixed"||w==="absolute"){let S=parseFloat(g.style.top)||0,b=parseFloat(g.style.left)||0;g.style.top=`${S+h}px`,g.style.left=`${b+d}px`,w==="fixed"&&(g.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.transform=`translate(${-d}px, ${-h}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m)}}let l=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(In(t,l),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||H(t);n.styleCache.set(t,c);let f=ce(c.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=f||""}for(let[c,f]of n.nodeMap.entries())f.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:o,classCSS:s,styleCache:n.styleCache}}pt();var On="http://www.w3.org/1999/xlink";function _r(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(On,"href"):null)}function Wr(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,o=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,r=parseFloat(t.style?.width||"")||0,i=parseFloat(t.style?.height||"")||0,u=e||r||o||t.width||t.naturalWidth||100,a=n||i||s||t.height||t.naturalHeight||100;return{width:u,height:a}}async function Un(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async i=>{if(!i.getAttribute("src")){let d=i.currentSrc||i.src||"";d&&i.setAttribute("src",d)}i.removeAttribute("srcset"),i.removeAttribute("sizes");let u=i.src||"";if(!u)return;let a=await O(u,{as:"dataURL",useProxy:e.useProxy});if(a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")){i.src=a.data,i.width||(i.width=i.naturalWidth||100),i.height||(i.height=i.naturalHeight||100);return}let{width:l,height:c}=Wr(i),{fallbackURL:f}=e||{};if(f)try{let d=typeof f=="function"?await f({width:l,height:c,src:u,element:i}):f;if(d){let h=await O(d,{as:"dataURL",useProxy:e.useProxy});if(h?.ok&&typeof h.data=="string"){i.src=h.data,i.width||(i.width=l),i.height||(i.height=c);return}}}catch{}if(e.placeholders!==!1){let d=document.createElement("div");d.style.cssText=[`width:${l}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),d.textContent="img",i.replaceWith(d)}else{let d=document.createElement("div");d.style.cssText=`display:inline-block;width:${l}px;height:${c}px;visibility:hidden;`,i.replaceWith(d)}};for(let i=0;i<n.length;i+=4){let u=n.slice(i,i+4).map(o);await Promise.allSettled(u)}let s=Array.from(t.querySelectorAll("image")),r=async i=>{let u=_r(i);if(!u||u.startsWith("data:")||u.startsWith("blob:"))return;let a=await O(u,{as:"dataURL",useProxy:e.useProxy});a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")&&(i.setAttribute("href",a.data),i.removeAttribute("xlink:href"),typeof i.removeAttributeNS=="function"&&i.removeAttributeNS(On,"href"))};for(let i=0;i<s.length;i+=4){let u=s.slice(i,i+4).map(r);await Promise.allSettled(u)}}G();async function oe(t,e,n,o={}){let s=[[t,e]],r=["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"],i=["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"],u=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],a=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;s.length;){let[l,c]=s.shift();if(!c)continue;let f=n.get(l)||H(l);n.has(l)||n.set(l,f);let d=(()=>{let m=f.getPropertyValue("border-image"),p=f.getPropertyValue("border-image-source");return m&&m!=="none"||p&&p!=="none"})();for(let m of u){let p=f.getPropertyValue(m);p&&c.style.setProperty(m,p)}for(let m of r){let p=f.getPropertyValue(m);if(m==="background-image"&&(!p||p==="none")){let S=f.getPropertyValue("background");S&&/url\s*\(/.test(S)&&(p=wt(S).filter(b=>/url\s*\(/.test(b)).join(", ")||p)}if(!p||p==="none")continue;let g=wt(p),w=await Promise.all(g.map(S=>ht(S,o)));w.some(S=>S&&S!=="none"&&!/^url\(undefined/.test(S))&&c.style.setProperty(m,w.join(", "))}for(let m of i){let p=f.getPropertyValue(m);!p||p==="initial"||c.style.setProperty(m,p)}if(d)for(let m of a){let p=f.getPropertyValue(m);!p||p==="initial"||c.style.setProperty(m,p)}let h=l.shadowRoot?Array.from(l.shadowRoot.children).filter(m=>m.tagName!=="STYLE"):Array.from(l.children),y=Array.from(c.children).filter(m=>!(m.dataset?.snapdomPseudo||m.tagName==="STYLE"&&m.dataset?.sd));for(let m=0;m<Math.min(h.length,y.length);m++)s.push([h[m],y[m]])}}G();X();function Bn(t){if(!t)return()=>{};let e=[];function n(o){let s=Or(o);s&&e.push(s);for(let r of o.children||[])n(r)}return n(t),()=>e.forEach(o=>o())}function Or(t){if(!t)return()=>{};let e=Ur(t);if(e<=0)return()=>{};if(!Hr(t))return()=>{};let n=getComputedStyle(t),o=Math.round(Br(n)*e+Dr(n)),s=t.textContent??"",r=s;if(t.scrollHeight<=o+.5)return()=>{};let i=0,u=s.length,a=-1;for(;i<=u;){let l=i+u>>1;t.textContent=s.slice(0,l)+"\u2026",t.scrollHeight<=o+.5?(a=l,i=l+1):u=l-1}return t.textContent=(a>=0?s.slice(0,a):"")+"\u2026",()=>{t.textContent=r}}function Ur(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 Br(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 Dr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Hr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Pt=[];function Dn(t){if(!t)return null;if(Array.isArray(t)){let[e,n]=t;return typeof e=="function"?e(n):e}if(typeof t=="object"&&"plugin"in t){let{plugin:e,options:n}=t;return typeof e=="function"?e(n):e}return typeof t=="function"?t():t}function Hn(...t){let e=t.flat();for(let n of e){let o=Dn(n);o&&(Pt.some(s=>s&&s.name&&o.name&&s.name===o.name)||Pt.push(o))}}function Vn(t){return(t&&Array.isArray(t.plugins)?t.plugins:Pt)||Pt}async function J(t,e,n){let o=n,s=Vn(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let u=await i(e,o);typeof u<"u"&&(o=u)}return o}async function jn(t,e,n){let o=[],s=Vn(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let u=await i(e,n);typeof u<"u"&&o.push(u)}return o}function Vr(t){let e=[];if(Array.isArray(t))for(let n of t){let o=Dn(n);if(!o||!o.name)continue;let s=e.findIndex(r=>r&&r.name===o.name);s>=0&&e.splice(s,1),e.push(o)}for(let n of Pt)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function qn(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=Vr(e)),t}G();function zn(t,e,n={}){if(!t||!e||!e.style)return;let o=getComputedStyle(t);try{e.style.boxShadow="none"}catch(i){R(n,"stripRootShadows boxShadow",i)}try{e.style.textShadow="none"}catch(i){R(n,"stripRootShadows textShadow",i)}try{e.style.outline="none"}catch(i){R(n,"stripRootShadows outline",i)}let r=(o.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=r.length?r:"none"}catch(i){R(n,"stripRootShadows filter",i)}}function jr(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let o of n)o.remove()}function qr(t,e={}){let{stripFrameworkDirectives:n=!0}=e,o=new Set(["xml","xlink"]),s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let r=s.currentNode;for(let i of Array.from(r.attributes)){let u=i.name;if(u.includes("@")){r.removeAttribute(u);continue}if(u.includes(":")){let a=u.split(":",1)[0];if(!o.has(a)){r.removeAttribute(u);continue}}if(n&&(u.startsWith("x-")||u.startsWith("v-")||u.startsWith(":")||u.startsWith("on:")||u.startsWith("bind:")||u.startsWith("let:")||u.startsWith("class:"))){r.removeAttribute(u);continue}}}}function Xn(t,e={}){t&&(qr(t,e),jr(t))}function zr(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function Xr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Yr(t,e){if(!(t instanceof Element)||zr(t)||Xr(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let o=e.display||"";return!(o.includes("flex")||o.includes("grid")||o.startsWith("table")||e.transform&&e.transform!=="none")}function Yn(t,e,n=new Map){function o(s,r){if(!(s instanceof Element)||!(r instanceof Element))return;let i=s.childElementCount>r.childElementCount,u=n.get(s)||getComputedStyle(s);if(n.has(s)||n.set(s,u),i&&Yr(s,u)){r.style.height||(r.style.height="auto"),r.style.width||(r.style.width="auto"),r.style.removeProperty("block-size"),r.style.removeProperty("inline-size"),r.style.minHeight||(r.style.minHeight="0"),r.style.minWidth||(r.style.minWidth="0"),r.style.maxHeight||(r.style.maxHeight="none"),r.style.maxWidth||(r.style.maxWidth="none");let c=u.overflowY||u.overflowBlock||"visible",f=u.overflowX||u.overflowInline||"visible";(c!=="visible"||f!=="visible")&&(r.style.overflow="visible")}let a=Array.from(s.children),l=Array.from(r.children);for(let c=0;c<Math.min(a.length,l.length);c++)o(a[c],l[c])}o(t,e)}function Gr(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed")}function Kr(t,e){if(!(t instanceof Element))return!1;if(t.getAttribute("data-capture")==="exclude"&&e?.excludeMode==="remove")return!0;if(Array.isArray(e?.exclude))for(let n of e.exclude)try{if(t.matches(n))return e.excludeMode==="remove"}catch(o){R(e,"exclude selector match failed",o)}return!1}function Gn(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),s=1/0,r=-1/0,i=!1,u=Array.from(t.children);for(let h of u){if(Kr(h,e)||!Gr(h))continue;let y=h.getBoundingClientRect(),m=y.top-o.top,p=y.bottom-o.top;p<=m||(m<s&&(s=m),p>r&&(r=p),i=!0)}let a=i?Math.max(0,r-s):0,l=parseFloat(n.borderTopWidth)||0,c=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingBottom)||0;return l+c+f+d+a}var E=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t,Qr=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Me(t,e=new Set){let n="";if(!t)return n;for(let o=0;o<t.length;o++){let s=t[o];try{if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){n+=Me(s.styleSheet.cssRules,e);continue}if(s.type===CSSRule.MEDIA_RULE&&s.cssRules){let r=Me(s.cssRules,e);r&&(n+=`@media ${s.conditionText}{${r}}`);continue}if(s.type===CSSRule.STYLE_RULE){let r=s.selectorText||"";if(Qr.test(r)){let i=s.cssText;i&&!e.has(i)&&(e.add(i),n+=i)}}}catch{}}return n}function Kn(t){if(!t||!t.styleSheets)return"";let e=new Set,n="";for(let o of Array.from(t.styleSheets))try{let s=o.cssRules;s&&(n+=Me(s,e))}catch{}return n}function Qn(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(u=>u.trim()),o=0,s=0,r=0,i=0;for(let u of n){let a=u.match(/-?\d+(\.\d+)?px/g)?.map(m=>parseFloat(m))||[];if(a.length<2)continue;let[l,c,f=0,d=0]=a,h=Math.abs(l)+f+d,y=Math.abs(c)+f+d;s=Math.max(s,h+Math.max(l,0)),i=Math.max(i,h+Math.max(-l,0)),r=Math.max(r,y+Math.max(c,0)),o=Math.max(o,y+Math.max(-c,0))}return{top:Math.ceil(o),right:Math.ceil(s),bottom:Math.ceil(r),left:Math.ceil(i)}}function Jn(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function Zn(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0),n=parseFloat(t.outlineOffset||"0")||0,o=e+Math.max(0,Math.ceil(n));return{top:o,right:o,bottom:o,left:o}}function to(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],o=0,s=0,r=0,i=0,u=!1;for(let a of n){u=!0;let l=a.match(/-?\d+(?:\.\d+)?px/gi)?.map(m=>parseFloat(m))||[],[c=0,f=0,d=0]=l,h=Math.abs(c)+d,y=Math.abs(f)+d;s=Math.max(s,h+Math.max(c,0)),i=Math.max(i,h+Math.max(-c,0)),r=Math.max(r,y+Math.max(f,0)),o=Math.max(o,y+Math.max(-f,0))}return{bleed:{top:E(o),right:E(s),bottom:E(r),left:E(i)},has:u}}function eo(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let o=n.transform||"none";if(!o||o==="none")try{let u=so(t);if(u.a===1&&u.b===0&&u.c===0&&u.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}function s(u,a,l,c){let f=Math.sqrt(u*u+a*a)||0,d=0,h=0;if(f>0){let y=u/f,m=a/f;d=y*l+m*c;let p=l-y*d,g=c-m*d;h=Math.sqrt(p*p+g*g)||0,h>0?d=d/h:d=0}return{a:f,b:0,c:d*h,d:h}}let r=o.match(/^matrix\(\s*([^)]+)\)$/i);if(r){let u=r[1].split(",").map(a=>parseFloat(a.trim()));if(u.length===6&&u.every(Number.isFinite)){let[a,l,c,f]=u,d=s(a,l,c,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}let i=o.match(/^matrix3d\(\s*([^)]+)\)$/i);if(i){let u=i[1].split(",").map(a=>parseFloat(a.trim()));if(u.length===16&&u.every(Number.isFinite)){let a=u[0],l=u[1],c=u[4],f=u[5],d=s(a,l,c,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}try{let u=new DOMMatrix(o),a=s(u.a,u.b,u.c,u.d);try{e.style.transform=`matrix(${a.a}, ${a.b}, ${a.c}, ${a.d}, 0, 0)`}catch{}return a}catch{return null}}function $e(t,e,n,o,s){let r=n.a,i=n.b,u=n.c,a=n.d,l=n.e||0,c=n.f||0;function f(g,w){let S=g-o,b=w-s,C=r*S+u*b,A=i*S+a*b;return C+=o+l,A+=s+c,[C,A]}let d=[f(0,0),f(t,0),f(0,e),f(t,e)],h=1/0,y=1/0,m=-1/0,p=-1/0;for(let[g,w]of d)g<h&&(h=g),w<y&&(y=w),g>m&&(m=g),w>p&&(p=w);return{minX:h,minY:y,maxX:m,maxY:p,width:m-h,height:p-y}}function no(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[s,r]=[o[0]||"0",o[1]||"0"],i=(u,a)=>{let l=u.toLowerCase();return l==="left"||l==="top"?0:l==="center"?a/2:l==="right"||l==="bottom"?a:l.endsWith("px")?parseFloat(l)||0:l.endsWith("%")?(parseFloat(l)||0)*a/100:/^-?\d+(\.\d+)?$/.test(l)&&parseFloat(l)||0};return{ox:i(s,e),oy:i(r,n)}}function oo(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let s=a=>{try{return typeof n.has=="function"&&!n.has(a)||typeof n.get!="function"?null:n.get(a)}catch{return null}},r=s("rotate");if(r)if(r.angle){let a=r.angle;e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit}else r.unit?e.rotate=r.unit==="rad"?r.value*180/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{let a=getComputedStyle(t);e.rotate=a.rotate&&a.rotate!=="none"?a.rotate:"0deg"}let i=s("scale");if(i){let a="x"in i&&i.x?.value!=null?i.x.value:Array.isArray(i)?i[0]?.value:Number(i)||1,l="y"in i&&i.y?.value!=null?i.y.value:Array.isArray(i)?i[1]?.value:a;e.scale=`${a} ${l}`}else{let a=getComputedStyle(t);e.scale=a.scale&&a.scale!=="none"?a.scale:null}let u=s("translate");if(u){let a="x"in u&&"value"in u.x?u.x.value:Array.isArray(u)?u[0]?.value:0,l="y"in u&&"value"in u.y?u.y.value:Array.isArray(u)?u[1]?.value:0,c="x"in u&&u.x?.unit?u.x.unit:"px",f="y"in u&&u.y?.unit?u.y.unit:"px";e.translate=`${a}${c} ${l}${f}`}else{let a=getComputedStyle(t);e.translate=a.translate&&a.translate!=="none"?a.translate:null}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}var Fe=null;function Jr(){if(Fe)return Fe;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),Fe=t,t}function ro(t){let e=Jr(),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=so(n);return e.removeChild(n),o}function io(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let s=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",r=e.scale&&e.scale!=="none"&&e.scale!=="1",i=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(s||r||i)}function so(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}async function Re(t,e){if(!t)throw new Error("Element cannot be null or undefined");jt(e.cache);let n=e.fast,o=e.outerTransforms!==!1,s=!!e.outerShadows,r={element:t,options:e,plugins:e.plugins},i,u,a,l="",c="",f,d,h=null;await J("beforeSnap",r),await J("beforeClone",r);let y=Bn(r.element);try{({clone:i,classCSS:u,styleCache:a}=await Wn(r.element,r.options)),!o&&i&&(h=eo(r.element,i)),!s&&i&&zn(r.element,i,r.options)}finally{y()}if(r={clone:i,classCSS:u,styleCache:a,...r},await J("afterClone",r),Xn(r.clone),r.options?.excludeMode==="remove")try{Yn(r.element,r.clone,r.styleCache)}catch(S){console.warn("[snapdom] shrink pass failed:",S)}try{await fn(r.clone,r.element)}catch{}await new Promise(S=>{ot(async()=>{await Un(r.clone,r.options),S()},{fast:n})}),await new Promise(S=>{ot(async()=>{await oe(r.element,r.clone,r.styleCache,r.options),S()},{fast:n})}),e.embedFonts&&await new Promise(S=>{ot(async()=>{let b=Ct(r.element),C=ee(r.element);if(V()){let A=new Set(Array.from(b).map(k=>String(k).split("__")[0]).filter(Boolean));await kt(A,1)}l=await te({required:b,usedCodepoints:C,preCached:!1,exclude:r.options.excludeFonts,useProxy:r.options.useProxy,fontStylesheetDomains:r.options.fontStylesheetDomains}),S()},{fast:n})});let m=me(r.clone).sort(),p=m.join(",");x.baseStyle.has(p)?c=x.baseStyle.get(p):await new Promise(S=>{ot(()=>{c=pe(m),x.baseStyle.set(p,c),S()},{fast:n})});let g=Kn(r.element?.ownerDocument||document);r={fontsCSS:l,baseCSS:c,scrollbarCSS:g,...r},await J("beforeRender",r),await new Promise(S=>{ot(()=>{let b=H(r.element),C=r.element.getBoundingClientRect(),A=Math.max(1,E(r.element.offsetWidth||parseFloat(b.width)||C.width||1)),k=Math.max(1,E(r.element.offsetHeight||parseFloat(b.height)||C.height||1)),v=r.element.ownerDocument||document;if(r.element===v.body||r.element===v.documentElement){let j=Math.max(r.element.scrollHeight||0,v.documentElement?.scrollHeight||0,v.body?.scrollHeight||0),z=Math.max(r.element.scrollWidth||0,v.documentElement?.scrollWidth||0,v.body?.scrollWidth||0);j>0&&(k=Math.max(k,E(j))),z>0&&(A=Math.max(A,E(z)));try{let et=(r.scrollbarCSS||"").length+(r.baseCSS||"").length+(r.fontsCSS||"").length+(r.classCSS||"").length,Y=x.measureHints.get(r.element);if(Y&&Y.cssLen===et&&Y.w0===A)Y.csh>0&&(k=Math.max(k,E(Y.csh))),Y.csw>0&&(A=Math.max(A,E(Y.csw)));else{let nt=v.createElement("div");nt.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+A+"px!important;overflow:visible!important;visibility:hidden!important;";let Vt=v.createElement("style");Vt.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,nt.appendChild(Vt),nt.appendChild(r.clone.cloneNode(!0)),v.body.appendChild(nt);let Et=nt.scrollHeight,ct=nt.scrollWidth;v.body.removeChild(nt),x.measureHints.set(r.element,{cssLen:et,w0:A,csh:Et,csw:ct}),Et>0&&(k=Math.max(k,E(Et))),ct>0&&(A=Math.max(A,E(ct)))}}catch{}}if(r.options?.excludeMode==="remove"){let j=Gn(r.element,r.options);Number.isFinite(j)&&j>0&&(k=Math.max(1,Math.min(k,E(j+1))))}let N=(j,z=NaN)=>{let et=typeof j=="string"?parseFloat(j):j;return Number.isFinite(et)?et:z},_=N(r.options.width),L=N(r.options.height),I=A,B=k,F=Number.isFinite(_),ut=Number.isFinite(L),Ot=k>0?A/k:1;F&&ut?(I=Math.max(1,E(_)),B=Math.max(1,E(L))):F?(I=Math.max(1,E(_)),B=Math.max(1,E(I/(Ot||1)))):ut?(B=Math.max(1,E(L)),I=Math.max(1,E(B*(Ot||1)))):(I=A,B=k);let ft=0,it=0,$=A,P=k;if(!o&&h&&Number.isFinite(h.a)){let j={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},z=$e(A,k,j,0,0);ft=E(z.minX),it=E(z.minY),$=E(z.maxX),P=E(z.maxY)}else if(o&&ao(r.element)){let z=b.transform&&b.transform!=="none"?b.transform:"",et=oo(r.element),Y=ro({baseTransform:z,rotate:et.rotate||"0deg",scale:et.scale,translate:et.translate}),{ox:nt,oy:Vt}=no(b,A,k),Et=Y.is2D?Y:new DOMMatrix(Y.toString()),ct=$e(A,k,Et,nt,Vt);ft=E(ct.minX),it=E(ct.minY),$=E(ct.maxX),P=E(ct.maxY)}let W=Qn(b),D=Jn(b),Z=Zn(b),tt=to(b),yt=s?{top:E(W.top+D.top+Z.top+tt.bleed.top),right:E(W.right+D.right+Z.right+tt.bleed.right),bottom:E(W.bottom+D.bottom+Z.bottom+tt.bleed.bottom),left:E(W.left+D.left+Z.left+tt.bleed.left)}:{top:0,right:0,bottom:0,left:0};ft=E(ft-yt.left),it=E(it-yt.top),$=E($+yt.right),P=E(P+yt.bottom);let dt=Math.max(1,E($-ft)),Ut=Math.max(1,E(P-it)),ie=F||ut?E(I/A):1,Bt=ut||F?E(B/k):1,Dt=Math.max(1,E(dt*ie)),bo=Math.max(1,E(Ut*Bt)),_e="http://www.w3.org/2000/svg",wo=V()&&ao(r.element)?1:0,st=E(wo+(o?0:1)),at=document.createElementNS(_e,"foreignObject"),So=E(ft),xo=E(it);at.setAttribute("x",String(E(-(So-st)))),at.setAttribute("y",String(E(-(xo-st)))),at.setAttribute("width",String(E(A+st*2))),at.setAttribute("height",String(E(k+st*2))),at.style.overflow="visible";let We=document.createElement("style"),Co='svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject *{min-width:0;} foreignObject pre,foreignObject [style*="white-space"]{white-space:inherit;}';We.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+Co+r.classCSS,at.appendChild(We);let Ht=document.createElement("div");Ht.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ht.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${E(A)}px;height:${E(k)}px`,Ht.appendChild(r.clone),at.appendChild(Ht);let ko=new XMLSerializer().serializeToString(at),se=E(dt+st*2),ae=E(Ut+st*2),Oe=F||ut;e.meta={w0:A,h0:k,vbW:se,vbH:ae,targetW:I,targetH:B};let Ao=V()&&Oe?se:E(Dt+st*2),vo=V()&&Oe?ae:E(bo+st*2),Eo=parseFloat(H(v.documentElement)?.fontSize)||16;d=`<svg xmlns="${_e}" width="${Ao}" height="${vo}" viewBox="0 0 ${se} ${ae}" font-size="${Eo}px">`+ko+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,r={svgString:d,dataURL:f,...r},S()},{fast:n})}),await J("afterRender",r);let w=document.getElementById("snapdom-sandbox");return w&&w.style.position==="absolute"&&w.remove(),r.dataURL}function ao(t){return io(t)}X();function co(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Ue(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,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],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??(["jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(t.safariWarmupAttempts??3)|0)),excludeStyleProps:t.excludeStyleProps??null}}St();be();G();pt();X();async function Zr(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,s=e.cache??e.cacheOpt??"full";jt(s);try{await document.fonts?.ready}catch{}try{fe()}catch{}x.session=x.session||{},x.session.styleCache||(x.session.styleCache=new WeakMap),x.image=x.image||new U(100),x.background=x.background||new U(100);try{await oe(t,void 0,x.session.styleCache,{useProxy:o})}catch{}let r=[],i=[];try{if(t&&t.nodeType===1){let a=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];i=[t,...a],r=[],t.tagName==="IMG"&&t.getAttribute("src")&&r.push(t),r.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(r=Array.from(t.querySelectorAll("img[src]")),i=Array.from(t.querySelectorAll("*")))}catch{}let u=[];for(let a of r){let l=a?.currentSrc||a?.src;if(l&&!x.image.has(l)){let c=Promise.resolve().then(async()=>{let f=await O(l,{as:"dataURL",useProxy:o});f?.ok&&typeof f.data=="string"&&x.image.set(l,f.data)}).catch(()=>{});u.push(c)}}for(let a of i){let l="";try{l=a?.style?.backgroundImage||"",(!l||l==="none")&&(l=H(a).backgroundImage)}catch{}if(l&&l!=="none"){let c=l.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let f of c){let d=Promise.resolve().then(()=>ht(f,{...e,useProxy:o})).catch(()=>{});u.push(d)}}}if(n)try{let a=Ct(t),l=ee(t);if(typeof V=="function"?V():!!V){let f=new Set(Array.from(a).map(d=>String(d).split("__")[0]).filter(Boolean));await kt(f,3)}await te({required:a,usedCodepoints:l,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o,fontStylesheetDomains:e.fontStylesheetDomains})}catch{}await Promise.allSettled(u)}function ui(...t){return Hn(...t),T}var T=Object.assign(di,{plugins:ui}),yo=Symbol("snapdom.internal"),fi=Symbol("snapdom.internal.silent"),go=!1;async function di(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=co(e);if(qn(n,e&&e.plugins),V()&&(n.embedFonts===!0||pi(t))){if(n.embedFonts)try{let s=Ct(t),r=new Set([...s].map(i=>String(i).split("__")[0]).filter(Boolean));await kt(r,1)}catch{}let o=n.safariWarmupAttempts??3;for(let s=0;s<o;s++)try{await mi(t,e)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&un(n.iconFonts),n.snap||(n.snap={toPng:(o,s)=>T.toPng(o,s),toSvg:(o,s)=>T.toSvg(o,s)}),T.capture(t,n,yo)}T.capture=async(t,e,n)=>{if(n!==yo)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Re(t,e),s={img:async(m,p)=>{let{toImg:g}=await Promise.resolve().then(()=>(Te(),Ne));return g(o,{...m,...p||{}})},svg:async(m,p)=>{let{toSvg:g}=await Promise.resolve().then(()=>(Te(),Ne));return g(o,{...m,...p||{}})},canvas:async(m,p)=>{let{toCanvas:g}=await Promise.resolve().then(()=>(_t(),uo));return g(o,{...m,...p||{}})},blob:async(m,p)=>{let{toBlob:g}=await Promise.resolve().then(()=>(Pe(),fo));return g(o,{...m,...p||{}})},png:async(m,p)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Wt(),re));return g(o,{...m,...p||{},format:"png"})},jpeg:async(m,p)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Wt(),re));return g(o,{...m,...p||{},format:"jpeg"})},webp:async(m,p)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Wt(),re));return g(o,{...m,...p||{},format:"webp"})},download:async(m,p)=>{let{download:g}=await Promise.resolve().then(()=>(ho(),po));return g(o,{...m,...p||{}})}},r={};for(let m of["img","svg","canvas","blob","png","jpeg","webp"])r[m]=async p=>s[m](e,{...p||{},[fi]:!0});r.jpg=r.jpeg;let i={...e,export:{url:o},exports:r},u=await jn("defineExports",i),a=Object.assign({},...u.filter(m=>m&&typeof m=="object")),l={...s,...a};l.jpeg&&!l.jpg&&(l.jpg=(m,p)=>l.jpeg(m,p));function c(m,p){let g={...e,...p||{}};return(m==="jpeg"||m==="jpg")&&(g.backgroundColor==null||g.backgroundColor==="transparent")&&(g.backgroundColor="#ffffff"),g}let f=!1,d=Promise.resolve();async function h(m,p){let g=async()=>{let w=l[m];if(!w)throw new Error(`[snapdom] Unknown export type: ${m}`);let S=c(m,p),b={...e,export:{type:m,options:S,url:o}};await J("beforeExport",b);let C=await w(b,S);return await J("afterExport",b,C),f||(f=!0,await J("afterSnap",e)),C};return d=d.then(g)}let y={url:o,toRaw:()=>o,to:(m,p)=>h(m,p),toImg:m=>h("img",m),toSvg:m=>h("svg",m),toCanvas:m=>h("canvas",m),toBlob:m=>h("blob",m),toPng:m=>h("png",m),toJpg:m=>h("jpg",m),toWebp:m=>h("webp",m),download:m=>h("download",m)};for(let m of Object.keys(l)){let p="to"+m.charAt(0).toUpperCase()+m.slice(1);y[p]||(y[p]=g=>h(m,g))}return y};T.toRaw=(t,e)=>T(t,e).then(n=>n.toRaw());T.toImg=(t,e)=>T(t,e).then(n=>n.toImg());T.toSvg=(t,e)=>T(t,e).then(n=>n.toSvg());T.toCanvas=(t,e)=>T(t,e).then(n=>n.toCanvas());T.toBlob=(t,e)=>T(t,e).then(n=>n.toBlob());T.toPng=(t,e)=>T(t,{...e,format:"png"}).then(n=>n.toPng());T.toJpg=(t,e)=>T(t,{...e,format:"jpeg"}).then(n=>n.toJpg());T.toWebp=(t,e)=>T(t,{...e,format:"webp"}).then(n=>n.toWebp());T.download=(t,e)=>T(t,e).then(n=>n.download());async function mi(t,e){if(go)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await Re(t,n)}catch(s){R(e,"safariWarmup pre-capture failed",s)}await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s))),o&&await new Promise(s=>{let r=new Image;try{r.decoding="sync",r.loading="eager"}catch(i){R(e,"safariWarmup img hints failed",i)}r.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",r.src=o,document.body.appendChild(r),(async()=>{try{typeof r.decode=="function"&&await r.decode()}catch(u){R(e,"safariWarmup img.decode failed",u)}let i=performance.now();for(;!(r.complete&&r.naturalWidth>0)&&performance.now()-i<900;)await new Promise(u=>setTimeout(u,200));await new Promise(u=>requestAnimationFrame(u));try{let u=document.createElement("canvas");u.width=Math.max(1,r.naturalWidth||10),u.height=Math.max(1,r.naturalHeight||10);let a=u.getContext("2d");a&&a.drawImage(r,0,0)}catch{}await new Promise(u=>requestAnimationFrame(u));try{r.remove()}catch(u){R(e,"safariWarmup img.remove failed",u)}s()})()}),t.querySelectorAll("canvas").forEach(s=>{try{let r=s.getContext("2d",{willReadFrequently:!0});r&&r.getImageData(0,0,1,1)}catch(r){R(e,"safariWarmup canvas poke failed",r)}}),go=!0}function pi(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),s=o.backgroundImage&&o.backgroundImage!=="none",r=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(s||r||n.tagName==="CANVAS")return!0}return!1}export{Zr as preCache,T as snapdom};
|
|
7
|
+
var Lr=Object.defineProperty;var V=(t,e)=>()=>(t&&(e=t(t=0)),e);var Rt=(t,e)=>{for(var n in e)Lr(t,n,{get:e[n],enumerable:!0})};function He(t){if(t===!0)return"soft";if(t===!1)return"disabled";if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="auto")return"auto";if(e==="full")return"full";if(e==="soft"||e==="disabled")return e}return"soft"}function Vt(t="soft"){switch(C.session.__counterEpoch=(C.session.__counterEpoch||0)+1,t){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.baseStyle=new O(50),C.defaultStyle=new O(30),C.image=new O(100),C.background=new O(100),C.resource=new O(150),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var O,C,X=V(()=>{O=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let r=this.keys().next().value;r!==void 0&&this.delete(r)}return super.set(e,n)}},C={image:new O(100),background:new O(100),resource:new O(150),defaultStyle:new O(30),baseStyle:new O(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function mt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function fe(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function lt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function de(t,e){if(!t||/^(data|blob|about|#)/i.test(t.trim()))return t;try{let n=e||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(t,n).href}catch{return t}}var Lt=V(()=>{});function Pr(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(s,c,a){if(i>=n)return;let u=Date.now();(r.get(c)||0)>u||(r.set(c,u+e),i++,s==="warn"&&console&&console.warn?console.warn(`${t} ${a}`):console&&console.error&&console.error(`${t} ${a}`))}return{warnOnce(s,c){o("warn",s,c)},errorOnce(s,c){o("error",s,c)},reset(){r.clear(),i=0}}}function Tr(t){return/^data:|^blob:|^about:blank$/i.test(t)}function Ir(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,i=new URL(r||".",n),o=new URL(t,n);if(o.origin===i.origin)return!0;let s=o.searchParams;if(s&&(s.has("url")||s.has("target")))return!0}catch{}return!1}function Nr(t,e){if(!e||Tr(t)||Ir(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 _r(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",lt(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}${lt(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function qe(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 Wr(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function W(t,e={}){let n=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",o=e.errorTTL??8e3,s=e.headers||{},c=!!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="",y=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],S=/;base64/i.test(h)?atob(y):decodeURIComponent(y),b=new Uint8Array([...S].map(v=>v.charCodeAt(0))),x=new Blob([b],{type:(h||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:t,fromCache:!1,mime:x.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 y=await h.blob(),w=y.type||h.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await qe(y),status:h.status,url:t,fromCache:!1,mime:w}:n==="text"?{ok:!0,data:await y.text(),status:h.status,url:t,fromCache:!1,mime:w}:{ok:!0,data:y,status:h.status,url:t,fromCache:!1,mime:w}}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 a=Wr(t,{as:n,timeout:r,useProxy:i,errorTTL:o}),u=jt.get(a);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&jt.delete(a);let l=me.get(a);if(l)return l;let f=Nr(t,i)?_r(t,i):t,d=e.credentials;if(!d)try{let h=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(t,h);d=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{d="omit"}let m=new AbortController,g=setTimeout(()=>m.abort("timeout"),r),p=(async()=>{try{let h=await fetch(f,{signal:m.signal,credentials:d,headers:s});if(!h.ok){let S={ok:!1,data:null,status:h.status,url:f,fromCache:!1,reason:"http_error"};if(o>0&&jt.set(a,{until:Date.now()+o,result:S}),!c){let b=`${h.status} ${h.statusText||""}`.trim();ze.warnOnce(`http:${h.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${b} while fetching ${n} ${t}`)}return e.onError&&e.onError(S),S}if(n==="text")return{ok:!0,data:await h.text(),status:h.status,url:f,fromCache:!1};let y=await h.blob(),w=y.type||h.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await qe(y),status:h.status,url:f,fromCache:!1,mime:w}:{ok:!0,data:y,status:h.status,url:f,fromCache:!1,mime:w}}catch(h){let y=h&&typeof h=="object"&&"name"in h&&h.name==="AbortError"?String(h.message||"").includes("timeout")?"timeout":"abort":"network",w={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:y};if(!/^blob:/i.test(t)&&o>0&&jt.set(a,{until:Date.now()+o,result:w}),!c){let S=`${y}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,b=y==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:y==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;ze.errorOnce(S,b)}return e.onError&&e.onError(w),w}finally{clearTimeout(g),me.delete(a)}})();return me.set(a,p),p}var ze,me,jt,pt=V(()=>{Lt();ze=Pr("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),me=new Map,jt=new Map});async function ht(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=mt(t);if(!r)return t;let i=de(r),o=lt(i);if(C.background.has(o)){let s=C.background.get(o);return s?`url("${s}")`:"none"}try{let s=await W(o,{as:"dataURL",useProxy:e.useProxy});return s.ok?(C.background.set(o,s.data),`url("${s.data}")`):(C.background.set(o,null),"none")}catch{return C.background.set(o,null),"none"}}var Ve=V(()=>{X();Lt();pt()});function pe(){for(let t of Ur){let e=String(t).toLowerCase();Xt.has(e)||Yt.has(e)||he(e)}}function he(t){if(t=String(t).toLowerCase(),Yt.has(t)){let o={};return C.defaultStyle.set(t,o),o}if(C.defaultStyle.has(t))return C.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),i={};for(let o of r){if(Pt(o))continue;let s=r.getPropertyValue(o);i[o]=s}return e.removeChild(n),C.defaultStyle.set(t,i),i}function Pt(t){let e=String(t).toLowerCase();return!!(Dr.has(e)||Br.test(e)||Or.test(e))}function wt(t,e){if(e=String(e||"").toLowerCase(),Yt.has(e))return"";let n=[],r=he(e),c=(t.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(e);for(let[a,u]of Object.entries(t)){if(Pt(a)||c&&(a==="width"||a==="min-width"||a==="max-width"))continue;let l=r[a];u&&u!==l&&n.push(`${a}:${u}`)}return n.sort(),n.join(";")}function ge(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 ye(t){let e=new Map;for(let r of t){let i=C.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([s,c])=>`${s}:${c};`).sort().join("");o&&(e.has(o)||e.set(o,[]),e.get(o).push(r))}let n="";for(let[r,i]of e.entries())n+=`${i.join(",")} { ${r} }
|
|
8
|
+
`;return n}function be(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of e)n.set(i,`c${r++}`);return n}function Hr(t){try{let e=t?.ownerDocument;if(!e)return typeof window<"u"?window:null;let n=e.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let r=0;r<window.frames.length;r++)try{if(window.frames[r]?.document===e)return window.frames[r]}catch{}}catch{}return typeof window<"u"?window:null}function z(t,e=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(t instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(t,e)||n()}catch{return n()}return n()}let r=C.computedStyle.get(t);r||(r=new Map,C.computedStyle.set(t,r));let i=r.get(e);if(!i){let o=Hr(t),s=null;try{s=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(t,e):null}catch{}if(!s&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(s=window.getComputedStyle(t,e))}catch{}i=s||n(),r.set(e,i)}return i}function Gt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);for(let n of zr){let r=e[`border-${n}-style`],i=e[`border-${n}-width`];(r==="none"||r==="hidden"||i==="0px")&&(delete e[`border-${n}-style`],delete e[`border-${n}-width`],delete e[`border-${n}-color`])}return e}function St(t){let e=[],n=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e}var Xt,Yt,Ur,Or,Br,Dr,zr,we=V(()=>{X();Xt=new Set(["meta","script","noscript","title","link","template"]),Yt=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"]),Ur=["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"];Or=/(?:^|-)(animation|transition)(?:-|$)/i,Br=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Dr=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom"]);zr=["top","right","bottom","left"]});function rt(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function Se(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let t=navigator.userAgent||"",e=/iPhone|iPad|iPod/.test(t),n=navigator.maxTouchPoints>2&&/Macintosh/.test(t);return e||n}function B(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),r=/applewebkit/i.test(t),i=/mobile/i.test(t),o=!/safari/i.test(t),s=r&&i&&o,c=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),a=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),u=/ipad|iphone|ipod/.test(e)&&r;return n||s||c||a||u}function je(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var xt=V(()=>{});function R(t,e,n){let r=t&&typeof t=="object"&&(t.options||t);r&&r.debug&&(n!==void 0?console.warn("[snapdom]",e,n):console.warn("[snapdom]",e))}var xe=V(()=>{});var K=V(()=>{Ve();we();xt();Lt();xe()});var hr={};Rt(hr,{toCanvas:()=>yt});function fi(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function di(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function mi(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function pi(t){let e=[],n="",r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(e.push(n),n=""):n+=o}return n.trim()&&e.push(n),e.map(i=>i.trim()).filter(Boolean)}function hi(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let s=t[o];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let i=[];for(let o of e){if(/\binset\b/i.test(o))continue;let s=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[c="0px",a="0px",u="0px"]=s,l=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!l&&l!==",";i.push(`drop-shadow(${c} ${a} ${u}${f?` ${l}`:""})`)}return i.join(" ")}function pr(t){let e=pi(t),n=null,r=null,i=null,o=[];for(let c of e){let a=c.indexOf(":");if(a<0)continue;let u=c.slice(0,a).trim().toLowerCase(),l=c.slice(a+1).trim();u==="box-shadow"?i=l:u==="filter"?n=l:u==="-webkit-filter"?r=l:o.push([u,l])}if(i){let c=hi(i);c&&(n=n?`${n} ${c}`:c,r=r?`${r} ${c}`:c)}let s=[...o];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([c,a])=>`${c}:${a}`).join(";")}function gi(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${pr(r)}}`)}function yi(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,gi(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${pr(r)}${n}`),t}function bi(t){if(!B()||!fi(t))return t;try{let e=di(t),n=yi(e);return mi(n)}catch{return t}}async function yt(t,e){let{width:n,height:r,scale:i=1,dpr:o=1,meta:s={},backgroundColor:c}=e;t=bi(t);let a=new Image;if(a.loading="eager",a.decoding="sync",a.crossOrigin="anonymous",a.src=t,await a.decode(),B()){a.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(a);try{await new Promise(S=>requestAnimationFrame(()=>requestAnimationFrame(S)))}finally{try{a.remove()}catch{}}}let u=a.naturalWidth,l=a.naturalHeight,f=Number.isFinite(s.w0)?s.w0:u,d=Number.isFinite(s.h0)?s.h0:l,m,g,p=Number.isFinite(n),h=Number.isFinite(r);if(p&&h)m=Math.max(1,n),g=Math.max(1,r);else if(p){let S=n/Math.max(1,f);m=n,g=d*S}else if(h){let S=r/Math.max(1,d);g=r,m=f*S}else m=u,g=l;m=m*i,g=g*i;let y=document.createElement("canvas");y.width=m*o,y.height=g*o,y.style.width=`${m}px`,y.style.height=`${g}px`;let w=y.getContext("2d");return o!==1&&w.scale(o,o),c&&(w.save(),w.fillStyle=c,w.fillRect(0,0,m,g),w.restore()),w.drawImage(a,0,0,m,g),y}var Ut=V(()=>{xt()});var se={};Rt(se,{rasterize:()=>Ie});async function Ie(t,e){let n=await yt(t,e),r=new Image;return r.src=n.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=`${n.width/e.dpr}px`,r.style.height=`${n.height/e.dpr}px`,r}var Ot=V(()=>{Ut()});var Ne={};Rt(Ne,{toImg:()=>wi,toSvg:()=>wi});async function wi(t,e){let{scale:n=1,width:r,height:i,meta:o={}}=e,s=Number.isFinite(r),c=Number.isFinite(i),a=Number.isFinite(n)&&n!==1||s||c;if(B()&&a)return await Ie(t,{...e,format:"png",quality:1,meta:o});let u=new Image;if(u.decoding="sync",u.loading="eager",u.src=t,await u.decode(),s&&c)u.style.width=`${r}px`,u.style.height=`${i}px`;else if(s){let l=Number.isFinite(o.w0)?o.w0:u.naturalWidth,f=Number.isFinite(o.h0)?o.h0:u.naturalHeight,d=r/Math.max(1,l);u.style.width=`${r}px`,u.style.height=`${Math.round(f*d)}px`}else if(c){let l=Number.isFinite(o.w0)?o.w0:u.naturalWidth,f=Number.isFinite(o.h0)?o.h0:u.naturalHeight,d=i/Math.max(1,f);u.style.height=`${i}px`,u.style.width=`${Math.round(l*d)}px`}else{let l=Math.round(u.naturalWidth*n),f=Math.round(u.naturalHeight*n);if(u.style.width=`${l}px`,u.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let m=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${l}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,u.src=t}catch(d){R(e,"SVG width/height patch in toImg failed",d)}}return u}var _e=V(()=>{K();Ot()});var gr={};Rt(gr,{toBlob:()=>We});async function We(t,e){let n=e.type;if(n==="svg"){let i=decodeURIComponent(t.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await yt(t,e);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,e.quality))}var Ue=V(()=>{Ut()});var br={};Rt(br,{download:()=>Si});async function yr(t,e){let n=new File([t],e,{type:t.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:e})}catch(r){if(r.name!=="AbortError")return!1}return!0}async function Si(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),r=(e?.type||"").toLowerCase(),i=n.has(r)?r:"",o=(e?.format||i||"").toLowerCase(),s=o==="jpg"?"jpeg":o||"png",c=e?.filename||`snapdom.${s}`,a={...e||{},format:s,type:s};a.dpr=1;let u=Se();if(s==="svg"){let d=await We(t,{...a,type:"svg"});if(u&&await yr(d,c))return;let m=URL.createObjectURL(d),g=document.createElement("a");g.href=m,g.download=c,document.body.appendChild(g),g.click(),URL.revokeObjectURL(m),g.remove();return}let l=await yt(t,a);if(u){let d=`image/${s}`,m=await new Promise(g=>l.toBlob(g,d,e?.quality));if(m&&await yr(m,c))return}let f=document.createElement("a");f.href=l.toDataURL(`image/${s}`,e?.quality),f.download=c,document.body.appendChild(f),f.click(),f.remove()}var wr=V(()=>{Ue();Ut();xt()});K();K();X();var Xe=new WeakMap,It=new Map,qr=2e3,Ce=0;function Tt(){Ce++,It.size>qr&&It.clear()}var Ye=!1;function Vr(t=document.documentElement){if(!Ye){Ye=!0;try{new MutationObserver(()=>Tt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Tt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Tt),e.ready?.then(()=>Tt()).catch(()=>{}))}catch{}}}function jr(t,e={}){let n={},r=t.getPropertyValue("visibility"),i=e.excludeStyleProps;for(let f=0;f<t.length;f++){let d=t[f];if(Pt(d)||i&&(i instanceof RegExp&&i.test(d)||typeof i=="function"&&i(d)))continue;let m=t.getPropertyValue(d);(d==="background-image"||d==="content")&&m.includes("url(")&&!m.includes("data:")&&(m="none"),n[d]=m}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let f of o)if(!n[f])try{let d=t.getPropertyValue(f);d&&(n[f]=d)}catch{}let s=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let f of s)if(!n[f])try{let d=t.getPropertyValue(f);d&&(n[f]=d)}catch{}if(e.embedFonts){let f=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let d of f)if(!n[d])try{let m=t.getPropertyValue(d);m&&(n[d]=m)}catch{}}r==="hidden"&&(n.opacity="0");try{(n["content-visibility"]||t.getPropertyValue("content-visibility"))==="hidden"&&(n.visibility="hidden")}catch{}let c=parseFloat(t.getPropertyValue("border-top-width")||0)||0,a=parseFloat(t.getPropertyValue("border-right-width")||0)||0,u=parseFloat(t.getPropertyValue("border-bottom-width")||0)||0,l=parseFloat(t.getPropertyValue("border-left-width")||0)||0;if(c===0&&a===0&&u===0&&l===0){let f=(t.getPropertyValue("border-image-source")||"").trim(),d=f&&f!=="none",m=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let g of m)delete n[g];d||(n.border="none")}return n}var Ge=new WeakMap;function Xr(t){let e=Ge.get(t);return e||(e=Object.entries(t).sort((r,i)=>r[0]<i[0]?-1:r[0]>i[0]?1:0).map(([r,i])=>`${r}:${i}`).join(";"),Ge.set(t,e),e)}function Yr(t,e=null,n={}){let r=Xe.get(t);if(r&&r.epoch===Ce)return r.snapshot;let i=e||getComputedStyle(t),o=jr(i,n);return to(t,i,o),Xe.set(t,{epoch:Ce,snapshot:o}),o}function Gr(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:It,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||{}}:{session:C.session,persist:{snapshotKeyCache:It,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||e||{}}}function Kr(t,e,n){if(!(!t.style||t.style.length===0))for(let r=0;r<t.style.length;r++){let i=t.style[r],o=n.getPropertyValue(i);o&&e.style.setProperty(i,o)}}async function ot(t,e,n,r){if(t.tagName==="STYLE")return;let i=Gr(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&Vr(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Tt(),It.clear(),i.session.__bumpedForDisabled=!0);let{session:s,persist:c}=i;if(!s.styleCache.has(t)){let d=null;try{d=getComputedStyle(t)}catch{}s.styleCache.set(t,d||getComputedStyle(document.documentElement))}let a=s.styleCache.get(t);t.getAttribute?.("style")&&Kr(t,e,a);let u=Yr(t,a,i.options);if(Ke(t)){let d=a.getPropertyValue("min-width");(!d||d==="auto"||d==="0px")&&(u["min-width"]="0px")}let l=Xr(u),f=c.snapshotKeyCache.get(l);if(!f){let d=t.tagName?.toLowerCase()||"div";f=wt(u,d),c.snapshotKeyCache.set(l,f)}s.styleMap.set(e,f)}function Qr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Jr(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 Ke(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Zr(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 i=t.scrollHeight;if(i===0)return!1;let o=parseFloat(e.paddingTop)||0,s=parseFloat(e.paddingBottom)||0;return i>o+s}function to(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let r=t.tagName&&t.tagName.toLowerCase();if(!r||!["div","section","article","main","aside","header","footer","nav"].includes(r))return;let o=parseFloat(e.height);if(Number.isFinite(o)&&t.scrollHeight>0&&Math.abs(o-t.scrollHeight)>2||e.aspectRatio&&e.aspectRatio!=="none"&&e.aspectRatio!=="auto")return;let c=e.display||"";if(c.includes("flex")||c.includes("grid")||Qr(t))return;let a=e.position;if(a==="absolute"||a==="fixed"||a==="sticky"||e.transform!=="none"||Jr(e)||Ke(t))return;let u=e.overflowX||e.overflow||"visible",l=e.overflowY||e.overflow||"visible";if(u!=="visible"||l!=="visible")return;let f=e.clip;f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Zr(t,e)&&(delete n.height,delete n["block-size"])}we();var Je=["fill","stroke","color","background-color","stop-color"],Qe=new Map;function eo(t,e){let n=e+"::"+t.toLowerCase(),r=Qe.get(n);if(r)return r;let i=document,o=e==="http://www.w3.org/2000/svg"?i.createElementNS(e,t):i.createElement(t),s=i.createElement("div");s.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",s.appendChild(o),i.documentElement.appendChild(s);let c=getComputedStyle(o),a={};for(let u of Je)a[u]=c.getPropertyValue(u)||"";return s.remove(),Qe.set(n,a),a}function Ze(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&t.attributes?.length){let o=t.attributes;for(let s=0;s<o.length;s++){let c=o[s];if(c&&typeof c.value=="string"&&c.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(t)}catch{}if(r){let o=t.style;if(o&&o.length){let s=new Set;for(let c=0;c<o.length;c++){let a=o[c];if(s.has(a))continue;s.add(a);let u=o.getPropertyValue(a);if(!u||!u.includes("var("))continue;let l=i&&i.getPropertyValue(a);if(l)try{e.style.setProperty(a,l.trim(),o.getPropertyPriority(a))}catch{}}}}if(r&&t.attributes?.length){let o=t.attributes;for(let s=0;s<o.length;s++){let c=o[s];if(!c||typeof c.value!="string"||!c.value.includes("var("))continue;let a=c.name,u=i&&i.getPropertyValue(a);if(u)try{e.style.setProperty(a,u.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(t)}catch{i=null}if(!i)return;let o=t.namespaceURI||"html",s=eo(t.tagName,o);for(let c of Je){let a=i.getPropertyValue(c)||"",u=s[c]||"";if(a&&a!==u)try{e.style.setProperty(c,a.trim())}catch{}}}}K();K();X();pt();function Qt(t,e,n){return Promise.all(t.map(r=>new Promise(i=>{function o(){rt(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(r,i):o()},{fast:n})}o()})))}function no(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function ro(t,e,n=!0){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?no(r):r;return`:where(${e} ${i})`}).join(", ")}function en(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,i,o)=>{let s=ro(o,e,!0);return`${r}${i}${s}{`}),t):""}function nn(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function rn(t){let e="";try{t.querySelectorAll("style").forEach(r=>{e+=(r.textContent||"")+`
|
|
9
|
+
`});let n=t.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let i of r.cssRules)e+=i.cssText+`
|
|
10
|
+
`}catch{}}catch{}return e}function on(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 sn(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 an(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 oo(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 cn(t,e,n){let r=[];for(let i of e){let o=oo(t,i);o&&r.push(`${i}: ${o};`)}return r.length?`${n}{${r.join("")}}
|
|
11
|
+
`:""}function ln(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 io(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<e&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function so(t){let e=t.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let a=getComputedStyle(t);n=parseFloat(a.borderLeftWidth)||0,r=parseFloat(a.borderRightWidth)||0,i=parseFloat(a.borderTopWidth)||0,o=parseFloat(a.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),c=Math.max(0,Math.round(e.height-(i+o)));return{contentWidth:s,contentHeight:c,rect:e}}function Q(t){let e=0,n=0;if(t.offsetWidth>0&&(e=t.offsetWidth),t.offsetHeight>0&&(n=t.offsetHeight),e===0||n===0)try{let r=getComputedStyle(t);if(e===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(e=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(e===0||n===0)try{if(e===0){let r=parseFloat(t.getAttribute("width"));!isNaN(r)&&r>0&&(e=r)}if(n===0){let r=parseFloat(t.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((e===0||n===0)&&(t.naturalWidth||t.naturalHeight))try{e===0&&t.naturalWidth>0&&(e=t.naturalWidth),n===0&&t.naturalHeight>0&&(n=t.naturalHeight)}catch{}return{width:e,height:n}}function ao(t,e,n){let r=t.defaultView,i=r?r.scrollX:0,o=r?r.scrollY:0,s=t.body?t.body.scrollLeft:0,c=t.body?t.body.scrollTop:0,a=t.documentElement?t.documentElement.scrollLeft:0,u=t.documentElement?t.documentElement.scrollTop:0,l=t.createElement("style");return l.setAttribute("data-sd-iframe-pin",""),l.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(l),()=>{try{l.remove()}catch{}try{r&&typeof r.scrollTo=="function"&&r.scrollTo(i,o),t.body&&(t.body.scrollLeft=s,t.body.scrollTop=c),t.documentElement&&(t.documentElement.scrollLeft=a,t.documentElement.scrollTop=u)}catch{}}}async function un(t,e,n){let r=await io(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:s}=so(t),c=n?.snap;if(!c&&typeof window<"u"&&window.snapdom&&(c=window.snapdom),!c||typeof c.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let a={...n,scale:1},u=ao(r,i,o),l;try{l=await c.toPng(r.documentElement,a)}finally{u()}l.style.display="block",l.style.width=`${i}px`,l.style.height=`${o}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),ot(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(l),f}function fn(t){let{width:e,height:n}=Q(t),r=t.getBoundingClientRect(),i;try{i=window.getComputedStyle(t)}catch{}let o=i?parseFloat(i.width):NaN,s=i?parseFloat(i.height):NaN,c=Math.round(e||r.width||0),a=Math.round(n||r.height||0),u=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),l=Number.isFinite(s)&&s>0?Math.round(s):Math.max(12,a||16),f=(t.type||"text").toLowerCase()==="checkbox",d=!!t.checked,m=!!t.indeterminate,p=Math.max(Math.min(u,l),12),h="middle";try{i&&i.verticalAlign&&(h=i.verticalAlign)}catch{}let y=document.createElement("div");y.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),y.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:${h};flex-shrink:0;line-height:0;`;let w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",String(p)),w.setAttribute("height",String(p)),w.setAttribute("viewBox",`0 0 ${p} ${p}`),y.appendChild(w);function S(){let b="#0a6ed1";try{i&&(b=i.accentColor||i.color||b)}catch{}let x=2,v=x/2,A=p-x;if(w.innerHTML="",f){let k=document.createElementNS("http://www.w3.org/2000/svg","rect");if(k.setAttribute("x",String(v)),k.setAttribute("y",String(v)),k.setAttribute("width",String(A)),k.setAttribute("height",String(A)),k.setAttribute("rx","2"),k.setAttribute("ry","2"),k.setAttribute("fill",d?b:"none"),k.setAttribute("stroke",b),k.setAttribute("stroke-width",String(x)),w.appendChild(k),d){let E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d",`M ${v+2} ${p/2} L ${p/2-1} ${p-v-2} L ${p-v-2} ${v+2}`),E.setAttribute("stroke","white"),E.setAttribute("stroke-width",String(Math.max(1.5,x))),E.setAttribute("fill","none"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round"),w.appendChild(E)}else if(m){let E=document.createElementNS("http://www.w3.org/2000/svg","rect"),P=Math.max(6,A-4);E.setAttribute("x",String((p-P)/2)),E.setAttribute("y",String((p-x)/2)),E.setAttribute("width",String(P)),E.setAttribute("height",String(x)),E.setAttribute("fill",b),E.setAttribute("rx","1"),w.appendChild(E)}}else{let k=document.createElementNS("http://www.w3.org/2000/svg","circle");if(k.setAttribute("cx",String(p/2)),k.setAttribute("cy",String(p/2)),k.setAttribute("r",String((p-x)/2)),k.setAttribute("fill",d?b:"none"),k.setAttribute("stroke",b),k.setAttribute("stroke-width",String(x)),w.appendChild(k),d){let E=document.createElementNS("http://www.w3.org/2000/svg","circle"),P=Math.max(2,(p-x*2)*.35);E.setAttribute("cx",String(p/2)),E.setAttribute("cy",String(p/2)),E.setAttribute("r",String(P)),E.setAttribute("fill","white"),w.appendChild(E)}}y.style.setProperty("width",`${p}px`,"important"),y.style.setProperty("height",`${p}px`,"important"),y.style.setProperty("min-width",`${p}px`,"important"),y.style.setProperty("min-height",`${p}px`,"important")}return S(),{el:y,applyVisual:S}}var Nt=new O(80);async function _t(t){if(C.resource?.has(t))return C.resource.get(t);if(Nt.has(t))return Nt.get(t);let e=(async()=>{let n=await W(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return C.resource?.set(t,n.data),n.data})();Nt.set(t,e);try{let n=await e;return Nt.set(t,n),n}catch(n){throw Nt.delete(t),n}}var co=/\bblob:[^)"'\s]+/g;async function tn(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(co)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let i=await _t(r);n=n.split(r).join(i)}catch{}return n}function Kt(t){return typeof t=="string"&&t.startsWith("blob:")}function lo(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 uo(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function dn(t,e=null){if(!t)return;let n=e,r=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of r)try{let l=a.getAttribute("src")||a.currentSrc||"";if(Kt(l)){let d=await _t(l);a.setAttribute("src",d)}let f=a.getAttribute("srcset");if(f&&f.includes("blob:")){let d=lo(f),m=!1;for(let g of d)if(Kt(g.url))try{g.url=await _t(g.url),m=!0}catch(p){R(n,"blobUrlToDataUrl for srcset item failed",p)}m&&a.setAttribute("srcset",uo(d))}}catch(u){R(n,"resolveBlobUrls for img failed",u)}let i=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of i)try{let u="http://www.w3.org/1999/xlink",l=a.getAttribute("href")||a.getAttributeNS?.(u,"href");if(Kt(l)){let f=await _t(l);a.setAttribute("href",f),a.removeAttributeNS?.(u,"href")}}catch(u){R(n,"resolveBlobUrls for SVG image href failed",u)}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of o)try{let u=a.getAttribute("style");if(u&&u.includes("blob:")){let l=await tn(u);a.setAttribute("style",l)}}catch(u){R(n,"replaceBlobUrls in inline style failed",u)}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of s)try{let u=a.textContent||"";u.includes("blob:")&&(a.textContent=await tn(u))}catch(u){R(n,"replaceBlobUrls in style tag failed",u)}let c=["poster"];for(let a of c){let u=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let l of u)try{let f=l.getAttribute(a);Kt(f)&&l.setAttribute(a,await _t(f))}catch(f){R(n,`resolveBlobUrls for ${a} failed`,f)}}}xt();async function Wt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(t.nodeType===Node.ELEMENT_NODE){let l=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Xt.has(l))return null;if(l==="foreignobject"&&t.parentElement?.closest?.("foreignObject"))return R(e,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),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 l=document.createElement("div"),{width:f,height:d}=Q(t),m=f||t.getBoundingClientRect().width||0,g=d||t.getBoundingClientRect().height||0;return l.style.cssText=`display:inline-block;width:${m}px;height:${g}px;visibility:hidden;`,l}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let l of n.exclude)try{if(t.matches?.(l)){if(n.excludeMode==="hide"){let f=document.createElement("div"),{width:d,height:m}=Q(t),g=d||t.getBoundingClientRect().width||0,p=m||t.getBoundingClientRect().height||0;return f.style.cssText=`display:inline-block;width:${g}px;height:${p}px;visibility:hidden;`,f}else if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${l}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let l=document.createElement("div"),{width:f,height:d}=Q(t),m=f||t.getBoundingClientRect().width||0,g=d||t.getBoundingClientRect().height||0;return l.style.cssText=`display:inline-block;width:${m}px;height:${g}px;visibility:hidden;`,l}else if(n.filterMode==="remove")return null}}catch(l){console.warn("Error in filter function:",l)}if(t.tagName==="IFRAME"){let l=!1;try{l=!!(t.contentDocument||t.contentWindow?.document)}catch(f){R(e,"iframe same-origin probe failed",f)}if(l)try{return await un(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(l||console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.",t),n.placeholders){let{width:f,height:d}=Q(t),m=document.createElement("div");return m.style.cssText=`width:${f}px;height:${d}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;`,ot(t,m,e,n),m}else{let{width:f,height:d}=Q(t),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${f}px;height:${d}px;visibility:hidden;`,ot(t,m,e,n),m}}if(t.getAttribute("data-capture")==="placeholder"){let l=t.cloneNode(!1);e.nodeMap.set(l,t),ot(t,l,e,n);let f=document.createElement("div");return f.textContent=t.getAttribute("data-placeholder-text")||"",f.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",l.appendChild(f),l}if(t.tagName==="CANVAS"){let l="";try{let g=t.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),l=t.toDataURL("image/png"),!l||l==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),l=t.toDataURL("image/png"),!l||l==="data:,"){let p=document.createElement("canvas");p.width=t.width,p.height=t.height;let h=p.getContext("2d");h&&(h.drawImage(t,0,0),l=p.toDataURL("image/png"))}}}catch(g){R(e,"Canvas toDataURL failed, using empty/fallback",g)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch(g){R(e,"img decoding/loading hints failed",g)}l&&(f.src=l),f.width=t.width,f.height=t.height;let{width:d,height:m}=Q(t);return d>0&&(f.style.width=`${d}px`),m>0&&(f.style.height=`${m}px`),e.nodeMap.set(f,t),ot(t,f,e,n),f}if(t.tagName==="VIDEO"){let l="";try{let g=document.createElement("canvas");g.width=t.videoWidth||t.offsetWidth||320,g.height=t.videoHeight||t.offsetHeight||240;let p=g.getContext("2d");p&&(p.drawImage(t,0,0,g.width,g.height),l=g.toDataURL("image/png"),(!l||l==="data:,")&&(l=""))}catch(g){R(e,"Video frame capture failed, using poster fallback",g)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch{}l?f.src=l:t.poster&&(f.src=t.poster),f.width=t.videoWidth||t.offsetWidth||0,f.height=t.videoHeight||t.offsetHeight||0;let{width:d,height:m}=Q(t);return d>0&&(f.style.width=`${d}px`),m>0&&(f.style.height=`${m}px`),f.style.objectFit="contain",e.nodeMap.set(f,t),ot(t,f,e,n),f}let s;try{if(s=t.cloneNode(!1),s.attributes?.length)try{for(let l of s.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(l.value)&&s.setAttribute(l.name,l.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Ze(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){sn(t,s);try{let{width:l,height:f}=Q(t),d=Math.round(l||0),m=Math.round(f||0);d&&(s.dataset.snapdomWidth=String(d)),m&&(s.dataset.snapdomHeight=String(m))}catch(l){R(e,"getUnscaledDimensions for IMG failed",l)}try{let l=t.getAttribute("style")||"",f=window.getComputedStyle(t),d=S=>{let b=l.match(new RegExp(`${S}\\s*:\\s*([^;]+)`,"i")),x=b?b[1].trim():f.getPropertyValue(S);return/%|auto/i.test(String(x||""))},m=parseInt(s.dataset.snapdomWidth||"0",10),g=parseInt(s.dataset.snapdomHeight||"0",10),p=d("width")||!m,h=d("height")||!g;p&&m&&(s.style.width=`${m}px`),h&&g&&(s.style.height=`${g}px`);let y=f.getPropertyValue("object-fit"),w=f.getPropertyValue("object-position");y&&y!=="fill"?(s.style.objectFit=y,w&&(s.style.objectPosition=w)):(m&&(s.style.minWidth=`${m}px`),g&&(s.style.minHeight=`${g}px`))}catch(l){R(e,"IMG dimension freeze failed",l)}}}catch(l){throw console.error("[Snapdom] Failed to clone node:",t,l),l}let c=null;if(t instanceof HTMLTextAreaElement){let{width:l,height:f}=Q(t),d=l||t.getBoundingClientRect().width||0,m=f||t.getBoundingClientRect().height||0;d&&(s.style.width=`${d}px`),m&&(s.style.height=`${m}px`)}if(t instanceof HTMLInputElement){let l=(t.type||"text").toLowerCase();if((l==="checkbox"||l==="radio")&&je()){let{el:d,applyVisual:m}=fn(t);e.nodeMap.set(d,t),c=m,s=d}else 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))}if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&!t.value&&t.placeholder)try{let l=window.getComputedStyle(t,"::placeholder"),f=l&&l.color;if(f&&f!=="rgba(0, 0, 0, 0)"){let d="snapdom-ph-"+(Math.random()*1e6|0);s.classList.add(d);let m=document.createElement("style");m.textContent=`.${d}::placeholder{color:${f}!important;opacity:${l.opacity||"1"}!important;}`,s.prepend(m)}}catch{}if(t instanceof HTMLSelectElement&&(i=t.value),t instanceof HTMLTextAreaElement&&(o=t.value),t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){t.disabled&&s.setAttribute("disabled",""),t.required&&s.setAttribute("required",""),t.readOnly&&s.setAttribute("readonly","");let l=t;l.min!==void 0&&l.min!==""&&s.setAttribute("min",l.min),l.max!==void 0&&l.max!==""&&s.setAttribute("max",l.max),l.pattern!==void 0&&l.pattern!==""&&s.setAttribute("pattern",l.pattern);let f=t.getAttribute("aria-invalid");f!==null&&s.setAttribute("aria-invalid",f)}if(ot(t,s,e,n),c&&c(),t instanceof SVGElement){let l=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let f=window.getComputedStyle(t);for(let d of l){let m=f.getPropertyValue(d);m&&s.style.setProperty(d,m)}}catch{}}if(t.shadowRoot){let y=function(S,b){if(S.nodeType===Node.ELEMENT_NODE&&S.tagName==="STYLE")return b(null);Wt(S,e,n).then(x=>{b(x||null)}).catch(()=>{b(null)})};try{let S=t.shadowRoot.querySelectorAll("slot");for(let b of S){let x=[];try{x=b.assignedNodes?.({flatten:!0})||b.assignedNodes?.()||[]}catch{x=b.assignedNodes?.()||[]}for(let v of x)r.add(v)}}catch{}let l=nn(e),f=`[data-sd="${l}"]`;try{s.setAttribute("data-sd",l)}catch{}let d=rn(t.shadowRoot),m=en(d,f),g=an(d),p=cn(t,g,f);on(s,p+m,l);let h=document.createDocumentFragment(),w=await Qt(Array.from(t.shadowRoot.childNodes),y,n.fast);h.append(...w.filter(S=>!!S)),s.appendChild(h)}if(t.tagName==="SLOT"){let m=function(p,h){Wt(p,e,n).then(y=>{y&&ln(y),h(y||null)}).catch(()=>{h(null)})},l=t.assignedNodes?.({flatten:!0})||[],f=l.length>0?l:Array.from(t.childNodes),d=document.createDocumentFragment(),g=await Qt(Array.from(f),m,n.fast);return d.append(...g.filter(p=>!!p)),d}function a(l,f){if(r.has(l))return f(null);Wt(l,e,n).then(d=>{f(d||null)}).catch(()=>{f(null)})}let u=await Qt(Array.from(t.childNodes),a,n.fast);if(s.append(...u.filter(l=>!!l)),i!==null&&s instanceof HTMLSelectElement){s.value=i;for(let l of s.options)l.value===i?l.setAttribute("selected",""):l.removeAttribute("selected")}return o!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=o),s}K();Lt();X();var fo=[/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],Ct=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),Ae=[];function mo(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pn(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Ae.push(n):typeof n=="string"?Ae.push(new RegExp(mo(n),"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function J(t){let e=typeof t=="string"?t:"",n=[...fo,...Ae];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 po(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var mn=new Map;function ho(t=""){let e=Object.create(null),n=String(t||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)e[i[1].toUpperCase()]=Number(i[2]);return e}async function go(t,e,n){let r=String(t||""),i=r.toLowerCase(),o=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let c=n&&(n.FILL??n.fill),a="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?a="rounded":/\bsharp\b/.test(o)?a="sharp":/\boutlined\b/.test(o)&&(a="outlined");let u=c===1,l=null;if(u&&(a==="outlined"&&Ct.materialIconsFilled?l={url:Ct.materialIconsFilled,alias:"snapdom-mi-filled"}:a==="rounded"&&Ct.materialIconsRound?l={url:Ct.materialIconsRound,alias:"snapdom-mi-round"}:a==="sharp"&&Ct.materialIconsSharp&&(l={url:Ct.materialIconsSharp,alias:"snapdom-mi-sharp"})),!l)return{familyForMeasure:r,familyForCanvas:r};if(!mn.has(l.alias))try{let d=new FontFace(l.alias,`url(${l.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),mn.set(l.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let f=`"${l.alias}"`;return{familyForMeasure:f,familyForCanvas:f}}async function yo(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function bo(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let r=t.color?.trim();return r&&r!=="inherit"?r:"#000"}async function wo(t,{family:e="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:s=""}={}){let c=String(e||"").replace(/^['"]+|['"]+$/g,""),a=window.devicePixelRatio||1,u=ho(o),{familyForMeasure:l,familyForCanvas:f}=await go(c,s,u);await yo(f.replace(/^["']+|["']+$/g,""),r);let d=document.createElement("span");d.textContent=t,d.style.position="absolute",d.style.visibility="hidden",d.style.left="-99999px",d.style.whiteSpace="nowrap",d.style.fontFamily=l,d.style.fontWeight=String(n||"normal"),d.style.fontSize=`${r}px`,d.style.lineHeight="1",d.style.margin="0",d.style.padding="0",d.style.fontFeatureSettings="'liga' 1",d.style.fontVariantLigatures="normal",d.style.color=i,document.body.appendChild(d);let m=d.getBoundingClientRect(),g=Math.max(1,Math.ceil(m.width)),p=Math.max(1,Math.ceil(m.height));document.body.removeChild(d);let h=document.createElement("canvas");h.width=g*a,h.height=p*a;let y=h.getContext("2d");y.scale(a,a),y.font=`${n?`${n} `:""}${r}px ${f}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(t,0,0),{dataUrl:h.toDataURL(),width:g,height:p}}async function hn(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(t.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim());if(r.length===0)return 0;let i=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim()):[],o=0;for(let s=0;s<r.length;s++){let c=r[s],a=i[s]||null;try{let u=getComputedStyle(a||c),l=u.fontFamily||"Material Icons";if(!po(l))continue;let f=(a||c).textContent.trim();if(!f)continue;let d=parseInt(u.fontSize,10)||24,m=u.fontWeight&&u.fontWeight!=="normal"?u.fontWeight:"normal",g=bo(u),p=u.fontVariationSettings&&u.fontVariationSettings!=="normal"?u.fontVariationSettings:"",h=(a||c).className||"",{dataUrl:y,width:w,height:S}=await wo(f,{family:l,weight:m,fontSize:d,color:g,variation:p,className:h});c.textContent="";let b=c.ownerDocument.createElement("img");b.src=y,b.alt=f,b.style.height=`${d}px`,b.style.width=`${Math.max(1,Math.round(w/S*d))}px`,b.style.objectFit="contain",b.style.verticalAlign=getComputedStyle(c).verticalAlign||"baseline",c.appendChild(b),o++}catch{}}return o}pt();async function bn(t,e,n,r=32,i="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let c=s.getBoundingClientRect(),a=Math.ceil(c.width),u=Math.ceil(c.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=Math.max(1,a*o),l.height=Math.max(1,u*o);let f=l.getContext("2d");return f.scale(o,o),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=i,f.fillText(t,0,0),{dataUrl:l.toDataURL(),width:a,height:u}}var wn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),So=["katex","mathjax","mathml"];function ve(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!wn.has(n.toLowerCase()))return n}return""}function xo(t){if(!t)return[];let e=[];for(let n of t.split(",")){let r=n.trim().replace(/^['"]+|['"]+$/g,"");r&&(wn.has(r.toLowerCase())||e.push(r))}return e}function Jt(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 Zt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Co(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Ao(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=Jt(n[1]),o=Jt(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=Jt(e);return{min:r,max:r}}function ko(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function vo(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(o,s),max:Math.max(o,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function Eo(t){return!t||typeof t!="string"?"":t.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function Mo(t,e,n=[]){if(!t)return!1;try{let r=new URL(t,location.href);if(r.origin===location.origin)return!0;let o=r.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>o.endsWith(a))||n.some(a=>o===a.toLowerCase()||o.endsWith("."+a.toLowerCase())))return!0;let c=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(c)||/\.woff2?(\b|$)/.test(c)||So.some(a=>c.includes(a)))return!0;for(let a of e){let u=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),f=Eo(a);if(c.includes(u)||c.includes(l)||f&&c.includes(f))return!0}return!1}catch{return!1}}function Fo(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function gn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return n;let s=o;try{s=new URL(o,e||location.href).href}catch{}return`url("${s}")`})}var ke=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,te=4;async function $o(t,e,n){if(!t)return t;let r=new Set;function i(c,a){try{return new URL(c,a||location.href).href}catch{return c}}async function o(c,a,u=0){if(u>te)return console.warn(`[snapDOM] @import depth exceeded (${te}) at ${a}`),c;let l="",f=0,d;for(;d=ke.exec(c);){l+=c.slice(f,d.index),f=ke.lastIndex;let m=(d[2]||d[4]||"").trim(),g=i(m,a);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let p="";try{let h=await W(g,{as:"text",useProxy:n,silent:!0});h.ok&&typeof h.data=="string"&&(p=h.data)}catch{}p?(p=gn(p,g),p=await o(p,g,u+1),l+=`
|
|
12
|
+
/* inlined: ${g} */
|
|
13
|
+
${p}
|
|
14
|
+
`):l+=d[0]}return l+=c.slice(f),l}let s=gn(t,e||location.href);return s=await o(s,e||location.href,0),s}var Sn=/url\((["']?)([^"')]+)\1\)/g,Ro=/@font-face[^{}]*\{[^}]*\}/g;function xn(t){if(!t)return[];let e=[],n=t.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let i=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],s=i[2],c=a=>{if(!a.includes("?"))return parseInt(a,16);let u=parseInt(a.replace(/\?/g,"0"),16),l=parseInt(a.replace(/\?/g,"F"),16);return[u,l]};if(s){let a=c(o),u=c(s),l=Array.isArray(a)?a[0]:a,f=Array.isArray(u)?u[1]:u;e.push([Math.min(l,f),Math.max(l,f)])}else{let a=c(o);Array.isArray(a)?e.push([a[0],a[1]]):e.push([a,a])}}return e}function Cn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,i]of e)if(n>=r&&n<=i)return!0;return!1}function Ee(t,e){let n=[];if(!t)return n;for(let r of t.matchAll(Sn)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,e||location.href).href}catch{}n.push(i)}}return n}async function An(t,e,n=""){let r=t;for(let i of t.matchAll(Sn)){let o=mt(i[0]);if(!o)continue;let s=o;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!J(s)){if(C.resource?.has(s)){C.font?.add(s),r=r.replace(i[0],`url(${C.resource.get(s)})`);continue}if(!C.font?.has(s))try{let c=await W(s,{as:"dataURL",useProxy:n,silent:!0});if(c.ok&&typeof c.data=="string"){let a=c.data;C.resource?.set(s,a),C.font?.add(s),r=r.replace(i[0],`url(${a})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Lo(t){if(!t.length)return null;let e=(c,a)=>t.some(([u,l])=>!(l<c||u>a)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),i=e(880,1023),o=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function yn(t={}){let e=new Set((t.families||[]).map(i=>String(i).toLowerCase())),n=new Set((t.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((t.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(e.size&&e.has(i.family.toLowerCase()))return!0;if(n.size)for(let s of i.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Lo(o);if(s&&r.has(s))return!0}return!1}}function Po(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of t.match(e)||[]){let s=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",c=ve(s),a=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),u=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),l=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),d=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),m=Ee(d,location.href),g=m.length?m.map(h=>String(h).toLowerCase()).sort().join("|"):d.toLowerCase(),p=[String(c||"").toLowerCase(),a,u,l,f.toLowerCase(),g].join("|");n.has(p)||(n.add(p),r.push(o))}if(r.length===0)return t;let i=0;return t.replace(e,()=>r[i++]||"")}function To(t,e,n,r,i){let o=Array.from(t||[]).sort().join("|"),s=e?JSON.stringify({families:(e.families||[]).map(l=>String(l).toLowerCase()).sort(),domains:(e.domains||[]).map(l=>String(l).toLowerCase()).sort(),subsets:(e.subsets||[]).map(l=>String(l).toLowerCase()).sort()}):"",c=(n||[]).map(l=>`${(l.family||"").toLowerCase()}::${l.weight||"normal"}::${l.style||"normal"}::${l.src||""}`).sort().join("|"),a=r||"",u=(i||[]).map(l=>String(l).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${s}::lf=${c}::px=${a}::fd=${u}`}async function kn(t,e,n,r){let i;try{i=t.cssRules||[]}catch{return}let o=(s,c)=>{try{return new URL(s,c||location.href).href}catch{return s}};for(let s of i){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let c=s.href?o(s.href,e):e;if(r.depth>=te){console.warn(`[snapDOM] CSSOM import depth exceeded (${te}) at ${c}`);continue}if(c&&r.visitedSheets.has(c)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${c}`);continue}c&&r.visitedSheets.add(c);let a={...r,depth:(r.depth||0)+1};await kn(s.styleSheet,c,n,a);continue}if(s.type===CSSRule.FONT_FACE_RULE){let c=(s.style.getPropertyValue("font-family")||"").trim(),a=ve(c);if(!a||J(a))continue;let u=(s.style.getPropertyValue("font-weight")||"400").trim(),l=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),d=(s.style.getPropertyValue("src")||"").trim(),m=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(a,l,u,f))continue;let g=xn(m);if(!Cn(r.usedCodepoints,g))continue;let p={family:a,weightSpec:u,styleSpec:l,stretchSpec:f,unicodeRange:m,srcRaw:d,srcUrls:Ee(d,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(p,g))continue;if(/url\(/i.test(d)){let h=await An(d,e||location.href,r.useProxy);await n(`@font-face{font-family:${a};src:${h};font-style:${l};font-weight:${u};font-stretch:${f};${m?`unicode-range:${m};`:""}}`)}else await n(`@font-face{font-family:${a};src:${d};font-style:${l};font-weight:${u};font-stretch:${f};${m?`unicode-range:${m};`:""}}`)}}}async function ee({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let s=new Map;for(let h of t){let[y,w,S,b]=String(h).split("__");if(!y)continue;let x=s.get(y)||[];x.push({w:parseInt(w,10),s:S,st:parseInt(b,10)}),s.set(y,x)}function c(h,y,w,S){if(!s.has(h))return!1;let b=s.get(h),x=Ao(w),v=ko(y),A=vo(S),k=x.min!==x.max,E=x.min,P=L=>v.kind==="normal"&&L==="normal"||v.kind!=="normal"&&(L==="italic"||L==="oblique"),N=!1;for(let L of b){let _=k?L.w>=x.min&&L.w<=x.max:L.w===E,D=P(Zt(L.s)),F=L.st>=A.min&&L.st<=A.max;if(_&&D&&F){N=!0;break}}if(N)return!0;if(!k)for(let L of b){let _=P(Zt(L.s)),D=L.st>=A.min&&L.st<=A.max;if(Math.abs(E-L.w)<=300&&_&&D)return!0}if(!k&&v.kind==="normal"&&b.some(_=>Zt(_.s)!=="normal"))for(let _ of b){let D=Math.abs(E-_.w)<=300,F=_.st>=A.min&&_.st<=A.max;if(D&&F)return!0}return!1}let a=yn(n),u=To(t,n,r,i,o);if(C.resource?.has(u))return C.resource.get(u);let l=Fo(t),f=[],d=ke;for(let h of document.querySelectorAll("style")){let y=h.textContent||"";for(let w of y.matchAll(d)){let S=(w[2]||w[4]||"").trim();if(!S||J(S))continue;!!document.querySelector(`link[rel="stylesheet"][href="${S}"]`)||f.push(S)}}f.length&&await Promise.all(f.map(h=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${h}"]`))return y(null);let w=document.createElement("link");w.rel="stylesheet",w.href=h,w.setAttribute("data-snapdom","injected-import"),w.onload=()=>y(w),w.onerror=()=>y(null),document.head.appendChild(w)})));let m="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(h=>!!h.href);for(let h of g)try{if(J(h.href))continue;let y="",w=!1;try{w=new URL(h.href,location.href).origin===location.origin}catch{}if(!w){let b=Array.isArray(o)?o:[];if(!Mo(h.href,l,b))continue}if(w){let b=Array.from(document.styleSheets).find(x=>x.href===h.href);if(b)try{let x=b.cssRules||[];y=Array.from(x).map(v=>v.cssText).join("")}catch{}}if(!y){let b=await W(h.href,{as:"text",useProxy:i});if(b?.ok&&typeof b.data=="string"&&(y=b.data),J(h.href))continue}y=await $o(y,h.href,i);let S="";for(let b of y.match(Ro)||[]){let x=(b.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),v=ve(x);if(!v||J(v))continue;let A=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),k=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),E=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),P=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(b.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=Ee(N,h.href);if(!c(v,k,A,E))continue;let _=xn(P);if(!Cn(e,_))continue;let D={family:v,weightSpec:A,styleSpec:k,stretchSpec:E,unicodeRange:P,srcRaw:N,srcUrls:L,href:h.href};if(n&&a(D,_))continue;let F=/url\(/i.test(N)?await An(b,h.href,i):b;S+=F}S.trim()&&(m+=S)}catch{console.warn("[snapDOM] Failed to process stylesheet:",h.href)}let p={requiredIndex:s,usedCodepoints:e,faceMatchesRequired:c,simpleExcluder:n?yn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let h of document.styleSheets)if(!(h.href&&g.some(y=>y.href===h.href)))try{let y=h.href||location.origin+"/";y&&p.visitedSheets.add(y),await kn(h,y,async w=>{m+=w},p)}catch{}try{for(let h of document.fonts||[]){if(!h||!h.family||h.status!=="loaded"||!h._snapdomSrc)continue;let y=String(h.family).replace(/^['"]+|['"]+$/g,"");if(J(y)||!s.has(y)||n?.families&&n.families.some(S=>String(S).toLowerCase()===y.toLowerCase()))continue;let w=h._snapdomSrc;if(!String(w).startsWith("data:")){if(C.resource?.has(h._snapdomSrc))w=C.resource.get(h._snapdomSrc),C.font?.add(h._snapdomSrc);else if(!C.font?.has(h._snapdomSrc))try{let S=await W(h._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(S.ok&&typeof S.data=="string")w=S.data,C.resource?.set(h._snapdomSrc,w),C.font?.add(h._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",h._snapdomSrc);continue}}m+=`@font-face{font-family:'${y}';src:url(${w});font-style:${h.style||"normal"};font-weight:${h.weight||"normal"};}`}}catch{}for(let h of r){if(!h||typeof h!="object")continue;let y=String(h.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||J(y)||!s.has(y)||n?.families&&n.families.some(A=>String(A).toLowerCase()===y.toLowerCase()))continue;let w=h.weight!=null?String(h.weight):"normal",S=h.style!=null?String(h.style):"normal",b=h.stretchPct!=null?`${h.stretchPct}%`:"100%",x=String(h.src||""),v=x;if(!v.startsWith("data:")){if(C.resource?.has(x))v=C.resource.get(x),C.font?.add(x);else if(!C.font?.has(x))try{let A=await W(x,{as:"dataURL",useProxy:i,silent:!0});if(A.ok&&typeof A.data=="string")v=A.data,C.resource?.set(x,v),C.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}m+=`@font-face{font-family:'${y}';src:url(${v});font-style:${S};font-weight:${w};font-stretch:${b};}`}return m&&(m=Po(m),C.resource?.set(u,m)),m}function At(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let c=xo(s.fontFamily);if(c.length)for(let a of c){let u=(l,f,d)=>`${a}__${Jt(l)}__${Zt(f)}__${Co(d)}`;e.add(u(s.fontWeight,s.fontStyle,s.fontStretch))}};r(getComputedStyle(t));let i=getComputedStyle(t,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(t,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let s=n.currentNode,c=getComputedStyle(s);r(c);let a=getComputedStyle(s,"::before");a&&a.content&&a.content!=="none"&&r(a);let u=getComputedStyle(s,"::after");u&&u.content&&u.content!=="none"&&r(u)}return e}function ne(t){let e=new Set,n=i=>{if(i)for(let o of i)e.add(o.codePointAt(0))},r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let i=r.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let o=i;for(let s of["::before","::after"]){let a=getComputedStyle(o,s)?.getPropertyValue("content");if(!(!a||a==="none"))if(/^"/.test(a)||/^'/.test(a))n(a.slice(1,-1));else{let u=a.match(/\\[0-9A-Fa-f]{1,6}/g);if(u)for(let l of u)try{e.add(parseInt(l.slice(1),16))}catch{}}}}}return e}async function kt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let i=document.createElement("div");i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let o of n){let s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${o}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",i.appendChild(s)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,e);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}X();function Fn(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Io(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function vn(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 En(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)),i="";for(let[o,s]of n)for(;r>=o;)i+=s,r-=o;return e?i:i.toLowerCase()}function Mn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(t);case"decimal-leading-zero":{let n=Math.abs(t);return(t<0?"-":"")+(n<10?"0":"")+String(n)}case"lower-alpha":return vn(t,!1);case"upper-alpha":return vn(t,!0);case"lower-roman":return En(t,!1);case"upper-roman":return En(t,!0);default:return String(t)}}function $n(t){let e=()=>C?.session?.__counterEpoch??0,n=e(),r=new WeakMap,i=t instanceof Document?t.documentElement:t,o=d=>d&&d.tagName==="LI",s=d=>{let m=0,g=d?.parentElement;if(!g)return 0;for(let p of g.children){if(p===d)break;p.tagName==="LI"&&m++}return m},c=d=>{let m=new Map;for(let[g,p]of d)m.set(g,p.slice());return m},a=(d,m,g)=>{let p=c(d),h;try{h=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(h&&h!=="none")for(let S of h.split(",")){let b=S.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!x)continue;let A=m.get(x);if(A&&A.length){let k=A.slice();k.push(v),p.set(x,k)}else p.set(x,[v])}let y;try{y=g.style?.counterSet||getComputedStyle(g).counterSet}catch{}if(y&&y!=="none")for(let S of y.split(",")){let b=S.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!x)continue;let A=p.get(x)||[];A.length===0&&A.push(0),A[A.length-1]=v,p.set(x,A)}let w;try{w=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(w&&w!=="none")for(let S of w.split(",")){let b=S.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!x)continue;let A=p.get(x)||[];A.length===0&&A.push(0),A[A.length-1]+=v,p.set(x,A)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let b=g.parentElement,x=1;if(b&&b.tagName==="OL"){let A=b.getAttribute("start"),k=Number.isFinite(Number(A))?Number(A):1,E=s(g),P=g.getAttribute("value");x=Number.isFinite(Number(P))?Number(P):k+E}else x=1+s(g);let v=p.get("list-item")||[];v.length===0&&v.push(0),v[v.length-1]=x,p.set("list-item",v)}}catch{}return p},u=(d,m,g)=>{let p=a(g,m,d);r.set(d,p);let h=p;for(let w of d.children)h=u(w,p,h);let y=new Map;for(let[w,S]of g){let b=S.length,x=h.get(w);y.set(w,x&&x.length?x.slice(0,b):S.slice())}for(let[w,S]of h)!y.has(w)&&S.length&&!m.has(w)&&y.set(w,S.slice(0,1));return y},l=new Map;u(i,l,l);function f(){let d=e();if(d!==n){n=d;let m=new Map;u(i,m,m)}}return{get(d,m){f();let g=r.get(d)?.get(m);return g&&g.length?g[g.length-1]:0},getStack(d,m){f();let g=r.get(d)?.get(m);return g?g.slice():[]}}}function Rn(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=t.replace(r,(o,s,c)=>{let a=String(c).split(",").map(u=>u.trim());if(s==="counter"){let u=a[0]?.replace(/^["']|["']$/g,""),l=(a[1]||"decimal").toLowerCase(),f=n.get(e,u);return Mn(f,l)}else{let u=a[0]?.replace(/^["']|["']$/g,""),l=a[1]?.replace(/^["']|["']$/g,"")??"",f=(a[2]||"decimal").toLowerCase(),d=n.getStack(e,u);return d.length?d.map(g=>Mn(g,f)).join(l):""}});return Io(i)}catch{return"- "}}pt();X();var vt=new WeakMap,Ln=1e3;function No(t,e){let n=Nn(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=Tn(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):Tn(t)}function Me(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Nn(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,r=0;for(let o=0;o<e.length;o++){let s=e[o];if(s.tagName==="STYLE"){let c=s.textContent?s.textContent.length:0;n+=`S${c}|`;let a=s.sheet,u=a?Me(a):null;u&&(r+=u.length)}else{let c=s.getAttribute("href")||"",a=s.getAttribute("media")||"all";n+=`L${c}|m:${a}|`;let u=s.sheet,l=u?Me(u):null;l&&(r+=l.length)}}let i=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Pn(t,e,n){let r=Me(t);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],s=o&&o.cssText?o.cssText:"";n.budget--;for(let c of e)if(s.includes(c))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let c=0;c<o.cssRules.length&&n.budget>0;c++){let a=o.cssRules[c],u=a&&a.cssText?a.cssText:"";n.budget--;for(let l of e)if(u.includes(l))return!0}if(n.budget<=0)return!1}return!1}function Tn(t=document){let e=Nn(t),n=vt.get(t);if(n&&n.fingerprint===e)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=t.querySelectorAll("style");for(let s=0;s<i.length;s++){let c=i[s].textContent||"";for(let a of r)if(c.includes(a))return vt.set(t,{fingerprint:e,result:!0}),!0}let o=t.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let s={budget:Ln};try{for(let c of o)if(Pn(c,r,s))return vt.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let s=t.querySelectorAll('style,link[rel~="stylesheet"]'),c={budget:Ln};for(let a=0;a<s.length&&c.budget>0;a++){let u=s[a],l=null;if(u.tagName,l=u.sheet||null,l&&Pn(l,r,c))return vt.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(vt.set(t,{fingerprint:e,result:!0}),!0):(vt.set(t,{fingerprint:e,result:!1}),!1)}var Et=new WeakMap,In=-1;function _o(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Wo(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):_o(t)}function Fe(t,e){let n=t.parentElement,r=n?Et.get(n):null;return r?{get(i,o){let s=e.get(i,o),c=r.get(o);return typeof c=="number"?Math.max(s,c):s},getStack(i,o){let s=e.getStack(i,o);if(!s.length)return s;let c=r.get(o);if(typeof c=="number"){let a=s.slice();return a[a.length-1]=Math.max(a[a.length-1],c),a}return s}}:e}function $e(t,e,n){let r=new Map;function i(a){let u=[];if(!a||a==="none")return u;for(let l of String(a).split(",")){let f=l.trim().split(/\s+/),d=f[0],m=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;d&&u.push({name:d,num:m})}return u}let o=i(e?.counterReset),s=i(e?.counterIncrement);function c(a){if(r.has(a))return r.get(a).slice();let u=n.getStack(t,a);u=u.length?u.slice():[];let l=o.find(d=>d.name===a);if(l){let d=Number.isFinite(l.num)?l.num:0;u=u.length?[...u,d]:[d]}let f=s.find(d=>d.name===a);if(f){let d=Number.isFinite(f.num)?f.num:1;u.length===0&&(u=[0]),u[u.length-1]+=d}return r.set(a,u.slice()),u}return{get(a,u){let l=c(u);return l.length?l[l.length-1]:0},getStack(a,u){return c(u)},__incs:s}}function Uo(t,e,n){let r;try{r=z(t,e)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=Fe(t,n),s=$e(t,r,o),c=Fn(i)?Rn(i,t,s):i;return{text:Wo(c),incs:s.__incs||[]}}async function re(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;let i=t.ownerDocument||document;if(!No(i,n))return;let o=C?.session?.__counterEpoch??0;if(In!==o&&(Et=new WeakMap,n&&(n.__counterCtx=null),In=o),!n.__counterCtx)try{n.__counterCtx=$n(t.ownerDocument||document)}catch(a){R(n,"buildCounterContext failed",a)}let s=n.__counterCtx;for(let a of["::before","::after","::first-letter"])try{let u=z(t,a);if(!u||u.content==="none"&&u.backgroundImage==="none"&&u.backgroundColor==="transparent"&&(u.borderStyle==="none"||parseFloat(u.borderWidth)===0)&&(!u.transform||u.transform==="none")&&u.display==="inline")continue;if(a==="::first-letter"){let $=z(t),T=($?.display||"").toLowerCase();if(T.includes("flex")||T.includes("grid")||!(u.color!==$.color||u.fontSize!==$.fontSize||u.fontWeight!==$.fontWeight||u.fontFamily!==$.fontFamily||u.fontStyle!==$.fontStyle||u.textTransform!==$.textTransform||u.float!==$.float||u.paddingTop!==$.paddingTop||u.paddingRight!==$.paddingRight||u.paddingBottom!==$.paddingBottom||u.paddingLeft!==$.paddingLeft||u.marginTop!==$.marginTop||u.marginRight!==$.marginRight||u.marginBottom!==$.marginBottom||u.marginLeft!==$.marginLeft))continue;let U=Array.from(e.childNodes).find(Ht=>Ht.nodeType===Node.TEXT_NODE&&Ht.textContent?.trim().length>0);if(!U)continue;let Y=U.textContent,tt=Y.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],bt=Y.slice(tt?.length||0);if(!tt||/[\uD800-\uDFFF]/.test(tt))continue;let dt=document.createElement("span");dt.textContent=tt,dt.dataset.snapdomPseudo="::first-letter";let Bt=Gt(u),ce=wt(Bt,"span");n.styleMap.set(dt,ce);let Dt=document.createTextNode(bt);e.replaceChild(Dt,U),e.insertBefore(dt,Dt);continue}let f=u.content??"",d=f===""||f==="none"||f==="normal",{text:m,incs:g}=Uo(t,a,s),p=u.backgroundImage,h=u.backgroundColor,y=u.fontFamily,w=parseInt(u.fontSize)||32,S=parseInt(u.fontWeight)||!1,b=u.color||"#000",x=u.borderStyle,v=parseFloat(u.borderWidth),A=u.transform,k=J(y),E=!d&&m!=="",P=p&&p!=="none",N=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",L=x&&x!=="none"&&v>0,_=A&&A!=="none";if(!(E||P||N||L||_)){if(g&&g.length&&t.parentElement){let $=Et.get(t.parentElement)||new Map;for(let{name:T}of g){if(!T)continue;let H=Fe(t,s),Y=$e(t,z(t,a),H).get(t,T);$.set(T,Y)}Et.set(t.parentElement,$)}continue}let F=document.createElement("span");F.dataset.snapdomPseudo=a,F.style.pointerEvents="none";let ut=Gt(u),ft=wt(ut,"span");if(n.styleMap.set(F,ft),k&&m&&m.length===1){let{dataUrl:$,width:T,height:H}=await bn(m,y,S,w,b),U=document.createElement("img");U.src=$,U.style=`height:${w}px;width:${T/H*w}px;object-fit:contain;`,F.appendChild(U),e.dataset.snapdomHasIcon="true"}else if(m&&m.startsWith("url(")){let $=mt(m);if($?.trim())try{let T=await W(lt($),{as:"dataURL",useProxy:r.useProxy});if(T?.ok&&typeof T.data=="string"){let H=document.createElement("img");H.src=T.data,H.style=`width:${w}px;height:auto;object-fit:contain;`,F.appendChild(H)}}catch(T){console.error(`[snapdom] Error in pseudo ${a} for`,t,T)}}else!k&&E&&(F.textContent=m);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=u.backgroundRepeat,F.style.backgroundSize=u.backgroundSize,u.backgroundPositionX&&u.backgroundPositionY?(F.style.backgroundPositionX=u.backgroundPositionX,F.style.backgroundPositionY=u.backgroundPositionY):F.style.backgroundPosition=u.backgroundPosition,F.style.backgroundOrigin=u.backgroundOrigin,F.style.backgroundClip=u.backgroundClip,F.style.backgroundAttachment=u.backgroundAttachment,F.style.backgroundBlendMode=u.backgroundBlendMode}catch{}if(P)try{let $=St(p),T=await Promise.all($.map(ht));F.style.backgroundImage=T.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${a}`,$)}N&&(F.style.backgroundColor=h);let it=F.childNodes.length>0||F.textContent?.trim()!==""||P||N||L||_;if(g&&g.length&&t.parentElement){let $=Et.get(t.parentElement)||new Map,T=Fe(t,s),H=$e(t,z(t,a),T);for(let{name:U}of g){if(!U)continue;let Y=H.get(t,U);$.set(U,Y)}Et.set(t.parentElement,$)}if(!it)continue;a==="::before"?(e.dataset.snapdomHasBefore="1",e.insertBefore(F,e.firstChild)):(e.dataset.snapdomHasAfter="1",e.appendChild(F))}catch(u){console.warn(`[snapdom] Failed to capture ${a} for`,t,u)}let c=Array.from(e.children).filter(a=>!a.dataset.snapdomPseudo);if(n.nodeMap)for(let a of c){let u=n.nodeMap.get(a);u instanceof Element&&await re(u,a,n,r)}else{let a=Array.from(t.children);for(let u=0;u<Math.min(a.length,c.length);u++)await re(a[u],c[u],n,r)}}function _n(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,r=e||n,i=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,s=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],c=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),a="http://www.w3.org/1999/xlink",u=b=>{if(!b||!b.getAttribute)return null;let x=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(a,"href"):null);if(x)return x;let v=b.attributes;if(!v)return null;for(let A=0;A<v.length;A++){let k=v[A];if(!k||!k.name)continue;if(k.name==="href")return k.value;let E=k.name.indexOf(":");if(E!==-1&&k.name.slice(E+1)==="href")return k.value}return null},l=new Set(Array.from(t.querySelectorAll("[id]")).map(b=>b.id)),f=new Set,d=!1,m=(b,x=null)=>{if(!b)return;o.lastIndex=0;let v;for(;v=o.exec(b);){d=!0;let A=(v[1]||"").trim();A&&(l.has(A)||(f.add(A),x&&!x.has(A)&&x.add(A)))}},g=b=>{let x=b.querySelectorAll("use");for(let k of x){let E=u(k);if(!E||!E.startsWith("#"))continue;d=!0;let P=E.slice(1).trim();P&&!l.has(P)&&f.add(P)}let A=b.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let k of A){m(k.getAttribute("style")||"");for(let E of s)m(k.getAttribute(E))}};for(let b of i)g(b);if(!d)return;let p=t.querySelector("svg.inline-defs-container");p||(p=n.createElementNS("http://www.w3.org/2000/svg","svg"),p.classList.add("inline-defs-container"),p.setAttribute("aria-hidden","true"),p.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(p,t.firstChild||null));let h=p.querySelector("defs")||null,y=b=>{if(!b||l.has(b))return null;let x=c(b),v=A=>{let k=r.querySelector(A);return k&&!t.contains(k)?k:null};return v(`svg defs > *#${x}`)||v(`svg > symbol#${x}`)||v(`*#${x}`)};if(!f.size)return;let w=new Set(f),S=new Set;for(;w.size;){let b=w.values().next().value;if(w.delete(b),!b||l.has(b)||S.has(b))continue;let x=y(b);if(!x){S.add(b);continue}h||(h=n.createElementNS("http://www.w3.org/2000/svg","defs"),p.appendChild(h));let v=x.cloneNode(!0);v.id||v.setAttribute("id",b),h.appendChild(v),S.add(b),l.add(b);let A=[v,...v.querySelectorAll("*")];for(let k of A){let E=u(k);if(E&&E.startsWith("#")){let N=E.slice(1).trim();N&&!l.has(N)&&!S.has(N)&&w.add(N)}let P=k.getAttribute?.("style")||"";P&&m(P,w);for(let N of s){let L=k.getAttribute?.(N);L&&m(L,w)}}}}X();function Un(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),i=t.clientHeight,o="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let c=s.currentNode,a=getComputedStyle(c),u=a.position;if(u!=="sticky"&&u!=="-webkit-sticky")continue;let l=Wn(a.top),f=Wn(a.bottom);if(l==null&&f==null)continue;let d=Oo(c,t),m=Bo(e,d,o);if(!m)continue;let g=c.getBoundingClientRect(),p=g.width,h=g.height,y=g.left-r.left;if(!(p>0&&h>0)||!Number.isFinite(y))continue;let w=l!=null?l+n:n+(i-h-f);if(!Number.isFinite(w))continue;let S=Number.parseInt(a.zIndex,10),b=Number.isFinite(S),x=b?Math.max(S,1)+1:2,v=b?S-1:0,A=m.cloneNode(!1);A.setAttribute(o,"1"),A.style.position="sticky",A.style.left=`${y}px`,A.style.top=`${w}px`,A.style.width=`${p}px`,A.style.height=`${h}px`,A.style.visibility="hidden",A.style.zIndex=String(v),A.style.overflow="hidden",A.style.background="transparent",A.style.boxShadow="none",A.style.filter="none",m.parentElement?.insertBefore(A,m),m.style.position="absolute",m.style.left=`${y}px`,m.style.top=`${w}px`,m.style.bottom="auto",m.style.zIndex=String(x),m.style.pointerEvents="none"}}function Wn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Oo(t,e){let n=[];for(let r=t;r&&r!==e;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function Bo(t,e,n){let r=t;for(let i=0;i<e.length;i++)if(r=Do(r,n)[e[i]],!r)return null;return r instanceof HTMLElement?r:null}function Do(t,e){let n=[],r=t.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(e)||n.push(o)}return n}function On(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,i=e.borderStyle,o=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,c=i==="none"||parseFloat(o)===0;s&&c&&(t.style.border=`${r} solid transparent`)}function Bn(t){let e=[];try{let n=t.querySelectorAll("*");for(let r of n){if(!(r instanceof HTMLElement))continue;let i=r.style.contentVisibility||"",o=getComputedStyle(r),s=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(s==="auto"||s==="hidden")&&(e.push({el:r,original:i}),r.style.contentVisibility="visible")}if(t instanceof HTMLElement){let r=getComputedStyle(t),i=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(e.push({el:t,original:t.style.contentVisibility||""}),t.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:n,original:r}of e)try{n.style.contentVisibility=r}catch{}}}async function Dn(t,e={}){let n={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap,options:e},r,i="",o="";On(t);let s=Bn(t);try{_n(t)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await Wt(t,n,e)}catch(l){throw console.warn("deepClone failed:",l),l}finally{s()}try{await re(t,r,n,e)}catch(l){console.warn("inlinePseudoElements failed:",l)}await dn(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let f of l)o+=f.textContent||"",f.remove()}catch(l){R(n,"Failed to extract shadow CSS from style[data-sd]",l)}let c=be(n.styleMap);i=Array.from(c.entries()).map(([l,f])=>`.${f}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,f]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",f.replace(/;/g,"; "));continue}let d=c.get(f);d&&l.classList.add(d);let m=l.style?.backgroundImage,g=l.dataset?.snapdomHasIcon;m&&m!=="none"&&(l.style.backgroundImage=m),g&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,f]of n.nodeMap.entries()){let d=f.scrollLeft,m=f.scrollTop;if((d||m)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";try{let h=l.querySelectorAll("*");for(let y of h){if(!(y instanceof HTMLElement))continue;let w=y.style.position;if(w==="fixed"||w==="absolute"){let S=parseFloat(y.style.top)||0,b=parseFloat(y.style.left)||0;y.style.top=`${S+m}px`,y.style.left=`${b+d}px`,w==="fixed"&&(y.style.position="absolute")}}}catch{}let p=document.createElement("div");for(p.style.transform=`translate(${-d}px, ${-m}px)`,p.style.willChange="transform",p.style.display="inline-block",p.style.width="100%";l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p)}}let u=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Un(t,u),t===n.nodeMap.get(r)){let l=n.styleCache.get(t)||z(t);n.styleCache.set(t,l);let f=fe(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=f||""}for(let[l,f]of n.nodeMap.entries())f.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}pt();var Hn="http://www.w3.org/1999/xlink";function Ho(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(Hn,"href"):null)}function zo(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,r=parseInt(t.getAttribute("width")||"",10)||0,i=parseInt(t.getAttribute("height")||"",10)||0,o=parseFloat(t.style?.width||"")||0,s=parseFloat(t.style?.height||"")||0,c=e||o||r||t.width||t.naturalWidth||100,a=n||s||i||t.height||t.naturalHeight||100;return{width:c,height:a}}async function zn(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async c=>{if(!c.getAttribute("src")){let m=c.currentSrc||c.src||"";m&&c.setAttribute("src",m)}c.removeAttribute("srcset"),c.removeAttribute("sizes");let a=c.src||"";if(!a)return;let u=await W(a,{as:"dataURL",useProxy:e.useProxy});if(u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")){c.src=u.data,c.width||(c.width=c.naturalWidth||100),c.height||(c.height=c.naturalHeight||100);return}let{width:l,height:f}=zo(c),{fallbackURL:d}=e||{};if(d)try{let m=typeof d=="function"?await d({width:l,height:f,src:a,element:c}):d;if(m){let g=await W(m,{as:"dataURL",useProxy:e.useProxy});if(g?.ok&&typeof g.data=="string"){c.src=g.data,c.width||(c.width=l),c.height||(c.height=f);return}}}catch{}if(e.placeholders!==!1){let m=document.createElement("div");m.style.cssText=[`width:${l}px`,`height:${f}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${f}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),m.textContent="img",c.replaceWith(m)}else{let m=document.createElement("div");m.style.cssText=`display:inline-block;width:${l}px;height:${f}px;visibility:hidden;`,c.replaceWith(m)}},i=6;for(let c=0;c<n.length;c+=i){let a=n.slice(c,c+i).map(r);await Promise.allSettled(a)}let o=Array.from(t.querySelectorAll("image")),s=async c=>{let a=Ho(c);if(!a||a.startsWith("data:")||a.startsWith("blob:"))return;let u=await W(a,{as:"dataURL",useProxy:e.useProxy});u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")&&(c.setAttribute("href",u.data),c.removeAttribute("xlink:href"),typeof c.removeAttributeNS=="function"&&c.removeAttributeNS(Hn,"href"))};for(let c=0;c<o.length;c+=i){let a=o.slice(c,c+i).map(s);await Promise.allSettled(a)}}K();async function oe(t,e,n,r={}){let i=[[t,e]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],s=["mask-position","mask-size","mask-repeat","mask-mode","mask-composite","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","-webkit-mask-composite","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],c=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],a=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[u,l]=i.shift();if(!l)continue;let f=n.get(u)||z(u);n.has(u)||n.set(u,f);let d=(()=>{let p=f.getPropertyValue("border-image"),h=f.getPropertyValue("border-image-source");return p&&p!=="none"||h&&h!=="none"})();for(let p of c){let h=f.getPropertyValue(p);h&&l.style.setProperty(p,h)}for(let p of o){let h=f.getPropertyValue(p);if(p==="background-image"&&(!h||h==="none")){let S=f.getPropertyValue("background");S&&/url\s*\(/.test(S)&&(h=St(S).filter(b=>/url\s*\(/.test(b)).join(", ")||h)}if(!h||h==="none")continue;let y=St(h),w=await Promise.all(y.map(S=>ht(S,r)));w.some(S=>S&&S!=="none"&&!/^url\(undefined/.test(S))&&l.style.setProperty(p,w.join(", "))}for(let p of s){let h=f.getPropertyValue(p);!h||h==="initial"||l.style.setProperty(p,h)}if(d)for(let p of a){let h=f.getPropertyValue(p);!h||h==="initial"||l.style.setProperty(p,h)}let m=u.shadowRoot?Array.from(u.shadowRoot.children).filter(p=>p.tagName!=="STYLE"):Array.from(u.children),g=Array.from(l.children).filter(p=>!(p.dataset?.snapdomPseudo||p.tagName==="STYLE"&&p.dataset?.sd));for(let p=0;p<Math.min(m.length,g.length);p++)i.push([m[p],g[p]])}}K();X();function qn(t){if(!t)return()=>{};let e=[];function n(r){let i=qo(r);i&&e.push(i);for(let o of r.children||[])n(o)}return n(t),()=>e.forEach(r=>r())}function qo(t){if(!t)return()=>{};let e=Vo(t);if(e<=0)return()=>{};if(!Yo(t))return()=>{};let n=getComputedStyle(t),r=Math.round(jo(n)*e+Xo(n)),i=t.textContent??"",o=i;if(t.scrollHeight<=r+.5)return()=>{};let s=0,c=i.length,a=-1;for(;s<=c;){let u=s+c>>1;t.textContent=i.slice(0,u)+"\u2026",t.scrollHeight<=r+.5?(a=u,s=u+1):c=u-1}return t.textContent=(a>=0?i.slice(0,a):"")+"\u2026",()=>{t.textContent=o}}function Vo(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 jo(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 Xo(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Yo(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Mt=[];function ie(t){if(!t)return null;if(Array.isArray(t)){let[e,n]=t;return typeof e=="function"?e(n):e}if(typeof t=="object"&&"plugin"in t){let{plugin:e,options:n}=t;return typeof e=="function"?e(n):e}return typeof t=="function"?t():t}function Vn(...t){let e=t.flat();for(let n of e){let r=ie(n);r&&(Mt.some(i=>i&&i.name&&r.name&&i.name===r.name)||Mt.push(r))}}function jn(t){return(t&&Array.isArray(t.plugins)?t.plugins:Mt)||Mt}async function Z(t,e,n){let r=n,i=jn(e);for(let o of i){let s=o&&typeof o[t]=="function"?o[t]:null;if(!s)continue;let c=await s(e,r);typeof c<"u"&&(r=c)}return r}async function Xn(t,e,n){let r=[],i=jn(e);for(let o of i){let s=o&&typeof o[t]=="function"?o[t]:null;if(!s)continue;let c=await s(e,n);typeof c<"u"&&r.push(c)}return r}function Go(t){let e=[];if(Array.isArray(t))for(let n of t){let r=ie(n);if(!r||!r.name)continue;let i=e.findIndex(o=>o&&o.name===r.name);i>=0&&e.splice(i,1),e.push(r)}for(let n of Mt)n&&n.name&&!e.some(r=>r.name===n.name)&&e.push(n);return Object.freeze(e)}function Yn(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=Go(e)),t}function Gn(){return Mt.slice()}function gt(t){return!!(!t||t.startsWith("data:")||t.startsWith("blob:")||/^data:image\/(gif|png|svg)/.test(t)&&t.length<200)}function Ko(t,e){return!t||!(t instanceof Element)?!1:t.querySelector("picture")?!0:e?!!t.querySelector("img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]"):!1}function Qo(t,e){let n=t.currentSrc||"";if(n&&!gt(n))return n;let r=e.querySelectorAll("source[srcset]"),i=null;for(let o of r){let s=o.getAttribute("srcset");if(!s||gt(s))continue;let c=o.getAttribute("media");if(c)try{if(window.matchMedia(c).matches)return s.split(",")[0].trim().split(/\s+/)[0]}catch{}i||(i=s.split(",")[0].trim().split(/\s+/)[0])}return i}function Jo(t){let e=[t.getAttribute("data-src"),t.getAttribute("data-lazy-src"),t.getAttribute("data-original"),t.getAttribute("data-hi-res-src")];for(let r of e)if(r&&!gt(r))return r;let n=t.getAttribute("data-srcset")||t.getAttribute("data-lazy-srcset");if(n){let r=n.split(",")[0].trim().split(/\s+/)[0];if(r&&!gt(r))return r}return null}function Zo(t={}){let e=t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{};return{timeout:e.timeout??5e3,concurrency:e.concurrency??4,resolveLazySrc:e.resolveLazySrc!==!1,silent:e.silent??!1,useProxy:typeof t.useProxy=="string"?t.useProxy:""}}async function Kn(t,e={}){if(!t||!(t instanceof Element)||e.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:r,resolveLazySrc:i,silent:o,useProxy:s}=Zo(e);if(!Ko(t,i))return null;let c=[],a=[];async function u(d){let m=new AbortController,g=setTimeout(()=>m.abort(),n);try{let p=await fetch(d,{credentials:"include",signal:m.signal});if(!p.ok&&s){let y=s.includes("{url}")?s.replace("{url}",encodeURIComponent(d)):s.endsWith("?")?`${s}${encodeURIComponent(d)}`:`${s}${s.includes("?")?"&":"?"}url=${encodeURIComponent(d)}`;p=await fetch(y,{signal:m.signal})}if(!p.ok)return null;let h=await p.blob();return await new Promise((y,w)=>{let S=new FileReader;S.onload=()=>y(S.result),S.onerror=w,S.readAsDataURL(h)})}catch{return null}finally{clearTimeout(g)}}async function l(d){for(let m=0;m<d.length;m+=r){let g=d.slice(m,m+r);await Promise.allSettled(g.map(p=>p()))}}let f=t.querySelectorAll("picture");for(let d of f){let m=d.querySelector("img");if(!m)continue;let g=m.getAttribute("src")||"";if(!gt(g))continue;let p=Qo(m,d);p&&a.push(async()=>{let h=await u(p);if(!h){o||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${p.slice(0,60)}`);return}let y=m.getAttribute("src"),w=m.getAttribute("srcset"),S=m.getAttribute("sizes"),b=[];m.src=h,m.setAttribute("src",h),m.removeAttribute("srcset"),m.removeAttribute("sizes");let x=d.querySelectorAll("source");for(let v of x)b.push({el:v,parent:v.parentElement,next:v.nextSibling}),v.remove();c.push(()=>{y!==null?m.setAttribute("src",y):m.removeAttribute("src"),w!==null&&m.setAttribute("srcset",w),S!==null&&m.setAttribute("sizes",S);for(let{el:v,parent:A,next:k}of b)A&&A.insertBefore(v,k)})})}if(i){let d=t.querySelectorAll("img");for(let m of d){if(m.closest("picture")&>(m.getAttribute("src")||""))continue;let g=m.getAttribute("src")||"",p=Jo(m);p&>(g)&&a.push(async()=>{let h=await u(p);if(!h)return;let y=m.getAttribute("src");m.src=h,m.setAttribute("src",h),m.removeAttribute("srcset"),m.removeAttribute("sizes"),c.push(()=>{y!==null?m.setAttribute("src",y):m.removeAttribute("src")})})}}return a.length===0?null:(await l(a),async function(){for(let m of c)try{m()}catch{}})}K();function Qn(t,e,n={}){if(!t||!e||!e.style)return;let r=getComputedStyle(t);try{e.style.boxShadow="none"}catch(s){R(n,"stripRootShadows boxShadow",s)}try{e.style.textShadow="none"}catch(s){R(n,"stripRootShadows textShadow",s)}try{e.style.outline="none"}catch(s){R(n,"stripRootShadows outline",s)}let o=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch(s){R(n,"stripRootShadows filter",s)}}function ti(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let r of n)r.remove()}function ei(t,e={}){let{stripFrameworkDirectives:n=!0}=e,r=new Set(["xml","xlink"]),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let s of Array.from(o.attributes)){let c=s.name;if(c.includes("@")){o.removeAttribute(c);continue}if(c.includes(":")){let a=c.split(":",1)[0];if(!r.has(a)){o.removeAttribute(c);continue}}if(n&&(c.startsWith("x-")||c.startsWith("v-")||c.startsWith(":")||c.startsWith("on:")||c.startsWith("bind:")||c.startsWith("let:")||c.startsWith("class:"))){o.removeAttribute(c);continue}}}}function Jn(t,e={}){t&&(ei(t,e),ti(t))}function ni(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function ri(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function oi(t,e){if(!(t instanceof Element)||ni(t)||ri(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=e.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||e.transform&&e.transform!=="none")}function Zn(t,e,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let s=i.childElementCount>o.childElementCount,c=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,c),s&&oi(i,c)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let l=c.overflowY||c.overflowBlock||"visible",f=c.overflowX||c.overflowInline||"visible";(l!=="visible"||f!=="visible")&&(o.style.overflow="visible")}let a=Array.from(i.children),u=Array.from(o.children);for(let l=0;l<Math.min(a.length,u.length);l++)r(a[l],u[l])}r(t,e)}function ii(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed")}function si(t,e){if(!(t instanceof Element))return!1;if(t.getAttribute("data-capture")==="exclude"&&e?.excludeMode==="remove")return!0;if(Array.isArray(e?.exclude))for(let n of e.exclude)try{if(t.matches(n))return e.excludeMode==="remove"}catch(r){R(e,"exclude selector match failed",r)}return!1}function tr(t,e){let n=getComputedStyle(t),r=t.getBoundingClientRect(),i=1/0,o=-1/0,s=!1,c=Array.from(t.children);for(let m of c){if(si(m,e)||!ii(m))continue;let g=m.getBoundingClientRect(),p=g.top-r.top,h=g.bottom-r.top;h<=p||(p<i&&(i=p),h>o&&(o=h),s=!0)}let a=s?Math.max(0,o-i):0,u=parseFloat(n.borderTopWidth)||0,l=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingBottom)||0;return u+l+f+d+a}var M=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t,ai=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Re(t,e=new Set){let n="";if(!t)return n;for(let r=0;r<t.length;r++){let i=t[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Re(i.styleSheet.cssRules,e);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=Re(i.cssRules,e);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(ai.test(o)){let s=i.cssText;s&&!e.has(s)&&(e.add(s),n+=s)}}}catch{}}return n}function er(t){if(!t||!t.styleSheets)return"";let e=new Set,n="";for(let r of Array.from(t.styleSheets))try{let i=r.cssRules;i&&(n+=Re(i,e))}catch{}return n}function nr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(c=>c.trim()),r=0,i=0,o=0,s=0;for(let c of n){let a=c.match(/-?\d+(\.\d+)?px/g)?.map(p=>parseFloat(p))||[];if(a.length<2)continue;let[u,l,f=0,d=0]=a,m=Math.abs(u)+f+d,g=Math.abs(l)+f+d;i=Math.max(i,m+Math.max(u,0)),s=Math.max(s,m+Math.max(-u,0)),o=Math.max(o,g+Math.max(l,0)),r=Math.max(r,g+Math.max(-l,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(o),left:Math.ceil(s)}}function rr(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function or(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0),n=parseFloat(t.outlineOffset||"0")||0,r=e+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function ir(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,s=0,c=!1;for(let a of n){c=!0;let u=a.match(/-?\d+(?:\.\d+)?px/gi)?.map(p=>parseFloat(p))||[],[l=0,f=0,d=0]=u,m=Math.abs(l)+d,g=Math.abs(f)+d;i=Math.max(i,m+Math.max(l,0)),s=Math.max(s,m+Math.max(-l,0)),o=Math.max(o,g+Math.max(f,0)),r=Math.max(r,g+Math.max(-f,0))}return{bleed:{top:M(r),right:M(i),bottom:M(o),left:M(s)},has:c}}function sr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let c=fr(t);if(c.a===1&&c.b===0&&c.c===0&&c.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}function i(c,a,u,l){let f=Math.sqrt(c*c+a*a)||0,d=0,m=0;if(f>0){let g=c/f,p=a/f;d=g*u+p*l;let h=u-g*d,y=l-p*d;m=Math.sqrt(h*h+y*y)||0,m>0?d=d/m:d=0}return{a:f,b:0,c:d*m,d:m}}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let c=o[1].split(",").map(a=>parseFloat(a.trim()));if(c.length===6&&c.every(Number.isFinite)){let[a,u,l,f]=c,d=i(a,u,l,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}let s=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(s){let c=s[1].split(",").map(a=>parseFloat(a.trim()));if(c.length===16&&c.every(Number.isFinite)){let a=c[0],u=c[1],l=c[4],f=c[5],d=i(a,u,l,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}try{let c=new DOMMatrix(r),a=i(c.a,c.b,c.c,c.d);try{e.style.transform=`matrix(${a.a}, ${a.b}, ${a.c}, ${a.d}, 0, 0)`}catch{}return a}catch{return null}}function Pe(t,e,n,r,i){let o=n.a,s=n.b,c=n.c,a=n.d,u=n.e||0,l=n.f||0;function f(y,w){let S=y-r,b=w-i,x=o*S+c*b,v=s*S+a*b;return x+=r+u,v+=i+l,[x,v]}let d=[f(0,0),f(t,0),f(0,e),f(t,e)],m=1/0,g=1/0,p=-1/0,h=-1/0;for(let[y,w]of d)y<m&&(m=y),w<g&&(g=w),y>p&&(p=y),w>h&&(h=w);return{minX:m,minY:g,maxX:p,maxY:h,width:p-m,height:h-g}}function ar(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],s=(c,a)=>{let u=c.toLowerCase();return u==="left"||u==="top"?0:u==="center"?a/2:u==="right"||u==="bottom"?a:u.endsWith("px")?parseFloat(u)||0:u.endsWith("%")?(parseFloat(u)||0)*a/100:/^-?\d+(\.\d+)?$/.test(u)&&parseFloat(u)||0};return{ox:s(i,e),oy:s(o,n)}}function cr(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let i=a=>{try{return typeof n.has=="function"&&!n.has(a)||typeof n.get!="function"?null:n.get(a)}catch{return null}},o=i("rotate");if(o)if(o.angle){let a=o.angle;e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit}else o.unit?e.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:e.rotate=String(o);else{let a=getComputedStyle(t);e.rotate=a.rotate&&a.rotate!=="none"?a.rotate:"0deg"}let s=i("scale");if(s){let a="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,u="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:a;e.scale=`${a} ${u}`}else{let a=getComputedStyle(t);e.scale=a.scale&&a.scale!=="none"?a.scale:null}let c=i("translate");if(c){let a="x"in c&&"value"in c.x?c.x.value:Array.isArray(c)?c[0]?.value:0,u="y"in c&&"value"in c.y?c.y.value:Array.isArray(c)?c[1]?.value:0,l="x"in c&&c.x?.unit?c.x.unit:"px",f="y"in c&&c.y?.unit?c.y.unit:"px";e.translate=`${a}${l} ${u}${f}`}else{let a=getComputedStyle(t);e.translate=a.translate&&a.translate!=="none"?a.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}var Le=null;function ci(){if(Le)return Le;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),Le=t,t}function lr(t){let e=ci(),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=fr(n);return e.removeChild(n),r}function ur(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let i=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",o=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(i||o||s)}function fr(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function li(t){if(Array.isArray(t.plugins)){for(let e of t.plugins)if(ie(e)?.name==="picture-resolver")return!0}return Gn().some(e=>e?.name==="picture-resolver")}async function Te(t,e){if(!t)throw new Error("Element cannot be null or undefined");Vt(e.cache);let n=e.fast,r=e.outerTransforms!==!1,i=!!e.outerShadows,o={element:t,options:e,plugins:e.plugins},s,c,a,u="",l="",f,d,m=null;await Z("beforeSnap",o);let g=null;e.resolvePicturePlaceholders!==!1&&!li(e)&&(g=await Kn(o.element,o.options)),await Z("beforeClone",o);let p=qn(o.element);try{({clone:s,classCSS:c,styleCache:a}=await Dn(o.element,o.options)),!r&&s&&(m=sr(o.element,s)),!i&&s&&Qn(o.element,s,o.options)}finally{p()}if(o={clone:s,classCSS:c,styleCache:a,...o},await Z("afterClone",o),g&&await g(),Jn(o.clone),o.options?.excludeMode==="remove")try{Zn(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await hn(o.clone,o.element)}catch{}await new Promise(b=>{rt(async()=>{await zn(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{rt(async()=>{await oe(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),e.embedFonts&&await new Promise(b=>{rt(async()=>{let x=At(o.element),v=ne(o.element);if(B()){let A=new Set(Array.from(x).map(k=>String(k).split("__")[0]).filter(Boolean));await kt(A,1)}u=await ee({required:x,usedCodepoints:v,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),b()},{fast:n})});let h=ge(o.clone).sort(),y=h.join(",");C.baseStyle.has(y)?l=C.baseStyle.get(y):await new Promise(b=>{rt(()=>{l=ye(h),C.baseStyle.set(y,l),b()},{fast:n})});let w=er(o.element?.ownerDocument||document);o={fontsCSS:u,baseCSS:l,scrollbarCSS:w,...o},await Z("beforeRender",o),await new Promise(b=>{rt(()=>{let x=z(o.element),v=o.element.getBoundingClientRect(),A=Math.max(1,M(o.element.offsetWidth||parseFloat(x.width)||v.width||1)),k=Math.max(1,M(o.element.offsetHeight||parseFloat(x.height)||v.height||1)),E=o.element.ownerDocument||document;if(o.element===E.body||o.element===E.documentElement){let q=Math.max(o.element.scrollHeight||0,E.documentElement?.scrollHeight||0,E.body?.scrollHeight||0),j=Math.max(o.element.scrollWidth||0,E.documentElement?.scrollWidth||0,E.body?.scrollWidth||0);q>0&&(k=Math.max(k,M(q))),j>0&&(A=Math.max(A,M(j)));try{let et=(o.scrollbarCSS||"").length+(o.baseCSS||"").length+(o.fontsCSS||"").length+(o.classCSS||"").length,G=C.measureHints.get(o.element);if(G&&G.cssLen===et&&G.w0===A)G.csh>0&&(k=Math.max(k,M(G.csh))),G.csw>0&&(A=Math.max(A,M(G.csw)));else{let nt=E.createElement("div");nt.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+A+"px!important;overflow:visible!important;visibility:hidden!important;";let qt=E.createElement("style");qt.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,nt.appendChild(qt),nt.appendChild(o.clone.cloneNode(!0)),E.body.appendChild(nt);let $t=nt.scrollHeight,ct=nt.scrollWidth;E.body.removeChild(nt),C.measureHints.set(o.element,{cssLen:et,w0:A,csh:$t,csw:ct}),$t>0&&(k=Math.max(k,M($t))),ct>0&&(A=Math.max(A,M(ct)))}}catch{}}if(o.options?.excludeMode==="remove"){let q=tr(o.element,o.options);Number.isFinite(q)&&q>0&&(k=Math.max(1,Math.min(k,M(q+1))))}let N=(q,j=NaN)=>{let et=typeof q=="string"?parseFloat(q):q;return Number.isFinite(et)?et:j},L=N(o.options.width),_=N(o.options.height),D=A,F=k,ut=Number.isFinite(L),ft=Number.isFinite(_),ae=k>0?A/k:1;ut&&ft?(D=Math.max(1,M(L)),F=Math.max(1,M(_))):ut?(D=Math.max(1,M(L)),F=Math.max(1,M(D/(ae||1)))):ft?(F=Math.max(1,M(_)),D=Math.max(1,M(F*(ae||1)))):(D=A,F=k);let it=0,$=0,T=A,H=k;if(!r&&m&&Number.isFinite(m.a)){let q={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},j=Pe(A,k,q,0,0);it=M(j.minX),$=M(j.minY),T=M(j.maxX),H=M(j.maxY)}else if(r&&dr(o.element)){let j=x.transform&&x.transform!=="none"?x.transform:"",et=cr(o.element),G=lr({baseTransform:j,rotate:et.rotate||"0deg",scale:et.scale,translate:et.translate}),{ox:nt,oy:qt}=ar(x,A,k),$t=G.is2D?G:new DOMMatrix(G.toString()),ct=Pe(A,k,$t,nt,qt);it=M(ct.minX),$=M(ct.minY),T=M(ct.maxX),H=M(ct.maxY)}let U=nr(x),Y=rr(x),Ft=or(x),tt=ir(x),bt=i?{top:M(U.top+Y.top+Ft.top+tt.bleed.top),right:M(U.right+Y.right+Ft.right+tt.bleed.right),bottom:M(U.bottom+Y.bottom+Ft.bottom+tt.bleed.bottom),left:M(U.left+Y.left+Ft.left+tt.bleed.left)}:{top:0,right:0,bottom:0,left:0};it=M(it-bt.left),$=M($-bt.top),T=M(T+bt.right),H=M(H+bt.bottom);let dt=Math.max(1,M(T-it)),Bt=Math.max(1,M(H-$)),ce=ut||ft?M(D/A):1,Dt=ft||ut?M(F/k):1,Ht=Math.max(1,M(dt*ce)),Cr=Math.max(1,M(Bt*Dt)),Oe="http://www.w3.org/2000/svg",Ar=B()&&dr(o.element)?1:0,st=M(Ar+(r?0:1)),at=document.createElementNS(Oe,"foreignObject"),kr=M(it),vr=M($);at.setAttribute("x",String(M(-(kr-st)))),at.setAttribute("y",String(M(-(vr-st)))),at.setAttribute("width",String(M(A+st*2))),at.setAttribute("height",String(M(k+st*2))),at.style.overflow="visible";let Be=document.createElement("style"),Er="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";Be.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+Er+o.classCSS,at.appendChild(Be);let zt=document.createElement("div");zt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),zt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${M(A)}px;height:${M(k)}px`,zt.appendChild(o.clone),at.appendChild(zt);let Mr=new XMLSerializer().serializeToString(at),le=M(dt+st*2),ue=M(Bt+st*2),De=ut||ft;e.meta={w0:A,h0:k,vbW:le,vbH:ue,targetW:D,targetH:F};let Fr=B()&&De?le:M(Ht+st*2),$r=B()&&De?ue:M(Cr+st*2),Rr=parseFloat(z(E.documentElement)?.fontSize)||16;d=`<svg xmlns="${Oe}" width="${Fr}" height="${$r}" viewBox="0 0 ${le} ${ue}" font-size="${Rr}px">`+Mr+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,o={svgString:d,dataURL:f,...o},b()},{fast:n})}),await Z("afterRender",o);let S=document.getElementById("snapdom-sandbox");return S&&S.style.position==="absolute"&&S.remove(),o.dataURL}function dr(t){return ur(t)}X();function mr(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=He(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,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],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??(["jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(t.safariWarmupAttempts??3)|0)),excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1,pictureResolver:t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{}}}xt();xe();K();pt();X();async function ui(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,i=e.cache??e.cacheOpt??"full";Vt(i);try{await document.fonts?.ready}catch{}try{pe()}catch{}C.session=C.session||{},C.session.styleCache||(C.session.styleCache=new WeakMap),C.image=C.image||new O(100),C.background=C.background||new O(100);try{await oe(t,void 0,C.session.styleCache,{useProxy:r})}catch{}let o=[],s=[];try{if(t&&t.nodeType===1){let a=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];s=[t,...a],o=[],t.tagName==="IMG"&&t.getAttribute("src")&&o.push(t),o.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(o=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let c=[];for(let a of o){let u=a?.currentSrc||a?.src;if(u&&!C.image.has(u)){let l=Promise.resolve().then(async()=>{let f=await W(u,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&C.image.set(u,f.data)}).catch(()=>{});c.push(l)}}for(let a of s){let u="";try{u=a?.style?.backgroundImage||"",(!u||u==="none")&&(u=z(a).backgroundImage)}catch{}if(u&&u!=="none"){let l=u.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let f of l){let d=Promise.resolve().then(()=>ht(f,{...e,useProxy:r})).catch(()=>{});c.push(d)}}}if(n)try{let a=At(t),u=ne(t);if(typeof B=="function"?B():!!B){let f=new Set(Array.from(a).map(d=>String(d).split("__")[0]).filter(Boolean));await kt(f,3)}await ee({required:a,usedCodepoints:u,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r,fontStylesheetDomains:e.fontStylesheetDomains})}catch{}await Promise.allSettled(c)}function xi(...t){return Vn(...t),I}var I=Object.assign(Ai,{plugins:xi}),xr=Symbol("snapdom.internal"),Ci=Symbol("snapdom.internal.silent"),Sr=!1;async function Ai(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=mr(e);if(Yn(n,e&&e.plugins),B()&&(n.embedFonts===!0||vi(t))){if(n.embedFonts)try{let i=At(t),o=new Set([...i].map(s=>String(s).split("__")[0]).filter(Boolean));await kt(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await ki(t,e)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&pn(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>I.toPng(r,i),toSvg:(r,i)=>I.toSvg(r,i)}),I.capture(t,n,xr)}I.capture=async(t,e,n)=>{if(n!==xr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Te(t,e),i={img:async(p,h)=>{let{toImg:y}=await Promise.resolve().then(()=>(_e(),Ne));return y(r,{...p,...h||{}})},svg:async(p,h)=>{let{toSvg:y}=await Promise.resolve().then(()=>(_e(),Ne));return y(r,{...p,...h||{}})},canvas:async(p,h)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(Ut(),hr));return y(r,{...p,...h||{}})},blob:async(p,h)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Ue(),gr));return y(r,{...p,...h||{}})},png:async(p,h)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Ot(),se));return y(r,{...p,...h||{},format:"png"})},jpeg:async(p,h)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Ot(),se));return y(r,{...p,...h||{},format:"jpeg"})},webp:async(p,h)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Ot(),se));return y(r,{...p,...h||{},format:"webp"})},download:async(p,h)=>{let{download:y}=await Promise.resolve().then(()=>(wr(),br));return y(r,{...p,...h||{}})}},o={};for(let p of["img","svg","canvas","blob","png","jpeg","webp"])o[p]=async h=>i[p](e,{...h||{},[Ci]:!0});o.jpg=o.jpeg;let s={...e,export:{url:r},exports:o},c=await Xn("defineExports",s),a=Object.assign({},...c.filter(p=>p&&typeof p=="object").reverse()),u={...i,...a};u.jpeg&&!u.jpg&&(u.jpg=(p,h)=>u.jpeg(p,h));function l(p,h){let y={...e,...h||{}};return(p==="jpeg"||p==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let f=!1,d=Promise.resolve();async function m(p,h){let y=async()=>{let w=u[p];if(!w)throw new Error(`[snapdom] Unknown export type: ${p}`);let S=l(p,h),b={...e,export:{type:p,options:S,url:r}};await Z("beforeExport",b);let x=await w(b,S);return await Z("afterExport",b,x),f||(f=!0,await Z("afterSnap",e)),x};return d=d.then(y)}let g={url:r,toRaw:()=>r,to:(p,h)=>m(p,h),toImg:p=>m("img",p),toSvg:p=>m("svg",p),toCanvas:p=>m("canvas",p),toBlob:p=>m("blob",p),toPng:p=>m("png",p),toJpg:p=>m("jpg",p),toWebp:p=>m("webp",p),download:p=>m("download",p)};for(let p of Object.keys(u)){let h="to"+p.charAt(0).toUpperCase()+p.slice(1);g[h]||(g[h]=y=>m(p,y))}return g};I.toRaw=(t,e)=>I(t,e).then(n=>n.toRaw());I.toImg=(t,e)=>I(t,e).then(n=>n.toImg());I.toSvg=(t,e)=>I(t,e).then(n=>n.toSvg());I.toCanvas=(t,e)=>I(t,e).then(n=>n.toCanvas());I.toBlob=(t,e)=>I(t,e).then(n=>n.toBlob());I.toPng=(t,e)=>I(t,{...e,format:"png"}).then(n=>n.toPng());I.toJpg=(t,e)=>I(t,{...e,format:"jpeg"}).then(n=>n.toJpg());I.toWebp=(t,e)=>I(t,{...e,format:"webp"}).then(n=>n.toWebp());I.download=(t,e)=>I(t,e).then(n=>n.download());async function ki(t,e){if(Sr)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Te(t,n)}catch(i){R(e,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),r&&await new Promise(i=>{let o=new Image;try{o.decoding="sync",o.loading="eager"}catch(s){R(e,"safariWarmup img hints failed",s)}o.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",o.src=r,document.body.appendChild(o),(async()=>{try{typeof o.decode=="function"&&await o.decode()}catch(c){R(e,"safariWarmup img.decode failed",c)}let s=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-s<900;)await new Promise(c=>setTimeout(c,200));await new Promise(c=>requestAnimationFrame(c));try{let c=document.createElement("canvas");c.width=Math.max(1,o.naturalWidth||10),c.height=Math.max(1,o.naturalHeight||10);let a=c.getContext("2d");a&&a.drawImage(o,0,0)}catch{}await new Promise(c=>requestAnimationFrame(c));try{o.remove()}catch(c){R(e,"safariWarmup img.remove failed",c)}i()})()}),t.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){R(e,"safariWarmup canvas poke failed",o)}}),Sr=!0}function vi(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,r=getComputedStyle(n),i=r.backgroundImage&&r.backgroundImage!=="none",o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(i||o||n.tagName==="CANVAS")return!0}return!1}export{ui as preCache,I as snapdom};
|