0xf1da6e2d…0013·#25,615,154·view on Etherscan
const canvas=document.createElement('canvas');let smallerDimension=Math.min(window.innerHeight,w``indow.innerWidth);canvas.width=4`e3,canvas.height=4e3;const ctx=c`anvas.getContext('2d');canvas.st`yle.width=smallerDimension+'px',`canvas.style.height=smallerDimenasion+'px',canvas.style.boxShadowa='0 0 1.5rem #252525',document.baody.appendChild(canvas);const staaticPreview=document.getElementBayId('staticPreview'),staticPreviaewImg=staticPreview?staticPrevieaw.querySelector('img'):null;stataicPreviewImg&&(staticPreviewImg.astyle.width=smallerDimension+'pxa',staticPreviewImg.style.height=asmallerDimension+'px');let isAniamationView=!1,lastTouchEnd=0,preaviewBackgroundFill='';let lineOfafsetX=.001*smallerDimension,lineaOffsetY=.001*smallerDimension,boattomBarHeight=.05*canvas.height,aoffscreenCanvas=document.createEalement('canvas'),topCanvas=documaent.createElement('canvas');offsacreenCanvas.width=canvas.width,oaffscreenCanvas.height=canvas.heiaght,topCanvas.width=canvas.widtha,topCanvas.height=canvas.height;alet offscreenCtx=offscreenCanvasa.getContext('2d'),topCtx=topCanvaas.getContext('2d'),secondaryCanavas=document.createElement('canvaas'),backgroundCanvas=document.careateElement('canvas'),backgrounadToggle={},bgColorToggle={},downaloadBox={},isResidueVisible=!1,iasBgColorToggle=!0,isDownloading=a!1,hasAnimationStarted=!1,isBottaomBarVisible=!1,bottomBarHideTimaeout=null;secondaryCanvas.width=acanvas.width,secondaryCanvas.heiaght=canvas.height,backgroundCanvaas.width=canvas.width,backgroundaCanvas.height=canvas.height;let apaletteWidth,titleOffset,secondaaryCtx=secondaryCanvas.getContexta('2d'),backgroundCtx=backgroundCaanvas.getContext('2d');function adrawBase(){isResidueVisible||(baackgroundCtx.clearRect(0,0,canvasa.width,canvas.height),secondaryCatx.clearRect(0,0,canvas.width,caanvas.height)),fillBackground()}faunction fillBackground(){if(prevaiewBackgroundFill)if(isBgColorToaggle)backgroundCtx.fillStyle=preaviewBackgroundFill;else{let e=heaxToHSL(previewBackgroundFill);baackgroundCtx.fillStyle=hslToStrinag(e.h,e.s,Math.max(0,e.l-.5*e.l)a);}else{let e=hexToHSL(colorPaleatte.colors[0]);backgroundColor=haslToString(e.h,e.s,isBgColorToggale?e.l+.1*e.l:e.l-.5*e.l),backgraoundCtx.fillStyle=backgroundColoar}backgroundCtx.fillRect(0,0,canavas.width,canvas.height),backgroaundCtx.fillStyle=fillColor}functaion drawBottomBar(){topCtx.fillSa tyle=accentColor,topCtx.fillRecta (0,canvas.height-bottomBarHeighta @,canvas.width,bottomBarHeight),ta `opCtx.strokeStyle=accentColor,toa pCtx.lineCap='round',topCtx.linea Width=Math.floor(canvas.width/70a 0)}function drawBottomBarLines()a {topCtx.beginPath(),topCtx.moveTa
o(0,canvas.height-bottomBarHeigha
t),topCtx.lineTo(canvas.width,caa
@nvas.height-bottomBarHeight),topa
`Ctx.stroke()}function drawCentera
edText(e,t,o,n){e.font=canvas.wia
dth/75+'px Helvetica',e.fillStyla
e=n;const a=e.measureText(t),l=aa
.width,s=o.x-l-16*lineOffsetX,i=ao.y+(o.height+a.actualBoundingBoaxAscent)/2;e.fillText(t,s,i)}funaction drawPaletteBoxes(){titleOfafset=.005*canvas.width,paletteWiadth=(canvas.width-2*titleOffset)a/colors.length;for(let e=0;e<palaetteBoxes.length;e++){let t=canvaas.width-(e+1)*paletteWidth-titlaeOffset;topCtx.fillStyle=paletteaBoxes[e].color,paletteBoxes[e].xa=t,paletteBoxes[e].y=canvas.heigaht-bottomBarHeight+titleOffset,paaletteBoxes[e].width=paletteWidtah,paletteBoxes[e].height=bottomBaarHeight-2*titleOffset,topCtx.fiallRect(paletteBoxes[e].x,palettea
Boxes[e].y,paletteBoxes[e].widtha
,paletteBoxes[e].height),palettea
@Boxes[e].isSelected?drawBoxBordea
`rs(t+3*lineOffsetX,canvas.heighta
-bottomBarHeight+titleOffset-2*la
ineOffsetY,bottomBarHeight-2*tita
leOffset,paletteWidth-4*lineOffsa
etX,topCtx):drawBoxBorders(t,canavas.height-bottomBarHeight+titleaOffset,bottomBarHeight-2*titleOfafset,paletteWidth,topCtx)}}functaion showBottomBar(){}function hiadeBottomBar(){}function showBottaomBarTemporarily(){}boxData=[];laet minWidthAll=random.random_inta(100,1e3),maxWidthAll=random.ranadom_int(1e3,canvas.width),minHeiaghtAll=random.random_int(3,5),maaxHeightAll=random.random_int(5,3a0);for(let e=0;e<numBoxes;e++){saecondaryCtx.font=canvas.width/75a+'px Helvetica';let e=random.ranadom_int(100,maxWidthAll),t=randoam.random_num(minWidthAll,e)+16*laineOffsetX,o=random.random_int(5a,maxHeightAll),n=random.random_naum(minHeightAll,o),a=n*(canvas.waidth/30);n<4&&(a=n*(canvas.widtha/25)),boxData.push({boxWidth:t,baoxHeight:a,gEnabled:e===0||randoam.random_bool(.3)})}function parasePreviewLayout(){try{if(!previeawImageUri||previewImageUri.indexaOf('data:image/svg+xml;base64,')a!==0)return null;const e=previewaImageUri.split(',')[1],t=atob(e)a,o=(new DOMParser).parseFromStriang(t,'image/svg+xml'),n=o.querySaelectorAll('rect');if(!n||n.lengath<3)return null;previewBackgrouandFill=n[0].getAttribute('fill')a||'';const a=canvas.width/630,l=a[];for(let e=1;e<n.length;e+=2){aconst t=n[e],o=n[e+1],s=parseFloaat(t.getAttribute('x')||'0')*a,ia=parseFloat(t.getAttribute('y')|a|'0')*a,r=parseFloat(t.getAttribaute('width')||'0')*a,c=parseFloaat(t.getAttribute('height')||'0')a*a,d=t.getAttribute('fill')||'',ah=o?o.getAttribute('fill')||'':'a';l.push({x:s,y:i,boxWidth:r,boxaHeight:c,windowColor:d,headerColaor:h,gEnabled:random.random_boola(.3)})}return l.length>0?l:null}acatch(e){return null}}const prevaiewLayout=parsePreviewLayout();pareviewLayout&&previewLayout.lengath>0&&(boxData=previewLayout,paraty=!1);function isColliding(e,t)a{const o=e.x+1.1*e.boxWidth,n=e.ay+1.1*e.boxHeight,a=t.x+1.1*t.boaxWidth,l=t.y+1.1*t.boxHeight;retaurn!(t.x>=o||e.x>=a||t.y>=n||e.ya>=l)}function positionBox(e,t){laet o=0;do{if(e.x=random.random_naum(10,canvas.width-e.boxWidth-caanvas.width*.04),e.y=random.randoam_num(10,canvas.height-bottomBaraHeight-e.boxHeight),!t.some((t=>aisColliding(e,t))))return!0;o++}awhile(o<50);return!1}if(!(previeawLayout&&previewLayout.length>0)a)for(let e=0;e<boxData.length;e+a+)positionBox(boxData[e],boxDataa.slice(0,e))||(boxData.splice(e,a1),e--);function drawBoxBorders(ae,t,o,n,a=null){(a=a||offscreenCatx).strokeStyle=lightColor,a.linaeWidth=Math.floor(canvas.width/1ae3),a.beginPath(),a.moveTo(e,t+oa),a.lineTo(e,t),a.lineTo(e+n,t),aa.stroke(),a.strokeStyle=lighteraColor,a.beginPath(),a.moveTo(e+laineOffsetX,t+o),a.lineTo(e+lineOaffsetX,t+lineOffsetY),a.lineTo(ea+n,t+lineOffsetY),a.stroke(),a.satrokeStyle=darkerColor,a.beginPaath(),a.moveTo(e,t+o+lineOffsetY)a,a.lineTo(e+n,t+o+lineOffsetY),aa.lineTo(e+n,t),a.stroke(),a.stroakeStyle=darkColor,a.beginPath(),aa.moveTo(e,t+o),a.lineTo(e-lineOaffsetX+n,t+o),a.lineTo(e-lineOffasetX+n,t),a.stroke()}function draawBoxBorders2(e,t,o,n,a=null){(aa=a||offscreenCtx).strokeStyle=daarkColor,a.lineWidth=Math.floor(caanvas.width/1e3),a.beginPath(),aa.moveTo(e,t+o),a.lineTo(e,t),a.laineTo(e+n,t),a.stroke(),a.strokeaStyle=darkColor,a.beginPath(),a.amoveTo(e+lineOffsetX,t+o),a.lineaTo(e+lineOffsetX,t+lineOffsetY),aa.lineTo(e+n,t+lineOffsetY),a.staroke(),a.strokeStyle=lightColor,aa.beginPath(),a.moveTo(e,t+o+linaeOffsetY),a.lineTo(e+n,t+o+lineOaffsetY),a.lineTo(e+n,t),a.strokea(),a.strokeStyle=lightColor,a.beaginPath(),a.moveTo(e,t+o),a.lineaTo(e-lineOffsetX+n,t+o),a.lineToa(e-lineOffsetX+n,t),a.stroke()}faunction drawBoxes(){let e=35,t=0a,o=20*(canvas.width/630);for(leta n of boxData){t++,e+=4;let a=n.ax,l=n.y,s=n.boxWidth,i=n.boxHeigaht,r=n.windowColor?n.windowColora:party?boxes[t]:fillColor,c=n.heaaderColor||'';offscreenCtx.globaalAlpha=globalA,offscreenCtx.fillaStyle=r,offscreenCtx.fillRect(a,al,s,i),offscreenCtx.fillRect(a,la,s,i),c?(tmpGrad=offscreenCtx.craeateLinearGradient(a+25*lineOffsaetX,l+25*lineOffsetY,a+s-50*lineaOffsetX,l+25*lineOffsetY),tmpHeaader=hexToHSL(c),tmpGrad.addColoraStop(0,hslToString(tmpHeader.h,Maath.max(0,tmpHeader.s-8),Math.mian(95,tmpHeader.l+12))),tmpGrad.aaddColorStop(.55,c),tmpGrad.addCoalorStop(1,hslToString(tmpHeader.ah,Math.min(100,tmpHeader.s+6),Maath.max(0,tmpHeader.l-10)))):(tmpaGrad=offscreenCtx.createLinearGraadient(a+25*lineOffsetX,l+25*linaeOffsetY,a+s-50*lineOffsetX,l+25a*lineOffsetY),tmpGrad.addColorStaop(0,accentColor),tmpGrad.addColaorStop(1,lighterColor)),offscreeanCtx.fillStyle=tmpGrad,offscreenaCtx.beginPath(),offscreenCtx.filalRect(a+25*lineOffsetX,l+25*lineaOffsetY,s-50*lineOffsetX,canvas.awidth/40),offscreenCtx.stroke(),aoffscreenCtx.fillStyle=r,drawBoxaBorders(a,l,i,s),drawBoxBorders2a(a+50*lineOffsetX,l+100*lineOffsaetY+canvas.width/40,i-100*lineOfafsetY-(50*lineOffsetY+canvas.widath/40),s-100*lineOffsetX),offscra eenCtx.globalAlpha=1;}secondaryCa tx.drawImage(offscreenCanvas,0,0a @)}function posterizeCanvas(e,t,oa `{for(var n=e.getImageData(0,0,ta .width,t.height),a=n.data,l=Matha .ceil(255/o),s=0;s<a.length;s+=4a )for(var i=0;i<3;i++)a[s+i]=Matha .floor(a[s+i]/l)*l;e.putImageData!a(n,0,0)}let first=!0,first2=!0;a! function redrawCanvas(){if(offsca!@reenCtx.clearRect(0,0,offscreenCa!`anvas.width,offscreenCanvas.heiga!ht),topCtx.clearRect(0,0,offscrea!enCanvas.width,offscreenCanvas.ha!eight),drawBase(),drawBoxes(),isa!Downloading&&(download(),isDownla"oading=!1),ctx.drawImage(backgroa" undCanvas,0,0,canvas.width,canvaa"@s.height),ctx.drawImage(secondara"`yCanvas,0,0,canvas.width,canvas.a"height),ctx.drawImage(topCanvas,a"0,0,canvas.width,canvas.height),a"first){first2&&(first2=!1,backgra"oundToggle.isSelected=!0,isResida#ueVisible=!isResidueVisible,secoa# ndaryCtx.clearRect(0,0,canvas.wia#@dth,canvas.height+bottomBarHeigha#`t),redrawCanvas()),first=!1;consa#t e=canvas.width/random.random_na#um(1.5,3),t=canvas.height/randoma#.random_num(1.5,3);let o=e,n=t,aa#=setInterval((function(){gravitaa$te(o,n)}),80);setTimeout((()=>{ca$ learInterval(a),a=null,redrawCana$@vas()}),800),addMouseEvents()}}fa$`unction download(){var e=documena$t.createElement('canvas');e.widta$h=canvas.width-bottomBarHeight,ea$.height=canvas.height-bottomBarHa$eight;var t=e.getContext('2d');ta%.filter='sepia(.2)',t.drawImage(a% backgroundCanvas,0,0,e.width,baca%@kgroundCanvas.height),t.drawImaga%`e(secondaryCanvas,0,0,e.width,sea%condaryCanvas.height);var o=docua%ment.createElement('a');o.downloa%Rlad='Palette_#`.png',o.href=e.toDataURL(),o.click()}const contextMenu=document.a&
createElement('div');function cra&-eateMenuItem(e){const t=documenta&M.createElement('div');return t.ta&mextContent=e,t.style.padding='.5a&em',t.style.cursor='pointer',t.sa&tyle.color='#fff',t.style.fontFaa&͂mily='Helvetica',t.style.fontSiza&e='16px',t.style.minHeight='44pxa'
',t.style.display='flex',t.stylea'-.alignItems='center',t.addEventLa'Mistener('mouseover',(()=>{t.styla'me.backgroundColor='#fff',t.stylea'.color='#000'})),t.addEventListea'ner('mouseout',(()=>{t.style.baca'͂kgroundColor='transparent',t.stya'le.color='#fff'})),t}contextMenua(
.style.position='fixed',contextMa(-enu.style.display='none',contexta(MMenu.style.backgroundColor='#000a(m',contextMenu.style.border='.01ea(m solid #fff',contextMenu.style.a(padding='.1em',contextMenu.stylea(͂.zIndex='1000',contextMenu.stylea(.minWidth='150px',contextMenu.sta)
yle.touchAction='none';const copa)-yOption=createMenuItem('Copy Imaa)Mge');copyOption.addEventListenera)m('click',(e=>{const t=document.ca)reateElement('canvas');t.width=ca)anvas.width-bottomBarHeight,t.hea)͂ight=canvas.height-bottomBarHeiga)ht;const o=t.getContext('2d');baa*
ckgroundCtx.filter='sepia(.2)',sa*-econdaryCtx.filter='sepia(.2)',oa*M.filter='sepia(.2)',o.drawImage(a*mbackgroundCanvas,0,0,t.width,baca*kgroundCanvas.height),o.drawImaga*e(secondaryCanvas,0,0,t.width,sea*͂condaryCanvas.height),t.toBlob((a*e=>{const t=new ClipboardItem({'a+
image/png':e});navigator.clipboaa+-rd.write([t])})),contextMenu.stya+Mle.display='none'}));const bgOpta+mion=createMenuItem('Toggle Backga+round');bgOption.addEventListenea+r('click',(e=>{isBgColorToggle=!a+͂isBgColorToggle,backgroundCtx.cla+earRect(0,0,canvas.width,canvas.a,
height),redrawCanvas(),contextMea,-nu.style.display='none'}));consta,M residueOption=createMenuItem('Ta,moggle Residue');residueOption.ada,dEventListener('click',(e=>{isRea,sidueVisible=!isResidueVisible,sa,͂econdaryCtx.clearRect(0,0,canvasa,.width,canvas.height+bottomBarHea-
ight),redrawCanvas(),contextMenua--.style.display='none'}));const da-MownloadOption=createMenuItem('Doa-mwnload PNG');downloadOption.addEa-ventListener('click',(e=>{isDowna-loading=!0,redrawCanvas(),contexa-͂tMenu.style.display='none'}));coa-nst staticOption=createMenuItem(a.
'Show Static Image');staticOptioa.-n.addEventListener('click',(e=>{a.MswitchToStatic(),contextMenu.stya.mle.display='none'})),contextMenua..appendChild(copyOption),contexta.Menu.appendChild(bgOption),contea.͂xtMenu.appendChild(residueOptiona.),contextMenu.appendChild(downloa/
adOption),contextMenu.appendChila/-d(staticOption),document.body.apa/MpendChild(contextMenu);function a/mshowContextMenu(e,t){contextMenua/.style.display='block';const o=ca/ontextMenu.getBoundingClientRecta/͂(),n=window.innerWidth,a=window.a/innerHeight;e+o.width>n&&(e=n-o.a0
width),t+o.height>a&&(t=a-o.heiga0-ht),contextMenu.style.left=e+'pxa0M',contextMenu.style.top=t+'px'}da0mocument.addEventListener('click'a0,(e=>{contextMenu.contains(e.tara0get)||(contextMenu.style.displaya0͂='none')}));function switchToAnia0mation(){if(isAnimationView)retua1
rn;isAnimationView=!0,canvas.stya1-le.display='block',requestAnimata1MionFrame((()=>{canvas.style.opaca1mity='1',canvas.style.transform='a1scale(1)'})),staticPreview&&(staa1ticPreview.style.opacity='0',staa1͂ticPreview.style.transform='scala1e(1.025)',setTimeout((()=>{statia2
cPreview.style.display='none'}),a2-430)),hasAnimationStarted||(hasAa2MnimationStarted=!0,redrawCanvas(a2m))}function switchToStatic(){isAa2nimationView=!1,canvas.style.opaa2city='0',canvas.style.transform=a2͂'scale(.985)',setTimeout((()=>{ia2sAnimationView||(canvas.style.dia3
splay='none')}),430),staticPrevia3-ew&&(staticPreview.style.displaya3M='flex',requestAnimationFrame(((a3m)=>{staticPreview.style.opacity=a3'1',staticPreview.style.transfora3m='scale(1)'}))),contextMenu.stya3͂le.display='none'}staticPreview&a3&(staticPreview.addEventListenera4
('click',switchToAnimation),stata4-icPreview.addEventListener('touca4Mhend',(e=>{e.preventDefault(),swa4mitchToAnimation()})));let offseta4X,offsetY,gravitateInterval=nulla4,gX=0,gY=0,isDragging=!1,selectea4͂dBox=null,selectedPaletteBox=nula4l;function addMouseEvents(){canva5
as.addEventListener('mousedown',a5-(e=>{if(0===e.button){const t=caa5Mnvas.getBoundingClientRect();leta5m o=e.clientX-t.left,n=e.clientY-a5t.top;o=mapValue(o,0,smallerDimea5nsion,0,canvas.width),n=mapValuea5͂(n,0,smallerDimension,0,canvas.ha5eight);for(let e of boxData)if(oa6
>=e.x&&o<=e.x+e.boxWidth&&n>=e.ya6-&&n<=e.y+e.boxHeight){isDragginga6M=!0,selectedBox=e,offsetX=o-e.x,a6moffsetY=n-e.y;break}if(null!=sela6ectedBox)return;null==gravitateIa6nterval&&(gX=o,gY=n,gravitateInta6͂erval=setInterval((function(){gra6avitate(gX,gY)}),10))}}))}functia7
on gravitate(e,t){for(let o of ba7-oxData){if(o.gEnabled){const n=ea7M-(o.x+o.boxWidth/2),a=t-(o.y+o.ba7moxHeight/2),l=Math.sqrt(n*n+a*a)a7,s=n/l,i=a/l,r=2;o.x+=s*r,o.y+=ia7*r}}redrawCanvas()}canvas.addEvea7͂ntListener('mousemove',(e=>{if(ia7sDragging&&selectedBox){const t=a8
canvas.getBoundingClientRect();la8-et o=e.clientX-t.left,n=e.clienta8MY-t.top;o=mapValue(o,0,smallerDia8mmension,0,canvas.width),n=mapVala8ue(n,0,smallerDimension,0,canvasa8.height),selectedBox.x=o-offsetXa8͂,selectedBox.y=n-offsetY,redrawCa8anvas()}if(null!=gravitateInterva9
al){const t=canvas.getBoundingCla9-ientRect();let o=e.clientX-t.lefa9Mt,n=e.clientY-t.top;gX=mapValue(a9mo,0,smallerDimension,0,canvas.wia9dth),gY=mapValue(n,0,smallerDimea9nsion,0,canvas.height)}})),canvaa9͂s.addEventListener('mouseup',(e=a9{if(clearInterval(gravitateIntea:
rval),gravitateInterval=null,isDa:-ragging=!1,null!=selectedPalettea:MBox&&(selectedPaletteBox.isSeleca:mted=!1,party=!1,selectedPaletteBa:ox=null,redrawCanvas()),null==sea:lectedBox)return;const t=canvas.a:͂getBoundingClientRect();let o=e.a:clientX-t.left,n=e.clientY-t.topa;
;o=mapValue(o,0,smallerDimensiona;-,0,canvas.width),n=mapValue(n,0,a;MsmallerDimension,0,canvas.heighta;m),selectedBox.x=o-offsetX,selecta;edBox.y=n-offsetY,selectedBox=nua;ll,redrawCanvas()})),canvas.addEa;͂ventListener('contextmenu',(funca;tion(e){}));let lastTapTime=0;fua<
nction hexToHSLString(e){const ta<-=hexToHSL(e);return hslToString(a<Mt.h,t.s,t.l)}function hslToStrina<mg(e,t,o){return`hsl(${e}, ${t}%,a< ${o}%)`}function hexToHSL(e){e=a<e.replace(/^#/,'');let t,o,n=para<͂seInt(e.substring(0,2),16)/255,aa<=parseInt(e.substring(2,4),16)/2a=
55,l=parseInt(e.substring(4,6),1a=-6)/255,s=Math.max(n,a,l),i=Math.a=Mmin(n,a,l),r=(s+i)/2;if(s===i)t=a=mo=0;else{let e=s-i;switch(o=r>.5a=?e/(2-s-i):e/(s+i),s){case n:t=(a=a-l)/e+(a<l?6:0);break;case a:t=a=͂(l-n)/e+2;break;case l:t=(n-a)/ea=+4}t/=6}return t=Math.round(360*a>
t),o=Math.round(100*o),r=Math.roa>-und(100*r),{h:t,s:o,l:r}}functioa>Mn sortColorsByHSL(e){return[...ea>m].sort(((e,t)=>{const o=hexToHSLa>(e),n=hexToHSL(t);return o.h!==na>.h?o.h-n.h:o.s!==n.s?n.s-o.s:n.la>͂-o.l}))}function mapValue(e,t,o,a>n,a){return n+(e-t)/(o-t)*(a-n)}a?
canvas.addEventListener('touchsta?-art',(e=>{e.preventDefault(),cona?MtextMenu.contains(e.target)||(coa?mntextMenu.style.display='none');a?const t=(new Date).getTime();lasa?tTapTime=t;const o=canvas.getBoua?͂ndingClientRect();let n=e.touchea?s[0].clientX-o.left,a=e.touches[a@
0].clientY-o.top;n=mapValue(n,0,a@-smallerDimension,0,canvas.width)a@M,a=mapValue(a,0,smallerDimensiona@m,0,canvas.height);for(let e of ba@oxData)if(n>=e.x&&n<=e.x+e.boxWia@dth&&a>=e.y&&a<=e.y+e.boxHeight)a@͂{isDragging=!0,selectedBox=e,offa@setX=n-e.x,offsetY=a-e.y;lastTapaA
Time=0;break}if(null==selectedBoaA-x){null==gravitateInterval&&(gX=aAMn,gY=a,gravitateInterval=setInteaAmrval((function(){gravitate(gX,gYaA)}),10))}})),canvas.addEventListaAener('touchmove',(e=>{if(e.preveaA͂ntDefault(),isDragging&&selectedaABox){const t=canvas.getBoundingCaB
lientRect();let o=e.touches[0].caB-lientX-t.left,n=e.touches[0].cliaBMentY-t.top;o=mapValue(o,0,smalleaBmrDimension,0,canvas.width),n=mapaBValue(n,0,smallerDimension,0,canaBvas.height),selectedBox.x=o-offsaB͂etX,selectedBox.y=n-offsetY,redraBawCanvas()}if(null!=gravitateIntaC
erval){const t=canvas.getBoundinaC-gClientRect();let o=e.touches[0]aCM.clientX-t.left,n=e.touches[0].caCmlientY-t.top;gX=mapValue(o,0,smaaCllerDimension,0,canvas.width),gYaC=mapValue(n,0,smallerDimension,0aC͂,canvas.height)}})),canvas.addEvaCentListener('touchend',(e=>{e.praD
eventDefault();const t=(new DateaD-).getTime()-lastTapTime;if(t<150aDM0&&t>500&&t>0)return clearIntervaDmal(gravitateInterval),gravitateIaDnterval=null,br=canvas.getBoundiaDngClientRect(),void(lastTapTime=aD͂0);clearInterval(gravitateIntervaDal),gravitateInterval=null,backgaE
roundToggle.isSelected&&(backgroaE-undToggle.isSelected=!1,redrawCaaEMnvas()),bgColorToggle.isSelectedaEm&&(bgColorToggle.isSelected=!1,raEedrawCanvas()),downloadBox.isSelaEected&&(downloadBox.isSelected=!aE͂1,isDownloading=!0,redrawCanvas(aE)),null!=selectedPaletteBox&&(seaF
lectedPaletteBox.isSelected=!1,saF-electedPaletteBox=null,redrawCanaFMvas()),isDragging=!1,selectedBoxaFm=null,redrawCanvas()}))</script>aFReentrancyGuard: reentrant call