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

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.
Files changed (37) hide show
  1. package/README.md +50 -9
  2. package/dist/modules/chunks/chunk-23Q2XEDO.js +7 -0
  3. package/dist/modules/chunks/chunk-2FBS3OGP.js +7 -0
  4. package/dist/modules/chunks/chunk-43NWAKSV.js +7 -0
  5. package/dist/modules/chunks/chunk-5EIHY65Z.js +7 -0
  6. package/dist/modules/chunks/chunk-6FO4Y3OG.js +10 -0
  7. package/dist/modules/chunks/chunk-AOOOETXS.js +7 -0
  8. package/dist/modules/chunks/chunk-DV3SVS7E.js +10 -0
  9. package/dist/modules/chunks/chunk-FPOOW4FJ.js +7 -0
  10. package/dist/modules/chunks/chunk-FQFF5KMG.js +7 -0
  11. package/dist/modules/chunks/chunk-GU6SHZKJ.js +7 -0
  12. package/dist/modules/chunks/chunk-JUQT3OWD.js +7 -0
  13. package/dist/modules/chunks/chunk-LO3HOQZX.js +8 -0
  14. package/dist/modules/chunks/chunk-MI3WCG7V.js +8 -0
  15. package/dist/modules/chunks/chunk-R6NINER4.js +7 -0
  16. package/dist/modules/chunks/chunk-TWGUMDQG.js +10 -0
  17. package/dist/modules/chunks/chunk-UI252PBJ.js +7 -0
  18. package/dist/modules/chunks/chunk-XUQSCYHL.js +10 -0
  19. package/dist/modules/chunks/chunk-ZHRUQIHZ.js +7 -0
  20. package/dist/modules/chunks/rasterize-NVVIIRN2.js +7 -0
  21. package/dist/modules/chunks/rasterize-XGEI2GKT.js +7 -0
  22. package/dist/modules/exporters/download.js +7 -0
  23. package/dist/modules/exporters/toBlob.js +7 -0
  24. package/dist/modules/exporters/toCanvas.js +7 -0
  25. package/dist/modules/exporters/toImg.js +7 -0
  26. package/dist/modules/exporters/toJpg.js +7 -0
  27. package/dist/modules/exporters/toPng.js +7 -0
  28. package/dist/modules/exporters/toSvg.js +7 -0
  29. package/dist/modules/exporters/toWebp.js +7 -0
  30. package/dist/modules/plugins.js +7 -0
  31. package/dist/modules/preCache.js +7 -0
  32. package/dist/modules/snapdom.js +7 -0
  33. package/dist/snapdom.js +13 -5030
  34. package/dist/snapdom.mjs +2284 -1886
  35. package/package.json +29 -24
  36. package/dist/snapdom.min.js +0 -8
  37. package/dist/snapdom.min.mjs +0 -8
@@ -0,0 +1,10 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{b as qt,c as Vt,d as Yt,e as Ut,f as jt,g as Kt,h as Gt,i as Zt}from"./chunk-TWGUMDQG.js";import{c as Q}from"./chunk-R6NINER4.js";import{a as A,b as $t,c as It,d as Lt,e as Wt,f as U,g as _t,h as Ht,i as Bt,k as ot,l as Rt,m as Dt,n as Ot,o as zt,p as St,q as Xt}from"./chunk-MI3WCG7V.js";import{a as O,b as st}from"./chunk-ZHRUQIHZ.js";var Jt=new WeakMap,Ct=new Map,vt=0;function it(){vt++}var Qt=!1;function en(t=document.documentElement){if(!Qt){Qt=!0;try{new MutationObserver(()=>it()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>it()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",it),e.ready?.then(()=>it()).catch(()=>{}))}catch{}}}function nn(t,e={}){let n={},r=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let s=t[o],u=t.getPropertyValue(s);(s==="background-image"||s==="content")&&u.includes("url(")&&!u.includes("data:")&&(u="none"),n[s]=u}let a=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let o of a)if(!n[o])try{let s=t.getPropertyValue(o);s&&(n[o]=s)}catch{}if(e.embedFonts){let o=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let s of o)if(!n[s])try{let u=t.getPropertyValue(s);u&&(n[s]=u)}catch{}}return r==="hidden"&&(n.opacity="0"),n}var te=new WeakMap;function rn(t){let e=te.get(t);return e||(e=Object.entries(t).sort((r,a)=>r[0]<a[0]?-1:r[0]>a[0]?1:0).map(([r,a])=>`${r}:${a}`).join(";"),te.set(t,e),e)}function on(t,e=null,n={}){let r=Jt.get(t);if(r&&r.epoch===vt)return r.snapshot;let a=e||getComputedStyle(t),o=nn(a,n);return fn(t,a,o),Jt.set(t,{epoch:vt,snapshot:o}),o}function sn(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Ct,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:e||{}}:{session:A.session,persist:{snapshotKeyCache:Ct,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:t||e||{}}}async function z(t,e,n,r){if(t.tagName==="STYLE")return;let a=sn(n,r),o=a.options&&a.options.cache||"auto";if(o!=="disabled"&&en(document.documentElement),o==="disabled"&&!a.session.__bumpedForDisabled&&(it(),Ct.clear(),a.session.__bumpedForDisabled=!0),Bt.has(t.tagName?.toLowerCase())){let d=t.getAttribute?.("style");d&&e.setAttribute("style",d)}let{session:s,persist:u}=a;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let l=s.styleCache.get(t),i=on(t,l,a.options),c=rn(i),f=u.snapshotKeyCache.get(c);if(!f){let d=t.tagName?.toLowerCase()||"div";f=ot(i,d),u.snapshotKeyCache.set(c,f)}s.styleMap.set(e,f)}function an(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function cn(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function ln(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function un(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,r=t.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let a=t.scrollHeight;if(a===0)return!1;let o=parseFloat(e.paddingTop)||0,s=parseFloat(e.paddingBottom)||0;return a>o+s}function fn(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let r=t.tagName&&t.tagName.toLowerCase();if(!r||r!=="div"&&r!=="section"&&r!=="article"&&r!=="main"&&r!=="aside"&&r!=="header"&&r!=="footer"&&r!=="nav")return;let a=e.display||"";if(a.includes("flex")||a.includes("grid")||an(t))return;let o=e.position;if(o==="absolute"||o==="fixed"||o==="sticky"||e.transform!=="none"||cn(e)||ln(t))return;let s=e.overflowX||e.overflow||"visible",u=e.overflowY||e.overflow||"visible";if(s!=="visible"||u!=="visible")return;let l=e.clip;l&&l!=="auto"&&l!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||un(t,e)&&(delete n.height,delete n["block-size"])}var ne=["fill","stroke","color","background-color","stop-color"],ee=new Map;function dn(t,e){let n=e+"::"+t.toLowerCase(),r=ee.get(n);if(r)return r;let a=document,o=e==="http://www.w3.org/2000/svg"?a.createElementNS(e,t):a.createElement(t),s=a.createElement("div");s.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",s.appendChild(o),a.documentElement.appendChild(s);let u=getComputedStyle(o),l={};for(let i of ne)l[i]=u.getPropertyValue(i)||"";return s.remove(),ee.set(n,l),l}function re(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&t.attributes?.length){let o=t.attributes;for(let s=0;s<o.length;s++){let u=o[s];if(u&&typeof u.value=="string"&&u.value.includes("var(")){r=!0;break}}}let a=null;if(r)try{a=getComputedStyle(t)}catch{}if(r){let o=t.style;if(o&&o.length)for(let s=0;s<o.length;s++){let u=o[s],l=o.getPropertyValue(u);if(!l||!l.includes("var("))continue;let i=a&&a.getPropertyValue(u);if(i)try{e.style.setProperty(u,i.trim(),o.getPropertyPriority(u))}catch{}}}if(r&&t.attributes?.length){let o=t.attributes;for(let s=0;s<o.length;s++){let u=o[s];if(!u||typeof u.value!="string"||!u.value.includes("var("))continue;let l=u.name,i=a&&a.getPropertyValue(l);if(i)try{e.style.setProperty(l,i.trim())}catch{}}}if(!r){if(!a)try{a=getComputedStyle(t)}catch{a=null}if(!a)return;let o=t.namespaceURI||"html",s=dn(t.tagName,o);for(let u of ne){let l=a.getPropertyValue(u)||"",i=s[u]||"";if(l&&l!==i)try{e.style.setProperty(u,l.trim())}catch{}}}}function mt(t,e,n){return Promise.all(t.map(r=>new Promise(a=>{function o(){O(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(r,a):o()},{fast:n})}o()})))}function hn(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function mn(t,e,n=!0){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let a=n?hn(r):r;return`:where(${e} ${a})`}).join(", ")}function se(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${e}:is(${r.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${e} ${r.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,a,o)=>{let s=mn(o,e,!0);return`${r}${a}${s}{`}),t):""}function ie(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function ae(t){let e="";try{t.querySelectorAll("style").forEach(r=>{e+=(r.textContent||"")+`
8
+ `});let n=t.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let a of r.cssRules)e+=a.cssText+`
9
+ `}catch{}}catch{}return e}function ce(t,e,n){if(!e)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=e,t.insertBefore(r,t.firstChild||null)}function le(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function ue(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(t);)e.add(r[1]);return e}function pn(t,e){try{let r=getComputedStyle(t).getPropertyValue(e).trim();if(r)return r}catch{}try{let r=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(r)return r}catch{}return""}function fe(t,e,n){let r=[];for(let a of e){let o=pn(t,a);o&&r.push(`${a}: ${o};`)}return r.length?`${n}{${r.join("")}}
10
+ `:""}function de(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function gn(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),a=0;for(;a<e&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),a++;return r&&(r.body||r.documentElement)?r:null}function yn(t){let e=t.getBoundingClientRect(),n=0,r=0,a=0,o=0;try{let l=getComputedStyle(t);n=parseFloat(l.borderLeftWidth)||0,r=parseFloat(l.borderRightWidth)||0,a=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),u=Math.max(0,Math.round(e.height-(a+o)));return{contentWidth:s,contentHeight:u,rect:e}}function bn(t,e,n){let r=t.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function he(t,e,n){let r=await gn(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:a,contentHeight:o,rect:s}=yn(t),u=n?.snap;if(!u||typeof u.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let l={...n,scale:1},i=bn(r,a,o),c;try{c=await u.toPng(r.documentElement,l)}finally{i()}c.style.display="block",c.style.width=`${a}px`,c.style.height=`${o}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),z(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(c),f}var at=new Map;async function ct(t){if(A.resource?.has(t))return A.resource.get(t);if(at.has(t))return at.get(t);let e=(async()=>{let n=await U(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return A.resource?.set(t,n.data),n.data})();at.set(t,e);try{let n=await e;return at.set(t,n),n}catch(n){throw at.delete(t),n}}var xn=/\bblob:[^)"'\s]+/g;async function oe(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(xn)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let a=await ct(r);n=n.split(r).join(a)}catch{}return n}function ht(t){return typeof t=="string"&&t.startsWith("blob:")}function wn(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function Sn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function me(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let l=s.getAttribute("src")||s.currentSrc||"";if(ht(l)){let c=await ct(l);s.setAttribute("src",c)}let i=s.getAttribute("srcset");if(i&&i.includes("blob:")){let c=wn(i),f=!1;for(let d of c)if(ht(d.url))try{d.url=await ct(d.url),f=!0}catch{}f&&s.setAttribute("srcset",Sn(c))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let u="http://www.w3.org/1999/xlink",l=s.getAttribute("href")||s.getAttributeNS?.(u,"href");if(ht(l)){let i=await ct(l);s.setAttribute("href",i),s.removeAttributeNS?.(u,"href")}}catch{}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of r)try{let u=s.getAttribute("style");if(u&&u.includes("blob:")){let l=await oe(u);s.setAttribute("style",l)}}catch{}let a=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of a)try{let u=s.textContent||"";u.includes("blob:")&&(s.textContent=await oe(u))}catch{}let o=["poster"];for(let s of o){let u=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let l of u)try{let i=l.getAttribute(s);ht(i)&&l.setAttribute(s,await ct(i))}catch{}}}async function lt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,a=null,o=null;if(t.nodeType===Node.ELEMENT_NODE){let i=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ht.has(i))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let i=document.createElement("div"),c=t.getBoundingClientRect();return i.style.cssText=`display:inline-block;width:${c.width}px;height:${c.height}px;visibility:hidden;`,i}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let i of n.exclude)try{if(t.matches?.(i)){if(n.excludeMode==="hide"){let c=document.createElement("div"),f=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${f.width}px;height:${f.height}px;visibility:hidden;`,c}else if(n.excludeMode==="remove")return null}}catch(c){console.warn(`Invalid selector in exclude option: ${i}`,c)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let i=document.createElement("div"),c=t.getBoundingClientRect();return i.style.cssText=`display:inline-block;width:${c.width}px;height:${c.height}px;visibility:hidden;`,i}else if(n.filterMode==="remove")return null}}catch(i){console.warn("Error in filter function:",i)}if(t.tagName==="IFRAME"){let i=!1;try{i=!!(t.contentDocument||t.contentWindow?.document)}catch{i=!1}if(i)try{return await he(t,e,n)}catch(c){console.warn("[SnapDOM] iframe rasterization failed, fallback:",c)}if(n.placeholders){let c=document.createElement("div");return c.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,z(t,c,e,n),c}else{let c=t.getBoundingClientRect(),f=document.createElement("div");return f.style.cssText=`display:inline-block;width:${c.width}px;height:${c.height}px;visibility:hidden;`,z(t,f,e,n),f}}if(t.getAttribute("data-capture")==="placeholder"){let i=t.cloneNode(!1);e.nodeMap.set(i,t),z(t,i,e,n);let c=document.createElement("div");return c.textContent=t.getAttribute("data-placeholder-text")||"",c.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",i.appendChild(c),i}if(t.tagName==="CANVAS"){let i="";try{let f=t.getContext("2d",{willReadFrequently:!0});try{f&&f.getImageData(0,0,1,1)}catch{}if(await new Promise(d=>requestAnimationFrame(d)),i=t.toDataURL("image/png"),!i||i==="data:,"){try{f&&f.getImageData(0,0,1,1)}catch{}if(await new Promise(d=>requestAnimationFrame(d)),i=t.toDataURL("image/png"),!i||i==="data:,"){let d=document.createElement("canvas");d.width=t.width,d.height=t.height;let h=d.getContext("2d");h&&(h.drawImage(t,0,0),i=d.toDataURL("image/png"))}}}catch{}let c=document.createElement("img");try{c.decoding="sync",c.loading="eager"}catch{}i&&(c.src=i),c.width=t.width,c.height=t.height;try{let f=getComputedStyle(t);f.width&&(c.style.width=f.width),f.height&&(c.style.height=f.height)}catch{}return e.nodeMap.set(c,t),z(t,c,e,n),c}let s;try{if(s=t.cloneNode(!1),re(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){le(t,s);try{let i=t.getBoundingClientRect(),c=Math.round(i.width||0),f=Math.round(i.height||0);if(!c||!f){let d=window.getComputedStyle(t),h=parseFloat(d.width)||0,m=parseFloat(d.height)||0,g=parseInt(t.getAttribute("width")||"",10)||0,w=parseInt(t.getAttribute("height")||"",10)||0,M=t.width||t.naturalWidth||0,b=t.height||t.naturalHeight||0;c=Math.round(c||h||g||M||0),f=Math.round(f||m||w||b||0)}c&&(s.dataset.snapdomWidth=String(c)),f&&(s.dataset.snapdomHeight=String(f))}catch{}try{let i=t.getAttribute("style")||"",c=window.getComputedStyle(t),f=w=>{let M=i.match(new RegExp(`${w}\\s*:\\s*([^;]+)`,"i")),b=M?M[1].trim():c.getPropertyValue(w);return/%|auto/i.test(String(b||""))},d=parseInt(s.dataset.snapdomWidth||"0",10),h=parseInt(s.dataset.snapdomHeight||"0",10),m=f("width")||!d,g=f("height")||!h;m&&d&&(s.style.width=`${d}px`),g&&h&&(s.style.height=`${h}px`),d&&(s.style.minWidth=`${d}px`),h&&(s.style.minHeight=`${h}px`)}catch{}}}catch(i){throw console.error("[Snapdom] Failed to clone node:",t,i),i}if(t instanceof HTMLTextAreaElement){let i=t.getBoundingClientRect();s.style.width=`${i.width}px`,s.style.height=`${i.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(a=t.value),t instanceof HTMLTextAreaElement&&(o=t.value),z(t,s,e,n),t.shadowRoot){let w=function(b,x){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return x(null);lt(b,e,n).then(p=>{x(p||null)}).catch(()=>{x(null)})};try{let b=t.shadowRoot.querySelectorAll("slot");for(let x of b){let p=[];try{p=x.assignedNodes?.({flatten:!0})||x.assignedNodes?.()||[]}catch{p=x.assignedNodes?.()||[]}for(let C of p)r.add(C)}}catch{}let i=ie(e),c=`[data-sd="${i}"]`;try{s.setAttribute("data-sd",i)}catch{}let f=ae(t.shadowRoot),d=se(f,c),h=ue(f),m=fe(t,h,c);ce(s,m+d,i);let g=document.createDocumentFragment(),M=await mt(Array.from(t.shadowRoot.childNodes),w,n.fast);g.append(...M.filter(b=>!!b)),s.appendChild(g)}if(t.tagName==="SLOT"){let d=function(m,g){lt(m,e,n).then(w=>{w&&de(w),g(w||null)}).catch(()=>{g(null)})},i=t.assignedNodes?.({flatten:!0})||[],c=i.length>0?i:Array.from(t.childNodes),f=document.createDocumentFragment(),h=await mt(Array.from(c),d,n.fast);return f.append(...h.filter(m=>!!m)),f}function u(i,c){if(r.has(i))return c(null);lt(i,e,n).then(f=>{c(f||null)}).catch(()=>{c(null)})}let l=await mt(Array.from(t.childNodes),u,n.fast);if(s.append(...l.filter(i=>!!i)),a!==null&&s instanceof HTMLSelectElement){s.value=a;for(let i of s.options)i.value===a?i.setAttribute("selected",""):i.removeAttribute("selected")}return o!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=o),s}function be(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Cn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function pe(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function ge(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,t)),a="";for(let[o,s]of n)for(;r>=o;)a+=s,r-=o;return e?a:a.toLowerCase()}function ye(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return pe(t,!1);case"upper-alpha":return pe(t,!0);case"lower-roman":return ge(t,!1);case"upper-roman":return ge(t,!0);default:return String(Math.max(0,t))}}function xe(t){let e=()=>A?.session?.__counterEpoch??0,n=e(),r=new WeakMap,a=t instanceof Document?t.documentElement:t,o=d=>d&&d.tagName==="LI",s=d=>{let h=0,m=d?.parentElement;if(!m)return 0;for(let g of m.children){if(g===d)break;g.tagName==="LI"&&h++}return h},u=d=>{let h=new Map;for(let[m,g]of d)h.set(m,g.slice());return h},l=(d,h,m)=>{let g=u(d),w;try{w=m.style?.counterReset||getComputedStyle(m).counterReset}catch{}if(w&&w!=="none")for(let b of w.split(",")){let x=b.trim().split(/\s+/),p=x[0],C=Number.isFinite(Number(x[1]))?Number(x[1]):0;if(!p)continue;let y=h.get(p);if(y&&y.length){let v=y.slice();v.push(C),g.set(p,v)}else g.set(p,[C])}let M;try{M=m.style?.counterIncrement||getComputedStyle(m).counterIncrement}catch{}if(M&&M!=="none")for(let b of M.split(",")){let x=b.trim().split(/\s+/),p=x[0],C=Number.isFinite(Number(x[1]))?Number(x[1]):1;if(!p)continue;let y=g.get(p)||[];y.length===0&&y.push(0),y[y.length-1]+=C,g.set(p,y)}try{if(getComputedStyle(m).display==="list-item"&&o(m)){let x=m.parentElement,p=1;if(x&&x.tagName==="OL"){let y=x.getAttribute("start"),v=Number.isFinite(Number(y))?Number(y):1,E=s(m),F=m.getAttribute("value");p=Number.isFinite(Number(F))?Number(F):v+E}else p=1+s(m);let C=g.get("list-item")||[];C.length===0&&C.push(0),C[C.length-1]=p,g.set("list-item",C)}}catch{}return g},i=(d,h,m)=>{let g=l(m,h,d);r.set(d,g);let w=g;for(let M of d.children)w=i(M,g,w);return g},c=new Map;i(a,c,c);function f(){let d=e();if(d!==n){n=d;let h=new Map;i(a,h,h)}}return{get(d,h){f();let m=r.get(d)?.get(h);return m&&m.length?m[m.length-1]:0},getStack(d,h){f();let m=r.get(d)?.get(h);return m?m.slice():[]}}}function we(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,a=t.replace(r,(o,s,u)=>{let l=String(u).split(",").map(i=>i.trim());if(s==="counter"){let i=l[0]?.replace(/^["']|["']$/g,""),c=(l[1]||"decimal").toLowerCase(),f=n.get(e,i);return ye(f,c)}else{let i=l[0]?.replace(/^["']|["']$/g,""),c=l[1]?.replace(/^["']|["']$/g,"")??"",f=(l[2]||"decimal").toLowerCase(),d=n.getStack(e,i);return d.length?d.map(m=>ye(m,f)).join(c):""}});return Cn(a)}catch{return"- "}}var tt=new WeakMap,Se=300;function vn(t,e){let n=ke(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=ve(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):ve(t)}function Mt(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function ke(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,r=0;for(let o=0;o<e.length;o++){let s=e[o];if(s.tagName==="STYLE"){let u=s.textContent?s.textContent.length:0;n+=`S${u}|`;let l=s.sheet,i=l?Mt(l):null;i&&(r+=i.length)}else{let u=s.getAttribute("href")||"",l=s.getAttribute("media")||"all";n+=`L${u}|m:${l}|`;let i=s.sheet,c=i?Mt(i):null;c&&(r+=c.length)}}let a=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(a)?a.length:0}|tr:${r}`,n}function Ce(t,e,n){let r=Mt(t);if(!r)return!1;for(let a=0;a<r.length;a++){if(n.budget<=0)return!1;let o=r[a],s=o&&o.cssText?o.cssText:"";n.budget--;for(let u of e)if(s.includes(u))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let u=0;u<o.cssRules.length&&n.budget>0;u++){let l=o.cssRules[u],i=l&&l.cssText?l.cssText:"";n.budget--;for(let c of e)if(i.includes(c))return!0}if(n.budget<=0)return!1}return!1}function ve(t=document){let e=ke(t),n=tt.get(t);if(n&&n.fingerprint===e)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],a=t.querySelectorAll("style");for(let s=0;s<a.length;s++){let u=a[s].textContent||"";for(let l of r)if(u.includes(l))return tt.set(t,{fingerprint:e,result:!0}),!0}let o=t.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let s={budget:Se};try{for(let u of o)if(Ce(u,r,s))return tt.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let s=t.querySelectorAll('style,link[rel~="stylesheet"]'),u={budget:Se};for(let l=0;l<s.length&&u.budget>0;l++){let i=s[l],c=null;if(i.tagName,c=i.sheet||null,c&&Ce(c,r,u))return tt.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(tt.set(t,{fingerprint:e,result:!0}),!0):(tt.set(t,{fingerprint:e,result:!1}),!1)}var et=new WeakMap,Me=-1;function Mn(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function kn(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r;for(;r=n.exec(t);)e.push(r[1]);return e.length?e.join(""):Mn(t)}function kt(t,e){let n=t.parentElement,r=n?et.get(n):null;return r?{get(a,o){let s=e.get(a,o),u=r.get(o);return typeof u=="number"?Math.max(s,u):s},getStack(a,o){let s=e.getStack(a,o);if(!s.length)return s;let u=r.get(o);if(typeof u=="number"){let l=s.slice();return l[l.length-1]=Math.max(l[l.length-1],u),l}return s}}:e}function At(t,e,n){let r=new Map;function a(l){let i=[];if(!l||l==="none")return i;for(let c of String(l).split(",")){let f=c.trim().split(/\s+/),d=f[0],h=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;d&&i.push({name:d,num:h})}return i}let o=a(e?.counterReset),s=a(e?.counterIncrement);function u(l){if(r.has(l))return r.get(l).slice();let i=n.getStack(t,l);i=i.length?i.slice():[];let c=o.find(d=>d.name===l);if(c){let d=Number.isFinite(c.num)?c.num:0;i=i.length?[...i,d]:[d]}let f=s.find(d=>d.name===l);if(f){let d=Number.isFinite(f.num)?f.num:1;i.length===0&&(i=[0]),i[i.length-1]+=d}return r.set(l,i.slice()),i}return{get(l,i){let c=u(i);return c.length?c[c.length-1]:0},getStack(l,i){return u(i)},__incs:s}}function An(t,e,n){let r;try{r=getComputedStyle(t,e)}catch{}let a=r?.content;if(!a||a==="none"||a==="normal")return{text:"",incs:[]};let o=kt(t,n),s=At(t,r,o),u=be(a)?we(a,t,s):a;return{text:kn(u),incs:s.__incs||[]}}async function Et(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;let a=t.ownerDocument||document;if(!vn(a,n))return;let o=A?.session?.__counterEpoch??0;if(Me!==o&&(et=new WeakMap,n&&(n.__counterCtx=null),Me=o),!n.__counterCtx)try{n.__counterCtx=xe(t.ownerDocument||document)}catch{}let s=n.__counterCtx;for(let i of["::before","::after","::first-letter"])try{let c=zt(t,i);if(!c||c.content==="none"&&c.backgroundImage==="none"&&c.backgroundColor==="transparent"&&(c.borderStyle==="none"||parseFloat(c.borderWidth)===0)&&(!c.transform||c.transform==="none")&&c.display==="inline")continue;if(i==="::first-letter"){let N=getComputedStyle(t);if(!(c.color!==N.color||c.fontSize!==N.fontSize||c.fontWeight!==N.fontWeight))continue;let I=Array.from(e.childNodes).find(yt=>yt.nodeType===Node.TEXT_NODE&&yt.textContent?.trim().length>0);if(!I)continue;let L=I.textContent,K=L.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],pt=L.slice(K?.length||0);if(!K||/[\uD800-\uDFFF]/.test(K))continue;let G=document.createElement("span");G.textContent=K,G.dataset.snapdomPseudo="::first-letter";let gt=St(c),ut=ot(gt,"span");n.styleMap.set(G,ut);let ft=document.createTextNode(pt);e.replaceChild(ft,I),e.insertBefore(G,ft);continue}let d=c.content??"",h=d===""||d==="none"||d==="normal",{text:m,incs:g}=An(t,i,s),w=c.backgroundImage,M=c.backgroundColor,b=c.fontFamily,x=parseInt(c.fontSize)||32,p=parseInt(c.fontWeight)||!1,C=c.color||"#000",y=c.borderStyle,v=parseFloat(c.borderWidth),E=c.transform,F=qt(b),$=!h&&m!=="",P=w&&w!=="none",W=M&&M!=="transparent"&&M!=="rgba(0, 0, 0, 0)",B=y&&y!=="none"&&v>0,nt=E&&E!=="none";if(!($||P||W||B||nt)){if(g&&g.length&&t.parentElement){let N=et.get(t.parentElement)||new Map;for(let{name:T}of g){if(!T)continue;let I=kt(t,s),Y=At(t,getComputedStyle(t,i),I).get(t,T);N.set(T,Y)}et.set(t.parentElement,N)}continue}let k=document.createElement("span");k.dataset.snapdomPseudo=i,k.style.pointerEvents="none";let q=St(c),V=ot(q,"span");if(n.styleMap.set(k,V),F&&m&&m.length===1){let{dataUrl:N,width:T,height:I}=await Yt(m,b,p,x,C),L=document.createElement("img");L.src=N,L.style=`height:${x}px;width:${T/I*x}px;object-fit:contain;`,k.appendChild(L),e.dataset.snapdomHasIcon="true"}else if(m&&m.startsWith("url(")){let N=It(m);if(N?.trim())try{let T=document.createElement("img"),I=await U(Wt(N),{as:"dataURL",useProxy:r.useProxy});T.src=I.data,T.style=`width:${x}px;height:auto;object-fit:contain;`,k.appendChild(T)}catch(T){console.error(`[snapdom] Error in pseudo ${i} for`,t,T)}}else!F&&$&&(k.textContent=m);k.style.backgroundImage="none","maskImage"in k.style&&(k.style.maskImage="none"),"webkitMaskImage"in k.style&&(k.style.webkitMaskImage="none");try{k.style.backgroundRepeat=c.backgroundRepeat,k.style.backgroundSize=c.backgroundSize,c.backgroundPositionX&&c.backgroundPositionY?(k.style.backgroundPositionX=c.backgroundPositionX,k.style.backgroundPositionY=c.backgroundPositionY):k.style.backgroundPosition=c.backgroundPosition,k.style.backgroundOrigin=c.backgroundOrigin,k.style.backgroundClip=c.backgroundClip,k.style.backgroundAttachment=c.backgroundAttachment,k.style.backgroundBlendMode=c.backgroundBlendMode}catch{}if(P)try{let N=Xt(w),T=await Promise.all(N.map(_t));k.style.backgroundImage=T.join(", ")}catch(N){console.warn(`[snapdom] Failed to inline background-image for ${i}`,N)}W&&(k.style.backgroundColor=M);let j=k.childNodes.length>0||k.textContent?.trim()!==""||P||W||B||nt;if(g&&g.length&&t.parentElement){let N=et.get(t.parentElement)||new Map,T=kt(t,s),I=At(t,getComputedStyle(t,i),T);for(let{name:L}of g){if(!L)continue;let Y=I.get(t,L);N.set(L,Y)}et.set(t.parentElement,N)}if(!j)continue;i==="::before"?e.insertBefore(k,e.firstChild):e.appendChild(k)}catch(c){console.warn(`[snapdom] Failed to capture ${i} for`,t,c)}let u=Array.from(t.children),l=Array.from(e.children).filter(i=>!i.dataset.snapdomPseudo);for(let i=0;i<Math.min(u.length,l.length);i++)await Et(u[i],l[i],n,r)}function Ae(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,r=e||n,a=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(a.length===0)return;let o=/url\(\s*#([^)]+)\)/g,s=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],u=p=>window.CSS&&CSS.escape?CSS.escape(p):p.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",i=p=>{if(!p||!p.getAttribute)return null;let C=p.getAttribute("href")||p.getAttribute("xlink:href")||(typeof p.getAttributeNS=="function"?p.getAttributeNS(l,"href"):null);if(C)return C;let y=p.attributes;if(!y)return null;for(let v=0;v<y.length;v++){let E=y[v];if(!E||!E.name)continue;if(E.name==="href")return E.value;let F=E.name.indexOf(":");if(F!==-1&&E.name.slice(F+1)==="href")return E.value}return null},c=new Set(Array.from(t.querySelectorAll("[id]")).map(p=>p.id)),f=new Set,d=!1,h=(p,C=null)=>{if(!p)return;o.lastIndex=0;let y;for(;y=o.exec(p);){d=!0;let v=(y[1]||"").trim();v&&(c.has(v)||(f.add(v),C&&!C.has(v)&&C.add(v)))}},m=p=>{let C=p.querySelectorAll("use");for(let E of C){let F=i(E);if(!F||!F.startsWith("#"))continue;d=!0;let $=F.slice(1).trim();$&&!c.has($)&&f.add($)}let v=p.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let E of v){h(E.getAttribute("style")||"");for(let F of s)h(E.getAttribute(F))}};for(let p of a)m(p);if(!d)return;let g=t.querySelector("svg.inline-defs-container");g||(g=n.createElementNS("http://www.w3.org/2000/svg","svg"),g.classList.add("inline-defs-container"),g.setAttribute("aria-hidden","true"),g.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(g,t.firstChild||null));let w=g.querySelector("defs")||null,M=p=>{if(!p||c.has(p))return null;let C=u(p),y=v=>{let E=r.querySelector(v);return E&&!t.contains(E)?E:null};return y(`svg defs > *#${C}`)||y(`svg > symbol#${C}`)||y(`*#${C}`)};if(!f.size)return;let b=new Set(f),x=new Set;for(;b.size;){let p=b.values().next().value;if(b.delete(p),!p||c.has(p)||x.has(p))continue;let C=M(p);if(!C){x.add(p);continue}w||(w=n.createElementNS("http://www.w3.org/2000/svg","defs"),g.appendChild(w));let y=C.cloneNode(!0);y.id||y.setAttribute("id",p),w.appendChild(y),x.add(p),c.add(p);let v=[y,...y.querySelectorAll("*")];for(let E of v){let F=i(E);if(F&&F.startsWith("#")){let P=F.slice(1).trim();P&&!c.has(P)&&!x.has(P)&&b.add(P)}let $=E.getAttribute?.("style")||"";$&&h($,b);for(let P of s){let W=E.getAttribute?.(P);W&&h(W,b)}}}}function Ne(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),a=t.clientHeight,o="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let u=s.currentNode,l=getComputedStyle(u),i=l.position;if(i!=="sticky"&&i!=="-webkit-sticky")continue;let c=Ee(l.top),f=Ee(l.bottom);if(c==null&&f==null)continue;let d=En(u,t),h=Nn(e,d,o);if(!h)continue;let m=u.getBoundingClientRect(),g=m.width,w=m.height,M=m.left-r.left;if(!(g>0&&w>0)||!Number.isFinite(M))continue;let b=c!=null?c+n:n+(a-w-f);if(!Number.isFinite(b))continue;let x=Number.parseInt(l.zIndex,10),p=Number.isFinite(x),C=p?Math.max(x,1)+1:2,y=p?x-1:0,v=h.cloneNode(!1);v.setAttribute(o,"1"),v.style.position="sticky",v.style.left=`${M}px`,v.style.top=`${b}px`,v.style.width=`${g}px`,v.style.height=`${w}px`,v.style.visibility="hidden",v.style.zIndex=String(y),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",h.parentElement?.insertBefore(v,h),h.style.position="absolute",h.style.left=`${M}px`,h.style.top=`${b}px`,h.style.bottom="auto",h.style.zIndex=String(C),h.style.pointerEvents="none"}}function Ee(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function En(t,e){let n=[];for(let r=t;r&&r!==e;){let a=r.parentElement;if(!a)break;n.push(Array.prototype.indexOf.call(a.children,r)),r=a}return n.reverse()}function Nn(t,e,n){let r=t;for(let a=0;a<e.length;a++)if(r=Fn(r,n)[e[a]],!r)return null;return r instanceof HTMLElement?r:null}function Fn(t,e){let n=[],r=t.children;for(let a=0;a<r.length;a++){let o=r[a];o.hasAttribute(e)||n.push(o)}return n}function Fe(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,a=e.borderStyle,o=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,u=a==="none"||parseFloat(o)===0;s&&u&&(t.style.border=`${r} solid transparent`)}async function Te(t,e={}){let n={styleMap:A.session.styleMap,styleCache:A.session.styleCache,nodeMap:A.session.nodeMap},r,a="",o="";Fe(t);try{Ae(t)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await lt(t,n,e,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{await Et(t,r,n,e)}catch(l){console.warn("inlinePseudoElements failed:",l)}await me(r);try{let l=r.querySelectorAll("style[data-sd]");for(let i of l)o+=i.textContent||"",i.remove()}catch{}let s=Ot(n.styleMap);a=Array.from(s.entries()).map(([l,i])=>`.${i}{${l}}`).join(""),a=o+a;for(let[l,i]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",i.replace(/;/g,"; "));continue}let c=s.get(i);c&&l.classList.add(c);let f=l.style?.backgroundImage,d=l.dataset?.snapdomHasIcon;f&&f!=="none"&&(l.style.backgroundImage=f),d&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,i]of n.nodeMap.entries()){let c=i.scrollLeft,f=i.scrollTop;if((c||f)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let h=document.createElement("div");for(h.style.transform=`translate(${-c}px, ${-f}px)`,h.style.willChange="transform",h.style.display="inline-block",h.style.width="100%";l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h)}}let u=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Ne(t,u),t===n.nodeMap.get(r)){let l=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,l);let i=Lt(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=i||""}for(let[l,i]of n.nodeMap.entries())i.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:a,styleCache:n.styleCache}}function Tn(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,r=parseInt(t.getAttribute("width")||"",10)||0,a=parseInt(t.getAttribute("height")||"",10)||0,o=parseFloat(t.style?.width||"")||0,s=parseFloat(t.style?.height||"")||0,u=e||o||r||t.width||t.naturalWidth||100,l=n||s||a||t.height||t.naturalHeight||100;return{width:u,height:l}}async function Pe(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let c=a.currentSrc||a.src||"";c&&a.setAttribute("src",c)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let o=a.src||"";if(!o)return;let s=await U(o,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){a.src=s.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:u,height:l}=Tn(a),{fallbackURL:i}=e||{};if(i)try{let c=typeof i=="function"?await i({width:u,height:l,src:o,element:a}):i;if(c){let f=await U(c,{as:"dataURL",useProxy:e.useProxy});a.src=f.data,a.width||(a.width=u),a.height||(a.height=l);return}}catch{}if(e.placeholders!==!1){let c=document.createElement("div");c.style.cssText=[`width:${u}px`,`height:${l}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${l}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),c.textContent="img",a.replaceWith(c)}else{let c=document.createElement("div");c.style.cssText=`display:inline-block;width:${u}px;height:${l}px;visibility:hidden;`,a.replaceWith(c)}};for(let a=0;a<n.length;a+=4){let o=n.slice(a,a+4).map(r);await Promise.allSettled(o)}}function $e(t){if(!t)return()=>{};let e=Pn(t);if(e<=0)return()=>{};if(!Ln(t))return()=>{};let n=getComputedStyle(t),r=Math.round($n(n)*e+In(n)),a=t.textContent??"",o=a;if(t.scrollHeight<=r+.5)return()=>{};let s=0,u=a.length,l=-1;for(;s<=u;){let i=s+u>>1;t.textContent=a.slice(0,i)+"\u2026",t.scrollHeight<=r+.5?(l=i,s=i+1):u=i-1}return t.textContent=(l>=0?a.slice(0,l):"")+"\u2026",()=>{t.textContent=o}}function Pn(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function $n(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function In(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Ln(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}function Ie(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let a=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=a.length?a:"none"}catch{}}function Wn(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let r of n)r.remove()}function _n(t,e={}){let{stripFrameworkDirectives:n=!0}=e,r=new Set(["xml","xlink"]),a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let o=a.currentNode;for(let s of Array.from(o.attributes)){let u=s.name;if(u.includes("@")){o.removeAttribute(u);continue}if(u.includes(":")){let l=u.split(":",1)[0];if(!r.has(l)){o.removeAttribute(u);continue}}if(n&&(u.startsWith("x-")||u.startsWith("v-")||u.startsWith(":")||u.startsWith("on:")||u.startsWith("bind:")||u.startsWith("let:")||u.startsWith("class:"))){o.removeAttribute(u);continue}}}}function Le(t,e={}){t&&(_n(t,e),Wn(t))}function Hn(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function Bn(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Rn(t,e){if(!(t instanceof Element)||Hn(t)||Bn(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=e.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||e.transform&&e.transform!=="none")}function We(t,e,n=new Map){function r(a,o){if(!(a instanceof Element)||!(o instanceof Element))return;let s=a.childElementCount>o.childElementCount,u=n.get(a)||getComputedStyle(a);if(n.has(a)||n.set(a,u),s&&Rn(a,u)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let c=u.overflowY||u.overflowBlock||"visible",f=u.overflowX||u.overflowInline||"visible";(c!=="visible"||f!=="visible")&&(o.style.overflow="visible")}let l=Array.from(a.children),i=Array.from(o.children);for(let c=0;c<Math.min(l.length,i.length);c++)r(l[c],i[c])}r(t,e)}function Dn(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed"||e.position==="sticky"||(e.cssFloat||e.float||"none")!=="none"||e.transform&&e.transform!=="none")}function On(t,e){if(!(t instanceof Element))return!1;if(t.getAttribute("data-capture")==="exclude"&&e?.excludeMode==="remove")return!0;if(Array.isArray(e?.exclude))for(let n of e.exclude)try{if(t.matches(n))return e.excludeMode==="remove"}catch{}return!1}function _e(t,e){let n=getComputedStyle(t),r=t.getBoundingClientRect(),a=1/0,o=-1/0,s=!1,u=Array.from(t.children);for(let h of u){if(On(h,e)||!Dn(h))continue;let m=h.getBoundingClientRect(),g=m.top-r.top,w=m.bottom-r.top;w<=g||(g<a&&(a=g),w>o&&(o=w),s=!0)}let l=s?Math.max(0,o-a):0,i=parseFloat(n.borderTopWidth)||0,c=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingBottom)||0;return i+c+f+d+l}var S=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t;function He(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(u=>u.trim()),r=0,a=0,o=0,s=0;for(let u of n){let l=u.match(/-?\d+(\.\d+)?px/g)?.map(g=>parseFloat(g))||[];if(l.length<2)continue;let[i,c,f=0,d=0]=l,h=Math.abs(i)+f+d,m=Math.abs(c)+f+d;a=Math.max(a,h+Math.max(i,0)),s=Math.max(s,h+Math.max(-i,0)),o=Math.max(o,m+Math.max(c,0)),r=Math.max(r,m+Math.max(-c,0))}return{top:Math.ceil(r),right:Math.ceil(a),bottom:Math.ceil(o),left:Math.ceil(s)}}function Be(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function Re(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function De(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,a=0,o=0,s=0,u=!1;for(let l of n){u=!0;let i=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(g=>parseFloat(g))||[],[c=0,f=0,d=0]=i,h=Math.abs(c)+d,m=Math.abs(f)+d;a=Math.max(a,h+Math.max(c,0)),s=Math.max(s,h+Math.max(-c,0)),o=Math.max(o,m+Math.max(f,0)),r=Math.max(r,m+Math.max(-f,0))}return{bleed:{top:S(r),right:S(a),bottom:S(o),left:S(s)},has:u}}function Oe(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let o=Ye(t);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let a=r.match(/^matrix\(\s*([^)]+)\)$/i);if(a){let o=a[1].split(",").map(s=>parseFloat(s.trim()));if(o.length===6&&o.every(Number.isFinite)){let[s,u,l,i]=o,c=Math.sqrt(s*s+u*u)||0,f=0,d=0,h=0,m=0,g=0,w=0;c>0&&(f=s/c,d=u/c,h=f*l+d*i,m=l-f*h,g=i-d*h,w=Math.sqrt(m*m+g*g)||0,w>0?h=h/w:h=0);let M=c,b=0,x=h*w,p=w;try{e.style.transform=`matrix(${M}, ${b}, ${x}, ${p}, 0, 0)`}catch{}return{a:M,b,c:x,d:p}}}try{let o=String(r).trim();return e.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function Ft(t,e,n,r,a){let o=n.a,s=n.b,u=n.c,l=n.d,i=n.e||0,c=n.f||0;function f(M,b){let x=M-r,p=b-a,C=o*x+u*p,y=s*x+l*p;return C+=r+i,y+=a+c,[C,y]}let d=[f(0,0),f(t,0),f(0,e),f(t,e)],h=1/0,m=1/0,g=-1/0,w=-1/0;for(let[M,b]of d)M<h&&(h=M),b<m&&(m=b),M>g&&(g=M),b>w&&(w=b);return{minX:h,minY:m,maxX:g,maxY:w,width:g-h,height:w-m}}function ze(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[a,o]=[r[0]||"0",r[1]||"0"],s=(u,l)=>{let i=u.toLowerCase();return i==="left"||i==="top"?0:i==="center"?l/2:i==="right"||i==="bottom"?l:i.endsWith("px")?parseFloat(i)||0:i.endsWith("%")?(parseFloat(i)||0)*l/100:/^-?\d+(\.\d+)?$/.test(i)&&parseFloat(i)||0};return{ox:s(a,e),oy:s(o,n)}}function Xe(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let a=l=>{try{return typeof n.has=="function"&&!n.has(l)||typeof n.get!="function"?null:n.get(l)}catch{return null}},o=a("rotate");if(o)if(o.angle){let l=o.angle;e.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else o.unit?e.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:e.rotate=String(o);else{let l=getComputedStyle(t);e.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let s=a("scale");if(s){let l="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,i="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:l;e.scale=`${l} ${i}`}else{let l=getComputedStyle(t);e.scale=l.scale&&l.scale!=="none"?l.scale:null}let u=a("translate");if(u){let l="x"in u&&"value"in u.x?u.x.value:Array.isArray(u)?u[0]?.value:0,i="y"in u&&"value"in u.y?u.y.value:Array.isArray(u)?u[1]?.value:0,c="x"in u&&u.x?.unit?u.x.unit:"px",f="y"in u&&u.y?.unit?u.y.unit:"px";e.translate=`${l}${c} ${i}${f}`}else{let l=getComputedStyle(t);e.translate=l.translate&&l.translate!=="none"?l.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}var Nt=null;function zn(){if(Nt)return Nt;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),Nt=t,t}function qe(t){let e=zn(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Ye(n);return e.removeChild(n),r}function Ve(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let a=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",o=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(a||o||s)}function Ye(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}async function Vr(t,e){if(!t)throw new Error("Element cannot be null or undefined");$t(e.cache);let n=e.fast,r=e.outerTransforms!==!1,a=!!e.outerShadows,o={element:t,options:e,plugins:e.plugins},s,u,l,i="",c="",f,d,h=null;await Q("beforeSnap",o),await Q("beforeClone",o);let m=$e(o.element);try{({clone:s,classCSS:u,styleCache:l}=await Te(o.element,o.options)),!r&&s&&(h=Oe(o.element,s)),!a&&s&&Ie(o.element,s)}finally{m()}if(o={clone:s,classCSS:u,styleCache:l,...o},await Q("afterClone",o),Le(o.clone),o.options?.excludeMode==="remove")try{We(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await Vt(o.clone,o.element)}catch{}await new Promise(b=>{O(async()=>{await Pe(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{O(async()=>{await Zt(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),e.embedFonts&&await new Promise(b=>{O(async()=>{let x=jt(o.element),p=Kt(o.element);if(st()){let C=new Set(Array.from(x).map(y=>String(y).split("__")[0]).filter(Boolean));await Gt(C,1)}i=await Ut({required:x,usedCodepoints:p,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy}),b()},{fast:n})});let g=Rt(o.clone).sort(),w=g.join(",");A.baseStyle.has(w)?c=A.baseStyle.get(w):await new Promise(b=>{O(()=>{c=Dt(g),A.baseStyle.set(w,c),b()},{fast:n})}),o={fontsCSS:i,baseCSS:c,...o},await Q("beforeRender",o),await new Promise(b=>{O(()=>{let x=getComputedStyle(o.element),p=o.element.getBoundingClientRect(),C=Math.max(1,S(o.element.offsetWidth||parseFloat(x.width)||p.width||1)),y=Math.max(1,S(o.element.offsetHeight||parseFloat(x.height)||p.height||1));if(o.options?.excludeMode==="remove"){let _=_e(o.element,o.options);Number.isFinite(_)&&_>0&&(y=Math.max(1,Math.min(y,S(_+1))))}let v=(_,H=NaN)=>{let J=typeof _=="string"?parseFloat(_):_;return Number.isFinite(J)?J:H},E=v(o.options.width),F=v(o.options.height),$=C,P=y,W=Number.isFinite(E),B=Number.isFinite(F),nt=y>0?C/y:1;W&&B?($=Math.max(1,S(E)),P=Math.max(1,S(F))):W?($=Math.max(1,S(E)),P=Math.max(1,S($/(nt||1)))):B?(P=Math.max(1,S(F)),$=Math.max(1,S(P*(nt||1)))):($=C,P=y);let X=0,k=0,q=C,V=y;if(!r&&h&&Number.isFinite(h.a)){let _={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},H=Ft(C,y,_,0,0);X=S(H.minX),k=S(H.minY),q=S(H.maxX),V=S(H.maxY)}else if(r&&Xn(o.element)){let H=x.transform&&x.transform!=="none"?x.transform:"",J=Xe(o.element),wt=qe({baseTransform:H,rotate:J.rotate||"0deg",scale:J.scale,translate:J.translate}),{ox:Je,oy:Qe}=ze(x,C,y),tn=wt.is2D?wt:new DOMMatrix(wt.toString()),dt=Ft(C,y,tn,Je,Qe);X=S(dt.minX),k=S(dt.minY),q=S(dt.maxX),V=S(dt.maxY)}let rt=He(x),j=Be(x),N=Re(x),T=De(x),I=a?{top:S(rt.top+j.top+N.top+T.bleed.top),right:S(rt.right+j.right+N.right+T.bleed.right),bottom:S(rt.bottom+j.bottom+N.bottom+T.bleed.bottom),left:S(rt.left+j.left+N.left+T.bleed.left)}:{top:0,right:0,bottom:0,left:0};X=S(X-I.left),k=S(k-I.top),q=S(q+I.right),V=S(V+I.bottom);let L=Math.max(1,S(q-X)),Y=Math.max(1,S(V-k)),K=W||B?S($/C):1,pt=B||W?S(P/y):1,G=Math.max(1,S(L*K)),gt=Math.max(1,S(Y*pt)),ut="http://www.w3.org/2000/svg",ft=st()?1:0,R=S(ft+(r?0:1)),D=document.createElementNS(ut,"foreignObject"),Ue=S(X),je=S(k);D.setAttribute("x",String(S(-(Ue-R)))),D.setAttribute("y",String(S(-(je-R)))),D.setAttribute("width",String(S(C+R*2))),D.setAttribute("height",String(S(y+R*2))),D.style.overflow="visible";let Tt=document.createElement("style");Tt.textContent=o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,D.appendChild(Tt);let Z=document.createElement("div");Z.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Z.style.width=`${S(C)}px`,Z.style.height=`${S(y)}px`,Z.style.overflow="visible",o.clone.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Z.appendChild(o.clone),D.appendChild(Z);let Ke=new XMLSerializer().serializeToString(D),bt=S(L+R*2),xt=S(Y+R*2),Pt=W||B;e.meta={w0:C,h0:y,vbW:bt,vbH:xt,targetW:$,targetH:P};let Ge=st()&&Pt?bt:S(G+R*2),Ze=st()&&Pt?xt:S(gt+R*2);d=`<svg xmlns="${ut}" width="${Ge}" height="${Ze}" viewBox="0 0 ${bt} ${xt}">`+Ke+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,o={svgString:d,dataURL:f,...o},b()},{fast:n})}),await Q("afterRender",o);let M=document.getElementById("snapdom-sandbox");return M&&M.style.position==="absolute"&&M.remove(),o.dataURL}function Xn(t){return Ve(t)}export{Vr as a};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ function d(e,{fast:i=!1}={}){if(i)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function l(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",i=e.toLowerCase(),t=i.includes("safari")&&!i.includes("chrome")&&!i.includes("crios")&&!i.includes("fxios")&&!i.includes("android"),s=/applewebkit/i.test(e),o=/mobile/i.test(e),a=!/safari/i.test(e),n=s&&o&&a,r=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(i),u=/ipad|iphone|ipod/.test(i)&&s;return t||n||r||c||u}export{d as a,l as b};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a}from"./chunk-JUQT3OWD.js";import"./chunk-5EIHY65Z.js";import"./chunk-ZHRUQIHZ.js";export{a as rasterize};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.3
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a}from"./chunk-FQFF5KMG.js";import"./chunk-43NWAKSV.js";import"./chunk-UI252PBJ.js";export{a as rasterize};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a as m}from"../chunks/chunk-2FBS3OGP.js";import{a as o}from"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";async function b(c,a){if(a.dpr=1,a.format==="svg"){let l=await m(c,{...a,type:"svg"}),r=URL.createObjectURL(l),t=document.createElement("a");t.href=r,t.download=a.filename,t.click(),URL.revokeObjectURL(r);return}let n=await o(c,a),e=document.createElement("a");e.href=n.toDataURL(`image/${a.format}`,a.quality),e.download=a.filename,e.click()}export{b as download};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a}from"../chunks/chunk-2FBS3OGP.js";import"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";export{a as toBlob};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a}from"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";export{a as toCanvas};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a}from"../chunks/chunk-GU6SHZKJ.js";import"../chunks/chunk-JUQT3OWD.js";import"../chunks/chunk-MI3WCG7V.js";import"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";export{a as toImg,a as toSvg};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a as f}from"../chunks/chunk-XUQSCYHL.js";import"../chunks/chunk-TWGUMDQG.js";import"../chunks/chunk-R6NINER4.js";import{a as r}from"../chunks/chunk-JUQT3OWD.js";import"../chunks/chunk-MI3WCG7V.js";import"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";async function e(t,n={}){let o={backgroundColor:"#ffffff",...n},a=typeof t=="string"?t:await f(t,o);return r(a,{...o,format:"jpeg"})}export{e as toJpg};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a as r}from"../chunks/chunk-XUQSCYHL.js";import"../chunks/chunk-TWGUMDQG.js";import"../chunks/chunk-R6NINER4.js";import{a as n}from"../chunks/chunk-JUQT3OWD.js";import"../chunks/chunk-MI3WCG7V.js";import"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";async function m(t,o={}){let a=typeof t=="string"?t:await r(t,o);return n(a,{...o,format:"png"})}export{m as toPng};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a as o}from"../chunks/chunk-GU6SHZKJ.js";import"../chunks/chunk-JUQT3OWD.js";import"../chunks/chunk-MI3WCG7V.js";import"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";export{o as toSvg};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a as r}from"../chunks/chunk-XUQSCYHL.js";import"../chunks/chunk-TWGUMDQG.js";import"../chunks/chunk-R6NINER4.js";import{a}from"../chunks/chunk-JUQT3OWD.js";import"../chunks/chunk-MI3WCG7V.js";import"../chunks/chunk-5EIHY65Z.js";import"../chunks/chunk-ZHRUQIHZ.js";async function p(t,o={}){let e=typeof t=="string"?t:await r(t,o);return a(e,{...o,format:"webp"})}export{p as toWebp};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a,b,c,d,e,f,g,h,i}from"./chunks/chunk-R6NINER4.js";export{h as attachSessionPlugins,f as clearPlugins,i as getGlobalPlugins,g as mergePlugins,a as normalizePlugin,e as pluginsList,b as registerPlugins,d as runAll,c as runHook};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{e as S,f as A,g as w,h as C,i as b}from"./chunks/chunk-TWGUMDQG.js";import{a as c,b as y,f as d,g as h,j as g,o as p}from"./chunks/chunk-MI3WCG7V.js";import{b as o}from"./chunks/chunk-ZHRUQIHZ.js";async function I(e=document,t={}){let{embedFonts:k=!0,useProxy:i=""}=t,F=t.cache??t.cacheOpt??"full";y(F);try{await document.fonts?.ready}catch{}try{g()}catch{}c.session=c.session||{},c.session.styleCache||(c.session.styleCache=new WeakMap),c.image=c.image||new Map,c.background=c.background||new Map;try{await b(e,void 0,c.session.styleCache,{useProxy:i})}catch{}let n=[],m=[];try{if(e&&e.nodeType===1){let s=e.querySelectorAll?Array.from(e.querySelectorAll("*")):[];m=[e,...s],n=[],e.tagName==="IMG"&&e.getAttribute("src")&&n.push(e),n.push(...Array.from(e.querySelectorAll?.("img[src]")||[]))}else e?.querySelectorAll&&(n=Array.from(e.querySelectorAll("img[src]")),m=Array.from(e.querySelectorAll("*")))}catch{}let f=[];for(let s of n){let a=s?.currentSrc||s?.src;if(a&&!c.image.has(a)){let l=Promise.resolve().then(async()=>{let r=await d(a,{as:"dataURL",useProxy:i});r?.ok&&typeof r.data=="string"&&c.image.set(a,r.data)}).catch(()=>{});f.push(l)}}for(let s of m){let a="";try{a=s?.style?.backgroundImage||"",(!a||a==="none")&&(a=p(s).backgroundImage)}catch{}if(a&&a!=="none"){let l=a.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let r of l){let u=Promise.resolve().then(()=>h(r,{...t,useProxy:i})).catch(()=>{});f.push(u)}}}if(k)try{let s=A(e),a=w(e);if(typeof o=="function"?o():!!o){let r=new Set(Array.from(s).map(u=>String(u).split("__")[0]).filter(Boolean));await C(r,3)}await S({required:s,usedCodepoints:a,exclude:t.excludeFonts,localFonts:t.localFonts,useProxy:t.useProxy??i})}catch{}await Promise.allSettled(f)}export{I as preCache};
@@ -0,0 +1,7 @@
1
+ /*
2
+ * SnapDOM
3
+ * v2.0.0-dev.4
4
+ * Author: Juan Martin Muda
5
+ * License: MIT
6
+ */
7
+ import{a as h}from"./chunks/chunk-XUQSCYHL.js";import{a as C}from"./chunks/chunk-TWGUMDQG.js";import{b as P,c as d,d as S,h as I}from"./chunks/chunk-R6NINER4.js";import"./chunks/chunk-MI3WCG7V.js";import{b as E}from"./chunks/chunk-ZHRUQIHZ.js";function R(e){if(typeof e=="string"){let r=e.toLowerCase().trim();if(r==="disabled"||r==="full"||r==="auto"||r==="soft")return r}return"soft"}function A(e={}){let r=e.format??"png";r==="jpg"&&(r="jpeg");let n=R(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:r,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(r)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1}}function z(...e){return P(...e),c}var c=Object.assign(O,{plugins:z}),M=Symbol("snapdom.internal"),f=Symbol("snapdom.internal.silent"),x=!1;async function O(e,r){if(!e)throw new Error("Element cannot be null or undefined");let n=A(r);if(I(n,r&&r.plugins),E()&&(n.embedFonts===!0||B(e)))for(let o=0;o<3;o++)try{await _(e,r),x=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&C(n.iconFonts),n.snap||(n.snap={toPng:(o,l)=>c.toPng(o,l),toSvg:(o,l)=>c.toSvg(o,l)}),c.capture(e,n,M)}c.capture=async(e,r,n)=>{if(n!==M)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await h(e,r),l={img:async(t,a)=>{let{toImg:s}=await import("./exporters/toImg.js");return s(o,{...t,...a||{}})},svg:async(t,a)=>{let{toSvg:s}=await import("./exporters/toImg.js");return s(o,{...t,...a||{}})},canvas:async(t,a)=>{let{toCanvas:s}=await import("./exporters/toCanvas.js");return s(o,{...t,...a||{}})},blob:async(t,a)=>{let{toBlob:s}=await import("./exporters/toBlob.js");return s(o,{...t,...a||{}})},png:async(t,a)=>{let{rasterize:s}=await import("./chunks/rasterize-NVVIIRN2.js");return s(o,{...t,...a||{},format:"png"})},jpeg:async(t,a)=>{let{rasterize:s}=await import("./chunks/rasterize-NVVIIRN2.js");return s(o,{...t,...a||{},format:"jpeg"})},webp:async(t,a)=>{let{rasterize:s}=await import("./chunks/rasterize-NVVIIRN2.js");return s(o,{...t,...a||{},format:"webp"})},download:async(t,a)=>{let{download:s}=await import("./exporters/download.js");return s(o,{...t,...a||{}})}},g={...r,export:{url:o},exports:{svg:async t=>{let{toSvg:a}=await import("./exporters/toImg.js");return a(o,{...r,...t||{},[f]:!0})},canvas:async t=>{let{toCanvas:a}=await import("./exporters/toCanvas.js");return a(o,{...r,...t||{},[f]:!0})},png:async t=>{let{rasterize:a}=await import("./chunks/rasterize-NVVIIRN2.js");return a(o,{...r,...t||{},format:"png",[f]:!0})},jpeg:async t=>{let{rasterize:a}=await import("./chunks/rasterize-NVVIIRN2.js");return a(o,{...r,...t||{},format:"jpeg",[f]:!0})},jpg:async t=>{let{rasterize:a}=await import("./chunks/rasterize-NVVIIRN2.js");return a(o,{...r,...t||{},format:"jpeg",[f]:!0})},webp:async t=>{let{rasterize:a}=await import("./chunks/rasterize-NVVIIRN2.js");return a(o,{...r,...t||{},format:"webp",[f]:!0})},blob:async t=>{let{toBlob:a}=await import("./exporters/toBlob.js");return a(o,{...r,...t||{},[f]:!0})},img:async t=>{let{toImg:a}=await import("./exporters/toImg.js");return a(o,{...r,...t||{},[f]:!0})}}},m=await S("defineExports",g),N=Object.assign({},...m.filter(t=>t&&typeof t=="object")),p={...l,...N};p.jpeg&&!p.jpg&&(p.jpg=(t,a)=>p.jpeg(t,a));function T(t,a){let s={...r,...a||{}};return(t==="jpeg"||t==="jpg")&&(s.backgroundColor==null||s.backgroundColor==="transparent")&&(s.backgroundColor="#ffffff"),s}let v=!1,k=Promise.resolve();async function u(t,a){let s=async()=>{let y=p[t];if(!y)throw new Error(`[snapdom] Unknown export type: ${t}`);let F=T(t,a),b={...r,export:{type:t,options:F,url:o}};await d("beforeExport",b);let j=await y(b,F);return await d("afterExport",b,j),v||(v=!0,await d("afterSnap",r)),j};return k=k.then(s)}let w={url:o,toRaw:()=>o,to:(t,a)=>u(t,a),toImg:t=>u("img",t),toSvg:t=>u("svg",t),toCanvas:t=>u("canvas",t),toBlob:t=>u("blob",t),toPng:t=>u("png",t),toJpg:t=>u("jpg",t),toWebp:t=>u("webp",t),download:t=>u("download",t)};for(let t of Object.keys(p)){let a="to"+t.charAt(0).toUpperCase()+t.slice(1);w[a]||(w[a]=s=>u(t,s))}return w};c.toRaw=(e,r)=>c(e,r).then(n=>n.toRaw());c.toImg=(e,r)=>c(e,r).then(n=>n.toImg());c.toSvg=(e,r)=>c(e,r).then(n=>n.toSvg());c.toCanvas=(e,r)=>c(e,r).then(n=>n.toCanvas());c.toBlob=(e,r)=>c(e,r).then(n=>n.toBlob());c.toPng=(e,r)=>c(e,{...r,format:"png"}).then(n=>n.toPng());c.toJpg=(e,r)=>c(e,{...r,format:"jpeg"}).then(n=>n.toJpg());c.toWebp=(e,r)=>c(e,{...r,format:"webp"}).then(n=>n.toWebp());c.download=(e,r)=>c(e,r).then(n=>n.download());async function _(e,r){if(x)return;let n={...r,fast:!0,embedFonts:!0,scale:.2},o;try{o=await h(e,n)}catch{}await new Promise(l=>requestAnimationFrame(()=>requestAnimationFrame(l))),o&&await new Promise(l=>{let i=new Image;try{i.decoding="sync",i.loading="eager"}catch{}i.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",i.src=o,document.body.appendChild(i),(async()=>{try{typeof i.decode=="function"&&await i.decode()}catch{}let g=performance.now();for(;!(i.complete&&i.naturalWidth>0)&&performance.now()-g<900;)await new Promise(m=>setTimeout(m,50));await new Promise(m=>requestAnimationFrame(m));try{i.remove()}catch{}l()})()}),e.querySelectorAll("canvas").forEach(l=>{try{let i=l.getContext("2d",{willReadFrequently:!0});i&&i.getImageData(0,0,1,1)}catch{}}),x=!0}function B(e){let r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;r.nextNode();){let n=r.currentNode,o=getComputedStyle(n),l=o.backgroundImage&&o.backgroundImage!=="none",i=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(l||i||n.tagName==="CANVAS")return!0}return!1}var H=c;export{H as default,z as plugins,c as snapdom};