Repository navigation
feat(Dom2Image): update SnapDOM to v3.7.6 - #1309
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reviewer's GuideConfigurationBump the Dom2Image package version to 11.0.1 to record the SnapDOM update.
Lock files and vendored codeReview the bundled SnapDOM v3.7.6 module, which supplies the updated dependency implementation.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 4 security issues
Security issues:
- User controlled data in methods like
innerHTML,outerHTMLordocument.writeis an anti-pattern that can lead to XSS vulnerabilities (link) - User controlled data in a
d.innerHTMLis an anti-pattern that can lead to XSS vulnerabilities (link) - User controlled data in methods like
innerHTML,outerHTMLordocument.writeis an anti-pattern that can lead to XSS vulnerabilities (link) - User controlled data in a
n.innerHTMLis an anti-pattern that can lead to XSS vulnerabilities (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs" line_range="16" />
<code_context>
`?"":o})}function gl(t){if(!t)return"";let e=[],n=/"((?:\\[\s\S]|[^"\\])*)"|'((?:\\[\s\S]|[^'\\])*)'/g,o=0,r;for(;r=n.exec(t);){let a=t.slice(o,r.index).trim();a&&e.push(a),e.push(Sp(r[1]!==void 0?r[1]:r[2])),o=n.lastIndex}let i=t.slice(o).trim();return i&&e.push(i),e.join("")}function wl(t,e,n){let o=t.parentElement,r=o&&n?n.get(o):null;return r?{get(i,a){let s=e.get(i,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(i,a){let s=e.getStack(i,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let u=s.slice();return u[u.length-1]=Math.max(u[u.length-1],l),u}return s}}:e}function xl(t,e,n){let o=new Map,r=(u,c)=>On(u,c).map(([f,p])=>({name:f,num:p})),i=r(e?.counterReset,0),a=r(e?.counterSet,0),s=r(e?.counterIncrement,1);function l(u){if(o.has(u))return o.get(u).slice();let c=n.getStack(t,u);c=c.length?c.slice():[];let f=i.find(m=>m.name===u);if(f){let m=Number.isFinite(f.num)?f.num:0;c=c.length?[...c,m]:[m]}let p=a.find(m=>m.name===u);if(p){let m=Number.isFinite(p.num)?p.num:0;c.length===0&&(c=[0]),c[c.length-1]=m}let y=s.find(m=>m.name===u);if(y){let m=Number.isFinite(y.num)?y.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return o.set(u,c.slice()),c}return{get(u,c){let f=l(c);return f.length?f[f.length-1]:0},getStack(u,c){return l(c)},__incs:s}}var vp=["color","-webkit-text-fill-color","font-family","font-size","font-weight","font-style","letter-spacing","line-height"],Cp=["color","-webkit-text-fill-color","font-family","font-size","font-weight","font-style","font-variant","letter-spacing","word-spacing","text-transform","text-decoration-line","text-decoration-color","text-decoration-style","line-height","background-color","vertical-align"];function yl(t,e,n,o,r,i){try{if(o===null){if(t.getRootNode()!==(t.ownerDocument||document))return;let f=D(t).display||"";if(r==="::marker"?!f.includes("list-item"):!(f==="block"||f==="flow-root"||f==="list-item"||f==="inline-block"||f==="table-cell"||f==="table-caption"))return}else if(!t.matches(o))return;if(r==="::marker"&&!(D(t).display||"").includes("list-item"))return;let a=D(t,r),s=D(t);if(!a)return;let l="";for(let f of i){let p=a.getPropertyValue(f);p&&p!==s.getPropertyValue(f)&&!(f==="background-color"&&p==="rgba(0, 0, 0, 0)")&&!(f==="vertical-align"&&p==="baseline")&&(l+=`${f}:${p};`)}if(r==="::marker"){let f=a.getPropertyValue("content");f&&f!=="normal"&&f!=="none"&&(l+=`content:${f};`)}if(!l)return;let c=`data-sd-p${n.__pseudoRuleSeq=(n.__pseudoRuleSeq||0)+1}`;e.setAttribute(c,""),n.__pseudoCSS=(n.__pseudoCSS||"")+`[${c}]${r}{${l}}`}catch{}}function kp(t,e){if(!/\b(?:no-)?(?:open|close)-quote\b/.test(t))return t;let n="\u201C",o="\u201D";try{let r=D(e).quotes;if(r==="none")n="",o="";else if(r&&r!=="auto"){let i=r.match(/"[^"]*"|'[^']*'/g);i&&i.length>=2&&(n=i[0].slice(1,-1),o=i[1].slice(1,-1))}}catch{}return n=n.replace(/"/g,""),o=o.replace(/"/g,""),t.replace(/"[^"]*"|\b(no-open-quote|no-close-quote|open-quote|close-quote)\b/g,(r,i)=>i?i==="open-quote"?`"${n}"`:i==="close-quote"?`"${o}"`:'""':r)}function Mp(t,e,n,o){let r=e.content;if(!r||r==="none"||r==="normal")return{text:"",incs:[]};r=xp(r),r=kp(r,t);let i=e.counterIncrement;if(!ti(r)&&(!i||i==="none"))return{text:gl(r),incs:[]};let a=wl(t,n,o),s=xl(t,e,a),l=ti(r)?dl(r,t,s):r;return{text:gl(l),incs:s.__incs||[],derived:s}}function Ap(t,e){if(e.__shadowPseudo)return!1;let n=ye(t),o=[];for(let i of["before","after","firstLetter","marker","firstLine"]){let a=n[i];if(a===null)return!1;a&&o.push(a)}if(!o.length)return!0;let r=o.join(",");try{return!t.matches(r)&&t.querySelector(r)===null}catch{return!1}}async function on(t,e,n,o,r=!1){if(t?.nodeType!==1||e?.nodeType!==1||(n.slicer?.due()&&await n.slicer.pause(),t.tagName==="TEXTAREA"))return;let i=t.ownerDocument||document;if(!r&&!bp(i,n)&&!n.__shadowPseudo||!r&&Ap(t,n))return;n.__siblingCounters||(n.__siblingCounters=new WeakMap),n.__counterCtx||(n.__counterCtx=wp(t.ownerDocument||document,n));let a=n.__counterCtx,s=ye(t);s.marker!==""&&yl(t,e,n,s.marker,"::marker",vp),s.firstLine!==""&&yl(t,e,n,s.firstLine,"::first-line",Cp);for(let l of["::before","::after","::first-letter"]){let u=s[l==="::before"?"before":l==="::after"?"after":"firstLetter"];if(u!==null){if(u==="")continue;try{if(!t.matches(u))continue}catch{}}let c=null;if(l==="::first-letter"){for(let f=e.firstChild;f&&!c;f=f.nextSibling)f.nodeType===3&&f.data.trim()&&(c=f);if(!c)continue}try{let f=D(t,l);if(!f)continue;let p=f.content,y=f.display;if(p==="none"&&f.backgroundImage==="none"&&(f.backgroundColor==="transparent"||f.backgroundColor==="rgba(0, 0, 0, 0)")&&!ml(f)&&(!f.transform||f.transform==="none")&&y==="inline")continue;if(y==="none"||l!=="::first-letter"&&(p==="none"||p==="normal")){l==="::before"&&e.setAttribute("data-snapdom-has-before","1"),l==="::after"&&e.setAttribute("data-snapdom-has-after","1");continue}if(l==="::first-letter"){let X=D(t),V=(X?.display||"").toLowerCase();if(V.includes("flex")||V.includes("grid"))continue;let J=Yt=>f[Yt]!==X[Yt]&&(parseFloat(f[Yt])||0)!==0;if(!(f.color!==X.color||f.fontSize!==X.fontSize||f.fontWeight!==X.fontWeight||f.fontFamily!==X.fontFamily||f.fontStyle!==X.fontStyle||f.textTransform!==X.textTransform||f.float!==X.float&&f.float!=="none"||J("paddingTop")||J("paddingRight")||J("paddingBottom")||J("paddingLeft")||J("marginTop")||J("marginRight")||J("marginBottom")||J("marginLeft")))continue;let ht=c.textContent,ce=/^\s*/.exec(ht)[0],Ce=ht.slice(ce.length),ne=Ce.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],gn=Ce.slice(ne?.length||0);if(!ne||/[\uD800-\uDFFF]/.test(ne))continue;let oe=document.createElement("span");oe.textContent=ne,oe.setAttribute("data-snapdom-pseudo","::first-letter");let _t=Ue(f,lo(t,n)),Jn=ze(_t,"span");n.styleMap.set(oe,Jn);let Zn=document.createTextNode(gn);e.replaceChild(Zn,c),e.insertBefore(oe,Zn),ce&&e.insertBefore(document.createTextNode(ce),oe);continue}let d=p??"",h=d===""||d==="none"||d==="normal",{text:b,incs:w,derived:x}=Mp(t,f,a,n.__siblingCounters),v=f.backgroundImage,S=f.backgroundColor,k=f.fontFamily,A=parseInt(f.fontSize)||32,R=parseInt(f.fontWeight)||!1,E=f.fontStyle||"normal",C=f.color||"#000",_=f.transform,T=Gt(k,o?.__iconMatchers),P=!h&&b!=="",F=v&&v!=="none",L=S&&S!=="transparent"&&S!=="rgba(0, 0, 0, 0)",M=ml(f),I=_&&_!=="none",$=d!=="none"&&d!=="normal",N=/^inline-/.test(y||""),O=$&&((parseFloat(f.width)||0)>0||(parseFloat(f.height)||0)>0||N),B=f.boxShadow,z=f.outlineStyle,G=$&&B&&B!=="none",j=$&&z&&z!=="none"&&(parseFloat(f.outlineWidth)||0)>0;if(!(P||F||L||M||I||O||G||j)){if(w&&w.length&&t.parentElement){let X=n.__siblingCounters.get(t.parentElement)||new Map;for(let{name:V}of w){if(!V)continue;let J=wl(t,a,n.__siblingCounters),ht=xl(t,D(t,l),J).get(t,V);X.set(V,ht)}n.__siblingCounters.set(t.parentElement,X)}continue}let ot=b.startsWith("url(")||/^-?(?:webkit-)?image-set\(/i.test(b),it=y==="inline"&&f.cssFloat==="none"&&f.position!=="absolute"&&f.position!=="fixed",St=!1;if(P&&!T&&b.length>1&&!ot&&it){let X=D(t),V=parseFloat(X.fontSize)||16,J=parseFloat(X.lineHeight);Number.isFinite(J)||(J=V*1.5),t.getBoundingClientRect().height<J*1.6&&(e.style.whiteSpace="nowrap",St=!0)}let q=document.createElement("span");q.setAttribute("data-snapdom-pseudo",l),q.style.pointerEvents="none",St?q.style.whiteSpace="nowrap":e.style.getPropertyValue(Ge)==="nowrap"&&q.style.setProperty(Ge,"nowrap");let gt=oa(t,l,f,n,o),At=(D(t).display||"").toLowerCase(),le=At.includes("flex")||At.includes("grid");if(le){let X=gt["min-width"];(!X||X==="auto"||X==="0px")&&(gt["min-width"]="0px")}let ee=P;ee&&!it&&parseFloat(f.height)>=1.5*(parseFloat(f.lineHeight)||(parseFloat(f.fontSize)||16)*1.2)&&(ee=!1,q.style.whiteSpace=f.whiteSpace);let Xt=ze(gt,"span",ee,le);if(n.styleMap.set(q,Xt),T&&b&&[...b].length===1){let{dataUrl:X,height:V,advance:J,descent:It}=await el(b,k,R,A,C,E),ht=document.createElement("img");ht.src=X,ht.style=`height:${A}px;width:${J/V*A}px;object-fit:contain;vertical-align:${-It}px;`,q.appendChild(ht)}else if(b&&ot){let X=bn(b,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??ke(b);if(X?.trim())try{let V=await ft(de(X),{as:"dataURL",useProxy:o.useProxy,debug:o.debug});if(V?.ok&&typeof V.data=="string"){let J=document.createElement("img");J.src=V.data,J.style=`width:${A}px;height:auto;object-fit:contain;`,q.appendChild(J)}}catch(V){W(o,`Couldn't draw the ${l} icon of`,[t,V])}}else!T&&P&&(q.textContent=b);q.style.backgroundImage="none","maskImage"in q.style&&(q.style.maskImage="none"),"webkitMaskImage"in q.style&&(q.style.webkitMaskImage="none");try{q.style.backgroundClip=f.backgroundClip,F&&(q.style.backgroundRepeat=f.backgroundRepeat,q.style.backgroundSize=f.backgroundSize,f.backgroundPositionX&&f.backgroundPositionY?(q.style.backgroundPositionX=f.backgroundPositionX,q.style.backgroundPositionY=f.backgroundPositionY):q.style.backgroundPosition=f.backgroundPosition,q.style.backgroundOrigin=f.backgroundOrigin,q.style.backgroundAttachment=f.backgroundAttachment,q.style.backgroundBlendMode=f.backgroundBlendMode)}catch{}if(F)try{let X=he(v),V=await Promise.all(X.map(J=>De(J,o)));q.style.backgroundImage=V.join(", ")}catch(X){W(o,`Couldn't load the ${l} background image.`,X)}L&&(q.style.backgroundColor=S);let Nt=f.maskImage||f.webkitMaskImage;if(Nt&&Nt!=="none")try{let V=(await Promise.all(he(Nt).map(J=>De(J,o)))).join(", ");q.style.maskImage=V,q.style.webkitMaskImage=V;for(let J of["maskSize","maskRepeat","maskPosition","maskMode","maskComposite","maskOrigin","maskClip"])f[J]&&(q.style[J]=f[J])}catch(X){W(o,`Couldn't load the ${l} mask image.`,X)}let pt=q.childNodes.length>0||q.textContent?.trim()!==""||F||L||M||I||O||G||j;if(w&&w.length&&t.parentElement){let X=n.__siblingCounters.get(t.parentElement)||new Map;for(let{name:V}of w){if(!V)continue;let J=x.get(t,V);X.set(V,J)}n.__siblingCounters.set(t.parentElement,X)}if(!pt)continue;l==="::before"?(e.setAttribute("data-snapdom-has-before","1"),e.insertBefore(q,e.firstChild)):(e.setAttribute("data-snapdom-has-after","1"),e.appendChild(q))}catch(f){rt(o.__session,"pseudo-failed",`${l} could not be copied`,t),W(o,`Couldn't copy the ${l} of`,[t,f])}}if(n.nodeMap)for(let l=e.firstElementChild;l;l=l.nextElementSibling){let u=n.nodeMap.get(l);u?.nodeType===1&&!l.hasAttribute("data-snapdom-pseudo")&&await on(u,l,n,o,!0)}else{let l=Array.from(e.children).filter(c=>!c.hasAttribute("data-snapdom-pseudo")),u=Array.from(t.children);for(let c=0;c<Math.min(u.length,l.length);c++)await on(u[c],l[c],n,o,!0)}}var Sl="http://www.w3.org/2000/svg",_p=["background-color","background-image","background-size","background-position","background-repeat","background-origin"];function vl(t){for(let[e,n]of t)try{Ep(e,n)}catch{}}function Ep(t,e){let n=t.ownerDocument.defaultView,o=n.getComputedStyle(t),r=[...t.getClientRects()];if(!r.length)return;let i=r[0].left+parseFloat(o.borderLeftWidth),a=r[0].top+parseFloat(o.borderTopWidth),s;if(o.display==="inline"){let h=r.reduce((w,x)=>w+x.width,0),b=0;s=r.map(w=>{let x={x:w.left-i-b,y:w.top-a,w:h,h:w.height,top:w.top,bottom:w.bottom};return b+=w.width,x})}else{let h=t.clientWidth||r[0].width,b=t.clientHeight||r[0].height;s=[{x:0,y:0,w:h,h:b,top:-1/0,bottom:1/0}]}let l=e.ownerDocument,u=`sd-bct-${Math.random().toString(36).slice(2,9)}`,c=_p.map(h=>`${h}:${o.getPropertyValue(h)}`).join(";").replace(/"/g,"'"),f="";s.forEach((h,b)=>{let w=`<svg xmlns="${Sl}" width="${h.w}" height="${h.h}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="width:${h.w}px;height:${h.h}px;${c}"></div></foreignObject></svg>`;f+=`<pattern id="${u}-${b}" patternUnits="userSpaceOnUse" x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}"><image width="${h.w}" height="${h.h}" preserveAspectRatio="none" href="data:image/svg+xml;charset=utf-8,${encodeURIComponent(w)}"/></pattern>`});let p="",y=l.createElement("canvas").getContext("2d"),m=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT),g=t.ownerDocument.createRange();for(let h=m.nextNode();h;h=m.nextNode()){let b=n.getComputedStyle(h.parentElement);y.font=b.font;let w=y.measureText("X").fontBoundingBoxAscent;if(!Number.isFinite(w))return;let x=b.font.replace(/"/g,"'"),v=s.map(()=>({xs:[],ys:[],chars:""})),S=h.data;for(let k=0;k<S.length;k++){let A=S.charCodeAt(k)>=55296&&S.charCodeAt(k)<=56319?2:1;g.setStart(h,k),g.setEnd(h,k+A);let R=g.getClientRects()[0],E=S.slice(k,k+A);if(k+=A-1,!R||!E.trim())continue;let C=(R.top+R.bottom)/2,_=s.findIndex(T=>C>=T.top&&C<=T.bottom);_<0&&(_=0),v[_].xs.push(+(R.left-i).toFixed(2)),v[_].ys.push(+(R.top-a+w).toFixed(2)),v[_].chars+=E}v.forEach((k,A)=>{if(!k.chars)return;let R=k.chars.replace(/&/g,"&").replace(/</g,"<");p+=`<text x="${k.xs.join(" ")}" y="${k.ys.join(" ")}" fill="url(#${u}-${A})" style="font:${x};font-kerning:none;letter-spacing:0;white-space:pre">${R}</text>`})}if(!p)return;let d=l.createElementNS(Sl,"svg");d.setAttribute("style","position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;pointer-events:none"),d.innerHTML=`<defs>${f}</defs>${p}`,o.position==="static"&&e.style.setProperty("position","relative","important"),e.style.setProperty("color","transparent","important"),e.style.setProperty("-webkit-text-fill-color","transparent","important"),e.insertBefore(d,e.firstChild)}Ct();function Cl(t,e,n){if(!t||t?.nodeType!==1)return;let o=t.ownerDocument||document,r=e||o,i=Dt(t)&&t.localName==="svg"?[t]:Array.from(t.querySelectorAll("svg")),a=/url\(\s*["']?\s*#([^)"']+)/g,s=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],l=S=>window.CSS&&CSS.escape?CSS.escape(S):S.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),u="http://www.w3.org/1999/xlink",c=S=>{if(!S||!S.getAttribute)return null;let k=S.getAttribute("href")||S.getAttribute("xlink:href")||(typeof S.getAttributeNS=="function"?S.getAttributeNS(u,"href"):null);if(k)return k;let A=S.attributes;if(!A)return null;for(let R=0;R<A.length;R++){let E=A[R];if(!E||!E.name)continue;if(E.name==="href")return E.value;let C=E.name.indexOf(":");if(C!==-1&&E.name.slice(C+1)==="href")return E.value}return null},f=new Set(Array.from(t.querySelectorAll("[id]")).map(S=>S.id)),p=new Set,y=!1,m=(S,k=null)=>{if(!S)return;a.lastIndex=0;let A;for(;A=a.exec(S);){y=!0;let R=(A[1]||"").trim();R&&(f.has(R)||(p.add(R),k&&!k.has(R)&&k.add(R)))}},g=S=>{let k=S.querySelectorAll("use");for(let E of k){let C=c(E);if(!C||!C.startsWith("#"))continue;y=!0;let _=C.slice(1).trim();_&&!f.has(_)&&p.add(_)}let A='*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]';m(S.getAttribute("style")||"");for(let E of s)m(S.getAttribute(E));let R=S.querySelectorAll(A);for(let E of R){m(E.getAttribute("style")||"");for(let C of s)m(E.getAttribute(C))}},d=S=>{if(!S||S.nodeType!==1||!S.querySelectorAll)return;let k="filter[id],clipPath[id],mask[id],linearGradient[id],radialGradient[id],pattern[id]",A=!1;try{A=!!(r.querySelector&&r.querySelector(k))}catch{return}if(!A)return;let R=["filter","clipPath","mask","maskImage","webkitMaskImage"],E=C=>{if(Dt(C))return;let _;try{_=getComputedStyle(C)}catch{return}for(let T of R){let P=_[T];P&&P.includes("url(")&&m(P)}};E(S);for(let C of S.querySelectorAll("*"))E(C)};for(let S of i)g(S);if(d(n),!y)return;let h=t.querySelector("svg.inline-defs-container");h||(h=o.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(h,t.firstChild||null));let b=h.querySelector("defs")||null,w=S=>{if(!S||f.has(S))return null;let k=l(S),A=R=>{let E=r.querySelector(R);return E&&!t.contains(E)?E:null};return A(`svg defs > *#${k}`)||A(`svg > symbol#${k}`)||A(`*#${k}`)};if(!p.size)return;let x=new Set(p),v=new Set;for(;x.size;){let S=x.values().next().value;if(x.delete(S),!S||f.has(S)||v.has(S))continue;let k=w(S);if(!k){v.add(S);continue}b||(b=o.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(b));let A=k.cloneNode(!0);A.id||A.setAttribute("id",S),b.appendChild(A),v.add(S),f.add(S);let R=[A,...A.querySelectorAll("*")];for(let E of R){let C=c(E);if(C&&C.startsWith("#")){let T=C.slice(1).trim();T&&!f.has(T)&&!v.has(T)&&x.add(T)}let _=E.getAttribute?.("style")||"";_&&m(_,x);for(let T of s){let P=E.getAttribute?.(T);P&&m(P,x)}}}}Ct();var ni=new WeakMap,oi=new WeakMap;function Lo(t,e,n){let o=n.get(t),r=t.style;if(!o){let a=r.cssText,s=t.hasAttribute("style");o={users:0,saved:e.map(([u,c])=>{let f={property:u,value:r.getPropertyValue(u),priority:r.getPropertyPriority(u)};return r.setProperty(u,c,"important"),f.forcedValue=r.getPropertyValue(u),f}),originalCSS:a,forcedCSS:r.cssText,hadStyle:s},n.set(t,o)}o.users++;let i=!1;return()=>{if(!i&&(i=!0,!--o.users)){if(n.delete(t),r.cssText===o.forcedCSS)r.cssText=o.originalCSS;else for(let a of o.saved)r.getPropertyValue(a.property)!==a.forcedValue||r.getPropertyPriority(a.property)!=="important"||(a.value?r.setProperty(a.property,a.value,a.priority):r.removeProperty(a.property));!o.hadStyle&&!r.length&&(t.getAttribute("style"),t.removeAttribute("style"))}}}function kl(t){if(ni.has(t))return Lo(t,[],ni);let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=n!=="none"&&parseFloat(o)>0,i=parseFloat(e.borderTopWidth)===0&&parseFloat(e.borderRightWidth)===0&&parseFloat(e.borderBottomWidth)===0&&parseFloat(e.borderLeftWidth)===0;if(r&&i){let a=[];for(let s of["top","right","bottom","left"])a.push([`border-${s}-width`,o],[`border-${s}-style`,"solid"],[`border-${s}-color`,"transparent"]);return Lo(t,a,ni)}return()=>{}}function Io(t,e=null){let n=[],o=r=>{if(!Wt(r))return;if(oi.has(r)){n.push(Lo(r,[],oi));return}let i=getComputedStyle(r);(i.contentVisibility||i.getPropertyValue("content-visibility")||"")==="auto"&&n.push(Lo(r,[["content-visibility","visible"]],oi))};try{if(e){let i=a=>{let s;try{s=a.getBoundingClientRect()}catch{return}if(!((s.width>0||s.height>0)&&(s.right<e.left-200||s.left>e.right+200||s.bottom<e.top-200||s.top>e.bottom+200))){o(a);for(let l=a.firstElementChild;l;l=l.nextElementSibling)i(l)}};i(t)}else{for(let r of t.querySelectorAll("*"))o(r);o(t)}}catch{}return()=>{for(let r of n)try{r()}catch{}}}Ne();dt();var Bo=new Set,Jp=/^(?:IMG|VIDEO|CANVAS|IFRAME|EMBED|OBJECT|SVG|svg|INPUT|SELECT|TEXTAREA|BUTTON)$/,Zp="[data-sd-ph]::placeholder{color:var(--sd-ph)!important;opacity:var(--sd-ph-o)!important;-webkit-text-fill-color:var(--sd-ph)!important}";async function Ul(t,e={}){Vt(),uo(t.ownerDocument||document);let n=e.__session||{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map},o={styleMap:n.styleMap,styleCache:n.styleCache,nodeMap:n.nodeMap,options:e,slicer:e.__slicer||null},r=null,i=null,a=null;if(e.clip&&(i=Oo(t,e.clip),i&&(o.clip={rect:i,root:t})),e.captureSelection)try{o.selection=La(t)}catch(d){W(o,"Couldn't read the text selection.",d)}let s,l="",u="";if(Bo.size){let d=(h,b)=>{for(let w=b;w;w=w.assignedSlot||w.parentElement||Ht(w))if(w===h)return!0;return!1};for(;;){let h=[...Bo].filter(({root:b})=>d(b,t)||d(t,b)).map(({promise:b})=>b.catch(()=>{}));if(!h.length)break;await Promise.all(h)}}if(!o.clip&&t.isConnected&&t.ownerDocument?.visibilityState!=="hidden")try{let d=t.getBoundingClientRect(),h=t.ownerDocument?.defaultView||window,b=d.right<=0||d.bottom<=0||d.left>=h.innerWidth||d.top>=h.innerHeight,w=[];if(b&&(()=>{let v=[];t.shadowRoot&&v.push(t.shadowRoot);for(let S of t.querySelectorAll("*"))S.shadowRoot&&v.push(S.shadowRoot);for(;v.length;){let S=v.pop(),k=S.host?.localName==="calcite-icon";for(let A of S.querySelectorAll("*")){if(A.shadowRoot&&v.push(A.shadowRoot),!k||A.localName!=="svg")continue;let R=A.querySelectorAll("path");if(!R.length||[...R].some(C=>C.getAttribute("d")?.trim()))continue;let E=A.getBoundingClientRect();E.width&&E.height&&w.push(A)}}})(),w.length){let v=(async()=>{let k=t.style,A=t.hasAttribute("style"),R=new Map,E=(C,_)=>{R.has(C)||R.set(C,{value:k.getPropertyValue(C),priority:k.getPropertyPriority(C)}),k.setProperty(C,_,"important");let T=R.get(C);T.forcedValue=k.getPropertyValue(C),T.forcedPriority=k.getPropertyPriority(C)};try{E("left","0"),E("top","0"),E("right","auto"),E("bottom","auto"),E("margin-top","0"),E("margin-right","0"),E("margin-bottom","0"),E("margin-left","0"),E("transform","none"),E("translate","none"),E("opacity","0"),E("pointer-events","none");let C=t.getBoundingClientRect();if(C.right<=0||C.bottom<=0||C.left>=h.innerWidth||C.top>=h.innerHeight){let P=t.parentElement?.getBoundingClientRect(),F=P&&P.right>0&&P.left<h.innerWidth?Math.max(0,P.left):0,L=P&&P.bottom>0&&P.top<h.innerHeight?Math.max(0,P.top):0;E("position","fixed"),E("left",`${F}px`),E("top",`${L}px`)}await kt(100);let _=Date.now()+1500,T=()=>w.some(P=>{if([...P.querySelectorAll("path")].some(L=>L.getAttribute("d")?.trim()))return!1;let F=P.getBoundingClientRect();return F.width&&F.height&&F.right>0&&F.bottom>0&&F.left<h.innerWidth&&F.top<h.innerHeight});for(;Date.now()<_&&T();)await new Promise(P=>setTimeout(P,25));await kt(100)}finally{for(let[C,_]of R)k.getPropertyValue(C)!==_.forcedValue||k.getPropertyPriority(C)!==_.forcedPriority||(_.value?k.setProperty(C,_.value,_.priority):k.removeProperty(C));!A&&!k.length&&t.removeAttribute("style"),await kt(100)}})(),S={root:t,promise:v};Bo.add(S);try{await v}finally{Bo.delete(S)}}}catch{}let c=kl(t),f=Io(t,i);if(i){let d=t.getBoundingClientRect(),h=t.offsetWidth||d.width,b=t.offsetHeight||d.height,w=d.width&&Math.abs(h-d.width)>=1?h/d.width:1,x=d.height&&Math.abs(b-d.height)>=1?b/d.height:1;r={x:(i.left-d.left)*w,y:(i.top-d.top)*x,width:i.width*w,height:i.height*x}}try{s=await be(t,o,e),a=Xa(s,o,e)}catch(d){throw W(o,"Capture failed while copying the element.",d),d}finally{f(),c()}Pa(o.nodeMap,t.ownerDocument||document),o.slicer?.due()&&await o.slicer.pause();try{Cl(s,void 0,t)}catch(d){rt(n,"svg-defs-failed","external <use> references failed to inline",d),W(o,"Couldn't copy external SVG icons; some may be missing.",d)}try{await on(t,s,o,e)}catch(d){rt(n,"pseudo-failed","::before/::after pass failed",d),W(o,"Couldn't copy ::before/::after content; some decorations may be missing.",d)}o.bgClipText&&vl(o.bgClipText),await wo(s,o);for(let[d,h]of o.nodeMap.entries())if(h?.tagName==="STYLE"&&d?.tagName==="STYLE"&&!d.hasAttribute("data-sd")){let b=d.textContent||"";try{let w=h.sheet&&h.sheet.cssRules;w&&/@media/i.test(b)&&(b=Te(w))}catch{}/@(?:import|namespace)\b/i.test(b)||(b=`@layer{${b}}`),d.textContent=b}try{let d=[...s.querySelectorAll("style[data-sd]")].sort((h,b)=>h.getAttribute("data-sd")-b.getAttribute("data-sd"));for(let h of d)u+=h.textContent||"",h.remove()}catch(d){W(o,"Couldn't copy shadow DOM styles.",d)}o.slicer?.due()&&await o.slicer.pause();let p=vn(o.styleMap);l=Array.from(p.entries()).map(([d,h])=>`.${h}{${d}}`).join("");let m=u+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+(o.__usesPlaceholder?Zp:"")+(o.__pseudoCSS||"");l=m+l;for(let[d,h]of o.styleMap.entries())yi(d,h,p);try{Qp(t,s,o.nodeMap)}catch(d){W(o,"Couldn't bring an open dialog or popover into the capture.",d)}if((o.clip||t.scrollTop||t.scrollLeft)&&s?.nodeType===1)try{let d=o.clip&&r?{x:r.x,y:r.y}:{x:0,y:0};Ll(t,s,o.nodeMap,o.styleCache,d)}catch(d){W(o,"Couldn't keep fixed-position elements in place.",d)}for(let[d,h]of o.nodeMap.entries())o.clip&&h===t&&t===t.ownerDocument.scrollingElement||bi(d,h,o.nodeMap,o.styleCache);let g=t.ownerDocument;if((t===g.body||t===g.documentElement)&&g.documentElement.localName==="html"){let d=o.styleCache.get(g.documentElement)||D(g.documentElement);t===g.documentElement&&(s.style.overflow="visible");let h=t===g.body?s:s.querySelector("body");if(h&&d.overflowX==="visible"&&d.overflowY==="visible"&&d.contain==="none"&&!d.containerType?.includes("size")&&d.contentVisibility!=="auto"&&d.contentVisibility!=="hidden"){let b=o.styleCache.get(g.body)||D(g.body);b.contain==="none"&&!b.containerType?.includes("size")&&b.contentVisibility!=="auto"&&b.contentVisibility!=="hidden"&&b.display!=="none"&&(h.style.overflow="visible")}}if(t===o.nodeMap.get(s)){let d=o.styleCache.get(t)||D(t);o.styleCache.set(t,d);let h=yr(d.transform);if(s.style.margin="0",s.style.top="auto",s.style.left="auto",s.style.right="auto",s.style.bottom="auto",s.style.animation="none",s.style.transition="none",s.style.willChange="auto",s.style.float="none",s.style.clear="none",s.style.placeSelf="normal",s.style.transform=h||"",s.style.translate="none",(/^inline-/.test(d.display)||d.display==="inline"&&Jp.test(t.tagName))&&(s.style.verticalAlign="top"),zl(t,s,d),!s.hasAttribute("lang")){let b=t.closest?.("[lang]")?.getAttribute("lang")??t.ownerDocument?.documentElement?.getAttribute("lang");b&&s.setAttribute("lang",b)}}for(let[d,h]of o.nodeMap.entries())h.tagName==="PRE"&&(d.style.marginTop="0",d.style.marginBlockStart="0");return{clone:s,classCSS:l,classPrefixCSS:m,shadowCSS:!!u,styleCache:o.styleCache,nodeMap:o.nodeMap,reconcileRisk:o.reconcileRisk||0,clipWindow:r,standIns:a,universe:Je(t,o)}}function Qp(t,e,n){let o=[];for(let a of[":modal",":popover-open"])try{o.push(...t.querySelectorAll(a))}catch{}if(!o.length)return;let r=new Map;for(let[a,s]of n.entries())r.set(s,a);let i=214748e4;for(let a of o){let s=r.get(a);if(!(!s||s===e||s.parentNode==null)){try{let l=getComputedStyle(a,"::backdrop"),u=l.backgroundColor,c=l.backgroundImage;if(u&&u!=="rgba(0, 0, 0, 0)"&&u!=="transparent"||c&&c!=="none"){let p=document.createElement("div");p.setAttribute("data-sd-backdrop",""),p.style.cssText=`position:fixed;inset:0;z-index:${i};background-color:${u};`+(c&&c!=="none"&&c.includes("data:")?`background-image:${c};`:""),e.appendChild(p)}}catch{}i+=1,s.style.zIndex=String(i),e.appendChild(s),i+=1}}}function yi(t,e,n){if(t.tagName==="STYLE")return;let o=n.get(e);o&&t.classList.add(o);let r=t.style?.backgroundImage;r&&r!=="none"&&(t.style.backgroundImage=r)}var th=["grid-template-columns","grid-template-rows","grid-template-areas","grid-auto-columns","grid-auto-rows","grid-auto-flow","row-gap","column-gap","align-items","justify-items","align-content","justify-content","flex-direction","flex-wrap"];function bi(t,e,n,o){let r=e.scrollLeft,i=e.scrollTop;if(!(r||i)||t?.nodeType!==1||t.namespaceURI!=="http://www.w3.org/1999/xhtml")return;t.style.overflow="hidden",t.style.scrollbarWidth="none",t.style.msOverflowStyle="none";try{let c=t.querySelectorAll("*");for(let f of c){if(f.nodeType!==1||f.namespaceURI!=="http://www.w3.org/1999/xhtml")continue;let p=n?.get(f),y=p&&(o?.get(p)||D(p)),m=f.style.position||y?.position;if(m!=="fixed"&&m!=="absolute")continue;let g=y&&y.position!=="absolute"&&m==="absolute",d=null;if(p&&!g)for(let w=p.parentElement||Ht(p);w;w=w.parentElement||Ht(w)){let x=o?.get(w)||D(w);if(m==="absolute"&&x.position!=="static"||x.transform&&x.transform!=="none"||x.translate&&x.translate!=="none"||x.rotate&&x.rotate!=="none"||x.scale&&x.scale!=="none"||x.filter&&x.filter!=="none"||x.backdropFilter&&x.backdropFilter!=="none"||x.perspective&&x.perspective!=="none"||/transform|perspective|filter/.test(x.willChange||"")||/layout|paint|strict|content/.test(x.contain||"")){d=w;break}if(w===e)break}if(d){d===e&&(f.style.top=y.top,f.style.left=y.left,f.style.right=y.right,f.style.bottom=y.bottom);continue}let h=parseFloat(f.style.top||y?.top)||0,b=parseFloat(f.style.left||y?.left)||0;f.style.top=`${h+i}px`,f.style.left=`${b+r}px`,m==="fixed"&&(f.style.position="absolute")}}catch{}let s=document.createElement("div");s.style.all="unset",s.style.direction="inherit",s.style.transform=`translate(${-r}px, ${-i}px)`,s.style.willChange="transform";let l=(o?.get(e)||D(e)).display,u=l.includes("grid")?"grid":l.includes("flex")?"flex":"";if(u){t.style.display=l.startsWith("inline")?"inline-block":"block",s.style.display=u;for(let c of th)s.style.setProperty(c,"inherit")}else s.style.display="inline-block";for(s.style.width="100%";t.firstChild;)s.appendChild(t.firstChild);t.appendChild(s)}Ae();bt();Et();var Hl="http://www.w3.org/1999/xlink";function eh(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(Hl,"href"):null)}function nh(t){let e=parseFloat(t.dataset?.snapdomWidth||"")||0,n=parseFloat(t.dataset?.snapdomHeight||"")||0,o=parseInt(t.getAttribute("width")||"",10)||0,r=parseInt(t.getAttribute("height")||"",10)||0,i=parseFloat(t.style?.width||"")||0,a=parseFloat(t.style?.height||"")||0,s=e||i||o||t.width||t.naturalWidth||100,l=n||a||r||t.height||t.naturalHeight||100;return{width:s,height:l}}async function zo(t,e={}){let n=Array.from(t.querySelectorAll("img"));t.tagName==="IMG"&&n.unshift(t);let o=async s=>{if(!s.getAttribute("src")){let g=s.currentSrc||s.src||Qe(s.getAttribute("srcset"),s)||"";g&&s.setAttribute("src",g)}if(s.removeAttribute("srcset"),s.removeAttribute("sizes"),(s.getAttribute("src")||"").startsWith("data:")){s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let l=s.src||"";if(!l)return;let u=H.image?.get(l);if(u){s.src=u,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let c=await ft(l,{as:"dataURL",useProxy:e.useProxy,debug:e.debug});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){H.image?.set(l,c.data),s.src=c.data,c.blob&&(s.__snapdomBlob=c.blob),s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:f,height:p}=nh(s),{fallbackURL:y}=e||{};if(y)try{let g=typeof y=="function"?await y({width:f,height:p,src:l,element:s}):y;if(g){let d=await ft(g,{as:"dataURL",useProxy:e.useProxy,debug:e.debug});if(d?.ok&&typeof d.data=="string"){s.src=d.data,s.width||(s.width=f),s.height||(s.height=p);return}}}catch{}let m="";e.placeholders!==!1&&(rt(e.__session,"image-fallback",`image failed to inline, using placeholder: ${l}`),m='<rect width="100%" height="100%" fill="#ccc"/><text x="50%" y="50%" fill="#666" font-family="sans-serif" font-size="12" text-anchor="middle" dominant-baseline="central">img</text>'),s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${f}" height="${p}">${m}</svg>`)}`,s.width||(s.width=f),s.height||(s.height=p)},r=6;for(let s=0;s<n.length;s+=r){let l=n.slice(s,s+r).map(o);await Promise.allSettled(l)}let i=Array.from(t.querySelectorAll("image"));t.localName==="image"&&i.unshift(t);let a=async s=>{let l=eh(s);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let u=await ft(l,{as:"dataURL",useProxy:e.useProxy,debug:e.debug});u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")&&(s.setAttribute("href",u.data),s.removeAttribute("xlink:href"),typeof s.removeAttributeNS=="function"&&s.removeAttributeNS(Hl,"href"))};for(let s=0;s<i.length;s+=r){let l=i.slice(s,s+r).map(a);await Promise.allSettled(l)}}dt();Ft();var jl=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],oh=["mask-position","mask-size","mask-repeat","mask-mode","mask-composite","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","-webkit-mask-composite","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],rh=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],ih=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];async function sh(t,e,n,o){let r=n.get(t)||D(t);n.has(t)||n.set(t,r);let i=jr(t),a=i?m=>m in i?i[m]:"":m=>r.getPropertyValue(m),s=a("border-image"),l=a("border-image-source"),u=s&&s!=="none"||l&&l!=="none",c=r.getPropertyValue("background-image"),f=a("background-color"),p=c&&c!=="none"||f&&f!=="rgba(0, 0, 0, 0)"&&f!=="transparent"||/url\s*\(|gradient\s*\(/i.test(r.getPropertyValue("background")||""),y=ut()&&(a("background-clip")||a("-webkit-background-clip")||"").includes("text");if(p&&!y)for(let m of rh){let g=a(m);g&&e.style.setProperty(m,g)}for(let m of jl){if(y&&m==="background-image")continue;let g=r.getPropertyValue(m);if(m==="background-image"&&(!g||g==="none")){let b=r.getPropertyValue("background");b&&/url\s*\(/.test(b)&&(g=he(b).filter(w=>/url\s*\(/.test(w)).join(", ")||g)}if(!g||g==="none")continue;let d=he(g),h=await Promise.all(d.map(b=>De(b,o)));h.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&e.style.setProperty(m,h.join(", "))}for(let m of oh){let g=a(m);!g||g==="initial"||e.style.setProperty(m,g)}if(u)for(let m of ih){let g=a(m);!g||g==="initial"||e.style.setProperty(m,g)}if(p&&/fixed/.test(a("background-attachment")||""))try{await lh(t,e,r)}catch{}}function ah(t,e,n,o,r){let i=(t||"auto").trim();if(i==="cover"||i==="contain"){if(!e||!n)return{w:o,h:r};let p=i==="cover"?Math.max(o/e,r/n):Math.min(o/e,r/n);return{w:e*p,h:n*p}}let a=i.split(/\s+/),s=(p,y)=>{if(p==="auto"||p===void 0)return null;if(p.endsWith("px"))return parseFloat(p);if(p.endsWith("%"))return y*parseFloat(p)/100},l=s(a[0],o),u=s(a[1],r);if(l===void 0||u===void 0)return null;let c=l,f=u;return c==null&&f==null?(c=e||o,f=n||r):c==null?c=e&&n?f*(e/n):o:f==null&&(f=e&&n?c*(n/e):r),!c||!f?null:{w:c,h:f}}async function lh(t,e,n){let o=(n.getPropertyValue("background-attachment")||"").split(",").map(m=>m.trim()),r=Mn();if(!r)for(let m=t.parentElement;m&&!r;m=m.parentElement){let g=D(m);(g.transform&&g.transform!=="none"||g.filter&&g.filter!=="none")&&(r=!0)}if(r){e.style.setProperty("background-attachment",o.map(()=>"scroll").join(", "));return}let i=t.getBoundingClientRect(),a=t.ownerDocument?.defaultView||window,s=a.innerWidth,l=a.innerHeight,u=he(e.style.backgroundImage||n.getPropertyValue("background-image")||""),c=(e.style.backgroundSize||n.getPropertyValue("background-size")||"auto").split(",").map(m=>m.trim()),f=(e.style.backgroundPosition||n.getPropertyValue("background-position")||"0% 0%").split(",").map(m=>m.trim()),p=[],y=[];for(let m=0;m<u.length;m++){let g=o[m%o.length]||"scroll",d=c[m%c.length],h=f[m%f.length];if(g!=="fixed"){p.push(d),y.push(h);continue}let b=0,w=0,x=u[m]&&u[m].match(/url\(["']?([^"')]+)["']?\)/);if(x)try{let E=new Image;E.src=x[1],await E.decode(),b=E.naturalWidth,w=E.naturalHeight}catch{p.push(d),y.push(h);continue}let v=ah(d,b,w,s,l);if(!v){p.push(d),y.push(h);continue}let S=h.split(/\s+/),k=(E,C,_)=>{if(!E)return 0;if(E.endsWith("px"))return parseFloat(E);if(E.endsWith("%"))return(C-_)*parseFloat(E)/100},A=k(S[0]||"0%",s,v.w),R=k(S[1]||S[0]||"0%",l,v.h);if(A===void 0||R===void 0){p.push(d),y.push(h);continue}p.push(`${Uo(v.w)}px ${Uo(v.h)}px`),y.push(`${Uo(A-i.left)}px ${Uo(R-i.top)}px`)}e.style.setProperty("background-size",p.join(", ")),e.style.setProperty("background-position",y.join(", ")),e.style.setProperty("background-attachment",o.map(()=>"scroll").join(", "))}var Uo=t=>Math.round(t*100)/100;async function Ho(t,e,n,o={},r=new Map,i=!1){if(!e)return;let a=[],s=(c,f)=>{if(Ks(c)){if(i&&jr(c)){let p=n.get(c)||D(c);if(jl.every(y=>(p.getPropertyValue(y)||"none")==="none")&&!/url\s*\(/.test(p.getPropertyValue("background")||""))return}a.push([c,f])}};t&&s(t,e);let l=[e];for(;l.length;){let c=l.pop();if(c.children)for(let f of c.children){if(f.tagName==="STYLE")continue;let p=r.get(f);p&&s(p,f),l.push(f)}}let u=6;for(let c=0;c<a.length;c+=u)await Promise.allSettled(a.slice(c,c+u).map(([f,p])=>sh(f,p,n,o)))}Ft();function Gl(t,e,n=new Map){let o=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(let l=r.currentNode;l;l=r.nextNode()){let u=n.get(l);if(u?.nodeType!==1)continue;let c=D(u),f=c.getPropertyValue("backdrop-filter")||c.getPropertyValue("-webkit-backdrop-filter");f&&f!=="none"&&l!==e&&o.push({cloneEl:l,orig:u,bf:f,path:dh(e,l)})}if(!o.length)return;let i=t.getBoundingClientRect(),a=o.length>1?new Map:null,s=o.map((l,u)=>{let c=e.cloneNode(!0);uh(c,e,l.orig.getBoundingClientRect(),n,a),ph(Vl(c,l.path));for(let f=0;f<u;f++){let p=Vl(c,o[f].path);p&&(p.style.setProperty("backdrop-filter","none","important"),p.style.setProperty("-webkit-backdrop-filter","none","important"))}return{...l,copy:c}});for(let{cloneEl:l,orig:u,bf:c,copy:f}of s)ch.has(l.tagName)||fh(l,u,c,f,i)}var ch=new Set(["IMG","INPUT","TEXTAREA","SELECT","CANVAS","VIDEO","AUDIO","IFRAME","EMBED","OBJECT","PROGRESS","METER","HR","BR"]);function fh(t,e,n,o,r){let i=e.getBoundingClientRect();if(!i.width||!i.height)return;let a=D(e),s=e.offsetWidth?i.width/e.offsetWidth:1,l=Math.abs(s-1)>.001?1/s:1;o.style.position="absolute",o.style.left=`${(r.left-i.left)*l}px`,o.style.top=`${(r.top-i.top)*l}px`,o.style.width=`${r.width}px`,o.style.height=`${r.height}px`,o.style.margin="0",o.style.filter=n,l!==1&&(o.style.transform=`scale(${l})`,o.style.transformOrigin="top left");let u=document.createElement("div");u.style.cssText="position:absolute;inset:0;overflow:hidden;border-radius:inherit;z-index:-2",u.appendChild(o);let c=document.createElement("div");c.style.cssText="position:absolute;inset:0;border-radius:inherit;z-index:-1",c.style.backgroundColor=a.backgroundColor,c.style.backgroundImage=t.style.backgroundImage||a.backgroundImage;for(let f of["background-size","background-position","background-repeat","background-origin","background-clip"])c.style.setProperty(f,a.getPropertyValue(f));t.style.setProperty("background-color","transparent","important"),t.style.setProperty("background-image","none","important"),t.style.setProperty("backdrop-filter","none","important"),t.style.setProperty("-webkit-backdrop-filter","none","important"),a.position==="static"&&(t.style.position="relative"),t.style.isolation="isolate",t.prepend(c),t.prepend(u)}var jo=128;function uh(t,e,n,o,r){let i=[[t,e]];for(;i.length;){let[a,s]=i.pop(),l=o.get(s);if(l?.nodeType===1){let f=r?.get(l);f||(f=l.getBoundingClientRect(),r?.set(l,f)),(f.left>n.right+jo||f.right<n.left-jo||f.top>n.bottom+jo||f.bottom<n.top-jo)&&(a.tagName==="IMG"&&a.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="),a.style&&(a.style.backgroundImage="none"))}let u=a.children,c=s.children;for(let f=0;f<u.length;f++)i.push([u[f],c[f]])}}function dh(t,e){let n=[];for(let o=e;o!==t;o=o.parentElement){if(!o?.parentElement)return null;n.push([...o.parentElement.children].indexOf(o))}return n.reverse()}function Vl(t,e){if(!e)return null;let n=t;for(let o of e)if(n=n.children[o],!n)return null;return n}function ph(t){if(t)for(let e=t;e&&e.parentNode;){let n=e.parentNode;for(;e.nextSibling;)e.nextSibling.remove();e===t&&e.remove(),e=n}}Ft();dt();Et();Et();function wi(t){return ss(t),{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map,warnings:[]}}bt();dt();var Pt=()=>{};function Vo(t,e){if(!t)return Pt;let n=[],o=200;function r(i){if(e){let a=i.getBoundingClientRect();if(a.width>0||a.height>0){let s=Math.max(a.right,a.left+(i.scrollWidth||0)),l=Math.max(a.bottom,a.top+(i.scrollHeight||0));if(s<e.left-o||a.left>e.right+o||l<e.top-o||a.top>e.bottom+o)return}}if(i.firstElementChild===null&&i.firstChild!==null){let a=getComputedStyle(i),s=hh(i,a);s!==Pt&&n.push(s);let l=mh(i,a);l!==Pt&&n.push(l)}for(let a=i.firstElementChild;a;a=a.nextElementSibling)r(a)}return r(t),()=>n.forEach(i=>i())}function hh(t,e){if(!t)return Pt;e=e||getComputedStyle(t);let n=bh(e);if(n<=0||!Jl(t))return Pt;let o=Kl(t),r=o.text,i=xh(e);o.write("X");let a=t.scrollHeight-i;o.restore();let s=a>0?a:wh(e),l=Math.round(s*n+i),u=.5*(n+1);if(t.scrollHeight<=l+u)return Pt;let c=0,f=r.length,p=-1;for(;c<=f;){let m=c+f>>1;o.write(r.slice(0,xi(r,m))+"\u2026"),t.scrollHeight<=l+u?(p=m,c=m+1):f=m-1}let y=(p>=0?r.slice(0,xi(r,p)):"")+"\u2026";return o.write(y),Yl(t,y,o)}function mh(t,e){if(!t||(e=e||getComputedStyle(t),e.textOverflow!=="ellipsis")||e.whiteSpace!=="nowrap"&&e.whiteSpace!=="pre"||e.overflowX!=="hidden"&&e.overflowX!=="clip"||!Jl(t)||t.scrollWidth<=t.clientWidth+.5)return Pt;let n=Kl(t),o=n.text,r=yh(t,e,n.nodes),i=c=>{if(!r){let p=xi(o,c);return o.slice(0,p)+Xl(o,p)+"\u2026"}let f=gh(o,o.length-c);return Xl(o,f)+o.slice(f)+"\u2026"},a=0,s=o.length,l=-1;for(;a<=s;){let c=a+s>>1;n.write(i(c)),t.scrollWidth<=t.clientWidth+.5?(l=c,a=c+1):s=c-1}let u=l>=0?i(l):"\u2026";return n.write(u),Yl(t,u,n)}function Yl(t,e,n){return()=>{t.textContent===e&&n.restore()}}function Kl(t){let e=[];for(let o=t.firstChild;o;o=o.nextSibling)o.nodeType===Node.TEXT_NODE&&e.push(o);let n=e.map(o=>o.data);return{nodes:e,text:n.join(""),write(o){e[0].data=o;for(let r=1;r<e.length;r++)e[r].data=""},restore(){for(let o=0;o<e.length;o++)e[o].data=n[o]}}}function xi(t,e){if(e<=0||e>=t.length)return e;let n=t.charCodeAt(e-1);return n>=55296&&n<=56319?e-1:e}function gh(t,e){if(e<=0||e>=t.length)return e;let n=t.charCodeAt(e);return n>=56320&&n<=57343?e-1:e}var ql=/[\u0600-\u08FF\u1800-\u18AF\uFB50-\uFDFF\uFE70-\uFEFF]/;function Xl(t,e){return e>0&&e<t.length&&ql.test(t[e-1])&&ql.test(t[e])&&!Y()?"\u200D":""}function yh(t,e,n){let o=null,r=null;for(let d of n){let h=d.data.search(/\S/);h<0||(o||(o=[d,h]),r=[d,d.data.length-d.data.trimEnd().length])}if(!o)return!1;let i=t.ownerDocument.createRange(),a=(d,h,b)=>(i.setStart(d,h),i.setEnd(d,b),i.getBoundingClientRect()),[s,l]=o,[u,c]=r,f=u.data.length-c,p=a(s,l,Math.min(s.data.length,l+1)),y=a(u,Math.max(0,f-1),f),m=t.getBoundingClientRect();if(e.direction==="rtl"){let d=m.right-(parseFloat(e.borderRightWidth)||0)-(parseFloat(e.paddingRight)||0);return Math.abs(y.right-d)<Math.abs(p.right-d)}let g=m.left+(parseFloat(e.borderLeftWidth)||0)+(parseFloat(e.paddingLeft)||0);return Math.abs(y.left-g)<Math.abs(p.left-g)}function bh(t){let e=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");e=(e||"").trim();let n=parseInt(e,10);return Number.isFinite(n)&&n>0?n:0}function wh(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 xh(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Jl(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var an=["clone","render"],Hn={clone:0,render:1},Mt="render";function Zl(t){let e=Array.isArray(t&&t.plugins)?t.plugins:[];if(!e.length)return{stage:Mt,loweredBy:[]};let n=-1,o=[];for(let i of e){if(!i||typeof i!="object")continue;let a=i.needs===void 0?Mt:i.needs;if(!Object.prototype.hasOwnProperty.call(Hn,a))throw new Error(`[SnapDOM] Plugin '${i.name||"(unnamed)"}' declares needs: ${JSON.stringify(a)}, expected one of ${an.join(", ")}.`);o.push({name:i.name||"(unnamed)",needs:a}),n=Math.max(n,Hn[a])}if(n<0)return{stage:Mt,loweredBy:[]};let r=an[n];return{loweredBy:r===Mt?[]:o.filter(i=>i.needs===r).map(i=>i.name),stage:r}}function ln(t,e){return Hn[t]>=Hn[e]}function Ql(t,e,n=an){let o=n[n.length-1];if(e==null)return o;if(!Object.prototype.hasOwnProperty.call(Hn,e))throw new Error(`[SnapDOM] ${t}: needs must be one of ${an.join(", ")}, got ${JSON.stringify(e)}.`);if(!n.includes(e))throw new Error(`[SnapDOM] ${t} cannot run at stage '${e}'; it supports ${n.join(", ")}.`);return e}function tc(t,e,n){let o=e.length?e.map(r=>`'${r}'`).join(", "):"the attached plugins";return new Error(`[SnapDOM] No ${n}: this capture stopped at '${t}' because ${o} asked for needs: '${t}'. It is not re-captured, since that would be a different instant. Ask the plugin for needs: 'render', or capture without it.`)}var cn=[];function fn(t){if(!t)return null;if(Array.isArray(t)){let[e,n]=t;return typeof e=="function"?e(n):e}if(typeof t=="object"&&"plugin"in t){let{plugin:e,options:n}=t;return typeof e=="function"?e(n):e}return typeof t=="function"?t():t}function Si(...t){let e=t.flat();for(let n of e){let o=fn(n);if(o){if(o.needs!==void 0&&o.needs!==Mt)throw new Error(`[SnapDOM] '${o.name||"(unnamed)"}' declares needs: ${JSON.stringify(o.needs)}, so it can't be a global plugin (it would stop every capture before '${Mt}'). Pass it per capture: snapdom(el, { plugins: [...] }).`);cn.some(r=>r&&r.name&&o.name&&r.name===o.name)||cn.push(o)}}}function ec(t){return t&&Array.isArray(t.plugins)?t.plugins:cn}async function se(t,e,n){let o=n,r=ec(e);for(let i of r){let a=i&&typeof i[t]=="function"?i[t]:null;if(!a)continue;let s=await a(e,o);typeof s<"u"&&(o=s)}return o}async function Go(t,e,n){let o=[],r=ec(e);for(let i of r){let a=i&&typeof i[t]=="function"?i[t]:null;if(!a)continue;let s=await a(e,n);typeof s<"u"&&o.push(s)}return o}function Sh(){cn.length=0}var vh=0;function Ch(t){let e=[];if(Array.isArray(t))for(let n of t){let o=fn(n);if(!o)continue;o.name||(o.name=`anonymous-${++vh}`);let r=e.findIndex(i=>i&&i.name===o.name);r>=0&&e.splice(r,1),e.push(o)}for(let n of cn)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function nc(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=Ch(e)),t}function vi(){return cn.slice()}var kh=["resolveNode","beforeSnap","beforeClone","afterClone","beforeRender","afterRender"];function qo(t){let e=Array.isArray(t&&t.plugins)?t.plugins:[];for(let n of e){let o=fn(n);if(!(!o||o.pure===!0)){for(let r of kh)if(typeof o[r]=="function")return!0}}return!1}Et();He();Dn();var Ie="data-snapdom-asset",ic="http://www.w3.org/1999/xlink",Mh=0;function Yo(t,e,n,o,r,i){let a=i.__compressedAssets||=new WeakMap,s=a.get(t);s||(s={token:String(++Mh),properties:[]},a.set(t,s),t.setAttribute(Ie,s.token));let l=s.properties.find(u=>u.kind===e&&u.name===n);l?(l.compressed!==o&&(l.original=o),l.compressed=r):s.properties.push({kind:e,name:n,original:o,compressed:r})}var sc=(t,e)=>e.kind==="style"?t.style?.getPropertyValue(e.name):t.getAttribute(e.name);function Ko(t,e){let n=new Map;if(!t||!e)return n;let o=[t,...t.querySelectorAll(`[${Ie}]`)];for(let r of o){let i=e.get(r);if(!i||r.getAttribute(Ie)!==i.token)continue;let a=i.properties.filter(s=>sc(r,s)===s.compressed).map(s=>Object.freeze({...s}));a.length&&n.set(i.token,Object.freeze(a))}return n}function Jo(t,e){if(!t||!e)return;let n=0;for(let o of[t,...t.querySelectorAll(`[${Ie}]`)]){let r=e.get(o);r&&(r.token=String(++n),o.setAttribute(Ie,r.token))}}function ac(t,e){if(!e?.size||typeof t!="string"||!t.startsWith("data:image/svg+xml"))return t;let n=t.indexOf(","),o=new DOMParser().parseFromString(decodeURIComponent(t.slice(n+1)),"image/svg+xml");if(o.querySelector("parsererror"))return t;let r=!1;for(let i of o.querySelectorAll(`[${Ie}]`))for(let a of e.get(i.getAttribute(Ie))||[])sc(i,a)===a.compressed&&(a.kind==="style"?i.style.setProperty(a.name,a.original,i.style.getPropertyPriority(a.name)):a.name==="xlink:href"?i.setAttributeNS(ic,a.name,a.original):i.setAttribute(a.name,a.original),r=!0);return r?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(o))}`:t}function oc(t){if(t.is2D===!1)return 1/0;let e=t.a*t.a+t.b*t.b+t.c*t.c+t.d*t.d,n=t.a*t.d-t.b*t.c;return Math.sqrt((e+Math.sqrt(Math.max(0,e*e-4*n*n)))/2)}function Mi(t,e){let n=e.element||t,o=n.isConnected?D(n):n.style,r=e.__compressionClip,i=(y,m)=>{try{return y[m]?.baseVal?.value||0}catch{return 0}},a=r?.width||n.offsetWidth||parseFloat(o?.width)||i(n,"width"),s=r?.height||n.offsetHeight||parseFloat(o?.height)||i(n,"height"),l=Number.isFinite(e.width),u=Number.isFinite(e.height);if(!r&&(l||u)&&a&&s)try{let y=e.outerTransforms===!1&&e.__compressionRootTransform?e.__compressionRootTransform:we({baseTransform:o?.transform,rotate:o?.rotate,scale:o?.scale,width:a,height:s});if(y.is2D===!1)a=0,s=0;else{let m=Math.abs(y.a)*a+Math.abs(y.c)*s,g=Math.abs(y.b)*a+Math.abs(y.d)*s;a=Math.min(a,m),s=Math.min(s,g)}}catch{a=0,s=0}let c=(l||u?Math.max(l?a?e.width/a:1/0:0,u?s?e.height/s:1/0:0):e.scale||1)*(e.dpr||1);e.__compressionDensity=c;let f=new WeakMap,p=y=>{if(!y||y.nodeType!==1)return 1;if(f.has(y))return f.get(y);let m=y.isConnected?D(y):y.style,g=1;try{m?.perspective&&m.perspective!=="none"&&(g=1/0);let d=m?.transform;if(d&&d!=="none")g*=oc(new DOMMatrix(d));else if(y.transform?.baseVal?.numberOfItems){let h=new DOMMatrix;for(let b=0;b<y.transform.baseVal.numberOfItems;b++){let w=y.transform.baseVal.getItem(b).matrix;h=h.multiply(new DOMMatrix([w.a,w.b,w.c,w.d,w.e,w.f]))}g*=oc(h)}if(m?.scale&&m.scale!=="none"){let h=m.scale.trim().split(/\s+/).map(b=>parseFloat(b)/(b.endsWith("%")?100:1));g*=Math.max(...h.map(Math.abs))}if(y!==n&&m?.zoom&&m.zoom!=="normal"&&(g*=parseFloat(m.zoom)||1),y.localName==="svg"&&y.viewBox?.baseVal?.width>0&&y.viewBox.baseVal.height>0){let h=y.viewBox.baseVal,b=v=>/^\d+(?:\.\d+)?px$/.test(m?.[v]||"")?parseFloat(m[v]):i(y,v),w=b("width"),x=b("height");g*=w>0&&x>0?Math.max(w/h.width,x/h.height):1/0}}catch{g=1/0}return Number.isFinite(g)||(g=1/0),y!==n&&(g*=p(y.parentElement||y.getRootNode?.().host)),f.set(y,g),g};return{density:c,stretch:p}}var lc=.92,cc=1;async function Ah(t){let e=new Image;return e.decoding="sync",e.src=t,typeof e.decode=="function"?(await e.decode(),e):(await new Promise((n,o)=>{e.onload=()=>n(),e.onerror=o}),e)}function _h(t){let e=/^data:([^;,]+)/.exec(t);return e?e[1]:""}var Eh=64*1024,fc=32*1024*1024,Rh=50,Xo=new Map,Ci=0,ki=0;function Fh(t,e){let n=t.indexOf(",");if(n<0||!/;base64/i.test(t.slice(0,n)))return null;let o=Math.ceil(e/3)*4,r=t.length-n-1,i=Math.min(r,o);try{let a=atob(t.slice(n+1,n+1+i-i%4)),s=new Uint8Array(a.length);for(let l=0;l<a.length;l++)s[l]=a.charCodeAt(l);return s}catch{return null}}function $h(t){let e=Fh(t,4096);if(!e||e.length<16)return null;let n=o=>e[o]<<8|e[o+1];if(e[0]===137&&e[1]===80&&e.length>=24)return{w:(e[16]<<24|e[17]<<16|e[18]<<8|e[19])>>>0,h:(e[20]<<24|e[21]<<16|e[22]<<8|e[23])>>>0};if(e[0]===71&&e[1]===73&&e[2]===70)return{w:e[6]|e[7]<<8,h:e[8]|e[9]<<8};if(e[0]===82&&e[1]===73&&e[8]===87&&e.length>=30){let o=e[15];if(o===32&&e[23]===157)return{w:(e[26]|e[27]<<8)&16383,h:(e[28]|e[29]<<8)&16383};if(o===76)return{w:(e[21]|(e[22]&63)<<8)+1,h:((e[22]>>6|e[23]<<2|(e[24]&15)<<10)&16383)+1};if(o===88)return{w:(e[24]|e[25]<<8|e[26]<<16)+1,h:(e[27]|e[28]<<8|e[29]<<16)+1}}if(e[0]===255&&e[1]===216){let o=2;for(;o+9<e.length;){if(e[o]!==255){o++;continue}let r=e[o+1];if(r===216||r===1||r>=208&&r<=215){o+=2;continue}if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{h:n(o+5),w:n(o+7)};let i=n(o+2);if(i<2)break;o+=2+i}}return null}function rc(t,e,n,o){let r=Math.min(1,Math.max(n/t,o/e));return!(r>0)||r>=.95?0:r}var Th=`self.onmessage = async (e) => {
</code_context>
<issue_to_address>
**security (javascript.browser.security.insecure-document-method):** User controlled data in methods like `innerHTML`, `outerHTML` or `document.write` is an anti-pattern that can lead to XSS vulnerabilities
*Source: opengrep*
</issue_to_address>
### Comment 2
<location path="src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs" line_range="16" />
<code_context>
`?"":o})}function gl(t){if(!t)return"";let e=[],n=/"((?:\\[\s\S]|[^"\\])*)"|'((?:\\[\s\S]|[^'\\])*)'/g,o=0,r;for(;r=n.exec(t);){let a=t.slice(o,r.index).trim();a&&e.push(a),e.push(Sp(r[1]!==void 0?r[1]:r[2])),o=n.lastIndex}let i=t.slice(o).trim();return i&&e.push(i),e.join("")}function wl(t,e,n){let o=t.parentElement,r=o&&n?n.get(o):null;return r?{get(i,a){let s=e.get(i,a),l=r.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(i,a){let s=e.getStack(i,a);if(!s.length)return s;let l=r.get(a);if(typeof l=="number"){let u=s.slice();return u[u.length-1]=Math.max(u[u.length-1],l),u}return s}}:e}function xl(t,e,n){let o=new Map,r=(u,c)=>On(u,c).map(([f,p])=>({name:f,num:p})),i=r(e?.counterReset,0),a=r(e?.counterSet,0),s=r(e?.counterIncrement,1);function l(u){if(o.has(u))return o.get(u).slice();let c=n.getStack(t,u);c=c.length?c.slice():[];let f=i.find(m=>m.name===u);if(f){let m=Number.isFinite(f.num)?f.num:0;c=c.length?[...c,m]:[m]}let p=a.find(m=>m.name===u);if(p){let m=Number.isFinite(p.num)?p.num:0;c.length===0&&(c=[0]),c[c.length-1]=m}let y=s.find(m=>m.name===u);if(y){let m=Number.isFinite(y.num)?y.num:1;c.length===0&&(c=[0]),c[c.length-1]+=m}return o.set(u,c.slice()),c}return{get(u,c){let f=l(c);return f.length?f[f.length-1]:0},getStack(u,c){return l(c)},__incs:s}}var vp=["color","-webkit-text-fill-color","font-family","font-size","font-weight","font-style","letter-spacing","line-height"],Cp=["color","-webkit-text-fill-color","font-family","font-size","font-weight","font-style","font-variant","letter-spacing","word-spacing","text-transform","text-decoration-line","text-decoration-color","text-decoration-style","line-height","background-color","vertical-align"];function yl(t,e,n,o,r,i){try{if(o===null){if(t.getRootNode()!==(t.ownerDocument||document))return;let f=D(t).display||"";if(r==="::marker"?!f.includes("list-item"):!(f==="block"||f==="flow-root"||f==="list-item"||f==="inline-block"||f==="table-cell"||f==="table-caption"))return}else if(!t.matches(o))return;if(r==="::marker"&&!(D(t).display||"").includes("list-item"))return;let a=D(t,r),s=D(t);if(!a)return;let l="";for(let f of i){let p=a.getPropertyValue(f);p&&p!==s.getPropertyValue(f)&&!(f==="background-color"&&p==="rgba(0, 0, 0, 0)")&&!(f==="vertical-align"&&p==="baseline")&&(l+=`${f}:${p};`)}if(r==="::marker"){let f=a.getPropertyValue("content");f&&f!=="normal"&&f!=="none"&&(l+=`content:${f};`)}if(!l)return;let c=`data-sd-p${n.__pseudoRuleSeq=(n.__pseudoRuleSeq||0)+1}`;e.setAttribute(c,""),n.__pseudoCSS=(n.__pseudoCSS||"")+`[${c}]${r}{${l}}`}catch{}}function kp(t,e){if(!/\b(?:no-)?(?:open|close)-quote\b/.test(t))return t;let n="\u201C",o="\u201D";try{let r=D(e).quotes;if(r==="none")n="",o="";else if(r&&r!=="auto"){let i=r.match(/"[^"]*"|'[^']*'/g);i&&i.length>=2&&(n=i[0].slice(1,-1),o=i[1].slice(1,-1))}}catch{}return n=n.replace(/"/g,""),o=o.replace(/"/g,""),t.replace(/"[^"]*"|\b(no-open-quote|no-close-quote|open-quote|close-quote)\b/g,(r,i)=>i?i==="open-quote"?`"${n}"`:i==="close-quote"?`"${o}"`:'""':r)}function Mp(t,e,n,o){let r=e.content;if(!r||r==="none"||r==="normal")return{text:"",incs:[]};r=xp(r),r=kp(r,t);let i=e.counterIncrement;if(!ti(r)&&(!i||i==="none"))return{text:gl(r),incs:[]};let a=wl(t,n,o),s=xl(t,e,a),l=ti(r)?dl(r,t,s):r;return{text:gl(l),incs:s.__incs||[],derived:s}}function Ap(t,e){if(e.__shadowPseudo)return!1;let n=ye(t),o=[];for(let i of["before","after","firstLetter","marker","firstLine"]){let a=n[i];if(a===null)return!1;a&&o.push(a)}if(!o.length)return!0;let r=o.join(",");try{return!t.matches(r)&&t.querySelector(r)===null}catch{return!1}}async function on(t,e,n,o,r=!1){if(t?.nodeType!==1||e?.nodeType!==1||(n.slicer?.due()&&await n.slicer.pause(),t.tagName==="TEXTAREA"))return;let i=t.ownerDocument||document;if(!r&&!bp(i,n)&&!n.__shadowPseudo||!r&&Ap(t,n))return;n.__siblingCounters||(n.__siblingCounters=new WeakMap),n.__counterCtx||(n.__counterCtx=wp(t.ownerDocument||document,n));let a=n.__counterCtx,s=ye(t);s.marker!==""&&yl(t,e,n,s.marker,"::marker",vp),s.firstLine!==""&&yl(t,e,n,s.firstLine,"::first-line",Cp);for(let l of["::before","::after","::first-letter"]){let u=s[l==="::before"?"before":l==="::after"?"after":"firstLetter"];if(u!==null){if(u==="")continue;try{if(!t.matches(u))continue}catch{}}let c=null;if(l==="::first-letter"){for(let f=e.firstChild;f&&!c;f=f.nextSibling)f.nodeType===3&&f.data.trim()&&(c=f);if(!c)continue}try{let f=D(t,l);if(!f)continue;let p=f.content,y=f.display;if(p==="none"&&f.backgroundImage==="none"&&(f.backgroundColor==="transparent"||f.backgroundColor==="rgba(0, 0, 0, 0)")&&!ml(f)&&(!f.transform||f.transform==="none")&&y==="inline")continue;if(y==="none"||l!=="::first-letter"&&(p==="none"||p==="normal")){l==="::before"&&e.setAttribute("data-snapdom-has-before","1"),l==="::after"&&e.setAttribute("data-snapdom-has-after","1");continue}if(l==="::first-letter"){let X=D(t),V=(X?.display||"").toLowerCase();if(V.includes("flex")||V.includes("grid"))continue;let J=Yt=>f[Yt]!==X[Yt]&&(parseFloat(f[Yt])||0)!==0;if(!(f.color!==X.color||f.fontSize!==X.fontSize||f.fontWeight!==X.fontWeight||f.fontFamily!==X.fontFamily||f.fontStyle!==X.fontStyle||f.textTransform!==X.textTransform||f.float!==X.float&&f.float!=="none"||J("paddingTop")||J("paddingRight")||J("paddingBottom")||J("paddingLeft")||J("marginTop")||J("marginRight")||J("marginBottom")||J("marginLeft")))continue;let ht=c.textContent,ce=/^\s*/.exec(ht)[0],Ce=ht.slice(ce.length),ne=Ce.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],gn=Ce.slice(ne?.length||0);if(!ne||/[\uD800-\uDFFF]/.test(ne))continue;let oe=document.createElement("span");oe.textContent=ne,oe.setAttribute("data-snapdom-pseudo","::first-letter");let _t=Ue(f,lo(t,n)),Jn=ze(_t,"span");n.styleMap.set(oe,Jn);let Zn=document.createTextNode(gn);e.replaceChild(Zn,c),e.insertBefore(oe,Zn),ce&&e.insertBefore(document.createTextNode(ce),oe);continue}let d=p??"",h=d===""||d==="none"||d==="normal",{text:b,incs:w,derived:x}=Mp(t,f,a,n.__siblingCounters),v=f.backgroundImage,S=f.backgroundColor,k=f.fontFamily,A=parseInt(f.fontSize)||32,R=parseInt(f.fontWeight)||!1,E=f.fontStyle||"normal",C=f.color||"#000",_=f.transform,T=Gt(k,o?.__iconMatchers),P=!h&&b!=="",F=v&&v!=="none",L=S&&S!=="transparent"&&S!=="rgba(0, 0, 0, 0)",M=ml(f),I=_&&_!=="none",$=d!=="none"&&d!=="normal",N=/^inline-/.test(y||""),O=$&&((parseFloat(f.width)||0)>0||(parseFloat(f.height)||0)>0||N),B=f.boxShadow,z=f.outlineStyle,G=$&&B&&B!=="none",j=$&&z&&z!=="none"&&(parseFloat(f.outlineWidth)||0)>0;if(!(P||F||L||M||I||O||G||j)){if(w&&w.length&&t.parentElement){let X=n.__siblingCounters.get(t.parentElement)||new Map;for(let{name:V}of w){if(!V)continue;let J=wl(t,a,n.__siblingCounters),ht=xl(t,D(t,l),J).get(t,V);X.set(V,ht)}n.__siblingCounters.set(t.parentElement,X)}continue}let ot=b.startsWith("url(")||/^-?(?:webkit-)?image-set\(/i.test(b),it=y==="inline"&&f.cssFloat==="none"&&f.position!=="absolute"&&f.position!=="fixed",St=!1;if(P&&!T&&b.length>1&&!ot&&it){let X=D(t),V=parseFloat(X.fontSize)||16,J=parseFloat(X.lineHeight);Number.isFinite(J)||(J=V*1.5),t.getBoundingClientRect().height<J*1.6&&(e.style.whiteSpace="nowrap",St=!0)}let q=document.createElement("span");q.setAttribute("data-snapdom-pseudo",l),q.style.pointerEvents="none",St?q.style.whiteSpace="nowrap":e.style.getPropertyValue(Ge)==="nowrap"&&q.style.setProperty(Ge,"nowrap");let gt=oa(t,l,f,n,o),At=(D(t).display||"").toLowerCase(),le=At.includes("flex")||At.includes("grid");if(le){let X=gt["min-width"];(!X||X==="auto"||X==="0px")&&(gt["min-width"]="0px")}let ee=P;ee&&!it&&parseFloat(f.height)>=1.5*(parseFloat(f.lineHeight)||(parseFloat(f.fontSize)||16)*1.2)&&(ee=!1,q.style.whiteSpace=f.whiteSpace);let Xt=ze(gt,"span",ee,le);if(n.styleMap.set(q,Xt),T&&b&&[...b].length===1){let{dataUrl:X,height:V,advance:J,descent:It}=await el(b,k,R,A,C,E),ht=document.createElement("img");ht.src=X,ht.style=`height:${A}px;width:${J/V*A}px;object-fit:contain;vertical-align:${-It}px;`,q.appendChild(ht)}else if(b&&ot){let X=bn(b,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??ke(b);if(X?.trim())try{let V=await ft(de(X),{as:"dataURL",useProxy:o.useProxy,debug:o.debug});if(V?.ok&&typeof V.data=="string"){let J=document.createElement("img");J.src=V.data,J.style=`width:${A}px;height:auto;object-fit:contain;`,q.appendChild(J)}}catch(V){W(o,`Couldn't draw the ${l} icon of`,[t,V])}}else!T&&P&&(q.textContent=b);q.style.backgroundImage="none","maskImage"in q.style&&(q.style.maskImage="none"),"webkitMaskImage"in q.style&&(q.style.webkitMaskImage="none");try{q.style.backgroundClip=f.backgroundClip,F&&(q.style.backgroundRepeat=f.backgroundRepeat,q.style.backgroundSize=f.backgroundSize,f.backgroundPositionX&&f.backgroundPositionY?(q.style.backgroundPositionX=f.backgroundPositionX,q.style.backgroundPositionY=f.backgroundPositionY):q.style.backgroundPosition=f.backgroundPosition,q.style.backgroundOrigin=f.backgroundOrigin,q.style.backgroundAttachment=f.backgroundAttachment,q.style.backgroundBlendMode=f.backgroundBlendMode)}catch{}if(F)try{let X=he(v),V=await Promise.all(X.map(J=>De(J,o)));q.style.backgroundImage=V.join(", ")}catch(X){W(o,`Couldn't load the ${l} background image.`,X)}L&&(q.style.backgroundColor=S);let Nt=f.maskImage||f.webkitMaskImage;if(Nt&&Nt!=="none")try{let V=(await Promise.all(he(Nt).map(J=>De(J,o)))).join(", ");q.style.maskImage=V,q.style.webkitMaskImage=V;for(let J of["maskSize","maskRepeat","maskPosition","maskMode","maskComposite","maskOrigin","maskClip"])f[J]&&(q.style[J]=f[J])}catch(X){W(o,`Couldn't load the ${l} mask image.`,X)}let pt=q.childNodes.length>0||q.textContent?.trim()!==""||F||L||M||I||O||G||j;if(w&&w.length&&t.parentElement){let X=n.__siblingCounters.get(t.parentElement)||new Map;for(let{name:V}of w){if(!V)continue;let J=x.get(t,V);X.set(V,J)}n.__siblingCounters.set(t.parentElement,X)}if(!pt)continue;l==="::before"?(e.setAttribute("data-snapdom-has-before","1"),e.insertBefore(q,e.firstChild)):(e.setAttribute("data-snapdom-has-after","1"),e.appendChild(q))}catch(f){rt(o.__session,"pseudo-failed",`${l} could not be copied`,t),W(o,`Couldn't copy the ${l} of`,[t,f])}}if(n.nodeMap)for(let l=e.firstElementChild;l;l=l.nextElementSibling){let u=n.nodeMap.get(l);u?.nodeType===1&&!l.hasAttribute("data-snapdom-pseudo")&&await on(u,l,n,o,!0)}else{let l=Array.from(e.children).filter(c=>!c.hasAttribute("data-snapdom-pseudo")),u=Array.from(t.children);for(let c=0;c<Math.min(u.length,l.length);c++)await on(u[c],l[c],n,o,!0)}}var Sl="http://www.w3.org/2000/svg",_p=["background-color","background-image","background-size","background-position","background-repeat","background-origin"];function vl(t){for(let[e,n]of t)try{Ep(e,n)}catch{}}function Ep(t,e){let n=t.ownerDocument.defaultView,o=n.getComputedStyle(t),r=[...t.getClientRects()];if(!r.length)return;let i=r[0].left+parseFloat(o.borderLeftWidth),a=r[0].top+parseFloat(o.borderTopWidth),s;if(o.display==="inline"){let h=r.reduce((w,x)=>w+x.width,0),b=0;s=r.map(w=>{let x={x:w.left-i-b,y:w.top-a,w:h,h:w.height,top:w.top,bottom:w.bottom};return b+=w.width,x})}else{let h=t.clientWidth||r[0].width,b=t.clientHeight||r[0].height;s=[{x:0,y:0,w:h,h:b,top:-1/0,bottom:1/0}]}let l=e.ownerDocument,u=`sd-bct-${Math.random().toString(36).slice(2,9)}`,c=_p.map(h=>`${h}:${o.getPropertyValue(h)}`).join(";").replace(/"/g,"'"),f="";s.forEach((h,b)=>{let w=`<svg xmlns="${Sl}" width="${h.w}" height="${h.h}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="width:${h.w}px;height:${h.h}px;${c}"></div></foreignObject></svg>`;f+=`<pattern id="${u}-${b}" patternUnits="userSpaceOnUse" x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}"><image width="${h.w}" height="${h.h}" preserveAspectRatio="none" href="data:image/svg+xml;charset=utf-8,${encodeURIComponent(w)}"/></pattern>`});let p="",y=l.createElement("canvas").getContext("2d"),m=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT),g=t.ownerDocument.createRange();for(let h=m.nextNode();h;h=m.nextNode()){let b=n.getComputedStyle(h.parentElement);y.font=b.font;let w=y.measureText("X").fontBoundingBoxAscent;if(!Number.isFinite(w))return;let x=b.font.replace(/"/g,"'"),v=s.map(()=>({xs:[],ys:[],chars:""})),S=h.data;for(let k=0;k<S.length;k++){let A=S.charCodeAt(k)>=55296&&S.charCodeAt(k)<=56319?2:1;g.setStart(h,k),g.setEnd(h,k+A);let R=g.getClientRects()[0],E=S.slice(k,k+A);if(k+=A-1,!R||!E.trim())continue;let C=(R.top+R.bottom)/2,_=s.findIndex(T=>C>=T.top&&C<=T.bottom);_<0&&(_=0),v[_].xs.push(+(R.left-i).toFixed(2)),v[_].ys.push(+(R.top-a+w).toFixed(2)),v[_].chars+=E}v.forEach((k,A)=>{if(!k.chars)return;let R=k.chars.replace(/&/g,"&").replace(/</g,"<");p+=`<text x="${k.xs.join(" ")}" y="${k.ys.join(" ")}" fill="url(#${u}-${A})" style="font:${x};font-kerning:none;letter-spacing:0;white-space:pre">${R}</text>`})}if(!p)return;let d=l.createElementNS(Sl,"svg");d.setAttribute("style","position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;pointer-events:none"),d.innerHTML=`<defs>${f}</defs>${p}`,o.position==="static"&&e.style.setProperty("position","relative","important"),e.style.setPr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link issues
fixes #1308
Summary By Copilot
Update the bundled SnapDOM module from v3.7.4 to the official v3.7.6 release and bump the Dom2Image package version to 11.0.1. The existing wrapper API and asset path are preserved.
Regression?
Risk
Only the upstream JavaScript bundle and package version change; the wrapper API and asset path are unchanged.
Verification
Manual (required)
Automated
node --check 'src\components\BootstrapBlazor.Dom2Image\wwwroot\lib\snapdom.mjs'— passed.node --input-type=module -e "import { snapdom } from './src/components/BootstrapBlazor.Dom2Image/wwwroot/lib/snapdom.mjs'; if (typeof snapdom !== 'function') process.exit(1);"— passed.dotnet build 'src\components\BootstrapBlazor.Dom2Image\BootstrapBlazor.Dom2Image.csproj' --no-restore --nologo --verbosity quiet— passed with 0 warnings and 0 errors.git diff --check— passed.SHA-256 comparison against the official
@zumer/snapdom@3.7.6npm module — matched (A197D0C229A6E6E19A545F67F1A9067F274C283D633E3C8E424D719CBC198956).Manual browser capture verification was not performed.
Packaging changes reviewed?
The package version is now 11.0.1; the existing static asset path and MIT license header are preserved.
☑️ Self Check before Merge
Summary by Sourcery
Update Dom2Image to SnapDOM v3.7.6 and release package version 11.0.1.
Bug Fixes:
Enhancements: