@munusshih/p5.export 0.1.0-beta.4 → 0.1.0-beta.5

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.
@@ -9,7 +9,7 @@
9
9
  * Kerry Liu
10
10
  *
11
11
  * Copyright (c) 2014 Gliffy Inc.
12
- */(function(t){(function(){var e,i,r,s,n;function a(h,d){var f=Object.keys(d),m;for(m=0;m<f.length;m++)h=h.replace(new RegExp("\\{"+f[m]+"\\}","gi"),d[f[m]]);return h}function l(h){var d,f,m;if(!h)throw new Error("cannot create a random attribute name for an undefined object");d="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",f="";do for(f="",m=0;m<12;m++)f+=d[Math.floor(Math.random()*d.length)];while(h[f]);return f}function u(h,d){var f,m,w={},y;for(h=h.split(","),d=d||10,f=0;f<h.length;f+=2)m="&"+h[f+1]+";",y=parseInt(h[f],d),w[m]="&#"+y+";";return w["\\xa0"]="&#160;",w}function g(h){var d={left:"start",right:"end",center:"middle",start:"start",end:"end"};return d[h]||d.start}function v(h){var d={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return d[h]||d.alphabetic}n=u("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),e={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"}},r=function(h,d){this.__root=h,this.__ctx=d},r.prototype.addColorStop=function(h,d){var f=this.__ctx.__createElement("stop"),m,w;f.setAttribute("offset",h),d.indexOf("rgba")!==-1?(m=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi,w=m.exec(d),f.setAttribute("stop-color",a("rgb({r},{g},{b})",{r:w[1],g:w[2],b:w[3]})),f.setAttribute("stop-opacity",w[4])):f.setAttribute("stop-color",d),this.__root.appendChild(f)},s=function(h,d){this.__root=h,this.__ctx=d},i=function(h){var d={width:500,height:500,enableMirroring:!1},f;if(arguments.length>1?(f=d,f.width=arguments[0],f.height=arguments[1]):h?f=h:f=d,!(this instanceof i))return new i(f);this.width=f.width||d.width,this.height=f.height||d.height,this.enableMirroring=f.enableMirroring!==void 0?f.enableMirroring:d.enableMirroring,this.canvas=this,this.__document=f.document||document,this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d"),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__root.setAttribute("version",1.1),this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__ids={},this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__root.appendChild(this.__currentElement)},i.prototype.__createElement=function(h,d,f){typeof d>"u"&&(d={});var m=this.__document.createElementNS("http://www.w3.org/2000/svg",h),w=Object.keys(d),y,C;for(f&&(m.setAttribute("fill","none"),m.setAttribute("stroke","none")),y=0;y<w.length;y++)C=w[y],m.setAttribute(C,d[C]);return m},i.prototype.__setDefaultStyles=function(){var h=Object.keys(e),d,f;for(d=0;d<h.length;d++)f=h[d],this[f]=e[f].canvas},i.prototype.__applyStyleState=function(h){var d=Object.keys(h),f,m;for(f=0;f<d.length;f++)m=d[f],this[m]=h[m]},i.prototype.__getStyleState=function(){var h,d={},f=Object.keys(e),m;for(h=0;h<f.length;h++)m=f[h],d[m]=this[m];return d},i.prototype.__applyStyleToCurrentElement=function(h){var d=Object.keys(e),f,m,w,y,C,S;for(f=0;f<d.length;f++)if(m=e[d[f]],w=this[d[f]],m.apply)if(m.apply.indexOf("fill")!==-1&&w instanceof s){if(w.__ctx)for(;w.__ctx.__defs.childNodes.length;)y=w.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[y]=y,this.__defs.appendChild(w.__ctx.__defs.childNodes[0]);this.__currentElement.setAttribute("fill",a("url(#{id})",{id:w.__root.getAttribute("id")}))}else m.apply.indexOf("fill")!==-1&&w instanceof r?this.__currentElement.setAttribute("fill",a("url(#{id})",{id:w.__root.getAttribute("id")})):m.apply.indexOf(h)!==-1&&m.svg!==w&&((m.svgAttr==="stroke"||m.svgAttr==="fill")&&w.indexOf("rgba")!==-1?(C=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi,S=C.exec(w),this.__currentElement.setAttribute(m.svgAttr,a("rgb({r},{g},{b})",{r:S[1],g:S[2],b:S[3]})),this.__currentElement.setAttribute(m.svgAttr+"-opacity",S[4])):this.__currentElement.setAttribute(m.svgAttr,w))},i.prototype.__closestGroupOrSvg=function(h){return h=h||this.__currentElement,h.nodeName==="g"||h.nodeName==="svg"?h:this.__closestGroupOrSvg(h.parentNode)},i.prototype.getSerializedSvg=function(h){var d=new XMLSerializer().serializeToString(this.__root),f,m,w,y,C,S;if(S=/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi,S.test(d)&&(d=d.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),h)for(f=Object.keys(n),m=0;m<f.length;m++)w=f[m],y=n[w],C=new RegExp(w,"gi"),C.test(d)&&(d=d.replace(C,y));return d},i.prototype.getSvg=function(){return this.__root},i.prototype.save=function(){var h=this.__createElement("g"),d=this.__closestGroupOrSvg();this.__groupStack.push(d),d.appendChild(h),this.__currentElement=h,this.__stack.push(this.__getStyleState())},i.prototype.restore=function(){this.__currentElement=this.__groupStack.pop();var h=this.__stack.pop();this.__applyStyleState(h)},i.prototype.__addTransform=function(h){var d=this.__closestGroupOrSvg();if(d.childNodes.length>0){var f=this.__createElement("g");d.appendChild(f),this.__currentElement=f}var m=this.__currentElement.getAttribute("transform");m?m+=" ":m="",m+=h,this.__currentElement.setAttribute("transform",m)},i.prototype.scale=function(h,d){d===void 0&&(d=h),this.__addTransform(a("scale({x},{y})",{x:h,y:d}))},i.prototype.rotate=function(h){var d=h*180/Math.PI;this.__addTransform(a("rotate({angle},{cx},{cy})",{angle:d,cx:0,cy:0}))},i.prototype.translate=function(h,d){this.__addTransform(a("translate({x},{y})",{x:h,y:d}))},i.prototype.transform=function(h,d,f,m,w,y){this.__addTransform(a("matrix({a},{b},{c},{d},{e},{f})",{a:h,b:d,c:f,d:m,e:w,f:y}))},i.prototype.beginPath=function(){var h,d;this.__currentDefaultPath="",this.__currentPosition={},h=this.__createElement("path",{},!0),d=this.__closestGroupOrSvg(),d.appendChild(h),this.__currentElement=h},i.prototype.__applyCurrentDefaultPath=function(){if(this.__currentElement.nodeName==="path"){var h=this.__currentDefaultPath;this.__currentElement.setAttribute("d",h)}else throw new Error("Attempted to apply path command to node "+this.__currentElement.nodeName)},i.prototype.__addPathCommand=function(h){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=h},i.prototype.moveTo=function(h,d){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:h,y:d},this.__addPathCommand(a("M {x} {y}",{x:h,y:d}))},i.prototype.closePath=function(){this.__addPathCommand("Z")},i.prototype.lineTo=function(h,d){this.__currentPosition={x:h,y:d},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(a("L {x} {y}",{x:h,y:d})):this.__addPathCommand(a("M {x} {y}",{x:h,y:d}))},i.prototype.bezierCurveTo=function(h,d,f,m,w,y){this.__currentPosition={x:w,y},this.__addPathCommand(a("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:h,cp1y:d,cp2x:f,cp2y:m,x:w,y}))},i.prototype.quadraticCurveTo=function(h,d,f,m){this.__currentPosition={x:f,y:m},this.__addPathCommand(a("Q {cpx} {cpy} {x} {y}",{cpx:h,cpy:d,x:f,y:m}))};var p=function(h){var d=Math.sqrt(h[0]*h[0]+h[1]*h[1]);return[h[0]/d,h[1]/d]};i.prototype.arcTo=function(h,d,f,m,w){var y=this.__currentPosition&&this.__currentPosition.x,C=this.__currentPosition&&this.__currentPosition.y;if(!(typeof y>"u"||typeof C>"u")){if(w<0)throw new Error("IndexSizeError: The radius provided ("+w+") is negative.");if(y===h&&C===d||h===f&&d===m||w===0){this.lineTo(h,d);return}var S=p([y-h,C-d]),_=p([f-h,m-d]);if(S[0]*_[1]===S[1]*_[0]){this.lineTo(h,d);return}var M=S[0]*_[0]+S[1]*_[1],j=Math.acos(Math.abs(M)),B=p([S[0]+_[0],S[1]+_[1]]),O=w/Math.sin(j/2),G=h+O*B[0],tt=d+O*B[1],X=[-S[1],S[0]],q=[_[1],-_[0]],ht=function(A){var F=A[0],b=A[1];return b>=0?Math.acos(F):-Math.acos(F)},Y=ht(X),L=ht(q);this.lineTo(G+X[0]*w,tt+X[1]*w),this.arc(G,tt,w,Y,L)}},i.prototype.stroke=function(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")},i.prototype.fill=function(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")},i.prototype.rect=function(h,d,f,m){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(h,d),this.lineTo(h+f,d),this.lineTo(h+f,d+m),this.lineTo(h,d+m),this.lineTo(h,d),this.closePath()},i.prototype.fillRect=function(h,d,f,m){var w,y;w=this.__createElement("rect",{x:h,y:d,width:f,height:m},!0),y=this.__closestGroupOrSvg(),y.appendChild(w),this.__currentElement=w,this.__applyStyleToCurrentElement("fill")},i.prototype.strokeRect=function(h,d,f,m){var w,y;w=this.__createElement("rect",{x:h,y:d,width:f,height:m},!0),y=this.__closestGroupOrSvg(),y.appendChild(w),this.__currentElement=w,this.__applyStyleToCurrentElement("stroke")},i.prototype.clearRect=function(h,d,f,m){var w,y=this.__closestGroupOrSvg();w=this.__createElement("rect",{x:h,y:d,width:f,height:m,fill:"#FFFFFF"},!0),y.appendChild(w)},i.prototype.createLinearGradient=function(h,d,f,m){var w=this.__createElement("linearGradient",{id:l(this.__ids),x1:h+"px",x2:f+"px",y1:d+"px",y2:m+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(w),new r(w,this)},i.prototype.createRadialGradient=function(h,d,f,m,w,y){var C=this.__createElement("radialGradient",{id:l(this.__ids),cx:m+"px",cy:w+"px",r:y+"px",fx:h+"px",fy:d+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(C),new r(C,this)},i.prototype.__parseFont=function(){var h=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\"\sa-z]+?)\s*$/i,d=h.exec(this.font),f={style:d[1]||"normal",size:d[4]||"10px",family:d[6]||"sans-serif",weight:d[3]||"normal",decoration:d[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(f.decoration="underline"),this.__fontHref&&(f.href=this.__fontHref),f},i.prototype.__wrapTextLink=function(h,d){if(h.href){var f=this.__createElement("a");return f.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.href),f.appendChild(d),f}return d},i.prototype.__applyText=function(h,d,f,m){var w=this.__parseFont(),y=this.__closestGroupOrSvg(),C=this.__createElement("text",{"font-family":w.family,"font-size":w.size,"font-style":w.style,"font-weight":w.weight,"text-decoration":w.decoration,x:d,y:f,"text-anchor":g(this.textAlign),"dominant-baseline":v(this.textBaseline)},!0);C.appendChild(this.__document.createTextNode(h)),this.__currentElement=C,this.__applyStyleToCurrentElement(m),y.appendChild(this.__wrapTextLink(w,C))},i.prototype.fillText=function(h,d,f){this.__applyText(h,d,f,"fill")},i.prototype.strokeText=function(h,d,f){this.__applyText(h,d,f,"stroke")},i.prototype.measureText=function(h){return this.__ctx.font=this.font,this.__ctx.measureText(h)},i.prototype.arc=function(h,d,f,m,w,y){if(m!==w){m=m%(2*Math.PI),w=w%(2*Math.PI),m===w&&(w=(w+2*Math.PI-.001*(y?-1:1))%(2*Math.PI));var C=h+f*Math.cos(w),S=d+f*Math.sin(w),_=h+f*Math.cos(m),M=d+f*Math.sin(m),j=y?0:1,B=0,O=w-m;O<0&&(O+=2*Math.PI),y?B=O>Math.PI?0:1:B=O>Math.PI?1:0,this.lineTo(_,M),this.__addPathCommand(a("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:f,ry:f,xAxisRotation:0,largeArcFlag:B,sweepFlag:j,endX:C,endY:S})),this.__currentPosition={x:C,y:S}}},i.prototype.clip=function(){var h=this.__closestGroupOrSvg(),d=this.__createElement("clipPath"),f=l(this.__ids),m=this.__createElement("g");h.removeChild(this.__currentElement),d.setAttribute("id",f),d.appendChild(this.__currentElement),this.__defs.appendChild(d),h.setAttribute("clip-path",a("url(#{id})",{id:f})),h.appendChild(m),this.__currentElement=m},i.prototype.drawImage=function(){var h=Array.prototype.slice.call(arguments),d=h[0],f,m,w,y,C=0,S=0,_,M,j,B,O,G,tt,X,q,ht,Y;if(h.length===3)f=h[1],m=h[2],_=d.width,M=d.height,w=_,y=M;else if(h.length===5)f=h[1],m=h[2],w=h[3],y=h[4],_=d.width,M=d.height;else if(h.length===9)C=h[1],S=h[2],_=h[3],M=h[4],f=h[5],m=h[6],w=h[7],y=h[8];else throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);if(j=this.__closestGroupOrSvg(),tt=this.__currentElement,d instanceof i){for(B=d.getSvg(),O=B.childNodes[0];O.childNodes.length;)Y=O.childNodes[0].getAttribute("id"),this.__ids[Y]=Y,this.__defs.appendChild(O.childNodes[0]);G=B.childNodes[1],j.appendChild(G),this.__currentElement=G,this.translate(f,m),this.__currentElement=tt}else(d.nodeName==="CANVAS"||d.nodeName==="IMG")&&(X=this.__createElement("image"),X.setAttribute("width",w),X.setAttribute("height",y),X.setAttribute("preserveAspectRatio","none"),(C||S||_!==d.width||M!==d.height)&&(q=this.__document.createElement("canvas"),q.width=w,q.height=y,ht=q.getContext("2d"),ht.drawImage(d,C,S,_,M,0,0,w,y),d=q),X.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d.nodeName==="CANVAS"?d.toDataURL():d.getAttribute("src")),j.appendChild(X),this.__currentElement=X,this.translate(f,m),this.__currentElement=tt)},i.prototype.createPattern=function(h,d){var f=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),m=l(this.__ids),w;return f.setAttribute("id",m),f.setAttribute("width",h.width),f.setAttribute("height",h.height),h.nodeName==="CANVAS"||h.nodeName==="IMG"?(w=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),w.setAttribute("width",h.width),w.setAttribute("height",h.height),w.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.nodeName==="CANVAS"?h.toDataURL():h.getAttribute("src")),f.appendChild(w),this.__defs.appendChild(f)):h instanceof i&&(f.appendChild(h.__root.childNodes[1]),this.__defs.appendChild(f)),new s(f,this)},i.prototype.drawFocusRing=function(){},i.prototype.createImageData=function(){},i.prototype.getImageData=function(){},i.prototype.putImageData=function(){},i.prototype.globalCompositeOperation=function(){},i.prototype.setTransform=function(){},typeof window=="object"&&(window.C2S=i),t.exports=i})()})(zr);var hn=zr.exports;const _t=on(hn),ln=Math.PI*2;let dn=0;function cn(){return`p5ExportPattern_${++dn}`}function fn(t){const e=t._patternControler,i=e&&Array.isArray(e.colors)?e.colors:null;if(!i||i.length===0)return"#888888";const r=i[i.length-1];return typeof r=="string"?r:r&&typeof r.toString=="function"?r.toString():"#888888"}function ge(t,e,i,r,s){return s==="corners"?{x:t,y:e,w:i-t,h:r-e}:s==="radius"?{x:t-i,y:e-r,w:2*i,h:2*r}:s==="center"?{x:t-i*.5,y:e-r*.5,w:i,h:r}:{x:t,y:e,w:i,h:r}}function Vr(t){return t._renderer&&t._renderer.states&&t._renderer.states.rectMode||"corner"}function Pi(t){return t._renderer&&t._renderer.states&&t._renderer.states.ellipseMode||"center"}function un(t,e,i){const r=t._p5ExportSVGRecorder;r&&r.ops.push([3,e,i])}function pn(t,e){const i=t._p5ExportSVGRecorder;i&&i.ops.push([2,"beginRaster",e])}function mn(t){const e=t._p5ExportSVGRecorder;e&&e.ops.push([2,"endRaster"])}function Dt(t,e,i){const r=t[e];typeof r!="function"||r.__p5ExportWrapped||(t[e]=function(...s){let n,a;try{if(a=i(this,s),a){n=cn();const u=fn(this);un(this,a.kind,{...a,color:u,patternId:n})}}catch{}const l=!!this._p5ExportSVGRecorder&&!!n&&!!a;l&&pn(this,{bbox:a,patternId:n});try{return r.apply(this,s)}finally{l&&mn(this)}},t[e].__p5ExportWrapped=!0)}const wn=["rectPattern","squarePattern","ellipsePattern","circlePattern","arcPattern","trianglePattern","quadPattern"];function Lr(t,e){if(!t||!t.prototype)return!1;const i=t.prototype;if(typeof i.rectPattern!="function")return!1;const r=!!i.__p5ExportPatternHooksInstalled;if(r||(i.__p5ExportPatternHooksInstalled=!0),e&&e._renderer&&e._renderer.states){const n=t.Renderer||e._renderer.constructor;if(n&&n.prototype&&!n.prototype.__p5ExportModeBridged){n.prototype.__p5ExportModeBridged=!0;for(const a of["rectMode","ellipseMode","imageMode","colorMode"])Object.defineProperty(n.prototype,"_"+a,{configurable:!0,get(){return this.states&&this.states[a]},set(l){this.states&&(this.states[a]=l)}})}}r||(Dt(i,"rectPattern",(n,a)=>({kind:"rect",...ge(a[0],a[1],a[2],a[3],Vr(n))})),Dt(i,"squarePattern",(n,a)=>({kind:"rect",...ge(a[0],a[1],a[2],a[2],Vr(n))})),Dt(i,"ellipsePattern",(n,a)=>({kind:"ellipse",...ge(a[0],a[1],a[2],a[3],Pi(n))})),Dt(i,"circlePattern",(n,a)=>({kind:"ellipse",...ge(a[0],a[1],a[2],a[2],Pi(n))})),Dt(i,"arcPattern",(n,a)=>({kind:"ellipse",...ge(a[0],a[1],a[2],a[3],Pi(n))})),Dt(i,"trianglePattern",(n,a)=>{const l=[a[0],a[2],a[4]],u=[a[1],a[3],a[5]],g=Math.min(...l),v=Math.max(...l),p=Math.min(...u),h=Math.max(...u);return{kind:"polygon",points:[[a[0],a[1]],[a[2],a[3]],[a[4],a[5]]],x:g,y:p,w:v-g,h:h-p}}),Dt(i,"quadPattern",(n,a)=>{const l=[a[0],a[2],a[4],a[6]],u=[a[1],a[3],a[5],a[7]],g=Math.min(...l),v=Math.max(...l),p=Math.min(...u),h=Math.max(...u);return{kind:"polygon",points:[[a[0],a[1]],[a[2],a[3]],[a[4],a[5]],[a[6],a[7]]],x:g,y:p,w:v-g,h:h-p}}));const s=e&&e._isGlobal&&e||typeof window<"u"&&window.p5&&window.p5.instance||null;if(s&&s._isGlobal&&typeof window<"u")for(const n of wn){const a=i[n];if(typeof a=="function")try{let l=a.bind(s);Object.defineProperty(window,n,{configurable:!0,enumerable:!0,get(){return l},set(u){}})}catch{}}return!0}const Or="p5ExportSharedRaster";function gn(t,e,i,r){if(!i||!t)return;const s=t.fillStyle;i.patternId?t.fillStyle=`url(#${i.patternId})`:t.fillStyle=`url(#${Or})`;try{if(e==="rect")t.beginPath(),t.rect(i.x,i.y,i.w,i.h),t.fill();else if(e==="ellipse"){const n=i.w/2,a=i.h/2,l=i.x+n,u=i.y+a;t.beginPath(),t.ellipse(l,u,n,a,0,0,ln),t.fill()}else if(e==="polygon"){const n=i.points||[];if(n.length>=2){t.beginPath(),t.moveTo(n[0][0],n[0][1]);for(let a=1;a<n.length;a++)t.lineTo(n[a][0],n[a][1]);t.closePath(),t.fill()}}}finally{t.fillStyle=s}}let Gr=!1;function vn(){if(Gr)return;Gr=!0,_t.prototype.setTransform=function(r,s,n,a,l,u){const v=this.__groupStack&&this.__groupStack.length>0?this.__closestGroupOrSvg():this.__root,p=this.__createElement("g");v.appendChild(p),this.__currentElement=p,r===1&&s===0&&n===0&&a===1&&l===0&&u===0||this.__currentElement.setAttribute("transform",`matrix(${r},${s},${n},${a},${l},${u})`)},_t.prototype.resetTransform=function(){this.setTransform(1,0,0,1,0,0)},_t.prototype.ellipse=function(r,s,n,a,l,u,g,v){if(u===g)return;l=l||0;const p=Math.PI*2;u=u%p,g=g%p,u===g&&(g=(g+p-.001*(v?-1:1))%p);const h=Math.cos(l),d=Math.sin(l),f=M=>{const j=n*Math.cos(M),B=a*Math.sin(M);return{x:r+j*h-B*d,y:s+j*d+B*h}},m=f(u),w=f(g);let y=g-u;y<0&&(y+=p);const C=v?0:1,S=v?y>Math.PI?0:1:y>Math.PI?1:0,_=l*180/Math.PI;this.lineTo(m.x,m.y),this.__addPathCommand("A "+n+" "+a+" "+_+" "+S+" "+C+" "+w.x+" "+w.y),this.__currentPosition={x:w.x,y:w.y}},typeof _t.prototype.roundRect!="function"&&(_t.prototype.roundRect=function(r,s,n,a,l){let u,g,v,p;typeof l=="number"?u=g=v=p=l:Array.isArray(l)?l.length===1?u=g=v=p=l[0]:l.length===2?(u=v=l[0],g=p=l[1]):[u,g,v,p]=[l[0],l[1],l[2],l[3]??l[1]]:u=g=v=p=0;const h=Math.min(Math.abs(n),Math.abs(a))/2;u=Math.min(u,h),g=Math.min(g,h),v=Math.min(v,h),p=Math.min(p,h),this.moveTo(r+u,s),this.lineTo(r+n-g,s),this.ellipse(r+n-g,s+g,g,g,0,-Math.PI/2,0),this.lineTo(r+n,s+a-v),this.ellipse(r+n-v,s+a-v,v,v,0,0,Math.PI/2),this.lineTo(r+p,s+a),this.ellipse(r+p,s+a-p,p,p,0,Math.PI/2,Math.PI),this.lineTo(r,s+u),this.ellipse(r+u,s+u,u,u,0,Math.PI,Math.PI*1.5)}),delete _t.prototype.globalCompositeOperation;const t=_t.prototype.__applyStyleToCurrentElement,e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,i=r=>{if(typeof r!="string")return r;const s=e.exec(r);if(!s)return r;const n=Math.round(parseInt(s[4],16)/255*1e3)/1e3;return`rgba(${parseInt(s[1],16)},${parseInt(s[2],16)},${parseInt(s[3],16)},${n})`};_t.prototype.__applyStyleToCurrentElement=function(r){const s=this.fillStyle,n=this.strokeStyle;typeof s=="string"&&(this.fillStyle=i(s)),typeof n=="string"&&(this.strokeStyle=i(n));try{return t.call(this,r)}finally{this.fillStyle=s,this.strokeStyle=n}}}const yn=60,Nr=new Set(["fillStyle","strokeStyle","lineWidth","lineCap","lineJoin","miterLimit","globalAlpha","font","textAlign","textBaseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]);let bn=0;const $r=new Map;function _n(){return`p5ExportGrad_${++bn}`}function xn(t){const e=[],i=[0],r={proxy:null,ops:e,maxFrames:yn,clear(){e.length=0,i.length=1,i[0]=0},markFrameBoundary(){if(this.maxFrames===1/0){i.push(e.length);return}for(i.push(e.length);i.length>this.maxFrames+1;){const a=i[1];if(a>0){const l={};for(let v=0;v<a;v++){const p=e[v];p[0]===1&&Nr.has(p[1])&&(l[p[1]]=p[2])}e.splice(0,a);const u=[];for(const v in l)u.push([1,v,l[v]]);u.length&&e.unshift(...u);const g=u.length-a;for(let v=1;v<i.length;v++)i[v]+=g}i.shift()}}},s=new Set(["createLinearGradient","createRadialGradient","createConicGradient"]),n=(a,l,u)=>{if(!a)return a;const g=_n(),v={id:g,kind:l,args:Array.from(u),stops:[]};$r.set(g,v);try{a.__p5ExportGradId=g}catch{}return new Proxy(a,{get(p,h){if(h==="addColorStop"&&typeof p[h]=="function")return function(f,m){return v.stops.push({offset:f,color:m}),p[h].call(p,f,m)};const d=p[h];return typeof d=="function"?d.bind(p):d}})};return r.proxy=new Proxy(t,{get(a,l){const u=a[l];return typeof u=="function"?function(...g){e.push([0,l,g]);const v=u.apply(a,g);return s.has(l)?n(v,l,g):v}:u},set(a,l,u){if((l==="fillStyle"||l==="strokeStyle")&&u&&typeof u=="object"){const g=u.__p5ExportGradId;e.push([1,l,g?{__p5ExportGradId:g}:u])}else e.push([1,l,u]);return a[l]=u,!0}}),r}function Sn(t){return!!(t&&typeof t.fillRect=="function")}function jr(t){if(!t||t._p5ExportSVGRecorder)return;const e=t._renderer;if(!e)return;const i=e.drawingContext;if(!Sn(i))return;const r=xn(i),s=typeof window<"u"&&window.p5ExportConfig||{};typeof s.svgMaxFrames=="number"&&(r.maxFrames=s.svgMaxFrames>0?s.svgMaxFrames:1/0),t._p5ExportSVGRecorder=r;const n={value:r.proxy,configurable:!0,writable:!0,enumerable:!0};Object.defineProperty(e,"drawingContext",n),Object.defineProperty(t,"drawingContext",n)}function qr(t){if(typeof t!="string")return t;const e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!e)return t;const i=parseInt(e[4],16)/255;return`rgba(${parseInt(e[1],16)},${parseInt(e[2],16)},${parseInt(e[3],16)},${i})`}function Cn(t){if(typeof t!="string")return!0;let e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);return e?parseInt(e[4],16)===255:(e=/^rgba\(\s*[^,]+,\s*[^,]+,\s*[^,]+,\s*([\d.]+)\s*\)$/i.exec(t),e?parseFloat(e[1])>=1:(e=/^#[0-9a-f]{3}([0-9a-f])$/i.exec(t),e?parseInt(e[1],16)===15:!0))}function Hr(t,e,i){let r=-1,s="#000000";const n=.5;let a=!1;for(let l=0;l<t.length;l++){const u=t[l];if(u[0]===2){u[1]==="beginRaster"?a=!0:u[1]==="endRaster"&&(a=!1);continue}if(!a){if(u[0]===1&&u[1]==="fillStyle")s=u[2];else if(u[0]===0&&(u[1]==="fillRect"||u[1]==="clearRect")){const g=u[2],v=g[0],p=g[1],h=g[2],d=g[3];Math.abs(v)<=n&&Math.abs(p)<=n&&Math.abs(h-e)<=n&&Math.abs(d-i)<=n&&(u[1]==="clearRect"||Cn(s))&&(r=l)}}}return r}function Xr(t){vn();const e=t._p5ExportSVGRecorder,i=t.width||100,r=t.height||100,s=new _t(i,r);if(s.setTransform(1,0,0,1,0,0),!e)return s.getSerializedSvg();let n="#000000",a="#000000";const l=new Set,u="http://www.w3.org/2000/svg",g=L=>{if(!L||l.has(L.id))return!0;const A=s.__defs,F=s.__document;let b;if(L.kind==="createLinearGradient"){const[W,et,lt,Bt]=L.args;b=F.createElementNS(u,"linearGradient"),b.setAttribute("gradientUnits","userSpaceOnUse"),b.setAttribute("x1",String(W)),b.setAttribute("y1",String(et)),b.setAttribute("x2",String(lt)),b.setAttribute("y2",String(Bt))}else if(L.kind==="createRadialGradient"){const[W,et,lt,Bt,Xe,Fr]=L.args;b=F.createElementNS(u,"radialGradient"),b.setAttribute("gradientUnits","userSpaceOnUse"),b.setAttribute("fx",String(W)),b.setAttribute("fy",String(et)),b.setAttribute("fr",String(lt)),b.setAttribute("cx",String(Bt)),b.setAttribute("cy",String(Xe)),b.setAttribute("r",String(Fr))}else return!1;b.setAttribute("id",L.id);for(const W of L.stops){const et=F.createElementNS(u,"stop");et.setAttribute("offset",String(W.offset)),et.setAttribute("stop-color",String(W.color)),b.appendChild(et)}return A.appendChild(b),l.add(L.id),!0},v=typeof t.pixelDensity=="function"?t.pixelDensity():1,p=1/v,h=e.ops.slice(),d=Hr(h,i,r);let f=0;if(d>0){let L=0,A=-1;for(let b=d-1;b>=0;b--)if(h[b][0]===0){if(h[b][1]==="restore")L++;else if(h[b][1]==="save"){if(L===0){A=b;break}L--}}f=A>=0?A:d;const F={};for(let b=0;b<f;b++){const W=h[b];W[0]===1&&Nr.has(W[1])&&(F[W[1]]=W[2])}for(const b in F){const W=F[b];b==="fillStyle"||b==="strokeStyle"?typeof W=="string"?(b==="fillStyle"?n=W:a=W,s[b]=qr(W)):s[b]=b==="fillStyle"?n:a:s[b]=W}}const m=bt(t),w=m?m.width:i*v,y=m?m.height:r*v;let C=null,S=null,_=null,M=null,j=null,B=!1;const O="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xlink",tt=()=>{C||(C=document.createElement("canvas"),C.width=w,C.height=y,S=C.getContext("2d")),S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,C.width,C.height),S.setTransform(v,0,0,v,0,0)},X=()=>{M||(M=document.createElement("canvas"),M.width=w,M.height=y,j=M.getContext("2d"),j.setTransform(v,0,0,v,0,0))},q=L=>{if(!L||!L.hasContent||!C)return;const A=L.bbox;if(!A)return;const F=Math.max(0,Math.floor(A.x*v)),b=Math.max(0,Math.floor(A.y*v)),W=Math.min(C.width,Math.ceil((A.x+A.w)*v)),et=Math.min(C.height,Math.ceil((A.y+A.h)*v)),lt=W-F,Bt=et-b;if(lt<=0||Bt<=0)return;let Xe;try{const Ye=document.createElement("canvas");Ye.width=lt,Ye.height=Bt,Ye.getContext("2d").drawImage(C,F,b,lt,Bt,0,0,lt,Bt),Xe=Ye.toDataURL()}catch{return}const Fr=s.__defs,Ft=s.__document.createElementNS(O,"pattern");Ft.setAttribute("id",L.patternId),Ft.setAttribute("patternUnits","userSpaceOnUse"),Ft.setAttribute("x",String(A.x)),Ft.setAttribute("y",String(A.y)),Ft.setAttribute("width",String(A.w)),Ft.setAttribute("height",String(A.h));const Ut=s.__document.createElementNS(O,"image");Ut.setAttribute("x","0"),Ut.setAttribute("y","0"),Ut.setAttribute("width",String(A.w)),Ut.setAttribute("height",String(A.h)),Ut.setAttributeNS(G,"xlink:href",Xe),Ut.setAttribute("href",Xe),Ut.setAttribute("preserveAspectRatio","none"),Ft.appendChild(Ut),Fr.appendChild(Ft)},ht=()=>{if(!(!M||!B))try{const L=M.toDataURL(),A=s.__defs,F=s.__document.createElementNS(O,"pattern");F.setAttribute("id",Or),F.setAttribute("patternUnits","userSpaceOnUse"),F.setAttribute("x","0"),F.setAttribute("y","0"),F.setAttribute("width",String(i)),F.setAttribute("height",String(r));const b=s.__document.createElementNS(O,"image");b.setAttribute("x","0"),b.setAttribute("y","0"),b.setAttribute("width",String(i)),b.setAttribute("height",String(r)),b.setAttributeNS(G,"xlink:href",L),b.setAttribute("href",L),F.appendChild(b),A.appendChild(F);const W=s.__document.createElementNS(O,"image");W.setAttribute("x","0"),W.setAttribute("y","0"),W.setAttribute("width",String(i)),W.setAttribute("height",String(r)),W.setAttributeNS(G,"xlink:href",L),W.setAttribute("href",L),s.__root.appendChild(W)}catch{}};let Y=!1;for(let L=f;L<h.length;L++){const A=h[L];if(A[0]===2){if(A[1]==="beginRaster"){const b=A[2];b&&b.bbox&&b.patternId?(tt(),_={bbox:b.bbox,patternId:b.patternId,hasContent:!1}):(X(),_=null),Y=!0}else A[1]==="endRaster"&&(_&&(q(_),_=null),Y=!1);continue}if(A[0]===3){try{gn(s,A[1],A[2],!0)}catch{}continue}const F=Y?_?S:j:s;Y&&A[0]===0&&(_?_.hasContent=!0:B=!0);try{if(A[0]===0)if(A[1]==="setTransform"){const b=A[2];F===s?F.setTransform(b[0]*p,b[1]*p,b[2]*p,b[3]*p,b[4]*p,b[5]*p):F.setTransform(b[0],b[1],b[2],b[3],b[4],b[5])}else{const b=F[A[1]];typeof b=="function"&&b.apply(F,A[2])}else if(A[1]==="fillStyle"||A[1]==="strokeStyle"){const b=A[2],W=A[1]==="fillStyle";if(typeof b=="string")W?n=b:a=b,F[A[1]]=F===s?qr(b):b;else if(b&&typeof b=="object"&&b.__p5ExportGradId){const et=$r.get(b.__p5ExportGradId);F===s&&g(et)?F[A[1]]=`url(#${et.id})`:F===s&&(F[A[1]]=W?n:a)}else if(F===s)F[A[1]]=W?n:a;else try{F[A[1]]=b}catch{}}else if(A[1]==="globalCompositeOperation"){if(F[A[1]]=A[2],F===s){const b=A[2],W=s.__currentElement;if(W&&W.setAttribute&&b&&b!=="source-over"){const et=W.getAttribute("style")||"";if(et.indexOf("mix-blend-mode")===-1){const lt=et&&!et.trim().endsWith(";")?";":"";W.setAttribute("style",et+lt+"mix-blend-mode:"+b)}}}}else F[A[1]]=A[2]}catch{}}return _&&q(_),ht(),s.getSerializedSvg()}function En(t){const e=t.toDataURL("image/png"),i=t.width,r=t.height;return`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${r}" viewBox="0 0 ${i} ${r}"><image href="${e}" width="${i}" height="${r}"/></svg>`}function Tn(t,e,i){e.saveSVG=function(s,n={}){let a;const l=!!this._p5ExportSVGRecorder,u=2e6;let g=0;if(l){const d=this._p5ExportSVGRecorder.ops.slice(),f=this.width||100,m=this.height||100,w=Hr(d,f,m);let y=0;if(w>0){let S=0;for(let _=w-1;_>=0;_--)if(d[_][0]===0){if(d[_][1]==="restore")S++;else if(d[_][1]==="save"){if(S===0){y=_;break}S--}}}let C=!1;for(let S=y;S<d.length;S++){const _=d[S];if(_[0]===2){_[1]==="beginRaster"?C=!0:_[1]==="endRaster"&&(C=!1);continue}C||g++}}const v=l&&!n.forceVector&&g>u;if(!n.raster&&(!l||v)&&!n.silent&&typeof window<"u"&&typeof window.confirm=="function"){const d=v?`This sketch produced ${g.toLocaleString()} vector ops — too many to render as vector SVG cleanly (viewers crash above ~250k paths).`:"This sketch's renderer (likely WEBGL) can't be captured as vector. SVG would only contain a single embedded PNG.";if(!window.confirm(`[p5.export] SVG export problem
12
+ */(function(t){(function(){var e,i,r,s,n;function a(h,d){var f=Object.keys(d),m;for(m=0;m<f.length;m++)h=h.replace(new RegExp("\\{"+f[m]+"\\}","gi"),d[f[m]]);return h}function l(h){var d,f,m;if(!h)throw new Error("cannot create a random attribute name for an undefined object");d="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",f="";do for(f="",m=0;m<12;m++)f+=d[Math.floor(Math.random()*d.length)];while(h[f]);return f}function u(h,d){var f,m,w={},y;for(h=h.split(","),d=d||10,f=0;f<h.length;f+=2)m="&"+h[f+1]+";",y=parseInt(h[f],d),w[m]="&#"+y+";";return w["\\xa0"]="&#160;",w}function g(h){var d={left:"start",right:"end",center:"middle",start:"start",end:"end"};return d[h]||d.start}function v(h){var d={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return d[h]||d.alphabetic}n=u("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),e={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"}},r=function(h,d){this.__root=h,this.__ctx=d},r.prototype.addColorStop=function(h,d){var f=this.__ctx.__createElement("stop"),m,w;f.setAttribute("offset",h),d.indexOf("rgba")!==-1?(m=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi,w=m.exec(d),f.setAttribute("stop-color",a("rgb({r},{g},{b})",{r:w[1],g:w[2],b:w[3]})),f.setAttribute("stop-opacity",w[4])):f.setAttribute("stop-color",d),this.__root.appendChild(f)},s=function(h,d){this.__root=h,this.__ctx=d},i=function(h){var d={width:500,height:500,enableMirroring:!1},f;if(arguments.length>1?(f=d,f.width=arguments[0],f.height=arguments[1]):h?f=h:f=d,!(this instanceof i))return new i(f);this.width=f.width||d.width,this.height=f.height||d.height,this.enableMirroring=f.enableMirroring!==void 0?f.enableMirroring:d.enableMirroring,this.canvas=this,this.__document=f.document||document,this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d"),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__root.setAttribute("version",1.1),this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__ids={},this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__root.appendChild(this.__currentElement)},i.prototype.__createElement=function(h,d,f){typeof d>"u"&&(d={});var m=this.__document.createElementNS("http://www.w3.org/2000/svg",h),w=Object.keys(d),y,C;for(f&&(m.setAttribute("fill","none"),m.setAttribute("stroke","none")),y=0;y<w.length;y++)C=w[y],m.setAttribute(C,d[C]);return m},i.prototype.__setDefaultStyles=function(){var h=Object.keys(e),d,f;for(d=0;d<h.length;d++)f=h[d],this[f]=e[f].canvas},i.prototype.__applyStyleState=function(h){var d=Object.keys(h),f,m;for(f=0;f<d.length;f++)m=d[f],this[m]=h[m]},i.prototype.__getStyleState=function(){var h,d={},f=Object.keys(e),m;for(h=0;h<f.length;h++)m=f[h],d[m]=this[m];return d},i.prototype.__applyStyleToCurrentElement=function(h){var d=Object.keys(e),f,m,w,y,C,S;for(f=0;f<d.length;f++)if(m=e[d[f]],w=this[d[f]],m.apply)if(m.apply.indexOf("fill")!==-1&&w instanceof s){if(w.__ctx)for(;w.__ctx.__defs.childNodes.length;)y=w.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[y]=y,this.__defs.appendChild(w.__ctx.__defs.childNodes[0]);this.__currentElement.setAttribute("fill",a("url(#{id})",{id:w.__root.getAttribute("id")}))}else m.apply.indexOf("fill")!==-1&&w instanceof r?this.__currentElement.setAttribute("fill",a("url(#{id})",{id:w.__root.getAttribute("id")})):m.apply.indexOf(h)!==-1&&m.svg!==w&&((m.svgAttr==="stroke"||m.svgAttr==="fill")&&w.indexOf("rgba")!==-1?(C=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi,S=C.exec(w),this.__currentElement.setAttribute(m.svgAttr,a("rgb({r},{g},{b})",{r:S[1],g:S[2],b:S[3]})),this.__currentElement.setAttribute(m.svgAttr+"-opacity",S[4])):this.__currentElement.setAttribute(m.svgAttr,w))},i.prototype.__closestGroupOrSvg=function(h){return h=h||this.__currentElement,h.nodeName==="g"||h.nodeName==="svg"?h:this.__closestGroupOrSvg(h.parentNode)},i.prototype.getSerializedSvg=function(h){var d=new XMLSerializer().serializeToString(this.__root),f,m,w,y,C,S;if(S=/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi,S.test(d)&&(d=d.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),h)for(f=Object.keys(n),m=0;m<f.length;m++)w=f[m],y=n[w],C=new RegExp(w,"gi"),C.test(d)&&(d=d.replace(C,y));return d},i.prototype.getSvg=function(){return this.__root},i.prototype.save=function(){var h=this.__createElement("g"),d=this.__closestGroupOrSvg();this.__groupStack.push(d),d.appendChild(h),this.__currentElement=h,this.__stack.push(this.__getStyleState())},i.prototype.restore=function(){this.__currentElement=this.__groupStack.pop();var h=this.__stack.pop();this.__applyStyleState(h)},i.prototype.__addTransform=function(h){var d=this.__closestGroupOrSvg();if(d.childNodes.length>0){var f=this.__createElement("g");d.appendChild(f),this.__currentElement=f}var m=this.__currentElement.getAttribute("transform");m?m+=" ":m="",m+=h,this.__currentElement.setAttribute("transform",m)},i.prototype.scale=function(h,d){d===void 0&&(d=h),this.__addTransform(a("scale({x},{y})",{x:h,y:d}))},i.prototype.rotate=function(h){var d=h*180/Math.PI;this.__addTransform(a("rotate({angle},{cx},{cy})",{angle:d,cx:0,cy:0}))},i.prototype.translate=function(h,d){this.__addTransform(a("translate({x},{y})",{x:h,y:d}))},i.prototype.transform=function(h,d,f,m,w,y){this.__addTransform(a("matrix({a},{b},{c},{d},{e},{f})",{a:h,b:d,c:f,d:m,e:w,f:y}))},i.prototype.beginPath=function(){var h,d;this.__currentDefaultPath="",this.__currentPosition={},h=this.__createElement("path",{},!0),d=this.__closestGroupOrSvg(),d.appendChild(h),this.__currentElement=h},i.prototype.__applyCurrentDefaultPath=function(){if(this.__currentElement.nodeName==="path"){var h=this.__currentDefaultPath;this.__currentElement.setAttribute("d",h)}else throw new Error("Attempted to apply path command to node "+this.__currentElement.nodeName)},i.prototype.__addPathCommand=function(h){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=h},i.prototype.moveTo=function(h,d){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.__currentPosition={x:h,y:d},this.__addPathCommand(a("M {x} {y}",{x:h,y:d}))},i.prototype.closePath=function(){this.__addPathCommand("Z")},i.prototype.lineTo=function(h,d){this.__currentPosition={x:h,y:d},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(a("L {x} {y}",{x:h,y:d})):this.__addPathCommand(a("M {x} {y}",{x:h,y:d}))},i.prototype.bezierCurveTo=function(h,d,f,m,w,y){this.__currentPosition={x:w,y},this.__addPathCommand(a("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:h,cp1y:d,cp2x:f,cp2y:m,x:w,y}))},i.prototype.quadraticCurveTo=function(h,d,f,m){this.__currentPosition={x:f,y:m},this.__addPathCommand(a("Q {cpx} {cpy} {x} {y}",{cpx:h,cpy:d,x:f,y:m}))};var p=function(h){var d=Math.sqrt(h[0]*h[0]+h[1]*h[1]);return[h[0]/d,h[1]/d]};i.prototype.arcTo=function(h,d,f,m,w){var y=this.__currentPosition&&this.__currentPosition.x,C=this.__currentPosition&&this.__currentPosition.y;if(!(typeof y>"u"||typeof C>"u")){if(w<0)throw new Error("IndexSizeError: The radius provided ("+w+") is negative.");if(y===h&&C===d||h===f&&d===m||w===0){this.lineTo(h,d);return}var S=p([y-h,C-d]),_=p([f-h,m-d]);if(S[0]*_[1]===S[1]*_[0]){this.lineTo(h,d);return}var M=S[0]*_[0]+S[1]*_[1],j=Math.acos(Math.abs(M)),B=p([S[0]+_[0],S[1]+_[1]]),O=w/Math.sin(j/2),G=h+O*B[0],tt=d+O*B[1],X=[-S[1],S[0]],q=[_[1],-_[0]],ht=function(A){var F=A[0],b=A[1];return b>=0?Math.acos(F):-Math.acos(F)},Y=ht(X),L=ht(q);this.lineTo(G+X[0]*w,tt+X[1]*w),this.arc(G,tt,w,Y,L)}},i.prototype.stroke=function(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")},i.prototype.fill=function(){this.__currentElement.nodeName==="path"&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")},i.prototype.rect=function(h,d,f,m){this.__currentElement.nodeName!=="path"&&this.beginPath(),this.moveTo(h,d),this.lineTo(h+f,d),this.lineTo(h+f,d+m),this.lineTo(h,d+m),this.lineTo(h,d),this.closePath()},i.prototype.fillRect=function(h,d,f,m){var w,y;w=this.__createElement("rect",{x:h,y:d,width:f,height:m},!0),y=this.__closestGroupOrSvg(),y.appendChild(w),this.__currentElement=w,this.__applyStyleToCurrentElement("fill")},i.prototype.strokeRect=function(h,d,f,m){var w,y;w=this.__createElement("rect",{x:h,y:d,width:f,height:m},!0),y=this.__closestGroupOrSvg(),y.appendChild(w),this.__currentElement=w,this.__applyStyleToCurrentElement("stroke")},i.prototype.clearRect=function(h,d,f,m){var w,y=this.__closestGroupOrSvg();w=this.__createElement("rect",{x:h,y:d,width:f,height:m,fill:"#FFFFFF"},!0),y.appendChild(w)},i.prototype.createLinearGradient=function(h,d,f,m){var w=this.__createElement("linearGradient",{id:l(this.__ids),x1:h+"px",x2:f+"px",y1:d+"px",y2:m+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(w),new r(w,this)},i.prototype.createRadialGradient=function(h,d,f,m,w,y){var C=this.__createElement("radialGradient",{id:l(this.__ids),cx:m+"px",cy:w+"px",r:y+"px",fx:h+"px",fy:d+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(C),new r(C,this)},i.prototype.__parseFont=function(){var h=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\"\sa-z]+?)\s*$/i,d=h.exec(this.font),f={style:d[1]||"normal",size:d[4]||"10px",family:d[6]||"sans-serif",weight:d[3]||"normal",decoration:d[2]||"normal",href:null};return this.__fontUnderline==="underline"&&(f.decoration="underline"),this.__fontHref&&(f.href=this.__fontHref),f},i.prototype.__wrapTextLink=function(h,d){if(h.href){var f=this.__createElement("a");return f.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.href),f.appendChild(d),f}return d},i.prototype.__applyText=function(h,d,f,m){var w=this.__parseFont(),y=this.__closestGroupOrSvg(),C=this.__createElement("text",{"font-family":w.family,"font-size":w.size,"font-style":w.style,"font-weight":w.weight,"text-decoration":w.decoration,x:d,y:f,"text-anchor":g(this.textAlign),"dominant-baseline":v(this.textBaseline)},!0);C.appendChild(this.__document.createTextNode(h)),this.__currentElement=C,this.__applyStyleToCurrentElement(m),y.appendChild(this.__wrapTextLink(w,C))},i.prototype.fillText=function(h,d,f){this.__applyText(h,d,f,"fill")},i.prototype.strokeText=function(h,d,f){this.__applyText(h,d,f,"stroke")},i.prototype.measureText=function(h){return this.__ctx.font=this.font,this.__ctx.measureText(h)},i.prototype.arc=function(h,d,f,m,w,y){if(m!==w){m=m%(2*Math.PI),w=w%(2*Math.PI),m===w&&(w=(w+2*Math.PI-.001*(y?-1:1))%(2*Math.PI));var C=h+f*Math.cos(w),S=d+f*Math.sin(w),_=h+f*Math.cos(m),M=d+f*Math.sin(m),j=y?0:1,B=0,O=w-m;O<0&&(O+=2*Math.PI),y?B=O>Math.PI?0:1:B=O>Math.PI?1:0,this.lineTo(_,M),this.__addPathCommand(a("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:f,ry:f,xAxisRotation:0,largeArcFlag:B,sweepFlag:j,endX:C,endY:S})),this.__currentPosition={x:C,y:S}}},i.prototype.clip=function(){var h=this.__closestGroupOrSvg(),d=this.__createElement("clipPath"),f=l(this.__ids),m=this.__createElement("g");h.removeChild(this.__currentElement),d.setAttribute("id",f),d.appendChild(this.__currentElement),this.__defs.appendChild(d),h.setAttribute("clip-path",a("url(#{id})",{id:f})),h.appendChild(m),this.__currentElement=m},i.prototype.drawImage=function(){var h=Array.prototype.slice.call(arguments),d=h[0],f,m,w,y,C=0,S=0,_,M,j,B,O,G,tt,X,q,ht,Y;if(h.length===3)f=h[1],m=h[2],_=d.width,M=d.height,w=_,y=M;else if(h.length===5)f=h[1],m=h[2],w=h[3],y=h[4],_=d.width,M=d.height;else if(h.length===9)C=h[1],S=h[2],_=h[3],M=h[4],f=h[5],m=h[6],w=h[7],y=h[8];else throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);if(j=this.__closestGroupOrSvg(),tt=this.__currentElement,d instanceof i){for(B=d.getSvg(),O=B.childNodes[0];O.childNodes.length;)Y=O.childNodes[0].getAttribute("id"),this.__ids[Y]=Y,this.__defs.appendChild(O.childNodes[0]);G=B.childNodes[1],j.appendChild(G),this.__currentElement=G,this.translate(f,m),this.__currentElement=tt}else(d.nodeName==="CANVAS"||d.nodeName==="IMG")&&(X=this.__createElement("image"),X.setAttribute("width",w),X.setAttribute("height",y),X.setAttribute("preserveAspectRatio","none"),(C||S||_!==d.width||M!==d.height)&&(q=this.__document.createElement("canvas"),q.width=w,q.height=y,ht=q.getContext("2d"),ht.drawImage(d,C,S,_,M,0,0,w,y),d=q),X.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d.nodeName==="CANVAS"?d.toDataURL():d.getAttribute("src")),j.appendChild(X),this.__currentElement=X,this.translate(f,m),this.__currentElement=tt)},i.prototype.createPattern=function(h,d){var f=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),m=l(this.__ids),w;return f.setAttribute("id",m),f.setAttribute("width",h.width),f.setAttribute("height",h.height),h.nodeName==="CANVAS"||h.nodeName==="IMG"?(w=this.__document.createElementNS("http://www.w3.org/2000/svg","image"),w.setAttribute("width",h.width),w.setAttribute("height",h.height),w.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h.nodeName==="CANVAS"?h.toDataURL():h.getAttribute("src")),f.appendChild(w),this.__defs.appendChild(f)):h instanceof i&&(f.appendChild(h.__root.childNodes[1]),this.__defs.appendChild(f)),new s(f,this)},i.prototype.drawFocusRing=function(){},i.prototype.createImageData=function(){},i.prototype.getImageData=function(){},i.prototype.putImageData=function(){},i.prototype.globalCompositeOperation=function(){},i.prototype.setTransform=function(){},typeof window=="object"&&(window.C2S=i),t.exports=i})()})(zr);var hn=zr.exports;const _t=on(hn),ln=Math.PI*2;let dn=0;function cn(){return`p5ExportPattern_${++dn}`}function fn(t){const e=t._patternControler,i=e&&Array.isArray(e.colors)?e.colors:null;if(!i||i.length===0)return"#888888";const r=i[i.length-1];return typeof r=="string"?r:r&&typeof r.toString=="function"?r.toString():"#888888"}function ge(t,e,i,r,s){return s==="corners"?{x:t,y:e,w:i-t,h:r-e}:s==="radius"?{x:t-i,y:e-r,w:2*i,h:2*r}:s==="center"?{x:t-i*.5,y:e-r*.5,w:i,h:r}:{x:t,y:e,w:i,h:r}}function Vr(t){return t._renderer&&t._renderer.states&&t._renderer.states.rectMode||"corner"}function Pi(t){return t._renderer&&t._renderer.states&&t._renderer.states.ellipseMode||"center"}function un(t,e,i){const r=t._p5ExportSVGRecorder;r&&r.ops.push([3,e,i])}function pn(t,e){const i=t._p5ExportSVGRecorder;i&&i.ops.push([2,"beginRaster",e])}function mn(t){const e=t._p5ExportSVGRecorder;e&&e.ops.push([2,"endRaster"])}function Dt(t,e,i){const r=t[e];typeof r!="function"||r.__p5ExportWrapped||(t[e]=function(...s){let n,a;try{if(a=i(this,s),a){n=cn();const u=fn(this);un(this,a.kind,{...a,color:u,patternId:n})}}catch{}const l=!!this._p5ExportSVGRecorder&&!!n&&!!a;l&&pn(this,{bbox:a,patternId:n});try{return r.apply(this,s)}finally{l&&mn(this)}},t[e].__p5ExportWrapped=!0)}const wn=["rectPattern","squarePattern","ellipsePattern","circlePattern","arcPattern","trianglePattern","quadPattern"];function Lr(t,e){if(!t||!t.prototype)return!1;const i=t.prototype;if(typeof i.rectPattern!="function")return!1;const r=!!i.__p5ExportPatternHooksInstalled;if(r||(i.__p5ExportPatternHooksInstalled=!0),e&&e._renderer&&e._renderer.states){const n=t.Renderer||e._renderer.constructor;if(n&&n.prototype&&!n.prototype.__p5ExportModeBridged){n.prototype.__p5ExportModeBridged=!0;for(const a of["rectMode","ellipseMode","imageMode","colorMode"])Object.defineProperty(n.prototype,"_"+a,{configurable:!0,get(){return this.states&&this.states[a]},set(l){this.states&&(this.states[a]=l)}})}}r||(Dt(i,"rectPattern",(n,a)=>({kind:"rect",...ge(a[0],a[1],a[2],a[3],Vr(n))})),Dt(i,"squarePattern",(n,a)=>({kind:"rect",...ge(a[0],a[1],a[2],a[2],Vr(n))})),Dt(i,"ellipsePattern",(n,a)=>({kind:"ellipse",...ge(a[0],a[1],a[2],a[3],Pi(n))})),Dt(i,"circlePattern",(n,a)=>({kind:"ellipse",...ge(a[0],a[1],a[2],a[2],Pi(n))})),Dt(i,"arcPattern",(n,a)=>({kind:"ellipse",...ge(a[0],a[1],a[2],a[3],Pi(n))})),Dt(i,"trianglePattern",(n,a)=>{const l=[a[0],a[2],a[4]],u=[a[1],a[3],a[5]],g=Math.min(...l),v=Math.max(...l),p=Math.min(...u),h=Math.max(...u);return{kind:"polygon",points:[[a[0],a[1]],[a[2],a[3]],[a[4],a[5]]],x:g,y:p,w:v-g,h:h-p}}),Dt(i,"quadPattern",(n,a)=>{const l=[a[0],a[2],a[4],a[6]],u=[a[1],a[3],a[5],a[7]],g=Math.min(...l),v=Math.max(...l),p=Math.min(...u),h=Math.max(...u);return{kind:"polygon",points:[[a[0],a[1]],[a[2],a[3]],[a[4],a[5]],[a[6],a[7]]],x:g,y:p,w:v-g,h:h-p}}));const s=e&&e._isGlobal&&e||typeof window<"u"&&window.p5&&window.p5.instance||null;if(s&&s._isGlobal&&typeof window<"u")for(const n of wn){const a=i[n];if(typeof a=="function")try{let l=a.bind(s);Object.defineProperty(window,n,{configurable:!0,enumerable:!0,get(){return l},set(u){}})}catch{}}return!0}const Or="p5ExportSharedRaster";function gn(t,e,i,r){if(!i||!t)return;const s=t.fillStyle;i.patternId?t.fillStyle=`url(#${i.patternId})`:t.fillStyle=`url(#${Or})`;try{if(e==="rect")t.beginPath(),t.rect(i.x,i.y,i.w,i.h),t.fill();else if(e==="ellipse"){const n=i.w/2,a=i.h/2,l=i.x+n,u=i.y+a;t.beginPath(),t.ellipse(l,u,n,a,0,0,ln),t.fill()}else if(e==="polygon"){const n=i.points||[];if(n.length>=2){t.beginPath(),t.moveTo(n[0][0],n[0][1]);for(let a=1;a<n.length;a++)t.lineTo(n[a][0],n[a][1]);t.closePath(),t.fill()}}}finally{t.fillStyle=s}}let Gr=!1;function vn(){if(Gr)return;Gr=!0,_t.prototype.setTransform=function(r,s,n,a,l,u){const v=this.__groupStack&&this.__groupStack.length>0?this.__closestGroupOrSvg():this.__root,p=this.__createElement("g");v.appendChild(p),this.__currentElement=p,r===1&&s===0&&n===0&&a===1&&l===0&&u===0||this.__currentElement.setAttribute("transform",`matrix(${r},${s},${n},${a},${l},${u})`)},_t.prototype.resetTransform=function(){this.setTransform(1,0,0,1,0,0)},_t.prototype.ellipse=function(r,s,n,a,l,u,g,v){if(u===g)return;l=l||0;const p=Math.PI*2;u=u%p,g=g%p,u===g&&(g=(g+p-.001*(v?-1:1))%p);const h=Math.cos(l),d=Math.sin(l),f=M=>{const j=n*Math.cos(M),B=a*Math.sin(M);return{x:r+j*h-B*d,y:s+j*d+B*h}},m=f(u),w=f(g);let y=g-u;y<0&&(y+=p);const C=v?0:1,S=v?y>Math.PI?0:1:y>Math.PI?1:0,_=l*180/Math.PI;this.lineTo(m.x,m.y),this.__addPathCommand("A "+n+" "+a+" "+_+" "+S+" "+C+" "+w.x+" "+w.y),this.__currentPosition={x:w.x,y:w.y}},typeof _t.prototype.roundRect!="function"&&(_t.prototype.roundRect=function(r,s,n,a,l){let u,g,v,p;typeof l=="number"?u=g=v=p=l:Array.isArray(l)?l.length===1?u=g=v=p=l[0]:l.length===2?(u=v=l[0],g=p=l[1]):[u,g,v,p]=[l[0],l[1],l[2],l[3]??l[1]]:u=g=v=p=0;const h=Math.min(Math.abs(n),Math.abs(a))/2;u=Math.min(u,h),g=Math.min(g,h),v=Math.min(v,h),p=Math.min(p,h),this.moveTo(r+u,s),this.lineTo(r+n-g,s),this.ellipse(r+n-g,s+g,g,g,0,-Math.PI/2,0),this.lineTo(r+n,s+a-v),this.ellipse(r+n-v,s+a-v,v,v,0,0,Math.PI/2),this.lineTo(r+p,s+a),this.ellipse(r+p,s+a-p,p,p,0,Math.PI/2,Math.PI),this.lineTo(r,s+u),this.ellipse(r+u,s+u,u,u,0,Math.PI,Math.PI*1.5)}),delete _t.prototype.globalCompositeOperation;const t=_t.prototype.__applyStyleToCurrentElement,e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,i=r=>{if(typeof r!="string")return r;const s=e.exec(r);if(!s)return r;const n=Math.round(parseInt(s[4],16)/255*1e3)/1e3;return`rgba(${parseInt(s[1],16)},${parseInt(s[2],16)},${parseInt(s[3],16)},${n})`};_t.prototype.__applyStyleToCurrentElement=function(r){const s=this.fillStyle,n=this.strokeStyle;typeof s=="string"&&(this.fillStyle=i(s)),typeof n=="string"&&(this.strokeStyle=i(n));try{return t.call(this,r)}finally{this.fillStyle=s,this.strokeStyle=n}}}const yn=60,Nr=new Set(["fillStyle","strokeStyle","lineWidth","lineCap","lineJoin","miterLimit","globalAlpha","font","textAlign","textBaseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]);let bn=0;const $r=new Map;function _n(){return`p5ExportGrad_${++bn}`}function xn(t){const e=[],i=[0],r={proxy:null,ops:e,maxFrames:yn,clear(){e.length=0,i.length=1,i[0]=0},markFrameBoundary(){if(this.maxFrames===1/0){i.push(e.length);return}for(i.push(e.length);i.length>this.maxFrames+1;){const a=i[1];if(a>0){const l={};for(let v=0;v<a;v++){const p=e[v];p[0]===1&&Nr.has(p[1])&&(l[p[1]]=p[2])}e.splice(0,a);const u=[];for(const v in l)u.push([1,v,l[v]]);u.length&&e.unshift(...u);const g=u.length-a;for(let v=1;v<i.length;v++)i[v]+=g}i.shift()}}},s=new Set(["createLinearGradient","createRadialGradient","createConicGradient"]),n=(a,l,u)=>{if(!a)return a;const g=_n(),v={id:g,kind:l,args:Array.from(u),stops:[]};$r.set(g,v);try{a.__p5ExportGradId=g}catch{}return new Proxy(a,{get(p,h){if(h==="__p5ExportRealGrad")return p;if(h==="addColorStop"&&typeof p[h]=="function")return function(f,m){return v.stops.push({offset:f,color:m}),p[h].call(p,f,m)};const d=p[h];return typeof d=="function"?d.bind(p):d}})};return r.proxy=new Proxy(t,{get(a,l){const u=a[l];return typeof u=="function"?function(...g){e.push([0,l,g]);const v=u.apply(a,g);return s.has(l)?n(v,l,g):v}:u},set(a,l,u){if((l==="fillStyle"||l==="strokeStyle")&&u&&typeof u=="object"){const g=u.__p5ExportGradId;e.push([1,l,g?{__p5ExportGradId:g}:u]),a[l]=u.__p5ExportRealGrad||u}else e.push([1,l,u]),a[l]=u;return!0}}),r}function Sn(t){return!!(t&&typeof t.fillRect=="function")}function jr(t){if(!t||t._p5ExportSVGRecorder)return;const e=t._renderer;if(!e)return;const i=e.drawingContext;if(!Sn(i))return;const r=xn(i),s=typeof window<"u"&&window.p5ExportConfig||{};typeof s.svgMaxFrames=="number"&&(r.maxFrames=s.svgMaxFrames>0?s.svgMaxFrames:1/0),t._p5ExportSVGRecorder=r;const n={value:r.proxy,configurable:!0,writable:!0,enumerable:!0};Object.defineProperty(e,"drawingContext",n),Object.defineProperty(t,"drawingContext",n)}function qr(t){if(typeof t!="string")return t;const e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!e)return t;const i=parseInt(e[4],16)/255;return`rgba(${parseInt(e[1],16)},${parseInt(e[2],16)},${parseInt(e[3],16)},${i})`}function Cn(t){if(typeof t!="string")return!0;let e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);return e?parseInt(e[4],16)===255:(e=/^rgba\(\s*[^,]+,\s*[^,]+,\s*[^,]+,\s*([\d.]+)\s*\)$/i.exec(t),e?parseFloat(e[1])>=1:(e=/^#[0-9a-f]{3}([0-9a-f])$/i.exec(t),e?parseInt(e[1],16)===15:!0))}function Hr(t,e,i){let r=-1,s="#000000";const n=.5;let a=!1;for(let l=0;l<t.length;l++){const u=t[l];if(u[0]===2){u[1]==="beginRaster"?a=!0:u[1]==="endRaster"&&(a=!1);continue}if(!a){if(u[0]===1&&u[1]==="fillStyle")s=u[2];else if(u[0]===0&&(u[1]==="fillRect"||u[1]==="clearRect")){const g=u[2],v=g[0],p=g[1],h=g[2],d=g[3];Math.abs(v)<=n&&Math.abs(p)<=n&&Math.abs(h-e)<=n&&Math.abs(d-i)<=n&&(u[1]==="clearRect"||Cn(s))&&(r=l)}}}return r}function Xr(t){vn();const e=t._p5ExportSVGRecorder,i=t.width||100,r=t.height||100,s=new _t(i,r);if(s.setTransform(1,0,0,1,0,0),!e)return s.getSerializedSvg();let n="#000000",a="#000000";const l=new Set,u="http://www.w3.org/2000/svg",g=L=>{if(!L||l.has(L.id))return!0;const A=s.__defs,F=s.__document;let b;if(L.kind==="createLinearGradient"){const[W,et,lt,Bt]=L.args;b=F.createElementNS(u,"linearGradient"),b.setAttribute("gradientUnits","userSpaceOnUse"),b.setAttribute("x1",String(W)),b.setAttribute("y1",String(et)),b.setAttribute("x2",String(lt)),b.setAttribute("y2",String(Bt))}else if(L.kind==="createRadialGradient"){const[W,et,lt,Bt,Xe,Fr]=L.args;b=F.createElementNS(u,"radialGradient"),b.setAttribute("gradientUnits","userSpaceOnUse"),b.setAttribute("fx",String(W)),b.setAttribute("fy",String(et)),b.setAttribute("fr",String(lt)),b.setAttribute("cx",String(Bt)),b.setAttribute("cy",String(Xe)),b.setAttribute("r",String(Fr))}else return!1;b.setAttribute("id",L.id);for(const W of L.stops){const et=F.createElementNS(u,"stop");et.setAttribute("offset",String(W.offset)),et.setAttribute("stop-color",String(W.color)),b.appendChild(et)}return A.appendChild(b),l.add(L.id),!0},v=typeof t.pixelDensity=="function"?t.pixelDensity():1,p=1/v,h=e.ops.slice(),d=Hr(h,i,r);let f=0;if(d>0){let L=0,A=-1;for(let b=d-1;b>=0;b--)if(h[b][0]===0){if(h[b][1]==="restore")L++;else if(h[b][1]==="save"){if(L===0){A=b;break}L--}}f=A>=0?A:d;const F={};for(let b=0;b<f;b++){const W=h[b];W[0]===1&&Nr.has(W[1])&&(F[W[1]]=W[2])}for(const b in F){const W=F[b];b==="fillStyle"||b==="strokeStyle"?typeof W=="string"?(b==="fillStyle"?n=W:a=W,s[b]=qr(W)):s[b]=b==="fillStyle"?n:a:s[b]=W}}const m=bt(t),w=m?m.width:i*v,y=m?m.height:r*v;let C=null,S=null,_=null,M=null,j=null,B=!1;const O="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xlink",tt=()=>{C||(C=document.createElement("canvas"),C.width=w,C.height=y,S=C.getContext("2d")),S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,C.width,C.height),S.setTransform(v,0,0,v,0,0)},X=()=>{M||(M=document.createElement("canvas"),M.width=w,M.height=y,j=M.getContext("2d"),j.setTransform(v,0,0,v,0,0))},q=L=>{if(!L||!L.hasContent||!C)return;const A=L.bbox;if(!A)return;const F=Math.max(0,Math.floor(A.x*v)),b=Math.max(0,Math.floor(A.y*v)),W=Math.min(C.width,Math.ceil((A.x+A.w)*v)),et=Math.min(C.height,Math.ceil((A.y+A.h)*v)),lt=W-F,Bt=et-b;if(lt<=0||Bt<=0)return;let Xe;try{const Ye=document.createElement("canvas");Ye.width=lt,Ye.height=Bt,Ye.getContext("2d").drawImage(C,F,b,lt,Bt,0,0,lt,Bt),Xe=Ye.toDataURL()}catch{return}const Fr=s.__defs,Ft=s.__document.createElementNS(O,"pattern");Ft.setAttribute("id",L.patternId),Ft.setAttribute("patternUnits","userSpaceOnUse"),Ft.setAttribute("x",String(A.x)),Ft.setAttribute("y",String(A.y)),Ft.setAttribute("width",String(A.w)),Ft.setAttribute("height",String(A.h));const Ut=s.__document.createElementNS(O,"image");Ut.setAttribute("x","0"),Ut.setAttribute("y","0"),Ut.setAttribute("width",String(A.w)),Ut.setAttribute("height",String(A.h)),Ut.setAttributeNS(G,"xlink:href",Xe),Ut.setAttribute("href",Xe),Ut.setAttribute("preserveAspectRatio","none"),Ft.appendChild(Ut),Fr.appendChild(Ft)},ht=()=>{if(!(!M||!B))try{const L=M.toDataURL(),A=s.__defs,F=s.__document.createElementNS(O,"pattern");F.setAttribute("id",Or),F.setAttribute("patternUnits","userSpaceOnUse"),F.setAttribute("x","0"),F.setAttribute("y","0"),F.setAttribute("width",String(i)),F.setAttribute("height",String(r));const b=s.__document.createElementNS(O,"image");b.setAttribute("x","0"),b.setAttribute("y","0"),b.setAttribute("width",String(i)),b.setAttribute("height",String(r)),b.setAttributeNS(G,"xlink:href",L),b.setAttribute("href",L),F.appendChild(b),A.appendChild(F);const W=s.__document.createElementNS(O,"image");W.setAttribute("x","0"),W.setAttribute("y","0"),W.setAttribute("width",String(i)),W.setAttribute("height",String(r)),W.setAttributeNS(G,"xlink:href",L),W.setAttribute("href",L),s.__root.appendChild(W)}catch{}};let Y=!1;for(let L=f;L<h.length;L++){const A=h[L];if(A[0]===2){if(A[1]==="beginRaster"){const b=A[2];b&&b.bbox&&b.patternId?(tt(),_={bbox:b.bbox,patternId:b.patternId,hasContent:!1}):(X(),_=null),Y=!0}else A[1]==="endRaster"&&(_&&(q(_),_=null),Y=!1);continue}if(A[0]===3){try{gn(s,A[1],A[2],!0)}catch{}continue}const F=Y?_?S:j:s;Y&&A[0]===0&&(_?_.hasContent=!0:B=!0);try{if(A[0]===0)if(A[1]==="setTransform"){const b=A[2];F===s?F.setTransform(b[0]*p,b[1]*p,b[2]*p,b[3]*p,b[4]*p,b[5]*p):F.setTransform(b[0],b[1],b[2],b[3],b[4],b[5])}else{const b=F[A[1]];typeof b=="function"&&b.apply(F,A[2])}else if(A[1]==="fillStyle"||A[1]==="strokeStyle"){const b=A[2],W=A[1]==="fillStyle";if(typeof b=="string")W?n=b:a=b,F[A[1]]=F===s?qr(b):b;else if(b&&typeof b=="object"&&b.__p5ExportGradId){const et=$r.get(b.__p5ExportGradId);F===s&&g(et)?F[A[1]]=`url(#${et.id})`:F===s&&(F[A[1]]=W?n:a)}else if(F===s)F[A[1]]=W?n:a;else try{F[A[1]]=b}catch{}}else if(A[1]==="globalCompositeOperation"){if(F[A[1]]=A[2],F===s){const b=A[2],W=s.__currentElement;if(W&&W.setAttribute&&b&&b!=="source-over"){const et=W.getAttribute("style")||"";if(et.indexOf("mix-blend-mode")===-1){const lt=et&&!et.trim().endsWith(";")?";":"";W.setAttribute("style",et+lt+"mix-blend-mode:"+b)}}}}else F[A[1]]=A[2]}catch{}}return _&&q(_),ht(),s.getSerializedSvg()}function En(t){const e=t.toDataURL("image/png"),i=t.width,r=t.height;return`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${r}" viewBox="0 0 ${i} ${r}"><image href="${e}" width="${i}" height="${r}"/></svg>`}function Tn(t,e,i){e.saveSVG=function(s,n={}){let a;const l=!!this._p5ExportSVGRecorder,u=2e6;let g=0;if(l){const d=this._p5ExportSVGRecorder.ops.slice(),f=this.width||100,m=this.height||100,w=Hr(d,f,m);let y=0;if(w>0){let S=0;for(let _=w-1;_>=0;_--)if(d[_][0]===0){if(d[_][1]==="restore")S++;else if(d[_][1]==="save"){if(S===0){y=_;break}S--}}}let C=!1;for(let S=y;S<d.length;S++){const _=d[S];if(_[0]===2){_[1]==="beginRaster"?C=!0:_[1]==="endRaster"&&(C=!1);continue}C||g++}}const v=l&&!n.forceVector&&g>u;if(!n.raster&&(!l||v)&&!n.silent&&typeof window<"u"&&typeof window.confirm=="function"){const d=v?`This sketch produced ${g.toLocaleString()} vector ops — too many to render as vector SVG cleanly (viewers crash above ~250k paths).`:"This sketch's renderer (likely WEBGL) can't be captured as vector. SVG would only contain a single embedded PNG.";if(!window.confirm(`[p5.export] SVG export problem
13
13
 
14
14
  ${d}
15
15