"use strict";(globalThis.webpackChunksimple_history=globalThis.webpackChunksimple_history||[]).push([[580],{455:(t,e,i)=>{i.d(e,{a:()=>l});var a=i(887);function n(t){let e=function(t){let e=[],i="",a=0;for(let n=0;n<t.length;n++){let r=t[n];"("===r&&a++,")"===r&&(a=Math.max(0,a-1)),";"===r&&0===a?(e.push(i),i=""):i+=r}return i.trim()&&e.push(i),e.map((t=>t.trim())).filter(Boolean)}(t),i=null,a=null,n=null,r=[];for(let t of e){let e=t.indexOf(":");if(e<0)continue;let l=t.slice(0,e).trim().toLowerCase(),s=t.slice(e+1).trim();"box-shadow"===l?n=s:"filter"===l?i=s:"-webkit-filter"===l?a=s:r.push([l,s])}if(n){let t=function(t){let e=[],i="",a=0;for(let n=0;n<t.length;n++){let r=t[n];"("===r&&a++,")"===r&&(a=Math.max(0,a-1)),","===r&&0===a?(e.push(i.trim()),i=""):i+=r}i.trim()&&e.push(i.trim());let n=[];for(let t of e){if(/\binset\b/i.test(t))continue;let e=t.match(/-?\d+(?:\.\d+)?px/gi)||[],[i="0px",a="0px",r="0px"]=e,l=t.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/gi,"").trim().replace(/\s{2,}/g," "),s=!!l&&","!==l;n.push(`drop-shadow(${i} ${a} ${r}${s?` ${l}`:""})`)}return n.join(" ")}(n);t&&(i=i?`${i} ${t}`:t,a=a?`${a} ${t}`:t)}let l=[...r];return i&&l.push(["filter",i]),a&&l.push(["-webkit-filter",a]),l.map((([t,e])=>`${t}:${e}`)).join(";")}function r(t){if(!(0,a.b)()||!function(t){return"string"==typeof t&&/^data:image\/svg\+xml/i.test(t)}(t))return t;try{let e=function(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}(t);return function(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}(function(t){return(t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,((t,e)=>t.replace(e,function(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,((t,e,i)=>`${e}{${n(i)}}`))}(e))))).replace(/style=(['"])([\s\S]*?)\1/gi,((t,e,i)=>`style=${e}${n(i)}${e}`))}(e))}catch{return t}}async function l(t,e){let{width:i,height:a,scale:n=1,dpr:l=1,meta:s={},backgroundColor:h}=e;t=r(t);let u=new Image;u.loading="eager",u.decoding="sync",u.crossOrigin="anonymous",u.src=t,await u.decode();let o,c,d=u.naturalWidth,m=u.naturalHeight,g=Number.isFinite(s.w0)?s.w0:d,p=Number.isFinite(s.h0)?s.h0:m,f=Number.isFinite(i),w=Number.isFinite(a);f&&w?(o=Math.max(1,i),c=Math.max(1,a)):f?(o=i,c=p*(i/Math.max(1,g))):w?(c=a,o=g*(a/Math.max(1,p))):(o=d,c=m),o*=n,c*=n;let x=document.createElement("canvas");x.width=o*l,x.height=c*l,x.style.width=`${o}px`,x.style.height=`${c}px`;let y=x.getContext("2d");return 1!==l&&y.scale(l,l),h&&(y.save(),y.fillStyle=h,y.fillRect(0,0,o,c),y.restore()),y.drawImage(u,0,0,o,c),x}},836:(t,e,i)=>{i.d(e,{a:()=>n});var a=i(455);async function n(t,e){let i=await(0,a.a)(t,e),n=new Image;return n.src=i.toDataURL(`image/${e.format}`,e.quality),await n.decode(),n.style.width=i.width/e.dpr+"px",n.style.height=i.height/e.dpr+"px",n}},580:(t,e,i)=>{i.d(e,{toImg:()=>r,toSvg:()=>r});var a=i(836),n=i(887);async function r(t,e){let{scale:i=1,width:r,height:l,meta:s={}}=e,h=Number.isFinite(r),u=Number.isFinite(l),o=Number.isFinite(i)&&1!==i||h||u;if((0,n.b)()&&o)return await(0,a.a)(t,{...e,format:"png",quality:1,meta:s});let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=t,await c.decode(),h&&u)c.style.width=`${r}px`,c.style.height=`${l}px`;else if(h){let t=Number.isFinite(s.w0)?s.w0:c.naturalWidth,e=Number.isFinite(s.h0)?s.h0:c.naturalHeight,i=r/Math.max(1,t);c.style.width=`${r}px`,c.style.height=`${Math.round(e*i)}px`}else if(u){let t=Number.isFinite(s.w0)?s.w0:c.naturalWidth,e=Number.isFinite(s.h0)?s.h0:c.naturalHeight,i=l/Math.max(1,e);c.style.height=`${l}px`,c.style.width=`${Math.round(t*i)}px`}else{let e=Math.round(c.naturalWidth*i),a=Math.round(c.naturalHeight*i);if(c.style.width=`${e}px`,c.style.height=`${a}px`,"string"==typeof t&&t.startsWith("data:image/svg+xml"))try{let i=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${e}"`).replace(/height="[^"]*"/,`height="${a}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`,c.src=t}catch{}}return c}}}]);