From 7a9e31f3a12bc5a1aae4b53f529a64aa03345c53 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 12 Sep 2026 07:44:33 +0800 Subject: [PATCH 1/2] chore: bump version 2.24.18 --- .../wwwroot/lib/snapdom.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs b/src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs index e74bc9a1..0ac3bc5e 100644 --- a/src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs +++ b/src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs @@ -1,14 +1,14 @@ /* * SnapDOM -* v2.24.12 +* v2.24.18 * Author: Juan Martin Muda * License: MIT */ -var Yr=Object.defineProperty;var st=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(o){throw n=[o],o}};var Gt=(t,e)=>{for(var n in e)Yr(t,n,{get:e[n],enumerable:!0})};function _n(t){if(t===!0)return"soft";if(t===!1)return"disabled";if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="auto")return"auto";if(e==="full")return"full";if(e==="soft"||e==="disabled")return e}return"soft"}function he(t="soft"){switch(t){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.measureHints=new WeakMap,C.baseStyle=new Y(50),C.defaultStyle=new Y(30),C.image=new Y(100),C.background=new Y(100),C.resource=new Y(150),C.compress=new Y(50),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var Y,C,rt=st(()=>{"use strict";Y=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let o=this.keys().next().value;o!==void 0&&this.delete(o)}return super.set(e,n)}},C={image:new Y(100),background:new Y(100),resource:new Y(150),defaultStyle:new Y(30),baseStyle:new Y(50),compress:new Y(50),computedStyle:new WeakMap,measureHints:new WeakMap,burstAdvice:new WeakMap,warnedReconcile:!1,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function Et(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Yt(t,e=1){let n=t.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let o=[];for(let s of n[1].split(",")){let i=s.match(/url\((['"]?)(.*?)(\1)\)/);if(!i)continue;let a=s.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!Kr.test(a[1].trim()))continue;let c=s.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),u=1;if(c){let l=parseFloat(c[1]);u=/dpi/i.test(c[2])?l/96:l}o.push({url:i[2].trim(),dppx:u})}return o.length?(o.sort((s,i)=>s.dppx-i.dppx),(o.find(s=>s.dppx>=e)||o[o.length-1]).url):null}function De(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 St(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function He(t,e){if(!t||/^(data|blob|about|#)/i.test(t.trim()))return t;try{let n=e||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(t,n).href}catch{return t}}var Kr,Kt=st(()=>{"use strict";Kr=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function Qr(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function s(i,a,c){if(r>=n)return;let u=Date.now();(o.get(a)||0)>u||(o.set(a,u+e),r++,i==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(i,a){s("warn",i,a)},errorOnce(i,a){s("error",i,a)},reset(){o.clear(),r=0}}}function Zr(t){return/^data:|^blob:|^about:blank$/i.test(t)}function Jr(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 i=s.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function ti(t,e){if(!e||Zr(t)||Jr(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 ei(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",St(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}${St(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function On(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 ni(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function G(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",s=e.errorTTL??8e3,i=e.headers||{},a=!!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[,b="",y=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],S=/;base64/i.test(b)?atob(y):decodeURIComponent(y),g=new Uint8Array([...S].map(v=>v.charCodeAt(0))),x=new Blob([g],{type:(b||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:t,fromCache:!1,mime:x.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let b=await fetch(t);if(!b.ok)return{ok:!1,data:null,status:b.status,url:t,fromCache:!1,reason:"http_error"};let y=await b.blob(),w=y.type||b.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await On(y),status:b.status,url:t,fromCache:!1,mime:w}:n==="text"?{ok:!0,data:await y.text(),status:b.status,url:t,fromCache:!1,mime:w}:{ok:!0,data:y,status:b.status,url:t,fromCache:!1,mime:w}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=ni(t,{as:n,timeout:o,useProxy:r,errorTTL:s}),u=pe.get(c);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&pe.delete(c);let l=ze.get(c);if(l)return l;let d=ti(t,r)?ei(t,r):t,f=e.credentials;if(!f)try{let b=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(t,b);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let h=new AbortController,m=setTimeout(()=>h.abort("timeout"),o),p=(async()=>{try{let b=await fetch(d,{signal:h.signal,credentials:f,headers:i});if(!b.ok){let S={ok:!1,data:null,status:b.status,url:d,fromCache:!1,reason:"http_error"};if(s>0&&pe.set(c,{until:Date.now()+s,result:S}),!a){let g=`${b.status} ${b.statusText||""}`.trim();Wn.warnOnce(`http:${b.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${g} while fetching ${n} ${t}`)}return e.onError&&e.onError(S),S}if(n==="text")return{ok:!0,data:await b.text(),status:b.status,url:d,fromCache:!1};let y=await b.blob(),w=y.type||b.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await On(y),status:b.status,url:d,fromCache:!1,mime:w}:{ok:!0,data:y,status:b.status,url:d,fromCache:!1,mime:w}}catch(b){let y=b&&typeof b=="object"&&"name"in b&&b.name==="AbortError"?String(b.message||"").includes("timeout")?"timeout":"abort":"network",w={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(t)&&s>0&&pe.set(c,{until:Date.now()+s,result:w}),!a){let S=`${y}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,g=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`;Wn.errorOnce(S,g)}return e.onError&&e.onError(w),w}finally{clearTimeout(m),ze.delete(c)}})();return ze.set(c,p),p}var Wn,ze,pe,vt=st(()=>{"use strict";Kt();Wn=Qr("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ze=new Map,pe=new Map});async function $t(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=Yt(t,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??Et(t);if(!o)return t;let r=He(o),s=St(r),i=(e.useProxy||"")+"|"+s;if(C.background.has(i)){let a=C.background.get(i);return a?`url("${a}")`:"none"}try{let a=await G(s,{as:"dataURL",useProxy:e.useProxy});return a.ok?(C.background.set(i,a.data),`url("${a.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var Bn=st(()=>{"use strict";rt();Kt();vt()});function Ve(){for(let t of oi){let e=String(t).toLowerCase();me.has(e)||ge.has(e)||ye(e)}}function ye(t){if(t=String(t).toLowerCase(),ge.has(t)){let s={};return C.defaultStyle.set(t,s),s}if(C.defaultStyle.has(t))return C.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),r={};for(let s of o){if(Qt(s))continue;let i=o.getPropertyValue(s);r[s]=i}return e.removeChild(n),C.defaultStyle.set(t,r),r}function Qt(t){let e=Un.get(t);if(e===void 0){let n=String(t).toLowerCase();e=si.has(n)||ii.test(n)||ri.test(n),Un.set(t,e)}return e}function be(t,e){return!ci.has(t)&&(e==="inline"||ai.has(t)||Dn.has(t))}function je(t,e,n){let o=(e.display||"").toLowerCase();if(o==="inline"||Dn.has(t))return!1;if(n)return!0;if((e.float||"none").toLowerCase()!=="none")return!1;let s=(e.position||"static").toLowerCase();return s==="absolute"||s==="fixed"?!1:!ui.has(o)}function Wt(t,e,n=!0,o=!1){if(e=String(e||"").toLowerCase(),ge.has(e))return"";let r=[],s=ye(e),i=(t.display||"").toLowerCase(),a=i==="inline",c=be(e,i),u=t["text-wrap-mode"]||t["white-space"]||"",l=c&&n&&!a&&(u==="nowrap"||u==="pre"),d=c&&n&&!l,f=!1;for(let h in t){if(Qt(h))continue;let m=t[h];if(d){if(li.has(h))continue;if(fi.has(h)){m&&m!==s[h]&&(r.push(`${h}:${m}`),m!=="auto"&&(f=!0));continue}}if(m&&m!==s[h]){if(!l&&(h==="width"||h==="inline-size")&&m.endsWith("px")&&m.includes(".")){let p=parseFloat(m);if(Number.isFinite(p)){r.push(`${h}:${Math.ceil(p*16)/16}px`);continue}}r.push(`${h}:${m}`)}}if(d&&!a&&!o&&!f){let h=t.width;h&&h!=="auto"&&h!==s.width&&r.push(`min-width:${h}`)}return r.sort(),r.join(";")}function qe(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 Xe(t){let e=new Map;for(let o of t){let r=ye(o);if(!r)continue;let s=Object.entries(r).map(([i,a])=>`${i}:${a};`).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} } -`;return n}function Ge(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 di(t){try{let e=t?.ownerDocument;if(!e)return typeof window<"u"?window:null;let n=e.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let o=0;o{let s={length:0,getPropertyValue:()=>"",item:()=>""};return s[Symbol.iterator]=function*(){},s};if(t?.nodeType!==1){let s=typeof window<"u"?window:null;if(s&&typeof s.getComputedStyle=="function")try{return s.getComputedStyle(t,e)||n()}catch{return n()}return n()}let o=C.computedStyle.get(t);o||(o=new Map,C.computedStyle.set(t,o));let r=o.get(e);if(!r){let s=di(t),i=null;try{i=s&&typeof s.getComputedStyle=="function"?s.getComputedStyle(t,e):null}catch{}if(!i&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(i=window.getComputedStyle(t,e))}catch{}r=i||n(),o.set(e,r)}return r}function we(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);for(let n of hi){let o=e[`border-${n}-style`],r=e[`border-${n}-width`];(o==="none"||o==="hidden"||r==="0px")&&(delete e[`border-${n}-style`],delete e[`border-${n}-width`],delete e[`border-${n}-color`])}return e}function Ot(t){let e=[],n=0,o=0;for(let r=0;r{"use strict";rt();me=new Set(["meta","script","noscript","title","link","template"]),ge=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","symbol","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),oi=["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"];ri=/(?:^|-)(animation|transition)(?:-|$)/i,ii=/^(--.+|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,si=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom","stroke-color"]),Un=new Map;ai=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),Dn=new Set(["table","thead","tbody","tfoot","tr","td","th"]),ci=new Set(["img","video","canvas","svg","iframe","embed","object","input","textarea","select"]),li=new Set(["width","max-width","inline-size","max-inline-size"]),fi=new Set(["min-width","min-inline-size"]);ui=new Set(["inline-block","inline-flex","inline-grid","inline-table","inline-flow-root","table"]);hi=["top","right","bottom","left"]});function Rt(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function mt(t=1e3){return typeof requestAnimationFrame!="function"||typeof document<"u"&&document.visibilityState==="hidden"?Promise.resolve():new Promise(e=>{let n=!1,o=()=>{n||(n=!0,e())};try{requestAnimationFrame(o)}catch{o();return}setTimeout(o,t)})}function Ye(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let t=navigator.userAgent||"",e=/iPhone|iPad|iPod/.test(t),n=navigator.maxTouchPoints>2&&/Macintosh/.test(t);return e||n}function K(){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),i=o&&r&&s,a=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),u=/ipad|iphone|ipod/.test(e)&&o;return n||i||a||c||u}function Hn(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var Ct=st(()=>{"use strict"});function _(t,e,n){let o=t&&typeof t=="object"&&(t.options||t);o&&o.debug&&(n!==void 0?console.warn("[snapdom]",e,n):console.warn("[snapdom]",e))}var Ke=st(()=>{"use strict"});var at=st(()=>{"use strict";Bn();Zt();Ct();Kt();Ke()});var Nr={};Gt(Nr,{decodeSvgFromDataURL:()=>We,encodeSvgToDataURL:()=>Oe,fixSafariShadows:()=>Be,toCanvas:()=>Pt});function va(t){try{let e=t.match(/]*>/i);if(!e)return t;let n=e[0],o=parseFloat((n.match(/\bwidth="([\d.]+)/i)||[])[1]),r=parseFloat((n.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(o)||!Number.isFinite(r)||o<=0||r<=0)return t;let s=Math.min(1,At/o,At/r,Math.sqrt(Sn/(o*r)));if(s>=1)return t;let i=Math.max(1,Math.floor(o*s)),a=Math.max(1,Math.floor(r*s));return console.warn(`[snapDOM] Capture ${Math.round(o)}\xD7${Math.round(r)}px exceeds the browser image-decode limit (${At}px/side); downscaling to ${i}\xD7${a}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`),t.replace(n,n.replace(/(\bwidth=")[\d.]+/i,`$1${i}`).replace(/(\bheight=")[\d.]+/i,`$1${a}`))}catch{return t}}function Ca(t,e){let n=["x","y","width","height"].map(v=>Number(e?.[v]));if(!n.every(Number.isFinite)||n[2]<=0||n[3]<=0)throw new RangeError("[snapdom] canvas crop requires finite x/y and positive width/height");let o=t.match(/]*>/i);if(!o)throw new Error("[snapdom] cannot crop a non-SVG capture");let r=o[0],s=(r.match(/\bviewBox="([^"]+)"/i)||[])[1],i=String(s||"").trim().split(/[\s,]+/).map(Number);if(i.length!==4||!i.every(Number.isFinite)||i[2]<=0||i[3]<=0)throw new Error("[snapdom] cannot crop an SVG without a finite viewBox");let[a,c,u,l]=i,d=Math.max(a,n[0]),f=Math.max(c,n[1]),h=Math.min(a+u,n[0]+n[2]),m=Math.min(c+l,n[1]+n[3]);if(!(h>d)||!(m>f))throw new RangeError("[snapdom] canvas crop does not intersect the SVG viewBox");let p=parseFloat((r.match(/\bwidth="([\d.]+)/i)||[])[1]),b=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]),y=Number.isFinite(p)&&p>0?p/u:1,w=Number.isFinite(b)&&b>0?b/l:1,S=Math.max(1,(h-d)*y),g=Math.max(1,(m-f)*w),x=r.replace(/(\bwidth=")[^"]*/i,`$1${S}`).replace(/(\bheight=")[^"]*/i,`$1${g}`).replace(/(\bviewBox=")[^"]*/i,`$1${d} ${f} ${h-d} ${m-f}`);return t.replace(r,x)}function Rr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function We(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Aa(t){let e=t.indexOf(",");if(e<0)return"";let n=t.slice(e+1,e+1201).replace(/%[0-9A-Fa-f]?$/,"");try{return decodeURIComponent(n)}catch{return""}}function Oe(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Tr(t){let e=[],n="",o=0;for(let r=0;rr.trim()).filter(Boolean)}function ka(t){let e=[],n="",o=0;for(let s=0;s`${a}:${c}`).join(";")}function Ma(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Pr(o)}}`)}function Fa(t){return t=t.replace(/]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Ma(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Pr(o)}${n}`),t}function Ea(){return _e||(_e=(async()=>{try{let t='
',e=new Image;e.decoding="sync",e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,await e.decode();let n=document.createElement("canvas");n.width=8,n.height=20;let o=n.getContext("2d",{willReadFrequently:!0});o.drawImage(e,0,0);let r=o.getImageData(2,18,1,1).data[3]>128,s=o.getImageData(2,2,1,1).data[3]>128;return{native:r||s,flippedY:s&&!r}}catch{return{native:!1,flippedY:!1}}})(),_e)}function $a(t){let e=[],n=0,o=0;for(let r=0;r{let s=0,i=0,a="",c=0;for(;cTr(o).map(r=>{let s=r.indexOf(":");if(s<0)return r;let i=r.slice(0,s).trim().toLowerCase();return i==="text-shadow"||e&&i==="box-shadow"?`${i}:${$a(r.slice(s+1))}`:r}).join(";");return t=t.replace(/]*>([\s\S]*?)<\/style>/gi,(o,r)=>o.replace(r,r.replace(/([^{}]+)\{([^}]*)\}/g,(s,i,a)=>`${i}{${n(a)}}`))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(o,r,s)=>`style=${r}${n(s)}${r}`),t}async function Be(t){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(t))return{svg:t,naturalOnly:!1};let{native:n,flippedY:o}=await Ea();try{let r=t;return n||(r=Fa(r)),o&&(r=Ra(r,n)),{svg:r,naturalOnly:!0}}catch{return{svg:t,naturalOnly:!0}}}async function Ta(t,e){t.setAttribute("data-snapdom-internal",""),t.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(t);try{let n=document.createElement("canvas");n.width=16,n.height=16;let o=()=>new Promise(i=>{requestAnimationFrame(i),setTimeout(i,50)}),r=n.getContext("2d",{willReadFrequently:!0});if(!r){await o(),await o();return}let s=performance.now()+(e?600:150);for(;;){r.clearRect(0,0,16,16);try{r.drawImage(t,0,0,16,16)}catch{return}let i=r.getImageData(0,0,16,16).data,a=!1;for(let c=3;c0){a=!0;break}if(a||performance.now()>s)return;await o()}}finally{try{t.remove()}catch{}}}async function Pt(t,e){let{width:n,height:o,scale:r=1,dpr:s=1,meta:i={},backgroundColor:a,crop:c=null}=e,u=t,l=!1,d=!1;if(c&&!Rr(t))throw new RangeError("[snapdom] canvas crop requires an SVG capture payload");if(Rr(t)){let F=(Aa(t).match(/]*>/i)||[])[0]||"",E=parseFloat((F.match(/\bwidth="([\d.]+)/i)||[])[1]),R=parseFloat((F.match(/\bheight="([\d.]+)/i)||[])[1]),W=Number.isFinite(E)&&Number.isFinite(R)&&E>0&&R>0&&Math.min(1,At/E,At/R,Math.sqrt(Sn/(E*R)))<1;if(c||W||K())try{let T=We(t);if(c&&(T=Ca(T,c)),K()){let I=await Be(T);T=I.svg,l=I.naturalOnly,d=/@font-face|data:image\//i.test(T)}(W||c)&&(T=va(T)),u=Oe(T)}catch(T){if(c)throw T;u=t}}let f=new Image;f.loading="eager",f.decoding="sync",f.crossOrigin="anonymous",f.src=u,await f.decode(),K()&&await Ta(f,d);let h=f.naturalWidth,m=f.naturalHeight,p=c?h:Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:h,b=c?m:Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:m,y,w,S=Number.isFinite(n),g=Number.isFinite(o);if(S&&g)y=Math.max(1,n),w=Math.max(1,o);else if(S){let F=n/Math.max(1,p);y=n,w=b*F}else if(g){let F=o/Math.max(1,b);w=o,y=p*F}else y=h,w=m;y=y*r,w=w*r;let x=y*s,v=w*s,k=Math.max(x/At,v/At,Math.sqrt(x*v/Sn));k>1&&(console.warn(`[snapDOM] Output ${Math.round(x)}\xD7${Math.round(v)}px exceeds the browser canvas limit (${At}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),y/=k,w/=k);let A=document.createElement("canvas");A.width=y*s,A.height=w*s,A.style.width=`${y}px`,A.style.height=`${w}px`;let M=A.getContext("2d");if(s!==1&&M.scale(s,s),a&&(M.save(),M.fillStyle=a,M.fillRect(0,0,y,w),M.restore()),l&&(Math.round(y*s)!==h||Math.round(w*s)!==m)){let F=document.createElement("canvas");F.width=h,F.height=m,F.getContext("2d").drawImage(f,0,0),M.drawImage(F,0,0,y,w)}else M.drawImage(f,0,0,y,w);return A}var At,Sn,_e,qt=st(()=>{"use strict";Ct();At=16384,Sn=16384*16384;_e=null});var Ue={};Gt(Ue,{rasterize:()=>vn});async function vn(t,e){let n=await Pt(t,e),o=await new Promise(s=>{let i=()=>s(n.toDataURL(`image/${e.format}`,e.quality));try{n.toBlob(a=>{if(!a)return i();let c=new FileReader;c.onload=()=>s(String(c.result||"")),c.onerror=i,c.readAsDataURL(a)},`image/${e.format}`,e.quality)}catch{i()}}),r=new Image;return r.src=o,await r.decode(),r.style.width=`${n.width/e.dpr}px`,r.style.height=`${n.height/e.dpr}px`,r}var ae=st(()=>{"use strict";qt()});var Cn={};Gt(Cn,{toImg:()=>Pa,toSvg:()=>Pa});async function Pa(t,e){let{scale:n=1,width:o,height:r,meta:s={}}=e,i=Number.isFinite(o),a=Number.isFinite(r),c=Number.isFinite(n)&&n!==1||i||a;if(K()&&c)try{let{svg:l}=await Be(We(t)),d=(l.match(/]*>/i)||[])[0]||"",f=parseFloat((d.match(/\bwidth="([\d.]+)/i)||[])[1]),h=parseFloat((d.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(f)||!Number.isFinite(h))throw new Error("svg without dimensions");let m=Number.isFinite(s.vbW)?s.vbW:Number.isFinite(s.w0)?s.w0:f,p=Number.isFinite(s.vbH)?s.vbH:Number.isFinite(s.h0)?s.h0:h,b,y;i&&a?(b=o,y=r):i?(b=o,y=Math.round(p*(o/Math.max(1,m)))):a?(y=r,b=Math.round(m*(r/Math.max(1,p)))):(b=Math.round(f*n),y=Math.round(h*n));let w=l.replace(/width="[^"]*"/,`width="${b}"`).replace(/height="[^"]*"/,`height="${y}"`),S=new Image;return S.decoding="sync",S.loading="eager",S.src=Oe(w),await S.decode(),S.style.width=`${b}px`,S.style.height=`${y}px`,S}catch(l){return _(e,"safari vector toImg failed, falling back to PNG",l),vn(t,{...e,format:"png",quality:1,meta:s})}let u=new Image;if(u.decoding="sync",u.loading="eager",u.src=t,await u.decode(),i&&a)u.style.width=`${o}px`,u.style.height=`${r}px`;else if(i){let l=Number.isFinite(s.vbW)?s.vbW:Number.isFinite(s.w0)?s.w0:u.naturalWidth,d=Number.isFinite(s.vbH)?s.vbH:Number.isFinite(s.h0)?s.h0:u.naturalHeight,f=o/Math.max(1,l);u.style.width=`${o}px`,u.style.height=`${Math.round(d*f)}px`}else if(a){let l=Number.isFinite(s.vbW)?s.vbW:Number.isFinite(s.w0)?s.w0:u.naturalWidth,d=Number.isFinite(s.vbH)?s.vbH:Number.isFinite(s.h0)?s.h0:u.naturalHeight,f=r/Math.max(1,d);u.style.height=`${r}px`,u.style.width=`${Math.round(l*f)}px`}else{let l=Math.round(u.naturalWidth*n),d=Math.round(u.naturalHeight*n);if(u.style.width=`${l}px`,u.style.height=`${d}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${l}"`).replace(/height="[^"]*"/,`height="${d}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,u.src=t}catch(f){_(e,"SVG width/height patch in toImg failed",f)}}return u}var An=st(()=>{"use strict";at();ae();qt()});var Lr={};Gt(Lr,{toBlob:()=>kn});async function kn(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 Pt(t,e);return new Promise(r=>o.toBlob(s=>r(s),`image/${n}`,e.quality))}var Mn=st(()=>{"use strict";qt()});var _r={};Gt(_r,{download:()=>Na});async function Ir(t,e){let n=new File([t],e,{type:t.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:e})}catch(o){if(o.name!=="AbortError")return!1}return!0}async function Na(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),o=(e?.type||"").toLowerCase(),r=n.has(o)?o:"",s=(e?.format||r||"").toLowerCase(),i=s==="jpg"?"jpeg":s||"png",a=e?.filename||`snapdom.${i}`,c={...e||{},format:i,type:i};c.dpr=1;let u=Ye();if(i==="svg"){let f=await kn(t,{...c,type:"svg"});if(u&&await Ir(f,a))return;let h=URL.createObjectURL(f),m=document.createElement("a");m.href=h,m.download=a,document.body.appendChild(m),m.click(),URL.revokeObjectURL(h),m.remove();return}let l=await Pt(t,c);if(u){let f=`image/${i}`,h=await new Promise(m=>l.toBlob(m,f,e?.quality));if(h&&await Ir(h,a))return}let d=document.createElement("a");d.href=l.toDataURL(`image/${i}`,e?.quality),d.download=a,document.body.appendChild(d),d.click(),d.remove()}var Wr=st(()=>{"use strict";Mn();qt();Ct()});at();at();rt();var Ze=new WeakMap,Jt=new Map,pi=2e3,Se=0;function xe(){Se++,Jt.size>pi&&Jt.clear()}var mi="[data-snapdom-sandbox],[data-snapdom-internal],[data-snapdom]";function Qe(t){let e=t&&(t.nodeType===1?t:t.parentElement);return!!(e&&e.closest&&e.closest(mi))}function Je(t){for(let e of t)if(!Qe(e.target)){if(e.type==="childList"){let n=!0;for(let o of e.addedNodes)if(!Qe(o)){n=!1;break}if(n){for(let o of e.removedNodes)if(!Qe(o)){n=!1;break}}if(n)continue}return!0}return!1}var zn=!1;function gi(t=document.documentElement){if(zn)return;zn=!0;let e=n=>{Je(n)&&xe()};try{new MutationObserver(e).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(e).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let n=document.fonts;n&&(n.addEventListener?.("loadingdone",xe),n.ready?.then(()=>xe()).catch(()=>{}))}catch{}}var yi=["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"];function tn(t){let e=Ze.get(t);if(e&&e.epoch===Se){let n=e.snapshot&&e.snapshot.__needsBgInline;if(n!==void 0)return n}return!0}function bi(t,e={}){let n={},o=e.excludeStyleProps;for(let d=0;d0))return!1;let o=1/0,r=-1/0,s=null;for(let i=t.firstChild;i;i=i.nextSibling){let a;if(i.nodeType===3){if(!/\S/.test(i.nodeValue||"")||(s=s||document.createRange(),s.selectNode(i),a=s.getBoundingClientRect(),!a.width&&!a.height))continue}else if(i.nodeType===1){let c=N(i);if(c.display==="none"||c.position==="absolute"||c.position==="fixed")continue;a=i.getBoundingClientRect()}else continue;a.leftr&&(r=a.right)}return r===-1/0?!1:r-o0?Math.abs(t.getBoundingClientRect().width-r)>.5:!1}var jn=new WeakMap;function Ai(t){let e=jn.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),jn.set(t,e),e)}function ki(t,e=null,n={}){let o=Ze.get(t),r=!!(n&&n.embedFonts),s=n&&n.excludeStyleProps||null;if(o&&o.epoch===Se&&o.embedFonts===r&&o.excludeStyleProps===s)return o.snapshot;let i=e||getComputedStyle(t),a=bi(i,n);return Ti(t,i,a),Ze.set(t,{epoch:Se,snapshot:a,embedFonts:r,excludeStyleProps:s}),a}function Mi(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Jt,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||{}}:{session:C.session,persist:{snapshotKeyCache:Jt,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||e||{}}}function Fi(t,e,n){if(!(!t.style||t.style.length===0))for(let o=0;o0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function qn(t){let e=t.parentElement;if(!e)return!1;let n=N(e).display||"";return n.includes("flex")||n.includes("grid")}function $i(t){for(let o=t.firstChild;o;o=o.nextSibling)if(o.nodeType===3&&/\S/.test(o.nodeValue))return!0;let e=t.firstElementChild,n=t.lastElementChild;if(e&&e.tagName==="BR"||n&&n.tagName==="BR")return!0;for(let o=t.firstElementChild;o;o=o.nextElementSibling){let r=N(o);if(r.display==="none")continue;let s=r.position;if(s!=="absolute"&&s!=="fixed")return!0}return!1}function Ri(t){let e=t.getBoundingClientRect().top,n=-1/0,o=null;for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===3){if(!/\S/.test(r.nodeValue||""))continue;o=o||document.createRange(),o.selectNode(r);let a=o.getBoundingClientRect();(a.width||a.height)&&(n=Math.max(n,a.bottom));continue}if(r.nodeType!==1)continue;let s=N(r);if(s.display==="none")continue;let i=s.position;i==="absolute"||i==="fixed"||s.float&&s.float!=="none"||(n=Math.max(n,r.getBoundingClientRect().bottom))}return n===-1/0?NaN:n-e}function Ti(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||!["div","section","article","main","aside","header","footer","nav"].includes(o)||e.aspectRatio&&e.aspectRatio!=="none"&&e.aspectRatio!=="auto")return;let s=e.display||"";if(s.includes("flex")||s.includes("grid"))return;let i=e.position;if(i==="absolute"||i==="fixed"||i==="sticky"||e.transform!=="none"||Ei(e)||qn(t))return;let a=e.overflowX||e.overflow||"visible",c=e.overflowY||e.overflow||"visible";if(a!=="visible"||c!=="visible")return;let u=e.clip;if(u&&u!=="auto"&&u!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||!$i(t))return;let l=parseFloat(e.height),d=Ri(t);Number.isFinite(l)&&Number.isFinite(d)&&Math.abs(l-d)>2||(delete n.height,delete n["block-size"])}Zt();var Gn=["fill","stroke","color","background-color","stop-color"],Pi=new Set(["symbol","defs","pattern","marker","linearGradient","radialGradient","filter"]);function ve(t){let e=t;for(;e&&e.nodeType===1;){if(e.namespaceURI==="http://www.w3.org/2000/svg"){if(e.localName==="mask"||e.localName==="clipPath")return!1;if(Pi.has(e.localName))return!0}e=e.parentNode}return!1}var Xn=new Map;function Ni(t,e){let n=e+"::"+t.toLowerCase(),o=Xn.get(n);if(o)return o;let r=document,s=e==="http://www.w3.org/2000/svg"?r.createElementNS(e,t):r.createElement(t),i=r.createElement("div");i.setAttribute("data-snapdom-internal",""),i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(s),r.documentElement.appendChild(i);let a=getComputedStyle(s),c={};for(let u of Gn)c[u]=a.getPropertyValue(u)||"";return i.remove(),Xn.set(n,c),c}function Yn(t,e){if(t?.nodeType!==1||e?.nodeType!==1||ve(t))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let s=t.attributes;for(let i=0;is.d-i.d);let r=window.devicePixelRatio||1;return(o.find(s=>s.d>=r)||o[o.length-1]).url}function en(t,e){let n=t.currentSrc||"";if(n&&!Tt(n))return n;let o=e.querySelectorAll("source[srcset]"),r=null;for(let s of o){let i=s.getAttribute("srcset");if(!i||Tt(i))continue;let a=s.getAttribute("type");if(a&&!Ii.test(a.trim()))continue;let c=s.getAttribute("media");if(c)try{if(window.matchMedia(c).matches)return Bt(i,t)}catch{}r||(r=Bt(i,t))}return r}function _i(t){let e=[t.getAttribute("data-src"),t.getAttribute("data-lazy-src"),t.getAttribute("data-original"),t.getAttribute("data-hi-res-src")];for(let o of e)if(o&&!Tt(o))return o;let n=t.getAttribute("data-srcset")||t.getAttribute("data-lazy-srcset");if(n){let o=n.split(",")[0].trim().split(/\s+/)[0];if(o&&!Tt(o))return o}return null}function Wi(t={}){let e=t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{};return{timeout:e.timeout??5e3,concurrency:e.concurrency??4,resolveLazySrc:e.resolveLazySrc!==!1,silent:e.silent??!1,useProxy:typeof t.useProxy=="string"?t.useProxy:""}}async function Qn(t,e={}){if(!t||t?.nodeType!==1||e.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:o,resolveLazySrc:r,silent:s,useProxy:i}=Wi(e);if(!Li(t,r))return null;let a=[],c=[];async function u(f){let h=await G(f,{as:"dataURL",timeout:n,useProxy:i,silent:!0});return h.ok?h.data:null}async function l(f){for(let h=0;hp()))}}let d=Array.from(t.querySelectorAll("picture"));t.matches?.("picture")&&d.unshift(t);for(let f of d){let h=f.querySelector("img");if(!h)continue;let m=h.getAttribute("src")||"";if(!Tt(m))continue;let p=en(h,f);p&&c.push(async()=>{let b=await u(p);if(!b){s||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${p.slice(0,60)}`);return}let y=h.getAttribute("src"),w=h.getAttribute("srcset"),S=h.getAttribute("sizes"),g=[];h.src=b,h.setAttribute("src",b),h.removeAttribute("srcset"),h.removeAttribute("sizes");let x=f.querySelectorAll("source");for(let v of x)g.push({el:v,parent:v.parentElement,next:v.nextSibling}),v.remove();a.push(()=>{y!==null?h.setAttribute("src",y):h.removeAttribute("src"),w!==null&&h.setAttribute("srcset",w),S!==null&&h.setAttribute("sizes",S);for(let{el:v,parent:k,next:A}of g)k&&k.insertBefore(v,A)})})}if(r){let f=Array.from(t.querySelectorAll("img"));t.localName==="img"&&f.unshift(t);for(let h of f){if(h.closest("picture")&&Tt(h.getAttribute("src")||""))continue;let m=h.getAttribute("src")||"",p=_i(h);p&&Tt(m)&&c.push(async()=>{let b=await u(p);if(!b)return;let y=h.getAttribute("src");h.src=b,h.setAttribute("src",b),h.removeAttribute("srcset"),h.removeAttribute("sizes"),a.push(()=>{y!==null?h.setAttribute("src",y):h.removeAttribute("src")})})}}return c.length===0?null:(await l(c),async function(){for(let h of a)try{h()}catch{}})}function ke(t,e,n){return n?Promise.all(t.map(o=>new Promise(r=>e(o,r)))):Promise.all(t.map(o=>new Promise(r=>{function s(){Rt(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,r):s()},{fast:n})}s()})))}function Oi(t,e){if(t=t.trim(),!t)return t;let n=e?`[data-sd-slotted~="${e}"]`:"[data-sd-slotted]";return t.endsWith(":not([data-sd-slotted])")||t.endsWith(`:not(${n})`)?t:`${t}:not(${n})`}function Bi(t,e,n=!0,o){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let s=n?Oi(r,o):r;return`:where(${e} ${s})`}).join(", ")}function Jn(t,e,n){return t?(t=t.replace(/:host\(([^)]+)\)/g,(o,r)=>`:where(${e}:is(${r.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(o,r)=>`:where(:where(${r.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(o,r)=>`:where(${e} ${r.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(o,r,s,i)=>{let a=Bi(i,e,!0,n);return`${r}${s}${a}{`}),t):""}function to(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function eo(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+` +var oi=Object.defineProperty;var ot=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(o){throw n=[o],o}};var Kt=(t,e)=>{for(var n in e)oi(t,n,{get:e[n],enumerable:!0})};function zn(t){if(t===!0)return"soft";if(t===!1)return"disabled";if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="auto")return"auto";if(e==="full")return"full";if(e==="soft"||e==="disabled")return e}return"soft"}function Se(t="soft"){switch(t){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.measureHints=new WeakMap,C.baseStyle=new Y(50),C.defaultStyle=new Y(30),C.image=new Y(100),C.background=new Y(100),C.resource=new Y(150),C.compress=new Y(50),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var Y,C,nt=ot(()=>{"use strict";Y=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let o=this.keys().next().value;o!==void 0&&this.delete(o)}return super.set(e,n)}},C={image:new Y(100),background:new Y(100),resource:new Y(150),defaultStyle:new Y(30),baseStyle:new Y(50),compress:new Y(50),computedStyle:new WeakMap,measureHints:new WeakMap,burstAdvice:new WeakMap,warnedReconcile:!1,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function Et(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Qt(t,e=1){let n=t.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let o=[];for(let s of n[1].split(",")){let i=s.match(/url\((['"]?)(.*?)(\1)\)/);if(!i)continue;let a=s.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!ri.test(a[1].trim()))continue;let c=s.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),f=1;if(c){let l=parseFloat(c[1]);f=/dpi/i.test(c[2])?l/96:l}o.push({url:i[2].trim(),dppx:f})}return o.length?(o.sort((s,i)=>s.dppx-i.dppx),(o.find(s=>s.dppx>=e)||o[o.length-1]).url):null}function Ye(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 Ct(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function Ke(t,e){if(!t||/^(data|blob|about|#)/i.test(t.trim()))return t;try{let n=e||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(t,n).href}catch{return t}}var ri,Zt=ot(()=>{"use strict";ri=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function ii(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function s(i,a,c){if(r>=n)return;let f=Date.now();(o.get(a)||0)>f||(o.set(a,f+e),r++,i==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(i,a){s("warn",i,a)},errorOnce(i,a){s("error",i,a)},reset(){o.clear(),r=0}}}function si(t){return/^data:|^blob:|^about:blank$/i.test(t)}function ai(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 i=s.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function ci(t,e){if(!e||si(t)||ai(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 li(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",Ct(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}${Ct(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function jn(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 fi(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function X(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",s=e.errorTTL??8e3,i=e.headers||{},a=!!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[,y="",b=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],S=/;base64/i.test(y)?atob(b):decodeURIComponent(b),g=new Uint8Array([...S].map(v=>v.charCodeAt(0))),x=new Blob([g],{type:(y||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:t,fromCache:!1,mime:x.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let y=await fetch(t);if(!y.ok)return{ok:!1,data:null,status:y.status,url:t,fromCache:!1,reason:"http_error"};let b=await y.blob(),w=b.type||y.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await jn(b),status:y.status,url:t,fromCache:!1,mime:w}:n==="text"?{ok:!0,data:await b.text(),status:y.status,url:t,fromCache:!1,mime:w}:{ok:!0,data:b,status:y.status,url:t,fromCache:!1,mime:w}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=fi(t,{as:n,timeout:o,useProxy:r,errorTTL:s}),f=ve.get(c);if(f&&f.until>Date.now())return{...f.result,fromCache:!0};f&&ve.delete(c);let l=Qe.get(c);if(l)return l;let d=ci(t,r)?li(t,r):t,u=e.credentials;if(!u)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",b=new URL(t,y);u=typeof location<"u"&&b.origin===location.origin?"include":"omit"}catch{u="omit"}let p=new AbortController,m=setTimeout(()=>p.abort("timeout"),o),h=(async()=>{try{let y=await fetch(d,{signal:p.signal,credentials:u,headers:i});if(!y.ok){let S={ok:!1,data:null,status:y.status,url:d,fromCache:!1,reason:"http_error"};if(s>0&&ve.set(c,{until:Date.now()+s,result:S}),!a){let g=`${y.status} ${y.statusText||""}`.trim();Vn.warnOnce(`http:${y.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${g} while fetching ${n} ${t}`)}return e.onError&&e.onError(S),S}if(n==="text")return{ok:!0,data:await y.text(),status:y.status,url:d,fromCache:!1};let b=await y.blob(),w=b.type||y.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await jn(b),status:y.status,url:d,fromCache:!1,mime:w}:{ok:!0,data:b,status:y.status,url:d,fromCache:!1,mime:w}}catch(y){let b=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",w={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:b};if(!/^blob:/i.test(t)&&s>0&&ve.set(c,{until:Date.now()+s,result:w}),!a){let S=`${b}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,g=b==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:b==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Vn.errorOnce(S,g)}return e.onError&&e.onError(w),w}finally{clearTimeout(m),Qe.delete(c)}})();return Qe.set(c,h),h}var Vn,Qe,ve,At=ot(()=>{"use strict";Zt();Vn=ii("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Qe=new Map,ve=new Map});async function Pt(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=Qt(t,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??Et(t);if(!o)return t;let r=Ke(o),s=Ct(r),i=(e.useProxy||"")+"|"+s;if(C.background.has(i)){let a=C.background.get(i);return a?`url("${a}")`:"none"}try{let a=await X(s,{as:"dataURL",useProxy:e.useProxy});return a.ok?(C.background.set(i,a.data),`url("${a.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var qn=ot(()=>{"use strict";nt();Zt();At()});function Ze(){for(let t of ui){let e=String(t).toLowerCase();Ce.has(e)||Ae.has(e)||ke(e)}}function ke(t){if(t=String(t).toLowerCase(),Ae.has(t)){let s={};return C.defaultStyle.set(t,s),s}if(C.defaultStyle.has(t))return C.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),r={};for(let s of o){if(Jt(s))continue;let i=o.getPropertyValue(s);r[s]=i}return e.removeChild(n),C.defaultStyle.set(t,r),r}function Jt(t){let e=Xn.get(t);if(e===void 0){let n=String(t).toLowerCase();e=hi.has(n)||pi.test(n)||di.test(n),Xn.set(t,e)}return e}function Me(t,e){return!gi.has(t)&&(e==="inline"||mi.has(t)||Gn.has(t))}function Je(t,e,n){let o=(e.display||"").toLowerCase();if(o==="inline"||Gn.has(t))return!1;if(n)return!0;if((e.float||"none").toLowerCase()!=="none")return!1;let s=(e.position||"static").toLowerCase();return s==="absolute"||s==="fixed"?!1:!xi.has(o)}function Ot(t,e,n=!0,o=!1){if(e=String(e||"").toLowerCase(),Ae.has(e))return"";let r=[],s=ke(e),i=(t.display||"").toLowerCase(),a=i==="inline",c=Me(e,i),f=t["text-wrap-mode"]||t["white-space"]||"",l=f==="nowrap"||f==="pre",u=c&&n&&!(c&&n&&!a&&l),p=!1;for(let m in t){if(Jt(m))continue;let h=t[m];if(u){if(yi.has(m))continue;if(bi.has(m)){h&&h!==s[m]&&(r.push(`${m}:${h}`),h!=="auto"&&(p=!0));continue}}if(h&&h!==s[m]){if(!l&&(m==="width"||m==="inline-size")&&h.endsWith("px")&&h.includes(".")){let y=parseFloat(h);if(Number.isFinite(y)){r.push(`${m}:${(y+wi).toFixed(3)}px`);continue}}r.push(`${m}:${h}`)}}if(u&&!a&&!o&&!p){let m=t.width;m&&m!=="auto"&&m!==s.width&&r.push(`min-width:${m}`)}return r.sort(),r.join(";")}function tn(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 en(t){let e=new Map;for(let o of t){let r=ke(o);if(!r)continue;let s=Object.entries(r).map(([i,a])=>`${i}:${a};`).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} } +`;return n}function nn(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 Si(t){try{let e=t?.ownerDocument;if(!e)return typeof window<"u"?window:null;let n=e.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let o=0;o{let s={length:0,getPropertyValue:()=>"",item:()=>""};return s[Symbol.iterator]=function*(){},s};if(t?.nodeType!==1){let s=typeof window<"u"?window:null;if(s&&typeof s.getComputedStyle=="function")try{return s.getComputedStyle(t,e)||n()}catch{return n()}return n()}let o=C.computedStyle.get(t);o||(o=new Map,C.computedStyle.set(t,o));let r=o.get(e);if(!r){let s=Si(t),i=null;try{i=s&&typeof s.getComputedStyle=="function"?s.getComputedStyle(t,e):null}catch{}if(!i&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(i=window.getComputedStyle(t,e))}catch{}r=i||n(),o.set(e,r)}return r}function Fe(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);for(let n of vi){let o=e[`border-${n}-style`],r=e[`border-${n}-width`];(o==="none"||o==="hidden"||r==="0px")&&(delete e[`border-${n}-style`],delete e[`border-${n}-width`],delete e[`border-${n}-color`])}return e}function Bt(t){let e=[],n=0,o=0;for(let r=0;r{"use strict";nt();Ce=new Set(["meta","script","noscript","title","link","template"]),Ae=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","symbol","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),ui=["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"];di=/(?:^|-)(animation|transition)(?:-|$)/i,pi=/^(--.+|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,hi=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom","stroke-color"]),Xn=new Map;mi=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),Gn=new Set(["table","thead","tbody","tfoot","tr","td","th"]),gi=new Set(["img","video","canvas","svg","iframe","embed","object","input","textarea","select"]),yi=new Set(["width","max-width","inline-size","max-inline-size"]),bi=new Set(["min-width","min-inline-size"]),wi=.001;xi=new Set(["inline-block","inline-flex","inline-grid","inline-table","inline-flow-root","table"]);vi=["top","right","bottom","left"]});function Nt(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function mt(t=1e3){return typeof requestAnimationFrame!="function"||typeof document<"u"&&document.visibilityState==="hidden"?Promise.resolve():new Promise(e=>{let n=!1,o=()=>{n||(n=!0,e())};try{requestAnimationFrame(o)}catch{o();return}setTimeout(o,t)})}function on(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let t=navigator.userAgent||"",e=/iPhone|iPad|iPod/.test(t),n=navigator.maxTouchPoints>2&&/Macintosh/.test(t);return e||n}function K(){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),i=o&&r&&s,a=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),f=/ipad|iphone|ipod/.test(e)&&o;return n||i||a||c||f}function Yn(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var kt=ot(()=>{"use strict"});function W(t,e,n){let o=t&&typeof t=="object"&&(t.options||t);o&&o.debug&&(n!==void 0?console.warn("[snapdom]",e,n):console.warn("[snapdom]",e))}var rn=ot(()=>{"use strict"});var ct=ot(()=>{"use strict";qn();te();kt();Zt();rn()});var zr={};Kt(zr,{decodeSvgFromDataURL:()=>je,encodeSvgToDataURL:()=>qe,fixSafariShadows:()=>Xe,toCanvas:()=>Lt});function Ta(t){try{let e=t.match(/]*>/i);if(!e)return t;let n=e[0],o=parseFloat((n.match(/\bwidth="([\d.]+)/i)||[])[1]),r=parseFloat((n.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(o)||!Number.isFinite(r)||o<=0||r<=0)return t;let s=Math.min(1,Mt/o,Mt/r,Math.sqrt($n/(o*r)));if(s>=1)return t;let i=Math.max(1,Math.floor(o*s)),a=Math.max(1,Math.floor(r*s));return console.warn(`[snapDOM] Capture ${Math.round(o)}\xD7${Math.round(r)}px exceeds the browser image-decode limit (${Mt}px/side); downscaling to ${i}\xD7${a}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`),t.replace(n,n.replace(/(\bwidth=")[\d.]+/i,`$1${i}`).replace(/(\bheight=")[\d.]+/i,`$1${a}`))}catch{return t}}function La(t,e){let n=["x","y","width","height"].map(v=>Number(e?.[v]));if(!n.every(Number.isFinite)||n[2]<=0||n[3]<=0)throw new RangeError("[snapdom] canvas crop requires finite x/y and positive width/height");let o=t.match(/]*>/i);if(!o)throw new Error("[snapdom] cannot crop a non-SVG capture");let r=o[0],s=(r.match(/\bviewBox="([^"]+)"/i)||[])[1],i=String(s||"").trim().split(/[\s,]+/).map(Number);if(i.length!==4||!i.every(Number.isFinite)||i[2]<=0||i[3]<=0)throw new Error("[snapdom] cannot crop an SVG without a finite viewBox");let[a,c,f,l]=i,d=Math.max(a,n[0]),u=Math.max(c,n[1]),p=Math.min(a+f,n[0]+n[2]),m=Math.min(c+l,n[1]+n[3]);if(!(p>d)||!(m>u))throw new RangeError("[snapdom] canvas crop does not intersect the SVG viewBox");let h=parseFloat((r.match(/\bwidth="([\d.]+)/i)||[])[1]),y=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]),b=Number.isFinite(h)&&h>0?h/f:1,w=Number.isFinite(y)&&y>0?y/l:1,S=Math.max(1,(p-d)*b),g=Math.max(1,(m-u)*w),x=r.replace(/(\bwidth=")[^"]*/i,`$1${S}`).replace(/(\bheight=")[^"]*/i,`$1${g}`).replace(/(\bviewBox=")[^"]*/i,`$1${d} ${u} ${p-d} ${m-u}`);return t.replace(r,x)}function Ur(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function je(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Ia(t){let e=t.indexOf(",");if(e<0)return"";let n=t.slice(e+1,e+1201).replace(/%[0-9A-Fa-f]?$/,"");try{return decodeURIComponent(n)}catch{return""}}function qe(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Dr(t){let e=[],n="",o=0;for(let r=0;rr.trim()).filter(Boolean)}function _a(t){let e=[],n="",o=0;for(let s=0;s`${a}:${c}`).join(";")}function Wa(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Hr(o)}}`)}function Oa(t){return t=t.replace(/]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Wa(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Hr(o)}${n}`),t}function Ba(){return Ve||(Ve=(async()=>{try{let t='
',e=new Image;e.decoding="sync",e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,await e.decode();let n=document.createElement("canvas");n.width=8,n.height=20;let o=n.getContext("2d",{willReadFrequently:!0});o.drawImage(e,0,0);let r=o.getImageData(2,18,1,1).data[3]>128,s=o.getImageData(2,2,1,1).data[3]>128;return{native:r||s,flippedY:s&&!r}}catch{return{native:!1,flippedY:!1}}})(),Ve)}function Ua(t){let e=[],n=0,o=0;for(let r=0;r{let s=0,i=0,a="",c=0;for(;cDr(o).map(r=>{let s=r.indexOf(":");if(s<0)return r;let i=r.slice(0,s).trim().toLowerCase();return i==="text-shadow"||e&&i==="box-shadow"?`${i}:${Ua(r.slice(s+1))}`:r}).join(";");return t=t.replace(/]*>([\s\S]*?)<\/style>/gi,(o,r)=>o.replace(r,r.replace(/([^{}]+)\{([^}]*)\}/g,(s,i,a)=>`${i}{${n(a)}}`))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(o,r,s)=>`style=${r}${n(s)}${r}`),t}async function Xe(t){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(t))return{svg:t,naturalOnly:!1};let{native:n,flippedY:o}=await Ba();try{let r=t;return n||(r=Oa(r)),o&&(r=Da(r,n)),{svg:r,naturalOnly:!0}}catch{return{svg:t,naturalOnly:!0}}}async function Ha(t,e){t.setAttribute("data-snapdom-internal",""),t.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(t);try{let n=document.createElement("canvas");n.width=16,n.height=16;let o=()=>new Promise(i=>{requestAnimationFrame(i),setTimeout(i,50)}),r=n.getContext("2d",{willReadFrequently:!0});if(!r){await o(),await o();return}let s=performance.now()+(e?600:150);for(;;){r.clearRect(0,0,16,16);try{r.drawImage(t,0,0,16,16)}catch{return}let i=r.getImageData(0,0,16,16).data,a=!1;for(let c=3;c0){a=!0;break}if(a||performance.now()>s)return;await o()}}finally{try{t.remove()}catch{}}}async function Lt(t,e){let{width:n,height:o,scale:r=1,dpr:s=1,meta:i={},backgroundColor:a,crop:c=null}=e,f=t,l=!1,d=!1;if(c&&!Ur(t))throw new RangeError("[snapdom] canvas crop requires an SVG capture payload");if(Ur(t)){let F=(Ia(t).match(/]*>/i)||[])[0]||"",R=parseFloat((F.match(/\bwidth="([\d.]+)/i)||[])[1]),E=parseFloat((F.match(/\bheight="([\d.]+)/i)||[])[1]),O=Number.isFinite(R)&&Number.isFinite(E)&&R>0&&E>0&&Math.min(1,Mt/R,Mt/E,Math.sqrt($n/(R*E)))<1;if(c||O||K())try{let P=je(t);if(c&&(P=La(P,c)),K()){let L=await Xe(P);P=L.svg,l=L.naturalOnly,d=/@font-face|data:image\//i.test(P)}(O||c)&&(P=Ta(P)),f=qe(P)}catch(P){if(c)throw P;f=t}}let u=new Image;u.loading="eager",u.decoding="sync",u.crossOrigin="anonymous",u.src=f,await u.decode(),K()&&await Ha(u,d);let p=u.naturalWidth,m=u.naturalHeight,h=c?p:Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:p,y=c?m:Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:m,b,w,S=Number.isFinite(n),g=Number.isFinite(o);if(S&&g)b=Math.max(1,n),w=Math.max(1,o);else if(S){let F=n/Math.max(1,h);b=n,w=y*F}else if(g){let F=o/Math.max(1,y);w=o,b=h*F}else b=p,w=m;b=b*r,w=w*r;let x=b*s,v=w*s,k=Math.max(x/Mt,v/Mt,Math.sqrt(x*v/$n));k>1&&(console.warn(`[snapDOM] Output ${Math.round(x)}\xD7${Math.round(v)}px exceeds the browser canvas limit (${Mt}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),b/=k,w/=k);let A=document.createElement("canvas");A.width=b*s,A.height=w*s,A.style.width=`${b}px`,A.style.height=`${w}px`;let M=A.getContext("2d");if(s!==1&&M.scale(s,s),a&&(M.save(),M.fillStyle=a,M.fillRect(0,0,b,w),M.restore()),l&&(Math.round(b*s)!==p||Math.round(w*s)!==m)){let F=document.createElement("canvas");F.width=p,F.height=m,F.getContext("2d").drawImage(u,0,0),M.drawImage(F,0,0,b,w)}else M.drawImage(u,0,0,b,w);return A}var Mt,$n,Ve,Gt=ot(()=>{"use strict";kt();Mt=16384,$n=16384*16384;Ve=null});var Ge={};Kt(Ge,{rasterize:()=>En});async function En(t,e){let n=await Lt(t,e),o=await new Promise(s=>{let i=()=>s(n.toDataURL(`image/${e.format}`,e.quality));try{n.toBlob(a=>{if(!a)return i();let c=new FileReader;c.onload=()=>s(String(c.result||"")),c.onerror=i,c.readAsDataURL(a)},`image/${e.format}`,e.quality)}catch{i()}}),r=new Image;return r.src=o,await r.decode(),r.style.width=`${n.width/e.dpr}px`,r.style.height=`${n.height/e.dpr}px`,r}var de=ot(()=>{"use strict";Gt()});var Pn={};Kt(Pn,{toImg:()=>za,toSvg:()=>za});async function za(t,e){let{scale:n=1,width:o,height:r,meta:s={}}=e,i=Number.isFinite(o),a=Number.isFinite(r),c=Number.isFinite(n)&&n!==1||i||a;if(K()&&c)try{let{svg:l}=await Xe(je(t)),d=(l.match(/]*>/i)||[])[0]||"",u=parseFloat((d.match(/\bwidth="([\d.]+)/i)||[])[1]),p=parseFloat((d.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(u)||!Number.isFinite(p))throw new Error("svg without dimensions");let m=Number.isFinite(s.vbW)?s.vbW:Number.isFinite(s.w0)?s.w0:u,h=Number.isFinite(s.vbH)?s.vbH:Number.isFinite(s.h0)?s.h0:p,y,b;i&&a?(y=o,b=r):i?(y=o,b=Math.round(h*(o/Math.max(1,m)))):a?(b=r,y=Math.round(m*(r/Math.max(1,h)))):(y=Math.round(u*n),b=Math.round(p*n));let w=l.replace(/width="[^"]*"/,`width="${y}"`).replace(/height="[^"]*"/,`height="${b}"`),S=new Image;return S.decoding="sync",S.loading="eager",S.src=qe(w),await S.decode(),S.style.width=`${y}px`,S.style.height=`${b}px`,S}catch(l){return W(e,"safari vector toImg failed, falling back to PNG",l),En(t,{...e,format:"png",quality:1,meta:s})}let f=new Image;if(f.decoding="sync",f.loading="eager",f.src=t,await f.decode(),i&&a)f.style.width=`${o}px`,f.style.height=`${r}px`;else if(i){let l=Number.isFinite(s.vbW)?s.vbW:Number.isFinite(s.w0)?s.w0:f.naturalWidth,d=Number.isFinite(s.vbH)?s.vbH:Number.isFinite(s.h0)?s.h0:f.naturalHeight,u=o/Math.max(1,l);f.style.width=`${o}px`,f.style.height=`${Math.round(d*u)}px`}else if(a){let l=Number.isFinite(s.vbW)?s.vbW:Number.isFinite(s.w0)?s.w0:f.naturalWidth,d=Number.isFinite(s.vbH)?s.vbH:Number.isFinite(s.h0)?s.h0:f.naturalHeight,u=r/Math.max(1,d);f.style.height=`${r}px`,f.style.width=`${Math.round(l*u)}px`}else{let l=Math.round(f.naturalWidth*n),d=Math.round(f.naturalHeight*n);if(f.style.width=`${l}px`,f.style.height=`${d}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let p=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${l}"`).replace(/height="[^"]*"/,`height="${d}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,f.src=t}catch(u){W(e,"SVG width/height patch in toImg failed",u)}}return f}var Nn=ot(()=>{"use strict";ct();de();Gt()});var Vr={};Kt(Vr,{toBlob:()=>Tn});async function Tn(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 Lt(t,e);return new Promise(r=>o.toBlob(s=>r(s),`image/${n}`,e.quality))}var Ln=ot(()=>{"use strict";Gt()});var qr={};Kt(qr,{download:()=>Va});async function jr(t,e){let n=new File([t],e,{type:t.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:e})}catch(o){if(o.name!=="AbortError")return!1}return!0}async function Va(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),o=(e?.type||"").toLowerCase(),r=n.has(o)?o:"",s=(e?.format||r||"").toLowerCase(),i=s==="jpg"?"jpeg":s||"png",a=e?.filename||`snapdom.${i}`,c={...e||{},format:i,type:i};c.dpr=1;let f=on();if(i==="svg"){let u=await Tn(t,{...c,type:"svg"});if(f&&await jr(u,a))return;let p=URL.createObjectURL(u),m=document.createElement("a");m.href=p,m.download=a,document.body.appendChild(m),m.click(),URL.revokeObjectURL(p),m.remove();return}let l=await Lt(t,c);if(f){let u=`image/${i}`,p=await new Promise(m=>l.toBlob(m,u,e?.quality));if(p&&await jr(p,a))return}let d=document.createElement("a");d.href=l.toDataURL(`image/${i}`,e?.quality),d.download=a,document.body.appendChild(d),d.click(),d.remove()}var Xr=ot(()=>{"use strict";Ln();Gt();kt()});ct();ct();nt();var ee="http://www.w3.org/1999/xhtml",Ci="http://www.w3.org/2000/svg";function Ut(t){return!!t&&t.nodeType===1&&t.namespaceURI===ee}function rt(t,...e){return Ut(t)&&e.includes(t.localName)}function ne(t){return!!t&&t.nodeType===1&&t.namespaceURI===Ci}function Kn(t){return ne(t)&&t.localName==="svg"}function oe(t){return!!t&&t.nodeType===11&&!!t.host}function Qn(t){return!!t&&t.nodeType===9}function Zn(t){return!!t&&typeof t.nodeType=="number"&&typeof t.nodeName=="string"}var an=new WeakMap,re=new Map,Ai=2e3,$e=0;function Re(){$e++,re.size>Ai&&re.clear()}var ki="[data-snapdom-sandbox],[data-snapdom-internal],[data-snapdom]";function sn(t){let e=t&&(t.nodeType===1?t:t.parentElement);return!!(e&&e.closest&&e.closest(ki))}function cn(t){for(let e of t)if(!sn(e.target)){if(e.type==="childList"){let n=!0;for(let o of e.addedNodes)if(!sn(o)){n=!1;break}if(n){for(let o of e.removedNodes)if(!sn(o)){n=!1;break}}if(n)continue}return!0}return!1}var Jn=!1;function Mi(t=document.documentElement){if(Jn)return;Jn=!0;let e=n=>{cn(n)&&Re()};try{new MutationObserver(e).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(e).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let n=document.fonts;n&&(n.addEventListener?.("loadingdone",Re),n.ready?.then(()=>Re()).catch(()=>{}))}catch{}}var Fi=["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"];function ln(t){let e=an.get(t);if(e&&e.epoch===$e){let n=e.snapshot&&e.snapshot.__needsBgInline;if(n!==void 0)return n}return!0}function Ri(t,e={}){let n={},o=e.excludeStyleProps;for(let d=0;d0))return!1;let o=1/0,r=-1/0,s=null;for(let i=t.firstChild;i;i=i.nextSibling){let a;if(i.nodeType===3){if(!/\S/.test(i.nodeValue||"")||(s=s||document.createRange(),s.selectNode(i),a=s.getBoundingClientRect(),!a.width&&!a.height))continue}else if(i.nodeType===1){let c=T(i);if(c.display==="none"||c.position==="absolute"||c.position==="fixed")continue;a=i.getBoundingClientRect()}else continue;a.leftr&&(r=a.right)}return r===-1/0?!1:r-o0?Math.abs(t.getBoundingClientRect().width-r)>.5:!1}var eo=new WeakMap;function Li(t){let e=eo.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),eo.set(t,e),e)}function Ii(t,e=null,n={}){let o=an.get(t),r=!!(n&&n.embedFonts),s=n&&n.excludeStyleProps||null;if(o&&o.epoch===$e&&o.embedFonts===r&&o.excludeStyleProps===s)return o.snapshot;let i=e||getComputedStyle(t),a=Ri(i,n);return Hi(t,i,a),an.set(t,{epoch:$e,snapshot:a,embedFonts:r,excludeStyleProps:s}),a}function _i(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:re,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||{}}:{session:C.session,persist:{snapshotKeyCache:re,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||e||{}}}function Wi(t,e,n){if(!(!t.style||t.style.length===0))for(let o=0;oparseFloat(f)||0,i=t.offsetWidth-t.clientWidth-s(e.getPropertyValue("border-left-width"))-s(e.getPropertyValue("border-right-width")),a=t.offsetHeight-t.clientHeight-s(e.getPropertyValue("border-top-width"))-s(e.getPropertyValue("border-bottom-width")),c=(f,l)=>{let d=n[f];if(!d||!d.endsWith("px"))return;let u=parseFloat(d);Number.isFinite(u)&&(n[f]=`${Math.round((u+l)*1e3)/1e3}px`)};i>.5&&(c("width",i),c("inline-size",i)),a>.5&&(c("height",a),c("block-size",a))}function Bi(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 no(t){let e=t.parentElement;if(!e)return!1;let n=T(e).display||"";return n.includes("flex")||n.includes("grid")}function Ui(t){for(let o=t.firstChild;o;o=o.nextSibling)if(o.nodeType===3&&/\S/.test(o.nodeValue))return!0;let e=t.firstElementChild,n=t.lastElementChild;if(e&&e.tagName==="BR"||n&&n.tagName==="BR")return!0;for(let o=t.firstElementChild;o;o=o.nextElementSibling){let r=T(o);if(r.display==="none")continue;let s=r.position;if(s!=="absolute"&&s!=="fixed")return!0}return!1}function Di(t){let e=t.getBoundingClientRect().top,n=-1/0,o=null;for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===3){if(!/\S/.test(r.nodeValue||""))continue;o=o||document.createRange(),o.selectNode(r);let a=o.getBoundingClientRect();(a.width||a.height)&&(n=Math.max(n,a.bottom));continue}if(r.nodeType!==1)continue;let s=T(r);if(s.display==="none")continue;let i=s.position;i==="absolute"||i==="fixed"||s.float&&s.float!=="none"||(n=Math.max(n,r.getBoundingClientRect().bottom))}return n===-1/0?NaN:n-e}function Hi(t,e,n){if(Ut(t)&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||!["div","section","article","main","aside","header","footer","nav"].includes(o)||e.aspectRatio&&e.aspectRatio!=="none"&&e.aspectRatio!=="auto")return;let s=e.display||"";if(s.includes("flex")||s.includes("grid"))return;let i=e.position;if(i==="absolute"||i==="fixed"||i==="sticky"||e.transform!=="none"||Bi(e)||no(t))return;let a=e.overflowX||e.overflow||"visible",c=e.overflowY||e.overflow||"visible";if(a!=="visible"||c!=="visible")return;let f=e.clip;if(f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||!Ui(t))return;let l=parseFloat(e.height),d=Di(t);Number.isFinite(l)&&Number.isFinite(d)&&Math.abs(l-d)>2||(delete n.height,delete n["block-size"])}te();var ro=["fill","stroke","color","background-color","stop-color"],zi=new Set(["symbol","defs","pattern","marker","linearGradient","radialGradient","filter"]);function Ee(t){let e=t;for(;e&&e.nodeType===1;){if(e.namespaceURI==="http://www.w3.org/2000/svg"){if(e.localName==="mask"||e.localName==="clipPath")return!1;if(zi.has(e.localName))return!0}e=e.parentNode}return!1}var oo=new Map;function Vi(t,e){let n=e+"::"+t.toLowerCase(),o=oo.get(n);if(o)return o;let r=document,s=e==="http://www.w3.org/2000/svg"?r.createElementNS(e,t):r.createElement(t),i=r.createElement("div");i.setAttribute("data-snapdom-internal",""),i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(s),r.documentElement.appendChild(i);let a=getComputedStyle(s),c={};for(let f of ro)c[f]=a.getPropertyValue(f)||"";return i.remove(),oo.set(n,c),c}function io(t,e){if(t?.nodeType!==1||e?.nodeType!==1||Ee(t))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let s=t.attributes;for(let i=0;is.d-i.d);let r=window.devicePixelRatio||1;return(o.find(s=>s.d>=r)||o[o.length-1]).url}function fn(t,e){let n=t.currentSrc||"";if(n&&!Tt(n))return n;let o=e.querySelectorAll("source[srcset]"),r=null;for(let s of o){let i=s.getAttribute("srcset");if(!i||Tt(i))continue;let a=s.getAttribute("type");if(a&&!qi.test(a.trim()))continue;let c=s.getAttribute("media");if(c)try{if(window.matchMedia(c).matches)return Dt(i,t)}catch{}r||(r=Dt(i,t))}return r}function Xi(t){let e=[t.getAttribute("data-src"),t.getAttribute("data-lazy-src"),t.getAttribute("data-original"),t.getAttribute("data-hi-res-src")];for(let o of e)if(o&&!Tt(o))return o;let n=t.getAttribute("data-srcset")||t.getAttribute("data-lazy-srcset");if(n){let o=n.split(",")[0].trim().split(/\s+/)[0];if(o&&!Tt(o))return o}return null}function Gi(t={}){let e=t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{};return{timeout:e.timeout??5e3,concurrency:e.concurrency??4,resolveLazySrc:e.resolveLazySrc!==!1,silent:e.silent??!1,useProxy:typeof t.useProxy=="string"?t.useProxy:""}}async function ao(t,e={}){if(!t||t?.nodeType!==1||e.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:o,resolveLazySrc:r,silent:s,useProxy:i}=Gi(e);if(!ji(t,r))return null;let a=[],c=[];async function f(u){let p=await X(u,{as:"dataURL",timeout:n,useProxy:i,silent:!0});return p.ok?p.data:null}async function l(u){for(let p=0;ph()))}}let d=Array.from(t.querySelectorAll("picture"));t.matches?.("picture")&&d.unshift(t);for(let u of d){let p=u.querySelector("img");if(!p)continue;let m=p.getAttribute("src")||"";if(!Tt(m))continue;let h=fn(p,u);h&&c.push(async()=>{let y=await f(h);if(!y){s||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${h.slice(0,60)}`);return}let b=p.getAttribute("src"),w=p.getAttribute("srcset"),S=p.getAttribute("sizes"),g=[];p.src=y,p.setAttribute("src",y),p.removeAttribute("srcset"),p.removeAttribute("sizes");let x=u.querySelectorAll("source");for(let v of x)g.push({el:v,parent:v.parentElement,next:v.nextSibling}),v.remove();a.push(()=>{b!==null?p.setAttribute("src",b):p.removeAttribute("src"),w!==null&&p.setAttribute("srcset",w),S!==null&&p.setAttribute("sizes",S);for(let{el:v,parent:k,next:A}of g)k&&k.insertBefore(v,A)})})}if(r){let u=Array.from(t.querySelectorAll("img"));t.localName==="img"&&u.unshift(t);for(let p of u){if(p.closest("picture")&&Tt(p.getAttribute("src")||""))continue;let m=p.getAttribute("src")||"",h=Xi(p);h&&Tt(m)&&c.push(async()=>{let y=await f(h);if(!y)return;let b=p.getAttribute("src");p.src=y,p.setAttribute("src",y),p.removeAttribute("srcset"),p.removeAttribute("sizes"),a.push(()=>{b!==null?p.setAttribute("src",b):p.removeAttribute("src")})})}}return c.length===0?null:(await l(c),async function(){for(let p of a)try{p()}catch{}})}function Te(t,e,n){return n?Promise.all(t.map(o=>new Promise(r=>e(o,r)))):Promise.all(t.map(o=>new Promise(r=>{function s(){Nt(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,r):s()},{fast:n})}s()})))}function Yi(t,e){if(t=t.trim(),!t)return t;let n=e?`[data-sd-slotted~="${e}"]`:"[data-sd-slotted]";return t.endsWith(":not([data-sd-slotted])")||t.endsWith(`:not(${n})`)?t:`${t}:not(${n})`}function Ki(t,e,n=!0,o){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let s=n?Yi(r,o):r;return`:where(${e} ${s})`}).join(", ")}function lo(t,e,n){return t?(t=t.replace(/:host\(([^)]+)\)/g,(o,r)=>`:where(${e}:is(${r.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(o,r)=>`:where(:where(${r.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(o,r)=>`:where(${e} ${r.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(o,r,s,i)=>{let a=Ki(i,e,!0,n);return`${r}${s}${a}{`}),t):""}function fo(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function uo(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+` `});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let r of o.cssRules)e+=r.cssText+` -`}catch{}}catch{}return e}function no(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 oo(t,e){try{let n=null,o=N(t).content;if(o&&o.includes("url(")){let i=o.match(/url\(["']?([^"')]+)["']?\)/);i&&(n=i[1])}let r=t.closest?.("picture"),s=n||(r?en(t,r):t.currentSrc)||t.src||Bt(t.getAttribute("srcset"),t)||"";if(!s)return;e.setAttribute("src",s),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function ro(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 Ui(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 io(t,e,n){let o=[];for(let r of e){let s=Ui(t,r);s&&o.push(`${r}: ${s};`)}return o.length?`${n}{${o.join("")}} -`:""}function so(t,e){if(!t)return;let n=o=>{let r=o.getAttribute("data-sd-slotted")||"";e?` ${r} `.includes(` ${e} `)||o.setAttribute("data-sd-slotted",r?`${r} ${e}`:e):o.setAttribute("data-sd-slotted",r)};t.nodeType===Node.ELEMENT_NODE&&n(t),t.querySelectorAll?.("*").forEach(n)}async function Di(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),r=0;for(;rsetTimeout(s,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}function Hi(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 i=Math.max(0,Math.round(e.width-(n+o))),a=Math.max(0,Math.round(e.height-(r+s)));return{contentWidth:i,contentHeight:a,rect:e}}function ut(t){let e=0,n=0;if(t.offsetWidth>0&&(e=t.offsetWidth),t.offsetHeight>0&&(n=t.offsetHeight),e===0||n===0)try{let o=getComputedStyle(t);if(e===0){let r=parseFloat(o.width);!isNaN(r)&&r>0&&(e=r)}if(n===0){let r=parseFloat(o.height);!isNaN(r)&&r>0&&(n=r)}}catch{}if(e===0||n===0)try{if(e===0){let o=parseFloat(t.getAttribute("width"));!isNaN(o)&&o>0&&(e=o)}if(n===0){let o=parseFloat(t.getAttribute("height"));!isNaN(o)&&o>0&&(n=o)}}catch{}if((e===0||n===0)&&(t.naturalWidth||t.naturalHeight))try{e===0&&t.naturalWidth>0&&(e=t.naturalWidth),n===0&&t.naturalHeight>0&&(n=t.naturalHeight)}catch{}return{width:e,height:n}}function zi(t,e,n){let o=t.defaultView,r=o?o.scrollX:0,s=o?o.scrollY:0,i=t.body?t.body.scrollLeft:0,a=t.body?t.body.scrollTop:0,c=t.documentElement?t.documentElement.scrollLeft:0,u=t.documentElement?t.documentElement.scrollTop:0,l=0,d=0,f=0,h=0;try{let p=o&&t.body?o.getComputedStyle(t.body):null;p&&(l=(parseFloat(p.marginTop)||0)+(parseFloat(p.paddingTop)||0),d=(parseFloat(p.marginRight)||0)+(parseFloat(p.paddingRight)||0),f=(parseFloat(p.marginBottom)||0)+(parseFloat(p.paddingBottom)||0),h=(parseFloat(p.marginLeft)||0)+(parseFloat(p.paddingLeft)||0))}catch{}try{t.documentElement.setAttribute("data-sd-pinned","")}catch{}let m=t.createElement("style");return m.setAttribute("data-sd-iframe-pin",""),m.textContent=`html {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;}body {margin: 0 !important;padding: ${l}px ${d}px ${f}px ${h}px !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(m),()=>{try{m.remove()}catch{}try{t.documentElement.removeAttribute("data-sd-pinned")}catch{}try{o&&typeof o.scrollTo=="function"&&o.scrollTo(r,s),t.body&&(t.body.scrollLeft=i,t.body.scrollTop=a),t.documentElement&&(t.documentElement.scrollLeft=c,t.documentElement.scrollTop=u)}catch{}}}async function ao(t,e,n){let o=await Di(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:s,rect:i}=Hi(t),a=n?.snap;if(!a&&typeof window<"u"&&window.snapdom&&(a=window.snapdom),!a||typeof a.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={...n,scale:1,clip:null},u=zi(o,r,s),l=C.session.nodeMap,d=C.session.styleMap,f=C.session.styleCache,h;try{h=await a.toPng(o.documentElement,c)}finally{u(),C.session.nodeMap=l,C.session.styleMap=d,C.session.styleCache=f}h.style.display="block",h.style.width=`${r}px`,h.style.height=`${s}px`;let m=document.createElement("div");return e.nodeMap.set(m,t),ct(t,m,e,n),m.style.overflow="hidden",m.style.display="block",m.style.width||(m.style.width=`${Math.round(i.width)}px`),m.style.height||(m.style.height=`${Math.round(i.height)}px`),m.appendChild(h),m}function co(t){let{width:e,height:n}=ut(t),o=t.getBoundingClientRect(),r;try{r=window.getComputedStyle(t)}catch{}let s=r?parseFloat(r.width):NaN,i=r?parseFloat(r.height):NaN,a=Math.round(e||o.width||0),c=Math.round(n||o.height||0),u=Number.isFinite(s)&&s>0?Math.round(s):Math.max(12,a||16),l=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,c||16),d=(t.type||"text").toLowerCase()==="checkbox",f=!!t.checked,h=!!t.indeterminate,p=Math.max(Math.min(u,l),12),b="middle";try{r&&r.verticalAlign&&(b=r.verticalAlign)}catch{}let y=document.createElement("div");y.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),y.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:${b};flex-shrink:0;line-height:0;`;let w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",String(p)),w.setAttribute("height",String(p)),w.setAttribute("viewBox",`0 0 ${p} ${p}`),y.appendChild(w);function S(){let g="#0a6ed1";try{r&&(g=r.accentColor||r.color||g)}catch{}let x=2,v=x/2,k=p-x;if(w.innerHTML="",d){let A=document.createElementNS("http://www.w3.org/2000/svg","rect");if(A.setAttribute("x",String(v)),A.setAttribute("y",String(v)),A.setAttribute("width",String(k)),A.setAttribute("height",String(k)),A.setAttribute("rx","2"),A.setAttribute("ry","2"),A.setAttribute("fill",f?g:"none"),A.setAttribute("stroke",g),A.setAttribute("stroke-width",String(x)),w.appendChild(A),f){let M=document.createElementNS("http://www.w3.org/2000/svg","path");M.setAttribute("d",`M ${v+2} ${p/2} L ${p/2-1} ${p-v-2} L ${p-v-2} ${v+2}`),M.setAttribute("stroke","white"),M.setAttribute("stroke-width",String(Math.max(1.5,x))),M.setAttribute("fill","none"),M.setAttribute("stroke-linecap","round"),M.setAttribute("stroke-linejoin","round"),w.appendChild(M)}else if(h){let M=document.createElementNS("http://www.w3.org/2000/svg","rect"),F=Math.max(6,k-4);M.setAttribute("x",String((p-F)/2)),M.setAttribute("y",String((p-x)/2)),M.setAttribute("width",String(F)),M.setAttribute("height",String(x)),M.setAttribute("fill",g),M.setAttribute("rx","1"),w.appendChild(M)}}else{let A=document.createElementNS("http://www.w3.org/2000/svg","circle");if(A.setAttribute("cx",String(p/2)),A.setAttribute("cy",String(p/2)),A.setAttribute("r",String((p-x)/2)),A.setAttribute("fill",f?g:"none"),A.setAttribute("stroke",g),A.setAttribute("stroke-width",String(x)),w.appendChild(A),f){let M=document.createElementNS("http://www.w3.org/2000/svg","circle"),F=Math.max(2,(p-x*2)*.35);M.setAttribute("cx",String(p/2)),M.setAttribute("cy",String(p/2)),M.setAttribute("r",String(F)),M.setAttribute("fill","white"),w.appendChild(M)}}y.style.setProperty("width",`${p}px`,"important"),y.style.setProperty("height",`${p}px`,"important"),y.style.setProperty("min-width",`${p}px`,"important"),y.style.setProperty("min-height",`${p}px`,"important")}return S(),{el:y,applyVisual:S}}var te=new Y(80);async function ee(t){if(C.resource?.has(t))return C.resource.get(t);if(te.has(t))return te.get(t);let e=(async()=>{let n=await G(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return C.resource?.set(t,n.data),n.data})();te.set(t,e);try{let n=await e;return te.set(t,n),n}catch(n){throw te.delete(t),n}}var Vi=/\bblob:[^)"'\s]+/g;async function Zn(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Vi)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=await ee(o);n=n.split(o).join(r)}catch{}return n}function Ce(t){return typeof t=="string"&&t.startsWith("blob:")}function ji(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 qi(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}function Ae(t,e){let n=t.querySelectorAll?Array.from(t.querySelectorAll(e)):[];return t.matches?.(e)&&n.unshift(t),n}async function lo(t,e=null){if(!t)return;let n=e,o=Ae(t,"img");for(let c of o)try{let l=c.getAttribute("src")||c.currentSrc||"";if(Ce(l)){let f=await ee(l);c.setAttribute("src",f)}let d=c.getAttribute("srcset");if(d&&d.includes("blob:")){let f=ji(d),h=!1;for(let m of f)if(Ce(m.url))try{m.url=await ee(m.url),h=!0}catch(p){_(n,"blobUrlToDataUrl for srcset item failed",p)}h&&c.setAttribute("srcset",qi(f))}}catch(u){_(n,"resolveBlobUrls for img failed",u)}let r=Ae(t,"image");for(let c of r)try{let u="http://www.w3.org/1999/xlink",l=c.getAttribute("href")||c.getAttributeNS?.(u,"href");if(Ce(l)){let d=await ee(l);c.setAttribute("href",d),c.removeAttributeNS?.(u,"href")}}catch(u){_(n,"resolveBlobUrls for SVG image href failed",u)}let s=Ae(t,"[style*='blob:']");for(let c of s)try{let u=c.getAttribute("style");if(u&&u.includes("blob:")){let l=await Zn(u);c.setAttribute("style",l)}}catch(u){_(n,"replaceBlobUrls in inline style failed",u)}let i=t.querySelectorAll?t.querySelectorAll("style"):[];for(let c of i)try{let u=c.textContent||"";u.includes("blob:")&&(c.textContent=await Zn(u))}catch(u){_(n,"replaceBlobUrls in style tag failed",u)}let a=["poster"];for(let c of a){let u=Ae(t,`[${c}^='blob:']`);for(let l of u)try{let d=l.getAttribute(c);Ce(d)&&l.setAttribute(c,await ee(d))}catch(d){_(n,`resolveBlobUrls for ${c} failed`,d)}}}Ct();var on=new Map,fo=new Set(["IFRAME"]);function Fe(t,e){on.set(String(t).toUpperCase(),e)}function nn(t){let{width:e,height:n}=ut(t),o=e,r=n;if(!o||!r){let i=t.getBoundingClientRect();o=o||i.width||0,r=r||i.height||0}let s=document.createElement("div");return s.style.cssText=`display:inline-block;width:${o}px;height:${r}px;visibility:hidden;`,s}var Me=200,Xi=new Set(["img","canvas","video","iframe","object","embed"]);function uo(t,e){return t.right>=e.left-Me&&t.left<=e.right+Me&&t.bottom>=e.top-Me&&t.top<=e.bottom+Me}function Gi(t,e){if(t===e.root)return!1;let n;try{n=t.getBoundingClientRect()}catch{return!1}if(n.width===0&&n.height===0)return!1;let o=N(t);if(o.display==="inline"&&!Xi.has((t.localName||"").toLowerCase()))return!1;let r=e.rect,s=t.scrollWidth||0,i=t.scrollHeight||0,a={left:o.direction==="rtl"?Math.min(n.left,n.right-s):n.left,top:n.top,right:Math.max(n.right,n.left+s),bottom:Math.max(n.bottom,n.top+i)},c=o.writingMode||"";if((c.startsWith("vertical")||c.startsWith("sideways"))&&(a.top=Math.min(n.top,n.bottom-i),a.left=Math.min(a.left,n.right-s)),uo(a,r))return!1;let u=(t.ownerDocument||document).createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;u.nextNode();){let l=u.currentNode.getBoundingClientRect();if((l.width>0||l.height>0)&&uo(l,r))return!1}return!0}function Yi(t,e,n){let o=t.cloneNode(!1);t.tagName==="IMG"&&(o.removeAttribute("src"),o.removeAttribute("srcset"),o.removeAttribute("sizes")),ct(t,o,e,n);let{width:r,height:s}=ut(t);return r>0&&(o.style.width=`${r}px`,o.style.minWidth=`${r}px`,o.style.maxWidth=`${r}px`),s>0&&(o.style.height=`${s}px`,o.style.minHeight=`${s}px`,o.style.maxHeight=`${s}px`),o.style.visibility="hidden",o.style.overflow="hidden",o.style.boxSizing="border-box",o}async function ne(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 l=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||me.has(l))return null;if(l==="foreignobject"&&t.parentElement?.closest?.("foreignObject"))return _(e,"Nested skipped (SVG spec limitation \u2014 not rendered by browsers)"),null;if(l==="source"&&t.parentElement?.localName==="picture")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")return nn(t);if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let l of n.exclude)try{if(t.matches?.(l)){if(n.excludeMode==="hide")return nn(t);if(n.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${l}`,d)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide")return nn(t);if(n.filterMode==="remove")return null}}catch(l){console.warn("Error in filter function:",l)}if(e.clip&&Gi(t,e.clip))return Yi(t,e,n);if(n.__resolveNodeHooks)for(let l of n.__resolveNodeHooks){let d;try{d=await l(t,n)}catch(f){_(e,"resolveNode plugin hook failed",f)}if(d===null)return null;if(d instanceof Node)return d.nodeType===Node.ELEMENT_NODE&&(e.nodeMap.set(d,t),ct(t,d,e,n)),d}{let l=fo.has(t.tagName)&&on.get(t.tagName);if(l){let d=await l(t,e,n);if(d!==void 0)return d}}if(t.getAttribute("data-capture")==="placeholder"){let l=t.cloneNode(!1);e.nodeMap.set(l,t),ct(t,l,e,n);let d=document.createElement("div");return d.textContent=t.getAttribute("data-placeholder-text")||"",d.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",l.appendChild(d),l}{let l=!fo.has(t.tagName)&&on.get(t.tagName);if(l){let d=await l(t,e,n);if(d!==void 0)return d}}let i;try{if(i=t.cloneNode(!1),i.attributes?.length)try{for(let l of i.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(l.value)&&i.setAttribute(l.name,l.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Yn(t,i),e.nodeMap.set(i,t),t.tagName==="IMG"){oo(t,i);try{let{width:l,height:d}=ut(t),f=Math.round(l||0),h=Math.round(d||0);f&&(i.dataset.snapdomWidth=String(f)),h&&(i.dataset.snapdomHeight=String(h))}catch(l){_(e,"getUnscaledDimensions for IMG failed",l)}try{let l=t.getAttribute("style")||"",d=window.getComputedStyle(t),f=S=>{let g=l.match(new RegExp(`${S}\\s*:\\s*([^;]+)`,"i")),x=g?g[1].trim():d.getPropertyValue(S);return/%|auto/i.test(String(x||""))},h=parseInt(i.dataset.snapdomWidth||"0",10),m=parseInt(i.dataset.snapdomHeight||"0",10),p=f("width")||!h,b=f("height")||!m;p&&h&&(i.style.width=`${h}px`),b&&m&&(i.style.height=`${m}px`);let y=d.getPropertyValue("object-fit"),w=d.getPropertyValue("object-position");y&&y!=="fill"?(i.style.objectFit=y,w&&(i.style.objectPosition=w)):(h&&(i.style.minWidth=`${h}px`),m&&(i.style.minHeight=`${m}px`))}catch(l){_(e,"IMG dimension freeze failed",l)}}}catch(l){throw console.error("[Snapdom] Failed to clone node:",t,l),l}let a=null;if(t instanceof HTMLTextAreaElement){let{width:l,height:d}=ut(t),f=l||t.getBoundingClientRect().width||0,h=d||t.getBoundingClientRect().height||0;f&&(i.style.width=`${f}px`),h&&(i.style.height=`${h}px`)}if(t instanceof HTMLInputElement){let l=(t.type||"text").toLowerCase();if((l==="checkbox"||l==="radio")&&Hn()){let{el:f,applyVisual:h}=co(t);e.nodeMap.set(f,t),a=h,i=f}else i.value=t.value,i.setAttribute("value",t.value),t.checked!==void 0&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.indeterminate=t.indeterminate))}if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&!t.value&&t.placeholder)try{let l=window.getComputedStyle(t,"::placeholder"),d=l&&l.color;if(d&&d!=="rgba(0, 0, 0, 0)"){let f="snapdom-ph-"+(Math.random()*1e6|0);i.classList.add(f);let h=document.createElement("style");h.textContent=`.${f}::placeholder{color:${d}!important;opacity:${l.opacity||"1"}!important;-webkit-text-fill-color:${d}!important;}`,i.prepend(h)}}catch{}if(t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(s=t.value),t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){t.disabled&&i.setAttribute("disabled",""),t.required&&i.setAttribute("required",""),t.readOnly&&i.setAttribute("readonly","");let l=t;l.min!==void 0&&l.min!==""&&i.setAttribute("min",l.min),l.max!==void 0&&l.max!==""&&i.setAttribute("max",l.max),l.pattern!==void 0&&l.pattern!==""&&i.setAttribute("pattern",l.pattern);let d=t.getAttribute("aria-invalid");d!==null&&i.setAttribute("aria-invalid",d)}if(ve(t)||ct(t,i,e,n),a&&a(),t instanceof SVGElement&&!ve(t)){let l=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let d=window.getComputedStyle(t);for(let f of l){let h=d.getPropertyValue(f);h&&i.style.setProperty(f,h)}}catch{}}if(t.shadowRoot){try{let S=t.shadowRoot.querySelectorAll("slot");for(let g of S){let x=g.assignedNodes?.()||[];for(let v of x)o.add(v)}}catch{}let l=to(e),d=`[data-sd="${l}"]`;e.shadowScopes||=new WeakMap,e.shadowScopes.set(t.shadowRoot,l);try{i.setAttribute("data-sd",l)}catch{}let f=eo(t.shadowRoot),h=Jn(f,d,l),m=ro(f),p=io(t,m,d);no(i,p+h,l);let b=document.createDocumentFragment(),y=(S,g)=>{if(S.nodeType===Node.ELEMENT_NODE&&S.tagName==="STYLE")return g(null);ne(S,e,n).then(x=>{g(x||null)}).catch(()=>{g(null)})},w=await ke(Array.from(t.shadowRoot.childNodes),y,n.fast);b.append(...w.filter(S=>!!S)),i.appendChild(b)}if(t.tagName==="SLOT"){let l=e.shadowScopes?.get(t.getRootNode()),d=t.assignedNodes?.()||[],f=d.length?t.assignedNodes?.({flatten:!0})||d:[],h=f.length?f:Array.from(t.childNodes),m=document.createDocumentFragment(),p=(y,w)=>{ne(y,e,n).then(S=>{S&&d.length&&so(S,l),w(S||null)}).catch(()=>{w(null)})},b=await ke(Array.from(h),p,n.fast);return m.append(...b.filter(y=>!!y)),m}function c(l,d){if(o.has(l))return d(null);ne(l,e,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let u=await ke(Array.from(t.childNodes),c,n.fast);if(i.append(...u.filter(l=>!!l)),r!==null&&i instanceof HTMLSelectElement){i.value=r;for(let l of i.options)l.value===r?l.setAttribute("selected",""):l.removeAttribute("selected")}return s!==null&&i instanceof HTMLTextAreaElement&&(i.textContent=s),i}async function Ki(t,e,n){let o=!1;try{o=!!(t.contentDocument||t.contentWindow?.document)}catch(r){_(e,"iframe same-origin probe failed",r)}if(o)try{return await ao(t,e,n)}catch(r){console.warn("[SnapDOM] iframe rasterization failed, fallback:",r)}if(o||console.warn("[snapdom] cross-origin