Build 589089stable
Module 515718
2,934 characters · in no known chunkDependencies
Required by (30)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{EW:()=>m,LZ:()=>N,NN:()=>C,S4:()=>f,Sf:()=>I,U8:()=>u,Uj:()=>d,V:()=>_,We:()=>T,aU:()=>S,bX:()=>g,eJ:()=>E,wU:()=>A,z$:()=>c}),n(321073),n(508300),n(393431),n(532706),n(42231),n(232424),n(949626),n(767709),n(65162);var i=n(284009),r=n.n(i),a=n(435558),s=n.n(a),l=n(531325),o=n.n(l);function d(e){let{width:t,height:n,maxWidth:i,maxHeight:r,minWidth:a=0,minHeight:s=0}=e;if(t!==i||n!==r){let e=t>i?i/t:1;t=Math.max(Math.round(t*e),a);let l=(n=Math.max(Math.round(n*e),s))>r?r/n:1;t=Math.max(Math.round(t*l),a),n=Math.max(Math.round(n*l),s)}return{width:t,height:n}}function c(e,t){let n=Math.min(Math.round(.65*window.innerHeight),Math.round(window.innerHeight));return d({width:e,height:t,maxWidth:Math.min(Math.min(Math.round(.75*window.innerWidth),Math.round(window.innerWidth)),2e3),maxHeight:Math.min(n,2e3)})}function u(e){let{width:t,height:n,maxWidth:i,maxHeight:r}=e,a=1;t>i&&(a=i/t),t=Math.round(t*a);let s=1;return(n=Math.round(n*a))>r&&(s=r/n),Math.min(a*s,1)}function _(e){let{width:t,height:n,maxWidth:i,maxHeight:r}=e;return t===n?1:Math.min(Math.max(i/t,r/n),1)}function E(e){let{width:t,height:n}=e;return null!=t&&0!==t&&null!=n&&0!==n}function A(e){return null==e||""===e?"none":`url(${e})`}let h=[[0,0,0]];function I(e,t,n){let i=document.createElement("canvas"),r=i.getContext("2d");if(null==r)return h;let a=i.width=0===e.width?128:e.width,s=i.height=0===e.height?128:e.height;r.drawImage(e,0,0,a,s);let l=function(e,t,n){let i=[];for(let r=0,a,s,l,o,d;r<t;r+=n)s=e[(a=4*r)+0],l=e[a+1],o=e[a+2],(void 0===(d=e[a+3])||d>=125)&&!(s>250&&l>250&&o>250)&&i.push([s,l,o]);return i}(r.getImageData(0,0,a,s).data,a*s,n),d=o()(l,t);return"boolean"==typeof d?h:d.palette()}function f(e){return"number"==typeof e?null:p(e)}let p=s().memoize(e=>new Promise((t,n)=>{let i=new Image;i.crossOrigin="Anonymous",i.onerror=e=>{n(e),i.onerror=i.onload=null,i=null},i.onload=()=>{t(I(i,5,10)),i.onerror=i.onload=null,i=null},i.src=e}));function T(e){return new Promise((t,n)=>{let i=new FileReader;i.readAsDataURL(e),i.onload=()=>{r()("string"==typeof i.result,"Result must be a string"),t(i.result)},i.onerror=e=>n(e)})}function m(e){let t=e.split(";base64,");return r()(2===t.length,"Input data is not a valid image."),atob(t[1]).length}async function g(e,t,n){let i=S(e);return new File([await i.arrayBuffer()],t,{type:n})}function S(e){let t;t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):btoa(e.split(",")[1]);let n=e.split(",")[0].split(":")[1].split(";")[0],i=new Uint8Array(t.length);for(var r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return new Blob([i],{type:n})}async function N(e){if("image/png"!==e.type?.split(";")[0])throw Error("File is not a PNG");let t=await e.text(),n=t.indexOf("IDAT");return!!(n>0)&&-1!==t.substring(0,n).indexOf("acTL")}function C(e){return new Promise((t,n)=>{let i=new Image;i.addEventListener("load",t),i.addEventListener("error",n),i.src=e})}}