html2canvas-pro 2.3.8 → 2.3.9

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 2.3.8 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 2.3.9 <https://yorickshan.github.io/html2canvas-pro/>
3
3
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
4
4
  * Released under MIT License
5
5
  */
@@ -8,4 +8,4 @@
8
8
  display: none !important;
9
9
  }`,zs=(e,t)=>{Bs(e,`.${Is}:before${Rs}
10
10
  .${Ls}:after${Rs}`,t)},Bs=(e,t,n)=>{let r=e.ownerDocument;if(r){let i=r.createElement(`style`);i.textContent=t,n&&(i.nonce=n),e.appendChild(i)}},Vs=(e,t)=>{let n=e.ownerDocument.createElement(`base`);n.href=t;let r=e.getElementsByTagName(`head`).item(0);r?.insertBefore(n,r?.firstChild??null)};for(var Hs=class{static normalizeElement(e,t){let n={};return Yr(e)?(t.animationDuration.some(e=>e>0)&&(n.animationDuration=e.style.animationDuration,e.style.animationDuration=`0s`),t.transform!==null&&(n.transform=e.style.transform,e.style.transform=`translate(0, 0)`),t.rotate!==null&&(n.rotate=e.style.rotate,e.style.rotate=`0deg`,n.transform===void 0&&(n.transform=e.style.transform,e.style.transform=`translate(0, 0)`)),n):n}static restoreElement(e,t){Yr(e)&&(t.animationDuration!==void 0&&(e.style.animationDuration=t.animationDuration),t.transform!==void 0&&(e.style.transform=t.transform),t.rotate!==void 0&&(e.style.rotate=t.rotate))}},J=class{constructor(e,t,n={}){if(this.context=e,this.textNodes=[],this.elements=[],this.createsStackingContext=!1,this.createsRealStackingContext=!1,this.isListOwner=!1,this.debugRender=!1,Cs(t,3))debugger;if(this.styles=new vs(e,e.config.window.getComputedStyle(t,null)),n.normalizeDom!==!1&&Yr(t)&&(this.originalStyles=Hs.normalizeElement(t,this.styles),this.originalElement=t),this.bounds=o(this.context,t),t.tagName===`FIELDSET`){let e=t.querySelector(`:scope > legend`);if(e){let t=o(this.context,e);this.legendBounds=t;let n=t.top+t.height/2-this.styles.borderTopWidth/2;this.bounds=new a(this.bounds.left,n,this.bounds.width,this.bounds.height-(n-this.bounds.top))}}Cs(t,4)&&(this.debugRender=!0)}restore(){this.originalStyles&&this.originalElement&&(Hs.restoreElement(this.originalElement,this.originalStyles),this.originalStyles=void 0,this.originalElement=void 0)}restoreTree(){this.restore();for(let e of this.elements)e.restoreTree()}},Us=`AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAI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AMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBY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AA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=`,Ws=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Gs=typeof Uint8Array>`u`?[]:new Uint8Array(256),Ks=0;Ks<Ws.length;Ks++)Gs[Ws.charCodeAt(Ks)]=Ks;for(var qs=function(e){var t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);var l=typeof ArrayBuffer<`u`&&typeof Uint8Array<`u`&&Uint8Array.prototype.slice!==void 0?new ArrayBuffer(t):Array(t),u=Array.isArray(l)?l:new Uint8Array(l);for(r=0;r<n;r+=4)a=Gs[e.charCodeAt(r)],o=Gs[e.charCodeAt(r+1)],s=Gs[e.charCodeAt(r+2)],c=Gs[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Js=function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n.push(e[r+1]<<8|e[r]);return n},Ys=function(e){for(var t=e.length,n=[],r=0;r<t;r+=4)n.push(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]);return n},Xs=5,Zs=11,Qs=2,$s=Zs-Xs,ec=65536>>Xs,tc=(1<<Xs)-1,nc=ec+(1024>>Xs)+32,rc=65536>>Zs,ic=(1<<$s)-1,ac=function(e,t,n){return e.slice?e.slice(t,n):new Uint16Array(Array.prototype.slice.call(e,t,n))},oc=function(e,t,n){return e.slice?e.slice(t,n):new Uint32Array(Array.prototype.slice.call(e,t,n))},sc=function(e,t){var n=qs(e),r=Array.isArray(n)?Ys(n):new Uint32Array(n),i=Array.isArray(n)?Js(n):new Uint16Array(n),a=24,o=ac(i,a/2,r[4]/2),s=r[5]===2?ac(i,(a+r[4])/2):oc(r,Math.ceil((a+r[4])/4));return new cc(r[0],r[1],r[2],r[3],o,s)},cc=function(){function e(e,t,n,r,i,a){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=r,this.index=i,this.data=a}return e.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Xs],t=(t<<Qs)+(e&tc),this.data[t];if(e<=65535)return t=this.index[ec+(e-55296>>Xs)],t=(t<<Qs)+(e&tc),this.data[t];if(e<this.highStart)return t=nc-rc+(e>>Zs),t=this.index[t],t+=e>>Xs&ic,t=this.index[t],t=(t<<Qs)+(e&tc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),lc=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,uc=typeof Uint8Array>`u`?[]:new Uint8Array(256),dc=0;dc<lc.length;dc++)uc[lc.charCodeAt(dc)]=dc;var fc=1,pc=2,mc=3,hc=4,gc=5,_c=7,vc=8,yc=9,bc=10,xc=11,Sc=12,Cc=13,wc=14,Tc=15,Ec=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var a=e.charCodeAt(n++);(a&64512)==56320?t.push(((i&1023)<<10)+(a&1023)+65536):(t.push(i),n--)}else t.push(i)}return t},Dc=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var n=e.length;if(!n)return``;for(var r=[],i=-1,a=``;++i<n;){var o=e[i];o<=65535?r.push(o):(o-=65536,r.push((o>>10)+55296,o%1024+56320)),(i+1===n||r.length>16384)&&(a+=String.fromCharCode.apply(String,r),r.length=0)}return a},Oc=sc(Us),kc=`×`,Ac=`÷`,jc=function(e){return Oc.get(e)},Mc=function(e,t,n){var r=n-2,i=t[r],a=t[n-1],o=t[n];if(a===pc&&o===mc)return kc;if(a===pc||a===mc||a===hc||o===pc||o===mc||o===hc)return Ac;if(a===vc&&[vc,yc,xc,Sc].indexOf(o)!==-1||(a===xc||a===yc)&&(o===yc||o===bc)||(a===Sc||a===bc)&&o===bc||o===Cc||o===gc||o===_c||a===fc)return kc;if(a===Cc&&o===wc){for(;i===gc;)i=t[--r];if(i===wc)return kc}if(a===Tc&&o===Tc){for(var s=0;i===Tc;)s++,i=t[--r];if(s%2==0)return kc}return Ac},Nc=function(e){var t=Ec(e),n=t.length,r=0,i=0,a=t.map(jc);return{next:function(){if(r>=n)return{done:!0,value:null};for(var e=kc;r<n&&(e=Mc(t,a,++r))===kc;);if(e!==kc||r===n){var o=Dc.apply(null,t.slice(i,r));return i=r,{value:o,done:!1}}return{done:!0,value:null}}}},Pc=function(e){for(var t=Nc(e),n=[],r;!(r=t.next()).done;)r.value&&n.push(r.value.slice());return n};let Fc=e=>{if(e.createRange){let t=e.createRange();if(t.getBoundingClientRect){let n=e.createElement(`boundtest`);n.style.height=`123px`,n.style.display=`block`,e.body.appendChild(n),t.selectNode(n);let r=t.getBoundingClientRect(),i=Math.round(r.height);if(e.body.removeChild(n),i===123)return!0}}return!1},Ic=e=>{let t=e.createElement(`boundtest`);t.style.width=`50px`,t.style.display=`block`,t.style.fontSize=`12px`,t.style.letterSpacing=`0px`,t.style.wordSpacing=`0px`,e.body.appendChild(t);let n=e.createRange();t.innerHTML=typeof``.repeat==`function`?`&#128104;`.repeat(10):``;let r=t.firstChild,i=c(r.data).map(e=>l(e)),a=0,o={},s=i.every((e,t)=>{n.setStart(r,a),n.setEnd(r,a+e.length);let i=n.getBoundingClientRect();a+=e.length;let s=i.x>o.x||i.y>o.y;return o=i,t===0||s});return e.body.removeChild(t),s},Lc=()=>new Image().crossOrigin!==void 0,Rc=()=>typeof new XMLHttpRequest().responseType==`string`,zc=e=>{let t=new Image,n=e.createElement(`canvas`),r=n.getContext(`2d`);if(!r)return!1;t.src=`data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>`;try{r.drawImage(t,0,0),n.toDataURL()}catch{return!1}return!0},Bc=e=>e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255,Vc=e=>{let t=e.createElement(`canvas`);t.width=100,t.height=100;let n=t.getContext(`2d`);if(!n)return Promise.reject(Error(`Failed to get 2D rendering context`));n.fillStyle=`rgb(0, 255, 0)`,n.fillRect(0,0,100,100);let r=new Image,i=t.toDataURL();r.src=i;let a=Hc(100,100,0,0,r);return n.fillStyle=`red`,n.fillRect(0,0,100,100),Uc(a).then(t=>{n.drawImage(t,0,0);let r=n.getImageData(0,0,100,100).data;n.fillStyle=`red`,n.fillRect(0,0,100,100);let a=e.createElement(`div`);return a.style.backgroundImage=`url(${i})`,a.style.height=`100px`,Bc(r)?Uc(Hc(100,100,0,0,a)):Promise.reject(Error(`ForeignObject rendering not supported`))}).then(e=>(n.drawImage(e,0,0),Bc(n.getImageData(0,0,100,100).data))).catch(()=>!1)},Hc=(e,t,n,r,i)=>{let a=`http://www.w3.org/2000/svg`,o=document.createElementNS(a,`svg`),s=document.createElementNS(a,`foreignObject`);return o.setAttributeNS(null,`width`,e.toString()),o.setAttributeNS(null,`height`,t.toString()),s.setAttributeNS(null,`width`,`100%`),s.setAttributeNS(null,`height`,`100%`),s.setAttributeNS(null,`x`,n.toString()),s.setAttributeNS(null,`y`,r.toString()),s.setAttributeNS(null,`externalResourcesRequired`,`true`),o.appendChild(s),s.appendChild(i),o},Uc=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=n,r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(e))}`}),Y={get SUPPORT_RANGE_BOUNDS(){"use strict";let e=Fc(document);return Object.defineProperty(Y,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){"use strict";let e=Y.SUPPORT_RANGE_BOUNDS&&Ic(document);return Object.defineProperty(Y,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){"use strict";let e=zc(document);return Object.defineProperty(Y,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){"use strict";let e=typeof Array.from==`function`&&typeof window.fetch==`function`?Vc(document):Promise.resolve(!1);return Object.defineProperty(Y,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){"use strict";let e=Lc();return Object.defineProperty(Y,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){"use strict";let e=Rc();return Object.defineProperty(Y,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){"use strict";let e=`withCredentials`in new XMLHttpRequest;return Object.defineProperty(Y,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){"use strict";let e=!!(typeof Intl<`u`&&Intl.Segmenter);return Object.defineProperty(Y,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}};var Wc=class{constructor(e,t){this.text=e,this.bounds=t}};let Gc=(e,t,n,r)=>{let i=Xc(t,n),o=[],s=0;return i.forEach(t=>{if(n.textDecorationLine.length||t.trim().length>0)if(Y.SUPPORT_RANGE_BOUNDS){let n=qc(r,s,t.length).getClientRects();if(n.length>1){let n=Jc(t),i=0;n.forEach(t=>{o.push(new Wc(t,a.fromDOMRectList(e,qc(r,i+s,t.length).getClientRects()))),i+=t.length})}else o.push(new Wc(t,a.fromDOMRectList(e,n)))}else{let n=r.splitText(t.length);o.push(new Wc(t,Kc(e,r))),r=n}else Y.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));s+=t.length}),o},Kc=(e,t)=>{let n=t.ownerDocument;if(n){let r=n.createElement(`html2canvaswrapper`);r.appendChild(t.cloneNode(!0));let i=t.parentNode;if(i){i.replaceChild(r,t);let n=o(e,r);return r.firstChild&&i.replaceChild(r.firstChild,r),n}}return a.EMPTY},qc=(e,t,n)=>{let r=e.ownerDocument;if(!r)throw Error(`Node has no owner document`);let i=r.createRange();return i.setStart(e,t),i.setEnd(e,t+n),i},Jc=e=>{if(Y.SUPPORT_NATIVE_TEXT_SEGMENTATION){let t=new Intl.Segmenter(void 0,{granularity:`grapheme`});return Array.from(t.segment(e)).map(e=>e.segment)}return Pc(e)},Yc=(e,t)=>{if(Y.SUPPORT_NATIVE_TEXT_SEGMENTATION){let t=new Intl.Segmenter(void 0,{granularity:`word`});return Array.from(t.segment(e)).map(e=>e.segment)}return Qc(e,t)},Xc=(e,t)=>xo(t.writingMode)?Jc(e):t.letterSpacing===0?Yc(e,t):Jc(e),Zc=[32,160,4961,65792,65793,4153,4241],Qc=(e,t)=>{let n=vt(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap===`break-word`?`break-word`:t.wordBreak}),r=[],i;for(;!(i=n.next()).done;)if(i.value){let e=c(i.value.slice()),t=``;e.forEach(e=>{Zc.indexOf(e)===-1?t+=l(e):(t.length&&r.push(t),r.push(l(e)),t=``)}),t.length&&r.push(t)}return r};var $c=class{constructor(e,t,n){this.text=el(t.data,n.textTransform),this.text.length!==t.data.length&&(t.data=this.text),this.textBounds=Gc(e,this.text,n,t)}};let el=(e,t)=>{switch(t){case 1:return e.toLowerCase();case 3:return e.replace(tl,nl);case 2:return e.toUpperCase();default:return e}},tl=/(^|\s|:|-|\(|\))([a-z])/g,nl=(e,t,n)=>e.length>0?t+n.toUpperCase():e;var rl=class extends J{constructor(e,t){super(e,t),this.src=t.currentSrc||t.src,this.intrinsicWidth=t.naturalWidth,this.intrinsicHeight=t.naturalHeight,this.context.cache.addImage(this.src)}},il=class extends J{constructor(e,t){super(e,t),this.canvas=t,this.intrinsicWidth=t.width,this.intrinsicHeight=t.height}},al=class extends J{constructor(e,t){super(e,t);let n=new XMLSerializer,r=o(e,t);t.setAttribute(`width`,`${r.width}px`),t.setAttribute(`height`,`${r.height}px`),this.svg=`data:image/svg+xml,${encodeURIComponent(n.serializeToString(t))}`,this.intrinsicWidth=t.width.baseVal.value,this.intrinsicHeight=t.height.baseVal.value,this.context.cache.addImage(this.svg)}},ol=class extends J{constructor(e,t){super(e,t),this.value=t.value}},sl=class extends J{constructor(e,t){super(e,t),this.start=t.start,this.reversed=typeof t.reversed==`boolean`&&t.reversed===!0}};let cl=[{type:15,flags:0,unit:`px`,number:3}],ll=[{type:16,flags:0,number:50}],ul=e=>e.width>e.height?new a(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new a(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e,dl=e=>{let t=e.type===`password`?Array(e.value.length+1).join(`•`):e.value;return t.length===0?e.placeholder||``:t},fl=e=>e.value.length===0&&!!e.placeholder,pl=707406591;var ml=class extends J{constructor(e,t){switch(super(e,t),this.type=t.type.toLowerCase(),this.checked=t.checked,this.value=dl(t),this.isPlaceholder=fl(t),(this.type===`checkbox`||this.type===`radio`)&&(this.styles.backgroundColor=3739148031,this.styles.borderTopColor=this.styles.borderRightColor=this.styles.borderBottomColor=this.styles.borderLeftColor=2779096575,this.styles.borderTopWidth=this.styles.borderRightWidth=this.styles.borderBottomWidth=this.styles.borderLeftWidth=1,this.styles.borderTopStyle=this.styles.borderRightStyle=this.styles.borderBottomStyle=this.styles.borderLeftStyle=1,this.styles.backgroundClip=[0],this.styles.backgroundOrigin=[0],this.bounds=ul(this.bounds)),this.type){case`checkbox`:this.styles.borderTopRightRadius=this.styles.borderTopLeftRadius=this.styles.borderBottomRightRadius=this.styles.borderBottomLeftRadius=cl;break;case`radio`:this.styles.borderTopRightRadius=this.styles.borderTopLeftRadius=this.styles.borderBottomRightRadius=this.styles.borderBottomLeftRadius=ll;break}}},hl=class extends J{constructor(e,t){super(e,t);let n=t.options[t.selectedIndex||0];this.value=n&&n.text||``}},gl=class extends J{constructor(e,t){super(e,t),this.value=t.value}},_l=class extends J{constructor(e,t,n){super(e,t),this.src=t.src,this.width=parseInt(t.width,10)||0,this.height=parseInt(t.height,10)||0,this.backgroundColor=this.styles.backgroundColor,this.parseTreeFn=n;try{if(t.contentWindow&&t.contentWindow.document&&t.contentWindow.document.documentElement&&this.parseTreeFn){this.tree=this.parseTreeFn(e,t.contentWindow.document.documentElement);let n=t.contentWindow.document.documentElement?Gr(e,getComputedStyle(t.contentWindow.document.documentElement).backgroundColor):V.TRANSPARENT,r=t.contentWindow.document.body?Gr(e,getComputedStyle(t.contentWindow.document.body).backgroundColor):V.TRANSPARENT;this.backgroundColor=R(n)?R(r)?this.styles.backgroundColor:r:n}}catch{}}};let vl=[`OL`,`UL`,`MENU`],yl=(e,t,n,r)=>{for(let i=t.firstChild,a;i;i=a)a=i.nextSibling,bl(e,i,n,r)},bl=(e,t,n,r)=>{if(qr(t)&&t.data.length>0)n.textNodes.push(new $c(e,t,n.styles));else if(Kr(t))if(ci(t)&&t.assignedNodes)t.assignedNodes().forEach(t=>bl(e,t,n,r));else{let i=xl(e,t);i.styles.isVisible()&&(Cl(t,i,r)?i.createsRealStackingContext=!0:wl(i.styles)&&(i.createsStackingContext=!0),vl.indexOf(t.tagName)!==-1&&(i.isListOwner=!0),n.elements.push(i),t.shadowRoot?yl(e,t.shadowRoot,i,r):!oi(t)&&!Qr(t)&&!si(t)&&yl(e,t,i,r))}},xl=(e,t)=>ni(t)?new rl(e,t):ei(t)?new il(e,t):Qr(t)?new al(e,t):li(t)?new ol(e,t):ui(t)?new sl(e,t):Xr(t)?new ml(e,t):si(t)?new hl(e,t):oi(t)?new gl(e,t):ri(t)?new _l(e,t,Sl):new J(e,t),Sl=(e,t)=>{let n=xl(e,t);return n.createsRealStackingContext=!0,yl(e,t,n,n),n},Cl=(e,t,n)=>t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||$r(e)&&n.styles.isTransparent(),wl=e=>e.isPositioned()||e.isFloating()?!0:H(e.display,268435456)||H(e.display,33554432)||H(e.display,536870912)||H(e.display,134217728),Tl=(e,t)=>e.length===t.length&&e.some((e,n)=>e===t[n]),El=(e,t,n,r,i)=>e.map((e,a)=>{switch(a){case 0:return e.add(t,n);case 1:return e.add(t+r,n);case 2:return e.add(t+r,n+i);case 3:return e.add(t,n+i)}return e});var X=class e{constructor(e,t){this.type=0,this.x=e,this.y=t}add(t,n){return new e(this.x+t,this.y+n)}};let Dl=(e,t,n)=>new X(e.x+(t.x-e.x)*n,e.y+(t.y-e.y)*n);var Ol=class e{constructor(e,t,n,r){this.type=1,this.start=e,this.startControl=t,this.endControl=n,this.end=r}subdivide(t,n){let r=Dl(this.start,this.startControl,t),i=Dl(this.startControl,this.endControl,t),a=Dl(this.endControl,this.end,t),o=Dl(r,i,t),s=Dl(i,a,t),c=Dl(o,s,t);return n?new e(this.start,r,o,c):new e(c,s,a,this.end)}add(t,n){return new e(this.start.add(t,n),this.startControl.add(t,n),this.endControl.add(t,n),this.end.add(t,n))}reverse(){return new e(this.end,this.endControl,this.startControl,this.start)}};let Z=e=>e.type===1;var kl=class{constructor(e){let t=e.styles,n=e.bounds,[r,i]=wn(t.borderTopLeftRadius,n.width,n.height),[a,o]=wn(t.borderTopRightRadius,n.width,n.height),[s,c]=wn(t.borderBottomRightRadius,n.width,n.height),[l,u]=wn(t.borderBottomLeftRadius,n.width,n.height),d=[];d.push((r+a)/n.width),d.push((l+s)/n.width),d.push((i+u)/n.height),d.push((o+c)/n.height);let f=Math.max(...d);f>1&&(r/=f,i/=f,a/=f,o/=f,s/=f,c/=f,l/=f,u/=f);let p=n.width-a,m=n.height-c,h=n.width-s,g=n.height-u,_=t.borderTopWidth,v=t.borderRightWidth,y=t.borderBottomWidth,b=t.borderLeftWidth,x=I(t.paddingTop,e.bounds.width),ee=I(t.paddingRight,e.bounds.width),te=I(t.paddingBottom,e.bounds.width),S=I(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||i>0?Q(n.left+b/3,n.top+_/3,r-b/3,i-_/3,0):new X(n.left+b/3,n.top+_/3),this.topRightBorderDoubleOuterBox=r>0||i>0?Q(n.left+p,n.top+_/3,a-v/3,o-_/3,1):new X(n.left+n.width-v/3,n.top+_/3),this.bottomRightBorderDoubleOuterBox=s>0||c>0?Q(n.left+h,n.top+m,s-v/3,c-y/3,2):new X(n.left+n.width-v/3,n.top+n.height-y/3),this.bottomLeftBorderDoubleOuterBox=l>0||u>0?Q(n.left+b/3,n.top+g,l-b/3,u-y/3,3):new X(n.left+b/3,n.top+n.height-y/3),this.topLeftBorderDoubleInnerBox=r>0||i>0?Q(n.left+b*2/3,n.top+_*2/3,r-b*2/3,i-_*2/3,0):new X(n.left+b*2/3,n.top+_*2/3),this.topRightBorderDoubleInnerBox=r>0||i>0?Q(n.left+p,n.top+_*2/3,a-v*2/3,o-_*2/3,1):new X(n.left+n.width-v*2/3,n.top+_*2/3),this.bottomRightBorderDoubleInnerBox=s>0||c>0?Q(n.left+h,n.top+m,s-v*2/3,c-y*2/3,2):new X(n.left+n.width-v*2/3,n.top+n.height-y*2/3),this.bottomLeftBorderDoubleInnerBox=l>0||u>0?Q(n.left+b*2/3,n.top+g,l-b*2/3,u-y*2/3,3):new X(n.left+b*2/3,n.top+n.height-y*2/3),this.topLeftBorderStroke=r>0||i>0?Q(n.left+b/2,n.top+_/2,r-b/2,i-_/2,0):new X(n.left+b/2,n.top+_/2),this.topRightBorderStroke=r>0||i>0?Q(n.left+p,n.top+_/2,a-v/2,o-_/2,1):new X(n.left+n.width-v/2,n.top+_/2),this.bottomRightBorderStroke=s>0||c>0?Q(n.left+h,n.top+m,s-v/2,c-y/2,2):new X(n.left+n.width-v/2,n.top+n.height-y/2),this.bottomLeftBorderStroke=l>0||u>0?Q(n.left+b/2,n.top+g,l-b/2,u-y/2,3):new X(n.left+b/2,n.top+n.height-y/2),this.topLeftBorderBox=r>0||i>0?Q(n.left,n.top,r,i,0):new X(n.left,n.top),this.topRightBorderBox=a>0||o>0?Q(n.left+p,n.top,a,o,1):new X(n.left+n.width,n.top),this.bottomRightBorderBox=s>0||c>0?Q(n.left+h,n.top+m,s,c,2):new X(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=l>0||u>0?Q(n.left,n.top+g,l,u,3):new X(n.left,n.top+n.height),this.topLeftPaddingBox=r>0||i>0?Q(n.left+b,n.top+_,Math.max(0,r-b),Math.max(0,i-_),0):new X(n.left+b,n.top+_),this.topRightPaddingBox=a>0||o>0?Q(n.left+Math.min(p,n.width-v),n.top+_,p>n.width+v?0:Math.max(0,a-v),Math.max(0,o-_),1):new X(n.left+n.width-v,n.top+_),this.bottomRightPaddingBox=s>0||c>0?Q(n.left+Math.min(h,n.width-b),n.top+Math.min(m,n.height-y),Math.max(0,s-v),Math.max(0,c-y),2):new X(n.left+n.width-v,n.top+n.height-y),this.bottomLeftPaddingBox=l>0||u>0?Q(n.left+b,n.top+Math.min(g,n.height-y),Math.max(0,l-b),Math.max(0,u-y),3):new X(n.left+b,n.top+n.height-y),this.topLeftContentBox=r>0||i>0?Q(n.left+b+S,n.top+_+x,Math.max(0,r-(b+S)),Math.max(0,i-(_+x)),0):new X(n.left+b+S,n.top+_+x),this.topRightContentBox=a>0||o>0?Q(n.left+Math.min(p,n.width+b+S),n.top+_+x,p>n.width+b+S?0:a-b+S,o-(_+x),1):new X(n.left+n.width-(v+ee),n.top+_+x),this.bottomRightContentBox=s>0||c>0?Q(n.left+Math.min(h,n.width-(b+S)),n.top+Math.min(m,n.height+_+x),Math.max(0,s-(v+ee)),c-(y+te),2):new X(n.left+n.width-(v+ee),n.top+n.height-(y+te)),this.bottomLeftContentBox=l>0||u>0?Q(n.left+b+S,n.top+g,Math.max(0,l-(b+S)),u-(y+te),3):new X(n.left+b+S,n.top+n.height-(y+te))}};let Q=(e,t,n,r,i)=>{let a=4*((Math.sqrt(2)-1)/3),o=n*a,s=r*a,c=e+n,l=t+r;switch(i){case 0:return new Ol(new X(e,l),new X(e,l-s),new X(c-o,t),new X(c,t));case 1:return new Ol(new X(e,t),new X(e+o,t),new X(c,l-s),new X(c,l));case 2:return new Ol(new X(c,t),new X(c,t+s),new X(e+o,l),new X(e,l));default:return new Ol(new X(c,l),new X(c-o,l),new X(e,t+s),new X(e,t))}},Al=e=>[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox],jl=e=>[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox],Ml=e=>[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox];var Nl=class{constructor(e,t,n){this.offsetX=e,this.offsetY=t,this.matrix=n,this.type=0,this.target=6}},Pl=class{constructor(e,t){this.path=e,this.target=t,this.type=1}},Fl=class{constructor(e){this.opacity=e,this.type=2,this.target=6}},Il=class{constructor(e){this.applyClip=e,this.type=3,this.target=6}};let Ll={[K.NORMAL]:`source-over`,[K.MULTIPLY]:`multiply`,[K.SCREEN]:`screen`,[K.OVERLAY]:`overlay`,[K.DARKEN]:`darken`,[K.LIGHTEN]:`lighten`,[K.COLOR_DODGE]:`color-dodge`,[K.COLOR_BURN]:`color-burn`,[K.HARD_LIGHT]:`hard-light`,[K.SOFT_LIGHT]:`soft-light`,[K.DIFFERENCE]:`difference`,[K.EXCLUSION]:`exclusion`,[K.HUE]:`hue`,[K.SATURATION]:`saturation`,[K.COLOR]:`color`,[K.LUMINOSITY]:`luminosity`};var Rl=class{constructor(e){this.mixBlendMode=e,this.type=4,this.target=6,this.compositeOperation=Ll[e]}},zl=class e{constructor(t){this.type=5,this.target=6;let n=e.parseDropShadow(t);this.shadow=n.shadow,this.safeFilterString=n.safeFilterString}static parseDropShadow(t){if(!t)return{safeFilterString:``};let n=e.findDropShadows(t);if(n.length===0)return{safeFilterString:t};let r=e.parseDropShadowBody(n[0].body),i=``,a=0;for(let e of n)i+=t.slice(a,e.start),a=e.end;return i+=t.slice(a),{shadow:r,safeFilterString:i.replace(/\s+/g,` `).trim()}}static findDropShadows(e){let t=[],n=/drop-shadow\(/gi,r;for(;(r=n.exec(e))!==null;){let n=r.index+12-1,i=r.index,a=1,o=n+1;for(;o<e.length&&a>0;){let t=e[o];t===`(`?a++:t===`)`&&a--,o++}if(a!==0)break;let s=e.slice(n+1,o-1);t.push({body:s,start:i,end:o})}return t}static parseDropShadowBody(t){let n=e.tokenizeFilterArgs(t.trim()),r=[],i;for(let t of n)e.isCSSLength(t)?r.push(parseFloat(t)):t&&(i=t);if(!(r.length<2||r.length>3))return{offsetX:r[0],offsetY:r[1],blur:r[2]??0,color:i??`rgba(0,0,0,1)`}}static tokenizeFilterArgs(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):/\s/.test(a)?r>0?n+=a:n&&=(t.push(n),``):n+=a}return n&&t.push(n),t}static isCSSLength(e){return/^-?[\d.]+(px|em|rem|pt|cm|mm|in|pc|ex|ch|vw|vh|vmin|vmax|%)?$/i.test(e)}};let Bl=e=>e.type===0,Vl=e=>e.type===1,Hl=e=>e.type===2,Ul=e=>e.type===3,Wl=e=>e.type===4,Gl=e=>e.type===5;var Kl=class{constructor(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}},ql=class{constructor(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new kl(this.container),this.container.styles.opacity<1&&this.effects.push(new Fl(this.container.styles.opacity)),this.container.styles.rotate!==null){let e=this.container.styles.transformOrigin,t=this.container.bounds.left+I(e[0],this.container.bounds.width),n=this.container.bounds.top+I(e[1],this.container.bounds.height),r=this.container.styles.rotate*Math.PI/180,i=Math.cos(r),a=Math.sin(r),o=[i,a,-a,i,0,0];this.effects.push(new Nl(t,n,o))}if(this.container.styles.transform!==null){let e=this.container.styles.transformOrigin,t=this.container.bounds.left+I(e[0],this.container.bounds.width),n=this.container.bounds.top+I(e[1],this.container.bounds.height),r=this.container.styles.transform;this.effects.push(new Nl(t,n,r))}if(Jl(this.container.styles)){let e=Al(this.curves),t=Ml(this.curves);Tl(e,t)?this.effects.push(new Pl(e,6)):(this.effects.push(new Pl(e,2)),this.effects.push(new Pl(t,4)))}if(this.container.styles.clipPath.type!==0){let e=Xl(this.container.styles.clipPath,this.container.bounds);e&&this.effects.push(e)}if(this.container.styles.mixBlendMode!==K.NORMAL&&this.effects.push(new Rl(this.container.styles.mixBlendMode)),this.container.styles.filter!==null&&this.effects.push(new zl(this.container.styles.filter)),this.container.styles.zoom!==1){let e=this.container.styles.transformOrigin,t=this.container.bounds.left+I(e[0],this.container.bounds.width),n=this.container.bounds.top+I(e[1],this.container.bounds.height),r=this.container.styles.zoom,i=[r,0,0,r,0,0];this.effects.push(new Nl(t,n,i))}}getEffects(e){let t=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,r=this.effects.slice(0);for(;n;){let e=n.effects.filter(e=>!Vl(e));if(t||n.container.styles.position!==0||!n.parent){if(t=[2,3].indexOf(n.container.styles.position)===-1,Jl(n.container.styles)){let e=Al(n.curves),t=Ml(n.curves);Tl(e,t)||r.unshift(new Pl(t,6))}r.unshift(...e)}else r.unshift(...e);n=n.parent}return r.filter(t=>H(t.target,e))}};let Jl=e=>e.overflowX!==0||e.overflowY!==0,Yl=(e,t,n,r,i)=>e===`closest-side`?Math.min(t-n,r-t):e===`farthest-side`?Math.max(t-n,r-t):I(e,i),Xl=(e,t)=>{let{left:n,top:r,width:i,height:a}=t;switch(e.type){case 1:{let t=I(e.left,i),o=I(e.top,a),s=n+t,c=r+o,l=Math.max(0,i-t-I(e.right,i)),u=Math.max(0,a-o-I(e.bottom,a));return new Il(e=>{e.beginPath(),e.rect(s,c,l,u),e.clip()})}case 2:{let t=n+I(e.cx,i),o=r+I(e.cy,a),s;return s=e.radius===`closest-side`?Math.min(t-n,o-r,n+i-t,r+a-o):e.radius===`farthest-side`?Math.max(t-n,o-r,n+i-t,r+a-o):I(e.radius,Math.sqrt(i*i+a*a)/Math.SQRT2),new Il(e=>{e.beginPath(),e.arc(t,o,Math.max(0,s),0,Math.PI*2),e.clip()})}case 3:{let t=n+I(e.cx,i),o=r+I(e.cy,a),s=Yl(e.rx,t,n,n+i,i),c=Yl(e.ry,o,r,r+a,a);return new Il(e=>{e.beginPath(),e.ellipse(t,o,Math.max(0,s),Math.max(0,c),0,0,Math.PI*2),e.clip()})}case 4:{let t=e.points.map(([e,t])=>[n+I(e,i),r+I(t,a)]);return new Il(e=>{if(e.beginPath(),t.length>0){e.moveTo(t[0][0],t[0][1]);for(let n=1;n<t.length;n++)e.lineTo(t[n][0],t[n][1]);e.closePath()}e.clip()})}case 5:{let{d:t}=e,i=null;return new Il(e=>{try{i||=new Path2D(t);let a=e.getTransform();e.translate(n,r),e.clip(i),e.setTransform(a)}catch{}})}case 0:return null;default:return null}},Zl=(e,t,n,r)=>{e.container.elements.forEach(i=>{let a=i.createsRealStackingContext,o=i.createsStackingContext,s=new ql(i,e);H(i.styles.display,2048)&&r.push(s);let c=i.isListOwner?[]:r;if(a||o){let e=a||i.styles.isPositioned()?n:t,r=new Kl(s);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){let t=i.styles.zIndex.order;if(t<0){let n=0;e.negativeZIndex.some((e,r)=>t>e.element.container.styles.zIndex.order?(n=r,!1):n>0),e.negativeZIndex.splice(n,0,r)}else if(t>0){let n=0;e.positiveZIndex.some((e,r)=>t>=e.element.container.styles.zIndex.order?(n=r+1,!1):n>0),e.positiveZIndex.splice(n,0,r)}else e.zeroOrAutoZIndexOrTransformedOrOpacity.push(r)}else i.styles.isFloating()?e.nonPositionedFloats.push(r):e.nonPositionedInlineLevel.push(r);Zl(s,r,a?r:n,c)}else i.styles.isInlineLevel()?t.inlineLevel.push(s):t.nonInlineLevel.push(s),Zl(s,t,n,c);i.isListOwner&&Ql(i,c)})},Ql=(e,t)=>{let n=e instanceof sl?e.start:1,r=e instanceof sl&&e.reversed;for(let e=0;e<t.length;e++){let i=t[e];i.container instanceof ol&&typeof i.container.value==`number`&&i.container.value!==0&&(n=i.container.value),i.listValue=Di(n,i.container.styles.listStyleType,!0),n+=r?-1:1}},$l=e=>{let t=new ql(e,null),n=new Kl(t),r=[];return Zl(t,n,n,r),Ql(t.container,r),n},eu=e=>{let t=e.bounds,n=e.styles;return t.add(n.borderLeftWidth,n.borderTopWidth,-(n.borderRightWidth+n.borderLeftWidth),-(n.borderTopWidth+n.borderBottomWidth))},tu=e=>{let t=e.styles,n=e.bounds,r=I(t.paddingLeft,n.width),i=I(t.paddingRight,n.width),a=I(t.paddingTop,n.width),o=I(t.paddingBottom,n.width);return n.add(r+t.borderLeftWidth,a+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+r+i),-(t.borderTopWidth+t.borderBottomWidth+a+o))},nu=(e,t)=>e===0?t.bounds:e===2?tu(t):eu(t),ru=(e,t)=>e===0?t.bounds:e===2?tu(t):eu(t),iu=(e,t,n)=>{let r=nu(cu(e.styles.backgroundOrigin,t),e),i=ru(cu(e.styles.backgroundClip,t),e),a=su(cu(e.styles.backgroundSize,t),n,r),[o,s]=a,c=wn(cu(e.styles.backgroundPosition,t),r.width-o,r.height-s),l=lu(cu(e.styles.backgroundRepeat,t),c,a,r,i),u=Math.round(r.left+c[0]),d=Math.round(r.top+c[1]);return o=Math.max(1,o),s=Math.max(1,s),[l,u,d,o,s]},au=e=>O(e)&&e.value===`auto`,ou=e=>typeof e==`number`,su=(e,[t,n,r],i)=>{let[a,o]=e;if(!a)return[0,0];if(N(a)&&o&&N(o))return[I(a,i.width),I(o,i.height)];let s=ou(r);if(O(a)&&(a.value===`contain`||a.value===`cover`))return ou(r)?i.width/i.height<r==(a.value===`cover`)?[i.height*r,i.height]:[i.width,i.width/r]:[i.width,i.height];let c=ou(t),l=ou(n),u=c||l;if(au(a)&&(!o||au(o)))return c&&l?[t,n]:!s&&!u?[i.width,i.height]:u&&s?[c?t:n*r,l?n:t/r]:[c?t:i.width,l?n:i.height];if(s){let e=0,t=0;return N(a)?e=I(a,i.width):N(o)&&(t=I(o,i.height)),au(a)?e=t*r:(!o||au(o))&&(t=e/r),[e,t]}let d=null,f=null;if(N(a)?d=I(a,i.width):o&&N(o)&&(f=I(o,i.height)),d!==null&&(!o||au(o))&&(f=c&&l?d/t*n:i.height),f!==null&&au(a)&&(d=c&&l?f/n*t:i.width),d!==null&&f!==null)return[d,f];throw Error(`Unable to calculate background-size for element`)},cu=(e,t)=>{let n=e[t];return n===void 0?e[0]:n},lu=(e,[t,n],[r,i],a,o)=>{switch(e){case 2:return[new X(Math.round(a.left),Math.round(a.top+n)),new X(Math.round(a.left+a.width),Math.round(a.top+n)),new X(Math.round(a.left+a.width),Math.round(i+a.top+n)),new X(Math.round(a.left),Math.round(i+a.top+n))];case 3:return[new X(Math.round(a.left+t),Math.round(a.top)),new X(Math.round(a.left+t+r),Math.round(a.top)),new X(Math.round(a.left+t+r),Math.round(a.height+a.top)),new X(Math.round(a.left+t),Math.round(a.height+a.top))];case 1:return[new X(Math.round(a.left+t),Math.round(a.top+n)),new X(Math.round(a.left+t+r),Math.round(a.top+n)),new X(Math.round(a.left+t+r),Math.round(a.top+n+i)),new X(Math.round(a.left+t),Math.round(a.top+n+i))];default:return[new X(Math.round(o.left),Math.round(o.top)),new X(Math.round(o.left+o.width),Math.round(o.top)),new X(Math.round(o.left+o.width),Math.round(o.height+o.top)),new X(Math.round(o.left),Math.round(o.height+o.top))]}};var uu=class{constructor(e){this.ctx=e}render(e,t){this.ctx.fillStyle=z(t.textDecorationColor||t.color);let n=1;typeof t.textDecorationThickness==`number`?n=t.textDecorationThickness:t.textDecorationThickness===`from-font`&&(n=Math.max(1,Math.floor(t.fontSize.number*.05)));let r=0;typeof t.textUnderlineOffset==`number`&&(r=t.textUnderlineOffset);let i=t.textDecorationStyle;t.textDecorationLine.forEach(t=>{let a=0;switch(t){case 1:a=e.top+e.height-n+r;break;case 2:a=e.top;break;case 3:a=e.top+(e.height/2-n/2);break;default:return}this.draw(e.left,a,e.width,n,i)})}draw(e,t,n,r,i){switch(i){case 0:this.ctx.fillRect(e,t,n,r);break;case 1:{let i=Math.max(1,r);this.ctx.fillRect(e,t,n,r),this.ctx.fillRect(e,t+r+i,n,r);break}case 2:this.drawPattern(e,t,n,r,[r,r*2]);break;case 3:this.drawPattern(e,t,n,r,[r*3,r*2]);break;case 4:this.drawWavy(e,t,n,r);break;default:this.ctx.fillRect(e,t,n,r)}}drawPattern(e,t,n,r,i){this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash(i),this.ctx.lineWidth=r,this.ctx.strokeStyle=this.ctx.fillStyle,this.ctx.moveTo(e,t+r/2),this.ctx.lineTo(e+n,t+r/2),this.ctx.stroke(),this.ctx.restore()}drawWavy(e,t,n,r){this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=r,this.ctx.strokeStyle=this.ctx.fillStyle;let i=r*2,a=r*4,o=e;for(this.ctx.moveTo(o,t+r/2);o<e+n;){let s=Math.min(o+a/2,e+n);if(this.ctx.quadraticCurveTo(o+a/4,t+r/2-i,s,t+r/2),o=s,o<e+n){let s=Math.min(o+a/2,e+n);this.ctx.quadraticCurveTo(o+a/4,t+r/2+i,s,t+r/2),o=s}}this.ctx.stroke(),this.ctx.restore()}};let du=(e,t)=>{let n=e.measureText(`Mg`),r=n.fontBoundingBoxAscent,i=r!==void 0&&!Number.isNaN(r)?r:n.actualBoundingBoxAscent;return i!==void 0&&!Number.isNaN(i)?i:t},fu=[`-apple-system`,`system-ui`],pu=/[\u2E80-\u2FFF\u3000-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF01-\uFFEF]/,mu=e=>pu.test(e),hu=()=>{if(typeof navigator>`u`)return null;let e=navigator.userAgent,t=/iPhone|iPad|iPod/.test(e),n=/Macintosh/.test(e)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1;if(!t&&!n)return null;for(let t of[/(?:iPhone|CPU(?:\siPhone)?)\sOS\s(\d+)[\._](\d+)/,/Version\/(\d+)\.(\d+)/]){let n=e.match(t);if(n&&n[1])return parseInt(n[1],10)}return null},gu=e=>{let t=hu();return t!==null&&t>=15&&t<17?e.map(e=>fu.indexOf(e)===-1?e:`-apple-system, "Helvetica Neue", Arial, sans-serif`):e},_u=()=>(typeof window<`u`?window:void 0)?.chrome?`miter`:`round`;var vu=class{constructor(e){this.glyphWidthCache=null,this.ctx=e.ctx,this.options=e.options,this.decorationRenderer=new uu(e.ctx)}cachedMeasureText(e,t){let n=this.glyphWidthCache;n||(n=new Map,this.glyphWidthCache=n);let r=e+t,i=n.get(r);return i===void 0&&(i=this.ctx.measureText(e).width,n.set(r,i)),i}iterateLettersWithLetterSpacing(e,t,n,r,i){if(xo(r)){this.iterateVerticalGlyphs(e,t,n,r,i);return}let a=Jc(e.text),o=e.bounds.top+n,s=this.ctx.font,c=e.bounds.left;for(let e of a){if(mu(e)){let t=this.ctx.textBaseline;this.ctx.textBaseline=`ideographic`,i(e,c,o),this.ctx.textBaseline=t}else i(e,c,o);c+=this.cachedMeasureText(e,s)+t}}iterateVerticalGlyphs(e,t,n,r,i){let a=Jc(e.text),o=this.ctx.font,s=r===4?-Math.PI/2:Math.PI/2,c=e.bounds.top;for(let l=0;l<a.length;){let u=a[l];if(!(So(r)||!mu(u)&&u.trim().length>0)){let r=this.ctx.textBaseline;mu(u)&&(this.ctx.textBaseline=`ideographic`),i(u,e.bounds.left,c+n),this.ctx.textBaseline=r,c+=this.cachedMeasureText(u,o)+t,l++;continue}let d=l;for(;l<a.length;){let e=a[l];if(!So(r)&&!mu(e)&&e.trim().length===0)break;if(So(r)||!mu(e)&&e.trim().length>0)l++;else break}this.ctx.save(),this.ctx.translate(e.bounds.left+n,c),this.ctx.rotate(s);let f=0;for(let e=d;e<l;e++)i(a[e],0,f),f+=this.cachedMeasureText(a[e],o)+t;this.ctx.restore(),c+=f}}renderTextWithLetterSpacing(e,t,n,r=0){this.renderFillText(e,t,n,r)}canRenderWholeText(e,t){return e===0&&!xo(t)}renderFillText(e,t,n,r){this.canRenderWholeText(t,r)?this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+n):this.iterateLettersWithLetterSpacing(e,t,n,r,(e,t,n)=>{this.ctx.fillText(e,t,n)})}renderStrokeText(e,t,n,r){this.canRenderWholeText(t,r)?this.ctx.strokeText(e.text,e.bounds.left,e.bounds.top+n):this.iterateLettersWithLetterSpacing(e,t,n,r,(e,t,n)=>{this.ctx.strokeText(e,t,n)})}renderTextStrokeWithStyle(e,t,n){!t.webkitTextStrokeWidth||!e.text.trim().length||(this.ctx.strokeStyle=z(t.webkitTextStrokeColor),this.ctx.lineWidth=t.webkitTextStrokeWidth,this.ctx.lineJoin=_u(),this.renderStrokeText(e,t.letterSpacing,n,t.writingMode),this.ctx.strokeStyle=``,this.ctx.lineWidth=0,this.ctx.lineJoin=`miter`)}renderTextFillWithShadows(e,t,n){this.ctx.fillStyle=z(t.color),this.renderTextWithLetterSpacing(e,t.letterSpacing,n,t.writingMode);let r=t.textShadow;r.length&&e.text.trim().length&&(r.slice(0).reverse().forEach(r=>{this.ctx.shadowColor=z(r.color),this.ctx.shadowOffsetX=r.offsetX.number*this.options.scale,this.ctx.shadowOffsetY=r.offsetY.number*this.options.scale,this.ctx.shadowBlur=r.blur.number,this.renderTextWithLetterSpacing(e,t.letterSpacing,n,t.writingMode)}),this.ctx.shadowColor=``,this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.ctx.shadowBlur=0)}renderTextBoundWithPaintOrder(e,t,n,r){n.forEach(n=>{switch(n){case 0:this.ctx.fillStyle=z(t.color),this.renderTextWithLetterSpacing(e,t.letterSpacing,r,t.writingMode);break;case 1:this.renderTextStrokeWithStyle(e,t,r);break}})}renderTextDecoration(e,t){this.decorationRenderer.render(e,t)}truncateTextWithEllipsis(e,t,n){let r=this.ctx.measureText(`…`).width,i=Jc(e);if(n===0){let e=e=>this.ctx.measureText(i.slice(0,e).join(``)).width+r<=t,n=0,a=i.length;for(;n<a;){let t=n+a+1>>1;e(t)?n=t:a=t-1}return i.slice(0,n).join(``)+`…`}else{let e=this.ctx.font,a=r,o=[];for(let r of i){let i=this.cachedMeasureText(r,e);if(a+i>t)break;o.push(r),a+=i+n}return o.join(``)+`…`}}createFontStyle(e){let t=e.fontVariant.filter(e=>e===`normal`||e===`small-caps`).join(``),n=gu(e.fontFamily).join(`, `),r=E(e.fontSize)?`${e.fontSize.number}${e.fontSize.unit}`:`${e.fontSize.number}px`;return[[e.fontStyle,t,e.fontWeight,r,n].join(` `),n,r]}renderLineClampedText(e,t,n,r,i){let a=t.fontSize.number*1.5,o=[],s=[],c=e.textBounds[0].bounds.top;e.textBounds.forEach(e=>{Math.abs(e.bounds.top-c)>=a*.5?(s.length>0&&o.push(s),s=[e],c=e.bounds.top):s.push(e)}),s.length>0&&o.push(s);let l=t.webkitLineClamp;if(o.length<=l)return!1;for(let e=0;e<l-1;e++)o[e].forEach(e=>this.renderTextBoundWithPaintOrder(e,t,n,r));let u=o[l-1];if(u?.length&&i){let e=u.map(e=>e.text).join(``),a=u[0],o=i.width-(a.bounds.left-i.left),s=new Wc(this.truncateTextWithEllipsis(e,o,t.letterSpacing),a.bounds);for(let e of n)e===0?(this.ctx.fillStyle=z(t.color),this.renderTextWithLetterSpacing(s,t.letterSpacing,r,t.writingMode)):e===1&&this.renderTextStrokeWithStyle(s,t,r)}return!0}renderEllipsisText(e,t,n,r,i){let a=t.fontSize.number*1.5,o=e.textBounds[0].bounds.top;if(!e.textBounds.every(e=>Math.abs(e.bounds.top-o)<a*.5))return!1;let s=e.textBounds.map(e=>e.text).join(``).replace(/\s+/g,` `).trim();if(this.ctx.measureText(s).width<=i.width+1)return!1;let c=new Wc(this.truncateTextWithEllipsis(s,i.width,t.letterSpacing),e.textBounds[0].bounds);for(let e of n)e===0?this.renderTextFillWithShadows(c,t,r):e===1&&this.renderTextStrokeWithStyle(c,t,r);return!0}async renderTextNode(e,t,n){this.glyphWidthCache=null;let[r]=this.createFontStyle(t);this.ctx.font=r,this.ctx.direction=t.direction===1?`rtl`:`ltr`,this.ctx.textAlign=`left`,this.ctx.textBaseline=`alphabetic`;let i=t.paintOrder,a=du(this.ctx,t.fontSize.number);t.webkitLineClamp>0&&t.display&2&&t.overflowY===1&&e.textBounds.length>0&&this.renderLineClampedText(e,t,i,a,n)||t.textOverflow===1&&n&&t.overflowX===1&&e.textBounds.length>0&&this.renderEllipsisText(e,t,i,a,n)||e.textBounds.forEach(e=>{i.forEach(n=>{n===0?(this.renderTextFillWithShadows(e,t,a),t.textDecorationLine.length&&this.renderTextDecoration(e.bounds,t)):n===1&&this.renderTextStrokeWithStyle(e,t,a)})})}};let yu=(e,t)=>{t.forEach((t,n)=>{let r=Z(t)?t.start:t;n===0?e.moveTo(r.x,r.y):e.lineTo(r.x,r.y),Z(t)&&e.bezierCurveTo(t.startControl.x,t.startControl.y,t.endControl.x,t.endControl.y,t.end.x,t.end.y)})},bu=(e,t)=>{e.beginPath(),yu(e,t),e.closePath()};var xu=class{constructor(e){this.maxSize=e,this._map=new Map}get(e){if(!this._map.has(e))return;let t=this._map.get(e);return this._map.delete(e),this._map.set(e,t),t}set(e,t){if(this._map.has(e))this._map.delete(e);else if(this._map.size>=this.maxSize){let e=this._map.keys().next().value;e!==void 0&&this._map.delete(e)}this._map.set(e,t)}get size(){return this._map.size}clear(){this._map.clear()}},Su=class{constructor(e){this.patternCache=new xu(50),this.ctx=e.ctx,this.context=e.context,this.canvas=e.canvas}async renderBackgroundImage(e){let t=e.styles.backgroundImage.length-1,n=e.styles.backgroundBlendMode,r=0;for(let i of e.styles.backgroundImage.slice(0).reverse()){if(r>0){let e=n[r]??n[0]??`normal`;e!==`normal`&&(this.ctx.save(),this.ctx.globalCompositeOperation=e)}i.type===0?await this.renderBackgroundURLImage(e,i,t):Xi(i)?this.renderLinearGradient(e,i,t):Qi(i)?this.renderRepeatingLinearGradient(e,i,t):Zi(i)&&this.renderRadialGradient(e,i,t),r>0&&(n[r]??n[0]??`normal`)!==`normal`&&this.ctx.restore(),t--,r++}}async renderBackgroundURLImage(e,t,n){let r,i=t.url;try{r=await this.context.cache.match(i)}catch(e){this.context.logger.error(`Error loading background-image ${i}`),this.context.onError?.(e instanceof Error?e:Error(String(e)))}if(r){let t=isNaN(r.width)||r.width===0?1:r.width,a=isNaN(r.height)||r.height===0?1:r.height,[o,s,c,l,u]=iu(e,n,[t,a,t/a]),d=cu(e.styles.backgroundRepeat,n),f=d===1?`no-repeat`:d===2?`repeat-x`:d===3?`repeat-y`:`repeat`,p=`${i}|${Math.round(l)}x${Math.round(u)}|${e.styles.imageRendering}|${f}`,m=this.patternCache.get(p);if(!m){let t=this.resizeImage(r,l,u,e.styles.imageRendering);m=this.ctx.createPattern(t,f),this.patternCache.set(p,m)}this.renderRepeat(o,m,s,c)}}renderRepeatingLinearGradient(e,t,n){let[r,i,a,o,s]=iu(e,n,[null,null,null]),[c,l,u,d,f]=Ni(t.angle,o,s),p=ji(t.stops,c||1),m=p[p.length-1],h=p[0],g=m.stop-h.stop;if(g<=0){this.renderLinearGradient(e,t,n);return}let _=u-l,v=f-d,y=g/(Math.sqrt(_*_+v*v)||1),b=l,x=d,ee=l+_*y,te=d+v*y,S=this.canvas.ownerDocument??document,ne=`rlg|${t.angle}|${Math.round(g)}|${JSON.stringify(t.stops)}`,re=this.patternCache.get(ne);if(!re){let e=S.createElement(`canvas`),t=Math.max(1,Math.ceil(g));e.width=t,e.height=t;let n=e.getContext(`2d`);if(!n)return;let r=n.createLinearGradient(b-i,x-a,ee-i,te-a);p.forEach(e=>{r.addColorStop((e.stop-h.stop)/g,z(e.color))}),n.fillStyle=r,n.fillRect(0,0,t,t),t>0&&(re=this.ctx.createPattern(e,`repeat`),this.patternCache.set(ne,re))}re&&this.renderRepeat(r,re,i,a)}renderLinearGradient(e,t,n){let[r,i,a,o,s]=iu(e,n,[null,null,null]),[c,l,u,d,f]=Ni(t.angle,o,s),p=`lg|${t.angle}|${Math.round(o)}x${Math.round(s)}|${JSON.stringify(t.stops)}`,m=this.patternCache.get(p);if(!m){let e=(this.canvas.ownerDocument??document).createElement(`canvas`);e.width=o,e.height=s;let n=e.getContext(`2d`);if(!n)return;let r=n.createLinearGradient(l,d,u,f);ji(t.stops,c||1).forEach(e=>r.addColorStop(e.stop,z(e.color))),n.fillStyle=r,n.fillRect(0,0,o,s),o>0&&s>0&&(m=this.ctx.createPattern(e,`repeat`),this.patternCache.set(p,m))}m&&this.renderRepeat(r,m,i,a)}renderRadialGradient(e,t,n){let[r,i,a,o,s]=iu(e,n,[null,null,null]),c=t.position.length===0?[Cn]:t.position,l=I(c[0],o),u=I(c[c.length-1],s),[d,f]=Fi(t,l,u,o,s);if((d===0||f===0)&&(d=Math.max(d,.01),f=Math.max(f,.01)),d>0&&f>0){let e=`rg|${Math.round(l)}x${Math.round(u)}|${Math.round(d)}x${Math.round(f)}|${JSON.stringify(t.stops)}`,n=this.patternCache.get(e);if(!n){let r=this.canvas.ownerDocument??document,i=Math.ceil(Math.max(d,f)*2),a=r.createElement(`canvas`);a.width=i,a.height=i;let o=a.getContext(`2d`);if(o){let r=Math.max(d,f),i=o.createRadialGradient(r,r,0,r,r,r);ji(t.stops,r*2).forEach(e=>i.addColorStop(e.stop,z(e.color))),o.fillStyle=i,d!==f&&o.scale(1,f/d),o.fillRect(0,0,r*2,r*2),n=this.ctx.createPattern(a,`no-repeat`),this.patternCache.set(e,n)}}n&&(this.path(r),this.ctx.save(),this.ctx.clip(),this.ctx.translate(i+l-Math.max(d,f),a+u-Math.max(d,f)),this.ctx.fillStyle=n,this.ctx.fillRect(0,0,Math.max(d,f)*2,Math.max(d,f)*2),this.ctx.restore())}}renderRepeat(e,t,n,r){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(n,r),this.ctx.fill(),this.ctx.translate(-n,-r)}resizeImage(e,t,n,r){let i=(this.canvas.ownerDocument??document).createElement(`canvas`);i.width=Math.max(1,t),i.height=Math.max(1,n);let a=i.getContext(`2d`);return a?(r===2||r===1?(this.context.logger.debug(`Disabling image smoothing for background image due to CSS image-rendering`),a.imageSmoothingEnabled=!1):r===3?(this.context.logger.debug(`Enabling image smoothing for background image due to CSS image-rendering: smooth`),a.imageSmoothingEnabled=!0):a.imageSmoothingEnabled=this.ctx.imageSmoothingEnabled,this.ctx.imageSmoothingQuality&&(a.imageSmoothingQuality=this.ctx.imageSmoothingQuality),a.drawImage(e,0,0,e.width,e.height,0,0,t,n),i):e}path(e){bu(this.ctx,e)}};let Cu=(e,t)=>{switch(t){case 0:return $(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return $(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return $(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);default:return $(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},wu=(e,t)=>{switch(t){case 0:return $(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return $(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return $(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);default:return $(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Tu=(e,t)=>{switch(t){case 0:return $(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return $(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return $(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);default:return $(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Eu=(e,t)=>{switch(t){case 0:return Du(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Du(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Du(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return Du(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},Du=(e,t)=>{let n=[];return Z(e)?n.push(e.subdivide(.5,!1)):n.push(e),Z(t)?n.push(t.subdivide(.5,!0)):n.push(t),n},$=(e,t,n,r)=>{let i=[];return Z(e)?i.push(e.subdivide(.5,!1)):i.push(e),Z(n)?i.push(n.subdivide(.5,!0)):i.push(n),Z(r)?i.push(r.subdivide(.5,!0).reverse()):i.push(r),Z(t)?i.push(t.subdivide(.5,!1).reverse()):i.push(t),i};var Ou=class{constructor(e,t){this.ctx=e.ctx,this.pathCallbacks=t}async renderSolidBorder(e,t,n){this.pathCallbacks.path(Cu(n,t)),this.ctx.fillStyle=z(e),this.ctx.fill()}async renderDoubleBorder(e,t,n,r){if(t<3){await this.renderSolidBorder(e,n,r);return}let i=wu(r,n);this.pathCallbacks.path(i),this.ctx.fillStyle=z(e),this.ctx.fill();let a=Tu(r,n);this.pathCallbacks.path(a),this.ctx.fill()}async renderDashedDottedBorder(e,t,n,r,i){this.ctx.save();let a=Eu(r,n),o=Cu(r,n);i===2&&(this.pathCallbacks.path(o),this.ctx.clip());let s,c,l,u;Z(o[0])?(s=o[0].start.x,c=o[0].start.y):(s=o[0].x,c=o[0].y),Z(o[1])?(l=o[1].end.x,u=o[1].end.y):(l=o[1].x,u=o[1].y);let d;d=Math.abs(n===0||n===2?s-l:c-u),this.ctx.beginPath(),i===3?this.pathCallbacks.formatPath(a):this.pathCallbacks.formatPath(o.slice(0,2));let f=t<3?t*3:t*2,p=t<3?t*2:t;i===3&&(f=t,p=t);let m=!0;if(d<=f*2)m=!1;else if(d<=f*2+p){let e=d/(2*f+p);f*=e,p*=e}else{let e=Math.floor((d+p)/(f+p)),t=(d-e*f)/(e-1),n=(d-(e+1)*f)/e;p=n<=0||Math.abs(p-t)<Math.abs(p-n)?t:n}if(m&&(i===3?this.ctx.setLineDash([0,f+p]):this.ctx.setLineDash([f,p])),i===3?(this.ctx.lineCap=`round`,this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=z(e),this.ctx.stroke(),this.ctx.setLineDash([]),i===2){if(Z(o[0])){let e=o[3],t=o[0];this.ctx.beginPath(),this.pathCallbacks.formatPath([new X(e.end.x,e.end.y),new X(t.start.x,t.start.y)]),this.ctx.stroke()}if(Z(o[1])){let e=o[1],t=o[2];this.ctx.beginPath(),this.pathCallbacks.formatPath([new X(e.end.x,e.end.y),new X(t.start.x,t.start.y)]),this.ctx.stroke()}}this.ctx.restore()}},ku=class{constructor(e){this.ctx=e}renderBorderImage(e,t,n,r,i,a,o,s){let c=t.naturalWidth||t.width,l=t.naturalHeight||t.height;if(c<=0||l<=0)return;let u=Math.min(n.unit===`percent`?n.top/100*l:Math.min(n.top,l),l),d=Math.min(n.unit===`percent`?n.right/100*c:Math.min(n.right,c),c),f=Math.min(n.unit===`percent`?n.bottom/100*l:Math.min(n.bottom,l),l),p=Math.min(n.unit===`percent`?n.left/100*c:Math.min(n.left,c),c),{left:m,top:h,width:g,height:_}=e;if(g<=0||_<=0)return;let v=Math.min(i,_),y=Math.min(a,g),b=Math.min(o,_-v),x=Math.min(s,g-y);this.drawRegion(t,0,0,p,u,m,h,x,v),this.drawRegion(t,c-d,0,d,u,m+g-y,h,y,v),this.drawRegion(t,c-d,l-f,d,f,m+g-y,h+_-b,y,b),this.drawRegion(t,0,l-f,p,f,m,h+_-b,x,b);let ee=[{sx:p,sy:0,sw:c-p-d,sh:u,dx:m+x,dy:h,dw:g-x-y,dh:v,repeat:r.horizontal},{sx:c-d,sy:u,sw:d,sh:l-u-f,dx:m+g-y,dy:h+v,dw:y,dh:_-v-b,repeat:r.vertical},{sx:p,sy:l-f,sw:c-p-d,sh:f,dx:m+x,dy:h+_-b,dw:g-x-y,dh:b,repeat:r.horizontal},{sx:0,sy:u,sw:p,sh:l-u-f,dx:m,dy:h+v,dw:x,dh:_-v-b,repeat:r.vertical}];for(let e of ee){if(e.sw<=0||e.sh<=0||e.dw<=0||e.dh<=0)continue;let n=e.dw>=e.dh;e.repeat===0?this.ctx.drawImage(t,e.sx,e.sy,e.sw,e.sh,e.dx,e.dy,e.dw,e.dh):(e.repeat===1||e.repeat===2)&&this.drawRepeatedEdge(t,e,n,e.repeat===2)}if(n.fill){let e=p,n=u,r=c-p-d,i=l-u-f,a=m+x,o=h+v,s=g-x-y,ee=_-v-b;this.drawRegion(t,e,n,r,i,a,o,s,ee)}}drawRegion(e,t,n,r,i,a,o,s,c){r>0&&i>0&&s>0&&c>0&&this.ctx.drawImage(e,t,n,r,i,a,o,s,c)}drawRepeatedEdge(e,t,n,r){let i=n?t.sw:t.sh,a=n?t.dw:t.dh;if(i<=0||a<=0)return;let o,s;r?(s=Math.max(1,Math.round(a/i)),o=a/s):(o=i,s=Math.ceil(a/o)),this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(t.dx,t.dy,t.dw,t.dh),this.ctx.clip();for(let r=0;r<s;r++){let i=r*o,s=a-i,c=Math.min(o,s);if(c<=0)break;n?this.ctx.drawImage(e,t.sx,t.sy,t.sw,t.sh,t.dx+i,t.dy,c,t.dh):this.ctx.drawImage(e,t.sx,t.sy,t.sw,t.sh,t.dx,t.dy+i,t.dw,c)}this.ctx.restore()}},Au=class{constructor(e,t){this.activeEffects=[],this.didSave=!1,this.saveAtDepth=-1,this.ctx=e.ctx,this.pathCallback=t}applyEffects(e){for(;this.activeEffects.length;)this.popEffect();this.didSave=!1,this.saveAtDepth=-1;let t=e=>Bl(e)||Vl(e)||Ul(e),n=e.reduceRight((e,n,r)=>e===-1?t(n)?r:-1:e,-1);for(let r=0;r<e.length;r++){let i=e[r];t(i)&&(this.didSave||=(this.ctx.save(),!0),r===n&&(this.saveAtDepth=this.activeEffects.length)),this.applyEffect(i)}}applyEffect(e){Bl(e)?(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)):Vl(e)?(this.pathCallback.path(e.path),this.ctx.clip()):Ul(e)?e.applyClip(this.ctx):Hl(e)?this.ctx.globalAlpha*=e.opacity:Wl(e)?this.ctx.globalCompositeOperation=e.compositeOperation:Gl(e)&&(this.ctx.filter=e.safeFilterString||`none`,e.shadow&&(this.ctx.shadowOffsetX=e.shadow.offsetX,this.ctx.shadowOffsetY=e.shadow.offsetY,this.ctx.shadowBlur=e.shadow.blur,this.ctx.shadowColor=e.shadow.color)),this.activeEffects.push(e)}popEffect(){this.activeEffects.length!==0&&(this.didSave&&this.activeEffects.length-1===this.saveAtDepth&&(this.ctx.restore(),this.didSave=!1,this.saveAtDepth=-1),this.activeEffects.pop(),!this.didSave&&this.activeEffects.length===0&&(this.ctx.globalAlpha=1,this.ctx.globalCompositeOperation=`source-over`,this.ctx.filter=`none`,this.ctx.shadowOffsetX=0,this.ctx.shadowOffsetY=0,this.ctx.shadowBlur=0,this.ctx.shadowColor=`rgba(0, 0, 0, 0)`))}getActiveEffectCount(){return this.activeEffects.length}hasActiveEffects(){return this.activeEffects.length>0}};let ju=(e,t,n,r,i)=>{let a=0,o=0,s=e,c=t,l=n.left,u=n.top,d=n.width,f=n.height,p=d/f,m=s/c,h=i?I(i[0],1):.5,g=i?I(i[1],1):.5;return r===2?m>p?(f=d/m,u+=(n.height-f)*g):(d=f*m,l+=(n.width-d)*h):r===4?m>p?(s=c*p,a+=(e-s)*h):(c=s/p,o+=(t-c)*g):r===8?(s>d?(a+=(s-d)*h,s=d):(l+=(d-s)*h,d=s),c>f?(o+=(c-f)*g,c=f):(u+=(f-c)*g,f=c)):r===16&&((m>p?d:f*m)<(s>d?s:d)?m>p?(f=d/m,u+=(n.height-f)*g):(d=f*m,l+=(n.width-d)*h):(s>d?(a+=(s-d)*h,s=d):(l+=(d-s)*h,d=s),c>f?(o+=(c-f)*g,c=f):(u+=(f-c)*g,f=c))),{sx:a,sy:o,sw:s,sh:c,dx:l,dy:u,dw:d,dh:f}};async function Mu(e,t,n,r,i,a,o,s){if(i instanceof rl)try{let n=await t.cache.match(i.src),r=e.imageSmoothingEnabled;o.imageRendering===2||o.imageRendering===1?e.imageSmoothingEnabled=!1:o.imageRendering===3&&(e.imageSmoothingEnabled=!0),s(i,a,n),e.imageSmoothingEnabled=r}catch(e){t.logger.error(`Error loading image ${i.src}`),t.onError?.(e instanceof Error?e:Error(String(e)))}if(i instanceof il&&s(i,a,i.canvas),i instanceof al)try{s(i,a,await t.cache.match(i.svg))}catch(e){t.logger.error(`Error loading svg ${i.svg.substring(0,255)}`),t.onError?.(e instanceof Error?e:Error(String(e)))}if(i instanceof _l&&i.tree){let a=await r(t,{scale:n.scale,backgroundColor:i.backgroundColor,x:0,y:0,width:i.width,height:i.height}).render(i.tree);i.width&&i.height&&e.drawImage(a,0,0,i.width,i.height,i.bounds.left,i.bounds.top,i.bounds.width,i.bounds.height)}}function Nu(e,t,n,r,i){if(r instanceof ml){let t=Math.min(r.bounds.width,r.bounds.height);r.type===`checkbox`&&r.checked?(e.save(),n([new X(r.bounds.left+t*.39363,r.bounds.top+t*.79),new X(r.bounds.left+t*.16,r.bounds.top+t*.5549),new X(r.bounds.left+t*.27347,r.bounds.top+t*.44071),new X(r.bounds.left+t*.39694,r.bounds.top+t*.5649),new X(r.bounds.left+t*.72983,r.bounds.top+t*.23),new X(r.bounds.left+t*.84,r.bounds.top+t*.34085),new X(r.bounds.left+t*.39363,r.bounds.top+t*.79)]),e.fillStyle=z(pl),e.fill(),e.restore()):r.type===`radio`&&r.checked&&(e.save(),e.beginPath(),e.arc(r.bounds.left+t/2,r.bounds.top+t/2,t/4,0,Math.PI*2,!0),e.fillStyle=z(pl),e.fill(),e.restore())}if(Iu(r)&&r.value.length){let[o]=t.createFontStyle(i);e.font=o;let s=du(e,I(i.fontSize,0));e.fillStyle=r instanceof ml&&r.isPlaceholder?z(1970632191):z(i.color),e.textBaseline=`alphabetic`,e.textAlign=Lu(r.styles.textAlign);let c=tu(r),l=0;switch(r.styles.textAlign){case 1:l+=c.width/2;break;case 2:l+=c.width;break}let u=0;if(r instanceof ml){let e=I(i.fontSize,0);u=(c.height-e)/2}let d=c.add(l,u,0,0);e.save(),n([new X(c.left,c.top),new X(c.left+c.width,c.top),new X(c.left+c.width,c.top+c.height),new X(c.left,c.top+c.height)]),e.clip();let f=Pu(e,r.value,c.width,i.whiteSpace===`pre`||i.whiteSpace===`nowrap`),p=I(i.fontSize,0),m=Ka(i.lineHeight,p);f.forEach((n,r)=>{let o=d.left,l=e.measureText(n).width;switch(i.textAlign){case 1:o+=(c.width-l)/2;break;case 2:o+=c.width-l;break}let u=new a(o,d.top+r*m,0,0);t.renderTextWithLetterSpacing(new Wc(n,u),i.letterSpacing,s,i.writingMode)}),e.restore(),e.textBaseline=`alphabetic`,e.textAlign=`left`}}let Pu=(e,t,n,r)=>{let i=[],a=t.split(`
11
- `);for(let t of a){if(r){i.push(t);continue}let a=t.split(/(\s+)/),o=``;for(let t of a){let r=o+t;e.measureText(r).width<=n||o===``?o=r:(i.push(o),o=t)}i.push(o)}return i};async function Fu(e,t,n,r,i,o){if(H(i.styles.display,2048)){if(i.styles.listStyleImage!==null){let n=i.styles.listStyleImage;if(n.type===0){let r=n.url;try{let n=await t.cache.match(r);e.drawImage(n,i.bounds.left-(n.width+10),i.bounds.top)}catch(e){t.logger.error(`Error loading list-style-image ${r}`),t.onError?.(e instanceof Error?e:Error(String(e)))}}}else if(r.listValue&&i.styles.listStyleType!==-1){let[t]=n.createFontStyle(o);e.font=t,e.fillStyle=z(o.color),e.textBaseline=`middle`,e.textAlign=`right`;let s=new a(i.bounds.left,i.bounds.top+I(i.styles.paddingTop,i.bounds.width),i.bounds.width,Ka(o.lineHeight,o.fontSize.number)/2+1);n.renderTextWithLetterSpacing(new Wc(r.listValue,s),o.letterSpacing,Ka(o.lineHeight,o.fontSize.number)/2+2,o.writingMode),e.textBaseline=`bottom`,e.textAlign=`left`}}}let Iu=e=>e instanceof gl||e instanceof hl||e instanceof ml&&e.type!==`radio`&&e.type!==`checkbox`,Lu=e=>{switch(e){case 1:return`center`;case 2:return`right`;default:return`left`}};var Ru=class e{constructor(e,t){this.context=e,this.options=t,this.canvas=t.canvas?t.canvas:document.createElement(`canvas`);let n=this.canvas.getContext(`2d`);if(!n)throw Error(`Failed to get 2D rendering context from canvas`);this.ctx=n,t.canvas||(this.canvas.width=Math.floor(t.width*t.scale),this.canvas.height=Math.floor(t.height*t.scale),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`),this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-t.x,-t.y),this.ctx.textBaseline=`bottom`,t.imageSmoothing!==void 0&&(this.ctx.imageSmoothingEnabled=t.imageSmoothing),t.imageSmoothingQuality&&(this.ctx.imageSmoothingQuality=t.imageSmoothingQuality),this.backgroundRenderer=new Su({ctx:this.ctx,context:this.context,canvas:this.canvas,options:{width:t.width,height:t.height,scale:t.scale}}),this.borderRenderer=new Ou({ctx:this.ctx},{path:e=>this.path(e),formatPath:e=>this.formatPath(e)}),this.borderImageRenderer=new ku(this.ctx),this.effectsRenderer=new Au({ctx:this.ctx},{path:e=>this.path(e)}),this.textRenderer=new vu({ctx:this.ctx,options:{scale:t.scale}}),this.context.logger.debug(`Canvas renderer initialized (${t.width}x${t.height}) with scale ${t.scale}`)}async renderStack(e){e.element.container.styles.isVisible()&&await this.renderStackContent(e)}async renderNode(e){if(e.container.debugRender)debugger;e.container.styles.isVisible()&&(await this.renderNodeBackgroundAndBorders(e),await this.renderNodeContent(e))}renderReplacedElement(e,t,n){let r=n.naturalWidth||e.intrinsicWidth,i=n.naturalHeight||e.intrinsicHeight;if(n&&r>0&&i>0){let a=tu(e),o=Ml(t);this.path(o),this.ctx.save(),this.ctx.clip();let{sx:s,sy:c,sw:l,sh:u,dx:d,dy:f,dw:p,dh:m}=ju(r,i,a,e.styles.objectFit,e.styles.objectPosition);this.ctx.drawImage(n,s,c,l,u,d,f,p,m),this.ctx.restore()}}async renderNodeContent(t){this.effectsRenderer.applyEffects(t.getEffects(4));let n=t.container,r=t.curves,i=n.styles,a=tu(n);for(let e of n.textNodes)await this.textRenderer.renderTextNode(e,i,a);await Mu(this.ctx,this.context,{scale:this.options.scale,backgroundColor:this.options.backgroundColor,x:this.options.x,y:this.options.y,width:this.options.width,height:this.options.height},(t,n)=>new e(t,n),n,r,i,(e,t,n)=>this.renderReplacedElement(e,t,n)),Nu(this.ctx,this.textRenderer,this.path.bind(this),n,i),await Fu(this.ctx,this.context,this.textRenderer,t,n,i)}async renderStackContent(e){if(e.element.container.debugRender)debugger;let t=this.options.signal;await this.renderNodeBackgroundAndBorders(e.element);for(let n of e.negativeZIndex){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderNodeContent(e.element);for(let t of e.nonInlineLevel)await this.renderNode(t);for(let n of e.nonPositionedFloats){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}for(let n of e.nonPositionedInlineLevel){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}for(let t of e.inlineLevel)await this.renderNode(t);for(let n of e.zeroOrAutoZIndexOrTransformedOrOpacity){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}for(let n of e.positiveZIndex){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}}mask(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.options.width,0),this.ctx.lineTo(this.options.width,this.options.height),this.ctx.lineTo(0,this.options.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()}path(e){bu(this.ctx,e)}formatPath(e){yu(this.ctx,e)}async renderNodeBackgroundAndBorders(e){this.effectsRenderer.applyEffects(e.getEffects(2));let t=e.container.styles,n=!R(t.backgroundColor)||t.backgroundImage.length,r=Bu(t),i=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],a=cu(t.backgroundClip,0),o=zu(a,e.curves);if((n||t.boxShadow.length)&&(r&&e.container.textNodes.length>0?await this.renderTextClippedBackground(e):(this.ctx.save(),this.path(o),this.ctx.clip(),R(t.backgroundColor)||(this.ctx.fillStyle=z(t.backgroundColor),this.ctx.fill()),await this.backgroundRenderer.renderBackgroundImage(e.container),this.ctx.restore()),t.boxShadow.slice(0).reverse().forEach(t=>{this.ctx.save();let n=Al(e.curves),r=t.inset?0:1e4,i=El(n,-r+(t.inset?1:-1)*t.spread.number,(t.inset?1:-1)*t.spread.number,t.spread.number*(t.inset?-2:2),t.spread.number*(t.inset?-2:2));t.inset?(this.path(n),this.ctx.clip(),this.mask(i)):(this.mask(n),this.ctx.clip(),this.path(i)),this.ctx.shadowOffsetX=t.offsetX.number+r,this.ctx.shadowOffsetY=t.offsetY.number,this.ctx.shadowColor=z(t.color),this.ctx.shadowBlur=t.blur.number,this.ctx.fillStyle=t.inset?z(t.color):`rgba(0,0,0,1)`,this.ctx.fill(),this.ctx.restore()})),t.borderImageSource){let n=t.borderImageSource;if(n.type===0){let r=n.url;try{let n=await this.context.cache.match(r);if(n){let r=e.container.bounds;this.borderImageRenderer.renderBorderImage(r,n,t.borderImageSlice,t.borderImageRepeat,Math.max(0,t.borderTopWidth),Math.max(0,t.borderRightWidth),Math.max(0,t.borderBottomWidth),Math.max(0,t.borderLeftWidth))}}catch{this.context.logger.error(`Error loading border-image ${r}`)}}return}let s=0;for(let t of i){if(t.style!==0&&!R(t.color)&&t.width>0){let n=async()=>{t.style===2?await this.borderRenderer.renderDashedDottedBorder(t.color,t.width,s,e.curves,2):t.style===3?await this.borderRenderer.renderDashedDottedBorder(t.color,t.width,s,e.curves,3):t.style===4?await this.borderRenderer.renderDoubleBorder(t.color,t.width,s,e.curves):await this.borderRenderer.renderSolidBorder(t.color,s,e.curves)},r=e.container.legendBounds;if(s===0&&r){let t=e.container.bounds,i=r.left-t.left,a=r.left+r.width-t.left;i>0&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(t.left,t.top,i,t.height),this.ctx.clip(),await n(),this.ctx.restore());let o=t.left+a,s=t.width-a;s>0&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(o,t.top,s,t.height),this.ctx.clip(),await n(),this.ctx.restore())}else await n()}s++}}async render(e){this.options.backgroundColor&&(this.ctx.fillStyle=z(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height));let t=$l(e);return await this.renderStack(t),this.effectsRenderer.applyEffects([]),this.canvas}async renderTextClippedBackground(e){let t=e.container,n=t.styles,r=t.bounds;if(r.width<=0||r.height<=0)return;let i=(this.canvas.ownerDocument??document).createElement(`canvas`),a=Math.ceil(r.width),o=Math.ceil(r.height);i.width=a,i.height=o;let s=i.getContext(`2d`);if(!s)return;let[c]=this.textRenderer.createFontStyle(n);s.font=c,s.textBaseline=`alphabetic`,s.textAlign=`left`,s.direction=n.direction===1?`rtl`:`ltr`;let l=du(s,n.fontSize.number),u=new Su({ctx:s,context:this.context,canvas:i,options:{width:a,height:o,scale:1}});R(n.backgroundColor)||(s.fillStyle=z(n.backgroundColor),s.fillRect(0,0,a,o)),s.save(),s.translate(-r.left,-r.top),await u.renderBackgroundImage(t),s.restore(),s.globalCompositeOperation=`destination-in`,s.fillStyle=`#000`;let d=n.writingMode,f=n.letterSpacing;for(let e of t.textNodes)for(let t of e.textBounds){let e=t.bounds.left-r.left,n=t.bounds.top-r.top+l;f>0?this.renderTextMaskWithLetterSpacing(s,t,f,e,n,d):s.fillText(t.text,e,n)}this.ctx.drawImage(i,r.left,r.top)}renderTextMaskWithLetterSpacing(e,t,n,r,i,a){let o=Jc(t.text),s=r;for(let c of o){if(xo(a)){e.fillText(t.text,r,i);return}e.fillText(c,s,i),s+=e.measureText(c).width+n}}};let zu=(e,t)=>{switch(e){case 0:return Al(t);case 2:return jl(t);default:return Ml(t)}},Bu=e=>e.backgroundClip.some(e=>e===3);var Vu=class{constructor(e,t){this.context=e,this.options=t,this.canvas=t.canvas?t.canvas:document.createElement(`canvas`);let n=this.canvas.getContext(`2d`);if(!n)throw Error(`Failed to get 2D rendering context from canvas`);this.ctx=n,this.canvas.width=Math.floor(t.width*t.scale),this.canvas.height=Math.floor(t.height*t.scale),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`,this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-t.x,-t.y),this.context.logger.debug(`EXPERIMENTAL ForeignObject renderer initialized (${t.width}x${t.height} at ${t.x},${t.y}) with scale ${t.scale}`)}async render(e){if(this.options.signal?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);let t=await Uc(Hc(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e));return this.options.backgroundColor&&(this.ctx.fillStyle=z(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(t,-this.options.x*this.options.scale,-this.options.y*this.options.scale),this.canvas}},Hu=class{static{this.instances={}}constructor({id:e,enabled:t}){this.id=e,this.enabled=t,this.start=Date.now()}debug(...e){this.enabled&&(typeof window<`u`&&window.console&&typeof console.debug==`function`?console.debug(this.id,`${this.getTime()}ms`,...e):this.info(...e))}getTime(){return Date.now()-this.start}info(...e){this.enabled&&typeof window<`u`&&window.console&&typeof console.info==`function`&&console.info(this.id,`${this.getTime()}ms`,...e)}warn(...e){this.enabled&&(typeof window<`u`&&window.console&&typeof console.warn==`function`?console.warn(this.id,`${this.getTime()}ms`,...e):this.info(...e))}error(...e){this.enabled&&(typeof window<`u`&&window.console&&typeof console.error==`function`?console.error(this.id,`${this.getTime()}ms`,...e):this.info(...e))}},Uu=class{constructor(e,t){if(this.context=e,this._options=t,this._cache=new Map,this._pendingOperations=new Map,this._deferMode=!1,this._collectedUrls=new Set,this.maxSize=t.maxCacheSize??100,this.maxSize<1)throw Error(`Cache maxSize must be at least 1`);this.maxSize>1e4&&this.context.logger.warn(`Cache maxSize ${this.maxSize} is very large and may cause memory issues. Consider using a smaller value (recommended: 100-1000).`)}startDefer(){this._deferMode=!0}async preloadAll(e=10){this._deferMode=!1;let t=Array.from(this._collectedUrls);if(this._collectedUrls.clear(),t.length===0)return;let n=Math.max(1,Math.min(e,100));this.context.logger.debug(`Preloading ${t.length} image(s) with concurrency ${n}`);for(let e=0;e<t.length;e+=n){let r=t.slice(e,e+n).map(e=>this._addImageWithPending(e));await Promise.allSettled(r)}}addImage(e){if(this._deferMode)return!this.has(e)&&(Xu(e)||qu(e))&&this._collectedUrls.add(e),Promise.resolve();let t=this._pendingOperations.get(e);if(t)return t;if(this.has(e)){let t=this._cache.get(e);return this._cache.delete(e),this._cache.set(e,t),Promise.resolve()}return Xu(e)||qu(e)?this._addImageWithPending(e):Promise.resolve()}_addImageWithPending(e){let t=this._pendingOperations.get(e);if(t)return t;let n=this._addImageInternal(e);return this._pendingOperations.set(e,n),n.finally(()=>{this._pendingOperations.delete(e)}),n}async _addImageInternal(e){let t=this._options.imageTimeout??15e3,n=this.withTimeout(this.loadImage(e),t,`Timed out (${t}ms) loading image`);n.catch(t=>{this.context.logger.error(`Failed to load image ${e}: ${t instanceof Error?t.message:`Unknown error`}`)}),this.set(e,n)}withTimeout(e,t,n){if(t<=0)return e;let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>{r!==void 0&&clearTimeout(r)})}match(e){let t=this._cache.get(e);if(t)return this._cache.delete(e),this._cache.set(e,t),t.value}set(e,t){if(this._cache.has(e))this._cache.delete(e);else if(this._cache.size>=this.maxSize){let e=this._cache.keys().next().value;e!==void 0&&(this._cache.delete(e),this.context.logger.debug(`Cache: Evicted LRU entry: ${e}`))}this._cache.set(e,{value:t})}size(){return this._cache.size}getMaxSize(){return this.maxSize}clear(){this._cache.clear()}async loadImage(e){let t=this.context.originChecker,n=e=>t.isSameOrigin(e),r=typeof this._options.customIsSameOrigin==`function`?await this._options.customIsSameOrigin(e,n):n(e),i=!r&&this._options.allowTaint===!1&&!Ju(e)&&!Xu(e)&&typeof this._options.proxy!=`string`,a=!Ju(e)&&(this._options.useCORS===!0||i)&&Y.SUPPORT_CORS_IMAGES&&!r,o=!Ju(e)&&!r&&!Xu(e)&&typeof this._options.proxy==`string`&&Y.SUPPORT_CORS_XHR&&!a;if(!r&&this._options.allowTaint===!1&&!Ju(e)&&!Xu(e)&&!o&&!a)return;let s=e;return o&&(s=await this.proxy(s)),this.context.logger.debug(`Added image ${e.substring(0,256)}`),await new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=t,(Yu(s)||a)&&(n.crossOrigin=`anonymous`),n.src=s,n.complete===!0&&setTimeout(()=>e(n),500)})}has(e){return this._cache.has(e)}keys(){return Promise.resolve(Array.from(this._cache.keys()))}proxy(e){let t=this._options.proxy;if(!t)throw Error(`No proxy defined`);let n=e.substring(0,256);return new Promise((r,i)=>{let a=Y.SUPPORT_RESPONSE_TYPE?`blob`:`text`,o=new XMLHttpRequest;o.onload=()=>{if(o.status===200)if(a===`text`)r(o.response);else{let e=new FileReader;e.addEventListener(`load`,()=>r(e.result),!1),e.addEventListener(`error`,e=>i(e),!1),e.readAsDataURL(o.response)}else i(`Failed to proxy resource ${n} with status code ${o.status}`)},o.onerror=i;let s=t.indexOf(`?`)>-1?`&`:`?`;if(o.open(`GET`,`${t}${s}url=${encodeURIComponent(e)}&responseType=${a}`),a!==`text`&&o instanceof XMLHttpRequest&&(o.responseType=a),this._options.imageTimeout){let e=this._options.imageTimeout;o.timeout=e,o.ontimeout=()=>i(`Timed out (${e}ms) proxying ${n}`)}o.send()})}};let Wu=/^data:image\/svg\+xml/i,Gu=/^data:image\/.*;base64,/i,Ku=/^data:image\/.*/i,qu=e=>Y.SUPPORT_SVG_DRAWING||!Zu(e),Ju=e=>Ku.test(e),Yu=e=>Gu.test(e),Xu=e=>e.substring(0,4)===`blob`,Zu=e=>e.slice(-3).toLowerCase()===`svg`||Wu.test(e);var Qu=class{constructor(e){if(!e||!e.document)throw Error(`Valid window object required for OriginChecker`);if(!e.location||!e.location.href)throw Error(`Window object must have valid location`);this.link=e.document.createElement(`a`),this.origin=this.getOrigin(e.location.href)}getOrigin(e){return this.link.href=e,this.link.href=this.link.href,this.link.protocol+this.link.hostname+this.link.port}isSameOrigin(e){return this.getOrigin(e)===this.origin}getContextOrigin(){return this.origin}},$u=class e{static{this.instanceCount=1}constructor(t,n,r){this.windowBounds=n,this.instanceName=`#${e.instanceCount++}`,this.config=r,this.logger=new Hu({id:this.instanceName,enabled:t.logging}),this.originChecker=new Qu(r.window),this.cache=t.cache??r.cache??new Uu(this,t),this.onError=t.onError}};let ed=e=>{if(e?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`)},td=e=>{[`scale`,`width`,`height`,`imageTimeout`,`x`,`y`,`windowWidth`,`windowHeight`,`scrollX`,`scrollY`].forEach(t=>{let n=e[t];if(n!=null&&typeof n!=`number`){let r=Number(n);Number.isNaN(r)||(e[t]=r)}})},nd=e=>({allowTaint:e.allowTaint??!1,imageTimeout:e.imageTimeout??15e3,proxy:e.proxy,useCORS:e.useCORS??!1,customIsSameOrigin:e.customIsSameOrigin,maxCacheSize:e.maxCacheSize}),rd=(e,t,n)=>({logging:e.logging??!0,cache:e.cache??t.cache,...n}),id=(e,t)=>{let n=t;return{windowWidth:e.windowWidth??n.innerWidth??800,windowHeight:e.windowHeight??n.innerHeight??600,scrollX:e.scrollX??n.pageXOffset??0,scrollY:e.scrollY??n.pageYOffset??0}},ad=(e,t,n)=>({allowTaint:e.allowTaint??!1,onclone:e.onclone,ignoreElements:e.ignoreElements,iframeContainer:e.iframeContainer,inlineImages:n,copyStyles:n,cspNonce:e.cspNonce??t.cspNonce}),od=(e,t,n,r,i,a,o)=>({canvas:e.canvas,backgroundColor:t,signal:e.signal,scale:e.scale??o??1,x:(e.x??0)+n,y:(e.y??0)+r,width:e.width??Math.ceil(i),height:e.height??Math.ceil(a),imageSmoothing:e.imageSmoothing,imageSmoothingQuality:e.imageSmoothingQuality}),sd=(e,t,n)=>{let r=t.ownerDocument,i=r.documentElement?Gr(e,getComputedStyle(r.documentElement).backgroundColor):V.TRANSPARENT,a=r.body?Gr(e,getComputedStyle(r.body).backgroundColor):V.TRANSPARENT,o=typeof n==`string`?Gr(e,n):n===null?V.TRANSPARENT:4294967295;return t===r.documentElement?R(i)?R(a)?o:a:i:o},cd=async(e,t,n)=>{if(td(t),!t.skipValidation){let n=t.validator||r(),i=n.validateElement(e);if(!i.valid)throw Error(i.error);let a=n.validateOptions(t);if(!a.valid)throw Error(`Invalid options: ${a.error}`)}if(!e||typeof e!=`object`)throw Error(`Invalid element provided as first argument`);let c=e.ownerDocument;if(!c)throw Error(`Element is not attached to a Document`);let l=c.defaultView;if(!l)throw Error(`Document is not attached to a Window`);let u=rd(t,n,nd(t)),d=id(t,l),f=new a(d.scrollX,d.scrollY,d.windowWidth,d.windowHeight),p=new $u(u,f,n),m=t.enablePerformanceMonitoring??t.logging??!1,h=new i(p,m);h.start(`total`,{width:d.windowWidth,height:d.windowHeight});let g=t.signal;ed(g);let _=t.foreignObjectRendering??!1,v=ad(t,n,_);p.logger.debug(`Starting document clone with size ${f.width}x${f.height} scrolled to ${-f.left},${-f.top}`),h.start(`clone`);let y=new Es(p,e,v),b=y.clonedReferenceElement;if(!b)throw Error(`Unable to find element in cloned iframe`);let x=await y.toIFrame(c,f);h.end(`clone`),g?.aborted&&((t.removeContainer??!0)&&Es.destroy(x),ed(g));let{width:ee,height:te,left:S,top:ne}=$r(b)||Zr(b)?s(b.ownerDocument):o(p,b),re=sd(p,b,t.backgroundColor),ie=od(t,re,S,ne,ee,te,l.devicePixelRatio??1),ae,oe;try{return _?(p.logger.debug(`Document cloned, using foreign object rendering`),h.start(`render-foreignobject`),ae=await new Vu(p,ie).render(b),h.end(`render-foreignobject`)):(p.logger.debug(`Document cloned, element located at ${S},${ne} with size ${ee}x${te} using computed rendering`),p.logger.debug(`Starting DOM parsing`),h.start(`parse`),ed(g),p.cache.startDefer(),oe=Sl(p,b),h.end(`parse`),h.start(`preload`),await p.cache.preloadAll(),h.end(`preload`),re===oe.styles.backgroundColor&&(oe.styles.backgroundColor=V.TRANSPARENT),p.logger.debug(`Starting renderer for element at ${ie.x},${ie.y} with size ${ie.width}x${ie.height}`),h.start(`render`),ed(g),ae=await new Ru(p,ie).render(oe),h.end(`render`)),h.start(`cleanup`),(t.removeContainer??!0)&&(Es.destroy(x)||p.logger.error(`Cannot detach cloned iframe as it is not in the DOM anymore`)),h.end(`cleanup`),h.end(`total`),p.logger.debug(`Finished rendering`),m&&h.logSummary(),ae}finally{oe&&oe.restoreTree()}},ld=(e,n={},r)=>cd(e,n,r||t.fromElement(e,{cspNonce:n.cspNonce,cache:n.cache}));e.Html2CanvasConfig=t,e.PerformanceMonitor=i,e.Validator=n,e.createDefaultValidator=r,e.default=ld,e.html2canvas=ld}),typeof window<`u`&&window.html2canvas&&window.html2canvas.default&&(window.html2canvas=window.html2canvas.default);
11
+ `);for(let t of a){if(r){i.push(t);continue}let a=t.split(/(\s+)/),o=``;for(let t of a){let r=o+t;e.measureText(r).width<=n||o===``?o=r:(i.push(o),o=t)}i.push(o)}return i};async function Fu(e,t,n,r,i,o){if(H(i.styles.display,2048)){if(i.styles.listStyleImage!==null){let n=i.styles.listStyleImage;if(n.type===0){let r=n.url;try{let n=await t.cache.match(r);e.drawImage(n,i.bounds.left-(n.width+10),i.bounds.top)}catch(e){t.logger.error(`Error loading list-style-image ${r}`),t.onError?.(e instanceof Error?e:Error(String(e)))}}}else if(r.listValue&&i.styles.listStyleType!==-1){let[t]=n.createFontStyle(o);e.font=t,e.fillStyle=z(o.color),e.textBaseline=`middle`,e.textAlign=`right`;let s=new a(i.bounds.left,i.bounds.top+I(i.styles.paddingTop,i.bounds.width),i.bounds.width,Ka(o.lineHeight,o.fontSize.number)/2+1);n.renderTextWithLetterSpacing(new Wc(r.listValue,s),o.letterSpacing,Ka(o.lineHeight,o.fontSize.number)/2+2,o.writingMode),e.textBaseline=`bottom`,e.textAlign=`left`}}}let Iu=e=>e instanceof gl||e instanceof hl||e instanceof ml&&e.type!==`radio`&&e.type!==`checkbox`,Lu=e=>{switch(e){case 1:return`center`;case 2:return`right`;default:return`left`}};var Ru=class e{constructor(e,t){this.context=e,this.options=t,this.canvas=t.canvas?t.canvas:document.createElement(`canvas`);let n=this.canvas.getContext(`2d`);if(!n)throw Error(`Failed to get 2D rendering context from canvas`);this.ctx=n,t.canvas||(this.canvas.width=Math.floor(t.width*t.scale),this.canvas.height=Math.floor(t.height*t.scale),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`),this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-t.x,-t.y),this.ctx.textBaseline=`bottom`,t.imageSmoothing!==void 0&&(this.ctx.imageSmoothingEnabled=t.imageSmoothing),t.imageSmoothingQuality&&(this.ctx.imageSmoothingQuality=t.imageSmoothingQuality),this.backgroundRenderer=new Su({ctx:this.ctx,context:this.context,canvas:this.canvas,options:{width:t.width,height:t.height,scale:t.scale}}),this.borderRenderer=new Ou({ctx:this.ctx},{path:e=>this.path(e),formatPath:e=>this.formatPath(e)}),this.borderImageRenderer=new ku(this.ctx),this.effectsRenderer=new Au({ctx:this.ctx},{path:e=>this.path(e)}),this.textRenderer=new vu({ctx:this.ctx,options:{scale:t.scale}}),this.context.logger.debug(`Canvas renderer initialized (${t.width}x${t.height}) with scale ${t.scale}`)}async renderStack(e){e.element.container.styles.isVisible()&&await this.renderStackContent(e)}async renderNode(e){if(e.container.debugRender)debugger;e.container.styles.isVisible()&&(await this.renderNodeBackgroundAndBorders(e),await this.renderNodeContent(e))}renderReplacedElement(e,t,n){let r=n.naturalWidth||e.intrinsicWidth,i=n.naturalHeight||e.intrinsicHeight;if(n&&r>0&&i>0){let a=tu(e),o=Ml(t);this.path(o),this.ctx.save(),this.ctx.clip();let{sx:s,sy:c,sw:l,sh:u,dx:d,dy:f,dw:p,dh:m}=ju(r,i,a,e.styles.objectFit,e.styles.objectPosition);this.ctx.drawImage(n,s,c,l,u,d,f,p,m),this.ctx.restore()}}async renderNodeContent(t){this.effectsRenderer.applyEffects(t.getEffects(4));let n=t.container,r=t.curves,i=n.styles,a=tu(n);for(let e of n.textNodes)await this.textRenderer.renderTextNode(e,i,a);await Mu(this.ctx,this.context,{scale:this.options.scale,backgroundColor:this.options.backgroundColor,x:this.options.x,y:this.options.y,width:this.options.width,height:this.options.height},(t,n)=>new e(t,n),n,r,i,(e,t,n)=>this.renderReplacedElement(e,t,n)),Nu(this.ctx,this.textRenderer,this.path.bind(this),n,i),await Fu(this.ctx,this.context,this.textRenderer,t,n,i)}async renderStackContent(e){if(e.element.container.debugRender)debugger;let t=this.options.signal;await this.renderNodeBackgroundAndBorders(e.element);for(let n of e.negativeZIndex){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderNodeContent(e.element);for(let t of e.nonInlineLevel)await this.renderNode(t);for(let n of e.nonPositionedFloats){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}for(let n of e.nonPositionedInlineLevel){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}for(let t of e.inlineLevel)await this.renderNode(t);for(let n of e.zeroOrAutoZIndexOrTransformedOrOpacity){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}for(let n of e.positiveZIndex){if(t?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);await this.renderStack(n)}}mask(e){this.ctx.beginPath();let t=this.options.x,n=this.options.y;this.ctx.moveTo(t,n),this.ctx.lineTo(t+this.options.width,n),this.ctx.lineTo(t+this.options.width,n+this.options.height),this.ctx.lineTo(t,n+this.options.height),this.ctx.lineTo(t,n),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()}path(e){bu(this.ctx,e)}formatPath(e){yu(this.ctx,e)}async renderNodeBackgroundAndBorders(e){this.effectsRenderer.applyEffects(e.getEffects(2));let t=e.container.styles,n=!R(t.backgroundColor)||t.backgroundImage.length,r=Bu(t),i=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],a=cu(t.backgroundClip,0),o=zu(a,e.curves);if((n||t.boxShadow.length)&&(r&&e.container.textNodes.length>0?await this.renderTextClippedBackground(e):(this.ctx.save(),this.path(o),this.ctx.clip(),R(t.backgroundColor)||(this.ctx.fillStyle=z(t.backgroundColor),this.ctx.fill()),await this.backgroundRenderer.renderBackgroundImage(e.container),this.ctx.restore()),t.boxShadow.slice(0).reverse().forEach(t=>{this.ctx.save();let n=Al(e.curves),r=t.inset?0:1e4,i=El(n,-r+(t.inset?1:-1)*t.spread.number,(t.inset?1:-1)*t.spread.number,t.spread.number*(t.inset?-2:2),t.spread.number*(t.inset?-2:2));t.inset?(this.path(n),this.ctx.clip(),this.mask(i)):(this.mask(n),this.ctx.clip(),this.path(i)),this.ctx.shadowOffsetX=t.offsetX.number+r,this.ctx.shadowOffsetY=t.offsetY.number,this.ctx.shadowColor=z(t.color),this.ctx.shadowBlur=t.blur.number,this.ctx.fillStyle=t.inset?z(t.color):`rgba(0,0,0,1)`,this.ctx.fill(),this.ctx.restore()})),t.borderImageSource){let n=t.borderImageSource;if(n.type===0){let r=n.url;try{let n=await this.context.cache.match(r);if(n){let r=e.container.bounds;this.borderImageRenderer.renderBorderImage(r,n,t.borderImageSlice,t.borderImageRepeat,Math.max(0,t.borderTopWidth),Math.max(0,t.borderRightWidth),Math.max(0,t.borderBottomWidth),Math.max(0,t.borderLeftWidth))}}catch{this.context.logger.error(`Error loading border-image ${r}`)}}return}let s=0;for(let t of i){if(t.style!==0&&!R(t.color)&&t.width>0){let n=async()=>{t.style===2?await this.borderRenderer.renderDashedDottedBorder(t.color,t.width,s,e.curves,2):t.style===3?await this.borderRenderer.renderDashedDottedBorder(t.color,t.width,s,e.curves,3):t.style===4?await this.borderRenderer.renderDoubleBorder(t.color,t.width,s,e.curves):await this.borderRenderer.renderSolidBorder(t.color,s,e.curves)},r=e.container.legendBounds;if(s===0&&r){let t=e.container.bounds,i=r.left-t.left,a=r.left+r.width-t.left;i>0&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(t.left,t.top,i,t.height),this.ctx.clip(),await n(),this.ctx.restore());let o=t.left+a,s=t.width-a;s>0&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(o,t.top,s,t.height),this.ctx.clip(),await n(),this.ctx.restore())}else await n()}s++}}async render(e){this.options.backgroundColor&&(this.ctx.fillStyle=z(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height));let t=$l(e);return await this.renderStack(t),this.effectsRenderer.applyEffects([]),this.canvas}async renderTextClippedBackground(e){let t=e.container,n=t.styles,r=t.bounds;if(r.width<=0||r.height<=0)return;let i=(this.canvas.ownerDocument??document).createElement(`canvas`),a=Math.ceil(r.width),o=Math.ceil(r.height);i.width=a,i.height=o;let s=i.getContext(`2d`);if(!s)return;let[c]=this.textRenderer.createFontStyle(n);s.font=c,s.textBaseline=`alphabetic`,s.textAlign=`left`,s.direction=n.direction===1?`rtl`:`ltr`;let l=du(s,n.fontSize.number),u=new Su({ctx:s,context:this.context,canvas:i,options:{width:a,height:o,scale:1}});R(n.backgroundColor)||(s.fillStyle=z(n.backgroundColor),s.fillRect(0,0,a,o)),s.save(),s.translate(-r.left,-r.top),await u.renderBackgroundImage(t),s.restore(),s.globalCompositeOperation=`destination-in`,s.fillStyle=`#000`;let d=n.writingMode,f=n.letterSpacing;for(let e of t.textNodes)for(let t of e.textBounds){let e=t.bounds.left-r.left,n=t.bounds.top-r.top+l;f>0?this.renderTextMaskWithLetterSpacing(s,t,f,e,n,d):s.fillText(t.text,e,n)}this.ctx.drawImage(i,r.left,r.top)}renderTextMaskWithLetterSpacing(e,t,n,r,i,a){let o=Jc(t.text),s=r;for(let c of o){if(xo(a)){e.fillText(t.text,r,i);return}e.fillText(c,s,i),s+=e.measureText(c).width+n}}};let zu=(e,t)=>{switch(e){case 0:return Al(t);case 2:return jl(t);default:return Ml(t)}},Bu=e=>e.backgroundClip.some(e=>e===3);var Vu=class{constructor(e,t){this.context=e,this.options=t,this.canvas=t.canvas?t.canvas:document.createElement(`canvas`);let n=this.canvas.getContext(`2d`);if(!n)throw Error(`Failed to get 2D rendering context from canvas`);this.ctx=n,this.canvas.width=Math.floor(t.width*t.scale),this.canvas.height=Math.floor(t.height*t.scale),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`,this.ctx.scale(this.options.scale,this.options.scale),this.ctx.translate(-t.x,-t.y),this.context.logger.debug(`EXPERIMENTAL ForeignObject renderer initialized (${t.width}x${t.height} at ${t.x},${t.y}) with scale ${t.scale}`)}async render(e){if(this.options.signal?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);let t=await Uc(Hc(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e));return this.options.backgroundColor&&(this.ctx.fillStyle=z(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(t,-this.options.x*this.options.scale,-this.options.y*this.options.scale),this.canvas}},Hu=class{static{this.instances={}}constructor({id:e,enabled:t}){this.id=e,this.enabled=t,this.start=Date.now()}debug(...e){this.enabled&&(typeof window<`u`&&window.console&&typeof console.debug==`function`?console.debug(this.id,`${this.getTime()}ms`,...e):this.info(...e))}getTime(){return Date.now()-this.start}info(...e){this.enabled&&typeof window<`u`&&window.console&&typeof console.info==`function`&&console.info(this.id,`${this.getTime()}ms`,...e)}warn(...e){this.enabled&&(typeof window<`u`&&window.console&&typeof console.warn==`function`?console.warn(this.id,`${this.getTime()}ms`,...e):this.info(...e))}error(...e){this.enabled&&(typeof window<`u`&&window.console&&typeof console.error==`function`?console.error(this.id,`${this.getTime()}ms`,...e):this.info(...e))}},Uu=class{constructor(e,t){if(this.context=e,this._options=t,this._cache=new Map,this._pendingOperations=new Map,this._deferMode=!1,this._collectedUrls=new Set,this.maxSize=t.maxCacheSize??100,this.maxSize<1)throw Error(`Cache maxSize must be at least 1`);this.maxSize>1e4&&this.context.logger.warn(`Cache maxSize ${this.maxSize} is very large and may cause memory issues. Consider using a smaller value (recommended: 100-1000).`)}startDefer(){this._deferMode=!0}async preloadAll(e=10){this._deferMode=!1;let t=Array.from(this._collectedUrls);if(this._collectedUrls.clear(),t.length===0)return;let n=Math.max(1,Math.min(e,100));this.context.logger.debug(`Preloading ${t.length} image(s) with concurrency ${n}`);for(let e=0;e<t.length;e+=n){let r=t.slice(e,e+n).map(e=>this._addImageWithPending(e));await Promise.allSettled(r)}}addImage(e){if(this._deferMode)return!this.has(e)&&(Xu(e)||qu(e))&&this._collectedUrls.add(e),Promise.resolve();let t=this._pendingOperations.get(e);if(t)return t;if(this.has(e)){let t=this._cache.get(e);return this._cache.delete(e),this._cache.set(e,t),Promise.resolve()}return Xu(e)||qu(e)?this._addImageWithPending(e):Promise.resolve()}_addImageWithPending(e){let t=this._pendingOperations.get(e);if(t)return t;let n=this._addImageInternal(e);return this._pendingOperations.set(e,n),n.finally(()=>{this._pendingOperations.delete(e)}),n}async _addImageInternal(e){let t=this._options.imageTimeout??15e3,n=this.withTimeout(this.loadImage(e),t,`Timed out (${t}ms) loading image`);n.catch(t=>{this.context.logger.error(`Failed to load image ${e}: ${t instanceof Error?t.message:`Unknown error`}`)}),this.set(e,n)}withTimeout(e,t,n){if(t<=0)return e;let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>{r!==void 0&&clearTimeout(r)})}match(e){let t=this._cache.get(e);if(t)return this._cache.delete(e),this._cache.set(e,t),t.value}set(e,t){if(this._cache.has(e))this._cache.delete(e);else if(this._cache.size>=this.maxSize){let e=this._cache.keys().next().value;e!==void 0&&(this._cache.delete(e),this.context.logger.debug(`Cache: Evicted LRU entry: ${e}`))}this._cache.set(e,{value:t})}size(){return this._cache.size}getMaxSize(){return this.maxSize}clear(){this._cache.clear()}async loadImage(e){let t=this.context.originChecker,n=e=>t.isSameOrigin(e),r=typeof this._options.customIsSameOrigin==`function`?await this._options.customIsSameOrigin(e,n):n(e),i=!r&&this._options.allowTaint===!1&&!Ju(e)&&!Xu(e)&&typeof this._options.proxy!=`string`,a=!Ju(e)&&(this._options.useCORS===!0||i)&&Y.SUPPORT_CORS_IMAGES&&!r,o=!Ju(e)&&!r&&!Xu(e)&&typeof this._options.proxy==`string`&&Y.SUPPORT_CORS_XHR&&!a;if(!r&&this._options.allowTaint===!1&&!Ju(e)&&!Xu(e)&&!o&&!a)return;let s=e;return o&&(s=await this.proxy(s)),this.context.logger.debug(`Added image ${e.substring(0,256)}`),await new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=t,(Yu(s)||a)&&(n.crossOrigin=`anonymous`),n.src=s,n.complete===!0&&setTimeout(()=>e(n),500)})}has(e){return this._cache.has(e)}keys(){return Promise.resolve(Array.from(this._cache.keys()))}proxy(e){let t=this._options.proxy;if(!t)throw Error(`No proxy defined`);let n=e.substring(0,256);return new Promise((r,i)=>{let a=Y.SUPPORT_RESPONSE_TYPE?`blob`:`text`,o=new XMLHttpRequest;o.onload=()=>{if(o.status===200)if(a===`text`)r(o.response);else{let e=new FileReader;e.addEventListener(`load`,()=>r(e.result),!1),e.addEventListener(`error`,e=>i(e),!1),e.readAsDataURL(o.response)}else i(`Failed to proxy resource ${n} with status code ${o.status}`)},o.onerror=i;let s=t.indexOf(`?`)>-1?`&`:`?`;if(o.open(`GET`,`${t}${s}url=${encodeURIComponent(e)}&responseType=${a}`),a!==`text`&&o instanceof XMLHttpRequest&&(o.responseType=a),this._options.imageTimeout){let e=this._options.imageTimeout;o.timeout=e,o.ontimeout=()=>i(`Timed out (${e}ms) proxying ${n}`)}o.send()})}};let Wu=/^data:image\/svg\+xml/i,Gu=/^data:image\/.*;base64,/i,Ku=/^data:image\/.*/i,qu=e=>Y.SUPPORT_SVG_DRAWING||!Zu(e),Ju=e=>Ku.test(e),Yu=e=>Gu.test(e),Xu=e=>e.substring(0,4)===`blob`,Zu=e=>e.slice(-3).toLowerCase()===`svg`||Wu.test(e);var Qu=class{constructor(e){if(!e||!e.document)throw Error(`Valid window object required for OriginChecker`);if(!e.location||!e.location.href)throw Error(`Window object must have valid location`);this.link=e.document.createElement(`a`),this.origin=this.getOrigin(e.location.href)}getOrigin(e){return this.link.href=e,this.link.href=this.link.href,this.link.protocol+this.link.hostname+this.link.port}isSameOrigin(e){return this.getOrigin(e)===this.origin}getContextOrigin(){return this.origin}},$u=class e{static{this.instanceCount=1}constructor(t,n,r){this.windowBounds=n,this.instanceName=`#${e.instanceCount++}`,this.config=r,this.logger=new Hu({id:this.instanceName,enabled:t.logging}),this.originChecker=new Qu(r.window),this.cache=t.cache??r.cache??new Uu(this,t),this.onError=t.onError}};let ed=e=>{if(e?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`)},td=e=>{[`scale`,`width`,`height`,`imageTimeout`,`x`,`y`,`windowWidth`,`windowHeight`,`scrollX`,`scrollY`].forEach(t=>{let n=e[t];if(n!=null&&typeof n!=`number`){let r=Number(n);Number.isNaN(r)||(e[t]=r)}})},nd=e=>({allowTaint:e.allowTaint??!1,imageTimeout:e.imageTimeout??15e3,proxy:e.proxy,useCORS:e.useCORS??!1,customIsSameOrigin:e.customIsSameOrigin,maxCacheSize:e.maxCacheSize}),rd=(e,t,n)=>({logging:e.logging??!0,cache:e.cache??t.cache,...n}),id=(e,t)=>{let n=t;return{windowWidth:e.windowWidth??n.innerWidth??800,windowHeight:e.windowHeight??n.innerHeight??600,scrollX:e.scrollX??n.pageXOffset??0,scrollY:e.scrollY??n.pageYOffset??0}},ad=(e,t,n)=>({allowTaint:e.allowTaint??!1,onclone:e.onclone,ignoreElements:e.ignoreElements,iframeContainer:e.iframeContainer,inlineImages:n,copyStyles:n,cspNonce:e.cspNonce??t.cspNonce}),od=(e,t,n,r,i,a,o)=>({canvas:e.canvas,backgroundColor:t,signal:e.signal,scale:e.scale??o??1,x:(e.x??0)+n,y:(e.y??0)+r,width:e.width??Math.ceil(i),height:e.height??Math.ceil(a),imageSmoothing:e.imageSmoothing,imageSmoothingQuality:e.imageSmoothingQuality}),sd=(e,t,n)=>{let r=t.ownerDocument,i=r.documentElement?Gr(e,getComputedStyle(r.documentElement).backgroundColor):V.TRANSPARENT,a=r.body?Gr(e,getComputedStyle(r.body).backgroundColor):V.TRANSPARENT,o=typeof n==`string`?Gr(e,n):n===null?V.TRANSPARENT:4294967295;return t===r.documentElement?R(i)?R(a)?o:a:i:o},cd=async(e,t,n)=>{if(td(t),!t.skipValidation){let n=t.validator||r(),i=n.validateElement(e);if(!i.valid)throw Error(i.error);let a=n.validateOptions(t);if(!a.valid)throw Error(`Invalid options: ${a.error}`)}if(!e||typeof e!=`object`)throw Error(`Invalid element provided as first argument`);let c=e.ownerDocument;if(!c)throw Error(`Element is not attached to a Document`);let l=c.defaultView;if(!l)throw Error(`Document is not attached to a Window`);let u=rd(t,n,nd(t)),d=id(t,l),f=new a(d.scrollX,d.scrollY,d.windowWidth,d.windowHeight),p=new $u(u,f,n),m=t.enablePerformanceMonitoring??t.logging??!1,h=new i(p,m);h.start(`total`,{width:d.windowWidth,height:d.windowHeight});let g=t.signal;ed(g);let _=t.foreignObjectRendering??!1,v=ad(t,n,_);p.logger.debug(`Starting document clone with size ${f.width}x${f.height} scrolled to ${-f.left},${-f.top}`),h.start(`clone`);let y=new Es(p,e,v),b=y.clonedReferenceElement;if(!b)throw Error(`Unable to find element in cloned iframe`);let x=await y.toIFrame(c,f);h.end(`clone`),g?.aborted&&((t.removeContainer??!0)&&Es.destroy(x),ed(g));let{width:ee,height:te,left:S,top:ne}=$r(b)||Zr(b)?s(b.ownerDocument):o(p,b),re=sd(p,b,t.backgroundColor),ie=od(t,re,S,ne,ee,te,l.devicePixelRatio??1),ae,oe;try{return _?(p.logger.debug(`Document cloned, using foreign object rendering`),h.start(`render-foreignobject`),ae=await new Vu(p,ie).render(b),h.end(`render-foreignobject`)):(p.logger.debug(`Document cloned, element located at ${S},${ne} with size ${ee}x${te} using computed rendering`),p.logger.debug(`Starting DOM parsing`),h.start(`parse`),ed(g),p.cache.startDefer(),oe=Sl(p,b),h.end(`parse`),h.start(`preload`),await p.cache.preloadAll(),h.end(`preload`),re===oe.styles.backgroundColor&&(oe.styles.backgroundColor=V.TRANSPARENT),p.logger.debug(`Starting renderer for element at ${ie.x},${ie.y} with size ${ie.width}x${ie.height}`),h.start(`render`),ed(g),ae=await new Ru(p,ie).render(oe),h.end(`render`)),h.start(`cleanup`),(t.removeContainer??!0)&&(Es.destroy(x)||p.logger.error(`Cannot detach cloned iframe as it is not in the DOM anymore`)),h.end(`cleanup`),h.end(`total`),p.logger.debug(`Finished rendering`),m&&h.logSummary(),ae}finally{oe&&oe.restoreTree()}},ld=(e,n={},r)=>cd(e,n,r||t.fromElement(e,{cspNonce:n.cspNonce,cache:n.cache}));e.Html2CanvasConfig=t,e.PerformanceMonitor=i,e.Validator=n,e.createDefaultValidator=r,e.default=ld,e.html2canvas=ld}),typeof window<`u`&&window.html2canvas&&window.html2canvas.default&&(window.html2canvas=window.html2canvas.default);
@@ -187,14 +187,17 @@ class CanvasRenderer {
187
187
  }
188
188
  mask(paths) {
189
189
  this.ctx.beginPath();
190
- this.ctx.moveTo(0, 0);
191
- // Use logical dimensions (options.width/height) instead of canvas pixel dimensions
192
- // because context has already been scaled by this.options.scale
193
- // Fix for Issue #126: Using canvas pixel dimensions causes broken output
194
- this.ctx.lineTo(this.options.width, 0);
195
- this.ctx.lineTo(this.options.width, this.options.height);
196
- this.ctx.lineTo(0, this.options.height);
197
- this.ctx.lineTo(0, 0);
190
+ // Anchor the mask rectangle to (options.x, options.y) instead of (0, 0)
191
+ // because ctx.translate(-options.x, -options.y) shifts the coordinate system.
192
+ // Fix for Issue #230: inset box-shadow rendering was inverted for elements
193
+ // not at document origin due to the mask covering the wrong region.
194
+ const x = this.options.x;
195
+ const y = this.options.y;
196
+ this.ctx.moveTo(x, y);
197
+ this.ctx.lineTo(x + this.options.width, y);
198
+ this.ctx.lineTo(x + this.options.width, y + this.options.height);
199
+ this.ctx.lineTo(x, y + this.options.height);
200
+ this.ctx.lineTo(x, y);
198
201
  this.formatPath(paths.slice(0).reverse());
199
202
  this.ctx.closePath();
200
203
  }
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "default": "./dist/html2canvas-pro.esm.js"
20
20
  }
21
21
  },
22
- "version": "2.3.8",
22
+ "version": "2.3.9",
23
23
  "author": {
24
24
  "name": "yorickshan",
25
25
  "email": "yorickshan@gmail.com",