@zumer/snapdom 2.0.0-dev.1 → 2.0.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- var S={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function vt(t="soft"){switch(S.session.__counterEpoch=(S.session.__counterEpoch||0)+1,t){case"auto":{S.session.styleMap=new Map,S.session.nodeMap=new Map;return}case"soft":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap,S.computedStyle=new WeakMap,S.baseStyle=new Map,S.defaultStyle=new Map,S.image=new Map,S.background=new Map,S.resource=new Map,S.font=new Set;return}default:{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}}}function et(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function jt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(s=>s.trim());return r.length!==6?`matrix(${o})`:(r[4]="0",r[5]="0",`matrix(${r.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(s=>s.trim());return r.length!==16?`matrix3d(${o})`:(r[12]="0",r[13]="0",`matrix3d(${r.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function J(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function dn(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function s(a,l,c){if(r>=n)return;let i=Date.now();(o.get(l)||0)>i||(o.set(l,i+e),r++,a==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(a,l){s("warn",a,l)},errorOnce(a,l){s("error",a,l)},reset(){o.clear(),r=0}}}var me=dn("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Vt=new Map,$t=new Map;function mn(t){return/^data:|^blob:|^about:blank$/i.test(t)}function pn(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,r=new URL(o||".",n),s=new URL(t,n);if(s.origin===r.origin)return!0;let a=s.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function hn(t,e){if(!e||mn(t)||pn(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function gn(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",J(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}${J(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function pe(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function yn(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function P(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",s=e.errorTTL??8e3,a=e.headers||{},l=!!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[,d="",w=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],y=/;base64/i.test(d)?atob(w):decodeURIComponent(w),x=new Uint8Array([...y].map(C=>C.charCodeAt(0))),k=new Blob([x],{type:(d||"").split(";")[0]||""});return{ok:!0,data:k,status:200,url:t,fromCache:!1,mime:k.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let d=await fetch(t);if(!d.ok)return{ok:!1,data:null,status:d.status,url:t,fromCache:!1,reason:"http_error"};let w=await d.blob(),g=w.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await pe(w),status:d.status,url:t,fromCache:!1,mime:g}:n==="text"?{ok:!0,data:await w.text(),status:d.status,url:t,fromCache:!1,mime:g}:{ok:!0,data:w,status:d.status,url:t,fromCache:!1,mime:g}}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 c=yn(t,{as:n,timeout:o,useProxy:r,errorTTL:s}),i=$t.get(c);if(i&&i.until>Date.now())return{...i.result,fromCache:!0};i&&$t.delete(c);let f=Vt.get(c);if(f)return f;let m=hn(t,r)?gn(t,r):t,p=e.credentials;if(!p)try{let d=typeof location<"u"&&location.href?location.href:"http://localhost/",w=new URL(t,d);p=typeof location<"u"&&w.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,b=setTimeout(()=>h.abort("timeout"),o),u=(async()=>{try{let d=await fetch(m,{signal:h.signal,credentials:p,headers:a});if(!d.ok){let y={ok:!1,data:null,status:d.status,url:m,fromCache:!1,reason:"http_error"};if(s>0&&$t.set(c,{until:Date.now()+s,result:y}),!l){let x=`${d.status} ${d.statusText||""}`.trim();me.warnOnce(`http:${d.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${x} while fetching ${n} ${t}`)}return e.onError&&e.onError(y),y}if(n==="text")return{ok:!0,data:await d.text(),status:d.status,url:m,fromCache:!1};let w=await d.blob(),g=w.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await pe(w),status:d.status,url:m,fromCache:!1,mime:g}:{ok:!0,data:w,status:d.status,url:m,fromCache:!1,mime:g}}catch(d){let w=d&&typeof d=="object"&&"name"in d&&d.name==="AbortError"?String(d.message||"").includes("timeout")?"timeout":"abort":"network",g={ok:!1,data:null,status:0,url:m,fromCache:!1,reason:w};if(!/^blob:/i.test(t)&&s>0&&$t.set(c,{until:Date.now()+s,result:g}),!l){let y=`${w}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,x=w==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:w==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;me.errorOnce(y,x)}return e.onError&&e.onError(g),g}finally{clearTimeout(b),Vt.delete(c)}})();return Vt.set(c,u),u}function nt(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}async function ot(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=et(t);if(!o)return t;let r=J(o);if(S.background.has(r)){let s=S.background.get(r);return s?`url("${s}")`:"none"}try{let s=await P(r,{as:"dataURL",useProxy:e.useProxy});return s.ok?(S.background.set(r,s.data),`url("${s.data}")`):(S.background.set(r,null),"none")}catch{return S.background.set(r,null),"none"}}var Et=new Set(["meta","script","noscript","title","link","template"]),ft=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"]),wn=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function zt(){for(let t of wn){let e=String(t).toLowerCase();Et.has(e)||ft.has(e)||Xt(e)}}function Xt(t){if(t=String(t).toLowerCase(),ft.has(t)){let s={};return S.defaultStyle.set(t,s),s}if(S.defaultStyle.has(t))return S.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 o=getComputedStyle(n),r={};for(let s of o){if(he(s))continue;let a=o.getPropertyValue(s);r[s]=a}return e.removeChild(n),S.defaultStyle.set(t,r),r}var bn=/(?:^|-)(animation|transition)(?:-|$)/i,Sn=/^(--|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,xn=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function he(t){let e=String(t).toLowerCase();return!!(xn.has(e)||Sn.test(e)||bn.test(e))}function dt(t,e){if(e=String(e||"").toLowerCase(),ft.has(e))return"";let n=[],o=Xt(e);for(let[r,s]of Object.entries(t)){if(he(r))continue;let a=o[r];s&&s!==a&&n.push(`${r}:${s}`)}return n.sort(),n.join(";")}function Yt(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 Gt(t){let e=new Map;for(let o of t){let r=S.defaultStyle.get(o);if(!r)continue;let s=Object.entries(r).map(([a,l])=>`${a}:${l};`).sort().join("");s&&(e.has(s)||e.set(s,[]),e.get(s).push(o))}let n="";for(let[o,r]of e.entries())n+=`${r.join(",")} { ${o} }
2
- `;return n}function Kt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let r of e)n.set(r,`c${o++}`);return n}function rt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=S.computedStyle.get(t);if(n||(n=new Map,S.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Ft(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function gt(t){let e=[],n=0,o=0;for(let r=0;r<t.length;r++){let s=t[r];s==="("&&n++,s===")"&&n--,s===","&&n===0&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function j(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function U(){let t=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(t),n=/AppleWebKit/i.test(t)&&/Mobile/i.test(t)&&!/Safari/i.test(t),o=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(t);return e||n||o}var ge=new WeakMap,Jt=new Map,Qt=0;function yt(){Qt++}var ye=!1;function Cn(t=document.documentElement){if(!ye){ye=!0;try{new MutationObserver(()=>yt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>yt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",yt),e.ready?.then(()=>yt()).catch(()=>{}))}catch{}}}function kn(t,e={}){let n={},o=t.getPropertyValue("visibility");for(let r=0;r<t.length;r++){let s=t[r],a=t.getPropertyValue(s);(s==="background-image"||s==="content")&&a.includes("url(")&&!a.includes("data:")&&(a="none"),n[s]=a}if(e.embedFonts){let r=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let s of r)if(!n[s])try{let a=t.getPropertyValue(s);a&&(n[s]=a)}catch{}}return o==="hidden"&&(n.opacity="0"),n}var we=new WeakMap;function An(t){let e=we.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]<r[0]?-1:o[0]>r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),we.set(t,e),e)}function Mn(t,e=null,n={}){let o=ge.get(t);if(o&&o.epoch===Qt)return o.snapshot;let r=e||getComputedStyle(t),s=kn(r,n);return Rn(t,r,s),ge.set(t,{epoch:Qt,snapshot:s}),s}function vn(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Jt,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:e||{}}:{session:S.session,persist:{snapshotKeyCache:Jt,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:t||e||{}}}async function st(t,e,n,o){if(t.tagName==="STYLE")return;let r=vn(n,o),s=r.options&&r.options.cache||"auto";if(s!=="disabled"&&Cn(document.documentElement),s==="disabled"&&!r.session.__bumpedForDisabled&&(yt(),Jt.clear(),r.session.__bumpedForDisabled=!0),ft.has(t.tagName?.toLowerCase())){let p=t.getAttribute?.("style");p&&e.setAttribute("style",p)}let{session:a,persist:l}=r;a.styleCache.has(t)||a.styleCache.set(t,getComputedStyle(t));let c=a.styleCache.get(t),i=Mn(t,c,r.options),f=An(i),m=l.snapshotKeyCache.get(f);if(!m){let p=t.tagName?.toLowerCase()||"div";m=dt(i,p),l.snapshotKeyCache.set(f,m)}a.styleMap.set(e,m)}function $n(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function En(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 Fn(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Ln(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let r=t.scrollHeight;if(r===0)return!1;let s=parseFloat(e.paddingTop)||0,a=parseFloat(e.paddingBottom)||0;return r>s+a}function Rn(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=e.display||"";if(o.includes("flex")||o.includes("grid")||$n(t))return;let r=e.position;r==="absolute"||r==="fixed"||r==="sticky"||e.transform==="none"&&(En(e)||Fn(t)||Ln(t,e)&&(delete n.height,delete n["block-size"]))}var Se=["fill","stroke","color","background-color","stop-color"],be=new Map;function In(t,e){let n=e+"::"+t.toLowerCase(),o=be.get(n);if(o)return o;let r=document,s=e==="http://www.w3.org/2000/svg"?r.createElementNS(e,t):r.createElement(t),a=r.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(s),r.documentElement.appendChild(a);let l=getComputedStyle(s),c={};for(let i of Se)c[i]=l.getPropertyValue(i)||"";return a.remove(),be.set(n,c),c}function xe(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 s=t.attributes;for(let a=0;a<s.length;a++){let l=s[a];if(l&&typeof l.value=="string"&&l.value.includes("var(")){o=!0;break}}}let r=null;if(o)try{r=getComputedStyle(t)}catch{}if(o){let s=t.style;if(s&&s.length)for(let a=0;a<s.length;a++){let l=s[a],c=s.getPropertyValue(l);if(!c||!c.includes("var("))continue;let i=r&&r.getPropertyValue(l);if(i)try{e.style.setProperty(l,i.trim(),s.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let s=t.attributes;for(let a=0;a<s.length;a++){let l=s[a];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,i=r&&r.getPropertyValue(c);if(i)try{e.style.setProperty(c,i.trim())}catch{}}}if(!o){if(!r)try{r=getComputedStyle(t)}catch{r=null}if(!r)return;let s=t.namespaceURI||"html",a=In(t.tagName,s);for(let l of Se){let c=r.getPropertyValue(l)||"",i=a[l]||"";if(c&&c!==i)try{e.style.setProperty(l,c.trim())}catch{}}}}function Zt(t,e,n){return Promise.all(t.map(o=>new Promise(r=>{function s(){j(a=>{(a&&typeof a.timeRemaining=="function"?a.timeRemaining()>0:!0)?e(o,r):s()},{fast:n})}s()})))}function Nn(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Pn(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let r=n?Nn(o):o;return`:where(${e} ${r})`}).join(", ")}function Tn(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,r,s)=>{let a=Pn(s,e,!0);return`${o}${r}${a}{`}),t):""}function _n(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Un(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
1
+ var x={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function vt(t="soft"){switch(x.session.__counterEpoch=(x.session.__counterEpoch||0)+1,t){case"auto":{x.session.styleMap=new Map,x.session.nodeMap=new Map;return}case"soft":{x.session.styleMap=new Map,x.session.nodeMap=new Map,x.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{x.session.styleMap=new Map,x.session.nodeMap=new Map,x.session.styleCache=new WeakMap,x.computedStyle=new WeakMap,x.baseStyle=new Map,x.defaultStyle=new Map,x.image=new Map,x.background=new Map,x.resource=new Map,x.font=new Set;return}default:{x.session.styleMap=new Map,x.session.nodeMap=new Map,x.session.styleCache=new WeakMap;return}}}function nt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function jt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(s=>s.trim());return r.length!==6?`matrix(${o})`:(r[4]="0",r[5]="0",`matrix(${r.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(s=>s.trim());return r.length!==16?`matrix3d(${o})`:(r[12]="0",r[13]="0",`matrix3d(${r.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function J(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function mn(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function s(a,l,c){if(r>=n)return;let i=Date.now();(o.get(l)||0)>i||(o.set(l,i+e),r++,a==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(a,l){s("warn",a,l)},errorOnce(a,l){s("error",a,l)},reset(){o.clear(),r=0}}}var me=mn("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),zt=new Map,Et=new Map;function pn(t){return/^data:|^blob:|^about:blank$/i.test(t)}function hn(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,r=new URL(o||".",n),s=new URL(t,n);if(s.origin===r.origin)return!0;let a=s.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function gn(t,e){if(!e||pn(t)||hn(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function yn(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",J(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}${J(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function pe(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function wn(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function T(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",s=e.errorTTL??8e3,a=e.headers||{},l=!!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[,m="",y=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],b=/;base64/i.test(m)?atob(y):decodeURIComponent(y),S=new Uint8Array([...b].map(C=>C.charCodeAt(0))),k=new Blob([S],{type:(m||"").split(";")[0]||""});return{ok:!0,data:k,status:200,url:t,fromCache:!1,mime:k.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let m=await fetch(t);if(!m.ok)return{ok:!1,data:null,status:m.status,url:t,fromCache:!1,reason:"http_error"};let y=await m.blob(),g=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await pe(y),status:m.status,url:t,fromCache:!1,mime:g}:n==="text"?{ok:!0,data:await y.text(),status:m.status,url:t,fromCache:!1,mime:g}:{ok:!0,data:y,status:m.status,url:t,fromCache:!1,mime:g}}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 c=wn(t,{as:n,timeout:o,useProxy:r,errorTTL:s}),i=Et.get(c);if(i&&i.until>Date.now())return{...i.result,fromCache:!0};i&&Et.delete(c);let f=zt.get(c);if(f)return f;let d=gn(t,r)?yn(t,r):t,p=e.credentials;if(!p)try{let m=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(t,m);p=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,w=setTimeout(()=>h.abort("timeout"),o),u=(async()=>{try{let m=await fetch(d,{signal:h.signal,credentials:p,headers:a});if(!m.ok){let b={ok:!1,data:null,status:m.status,url:d,fromCache:!1,reason:"http_error"};if(s>0&&Et.set(c,{until:Date.now()+s,result:b}),!l){let S=`${m.status} ${m.statusText||""}`.trim();me.warnOnce(`http:${m.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${S} while fetching ${n} ${t}`)}return e.onError&&e.onError(b),b}if(n==="text")return{ok:!0,data:await m.text(),status:m.status,url:d,fromCache:!1};let y=await m.blob(),g=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await pe(y),status:m.status,url:d,fromCache:!1,mime:g}:{ok:!0,data:y,status:m.status,url:d,fromCache:!1,mime:g}}catch(m){let y=m&&typeof m=="object"&&"name"in m&&m.name==="AbortError"?String(m.message||"").includes("timeout")?"timeout":"abort":"network",g={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(t)&&s>0&&Et.set(c,{until:Date.now()+s,result:g}),!l){let b=`${y}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,S=y==="timeout"?`Timeout after ${o}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`;me.errorOnce(b,S)}return e.onError&&e.onError(g),g}finally{clearTimeout(w),zt.delete(c)}})();return zt.set(c,u),u}async function ot(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=nt(t);if(!o)return t;let r=J(o);if(x.background.has(r)){let s=x.background.get(r);return s?`url("${s}")`:"none"}try{let s=await T(r,{as:"dataURL",useProxy:e.useProxy});return s.ok?(x.background.set(r,s.data),`url("${s.data}")`):(x.background.set(r,null),"none")}catch{return x.background.set(r,null),"none"}}var Ft=new Set(["meta","script","noscript","title","link","template"]),ut=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"]),bn=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];function Vt(){for(let t of bn){let e=String(t).toLowerCase();Ft.has(e)||ut.has(e)||Xt(e)}}function Xt(t){if(t=String(t).toLowerCase(),ut.has(t)){let s={};return x.defaultStyle.set(t,s),s}if(x.defaultStyle.has(t))return x.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 o=getComputedStyle(n),r={};for(let s of o){if(he(s))continue;let a=o.getPropertyValue(s);r[s]=a}return e.removeChild(n),x.defaultStyle.set(t,r),r}var xn=/(?:^|-)(animation|transition)(?:-|$)/i,Sn=/^(--|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,Cn=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function he(t){let e=String(t).toLowerCase();return!!(Cn.has(e)||Sn.test(e)||xn.test(e))}function ft(t,e){if(e=String(e||"").toLowerCase(),ut.has(e))return"";let n=[],o=Xt(e);for(let[r,s]of Object.entries(t)){if(he(r))continue;let a=o[r];s&&s!==a&&n.push(`${r}:${s}`)}return n.sort(),n.join(";")}function Yt(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 Kt(t){let e=new Map;for(let o of t){let r=x.defaultStyle.get(o);if(!r)continue;let s=Object.entries(r).map(([a,l])=>`${a}:${l};`).sort().join("");s&&(e.has(s)||e.set(s,[]),e.get(s).push(o))}let n="";for(let[o,r]of e.entries())n+=`${r.join(",")} { ${o} }
2
+ `;return n}function Gt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let r of e)n.set(r,`c${o++}`);return n}function rt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=x.computedStyle.get(t);if(n||(n=new Map,x.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function $t(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function gt(t){let e=[],n=0,o=0;for(let r=0;r<t.length;r++){let s=t[r];s==="("&&n++,s===")"&&n--,s===","&&n===0&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function V(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function W(){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),r=/mobile/i.test(t),s=!/safari/i.test(t),a=o&&r&&s,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),i=/ipad|iphone|ipod/.test(e)&&o;return n||a||l||c||i}var ge=new WeakMap,Qt=new Map,Jt=0;function yt(){Jt++}var ye=!1;function kn(t=document.documentElement){if(!ye){ye=!0;try{new MutationObserver(()=>yt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>yt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",yt),e.ready?.then(()=>yt()).catch(()=>{}))}catch{}}}function An(t,e={}){let n={},o=t.getPropertyValue("visibility");for(let s=0;s<t.length;s++){let a=t[s],l=t.getPropertyValue(a);(a==="background-image"||a==="content")&&l.includes("url(")&&!l.includes("data:")&&(l="none"),n[a]=l}let r=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let s of r)if(!n[s])try{let a=t.getPropertyValue(s);a&&(n[s]=a)}catch{}if(e.embedFonts){let s=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let a of s)if(!n[a])try{let l=t.getPropertyValue(a);l&&(n[a]=l)}catch{}}return o==="hidden"&&(n.opacity="0"),n}var we=new WeakMap;function Mn(t){let e=we.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]<r[0]?-1:o[0]>r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),we.set(t,e),e)}function vn(t,e=null,n={}){let o=ge.get(t);if(o&&o.epoch===Jt)return o.snapshot;let r=e||getComputedStyle(t),s=An(r,n);return Nn(t,r,s),ge.set(t,{epoch:Jt,snapshot:s}),s}function En(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Qt,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:Qt,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:t||e||{}}}async function st(t,e,n,o){if(t.tagName==="STYLE")return;let r=En(n,o),s=r.options&&r.options.cache||"auto";if(s!=="disabled"&&kn(document.documentElement),s==="disabled"&&!r.session.__bumpedForDisabled&&(yt(),Qt.clear(),r.session.__bumpedForDisabled=!0),ut.has(t.tagName?.toLowerCase())){let p=t.getAttribute?.("style");p&&e.setAttribute("style",p)}let{session:a,persist:l}=r;a.styleCache.has(t)||a.styleCache.set(t,getComputedStyle(t));let c=a.styleCache.get(t),i=vn(t,c,r.options),f=Mn(i),d=l.snapshotKeyCache.get(f);if(!d){let p=t.tagName?.toLowerCase()||"div";d=ft(i,p),l.snapshotKeyCache.set(f,d)}a.styleMap.set(e,d)}function Fn(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function $n(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 In(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Ln(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let r=t.scrollHeight;if(r===0)return!1;let s=parseFloat(e.paddingTop)||0,a=parseFloat(e.paddingBottom)||0;return r>s+a}function Nn(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=e.display||"";if(o.includes("flex")||o.includes("grid")||Fn(t))return;let r=e.position;r==="absolute"||r==="fixed"||r==="sticky"||e.transform==="none"&&($n(e)||In(t)||Ln(t,e)&&(delete n.height,delete n["block-size"]))}var xe=["fill","stroke","color","background-color","stop-color"],be=new Map;function Rn(t,e){let n=e+"::"+t.toLowerCase(),o=be.get(n);if(o)return o;let r=document,s=e==="http://www.w3.org/2000/svg"?r.createElementNS(e,t):r.createElement(t),a=r.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(s),r.documentElement.appendChild(a);let l=getComputedStyle(s),c={};for(let i of xe)c[i]=l.getPropertyValue(i)||"";return a.remove(),be.set(n,c),c}function Se(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 s=t.attributes;for(let a=0;a<s.length;a++){let l=s[a];if(l&&typeof l.value=="string"&&l.value.includes("var(")){o=!0;break}}}let r=null;if(o)try{r=getComputedStyle(t)}catch{}if(o){let s=t.style;if(s&&s.length)for(let a=0;a<s.length;a++){let l=s[a],c=s.getPropertyValue(l);if(!c||!c.includes("var("))continue;let i=r&&r.getPropertyValue(l);if(i)try{e.style.setProperty(l,i.trim(),s.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let s=t.attributes;for(let a=0;a<s.length;a++){let l=s[a];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,i=r&&r.getPropertyValue(c);if(i)try{e.style.setProperty(c,i.trim())}catch{}}}if(!o){if(!r)try{r=getComputedStyle(t)}catch{r=null}if(!r)return;let s=t.namespaceURI||"html",a=Rn(t.tagName,s);for(let l of xe){let c=r.getPropertyValue(l)||"",i=a[l]||"";if(c&&c!==i)try{e.style.setProperty(l,c.trim())}catch{}}}}function Zt(t,e,n){return Promise.all(t.map(o=>new Promise(r=>{function s(){V(a=>{(a&&typeof a.timeRemaining=="function"?a.timeRemaining()>0:!0)?e(o,r):s()},{fast:n})}s()})))}function Tn(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Pn(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let r=n?Tn(o):o;return`:where(${e} ${r})`}).join(", ")}function _n(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,r,s)=>{let a=Pn(s,e,!0);return`${o}${r}${a}{`}),t):""}function Wn(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Un(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
3
3
  `});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let r of o.cssRules)e+=r.cssText+`
4
- `}catch{}}catch{}return e}function Wn(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function On(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 Bn(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function Dn(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function Hn(t,e,n){let o=[];for(let r of e){let s=Dn(t,r);s&&o.push(`${r}: ${s};`)}return o.length?`${n}{${o.join("")}}
5
- `:""}function qn(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 jn(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)await new Promise(s=>setTimeout(s,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}function Vn(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,s=0;try{let c=getComputedStyle(t);n=parseFloat(c.borderLeftWidth)||0,o=parseFloat(c.borderRightWidth)||0,r=parseFloat(c.borderTopWidth)||0,s=parseFloat(c.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(e.width-(n+o))),l=Math.max(0,Math.round(e.height-(r+s)));return{contentWidth:a,contentHeight:l,rect:e}}function zn(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 Xn(t,e,n){let o=await jn(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:s,rect:a}=Vn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let c={...n,scale:1},i=zn(o,r,s),f;try{f=await l.toPng(o.documentElement,c)}finally{i()}f.style.display="block",f.style.width=`${r}px`,f.style.height=`${s}px`;let m=document.createElement("div");return e.nodeMap.set(m,t),st(t,m,e,n),m.style.overflow="hidden",m.style.display="block",m.style.width||(m.style.width=`${Math.round(a.width)}px`),m.style.height||(m.style.height=`${Math.round(a.height)}px`),m.appendChild(f),m}async function wt(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,r=null,s=null;if(t.nodeType===Node.ELEMENT_NODE){let i=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Et.has(i))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let i=document.createElement("div"),f=t.getBoundingClientRect();return i.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,i}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let i of n.exclude)try{if(t.matches?.(i)){if(n.excludeMode==="hide"){let f=document.createElement("div"),m=t.getBoundingClientRect();return f.style.cssText=`display:inline-block;width:${m.width}px;height:${m.height}px;visibility:hidden;`,f}else if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${i}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let i=document.createElement("div"),f=t.getBoundingClientRect();return i.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,i}else if(n.filterMode==="remove")return null}}catch(i){console.warn("Error in filter function:",i)}if(t.tagName==="IFRAME"){let i=!1;try{i=!!(t.contentDocument||t.contentWindow?.document)}catch{i=!1}if(i)try{return await Xn(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(n.placeholders){let f=document.createElement("div");return f.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,st(t,f,e,n),f}else{let f=t.getBoundingClientRect(),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,st(t,m,e,n),m}}if(t.getAttribute("data-capture")==="placeholder"){let i=t.cloneNode(!1);e.nodeMap.set(i,t),st(t,i,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;",i.appendChild(f),i}if(t.tagName==="CANVAS"){let i="";try{let m=t.getContext("2d",{willReadFrequently:!0});try{m&&m.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),i=t.toDataURL("image/png"),!i||i==="data:,"){try{m&&m.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),i=t.toDataURL("image/png"),!i||i==="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),i=p.toDataURL("image/png"))}}}catch{}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch{}i&&(f.src=i),f.width=t.width,f.height=t.height;try{let m=getComputedStyle(t);m.width&&(f.style.width=m.width),m.height&&(f.style.height=m.height)}catch{}return e.nodeMap.set(f,t),st(t,f,e,n),f}let a;try{if(a=t.cloneNode(!1),xe(t,a),e.nodeMap.set(a,t),t.tagName==="IMG"){On(t,a);try{let i=t.getBoundingClientRect(),f=Math.round(i.width||0),m=Math.round(i.height||0);if(!f||!m){let p=window.getComputedStyle(t),h=parseFloat(p.width)||0,b=parseFloat(p.height)||0,u=parseInt(t.getAttribute("width")||"",10)||0,d=parseInt(t.getAttribute("height")||"",10)||0,w=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;f=Math.round(f||h||u||w||0),m=Math.round(m||b||d||g||0)}f&&(a.dataset.snapdomWidth=String(f)),m&&(a.dataset.snapdomHeight=String(m))}catch{}}}catch(i){throw console.error("[Snapdom] Failed to clone node:",t,i),i}if(t instanceof HTMLTextAreaElement){let i=t.getBoundingClientRect();a.style.width=`${i.width}px`,a.style.height=`${i.height}px`}if(t instanceof HTMLInputElement&&(a.value=t.value,a.setAttribute("value",t.value),t.checked!==void 0&&(a.checked=t.checked,t.checked&&a.setAttribute("checked",""),t.indeterminate&&(a.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(s=t.value),st(t,a,e,n),t.shadowRoot){let d=function(g,y){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return y(null);wt(g,e,n).then(x=>{y(x||null)}).catch(()=>{y(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let y of g){let x=[];try{x=y.assignedNodes?.({flatten:!0})||y.assignedNodes?.()||[]}catch{x=y.assignedNodes?.()||[]}for(let k of x)o.add(k)}}catch{}let i=_n(e),f=`[data-sd="${i}"]`;try{a.setAttribute("data-sd",i)}catch{}let m=Un(t.shadowRoot),p=Tn(m,f),h=Bn(m),b=Hn(t,h,f);Wn(a,b+p,i);let u=document.createDocumentFragment(),w=await Zt(Array.from(t.shadowRoot.childNodes),d,n.fast);u.append(...w.filter(g=>!!g)),a.appendChild(u)}if(t.tagName==="SLOT"){let p=function(b,u){wt(b,e,n).then(d=>{d&&qn(d),u(d||null)}).catch(()=>{u(null)})},i=t.assignedNodes?.({flatten:!0})||[],f=i.length>0?i:Array.from(t.childNodes),m=document.createDocumentFragment(),h=await Zt(Array.from(f),p,n.fast);return m.append(...h.filter(b=>!!b)),m}function l(i,f){if(o.has(i))return f(null);wt(i,e,n).then(m=>{f(m||null)}).catch(()=>{f(null)})}let c=await Zt(Array.from(t.childNodes),l,n.fast);if(a.append(...c.filter(i=>!!i)),r!==null&&a instanceof HTMLSelectElement){a.value=r;for(let i of a.options)i.value===r?i.setAttribute("selected",""):i.removeAttribute("selected")}return s!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=s),a}var Yn=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],te=[];function Ce(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...Yn,...te];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 Gn(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}async function Kn(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${t.replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function Jn(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/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 Qn(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:r="#000",variation:s=""}={}){let a=String(e||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1;await Kn(a,o);let c=document.createElement("span");c.textContent=t,c.style.position="absolute",c.style.visibility="hidden",c.style.left="-99999px",c.style.whiteSpace="nowrap",c.style.fontFamily=`"${a}"`,c.style.fontWeight=String(n||"normal"),c.style.fontSize=`${o}px`,c.style.lineHeight="1",c.style.margin="0",c.style.padding="0",c.style.fontFeatureSettings="'liga' 1",c.style.fontVariantLigatures="normal",s&&(c.style.fontVariationSettings=s),c.style.color=r,document.body.appendChild(c);let i=c.getBoundingClientRect(),f=Math.max(1,Math.ceil(i.width)),m=Math.max(1,Math.ceil(i.height));document.body.removeChild(c);let p=document.createElement("canvas");p.width=f*l,p.height=m*l;let h=p.getContext("2d");h.scale(l,l),h.font=`${n?`${n} `:""}${o}px "${a}"`,h.textAlign="left",h.textBaseline="top",h.fillStyle=r;try{h.fontKerning="normal"}catch{}return h.fillText(t,0,0),{dataUrl:p.toDataURL(),width:f,height:m}}async function ke(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(o.length===0)return 0;let r=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],s=0;for(let a=0;a<o.length;a++){let l=o[a],c=r[a]||null;try{let i=getComputedStyle(c||l),f=i.fontFamily||"Material Icons";if(!Gn(f))continue;let m=(c||l).textContent.trim();if(!m)continue;let p=parseInt(i.fontSize,10)||24,h=i.fontWeight&&i.fontWeight!=="normal"?i.fontWeight:"normal",b=Jn(i),u=i.fontVariationSettings&&i.fontVariationSettings!=="normal"?i.fontVariationSettings:"",{dataUrl:d,width:w,height:g}=await Qn(m,{family:f,weight:h,fontSize:p,color:b,variation:u});l.textContent="";let y=l.ownerDocument.createElement("img");y.src=d,y.alt=m,y.style.height=`${p}px`,y.style.width=`${Math.max(1,Math.round(w/g*p))}px`,y.style.objectFit="contain",y.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(y),s++}catch{}}return s}async function ve(t,e,n,o=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let s=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=t,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${e}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${o}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let l=a.getBoundingClientRect(),c=Math.ceil(l.width),i=Math.ceil(l.height);document.body.removeChild(a);let f=document.createElement("canvas");f.width=Math.max(1,c*s),f.height=Math.max(1,i*s);let m=f.getContext("2d");return m.scale(s,s),m.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,m.textAlign="left",m.textBaseline="top",m.fillStyle=r,m.fillText(t,0,0),{dataUrl:f.toDataURL(),width:c,height:i}}var Zn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function It(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Zn.has(n.toLowerCase()))return n}return""}function Lt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function to(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function eo(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=Lt(n[1]),s=Lt(n[2]);return{min:Math.min(r,s),max:Math.max(r,s)}}let o=Lt(e);return{min:o,max:o}}function no(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function oo(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let s=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(s,a),max:Math.max(s,a)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function ro(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>r.endsWith(l)))return!0;let a=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a))return!0;for(let l of e){let c=l.toLowerCase().replace(/\s+/g,"+"),i=l.toLowerCase().replace(/\s+/g,"-");if(a.includes(c)||a.includes(i))return!0}return!1}catch{return!1}}function so(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function Ae(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,r)=>{let s=(r||"").trim();if(!s||/^data:|^blob:|^https?:|^file:|^about:/i.test(s))return n;let a=s;try{a=new URL(s,e||location.href).href}catch{}return`url("${a}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Rt=4;async function ao(t,e,n){if(!t)return t;let o=new Set;function r(l,c){try{return new URL(l,c||location.href).href}catch{return l}}async function s(l,c,i=0){if(i>Rt)return console.warn(`[snapDOM] @import depth exceeded (${Rt}) at ${c}`),l;let f="",m=0,p;for(;p=ne.exec(l);){f+=l.slice(m,p.index),m=ne.lastIndex;let h=(p[2]||p[4]||"").trim(),b=r(h,c);if(o.has(b)){console.warn(`[snapDOM] Skipping circular @import: ${b}`);continue}o.add(b);let u="";try{let d=await P(b,{as:"text",useProxy:n,silent:!0});d.ok&&typeof d.data=="string"&&(u=d.data)}catch{}u?(u=Ae(u,b),u=await s(u,b,i+1),f+=`
6
- /* inlined: ${b} */
4
+ `}catch{}}catch{}return e}function On(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function Bn(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 Dn(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function Hn(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function qn(t,e,n){let o=[];for(let r of e){let s=Hn(t,r);s&&o.push(`${r}: ${s};`)}return o.length?`${n}{${o.join("")}}
5
+ `:""}function jn(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 zn(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)await new Promise(s=>setTimeout(s,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}function Vn(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,s=0;try{let c=getComputedStyle(t);n=parseFloat(c.borderLeftWidth)||0,o=parseFloat(c.borderRightWidth)||0,r=parseFloat(c.borderTopWidth)||0,s=parseFloat(c.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(e.width-(n+o))),l=Math.max(0,Math.round(e.height-(r+s)));return{contentWidth:a,contentHeight:l,rect:e}}function Xn(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 Yn(t,e,n){let o=await zn(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:s,rect:a}=Vn(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let c={...n,scale:1},i=Xn(o,r,s),f;try{f=await l.toPng(o.documentElement,c)}finally{i()}f.style.display="block",f.style.width=`${r}px`,f.style.height=`${s}px`;let d=document.createElement("div");return e.nodeMap.set(d,t),st(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(f),d}async function wt(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,r=null,s=null;if(t.nodeType===Node.ELEMENT_NODE){let i=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ft.has(i))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let i=document.createElement("div"),f=t.getBoundingClientRect();return i.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,i}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let i of n.exclude)try{if(t.matches?.(i)){if(n.excludeMode==="hide"){let f=document.createElement("div"),d=t.getBoundingClientRect();return f.style.cssText=`display:inline-block;width:${d.width}px;height:${d.height}px;visibility:hidden;`,f}else if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${i}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let i=document.createElement("div"),f=t.getBoundingClientRect();return i.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,i}else if(n.filterMode==="remove")return null}}catch(i){console.warn("Error in filter function:",i)}if(t.tagName==="IFRAME"){let i=!1;try{i=!!(t.contentDocument||t.contentWindow?.document)}catch{i=!1}if(i)try{return await Yn(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(n.placeholders){let f=document.createElement("div");return f.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,st(t,f,e,n),f}else{let f=t.getBoundingClientRect(),d=document.createElement("div");return d.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,st(t,d,e,n),d}}if(t.getAttribute("data-capture")==="placeholder"){let i=t.cloneNode(!1);e.nodeMap.set(i,t),st(t,i,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;",i.appendChild(f),i}if(t.tagName==="CANVAS"){let i="";try{let d=t.getContext("2d",{willReadFrequently:!0});try{d&&d.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),i=t.toDataURL("image/png"),!i||i==="data:,"){try{d&&d.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),i=t.toDataURL("image/png"),!i||i==="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),i=p.toDataURL("image/png"))}}}catch{}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch{}i&&(f.src=i),f.width=t.width,f.height=t.height;try{let d=getComputedStyle(t);d.width&&(f.style.width=d.width),d.height&&(f.style.height=d.height)}catch{}return e.nodeMap.set(f,t),st(t,f,e,n),f}let a;try{if(a=t.cloneNode(!1),Se(t,a),e.nodeMap.set(a,t),t.tagName==="IMG"){Bn(t,a);try{let i=t.getBoundingClientRect(),f=Math.round(i.width||0),d=Math.round(i.height||0);if(!f||!d){let p=window.getComputedStyle(t),h=parseFloat(p.width)||0,w=parseFloat(p.height)||0,u=parseInt(t.getAttribute("width")||"",10)||0,m=parseInt(t.getAttribute("height")||"",10)||0,y=t.width||t.naturalWidth||0,g=t.height||t.naturalHeight||0;f=Math.round(f||h||u||y||0),d=Math.round(d||w||m||g||0)}f&&(a.dataset.snapdomWidth=String(f)),d&&(a.dataset.snapdomHeight=String(d))}catch{}}}catch(i){throw console.error("[Snapdom] Failed to clone node:",t,i),i}if(t instanceof HTMLTextAreaElement){let i=t.getBoundingClientRect();a.style.width=`${i.width}px`,a.style.height=`${i.height}px`}if(t instanceof HTMLInputElement&&(a.value=t.value,a.setAttribute("value",t.value),t.checked!==void 0&&(a.checked=t.checked,t.checked&&a.setAttribute("checked",""),t.indeterminate&&(a.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(s=t.value),st(t,a,e,n),t.shadowRoot){let m=function(g,b){if(g.nodeType===Node.ELEMENT_NODE&&g.tagName==="STYLE")return b(null);wt(g,e,n).then(S=>{b(S||null)}).catch(()=>{b(null)})};try{let g=t.shadowRoot.querySelectorAll("slot");for(let b of g){let S=[];try{S=b.assignedNodes?.({flatten:!0})||b.assignedNodes?.()||[]}catch{S=b.assignedNodes?.()||[]}for(let k of S)o.add(k)}}catch{}let i=Wn(e),f=`[data-sd="${i}"]`;try{a.setAttribute("data-sd",i)}catch{}let d=Un(t.shadowRoot),p=_n(d,f),h=Dn(d),w=qn(t,h,f);On(a,w+p,i);let u=document.createDocumentFragment(),y=await Zt(Array.from(t.shadowRoot.childNodes),m,n.fast);u.append(...y.filter(g=>!!g)),a.appendChild(u)}if(t.tagName==="SLOT"){let p=function(w,u){wt(w,e,n).then(m=>{m&&jn(m),u(m||null)}).catch(()=>{u(null)})},i=t.assignedNodes?.({flatten:!0})||[],f=i.length>0?i:Array.from(t.childNodes),d=document.createDocumentFragment(),h=await Zt(Array.from(f),p,n.fast);return d.append(...h.filter(w=>!!w)),d}function l(i,f){if(o.has(i))return f(null);wt(i,e,n).then(d=>{f(d||null)}).catch(()=>{f(null)})}let c=await Zt(Array.from(t.childNodes),l,n.fast);if(a.append(...c.filter(i=>!!i)),r!==null&&a instanceof HTMLSelectElement){a.value=r;for(let i of a.options)i.value===r?i.setAttribute("selected",""):i.removeAttribute("selected")}return s!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=s),a}var Kn=[/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],dt=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__||{}),te=[];function ke(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?te.push(n):typeof n=="string"?te.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function B(t){let e=typeof t=="string"?t:"",n=[...Kn,...te];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 Gn(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var Ce=new Map;function Qn(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,r;for(;r=o.exec(n);)e[r[1].toUpperCase()]=Number(r[2]);return e}async function Jn(t,e,n){let o=String(t||""),r=o.toLowerCase(),s=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(r)&&!/\bsymbols\b/.test(r))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(r))return{familyForMeasure:o,familyForCanvas:o};let l=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(s)||/\bround\b/.test(s)?c="rounded":/\bsharp\b/.test(s)?c="sharp":/\boutlined\b/.test(s)&&(c="outlined");let i=l===1,f=null;if(i&&(c==="outlined"&&dt.materialIconsFilled?f={url:dt.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&dt.materialIconsRound?f={url:dt.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&dt.materialIconsSharp&&(f={url:dt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!f)return{familyForMeasure:o,familyForCanvas:o};if(!Ce.has(f.alias))try{let p=new FontFace(f.alias,`url(${f.url})`,{style:"normal",weight:"400"});document.fonts.add(p),await p.load(),Ce.set(f.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let d=`"${f.alias}"`;return{familyForMeasure:d,familyForCanvas:d}}async function Zn(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function to(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 eo(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:r="#000",variation:s="",className:a=""}={}){let l=String(e||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,i=Qn(s),{familyForMeasure:f,familyForCanvas:d}=await Jn(l,a,i);await Zn(d.replace(/^["']+|["']+$/g,""),o);let p=document.createElement("span");p.textContent=t,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=f,p.style.fontWeight=String(n||"normal"),p.style.fontSize=`${o}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=r,document.body.appendChild(p);let h=p.getBoundingClientRect(),w=Math.max(1,Math.ceil(h.width)),u=Math.max(1,Math.ceil(h.height));document.body.removeChild(p);let m=document.createElement("canvas");m.width=w*c,m.height=u*c;let y=m.getContext("2d");y.scale(c,c),y.font=`${n?`${n} `:""}${o}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=r;try{y.fontKerning="normal"}catch{}return y.fillText(t,0,0),{dataUrl:m.toDataURL(),width:w,height:u}}async function Ae(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(o.length===0)return 0;let r=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],s=0;for(let a=0;a<o.length;a++){let l=o[a],c=r[a]||null;try{let i=getComputedStyle(c||l),f=i.fontFamily||"Material Icons";if(!Gn(f))continue;let d=(c||l).textContent.trim();if(!d)continue;let p=parseInt(i.fontSize,10)||24,h=i.fontWeight&&i.fontWeight!=="normal"?i.fontWeight:"normal",w=to(i),u=i.fontVariationSettings&&i.fontVariationSettings!=="normal"?i.fontVariationSettings:"",m=(c||l).className||"",{dataUrl:y,width:g,height:b}=await eo(d,{family:f,weight:h,fontSize:p,color:w,variation:u,className:m});l.textContent="";let S=l.ownerDocument.createElement("img");S.src=y,S.alt=d,S.style.height=`${p}px`,S.style.width=`${Math.max(1,Math.round(g/b*p))}px`,S.style.objectFit="contain",S.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(S),s++}catch{}}return s}async function Ee(t,e,n,o=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let s=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=t,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${e}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${o}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let l=a.getBoundingClientRect(),c=Math.ceil(l.width),i=Math.ceil(l.height);document.body.removeChild(a);let f=document.createElement("canvas");f.width=Math.max(1,c*s),f.height=Math.max(1,i*s);let d=f.getContext("2d");return d.scale(s,s),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(t,0,0),{dataUrl:f.toDataURL(),width:c,height:i}}var no=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Nt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!no.has(n.toLowerCase()))return n}return""}function It(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ee(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function oo(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function ro(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=It(n[1]),s=It(n[2]);return{min:Math.min(r,s),max:Math.max(r,s)}}let o=It(e);return{min:o,max:o}}function so(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function ao(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let s=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(s,a),max:Math.max(s,a)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function io(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>r.endsWith(l)))return!0;let a=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a))return!0;for(let l of e){let c=l.toLowerCase().replace(/\s+/g,"+"),i=l.toLowerCase().replace(/\s+/g,"-");if(a.includes(c)||a.includes(i))return!0}return!1}catch{return!1}}function co(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function Me(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,r)=>{let s=(r||"").trim();if(!s||/^data:|^blob:|^https?:|^file:|^about:/i.test(s))return n;let a=s;try{a=new URL(s,e||location.href).href}catch{}return`url("${a}")`})}var ne=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Lt=4;async function lo(t,e,n){if(!t)return t;let o=new Set;function r(l,c){try{return new URL(l,c||location.href).href}catch{return l}}async function s(l,c,i=0){if(i>Lt)return console.warn(`[snapDOM] @import depth exceeded (${Lt}) at ${c}`),l;let f="",d=0,p;for(;p=ne.exec(l);){f+=l.slice(d,p.index),d=ne.lastIndex;let h=(p[2]||p[4]||"").trim(),w=r(h,c);if(o.has(w)){console.warn(`[snapDOM] Skipping circular @import: ${w}`);continue}o.add(w);let u="";try{let m=await T(w,{as:"text",useProxy:n,silent:!0});m.ok&&typeof m.data=="string"&&(u=m.data)}catch{}u?(u=Me(u,w),u=await s(u,w,i+1),f+=`
6
+ /* inlined: ${w} */
7
7
  ${u}
8
- `):f+=p[0]}return f+=l.slice(m),f}let a=Ae(t,e||location.href);return a=await s(a,e||location.href,0),a}var $e=/url\((["']?)([^"')]+)\1\)/g,io=/@font-face[^{}]*\{[^}]*\}/g;function Ee(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let r=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!r)continue;let s=r[1],a=r[2],l=c=>{if(!c.includes("?"))return parseInt(c,16);let i=parseInt(c.replace(/\?/g,"0"),16),f=parseInt(c.replace(/\?/g,"F"),16);return[i,f]};if(a){let c=l(s),i=l(a),f=Array.isArray(c)?c[0]:c,m=Array.isArray(i)?i[1]:i;e.push([Math.min(f,m),Math.max(f,m)])}else{let c=l(s);Array.isArray(c)?e.push([c[0],c[1]]):e.push([c,c])}}return e}function Fe(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,r]of e)if(n>=o&&n<=r)return!0;return!1}function oe(t,e){let n=[];if(!t)return n;for(let o of t.matchAll($e)){let r=(o[2]||"").trim();if(!(!r||r.startsWith("data:"))){if(!/^https?:/i.test(r))try{r=new URL(r,e||location.href).href}catch{}n.push(r)}}return n}async function Le(t,e,n=""){let o=t;for(let r of t.matchAll($e)){let s=et(r[0]);if(!s)continue;let a=s;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,e||location.href).href}catch{}if(!B(a)){if(S.resource?.has(a)){S.font?.add(a),o=o.replace(r[0],`url(${S.resource.get(a)})`);continue}if(!S.font?.has(a))try{let l=await P(a,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let c=l.data;S.resource?.set(a,c),S.font?.add(a),o=o.replace(r[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return o}function co(t){if(!t.length)return null;let e=(l,c)=>t.some(([i,f])=>!(f<l||i>c)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),r=e(880,1023),s=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":s?"cyrillic":r?"greek":o?"latin-ext":n?"latin":null}function Me(t={}){let e=new Set((t.families||[]).map(r=>String(r).toLowerCase())),n=new Set((t.domains||[]).map(r=>String(r).toLowerCase())),o=new Set((t.subsets||[]).map(r=>String(r).toLowerCase()));return(r,s)=>{if(e.size&&e.has(r.family.toLowerCase()))return!0;if(n.size)for(let a of r.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(o.size){let a=co(s);if(a&&o.has(a))return!0}return!1}}function lo(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let s of t.match(e)||[]){let a=s.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=It(a),c=(s.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),i=(s.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),f=(s.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),m=(s.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),p=(s.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),h=oe(p,location.href),b=h.length?h.map(d=>String(d).toLowerCase()).sort().join("|"):p.toLowerCase(),u=[String(l||"").toLowerCase(),c,i,f,m.toLowerCase(),b].join("|");n.has(u)||(n.add(u),o.push(s))}if(o.length===0)return t;let r=0;return t.replace(e,()=>o[r++]||"")}function uo(t,e,n,o){let r=Array.from(t||[]).sort().join("|"),s=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()}):"",a=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|");return`fonts-embed-css::req=${r}::ex=${s}::lf=${a}::px=${o||""}`}async function Re(t,e,n,o){let r;try{r=t.cssRules||[]}catch{return}let s=(a,l)=>{try{return new URL(a,l||location.href).href}catch{return a}};for(let a of r){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let l=a.href?s(a.href,e):e;if(o.depth>=Rt){console.warn(`[snapDOM] CSSOM import depth exceeded (${Rt}) at ${l}`);continue}if(l&&o.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&o.visitedSheets.add(l);let c={...o,depth:(o.depth||0)+1};await Re(a.styleSheet,l,n,c);continue}if(a.type===CSSRule.FONT_FACE_RULE){let l=(a.style.getPropertyValue("font-family")||"").trim(),c=It(l);if(!c||B(c))continue;let i=(a.style.getPropertyValue("font-weight")||"400").trim(),f=(a.style.getPropertyValue("font-style")||"normal").trim(),m=(a.style.getPropertyValue("font-stretch")||"100%").trim(),p=(a.style.getPropertyValue("src")||"").trim(),h=(a.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(c,f,i,m))continue;let b=Ee(h);if(!Fe(o.usedCodepoints,b))continue;let u={family:c,weightSpec:i,styleSpec:f,stretchSpec:m,unicodeRange:h,srcRaw:p,srcUrls:oe(p,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(u,b))continue;if(/url\(/i.test(p)){let d=await Le(p,e||location.href,o.useProxy);await n(`@font-face{font-family:${c};src:${d};font-style:${f};font-weight:${i};font-stretch:${m};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${c};src:${p};font-style:${f};font-weight:${i};font-stretch:${m};${h?`unicode-range:${h};`:""}}`)}}}async function Nt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let s=new Map;for(let u of t){let[d,w,g,y]=String(u).split("__");if(!d)continue;let x=s.get(d)||[];x.push({w:parseInt(w,10),s:g,st:parseInt(y,10)}),s.set(d,x)}function a(u,d,w,g){if(!s.has(u))return!1;let y=s.get(u),x=eo(w),k=no(d),C=oo(g),M=x.min!==x.max,R=x.min,F=$=>k.kind==="normal"&&$==="normal"||k.kind!=="normal"&&($==="italic"||$==="oblique"),I=!1;for(let $ of y){let W=M?$.w>=x.min&&$.w<=x.max:$.w===R,O=F(ee($.s)),v=$.st>=C.min&&$.st<=C.max;if(W&&O&&v){I=!0;break}}if(I)return!0;if(!M)for(let $ of y){let W=F(ee($.s)),O=$.st>=C.min&&$.st<=C.max;if(Math.abs(R-$.w)<=300&&W&&O)return!0}return!1}let l=Me(n),c=uo(t,n,o,r);if(S.resource?.has(c))return S.resource.get(c);let i=so(t),f=[],m=ne;for(let u of document.querySelectorAll("style")){let d=u.textContent||"";for(let w of d.matchAll(m)){let g=(w[2]||w[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||f.push(g)}}f.length&&await Promise.all(f.map(u=>new Promise(d=>{if(document.querySelector(`link[rel="stylesheet"][href="${u}"]`))return d(null);let w=document.createElement("link");w.rel="stylesheet",w.href=u,w.setAttribute("data-snapdom","injected-import"),w.onload=()=>d(w),w.onerror=()=>d(null),document.head.appendChild(w)})));let p="",h=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(u=>!!u.href);for(let u of h)try{if(B(u.href))continue;let d="",w=!1;try{w=new URL(u.href,location.href).origin===location.origin}catch{}if(!w&&!ro(u.href,i))continue;if(w){let y=Array.from(document.styleSheets).find(x=>x.href===u.href);if(y)try{let x=y.cssRules||[];d=Array.from(x).map(k=>k.cssText).join("")}catch{}}if(!d&&(d=(await P(u.href,{as:"text",useProxy:r})).data,B(u.href)))continue;d=await ao(d,u.href,r);let g="";for(let y of d.match(io)||[]){let x=(y.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),k=It(x);if(!k||B(k))continue;let C=(y.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),M=(y.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),R=(y.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),F=(y.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),I=(y.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=oe(I,u.href);if(!a(k,M,C,R))continue;let W=Ee(F);if(!Fe(e,W))continue;let O={family:k,weightSpec:C,styleSpec:M,stretchSpec:R,unicodeRange:F,srcRaw:I,srcUrls:$,href:u.href};if(n&&l(O,W))continue;let v=/url\(/i.test(I)?await Le(y,u.href,r):y;g+=v}g.trim()&&(p+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",u.href)}let b={requiredIndex:s,usedCodepoints:e,faceMatchesRequired:a,simpleExcluder:n?Me(n):null,useProxy:r,visitedSheets:new Set,depth:0};for(let u of document.styleSheets)if(!(u.href&&h.some(d=>d.href===u.href)))try{let d=u.href||location.href;d&&b.visitedSheets.add(d),await Re(u,d,async w=>{p+=w},b)}catch{}try{for(let u of document.fonts||[]){if(!u||!u.family||u.status!=="loaded"||!u._snapdomSrc)continue;let d=String(u.family).replace(/^['"]+|['"]+$/g,"");if(B(d)||!s.has(d)||n?.families&&n.families.some(g=>String(g).toLowerCase()===d.toLowerCase()))continue;let w=u._snapdomSrc;if(!String(w).startsWith("data:")){if(S.resource?.has(u._snapdomSrc))w=S.resource.get(u._snapdomSrc),S.font?.add(u._snapdomSrc);else if(!S.font?.has(u._snapdomSrc))try{let g=await P(u._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(g.ok&&typeof g.data=="string")w=g.data,S.resource?.set(u._snapdomSrc,w),S.font?.add(u._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",u._snapdomSrc);continue}}p+=`@font-face{font-family:'${d}';src:url(${w});font-style:${u.style||"normal"};font-weight:${u.weight||"normal"};}`}}catch{}for(let u of o){if(!u||typeof u!="object")continue;let d=String(u.family||"").replace(/^['"]+|['"]+$/g,"");if(!d||B(d)||!s.has(d)||n?.families&&n.families.some(C=>String(C).toLowerCase()===d.toLowerCase()))continue;let w=u.weight!=null?String(u.weight):"normal",g=u.style!=null?String(u.style):"normal",y=u.stretchPct!=null?`${u.stretchPct}%`:"100%",x=String(u.src||""),k=x;if(!k.startsWith("data:")){if(S.resource?.has(x))k=S.resource.get(x),S.font?.add(x);else if(!S.font?.has(x))try{let C=await P(x,{as:"dataURL",useProxy:r,silent:!0});if(C.ok&&typeof C.data=="string")k=C.data,S.resource?.set(x,k),S.font?.add(x);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",x);continue}}p+=`@font-face{font-family:'${d}';src:url(${k});font-style:${g};font-weight:${w};font-stretch:${y};}`}return p&&(p=lo(p),S.resource?.set(c,p)),p}function Pt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=a=>{let l=It(a.fontFamily);if(!l)return;let c=(i,f,m)=>`${l}__${Lt(i)}__${ee(f)}__${to(m)}`;e.add(c(a.fontWeight,a.fontStyle,a.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let s=getComputedStyle(t,"::after");for(s&&s.content&&s.content!=="none"&&o(s);n.nextNode();){let a=n.currentNode,l=getComputedStyle(a);o(l);let c=getComputedStyle(a,"::before");c&&c.content&&c.content!=="none"&&o(c);let i=getComputedStyle(a,"::after");i&&i.content&&i.content!=="none"&&o(i)}return e}function Tt(t){let e=new Set,n=r=>{if(r)for(let s of r)e.add(s.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let s=r;for(let a of["::before","::after"]){let c=getComputedStyle(s,a)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let i=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(i)for(let f of i)try{e.add(parseInt(f.slice(1),16))}catch{}}}}}return e}async function _t(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let s of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${s}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",r.appendChild(a)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s)))}function Te(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function fo(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Ie(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 Ne(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],o=Math.max(1,Math.min(3999,t)),r="";for(let[s,a]of n)for(;o>=s;)r+=a,o-=s;return e?r:r.toLowerCase()}function Pe(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Ie(t,!1);case"upper-alpha":return Ie(t,!0);case"lower-roman":return Ne(t,!1);case"upper-roman":return Ne(t,!0);default:return String(Math.max(0,t))}}function _e(t){let e=()=>S?.session?.__counterEpoch??0,n=e(),o=new WeakMap,r=t instanceof Document?t.documentElement:t,s=p=>p&&p.tagName==="LI",a=p=>{let h=0,b=p?.parentElement;if(!b)return 0;for(let u of b.children){if(u===p)break;u.tagName==="LI"&&h++}return h},l=p=>{let h=new Map;for(let[b,u]of p)h.set(b,u.slice());return h},c=(p,h,b)=>{let u=l(p),d;try{d=b.style?.counterReset||getComputedStyle(b).counterReset}catch{}if(d&&d!=="none")for(let g of d.split(",")){let y=g.trim().split(/\s+/),x=y[0],k=Number.isFinite(Number(y[1]))?Number(y[1]):0;if(!x)continue;let C=h.get(x);if(C&&C.length){let M=C.slice();M.push(k),u.set(x,M)}else u.set(x,[k])}let w;try{w=b.style?.counterIncrement||getComputedStyle(b).counterIncrement}catch{}if(w&&w!=="none")for(let g of w.split(",")){let y=g.trim().split(/\s+/),x=y[0],k=Number.isFinite(Number(y[1]))?Number(y[1]):1;if(!x)continue;let C=u.get(x)||[];C.length===0&&C.push(0),C[C.length-1]+=k,u.set(x,C)}try{if(getComputedStyle(b).display==="list-item"&&s(b)){let y=b.parentElement,x=1;if(y&&y.tagName==="OL"){let C=y.getAttribute("start"),M=Number.isFinite(Number(C))?Number(C):1,R=a(b),F=b.getAttribute("value");x=Number.isFinite(Number(F))?Number(F):M+R}else x=1+a(b);let k=u.get("list-item")||[];k.length===0&&k.push(0),k[k.length-1]=x,u.set("list-item",k)}}catch{}return u},i=(p,h,b)=>{let u=c(b,h,p);o.set(p,u);let d=u;for(let w of p.children)d=i(w,u,d);return u},f=new Map;i(r,f,f);function m(){let p=e();if(p!==n){n=p;let h=new Map;i(r,h,h)}}return{get(p,h){m();let b=o.get(p)?.get(h);return b&&b.length?b[b.length-1]:0},getStack(p,h){m();let b=o.get(p)?.get(h);return b?b.slice():[]}}}function Ue(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,r=t.replace(o,(s,a,l)=>{let c=String(l).split(",").map(i=>i.trim());if(a==="counter"){let i=c[0]?.replace(/^["']|["']$/g,""),f=(c[1]||"decimal").toLowerCase(),m=n.get(e,i);return Pe(m,f)}else{let i=c[0]?.replace(/^["']|["']$/g,""),f=c[1]?.replace(/^["']|["']$/g,"")??"",m=(c[2]||"decimal").toLowerCase(),p=n.getStack(e,i);return p.length?p.map(b=>Pe(b,m)).join(f):""}});return fo(r)}catch{return"- "}}var mt=new WeakMap,We=-1;function mo(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function po(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):mo(t)}function re(t,e){let n=t.parentElement,o=n?mt.get(n):null;return o?{get(r,s){let a=e.get(r,s),l=o.get(s);return typeof l=="number"?Math.max(a,l):a},getStack(r,s){let a=e.getStack(r,s);if(!a.length)return a;let l=o.get(s);if(typeof l=="number"){let c=a.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return a}}:e}function se(t,e,n){let o=new Map;function r(c){let i=[];if(!c||c==="none")return i;for(let f of String(c).split(",")){let m=f.trim().split(/\s+/),p=m[0],h=Number.isFinite(Number(m[1]))?Number(m[1]):void 0;p&&i.push({name:p,num:h})}return i}let s=r(e?.counterReset),a=r(e?.counterIncrement);function l(c){if(o.has(c))return o.get(c).slice();let i=n.getStack(t,c);i=i.length?i.slice():[];let f=s.find(p=>p.name===c);if(f){let p=Number.isFinite(f.num)?f.num:0;i=i.length?[...i,p]:[p]}let m=a.find(p=>p.name===c);if(m){let p=Number.isFinite(m.num)?m.num:1;i.length===0&&(i=[0]),i[i.length-1]+=p}return o.set(c,i.slice()),i}return{get(c,i){let f=l(i);return f.length?f[f.length-1]:0},getStack(c,i){return l(i)},__incs:a}}function ho(t,e,n){let o;try{o=getComputedStyle(t,e)}catch{}let r=o?.content;if(!r||r==="none"||r==="normal")return{text:"",incs:[]};let s=re(t,n),a=se(t,o,s),l=Te(r)?Ue(r,t,a):r;return{text:po(l),incs:a.__incs||[]}}async function ae(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let r=S?.session?.__counterEpoch??0;if(We!==r&&(mt=new WeakMap,n&&(n.__counterCtx=null),We=r),!n.__counterCtx)try{n.__counterCtx=_e(t.ownerDocument||document)}catch{}let s=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let i=rt(t,c);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(c==="::first-letter"){let L=getComputedStyle(t);if(!(i.color!==L.color||i.fontSize!==L.fontSize||i.fontWeight!==L.fontWeight))continue;let T=Array.from(e.childNodes).find(ht=>ht.nodeType===Node.TEXT_NODE&&ht.textContent?.trim().length>0);if(!T)continue;let _=T.textContent,tt=_.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],kt=_.slice(tt?.length||0);if(!tt||/[\uD800-\uDFFF]/.test(tt))continue;let it=document.createElement("span");it.textContent=tt,it.dataset.snapdomPseudo="::first-letter";let Ot=Ft(i),Bt=dt(Ot,"span");n.styleMap.set(it,Bt);let At=document.createTextNode(kt);e.replaceChild(At,T),e.insertBefore(it,At);continue}let m=i.content,{text:p,incs:h}=ho(t,c,s),b=i.backgroundImage,u=i.backgroundColor,d=i.fontFamily,w=parseInt(i.fontSize)||32,g=parseInt(i.fontWeight)||!1,y=i.color||"#000",x=i.borderStyle,k=parseFloat(i.borderWidth),C=i.transform,M=B(d),R=m!=="none"&&p!=="",F=b&&b!=="none",I=u&&u!=="transparent"&&u!=="rgba(0, 0, 0, 0)",$=x&&x!=="none"&&k>0,W=C&&C!=="none";if(!(R||F||I||$||W)){if(h&&h.length&&t.parentElement){let L=mt.get(t.parentElement)||new Map;for(let{name:N}of h){if(!N)continue;let T=re(t,s),q=se(t,getComputedStyle(t,c),T).get(t,N);L.set(N,q)}mt.set(t.parentElement,L)}continue}let v=document.createElement("span");v.dataset.snapdomPseudo=c,v.style.display="inline",v.style.verticalAlign="baseline",v.style.pointerEvents="none";let z=Ft(i),X=dt(z,"span");if(n.styleMap.set(v,X),M&&p&&p.length===1){let{dataUrl:L,width:N,height:T}=await ve(p,d,g,w,y),_=document.createElement("img");_.src=L,_.style=`height:${w}px;width:${N/T*w}px;object-fit:contain;`,v.appendChild(_),e.dataset.snapdomHasIcon="true"}else if(p&&p.startsWith("url(")){let L=et(p);if(L?.trim())try{let N=document.createElement("img"),T=await P(J(L),{as:"dataURL",useProxy:o.useProxy});N.src=T.data,N.style=`width:${w}px;height:auto;object-fit:contain;`,v.appendChild(N)}catch(N){console.error(`[snapdom] Error in pseudo ${c} for`,t,N)}}else!M&&R&&(v.textContent=p);v.style.backgroundImage="none","maskImage"in v.style&&(v.style.maskImage="none"),"webkitMaskImage"in v.style&&(v.style.webkitMaskImage="none");try{v.style.backgroundRepeat=i.backgroundRepeat,v.style.backgroundSize=i.backgroundSize,i.backgroundPositionX&&i.backgroundPositionY?(v.style.backgroundPositionX=i.backgroundPositionX,v.style.backgroundPositionY=i.backgroundPositionY):v.style.backgroundPosition=i.backgroundPosition,v.style.backgroundOrigin=i.backgroundOrigin,v.style.backgroundClip=i.backgroundClip,v.style.backgroundAttachment=i.backgroundAttachment,v.style.backgroundBlendMode=i.backgroundBlendMode}catch{}if(F)try{let L=gt(b),N=await Promise.all(L.map(ot));v.style.backgroundImage=N.join(", ")}catch(L){console.warn(`[snapdom] Failed to inline background-image for ${c}`,L)}I&&(v.style.backgroundColor=u);let Z=v.childNodes.length>0||v.textContent?.trim()!==""||F||I||$||W;if(h&&h.length&&t.parentElement){let L=mt.get(t.parentElement)||new Map,N=re(t,s),T=se(t,getComputedStyle(t,c),N);for(let{name:_}of h){if(!_)continue;let q=T.get(t,_);L.set(_,q)}mt.set(t.parentElement,L)}if(!Z)continue;c==="::before"?e.insertBefore(v,e.firstChild):e.appendChild(v)}catch(i){console.warn(`[snapdom] Failed to capture ${c} for`,t,i)}let a=Array.from(t.children),l=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);for(let c=0;c<Math.min(a.length,l.length);c++)await ae(a[c],l[c],n,o)}function Oe(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,r=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(r.length===0)return;let s=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],l=g=>window.CSS&&CSS.escape?CSS.escape(g):g.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c=new Set(Array.from(t.querySelectorAll("[id]")).map(g=>g.id)),i=new Set,f=!1,m=g=>{if(!g)return;s.lastIndex=0;let y;for(;y=s.exec(g);){f=!0;let x=(y[1]||"").trim();x&&!c.has(x)&&i.add(x)}},p=g=>{let y=g.querySelectorAll('use[href^="#"], use[xlink\\:href^="#"]');for(let C of y){let M=C.getAttribute("href")||C.getAttribute("xlink:href");if(!M||!M.startsWith("#"))continue;f=!0;let R=M.slice(1).trim();R&&!c.has(R)&&i.add(R)}let k=g.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 C of k){m(C.getAttribute("style")||"");for(let M of a)m(C.getAttribute(M))}};for(let g of r)p(g);if(!f)return;let h=t.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(h,t.firstChild||null));let b=h.querySelector("defs")||null,u=g=>{if(!g||c.has(g))return null;let y=l(g),x=k=>{let C=o.querySelector(k);return C&&!t.contains(C)?C:null};return x(`svg defs > *#${y}`)||x(`svg > symbol#${y}`)||x(`*#${y}`)};if(!i.size)return;let d=new Set(i),w=new Set;for(;d.size;){let g=d.values().next().value;if(d.delete(g),!g||c.has(g)||w.has(g))continue;let y=u(g);if(!y){w.add(g);continue}b||(b=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(b));let x=y.cloneNode(!0);x.id||x.setAttribute("id",g),b.appendChild(x),w.add(g),c.add(g);let k=[x,...x.querySelectorAll("*")];for(let C of k){let M=C.getAttribute?.("href")||C.getAttribute?.("xlink:href");if(M&&M.startsWith("#")){let F=M.slice(1).trim();F&&!c.has(F)&&!w.has(F)&&d.add(F)}let R=C.getAttribute?.("style")||"";R&&m(R);for(let F of a){let I=C.getAttribute?.(F);I&&m(I)}}}}function De(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(),r=t.clientHeight,s="data-snap-ph",a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let l=a.currentNode,c=getComputedStyle(l),i=c.position;if(i!=="sticky"&&i!=="-webkit-sticky")continue;let f=Be(c.top),m=Be(c.bottom);if(f==null&&m==null)continue;let p=go(l,t),h=yo(e,p,s);if(!h)continue;let b=l.getBoundingClientRect(),u=b.width,d=b.height,w=b.left-o.left;if(!(u>0&&d>0)||!Number.isFinite(w))continue;let g=f!=null?f+n:n+(r-d-m);if(!Number.isFinite(g))continue;let y=Number.parseInt(c.zIndex,10),x=Number.isFinite(y),k=x?Math.max(y,1)+1:2,C=x?y-1:0,M=h.cloneNode(!1);M.setAttribute(s,"1"),M.style.position="sticky",M.style.left=`${w}px`,M.style.top=`${g}px`,M.style.width=`${u}px`,M.style.height=`${d}px`,M.style.visibility="hidden",M.style.zIndex=String(C),M.style.overflow="hidden",M.style.background="transparent",M.style.boxShadow="none",M.style.filter="none",h.parentElement?.insertBefore(M,h),h.style.position="absolute",h.style.left=`${w}px`,h.style.top=`${g}px`,h.style.bottom="auto",h.style.zIndex=String(k),h.style.pointerEvents="none"}}function Be(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function go(t,e){let n=[];for(let o=t;o&&o!==e;){let r=o.parentElement;if(!r)break;n.push(Array.prototype.indexOf.call(r.children,o)),o=r}return n.reverse()}function yo(t,e,n){let o=t;for(let r=0;r<e.length;r++)if(o=wo(o,n)[e[r]],!o)return null;return o instanceof HTMLElement?o:null}function wo(t,e){let n=[],o=t.children;for(let r=0;r<o.length;r++){let s=o[r];s.hasAttribute(e)||n.push(s)}return n}async function qe(t,e={}){let n={styleMap:S.session.styleMap,styleCache:S.session.styleCache,nodeMap:S.session.nodeMap},o,r="",s="";bo(t);try{Oe(t)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{o=await wt(t,n,e,t)}catch(c){throw console.warn("deepClone failed:",c),c}try{await ae(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await ko(o);try{let c=o.querySelectorAll("style[data-sd]");for(let i of c)s+=i.textContent||"",i.remove()}catch{}let a=Kt(n.styleMap);r=Array.from(a.entries()).map(([c,i])=>`.${i}{${c}}`).join(""),r=s+r;for(let[c,i]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",i.replace(/;/g,"; "));continue}let f=a.get(i);f&&c.classList.add(f);let m=c.style?.backgroundImage,p=c.dataset?.snapdomHasIcon;m&&m!=="none"&&(c.style.backgroundImage=m),p&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,i]of n.nodeMap.entries()){let f=i.scrollLeft,m=i.scrollTop;if((f||m)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";let h=document.createElement("div");for(h.style.transform=`translate(${-f}px, ${-m}px)`,h.style.willChange="transform",h.style.display="inline-block",h.style.width="100%";c.firstChild;)h.appendChild(c.firstChild);c.appendChild(h)}}let l=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(De(t,l),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,c);let i=jt(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=i||""}for(let[c,i]of n.nodeMap.entries())i.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:o,classCSS:r,styleCache:n.styleCache}}function bo(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,s=e.borderWidth,a=n!=="none"&&parseFloat(o)>0,l=r==="none"||parseFloat(s)===0;a&&l&&(t.style.border=`${o} solid transparent`)}var bt=new Map;async function St(t){if(S.resource?.has(t))return S.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await P(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return S.resource?.set(t,n.data),n.data})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var So=/\bblob:[^)"'\s]+/g;async function He(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(So)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=await St(o);n=n.split(o).join(r)}catch{}return n}function Ut(t){return typeof t=="string"&&t.startsWith("blob:")}function xo(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 Co(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function ko(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of e)try{let c=a.getAttribute("src")||a.currentSrc||"";if(Ut(c)){let f=await St(c);a.setAttribute("src",f)}let i=a.getAttribute("srcset");if(i&&i.includes("blob:")){let f=xo(i),m=!1;for(let p of f)if(Ut(p.url))try{p.url=await St(p.url),m=!0}catch{}m&&a.setAttribute("srcset",Co(f))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of n)try{let l="http://www.w3.org/1999/xlink",c=a.getAttribute("href")||a.getAttributeNS?.(l,"href");if(Ut(c)){let i=await St(c);a.setAttribute("href",i),a.removeAttributeNS?.(l,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of o)try{let l=a.getAttribute("style");if(l&&l.includes("blob:")){let c=await He(l);a.setAttribute("style",c)}}catch{}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of r)try{let l=a.textContent||"";l.includes("blob:")&&(a.textContent=await He(l))}catch{}let s=["poster"];for(let a of s){let l=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let c of l)try{let i=c.getAttribute(a);Ut(i)&&c.setAttribute(a,await St(i))}catch{}}}async function je(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async r=>{if(!r.getAttribute("src")){let f=r.currentSrc||r.src||"";f&&r.setAttribute("src",f)}r.removeAttribute("srcset"),r.removeAttribute("sizes");let s=r.src||"";if(!s)return;let a=await P(s,{as:"dataURL",useProxy:e.useProxy});if(a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")){r.src=a.data,r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let f=parseInt(r.dataset?.snapdomWidth||"",10)||0,m=parseInt(r.dataset?.snapdomHeight||"",10)||0,p=parseInt(r.getAttribute("width")||"",10)||0,h=parseInt(r.getAttribute("height")||"",10)||0,b=parseFloat(r.style?.width||"")||0,u=parseFloat(r.style?.height||"")||0,d=f||b||p||r.width||void 0,w=m||u||h||r.height||void 0,g=typeof l=="function"?await l({width:d,height:w,src:s,element:r}):l;if(g){let y=await P(g,{as:"dataURL",useProxy:e.useProxy});r.src=y.data,!r.width&&d&&(r.width=d),!r.height&&w&&(r.height=w),r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}}catch{}let c=r.width||r.naturalWidth||100,i=r.height||r.naturalHeight||100;if(e.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${c}px`,`height:${i}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${i}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",r.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${c}px;height:${i}px;visibility:hidden;`,r.replaceWith(f)}};for(let r=0;r<n.length;r+=4){let s=n.slice(r,r+4).map(o);await Promise.allSettled(s)}}async function Wt(t,e,n,o={}){let r=[[t,e]],s=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){let[i,f]=r.shift(),m=n.get(i)||rt(i);n.has(i)||n.set(i,m);let p=(()=>{let u=m.getPropertyValue("border-image"),d=m.getPropertyValue("border-image-source");return u&&u!=="none"||d&&d!=="none"})();for(let u of l){let d=m.getPropertyValue(u);d&&f.style.setProperty(u,d)}for(let u of s){let d=m.getPropertyValue(u);if(!d||d==="none")continue;let w=gt(d),g=await Promise.all(w.map(y=>ot(y,o)));g.some(y=>y&&y!=="none"&&!/^url\(undefined/.test(y))&&f.style.setProperty(u,g.join(", "))}for(let u of a){let d=m.getPropertyValue(u);!d||d==="initial"||f.style.setProperty(u,d)}if(p)for(let u of c){let d=m.getPropertyValue(u);!d||d==="initial"||f.style.setProperty(u,d)}let h=Array.from(i.children),b=Array.from(f.children).filter(u=>!(u.dataset&&u.dataset.snapdomPseudo));for(let u=0;u<Math.min(h.length,b.length);u++)r.push([h[u],b[u]])}}function Ve(t){if(!t)return()=>{};let e=Ao(t);if(e<=0)return()=>{};if(!$o(t))return()=>{};let n=getComputedStyle(t),o=Math.round(Mo(n)*e+vo(n)),r=t.textContent??"",s=r;if(t.scrollHeight<=o+.5)return()=>{};let a=0,l=r.length,c=-1;for(;a<=l;){let i=a+l>>1;t.textContent=r.slice(0,i)+"\u2026",t.scrollHeight<=o+.5?(c=i,a=i+1):l=i-1}return t.textContent=(c>=0?r.slice(0,c):"")+"\u2026",()=>{t.textContent=s}}function Ao(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 Mo(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 vo(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function $o(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var xt=[];function ze(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 ie(...t){let e=t.flat();for(let n of e){let o=ze(n);o&&(xt.some(r=>r&&r.name&&o.name&&r.name===o.name)||xt.push(o))}}function Xe(t){return(t&&Array.isArray(t.plugins)?t.plugins:xt)||xt}async function D(t,e,n){let o=n,r=Xe(e);for(let s of r){let a=s&&typeof s[t]=="function"?s[t]:null;if(!a)continue;let l=await a(e,o);typeof l<"u"&&(o=l)}return o}async function Ye(t,e,n){let o=[],r=Xe(e);for(let s of r){let a=s&&typeof s[t]=="function"?s[t]:null;if(!a)continue;let l=await a(e,n);typeof l<"u"&&o.push(l)}return o}function Eo(t){let e=[];if(Array.isArray(t))for(let n of t){let o=ze(n);if(!o||!o.name)continue;let r=e.findIndex(s=>s&&s.name===o.name);r>=0&&e.splice(r,1),e.push(o)}for(let n of xt)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function Ge(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=Eo(e)),t}function Fo(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let r=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=r.length?r:"none"}catch{}}async function le(t,e){if(!t)throw new Error("Element cannot be null or undefined");vt(e.cache);let n=e.fast,o=e.outerTransforms!==!1,r=!!e.outerShadows,s={element:t,options:e,plugins:e.plugins},a,l,c,i="",f="",m,p,h=null;await D("beforeSnap",s),await D("beforeClone",s);let b=Ve(s.element);try{({clone:a,classCSS:l,styleCache:c}=await qe(s.element,s.options)),!o&&a&&(h=Ro(s.element,a)),!r&&a&&Fo(s.element,a)}finally{b()}s={clone:a,classCSS:l,styleCache:c,...s},await D("afterClone",s);try{await ke(s.clone,s.element)}catch{}await new Promise(g=>{j(async()=>{await je(s.clone,s.options),g()},{fast:n})}),await new Promise(g=>{j(async()=>{await Wt(s.element,s.clone,s.styleCache,s.options),g()},{fast:n})}),e.embedFonts&&await new Promise(g=>{j(async()=>{let y=Pt(s.element),x=Tt(s.element);if(U()){let k=new Set(Array.from(y).map(C=>String(C).split("__")[0]).filter(Boolean));await _t(k,1)}i=await Nt({required:y,usedCodepoints:x,preCached:!1,exclude:s.options.excludeFonts,useProxy:s.options.useProxy}),g()},{fast:n})});let u=Yt(s.clone).sort(),d=u.join(",");S.baseStyle.has(d)?f=S.baseStyle.get(d):await new Promise(g=>{j(()=>{f=Gt(u),S.baseStyle.set(d,f),g()},{fast:n})}),s={fontsCSS:i,baseCSS:f,...s},await D("beforeRender",s),await new Promise(g=>{j(()=>{let y=getComputedStyle(s.element),x=s.element.getBoundingClientRect(),k=Math.max(1,A(s.element.offsetWidth||parseFloat(y.width)||x.width||1)),C=Math.max(1,A(s.element.offsetHeight||parseFloat(y.height)||x.height||1)),M=(lt,K=NaN)=>{let ut=typeof lt=="string"?parseFloat(lt):lt;return Number.isFinite(ut)?ut:K},R=M(s.options.width),F=M(s.options.height),I=k,$=C,W=Number.isFinite(R),O=Number.isFinite(F),v=C>0?k/C:1;W&&O?(I=Math.max(1,A(R)),$=Math.max(1,A(F))):W?(I=Math.max(1,A(R)),$=Math.max(1,A(I/(v||1)))):O?($=Math.max(1,A(F)),I=Math.max(1,A($*(v||1)))):(I=k,$=C);let z=0,X=0,at=k,Z=C;if(!o&&h&&Number.isFinite(h.a)){let lt={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},K=Ke(k,C,lt,0,0);z=A(K.minX),X=A(K.minY),at=A(K.maxX),Z=A(K.maxY)}else if(o&&To(s.element)){let K=y.transform&&y.transform!=="none"?y.transform:"",ut=_o(s.element),qt=Bo({baseTransform:K,rotate:ut.rotate||"0deg",scale:ut.scale,translate:ut.translate}),{ox:ln,oy:un}=Wo(y,k,C),fn=qt.is2D?qt:new DOMMatrix(qt.toString()),Mt=Ke(k,C,fn,ln,un);z=A(Mt.minX),X=A(Mt.minY),at=A(Mt.maxX),Z=A(Mt.maxY)}let L=Io(y),N=No(y),T=Po(y),_=Lo(y),q=r?{top:A(L.top+N.top+T.top+_.bleed.top),right:A(L.right+N.right+T.right+_.bleed.right),bottom:A(L.bottom+N.bottom+T.bottom+_.bleed.bottom),left:A(L.left+N.left+T.left+_.bleed.left)}:{top:0,right:0,bottom:0,left:0};z=A(z-q.left),X=A(X-q.top),at=A(at+q.right),Z=A(Z+q.bottom);let tt=Math.max(1,A(at-z)),kt=Math.max(1,A(Z-X)),it=W||O?A(I/k):1,Ot=O||W?A($/C):1,Bt=Math.max(1,A(tt*it)),At=Math.max(1,A(kt*Ot)),ht="http://www.w3.org/2000/svg",nn=U()?1:0,Y=A(nn+(o?0:1)),G=document.createElementNS(ht,"foreignObject"),on=A(z),rn=A(X);G.setAttribute("x",String(A(-(on-Y)))),G.setAttribute("y",String(A(-(rn-Y)))),G.setAttribute("width",String(A(k+Y*2))),G.setAttribute("height",String(A(C+Y*2))),G.style.overflow="visible";let fe=document.createElement("style");fe.textContent=s.baseCSS+s.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s.classCSS,G.appendChild(fe);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${A(k)}px`,ct.style.height=`${A(C)}px`,ct.style.overflow="visible",s.clone.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(s.clone),G.appendChild(ct);let sn=new XMLSerializer().serializeToString(G),Dt=A(tt+Y*2),Ht=A(kt+Y*2),de=W||O;e.meta={w0:k,h0:C,vbW:Dt,vbH:Ht,targetW:I,targetH:$};let an=U()&&de?Dt:A(Bt+Y*2),cn=U()&&de?Ht:A(At+Y*2);p=`<svg xmlns="${ht}" width="${an}" height="${cn}" viewBox="0 0 ${Dt} ${Ht}">`+sn+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,s={svgString:p,dataURL:m,...s},g()},{fast:n})}),await D("afterRender",s);let w=document.getElementById("snapdom-sandbox");return w&&w.style.position==="absolute"&&w.remove(),s.dataURL}var A=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t;function Lo(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,r=0,s=0,a=0,l=!1;for(let c of n){l=!0;let i=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(u=>parseFloat(u))||[],[f=0,m=0,p=0]=i,h=Math.abs(f)+p,b=Math.abs(m)+p;r=Math.max(r,h+Math.max(f,0)),a=Math.max(a,h+Math.max(-f,0)),s=Math.max(s,b+Math.max(m,0)),o=Math.max(o,b+Math.max(-m,0))}return{bleed:{top:A(o),right:A(r),bottom:A(s),left:A(a)},has:l}}function Ro(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 s=Je(t);if(s.a===1&&s.b===0&&s.c===0&&s.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let r=o.match(/^matrix\(\s*([^)]+)\)$/i);if(r){let s=r[1].split(",").map(a=>parseFloat(a.trim()));if(s.length===6&&s.every(Number.isFinite)){let[a,l,c,i]=s,f=Math.sqrt(a*a+l*l)||0,m=0,p=0,h=0,b=0,u=0,d=0;f>0&&(m=a/f,p=l/f,h=m*c+p*i,b=c-m*h,u=i-p*h,d=Math.sqrt(b*b+u*u)||0,d>0?h=h/d:h=0);let w=f,g=0,y=h*d,x=d;try{e.style.transform=`matrix(${w}, ${g}, ${y}, ${x}, 0, 0)`}catch{}return{a:w,b:g,c:y,d:x}}}try{let s=String(o).trim();return e.style.transform=s+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function Io(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),o=0,r=0,s=0,a=0;for(let l of n){let c=l.match(/-?\d+(\.\d+)?px/g)?.map(u=>parseFloat(u))||[];if(c.length<2)continue;let[i,f,m=0,p=0]=c,h=Math.abs(i)+m+p,b=Math.abs(f)+m+p;r=Math.max(r,h+Math.max(i,0)),a=Math.max(a,h+Math.max(-i,0)),s=Math.max(s,b+Math.max(f,0)),o=Math.max(o,b+Math.max(-f,0))}return{top:Math.ceil(o),right:Math.ceil(r),bottom:Math.ceil(s),left:Math.ceil(a)}}function No(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 Po(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Ke(t,e,n,o,r){let s=n.a,a=n.b,l=n.c,c=n.d,i=n.e||0,f=n.f||0;function m(w,g){let y=w-o,x=g-r,k=s*y+l*x,C=a*y+c*x;return k+=o+i,C+=r+f,[k,C]}let p=[m(0,0),m(t,0),m(0,e),m(t,e)],h=1/0,b=1/0,u=-1/0,d=-1/0;for(let[w,g]of p)w<h&&(h=w),g<b&&(b=g),w>u&&(u=w),g>d&&(d=g);return{minX:h,minY:b,maxX:u,maxY:d,width:u-h,height:d-b}}function To(t){return Uo(t)}function Je(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function _o(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let r=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},s=r("rotate");if(s)if(s.angle){let c=s.angle;e.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.unit}else s.unit?e.rotate=s.unit==="rad"?s.value*180/Math.PI+"deg":s.value+s.unit:e.rotate=String(s);else{let c=getComputedStyle(t);e.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let a=r("scale");if(a){let c="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,i="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:c;e.scale=`${c} ${i}`}else{let c=getComputedStyle(t);e.scale=c.scale&&c.scale!=="none"?c.scale:null}let l=r("translate");if(l){let c="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,i="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,f="x"in l&&l.x?.unit?l.x.unit:"px",m="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${c}${f} ${i}${m}`}else{let c=getComputedStyle(t);e.translate=c.translate&&c.translate!=="none"?c.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}function Uo(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 r=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",s=e.scale&&e.scale!=="none"&&e.scale!=="1",a=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(r||s||a)}function Wo(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[r,s]=[o[0]||"0",o[1]||"0"],a=(l,c)=>{let i=l.toLowerCase();return i==="left"||i==="top"?0:i==="center"?c/2:i==="right"||i==="bottom"?c:i.endsWith("px")?parseFloat(i)||0:i.endsWith("%")?(parseFloat(i)||0)*c/100:/^-?\d+(\.\d+)?$/.test(i)&&parseFloat(i)||0};return{ox:a(r,e),oy:a(s,n)}}var ce=null;function Oo(){if(ce)return ce;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),ce=t,t}function Bo(t){let e=Oo(),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=Je(n);return e.removeChild(n),o}function Do(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Qe(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Do(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1}}function Ho(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function qo(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function jo(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Vo(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let s=t[r];s==="("&&o++,s===")"&&(o=Math.max(0,o-1)),s===";"&&o===0?(e.push(n),n=""):n+=s}return n.trim()&&e.push(n),e.map(r=>r.trim()).filter(Boolean)}function zo(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let a=t[s];a==="("&&o++,a===")"&&(o=Math.max(0,o-1)),a===","&&o===0?(e.push(n.trim()),n=""):n+=a}n.trim()&&e.push(n.trim());let r=[];for(let s of e){if(/\binset\b/i.test(s))continue;let a=s.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",c="0px",i="0px"]=a,f=s.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),m=!!f&&f!==",";r.push(`drop-shadow(${l} ${c} ${i}${m?` ${f}`:""})`)}return r.join(" ")}function Ze(t){let e=Vo(t),n=null,o=null,r=null,s=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let i=l.slice(0,c).trim().toLowerCase(),f=l.slice(c+1).trim();i==="box-shadow"?r=f:i==="filter"?n=f:i==="-webkit-filter"?o=f:s.push([i,f])}if(r){let l=zo(r);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let a=[...s];return n&&a.push(["filter",n]),o&&a.push(["-webkit-filter",o]),a.map(([l,c])=>`${l}:${c}`).join(";")}function Xo(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Ze(o)}}`)}function Yo(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Xo(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Ze(o)}${n}`),t}function Go(t){if(!U()||!Ho(t))return t;try{let e=qo(t),n=Yo(e);return jo(n)}catch{return t}}async function V(t,e){let{width:n,height:o,scale:r=1,dpr:s=1,meta:a={}}=e;t=Go(t);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode();let c=l.naturalWidth,i=l.naturalHeight,f=Number.isFinite(a.w0)?a.w0:c,m=Number.isFinite(a.h0)?a.h0:i,p,h,b=Number.isFinite(n),u=Number.isFinite(o);if(b&&u)p=Math.max(1,n),h=Math.max(1,o);else if(b){let g=n/Math.max(1,f);p=n,h=m*g}else if(u){let g=o/Math.max(1,m);h=o,p=f*g}else p=c,h=i;p=p*r,h=h*r;let d=document.createElement("canvas");d.width=p*s,d.height=h*s,d.style.width=`${p}px`,d.style.height=`${h}px`;let w=d.getContext("2d");return s!==1&&w.scale(s,s),w.drawImage(l,0,0,p,h),d}async function H(t,e){let n=await V(t,e),o=e.backgroundColor?nt(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=`${o.width/e.dpr}px`,r.style.height=`${o.height/e.dpr}px`,r}async function pt(t,e){let{scale:n=1,width:o,height:r,meta:s={}}=e,a=Number.isFinite(o),l=Number.isFinite(r),c=Number.isFinite(n)&&n!==1||a||l;if(U()&&c)return await H(t,{...e,format:"png",quality:1,meta:s});let i=new Image;if(i.decoding="sync",i.loading="eager",i.src=t,await i.decode(),a&&l)i.style.width=`${o}px`,i.style.height=`${r}px`;else if(a){let f=Number.isFinite(s.w0)?s.w0:i.naturalWidth,m=Number.isFinite(s.h0)?s.h0:i.naturalHeight,p=o/Math.max(1,f);i.style.width=`${o}px`,i.style.height=`${Math.round(m*p)}px`}else if(l){let f=Number.isFinite(s.w0)?s.w0:i.naturalWidth,m=Number.isFinite(s.h0)?s.h0:i.naturalHeight,p=r/Math.max(1,m);i.style.height=`${r}px`,i.style.width=`${Math.round(f*p)}px`}else{let f=Math.round(i.naturalWidth*n),m=Math.round(i.naturalHeight*n);if(i.style.width=`${f}px`,i.style.height=`${m}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${f}"`).replace(/height="[^"]*"/,`height="${m}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,i.src=t}catch{}}return i}async function Ct(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await V(t,e),r=e.backgroundColor?nt(o,e.backgroundColor):o;return new Promise(s=>r.toBlob(a=>s(a),`image/${n}`,e.quality))}async function tn(t,e){if(e.dpr=1,e.format==="svg"){let s=await Ct(t,{...e,type:"svg"}),a=URL.createObjectURL(s),l=document.createElement("a");l.href=a,l.download=e.filename,l.click(),URL.revokeObjectURL(a);return}let n=await V(t,e),o=e.backgroundColor?nt(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}E.plugins=(...t)=>(ie(...t),E);var en=Symbol("snapdom.internal"),Q=Symbol("snapdom.internal.silent"),ue=!1;async function E(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Qe(e);if(Ge(n,e&&e.plugins),U()&&(n.embedFonts===!0||Jo(t)))for(let o=0;o<3;o++)try{await Ko(t,e),console.log("safariWarmup:",o),ue=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&Ce(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>E.toPng(o,r),toSvg:(o,r)=>E.toSvg(o,r)}),E.capture(t,n,en)}E.plugins=(...t)=>(ie(...t),E);E.capture=async(t,e,n)=>{if(n!==en)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await le(t,e),r={img:async(u,d)=>pt(o,{...u,...d||{}}),svg:async(u,d)=>pt(o,{...u,...d||{}}),canvas:async(u,d)=>V(o,{...u,...d||{}}),blob:async(u,d)=>Ct(o,{...u,...d||{}}),png:async(u,d)=>H(o,{...u,...d||{},format:"png"}),jpeg:async(u,d)=>H(o,{...u,...d||{},format:"jpeg"}),webp:async(u,d)=>H(o,{...u,...d||{},format:"webp"}),download:async(u,d)=>tn(o,{...u,...d||{}})},a={...e,export:{url:o},exports:{svg:u=>pt(o,{...e,...u||{},[Q]:!0}),canvas:u=>V(o,{...e,...u||{},[Q]:!0}),png:u=>H(o,{...e,...u||{},format:"png",[Q]:!0}),jpeg:u=>H(o,{...e,...u||{},format:"jpeg",[Q]:!0}),jpg:u=>H(o,{...e,...u||{},format:"jpeg",[Q]:!0}),webp:u=>H(o,{...e,...u||{},format:"webp",[Q]:!0}),blob:u=>Ct(o,{...e,...u||{},[Q]:!0}),img:u=>pt(o,{...e,...u||{},[Q]:!0})}},l=await Ye("defineExports",a),c=Object.assign({},...l.filter(u=>u&&typeof u=="object")),i={...r,...c};i.jpeg&&!i.jpg&&(i.jpg=(u,d)=>i.jpeg(u,d));function f(u,d){let w={...e,...d||{}};return(u==="jpeg"||u==="jpg")&&(w.backgroundColor==null||w.backgroundColor==="transparent")&&(w.backgroundColor="#ffffff"),w}let m=!1,p=Promise.resolve();async function h(u,d){let w=async()=>{let g=i[u];if(!g)throw new Error(`[snapdom] Unknown export type: ${u}`);let y=f(u,d),x={...e,export:{type:u,options:y,url:o}};await D("beforeExport",x);let k=await g(x,y);return await D("afterExport",x,k),m||(m=!0,await D("afterSnap",e)),k};return p=p.then(w)}let b={url:o,toRaw:()=>o,to:(u,d)=>h(u,d),toImg:u=>h("img",u),toSvg:u=>h("svg",u),toCanvas:u=>h("canvas",u),toBlob:u=>h("blob",u),toPng:u=>h("png",u),toJpg:u=>h("jpg",u),toWebp:u=>h("webp",u),download:u=>h("download",u)};for(let u of Object.keys(i)){let d="to"+u.charAt(0).toUpperCase()+u.slice(1);b[d]||(b[d]=w=>h(u,w))}return b};E.toRaw=(t,e)=>E(t,e).then(n=>n.toRaw());E.toImg=(t,e)=>E(t,e).then(n=>n.toImg());E.toSvg=(t,e)=>E(t,e).then(n=>n.toSvg());E.toCanvas=(t,e)=>E(t,e).then(n=>n.toCanvas());E.toBlob=(t,e)=>E(t,e).then(n=>n.toBlob());E.toPng=(t,e)=>E(t,{...e,format:"png"}).then(n=>n.toPng());E.toJpg=(t,e)=>E(t,{...e,format:"jpeg"}).then(n=>n.toJpg());E.toWebp=(t,e)=>E(t,{...e,format:"webp"}).then(n=>n.toWebp());E.download=(t,e)=>E(t,e).then(n=>n.download());async function Ko(t,e){if(ue)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await le(t,n)}catch{}await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r))),o&&await new Promise(r=>{let s=new Image;try{s.decoding="sync",s.loading="eager"}catch{}s.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",s.src=o,document.body.appendChild(s),(async()=>{try{typeof s.decode=="function"&&await s.decode()}catch{}let a=performance.now();for(;!(s.complete&&s.naturalWidth>0)&&performance.now()-a<900;)await new Promise(l=>setTimeout(l,50));await new Promise(l=>requestAnimationFrame(l));try{s.remove()}catch{}r()})()}),t.querySelectorAll("canvas").forEach(r=>{try{let s=r.getContext("2d",{willReadFrequently:!0});s&&s.getImageData(0,0,1,1)}catch{}}),ue=!0}function Jo(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),r=o.backgroundImage&&o.backgroundImage!=="none",s=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(r||s||n.tagName==="CANVAS")return!0}return!1}async function Qo(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,r=e.cache??e.cacheOpt??"full";vt(r);try{await document.fonts?.ready}catch{}try{zt()}catch{}S.session=S.session||{},S.session.styleCache||(S.session.styleCache=new WeakMap),S.image=S.image||new Map,S.background=S.background||new Map;try{await Wt(t,void 0,S.session.styleCache,{useProxy:o})}catch{}let s=[],a=[];try{if(t&&t.nodeType===1){let c=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];a=[t,...c],s=[],t.tagName==="IMG"&&t.getAttribute("src")&&s.push(t),s.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(s=Array.from(t.querySelectorAll("img[src]")),a=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let c of s){let i=c?.currentSrc||c?.src;if(i&&!S.image.has(i)){let f=Promise.resolve().then(async()=>{let m=await P(i,{as:"dataURL",useProxy:o});m?.ok&&typeof m.data=="string"&&S.image.set(i,m.data)}).catch(()=>{});l.push(f)}}for(let c of a){let i="";try{i=c?.style?.backgroundImage||"",(!i||i==="none")&&(i=rt(c).backgroundImage)}catch{}if(i&&i!=="none"){let f=i.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let m of f){let p=Promise.resolve().then(()=>ot(m,{...e,useProxy:o})).catch(()=>{});l.push(p)}}}if(n)try{let c=Pt(t),i=Tt(t);if(typeof U=="function"?U():!!U){let m=new Set(Array.from(c).map(p=>String(p).split("__")[0]).filter(Boolean));await _t(m,3)}await Nt({required:c,usedCodepoints:i,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o})}catch{}await Promise.allSettled(l)}export{Qo as preCache,E as snapdom};
8
+ `):f+=p[0]}return f+=l.slice(d),f}let a=Me(t,e||location.href);return a=await s(a,e||location.href,0),a}var Fe=/url\((["']?)([^"')]+)\1\)/g,uo=/@font-face[^{}]*\{[^}]*\}/g;function $e(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let r=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!r)continue;let s=r[1],a=r[2],l=c=>{if(!c.includes("?"))return parseInt(c,16);let i=parseInt(c.replace(/\?/g,"0"),16),f=parseInt(c.replace(/\?/g,"F"),16);return[i,f]};if(a){let c=l(s),i=l(a),f=Array.isArray(c)?c[0]:c,d=Array.isArray(i)?i[1]:i;e.push([Math.min(f,d),Math.max(f,d)])}else{let c=l(s);Array.isArray(c)?e.push([c[0],c[1]]):e.push([c,c])}}return e}function Ie(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,r]of e)if(n>=o&&n<=r)return!0;return!1}function oe(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(Fe)){let r=(o[2]||"").trim();if(!(!r||r.startsWith("data:"))){if(!/^https?:/i.test(r))try{r=new URL(r,e||location.href).href}catch{}n.push(r)}}return n}async function Le(t,e,n=""){let o=t;for(let r of t.matchAll(Fe)){let s=nt(r[0]);if(!s)continue;let a=s;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,e||location.href).href}catch{}if(!B(a)){if(x.resource?.has(a)){x.font?.add(a),o=o.replace(r[0],`url(${x.resource.get(a)})`);continue}if(!x.font?.has(a))try{let l=await T(a,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let c=l.data;x.resource?.set(a,c),x.font?.add(a),o=o.replace(r[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return o}function fo(t){if(!t.length)return null;let e=(l,c)=>t.some(([i,f])=>!(f<l||i>c)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),r=e(880,1023),s=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":s?"cyrillic":r?"greek":o?"latin-ext":n?"latin":null}function ve(t={}){let e=new Set((t.families||[]).map(r=>String(r).toLowerCase())),n=new Set((t.domains||[]).map(r=>String(r).toLowerCase())),o=new Set((t.subsets||[]).map(r=>String(r).toLowerCase()));return(r,s)=>{if(e.size&&e.has(r.family.toLowerCase()))return!0;if(n.size)for(let a of r.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(o.size){let a=fo(s);if(a&&o.has(a))return!0}return!1}}function mo(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let s of t.match(e)||[]){let a=s.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Nt(a),c=(s.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),i=(s.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),f=(s.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),d=(s.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),p=(s.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),h=oe(p,location.href),w=h.length?h.map(m=>String(m).toLowerCase()).sort().join("|"):p.toLowerCase(),u=[String(l||"").toLowerCase(),c,i,f,d.toLowerCase(),w].join("|");n.has(u)||(n.add(u),o.push(s))}if(o.length===0)return t;let r=0;return t.replace(e,()=>o[r++]||"")}function po(t,e,n,o){let r=Array.from(t||[]).sort().join("|"),s=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()}):"",a=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|");return`fonts-embed-css::req=${r}::ex=${s}::lf=${a}::px=${o||""}`}async function Ne(t,e,n,o){let r;try{r=t.cssRules||[]}catch{return}let s=(a,l)=>{try{return new URL(a,l||location.href).href}catch{return a}};for(let a of r){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let l=a.href?s(a.href,e):e;if(o.depth>=Lt){console.warn(`[snapDOM] CSSOM import depth exceeded (${Lt}) at ${l}`);continue}if(l&&o.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&o.visitedSheets.add(l);let c={...o,depth:(o.depth||0)+1};await Ne(a.styleSheet,l,n,c);continue}if(a.type===CSSRule.FONT_FACE_RULE){let l=(a.style.getPropertyValue("font-family")||"").trim(),c=Nt(l);if(!c||B(c))continue;let i=(a.style.getPropertyValue("font-weight")||"400").trim(),f=(a.style.getPropertyValue("font-style")||"normal").trim(),d=(a.style.getPropertyValue("font-stretch")||"100%").trim(),p=(a.style.getPropertyValue("src")||"").trim(),h=(a.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(c,f,i,d))continue;let w=$e(h);if(!Ie(o.usedCodepoints,w))continue;let u={family:c,weightSpec:i,styleSpec:f,stretchSpec:d,unicodeRange:h,srcRaw:p,srcUrls:oe(p,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(u,w))continue;if(/url\(/i.test(p)){let m=await Le(p,e||location.href,o.useProxy);await n(`@font-face{font-family:${c};src:${m};font-style:${f};font-weight:${i};font-stretch:${d};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${c};src:${p};font-style:${f};font-weight:${i};font-stretch:${d};${h?`unicode-range:${h};`:""}}`)}}}async function Rt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let s=new Map;for(let u of t){let[m,y,g,b]=String(u).split("__");if(!m)continue;let S=s.get(m)||[];S.push({w:parseInt(y,10),s:g,st:parseInt(b,10)}),s.set(m,S)}function a(u,m,y,g){if(!s.has(u))return!1;let b=s.get(u),S=ro(y),k=so(m),C=ao(g),M=S.min!==S.max,L=S.min,$=E=>k.kind==="normal"&&E==="normal"||k.kind!=="normal"&&(E==="italic"||E==="oblique"),N=!1;for(let E of b){let U=M?E.w>=S.min&&E.w<=S.max:E.w===L,O=$(ee(E.s)),v=E.st>=C.min&&E.st<=C.max;if(U&&O&&v){N=!0;break}}if(N)return!0;if(!M)for(let E of b){let U=$(ee(E.s)),O=E.st>=C.min&&E.st<=C.max;if(Math.abs(L-E.w)<=300&&U&&O)return!0}return!1}let l=ve(n),c=po(t,n,o,r);if(x.resource?.has(c))return x.resource.get(c);let i=co(t),f=[],d=ne;for(let u of document.querySelectorAll("style")){let m=u.textContent||"";for(let y of m.matchAll(d)){let g=(y[2]||y[4]||"").trim();if(!g||B(g))continue;!!document.querySelector(`link[rel="stylesheet"][href="${g}"]`)||f.push(g)}}f.length&&await Promise.all(f.map(u=>new Promise(m=>{if(document.querySelector(`link[rel="stylesheet"][href="${u}"]`))return m(null);let y=document.createElement("link");y.rel="stylesheet",y.href=u,y.setAttribute("data-snapdom","injected-import"),y.onload=()=>m(y),y.onerror=()=>m(null),document.head.appendChild(y)})));let p="",h=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(u=>!!u.href);for(let u of h)try{if(B(u.href))continue;let m="",y=!1;try{y=new URL(u.href,location.href).origin===location.origin}catch{}if(!y&&!io(u.href,i))continue;if(y){let b=Array.from(document.styleSheets).find(S=>S.href===u.href);if(b)try{let S=b.cssRules||[];m=Array.from(S).map(k=>k.cssText).join("")}catch{}}if(!m&&(m=(await T(u.href,{as:"text",useProxy:r})).data,B(u.href)))continue;m=await lo(m,u.href,r);let g="";for(let b of m.match(uo)||[]){let S=(b.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),k=Nt(S);if(!k||B(k))continue;let C=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),M=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),L=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),$=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(b.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),E=oe(N,u.href);if(!a(k,M,C,L))continue;let U=$e($);if(!Ie(e,U))continue;let O={family:k,weightSpec:C,styleSpec:M,stretchSpec:L,unicodeRange:$,srcRaw:N,srcUrls:E,href:u.href};if(n&&l(O,U))continue;let v=/url\(/i.test(N)?await Le(b,u.href,r):b;g+=v}g.trim()&&(p+=g)}catch{console.warn("[snapDOM] Failed to process stylesheet:",u.href)}let w={requiredIndex:s,usedCodepoints:e,faceMatchesRequired:a,simpleExcluder:n?ve(n):null,useProxy:r,visitedSheets:new Set,depth:0};for(let u of document.styleSheets)if(!(u.href&&h.some(m=>m.href===u.href)))try{let m=u.href||location.href;m&&w.visitedSheets.add(m),await Ne(u,m,async y=>{p+=y},w)}catch{}try{for(let u of document.fonts||[]){if(!u||!u.family||u.status!=="loaded"||!u._snapdomSrc)continue;let m=String(u.family).replace(/^['"]+|['"]+$/g,"");if(B(m)||!s.has(m)||n?.families&&n.families.some(g=>String(g).toLowerCase()===m.toLowerCase()))continue;let y=u._snapdomSrc;if(!String(y).startsWith("data:")){if(x.resource?.has(u._snapdomSrc))y=x.resource.get(u._snapdomSrc),x.font?.add(u._snapdomSrc);else if(!x.font?.has(u._snapdomSrc))try{let g=await T(u._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(g.ok&&typeof g.data=="string")y=g.data,x.resource?.set(u._snapdomSrc,y),x.font?.add(u._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",u._snapdomSrc);continue}}p+=`@font-face{font-family:'${m}';src:url(${y});font-style:${u.style||"normal"};font-weight:${u.weight||"normal"};}`}}catch{}for(let u of o){if(!u||typeof u!="object")continue;let m=String(u.family||"").replace(/^['"]+|['"]+$/g,"");if(!m||B(m)||!s.has(m)||n?.families&&n.families.some(C=>String(C).toLowerCase()===m.toLowerCase()))continue;let y=u.weight!=null?String(u.weight):"normal",g=u.style!=null?String(u.style):"normal",b=u.stretchPct!=null?`${u.stretchPct}%`:"100%",S=String(u.src||""),k=S;if(!k.startsWith("data:")){if(x.resource?.has(S))k=x.resource.get(S),x.font?.add(S);else if(!x.font?.has(S))try{let C=await T(S,{as:"dataURL",useProxy:r,silent:!0});if(C.ok&&typeof C.data=="string")k=C.data,x.resource?.set(S,k),x.font?.add(S);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",S);continue}}p+=`@font-face{font-family:'${m}';src:url(${k});font-style:${g};font-weight:${y};font-stretch:${b};}`}return p&&(p=mo(p),x.resource?.set(c,p)),p}function Tt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=a=>{let l=Nt(a.fontFamily);if(!l)return;let c=(i,f,d)=>`${l}__${It(i)}__${ee(f)}__${oo(d)}`;e.add(c(a.fontWeight,a.fontStyle,a.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let s=getComputedStyle(t,"::after");for(s&&s.content&&s.content!=="none"&&o(s);n.nextNode();){let a=n.currentNode,l=getComputedStyle(a);o(l);let c=getComputedStyle(a,"::before");c&&c.content&&c.content!=="none"&&o(c);let i=getComputedStyle(a,"::after");i&&i.content&&i.content!=="none"&&o(i)}return e}function Pt(t){let e=new Set,n=r=>{if(r)for(let s of r)e.add(s.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let s=r;for(let a of["::before","::after"]){let c=getComputedStyle(s,a)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let i=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(i)for(let f of i)try{e.add(parseInt(f.slice(1),16))}catch{}}}}}return e}async function _t(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let s of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${s}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",r.appendChild(a)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s)))}function _e(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function ho(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Re(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 Te(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],o=Math.max(1,Math.min(3999,t)),r="";for(let[s,a]of n)for(;o>=s;)r+=a,o-=s;return e?r:r.toLowerCase()}function Pe(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Re(t,!1);case"upper-alpha":return Re(t,!0);case"lower-roman":return Te(t,!1);case"upper-roman":return Te(t,!0);default:return String(Math.max(0,t))}}function We(t){let e=()=>x?.session?.__counterEpoch??0,n=e(),o=new WeakMap,r=t instanceof Document?t.documentElement:t,s=p=>p&&p.tagName==="LI",a=p=>{let h=0,w=p?.parentElement;if(!w)return 0;for(let u of w.children){if(u===p)break;u.tagName==="LI"&&h++}return h},l=p=>{let h=new Map;for(let[w,u]of p)h.set(w,u.slice());return h},c=(p,h,w)=>{let u=l(p),m;try{m=w.style?.counterReset||getComputedStyle(w).counterReset}catch{}if(m&&m!=="none")for(let g of m.split(",")){let b=g.trim().split(/\s+/),S=b[0],k=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!S)continue;let C=h.get(S);if(C&&C.length){let M=C.slice();M.push(k),u.set(S,M)}else u.set(S,[k])}let y;try{y=w.style?.counterIncrement||getComputedStyle(w).counterIncrement}catch{}if(y&&y!=="none")for(let g of y.split(",")){let b=g.trim().split(/\s+/),S=b[0],k=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!S)continue;let C=u.get(S)||[];C.length===0&&C.push(0),C[C.length-1]+=k,u.set(S,C)}try{if(getComputedStyle(w).display==="list-item"&&s(w)){let b=w.parentElement,S=1;if(b&&b.tagName==="OL"){let C=b.getAttribute("start"),M=Number.isFinite(Number(C))?Number(C):1,L=a(w),$=w.getAttribute("value");S=Number.isFinite(Number($))?Number($):M+L}else S=1+a(w);let k=u.get("list-item")||[];k.length===0&&k.push(0),k[k.length-1]=S,u.set("list-item",k)}}catch{}return u},i=(p,h,w)=>{let u=c(w,h,p);o.set(p,u);let m=u;for(let y of p.children)m=i(y,u,m);return u},f=new Map;i(r,f,f);function d(){let p=e();if(p!==n){n=p;let h=new Map;i(r,h,h)}}return{get(p,h){d();let w=o.get(p)?.get(h);return w&&w.length?w[w.length-1]:0},getStack(p,h){d();let w=o.get(p)?.get(h);return w?w.slice():[]}}}function Ue(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,r=t.replace(o,(s,a,l)=>{let c=String(l).split(",").map(i=>i.trim());if(a==="counter"){let i=c[0]?.replace(/^["']|["']$/g,""),f=(c[1]||"decimal").toLowerCase(),d=n.get(e,i);return Pe(d,f)}else{let i=c[0]?.replace(/^["']|["']$/g,""),f=c[1]?.replace(/^["']|["']$/g,"")??"",d=(c[2]||"decimal").toLowerCase(),p=n.getStack(e,i);return p.length?p.map(w=>Pe(w,d)).join(f):""}});return ho(r)}catch{return"- "}}var mt=new WeakMap,Oe=-1;function go(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function yo(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):go(t)}function re(t,e){let n=t.parentElement,o=n?mt.get(n):null;return o?{get(r,s){let a=e.get(r,s),l=o.get(s);return typeof l=="number"?Math.max(a,l):a},getStack(r,s){let a=e.getStack(r,s);if(!a.length)return a;let l=o.get(s);if(typeof l=="number"){let c=a.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return a}}:e}function se(t,e,n){let o=new Map;function r(c){let i=[];if(!c||c==="none")return i;for(let f of String(c).split(",")){let d=f.trim().split(/\s+/),p=d[0],h=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;p&&i.push({name:p,num:h})}return i}let s=r(e?.counterReset),a=r(e?.counterIncrement);function l(c){if(o.has(c))return o.get(c).slice();let i=n.getStack(t,c);i=i.length?i.slice():[];let f=s.find(p=>p.name===c);if(f){let p=Number.isFinite(f.num)?f.num:0;i=i.length?[...i,p]:[p]}let d=a.find(p=>p.name===c);if(d){let p=Number.isFinite(d.num)?d.num:1;i.length===0&&(i=[0]),i[i.length-1]+=p}return o.set(c,i.slice()),i}return{get(c,i){let f=l(i);return f.length?f[f.length-1]:0},getStack(c,i){return l(i)},__incs:a}}function wo(t,e,n){let o;try{o=getComputedStyle(t,e)}catch{}let r=o?.content;if(!r||r==="none"||r==="normal")return{text:"",incs:[]};let s=re(t,n),a=se(t,o,s),l=_e(r)?Ue(r,t,a):r;return{text:yo(l),incs:a.__incs||[]}}async function ae(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let r=x?.session?.__counterEpoch??0;if(Oe!==r&&(mt=new WeakMap,n&&(n.__counterCtx=null),Oe=r),!n.__counterCtx)try{n.__counterCtx=We(t.ownerDocument||document)}catch{}let s=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let i=rt(t,c);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(c==="::first-letter"){let I=getComputedStyle(t);if(!(i.color!==I.color||i.fontSize!==I.fontSize||i.fontWeight!==I.fontWeight))continue;let P=Array.from(e.childNodes).find(ht=>ht.nodeType===Node.TEXT_NODE&&ht.textContent?.trim().length>0);if(!P)continue;let _=P.textContent,et=_.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],kt=_.slice(et?.length||0);if(!et||/[\uD800-\uDFFF]/.test(et))continue;let it=document.createElement("span");it.textContent=et,it.dataset.snapdomPseudo="::first-letter";let Ot=$t(i),Bt=ft(Ot,"span");n.styleMap.set(it,Bt);let At=document.createTextNode(kt);e.replaceChild(At,P),e.insertBefore(it,At);continue}let d=i.content,{text:p,incs:h}=wo(t,c,s),w=i.backgroundImage,u=i.backgroundColor,m=i.fontFamily,y=parseInt(i.fontSize)||32,g=parseInt(i.fontWeight)||!1,b=i.color||"#000",S=i.borderStyle,k=parseFloat(i.borderWidth),C=i.transform,M=B(m),L=d!=="none"&&p!=="",$=w&&w!=="none",N=u&&u!=="transparent"&&u!=="rgba(0, 0, 0, 0)",E=S&&S!=="none"&&k>0,U=C&&C!=="none";if(!(L||$||N||E||U)){if(h&&h.length&&t.parentElement){let I=mt.get(t.parentElement)||new Map;for(let{name:R}of h){if(!R)continue;let P=re(t,s),j=se(t,getComputedStyle(t,c),P).get(t,R);I.set(R,j)}mt.set(t.parentElement,I)}continue}let v=document.createElement("span");v.dataset.snapdomPseudo=c,v.style.display="inline",v.style.verticalAlign="baseline",v.style.pointerEvents="none";let Y=$t(i),K=ft(Y,"span");if(n.styleMap.set(v,K),M&&p&&p.length===1){let{dataUrl:I,width:R,height:P}=await Ee(p,m,g,y,b),_=document.createElement("img");_.src=I,_.style=`height:${y}px;width:${R/P*y}px;object-fit:contain;`,v.appendChild(_),e.dataset.snapdomHasIcon="true"}else if(p&&p.startsWith("url(")){let I=nt(p);if(I?.trim())try{let R=document.createElement("img"),P=await T(J(I),{as:"dataURL",useProxy:o.useProxy});R.src=P.data,R.style=`width:${y}px;height:auto;object-fit:contain;`,v.appendChild(R)}catch(R){console.error(`[snapdom] Error in pseudo ${c} for`,t,R)}}else!M&&L&&(v.textContent=p);v.style.backgroundImage="none","maskImage"in v.style&&(v.style.maskImage="none"),"webkitMaskImage"in v.style&&(v.style.webkitMaskImage="none");try{v.style.backgroundRepeat=i.backgroundRepeat,v.style.backgroundSize=i.backgroundSize,i.backgroundPositionX&&i.backgroundPositionY?(v.style.backgroundPositionX=i.backgroundPositionX,v.style.backgroundPositionY=i.backgroundPositionY):v.style.backgroundPosition=i.backgroundPosition,v.style.backgroundOrigin=i.backgroundOrigin,v.style.backgroundClip=i.backgroundClip,v.style.backgroundAttachment=i.backgroundAttachment,v.style.backgroundBlendMode=i.backgroundBlendMode}catch{}if($)try{let I=gt(w),R=await Promise.all(I.map(ot));v.style.backgroundImage=R.join(", ")}catch(I){console.warn(`[snapdom] Failed to inline background-image for ${c}`,I)}N&&(v.style.backgroundColor=u);let tt=v.childNodes.length>0||v.textContent?.trim()!==""||$||N||E||U;if(h&&h.length&&t.parentElement){let I=mt.get(t.parentElement)||new Map,R=re(t,s),P=se(t,getComputedStyle(t,c),R);for(let{name:_}of h){if(!_)continue;let j=P.get(t,_);I.set(_,j)}mt.set(t.parentElement,I)}if(!tt)continue;c==="::before"?e.insertBefore(v,e.firstChild):e.appendChild(v)}catch(i){console.warn(`[snapdom] Failed to capture ${c} for`,t,i)}let a=Array.from(t.children),l=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);for(let c=0;c<Math.min(a.length,l.length);c++)await ae(a[c],l[c],n,o)}function Be(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,r=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(r.length===0)return;let s=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],l=g=>window.CSS&&CSS.escape?CSS.escape(g):g.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c=new Set(Array.from(t.querySelectorAll("[id]")).map(g=>g.id)),i=new Set,f=!1,d=g=>{if(!g)return;s.lastIndex=0;let b;for(;b=s.exec(g);){f=!0;let S=(b[1]||"").trim();S&&!c.has(S)&&i.add(S)}},p=g=>{let b=g.querySelectorAll('use[href^="#"], use[xlink\\:href^="#"]');for(let C of b){let M=C.getAttribute("href")||C.getAttribute("xlink:href");if(!M||!M.startsWith("#"))continue;f=!0;let L=M.slice(1).trim();L&&!c.has(L)&&i.add(L)}let k=g.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 C of k){d(C.getAttribute("style")||"");for(let M of a)d(C.getAttribute(M))}};for(let g of r)p(g);if(!f)return;let h=t.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(h,t.firstChild||null));let w=h.querySelector("defs")||null,u=g=>{if(!g||c.has(g))return null;let b=l(g),S=k=>{let C=o.querySelector(k);return C&&!t.contains(C)?C:null};return S(`svg defs > *#${b}`)||S(`svg > symbol#${b}`)||S(`*#${b}`)};if(!i.size)return;let m=new Set(i),y=new Set;for(;m.size;){let g=m.values().next().value;if(m.delete(g),!g||c.has(g)||y.has(g))continue;let b=u(g);if(!b){y.add(g);continue}w||(w=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(w));let S=b.cloneNode(!0);S.id||S.setAttribute("id",g),w.appendChild(S),y.add(g),c.add(g);let k=[S,...S.querySelectorAll("*")];for(let C of k){let M=C.getAttribute?.("href")||C.getAttribute?.("xlink:href");if(M&&M.startsWith("#")){let $=M.slice(1).trim();$&&!c.has($)&&!y.has($)&&m.add($)}let L=C.getAttribute?.("style")||"";L&&d(L);for(let $ of a){let N=C.getAttribute?.($);N&&d(N)}}}}function He(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(),r=t.clientHeight,s="data-snap-ph",a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let l=a.currentNode,c=getComputedStyle(l),i=c.position;if(i!=="sticky"&&i!=="-webkit-sticky")continue;let f=De(c.top),d=De(c.bottom);if(f==null&&d==null)continue;let p=bo(l,t),h=xo(e,p,s);if(!h)continue;let w=l.getBoundingClientRect(),u=w.width,m=w.height,y=w.left-o.left;if(!(u>0&&m>0)||!Number.isFinite(y))continue;let g=f!=null?f+n:n+(r-m-d);if(!Number.isFinite(g))continue;let b=Number.parseInt(c.zIndex,10),S=Number.isFinite(b),k=S?Math.max(b,1)+1:2,C=S?b-1:0,M=h.cloneNode(!1);M.setAttribute(s,"1"),M.style.position="sticky",M.style.left=`${y}px`,M.style.top=`${g}px`,M.style.width=`${u}px`,M.style.height=`${m}px`,M.style.visibility="hidden",M.style.zIndex=String(C),M.style.overflow="hidden",M.style.background="transparent",M.style.boxShadow="none",M.style.filter="none",h.parentElement?.insertBefore(M,h),h.style.position="absolute",h.style.left=`${y}px`,h.style.top=`${g}px`,h.style.bottom="auto",h.style.zIndex=String(k),h.style.pointerEvents="none"}}function De(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function bo(t,e){let n=[];for(let o=t;o&&o!==e;){let r=o.parentElement;if(!r)break;n.push(Array.prototype.indexOf.call(r.children,o)),o=r}return n.reverse()}function xo(t,e,n){let o=t;for(let r=0;r<e.length;r++)if(o=So(o,n)[e[r]],!o)return null;return o instanceof HTMLElement?o:null}function So(t,e){let n=[],o=t.children;for(let r=0;r<o.length;r++){let s=o[r];s.hasAttribute(e)||n.push(s)}return n}async function je(t,e={}){let n={styleMap:x.session.styleMap,styleCache:x.session.styleCache,nodeMap:x.session.nodeMap},o,r="",s="";Co(t);try{Be(t)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{o=await wt(t,n,e,t)}catch(c){throw console.warn("deepClone failed:",c),c}try{await ae(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await vo(o);try{let c=o.querySelectorAll("style[data-sd]");for(let i of c)s+=i.textContent||"",i.remove()}catch{}let a=Gt(n.styleMap);r=Array.from(a.entries()).map(([c,i])=>`.${i}{${c}}`).join(""),r=s+r;for(let[c,i]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",i.replace(/;/g,"; "));continue}let f=a.get(i);f&&c.classList.add(f);let d=c.style?.backgroundImage,p=c.dataset?.snapdomHasIcon;d&&d!=="none"&&(c.style.backgroundImage=d),p&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,i]of n.nodeMap.entries()){let f=i.scrollLeft,d=i.scrollTop;if((f||d)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";let h=document.createElement("div");for(h.style.transform=`translate(${-f}px, ${-d}px)`,h.style.willChange="transform",h.style.display="inline-block",h.style.width="100%";c.firstChild;)h.appendChild(c.firstChild);c.appendChild(h)}}let l=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(He(t,l),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,c);let i=jt(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=i||""}for(let[c,i]of n.nodeMap.entries())i.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:o,classCSS:r,styleCache:n.styleCache}}function Co(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,s=e.borderWidth,a=n!=="none"&&parseFloat(o)>0,l=r==="none"||parseFloat(s)===0;a&&l&&(t.style.border=`${o} solid transparent`)}var bt=new Map;async function xt(t){if(x.resource?.has(t))return x.resource.get(t);if(bt.has(t))return bt.get(t);let e=(async()=>{let n=await T(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})();bt.set(t,e);try{let n=await e;return bt.set(t,n),n}catch(n){throw bt.delete(t),n}}var ko=/\bblob:[^)"'\s]+/g;async function qe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ko)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=await xt(o);n=n.split(o).join(r)}catch{}return n}function Wt(t){return typeof t=="string"&&t.startsWith("blob:")}function Ao(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 Mo(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function vo(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of e)try{let c=a.getAttribute("src")||a.currentSrc||"";if(Wt(c)){let f=await xt(c);a.setAttribute("src",f)}let i=a.getAttribute("srcset");if(i&&i.includes("blob:")){let f=Ao(i),d=!1;for(let p of f)if(Wt(p.url))try{p.url=await xt(p.url),d=!0}catch{}d&&a.setAttribute("srcset",Mo(f))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of n)try{let l="http://www.w3.org/1999/xlink",c=a.getAttribute("href")||a.getAttributeNS?.(l,"href");if(Wt(c)){let i=await xt(c);a.setAttribute("href",i),a.removeAttributeNS?.(l,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of o)try{let l=a.getAttribute("style");if(l&&l.includes("blob:")){let c=await qe(l);a.setAttribute("style",c)}}catch{}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of r)try{let l=a.textContent||"";l.includes("blob:")&&(a.textContent=await qe(l))}catch{}let s=["poster"];for(let a of s){let l=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let c of l)try{let i=c.getAttribute(a);Wt(i)&&c.setAttribute(a,await xt(i))}catch{}}}async function ze(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async r=>{if(!r.getAttribute("src")){let f=r.currentSrc||r.src||"";f&&r.setAttribute("src",f)}r.removeAttribute("srcset"),r.removeAttribute("sizes");let s=r.src||"";if(!s)return;let a=await T(s,{as:"dataURL",useProxy:e.useProxy});if(a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")){r.src=a.data,r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}let{fallbackURL:l}=e||{};if(l)try{let f=parseInt(r.dataset?.snapdomWidth||"",10)||0,d=parseInt(r.dataset?.snapdomHeight||"",10)||0,p=parseInt(r.getAttribute("width")||"",10)||0,h=parseInt(r.getAttribute("height")||"",10)||0,w=parseFloat(r.style?.width||"")||0,u=parseFloat(r.style?.height||"")||0,m=f||w||p||r.width||void 0,y=d||u||h||r.height||void 0,g=typeof l=="function"?await l({width:m,height:y,src:s,element:r}):l;if(g){let b=await T(g,{as:"dataURL",useProxy:e.useProxy});r.src=b.data,!r.width&&m&&(r.width=m),!r.height&&y&&(r.height=y),r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}}catch{}let c=r.width||r.naturalWidth||100,i=r.height||r.naturalHeight||100;if(e.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${c}px`,`height:${i}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${i}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",r.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${c}px;height:${i}px;visibility:hidden;`,r.replaceWith(f)}};for(let r=0;r<n.length;r+=4){let s=n.slice(r,r+4).map(o);await Promise.allSettled(s)}}async function Ut(t,e,n,o={}){let r=[[t,e]],s=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){let[i,f]=r.shift(),d=n.get(i)||rt(i);n.has(i)||n.set(i,d);let p=(()=>{let u=d.getPropertyValue("border-image"),m=d.getPropertyValue("border-image-source");return u&&u!=="none"||m&&m!=="none"})();for(let u of l){let m=d.getPropertyValue(u);m&&f.style.setProperty(u,m)}for(let u of s){let m=d.getPropertyValue(u);if(!m||m==="none")continue;let y=gt(m),g=await Promise.all(y.map(b=>ot(b,o)));g.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&f.style.setProperty(u,g.join(", "))}for(let u of a){let m=d.getPropertyValue(u);!m||m==="initial"||f.style.setProperty(u,m)}if(p)for(let u of c){let m=d.getPropertyValue(u);!m||m==="initial"||f.style.setProperty(u,m)}let h=Array.from(i.children),w=Array.from(f.children).filter(u=>!(u.dataset&&u.dataset.snapdomPseudo));for(let u=0;u<Math.min(h.length,w.length);u++)r.push([h[u],w[u]])}}function Ve(t){if(!t)return()=>{};let e=Eo(t);if(e<=0)return()=>{};if(!Io(t))return()=>{};let n=getComputedStyle(t),o=Math.round(Fo(n)*e+$o(n)),r=t.textContent??"",s=r;if(t.scrollHeight<=o+.5)return()=>{};let a=0,l=r.length,c=-1;for(;a<=l;){let i=a+l>>1;t.textContent=r.slice(0,i)+"\u2026",t.scrollHeight<=o+.5?(c=i,a=i+1):l=i-1}return t.textContent=(c>=0?r.slice(0,c):"")+"\u2026",()=>{t.textContent=s}}function Eo(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 Fo(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 $o(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Io(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var St=[];function Xe(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 ie(...t){let e=t.flat();for(let n of e){let o=Xe(n);o&&(St.some(r=>r&&r.name&&o.name&&r.name===o.name)||St.push(o))}}function Ye(t){return(t&&Array.isArray(t.plugins)?t.plugins:St)||St}async function H(t,e,n){let o=n,r=Ye(e);for(let s of r){let a=s&&typeof s[t]=="function"?s[t]:null;if(!a)continue;let l=await a(e,o);typeof l<"u"&&(o=l)}return o}async function Ke(t,e,n){let o=[],r=Ye(e);for(let s of r){let a=s&&typeof s[t]=="function"?s[t]:null;if(!a)continue;let l=await a(e,n);typeof l<"u"&&o.push(l)}return o}function Lo(t){let e=[];if(Array.isArray(t))for(let n of t){let o=Xe(n);if(!o||!o.name)continue;let r=e.findIndex(s=>s&&s.name===o.name);r>=0&&e.splice(r,1),e.push(o)}for(let n of St)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function Ge(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=Lo(e)),t}function No(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let r=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=r.length?r:"none"}catch{}}function Ro(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 To(t,e={}){let{stripFrameworkDirectives:n=!0}=e,o=new Set(["xml","xlink"]),r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let s=r.currentNode;for(let a of Array.from(s.attributes)){let l=a.name;if(l.includes("@")){s.removeAttribute(l);continue}if(l.includes(":")){let c=l.split(":",1)[0];if(!o.has(c)){s.removeAttribute(l);continue}}if(n&&(l.startsWith("x-")||l.startsWith("v-")||l.startsWith(":")||l.startsWith("on:")||l.startsWith("bind:")||l.startsWith("let:")||l.startsWith("class:"))){s.removeAttribute(l);continue}}}}function Po(t,e={}){t&&(To(t,e),Ro(t))}async function le(t,e){if(!t)throw new Error("Element cannot be null or undefined");vt(e.cache);let n=e.fast,o=e.outerTransforms!==!1,r=!!e.outerShadows,s={element:t,options:e,plugins:e.plugins},a,l,c,i="",f="",d,p,h=null;await H("beforeSnap",s),await H("beforeClone",s);let w=Ve(s.element);try{({clone:a,classCSS:l,styleCache:c}=await je(s.element,s.options)),!o&&a&&(h=Do(s.element,a)),!r&&a&&No(s.element,a)}finally{w()}if(s={clone:a,classCSS:l,styleCache:c,...s},await H("afterClone",s),Po(s.clone),s.options?.excludeMode==="remove")try{Oo(s.element,s.clone,s.styleCache)}catch(g){console.warn("[snapdom] shrink pass failed:",g)}try{await Ae(s.clone,s.element)}catch{}await new Promise(g=>{V(async()=>{await ze(s.clone,s.options),g()},{fast:n})}),await new Promise(g=>{V(async()=>{await Ut(s.element,s.clone,s.styleCache,s.options),g()},{fast:n})}),e.embedFonts&&await new Promise(g=>{V(async()=>{let b=Tt(s.element),S=Pt(s.element);if(W()){let k=new Set(Array.from(b).map(C=>String(C).split("__")[0]).filter(Boolean));await _t(k,1)}i=await Rt({required:b,usedCodepoints:S,preCached:!1,exclude:s.options.excludeFonts,useProxy:s.options.useProxy}),g()},{fast:n})});let u=Yt(s.clone).sort(),m=u.join(",");x.baseStyle.has(m)?f=x.baseStyle.get(m):await new Promise(g=>{V(()=>{f=Kt(u),x.baseStyle.set(m,f),g()},{fast:n})}),s={fontsCSS:i,baseCSS:f,...s},await H("beforeRender",s),await new Promise(g=>{V(()=>{let b=getComputedStyle(s.element),S=s.element.getBoundingClientRect(),k=Math.max(1,A(s.element.offsetWidth||parseFloat(b.width)||S.width||1)),C=Math.max(1,A(s.element.offsetHeight||parseFloat(b.height)||S.height||1));if(s.options?.excludeMode==="remove"){let D=Zo(s.element,s.options);Number.isFinite(D)&&D>0&&(C=Math.max(1,Math.min(C,A(D+1))))}let M=(D,z=NaN)=>{let lt=typeof D=="string"?parseFloat(D):D;return Number.isFinite(lt)?lt:z},L=M(s.options.width),$=M(s.options.height),N=k,E=C,U=Number.isFinite(L),O=Number.isFinite($),v=C>0?k/C:1;U&&O?(N=Math.max(1,A(L)),E=Math.max(1,A($))):U?(N=Math.max(1,A(L)),E=Math.max(1,A(N/(v||1)))):O?(E=Math.max(1,A($)),N=Math.max(1,A(E*(v||1)))):(N=k,E=C);let Y=0,K=0,at=k,tt=C;if(!o&&h&&Number.isFinite(h.a)){let D={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},z=Qe(k,C,D,0,0);Y=A(z.minX),K=A(z.minY),at=A(z.maxX),tt=A(z.maxY)}else if(o&&zo(s.element)){let z=b.transform&&b.transform!=="none"?b.transform:"",lt=Vo(s.element),qt=Go({baseTransform:z,rotate:lt.rotate||"0deg",scale:lt.scale,translate:lt.translate}),{ox:un,oy:fn}=Yo(b,k,C),dn=qt.is2D?qt:new DOMMatrix(qt.toString()),Mt=Qe(k,C,dn,un,fn);Y=A(Mt.minX),K=A(Mt.minY),at=A(Mt.maxX),tt=A(Mt.maxY)}let I=Ho(b),R=qo(b),P=jo(b),_=Bo(b),j=r?{top:A(I.top+R.top+P.top+_.bleed.top),right:A(I.right+R.right+P.right+_.bleed.right),bottom:A(I.bottom+R.bottom+P.bottom+_.bleed.bottom),left:A(I.left+R.left+P.left+_.bleed.left)}:{top:0,right:0,bottom:0,left:0};Y=A(Y-j.left),K=A(K-j.top),at=A(at+j.right),tt=A(tt+j.bottom);let et=Math.max(1,A(at-Y)),kt=Math.max(1,A(tt-K)),it=U||O?A(N/k):1,Ot=O||U?A(E/C):1,Bt=Math.max(1,A(et*it)),At=Math.max(1,A(kt*Ot)),ht="http://www.w3.org/2000/svg",on=W()?1:0,G=A(on+(o?0:1)),Q=document.createElementNS(ht,"foreignObject"),rn=A(Y),sn=A(K);Q.setAttribute("x",String(A(-(rn-G)))),Q.setAttribute("y",String(A(-(sn-G)))),Q.setAttribute("width",String(A(k+G*2))),Q.setAttribute("height",String(A(C+G*2))),Q.style.overflow="visible";let fe=document.createElement("style");fe.textContent=s.baseCSS+s.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+s.classCSS,Q.appendChild(fe);let ct=document.createElement("div");ct.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.style.width=`${A(k)}px`,ct.style.height=`${A(C)}px`,ct.style.overflow="visible",s.clone.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),ct.appendChild(s.clone),Q.appendChild(ct);let an=new XMLSerializer().serializeToString(Q),Dt=A(et+G*2),Ht=A(kt+G*2),de=U||O;e.meta={w0:k,h0:C,vbW:Dt,vbH:Ht,targetW:N,targetH:E};let cn=W()&&de?Dt:A(Bt+G*2),ln=W()&&de?Ht:A(At+G*2);p=`<svg xmlns="${ht}" width="${cn}" height="${ln}" viewBox="0 0 ${Dt} ${Ht}">`+an+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,s={svgString:p,dataURL:d,...s},g()},{fast:n})}),await H("afterRender",s);let y=document.getElementById("snapdom-sandbox");return y&&y.style.position==="absolute"&&y.remove(),s.dataURL}function _o(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function Wo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Uo(t,e){if(!(t instanceof Element)||_o(t)||Wo(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 Oo(t,e,n=new Map){function o(r,s){if(!(r instanceof Element)||!(s instanceof Element))return;let a=r.childElementCount>s.childElementCount,l=n.get(r)||getComputedStyle(r);if(n.has(r)||n.set(r,l),a&&Uo(r,l)){s.style.height||(s.style.height="auto"),s.style.width||(s.style.width="auto"),s.style.removeProperty("block-size"),s.style.removeProperty("inline-size"),s.style.minHeight||(s.style.minHeight="0"),s.style.minWidth||(s.style.minWidth="0"),s.style.maxHeight||(s.style.maxHeight="none"),s.style.maxWidth||(s.style.maxWidth="none");let f=l.overflowY||l.overflowBlock||"visible",d=l.overflowX||l.overflowInline||"visible";(f!=="visible"||d!=="visible")&&(s.style.overflow="visible")}let c=Array.from(r.children),i=Array.from(s.children);for(let f=0;f<Math.min(c.length,i.length);f++)o(c[f],i[f])}o(t,e)}var A=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t;function Bo(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,r=0,s=0,a=0,l=!1;for(let c of n){l=!0;let i=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(u=>parseFloat(u))||[],[f=0,d=0,p=0]=i,h=Math.abs(f)+p,w=Math.abs(d)+p;r=Math.max(r,h+Math.max(f,0)),a=Math.max(a,h+Math.max(-f,0)),s=Math.max(s,w+Math.max(d,0)),o=Math.max(o,w+Math.max(-d,0))}return{bleed:{top:A(o),right:A(r),bottom:A(s),left:A(a)},has:l}}function Do(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 s=Je(t);if(s.a===1&&s.b===0&&s.c===0&&s.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let r=o.match(/^matrix\(\s*([^)]+)\)$/i);if(r){let s=r[1].split(",").map(a=>parseFloat(a.trim()));if(s.length===6&&s.every(Number.isFinite)){let[a,l,c,i]=s,f=Math.sqrt(a*a+l*l)||0,d=0,p=0,h=0,w=0,u=0,m=0;f>0&&(d=a/f,p=l/f,h=d*c+p*i,w=c-d*h,u=i-p*h,m=Math.sqrt(w*w+u*u)||0,m>0?h=h/m:h=0);let y=f,g=0,b=h*m,S=m;try{e.style.transform=`matrix(${y}, ${g}, ${b}, ${S}, 0, 0)`}catch{}return{a:y,b:g,c:b,d:S}}}try{let s=String(o).trim();return e.style.transform=s+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function Ho(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),o=0,r=0,s=0,a=0;for(let l of n){let c=l.match(/-?\d+(\.\d+)?px/g)?.map(u=>parseFloat(u))||[];if(c.length<2)continue;let[i,f,d=0,p=0]=c,h=Math.abs(i)+d+p,w=Math.abs(f)+d+p;r=Math.max(r,h+Math.max(i,0)),a=Math.max(a,h+Math.max(-i,0)),s=Math.max(s,w+Math.max(f,0)),o=Math.max(o,w+Math.max(-f,0))}return{top:Math.ceil(o),right:Math.ceil(r),bottom:Math.ceil(s),left:Math.ceil(a)}}function qo(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 jo(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Qe(t,e,n,o,r){let s=n.a,a=n.b,l=n.c,c=n.d,i=n.e||0,f=n.f||0;function d(y,g){let b=y-o,S=g-r,k=s*b+l*S,C=a*b+c*S;return k+=o+i,C+=r+f,[k,C]}let p=[d(0,0),d(t,0),d(0,e),d(t,e)],h=1/0,w=1/0,u=-1/0,m=-1/0;for(let[y,g]of p)y<h&&(h=y),g<w&&(w=g),y>u&&(u=y),g>m&&(m=g);return{minX:h,minY:w,maxX:u,maxY:m,width:u-h,height:m-w}}function zo(t){return Xo(t)}function Je(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function Vo(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let r=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},s=r("rotate");if(s)if(s.angle){let c=s.angle;e.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.unit}else s.unit?e.rotate=s.unit==="rad"?s.value*180/Math.PI+"deg":s.value+s.unit:e.rotate=String(s);else{let c=getComputedStyle(t);e.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let a=r("scale");if(a){let c="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,i="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:c;e.scale=`${c} ${i}`}else{let c=getComputedStyle(t);e.scale=c.scale&&c.scale!=="none"?c.scale:null}let l=r("translate");if(l){let c="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,i="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,f="x"in l&&l.x?.unit?l.x.unit:"px",d="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${c}${f} ${i}${d}`}else{let c=getComputedStyle(t);e.translate=c.translate&&c.translate!=="none"?c.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}function Xo(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 r=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",s=e.scale&&e.scale!=="none"&&e.scale!=="1",a=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(r||s||a)}function Yo(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[r,s]=[o[0]||"0",o[1]||"0"],a=(l,c)=>{let i=l.toLowerCase();return i==="left"||i==="top"?0:i==="center"?c/2:i==="right"||i==="bottom"?c:i.endsWith("px")?parseFloat(i)||0:i.endsWith("%")?(parseFloat(i)||0)*c/100:/^-?\d+(\.\d+)?$/.test(i)&&parseFloat(i)||0};return{ox:a(r,e),oy:a(s,n)}}var ce=null;function Ko(){if(ce)return ce;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),ce=t,t}function Go(t){let e=Ko(),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=Je(n);return e.removeChild(n),o}function Qo(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed"||e.position==="sticky"||(e.cssFloat||e.float||"none")!=="none"||e.transform&&e.transform!=="none")}function Jo(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{}return!1}function Zo(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),r=1/0,s=-1/0,a=!1,l=Array.from(t.children);for(let h of l){if(Jo(h,e)||!Qo(h))continue;let w=h.getBoundingClientRect(),u=w.top-o.top,m=w.bottom-o.top;m<=u||(u<r&&(r=u),m>s&&(s=m),a=!0)}let c=a?Math.max(0,s-r):0,i=parseFloat(n.borderTopWidth)||0,f=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,p=parseFloat(n.paddingBottom)||0;return i+f+d+p+c}function tr(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Ze(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=tr(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1}}function er(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function nr(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function or(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function rr(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let s=t[r];s==="("&&o++,s===")"&&(o=Math.max(0,o-1)),s===";"&&o===0?(e.push(n),n=""):n+=s}return n.trim()&&e.push(n),e.map(r=>r.trim()).filter(Boolean)}function sr(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let a=t[s];a==="("&&o++,a===")"&&(o=Math.max(0,o-1)),a===","&&o===0?(e.push(n.trim()),n=""):n+=a}n.trim()&&e.push(n.trim());let r=[];for(let s of e){if(/\binset\b/i.test(s))continue;let a=s.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",c="0px",i="0px"]=a,f=s.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!f&&f!==",";r.push(`drop-shadow(${l} ${c} ${i}${d?` ${f}`:""})`)}return r.join(" ")}function tn(t){let e=rr(t),n=null,o=null,r=null,s=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let i=l.slice(0,c).trim().toLowerCase(),f=l.slice(c+1).trim();i==="box-shadow"?r=f:i==="filter"?n=f:i==="-webkit-filter"?o=f:s.push([i,f])}if(r){let l=sr(r);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let a=[...s];return n&&a.push(["filter",n]),o&&a.push(["-webkit-filter",o]),a.map(([l,c])=>`${l}:${c}`).join(";")}function ar(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${tn(o)}}`)}function ir(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,ar(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${tn(o)}${n}`),t}function cr(t){if(!W()||!er(t))return t;try{let e=nr(t),n=ir(e);return or(n)}catch{return t}}async function X(t,e){let{width:n,height:o,scale:r=1,dpr:s=1,meta:a={},backgroundColor:l}=e;t=cr(t);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=t,await c.decode();let i=c.naturalWidth,f=c.naturalHeight,d=Number.isFinite(a.w0)?a.w0:i,p=Number.isFinite(a.h0)?a.h0:f,h,w,u=Number.isFinite(n),m=Number.isFinite(o);if(u&&m)h=Math.max(1,n),w=Math.max(1,o);else if(u){let b=n/Math.max(1,d);h=n,w=p*b}else if(m){let b=o/Math.max(1,p);w=o,h=d*b}else h=i,w=f;h=h*r,w=w*r;let y=document.createElement("canvas");y.width=h*s,y.height=w*s,y.style.width=`${h}px`,y.style.height=`${w}px`;let g=y.getContext("2d");return s!==1&&g.scale(s,s),l&&(g.save(),g.fillStyle=l,g.fillRect(0,0,h,w),g.restore()),g.drawImage(c,0,0,h,w),y}async function q(t,e){let n=await X(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}async function pt(t,e){let{scale:n=1,width:o,height:r,meta:s={}}=e,a=Number.isFinite(o),l=Number.isFinite(r),c=Number.isFinite(n)&&n!==1||a||l;if(W()&&c)return await q(t,{...e,format:"png",quality:1,meta:s});let i=new Image;if(i.decoding="sync",i.loading="eager",i.src=t,await i.decode(),a&&l)i.style.width=`${o}px`,i.style.height=`${r}px`;else if(a){let f=Number.isFinite(s.w0)?s.w0:i.naturalWidth,d=Number.isFinite(s.h0)?s.h0:i.naturalHeight,p=o/Math.max(1,f);i.style.width=`${o}px`,i.style.height=`${Math.round(d*p)}px`}else if(l){let f=Number.isFinite(s.w0)?s.w0:i.naturalWidth,d=Number.isFinite(s.h0)?s.h0:i.naturalHeight,p=r/Math.max(1,d);i.style.height=`${r}px`,i.style.width=`${Math.round(f*p)}px`}else{let f=Math.round(i.naturalWidth*n),d=Math.round(i.naturalHeight*n);if(i.style.width=`${f}px`,i.style.height=`${d}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${f}"`).replace(/height="[^"]*"/,`height="${d}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,i.src=t}catch{}}return i}async function Ct(t,e){let n=e.type;if(n==="svg"){let r=decodeURIComponent(t.split(",")[1]);return new Blob([r],{type:"image/svg+xml"})}let o=await X(t,e);return new Promise(r=>o.toBlob(s=>r(s),`image/${n}`,e.quality))}async function en(t,e){if(e.dpr=1,e.format==="svg"){let r=await Ct(t,{...e,type:"svg"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=e.filename,a.click(),URL.revokeObjectURL(s);return}let n=await X(t,e),o=document.createElement("a");o.href=n.toDataURL(`image/${e.format}`,e.quality),o.download=e.filename,o.click()}F.plugins=(...t)=>(ie(...t),F);var nn=Symbol("snapdom.internal"),Z=Symbol("snapdom.internal.silent"),ue=!1;async function F(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Ze(e);if(Ge(n,e&&e.plugins),W()&&(n.embedFonts===!0||ur(t)))for(let o=0;o<3;o++)try{await lr(t,e),console.log("safariWarmup:",o),ue=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&ke(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>F.toPng(o,r),toSvg:(o,r)=>F.toSvg(o,r)}),F.capture(t,n,nn)}F.plugins=(...t)=>(ie(...t),F);F.capture=async(t,e,n)=>{if(n!==nn)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await le(t,e),r={img:async(u,m)=>pt(o,{...u,...m||{}}),svg:async(u,m)=>pt(o,{...u,...m||{}}),canvas:async(u,m)=>X(o,{...u,...m||{}}),blob:async(u,m)=>Ct(o,{...u,...m||{}}),png:async(u,m)=>q(o,{...u,...m||{},format:"png"}),jpeg:async(u,m)=>q(o,{...u,...m||{},format:"jpeg"}),webp:async(u,m)=>q(o,{...u,...m||{},format:"webp"}),download:async(u,m)=>en(o,{...u,...m||{}})},a={...e,export:{url:o},exports:{svg:u=>pt(o,{...e,...u||{},[Z]:!0}),canvas:u=>X(o,{...e,...u||{},[Z]:!0}),png:u=>q(o,{...e,...u||{},format:"png",[Z]:!0}),jpeg:u=>q(o,{...e,...u||{},format:"jpeg",[Z]:!0}),jpg:u=>q(o,{...e,...u||{},format:"jpeg",[Z]:!0}),webp:u=>q(o,{...e,...u||{},format:"webp",[Z]:!0}),blob:u=>Ct(o,{...e,...u||{},[Z]:!0}),img:u=>pt(o,{...e,...u||{},[Z]:!0})}},l=await Ke("defineExports",a),c=Object.assign({},...l.filter(u=>u&&typeof u=="object")),i={...r,...c};i.jpeg&&!i.jpg&&(i.jpg=(u,m)=>i.jpeg(u,m));function f(u,m){let y={...e,...m||{}};return(u==="jpeg"||u==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,p=Promise.resolve();async function h(u,m){let y=async()=>{let g=i[u];if(!g)throw new Error(`[snapdom] Unknown export type: ${u}`);let b=f(u,m),S={...e,export:{type:u,options:b,url:o}};await H("beforeExport",S);let k=await g(S,b);return await H("afterExport",S,k),d||(d=!0,await H("afterSnap",e)),k};return p=p.then(y)}let w={url:o,toRaw:()=>o,to:(u,m)=>h(u,m),toImg:u=>h("img",u),toSvg:u=>h("svg",u),toCanvas:u=>h("canvas",u),toBlob:u=>h("blob",u),toPng:u=>h("png",u),toJpg:u=>h("jpg",u),toWebp:u=>h("webp",u),download:u=>h("download",u)};for(let u of Object.keys(i)){let m="to"+u.charAt(0).toUpperCase()+u.slice(1);w[m]||(w[m]=y=>h(u,y))}return w};F.toRaw=(t,e)=>F(t,e).then(n=>n.toRaw());F.toImg=(t,e)=>F(t,e).then(n=>n.toImg());F.toSvg=(t,e)=>F(t,e).then(n=>n.toSvg());F.toCanvas=(t,e)=>F(t,e).then(n=>n.toCanvas());F.toBlob=(t,e)=>F(t,e).then(n=>n.toBlob());F.toPng=(t,e)=>F(t,{...e,format:"png"}).then(n=>n.toPng());F.toJpg=(t,e)=>F(t,{...e,format:"jpeg"}).then(n=>n.toJpg());F.toWebp=(t,e)=>F(t,{...e,format:"webp"}).then(n=>n.toWebp());F.download=(t,e)=>F(t,e).then(n=>n.download());async function lr(t,e){if(ue)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await le(t,n)}catch{}await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r))),o&&await new Promise(r=>{let s=new Image;try{s.decoding="sync",s.loading="eager"}catch{}s.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",s.src=o,document.body.appendChild(s),(async()=>{try{typeof s.decode=="function"&&await s.decode()}catch{}let a=performance.now();for(;!(s.complete&&s.naturalWidth>0)&&performance.now()-a<900;)await new Promise(l=>setTimeout(l,50));await new Promise(l=>requestAnimationFrame(l));try{s.remove()}catch{}r()})()}),t.querySelectorAll("canvas").forEach(r=>{try{let s=r.getContext("2d",{willReadFrequently:!0});s&&s.getImageData(0,0,1,1)}catch{}}),ue=!0}function ur(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),r=o.backgroundImage&&o.backgroundImage!=="none",s=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(r||s||n.tagName==="CANVAS")return!0}return!1}async function fr(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,r=e.cache??e.cacheOpt??"full";vt(r);try{await document.fonts?.ready}catch{}try{Vt()}catch{}x.session=x.session||{},x.session.styleCache||(x.session.styleCache=new WeakMap),x.image=x.image||new Map,x.background=x.background||new Map;try{await Ut(t,void 0,x.session.styleCache,{useProxy:o})}catch{}let s=[],a=[];try{if(t&&t.nodeType===1){let c=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];a=[t,...c],s=[],t.tagName==="IMG"&&t.getAttribute("src")&&s.push(t),s.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(s=Array.from(t.querySelectorAll("img[src]")),a=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let c of s){let i=c?.currentSrc||c?.src;if(i&&!x.image.has(i)){let f=Promise.resolve().then(async()=>{let d=await T(i,{as:"dataURL",useProxy:o});d?.ok&&typeof d.data=="string"&&x.image.set(i,d.data)}).catch(()=>{});l.push(f)}}for(let c of a){let i="";try{i=c?.style?.backgroundImage||"",(!i||i==="none")&&(i=rt(c).backgroundImage)}catch{}if(i&&i!=="none"){let f=i.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let d of f){let p=Promise.resolve().then(()=>ot(d,{...e,useProxy:o})).catch(()=>{});l.push(p)}}}if(n)try{let c=Tt(t),i=Pt(t);if(typeof W=="function"?W():!!W){let d=new Set(Array.from(c).map(p=>String(p).split("__")[0]).filter(Boolean));await _t(d,3)}await Rt({required:c,usedCodepoints:i,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o})}catch{}await Promise.allSettled(l)}export{fr as preCache,F as snapdom};