var ts=Object.defineProperty;var zr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var rs=(e,t)=>()=>(e&&(t=e(e=0)),t);var ns=(e,t)=>{for(var r in t)ts(e,r,{get:t[r],enumerable:!0})};var ai={};ns(ai,{preCache:()=>Vc,snapdom:()=>ne});function as(e){if(e===!0)return"soft";if(e===!1)return"disabled";if(typeof e=="string"){let t=e.toLowerCase().trim();if(t==="auto")return"auto";if(t==="full")return"full";if(t==="soft"||t==="disabled")return t}return"soft"}function To(e="soft"){switch(k.session.__counterEpoch=(k.session.__counterEpoch||0)+1,e){case"auto":{k.session.styleMap=new Map,k.session.nodeMap=new Map;return}case"soft":{k.session.styleMap=new Map,k.session.nodeMap=new Map,k.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{k.session.styleMap=new Map,k.session.nodeMap=new Map,k.session.styleCache=new WeakMap,k.computedStyle=new WeakMap,k.baseStyle=new Se(50),k.defaultStyle=new Se(30),k.image=new Se(100),k.background=new Se(100),k.resource=new Se(150),k.font=new Set;return}default:{k.session.styleMap=new Map,k.session.nodeMap=new Map,k.session.styleCache=new WeakMap;return}}}function cn(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let r=t[2].trim();return r.startsWith("#")?null:r}function ss(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(r,n)=>{let o=n.split(",").map(i=>i.trim());return o.length!==6?`matrix(${n})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(r,n)=>{let o=n.split(",").map(i=>i.trim());return o.length!==16?`matrix3d(${n})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function tr(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function ls(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let r=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,r).href}catch{return e}}function cs(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:r=12}={}){let n=new Map,o=0;function i(a,s,c){if(o>=r)return;let l=Date.now();(n.get(s)||0)>l||(n.set(s,l+t),o++,a==="warn"&&console&&console.warn?console.warn(`${e} ${c}`):console&&console.error&&console.error(`${e} ${c}`))}return{warnOnce(a,s){i("warn",a,s)},errorOnce(a,s){i("error",a,s)},reset(){n.clear(),o=0}}}function us(e){return/^data:|^blob:|^about:blank$/i.test(e)}function ds(e,t){try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=t.includes("{url}")?t.split("{url}")[0]:t,o=new URL(n||".",r),i=new URL(e,r);if(i.origin===o.origin)return!0;let a=i.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function ms(e,t){if(!t||us(e)||ds(e,t))return!1;try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=new URL(e,r);return typeof location<"u"?n.origin!==location.origin:!0}catch{return!!t}}function fs(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",tr(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${tr(e)}`;let r=t.includes("?")?"&":"?";return`${t}${r}url=${encodeURIComponent(e)}`}function ro(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(String(n.result||"")),n.onerror=()=>r(new Error("read_failed")),n.readAsDataURL(e)})}function ps(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function Ie(e,t={}){let r=t.as??"blob",n=t.timeout??3e3,o=t.useProxy||"",i=t.errorTTL??8e3,a=t.headers||{},s=!!t.silent;if(/^data:/i.test(e))try{if(r==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(r==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,g="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],b=/;base64/i.test(g)?atob(y):decodeURIComponent(y),w=new Uint8Array([...b].map(I=>I.charCodeAt(0))),S=new Blob([w],{type:(g||"").split(";")[0]||""});return{ok:!0,data:S,status:200,url:e,fromCache:!1,mime:S.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let g=await fetch(e);if(!g.ok)return{ok:!1,data:null,status:g.status,url:e,fromCache:!1,reason:"http_error"};let y=await g.blob(),b=y.type||g.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await ro(y),status:g.status,url:e,fromCache:!1,mime:b}:r==="text"?{ok:!0,data:await y.text(),status:g.status,url:e,fromCache:!1,mime:b}:{ok:!0,data:y,status:g.status,url:e,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return r==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:r==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let c=ps(e,{as:r,timeout:n,useProxy:o,errorTTL:i}),l=Lt.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&Lt.delete(c);let u=Xt.get(c);if(u)return u;let d=ms(e,o)?fs(e,o):e,m=t.credentials;if(!m)try{let g=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,g);m=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{m="omit"}let f=new AbortController,p=setTimeout(()=>f.abort("timeout"),n),h=(async()=>{try{let g=await fetch(d,{signal:f.signal,credentials:m,headers:a});if(!g.ok){let w={ok:!1,data:null,status:g.status,url:d,fromCache:!1,reason:"http_error"};if(i>0&&Lt.set(c,{until:Date.now()+i,result:w}),!s){let S=`${g.status} ${g.statusText||""}`.trim();Xr.warnOnce(`http:${g.status}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${S} while fetching ${r} ${e}`)}return t.onError&&t.onError(w),w}if(r==="text")return{ok:!0,data:await g.text(),status:g.status,url:d,fromCache:!1};let y=await g.blob(),b=y.type||g.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await ro(y),status:g.status,url:d,fromCache:!1,mime:b}:{ok:!0,data:y,status:g.status,url:d,fromCache:!1,mime:b}}catch(g){let y=g&&typeof g=="object"&&"name"in g&&g.name==="AbortError"?String(g.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&i>0&&Lt.set(c,{until:Date.now()+i,result:b}),!s){let w=`${y}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,S=y==="timeout"?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${r} ${e}`:`Network/CORS issue while fetching ${r} ${e}. A proxy may be required`;Xr.errorOnce(w,S)}return t.onError&&t.onError(b),b}finally{clearTimeout(p),Xt.delete(c)}})();return Xt.set(c,h),h}async function un(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let r=cn(e);if(!r)return e;let n=ls(r),o=tr(n);if(k.background.has(o)){let i=k.background.get(o);return i?`url("${i}")`:"none"}try{let i=await Ie(o,{as:"dataURL",useProxy:t.useProxy});return i.ok?(k.background.set(o,i.data),`url("${i.data}")`):(k.background.set(o,null),"none")}catch{return k.background.set(o,null),"none"}}function gs(){for(let e of ko){let t=String(e).toLowerCase();mn.has(t)||or.has(t)||Mo(t)}}function Mo(e){if(e=String(e).toLowerCase(),or.has(e)){let i={};return k.defaultStyle.set(e,i),i}if(k.defaultStyle.has(e))return k.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let r=document.createElement(e);r.style.all="initial",t.appendChild(r);let n=getComputedStyle(r),o={};for(let i of n){if(dn(i))continue;let a=n.getPropertyValue(i);o[i]=a}return t.removeChild(r),k.defaultStyle.set(e,o),o}function dn(e){let t=String(e).toLowerCase();return!!(Lo.has(t)||Ro.test(t)||No.test(t))}function Kr(e,t){if(t=String(t||"").toLowerCase(),or.has(t))return"";let r=[],n=Mo(t),o=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[i,a]of Object.entries(e)){if(dn(i)||o&&(i==="width"||i==="min-width"||i==="max-width"))continue;let s=n[i];a&&a!==s&&r.push(`${i}:${a}`)}return r.sort(),r.join(";")}function ys(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(r=>t.add(r.tagName.toLowerCase())),Array.from(t))}function bs(e){let t=new Map;for(let n of e){let o=k.defaultStyle.get(n);if(!o)continue;let i=Object.entries(o).map(([a,s])=>`${a}:${s};`).sort().join("");i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))}let r="";for(let[n,o]of t.entries())r+=`${o.join(",")} { ${n} } `;return r}function Ss(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),r=new Map,n=1;for(let o of t)r.set(o,`c${n++}`);return r}function ws(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let r=t.defaultView;if(r&&typeof r.getComputedStyle=="function")return r;if(typeof window<"u"&&window.frames)for(let n=0;n{let i={length:0,getPropertyValue:()=>"",item:()=>""};return i[Symbol.iterator]=function*(){},i};if(!(e instanceof Element)){let i=typeof window<"u"?window:null;if(i&&typeof i.getComputedStyle=="function")try{return i.getComputedStyle(e,t)||r()}catch{return r()}return r()}let n=k.computedStyle.get(e);n||(n=new Map,k.computedStyle.set(e,n));let o=n.get(t);if(!o){let i=ws(e),a=null;try{a=i&&typeof i.getComputedStyle=="function"?i.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}o=a||r(),n.set(t,o)}return o}function no(e){let t={};for(let r of e)t[r]=e.getPropertyValue(r);for(let r of Do){let n=t[`border-${r}-style`],o=t[`border-${r}-width`];(n==="none"||n==="hidden"||o==="0px")&&(delete t[`border-${r}-style`],delete t[`border-${r}-width`],delete t[`border-${r}-color`])}return t}function qr(e){let t=[],r=0,n=0;for(let o=0;o"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),r=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||r}function xe(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),r=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),n=/applewebkit/i.test(e),o=/mobile/i.test(e),i=!/safari/i.test(e),a=n&&o&&i,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),l=/ipad|iphone|ipod/.test(t)&&n;return r||a||s||c||l}function Cs(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}function q(e,t,r){let n=e&&typeof e=="object"&&(e.options||e);n&&n.debug&&(r!==void 0?console.warn("[snapdom]",t,r):console.warn("[snapdom]",t))}function vs(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function Is(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function As(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function xs(e){let t=[],r="",n=0;for(let o=0;oo.trim()).filter(Boolean)}function Ts(e){let t=[],r="",n=0;for(let i=0;i`${s}:${c}`).join(";")}function Ms(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,r,n)=>`${r}{${_o(n)}}`)}function ks(e){return e=e.replace(/]*>([\s\S]*?)<\/style>/gi,(t,r)=>t.replace(r,Ms(r))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,r,n)=>`style=${r}${_o(n)}${r}`),e}function Ns(e){if(!xe()||!vs(e))return e;try{let t=Is(e),r=ks(t);return As(r)}catch{return e}}async function ir(e,t){let{width:r,height:n,scale:o=1,dpr:i=1,meta:a={},backgroundColor:s}=t;e=Ns(e);let c=new Image;if(c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=e,await c.decode(),xe()){c.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(c);try{await new Promise(w=>requestAnimationFrame(()=>requestAnimationFrame(w)))}finally{try{c.remove()}catch{}}}let l=c.naturalWidth,u=c.naturalHeight,d=Number.isFinite(a.w0)?a.w0:l,m=Number.isFinite(a.h0)?a.h0:u,f,p,h=Number.isFinite(r),g=Number.isFinite(n);if(h&&g)f=Math.max(1,r),p=Math.max(1,n);else if(h){let w=r/Math.max(1,d);f=r,p=m*w}else if(g){let w=n/Math.max(1,m);p=n,f=d*w}else f=l,p=u;f=f*o,p=p*o;let y=document.createElement("canvas");y.width=f*i,y.height=p*i,y.style.width=`${f}px`,y.style.height=`${p}px`;let b=y.getContext("2d");return i!==1&&b.scale(i,i),s&&(b.save(),b.fillStyle=s,b.fillRect(0,0,f,p),b.restore()),b.drawImage(c,0,0,f,p),y}async function Wo(e,t){let r=await ir(e,t),n=new Image;return n.src=r.toDataURL(`image/${t.format}`,t.quality),await n.decode(),n.style.width=`${r.width/t.dpr}px`,n.style.height=`${r.height/t.dpr}px`,n}async function oo(e,t){let{scale:r=1,width:n,height:o,meta:i={}}=t,a=Number.isFinite(n),s=Number.isFinite(o),c=Number.isFinite(r)&&r!==1||a||s;if(xe()&&c)return await Wo(e,{...t,format:"png",quality:1,meta:i});let l=new Image;if(l.decoding="sync",l.loading="eager",l.src=e,await l.decode(),a&&s)l.style.width=`${n}px`,l.style.height=`${o}px`;else if(a){let u=Number.isFinite(i.w0)?i.w0:l.naturalWidth,d=Number.isFinite(i.h0)?i.h0:l.naturalHeight,m=n/Math.max(1,u);l.style.width=`${n}px`,l.style.height=`${Math.round(d*m)}px`}else if(s){let u=Number.isFinite(i.w0)?i.w0:l.naturalWidth,d=Number.isFinite(i.h0)?i.h0:l.naturalHeight,m=o/Math.max(1,d);l.style.height=`${o}px`,l.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(l.naturalWidth*r),d=Math.round(l.naturalHeight*r);if(l.style.width=`${u}px`,l.style.height=`${d}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let m=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${d}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,l.src=e}catch(m){q(t,"SVG width/height patch in toImg failed",m)}}return l}async function Ho(e,t){let r=t.type;if(r==="svg"){let o=decodeURIComponent(e.split(",")[1]);return new Blob([o],{type:"image/svg+xml"})}let n=await ir(e,t);return new Promise(o=>n.toBlob(i=>o(i),`image/${r}`,t.quality))}async function ao(e,t){let r=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[r]}))return!1;try{await navigator.share({files:[r],title:t})}catch(n){if(n.name!=="AbortError")return!1}return!0}async function Rs(e,t){let r=new Set(["png","jpeg","jpg","webp","svg"]),n=(t?.type||"").toLowerCase(),o=r.has(n)?n:"",i=(t?.format||o||"").toLowerCase(),a=i==="jpg"?"jpeg":i||"png",s=t?.filename||`snapdom.${a}`,c={...t||{},format:a,type:a};c.dpr=1;let l=Es();if(a==="svg"){let m=await Ho(e,{...c,type:"svg"});if(l&&await ao(m,s))return;let f=URL.createObjectURL(m),p=document.createElement("a");p.href=f,p.download=s,document.body.appendChild(p),p.click(),URL.revokeObjectURL(f),p.remove();return}let u=await ir(e,c);if(l){let m=`image/${a}`,f=await new Promise(p=>u.toBlob(p,m,t?.quality));if(f&&await ao(f,s))return}let d=document.createElement("a");d.href=u.toDataURL(`image/${a}`,t?.quality),d.download=s,document.body.appendChild(d),d.click(),d.remove()}function Dt(){Qr++,Pt.size>Ds&&Pt.clear()}function Os(e=document.documentElement){if(!lo){lo=!0;try{new MutationObserver(()=>Dt()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Dt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",Dt),t.ready?.then(()=>Dt()).catch(()=>{}))}catch{}}}function Ps(e,t={}){let r={},n=e.getPropertyValue("visibility"),o=t.excludeStyleProps;for(let d=0;dr[0]n[0]?1:0).map(([r,n])=>`${r}:${n}`).join(";"),co.set(e,t),t)}function _s(e,t=null,r={}){let n=so.get(e);if(n&&n.epoch===Qr)return n.snapshot;let o=t||getComputedStyle(e),i=Ps(o,r);return Us(e,o,i),so.set(e,{epoch:Qr,snapshot:i}),i}function Ws(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Pt,defaultStyle:k.defaultStyle,baseStyle:k.baseStyle,image:k.image,resource:k.resource,background:k.background,font:k.font},options:t||{}}:{session:k.session,persist:{snapshotKeyCache:Pt,defaultStyle:k.defaultStyle,baseStyle:k.baseStyle,image:k.image,resource:k.resource,background:k.background,font:k.font},options:e||t||{}}}function Bs(e,t,r){if(!(!e.style||e.style.length===0))for(let n=0;n0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||"visible")!=="visible"}function Uo(e){let t=e.parentElement;if(!t)return!1;let r=getComputedStyle(t).display||"";return r.includes("flex")||r.includes("grid")}function Vs(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let r=e.firstElementChild,n=e.lastElementChild;if(r&&r.tagName==="BR"||n&&n.tagName==="BR")return!0;let o=e.scrollHeight;if(o===0)return!1;let i=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return o>i+a}function Us(e,t,r){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let n=e.tagName&&e.tagName.toLowerCase();if(!n||!["div","section","article","main","aside","header","footer","nav"].includes(n))return;let o=parseFloat(t.height);if(Number.isFinite(o)&&e.scrollHeight>0&&Math.abs(o-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let i=t.display||"";if(i.includes("flex")||i.includes("grid")||Hs(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||$s(t)||Uo(e))return;let s=t.overflowX||t.overflow||"visible",c=t.overflowY||t.overflow||"visible";if(s!=="visible"||c!=="visible")return;let l=t.clip;l&&l!=="auto"&&l!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||Vs(e,t)&&(delete r.height,delete r["block-size"])}function en(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI==="http://www.w3.org/2000/svg"&&Gs.has(t.localName))return!0;t=t.parentNode}return!1}function zs(e,t){let r=t+"::"+e.toLowerCase(),n=uo.get(r);if(n)return n;let o=document,i=t==="http://www.w3.org/2000/svg"?o.createElementNS(t,e):o.createElement(e),a=o.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(i),o.documentElement.appendChild(a);let s=getComputedStyle(i),c={};for(let l of Go)c[l]=s.getPropertyValue(l)||"";return a.remove(),uo.set(r,c),c}function Ys(e,t){if(!(e instanceof Element)||!(t instanceof Element)||en(e))return;let r=e.getAttribute?.("style"),n=!!(r&&r.includes("var("));if(!n&&e.attributes?.length){let i=e.attributes;for(let a=0;anew Promise(o=>{function i(){gt(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(n,o):i()},{fast:r})}i()})))}function Zs(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function js(e,t,r=!0){return e.split(",").map(n=>n.trim()).filter(Boolean).map(n=>{if(n.startsWith(":where(")||n.startsWith("@"))return n;let o=r?Zs(n):n;return`:where(${t} ${o})`}).join(", ")}function Xs(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(r,n)=>`:where(${t}:is(${n.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(r,n)=>`:where(:where(${n.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(r,n)=>`:where(${t} ${n.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(r,n,o,i)=>{let a=js(i,t,!0);return`${n}${o}${a}{`}),e):""}function Ks(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function qs(e){let t="";try{e.querySelectorAll("style").forEach(n=>{t+=(n.textContent||"")+` `});let r=e.adoptedStyleSheets||[];for(let n of r)try{if(n&&n.cssRules)for(let o of n.cssRules)t+=o.cssText+` `}catch{}}catch{}return t}function Js(e,t,r){if(!t)return;let n=document.createElement("style");n.setAttribute("data-sd",r),n.textContent=t,e.insertBefore(n,e.firstChild||null)}function Qs(e,t){try{let r=e.currentSrc||e.src||"";if(!r)return;t.setAttribute("src",r),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function el(e){let t=new Set;if(!e)return t;let r=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,n;for(;n=r.exec(e);)t.add(n[1]);return t}function tl(e,t){try{let r=getComputedStyle(e).getPropertyValue(t).trim();if(r)return r}catch{}try{let r=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(r)return r}catch{}return""}function rl(e,t,r){let n=[];for(let o of t){let i=tl(e,o);i&&n.push(`${o}: ${i};`)}return n.length?`${r}{${n.join("")}} `:""}function nl(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted","")))}async function ol(e,t=3){let r=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},n=r(),o=0;for(;osetTimeout(i,0)),n=r(),o++;return n&&(n.body||n.documentElement)?n:null}function il(e){let t=e.getBoundingClientRect(),r=0,n=0,o=0,i=0;try{let c=getComputedStyle(e);r=parseFloat(c.borderLeftWidth)||0,n=parseFloat(c.borderRightWidth)||0,o=parseFloat(c.borderTopWidth)||0,i=parseFloat(c.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(r+n))),s=Math.max(0,Math.round(t.height-(o+i)));return{contentWidth:a,contentHeight:s,rect:t}}function Re(e){let t=0,r=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(r=e.offsetHeight),t===0||r===0)try{let n=getComputedStyle(e);if(t===0){let o=parseFloat(n.width);!isNaN(o)&&o>0&&(t=o)}if(r===0){let o=parseFloat(n.height);!isNaN(o)&&o>0&&(r=o)}}catch{}if(t===0||r===0)try{if(t===0){let n=parseFloat(e.getAttribute("width"));!isNaN(n)&&n>0&&(t=n)}if(r===0){let n=parseFloat(e.getAttribute("height"));!isNaN(n)&&n>0&&(r=n)}}catch{}if((t===0||r===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),r===0&&e.naturalHeight>0&&(r=e.naturalHeight)}catch{}return{width:t,height:r}}function al(e,t,r){let n=e.defaultView,o=n?n.scrollX:0,i=n?n.scrollY:0,a=e.body?e.body.scrollLeft:0,s=e.body?e.body.scrollTop:0,c=e.documentElement?e.documentElement.scrollLeft:0,l=e.documentElement?e.documentElement.scrollTop:0,u=e.createElement("style");return u.setAttribute("data-sd-iframe-pin",""),u.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${r}px !important;min-width: ${t}px !important;min-height: ${r}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(u),()=>{try{u.remove()}catch{}try{n&&typeof n.scrollTo=="function"&&n.scrollTo(o,i),e.body&&(e.body.scrollLeft=a,e.body.scrollTop=s),e.documentElement&&(e.documentElement.scrollLeft=c,e.documentElement.scrollTop=l)}catch{}}}async function sl(e,t,r){let n=await ol(e,3);if(!n)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:i,rect:a}=il(e),s=r?.snap;if(!s&&typeof window<"u"&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let c={...r,scale:1},l=al(n,o,i),u;try{u=await s.toPng(n.documentElement,c)}finally{l()}u.style.display="block",u.style.width=`${o}px`,u.style.height=`${i}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),et(e,d,t,r),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(u),d}function ll(e){let{width:t,height:r}=Re(e),n=e.getBoundingClientRect(),o;try{o=window.getComputedStyle(e)}catch{}let i=o?parseFloat(o.width):NaN,a=o?parseFloat(o.height):NaN,s=Math.round(t||n.width||0),c=Math.round(r||n.height||0),l=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,s||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,c||16),d=(e.type||"text").toLowerCase()==="checkbox",m=!!e.checked,f=!!e.indeterminate,p=Math.max(Math.min(l,u),12),h="middle";try{o&&o.verticalAlign&&(h=o.verticalAlign)}catch{}let g=document.createElement("div");g.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),g.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:${h};flex-shrink:0;line-height:0;`;let y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width",String(p)),y.setAttribute("height",String(p)),y.setAttribute("viewBox",`0 0 ${p} ${p}`),g.appendChild(y);function b(){let w="#0a6ed1";try{o&&(w=o.accentColor||o.color||w)}catch{}let S=2,I=S/2,M=p-S;if(y.innerHTML="",d){let C=document.createElementNS("http://www.w3.org/2000/svg","rect");if(C.setAttribute("x",String(I)),C.setAttribute("y",String(I)),C.setAttribute("width",String(M)),C.setAttribute("height",String(M)),C.setAttribute("rx","2"),C.setAttribute("ry","2"),C.setAttribute("fill",m?w:"none"),C.setAttribute("stroke",w),C.setAttribute("stroke-width",String(S)),y.appendChild(C),m){let A=document.createElementNS("http://www.w3.org/2000/svg","path");A.setAttribute("d",`M ${I+2} ${p/2} L ${p/2-1} ${p-I-2} L ${p-I-2} ${I+2}`),A.setAttribute("stroke","white"),A.setAttribute("stroke-width",String(Math.max(1.5,S))),A.setAttribute("fill","none"),A.setAttribute("stroke-linecap","round"),A.setAttribute("stroke-linejoin","round"),y.appendChild(A)}else if(f){let A=document.createElementNS("http://www.w3.org/2000/svg","rect"),R=Math.max(6,M-4);A.setAttribute("x",String((p-R)/2)),A.setAttribute("y",String((p-S)/2)),A.setAttribute("width",String(R)),A.setAttribute("height",String(S)),A.setAttribute("fill",w),A.setAttribute("rx","1"),y.appendChild(A)}}else{let C=document.createElementNS("http://www.w3.org/2000/svg","circle");if(C.setAttribute("cx",String(p/2)),C.setAttribute("cy",String(p/2)),C.setAttribute("r",String((p-S)/2)),C.setAttribute("fill",m?w:"none"),C.setAttribute("stroke",w),C.setAttribute("stroke-width",String(S)),y.appendChild(C),m){let A=document.createElementNS("http://www.w3.org/2000/svg","circle"),R=Math.max(2,(p-S*2)*.35);A.setAttribute("cx",String(p/2)),A.setAttribute("cy",String(p/2)),A.setAttribute("r",String(R)),A.setAttribute("fill","white"),y.appendChild(A)}}g.style.setProperty("width",`${p}px`,"important"),g.style.setProperty("height",`${p}px`,"important"),g.style.setProperty("min-width",`${p}px`,"important"),g.style.setProperty("min-height",`${p}px`,"important")}return b(),{el:g,applyVisual:b}}async function Ot(e){if(k.resource?.has(e))return k.resource.get(e);if(Rt.has(e))return Rt.get(e);let t=(async()=>{let r=await Ie(e,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return k.resource?.set(e,r.data),r.data})();Rt.set(e,t);try{let r=await t;return Rt.set(e,r),r}catch(r){throw Rt.delete(e),r}}async function mo(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(cl)||[]));if(t.length===0)return e;let r=e;for(let n of t)try{let o=await Ot(n);r=r.split(n).join(o)}catch{}return r}function jt(e){return typeof e=="string"&&e.startsWith("blob:")}function ul(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let r=t.match(/^(\S+)(\s+.+)?$/);return r?{url:r[1],desc:r[2]||""}:null}).filter(Boolean)}function dl(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function ml(e,t=null){if(!e)return;let r=t,n=e.querySelectorAll?e.querySelectorAll("img"):[];for(let c of n)try{let l=c.getAttribute("src")||c.currentSrc||"";if(jt(l)){let d=await Ot(l);c.setAttribute("src",d)}let u=c.getAttribute("srcset");if(u&&u.includes("blob:")){let d=ul(u),m=!1;for(let f of d)if(jt(f.url))try{f.url=await Ot(f.url),m=!0}catch(p){q(r,"blobUrlToDataUrl for srcset item failed",p)}m&&c.setAttribute("srcset",dl(d))}}catch(l){q(r,"resolveBlobUrls for img failed",l)}let o=e.querySelectorAll?e.querySelectorAll("image"):[];for(let c of o)try{let l="http://www.w3.org/1999/xlink",u=c.getAttribute("href")||c.getAttributeNS?.(l,"href");if(jt(u)){let d=await Ot(u);c.setAttribute("href",d),c.removeAttributeNS?.(l,"href")}}catch(l){q(r,"resolveBlobUrls for SVG image href failed",l)}let i=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let c of i)try{let l=c.getAttribute("style");if(l&&l.includes("blob:")){let u=await mo(l);c.setAttribute("style",u)}}catch(l){q(r,"replaceBlobUrls in inline style failed",l)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let c of a)try{let l=c.textContent||"";l.includes("blob:")&&(c.textContent=await mo(l))}catch(l){q(r,"replaceBlobUrls in style tag failed",l)}let s=["poster"];for(let c of s){let l=e.querySelectorAll?e.querySelectorAll(`[${c}^='blob:']`):[];for(let u of l)try{let d=u.getAttribute(c);jt(d)&&u.setAttribute(c,await Ot(d))}catch(d){q(r,`resolveBlobUrls for ${c} failed`,d)}}}async function Jt(e,t,r){if(!e)throw new Error("Invalid node");let n=new Set,o=null,i=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||mn.has(u))return null;if(u==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return q(t,"Nested skipped (SVG spec limitation \u2014 not rendered by browsers)"),null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(r.excludeMode==="hide"){let u=document.createElement("div"),{width:d,height:m}=Re(e),f=d||e.getBoundingClientRect().width||0,p=m||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${f}px;height:${p}px;visibility:hidden;`,u}else if(r.excludeMode==="remove")return null}if(r.exclude&&Array.isArray(r.exclude))for(let u of r.exclude)try{if(e.matches?.(u)){if(r.excludeMode==="hide"){let d=document.createElement("div"),{width:m,height:f}=Re(e),p=m||e.getBoundingClientRect().width||0,h=f||e.getBoundingClientRect().height||0;return d.style.cssText=`display:inline-block;width:${p}px;height:${h}px;visibility:hidden;`,d}else if(r.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof r.filter=="function")try{if(!r.filter(e)){if(r.filterMode==="hide"){let u=document.createElement("div"),{width:d,height:m}=Re(e),f=d||e.getBoundingClientRect().width||0,p=m||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${f}px;height:${p}px;visibility:hidden;`,u}else if(r.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(e.tagName==="IFRAME"){let u=!1;try{u=!!(e.contentDocument||e.contentWindow?.document)}catch(d){q(t,"iframe same-origin probe failed",d)}if(u)try{return await sl(e,t,r)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(u||console.warn("[snapdom] cross-origin