@zumer/snapdom 3.3.1-dev.0 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/snapdom.js +2 -2
- package/dist/snapdom.mjs +2 -2
- package/package.json +6 -1
package/dist/snapdom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* SnapDOM
|
|
3
|
-
* v3.3.
|
|
3
|
+
* v3.3.3
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
"use strict";(()=>{var fc=Object.defineProperty;var ct=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var be=(t,e)=>{for(var n in e)fc(t,n,{get:e[n],enumerable:!0})};function Zo(t){return t===!1||typeof t=="string"&&t.toLowerCase().trim()==="disabled"?"disabled":"soft"}function ti(t="soft"){t==="disabled"&&(I.computedStyle=new WeakMap,I.measureHints=new WeakMap,I.baseStyle=new lt(50),I.defaultStyle=new lt(64),I.image=new lt(100),I.background=new lt(100),I.resource=new lt(150),I.compress=new lt(50))}var lt,I,gt=ct(()=>{"use strict";lt=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let r=this.keys().next().value;r!==void 0&&this.delete(r)}return super.set(e,n)}},I={image:new lt(100),background:new lt(100),resource:new lt(150),defaultStyle:new lt(64),baseStyle:new lt(50),compress:new lt(50),computedStyle:new WeakMap,measureHints:new WeakMap,warnedReconcile:!1}});function re(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function dc(t){let e=[],n=0,r=0,i="";for(let o=0;o<t.length;o++){let s=t[o];if(s==="\\"){o++;continue}i?s===i&&(i=""):s==='"'||s==="'"?i=s:s==="("?r++:s===")"?r--:s===","&&r===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e}function Ge(t,e=1){let n=t.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let r=[];for(let o of dc(n[1])){let s=o.match(/url\((['"]?)(.*?)(\1)\)/);if(!s)continue;let a=o.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!uc.test(a[1].trim()))continue;let c=o.replace(/url\((['"]?)[\s\S]*?\1\)/," ").match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)\b/i),u=1;if(c){let l=parseFloat(c[1]);u=/dpi/i.test(c[2])?l/96:l}r.push({url:s[2].trim(),dppx:u})}return r.length?(r.sort((o,s)=>o.dppx-s.dppx),(r.find(o=>o.dppx>=e)||r[r.length-1]).url):null}function kr(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function qt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function Mr(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}}function Xe(t){return!!t&&t.tagName==="INPUT"&&(t.getAttribute("type")||"").toLowerCase()==="password"}function Ar(t){return"\u2022".repeat(String(t??"").length)}function it(t,e){return t?.nodeType===1&&t.localName===e}function Rt(t){return t?.nodeType===1&&t.namespaceURI===pc}function It(t){return t?.nodeType===1&&t.namespaceURI===hc}function Ot(t){return t?.nodeType===11&&!!t.host}function _r(t){return t?.nodeType===9}var Cr,uc,pc,hc,Ct=ct(()=>{"use strict";Cr=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i,uc=Cr;pc="http://www.w3.org/1999/xhtml",hc="http://www.w3.org/2000/svg"});function mc(t="[SnapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(s,a,c){if(i>=n)return;let u=Date.now();(r.get(a)||0)>u||(r.set(a,u+e),i++,s==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(s,a){o("warn",s,a)},errorOnce(s,a){o("error",s,a)},reset(){r.clear(),i=0}}}function ri(t,e,n){if(Dt.size>=ni){let r=Date.now();for(let[i,o]of Dt)o.until<=r&&Dt.delete(i);for(;Dt.size>=ni;)Dt.delete(Dt.keys().next().value)}Dt.set(t,{until:Date.now()+n,result:e})}function gc(t){return/^data:|^blob:|^about:blank$/i.test(t)}function yc(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.split(/\{url(?:Raw)?\}/)[0],i=new URL(r||".",n);if(new URL(t,n).origin===i.origin)return!0}catch{}return!1}function bc(t,e){if(!e||gc(t)||yc(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(t,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function wc(t,e){if(!e)return t;if(/\{url(?:Raw)?\}/.test(e))return e.replace("{urlRaw}",()=>qt(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}${qt(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function oi(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(t)})}function Sc(t,e){return new Headers(e.headers||{}).keys().next().done?JSON.stringify([e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,e.credentials||"",t]):null}function ii(t){try{return new URL(t,globalThis.location?.href||"http://localhost/").origin}catch{return"invalid-url"}}function Rr(t,e){try{t.onError?.(e)}catch{}}async function ft(t,e={}){let n=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",o=e.errorTTL??8e3,s=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[,g="",y=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],w=/;base64/i.test(g)?atob(y):decodeURIComponent(y),v=new Uint8Array([...w].map(S=>S.charCodeAt(0))),C=new Blob([v],{type:(g||"").split(";")[0]||""});return{ok:!0,data:C,status:200,url:t,fromCache:!1,mime:C.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let g=await fetch(t);if(!g.ok)return{ok:!1,data:null,status:g.status,url:t,fromCache:!1,reason:"http_error"};let y=await g.blob(),b=y.type||g.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await oi(y),blob:y,status:g.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await y.text(),status:g.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:y,status:g.status,url:t,fromCache:!1,mime:b}}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;try{c=Sc(t,{as:n,timeout:r,useProxy:i,errorTTL:o,credentials:e.credentials,headers:s})}catch{let g={ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"};return Rr(e,g),g}let u=Dt.get(c);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&Dt.delete(c);let l=Er.get(c);if(l)return l;let f=bc(t,i)?wc(t,i):t,d=e.credentials;if(!d)try{let g=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(t,g);d=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{d="omit"}let h=new AbortController,m=setTimeout(()=>h.abort("timeout"),r),p=(async()=>{try{let g=await fetch(f,{signal:h.signal,credentials:d,headers:s});if(!g.ok){let w={ok:!1,data:null,status:g.status,url:f,fromCache:!1,reason:"http_error"};if(c!==null&&o>0&&ri(c,w,o),!a){let v=`${g.status} ${g.statusText||""}`.trim();ei.warnOnce(`http:${g.status}:${n}:${ii(t)}`,`Couldn't load ${t} (HTTP ${v}).`)}return Rr(e,w),w}if(n==="text")return{ok:!0,data:await g.text(),status:g.status,url:f,fromCache:!1};let y=await g.blob(),b=y.type||g.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await oi(y),blob:y,status:g.status,url:f,fromCache:!1,mime:b}:{ok:!0,data:y,status:g.status,url:f,fromCache:!1,mime:b}}catch(g){let y=h.signal.aborted?h.signal.reason==="timeout"?"timeout":"abort":g&&typeof g=="object"&&g.name==="AbortError"?"abort":"network",b={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:y};if(c!==null&&!/^blob:/i.test(t)&&o>0&&ri(c,b,o),!a){let w=`${y}:${n}:${ii(t)}`,v=y==="timeout"?`Timed out loading ${t} after ${r}ms. Raise the timeout option or set useProxy.`:y==="abort"?`Loading ${t} was cancelled.`:`Couldn't load ${t} (network or CORS). Try the useProxy option.`;ei.errorOnce(w,v)}return Rr(e,b),b}finally{clearTimeout(m),Er.delete(c)}})();return c!==null&&Er.set(c,p),p}var ei,Er,ni,Dt,we=ct(()=>{"use strict";Ct();ei=mc("[SnapDOM]",{ttlMs:3*6e4,maxEntries:10}),Er=new Map,ni=50,Dt=new Map});async function Se(t,e={}){if(/^\s*url\(\s*['"]?data:/i.test(t)||/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=Ge(t,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??re(t);if(!r)return t;let i=Mr(r),o=qt(i),s=(e.useProxy||"")+"|"+o;if(I.background.has(s)){let a=I.background.get(s);return a?`url("${a}")`:"none"}try{let a=await ft(o,{as:"dataURL",useProxy:e.useProxy});return a.ok?(I.background.set(s,a.data),`url("${a.data}")`):(I.background.set(s,null),"none")}catch{return I.background.set(s,null),"none"}}var si=ct(()=>{"use strict";gt();Ct();we()});function Ac(t){let e=t.replace(Mc,"").trim();return e?e.replace(/(^|,)(\s*)(?=,|$)/g,"$1$2*"):"*"}function li(t,e,n,r){for(let i=0;i<t.length;i++){if(--r.budget<0)return!1;let o=t[i],s=o.style;if(s){let c=!!o.selectorText&&Cc.test(o.selectorText);for(let u=0;u<s.length;u++){let l=s[u];if(e.add(l),c&&r.pseudoProps.add(l),s.getPropertyPriority(l)&&r.importantProps.add(l),l.length>5&&(l[0]==="m"||l[0]==="p")){let f=l.startsWith("margin")?"marginUnstable":l.startsWith("padding")?"paddingUnstable":null;f&&!r[f]&&kc.test(s.getPropertyValue(l))&&(r[f]=!0)}}}let a=o.selectorText;if(a&&a.includes(":has(")&&(r.usesHas=!0),a&&a.includes("&"))for(let c=o.parentRule;c&&a.includes("&");c=c.parentRule)c.selectorText&&(a=a.replace(/&/g,`:is(${c.selectorText})`));if(a&&(r.inContainer||ci.test(a)||a.includes("+")||a.includes("~")))for(let c of Pr(a,",")){let u=c.trim();u&&(r.inContainer||ci.test(u)||u.includes("+")||u.includes("~"))&&r.shareUnsafeSels.add(u)}if(a&&a.includes(":"))for(let c in ai)ai[c].test(a)&&n[c].push(Ac(a));if(o.styleSheet){if(!bn(o.styleSheet,e,n,r))return!1}else if(o.cssRules&&o.cssRules.length){let c=o.constructor?.name==="CSSContainerRule";c&&r.inContainer++;let u=li(o.cssRules,e,n,r);if(c&&r.inContainer--,!u)return!1}}return!0}function bn(t,e,n,r){let i;try{i=t.cssRules}catch{return!1}return i?li(i,e,n,r):!1}function Tr(t,e){for(let n of t){let r=n.effect?.getKeyframes?.()||[];for(let i of r)for(let o of Object.keys(i))o==="offset"||o==="easing"||o==="composite"||o==="computedOffset"||e.add(o.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()))}}function fi(t){let e=new Set;return bn(t,e,{before:[],after:[],firstLetter:[],marker:[],firstLine:[]},{budget:2e4,usesHas:!1,shareUnsafeSels:new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:new Set,pseudoProps:new Set})?e:null}function Pr(t,e){if(!t.includes(e))return[t];let n=[],r=0,i=null,o=0;for(let s=0;s<t.length;s++){let a=t[s];if(a==="\\"){s++;continue}if(i){a===i&&(i=null);continue}a==='"'||a==="'"?i=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:r===0&&a===e&&(n.push(t.slice(o,s)),o=s+1)}return n.push(t.slice(o)),n}function _c(t){let e=0,n=null,r=0;for(let l=0;l<t.length;l++){let f=t[l];if(n){f===n&&t[l-1]!=="\\"&&(n=null);continue}f==='"'||f==="'"?n=f:f==="("||f==="["?e++:f===")"||f==="]"?e--:e===0&&(f===" "||f===">"||f==="+"||f==="~")&&(r=l+1)}let i="",o=0;for(let l of t.slice(r))l==="("||l==="["?o++:l===")"||l==="]"?o--:o===0&&(i+=l);let s=l=>!l||/\\[0-9a-fA-F]/.test(l)?null:l.replace(/\\(.)/g,"$1"),a=s((i.match(/\.((?:\\.|[\w-])+)/)||[])[1]);if(a)return"c"+a;let c=s((i.match(/#((?:\\.|[\w-])+)/)||[])[1]);if(c)return"i"+c;let u=(i.match(/^([a-zA-Z][\w-]*)/)||[])[1];return u?"t"+u.toLowerCase():null}function ui(t,e){if(!e.length)return"";if(e.some(r=>r.includes("&")))return null;let n=e.join(",");try{return t.matches(n),n}catch{return null}}function Ec(t,e){let n=t.createElement("div"),r={};for(let i in e){let o=e[i];(i==="before"||i==="after")&&o.push("q"),r[i]=ui(n,o)}return r}function di(t){let e={universe:null,pseudoUniverse:null,usesHas:!0,shareGate:null,marginUnstable:!0,paddingUnstable:!0,importantProps:null,pseudoGates:{before:null,after:null,firstLetter:null,marker:null,firstLine:null}};try{let n=new Set(Fr),r={before:[],after:[],firstLetter:[],marker:[],firstLine:[]},i={budget:2e4,usesHas:!1,shareUnsafeSels:new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:new Set,pseudoProps:new Set};for(let u of t.styleSheets)if(!bn(u,n,r,i))return e;let o=t.adoptedStyleSheets;if(Array.isArray(o)){for(let u of o)if(!bn(u,n,r,i))return e}typeof t.getAnimations=="function"&&Tr(t.getAnimations(),n);let s=Array.from(i.shareUnsafeSels),a=ui(t.createElement("div"),s)===null?null:s.map(u=>({sel:u,key:_c(u)})),c=new Set(vc);for(let u of xc)n.has(u)&&c.add(u);for(let u of i.pseudoProps)c.add(u);return(i.pseudoProps.has("transform")||i.pseudoProps.has("rotate")||i.pseudoProps.has("scale"))&&c.add("transform-origin"),i.pseudoProps.has("perspective")&&c.add("perspective-origin"),{universe:n,pseudoUniverse:c,pseudoGates:Ec(t,r),usesHas:i.usesHas,shareGate:a,marginUnstable:i.marginUnstable,paddingUnstable:i.paddingUnstable,importantProps:i.importantProps}}catch{return e}}var Fr,xc,vc,Cc,kc,ai,Mc,ci,wn=ct(()=>{"use strict";Fr=["display","position","top","right","bottom","left","float","clear","z-index","box-sizing","width","height","min-width","min-height","max-width","max-height","margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left","overflow-x","overflow-y","visibility","opacity","content-visibility","vertical-align","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","flex-direction","flex-wrap","flex-grow","flex-shrink","flex-basis","order","align-items","align-self","align-content","justify-content","justify-items","justify-self","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-auto-flow","grid-auto-columns","grid-auto-rows","grid-column-start","grid-column-end","grid-row-start","grid-row-end","color","font-family","font-size","font-weight","font-style","font-stretch","line-height","letter-spacing","word-spacing","white-space","text-align","text-transform","text-indent","text-overflow","text-shadow","direction","unicode-bidi","writing-mode","text-orientation","word-break","overflow-wrap","tab-size","list-style-type","list-style-position","list-style-image","counter-reset","counter-increment","counter-set","background-color","background-image","background-size","background-position","background-repeat","background-clip","background-origin","background-attachment","box-shadow","outline-width","outline-style","outline-color","outline-offset","transform","transform-origin","rotate","scale","translate","filter","mix-blend-mode","clip-path","object-fit","object-position","border-collapse","border-spacing","table-layout","caption-side","empty-cells"],xc=["color","font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-kerning","font-feature-settings","font-variation-settings","line-height","letter-spacing","word-spacing","white-space","text-align","text-align-last","text-indent","text-transform","text-shadow","text-rendering","direction","unicode-bidi","word-break","overflow-wrap","writing-mode","text-orientation","hyphens","tab-size","visibility","list-style-type","list-style-position","list-style-image","border-collapse","border-spacing","caption-side","empty-cells","quotes","color-scheme","-webkit-text-fill-color","-webkit-font-smoothing","image-rendering"],vc=["display","width","height","min-width","min-height"],Cc=/::?(?:before|after|first-letter|first-line|marker)/,kc=/%|\bauto\b|calc\(|var\(/i,ai={before:/::?before\b/,after:/::?after\b/,firstLetter:/::?first-letter\b/,marker:/::marker\b/,firstLine:/::?first-line\b/},Mc=/::?(?:before|after|first-letter|first-line|marker)\b/g;ci=/:(nth-|first-child|last-child|only-|first-of-type|last-of-type|empty|hover|focus|active|target|checked|indeterminate|disabled|enabled|read-only|read-write|placeholder-shown|autofill|valid|invalid|user-valid|user-invalid|in-range|out-of-range|required|optional|default|link|any-link|scope|defined|modal|fullscreen|picture-in-picture|playing|paused|dir\(|lang\(|has\()/});function Z(t){return pi.add(t),t.setAttribute("data-snapdom-internal",""),t}function Gt(t){return pi.has(t)}var pi,kt=ct(()=>{"use strict";pi=new WeakSet});function Nr(t){if(t=String(t).toLowerCase(),Ye.has(t)){let o={};return I.defaultStyle.set(t,o),o}if(I.defaultStyle.has(t))return I.defaultStyle.get(t);let e=[...document.querySelectorAll("#snapdom-sandbox")].find(Gt);e||(e=document.createElement("div"),Z(e),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.includes("-")?"span":t);n.style.all="initial",e.appendChild(n);let r=getComputedStyle(n),i={};for(let o of r){if(xe(o))continue;let s=r.getPropertyValue(o);i[o]=s}for(let o of Fr)!(o in i)&&!xe(o)&&(i[o]=r.getPropertyValue(o));return e.removeChild(n),I.defaultStyle.set(t,i),i}function xe(t){let e=hi.get(t);if(e===void 0){let n=String(t).toLowerCase();e=Tc.has(n)||Fc.test(n)||Rc.test(n),hi.set(t,e)}return e}function gi(t,e){let n=Ic.get(t);if(n===void 0||e[n]!==e[t])return!1;let r=e["writing-mode"];if(r&&r!=="horizontal-tb")return!1;let i=e.direction;return!(i&&i!=="ltr")}function Sn(t,e){return!$c.has(t)&&(e==="inline"||Pc.has(t)||mi.has(t))}function Lr(t,e,n){let r=(e.display||"").toLowerCase();if(r==="inline"||mi.has(t))return!1;if(n)return!0;if((e.float||"none").toLowerCase()!=="none")return!1;let o=(e.position||"static").toLowerCase();return o==="absolute"||o==="fixed"?!1:!Dc.has(r)}function ve(t,e,n=!0,r=!1){if(e=String(e||"").toLowerCase(),Ye.has(e))return"";let i=[],o=Nr(e),s=(t.display||"").toLowerCase(),a=s==="inline",c=Sn(e,s),u=t["text-wrap-mode"]||t["white-space"]||"",l=u==="nowrap"||u==="pre",d=c&&n&&!(c&&n&&!a&&l),h=!1;for(let m in t){if(xe(m)||gi(m,t))continue;let p=t[m];if(d){if(Nc.has(m))continue;if(Lc.has(m)){p&&p!==o[m]&&(i.push(`${m}:${p}`),p!=="auto"&&(h=!0));continue}}if(p&&p!==o[m]){if(!l&&(m==="width"||m==="inline-size")&&p.endsWith("px")&&p.includes(".")){let g=parseFloat(p);if(Number.isFinite(g)){i.push(`${m}:${(g+Oc).toFixed(3)}px`);continue}}i.push(`${m}:${p}`)}}if(d&&!a&&!r&&!h){let m=t.width;m&&m!=="auto"&&m!==o.width&&i.push(`min-width:${m}`)}return i.sort(),i.join(";")}function Ir(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 Or(t,e=null){let n=new Map;for(let s of t){let a=Nr(s);if(!a)continue;let l=(e?Object.entries(a).filter(([d])=>e.has(d)):Object.entries(a)).filter(([d])=>!gi(d,a)).map(([d,h])=>`${d}:${h};`).sort(),f=l.join("");f&&(n.has(f)||n.set(f,{tagList:[],declarations:l}),n.get(f).tagList.push(s))}let r=[...n.values()],i=null;for(let{declarations:s}of r){let a=new Set(s);if(!i){i=a;continue}for(let c of i)a.has(c)||i.delete(c)}i??(i=new Set);let o="";if(i.size&&r.length>1){let s=r.flatMap(a=>a.tagList);o+=`${s.join(",")} { ${[...i].join("")} }
|
|
@@ -37,4 +37,4 @@ ${g}
|
|
|
37
37
|
} catch (err) {
|
|
38
38
|
self.postMessage({ id, error: String(err) })
|
|
39
39
|
}
|
|
40
|
-
}`,Du=Math.max(1,Math.min(4,(typeof navigator<"u"&&navigator.hardwareConcurrency||2)-1)),Lt=null,Wu=0,Bu=0,ue=new Map;function Sa(){for(let t of ue.values())t(void 0);if(ue.clear(),Array.isArray(Lt))for(let t of Lt)try{t?.terminate()}catch{}Lt=!1}function Uu(){let t,e=null;try{t=URL.createObjectURL(new Blob([Ou],{type:"text/javascript"})),e=new Worker(t),e.onmessage=n=>{let r=ue.get(n.data.id);r&&(ue.delete(n.data.id),r(n.data.error?void 0:n.data.url??null))},e.onerror=Sa}catch{e=null}return t&&URL.revokeObjectURL(t),e}function zu(){if(Lt===!1)return!1;if(Lt===null){if(typeof Worker>"u"||typeof OffscreenCanvas>"u")return Lt=!1;Lt=[]}let t=Wu++%Du;if(!Lt[t]){let e=Uu();if(!e)return Sa(),!1;Lt[t]=e}return Lt[t]}var Hu=5e3;function ju(t,e,n,r,i){let o=zu();return o?new Promise(s=>{let a=++Bu,c=setTimeout(()=>{ue.delete(a),s(void 0)},Hu);ue.set(a,u=>{clearTimeout(c),s(u)});try{o.postMessage({id:a,dataURL:i?"":t,blob:i,srcLength:t.length,targetW:e,targetH:n,resFactor:wa,quality:ba,mime:r})}catch{clearTimeout(c),ue.delete(a),s(void 0)}}):Promise.resolve(void 0)}async function Mo(t,e,n,r){if(typeof t!="string"||!t.startsWith("data:image")||t.startsWith("data:image/svg"))return null;e=Math.ceil(e),n=Math.ceil(n);let i=t.length+":"+t.slice(0,64)+t.slice(-64)+":"+e+"x"+n,o=I.compress,s=o.get(i);if(s?.source===t)return s.result;let a=tr.get(i);if(a?.source===t&&a.cache===o)return a.promise;let c=(async()=>{let l=Pu(t),f=l==="image/jpeg"?"image/jpeg":l==="image/webp"?"image/webp":"image/png",d=Iu(t);if(d&&d.w>0&&d.h>0&&!ha(d.w,d.h,e,n))return null;if(t.length>=$u){let S=await ju(t,e,n,f,r);if(S!==void 0)return S}let h;try{h=await Tu(t)}catch{return null}let m=h.naturalWidth||h.width,p=h.naturalHeight||h.height;if(!m||!p)return null;let g=ha(m,p,e,n);if(!g)return null;let y=g*wa,b=Math.max(1,Math.round(m*y)),w=Math.max(1,Math.round(p*y)),v=document.createElement("canvas");v.width=b,v.height=w;let C=v.getContext("2d");if(!C)return null;C.imageSmoothingEnabled=!0,C.imageSmoothingQuality="high",C.drawImage(h,0,0,b,w);try{let S=v.toDataURL(f,ba);if(typeof S=="string"&&S.startsWith("data:image")&&S.length<t.length)return S}catch{}return null})(),u={source:t,promise:c,cache:o};tr.set(i,u);try{let l=await c;return Nu(o,i,t,l),l}finally{tr.get(i)===u&&tr.delete(i)}}async function Vu(t,e,n=new Map,r={}){if(!e.compress)return{count:0,before:0,after:0};let i=Array.from(t.querySelectorAll("img"));t.tagName==="IMG"&&i.unshift(t);let o=0,s=0,a=0,c=async l=>{let f=l.getAttribute("src")||"";if(!f.startsWith("data:image")||f.startsWith("data:image/svg"))return;let d=parseFloat(l.dataset.snapdomWidth)||parseFloat(l.style.width)||l.width||0,h=parseFloat(l.dataset.snapdomHeight)||parseFloat(l.style.height)||l.height||0;if(!d||!h)return;let m=r.value||(r.value=ko(t,e)),p=m.density*m.stretch(n.get(l)||l),g=await Mo(f,d*p,h*p,l.__snapdomBlob);g&&(o++,s+=f.length,a+=g.length,l.setAttribute("src",g),er(l,"attribute","src",f,g,e))},u=6;for(let l=0;l<i.length;l+=u)await Promise.allSettled(i.slice(l,l+u).map(c));return{count:o,before:s,after:a}}var qu=/^(cover|contain|(\d+(\.\d+)?%(\s+\d+(\.\d+)?%)?))$/;function Gu(t){let e=t.offsetWidth||t.getBoundingClientRect().width||0,n=t.offsetHeight||t.getBoundingClientRect().height||0;return{w:e,h:n}}async function Xu(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=[],o=[t,...t.querySelectorAll("*")];for(let u of o){let l=u.style&&u.style.backgroundImage;l&&l.includes("data:image")&&i.push(u)}let s=0,a=async u=>{let l=n.get(u);if(!l||!l.isConnected)return;let f;try{f=getComputedStyle(l)}catch{return}if((f.backgroundRepeat||"repeat").toLowerCase().split(",").some(_=>_.trim()!=="no-repeat"))return;let h=(u.style.backgroundSize||f.backgroundSize||"auto").toLowerCase();if(h.split(",").some(_=>!qu.test(_.trim())))return;let{w:m,h:p}=Gu(l);if(!m||!p)return;let g=Math.max(1,...(h.match(/\d+(?:\.\d+)?%/g)||[]).map(_=>parseFloat(_)/100)),y=r.value||(r.value=ko(t,e)),b=y.density*y.stretch(l)*g,w=m*b,v=p*b,C=u.style.backgroundImage,S=[...C.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],M=C;for(let _ of S){let E=_[2];if(E.startsWith("data:image/svg"))continue;let x=await Mo(E,w,v);x&&(M=M.split(E).join(x),s++)}M!==C&&(u.style.setProperty("background-image",M,u.style.getPropertyPriority("background-image")),er(u,"style","background-image",C,u.style.backgroundImage,e))},c=6;for(let u=0;u<i.length;u+=c)await Promise.allSettled(i.slice(u,u+c).map(a));return{count:s}}async function Yu(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=Array.from(t.querySelectorAll("image"));t.localName==="image"&&i.unshift(t);let o=0,s=async c=>{let u=c.getAttribute("href")||(typeof c.getAttributeNS=="function"?c.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!u||!u.startsWith("data:image")||u.startsWith("data:image/svg"))return;let l=c.getAttribute("width")||"",f=c.getAttribute("height")||"";if(l.includes("%")||f.includes("%"))return;let d=n.get(c),h=d?O(d):c.style,m=(v,C)=>{if(/^\d+(?:\.\d+)?px$/.test(h?.[v]||""))return parseFloat(h[v]);if(/^\d+(?:\.\d+)?(?:px)?$/.test(C.trim()))return parseFloat(C);try{return d?.[v]?.baseVal?.value||0}catch{return 0}},p=m("width",l),g=m("height",f);if(!p||!g)return;let y=r.value||(r.value=ko(t,e)),b=y.density*y.stretch(d||c),w=await Mo(u,p*b,g*b);w&&(c.setAttribute("href",w),er(c,"attribute","href",u,w,e),c.hasAttribute("xlink:href")&&(c.setAttributeNS(ma,"xlink:href",w),er(c,"attribute","xlink:href",u,w,e)),o++)},a=6;for(let c=0;c<i.length;c+=a)await Promise.allSettled(i.slice(c,c+a).map(s));return{count:o}}async function or(t,e,n){if(!e.compress)return;let r={};await Vu(t,e,n,r),await Xu(t,e,n,r),await Yu(t,e,n,r)}wt();gt();kt();function Ku(t,e){if(X())return t;let n=t.indexOf("</style>");if(n===-1)return t;let r=/<style\b[^>]*>[\s\S]*?<\/style>/g,i=[],o=n,s;for(r.lastIndex=n;s=r.exec(t);)i.push({text:t.slice(o,s.index),intern:!0}),i.push({text:s[0],intern:!1}),o=r.lastIndex;i.push({text:t.slice(o),intern:!0});let a=new Map,c=/ style="([^"]*)"/g,u;for(let y of i)if(y.intern)for(c.lastIndex=0;u=c.exec(y.text);)a.set(u[1],(a.get(u[1])||0)+1);let l=0;for(let[y,b]of a)b>1&&(l+=(b-1)*y.length);if(l<2048||t.includes(" data-sdi="))return t;let f=Qu(e,i.some(y=>!y.intern),t.includes("data-snapdom-asset"));if(f===null)return t;let d=new Map,h=0,m=[],p=(y,b)=>{if((a.get(b)||0)<2||f.has(b))return y;let w=d.get(b);return w===void 0&&(w="i"+(h++).toString(36),d.set(b,w),m.push(`[data-sdi="${w}"]{${b}}`)),` data-sdi="${w}"`},g="";for(let y of i)g+=y.intern?y.text.replace(c,p):y.text;return t.slice(0,n)+m.join("")+g}function Qu(t,e,n){let r=new Set;if(!e&&!n)return r;if(!t||t.querySelector("[data-sdi]"))return null;let i=c=>{let u=c.getAttribute("style");u&&r.add(u)};if(n&&t.querySelectorAll("[data-snapdom-asset][style]").forEach(i),e)try{let c=u=>{for(let l of u){if(l.type===CSSRule.IMPORT_RULE||l.type===CSSRule.NAMESPACE_RULE)throw new Error("External or namespaced CSS");if(l.selectorText){if(/\[\s*style\b|data-sdi|\[[^\]]*\\|&/i.test(l.selectorText))throw new Error("Attribute-dependent or nested CSS");t.querySelectorAll(l.selectorText).forEach(i)}l.cssRules&&c(l.cssRules)}};for(let u of[...t.querySelectorAll("style")].slice(1)){let l=u.textContent||"";if(/@import\b/i.test(l))return null;let f=new CSSStyleSheet;f.replaceSync(l),c(f.cssRules)}}catch{return null}let o=new Set,s=document.createElement("div"),a=new XMLSerializer;for(let c of r){s.setAttribute("style",c);let u=a.serializeToString(s).match(/ style="([^"]*)"/);u&&o.add(u[1])}return o}async function ir(t,e){let{clipWindow:n,outerTransforms:r,outerShadows:i,rootTransform2D:o,fontsCSS:s}=e,a=t.options;if(t!==a){let{options:Q,...et}=t;t=Object.assign(a,et),Object.defineProperty(t,"options",{value:t,configurable:!0})}let c,u;Qs(t,s),await Bt("beforeRender",t);let l=O(t.element),f=t.element.getBoundingClientRect(),d=Math.max(1,D(t.element.offsetWidth||parseFloat(l.width)||f.width||1)),h=Math.max(1,D(t.element.offsetHeight||parseFloat(l.height)||f.height||1)),m=t.element.ownerDocument||document;if(!n&&(t.element===m.body||t.element===m.documentElement)&&!t.__pinned){let Q=Math.max(t.element.scrollHeight||0,m.documentElement?.scrollHeight||0,m.body?.scrollHeight||0),et=Math.max(t.element.scrollWidth||0,m.documentElement?.scrollWidth||0,m.body?.scrollWidth||0);Q>0&&(h=Math.max(h,D(Q))),et>0&&(d=Math.max(d,D(et)));try{let tt=(t.scrollbarCSS||"").length+(t.baseCSS||"").length+(t.fontsCSS||"").length+(t.classCSS||"").length,rt=I.measureHints.get(t.element);if(rt&&rt.cssLen===tt&&rt.w0===d&&rt.docH===Q&&rt.docW===et)rt.csh>0&&(h=Math.max(h,D(rt.csh))),rt.csw>0&&(d=Math.max(d,D(rt.csw)));else{let ot=m.createElement("div");Z(ot),ot.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+d+"px!important;overflow:visible!important;visibility:hidden!important;";let ee=ot.attachShadow({mode:"open"}),ne=m.createElement("style");ne.textContent=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS,ee.appendChild(ne),ee.appendChild(t.clone.cloneNode(!0)),m.body.appendChild(ot);let qe=ot.scrollHeight,Vt=ot.scrollWidth;m.body.removeChild(ot),I.measureHints.set(t.element,{cssLen:tt,w0:d,docH:Q,docW:et,csh:qe,csw:Vt}),qe>0&&(h=Math.max(h,D(qe))),Vt>0&&(d=Math.max(d,D(Vt)))}}catch{}}if(t.options?.excludeMode==="remove"||typeof t.options?.filter=="function"&&t.options.filterMode==="remove"){let Q=So(t.element,t.options),et=1,tt=So(t.element,{}),rt=Math.max(2,h*.15);Number.isFinite(tt)&&tt>=h-rt&&Number.isFinite(Q)&&Q>0&&(h=Math.max(1,Math.min(h,D(Q+et))))}if(t.options?.reconcile)try{let Q=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS;Ks(t.element,t.clone,Q,t.nodeMap,d,h)}catch(Q){console.warn("[SnapDOM] reconcile couldn't run; captured without it.",Q)}let g=(Q,et=NaN)=>{let tt=typeof Q=="string"?parseFloat(Q):Q;return Number.isFinite(tt)?tt:et},y=g(t.options.width),b=g(t.options.height),w=n?D(n.width):d,v=n?D(n.height):h,C=w,S=v,M=Number.isFinite(y),_=Number.isFinite(b),E=v>0?w/v:1;M&&_?(C=Math.max(1,D(y)),S=Math.max(1,D(b))):M?(C=Math.max(1,D(y)),S=Math.max(1,D(C/(E||1)))):_&&(S=Math.max(1,D(b)),C=Math.max(1,D(S*(E||1))));let x=0,k=0,R=d,T=h;if(n){let Q=0,et=0;if(Ao(t.element)){let tt=null;if(!r&&o&&Number.isFinite(o.a))tt={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0};else{let rt=fe(t.element),ot=wo(l.transform&&l.transform!=="none"?l.transform:"",rt);ot&&ot.is2D&&(tt={a:ot.a,b:ot.b,c:ot.c,d:ot.d,e:0,f:0})}if(tt&&!(tt.a===1&&tt.b===0&&tt.c===0&&tt.d===1)){let{ox:rt,oy:ot}=ln(l,d,h),ee=Oe(d,h,tt,rt,ot);Q=ee.minX,et=ee.minY}}x=D(n.x+Q),k=D(n.y+et),R=D(x+n.width),T=D(k+n.height)}else if(!r&&o&&Number.isFinite(o.a)){let Q={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0},et=Oe(d,h,Q,0,0);x=D(et.minX),k=D(et.minY),R=D(et.maxX),T=D(et.maxY)}else if(r&&Ao(t.element)){let et=l.transform&&l.transform!=="none"?l.transform:"",tt=fe(t.element),rt=Zt({baseTransform:et,rotate:tt.rotate||"0deg",scale:tt.scale,translate:tt.translate,width:d,height:h}),{ox:ot,oy:ee}=ln(l,d,h),ne=rt.is2D?rt:new DOMMatrix(rt.toString()),qe={a:ne.a,b:ne.b,c:ne.c,d:ne.d,e:0,f:0},Vt=Oe(d,h,qe,ot,ee);x=D(Vt.minX),k=D(Vt.minY),R=D(Vt.maxX),T=D(Vt.maxY)}let L=uo(l),W=po(l),P=ho(l),A=mo(l),N=go(l),$=f.width>0?(R-x)/f.width:1,F=f.height>0?(T-k)/f.height:1,z=i==="subtree"&&!n?Ds(t.element,t.nodeMap,t.styleCache,$,F):{top:0,right:0,bottom:0,left:0},q=n?{top:0,right:0,bottom:0,left:0}:i?{top:D(Math.max(L.top,W.top,z.top)+P.top+A.top+N.bleed.top),right:D(Math.max(L.right,W.right,z.right)+P.right+A.right+N.bleed.right),bottom:D(Math.max(L.bottom,W.bottom,z.bottom)+P.bottom+A.bottom+N.bleed.bottom),left:D(Math.max(L.left,W.left,z.left)+P.left+A.left+N.bleed.left)}:{top:P.top,right:P.right,bottom:P.bottom,left:P.left};x=D(x-q.left),k=D(k-q.top),R=D(R+q.right),T=D(T+q.bottom);let j=Math.max(1,D(R-x)),J=Math.max(1,D(T-k)),B="http://www.w3.org/2000/svg",ut=Ao(t.element)?2:0,at=D(ut+(r?0:1)),st=Math.ceil(j+at*2),nt=Math.ceil(J+at*2),pt=D(-(D(x)-at)),zt=D(-(D(k)-at)),ge=Math.max(0,pt),V=Math.max(0,zt),G=D(st-Math.min(0,pt)),U=D(nt-Math.min(0,zt)),ht=m.defaultView||window,Y=!X()&&CSS.supports("zoom","2")&&ht.devicePixelRatio||1;a.__layoutZoom=Y;let vt=document.createElementNS(B,"foreignObject");vt.setAttribute("x",String(Math.min(0,pt)*Y)),vt.setAttribute("y",String(Math.min(0,zt)*Y)),vt.setAttribute("width",String(G*Y)),vt.setAttribute("height",String(U*Y)),vt.style.overflow="visible";let ye=document.createElement("style"),gn="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";ye.textContent=(t.scrollbarCSS||"")+t.baseCSS+t.fontsCSS+gn+t.classCSS,vt.appendChild(ye);let je=document.createElement("div");je.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),je.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${G}px;height:${U}px`+(ge!==0||V!==0?`;padding:${V}px 0 0 ${ge}px !important`:"")+(Y!==1?`;zoom:${Y} !important`:""),je.appendChild(t.clone),vt.appendChild(je);let wr=new XMLSerializer().serializeToString(vt),Ht=M||_,Sr=Object.freeze({w0:w,h0:v,vbW:st,vbH:nt,targetW:C,targetH:S,contentX:D(pt+(n?x:0)),contentY:D(zt+(n?k:0)),clip:n?Object.freeze({x:D(x),y:D(k),width:w,height:v}):null});Object.defineProperty(a,"meta",{value:Sr,enumerable:!0,writable:!1,configurable:!0});let xr=!Ht||X()?st:M?C:D(st*(S/nt)),yn=!Ht||X()?nt:_?S:D(nt*(C/st)),jt=parseFloat(O(m.documentElement)?.fontSize)||16,Jo=Y!==1,cc=`<svg xmlns="${B}" width="${xr}" height="${yn}" viewBox="0 0 ${st} ${nt}" font-size="${jt}px">${Jo?`<g transform="scale(${1/Y})">`:""}`,lc=Jo?"</g></svg>":"</svg>";u=cc+Ku(wr,vt)+lc,c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`,t.svgString=u,t.dataURL=c,a.__artifacts={classCSS:t.classCSS||"",fontsCSS:t.fontsCSS||"",baseCSS:t.baseCSS||"",scrollbarCSS:t.scrollbarCSS||""},await Bt("afterRender",t),t.clone=t.nodeMap=t.styleCache=t.svgString=null;let vr=[...document.querySelectorAll("#snapdom-sandbox")].find(Gt);return vr&&vr.style.position==="absolute"&&vr.remove(),t.dataURL}function Ao(t){return Bs(t)}function Ju(t){let e=Array.isArray(t.plugins)?t.plugins:ua(),n=[];for(let r of e){let i=un(r);i&&typeof i.resolveNode=="function"&&n.push(i.resolveNode.bind(i))}return n.length?n:null}async function xa(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");e.__session=Co(e.cache),delete e.__compressedAssets,delete e.__compressedSnapshot,delete e.__compressionDensity,e.__resolveNodeHooks=Ju(e);let n=e;n.element=t,Object.defineProperty(n,"options",{value:n,configurable:!0});let r,i,o,s,a,c,u,l="",f=null,d=e.needs||_t,h=n.format,m=n.type;await Bt("beforeSnap",n);let p=n.format!==h&&/^(?:png|jpe?g|webp|svg)$/i.test(n.format),g=n.type!==m&&/^(?:png|jpe?g|webp|svg)$/i.test(n.type);if(p||g){let R=String(p?n.format:n.type).toLowerCase();n.format=R==="jpg"?"jpeg":R,n.type=n.format,n.__explicitFormat=n.format,/^(?:jpeg|webp)$/.test(n.format)&&(n.backgroundColor==null||n.backgroundColor==="transparent")&&(n.backgroundColor="#ffffff")}await Bt("beforeClone",n);let y=n.outerTransforms!==!1,b=n.outerShadows==="subtree"?"subtree":!!n.outerShadows,w=n.clip?zn(n.element,n.clip):null;if(e.__styleShare===void 0)try{e.__styleShare=Ti(n.element)&&(typeof n.element.getAnimations!="function"||n.element.getAnimations({subtree:!0}).length===0)}catch{e.__styleShare=!1}let v=bi(e.fast);for(;;){e.__slicer=v;let R=Kn(n.element,w);try{({clone:r,classCSS:i,classPrefixCSS:o,styleCache:s,nodeMap:a,reconcileRisk:c,clipWindow:u}=await Js(n.element,n.options)),c>0&&!e.reconcile&&(Mt(e.__session,"reconcile-risk","text in inline/table-cell elements kept natural width and may re-wrap; pass { reconcile: true } for pixel-exact layout"),I.warnedReconcile||(I.warnedReconcile=!0,console.warn("[SnapDOM] Some text may wrap differently in the capture. Pass { reconcile: true } to fix it (about 2x slower)."))),!y&&r&&(f=Ws(n.element,r)),!b&&r&&qs(n.element,r,n.options),r&&(Xs(n.element,r,a),Gs(n.element,r))}finally{R()}if(!v?.yielded||!e.__tornSinceStart?.())break;v=null,e.__session=Co(e.cache)}if(e.__slicer=null,n.clone=r,n.classCSS=i,n.styleCache=s,n.nodeMap=a,await Bt("afterClone",n),!We(d,"render"))return null;if(v?.due()&&await v.pause(),Hn(n.clone),n.options?.excludeMode==="remove"||typeof n.options?.filter=="function"&&n.options.filterMode==="remove")try{Ys(n.element,n.clone,n.styleCache,n.nodeMap)}catch(R){Mt(e.__session,"shrink-failed","shrink pass failed",R),console.warn("[SnapDOM] Couldn't close the gaps left by removed elements.",R)}try{await $n(n.clone,n.element,n.nodeMap)}catch{}let C=R=>Promise.resolve().then(R),S=(async()=>{await Promise.all([C(()=>Vn(n.clone,n.options)),C(()=>Gn(n.element,n.clone,n.styleCache,n.options,n.nodeMap))]);try{ea(n.element,n.clone,n.nodeMap)}catch(R){Mt(e.__session,"backdrop-filter-failed","backdrop-filter emulation failed",R),console.warn("[SnapDOM] Couldn't reproduce a backdrop-filter; captured without it.",R)}if(e.compress&&(e.__compressionClip=u,e.__compressionRootTransform=f,await C(()=>or(n.clone,n.options,n.nodeMap))),e.captureSelection)try{cs(n.nodeMap)}catch(R){Mt(e.__session,"selection-compose-failed","field selection compose failed",R)}})(),M=Promise.resolve();(e.embedFonts==="auto"?((n.element.ownerDocument||document).fonts?.size||0)>0:e.embedFonts)&&(M=C(async()=>{let R=n.element.ownerDocument||document,T=w?P=>{try{let A=P.getBoundingClientRect();return A.right>=w.left-200&&A.left<=w.right+200&&A.bottom>=w.top-200&&A.top<=w.bottom+200}catch{return!0}}:null,{required:L,usedCodepoints:W}=!w&&e.__fontUsage||On(n.element,T);if(e.embedFonts==="auto"){let P=new Set;try{for(let N of R.fonts)P.add(String(N.family).replace(/["']/g,"").toLowerCase())}catch{}if(!(P.size>0&&Array.from(L).some(N=>P.has(String(N).split("__")[0].toLowerCase()))))return}if(X()){let P=new Set(Array.from(L).map(A=>String(A).split("__")[0]).filter(Boolean));await Dn(P,1,R)}l=await vs({required:L,usedCodepoints:W,exclude:n.options.excludeFonts,localFonts:n.options.localFonts,useProxy:n.options.useProxy,fontStylesheetDomains:n.options.fontStylesheetDomains,iconMatchers:n.options.__iconMatchers,doc:R})})),await Promise.all([S,M]);let E=(n.options.plugins||[]).some(R=>R&&(typeof R.beforeRender=="function"||typeof R.afterRender=="function"));n.options.engine,v?.due()&&await v.pause();let x=n.clone;rr(x,e.__compressedAssets);let k=await ir(n,{clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,fontsCSS:l});if(e.__compressedSnapshot=nr(x,e.__compressedAssets),typeof e.__retain=="function")try{e.__retain({clone:r,nodeMap:a,styleCache:s,styleMap:e.__session.styleMap,classPrefixCSS:o,fontsCSS:l,clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,__compressedAssets:e.__compressedAssets,__compressionDensity:e.__compressionDensity})}catch{}return k}gt();Ct();var Zu=new Set(["png","jpeg","jpg","webp","svg"]);function va(t={}){let e=typeof t.type=="string"&&Zu.has(t.type.toLowerCase())?t.type.toLowerCase():null,n=t.format??e??"png";n==="jpg"&&(n="jpeg");let r=t.format!=null?n:e==="jpg"?"jpeg":e,i=Zo(t.cache),o=t.exclude==null?[]:Array.isArray(t.exclude)?t.exclude:[t.exclude],s=[],a=[];for(let f of o)if(typeof f=="string")try{document.createDocumentFragment().querySelector(f),s.push(f)}catch{console.warn(`[SnapDOM] Invalid exclude selector "${f}"; ignored.`)}else typeof f=="function"?a.push(f):f!=null&&console.warn("[SnapDOM] Ignored an exclude entry: use a CSS selector or a function.",f);let c=t.excludeMode??"hide",u=f=>{if(!f||f.nodeType!==1)return!1;if(f.getAttribute("data-capture")==="exclude")return!0;for(let d of Array.isArray(l.exclude)?l.exclude:[])try{if(f.matches(d))return!0}catch{}for(let d of Array.isArray(l.excludePredicates)?l.excludePredicates:[])try{if(d(f))return!0}catch{}if(typeof l.filter=="function")try{if(!l.filter(f))return!0}catch{}return!1},l={debug:t.debug??!1,scale:t.scale??1,exclude:s,excludePredicates:a.length?a:null,excludeMode:c,filter:t.filter??null,filterMode:t.filterMode??"hide",shouldExclude:u,placeholders:t.placeholders!==!1,captureSelection:t.captureSelection??!1,canvas:it(t.canvas,"canvas")?t.canvas:null,embedFonts:t.embedFonts??"auto",iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],__iconMatchers:ds(t.iconFonts),localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],fallbackURL:t.fallbackURL??void 0,cache:i,__styleShare:t.__styleShare,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:n,__explicitFormat:r,type:n,quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(n)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,reconcile:t.reconcile??!1,burst:t.burst,fast:t.fast===!1||t.fast==="auto"?t.fast:!0,engine:t.engine,invalidate:t.invalidate??!1,__pinned:t.__pinned===!0,clip:t.clip??null,compress:t.compress!==!1,excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1};return l}mt();oe();wt();var Ca="svg,iframe,canvas,video,audio,object,embed,slot,template,picture,style,pre";function td(t){try{return t.matches?.("dialog,[popover]")||!!t.querySelector?.("dialog,[popover]")}catch{return!0}}var ed=/(?:^|;)\s*(?:-webkit-)?backdrop-filter:\s*(?!none(?:\s*!important)?(?:;|$))[^;]+/i;function nd(t){if(t.__usesBackdropFilter!==void 0)return t.__usesBackdropFilter;let e=!1;for(let n of t.styleMap.values())if(ed.test(n)){e=!0;break}return t.__usesBackdropFilter=e,e}function rd(t,e){let n=e.has("backdrop-filter")||e.has("-webkit-backdrop-filter");if(!n&&(n=(o=>/(?:^|;)\s*(?:-webkit-)?backdrop-filter\s*:/i.test(o.getAttribute?.("style")||""))(t),!n))try{n=!!t.querySelector?.('[style*="backdrop-filter" i]')}catch{n=!0}if(!n)return!1;let r=[t];t.querySelectorAll&&r.push(...t.querySelectorAll("*"));for(let i of r){let o=getComputedStyle(i),s=o.getPropertyValue("backdrop-filter")||o.getPropertyValue("-webkit-backdrop-filter");if(s&&s!=="none")return!0}return!1}var ka=new WeakMap;function od(t){let e=Wt(),n=ka.get(t);if(n&&n.epoch===e)return n.leaky;let r=!1,i={budget:2e4},o=s=>{for(let a=0;a<s.length&&!r;a++){if(--i.budget<0){r=!0;return}let c=s[a],u=c.selectorText;if(u&&/[+~]|:has\(/.test(u)){r=!0;return}let l=c.style;if(l&&(l.counterReset||l.counterIncrement||l.counterSet||l.content&&l.content.includes("counter"))){r=!0;return}c.cssRules&&c.cssRules.length&&o(c.cssRules)}};try{for(let s of t.styleSheets){let a=null;try{a=s.cssRules}catch{r=!0}if(r)break;a&&o(a)}if(!r){let s=t.adoptedStyleSheets;if(Array.isArray(s))for(let a of s){if(r)break;try{o(a.cssRules)}catch{r=!0}}}}catch{r=!0}return ka.set(t,{epoch:e,leaky:r}),r}var id=1/16;function sd(t,e){if(t===e)return!0;if(!t.endsWith("px")||!e.endsWith("px"))return!1;let n=parseFloat(t),r=parseFloat(e);return Number.isFinite(n)&&Number.isFinite(r)&&Math.abs(n-r)<=id}var sr=new Map,ad=["width","height","min-width","min-height"];function cd(t){let e=sr.get(t);if(e===void 0){e=null;for(let n of ad){let r=t.match(new RegExp("(?:^|;)"+n+":([^;]+)"));r&&r[1].endsWith("px")&&((e||(e={}))[n]=r[1])}sr.size>5e3&&sr.clear(),sr.set(t,e)}return e}function ld(t){if(!(!t.classList||!t.classList.length))for(let e of Array.from(t.classList))/^c\d+$/.test(e)&&t.classList.remove(e)}function fd(t,e){let n=[t];for(;n.length;){let r=n.pop();if(r.nodeType===1){let i=e.nodeMap.get(r);i!==void 0&&(e.nodeMap.delete(r),e.srcToClone.get(i)===r&&e.srcToClone.delete(i)),e.styleMap.delete(r)}for(let i=r.firstChild;i;i=i.nextSibling)n.push(i)}}var _o={attempts:0,served:0,reconciled:0};async function Ma(t,e,n){_o.attempts++;try{let r=await ud(t,e,n);return r&&_o.served++,r}catch{return null}}async function ud(t,e,n){let r=e.retained;if(!r||!r.clone||!r.styleMap||!r.srcToClone||n.reconcile||n.clip||n.captureSelection||r.clipWindow||t.scrollTop||t.scrollLeft||td(t)||nd(r)||r.fontsCSS||Zn(n))return null;for(let f of n.plugins||[])if(f&&(typeof f.beforeSnap=="function"||typeof f.beforeClone=="function"||typeof f.resolveNode=="function"||typeof f.afterClone=="function"))return null;if(r.classPrefixCSS&&(r.classPrefixCSS.includes("::marker")||r.classPrefixCSS.includes("::first-line"))||n.excludeMode==="remove")return null;let i=t.ownerDocument||document,o=rn(t);if(!o||od(i))return null;let s=[];t:for(let f of e.dirtyRoots){if(!f.isConnected||f===t||!t.contains(f))return null;for(let d of e.dirtyRoots)if(d!==f&&d!==t&&d.contains(f))continue t;s.push(f)}if(!s.length)return null;n.__compressedAssets=r.__compressedAssets,n.__compressionDensity=r.__compressionDensity,n.__compressionRootTransform=r.rootTransform2D;for(let f of s){if(f.parentElement===t||f.matches?.(Ca)||f.querySelector?.(Ca)||rd(f,o))return null;let d=r.srcToClone.get(f);if(!d||!d.parentNode)return null;let h=new Map,m={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:h,options:n},p=Kn(f,null),g=Un(f),y;try{y=await Jt(f,m,n)}finally{g(),p()}if(!y||y.nodeType!==1||y.querySelector?.("style[data-sd]")||(await Ie(f,y,m,n),m.__pseudoCSS)||m.__usesPlaceholder&&!r.classPrefixCSS?.includes("[data-sd-ph]"))return null;await En(y,m),Hn(y);try{await $n(y,f,h)}catch{}if(await Promise.all([Vn(y,n),Gn(f,y,r.styleCache,n,h)]),n.compress)try{await or(y,n,h)}catch{}for(let[b,w]of h.entries())vo(b,w,h,r.styleCache);d.replaceWith(y),fd(d,r);for(let[b,w]of h.entries())r.nodeMap.set(b,w),r.srcToClone.set(w,b)}let a={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:n};for(let[f,d]of r.nodeMap.entries()){if(!d||d.nodeType!==1||!d.isConnected)continue;let h=r.styleMap.get(f);if(!h)continue;let m=cd(h);if(!m)continue;let p=null,g=!1;for(let y in m)if(p||(p=getComputedStyle(d)),!sd(p.getPropertyValue(y),m[y])){g=!0;break}if(g){if(n.__compressedAssets?.has(f))return null;_o.reconciled++,await dt(d,f,a,n)}}let c=Ke(r.styleMap);for(let[f,d]of r.styleMap.entries())ld(f),xo(f,d,c);let u=(r.classPrefixCSS||"")+Array.from(c.entries()).map(([f,d])=>`.${d}{${f}}`).join("");rr(r.clone,n.__compressedAssets);let l=await ir({element:t,options:n,plugins:n.plugins,clone:r.clone,classCSS:u,styleCache:r.styleCache,nodeMap:r.nodeMap},{clipWindow:null,outerTransforms:r.outerTransforms,outerShadows:r.outerShadows,rootTransform2D:r.rootTransform2D,fontsCSS:r.fontsCSS||""});return n.__compressedSnapshot=nr(r.clone,n.__compressedAssets),r.__compressedAssets=n.__compressedAssets,r.__compressionDensity=n.__compressionDensity,l}Ct();var Ro=new WeakMap,cr=new WeakMap,Ia=new WeakSet,Eo=new WeakMap,dd=64,dn=new Map,Oa=["scroll","input","change","focusin","focusout","pointerdown","pointerup","pointercancel","keydown","keyup","beforetoggle","toggle"],pd=["(prefers-color-scheme: dark)","(prefers-reduced-motion: reduce)","(prefers-contrast: more)","(forced-colors: active)","(inverted-colors: inverted)","(prefers-reduced-transparency: reduce)","(hover: hover)","(any-hover: hover)","(pointer: coarse)","(any-pointer: coarse)","(color-gamut: p3)","(dynamic-range: high)"];function hd(t){let e=t?.defaultView;return typeof e?.matchMedia!="function"?"":pd.map(n=>{try{return e.matchMedia(n).matches?"1":"0"}catch{return"?"}}).join("")}function Aa(t){let e=[];for(let n=t;n;){try{let r=n.getBoundingClientRect();e.push(r.x,r.y,r.width,r.height)}catch{e.push("?")}n.parentElement?n=n.parentElement:n=n.getRootNode?.()?.host||null}return e.join("|")}function _a(t,e){if(e.disposed||(dn.delete(t),dn.set(t,e),dn.size<=dd))return;let[n,r]=dn.entries().next().value;Da(n,r)}function Da(t,e){e.disposed=!0,dn.delete(t),Ro.delete(t);for(let n of e.observers)try{n.disconnect()}catch{}for(let n of Oa)t.removeEventListener(n,e.onMediaDirty,!0);for(let n of e.trackedShadowRoots.keys())for(let r of To)n.removeEventListener(r,e.onMediaDirty,!0);for(let[n,r]of e.trackedImages)n.removeEventListener("load",r),n.removeEventListener("error",r);e.trackedImages.clear(),e.trackedShadowRoots.clear(),e.images.length=0,e.controls.length=0,e.scrollNodes.length=0,e.observers.length=0,e.last=null,e.retained=null,e.retainedFrameDriven=!1}function Wa(t){if(Ia.has(t))return!1;cr.delete(t);let e=[t],n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i],s=[];o?.nodeType===1&&s.push(o);try{s.push(...o.querySelectorAll("*"))}catch{return!1}for(let a of s){a.shadowRoot&&e.push(a.shadowRoot);let c=String(a.localName||a.tagName||"").toLowerCase();if(/^(?:iframe|canvas|video|audio|object|embed|marquee|blink)$/.test(c)||c==="progress"&&!a.hasAttribute("value")||/^(?:animate|animatetransform|animatemotion|set)$/.test(c))return!1;let u="";if(c==="img"){r.push(a);try{u=a.currentSrc||a.src||""}catch{}}/^(?:input|textarea|select|option)$/.test(c)&&n.push(a);let l=a.getAttribute?.("style")||"",f=Eo.get(a);if(u||l){if((!f||f.src!==u||f.style!==l)&&(f={src:u,style:l,animated:ze(u)||ze(l)},Eo.set(a,f)),f.animated)return!1}else f&&Eo.delete(a)}}return cr.set(t,{roots:e.slice(1),controls:n,images:r}),!0}function Fo(t,e){if(!t.querySelectorAll)return!1;let n=cr.get(t);cr.delete(t);let r=new Set(n?.roots||[]);if(n&&(e.controls=n.controls,e.scannedImages=n.images),!n){let i=[t];for(let o=0;o<i.length;o++){let s=i[o];s.shadowRoot&&!r.has(s.shadowRoot)&&(r.add(s.shadowRoot),i.push(s.shadowRoot));for(let a of s.querySelectorAll("*"))a.shadowRoot&&!r.has(a.shadowRoot)&&(r.add(a.shadowRoot),i.push(a.shadowRoot))}}for(let[i,o]of e.trackedShadowRoots)if(!r.has(i)){try{o.disconnect()}catch{}for(let a of To)i.removeEventListener(a,e.onMediaDirty,!0);e.trackedShadowRoots.delete(i);let s=e.observers.indexOf(o);s>=0&&e.observers.splice(s,1)}for(let i of r)if(!e.trackedShadowRoots.has(i))try{let o=new MutationObserver(e.markDirty);o.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),o.__flush=e.markDirty,e.observers.push(o),e.trackedShadowRoots.set(i,o);for(let s of To)i.addEventListener(s,e.onMediaDirty,{capture:!0,passive:!0});e.retained&&e.dirtyAll()}catch{}return!!n}var To=["scroll","change","beforetoggle","toggle"];function lr(t,e){return[t,...e.trackedShadowRoots.keys()]}function Po(t,e){let n=e.scannedImages;if(e.scannedImages=null,!n){n=[],t.tagName==="IMG"&&n.push(t);for(let r of lr(t,e))r.querySelectorAll&&n.push(...r.querySelectorAll("img"))}if(e.images=n,e.trackedImages.size){let r=new Set(n);for(let[i,o]of e.trackedImages)r.has(i)||(i.removeEventListener("load",o),i.removeEventListener("error",o),e.trackedImages.delete(i))}for(let r of n){if(r.complete||e.trackedImages.has(r))continue;let i=()=>{e.capturing&&(e.torn=!0),e.dirty=!0,e.dirtyRoots=null,r.removeEventListener("load",i),r.removeEventListener("error",i),e.trackedImages.delete(r)};e.trackedImages.set(r,i),r.addEventListener("load",i),r.addEventListener("error",i)}}function Ea(t){let e=new Map,n=new Map,r=new Map;for(let i of t)if(ae(i))if(i.type==="attributes"){let o=e.get(i.target);o||e.set(i.target,o=new Map),o.has(i.attributeName)||o.set(i.attributeName,i.oldValue)}else if(i.type==="characterData")n.has(i.target)||n.set(i.target,i.oldValue);else if(i.type==="childList"){let o=r.get(i.target);o||r.set(i.target,o=new Map);for(let s of i.addedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)+1)}for(let s of i.removedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)-1)}}else return!0;for(let[i,o]of e)for(let[s,a]of o)if(i.getAttribute(s)!==a)return!0;for(let[i,o]of n)if(i.data!==o)return!0;for(let i of r.values())for(let o of i.values())if(o!==0)return!0;return!1}var md=/(?:^data:image\/(?:gif|apng)|\.(?:gif|apng)(?=[?#)'"\s;]|$))/i,Ue=t=>t&&(typeof t=="object"||typeof t=="function")?ar(t):"-";function gd(t,e=131072){if(t=String(t||"").trim(),!/^data:/i.test(t))return"";let n=t.indexOf(",");if(n<0)return"";let r=t.slice(0,n),i=t.slice(n+1);try{if(/;base64/i.test(r)){let o=Math.ceil(e/3)*4;return atob(i.slice(0,o-o%4))}return i.slice(0,e*3).replace(/%([0-9a-f]{2})/gi,(o,s)=>String.fromCharCode(parseInt(s,16))).slice(0,e)}catch{return""}}function yd(t){let e=(t.match(/^data:([^;,]+)/i)?.[1]||"").toLowerCase();if(e==="image/gif"||e==="image/apng")return!0;if(!/image\/(?:png|webp|avif|svg\+xml)/.test(e))return!1;let n=gd(t);return e==="image/png"?n.includes("acTL"):e==="image/webp"?n.includes("ANIM")||n.includes("ANMF")||n.includes("VP8X")&&!!(n.charCodeAt(n.indexOf("VP8X")+8)&2):e==="image/avif"?n.includes("avis"):/<(?:animate|animateTransform|animateMotion|set)\b|@keyframes\b|animation(?:-name)?\s*:/i.test(n)}function Ra(t){let e=String(t||"").trim();return e?md.test(e)?!0:/^data:/i.test(e)?yd(e):!1:!1}function ze(t){let e=String(t||"");if(Ra(e))return!0;for(let n of e.matchAll(/url\(\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^)]*))\s*\)/gi))if(Ra(n[1]??n[2]??n[3]))return!0;return!1}function Fa(t,e=null){let n=t&&t.clone;if(!n)return!1;let r=e?e.map(i=>t.srcToClone?.get(i)).filter(Boolean):[n];for(let i of r)for(let o of Ba(i))if(ze(o.getAttribute?.("src"))||ze(o.getAttribute?.("href"))||ze(o.getAttribute?.("style"))||ze(t.styleMap?.get(o)))return!0;return!1}function Ba(t){let e=[];t&&t.nodeType===1&&e.push(t);try{e.push(...t.querySelectorAll("*"))}catch{}return e}function $o(t,e){let n=[],r=new Set,i=o=>{o&&!r.has(o)&&(r.add(o),n.push(o))};t.matches?.("input,textarea,select,option")&&i(t);for(let o of lr(t,e))try{for(let s of o.querySelectorAll("input,textarea,select,option"))i(s)}catch{}e.controls=n}function No(t,e){let n=[],r=new Set,i=(o,s=!1)=>{if(!(!o||r.has(o))){r.add(o);try{(s||o.scrollLeft||o.scrollTop||o.scrollWidth>o.clientWidth||o.scrollHeight>o.clientHeight)&&n.push(o)}catch{}}};for(let o=t;o;o=o.parentElement)i(o,!0);for(let o of lr(t,e))for(let s of Ba(o))i(s);e.scrollNodes=n}function Ta(t,e){let n=t.ownerDocument||document,r=n.defaultView,i=[r?.location?.hash||"",hd(n),r?.innerWidth||0,r?.innerHeight||0,r?.devicePixelRatio||1,r?.screen?.orientation?.type||""];try{i.push(...[...n.adoptedStyleSheets||[]].map(Ue))}catch{}for(let l of e.trackedShadowRoots.keys())try{i.push("#shadow",...[...l.adoptedStyleSheets||[]].map(Ue))}catch{}let o=n.activeElement,s=n.fullscreenElement;(o?.contains(t)||t.contains(o))&&i.push(Ue(o)),(s?.contains(t)||t.contains(s))&&i.push(Ue(s));let a=[r?.scrollX||0,r?.scrollY||0];for(let l of e.scrollNodes)a.push(l.scrollLeft||0,l.scrollTop||0);let c=[];for(let l of e.controls){let f=String(l.localName||"").toLowerCase();f==="input"?c.push(l.type,Xe(l)?l.value.length:l.value,l.checked?1:0,l.indeterminate?1:0):f==="textarea"?c.push(l.value):f==="select"?c.push(l.selectedIndex,l.value):c.push(l.selected?1:0)}let u=[];for(let l of e.images){let f="";try{f=l.currentSrc||l.src||""}catch{}u.push(f,l.complete?1:0,l.naturalWidth||0,l.naturalHeight||0)}return{style:i.join("|"),scroll:a.join("|"),controls:c,images:u,frameDriven:e.retainedFrameDriven}}function Be(t,e,n){if(!t)return!1;let r=t[n],i=e[n];if(r===i)return!0;if(!Array.isArray(r)||r.length!==i.length)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}function Pa(t,e){let n=new Set;for(let r of lr(t,e))try{let i=r.getAnimations?.(r.nodeType===1?{subtree:!0}:void 0)||[];for(let o of i)n.add(o)}catch{}return[...n]}function $a(t){return t.map(e=>[Ue(e),e.playState,Math.round((Number(e.currentTime)||0)*10),e.playbackRate].join(":")).join("|")}function bd(t,e,n){if(!n||n.nodeType!==1)return null;if(n===t||t.contains(n))return t;for(let r of e.trackedShadowRoots.keys())if(r.contains(n))return r;return null}function wd(t){let e={dirty:!0,pending:[],torn:!1,dirtyRoots:new Set,retained:null,retainedFrameDriven:!1,disposed:!1,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedShadowRoots:new Map,trackedImages:new Map,images:[],scannedImages:null,scrollNodes:[],controls:[],envEpoch:_e(),styleEpoch:Wt(),styleStamp:nn(t),outsideMutations:en(t),geometry:null,renderState:null},n=()=>{e.dirty=!0,e.dirtyRoots=null},r=a=>{if(!e.dirtyRoots)return;let c=a&&(a.nodeType===1?a:a.parentElement);if(!c||c===t||!t.contains(c)||e.dirtyRoots.size>=12){e.dirtyRoots=null;return}e.dirtyRoots.add(c)},i=a=>{if(e.capturing){for(let c of a)e.pending.push(c);return}for(let c of a)ae(c)&&(e.dirty=!0,r(c.target))},o=()=>{if(e.capturing){e.torn=!0;return}n()};e.dirtyAll=n;try{let a=new MutationObserver(i);a.observe(t,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),a.__flush=i,e.observers.push(a)}catch{}e.markDirty=i,e.onMediaDirty=o;try{for(let a of Oa)t.addEventListener(a,o,{capture:!0,passive:!0})}catch{}return Fo(t,e)||$o(t,e),No(t,e),Po(t,e),e}var Sd=0,Na=new WeakMap;function ar(t){let e=Na.get(t);return e||(e="@"+ ++Sd,Na.set(t,e)),e}function Lo(t,e){let n=typeof t;if(n==="undefined")return null;if(t===null||n==="boolean"||n==="number"||n==="string")return JSON.stringify(t);if(n==="function"||n==="symbol")return n==="symbol"?null:JSON.stringify(ar(t));if(n!=="object")return null;if(typeof t.nodeType=="number")return JSON.stringify(ar(t));if(e.has(t))return null;e.add(t);try{if(Array.isArray(t)){let o=[];for(let s of t){let a=Lo(s,e);if(a===null)return null;o.push(a)}return"["+o.join(",")+"]"}let r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)return JSON.stringify(ar(t));let i=[];for(let o of Object.keys(t).sort()){let s=t[o];if(s===void 0)continue;let a=Lo(s,e);if(a===null)return null;i.push(JSON.stringify(o)+":"+a)}return"{"+i.join(",")+"}"}finally{e.delete(t)}}function La(t,e){let{burst:n,invalidate:r,...i}=t||{};try{let o=Lo(i,new Set);return o===null?null:`${(e||[]).map(Ue).join(",")}:${o}`}catch{return null}}function Ua(t,e,n,r,i=null){let o=Ro.get(t);o||(o=wd(t),o.baselineSignature=La(e,n.plugins),Ro.set(t,o));let s=La(e,n.plugins),a=async()=>{if(o.disposed)return r();let u=s===null||s!==o.baselineSignature;u&&s!==null?o.pendingSig===s?(o.baselineSignature=s,o.last=null,o.dirty=!0,o.dirtyRoots=null,o.pendingSig=null,u=!1):o.pendingSig=s:o.pendingSig=null,Fo(t,o),Po(t,o);for(let M of o.observers)M.__flush(M.takeRecords());Tt();let l=en(t);o.dirty&&o.outsideMutations!==l&&o.dirtyAll(),o.outsideMutations=l;let f=t.getRootNode?.(),d=[...o.trackedShadowRoots.keys()];f?.nodeType===11&&!d.includes(f)&&d.push(f),Mn(t.ownerDocument||document,d);let h=nn(t);o.styleStamp!==h&&(o.styleStamp=h,o.dirty||o.dirtyAll());let m=Ta(t,o),p=Pa(t,o);m.animation=$a(p),o.renderState&&(!Be(o.renderState,m,"style")&&(Ee(),o.dirtyAll()),Be(o.renderState,m,"scroll")||o.dirtyAll(),Be(o.renderState,m,"controls")||(ce(t),o.dirtyAll()),!Be(o.renderState,m,"images")&&!o.dirty&&o.dirtyAll());let g=_e();o.envEpoch!==g&&(o.dirtyAll(),o.envEpoch=g);let y=Wt();if(o.styleEpoch!==y&&(o.styleEpoch=y,!o.dirty)){let M=Aa(t);o.geometry!==null&&M!==o.geometry&&(ce(t),o.dirtyAll()),o.geometry=M}n.invalidate&&o.dirtyAll();let b=!1,w=!!o.renderState&&!Be(o.renderState,m,"animation");try{let M=new Set;w&&p.length===0&&(M=null);for(let _ of p){let E=_.playState==="running";if(!E&&!w)continue;E&&(b=!0),w=!0;let x=_.effect?.target;if(bd(t,o,x)===t)M.add(x);else{M=null;break}}if(w&&M&&M.size&&o.retained){o.dirty=!0;for(let _ of M)o.dirtyRoots&&o.dirtyRoots.add(_),ce(_)}else w&&!M&&o.dirtyAll()}catch{}let v=m.frameDriven,C=b||v;if(C&&(o.last=null),v&&o.dirtyAll(),!u&&!C&&!o.dirty&&o.last)return _a(t,o),o.last;o.capturing=!0;let S=null;try{let M=null,_=!1,E=null;if(!u&&o.dirty&&o.retained&&o.dirtyRoots&&o.dirtyRoots.size&&i){E=[...o.dirtyRoots];let x=await Ma(t,o,n);x&&(M=await i(x),_=!0)}if(M||(u||(n.__retain=x=>{let k=new Map;for(let[R,T]of x.nodeMap.entries())k.set(T,R);S={...x,srcToClone:k}}),n.__tornSinceStart=()=>{for(let x of o.observers)for(let k of x.takeRecords())o.pending.push(k);return Tt(),o.torn||Ea(o.pending)||en(t)!==l},M=await r()),!u&&!o.disposed){o.dirty=!1,o.dirtyRoots=new Set,S?(o.retained=S,o.retainedFrameDriven=Fa(S),$o(t,o),No(t,o)):_&&(o.retainedFrameDriven||(o.retainedFrameDriven=Fa(o.retained,E)),$o(t,o),No(t,o));let x=Ta(t,o);x.animation=$a(Pa(t,o));let k=["style","scroll","controls","images"];b||k.push("animation");let R=k.every(T=>Be(m,x,T));o.renderState=x,o.styleEpoch=Wt(),o.styleStamp=nn(t),o.geometry=Aa(t),o.renderState.frameDriven?(Ia.add(t),Da(t,o)):R?!C&&!o.renderState.frameDriven&&(o.last=M,_a(t,o)):(o.dirtyAll(),o.last=null)}return M}finally{n.__retain=void 0,n.__tornSinceStart=void 0;for(let _ of o.observers)for(let E of _.takeRecords())o.pending.push(E);Tt();let M=en(t);(o.torn||Ea(o.pending)||M!==l)&&(o.dirtyAll(),o.last=null),o.outsideMutations=M,o.styleEpoch=Wt(),o.styleStamp=nn(t),o.pending.length=0,o.torn=!1,o.capturing=!1,o.disposed||(Fo(t,o),Po(t,o))}},c=o.inflight.then(a,a);return o.inflight=c.catch(()=>{}),c}var fr=null;function ja(t){fr=t}var xd='button, a[href], [role="button"], input, select, summary, label, [tabindex]',Io=!1,pn=null,Oo=new WeakMap,za=!1;function Va(t,e){!Io||!pn||e&&e.burst===!1||Oo.set(pn.control,{element:t,options:e&&typeof e=="object"?{...e}:e})}function qa(t){let e={control:t};pn=e,setTimeout(()=>{pn===e&&(pn=null)},0)}function Wo(t){let e=t.target,n=e&&(e.nodeType===1?e:e.parentElement);return n&&n.closest?n.closest(xd):null}function Ha(t){if(t.type==="keydown"&&t.key!=="Enter"&&t.key!==" ")return;let e=Wo(t);e&&(qa(e),Do(t,!1))}function vd(t){let e=Wo(t);e&&qa(e)}function Do(t,e=!0){if(!fr||document.visibilityState==="hidden")return;let n=Wo(t);if(!n||t.type==="pointerenter"&&t.target!==n)return;let r=Oo.get(n);if(r){if(!r.element.isConnected){Oo.delete(n);return}fr(r.element,r.options).catch(()=>{});return}e&&!za&&(za=!0,fr(document.body,{clip:"viewport",burst:!1}).catch(()=>{}))}function Ga(){if(Io||typeof document>"u"||typeof document.addEventListener!="function")return;Io=!0;let t={capture:!0,passive:!0};document.addEventListener("pointerdown",Ha,t),document.addEventListener("keydown",Ha,t),document.addEventListener("click",vd,t),document.addEventListener("pointerenter",Do,t),document.addEventListener("focusin",Do,t)}kt();function Ud(...t){return ca(...t),K}async function zd(t,e){if(typeof t!="string"||!t.trim())throw new Error("[SnapDOM] fromString() needs an HTML string.");let n=document.createElement("div");Z(n),n.style.cssText="position:fixed;left:-99999px;top:0;pointer-events:none;",n.innerHTML=t,document.body.appendChild(n);try{await yt();let r=Array.from(n.childNodes).some(o=>o.nodeType===3&&o.textContent.trim()),i=n.children.length===1&&!r?n.firstElementChild:n;return await Qo(i,{...e||{},burst:!1})}finally{n.remove()}}var Hd="3.3.1-dev.0",K=Object.assign(Qo,{plugins:Ud,fromString:zd,version:Hd,preCapture:Ga});ja(Qo);var Ko=Symbol("snapdom.internal"),jd=Symbol("snapdom.internal.silent"),sc=new Set(["png","jpeg","jpg","webp","svg"]);async function Qo(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");let n=va(e);n.element=t,n.invalidate&&Ee(),fa(n,e&&e.plugins);let{stage:r,loweredBy:i}=sa(n);n.needs=r,n.__needsLoweredBy=i;let o=We(r,"render"),s=n.burst===!0||!Zn(n),a=typeof n.filter=="function"||!!n.excludePredicates||typeof n.excludeStyleProps=="function"||typeof n.fallbackURL=="function",u=o&&!n.captureSelection&&n.burst!==!1&&s&&!a&&Wa(t);return u&&Va(t,e),n.snap||(n.snap={toPng:(l,f)=>K.toPng(l,f),toSvg:(l,f)=>K.toSvg(l,f)}),u?Ua(t,e,n,()=>K.capture(t,n,Ko),l=>ac(l,n)):K.capture(t,n,Ko)}K.capture=async(t,e,n)=>{if(n!==Ko)throw new Error("[SnapDOM] snapdom.capture() is internal; use snapdom(el).");if(We(e.needs||_t,"render")&&X()){if(e.embedFonts)try{let o=t.ownerDocument||document,s=new Set;if(e.embedFonts==="auto"){try{for(let l of o.fonts)s.add(String(l.family).replace(/["']/g,"").toLowerCase())}catch{}if(s.size===0)throw null}let a=On(t);e.clip||(e.__fontUsage=a);let c=a.required,u=new Set([...c].map(l=>String(l).split("__")[0]).filter(Boolean));if(e.embedFonts==="auto"&&(u=new Set([...u].filter(l=>s.has(l.toLowerCase()))),u.size===0))throw null;await Dn(u,1,o)}catch{}let i=Array.from(t.querySelectorAll("canvas"));t.tagName==="CANVAS"&&i.unshift(t);for(let o of i)try{if(an(o))continue;let s=o.getContext("2d",{willReadFrequently:!0});s&&s.getImageData(0,0,1,1)}catch(s){H(e,"Couldn't prepare canvases for Safari.",s)}}let r=await xa(t,e);return ac(r,e)};async function ac(t,e){let n=e.needs||_t,r=We(n,"render"),i=A=>aa(n,e.__needsLoweredBy||[],A),o=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?t:null,s=o?null:t,a=()=>s??(s=o.toDataURL()),c=o||t;o&&(t="");let u=e.__compressedSnapshot,l=e.__compressionDensity;delete e.__compressedSnapshot,delete e.__compressedAssets;let f,d=e.meta||{},m=(Number.isFinite(e.width)||Number.isFinite(e.height))&&!X(),p=m?Number.isFinite(e.width)?d.targetW/d.vbW:d.targetH/d.vbH:1,g=m?Number.isFinite(e.height)?d.targetH/d.vbH:d.targetW/d.vbW:1,y=A=>{if(o||!u?.size)return c;let N=d.vbW,$=d.vbH,F=A.crop;F&&(N=Math.max(1,Math.min(N,F.x+F.width)-Math.max(0,F.x)),$=Math.max(1,Math.min($,F.y+F.height)-Math.max(0,F.y)));let z=Number.isFinite(A.width),q=Number.isFinite(A.height);return(z&&q?Math.max(A.width/N,A.height/$):z?A.width/N*(F?Math.max(1,g/p):1):q?A.height/$*(F?Math.max(1,p/g):1):(A.scale||1)*Math.max(p,g))*(A.dpr||1)<=l?c:f??(f=ya(a(),u))},b=async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn));return $(c,{...A,...N||{},format:"png"})},w=()=>{if(!r)throw i("svgString");if(o)throw new Error("[SnapDOM] html-in-canvas makes a raster capture; there is no SVG string.");let A=t.indexOf(",");return A>=0?decodeURIComponent(t.slice(A+1)):""},v=A=>Object.defineProperty({...A||{},svgString:w},"url",r?{get:a,enumerable:!0}:{get(){throw i("export.url")},enumerable:!1,configurable:!0}),C={img:async(A,N)=>{if(o)return b(A,N);let{toImg:$}=await Promise.resolve().then(()=>(qo(),Vo)),F={...A,...N||{}};return $(y(F),F)},svg:async(A,N)=>{if(o)return b(A,N);let{toSvg:$}=await Promise.resolve().then(()=>(qo(),Vo)),F={...A,...N||{}};return $(y(F),F)},canvas:async(A,N)=>{let{toCanvas:$}=await Promise.resolve().then(()=>(me(),Ja)),F={...A,...N||{}};return $(y(F),F)},blob:async(A,N)=>{let{toBlob:$}=await Promise.resolve().then(()=>(Yo(),nc)),F={...A,...N||{}};return $(y(F),F)},png:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn)),F={...A,...N||{},format:"png"};return $(y(F),F)},jpeg:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn)),F={...A,...N||{},format:"jpeg"};return $(y(F),F)},webp:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn)),F={...A,...N||{},format:"webp"};return $(y(F),F)},download:async(A,N)=>{let{download:$}=await Promise.resolve().then(()=>(ic(),oc)),F={...A,...N||{}};return $(y(F),F)}};if(!r)for(let A of Object.keys(C)){let N=A==="download"?"download()":`to${A.charAt(0).toUpperCase()}${A.slice(1)}()`;C[A]=async()=>{throw i(N)}}let S={};for(let A of["img","svg","canvas","blob","png","jpeg","webp"])S[A]=async N=>C[A](e,{...R(A,N||{}),[jd]:!0});S.jpg=S.jpeg;let M=A=>Object.defineProperty({...e,...A},"options",{value:e,configurable:!0}),_=M({artifacts:e.__artifacts||null,export:v(),exports:S}),E=await Jn("defineExports",_),x=Object.assign({},...E.filter(A=>A&&typeof A=="object").reverse()),k={...C,...x};k.jpeg&&!k.jpg&&(k.jpg=(A,N)=>k.jpeg(A,N));function R(A,N){let $=N||{},F={...e,...$},z=typeof $.type=="string"?$.type.toLowerCase():"",q=typeof $.format=="string"?$.format.toLowerCase():sc.has(z)?z:"";q&&(F.format=q==="jpg"?"jpeg":q),F.__explicitFormat=q?F.format:e.__explicitFormat??null,A==="blob"&&!F.__explicitFormat&&(F.format=o?"png":"svg"),F.type=F.format;let j=B=>B==="jpeg"||B==="jpg"||B==="webp";return[A,F.format,z].map(B=>typeof B=="string"?B.toLowerCase():"").find(j)&&(F.backgroundColor==null||F.backgroundColor==="transparent")&&(F.backgroundColor="#ffffff"),F.scale!==1&&(Number.isFinite(F.width)||Number.isFinite(F.height))&&H(F,"scale ignored: width/height already set the size."),F}let T=!1,L=Promise.resolve();async function W(A,N){let $=Object.freeze(N&&typeof N=="object"?{...N}:{}),F=async()=>{let q=k[A];if(!q)throw new Error(`[SnapDOM] Unknown export type: ${A}`);let j=R(A,$),J=M({artifacts:e.__artifacts||null,export:v({type:A,options:j,requestedOptions:$})}),B=j.format,ut=j.type;await Jn("beforeExport",J,{format:A,options:j});let xt=j.format!==B?j.format:j.type!==ut?j.type:"",at=typeof xt=="string"?xt.toLowerCase():"";sc.has(at)&&(j.format=at==="jpg"?"jpeg":at,j.type=j.format,j.__explicitFormat=j.format,/^(?:jpeg|webp)$/.test(j.format)&&(j.backgroundColor==null||j.backgroundColor==="transparent")&&(j.backgroundColor="#ffffff"));let st=await q(J,j);return await Jn("afterExport",J,{format:A,options:j,result:st}),T||(T=!0,await Bt("afterSnap",e)),st},z=L.then(F);return L=z.catch(()=>{}),z}let P={url:t,needs:n,warnings:e.__session&&e.__session.warnings||[],toRaw:()=>{if(!r)throw i("toRaw()");return a()},to:(A,N)=>W(A,N),toImg:A=>W("img",A),toSvg:A=>W("svg",A),toCanvas:A=>W("canvas",A),toBlob:A=>W("blob",A),toPng:A=>W("png",A),toJpg:A=>W("jpg",A),toWebp:A=>W("webp",A),download:A=>W("download",A)};r?o&&Object.defineProperty(P,"url",{get:a,enumerable:!0,configurable:!0}):Object.defineProperty(P,"url",{get(){throw i("url")},enumerable:!1,configurable:!0}),Object.defineProperty(P,"meta",r?{value:e.meta,enumerable:!0}:{get(){throw i("meta")},enumerable:!1,configurable:!0});for(let A of Object.keys(k)){let N="to"+A.charAt(0).toUpperCase()+A.slice(1);P[N]||(P[N]=$=>W(A,$))}return P}K.toRaw=(t,e)=>K(t,e).then(n=>n.toRaw());K.toImg=(t,e)=>K(t,e).then(n=>n.toImg());K.toSvg=(t,e)=>K(t,e).then(n=>n.toSvg());K.toCanvas=(t,e)=>K(t,e).then(n=>n.toCanvas());K.toBlob=(t,e)=>K(t,e).then(n=>n.toBlob());K.toPng=(t,e)=>K(t,{...e,format:"png"}).then(n=>n.toPng());K.toJpg=(t,e)=>K(t,{...e,format:"jpeg"}).then(n=>n.toJpg());K.toWebp=(t,e)=>K(t,{...e,format:"webp"}).then(n=>n.toWebp());K.download=(t,e)=>K(t,e).then(n=>n.download());typeof window<"u"&&(window.snapdom=K);})();
|
|
40
|
+
}`,Du=Math.max(1,Math.min(4,(typeof navigator<"u"&&navigator.hardwareConcurrency||2)-1)),Lt=null,Wu=0,Bu=0,ue=new Map;function Sa(){for(let t of ue.values())t(void 0);if(ue.clear(),Array.isArray(Lt))for(let t of Lt)try{t?.terminate()}catch{}Lt=!1}function Uu(){let t,e=null;try{t=URL.createObjectURL(new Blob([Ou],{type:"text/javascript"})),e=new Worker(t),e.onmessage=n=>{let r=ue.get(n.data.id);r&&(ue.delete(n.data.id),r(n.data.error?void 0:n.data.url??null))},e.onerror=Sa}catch{e=null}return t&&URL.revokeObjectURL(t),e}function zu(){if(Lt===!1)return!1;if(Lt===null){if(typeof Worker>"u"||typeof OffscreenCanvas>"u")return Lt=!1;Lt=[]}let t=Wu++%Du;if(!Lt[t]){let e=Uu();if(!e)return Sa(),!1;Lt[t]=e}return Lt[t]}var Hu=5e3;function ju(t,e,n,r,i){let o=zu();return o?new Promise(s=>{let a=++Bu,c=setTimeout(()=>{ue.delete(a),s(void 0)},Hu);ue.set(a,u=>{clearTimeout(c),s(u)});try{o.postMessage({id:a,dataURL:i?"":t,blob:i,srcLength:t.length,targetW:e,targetH:n,resFactor:wa,quality:ba,mime:r})}catch{clearTimeout(c),ue.delete(a),s(void 0)}}):Promise.resolve(void 0)}async function Mo(t,e,n,r){if(typeof t!="string"||!t.startsWith("data:image")||t.startsWith("data:image/svg"))return null;e=Math.ceil(e),n=Math.ceil(n);let i=t.length+":"+t.slice(0,64)+t.slice(-64)+":"+e+"x"+n,o=I.compress,s=o.get(i);if(s?.source===t)return s.result;let a=tr.get(i);if(a?.source===t&&a.cache===o)return a.promise;let c=(async()=>{let l=Pu(t),f=l==="image/jpeg"?"image/jpeg":l==="image/webp"?"image/webp":"image/png",d=Iu(t);if(d&&d.w>0&&d.h>0&&!ha(d.w,d.h,e,n))return null;if(t.length>=$u){let S=await ju(t,e,n,f,r);if(S!==void 0)return S}let h;try{h=await Tu(t)}catch{return null}let m=h.naturalWidth||h.width,p=h.naturalHeight||h.height;if(!m||!p)return null;let g=ha(m,p,e,n);if(!g)return null;let y=g*wa,b=Math.max(1,Math.round(m*y)),w=Math.max(1,Math.round(p*y)),v=document.createElement("canvas");v.width=b,v.height=w;let C=v.getContext("2d");if(!C)return null;C.imageSmoothingEnabled=!0,C.imageSmoothingQuality="high",C.drawImage(h,0,0,b,w);try{let S=v.toDataURL(f,ba);if(typeof S=="string"&&S.startsWith("data:image")&&S.length<t.length)return S}catch{}return null})(),u={source:t,promise:c,cache:o};tr.set(i,u);try{let l=await c;return Nu(o,i,t,l),l}finally{tr.get(i)===u&&tr.delete(i)}}async function Vu(t,e,n=new Map,r={}){if(!e.compress)return{count:0,before:0,after:0};let i=Array.from(t.querySelectorAll("img"));t.tagName==="IMG"&&i.unshift(t);let o=0,s=0,a=0,c=async l=>{let f=l.getAttribute("src")||"";if(!f.startsWith("data:image")||f.startsWith("data:image/svg"))return;let d=parseFloat(l.dataset.snapdomWidth)||parseFloat(l.style.width)||l.width||0,h=parseFloat(l.dataset.snapdomHeight)||parseFloat(l.style.height)||l.height||0;if(!d||!h)return;let m=r.value||(r.value=ko(t,e)),p=m.density*m.stretch(n.get(l)||l),g=await Mo(f,d*p,h*p,l.__snapdomBlob);g&&(o++,s+=f.length,a+=g.length,l.setAttribute("src",g),er(l,"attribute","src",f,g,e))},u=6;for(let l=0;l<i.length;l+=u)await Promise.allSettled(i.slice(l,l+u).map(c));return{count:o,before:s,after:a}}var qu=/^(cover|contain|(\d+(\.\d+)?%(\s+\d+(\.\d+)?%)?))$/;function Gu(t){let e=t.offsetWidth||t.getBoundingClientRect().width||0,n=t.offsetHeight||t.getBoundingClientRect().height||0;return{w:e,h:n}}async function Xu(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=[],o=[t,...t.querySelectorAll("*")];for(let u of o){let l=u.style&&u.style.backgroundImage;l&&l.includes("data:image")&&i.push(u)}let s=0,a=async u=>{let l=n.get(u);if(!l||!l.isConnected)return;let f;try{f=getComputedStyle(l)}catch{return}if((f.backgroundRepeat||"repeat").toLowerCase().split(",").some(_=>_.trim()!=="no-repeat"))return;let h=(u.style.backgroundSize||f.backgroundSize||"auto").toLowerCase();if(h.split(",").some(_=>!qu.test(_.trim())))return;let{w:m,h:p}=Gu(l);if(!m||!p)return;let g=Math.max(1,...(h.match(/\d+(?:\.\d+)?%/g)||[]).map(_=>parseFloat(_)/100)),y=r.value||(r.value=ko(t,e)),b=y.density*y.stretch(l)*g,w=m*b,v=p*b,C=u.style.backgroundImage,S=[...C.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],M=C;for(let _ of S){let E=_[2];if(E.startsWith("data:image/svg"))continue;let x=await Mo(E,w,v);x&&(M=M.split(E).join(x),s++)}M!==C&&(u.style.setProperty("background-image",M,u.style.getPropertyPriority("background-image")),er(u,"style","background-image",C,u.style.backgroundImage,e))},c=6;for(let u=0;u<i.length;u+=c)await Promise.allSettled(i.slice(u,u+c).map(a));return{count:s}}async function Yu(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=Array.from(t.querySelectorAll("image"));t.localName==="image"&&i.unshift(t);let o=0,s=async c=>{let u=c.getAttribute("href")||(typeof c.getAttributeNS=="function"?c.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!u||!u.startsWith("data:image")||u.startsWith("data:image/svg"))return;let l=c.getAttribute("width")||"",f=c.getAttribute("height")||"";if(l.includes("%")||f.includes("%"))return;let d=n.get(c),h=d?O(d):c.style,m=(v,C)=>{if(/^\d+(?:\.\d+)?px$/.test(h?.[v]||""))return parseFloat(h[v]);if(/^\d+(?:\.\d+)?(?:px)?$/.test(C.trim()))return parseFloat(C);try{return d?.[v]?.baseVal?.value||0}catch{return 0}},p=m("width",l),g=m("height",f);if(!p||!g)return;let y=r.value||(r.value=ko(t,e)),b=y.density*y.stretch(d||c),w=await Mo(u,p*b,g*b);w&&(c.setAttribute("href",w),er(c,"attribute","href",u,w,e),c.hasAttribute("xlink:href")&&(c.setAttributeNS(ma,"xlink:href",w),er(c,"attribute","xlink:href",u,w,e)),o++)},a=6;for(let c=0;c<i.length;c+=a)await Promise.allSettled(i.slice(c,c+a).map(s));return{count:o}}async function or(t,e,n){if(!e.compress)return;let r={};await Vu(t,e,n,r),await Xu(t,e,n,r),await Yu(t,e,n,r)}wt();gt();kt();function Ku(t,e){if(X())return t;let n=t.indexOf("</style>");if(n===-1)return t;let r=/<style\b[^>]*>[\s\S]*?<\/style>/g,i=[],o=n,s;for(r.lastIndex=n;s=r.exec(t);)i.push({text:t.slice(o,s.index),intern:!0}),i.push({text:s[0],intern:!1}),o=r.lastIndex;i.push({text:t.slice(o),intern:!0});let a=new Map,c=/ style="([^"]*)"/g,u;for(let y of i)if(y.intern)for(c.lastIndex=0;u=c.exec(y.text);)a.set(u[1],(a.get(u[1])||0)+1);let l=0;for(let[y,b]of a)b>1&&(l+=(b-1)*y.length);if(l<2048||t.includes(" data-sdi="))return t;let f=Qu(e,i.some(y=>!y.intern),t.includes("data-snapdom-asset"));if(f===null)return t;let d=new Map,h=0,m=[],p=(y,b)=>{if((a.get(b)||0)<2||f.has(b))return y;let w=d.get(b);return w===void 0&&(w="i"+(h++).toString(36),d.set(b,w),m.push(`[data-sdi="${w}"]{${b}}`)),` data-sdi="${w}"`},g="";for(let y of i)g+=y.intern?y.text.replace(c,p):y.text;return t.slice(0,n)+m.join("")+g}function Qu(t,e,n){let r=new Set;if(!e&&!n)return r;if(!t||t.querySelector("[data-sdi]"))return null;let i=c=>{let u=c.getAttribute("style");u&&r.add(u)};if(n&&t.querySelectorAll("[data-snapdom-asset][style]").forEach(i),e)try{let c=u=>{for(let l of u){if(l.type===CSSRule.IMPORT_RULE||l.type===CSSRule.NAMESPACE_RULE)throw new Error("External or namespaced CSS");if(l.selectorText){if(/\[\s*style\b|data-sdi|\[[^\]]*\\|&/i.test(l.selectorText))throw new Error("Attribute-dependent or nested CSS");t.querySelectorAll(l.selectorText).forEach(i)}l.cssRules&&c(l.cssRules)}};for(let u of[...t.querySelectorAll("style")].slice(1)){let l=u.textContent||"";if(/@import\b/i.test(l))return null;let f=new CSSStyleSheet;f.replaceSync(l),c(f.cssRules)}}catch{return null}let o=new Set,s=document.createElement("div"),a=new XMLSerializer;for(let c of r){s.setAttribute("style",c);let u=a.serializeToString(s).match(/ style="([^"]*)"/);u&&o.add(u[1])}return o}async function ir(t,e){let{clipWindow:n,outerTransforms:r,outerShadows:i,rootTransform2D:o,fontsCSS:s}=e,a=t.options;if(t!==a){let{options:Q,...et}=t;t=Object.assign(a,et),Object.defineProperty(t,"options",{value:t,configurable:!0})}let c,u;Qs(t,s),await Bt("beforeRender",t);let l=O(t.element),f=t.element.getBoundingClientRect(),d=Math.max(1,D(t.element.offsetWidth||parseFloat(l.width)||f.width||1)),h=Math.max(1,D(t.element.offsetHeight||parseFloat(l.height)||f.height||1)),m=t.element.ownerDocument||document;if(!n&&(t.element===m.body||t.element===m.documentElement)&&!t.__pinned){let Q=Math.max(t.element.scrollHeight||0,m.documentElement?.scrollHeight||0,m.body?.scrollHeight||0),et=Math.max(t.element.scrollWidth||0,m.documentElement?.scrollWidth||0,m.body?.scrollWidth||0);Q>0&&(h=Math.max(h,D(Q))),et>0&&(d=Math.max(d,D(et)));try{let tt=(t.scrollbarCSS||"").length+(t.baseCSS||"").length+(t.fontsCSS||"").length+(t.classCSS||"").length,rt=I.measureHints.get(t.element);if(rt&&rt.cssLen===tt&&rt.w0===d&&rt.docH===Q&&rt.docW===et)rt.csh>0&&(h=Math.max(h,D(rt.csh))),rt.csw>0&&(d=Math.max(d,D(rt.csw)));else{let ot=m.createElement("div");Z(ot),ot.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+d+"px!important;overflow:visible!important;visibility:hidden!important;";let ee=ot.attachShadow({mode:"open"}),ne=m.createElement("style");ne.textContent=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS,ee.appendChild(ne),ee.appendChild(t.clone.cloneNode(!0)),m.body.appendChild(ot);let qe=ot.scrollHeight,Vt=ot.scrollWidth;m.body.removeChild(ot),I.measureHints.set(t.element,{cssLen:tt,w0:d,docH:Q,docW:et,csh:qe,csw:Vt}),qe>0&&(h=Math.max(h,D(qe))),Vt>0&&(d=Math.max(d,D(Vt)))}}catch{}}if(t.options?.excludeMode==="remove"||typeof t.options?.filter=="function"&&t.options.filterMode==="remove"){let Q=So(t.element,t.options),et=1,tt=So(t.element,{}),rt=Math.max(2,h*.15);Number.isFinite(tt)&&tt>=h-rt&&Number.isFinite(Q)&&Q>0&&(h=Math.max(1,Math.min(h,D(Q+et))))}if(t.options?.reconcile)try{let Q=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS;Ks(t.element,t.clone,Q,t.nodeMap,d,h)}catch(Q){console.warn("[SnapDOM] reconcile couldn't run; captured without it.",Q)}let g=(Q,et=NaN)=>{let tt=typeof Q=="string"?parseFloat(Q):Q;return Number.isFinite(tt)?tt:et},y=g(t.options.width),b=g(t.options.height),w=n?D(n.width):d,v=n?D(n.height):h,C=w,S=v,M=Number.isFinite(y),_=Number.isFinite(b),E=v>0?w/v:1;M&&_?(C=Math.max(1,D(y)),S=Math.max(1,D(b))):M?(C=Math.max(1,D(y)),S=Math.max(1,D(C/(E||1)))):_&&(S=Math.max(1,D(b)),C=Math.max(1,D(S*(E||1))));let x=0,k=0,R=d,T=h;if(n){let Q=0,et=0;if(Ao(t.element)){let tt=null;if(!r&&o&&Number.isFinite(o.a))tt={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0};else{let rt=fe(t.element),ot=wo(l.transform&&l.transform!=="none"?l.transform:"",rt);ot&&ot.is2D&&(tt={a:ot.a,b:ot.b,c:ot.c,d:ot.d,e:0,f:0})}if(tt&&!(tt.a===1&&tt.b===0&&tt.c===0&&tt.d===1)){let{ox:rt,oy:ot}=ln(l,d,h),ee=Oe(d,h,tt,rt,ot);Q=ee.minX,et=ee.minY}}x=D(n.x+Q),k=D(n.y+et),R=D(x+n.width),T=D(k+n.height)}else if(!r&&o&&Number.isFinite(o.a)){let Q={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0},et=Oe(d,h,Q,0,0);x=D(et.minX),k=D(et.minY),R=D(et.maxX),T=D(et.maxY)}else if(r&&Ao(t.element)){let et=l.transform&&l.transform!=="none"?l.transform:"",tt=fe(t.element),rt=Zt({baseTransform:et,rotate:tt.rotate||"0deg",scale:tt.scale,translate:tt.translate,width:d,height:h}),{ox:ot,oy:ee}=ln(l,d,h),ne=rt.is2D?rt:new DOMMatrix(rt.toString()),qe={a:ne.a,b:ne.b,c:ne.c,d:ne.d,e:0,f:0},Vt=Oe(d,h,qe,ot,ee);x=D(Vt.minX),k=D(Vt.minY),R=D(Vt.maxX),T=D(Vt.maxY)}let L=uo(l),W=po(l),P=ho(l),A=mo(l),N=go(l),$=f.width>0?(R-x)/f.width:1,F=f.height>0?(T-k)/f.height:1,z=i==="subtree"&&!n?Ds(t.element,t.nodeMap,t.styleCache,$,F):{top:0,right:0,bottom:0,left:0},q=n?{top:0,right:0,bottom:0,left:0}:i?{top:D(Math.max(L.top,W.top,z.top)+P.top+A.top+N.bleed.top),right:D(Math.max(L.right,W.right,z.right)+P.right+A.right+N.bleed.right),bottom:D(Math.max(L.bottom,W.bottom,z.bottom)+P.bottom+A.bottom+N.bleed.bottom),left:D(Math.max(L.left,W.left,z.left)+P.left+A.left+N.bleed.left)}:{top:P.top,right:P.right,bottom:P.bottom,left:P.left};x=D(x-q.left),k=D(k-q.top),R=D(R+q.right),T=D(T+q.bottom);let j=Math.max(1,D(R-x)),J=Math.max(1,D(T-k)),B="http://www.w3.org/2000/svg",ut=Ao(t.element)?2:0,at=D(ut+(r?0:1)),st=Math.ceil(j+at*2),nt=Math.ceil(J+at*2),pt=D(-(D(x)-at)),zt=D(-(D(k)-at)),ge=Math.max(0,pt),V=Math.max(0,zt),G=D(st-Math.min(0,pt)),U=D(nt-Math.min(0,zt)),ht=m.defaultView||window,Y=!X()&&CSS.supports("zoom","2")&&ht.devicePixelRatio||1;a.__layoutZoom=Y;let vt=document.createElementNS(B,"foreignObject");vt.setAttribute("x",String(Math.min(0,pt)*Y)),vt.setAttribute("y",String(Math.min(0,zt)*Y)),vt.setAttribute("width",String(G*Y)),vt.setAttribute("height",String(U*Y)),vt.style.overflow="visible";let ye=document.createElement("style"),gn="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";ye.textContent=(t.scrollbarCSS||"")+t.baseCSS+t.fontsCSS+gn+t.classCSS,vt.appendChild(ye);let je=document.createElement("div");je.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),je.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${G}px;height:${U}px`+(ge!==0||V!==0?`;padding:${V}px 0 0 ${ge}px !important`:"")+(Y!==1?`;zoom:${Y} !important`:""),je.appendChild(t.clone),vt.appendChild(je);let wr=new XMLSerializer().serializeToString(vt),Ht=M||_,Sr=Object.freeze({w0:w,h0:v,vbW:st,vbH:nt,targetW:C,targetH:S,contentX:D(pt+(n?x:0)),contentY:D(zt+(n?k:0)),clip:n?Object.freeze({x:D(x),y:D(k),width:w,height:v}):null});Object.defineProperty(a,"meta",{value:Sr,enumerable:!0,writable:!1,configurable:!0});let xr=!Ht||X()?st:M?C:D(st*(S/nt)),yn=!Ht||X()?nt:_?S:D(nt*(C/st)),jt=parseFloat(O(m.documentElement)?.fontSize)||16,Jo=Y!==1,cc=`<svg xmlns="${B}" width="${xr}" height="${yn}" viewBox="0 0 ${st} ${nt}" font-size="${jt}px">${Jo?`<g transform="scale(${1/Y})">`:""}`,lc=Jo?"</g></svg>":"</svg>";u=cc+Ku(wr,vt)+lc,c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`,t.svgString=u,t.dataURL=c,a.__artifacts={classCSS:t.classCSS||"",fontsCSS:t.fontsCSS||"",baseCSS:t.baseCSS||"",scrollbarCSS:t.scrollbarCSS||""},await Bt("afterRender",t),t.clone=t.nodeMap=t.styleCache=t.svgString=null;let vr=[...document.querySelectorAll("#snapdom-sandbox")].find(Gt);return vr&&vr.style.position==="absolute"&&vr.remove(),t.dataURL}function Ao(t){return Bs(t)}function Ju(t){let e=Array.isArray(t.plugins)?t.plugins:ua(),n=[];for(let r of e){let i=un(r);i&&typeof i.resolveNode=="function"&&n.push(i.resolveNode.bind(i))}return n.length?n:null}async function xa(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");e.__session=Co(e.cache),delete e.__compressedAssets,delete e.__compressedSnapshot,delete e.__compressionDensity,e.__resolveNodeHooks=Ju(e);let n=e;n.element=t,Object.defineProperty(n,"options",{value:n,configurable:!0});let r,i,o,s,a,c,u,l="",f=null,d=e.needs||_t,h=n.format,m=n.type;await Bt("beforeSnap",n);let p=n.format!==h&&/^(?:png|jpe?g|webp|svg)$/i.test(n.format),g=n.type!==m&&/^(?:png|jpe?g|webp|svg)$/i.test(n.type);if(p||g){let R=String(p?n.format:n.type).toLowerCase();n.format=R==="jpg"?"jpeg":R,n.type=n.format,n.__explicitFormat=n.format,/^(?:jpeg|webp)$/.test(n.format)&&(n.backgroundColor==null||n.backgroundColor==="transparent")&&(n.backgroundColor="#ffffff")}await Bt("beforeClone",n);let y=n.outerTransforms!==!1,b=n.outerShadows==="subtree"?"subtree":!!n.outerShadows,w=n.clip?zn(n.element,n.clip):null;if(e.__styleShare===void 0)try{e.__styleShare=Ti(n.element)&&(typeof n.element.getAnimations!="function"||n.element.getAnimations({subtree:!0}).length===0)}catch{e.__styleShare=!1}let v=bi(e.fast);for(;;){e.__slicer=v;let R=Kn(n.element,w);try{({clone:r,classCSS:i,classPrefixCSS:o,styleCache:s,nodeMap:a,reconcileRisk:c,clipWindow:u}=await Js(n.element,n.options)),c>0&&!e.reconcile&&(Mt(e.__session,"reconcile-risk","text in inline/table-cell elements kept natural width and may re-wrap; pass { reconcile: true } for pixel-exact layout"),I.warnedReconcile||(I.warnedReconcile=!0,console.warn("[SnapDOM] Some text may wrap differently in the capture. Pass { reconcile: true } to fix it (about 2x slower)."))),!y&&r&&(f=Ws(n.element,r)),!b&&r&&qs(n.element,r,n.options),r&&(Xs(n.element,r,a),Gs(n.element,r))}finally{R()}if(!v?.yielded||!e.__tornSinceStart?.())break;v=null,e.__session=Co(e.cache)}if(e.__slicer=null,n.clone=r,n.classCSS=i,n.styleCache=s,n.nodeMap=a,await Bt("afterClone",n),!We(d,"render"))return null;if(v?.due()&&await v.pause(),Hn(n.clone),n.options?.excludeMode==="remove"||typeof n.options?.filter=="function"&&n.options.filterMode==="remove")try{Ys(n.element,n.clone,n.styleCache,n.nodeMap)}catch(R){Mt(e.__session,"shrink-failed","shrink pass failed",R),console.warn("[SnapDOM] Couldn't close the gaps left by removed elements.",R)}try{await $n(n.clone,n.element,n.nodeMap)}catch{}let C=R=>Promise.resolve().then(R),S=(async()=>{await Promise.all([C(()=>Vn(n.clone,n.options)),C(()=>Gn(n.element,n.clone,n.styleCache,n.options,n.nodeMap))]);try{ea(n.element,n.clone,n.nodeMap)}catch(R){Mt(e.__session,"backdrop-filter-failed","backdrop-filter emulation failed",R),console.warn("[SnapDOM] Couldn't reproduce a backdrop-filter; captured without it.",R)}if(e.compress&&(e.__compressionClip=u,e.__compressionRootTransform=f,await C(()=>or(n.clone,n.options,n.nodeMap))),e.captureSelection)try{cs(n.nodeMap)}catch(R){Mt(e.__session,"selection-compose-failed","field selection compose failed",R)}})(),M=Promise.resolve();(e.embedFonts==="auto"?((n.element.ownerDocument||document).fonts?.size||0)>0:e.embedFonts)&&(M=C(async()=>{let R=n.element.ownerDocument||document,T=w?P=>{try{let A=P.getBoundingClientRect();return A.right>=w.left-200&&A.left<=w.right+200&&A.bottom>=w.top-200&&A.top<=w.bottom+200}catch{return!0}}:null,{required:L,usedCodepoints:W}=!w&&e.__fontUsage||On(n.element,T);if(e.embedFonts==="auto"){let P=new Set;try{for(let N of R.fonts)P.add(String(N.family).replace(/["']/g,"").toLowerCase())}catch{}if(!(P.size>0&&Array.from(L).some(N=>P.has(String(N).split("__")[0].toLowerCase()))))return}if(X()){let P=new Set(Array.from(L).map(A=>String(A).split("__")[0]).filter(Boolean));await Dn(P,1,R)}l=await vs({required:L,usedCodepoints:W,exclude:n.options.excludeFonts,localFonts:n.options.localFonts,useProxy:n.options.useProxy,fontStylesheetDomains:n.options.fontStylesheetDomains,iconMatchers:n.options.__iconMatchers,doc:R})})),await Promise.all([S,M]);let E=(n.options.plugins||[]).some(R=>R&&(typeof R.beforeRender=="function"||typeof R.afterRender=="function"));n.options.engine,v?.due()&&await v.pause();let x=n.clone;rr(x,e.__compressedAssets);let k=await ir(n,{clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,fontsCSS:l});if(e.__compressedSnapshot=nr(x,e.__compressedAssets),typeof e.__retain=="function")try{e.__retain({clone:r,nodeMap:a,styleCache:s,styleMap:e.__session.styleMap,classPrefixCSS:o,fontsCSS:l,clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,__compressedAssets:e.__compressedAssets,__compressionDensity:e.__compressionDensity})}catch{}return k}gt();Ct();var Zu=new Set(["png","jpeg","jpg","webp","svg"]);function va(t={}){let e=typeof t.type=="string"&&Zu.has(t.type.toLowerCase())?t.type.toLowerCase():null,n=t.format??e??"png";n==="jpg"&&(n="jpeg");let r=t.format!=null?n:e==="jpg"?"jpeg":e,i=Zo(t.cache),o=t.exclude==null?[]:Array.isArray(t.exclude)?t.exclude:[t.exclude],s=[],a=[];for(let f of o)if(typeof f=="string")try{document.createDocumentFragment().querySelector(f),s.push(f)}catch{console.warn(`[SnapDOM] Invalid exclude selector "${f}"; ignored.`)}else typeof f=="function"?a.push(f):f!=null&&console.warn("[SnapDOM] Ignored an exclude entry: use a CSS selector or a function.",f);let c=t.excludeMode??"hide",u=f=>{if(!f||f.nodeType!==1)return!1;if(f.getAttribute("data-capture")==="exclude")return!0;for(let d of Array.isArray(l.exclude)?l.exclude:[])try{if(f.matches(d))return!0}catch{}for(let d of Array.isArray(l.excludePredicates)?l.excludePredicates:[])try{if(d(f))return!0}catch{}if(typeof l.filter=="function")try{if(!l.filter(f))return!0}catch{}return!1},l={debug:t.debug??!1,scale:t.scale??1,exclude:s,excludePredicates:a.length?a:null,excludeMode:c,filter:t.filter??null,filterMode:t.filterMode??"hide",shouldExclude:u,placeholders:t.placeholders!==!1,captureSelection:t.captureSelection??!1,canvas:it(t.canvas,"canvas")?t.canvas:null,embedFonts:t.embedFonts??"auto",iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],__iconMatchers:ds(t.iconFonts),localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],fallbackURL:t.fallbackURL??void 0,cache:i,__styleShare:t.__styleShare,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:n,__explicitFormat:r,type:n,quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(n)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,reconcile:t.reconcile??!1,burst:t.burst,fast:t.fast===!1||t.fast==="auto"?t.fast:!0,engine:t.engine,invalidate:t.invalidate??!1,__pinned:t.__pinned===!0,clip:t.clip??null,compress:t.compress!==!1,excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1};return l}mt();oe();wt();var Ca="svg,iframe,canvas,video,audio,object,embed,slot,template,picture,style,pre";function td(t){try{return t.matches?.("dialog,[popover]")||!!t.querySelector?.("dialog,[popover]")}catch{return!0}}var ed=/(?:^|;)\s*(?:-webkit-)?backdrop-filter:\s*(?!none(?:\s*!important)?(?:;|$))[^;]+/i;function nd(t){if(t.__usesBackdropFilter!==void 0)return t.__usesBackdropFilter;let e=!1;for(let n of t.styleMap.values())if(ed.test(n)){e=!0;break}return t.__usesBackdropFilter=e,e}function rd(t,e){let n=e.has("backdrop-filter")||e.has("-webkit-backdrop-filter");if(!n&&(n=(o=>/(?:^|;)\s*(?:-webkit-)?backdrop-filter\s*:/i.test(o.getAttribute?.("style")||""))(t),!n))try{n=!!t.querySelector?.('[style*="backdrop-filter" i]')}catch{n=!0}if(!n)return!1;let r=[t];t.querySelectorAll&&r.push(...t.querySelectorAll("*"));for(let i of r){let o=getComputedStyle(i),s=o.getPropertyValue("backdrop-filter")||o.getPropertyValue("-webkit-backdrop-filter");if(s&&s!=="none")return!0}return!1}var ka=new WeakMap;function od(t){let e=Wt(),n=ka.get(t);if(n&&n.epoch===e)return n.leaky;let r=!1,i={budget:2e4},o=s=>{for(let a=0;a<s.length&&!r;a++){if(--i.budget<0){r=!0;return}let c=s[a],u=c.selectorText;if(u&&/[+~]|:has\(/.test(u)){r=!0;return}let l=c.style;if(l&&(l.counterReset||l.counterIncrement||l.counterSet||l.content&&l.content.includes("counter"))){r=!0;return}c.cssRules&&c.cssRules.length&&o(c.cssRules)}};try{for(let s of t.styleSheets){let a=null;try{a=s.cssRules}catch{r=!0}if(r)break;a&&o(a)}if(!r){let s=t.adoptedStyleSheets;if(Array.isArray(s))for(let a of s){if(r)break;try{o(a.cssRules)}catch{r=!0}}}}catch{r=!0}return ka.set(t,{epoch:e,leaky:r}),r}var id=1/16;function sd(t,e){if(t===e)return!0;if(!t.endsWith("px")||!e.endsWith("px"))return!1;let n=parseFloat(t),r=parseFloat(e);return Number.isFinite(n)&&Number.isFinite(r)&&Math.abs(n-r)<=id}var sr=new Map,ad=["width","height","min-width","min-height"];function cd(t){let e=sr.get(t);if(e===void 0){e=null;for(let n of ad){let r=t.match(new RegExp("(?:^|;)"+n+":([^;]+)"));r&&r[1].endsWith("px")&&((e||(e={}))[n]=r[1])}sr.size>5e3&&sr.clear(),sr.set(t,e)}return e}function ld(t){if(!(!t.classList||!t.classList.length))for(let e of Array.from(t.classList))/^c\d+$/.test(e)&&t.classList.remove(e)}function fd(t,e){let n=[t];for(;n.length;){let r=n.pop();if(r.nodeType===1){let i=e.nodeMap.get(r);i!==void 0&&(e.nodeMap.delete(r),e.srcToClone.get(i)===r&&e.srcToClone.delete(i)),e.styleMap.delete(r)}for(let i=r.firstChild;i;i=i.nextSibling)n.push(i)}}var _o={attempts:0,served:0,reconciled:0};async function Ma(t,e,n){_o.attempts++;try{let r=await ud(t,e,n);return r&&_o.served++,r}catch{return null}}async function ud(t,e,n){let r=e.retained;if(!r||!r.clone||!r.styleMap||!r.srcToClone||n.reconcile||n.clip||n.captureSelection||r.clipWindow||t.scrollTop||t.scrollLeft||td(t)||nd(r)||r.fontsCSS||Zn(n))return null;for(let f of n.plugins||[])if(f&&(typeof f.beforeSnap=="function"||typeof f.beforeClone=="function"||typeof f.resolveNode=="function"||typeof f.afterClone=="function"))return null;if(r.classPrefixCSS&&(r.classPrefixCSS.includes("::marker")||r.classPrefixCSS.includes("::first-line"))||n.excludeMode==="remove")return null;let i=t.ownerDocument||document,o=rn(t);if(!o||od(i))return null;let s=[];t:for(let f of e.dirtyRoots){if(!f.isConnected||f===t||!t.contains(f))return null;for(let d of e.dirtyRoots)if(d!==f&&d!==t&&d.contains(f))continue t;s.push(f)}if(!s.length)return null;n.__compressedAssets=r.__compressedAssets,n.__compressionDensity=r.__compressionDensity,n.__compressionRootTransform=r.rootTransform2D;for(let f of s){if(f.parentElement===t||f.matches?.(Ca)||f.querySelector?.(Ca)||rd(f,o))return null;let d=r.srcToClone.get(f);if(!d||!d.parentNode)return null;let h=new Map,m={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:h,options:n},p=Kn(f,null),g=Un(f),y;try{y=await Jt(f,m,n)}finally{g(),p()}if(!y||y.nodeType!==1||y.querySelector?.("style[data-sd]")||(await Ie(f,y,m,n),m.__pseudoCSS)||m.__usesPlaceholder&&!r.classPrefixCSS?.includes("[data-sd-ph]"))return null;await En(y,m),Hn(y);try{await $n(y,f,h)}catch{}if(await Promise.all([Vn(y,n),Gn(f,y,r.styleCache,n,h)]),n.compress)try{await or(y,n,h)}catch{}for(let[b,w]of h.entries())vo(b,w,h,r.styleCache);d.replaceWith(y),fd(d,r);for(let[b,w]of h.entries())r.nodeMap.set(b,w),r.srcToClone.set(w,b)}let a={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:n};for(let[f,d]of r.nodeMap.entries()){if(!d||d.nodeType!==1||!d.isConnected)continue;let h=r.styleMap.get(f);if(!h)continue;let m=cd(h);if(!m)continue;let p=null,g=!1;for(let y in m)if(p||(p=getComputedStyle(d)),!sd(p.getPropertyValue(y),m[y])){g=!0;break}if(g){if(n.__compressedAssets?.has(f))return null;_o.reconciled++,await dt(d,f,a,n)}}let c=Ke(r.styleMap);for(let[f,d]of r.styleMap.entries())ld(f),xo(f,d,c);let u=(r.classPrefixCSS||"")+Array.from(c.entries()).map(([f,d])=>`.${d}{${f}}`).join("");rr(r.clone,n.__compressedAssets);let l=await ir({element:t,options:n,plugins:n.plugins,clone:r.clone,classCSS:u,styleCache:r.styleCache,nodeMap:r.nodeMap},{clipWindow:null,outerTransforms:r.outerTransforms,outerShadows:r.outerShadows,rootTransform2D:r.rootTransform2D,fontsCSS:r.fontsCSS||""});return n.__compressedSnapshot=nr(r.clone,n.__compressedAssets),r.__compressedAssets=n.__compressedAssets,r.__compressionDensity=n.__compressionDensity,l}Ct();var Ro=new WeakMap,cr=new WeakMap,Ia=new WeakSet,Eo=new WeakMap,dd=64,dn=new Map,Oa=["scroll","input","change","focusin","focusout","pointerdown","pointerup","pointercancel","keydown","keyup","beforetoggle","toggle"],pd=["(prefers-color-scheme: dark)","(prefers-reduced-motion: reduce)","(prefers-contrast: more)","(forced-colors: active)","(inverted-colors: inverted)","(prefers-reduced-transparency: reduce)","(hover: hover)","(any-hover: hover)","(pointer: coarse)","(any-pointer: coarse)","(color-gamut: p3)","(dynamic-range: high)"];function hd(t){let e=t?.defaultView;return typeof e?.matchMedia!="function"?"":pd.map(n=>{try{return e.matchMedia(n).matches?"1":"0"}catch{return"?"}}).join("")}function Aa(t){let e=[];for(let n=t;n;){try{let r=n.getBoundingClientRect();e.push(r.x,r.y,r.width,r.height)}catch{e.push("?")}n.parentElement?n=n.parentElement:n=n.getRootNode?.()?.host||null}return e.join("|")}function _a(t,e){if(e.disposed||(dn.delete(t),dn.set(t,e),dn.size<=dd))return;let[n,r]=dn.entries().next().value;Da(n,r)}function Da(t,e){e.disposed=!0,dn.delete(t),Ro.delete(t);for(let n of e.observers)try{n.disconnect()}catch{}for(let n of Oa)t.removeEventListener(n,e.onMediaDirty,!0);for(let n of e.trackedShadowRoots.keys())for(let r of To)n.removeEventListener(r,e.onMediaDirty,!0);for(let[n,r]of e.trackedImages)n.removeEventListener("load",r),n.removeEventListener("error",r);e.trackedImages.clear(),e.trackedShadowRoots.clear(),e.images.length=0,e.controls.length=0,e.scrollNodes.length=0,e.observers.length=0,e.last=null,e.retained=null,e.retainedFrameDriven=!1}function Wa(t){if(Ia.has(t))return!1;cr.delete(t);let e=[t],n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i],s=[];o?.nodeType===1&&s.push(o);try{s.push(...o.querySelectorAll("*"))}catch{return!1}for(let a of s){a.shadowRoot&&e.push(a.shadowRoot);let c=String(a.localName||a.tagName||"").toLowerCase();if(/^(?:iframe|canvas|video|audio|object|embed|marquee|blink)$/.test(c)||c==="progress"&&!a.hasAttribute("value")||/^(?:animate|animatetransform|animatemotion|set)$/.test(c))return!1;let u="";if(c==="img"){r.push(a);try{u=a.currentSrc||a.src||""}catch{}}/^(?:input|textarea|select|option)$/.test(c)&&n.push(a);let l=a.getAttribute?.("style")||"",f=Eo.get(a);if(u||l){if((!f||f.src!==u||f.style!==l)&&(f={src:u,style:l,animated:ze(u)||ze(l)},Eo.set(a,f)),f.animated)return!1}else f&&Eo.delete(a)}}return cr.set(t,{roots:e.slice(1),controls:n,images:r}),!0}function Fo(t,e){if(!t.querySelectorAll)return!1;let n=cr.get(t);cr.delete(t);let r=new Set(n?.roots||[]);if(n&&(e.controls=n.controls,e.scannedImages=n.images),!n){let i=[t];for(let o=0;o<i.length;o++){let s=i[o];s.shadowRoot&&!r.has(s.shadowRoot)&&(r.add(s.shadowRoot),i.push(s.shadowRoot));for(let a of s.querySelectorAll("*"))a.shadowRoot&&!r.has(a.shadowRoot)&&(r.add(a.shadowRoot),i.push(a.shadowRoot))}}for(let[i,o]of e.trackedShadowRoots)if(!r.has(i)){try{o.disconnect()}catch{}for(let a of To)i.removeEventListener(a,e.onMediaDirty,!0);e.trackedShadowRoots.delete(i);let s=e.observers.indexOf(o);s>=0&&e.observers.splice(s,1)}for(let i of r)if(!e.trackedShadowRoots.has(i))try{let o=new MutationObserver(e.markDirty);o.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),o.__flush=e.markDirty,e.observers.push(o),e.trackedShadowRoots.set(i,o);for(let s of To)i.addEventListener(s,e.onMediaDirty,{capture:!0,passive:!0});e.retained&&e.dirtyAll()}catch{}return!!n}var To=["scroll","change","beforetoggle","toggle"];function lr(t,e){return[t,...e.trackedShadowRoots.keys()]}function Po(t,e){let n=e.scannedImages;if(e.scannedImages=null,!n){n=[],t.tagName==="IMG"&&n.push(t);for(let r of lr(t,e))r.querySelectorAll&&n.push(...r.querySelectorAll("img"))}if(e.images=n,e.trackedImages.size){let r=new Set(n);for(let[i,o]of e.trackedImages)r.has(i)||(i.removeEventListener("load",o),i.removeEventListener("error",o),e.trackedImages.delete(i))}for(let r of n){if(r.complete||e.trackedImages.has(r))continue;let i=()=>{e.capturing&&(e.torn=!0),e.dirty=!0,e.dirtyRoots=null,r.removeEventListener("load",i),r.removeEventListener("error",i),e.trackedImages.delete(r)};e.trackedImages.set(r,i),r.addEventListener("load",i),r.addEventListener("error",i)}}function Ea(t){let e=new Map,n=new Map,r=new Map;for(let i of t)if(ae(i))if(i.type==="attributes"){let o=e.get(i.target);o||e.set(i.target,o=new Map),o.has(i.attributeName)||o.set(i.attributeName,i.oldValue)}else if(i.type==="characterData")n.has(i.target)||n.set(i.target,i.oldValue);else if(i.type==="childList"){let o=r.get(i.target);o||r.set(i.target,o=new Map);for(let s of i.addedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)+1)}for(let s of i.removedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)-1)}}else return!0;for(let[i,o]of e)for(let[s,a]of o)if(i.getAttribute(s)!==a)return!0;for(let[i,o]of n)if(i.data!==o)return!0;for(let i of r.values())for(let o of i.values())if(o!==0)return!0;return!1}var md=/(?:^data:image\/(?:gif|apng)|\.(?:gif|apng)(?=[?#)'"\s;]|$))/i,Ue=t=>t&&(typeof t=="object"||typeof t=="function")?ar(t):"-";function gd(t,e=131072){if(t=String(t||"").trim(),!/^data:/i.test(t))return"";let n=t.indexOf(",");if(n<0)return"";let r=t.slice(0,n),i=t.slice(n+1);try{if(/;base64/i.test(r)){let o=Math.ceil(e/3)*4;return atob(i.slice(0,o-o%4))}return i.slice(0,e*3).replace(/%([0-9a-f]{2})/gi,(o,s)=>String.fromCharCode(parseInt(s,16))).slice(0,e)}catch{return""}}function yd(t){let e=(t.match(/^data:([^;,]+)/i)?.[1]||"").toLowerCase();if(e==="image/gif"||e==="image/apng")return!0;if(!/image\/(?:png|webp|avif|svg\+xml)/.test(e))return!1;let n=gd(t);return e==="image/png"?n.includes("acTL"):e==="image/webp"?n.includes("ANIM")||n.includes("ANMF")||n.includes("VP8X")&&!!(n.charCodeAt(n.indexOf("VP8X")+8)&2):e==="image/avif"?n.includes("avis"):/<(?:animate|animateTransform|animateMotion|set)\b|@keyframes\b|animation(?:-name)?\s*:/i.test(n)}function Ra(t){let e=String(t||"").trim();return e?md.test(e)?!0:/^data:/i.test(e)?yd(e):!1:!1}function ze(t){let e=String(t||"");if(Ra(e))return!0;for(let n of e.matchAll(/url\(\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^)]*))\s*\)/gi))if(Ra(n[1]??n[2]??n[3]))return!0;return!1}function Fa(t,e=null){let n=t&&t.clone;if(!n)return!1;let r=e?e.map(i=>t.srcToClone?.get(i)).filter(Boolean):[n];for(let i of r)for(let o of Ba(i))if(ze(o.getAttribute?.("src"))||ze(o.getAttribute?.("href"))||ze(o.getAttribute?.("style"))||ze(t.styleMap?.get(o)))return!0;return!1}function Ba(t){let e=[];t&&t.nodeType===1&&e.push(t);try{e.push(...t.querySelectorAll("*"))}catch{}return e}function $o(t,e){let n=[],r=new Set,i=o=>{o&&!r.has(o)&&(r.add(o),n.push(o))};t.matches?.("input,textarea,select,option")&&i(t);for(let o of lr(t,e))try{for(let s of o.querySelectorAll("input,textarea,select,option"))i(s)}catch{}e.controls=n}function No(t,e){let n=[],r=new Set,i=(o,s=!1)=>{if(!(!o||r.has(o))){r.add(o);try{(s||o.scrollLeft||o.scrollTop||o.scrollWidth>o.clientWidth||o.scrollHeight>o.clientHeight)&&n.push(o)}catch{}}};for(let o=t;o;o=o.parentElement)i(o,!0);for(let o of lr(t,e))for(let s of Ba(o))i(s);e.scrollNodes=n}function Ta(t,e){let n=t.ownerDocument||document,r=n.defaultView,i=[r?.location?.hash||"",hd(n),r?.innerWidth||0,r?.innerHeight||0,r?.devicePixelRatio||1,r?.screen?.orientation?.type||""];try{i.push(...[...n.adoptedStyleSheets||[]].map(Ue))}catch{}for(let l of e.trackedShadowRoots.keys())try{i.push("#shadow",...[...l.adoptedStyleSheets||[]].map(Ue))}catch{}let o=n.activeElement,s=n.fullscreenElement;(o?.contains(t)||t.contains(o))&&i.push(Ue(o)),(s?.contains(t)||t.contains(s))&&i.push(Ue(s));let a=[r?.scrollX||0,r?.scrollY||0];for(let l of e.scrollNodes)a.push(l.scrollLeft||0,l.scrollTop||0);let c=[];for(let l of e.controls){let f=String(l.localName||"").toLowerCase();f==="input"?c.push(l.type,Xe(l)?l.value.length:l.value,l.checked?1:0,l.indeterminate?1:0):f==="textarea"?c.push(l.value):f==="select"?c.push(l.selectedIndex,l.value):c.push(l.selected?1:0)}let u=[];for(let l of e.images){let f="";try{f=l.currentSrc||l.src||""}catch{}u.push(f,l.complete?1:0,l.naturalWidth||0,l.naturalHeight||0)}return{style:i.join("|"),scroll:a.join("|"),controls:c,images:u,frameDriven:e.retainedFrameDriven}}function Be(t,e,n){if(!t)return!1;let r=t[n],i=e[n];if(r===i)return!0;if(!Array.isArray(r)||r.length!==i.length)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}function Pa(t,e){let n=new Set;for(let r of lr(t,e))try{let i=r.getAnimations?.(r.nodeType===1?{subtree:!0}:void 0)||[];for(let o of i)n.add(o)}catch{}return[...n]}function $a(t){return t.map(e=>[Ue(e),e.playState,Math.round((Number(e.currentTime)||0)*10),e.playbackRate].join(":")).join("|")}function bd(t,e,n){if(!n||n.nodeType!==1)return null;if(n===t||t.contains(n))return t;for(let r of e.trackedShadowRoots.keys())if(r.contains(n))return r;return null}function wd(t){let e={dirty:!0,pending:[],torn:!1,dirtyRoots:new Set,retained:null,retainedFrameDriven:!1,disposed:!1,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedShadowRoots:new Map,trackedImages:new Map,images:[],scannedImages:null,scrollNodes:[],controls:[],envEpoch:_e(),styleEpoch:Wt(),styleStamp:nn(t),outsideMutations:en(t),geometry:null,renderState:null},n=()=>{e.dirty=!0,e.dirtyRoots=null},r=a=>{if(!e.dirtyRoots)return;let c=a&&(a.nodeType===1?a:a.parentElement);if(!c||c===t||!t.contains(c)||e.dirtyRoots.size>=12){e.dirtyRoots=null;return}e.dirtyRoots.add(c)},i=a=>{if(e.capturing){for(let c of a)e.pending.push(c);return}for(let c of a)ae(c)&&(e.dirty=!0,r(c.target))},o=()=>{if(e.capturing){e.torn=!0;return}n()};e.dirtyAll=n;try{let a=new MutationObserver(i);a.observe(t,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),a.__flush=i,e.observers.push(a)}catch{}e.markDirty=i,e.onMediaDirty=o;try{for(let a of Oa)t.addEventListener(a,o,{capture:!0,passive:!0})}catch{}return Fo(t,e)||$o(t,e),No(t,e),Po(t,e),e}var Sd=0,Na=new WeakMap;function ar(t){let e=Na.get(t);return e||(e="@"+ ++Sd,Na.set(t,e)),e}function Lo(t,e){let n=typeof t;if(n==="undefined")return null;if(t===null||n==="boolean"||n==="number"||n==="string")return JSON.stringify(t);if(n==="function"||n==="symbol")return n==="symbol"?null:JSON.stringify(ar(t));if(n!=="object")return null;if(typeof t.nodeType=="number")return JSON.stringify(ar(t));if(e.has(t))return null;e.add(t);try{if(Array.isArray(t)){let o=[];for(let s of t){let a=Lo(s,e);if(a===null)return null;o.push(a)}return"["+o.join(",")+"]"}let r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)return JSON.stringify(ar(t));let i=[];for(let o of Object.keys(t).sort()){let s=t[o];if(s===void 0)continue;let a=Lo(s,e);if(a===null)return null;i.push(JSON.stringify(o)+":"+a)}return"{"+i.join(",")+"}"}finally{e.delete(t)}}function La(t,e){let{burst:n,invalidate:r,...i}=t||{};try{let o=Lo(i,new Set);return o===null?null:`${(e||[]).map(Ue).join(",")}:${o}`}catch{return null}}function Ua(t,e,n,r,i=null){let o=Ro.get(t);o||(o=wd(t),o.baselineSignature=La(e,n.plugins),Ro.set(t,o));let s=La(e,n.plugins),a=async()=>{if(o.disposed)return r();let u=s===null||s!==o.baselineSignature;u&&s!==null?o.pendingSig===s?(o.baselineSignature=s,o.last=null,o.dirty=!0,o.dirtyRoots=null,o.pendingSig=null,u=!1):o.pendingSig=s:o.pendingSig=null,Fo(t,o),Po(t,o);for(let M of o.observers)M.__flush(M.takeRecords());Tt();let l=en(t);o.dirty&&o.outsideMutations!==l&&o.dirtyAll(),o.outsideMutations=l;let f=t.getRootNode?.(),d=[...o.trackedShadowRoots.keys()];f?.nodeType===11&&!d.includes(f)&&d.push(f),Mn(t.ownerDocument||document,d);let h=nn(t);o.styleStamp!==h&&(o.styleStamp=h,o.dirty||o.dirtyAll());let m=Ta(t,o),p=Pa(t,o);m.animation=$a(p),o.renderState&&(!Be(o.renderState,m,"style")&&(Ee(),o.dirtyAll()),Be(o.renderState,m,"scroll")||o.dirtyAll(),Be(o.renderState,m,"controls")||(ce(t),o.dirtyAll()),!Be(o.renderState,m,"images")&&!o.dirty&&o.dirtyAll());let g=_e();o.envEpoch!==g&&(o.dirtyAll(),o.envEpoch=g);let y=Wt();if(o.styleEpoch!==y&&(o.styleEpoch=y,!o.dirty)){let M=Aa(t);o.geometry!==null&&M!==o.geometry&&(ce(t),o.dirtyAll()),o.geometry=M}n.invalidate&&o.dirtyAll();let b=!1,w=!!o.renderState&&!Be(o.renderState,m,"animation");try{let M=new Set;w&&p.length===0&&(M=null);for(let _ of p){let E=_.playState==="running";if(!E&&!w)continue;E&&(b=!0),w=!0;let x=_.effect?.target;if(bd(t,o,x)===t)M.add(x);else{M=null;break}}if(w&&M&&M.size&&o.retained){o.dirty=!0;for(let _ of M)o.dirtyRoots&&o.dirtyRoots.add(_),ce(_)}else w&&!M&&o.dirtyAll()}catch{}let v=m.frameDriven,C=b||v;if(C&&(o.last=null),v&&o.dirtyAll(),!u&&!C&&!o.dirty&&o.last)return _a(t,o),o.last;o.capturing=!0;let S=null;try{let M=null,_=!1,E=null;if(!u&&o.dirty&&o.retained&&o.dirtyRoots&&o.dirtyRoots.size&&i){E=[...o.dirtyRoots];let x=await Ma(t,o,n);x&&(M=await i(x),_=!0)}if(M||(u||(n.__retain=x=>{let k=new Map;for(let[R,T]of x.nodeMap.entries())k.set(T,R);S={...x,srcToClone:k}}),n.__tornSinceStart=()=>{for(let x of o.observers)for(let k of x.takeRecords())o.pending.push(k);return Tt(),o.torn||Ea(o.pending)||en(t)!==l},M=await r()),!u&&!o.disposed){o.dirty=!1,o.dirtyRoots=new Set,S?(o.retained=S,o.retainedFrameDriven=Fa(S),$o(t,o),No(t,o)):_&&(o.retainedFrameDriven||(o.retainedFrameDriven=Fa(o.retained,E)),$o(t,o),No(t,o));let x=Ta(t,o);x.animation=$a(Pa(t,o));let k=["style","scroll","controls","images"];b||k.push("animation");let R=k.every(T=>Be(m,x,T));o.renderState=x,o.styleEpoch=Wt(),o.styleStamp=nn(t),o.geometry=Aa(t),o.renderState.frameDriven?(Ia.add(t),Da(t,o)):R?!C&&!o.renderState.frameDriven&&(o.last=M,_a(t,o)):(o.dirtyAll(),o.last=null)}return M}finally{n.__retain=void 0,n.__tornSinceStart=void 0;for(let _ of o.observers)for(let E of _.takeRecords())o.pending.push(E);Tt();let M=en(t);(o.torn||Ea(o.pending)||M!==l)&&(o.dirtyAll(),o.last=null),o.outsideMutations=M,o.styleEpoch=Wt(),o.styleStamp=nn(t),o.pending.length=0,o.torn=!1,o.capturing=!1,o.disposed||(Fo(t,o),Po(t,o))}},c=o.inflight.then(a,a);return o.inflight=c.catch(()=>{}),c}var fr=null;function ja(t){fr=t}var xd='button, a[href], [role="button"], input, select, summary, label, [tabindex]',Io=!1,pn=null,Oo=new WeakMap,za=!1;function Va(t,e){!Io||!pn||e&&e.burst===!1||Oo.set(pn.control,{element:t,options:e&&typeof e=="object"?{...e}:e})}function qa(t){let e={control:t};pn=e,setTimeout(()=>{pn===e&&(pn=null)},0)}function Wo(t){let e=t.target,n=e&&(e.nodeType===1?e:e.parentElement);return n&&n.closest?n.closest(xd):null}function Ha(t){if(t.type==="keydown"&&t.key!=="Enter"&&t.key!==" ")return;let e=Wo(t);e&&(qa(e),Do(t,!1))}function vd(t){let e=Wo(t);e&&qa(e)}function Do(t,e=!0){if(!fr||document.visibilityState==="hidden")return;let n=Wo(t);if(!n||t.type==="pointerenter"&&t.target!==n)return;let r=Oo.get(n);if(r){if(!r.element.isConnected){Oo.delete(n);return}fr(r.element,r.options).catch(()=>{});return}e&&!za&&(za=!0,fr(document.body,{clip:"viewport",burst:!1}).catch(()=>{}))}function Ga(){if(Io||typeof document>"u"||typeof document.addEventListener!="function")return;Io=!0;let t={capture:!0,passive:!0};document.addEventListener("pointerdown",Ha,t),document.addEventListener("keydown",Ha,t),document.addEventListener("click",vd,t),document.addEventListener("pointerenter",Do,t),document.addEventListener("focusin",Do,t)}kt();function Ud(...t){return ca(...t),K}async function zd(t,e){if(typeof t!="string"||!t.trim())throw new Error("[SnapDOM] fromString() needs an HTML string.");let n=document.createElement("div");Z(n),n.style.cssText="position:fixed;left:-99999px;top:0;pointer-events:none;",n.innerHTML=t,document.body.appendChild(n);try{await yt();let r=Array.from(n.childNodes).some(o=>o.nodeType===3&&o.textContent.trim()),i=n.children.length===1&&!r?n.firstElementChild:n;return await Qo(i,{...e||{},burst:!1})}finally{n.remove()}}var Hd="3.3.3",K=Object.assign(Qo,{plugins:Ud,fromString:zd,version:Hd,preCapture:Ga});ja(Qo);var Ko=Symbol("snapdom.internal"),jd=Symbol("snapdom.internal.silent"),sc=new Set(["png","jpeg","jpg","webp","svg"]);async function Qo(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");let n=va(e);n.element=t,n.invalidate&&Ee(),fa(n,e&&e.plugins);let{stage:r,loweredBy:i}=sa(n);n.needs=r,n.__needsLoweredBy=i;let o=We(r,"render"),s=n.burst===!0||!Zn(n),a=typeof n.filter=="function"||!!n.excludePredicates||typeof n.excludeStyleProps=="function"||typeof n.fallbackURL=="function",u=o&&!n.captureSelection&&n.burst!==!1&&s&&!a&&Wa(t);return u&&Va(t,e),n.snap||(n.snap={toPng:(l,f)=>K.toPng(l,f),toSvg:(l,f)=>K.toSvg(l,f)}),u?Ua(t,e,n,()=>K.capture(t,n,Ko),l=>ac(l,n)):K.capture(t,n,Ko)}K.capture=async(t,e,n)=>{if(n!==Ko)throw new Error("[SnapDOM] snapdom.capture() is internal; use snapdom(el).");if(We(e.needs||_t,"render")&&X()){if(e.embedFonts)try{let o=t.ownerDocument||document,s=new Set;if(e.embedFonts==="auto"){try{for(let l of o.fonts)s.add(String(l.family).replace(/["']/g,"").toLowerCase())}catch{}if(s.size===0)throw null}let a=On(t);e.clip||(e.__fontUsage=a);let c=a.required,u=new Set([...c].map(l=>String(l).split("__")[0]).filter(Boolean));if(e.embedFonts==="auto"&&(u=new Set([...u].filter(l=>s.has(l.toLowerCase()))),u.size===0))throw null;await Dn(u,1,o)}catch{}let i=Array.from(t.querySelectorAll("canvas"));t.tagName==="CANVAS"&&i.unshift(t);for(let o of i)try{if(an(o))continue;let s=o.getContext("2d",{willReadFrequently:!0});s&&s.getImageData(0,0,1,1)}catch(s){H(e,"Couldn't prepare canvases for Safari.",s)}}let r=await xa(t,e);return ac(r,e)};async function ac(t,e){let n=e.needs||_t,r=We(n,"render"),i=A=>aa(n,e.__needsLoweredBy||[],A),o=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?t:null,s=o?null:t,a=()=>s??(s=o.toDataURL()),c=o||t;o&&(t="");let u=e.__compressedSnapshot,l=e.__compressionDensity;delete e.__compressedSnapshot,delete e.__compressedAssets;let f,d=e.meta||{},m=(Number.isFinite(e.width)||Number.isFinite(e.height))&&!X(),p=m?Number.isFinite(e.width)?d.targetW/d.vbW:d.targetH/d.vbH:1,g=m?Number.isFinite(e.height)?d.targetH/d.vbH:d.targetW/d.vbW:1,y=A=>{if(o||!u?.size)return c;let N=d.vbW,$=d.vbH,F=A.crop;F&&(N=Math.max(1,Math.min(N,F.x+F.width)-Math.max(0,F.x)),$=Math.max(1,Math.min($,F.y+F.height)-Math.max(0,F.y)));let z=Number.isFinite(A.width),q=Number.isFinite(A.height);return(z&&q?Math.max(A.width/N,A.height/$):z?A.width/N*(F?Math.max(1,g/p):1):q?A.height/$*(F?Math.max(1,p/g):1):(A.scale||1)*Math.max(p,g))*(A.dpr||1)<=l?c:f??(f=ya(a(),u))},b=async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn));return $(c,{...A,...N||{},format:"png"})},w=()=>{if(!r)throw i("svgString");if(o)throw new Error("[SnapDOM] html-in-canvas makes a raster capture; there is no SVG string.");let A=t.indexOf(",");return A>=0?decodeURIComponent(t.slice(A+1)):""},v=A=>Object.defineProperty({...A||{},svgString:w},"url",r?{get:a,enumerable:!0}:{get(){throw i("export.url")},enumerable:!1,configurable:!0}),C={img:async(A,N)=>{if(o)return b(A,N);let{toImg:$}=await Promise.resolve().then(()=>(qo(),Vo)),F={...A,...N||{}};return $(y(F),F)},svg:async(A,N)=>{if(o)return b(A,N);let{toSvg:$}=await Promise.resolve().then(()=>(qo(),Vo)),F={...A,...N||{}};return $(y(F),F)},canvas:async(A,N)=>{let{toCanvas:$}=await Promise.resolve().then(()=>(me(),Ja)),F={...A,...N||{}};return $(y(F),F)},blob:async(A,N)=>{let{toBlob:$}=await Promise.resolve().then(()=>(Yo(),nc)),F={...A,...N||{}};return $(y(F),F)},png:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn)),F={...A,...N||{},format:"png"};return $(y(F),F)},jpeg:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn)),F={...A,...N||{},format:"jpeg"};return $(y(F),F)},webp:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(He(),mn)),F={...A,...N||{},format:"webp"};return $(y(F),F)},download:async(A,N)=>{let{download:$}=await Promise.resolve().then(()=>(ic(),oc)),F={...A,...N||{}};return $(y(F),F)}};if(!r)for(let A of Object.keys(C)){let N=A==="download"?"download()":`to${A.charAt(0).toUpperCase()}${A.slice(1)}()`;C[A]=async()=>{throw i(N)}}let S={};for(let A of["img","svg","canvas","blob","png","jpeg","webp"])S[A]=async N=>C[A](e,{...R(A,N||{}),[jd]:!0});S.jpg=S.jpeg;let M=A=>Object.defineProperty({...e,...A},"options",{value:e,configurable:!0}),_=M({artifacts:e.__artifacts||null,export:v(),exports:S}),E=await Jn("defineExports",_),x=Object.assign({},...E.filter(A=>A&&typeof A=="object").reverse()),k={...C,...x};k.jpeg&&!k.jpg&&(k.jpg=(A,N)=>k.jpeg(A,N));function R(A,N){let $=N||{},F={...e,...$},z=typeof $.type=="string"?$.type.toLowerCase():"",q=typeof $.format=="string"?$.format.toLowerCase():sc.has(z)?z:"";q&&(F.format=q==="jpg"?"jpeg":q),F.__explicitFormat=q?F.format:e.__explicitFormat??null,A==="blob"&&!F.__explicitFormat&&(F.format=o?"png":"svg"),F.type=F.format;let j=B=>B==="jpeg"||B==="jpg"||B==="webp";return[A,F.format,z].map(B=>typeof B=="string"?B.toLowerCase():"").find(j)&&(F.backgroundColor==null||F.backgroundColor==="transparent")&&(F.backgroundColor="#ffffff"),F.scale!==1&&(Number.isFinite(F.width)||Number.isFinite(F.height))&&H(F,"scale ignored: width/height already set the size."),F}let T=!1,L=Promise.resolve();async function W(A,N){let $=Object.freeze(N&&typeof N=="object"?{...N}:{}),F=async()=>{let q=k[A];if(!q)throw new Error(`[SnapDOM] Unknown export type: ${A}`);let j=R(A,$),J=M({artifacts:e.__artifacts||null,export:v({type:A,options:j,requestedOptions:$})}),B=j.format,ut=j.type;await Jn("beforeExport",J,{format:A,options:j});let xt=j.format!==B?j.format:j.type!==ut?j.type:"",at=typeof xt=="string"?xt.toLowerCase():"";sc.has(at)&&(j.format=at==="jpg"?"jpeg":at,j.type=j.format,j.__explicitFormat=j.format,/^(?:jpeg|webp)$/.test(j.format)&&(j.backgroundColor==null||j.backgroundColor==="transparent")&&(j.backgroundColor="#ffffff"));let st=await q(J,j);return await Jn("afterExport",J,{format:A,options:j,result:st}),T||(T=!0,await Bt("afterSnap",e)),st},z=L.then(F);return L=z.catch(()=>{}),z}let P={url:t,needs:n,warnings:e.__session&&e.__session.warnings||[],toRaw:()=>{if(!r)throw i("toRaw()");return a()},to:(A,N)=>W(A,N),toImg:A=>W("img",A),toSvg:A=>W("svg",A),toCanvas:A=>W("canvas",A),toBlob:A=>W("blob",A),toPng:A=>W("png",A),toJpg:A=>W("jpg",A),toWebp:A=>W("webp",A),download:A=>W("download",A)};r?o&&Object.defineProperty(P,"url",{get:a,enumerable:!0,configurable:!0}):Object.defineProperty(P,"url",{get(){throw i("url")},enumerable:!1,configurable:!0}),Object.defineProperty(P,"meta",r?{value:e.meta,enumerable:!0}:{get(){throw i("meta")},enumerable:!1,configurable:!0});for(let A of Object.keys(k)){let N="to"+A.charAt(0).toUpperCase()+A.slice(1);P[N]||(P[N]=$=>W(A,$))}return P}K.toRaw=(t,e)=>K(t,e).then(n=>n.toRaw());K.toImg=(t,e)=>K(t,e).then(n=>n.toImg());K.toSvg=(t,e)=>K(t,e).then(n=>n.toSvg());K.toCanvas=(t,e)=>K(t,e).then(n=>n.toCanvas());K.toBlob=(t,e)=>K(t,e).then(n=>n.toBlob());K.toPng=(t,e)=>K(t,{...e,format:"png"}).then(n=>n.toPng());K.toJpg=(t,e)=>K(t,{...e,format:"jpeg"}).then(n=>n.toJpg());K.toWebp=(t,e)=>K(t,{...e,format:"webp"}).then(n=>n.toWebp());K.download=(t,e)=>K(t,e).then(n=>n.download());typeof window<"u"&&(window.snapdom=K);})();
|
package/dist/snapdom.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* SnapDOM
|
|
3
|
-
* v3.3.
|
|
3
|
+
* v3.3.3
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
var uc=Object.defineProperty;var ct=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var be=(t,e)=>{for(var n in e)uc(t,n,{get:e[n],enumerable:!0})};function ni(t){return t===!1||typeof t=="string"&&t.toLowerCase().trim()==="disabled"?"disabled":"soft"}function ri(t="soft"){t==="disabled"&&(I.computedStyle=new WeakMap,I.measureHints=new WeakMap,I.baseStyle=new lt(50),I.defaultStyle=new lt(64),I.image=new lt(100),I.background=new lt(100),I.resource=new lt(150),I.compress=new lt(50))}var lt,I,yt=ct(()=>{"use strict";lt=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let r=this.keys().next().value;r!==void 0&&this.delete(r)}return super.set(e,n)}},I={image:new lt(100),background:new lt(100),resource:new lt(150),defaultStyle:new lt(64),baseStyle:new lt(50),compress:new lt(50),computedStyle:new WeakMap,measureHints:new WeakMap,warnedReconcile:!1}});function re(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function pc(t){let e=[],n=0,r=0,i="";for(let o=0;o<t.length;o++){let s=t[o];if(s==="\\"){o++;continue}i?s===i&&(i=""):s==='"'||s==="'"?i=s:s==="("?r++:s===")"?r--:s===","&&r===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e}function Ke(t,e=1){let n=t.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let r=[];for(let o of pc(n[1])){let s=o.match(/url\((['"]?)(.*?)(\1)\)/);if(!s)continue;let a=o.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!dc.test(a[1].trim()))continue;let c=o.replace(/url\((['"]?)[\s\S]*?\1\)/," ").match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)\b/i),u=1;if(c){let l=parseFloat(c[1]);u=/dpi/i.test(c[2])?l/96:l}r.push({url:s[2].trim(),dppx:u})}return r.length?(r.sort((o,s)=>o.dppx-s.dppx),(r.find(o=>o.dppx>=e)||r[r.length-1]).url):null}function Mr(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function qt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function Ar(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}}function Qe(t){return!!t&&t.tagName==="INPUT"&&(t.getAttribute("type")||"").toLowerCase()==="password"}function _r(t){return"\u2022".repeat(String(t??"").length)}function it(t,e){return t?.nodeType===1&&t.localName===e}function Rt(t){return t?.nodeType===1&&t.namespaceURI===hc}function It(t){return t?.nodeType===1&&t.namespaceURI===mc}function Ot(t){return t?.nodeType===11&&!!t.host}function Er(t){return t?.nodeType===9}var kr,dc,hc,mc,kt=ct(()=>{"use strict";kr=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i,dc=kr;hc="http://www.w3.org/1999/xhtml",mc="http://www.w3.org/2000/svg"});function gc(t="[SnapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(s,a,c){if(i>=n)return;let u=Date.now();(r.get(a)||0)>u||(r.set(a,u+e),i++,s==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(s,a){o("warn",s,a)},errorOnce(s,a){o("error",s,a)},reset(){r.clear(),i=0}}}function si(t,e,n){if(Dt.size>=ii){let r=Date.now();for(let[i,o]of Dt)o.until<=r&&Dt.delete(i);for(;Dt.size>=ii;)Dt.delete(Dt.keys().next().value)}Dt.set(t,{until:Date.now()+n,result:e})}function yc(t){return/^data:|^blob:|^about:blank$/i.test(t)}function bc(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.split(/\{url(?:Raw)?\}/)[0],i=new URL(r||".",n);if(new URL(t,n).origin===i.origin)return!0}catch{}return!1}function wc(t,e){if(!e||yc(t)||bc(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(t,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function Sc(t,e){if(!e)return t;if(/\{url(?:Raw)?\}/.test(e))return e.replace("{urlRaw}",()=>qt(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}${qt(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function ai(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(t)})}function xc(t,e){return new Headers(e.headers||{}).keys().next().done?JSON.stringify([e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,e.credentials||"",t]):null}function ci(t){try{return new URL(t,globalThis.location?.href||"http://localhost/").origin}catch{return"invalid-url"}}function Fr(t,e){try{t.onError?.(e)}catch{}}async function ft(t,e={}){let n=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",o=e.errorTTL??8e3,s=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[,g="",y=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],w=/;base64/i.test(g)?atob(y):decodeURIComponent(y),v=new Uint8Array([...w].map(S=>S.charCodeAt(0))),C=new Blob([v],{type:(g||"").split(";")[0]||""});return{ok:!0,data:C,status:200,url:t,fromCache:!1,mime:C.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let g=await fetch(t);if(!g.ok)return{ok:!1,data:null,status:g.status,url:t,fromCache:!1,reason:"http_error"};let y=await g.blob(),b=y.type||g.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await ai(y),blob:y,status:g.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await y.text(),status:g.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:y,status:g.status,url:t,fromCache:!1,mime:b}}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;try{c=xc(t,{as:n,timeout:r,useProxy:i,errorTTL:o,credentials:e.credentials,headers:s})}catch{let g={ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"};return Fr(e,g),g}let u=Dt.get(c);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&Dt.delete(c);let l=Rr.get(c);if(l)return l;let f=wc(t,i)?Sc(t,i):t,d=e.credentials;if(!d)try{let g=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(t,g);d=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{d="omit"}let h=new AbortController,m=setTimeout(()=>h.abort("timeout"),r),p=(async()=>{try{let g=await fetch(f,{signal:h.signal,credentials:d,headers:s});if(!g.ok){let w={ok:!1,data:null,status:g.status,url:f,fromCache:!1,reason:"http_error"};if(c!==null&&o>0&&si(c,w,o),!a){let v=`${g.status} ${g.statusText||""}`.trim();oi.warnOnce(`http:${g.status}:${n}:${ci(t)}`,`Couldn't load ${t} (HTTP ${v}).`)}return Fr(e,w),w}if(n==="text")return{ok:!0,data:await g.text(),status:g.status,url:f,fromCache:!1};let y=await g.blob(),b=y.type||g.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await ai(y),blob:y,status:g.status,url:f,fromCache:!1,mime:b}:{ok:!0,data:y,status:g.status,url:f,fromCache:!1,mime:b}}catch(g){let y=h.signal.aborted?h.signal.reason==="timeout"?"timeout":"abort":g&&typeof g=="object"&&g.name==="AbortError"?"abort":"network",b={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:y};if(c!==null&&!/^blob:/i.test(t)&&o>0&&si(c,b,o),!a){let w=`${y}:${n}:${ci(t)}`,v=y==="timeout"?`Timed out loading ${t} after ${r}ms. Raise the timeout option or set useProxy.`:y==="abort"?`Loading ${t} was cancelled.`:`Couldn't load ${t} (network or CORS). Try the useProxy option.`;oi.errorOnce(w,v)}return Fr(e,b),b}finally{clearTimeout(m),Rr.delete(c)}})();return c!==null&&Rr.set(c,p),p}var oi,Rr,ii,Dt,we=ct(()=>{"use strict";kt();oi=gc("[SnapDOM]",{ttlMs:3*6e4,maxEntries:10}),Rr=new Map,ii=50,Dt=new Map});async function Se(t,e={}){if(/^\s*url\(\s*['"]?data:/i.test(t)||/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=Ke(t,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??re(t);if(!r)return t;let i=Ar(r),o=qt(i),s=(e.useProxy||"")+"|"+o;if(I.background.has(s)){let a=I.background.get(s);return a?`url("${a}")`:"none"}try{let a=await ft(o,{as:"dataURL",useProxy:e.useProxy});return a.ok?(I.background.set(s,a.data),`url("${a.data}")`):(I.background.set(s,null),"none")}catch{return I.background.set(s,null),"none"}}var li=ct(()=>{"use strict";yt();kt();we()});function _c(t){let e=t.replace(Ac,"").trim();return e?e.replace(/(^|,)(\s*)(?=,|$)/g,"$1$2*"):"*"}function di(t,e,n,r){for(let i=0;i<t.length;i++){if(--r.budget<0)return!1;let o=t[i],s=o.style;if(s){let c=!!o.selectorText&&kc.test(o.selectorText);for(let u=0;u<s.length;u++){let l=s[u];if(e.add(l),c&&r.pseudoProps.add(l),s.getPropertyPriority(l)&&r.importantProps.add(l),l.length>5&&(l[0]==="m"||l[0]==="p")){let f=l.startsWith("margin")?"marginUnstable":l.startsWith("padding")?"paddingUnstable":null;f&&!r[f]&&Mc.test(s.getPropertyValue(l))&&(r[f]=!0)}}}let a=o.selectorText;if(a&&a.includes(":has(")&&(r.usesHas=!0),a&&a.includes("&"))for(let c=o.parentRule;c&&a.includes("&");c=c.parentRule)c.selectorText&&(a=a.replace(/&/g,`:is(${c.selectorText})`));if(a&&(r.inContainer||ui.test(a)||a.includes("+")||a.includes("~")))for(let c of $r(a,",")){let u=c.trim();u&&(r.inContainer||ui.test(u)||u.includes("+")||u.includes("~"))&&r.shareUnsafeSels.add(u)}if(a&&a.includes(":"))for(let c in fi)fi[c].test(a)&&n[c].push(_c(a));if(o.styleSheet){if(!Sn(o.styleSheet,e,n,r))return!1}else if(o.cssRules&&o.cssRules.length){let c=o.constructor?.name==="CSSContainerRule";c&&r.inContainer++;let u=di(o.cssRules,e,n,r);if(c&&r.inContainer--,!u)return!1}}return!0}function Sn(t,e,n,r){let i;try{i=t.cssRules}catch{return!1}return i?di(i,e,n,r):!1}function Pr(t,e){for(let n of t){let r=n.effect?.getKeyframes?.()||[];for(let i of r)for(let o of Object.keys(i))o==="offset"||o==="easing"||o==="composite"||o==="computedOffset"||e.add(o.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()))}}function pi(t){let e=new Set;return Sn(t,e,{before:[],after:[],firstLetter:[],marker:[],firstLine:[]},{budget:2e4,usesHas:!1,shareUnsafeSels:new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:new Set,pseudoProps:new Set})?e:null}function $r(t,e){if(!t.includes(e))return[t];let n=[],r=0,i=null,o=0;for(let s=0;s<t.length;s++){let a=t[s];if(a==="\\"){s++;continue}if(i){a===i&&(i=null);continue}a==='"'||a==="'"?i=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:r===0&&a===e&&(n.push(t.slice(o,s)),o=s+1)}return n.push(t.slice(o)),n}function Ec(t){let e=0,n=null,r=0;for(let l=0;l<t.length;l++){let f=t[l];if(n){f===n&&t[l-1]!=="\\"&&(n=null);continue}f==='"'||f==="'"?n=f:f==="("||f==="["?e++:f===")"||f==="]"?e--:e===0&&(f===" "||f===">"||f==="+"||f==="~")&&(r=l+1)}let i="",o=0;for(let l of t.slice(r))l==="("||l==="["?o++:l===")"||l==="]"?o--:o===0&&(i+=l);let s=l=>!l||/\\[0-9a-fA-F]/.test(l)?null:l.replace(/\\(.)/g,"$1"),a=s((i.match(/\.((?:\\.|[\w-])+)/)||[])[1]);if(a)return"c"+a;let c=s((i.match(/#((?:\\.|[\w-])+)/)||[])[1]);if(c)return"i"+c;let u=(i.match(/^([a-zA-Z][\w-]*)/)||[])[1];return u?"t"+u.toLowerCase():null}function hi(t,e){if(!e.length)return"";if(e.some(r=>r.includes("&")))return null;let n=e.join(",");try{return t.matches(n),n}catch{return null}}function Rc(t,e){let n=t.createElement("div"),r={};for(let i in e){let o=e[i];(i==="before"||i==="after")&&o.push("q"),r[i]=hi(n,o)}return r}function mi(t){let e={universe:null,pseudoUniverse:null,usesHas:!0,shareGate:null,marginUnstable:!0,paddingUnstable:!0,importantProps:null,pseudoGates:{before:null,after:null,firstLetter:null,marker:null,firstLine:null}};try{let n=new Set(Tr),r={before:[],after:[],firstLetter:[],marker:[],firstLine:[]},i={budget:2e4,usesHas:!1,shareUnsafeSels:new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:new Set,pseudoProps:new Set};for(let u of t.styleSheets)if(!Sn(u,n,r,i))return e;let o=t.adoptedStyleSheets;if(Array.isArray(o)){for(let u of o)if(!Sn(u,n,r,i))return e}typeof t.getAnimations=="function"&&Pr(t.getAnimations(),n);let s=Array.from(i.shareUnsafeSels),a=hi(t.createElement("div"),s)===null?null:s.map(u=>({sel:u,key:Ec(u)})),c=new Set(Cc);for(let u of vc)n.has(u)&&c.add(u);for(let u of i.pseudoProps)c.add(u);return(i.pseudoProps.has("transform")||i.pseudoProps.has("rotate")||i.pseudoProps.has("scale"))&&c.add("transform-origin"),i.pseudoProps.has("perspective")&&c.add("perspective-origin"),{universe:n,pseudoUniverse:c,pseudoGates:Rc(t,r),usesHas:i.usesHas,shareGate:a,marginUnstable:i.marginUnstable,paddingUnstable:i.paddingUnstable,importantProps:i.importantProps}}catch{return e}}var Tr,vc,Cc,kc,Mc,fi,Ac,ui,xn=ct(()=>{"use strict";Tr=["display","position","top","right","bottom","left","float","clear","z-index","box-sizing","width","height","min-width","min-height","max-width","max-height","margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left","overflow-x","overflow-y","visibility","opacity","content-visibility","vertical-align","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","flex-direction","flex-wrap","flex-grow","flex-shrink","flex-basis","order","align-items","align-self","align-content","justify-content","justify-items","justify-self","row-gap","column-gap","grid-template-columns","grid-template-rows","grid-auto-flow","grid-auto-columns","grid-auto-rows","grid-column-start","grid-column-end","grid-row-start","grid-row-end","color","font-family","font-size","font-weight","font-style","font-stretch","line-height","letter-spacing","word-spacing","white-space","text-align","text-transform","text-indent","text-overflow","text-shadow","direction","unicode-bidi","writing-mode","text-orientation","word-break","overflow-wrap","tab-size","list-style-type","list-style-position","list-style-image","counter-reset","counter-increment","counter-set","background-color","background-image","background-size","background-position","background-repeat","background-clip","background-origin","background-attachment","box-shadow","outline-width","outline-style","outline-color","outline-offset","transform","transform-origin","rotate","scale","translate","filter","mix-blend-mode","clip-path","object-fit","object-position","border-collapse","border-spacing","table-layout","caption-side","empty-cells"],vc=["color","font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-kerning","font-feature-settings","font-variation-settings","line-height","letter-spacing","word-spacing","white-space","text-align","text-align-last","text-indent","text-transform","text-shadow","text-rendering","direction","unicode-bidi","word-break","overflow-wrap","writing-mode","text-orientation","hyphens","tab-size","visibility","list-style-type","list-style-position","list-style-image","border-collapse","border-spacing","caption-side","empty-cells","quotes","color-scheme","-webkit-text-fill-color","-webkit-font-smoothing","image-rendering"],Cc=["display","width","height","min-width","min-height"],kc=/::?(?:before|after|first-letter|first-line|marker)/,Mc=/%|\bauto\b|calc\(|var\(/i,fi={before:/::?before\b/,after:/::?after\b/,firstLetter:/::?first-letter\b/,marker:/::marker\b/,firstLine:/::?first-line\b/},Ac=/::?(?:before|after|first-letter|first-line|marker)\b/g;ui=/:(nth-|first-child|last-child|only-|first-of-type|last-of-type|empty|hover|focus|active|target|checked|indeterminate|disabled|enabled|read-only|read-write|placeholder-shown|autofill|valid|invalid|user-valid|user-invalid|in-range|out-of-range|required|optional|default|link|any-link|scope|defined|modal|fullscreen|picture-in-picture|playing|paused|dir\(|lang\(|has\()/});function Z(t){return gi.add(t),t.setAttribute("data-snapdom-internal",""),t}function Gt(t){return gi.has(t)}var gi,Mt=ct(()=>{"use strict";gi=new WeakSet});function Lr(t){if(t=String(t).toLowerCase(),Je.has(t)){let o={};return I.defaultStyle.set(t,o),o}if(I.defaultStyle.has(t))return I.defaultStyle.get(t);let e=[...document.querySelectorAll("#snapdom-sandbox")].find(Gt);e||(e=document.createElement("div"),Z(e),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.includes("-")?"span":t);n.style.all="initial",e.appendChild(n);let r=getComputedStyle(n),i={};for(let o of r){if(xe(o))continue;let s=r.getPropertyValue(o);i[o]=s}for(let o of Tr)!(o in i)&&!xe(o)&&(i[o]=r.getPropertyValue(o));return e.removeChild(n),I.defaultStyle.set(t,i),i}function xe(t){let e=yi.get(t);if(e===void 0){let n=String(t).toLowerCase();e=Pc.has(n)||Tc.test(n)||Fc.test(n),yi.set(t,e)}return e}function wi(t,e){let n=Oc.get(t);if(n===void 0||e[n]!==e[t])return!1;let r=e["writing-mode"];if(r&&r!=="horizontal-tb")return!1;let i=e.direction;return!(i&&i!=="ltr")}function vn(t,e){return!Nc.has(t)&&(e==="inline"||$c.has(t)||bi.has(t))}function Ir(t,e,n){let r=(e.display||"").toLowerCase();if(r==="inline"||bi.has(t))return!1;if(n)return!0;if((e.float||"none").toLowerCase()!=="none")return!1;let o=(e.position||"static").toLowerCase();return o==="absolute"||o==="fixed"?!1:!Wc.has(r)}function ve(t,e,n=!0,r=!1){if(e=String(e||"").toLowerCase(),Je.has(e))return"";let i=[],o=Lr(e),s=(t.display||"").toLowerCase(),a=s==="inline",c=vn(e,s),u=t["text-wrap-mode"]||t["white-space"]||"",l=u==="nowrap"||u==="pre",d=c&&n&&!(c&&n&&!a&&l),h=!1;for(let m in t){if(xe(m)||wi(m,t))continue;let p=t[m];if(d){if(Lc.has(m))continue;if(Ic.has(m)){p&&p!==o[m]&&(i.push(`${m}:${p}`),p!=="auto"&&(h=!0));continue}}if(p&&p!==o[m]){if(!l&&(m==="width"||m==="inline-size")&&p.endsWith("px")&&p.includes(".")){let g=parseFloat(p);if(Number.isFinite(g)){i.push(`${m}:${(g+Dc).toFixed(3)}px`);continue}}i.push(`${m}:${p}`)}}if(d&&!a&&!r&&!h){let m=t.width;m&&m!=="auto"&&m!==o.width&&i.push(`min-width:${m}`)}return i.sort(),i.join(";")}function Or(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 Dr(t,e=null){let n=new Map;for(let s of t){let a=Lr(s);if(!a)continue;let l=(e?Object.entries(a).filter(([d])=>e.has(d)):Object.entries(a)).filter(([d])=>!wi(d,a)).map(([d,h])=>`${d}:${h};`).sort(),f=l.join("");f&&(n.has(f)||n.set(f,{tagList:[],declarations:l}),n.get(f).tagList.push(s))}let r=[...n.values()],i=null;for(let{declarations:s}of r){let a=new Set(s);if(!i){i=a;continue}for(let c of i)a.has(c)||i.delete(c)}i??=new Set;let o="";if(i.size&&r.length>1){let s=r.flatMap(a=>a.tagList);o+=`${s.join(",")} { ${[...i].join("")} }
|
|
@@ -37,4 +37,4 @@ ${g}
|
|
|
37
37
|
} catch (err) {
|
|
38
38
|
self.postMessage({ id, error: String(err) })
|
|
39
39
|
}
|
|
40
|
-
}`,Bu=Math.max(1,Math.min(4,(typeof navigator<"u"&&navigator.hardwareConcurrency||2)-1)),Lt=null,Uu=0,zu=0,ue=new Map;function xa(){for(let t of ue.values())t(void 0);if(ue.clear(),Array.isArray(Lt))for(let t of Lt)try{t?.terminate()}catch{}Lt=!1}function Hu(){let t,e=null;try{t=URL.createObjectURL(new Blob([Wu],{type:"text/javascript"})),e=new Worker(t),e.onmessage=n=>{let r=ue.get(n.data.id);r&&(ue.delete(n.data.id),r(n.data.error?void 0:n.data.url??null))},e.onerror=xa}catch{e=null}return t&&URL.revokeObjectURL(t),e}function ju(){if(Lt===!1)return!1;if(Lt===null){if(typeof Worker>"u"||typeof OffscreenCanvas>"u")return Lt=!1;Lt=[]}let t=Uu++%Bu;if(!Lt[t]){let e=Hu();if(!e)return xa(),!1;Lt[t]=e}return Lt[t]}var Vu=5e3;function qu(t,e,n,r,i){let o=ju();return o?new Promise(s=>{let a=++zu,c=setTimeout(()=>{ue.delete(a),s(void 0)},Vu);ue.set(a,u=>{clearTimeout(c),s(u)});try{o.postMessage({id:a,dataURL:i?"":t,blob:i,srcLength:t.length,targetW:e,targetH:n,resFactor:Sa,quality:wa,mime:r})}catch{clearTimeout(c),ue.delete(a),s(void 0)}}):Promise.resolve(void 0)}async function Eo(t,e,n,r){if(typeof t!="string"||!t.startsWith("data:image")||t.startsWith("data:image/svg"))return null;e=Math.ceil(e),n=Math.ceil(n);let i=t.length+":"+t.slice(0,64)+t.slice(-64)+":"+e+"x"+n,o=I.compress,s=o.get(i);if(s?.source===t)return s.result;let a=er.get(i);if(a?.source===t&&a.cache===o)return a.promise;let c=(async()=>{let l=Nu(t),f=l==="image/jpeg"?"image/jpeg":l==="image/webp"?"image/webp":"image/png",d=Du(t);if(d&&d.w>0&&d.h>0&&!ma(d.w,d.h,e,n))return null;if(t.length>=Lu){let S=await qu(t,e,n,f,r);if(S!==void 0)return S}let h;try{h=await $u(t)}catch{return null}let m=h.naturalWidth||h.width,p=h.naturalHeight||h.height;if(!m||!p)return null;let g=ma(m,p,e,n);if(!g)return null;let y=g*Sa,b=Math.max(1,Math.round(m*y)),w=Math.max(1,Math.round(p*y)),v=document.createElement("canvas");v.width=b,v.height=w;let C=v.getContext("2d");if(!C)return null;C.imageSmoothingEnabled=!0,C.imageSmoothingQuality="high",C.drawImage(h,0,0,b,w);try{let S=v.toDataURL(f,wa);if(typeof S=="string"&&S.startsWith("data:image")&&S.length<t.length)return S}catch{}return null})(),u={source:t,promise:c,cache:o};er.set(i,u);try{let l=await c;return Iu(o,i,t,l),l}finally{er.get(i)===u&&er.delete(i)}}async function Gu(t,e,n=new Map,r={}){if(!e.compress)return{count:0,before:0,after:0};let i=Array.from(t.querySelectorAll("img"));t.tagName==="IMG"&&i.unshift(t);let o=0,s=0,a=0,c=async l=>{let f=l.getAttribute("src")||"";if(!f.startsWith("data:image")||f.startsWith("data:image/svg"))return;let d=parseFloat(l.dataset.snapdomWidth)||parseFloat(l.style.width)||l.width||0,h=parseFloat(l.dataset.snapdomHeight)||parseFloat(l.style.height)||l.height||0;if(!d||!h)return;let m=r.value||=_o(t,e),p=m.density*m.stretch(n.get(l)||l),g=await Eo(f,d*p,h*p,l.__snapdomBlob);g&&(o++,s+=f.length,a+=g.length,l.setAttribute("src",g),nr(l,"attribute","src",f,g,e))},u=6;for(let l=0;l<i.length;l+=u)await Promise.allSettled(i.slice(l,l+u).map(c));return{count:o,before:s,after:a}}var Xu=/^(cover|contain|(\d+(\.\d+)?%(\s+\d+(\.\d+)?%)?))$/;function Yu(t){let e=t.offsetWidth||t.getBoundingClientRect().width||0,n=t.offsetHeight||t.getBoundingClientRect().height||0;return{w:e,h:n}}async function Ku(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=[],o=[t,...t.querySelectorAll("*")];for(let u of o){let l=u.style&&u.style.backgroundImage;l&&l.includes("data:image")&&i.push(u)}let s=0,a=async u=>{let l=n.get(u);if(!l||!l.isConnected)return;let f;try{f=getComputedStyle(l)}catch{return}if((f.backgroundRepeat||"repeat").toLowerCase().split(",").some(_=>_.trim()!=="no-repeat"))return;let h=(u.style.backgroundSize||f.backgroundSize||"auto").toLowerCase();if(h.split(",").some(_=>!Xu.test(_.trim())))return;let{w:m,h:p}=Yu(l);if(!m||!p)return;let g=Math.max(1,...(h.match(/\d+(?:\.\d+)?%/g)||[]).map(_=>parseFloat(_)/100)),y=r.value||=_o(t,e),b=y.density*y.stretch(l)*g,w=m*b,v=p*b,C=u.style.backgroundImage,S=[...C.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],M=C;for(let _ of S){let E=_[2];if(E.startsWith("data:image/svg"))continue;let x=await Eo(E,w,v);x&&(M=M.split(E).join(x),s++)}M!==C&&(u.style.setProperty("background-image",M,u.style.getPropertyPriority("background-image")),nr(u,"style","background-image",C,u.style.backgroundImage,e))},c=6;for(let u=0;u<i.length;u+=c)await Promise.allSettled(i.slice(u,u+c).map(a));return{count:s}}async function Qu(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=Array.from(t.querySelectorAll("image"));t.localName==="image"&&i.unshift(t);let o=0,s=async c=>{let u=c.getAttribute("href")||(typeof c.getAttributeNS=="function"?c.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!u||!u.startsWith("data:image")||u.startsWith("data:image/svg"))return;let l=c.getAttribute("width")||"",f=c.getAttribute("height")||"";if(l.includes("%")||f.includes("%"))return;let d=n.get(c),h=d?O(d):c.style,m=(v,C)=>{if(/^\d+(?:\.\d+)?px$/.test(h?.[v]||""))return parseFloat(h[v]);if(/^\d+(?:\.\d+)?(?:px)?$/.test(C.trim()))return parseFloat(C);try{return d?.[v]?.baseVal?.value||0}catch{return 0}},p=m("width",l),g=m("height",f);if(!p||!g)return;let y=r.value||=_o(t,e),b=y.density*y.stretch(d||c),w=await Eo(u,p*b,g*b);w&&(c.setAttribute("href",w),nr(c,"attribute","href",u,w,e),c.hasAttribute("xlink:href")&&(c.setAttributeNS(ga,"xlink:href",w),nr(c,"attribute","xlink:href",u,w,e)),o++)},a=6;for(let c=0;c<i.length;c+=a)await Promise.allSettled(i.slice(c,c+a).map(s));return{count:o}}async function ir(t,e,n){if(!e.compress)return;let r={};await Gu(t,e,n,r),await Ku(t,e,n,r),await Qu(t,e,n,r)}St();yt();Mt();function Ju(t,e){if(X())return t;let n=t.indexOf("</style>");if(n===-1)return t;let r=/<style\b[^>]*>[\s\S]*?<\/style>/g,i=[],o=n,s;for(r.lastIndex=n;s=r.exec(t);)i.push({text:t.slice(o,s.index),intern:!0}),i.push({text:s[0],intern:!1}),o=r.lastIndex;i.push({text:t.slice(o),intern:!0});let a=new Map,c=/ style="([^"]*)"/g,u;for(let y of i)if(y.intern)for(c.lastIndex=0;u=c.exec(y.text);)a.set(u[1],(a.get(u[1])||0)+1);let l=0;for(let[y,b]of a)b>1&&(l+=(b-1)*y.length);if(l<2048||t.includes(" data-sdi="))return t;let f=Zu(e,i.some(y=>!y.intern),t.includes("data-snapdom-asset"));if(f===null)return t;let d=new Map,h=0,m=[],p=(y,b)=>{if((a.get(b)||0)<2||f.has(b))return y;let w=d.get(b);return w===void 0&&(w="i"+(h++).toString(36),d.set(b,w),m.push(`[data-sdi="${w}"]{${b}}`)),` data-sdi="${w}"`},g="";for(let y of i)g+=y.intern?y.text.replace(c,p):y.text;return t.slice(0,n)+m.join("")+g}function Zu(t,e,n){let r=new Set;if(!e&&!n)return r;if(!t||t.querySelector("[data-sdi]"))return null;let i=c=>{let u=c.getAttribute("style");u&&r.add(u)};if(n&&t.querySelectorAll("[data-snapdom-asset][style]").forEach(i),e)try{let c=u=>{for(let l of u){if(l.type===CSSRule.IMPORT_RULE||l.type===CSSRule.NAMESPACE_RULE)throw new Error("External or namespaced CSS");if(l.selectorText){if(/\[\s*style\b|data-sdi|\[[^\]]*\\|&/i.test(l.selectorText))throw new Error("Attribute-dependent or nested CSS");t.querySelectorAll(l.selectorText).forEach(i)}l.cssRules&&c(l.cssRules)}};for(let u of[...t.querySelectorAll("style")].slice(1)){let l=u.textContent||"";if(/@import\b/i.test(l))return null;let f=new CSSStyleSheet;f.replaceSync(l),c(f.cssRules)}}catch{return null}let o=new Set,s=document.createElement("div"),a=new XMLSerializer;for(let c of r){s.setAttribute("style",c);let u=a.serializeToString(s).match(/ style="([^"]*)"/);u&&o.add(u[1])}return o}async function sr(t,e){let{clipWindow:n,outerTransforms:r,outerShadows:i,rootTransform2D:o,fontsCSS:s}=e,a=t.options;if(t!==a){let{options:Q,...et}=t;t=Object.assign(a,et),Object.defineProperty(t,"options",{value:t,configurable:!0})}let c,u;ta(t,s),await Bt("beforeRender",t);let l=O(t.element),f=t.element.getBoundingClientRect(),d=Math.max(1,D(t.element.offsetWidth||parseFloat(l.width)||f.width||1)),h=Math.max(1,D(t.element.offsetHeight||parseFloat(l.height)||f.height||1)),m=t.element.ownerDocument||document;if(!n&&(t.element===m.body||t.element===m.documentElement)&&!t.__pinned){let Q=Math.max(t.element.scrollHeight||0,m.documentElement?.scrollHeight||0,m.body?.scrollHeight||0),et=Math.max(t.element.scrollWidth||0,m.documentElement?.scrollWidth||0,m.body?.scrollWidth||0);Q>0&&(h=Math.max(h,D(Q))),et>0&&(d=Math.max(d,D(et)));try{let tt=(t.scrollbarCSS||"").length+(t.baseCSS||"").length+(t.fontsCSS||"").length+(t.classCSS||"").length,rt=I.measureHints.get(t.element);if(rt&&rt.cssLen===tt&&rt.w0===d&&rt.docH===Q&&rt.docW===et)rt.csh>0&&(h=Math.max(h,D(rt.csh))),rt.csw>0&&(d=Math.max(d,D(rt.csw)));else{let ot=m.createElement("div");Z(ot),ot.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+d+"px!important;overflow:visible!important;visibility:hidden!important;";let ee=ot.attachShadow({mode:"open"}),ne=m.createElement("style");ne.textContent=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS,ee.appendChild(ne),ee.appendChild(t.clone.cloneNode(!0)),m.body.appendChild(ot);let Ye=ot.scrollHeight,Vt=ot.scrollWidth;m.body.removeChild(ot),I.measureHints.set(t.element,{cssLen:tt,w0:d,docH:Q,docW:et,csh:Ye,csw:Vt}),Ye>0&&(h=Math.max(h,D(Ye))),Vt>0&&(d=Math.max(d,D(Vt)))}}catch{}}if(t.options?.excludeMode==="remove"||typeof t.options?.filter=="function"&&t.options.filterMode==="remove"){let Q=xo(t.element,t.options),et=1,tt=xo(t.element,{}),rt=Math.max(2,h*.15);Number.isFinite(tt)&&tt>=h-rt&&Number.isFinite(Q)&&Q>0&&(h=Math.max(1,Math.min(h,D(Q+et))))}if(t.options?.reconcile)try{let Q=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS;Zs(t.element,t.clone,Q,t.nodeMap,d,h)}catch(Q){console.warn("[SnapDOM] reconcile couldn't run; captured without it.",Q)}let g=(Q,et=NaN)=>{let tt=typeof Q=="string"?parseFloat(Q):Q;return Number.isFinite(tt)?tt:et},y=g(t.options.width),b=g(t.options.height),w=n?D(n.width):d,v=n?D(n.height):h,C=w,S=v,M=Number.isFinite(y),_=Number.isFinite(b),E=v>0?w/v:1;M&&_?(C=Math.max(1,D(y)),S=Math.max(1,D(b))):M?(C=Math.max(1,D(y)),S=Math.max(1,D(C/(E||1)))):_&&(S=Math.max(1,D(b)),C=Math.max(1,D(S*(E||1))));let x=0,k=0,R=d,T=h;if(n){let Q=0,et=0;if(Ro(t.element)){let tt=null;if(!r&&o&&Number.isFinite(o.a))tt={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0};else{let rt=fe(t.element),ot=So(l.transform&&l.transform!=="none"?l.transform:"",rt);ot&&ot.is2D&&(tt={a:ot.a,b:ot.b,c:ot.c,d:ot.d,e:0,f:0})}if(tt&&!(tt.a===1&&tt.b===0&&tt.c===0&&tt.d===1)){let{ox:rt,oy:ot}=dn(l,d,h),ee=Oe(d,h,tt,rt,ot);Q=ee.minX,et=ee.minY}}x=D(n.x+Q),k=D(n.y+et),R=D(x+n.width),T=D(k+n.height)}else if(!r&&o&&Number.isFinite(o.a)){let Q={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0},et=Oe(d,h,Q,0,0);x=D(et.minX),k=D(et.minY),R=D(et.maxX),T=D(et.maxY)}else if(r&&Ro(t.element)){let et=l.transform&&l.transform!=="none"?l.transform:"",tt=fe(t.element),rt=Zt({baseTransform:et,rotate:tt.rotate||"0deg",scale:tt.scale,translate:tt.translate,width:d,height:h}),{ox:ot,oy:ee}=dn(l,d,h),ne=rt.is2D?rt:new DOMMatrix(rt.toString()),Ye={a:ne.a,b:ne.b,c:ne.c,d:ne.d,e:0,f:0},Vt=Oe(d,h,Ye,ot,ee);x=D(Vt.minX),k=D(Vt.minY),R=D(Vt.maxX),T=D(Vt.maxY)}let L=po(l),W=ho(l),P=mo(l),A=go(l),N=yo(l),$=f.width>0?(R-x)/f.width:1,F=f.height>0?(T-k)/f.height:1,z=i==="subtree"&&!n?Us(t.element,t.nodeMap,t.styleCache,$,F):{top:0,right:0,bottom:0,left:0},q=n?{top:0,right:0,bottom:0,left:0}:i?{top:D(Math.max(L.top,W.top,z.top)+P.top+A.top+N.bleed.top),right:D(Math.max(L.right,W.right,z.right)+P.right+A.right+N.bleed.right),bottom:D(Math.max(L.bottom,W.bottom,z.bottom)+P.bottom+A.bottom+N.bleed.bottom),left:D(Math.max(L.left,W.left,z.left)+P.left+A.left+N.bleed.left)}:{top:P.top,right:P.right,bottom:P.bottom,left:P.left};x=D(x-q.left),k=D(k-q.top),R=D(R+q.right),T=D(T+q.bottom);let j=Math.max(1,D(R-x)),J=Math.max(1,D(T-k)),B="http://www.w3.org/2000/svg",ut=Ro(t.element)?2:0,at=D(ut+(r?0:1)),st=Math.ceil(j+at*2),nt=Math.ceil(J+at*2),pt=D(-(D(x)-at)),zt=D(-(D(k)-at)),ge=Math.max(0,pt),V=Math.max(0,zt),G=D(st-Math.min(0,pt)),U=D(nt-Math.min(0,zt)),ht=m.defaultView||window,Y=!X()&&CSS.supports("zoom","2")&&ht.devicePixelRatio||1;a.__layoutZoom=Y;let Ct=document.createElementNS(B,"foreignObject");Ct.setAttribute("x",String(Math.min(0,pt)*Y)),Ct.setAttribute("y",String(Math.min(0,zt)*Y)),Ct.setAttribute("width",String(G*Y)),Ct.setAttribute("height",String(U*Y)),Ct.style.overflow="visible";let ye=document.createElement("style"),bn="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";ye.textContent=(t.scrollbarCSS||"")+t.baseCSS+t.fontsCSS+bn+t.classCSS,Ct.appendChild(ye);let Ge=document.createElement("div");Ge.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ge.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${G}px;height:${U}px`+(ge!==0||V!==0?`;padding:${V}px 0 0 ${ge}px !important`:"")+(Y!==1?`;zoom:${Y} !important`:""),Ge.appendChild(t.clone),Ct.appendChild(Ge);let Sr=new XMLSerializer().serializeToString(Ct),Ht=M||_,xr=Object.freeze({w0:w,h0:v,vbW:st,vbH:nt,targetW:C,targetH:S,contentX:D(pt+(n?x:0)),contentY:D(zt+(n?k:0)),clip:n?Object.freeze({x:D(x),y:D(k),width:w,height:v}):null});Object.defineProperty(a,"meta",{value:xr,enumerable:!0,writable:!1,configurable:!0});let vr=!Ht||X()?st:M?C:D(st*(S/nt)),wn=!Ht||X()?nt:_?S:D(nt*(C/st)),jt=parseFloat(O(m.documentElement)?.fontSize)||16,ei=Y!==1,lc=`<svg xmlns="${B}" width="${vr}" height="${wn}" viewBox="0 0 ${st} ${nt}" font-size="${jt}px">${ei?`<g transform="scale(${1/Y})">`:""}`,fc=ei?"</g></svg>":"</svg>";u=lc+Ju(Sr,Ct)+fc,c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`,t.svgString=u,t.dataURL=c,a.__artifacts={classCSS:t.classCSS||"",fontsCSS:t.fontsCSS||"",baseCSS:t.baseCSS||"",scrollbarCSS:t.scrollbarCSS||""},await Bt("afterRender",t),t.clone=t.nodeMap=t.styleCache=t.svgString=null;let Cr=[...document.querySelectorAll("#snapdom-sandbox")].find(Gt);return Cr&&Cr.style.position==="absolute"&&Cr.remove(),t.dataURL}function Ro(t){return Hs(t)}function td(t){let e=Array.isArray(t.plugins)?t.plugins:Ao(),n=[];for(let r of e){let i=ze(r);i&&typeof i.resolveNode=="function"&&n.push(i.resolveNode.bind(i))}return n.length?n:null}async function va(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");e.__session=ko(e.cache),delete e.__compressedAssets,delete e.__compressedSnapshot,delete e.__compressionDensity,e.__resolveNodeHooks=td(e);let n=e;n.element=t,Object.defineProperty(n,"options",{value:n,configurable:!0});let r,i,o,s,a,c,u,l="",f=null,d=e.needs||gt,h=n.format,m=n.type;await Bt("beforeSnap",n);let p=n.format!==h&&/^(?:png|jpe?g|webp|svg)$/i.test(n.format),g=n.type!==m&&/^(?:png|jpe?g|webp|svg)$/i.test(n.type);if(p||g){let R=String(p?n.format:n.type).toLowerCase();n.format=R==="jpg"?"jpeg":R,n.type=n.format,n.__explicitFormat=n.format,/^(?:jpeg|webp)$/.test(n.format)&&(n.backgroundColor==null||n.backgroundColor==="transparent")&&(n.backgroundColor="#ffffff")}await Bt("beforeClone",n);let y=n.outerTransforms!==!1,b=n.outerShadows==="subtree"?"subtree":!!n.outerShadows,w=n.clip?jn(n.element,n.clip):null;if(e.__styleShare===void 0)try{e.__styleShare=Ni(n.element)&&(typeof n.element.getAnimations!="function"||n.element.getAnimations({subtree:!0}).length===0)}catch{e.__styleShare=!1}let v=xi(e.fast);for(;;){e.__slicer=v;let R=Jn(n.element,w);try{({clone:r,classCSS:i,classPrefixCSS:o,styleCache:s,nodeMap:a,reconcileRisk:c,clipWindow:u}=await ea(n.element,n.options)),c>0&&!e.reconcile&&(At(e.__session,"reconcile-risk","text in inline/table-cell elements kept natural width and may re-wrap; pass { reconcile: true } for pixel-exact layout"),I.warnedReconcile||(I.warnedReconcile=!0,console.warn("[SnapDOM] Some text may wrap differently in the capture. Pass { reconcile: true } to fix it (about 2x slower)."))),!y&&r&&(f=zs(n.element,r)),!b&&r&&Ys(n.element,r,n.options),r&&(Qs(n.element,r,a),Ks(n.element,r))}finally{R()}if(!v?.yielded||!e.__tornSinceStart?.())break;v=null,e.__session=ko(e.cache)}if(e.__slicer=null,n.clone=r,n.classCSS=i,n.styleCache=s,n.nodeMap=a,await Bt("afterClone",n),!Be(d,"render"))return null;if(v?.due()&&await v.pause(),Vn(n.clone),n.options?.excludeMode==="remove"||typeof n.options?.filter=="function"&&n.options.filterMode==="remove")try{Js(n.element,n.clone,n.styleCache,n.nodeMap)}catch(R){At(e.__session,"shrink-failed","shrink pass failed",R),console.warn("[SnapDOM] Couldn't close the gaps left by removed elements.",R)}try{await Ln(n.clone,n.element,n.nodeMap)}catch{}let C=R=>Promise.resolve().then(R),S=(async()=>{await Promise.all([C(()=>Gn(n.clone,n.options)),C(()=>Yn(n.element,n.clone,n.styleCache,n.options,n.nodeMap))]);try{oa(n.element,n.clone,n.nodeMap)}catch(R){At(e.__session,"backdrop-filter-failed","backdrop-filter emulation failed",R),console.warn("[SnapDOM] Couldn't reproduce a backdrop-filter; captured without it.",R)}if(e.compress&&(e.__compressionClip=u,e.__compressionRootTransform=f,await C(()=>ir(n.clone,n.options,n.nodeMap))),e.captureSelection)try{us(n.nodeMap)}catch(R){At(e.__session,"selection-compose-failed","field selection compose failed",R)}})(),M=Promise.resolve();(e.embedFonts==="auto"?((n.element.ownerDocument||document).fonts?.size||0)>0:e.embedFonts)&&(M=C(async()=>{let R=n.element.ownerDocument||document,T=w?P=>{try{let A=P.getBoundingClientRect();return A.right>=w.left-200&&A.left<=w.right+200&&A.bottom>=w.top-200&&A.top<=w.bottom+200}catch{return!0}}:null,{required:L,usedCodepoints:W}=!w&&e.__fontUsage||Wn(n.element,T);if(e.embedFonts==="auto"){let P=new Set;try{for(let N of R.fonts)P.add(String(N.family).replace(/["']/g,"").toLowerCase())}catch{}if(!(P.size>0&&Array.from(L).some(N=>P.has(String(N).split("__")[0].toLowerCase()))))return}if(X()){let P=new Set(Array.from(L).map(A=>String(A).split("__")[0]).filter(Boolean));await Bn(P,1,R)}l=await Ms({required:L,usedCodepoints:W,exclude:n.options.excludeFonts,localFonts:n.options.localFonts,useProxy:n.options.useProxy,fontStylesheetDomains:n.options.fontStylesheetDomains,iconMatchers:n.options.__iconMatchers,doc:R})})),await Promise.all([S,M]);let E=(n.options.plugins||[]).some(R=>R&&(typeof R.beforeRender=="function"||typeof R.afterRender=="function"));n.options.engine,v?.due()&&await v.pause();let x=n.clone;or(x,e.__compressedAssets);let k=await sr(n,{clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,fontsCSS:l});if(e.__compressedSnapshot=rr(x,e.__compressedAssets),typeof e.__retain=="function")try{e.__retain({clone:r,nodeMap:a,styleCache:s,styleMap:e.__session.styleMap,classPrefixCSS:o,fontsCSS:l,clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,__compressedAssets:e.__compressedAssets,__compressionDensity:e.__compressionDensity})}catch{}return k}yt();kt();var ed=new Set(["png","jpeg","jpg","webp","svg"]);function Ca(t={}){let e=typeof t.type=="string"&&ed.has(t.type.toLowerCase())?t.type.toLowerCase():null,n=t.format??e??"png";n==="jpg"&&(n="jpeg");let r=t.format!=null?n:e==="jpg"?"jpeg":e,i=ni(t.cache),o=t.exclude==null?[]:Array.isArray(t.exclude)?t.exclude:[t.exclude],s=[],a=[];for(let f of o)if(typeof f=="string")try{document.createDocumentFragment().querySelector(f),s.push(f)}catch{console.warn(`[SnapDOM] Invalid exclude selector "${f}"; ignored.`)}else typeof f=="function"?a.push(f):f!=null&&console.warn("[SnapDOM] Ignored an exclude entry: use a CSS selector or a function.",f);let c=t.excludeMode??"hide",u=f=>{if(!f||f.nodeType!==1)return!1;if(f.getAttribute("data-capture")==="exclude")return!0;for(let d of Array.isArray(l.exclude)?l.exclude:[])try{if(f.matches(d))return!0}catch{}for(let d of Array.isArray(l.excludePredicates)?l.excludePredicates:[])try{if(d(f))return!0}catch{}if(typeof l.filter=="function")try{if(!l.filter(f))return!0}catch{}return!1},l={debug:t.debug??!1,scale:t.scale??1,exclude:s,excludePredicates:a.length?a:null,excludeMode:c,filter:t.filter??null,filterMode:t.filterMode??"hide",shouldExclude:u,placeholders:t.placeholders!==!1,captureSelection:t.captureSelection??!1,canvas:it(t.canvas,"canvas")?t.canvas:null,embedFonts:t.embedFonts??"auto",iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],__iconMatchers:ms(t.iconFonts),localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],fallbackURL:t.fallbackURL??void 0,cache:i,__styleShare:t.__styleShare,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:n,__explicitFormat:r,type:n,quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(n)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,reconcile:t.reconcile??!1,burst:t.burst,fast:t.fast===!1||t.fast==="auto"?t.fast:!0,engine:t.engine,invalidate:t.invalidate??!1,__pinned:t.__pinned===!0,clip:t.clip??null,compress:t.compress!==!1,excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1};return l}mt();oe();St();var ka="svg,iframe,canvas,video,audio,object,embed,slot,template,picture,style,pre";function nd(t){try{return t.matches?.("dialog,[popover]")||!!t.querySelector?.("dialog,[popover]")}catch{return!0}}var rd=/(?:^|;)\s*(?:-webkit-)?backdrop-filter:\s*(?!none(?:\s*!important)?(?:;|$))[^;]+/i;function od(t){if(t.__usesBackdropFilter!==void 0)return t.__usesBackdropFilter;let e=!1;for(let n of t.styleMap.values())if(rd.test(n)){e=!0;break}return t.__usesBackdropFilter=e,e}function id(t,e){let n=e.has("backdrop-filter")||e.has("-webkit-backdrop-filter");if(!n&&(n=(o=>/(?:^|;)\s*(?:-webkit-)?backdrop-filter\s*:/i.test(o.getAttribute?.("style")||""))(t),!n))try{n=!!t.querySelector?.('[style*="backdrop-filter" i]')}catch{n=!0}if(!n)return!1;let r=[t];t.querySelectorAll&&r.push(...t.querySelectorAll("*"));for(let i of r){let o=getComputedStyle(i),s=o.getPropertyValue("backdrop-filter")||o.getPropertyValue("-webkit-backdrop-filter");if(s&&s!=="none")return!0}return!1}var Ma=new WeakMap;function sd(t){let e=Wt(),n=Ma.get(t);if(n&&n.epoch===e)return n.leaky;let r=!1,i={budget:2e4},o=s=>{for(let a=0;a<s.length&&!r;a++){if(--i.budget<0){r=!0;return}let c=s[a],u=c.selectorText;if(u&&/[+~]|:has\(/.test(u)){r=!0;return}let l=c.style;if(l&&(l.counterReset||l.counterIncrement||l.counterSet||l.content&&l.content.includes("counter"))){r=!0;return}c.cssRules&&c.cssRules.length&&o(c.cssRules)}};try{for(let s of t.styleSheets){let a=null;try{a=s.cssRules}catch{r=!0}if(r)break;a&&o(a)}if(!r){let s=t.adoptedStyleSheets;if(Array.isArray(s))for(let a of s){if(r)break;try{o(a.cssRules)}catch{r=!0}}}}catch{r=!0}return Ma.set(t,{epoch:e,leaky:r}),r}var ad=1/16;function cd(t,e){if(t===e)return!0;if(!t.endsWith("px")||!e.endsWith("px"))return!1;let n=parseFloat(t),r=parseFloat(e);return Number.isFinite(n)&&Number.isFinite(r)&&Math.abs(n-r)<=ad}var ar=new Map,ld=["width","height","min-width","min-height"];function fd(t){let e=ar.get(t);if(e===void 0){e=null;for(let n of ld){let r=t.match(new RegExp("(?:^|;)"+n+":([^;]+)"));r&&r[1].endsWith("px")&&((e||={})[n]=r[1])}ar.size>5e3&&ar.clear(),ar.set(t,e)}return e}function ud(t){if(!(!t.classList||!t.classList.length))for(let e of Array.from(t.classList))/^c\d+$/.test(e)&&t.classList.remove(e)}function dd(t,e){let n=[t];for(;n.length;){let r=n.pop();if(r.nodeType===1){let i=e.nodeMap.get(r);i!==void 0&&(e.nodeMap.delete(r),e.srcToClone.get(i)===r&&e.srcToClone.delete(i)),e.styleMap.delete(r)}for(let i=r.firstChild;i;i=i.nextSibling)n.push(i)}}var Fo={attempts:0,served:0,reconciled:0};async function Aa(t,e,n){Fo.attempts++;try{let r=await pd(t,e,n);return r&&Fo.served++,r}catch{return null}}async function pd(t,e,n){let r=e.retained;if(!r||!r.clone||!r.styleMap||!r.srcToClone||n.reconcile||n.clip||n.captureSelection||r.clipWindow||t.scrollTop||t.scrollLeft||nd(t)||od(r)||r.fontsCSS||tr(n))return null;for(let f of n.plugins||[])if(f&&(typeof f.beforeSnap=="function"||typeof f.beforeClone=="function"||typeof f.resolveNode=="function"||typeof f.afterClone=="function"))return null;if(r.classPrefixCSS&&(r.classPrefixCSS.includes("::marker")||r.classPrefixCSS.includes("::first-line"))||n.excludeMode==="remove")return null;let i=t.ownerDocument||document,o=an(t);if(!o||sd(i))return null;let s=[];t:for(let f of e.dirtyRoots){if(!f.isConnected||f===t||!t.contains(f))return null;for(let d of e.dirtyRoots)if(d!==f&&d!==t&&d.contains(f))continue t;s.push(f)}if(!s.length)return null;n.__compressedAssets=r.__compressedAssets,n.__compressionDensity=r.__compressionDensity,n.__compressionRootTransform=r.rootTransform2D;for(let f of s){if(f.parentElement===t||f.matches?.(ka)||f.querySelector?.(ka)||id(f,o))return null;let d=r.srcToClone.get(f);if(!d||!d.parentNode)return null;let h=new Map,m={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:h,options:n},p=Jn(f,null),g=Hn(f),y;try{y=await Jt(f,m,n)}finally{g(),p()}if(!y||y.nodeType!==1||y.querySelector?.("style[data-sd]")||(await Ie(f,y,m,n),m.__pseudoCSS)||m.__usesPlaceholder&&!r.classPrefixCSS?.includes("[data-sd-ph]"))return null;await Fn(y,m),Vn(y);try{await Ln(y,f,h)}catch{}if(await Promise.all([Gn(y,n),Yn(f,y,r.styleCache,n,h)]),n.compress)try{await ir(y,n,h)}catch{}for(let[b,w]of h.entries())Co(b,w,h,r.styleCache);d.replaceWith(y),dd(d,r);for(let[b,w]of h.entries())r.nodeMap.set(b,w),r.srcToClone.set(w,b)}let a={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:n};for(let[f,d]of r.nodeMap.entries()){if(!d||d.nodeType!==1||!d.isConnected)continue;let h=r.styleMap.get(f);if(!h)continue;let m=fd(h);if(!m)continue;let p=null,g=!1;for(let y in m)if(p||=getComputedStyle(d),!cd(p.getPropertyValue(y),m[y])){g=!0;break}if(g){if(n.__compressedAssets?.has(f))return null;Fo.reconciled++,await dt(d,f,a,n)}}let c=Ze(r.styleMap);for(let[f,d]of r.styleMap.entries())ud(f),vo(f,d,c);let u=(r.classPrefixCSS||"")+Array.from(c.entries()).map(([f,d])=>`.${d}{${f}}`).join("");or(r.clone,n.__compressedAssets);let l=await sr({element:t,options:n,plugins:n.plugins,clone:r.clone,classCSS:u,styleCache:r.styleCache,nodeMap:r.nodeMap},{clipWindow:null,outerTransforms:r.outerTransforms,outerShadows:r.outerShadows,rootTransform2D:r.rootTransform2D,fontsCSS:r.fontsCSS||""});return n.__compressedSnapshot=rr(r.clone,n.__compressedAssets),r.__compressedAssets=n.__compressedAssets,r.__compressionDensity=n.__compressionDensity,l}kt();var Po=new WeakMap,lr=new WeakMap,Oa=new WeakSet,To=new WeakMap,hd=64,hn=new Map,Da=["scroll","input","change","focusin","focusout","pointerdown","pointerup","pointercancel","keydown","keyup","beforetoggle","toggle"],md=["(prefers-color-scheme: dark)","(prefers-reduced-motion: reduce)","(prefers-contrast: more)","(forced-colors: active)","(inverted-colors: inverted)","(prefers-reduced-transparency: reduce)","(hover: hover)","(any-hover: hover)","(pointer: coarse)","(any-pointer: coarse)","(color-gamut: p3)","(dynamic-range: high)"];function gd(t){let e=t?.defaultView;return typeof e?.matchMedia!="function"?"":md.map(n=>{try{return e.matchMedia(n).matches?"1":"0"}catch{return"?"}}).join("")}function _a(t){let e=[];for(let n=t;n;){try{let r=n.getBoundingClientRect();e.push(r.x,r.y,r.width,r.height)}catch{e.push("?")}n.parentElement?n=n.parentElement:n=n.getRootNode?.()?.host||null}return e.join("|")}function Ea(t,e){if(e.disposed||(hn.delete(t),hn.set(t,e),hn.size<=hd))return;let[n,r]=hn.entries().next().value;Wa(n,r)}function Wa(t,e){e.disposed=!0,hn.delete(t),Po.delete(t);for(let n of e.observers)try{n.disconnect()}catch{}for(let n of Da)t.removeEventListener(n,e.onMediaDirty,!0);for(let n of e.trackedShadowRoots.keys())for(let r of No)n.removeEventListener(r,e.onMediaDirty,!0);for(let[n,r]of e.trackedImages)n.removeEventListener("load",r),n.removeEventListener("error",r);e.trackedImages.clear(),e.trackedShadowRoots.clear(),e.images.length=0,e.controls.length=0,e.scrollNodes.length=0,e.observers.length=0,e.last=null,e.retained=null,e.retainedFrameDriven=!1}function Ba(t){if(Oa.has(t))return!1;lr.delete(t);let e=[t],n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i],s=[];o?.nodeType===1&&s.push(o);try{s.push(...o.querySelectorAll("*"))}catch{return!1}for(let a of s){a.shadowRoot&&e.push(a.shadowRoot);let c=String(a.localName||a.tagName||"").toLowerCase();if(/^(?:iframe|canvas|video|audio|object|embed|marquee|blink)$/.test(c)||c==="progress"&&!a.hasAttribute("value")||/^(?:animate|animatetransform|animatemotion|set)$/.test(c))return!1;let u="";if(c==="img"){r.push(a);try{u=a.currentSrc||a.src||""}catch{}}/^(?:input|textarea|select|option)$/.test(c)&&n.push(a);let l=a.getAttribute?.("style")||"",f=To.get(a);if(u||l){if((!f||f.src!==u||f.style!==l)&&(f={src:u,style:l,animated:Ve(u)||Ve(l)},To.set(a,f)),f.animated)return!1}else f&&To.delete(a)}}return lr.set(t,{roots:e.slice(1),controls:n,images:r}),!0}function $o(t,e){if(!t.querySelectorAll)return!1;let n=lr.get(t);lr.delete(t);let r=new Set(n?.roots||[]);if(n&&(e.controls=n.controls,e.scannedImages=n.images),!n){let i=[t];for(let o=0;o<i.length;o++){let s=i[o];s.shadowRoot&&!r.has(s.shadowRoot)&&(r.add(s.shadowRoot),i.push(s.shadowRoot));for(let a of s.querySelectorAll("*"))a.shadowRoot&&!r.has(a.shadowRoot)&&(r.add(a.shadowRoot),i.push(a.shadowRoot))}}for(let[i,o]of e.trackedShadowRoots)if(!r.has(i)){try{o.disconnect()}catch{}for(let a of No)i.removeEventListener(a,e.onMediaDirty,!0);e.trackedShadowRoots.delete(i);let s=e.observers.indexOf(o);s>=0&&e.observers.splice(s,1)}for(let i of r)if(!e.trackedShadowRoots.has(i))try{let o=new MutationObserver(e.markDirty);o.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),o.__flush=e.markDirty,e.observers.push(o),e.trackedShadowRoots.set(i,o);for(let s of No)i.addEventListener(s,e.onMediaDirty,{capture:!0,passive:!0});e.retained&&e.dirtyAll()}catch{}return!!n}var No=["scroll","change","beforetoggle","toggle"];function fr(t,e){return[t,...e.trackedShadowRoots.keys()]}function Lo(t,e){let n=e.scannedImages;if(e.scannedImages=null,!n){n=[],t.tagName==="IMG"&&n.push(t);for(let r of fr(t,e))r.querySelectorAll&&n.push(...r.querySelectorAll("img"))}if(e.images=n,e.trackedImages.size){let r=new Set(n);for(let[i,o]of e.trackedImages)r.has(i)||(i.removeEventListener("load",o),i.removeEventListener("error",o),e.trackedImages.delete(i))}for(let r of n){if(r.complete||e.trackedImages.has(r))continue;let i=()=>{e.capturing&&(e.torn=!0),e.dirty=!0,e.dirtyRoots=null,r.removeEventListener("load",i),r.removeEventListener("error",i),e.trackedImages.delete(r)};e.trackedImages.set(r,i),r.addEventListener("load",i),r.addEventListener("error",i)}}function Ra(t){let e=new Map,n=new Map,r=new Map;for(let i of t)if(ae(i))if(i.type==="attributes"){let o=e.get(i.target);o||e.set(i.target,o=new Map),o.has(i.attributeName)||o.set(i.attributeName,i.oldValue)}else if(i.type==="characterData")n.has(i.target)||n.set(i.target,i.oldValue);else if(i.type==="childList"){let o=r.get(i.target);o||r.set(i.target,o=new Map);for(let s of i.addedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)+1)}for(let s of i.removedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)-1)}}else return!0;for(let[i,o]of e)for(let[s,a]of o)if(i.getAttribute(s)!==a)return!0;for(let[i,o]of n)if(i.data!==o)return!0;for(let i of r.values())for(let o of i.values())if(o!==0)return!0;return!1}var yd=/(?:^data:image\/(?:gif|apng)|\.(?:gif|apng)(?=[?#)'"\s;]|$))/i,je=t=>t&&(typeof t=="object"||typeof t=="function")?cr(t):"-";function bd(t,e=131072){if(t=String(t||"").trim(),!/^data:/i.test(t))return"";let n=t.indexOf(",");if(n<0)return"";let r=t.slice(0,n),i=t.slice(n+1);try{if(/;base64/i.test(r)){let o=Math.ceil(e/3)*4;return atob(i.slice(0,o-o%4))}return i.slice(0,e*3).replace(/%([0-9a-f]{2})/gi,(o,s)=>String.fromCharCode(parseInt(s,16))).slice(0,e)}catch{return""}}function wd(t){let e=(t.match(/^data:([^;,]+)/i)?.[1]||"").toLowerCase();if(e==="image/gif"||e==="image/apng")return!0;if(!/image\/(?:png|webp|avif|svg\+xml)/.test(e))return!1;let n=bd(t);return e==="image/png"?n.includes("acTL"):e==="image/webp"?n.includes("ANIM")||n.includes("ANMF")||n.includes("VP8X")&&!!(n.charCodeAt(n.indexOf("VP8X")+8)&2):e==="image/avif"?n.includes("avis"):/<(?:animate|animateTransform|animateMotion|set)\b|@keyframes\b|animation(?:-name)?\s*:/i.test(n)}function Fa(t){let e=String(t||"").trim();return e?yd.test(e)?!0:/^data:/i.test(e)?wd(e):!1:!1}function Ve(t){let e=String(t||"");if(Fa(e))return!0;for(let n of e.matchAll(/url\(\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^)]*))\s*\)/gi))if(Fa(n[1]??n[2]??n[3]))return!0;return!1}function Ta(t,e=null){let n=t&&t.clone;if(!n)return!1;let r=e?e.map(i=>t.srcToClone?.get(i)).filter(Boolean):[n];for(let i of r)for(let o of Ua(i))if(Ve(o.getAttribute?.("src"))||Ve(o.getAttribute?.("href"))||Ve(o.getAttribute?.("style"))||Ve(t.styleMap?.get(o)))return!0;return!1}function Ua(t){let e=[];t&&t.nodeType===1&&e.push(t);try{e.push(...t.querySelectorAll("*"))}catch{}return e}function Io(t,e){let n=[],r=new Set,i=o=>{o&&!r.has(o)&&(r.add(o),n.push(o))};t.matches?.("input,textarea,select,option")&&i(t);for(let o of fr(t,e))try{for(let s of o.querySelectorAll("input,textarea,select,option"))i(s)}catch{}e.controls=n}function Oo(t,e){let n=[],r=new Set,i=(o,s=!1)=>{if(!(!o||r.has(o))){r.add(o);try{(s||o.scrollLeft||o.scrollTop||o.scrollWidth>o.clientWidth||o.scrollHeight>o.clientHeight)&&n.push(o)}catch{}}};for(let o=t;o;o=o.parentElement)i(o,!0);for(let o of fr(t,e))for(let s of Ua(o))i(s);e.scrollNodes=n}function Pa(t,e){let n=t.ownerDocument||document,r=n.defaultView,i=[r?.location?.hash||"",gd(n),r?.innerWidth||0,r?.innerHeight||0,r?.devicePixelRatio||1,r?.screen?.orientation?.type||""];try{i.push(...[...n.adoptedStyleSheets||[]].map(je))}catch{}for(let l of e.trackedShadowRoots.keys())try{i.push("#shadow",...[...l.adoptedStyleSheets||[]].map(je))}catch{}let o=n.activeElement,s=n.fullscreenElement;(o?.contains(t)||t.contains(o))&&i.push(je(o)),(s?.contains(t)||t.contains(s))&&i.push(je(s));let a=[r?.scrollX||0,r?.scrollY||0];for(let l of e.scrollNodes)a.push(l.scrollLeft||0,l.scrollTop||0);let c=[];for(let l of e.controls){let f=String(l.localName||"").toLowerCase();f==="input"?c.push(l.type,Qe(l)?l.value.length:l.value,l.checked?1:0,l.indeterminate?1:0):f==="textarea"?c.push(l.value):f==="select"?c.push(l.selectedIndex,l.value):c.push(l.selected?1:0)}let u=[];for(let l of e.images){let f="";try{f=l.currentSrc||l.src||""}catch{}u.push(f,l.complete?1:0,l.naturalWidth||0,l.naturalHeight||0)}return{style:i.join("|"),scroll:a.join("|"),controls:c,images:u,frameDriven:e.retainedFrameDriven}}function He(t,e,n){if(!t)return!1;let r=t[n],i=e[n];if(r===i)return!0;if(!Array.isArray(r)||r.length!==i.length)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}function $a(t,e){let n=new Set;for(let r of fr(t,e))try{let i=r.getAnimations?.(r.nodeType===1?{subtree:!0}:void 0)||[];for(let o of i)n.add(o)}catch{}return[...n]}function Na(t){return t.map(e=>[je(e),e.playState,Math.round((Number(e.currentTime)||0)*10),e.playbackRate].join(":")).join("|")}function Sd(t,e,n){if(!n||n.nodeType!==1)return null;if(n===t||t.contains(n))return t;for(let r of e.trackedShadowRoots.keys())if(r.contains(n))return r;return null}function xd(t){let e={dirty:!0,pending:[],torn:!1,dirtyRoots:new Set,retained:null,retainedFrameDriven:!1,disposed:!1,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedShadowRoots:new Map,trackedImages:new Map,images:[],scannedImages:null,scrollNodes:[],controls:[],envEpoch:_e(),styleEpoch:Wt(),styleStamp:sn(t),outsideMutations:on(t),geometry:null,renderState:null},n=()=>{e.dirty=!0,e.dirtyRoots=null},r=a=>{if(!e.dirtyRoots)return;let c=a&&(a.nodeType===1?a:a.parentElement);if(!c||c===t||!t.contains(c)||e.dirtyRoots.size>=12){e.dirtyRoots=null;return}e.dirtyRoots.add(c)},i=a=>{if(e.capturing){for(let c of a)e.pending.push(c);return}for(let c of a)ae(c)&&(e.dirty=!0,r(c.target))},o=()=>{if(e.capturing){e.torn=!0;return}n()};e.dirtyAll=n;try{let a=new MutationObserver(i);a.observe(t,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),a.__flush=i,e.observers.push(a)}catch{}e.markDirty=i,e.onMediaDirty=o;try{for(let a of Da)t.addEventListener(a,o,{capture:!0,passive:!0})}catch{}return $o(t,e)||Io(t,e),Oo(t,e),Lo(t,e),e}var vd=0,La=new WeakMap;function cr(t){let e=La.get(t);return e||(e="@"+ ++vd,La.set(t,e)),e}function Do(t,e){let n=typeof t;if(n==="undefined")return null;if(t===null||n==="boolean"||n==="number"||n==="string")return JSON.stringify(t);if(n==="function"||n==="symbol")return n==="symbol"?null:JSON.stringify(cr(t));if(n!=="object")return null;if(typeof t.nodeType=="number")return JSON.stringify(cr(t));if(e.has(t))return null;e.add(t);try{if(Array.isArray(t)){let o=[];for(let s of t){let a=Do(s,e);if(a===null)return null;o.push(a)}return"["+o.join(",")+"]"}let r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)return JSON.stringify(cr(t));let i=[];for(let o of Object.keys(t).sort()){let s=t[o];if(s===void 0)continue;let a=Do(s,e);if(a===null)return null;i.push(JSON.stringify(o)+":"+a)}return"{"+i.join(",")+"}"}finally{e.delete(t)}}function Ia(t,e){let{burst:n,invalidate:r,...i}=t||{};try{let o=Do(i,new Set);return o===null?null:`${(e||[]).map(je).join(",")}:${o}`}catch{return null}}function za(t,e,n,r,i=null){let o=Po.get(t);o||(o=xd(t),o.baselineSignature=Ia(e,n.plugins),Po.set(t,o));let s=Ia(e,n.plugins),a=async()=>{if(o.disposed)return r();let u=s===null||s!==o.baselineSignature;u&&s!==null?o.pendingSig===s?(o.baselineSignature=s,o.last=null,o.dirty=!0,o.dirtyRoots=null,o.pendingSig=null,u=!1):o.pendingSig=s:o.pendingSig=null,$o(t,o),Lo(t,o);for(let M of o.observers)M.__flush(M.takeRecords());Tt();let l=on(t);o.dirty&&o.outsideMutations!==l&&o.dirtyAll(),o.outsideMutations=l;let f=t.getRootNode?.(),d=[...o.trackedShadowRoots.keys()];f?.nodeType===11&&!d.includes(f)&&d.push(f),_n(t.ownerDocument||document,d);let h=sn(t);o.styleStamp!==h&&(o.styleStamp=h,o.dirty||o.dirtyAll());let m=Pa(t,o),p=$a(t,o);m.animation=Na(p),o.renderState&&(!He(o.renderState,m,"style")&&(Ee(),o.dirtyAll()),He(o.renderState,m,"scroll")||o.dirtyAll(),He(o.renderState,m,"controls")||(ce(t),o.dirtyAll()),!He(o.renderState,m,"images")&&!o.dirty&&o.dirtyAll());let g=_e();o.envEpoch!==g&&(o.dirtyAll(),o.envEpoch=g);let y=Wt();if(o.styleEpoch!==y&&(o.styleEpoch=y,!o.dirty)){let M=_a(t);o.geometry!==null&&M!==o.geometry&&(ce(t),o.dirtyAll()),o.geometry=M}n.invalidate&&o.dirtyAll();let b=!1,w=!!o.renderState&&!He(o.renderState,m,"animation");try{let M=new Set;w&&p.length===0&&(M=null);for(let _ of p){let E=_.playState==="running";if(!E&&!w)continue;E&&(b=!0),w=!0;let x=_.effect?.target;if(Sd(t,o,x)===t)M.add(x);else{M=null;break}}if(w&&M&&M.size&&o.retained){o.dirty=!0;for(let _ of M)o.dirtyRoots&&o.dirtyRoots.add(_),ce(_)}else w&&!M&&o.dirtyAll()}catch{}let v=m.frameDriven,C=b||v;if(C&&(o.last=null),v&&o.dirtyAll(),!u&&!C&&!o.dirty&&o.last)return Ea(t,o),o.last;o.capturing=!0;let S=null;try{let M=null,_=!1,E=null;if(!u&&o.dirty&&o.retained&&o.dirtyRoots&&o.dirtyRoots.size&&i){E=[...o.dirtyRoots];let x=await Aa(t,o,n);x&&(M=await i(x),_=!0)}if(M||(u||(n.__retain=x=>{let k=new Map;for(let[R,T]of x.nodeMap.entries())k.set(T,R);S={...x,srcToClone:k}}),n.__tornSinceStart=()=>{for(let x of o.observers)for(let k of x.takeRecords())o.pending.push(k);return Tt(),o.torn||Ra(o.pending)||on(t)!==l},M=await r()),!u&&!o.disposed){o.dirty=!1,o.dirtyRoots=new Set,S?(o.retained=S,o.retainedFrameDriven=Ta(S),Io(t,o),Oo(t,o)):_&&(o.retainedFrameDriven||=Ta(o.retained,E),Io(t,o),Oo(t,o));let x=Pa(t,o);x.animation=Na($a(t,o));let k=["style","scroll","controls","images"];b||k.push("animation");let R=k.every(T=>He(m,x,T));o.renderState=x,o.styleEpoch=Wt(),o.styleStamp=sn(t),o.geometry=_a(t),o.renderState.frameDriven?(Oa.add(t),Wa(t,o)):R?!C&&!o.renderState.frameDriven&&(o.last=M,Ea(t,o)):(o.dirtyAll(),o.last=null)}return M}finally{n.__retain=void 0,n.__tornSinceStart=void 0;for(let _ of o.observers)for(let E of _.takeRecords())o.pending.push(E);Tt();let M=on(t);(o.torn||Ra(o.pending)||M!==l)&&(o.dirtyAll(),o.last=null),o.outsideMutations=M,o.styleEpoch=Wt(),o.styleStamp=sn(t),o.pending.length=0,o.torn=!1,o.capturing=!1,o.disposed||($o(t,o),Lo(t,o))}},c=o.inflight.then(a,a);return o.inflight=c.catch(()=>{}),c}var ur=null;function Va(t){ur=t}var Cd='button, a[href], [role="button"], input, select, summary, label, [tabindex]',Wo=!1,mn=null,Bo=new WeakMap,Ha=!1;function qa(t,e){!Wo||!mn||e&&e.burst===!1||Bo.set(mn.control,{element:t,options:e&&typeof e=="object"?{...e}:e})}function Ga(t){let e={control:t};mn=e,setTimeout(()=>{mn===e&&(mn=null)},0)}function zo(t){let e=t.target,n=e&&(e.nodeType===1?e:e.parentElement);return n&&n.closest?n.closest(Cd):null}function ja(t){if(t.type==="keydown"&&t.key!=="Enter"&&t.key!==" ")return;let e=zo(t);e&&(Ga(e),Uo(t,!1))}function kd(t){let e=zo(t);e&&Ga(e)}function Uo(t,e=!0){if(!ur||document.visibilityState==="hidden")return;let n=zo(t);if(!n||t.type==="pointerenter"&&t.target!==n)return;let r=Bo.get(n);if(r){if(!r.element.isConnected){Bo.delete(n);return}ur(r.element,r.options).catch(()=>{});return}e&&!Ha&&(Ha=!0,ur(document.body,{clip:"viewport",burst:!1}).catch(()=>{}))}function Xa(){if(Wo||typeof document>"u"||typeof document.addEventListener!="function")return;Wo=!0;let t={capture:!0,passive:!0};document.addEventListener("pointerdown",ja,t),document.addEventListener("keydown",ja,t),document.addEventListener("click",kd,t),document.addEventListener("pointerenter",Uo,t),document.addEventListener("focusin",Uo,t)}Mt();function Hd(...t){return Mo(...t),K}async function jd(t,e){if(typeof t!="string"||!t.trim())throw new Error("[SnapDOM] fromString() needs an HTML string.");let n=document.createElement("div");Z(n),n.style.cssText="position:fixed;left:-99999px;top:0;pointer-events:none;",n.innerHTML=t,document.body.appendChild(n);try{await bt();let r=Array.from(n.childNodes).some(o=>o.nodeType===3&&o.textContent.trim()),i=n.children.length===1&&!r?n.firstElementChild:n;return await ti(i,{...e||{},burst:!1})}finally{n.remove()}}var Vd="3.3.1-dev.0",K=Object.assign(ti,{plugins:Hd,fromString:jd,version:Vd,preCapture:Xa});Va(ti);var Zo=Symbol("snapdom.internal"),qd=Symbol("snapdom.internal.silent"),ac=new Set(["png","jpeg","jpg","webp","svg"]);async function ti(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");let n=Ca(e);n.element=t,n.invalidate&&Ee(),da(n,e&&e.plugins);let{stage:r,loweredBy:i}=ca(n);n.needs=r,n.__needsLoweredBy=i;let o=Be(r,"render"),s=n.burst===!0||!tr(n),a=typeof n.filter=="function"||!!n.excludePredicates||typeof n.excludeStyleProps=="function"||typeof n.fallbackURL=="function",u=o&&!n.captureSelection&&n.burst!==!1&&s&&!a&&Ba(t);return u&&qa(t,e),n.snap||(n.snap={toPng:(l,f)=>K.toPng(l,f),toSvg:(l,f)=>K.toSvg(l,f)}),u?za(t,e,n,()=>K.capture(t,n,Zo),l=>cc(l,n)):K.capture(t,n,Zo)}K.capture=async(t,e,n)=>{if(n!==Zo)throw new Error("[SnapDOM] snapdom.capture() is internal; use snapdom(el).");if(Be(e.needs||gt,"render")&&X()){if(e.embedFonts)try{let o=t.ownerDocument||document,s=new Set;if(e.embedFonts==="auto"){try{for(let l of o.fonts)s.add(String(l.family).replace(/["']/g,"").toLowerCase())}catch{}if(s.size===0)throw null}let a=Wn(t);e.clip||(e.__fontUsage=a);let c=a.required,u=new Set([...c].map(l=>String(l).split("__")[0]).filter(Boolean));if(e.embedFonts==="auto"&&(u=new Set([...u].filter(l=>s.has(l.toLowerCase()))),u.size===0))throw null;await Bn(u,1,o)}catch{}let i=Array.from(t.querySelectorAll("canvas"));t.tagName==="CANVAS"&&i.unshift(t);for(let o of i)try{if(fn(o))continue;let s=o.getContext("2d",{willReadFrequently:!0});s&&s.getImageData(0,0,1,1)}catch(s){H(e,"Couldn't prepare canvases for Safari.",s)}}let r=await va(t,e);return cc(r,e)};async function cc(t,e){let n=e.needs||gt,r=Be(n,"render"),i=A=>fa(n,e.__needsLoweredBy||[],A),o=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?t:null,s=o?null:t,a=()=>s??=o.toDataURL(),c=o||t;o&&(t="");let u=e.__compressedSnapshot,l=e.__compressionDensity;delete e.__compressedSnapshot,delete e.__compressedAssets;let f,d=e.meta||{},m=(Number.isFinite(e.width)||Number.isFinite(e.height))&&!X(),p=m?Number.isFinite(e.width)?d.targetW/d.vbW:d.targetH/d.vbH:1,g=m?Number.isFinite(e.height)?d.targetH/d.vbH:d.targetW/d.vbW:1,y=A=>{if(o||!u?.size)return c;let N=d.vbW,$=d.vbH,F=A.crop;F&&(N=Math.max(1,Math.min(N,F.x+F.width)-Math.max(0,F.x)),$=Math.max(1,Math.min($,F.y+F.height)-Math.max(0,F.y)));let z=Number.isFinite(A.width),q=Number.isFinite(A.height);return(z&&q?Math.max(A.width/N,A.height/$):z?A.width/N*(F?Math.max(1,g/p):1):q?A.height/$*(F?Math.max(1,p/g):1):(A.scale||1)*Math.max(p,g))*(A.dpr||1)<=l?c:f??=ba(a(),u)},b=async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn));return $(c,{...A,...N||{},format:"png"})},w=()=>{if(!r)throw i("svgString");if(o)throw new Error("[SnapDOM] html-in-canvas makes a raster capture; there is no SVG string.");let A=t.indexOf(",");return A>=0?decodeURIComponent(t.slice(A+1)):""},v=A=>Object.defineProperty({...A||{},svgString:w},"url",r?{get:a,enumerable:!0}:{get(){throw i("export.url")},enumerable:!1,configurable:!0}),C={img:async(A,N)=>{if(o)return b(A,N);let{toImg:$}=await Promise.resolve().then(()=>(Yo(),Xo)),F={...A,...N||{}};return $(y(F),F)},svg:async(A,N)=>{if(o)return b(A,N);let{toSvg:$}=await Promise.resolve().then(()=>(Yo(),Xo)),F={...A,...N||{}};return $(y(F),F)},canvas:async(A,N)=>{let{toCanvas:$}=await Promise.resolve().then(()=>(me(),Za)),F={...A,...N||{}};return $(y(F),F)},blob:async(A,N)=>{let{toBlob:$}=await Promise.resolve().then(()=>(Jo(),rc)),F={...A,...N||{}};return $(y(F),F)},png:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn)),F={...A,...N||{},format:"png"};return $(y(F),F)},jpeg:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn)),F={...A,...N||{},format:"jpeg"};return $(y(F),F)},webp:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn)),F={...A,...N||{},format:"webp"};return $(y(F),F)},download:async(A,N)=>{let{download:$}=await Promise.resolve().then(()=>(sc(),ic)),F={...A,...N||{}};return $(y(F),F)}};if(!r)for(let A of Object.keys(C)){let N=A==="download"?"download()":`to${A.charAt(0).toUpperCase()}${A.slice(1)}()`;C[A]=async()=>{throw i(N)}}let S={};for(let A of["img","svg","canvas","blob","png","jpeg","webp"])S[A]=async N=>C[A](e,{...R(A,N||{}),[qd]:!0});S.jpg=S.jpeg;let M=A=>Object.defineProperty({...e,...A},"options",{value:e,configurable:!0}),_=M({artifacts:e.__artifacts||null,export:v(),exports:S}),E=await Zn("defineExports",_),x=Object.assign({},...E.filter(A=>A&&typeof A=="object").reverse()),k={...C,...x};k.jpeg&&!k.jpg&&(k.jpg=(A,N)=>k.jpeg(A,N));function R(A,N){let $=N||{},F={...e,...$},z=typeof $.type=="string"?$.type.toLowerCase():"",q=typeof $.format=="string"?$.format.toLowerCase():ac.has(z)?z:"";q&&(F.format=q==="jpg"?"jpeg":q),F.__explicitFormat=q?F.format:e.__explicitFormat??null,A==="blob"&&!F.__explicitFormat&&(F.format=o?"png":"svg"),F.type=F.format;let j=B=>B==="jpeg"||B==="jpg"||B==="webp";return[A,F.format,z].map(B=>typeof B=="string"?B.toLowerCase():"").find(j)&&(F.backgroundColor==null||F.backgroundColor==="transparent")&&(F.backgroundColor="#ffffff"),F.scale!==1&&(Number.isFinite(F.width)||Number.isFinite(F.height))&&H(F,"scale ignored: width/height already set the size."),F}let T=!1,L=Promise.resolve();async function W(A,N){let $=Object.freeze(N&&typeof N=="object"?{...N}:{}),F=async()=>{let q=k[A];if(!q)throw new Error(`[SnapDOM] Unknown export type: ${A}`);let j=R(A,$),J=M({artifacts:e.__artifacts||null,export:v({type:A,options:j,requestedOptions:$})}),B=j.format,ut=j.type;await Zn("beforeExport",J,{format:A,options:j});let vt=j.format!==B?j.format:j.type!==ut?j.type:"",at=typeof vt=="string"?vt.toLowerCase():"";ac.has(at)&&(j.format=at==="jpg"?"jpeg":at,j.type=j.format,j.__explicitFormat=j.format,/^(?:jpeg|webp)$/.test(j.format)&&(j.backgroundColor==null||j.backgroundColor==="transparent")&&(j.backgroundColor="#ffffff"));let st=await q(J,j);return await Zn("afterExport",J,{format:A,options:j,result:st}),T||(T=!0,await Bt("afterSnap",e)),st},z=L.then(F);return L=z.catch(()=>{}),z}let P={url:t,needs:n,warnings:e.__session&&e.__session.warnings||[],toRaw:()=>{if(!r)throw i("toRaw()");return a()},to:(A,N)=>W(A,N),toImg:A=>W("img",A),toSvg:A=>W("svg",A),toCanvas:A=>W("canvas",A),toBlob:A=>W("blob",A),toPng:A=>W("png",A),toJpg:A=>W("jpg",A),toWebp:A=>W("webp",A),download:A=>W("download",A)};r?o&&Object.defineProperty(P,"url",{get:a,enumerable:!0,configurable:!0}):Object.defineProperty(P,"url",{get(){throw i("url")},enumerable:!1,configurable:!0}),Object.defineProperty(P,"meta",r?{value:e.meta,enumerable:!0}:{get(){throw i("meta")},enumerable:!1,configurable:!0});for(let A of Object.keys(k)){let N="to"+A.charAt(0).toUpperCase()+A.slice(1);P[N]||(P[N]=$=>W(A,$))}return P}K.toRaw=(t,e)=>K(t,e).then(n=>n.toRaw());K.toImg=(t,e)=>K(t,e).then(n=>n.toImg());K.toSvg=(t,e)=>K(t,e).then(n=>n.toSvg());K.toCanvas=(t,e)=>K(t,e).then(n=>n.toCanvas());K.toBlob=(t,e)=>K(t,e).then(n=>n.toBlob());K.toPng=(t,e)=>K(t,{...e,format:"png"}).then(n=>n.toPng());K.toJpg=(t,e)=>K(t,{...e,format:"jpeg"}).then(n=>n.toJpg());K.toWebp=(t,e)=>K(t,{...e,format:"webp"}).then(n=>n.toWebp());K.download=(t,e)=>K(t,e).then(n=>n.download());export{gt as DEFAULT_STAGE,We as STAGES,la as assertNeeds,Eu as clearPlugins,Ao as getGlobalPlugins,ze as normalizePlugin,Mo as registerPlugins,K as snapdom};
|
|
40
|
+
}`,Bu=Math.max(1,Math.min(4,(typeof navigator<"u"&&navigator.hardwareConcurrency||2)-1)),Lt=null,Uu=0,zu=0,ue=new Map;function xa(){for(let t of ue.values())t(void 0);if(ue.clear(),Array.isArray(Lt))for(let t of Lt)try{t?.terminate()}catch{}Lt=!1}function Hu(){let t,e=null;try{t=URL.createObjectURL(new Blob([Wu],{type:"text/javascript"})),e=new Worker(t),e.onmessage=n=>{let r=ue.get(n.data.id);r&&(ue.delete(n.data.id),r(n.data.error?void 0:n.data.url??null))},e.onerror=xa}catch{e=null}return t&&URL.revokeObjectURL(t),e}function ju(){if(Lt===!1)return!1;if(Lt===null){if(typeof Worker>"u"||typeof OffscreenCanvas>"u")return Lt=!1;Lt=[]}let t=Uu++%Bu;if(!Lt[t]){let e=Hu();if(!e)return xa(),!1;Lt[t]=e}return Lt[t]}var Vu=5e3;function qu(t,e,n,r,i){let o=ju();return o?new Promise(s=>{let a=++zu,c=setTimeout(()=>{ue.delete(a),s(void 0)},Vu);ue.set(a,u=>{clearTimeout(c),s(u)});try{o.postMessage({id:a,dataURL:i?"":t,blob:i,srcLength:t.length,targetW:e,targetH:n,resFactor:Sa,quality:wa,mime:r})}catch{clearTimeout(c),ue.delete(a),s(void 0)}}):Promise.resolve(void 0)}async function Eo(t,e,n,r){if(typeof t!="string"||!t.startsWith("data:image")||t.startsWith("data:image/svg"))return null;e=Math.ceil(e),n=Math.ceil(n);let i=t.length+":"+t.slice(0,64)+t.slice(-64)+":"+e+"x"+n,o=I.compress,s=o.get(i);if(s?.source===t)return s.result;let a=er.get(i);if(a?.source===t&&a.cache===o)return a.promise;let c=(async()=>{let l=Nu(t),f=l==="image/jpeg"?"image/jpeg":l==="image/webp"?"image/webp":"image/png",d=Du(t);if(d&&d.w>0&&d.h>0&&!ma(d.w,d.h,e,n))return null;if(t.length>=Lu){let S=await qu(t,e,n,f,r);if(S!==void 0)return S}let h;try{h=await $u(t)}catch{return null}let m=h.naturalWidth||h.width,p=h.naturalHeight||h.height;if(!m||!p)return null;let g=ma(m,p,e,n);if(!g)return null;let y=g*Sa,b=Math.max(1,Math.round(m*y)),w=Math.max(1,Math.round(p*y)),v=document.createElement("canvas");v.width=b,v.height=w;let C=v.getContext("2d");if(!C)return null;C.imageSmoothingEnabled=!0,C.imageSmoothingQuality="high",C.drawImage(h,0,0,b,w);try{let S=v.toDataURL(f,wa);if(typeof S=="string"&&S.startsWith("data:image")&&S.length<t.length)return S}catch{}return null})(),u={source:t,promise:c,cache:o};er.set(i,u);try{let l=await c;return Iu(o,i,t,l),l}finally{er.get(i)===u&&er.delete(i)}}async function Gu(t,e,n=new Map,r={}){if(!e.compress)return{count:0,before:0,after:0};let i=Array.from(t.querySelectorAll("img"));t.tagName==="IMG"&&i.unshift(t);let o=0,s=0,a=0,c=async l=>{let f=l.getAttribute("src")||"";if(!f.startsWith("data:image")||f.startsWith("data:image/svg"))return;let d=parseFloat(l.dataset.snapdomWidth)||parseFloat(l.style.width)||l.width||0,h=parseFloat(l.dataset.snapdomHeight)||parseFloat(l.style.height)||l.height||0;if(!d||!h)return;let m=r.value||=_o(t,e),p=m.density*m.stretch(n.get(l)||l),g=await Eo(f,d*p,h*p,l.__snapdomBlob);g&&(o++,s+=f.length,a+=g.length,l.setAttribute("src",g),nr(l,"attribute","src",f,g,e))},u=6;for(let l=0;l<i.length;l+=u)await Promise.allSettled(i.slice(l,l+u).map(c));return{count:o,before:s,after:a}}var Xu=/^(cover|contain|(\d+(\.\d+)?%(\s+\d+(\.\d+)?%)?))$/;function Yu(t){let e=t.offsetWidth||t.getBoundingClientRect().width||0,n=t.offsetHeight||t.getBoundingClientRect().height||0;return{w:e,h:n}}async function Ku(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=[],o=[t,...t.querySelectorAll("*")];for(let u of o){let l=u.style&&u.style.backgroundImage;l&&l.includes("data:image")&&i.push(u)}let s=0,a=async u=>{let l=n.get(u);if(!l||!l.isConnected)return;let f;try{f=getComputedStyle(l)}catch{return}if((f.backgroundRepeat||"repeat").toLowerCase().split(",").some(_=>_.trim()!=="no-repeat"))return;let h=(u.style.backgroundSize||f.backgroundSize||"auto").toLowerCase();if(h.split(",").some(_=>!Xu.test(_.trim())))return;let{w:m,h:p}=Yu(l);if(!m||!p)return;let g=Math.max(1,...(h.match(/\d+(?:\.\d+)?%/g)||[]).map(_=>parseFloat(_)/100)),y=r.value||=_o(t,e),b=y.density*y.stretch(l)*g,w=m*b,v=p*b,C=u.style.backgroundImage,S=[...C.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],M=C;for(let _ of S){let E=_[2];if(E.startsWith("data:image/svg"))continue;let x=await Eo(E,w,v);x&&(M=M.split(E).join(x),s++)}M!==C&&(u.style.setProperty("background-image",M,u.style.getPropertyPriority("background-image")),nr(u,"style","background-image",C,u.style.backgroundImage,e))},c=6;for(let u=0;u<i.length;u+=c)await Promise.allSettled(i.slice(u,u+c).map(a));return{count:s}}async function Qu(t,e,n=new Map,r={}){if(!e.compress)return{count:0};let i=Array.from(t.querySelectorAll("image"));t.localName==="image"&&i.unshift(t);let o=0,s=async c=>{let u=c.getAttribute("href")||(typeof c.getAttributeNS=="function"?c.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!u||!u.startsWith("data:image")||u.startsWith("data:image/svg"))return;let l=c.getAttribute("width")||"",f=c.getAttribute("height")||"";if(l.includes("%")||f.includes("%"))return;let d=n.get(c),h=d?O(d):c.style,m=(v,C)=>{if(/^\d+(?:\.\d+)?px$/.test(h?.[v]||""))return parseFloat(h[v]);if(/^\d+(?:\.\d+)?(?:px)?$/.test(C.trim()))return parseFloat(C);try{return d?.[v]?.baseVal?.value||0}catch{return 0}},p=m("width",l),g=m("height",f);if(!p||!g)return;let y=r.value||=_o(t,e),b=y.density*y.stretch(d||c),w=await Eo(u,p*b,g*b);w&&(c.setAttribute("href",w),nr(c,"attribute","href",u,w,e),c.hasAttribute("xlink:href")&&(c.setAttributeNS(ga,"xlink:href",w),nr(c,"attribute","xlink:href",u,w,e)),o++)},a=6;for(let c=0;c<i.length;c+=a)await Promise.allSettled(i.slice(c,c+a).map(s));return{count:o}}async function ir(t,e,n){if(!e.compress)return;let r={};await Gu(t,e,n,r),await Ku(t,e,n,r),await Qu(t,e,n,r)}St();yt();Mt();function Ju(t,e){if(X())return t;let n=t.indexOf("</style>");if(n===-1)return t;let r=/<style\b[^>]*>[\s\S]*?<\/style>/g,i=[],o=n,s;for(r.lastIndex=n;s=r.exec(t);)i.push({text:t.slice(o,s.index),intern:!0}),i.push({text:s[0],intern:!1}),o=r.lastIndex;i.push({text:t.slice(o),intern:!0});let a=new Map,c=/ style="([^"]*)"/g,u;for(let y of i)if(y.intern)for(c.lastIndex=0;u=c.exec(y.text);)a.set(u[1],(a.get(u[1])||0)+1);let l=0;for(let[y,b]of a)b>1&&(l+=(b-1)*y.length);if(l<2048||t.includes(" data-sdi="))return t;let f=Zu(e,i.some(y=>!y.intern),t.includes("data-snapdom-asset"));if(f===null)return t;let d=new Map,h=0,m=[],p=(y,b)=>{if((a.get(b)||0)<2||f.has(b))return y;let w=d.get(b);return w===void 0&&(w="i"+(h++).toString(36),d.set(b,w),m.push(`[data-sdi="${w}"]{${b}}`)),` data-sdi="${w}"`},g="";for(let y of i)g+=y.intern?y.text.replace(c,p):y.text;return t.slice(0,n)+m.join("")+g}function Zu(t,e,n){let r=new Set;if(!e&&!n)return r;if(!t||t.querySelector("[data-sdi]"))return null;let i=c=>{let u=c.getAttribute("style");u&&r.add(u)};if(n&&t.querySelectorAll("[data-snapdom-asset][style]").forEach(i),e)try{let c=u=>{for(let l of u){if(l.type===CSSRule.IMPORT_RULE||l.type===CSSRule.NAMESPACE_RULE)throw new Error("External or namespaced CSS");if(l.selectorText){if(/\[\s*style\b|data-sdi|\[[^\]]*\\|&/i.test(l.selectorText))throw new Error("Attribute-dependent or nested CSS");t.querySelectorAll(l.selectorText).forEach(i)}l.cssRules&&c(l.cssRules)}};for(let u of[...t.querySelectorAll("style")].slice(1)){let l=u.textContent||"";if(/@import\b/i.test(l))return null;let f=new CSSStyleSheet;f.replaceSync(l),c(f.cssRules)}}catch{return null}let o=new Set,s=document.createElement("div"),a=new XMLSerializer;for(let c of r){s.setAttribute("style",c);let u=a.serializeToString(s).match(/ style="([^"]*)"/);u&&o.add(u[1])}return o}async function sr(t,e){let{clipWindow:n,outerTransforms:r,outerShadows:i,rootTransform2D:o,fontsCSS:s}=e,a=t.options;if(t!==a){let{options:Q,...et}=t;t=Object.assign(a,et),Object.defineProperty(t,"options",{value:t,configurable:!0})}let c,u;ta(t,s),await Bt("beforeRender",t);let l=O(t.element),f=t.element.getBoundingClientRect(),d=Math.max(1,D(t.element.offsetWidth||parseFloat(l.width)||f.width||1)),h=Math.max(1,D(t.element.offsetHeight||parseFloat(l.height)||f.height||1)),m=t.element.ownerDocument||document;if(!n&&(t.element===m.body||t.element===m.documentElement)&&!t.__pinned){let Q=Math.max(t.element.scrollHeight||0,m.documentElement?.scrollHeight||0,m.body?.scrollHeight||0),et=Math.max(t.element.scrollWidth||0,m.documentElement?.scrollWidth||0,m.body?.scrollWidth||0);Q>0&&(h=Math.max(h,D(Q))),et>0&&(d=Math.max(d,D(et)));try{let tt=(t.scrollbarCSS||"").length+(t.baseCSS||"").length+(t.fontsCSS||"").length+(t.classCSS||"").length,rt=I.measureHints.get(t.element);if(rt&&rt.cssLen===tt&&rt.w0===d&&rt.docH===Q&&rt.docW===et)rt.csh>0&&(h=Math.max(h,D(rt.csh))),rt.csw>0&&(d=Math.max(d,D(rt.csw)));else{let ot=m.createElement("div");Z(ot),ot.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+d+"px!important;overflow:visible!important;visibility:hidden!important;";let ee=ot.attachShadow({mode:"open"}),ne=m.createElement("style");ne.textContent=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS,ee.appendChild(ne),ee.appendChild(t.clone.cloneNode(!0)),m.body.appendChild(ot);let Ye=ot.scrollHeight,Vt=ot.scrollWidth;m.body.removeChild(ot),I.measureHints.set(t.element,{cssLen:tt,w0:d,docH:Q,docW:et,csh:Ye,csw:Vt}),Ye>0&&(h=Math.max(h,D(Ye))),Vt>0&&(d=Math.max(d,D(Vt)))}}catch{}}if(t.options?.excludeMode==="remove"||typeof t.options?.filter=="function"&&t.options.filterMode==="remove"){let Q=xo(t.element,t.options),et=1,tt=xo(t.element,{}),rt=Math.max(2,h*.15);Number.isFinite(tt)&&tt>=h-rt&&Number.isFinite(Q)&&Q>0&&(h=Math.max(1,Math.min(h,D(Q+et))))}if(t.options?.reconcile)try{let Q=(t.scrollbarCSS||"")+t.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+t.classCSS;Zs(t.element,t.clone,Q,t.nodeMap,d,h)}catch(Q){console.warn("[SnapDOM] reconcile couldn't run; captured without it.",Q)}let g=(Q,et=NaN)=>{let tt=typeof Q=="string"?parseFloat(Q):Q;return Number.isFinite(tt)?tt:et},y=g(t.options.width),b=g(t.options.height),w=n?D(n.width):d,v=n?D(n.height):h,C=w,S=v,M=Number.isFinite(y),_=Number.isFinite(b),E=v>0?w/v:1;M&&_?(C=Math.max(1,D(y)),S=Math.max(1,D(b))):M?(C=Math.max(1,D(y)),S=Math.max(1,D(C/(E||1)))):_&&(S=Math.max(1,D(b)),C=Math.max(1,D(S*(E||1))));let x=0,k=0,R=d,T=h;if(n){let Q=0,et=0;if(Ro(t.element)){let tt=null;if(!r&&o&&Number.isFinite(o.a))tt={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0};else{let rt=fe(t.element),ot=So(l.transform&&l.transform!=="none"?l.transform:"",rt);ot&&ot.is2D&&(tt={a:ot.a,b:ot.b,c:ot.c,d:ot.d,e:0,f:0})}if(tt&&!(tt.a===1&&tt.b===0&&tt.c===0&&tt.d===1)){let{ox:rt,oy:ot}=dn(l,d,h),ee=Oe(d,h,tt,rt,ot);Q=ee.minX,et=ee.minY}}x=D(n.x+Q),k=D(n.y+et),R=D(x+n.width),T=D(k+n.height)}else if(!r&&o&&Number.isFinite(o.a)){let Q={a:o.a,b:o.b||0,c:o.c||0,d:o.d||1,e:0,f:0},et=Oe(d,h,Q,0,0);x=D(et.minX),k=D(et.minY),R=D(et.maxX),T=D(et.maxY)}else if(r&&Ro(t.element)){let et=l.transform&&l.transform!=="none"?l.transform:"",tt=fe(t.element),rt=Zt({baseTransform:et,rotate:tt.rotate||"0deg",scale:tt.scale,translate:tt.translate,width:d,height:h}),{ox:ot,oy:ee}=dn(l,d,h),ne=rt.is2D?rt:new DOMMatrix(rt.toString()),Ye={a:ne.a,b:ne.b,c:ne.c,d:ne.d,e:0,f:0},Vt=Oe(d,h,Ye,ot,ee);x=D(Vt.minX),k=D(Vt.minY),R=D(Vt.maxX),T=D(Vt.maxY)}let L=po(l),W=ho(l),P=mo(l),A=go(l),N=yo(l),$=f.width>0?(R-x)/f.width:1,F=f.height>0?(T-k)/f.height:1,z=i==="subtree"&&!n?Us(t.element,t.nodeMap,t.styleCache,$,F):{top:0,right:0,bottom:0,left:0},q=n?{top:0,right:0,bottom:0,left:0}:i?{top:D(Math.max(L.top,W.top,z.top)+P.top+A.top+N.bleed.top),right:D(Math.max(L.right,W.right,z.right)+P.right+A.right+N.bleed.right),bottom:D(Math.max(L.bottom,W.bottom,z.bottom)+P.bottom+A.bottom+N.bleed.bottom),left:D(Math.max(L.left,W.left,z.left)+P.left+A.left+N.bleed.left)}:{top:P.top,right:P.right,bottom:P.bottom,left:P.left};x=D(x-q.left),k=D(k-q.top),R=D(R+q.right),T=D(T+q.bottom);let j=Math.max(1,D(R-x)),J=Math.max(1,D(T-k)),B="http://www.w3.org/2000/svg",ut=Ro(t.element)?2:0,at=D(ut+(r?0:1)),st=Math.ceil(j+at*2),nt=Math.ceil(J+at*2),pt=D(-(D(x)-at)),zt=D(-(D(k)-at)),ge=Math.max(0,pt),V=Math.max(0,zt),G=D(st-Math.min(0,pt)),U=D(nt-Math.min(0,zt)),ht=m.defaultView||window,Y=!X()&&CSS.supports("zoom","2")&&ht.devicePixelRatio||1;a.__layoutZoom=Y;let Ct=document.createElementNS(B,"foreignObject");Ct.setAttribute("x",String(Math.min(0,pt)*Y)),Ct.setAttribute("y",String(Math.min(0,zt)*Y)),Ct.setAttribute("width",String(G*Y)),Ct.setAttribute("height",String(U*Y)),Ct.style.overflow="visible";let ye=document.createElement("style"),bn="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";ye.textContent=(t.scrollbarCSS||"")+t.baseCSS+t.fontsCSS+bn+t.classCSS,Ct.appendChild(ye);let Ge=document.createElement("div");Ge.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ge.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${G}px;height:${U}px`+(ge!==0||V!==0?`;padding:${V}px 0 0 ${ge}px !important`:"")+(Y!==1?`;zoom:${Y} !important`:""),Ge.appendChild(t.clone),Ct.appendChild(Ge);let Sr=new XMLSerializer().serializeToString(Ct),Ht=M||_,xr=Object.freeze({w0:w,h0:v,vbW:st,vbH:nt,targetW:C,targetH:S,contentX:D(pt+(n?x:0)),contentY:D(zt+(n?k:0)),clip:n?Object.freeze({x:D(x),y:D(k),width:w,height:v}):null});Object.defineProperty(a,"meta",{value:xr,enumerable:!0,writable:!1,configurable:!0});let vr=!Ht||X()?st:M?C:D(st*(S/nt)),wn=!Ht||X()?nt:_?S:D(nt*(C/st)),jt=parseFloat(O(m.documentElement)?.fontSize)||16,ei=Y!==1,lc=`<svg xmlns="${B}" width="${vr}" height="${wn}" viewBox="0 0 ${st} ${nt}" font-size="${jt}px">${ei?`<g transform="scale(${1/Y})">`:""}`,fc=ei?"</g></svg>":"</svg>";u=lc+Ju(Sr,Ct)+fc,c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`,t.svgString=u,t.dataURL=c,a.__artifacts={classCSS:t.classCSS||"",fontsCSS:t.fontsCSS||"",baseCSS:t.baseCSS||"",scrollbarCSS:t.scrollbarCSS||""},await Bt("afterRender",t),t.clone=t.nodeMap=t.styleCache=t.svgString=null;let Cr=[...document.querySelectorAll("#snapdom-sandbox")].find(Gt);return Cr&&Cr.style.position==="absolute"&&Cr.remove(),t.dataURL}function Ro(t){return Hs(t)}function td(t){let e=Array.isArray(t.plugins)?t.plugins:Ao(),n=[];for(let r of e){let i=ze(r);i&&typeof i.resolveNode=="function"&&n.push(i.resolveNode.bind(i))}return n.length?n:null}async function va(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");e.__session=ko(e.cache),delete e.__compressedAssets,delete e.__compressedSnapshot,delete e.__compressionDensity,e.__resolveNodeHooks=td(e);let n=e;n.element=t,Object.defineProperty(n,"options",{value:n,configurable:!0});let r,i,o,s,a,c,u,l="",f=null,d=e.needs||gt,h=n.format,m=n.type;await Bt("beforeSnap",n);let p=n.format!==h&&/^(?:png|jpe?g|webp|svg)$/i.test(n.format),g=n.type!==m&&/^(?:png|jpe?g|webp|svg)$/i.test(n.type);if(p||g){let R=String(p?n.format:n.type).toLowerCase();n.format=R==="jpg"?"jpeg":R,n.type=n.format,n.__explicitFormat=n.format,/^(?:jpeg|webp)$/.test(n.format)&&(n.backgroundColor==null||n.backgroundColor==="transparent")&&(n.backgroundColor="#ffffff")}await Bt("beforeClone",n);let y=n.outerTransforms!==!1,b=n.outerShadows==="subtree"?"subtree":!!n.outerShadows,w=n.clip?jn(n.element,n.clip):null;if(e.__styleShare===void 0)try{e.__styleShare=Ni(n.element)&&(typeof n.element.getAnimations!="function"||n.element.getAnimations({subtree:!0}).length===0)}catch{e.__styleShare=!1}let v=xi(e.fast);for(;;){e.__slicer=v;let R=Jn(n.element,w);try{({clone:r,classCSS:i,classPrefixCSS:o,styleCache:s,nodeMap:a,reconcileRisk:c,clipWindow:u}=await ea(n.element,n.options)),c>0&&!e.reconcile&&(At(e.__session,"reconcile-risk","text in inline/table-cell elements kept natural width and may re-wrap; pass { reconcile: true } for pixel-exact layout"),I.warnedReconcile||(I.warnedReconcile=!0,console.warn("[SnapDOM] Some text may wrap differently in the capture. Pass { reconcile: true } to fix it (about 2x slower)."))),!y&&r&&(f=zs(n.element,r)),!b&&r&&Ys(n.element,r,n.options),r&&(Qs(n.element,r,a),Ks(n.element,r))}finally{R()}if(!v?.yielded||!e.__tornSinceStart?.())break;v=null,e.__session=ko(e.cache)}if(e.__slicer=null,n.clone=r,n.classCSS=i,n.styleCache=s,n.nodeMap=a,await Bt("afterClone",n),!Be(d,"render"))return null;if(v?.due()&&await v.pause(),Vn(n.clone),n.options?.excludeMode==="remove"||typeof n.options?.filter=="function"&&n.options.filterMode==="remove")try{Js(n.element,n.clone,n.styleCache,n.nodeMap)}catch(R){At(e.__session,"shrink-failed","shrink pass failed",R),console.warn("[SnapDOM] Couldn't close the gaps left by removed elements.",R)}try{await Ln(n.clone,n.element,n.nodeMap)}catch{}let C=R=>Promise.resolve().then(R),S=(async()=>{await Promise.all([C(()=>Gn(n.clone,n.options)),C(()=>Yn(n.element,n.clone,n.styleCache,n.options,n.nodeMap))]);try{oa(n.element,n.clone,n.nodeMap)}catch(R){At(e.__session,"backdrop-filter-failed","backdrop-filter emulation failed",R),console.warn("[SnapDOM] Couldn't reproduce a backdrop-filter; captured without it.",R)}if(e.compress&&(e.__compressionClip=u,e.__compressionRootTransform=f,await C(()=>ir(n.clone,n.options,n.nodeMap))),e.captureSelection)try{us(n.nodeMap)}catch(R){At(e.__session,"selection-compose-failed","field selection compose failed",R)}})(),M=Promise.resolve();(e.embedFonts==="auto"?((n.element.ownerDocument||document).fonts?.size||0)>0:e.embedFonts)&&(M=C(async()=>{let R=n.element.ownerDocument||document,T=w?P=>{try{let A=P.getBoundingClientRect();return A.right>=w.left-200&&A.left<=w.right+200&&A.bottom>=w.top-200&&A.top<=w.bottom+200}catch{return!0}}:null,{required:L,usedCodepoints:W}=!w&&e.__fontUsage||Wn(n.element,T);if(e.embedFonts==="auto"){let P=new Set;try{for(let N of R.fonts)P.add(String(N.family).replace(/["']/g,"").toLowerCase())}catch{}if(!(P.size>0&&Array.from(L).some(N=>P.has(String(N).split("__")[0].toLowerCase()))))return}if(X()){let P=new Set(Array.from(L).map(A=>String(A).split("__")[0]).filter(Boolean));await Bn(P,1,R)}l=await Ms({required:L,usedCodepoints:W,exclude:n.options.excludeFonts,localFonts:n.options.localFonts,useProxy:n.options.useProxy,fontStylesheetDomains:n.options.fontStylesheetDomains,iconMatchers:n.options.__iconMatchers,doc:R})})),await Promise.all([S,M]);let E=(n.options.plugins||[]).some(R=>R&&(typeof R.beforeRender=="function"||typeof R.afterRender=="function"));n.options.engine,v?.due()&&await v.pause();let x=n.clone;or(x,e.__compressedAssets);let k=await sr(n,{clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,fontsCSS:l});if(e.__compressedSnapshot=rr(x,e.__compressedAssets),typeof e.__retain=="function")try{e.__retain({clone:r,nodeMap:a,styleCache:s,styleMap:e.__session.styleMap,classPrefixCSS:o,fontsCSS:l,clipWindow:u,outerTransforms:y,outerShadows:b,rootTransform2D:f,__compressedAssets:e.__compressedAssets,__compressionDensity:e.__compressionDensity})}catch{}return k}yt();kt();var ed=new Set(["png","jpeg","jpg","webp","svg"]);function Ca(t={}){let e=typeof t.type=="string"&&ed.has(t.type.toLowerCase())?t.type.toLowerCase():null,n=t.format??e??"png";n==="jpg"&&(n="jpeg");let r=t.format!=null?n:e==="jpg"?"jpeg":e,i=ni(t.cache),o=t.exclude==null?[]:Array.isArray(t.exclude)?t.exclude:[t.exclude],s=[],a=[];for(let f of o)if(typeof f=="string")try{document.createDocumentFragment().querySelector(f),s.push(f)}catch{console.warn(`[SnapDOM] Invalid exclude selector "${f}"; ignored.`)}else typeof f=="function"?a.push(f):f!=null&&console.warn("[SnapDOM] Ignored an exclude entry: use a CSS selector or a function.",f);let c=t.excludeMode??"hide",u=f=>{if(!f||f.nodeType!==1)return!1;if(f.getAttribute("data-capture")==="exclude")return!0;for(let d of Array.isArray(l.exclude)?l.exclude:[])try{if(f.matches(d))return!0}catch{}for(let d of Array.isArray(l.excludePredicates)?l.excludePredicates:[])try{if(d(f))return!0}catch{}if(typeof l.filter=="function")try{if(!l.filter(f))return!0}catch{}return!1},l={debug:t.debug??!1,scale:t.scale??1,exclude:s,excludePredicates:a.length?a:null,excludeMode:c,filter:t.filter??null,filterMode:t.filterMode??"hide",shouldExclude:u,placeholders:t.placeholders!==!1,captureSelection:t.captureSelection??!1,canvas:it(t.canvas,"canvas")?t.canvas:null,embedFonts:t.embedFonts??"auto",iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],__iconMatchers:ms(t.iconFonts),localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],fallbackURL:t.fallbackURL??void 0,cache:i,__styleShare:t.__styleShare,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:n,__explicitFormat:r,type:n,quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(n)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,reconcile:t.reconcile??!1,burst:t.burst,fast:t.fast===!1||t.fast==="auto"?t.fast:!0,engine:t.engine,invalidate:t.invalidate??!1,__pinned:t.__pinned===!0,clip:t.clip??null,compress:t.compress!==!1,excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1};return l}mt();oe();St();var ka="svg,iframe,canvas,video,audio,object,embed,slot,template,picture,style,pre";function nd(t){try{return t.matches?.("dialog,[popover]")||!!t.querySelector?.("dialog,[popover]")}catch{return!0}}var rd=/(?:^|;)\s*(?:-webkit-)?backdrop-filter:\s*(?!none(?:\s*!important)?(?:;|$))[^;]+/i;function od(t){if(t.__usesBackdropFilter!==void 0)return t.__usesBackdropFilter;let e=!1;for(let n of t.styleMap.values())if(rd.test(n)){e=!0;break}return t.__usesBackdropFilter=e,e}function id(t,e){let n=e.has("backdrop-filter")||e.has("-webkit-backdrop-filter");if(!n&&(n=(o=>/(?:^|;)\s*(?:-webkit-)?backdrop-filter\s*:/i.test(o.getAttribute?.("style")||""))(t),!n))try{n=!!t.querySelector?.('[style*="backdrop-filter" i]')}catch{n=!0}if(!n)return!1;let r=[t];t.querySelectorAll&&r.push(...t.querySelectorAll("*"));for(let i of r){let o=getComputedStyle(i),s=o.getPropertyValue("backdrop-filter")||o.getPropertyValue("-webkit-backdrop-filter");if(s&&s!=="none")return!0}return!1}var Ma=new WeakMap;function sd(t){let e=Wt(),n=Ma.get(t);if(n&&n.epoch===e)return n.leaky;let r=!1,i={budget:2e4},o=s=>{for(let a=0;a<s.length&&!r;a++){if(--i.budget<0){r=!0;return}let c=s[a],u=c.selectorText;if(u&&/[+~]|:has\(/.test(u)){r=!0;return}let l=c.style;if(l&&(l.counterReset||l.counterIncrement||l.counterSet||l.content&&l.content.includes("counter"))){r=!0;return}c.cssRules&&c.cssRules.length&&o(c.cssRules)}};try{for(let s of t.styleSheets){let a=null;try{a=s.cssRules}catch{r=!0}if(r)break;a&&o(a)}if(!r){let s=t.adoptedStyleSheets;if(Array.isArray(s))for(let a of s){if(r)break;try{o(a.cssRules)}catch{r=!0}}}}catch{r=!0}return Ma.set(t,{epoch:e,leaky:r}),r}var ad=1/16;function cd(t,e){if(t===e)return!0;if(!t.endsWith("px")||!e.endsWith("px"))return!1;let n=parseFloat(t),r=parseFloat(e);return Number.isFinite(n)&&Number.isFinite(r)&&Math.abs(n-r)<=ad}var ar=new Map,ld=["width","height","min-width","min-height"];function fd(t){let e=ar.get(t);if(e===void 0){e=null;for(let n of ld){let r=t.match(new RegExp("(?:^|;)"+n+":([^;]+)"));r&&r[1].endsWith("px")&&((e||={})[n]=r[1])}ar.size>5e3&&ar.clear(),ar.set(t,e)}return e}function ud(t){if(!(!t.classList||!t.classList.length))for(let e of Array.from(t.classList))/^c\d+$/.test(e)&&t.classList.remove(e)}function dd(t,e){let n=[t];for(;n.length;){let r=n.pop();if(r.nodeType===1){let i=e.nodeMap.get(r);i!==void 0&&(e.nodeMap.delete(r),e.srcToClone.get(i)===r&&e.srcToClone.delete(i)),e.styleMap.delete(r)}for(let i=r.firstChild;i;i=i.nextSibling)n.push(i)}}var Fo={attempts:0,served:0,reconciled:0};async function Aa(t,e,n){Fo.attempts++;try{let r=await pd(t,e,n);return r&&Fo.served++,r}catch{return null}}async function pd(t,e,n){let r=e.retained;if(!r||!r.clone||!r.styleMap||!r.srcToClone||n.reconcile||n.clip||n.captureSelection||r.clipWindow||t.scrollTop||t.scrollLeft||nd(t)||od(r)||r.fontsCSS||tr(n))return null;for(let f of n.plugins||[])if(f&&(typeof f.beforeSnap=="function"||typeof f.beforeClone=="function"||typeof f.resolveNode=="function"||typeof f.afterClone=="function"))return null;if(r.classPrefixCSS&&(r.classPrefixCSS.includes("::marker")||r.classPrefixCSS.includes("::first-line"))||n.excludeMode==="remove")return null;let i=t.ownerDocument||document,o=an(t);if(!o||sd(i))return null;let s=[];t:for(let f of e.dirtyRoots){if(!f.isConnected||f===t||!t.contains(f))return null;for(let d of e.dirtyRoots)if(d!==f&&d!==t&&d.contains(f))continue t;s.push(f)}if(!s.length)return null;n.__compressedAssets=r.__compressedAssets,n.__compressionDensity=r.__compressionDensity,n.__compressionRootTransform=r.rootTransform2D;for(let f of s){if(f.parentElement===t||f.matches?.(ka)||f.querySelector?.(ka)||id(f,o))return null;let d=r.srcToClone.get(f);if(!d||!d.parentNode)return null;let h=new Map,m={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:h,options:n},p=Jn(f,null),g=Hn(f),y;try{y=await Jt(f,m,n)}finally{g(),p()}if(!y||y.nodeType!==1||y.querySelector?.("style[data-sd]")||(await Ie(f,y,m,n),m.__pseudoCSS)||m.__usesPlaceholder&&!r.classPrefixCSS?.includes("[data-sd-ph]"))return null;await Fn(y,m),Vn(y);try{await Ln(y,f,h)}catch{}if(await Promise.all([Gn(y,n),Yn(f,y,r.styleCache,n,h)]),n.compress)try{await ir(y,n,h)}catch{}for(let[b,w]of h.entries())Co(b,w,h,r.styleCache);d.replaceWith(y),dd(d,r);for(let[b,w]of h.entries())r.nodeMap.set(b,w),r.srcToClone.set(w,b)}let a={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:n};for(let[f,d]of r.nodeMap.entries()){if(!d||d.nodeType!==1||!d.isConnected)continue;let h=r.styleMap.get(f);if(!h)continue;let m=fd(h);if(!m)continue;let p=null,g=!1;for(let y in m)if(p||=getComputedStyle(d),!cd(p.getPropertyValue(y),m[y])){g=!0;break}if(g){if(n.__compressedAssets?.has(f))return null;Fo.reconciled++,await dt(d,f,a,n)}}let c=Ze(r.styleMap);for(let[f,d]of r.styleMap.entries())ud(f),vo(f,d,c);let u=(r.classPrefixCSS||"")+Array.from(c.entries()).map(([f,d])=>`.${d}{${f}}`).join("");or(r.clone,n.__compressedAssets);let l=await sr({element:t,options:n,plugins:n.plugins,clone:r.clone,classCSS:u,styleCache:r.styleCache,nodeMap:r.nodeMap},{clipWindow:null,outerTransforms:r.outerTransforms,outerShadows:r.outerShadows,rootTransform2D:r.rootTransform2D,fontsCSS:r.fontsCSS||""});return n.__compressedSnapshot=rr(r.clone,n.__compressedAssets),r.__compressedAssets=n.__compressedAssets,r.__compressionDensity=n.__compressionDensity,l}kt();var Po=new WeakMap,lr=new WeakMap,Oa=new WeakSet,To=new WeakMap,hd=64,hn=new Map,Da=["scroll","input","change","focusin","focusout","pointerdown","pointerup","pointercancel","keydown","keyup","beforetoggle","toggle"],md=["(prefers-color-scheme: dark)","(prefers-reduced-motion: reduce)","(prefers-contrast: more)","(forced-colors: active)","(inverted-colors: inverted)","(prefers-reduced-transparency: reduce)","(hover: hover)","(any-hover: hover)","(pointer: coarse)","(any-pointer: coarse)","(color-gamut: p3)","(dynamic-range: high)"];function gd(t){let e=t?.defaultView;return typeof e?.matchMedia!="function"?"":md.map(n=>{try{return e.matchMedia(n).matches?"1":"0"}catch{return"?"}}).join("")}function _a(t){let e=[];for(let n=t;n;){try{let r=n.getBoundingClientRect();e.push(r.x,r.y,r.width,r.height)}catch{e.push("?")}n.parentElement?n=n.parentElement:n=n.getRootNode?.()?.host||null}return e.join("|")}function Ea(t,e){if(e.disposed||(hn.delete(t),hn.set(t,e),hn.size<=hd))return;let[n,r]=hn.entries().next().value;Wa(n,r)}function Wa(t,e){e.disposed=!0,hn.delete(t),Po.delete(t);for(let n of e.observers)try{n.disconnect()}catch{}for(let n of Da)t.removeEventListener(n,e.onMediaDirty,!0);for(let n of e.trackedShadowRoots.keys())for(let r of No)n.removeEventListener(r,e.onMediaDirty,!0);for(let[n,r]of e.trackedImages)n.removeEventListener("load",r),n.removeEventListener("error",r);e.trackedImages.clear(),e.trackedShadowRoots.clear(),e.images.length=0,e.controls.length=0,e.scrollNodes.length=0,e.observers.length=0,e.last=null,e.retained=null,e.retainedFrameDriven=!1}function Ba(t){if(Oa.has(t))return!1;lr.delete(t);let e=[t],n=[],r=[];for(let i=0;i<e.length;i++){let o=e[i],s=[];o?.nodeType===1&&s.push(o);try{s.push(...o.querySelectorAll("*"))}catch{return!1}for(let a of s){a.shadowRoot&&e.push(a.shadowRoot);let c=String(a.localName||a.tagName||"").toLowerCase();if(/^(?:iframe|canvas|video|audio|object|embed|marquee|blink)$/.test(c)||c==="progress"&&!a.hasAttribute("value")||/^(?:animate|animatetransform|animatemotion|set)$/.test(c))return!1;let u="";if(c==="img"){r.push(a);try{u=a.currentSrc||a.src||""}catch{}}/^(?:input|textarea|select|option)$/.test(c)&&n.push(a);let l=a.getAttribute?.("style")||"",f=To.get(a);if(u||l){if((!f||f.src!==u||f.style!==l)&&(f={src:u,style:l,animated:Ve(u)||Ve(l)},To.set(a,f)),f.animated)return!1}else f&&To.delete(a)}}return lr.set(t,{roots:e.slice(1),controls:n,images:r}),!0}function $o(t,e){if(!t.querySelectorAll)return!1;let n=lr.get(t);lr.delete(t);let r=new Set(n?.roots||[]);if(n&&(e.controls=n.controls,e.scannedImages=n.images),!n){let i=[t];for(let o=0;o<i.length;o++){let s=i[o];s.shadowRoot&&!r.has(s.shadowRoot)&&(r.add(s.shadowRoot),i.push(s.shadowRoot));for(let a of s.querySelectorAll("*"))a.shadowRoot&&!r.has(a.shadowRoot)&&(r.add(a.shadowRoot),i.push(a.shadowRoot))}}for(let[i,o]of e.trackedShadowRoots)if(!r.has(i)){try{o.disconnect()}catch{}for(let a of No)i.removeEventListener(a,e.onMediaDirty,!0);e.trackedShadowRoots.delete(i);let s=e.observers.indexOf(o);s>=0&&e.observers.splice(s,1)}for(let i of r)if(!e.trackedShadowRoots.has(i))try{let o=new MutationObserver(e.markDirty);o.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),o.__flush=e.markDirty,e.observers.push(o),e.trackedShadowRoots.set(i,o);for(let s of No)i.addEventListener(s,e.onMediaDirty,{capture:!0,passive:!0});e.retained&&e.dirtyAll()}catch{}return!!n}var No=["scroll","change","beforetoggle","toggle"];function fr(t,e){return[t,...e.trackedShadowRoots.keys()]}function Lo(t,e){let n=e.scannedImages;if(e.scannedImages=null,!n){n=[],t.tagName==="IMG"&&n.push(t);for(let r of fr(t,e))r.querySelectorAll&&n.push(...r.querySelectorAll("img"))}if(e.images=n,e.trackedImages.size){let r=new Set(n);for(let[i,o]of e.trackedImages)r.has(i)||(i.removeEventListener("load",o),i.removeEventListener("error",o),e.trackedImages.delete(i))}for(let r of n){if(r.complete||e.trackedImages.has(r))continue;let i=()=>{e.capturing&&(e.torn=!0),e.dirty=!0,e.dirtyRoots=null,r.removeEventListener("load",i),r.removeEventListener("error",i),e.trackedImages.delete(r)};e.trackedImages.set(r,i),r.addEventListener("load",i),r.addEventListener("error",i)}}function Ra(t){let e=new Map,n=new Map,r=new Map;for(let i of t)if(ae(i))if(i.type==="attributes"){let o=e.get(i.target);o||e.set(i.target,o=new Map),o.has(i.attributeName)||o.set(i.attributeName,i.oldValue)}else if(i.type==="characterData")n.has(i.target)||n.set(i.target,i.oldValue);else if(i.type==="childList"){let o=r.get(i.target);o||r.set(i.target,o=new Map);for(let s of i.addedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)+1)}for(let s of i.removedNodes){if(s.nodeType!==3)return!0;o.set(s.data,(o.get(s.data)||0)-1)}}else return!0;for(let[i,o]of e)for(let[s,a]of o)if(i.getAttribute(s)!==a)return!0;for(let[i,o]of n)if(i.data!==o)return!0;for(let i of r.values())for(let o of i.values())if(o!==0)return!0;return!1}var yd=/(?:^data:image\/(?:gif|apng)|\.(?:gif|apng)(?=[?#)'"\s;]|$))/i,je=t=>t&&(typeof t=="object"||typeof t=="function")?cr(t):"-";function bd(t,e=131072){if(t=String(t||"").trim(),!/^data:/i.test(t))return"";let n=t.indexOf(",");if(n<0)return"";let r=t.slice(0,n),i=t.slice(n+1);try{if(/;base64/i.test(r)){let o=Math.ceil(e/3)*4;return atob(i.slice(0,o-o%4))}return i.slice(0,e*3).replace(/%([0-9a-f]{2})/gi,(o,s)=>String.fromCharCode(parseInt(s,16))).slice(0,e)}catch{return""}}function wd(t){let e=(t.match(/^data:([^;,]+)/i)?.[1]||"").toLowerCase();if(e==="image/gif"||e==="image/apng")return!0;if(!/image\/(?:png|webp|avif|svg\+xml)/.test(e))return!1;let n=bd(t);return e==="image/png"?n.includes("acTL"):e==="image/webp"?n.includes("ANIM")||n.includes("ANMF")||n.includes("VP8X")&&!!(n.charCodeAt(n.indexOf("VP8X")+8)&2):e==="image/avif"?n.includes("avis"):/<(?:animate|animateTransform|animateMotion|set)\b|@keyframes\b|animation(?:-name)?\s*:/i.test(n)}function Fa(t){let e=String(t||"").trim();return e?yd.test(e)?!0:/^data:/i.test(e)?wd(e):!1:!1}function Ve(t){let e=String(t||"");if(Fa(e))return!0;for(let n of e.matchAll(/url\(\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^)]*))\s*\)/gi))if(Fa(n[1]??n[2]??n[3]))return!0;return!1}function Ta(t,e=null){let n=t&&t.clone;if(!n)return!1;let r=e?e.map(i=>t.srcToClone?.get(i)).filter(Boolean):[n];for(let i of r)for(let o of Ua(i))if(Ve(o.getAttribute?.("src"))||Ve(o.getAttribute?.("href"))||Ve(o.getAttribute?.("style"))||Ve(t.styleMap?.get(o)))return!0;return!1}function Ua(t){let e=[];t&&t.nodeType===1&&e.push(t);try{e.push(...t.querySelectorAll("*"))}catch{}return e}function Io(t,e){let n=[],r=new Set,i=o=>{o&&!r.has(o)&&(r.add(o),n.push(o))};t.matches?.("input,textarea,select,option")&&i(t);for(let o of fr(t,e))try{for(let s of o.querySelectorAll("input,textarea,select,option"))i(s)}catch{}e.controls=n}function Oo(t,e){let n=[],r=new Set,i=(o,s=!1)=>{if(!(!o||r.has(o))){r.add(o);try{(s||o.scrollLeft||o.scrollTop||o.scrollWidth>o.clientWidth||o.scrollHeight>o.clientHeight)&&n.push(o)}catch{}}};for(let o=t;o;o=o.parentElement)i(o,!0);for(let o of fr(t,e))for(let s of Ua(o))i(s);e.scrollNodes=n}function Pa(t,e){let n=t.ownerDocument||document,r=n.defaultView,i=[r?.location?.hash||"",gd(n),r?.innerWidth||0,r?.innerHeight||0,r?.devicePixelRatio||1,r?.screen?.orientation?.type||""];try{i.push(...[...n.adoptedStyleSheets||[]].map(je))}catch{}for(let l of e.trackedShadowRoots.keys())try{i.push("#shadow",...[...l.adoptedStyleSheets||[]].map(je))}catch{}let o=n.activeElement,s=n.fullscreenElement;(o?.contains(t)||t.contains(o))&&i.push(je(o)),(s?.contains(t)||t.contains(s))&&i.push(je(s));let a=[r?.scrollX||0,r?.scrollY||0];for(let l of e.scrollNodes)a.push(l.scrollLeft||0,l.scrollTop||0);let c=[];for(let l of e.controls){let f=String(l.localName||"").toLowerCase();f==="input"?c.push(l.type,Qe(l)?l.value.length:l.value,l.checked?1:0,l.indeterminate?1:0):f==="textarea"?c.push(l.value):f==="select"?c.push(l.selectedIndex,l.value):c.push(l.selected?1:0)}let u=[];for(let l of e.images){let f="";try{f=l.currentSrc||l.src||""}catch{}u.push(f,l.complete?1:0,l.naturalWidth||0,l.naturalHeight||0)}return{style:i.join("|"),scroll:a.join("|"),controls:c,images:u,frameDriven:e.retainedFrameDriven}}function He(t,e,n){if(!t)return!1;let r=t[n],i=e[n];if(r===i)return!0;if(!Array.isArray(r)||r.length!==i.length)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}function $a(t,e){let n=new Set;for(let r of fr(t,e))try{let i=r.getAnimations?.(r.nodeType===1?{subtree:!0}:void 0)||[];for(let o of i)n.add(o)}catch{}return[...n]}function Na(t){return t.map(e=>[je(e),e.playState,Math.round((Number(e.currentTime)||0)*10),e.playbackRate].join(":")).join("|")}function Sd(t,e,n){if(!n||n.nodeType!==1)return null;if(n===t||t.contains(n))return t;for(let r of e.trackedShadowRoots.keys())if(r.contains(n))return r;return null}function xd(t){let e={dirty:!0,pending:[],torn:!1,dirtyRoots:new Set,retained:null,retainedFrameDriven:!1,disposed:!1,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedShadowRoots:new Map,trackedImages:new Map,images:[],scannedImages:null,scrollNodes:[],controls:[],envEpoch:_e(),styleEpoch:Wt(),styleStamp:sn(t),outsideMutations:on(t),geometry:null,renderState:null},n=()=>{e.dirty=!0,e.dirtyRoots=null},r=a=>{if(!e.dirtyRoots)return;let c=a&&(a.nodeType===1?a:a.parentElement);if(!c||c===t||!t.contains(c)||e.dirtyRoots.size>=12){e.dirtyRoots=null;return}e.dirtyRoots.add(c)},i=a=>{if(e.capturing){for(let c of a)e.pending.push(c);return}for(let c of a)ae(c)&&(e.dirty=!0,r(c.target))},o=()=>{if(e.capturing){e.torn=!0;return}n()};e.dirtyAll=n;try{let a=new MutationObserver(i);a.observe(t,{subtree:!0,childList:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),a.__flush=i,e.observers.push(a)}catch{}e.markDirty=i,e.onMediaDirty=o;try{for(let a of Da)t.addEventListener(a,o,{capture:!0,passive:!0})}catch{}return $o(t,e)||Io(t,e),Oo(t,e),Lo(t,e),e}var vd=0,La=new WeakMap;function cr(t){let e=La.get(t);return e||(e="@"+ ++vd,La.set(t,e)),e}function Do(t,e){let n=typeof t;if(n==="undefined")return null;if(t===null||n==="boolean"||n==="number"||n==="string")return JSON.stringify(t);if(n==="function"||n==="symbol")return n==="symbol"?null:JSON.stringify(cr(t));if(n!=="object")return null;if(typeof t.nodeType=="number")return JSON.stringify(cr(t));if(e.has(t))return null;e.add(t);try{if(Array.isArray(t)){let o=[];for(let s of t){let a=Do(s,e);if(a===null)return null;o.push(a)}return"["+o.join(",")+"]"}let r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)return JSON.stringify(cr(t));let i=[];for(let o of Object.keys(t).sort()){let s=t[o];if(s===void 0)continue;let a=Do(s,e);if(a===null)return null;i.push(JSON.stringify(o)+":"+a)}return"{"+i.join(",")+"}"}finally{e.delete(t)}}function Ia(t,e){let{burst:n,invalidate:r,...i}=t||{};try{let o=Do(i,new Set);return o===null?null:`${(e||[]).map(je).join(",")}:${o}`}catch{return null}}function za(t,e,n,r,i=null){let o=Po.get(t);o||(o=xd(t),o.baselineSignature=Ia(e,n.plugins),Po.set(t,o));let s=Ia(e,n.plugins),a=async()=>{if(o.disposed)return r();let u=s===null||s!==o.baselineSignature;u&&s!==null?o.pendingSig===s?(o.baselineSignature=s,o.last=null,o.dirty=!0,o.dirtyRoots=null,o.pendingSig=null,u=!1):o.pendingSig=s:o.pendingSig=null,$o(t,o),Lo(t,o);for(let M of o.observers)M.__flush(M.takeRecords());Tt();let l=on(t);o.dirty&&o.outsideMutations!==l&&o.dirtyAll(),o.outsideMutations=l;let f=t.getRootNode?.(),d=[...o.trackedShadowRoots.keys()];f?.nodeType===11&&!d.includes(f)&&d.push(f),_n(t.ownerDocument||document,d);let h=sn(t);o.styleStamp!==h&&(o.styleStamp=h,o.dirty||o.dirtyAll());let m=Pa(t,o),p=$a(t,o);m.animation=Na(p),o.renderState&&(!He(o.renderState,m,"style")&&(Ee(),o.dirtyAll()),He(o.renderState,m,"scroll")||o.dirtyAll(),He(o.renderState,m,"controls")||(ce(t),o.dirtyAll()),!He(o.renderState,m,"images")&&!o.dirty&&o.dirtyAll());let g=_e();o.envEpoch!==g&&(o.dirtyAll(),o.envEpoch=g);let y=Wt();if(o.styleEpoch!==y&&(o.styleEpoch=y,!o.dirty)){let M=_a(t);o.geometry!==null&&M!==o.geometry&&(ce(t),o.dirtyAll()),o.geometry=M}n.invalidate&&o.dirtyAll();let b=!1,w=!!o.renderState&&!He(o.renderState,m,"animation");try{let M=new Set;w&&p.length===0&&(M=null);for(let _ of p){let E=_.playState==="running";if(!E&&!w)continue;E&&(b=!0),w=!0;let x=_.effect?.target;if(Sd(t,o,x)===t)M.add(x);else{M=null;break}}if(w&&M&&M.size&&o.retained){o.dirty=!0;for(let _ of M)o.dirtyRoots&&o.dirtyRoots.add(_),ce(_)}else w&&!M&&o.dirtyAll()}catch{}let v=m.frameDriven,C=b||v;if(C&&(o.last=null),v&&o.dirtyAll(),!u&&!C&&!o.dirty&&o.last)return Ea(t,o),o.last;o.capturing=!0;let S=null;try{let M=null,_=!1,E=null;if(!u&&o.dirty&&o.retained&&o.dirtyRoots&&o.dirtyRoots.size&&i){E=[...o.dirtyRoots];let x=await Aa(t,o,n);x&&(M=await i(x),_=!0)}if(M||(u||(n.__retain=x=>{let k=new Map;for(let[R,T]of x.nodeMap.entries())k.set(T,R);S={...x,srcToClone:k}}),n.__tornSinceStart=()=>{for(let x of o.observers)for(let k of x.takeRecords())o.pending.push(k);return Tt(),o.torn||Ra(o.pending)||on(t)!==l},M=await r()),!u&&!o.disposed){o.dirty=!1,o.dirtyRoots=new Set,S?(o.retained=S,o.retainedFrameDriven=Ta(S),Io(t,o),Oo(t,o)):_&&(o.retainedFrameDriven||=Ta(o.retained,E),Io(t,o),Oo(t,o));let x=Pa(t,o);x.animation=Na($a(t,o));let k=["style","scroll","controls","images"];b||k.push("animation");let R=k.every(T=>He(m,x,T));o.renderState=x,o.styleEpoch=Wt(),o.styleStamp=sn(t),o.geometry=_a(t),o.renderState.frameDriven?(Oa.add(t),Wa(t,o)):R?!C&&!o.renderState.frameDriven&&(o.last=M,Ea(t,o)):(o.dirtyAll(),o.last=null)}return M}finally{n.__retain=void 0,n.__tornSinceStart=void 0;for(let _ of o.observers)for(let E of _.takeRecords())o.pending.push(E);Tt();let M=on(t);(o.torn||Ra(o.pending)||M!==l)&&(o.dirtyAll(),o.last=null),o.outsideMutations=M,o.styleEpoch=Wt(),o.styleStamp=sn(t),o.pending.length=0,o.torn=!1,o.capturing=!1,o.disposed||($o(t,o),Lo(t,o))}},c=o.inflight.then(a,a);return o.inflight=c.catch(()=>{}),c}var ur=null;function Va(t){ur=t}var Cd='button, a[href], [role="button"], input, select, summary, label, [tabindex]',Wo=!1,mn=null,Bo=new WeakMap,Ha=!1;function qa(t,e){!Wo||!mn||e&&e.burst===!1||Bo.set(mn.control,{element:t,options:e&&typeof e=="object"?{...e}:e})}function Ga(t){let e={control:t};mn=e,setTimeout(()=>{mn===e&&(mn=null)},0)}function zo(t){let e=t.target,n=e&&(e.nodeType===1?e:e.parentElement);return n&&n.closest?n.closest(Cd):null}function ja(t){if(t.type==="keydown"&&t.key!=="Enter"&&t.key!==" ")return;let e=zo(t);e&&(Ga(e),Uo(t,!1))}function kd(t){let e=zo(t);e&&Ga(e)}function Uo(t,e=!0){if(!ur||document.visibilityState==="hidden")return;let n=zo(t);if(!n||t.type==="pointerenter"&&t.target!==n)return;let r=Bo.get(n);if(r){if(!r.element.isConnected){Bo.delete(n);return}ur(r.element,r.options).catch(()=>{});return}e&&!Ha&&(Ha=!0,ur(document.body,{clip:"viewport",burst:!1}).catch(()=>{}))}function Xa(){if(Wo||typeof document>"u"||typeof document.addEventListener!="function")return;Wo=!0;let t={capture:!0,passive:!0};document.addEventListener("pointerdown",ja,t),document.addEventListener("keydown",ja,t),document.addEventListener("click",kd,t),document.addEventListener("pointerenter",Uo,t),document.addEventListener("focusin",Uo,t)}Mt();function Hd(...t){return Mo(...t),K}async function jd(t,e){if(typeof t!="string"||!t.trim())throw new Error("[SnapDOM] fromString() needs an HTML string.");let n=document.createElement("div");Z(n),n.style.cssText="position:fixed;left:-99999px;top:0;pointer-events:none;",n.innerHTML=t,document.body.appendChild(n);try{await bt();let r=Array.from(n.childNodes).some(o=>o.nodeType===3&&o.textContent.trim()),i=n.children.length===1&&!r?n.firstElementChild:n;return await ti(i,{...e||{},burst:!1})}finally{n.remove()}}var Vd="3.3.3",K=Object.assign(ti,{plugins:Hd,fromString:jd,version:Vd,preCapture:Xa});Va(ti);var Zo=Symbol("snapdom.internal"),qd=Symbol("snapdom.internal.silent"),ac=new Set(["png","jpeg","jpg","webp","svg"]);async function ti(t,e){if(!t)throw new Error("[SnapDOM] The element cannot be null or undefined.");let n=Ca(e);n.element=t,n.invalidate&&Ee(),da(n,e&&e.plugins);let{stage:r,loweredBy:i}=ca(n);n.needs=r,n.__needsLoweredBy=i;let o=Be(r,"render"),s=n.burst===!0||!tr(n),a=typeof n.filter=="function"||!!n.excludePredicates||typeof n.excludeStyleProps=="function"||typeof n.fallbackURL=="function",u=o&&!n.captureSelection&&n.burst!==!1&&s&&!a&&Ba(t);return u&&qa(t,e),n.snap||(n.snap={toPng:(l,f)=>K.toPng(l,f),toSvg:(l,f)=>K.toSvg(l,f)}),u?za(t,e,n,()=>K.capture(t,n,Zo),l=>cc(l,n)):K.capture(t,n,Zo)}K.capture=async(t,e,n)=>{if(n!==Zo)throw new Error("[SnapDOM] snapdom.capture() is internal; use snapdom(el).");if(Be(e.needs||gt,"render")&&X()){if(e.embedFonts)try{let o=t.ownerDocument||document,s=new Set;if(e.embedFonts==="auto"){try{for(let l of o.fonts)s.add(String(l.family).replace(/["']/g,"").toLowerCase())}catch{}if(s.size===0)throw null}let a=Wn(t);e.clip||(e.__fontUsage=a);let c=a.required,u=new Set([...c].map(l=>String(l).split("__")[0]).filter(Boolean));if(e.embedFonts==="auto"&&(u=new Set([...u].filter(l=>s.has(l.toLowerCase()))),u.size===0))throw null;await Bn(u,1,o)}catch{}let i=Array.from(t.querySelectorAll("canvas"));t.tagName==="CANVAS"&&i.unshift(t);for(let o of i)try{if(fn(o))continue;let s=o.getContext("2d",{willReadFrequently:!0});s&&s.getImageData(0,0,1,1)}catch(s){H(e,"Couldn't prepare canvases for Safari.",s)}}let r=await va(t,e);return cc(r,e)};async function cc(t,e){let n=e.needs||gt,r=Be(n,"render"),i=A=>fa(n,e.__needsLoweredBy||[],A),o=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?t:null,s=o?null:t,a=()=>s??=o.toDataURL(),c=o||t;o&&(t="");let u=e.__compressedSnapshot,l=e.__compressionDensity;delete e.__compressedSnapshot,delete e.__compressedAssets;let f,d=e.meta||{},m=(Number.isFinite(e.width)||Number.isFinite(e.height))&&!X(),p=m?Number.isFinite(e.width)?d.targetW/d.vbW:d.targetH/d.vbH:1,g=m?Number.isFinite(e.height)?d.targetH/d.vbH:d.targetW/d.vbW:1,y=A=>{if(o||!u?.size)return c;let N=d.vbW,$=d.vbH,F=A.crop;F&&(N=Math.max(1,Math.min(N,F.x+F.width)-Math.max(0,F.x)),$=Math.max(1,Math.min($,F.y+F.height)-Math.max(0,F.y)));let z=Number.isFinite(A.width),q=Number.isFinite(A.height);return(z&&q?Math.max(A.width/N,A.height/$):z?A.width/N*(F?Math.max(1,g/p):1):q?A.height/$*(F?Math.max(1,p/g):1):(A.scale||1)*Math.max(p,g))*(A.dpr||1)<=l?c:f??=ba(a(),u)},b=async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn));return $(c,{...A,...N||{},format:"png"})},w=()=>{if(!r)throw i("svgString");if(o)throw new Error("[SnapDOM] html-in-canvas makes a raster capture; there is no SVG string.");let A=t.indexOf(",");return A>=0?decodeURIComponent(t.slice(A+1)):""},v=A=>Object.defineProperty({...A||{},svgString:w},"url",r?{get:a,enumerable:!0}:{get(){throw i("export.url")},enumerable:!1,configurable:!0}),C={img:async(A,N)=>{if(o)return b(A,N);let{toImg:$}=await Promise.resolve().then(()=>(Yo(),Xo)),F={...A,...N||{}};return $(y(F),F)},svg:async(A,N)=>{if(o)return b(A,N);let{toSvg:$}=await Promise.resolve().then(()=>(Yo(),Xo)),F={...A,...N||{}};return $(y(F),F)},canvas:async(A,N)=>{let{toCanvas:$}=await Promise.resolve().then(()=>(me(),Za)),F={...A,...N||{}};return $(y(F),F)},blob:async(A,N)=>{let{toBlob:$}=await Promise.resolve().then(()=>(Jo(),rc)),F={...A,...N||{}};return $(y(F),F)},png:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn)),F={...A,...N||{},format:"png"};return $(y(F),F)},jpeg:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn)),F={...A,...N||{},format:"jpeg"};return $(y(F),F)},webp:async(A,N)=>{let{rasterize:$}=await Promise.resolve().then(()=>(qe(),yn)),F={...A,...N||{},format:"webp"};return $(y(F),F)},download:async(A,N)=>{let{download:$}=await Promise.resolve().then(()=>(sc(),ic)),F={...A,...N||{}};return $(y(F),F)}};if(!r)for(let A of Object.keys(C)){let N=A==="download"?"download()":`to${A.charAt(0).toUpperCase()}${A.slice(1)}()`;C[A]=async()=>{throw i(N)}}let S={};for(let A of["img","svg","canvas","blob","png","jpeg","webp"])S[A]=async N=>C[A](e,{...R(A,N||{}),[qd]:!0});S.jpg=S.jpeg;let M=A=>Object.defineProperty({...e,...A},"options",{value:e,configurable:!0}),_=M({artifacts:e.__artifacts||null,export:v(),exports:S}),E=await Zn("defineExports",_),x=Object.assign({},...E.filter(A=>A&&typeof A=="object").reverse()),k={...C,...x};k.jpeg&&!k.jpg&&(k.jpg=(A,N)=>k.jpeg(A,N));function R(A,N){let $=N||{},F={...e,...$},z=typeof $.type=="string"?$.type.toLowerCase():"",q=typeof $.format=="string"?$.format.toLowerCase():ac.has(z)?z:"";q&&(F.format=q==="jpg"?"jpeg":q),F.__explicitFormat=q?F.format:e.__explicitFormat??null,A==="blob"&&!F.__explicitFormat&&(F.format=o?"png":"svg"),F.type=F.format;let j=B=>B==="jpeg"||B==="jpg"||B==="webp";return[A,F.format,z].map(B=>typeof B=="string"?B.toLowerCase():"").find(j)&&(F.backgroundColor==null||F.backgroundColor==="transparent")&&(F.backgroundColor="#ffffff"),F.scale!==1&&(Number.isFinite(F.width)||Number.isFinite(F.height))&&H(F,"scale ignored: width/height already set the size."),F}let T=!1,L=Promise.resolve();async function W(A,N){let $=Object.freeze(N&&typeof N=="object"?{...N}:{}),F=async()=>{let q=k[A];if(!q)throw new Error(`[SnapDOM] Unknown export type: ${A}`);let j=R(A,$),J=M({artifacts:e.__artifacts||null,export:v({type:A,options:j,requestedOptions:$})}),B=j.format,ut=j.type;await Zn("beforeExport",J,{format:A,options:j});let vt=j.format!==B?j.format:j.type!==ut?j.type:"",at=typeof vt=="string"?vt.toLowerCase():"";ac.has(at)&&(j.format=at==="jpg"?"jpeg":at,j.type=j.format,j.__explicitFormat=j.format,/^(?:jpeg|webp)$/.test(j.format)&&(j.backgroundColor==null||j.backgroundColor==="transparent")&&(j.backgroundColor="#ffffff"));let st=await q(J,j);return await Zn("afterExport",J,{format:A,options:j,result:st}),T||(T=!0,await Bt("afterSnap",e)),st},z=L.then(F);return L=z.catch(()=>{}),z}let P={url:t,needs:n,warnings:e.__session&&e.__session.warnings||[],toRaw:()=>{if(!r)throw i("toRaw()");return a()},to:(A,N)=>W(A,N),toImg:A=>W("img",A),toSvg:A=>W("svg",A),toCanvas:A=>W("canvas",A),toBlob:A=>W("blob",A),toPng:A=>W("png",A),toJpg:A=>W("jpg",A),toWebp:A=>W("webp",A),download:A=>W("download",A)};r?o&&Object.defineProperty(P,"url",{get:a,enumerable:!0,configurable:!0}):Object.defineProperty(P,"url",{get(){throw i("url")},enumerable:!1,configurable:!0}),Object.defineProperty(P,"meta",r?{value:e.meta,enumerable:!0}:{get(){throw i("meta")},enumerable:!1,configurable:!0});for(let A of Object.keys(k)){let N="to"+A.charAt(0).toUpperCase()+A.slice(1);P[N]||(P[N]=$=>W(A,$))}return P}K.toRaw=(t,e)=>K(t,e).then(n=>n.toRaw());K.toImg=(t,e)=>K(t,e).then(n=>n.toImg());K.toSvg=(t,e)=>K(t,e).then(n=>n.toSvg());K.toCanvas=(t,e)=>K(t,e).then(n=>n.toCanvas());K.toBlob=(t,e)=>K(t,e).then(n=>n.toBlob());K.toPng=(t,e)=>K(t,{...e,format:"png"}).then(n=>n.toPng());K.toJpg=(t,e)=>K(t,{...e,format:"jpeg"}).then(n=>n.toJpg());K.toWebp=(t,e)=>K(t,{...e,format:"webp"}).then(n=>n.toWebp());K.download=(t,e)=>K(t,e).then(n=>n.download());export{gt as DEFAULT_STAGE,We as STAGES,la as assertNeeds,Eu as clearPlugins,Ao as getGlobalPlugins,ze as normalizePlugin,Mo as registerPlugins,K as snapdom};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zumer/snapdom",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "SnapDOM is a high-performance engine for capturing, modifying, and converting DOM elements into any format.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/snapdom.js",
|
|
@@ -49,10 +49,15 @@
|
|
|
49
49
|
"site": "npm run compile && node scripts/serve-site.mjs",
|
|
50
50
|
"bump:dry": "npx @zumerbox/bump -d",
|
|
51
51
|
"bump": "npx @zumerbox/bump && npx @zumerbox/changelog",
|
|
52
|
+
"bump:plugins": "npm run bump --workspace=@zumer/snapdom-plugins",
|
|
53
|
+
"bump:plugins:dry": "npm run bump:dry --workspace=@zumer/snapdom-plugins",
|
|
52
54
|
"prepack": "npm run compile",
|
|
53
55
|
"build": "npm pack",
|
|
56
|
+
"build:plugins": "npm pack --workspace=@zumer/snapdom-plugins",
|
|
54
57
|
"release": "REQUIRE_VISUAL=1 npm run test:full && npm run test:pack && npm run test:benchmark && npm run build && echo \"\\n→ Review CHANGELOG.md, then: npm run release:push\"",
|
|
55
58
|
"release:push": "git add CHANGELOG.md && git commit -m \"Bumped version\" && git push --follow-tags",
|
|
59
|
+
"release:plugins": "REQUIRE_VISUAL=1 npm run test:full && npm run test:pdf && npm run test:vector && npm run test:pack && npm run build:plugins && echo \"Review packages/plugins/CHANGELOG.md, then: npm run publish:plugins\"",
|
|
60
|
+
"publish:plugins": "npm publish --workspace=@zumer/snapdom-plugins --access public --tag latest",
|
|
56
61
|
"publish:beta": "npm publish --tag beta",
|
|
57
62
|
"publish:dev": "node scripts/publish-dev.mjs",
|
|
58
63
|
"test:pdf": "node packages/plugins/pdf/test/verify.mjs && node packages/plugins/pdf/test/megacheck.mjs && node packages/plugins/pdf/test/encryptcheck.mjs",
|