0x5079a8ad…cd43sent to0xa319c382…7f9c·#17,483,856·view on Etherscan
let t,e,o,n,l,s={};const i=(i=!1,r=!1,h=!1)=>{let c=window.innerWidth/window.innerHeight,a=h||1;s.b=1e3,s.h=window.innerHeight,s.r=a,c>a?s.w=a*s.h:(s.w=window.innerWidth,s.h=s.w/a),i&&(s.w=i),r&&(s.h=r),s.s=Math.min(s.w,s.h),s.m=s.s/s.b,[t,e,o,n,l]=[s.w,s.h,s.m,.1*s.w,s.b]},r=(t,e,o,n,l)=>n+(t-e)/(o-e)*(l-n),h=(t,e,o)=>{let{size:n,name:l,download:s,hideCanvas:i,removeSVG:r}=e||{},h=document.querySelector(".stroomlijn-svg");h&&h.remove();let a=2970,y=4200,u="http://www.w3.org/2000/svg",p=document.createElementNS(u,"svg");console.log("Generating SVG using backgroundColor: "+o),e.download||tokenData.plot?(p.setAttribute("width","29.7cm"),p.setAttribute("height","42cm")):(p.setAttribute("width","100vw"),p.setAttribute("height","100vh")),p.setAttribute("viewBox","0 0 2970 4200"),p.setAttribute("style",`background: ${o};`),p.setAttribute("xml:space","preserve"),p.setAttribute("xmlns:inkscape","http://www.inkscape.org/namespaces/inkscape"),p.setAttribute("xmlns","http://www.w3.org/2000/svg"),p.setAttribute("class","stroomlijn-svg"),t.forEach((t,o)=>{const n=t.path;if(n.length>0){const o=p.getElementById(""+t.colName);let l;if(null===o){l=document.createElementNS(u,"g"),l.setAttribute("id",""+t.colName),l.setAttribute("inkscape:groupmode","layer");const e=p.querySelectorAll("g").length+1;l.setAttribute("inkscape:label",`${e} - ${t.colName}`)}else l=o;let s=document.createElementNS(u,"path");s.setAttribute("d",`M ${n[0].x*a} ${n[0].y*y}`),s.setAttribute("stroke",t.col),s.setAttribute("stroke-width","5"),s.setAttribute("stroke-linejoin","bevel"),"outline"===t.type||"outline-hatch"===t.type||e.hideFill?s.setAttribute("fill","none"):s.setAttribute("fill",t.col),n.forEach(t=>{let e=s.getAttribute("d");s.setAttribute("d",`${e} L ${t.x*a} ${t.y*y} `)}),l.appendChild(s),p.appendChild(l)}}),document.body.appendChild(p),s&&c(p,l)},c=(t,e)=>{const o=(new XMLSerializer).serializeToString(t),n=document.createElement("a");n.setAttribute("download",tokenData.tokenId+".svg"),n.style.display="none",document.body.appendChild(n),n.setAttribute("href",window.URL.createObjectURL(new Blob([o],{type:"text/plain;charset=utf-8"}))),document.body.removeChild(n),n.click()},a=(o,n)=>({x:r(o,0,t,0,1),y:r(n,0,e,0,1)}),y=Uint32Array.from([0,0,0,0].map((t,e)=>parseInt(tokenData.hash.substr(8*e+2,8),16))),u=()=>{let t,e=y[3];return y[3]=y[2],y[2]=y[1],y[1]=t=y[0],e^=e<<11,e^=e>>>8,y[0]=e^t^t>>>19,y[0]/4294967296},p=(t,e)=>t+(e-t)*u(),x=t=>t[Math.floor(u()*t.length)];let d=function(t){this.p=[...Array(256)].map(e=>f(256*t())),this.pm=[...this.p,...this.p]};const{floor:f,sqrt:g}=Math,w=(t,e,o)=>t[0]*e+t[1]*o,b=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]];d.prototype.noise=function(t,e){const o=this.pm;let n,l,s,i,r,h=(t+e)*(.5*(g(3)-1)),c=f(t+h),a=f(e+h),y=(3-g(3))/6,u=(c+a)*y,p=t-(c-u),x=e-(a-u);p>x?(i=1,r=0):(i=0,r=1);let d=p-i+y,m=x-r+y,F=p-1+2*y,M=x-1+2*y,A=255&c,v=255&a,k=o[A+o[v]]%12,S=o[A+i+o[v+r]]%12,E=o[A+1+o[v+1]]%12,N=.5-p*p-x*x;N<0?n=0:(N*=N,n=N*N*w(b[k],p,x));let B=.5-d*d-m*m;B<0?l=0:(B*=B,l=B*B*w(b[S],d,m));let C=.5-F*F-M*M;return C<0?s=0:(C*=C,s=C*C*w(b[E],F,M)),70*(n+l+s)};const m=(t,e)=>{const o=e.x-t.x,n=e.y-t.y;return Math.atan2(n,o)*(180/Math.PI)},F=t=>{let e=0,o=0;for(let n=0;n<t.length;n++)e+=t[n].x,o+=t[n].y;return e/=t.length,o/=t.length,[e,o]},M=t=>{const e=[];for(let o=0;o<t.length;o++){let n=t[o],l=o===t.length-1?0:o+1,s=t[l];const i=Math.round(m(n,s));[-270,-180,-90,0,90,180,270].includes(i)&&e.push([o,l])}return e},A=(t,e)=>t.filter(t=>E(t,e)),v=(t,e)=>{const o=[];for(let n=0;n<t.length-1;n++){const l=[t[n],t[n+1]];for(let t=0;t<e.length-1;t++){const n=[e[t],e[t+1]];if(S(l,n)){const{x:t,y:e}=k(l,n);o.push({x:t,y:e})}}}return o},k=([t,e],[o,n])=>{const l=(t.x-e.x)*(o.y-n.y)-(t.y-e.y)*(o.x-n.x);return{x:((t.x*e.y-t.y*e.x)*(o.x-n.x)-(t.x-e.x)*(o.x*n.y-o.y*n.x))/l,y:((t.x*e.y-t.y*e.x)*(o.y-n.y)-(t.y-e.y)*(o.x*n.y-o.y*n.x))/l}},S=([t,e],[o,n])=>{const l=(e.x-t.x)*(n.y-o.y)-(n.x-o.x)*(e.y-t.y);if(0===l)return!1;const s=((n.y-o.y)*(n.x-t.x)+(o.x-n.x)*(n.y-t.y))/l,i=((t.y-e.y)*(n.x-t.x)+(e.x-t.x)*(n.y-t.y))/l;return 0<s&&s<1&&0<i&&i<1},E=(t,e)=>{let o=!1,n=t.x,l=t.y;for(let t=0,s=e.length-1;t<e.length;s=t++){let[i,r]=[e[t].x,e[t].y],[h,c]=[e[s].x,e[s].y];r>l!=c>l&&n<(h-i)*(l-r)/(c-r)+i&&(o=!o)}return o},N=t=>t.filter((e,o)=>t.findIndex(t=>t.x===e.x&&t.y===e.y)===o),B=t=>{let[e,o]=F(t);return t.sort((function(t,n){return Math.atan2(t.y-o,t.x-e)-Math.atan2(n.y-o,n.x-e)})),t};let C,$,q,H=[{bg:"#000000",colors:["#FFFFFF"]},{bg:"#FFFBF0",colors:["#0058b9"]},{bg:"#FFFBF0",colors:["#F00"]},{bg:"#FFFBF0",colors:["#F00","#0058b9"]},{bg:"#F6F5F4",colors:["#023c19"]},{bg:"#F6F5F4",colors:["#880018"]},{bg:"#FFFFFF",colors:["#000"]}],I=[[0,10],[1,10],[2,10],[3,3],[4,6],[5,6],[6,12]],L=[],j=0,D=0;const G=[[0,.65],[-.2,.6],[.1,.6]],z=[[-.1,.42,.57,.6],[-.3,.25,.42,.62],[-.2,.35,.45,.52]];let R,U,P=[],V=1*o,W=1,O={},T=new d(u),X={active:!0,size:"A3",name:tokenData.hash,download:!1,hideCanvas:!0,removeSVG:!1,hideFill:!1};const J=()=>{(t=>{console.log("Stroomlijn - Bart Simons - 2023");let{width:e,height:o,ratio:n}=t||{};i(e,o,n)})({width:707.56302521,height:1e3,ratio:.70756302521}),ct();const o=r(e,0,1e3,0,1);D=.1*t,X.height=e,X.width=t,V?V*=o:V=1*o},K=()=>{P=[],L=[],j=0;const t=Q();Y(t),Z(),_(),tt(),ht()},Q=()=>{const t=707.56302521/U,e=[],o=O.fullSelection?x(z):x(G);for(let n=-353.781512605;n<1061.344537815;n+=t){let l=-250;for(;l<1250;){const s=C.noise1,i=C.noise2,h=C.noiseHeight1,c=C.noiseHeight2,a=T.noise(n*s,l*i),y=T.noise(n*h,l*c),u=r(y,-1,1,10,150),p=r(a,-1,1,.5*t,.7*t);let x={x:n+t/2-p/2,y:l+u/2,w:p,h:u};l+u>1250&&(x.h=1250-l);const d=T.noise(a,y);if(O.fullSelection){const t=O.broken?o[3]:1;d>-1&&d<o[0]?x.type="filled":d>o[0]&&d<o[1]?x.type="outlined":d>o[1]&&d<o[2]?x.type="barred":d>o[2]&&d<t?x.type="angled":x.type="empty"}else{const t=O.broken?o[1]:1;d>-1&&d<o[0]?x.type="outlined":d>o[0]&&d<t?x.type="filled":x.type="empty"}e.push(x),l+=10+u}}return e},Y=t=>{t.forEach((t,e)=>{const o=x(q);"filled"===t.type?st(t.x,t.y,t.w,t.h,o):"outlined"===t.type?lt(t.x,t.y,t.w,t.h,"outline",o):"barred"===t.type?rt(t.x,t.y,t.w,t.h,o):"angled"===t.type&&it(t.x,t.y,t.w,t.h,o)})},Z=()=>{P.forEach(o=>{o.path.forEach(o=>{o.x-=t/2,o.y-=e/2;const n=o.x*Math.cos(C.rotation)-o.y*Math.sin(C.rotation),l=o.x*Math.sin(C.rotation)+o.y*Math.cos(C.rotation);o.x=n+t/2,o.y=l+e/2})})},_=()=>{let o=D,n=t-D,l=e-D,s=D;const i=[];for(let t=0;t<P.length;t++){let e=!0;const[r,h]=[P[t].path,P[t].type];for(let t=0;t<r.length;t++){const i=r[t];if(i.x>=s&&i.x<=n&&i.y>=o&&i.y<=l){e=!1;break}}e&&(i.push(t),"filled-outline"===h&&i.push(t+1))}const r=[...new Set(i)];for(let t=r.length-1;t>=0;t--)P.splice(r[t],1)},tt=()=>{let o=t-D,n=e-D,l=[{x:D,y:D},{x:o,y:D},{x:o,y:n},{x:D,y:n},{x:D,y:D}];for(let o=0;o<P.length;o++){const n=P[o];let s=n.path,i=.1*D,r=[{x:i,y:i},{x:t-i,y:i},{x:t-i,y:e-i},{x:i,y:e-i},{x:i,y:i}],h=!0;if(s.forEach(o=>{(o.x<D||o.x>t-D||o.y<D||o.y>e-D)&&(h=!1)}),!h)if("outline"===n.type){const t=nt(s,l);if(P[o].path=t[0],t.length>1){const e={path:t[1],type:"outline"};P.splice(o+1,0,e)}}else if("filled"===n.type){R||(r=l);const t=ot(s,r,R,l);P[o].path=t}else if("filled-hatch"===n.type){const t=ot(s,l);P[o].path=t}else if("outline-hatch"===n.type){const t=et(s,l);P[o].path=t}else if("filled-outline"===n.type)if(R){let t=!0;if(s.forEach(e=>{E(e,r)||(t=!1)}),!t){const t=[];P[o].path=t}}else{const t=et(s,l);P[o].path=t}}},et=(t,e)=>{let o=[];const n=v(t,e),l=[];n.forEach(t=>{l.push({...t})});const s=A(t,e);if(o.push(...s,...n),l.forEach(t=>{t.x=Math.floor(t.x),t.y=Math.floor(t.y)}),n.length<2)o.push(n[0]);else if(l[0].x===l[1].x||l[0].y===l[1].y||4===n.length);else{const[t,n]=F(o),l=((t,e,o)=>{const[n,l,s,i]=o,r=Math.sqrt((t-n.x)**2+(e-n.y)**2),h=Math.sqrt((t-l.x)**2+(e-l.y)**2),c=Math.sqrt((t-s.x)**2+(e-s.y)**2),a=Math.sqrt((t-i.x)**2+(e-i.y)**2),y=Math.min(r,h,c,a);return y===r?n:y===h?l:y===c?s:y===a?i:null})(t,n,e);o.push(l)}return o=N(o),o=B(o),o.push(o[0]),o},ot=(t,e,o=!1,n)=>{let l=[];if(o)for(let o=0;o<t.length;o++){const l=t[o];if(!E(l,e))return void nt(t,n)}for(let o=0;o<t.length;o++){const n=t[o],s=t[o+1]||t[0],i=v([n,s],e);E(n,e)?l.push(n):i.length>0&&(t[o]=i[0],l.push(...i))}return l},nt=(t,e)=>{let o=[];const n=v(t,e),l=A(t,e);if(o.push(...l,...n),o=N(o),o=B(o),n.length>2)o=(t=>{let e=[],o=[[],[]];e=M(t);let[n,l,s,i]=[e[0][1],e[1][0],e[1][1],e[0][0]];const r=t.slice(s).concat(t.slice(0,s));e=M(r),[n,l,s,i]=[e[0][1],e[1][0],e[1][1],e[0][0]];for(let t=0;t<r.length;t++)t>=n&&t<=l&&o[0].push(r[t]),s<i?t>=s&&t<=i&&o[1].push(r[t]):(t>=s||t<=i)&&o[1].push(r[t]);return o})(o);else if(2===n.length)for(let t=0;t<o.length;t++){let e=t===o.length-1?0:t+1;if(o[t]==n[1]&&o[e]==n[0]||o[t]==n[0]&&o[e]==n[1]){const e=o.slice(0,t+1),n=o.slice(t+1);n.push(...e),o=n}}return[o]},lt=(t,e,o,n,l="outline",s="#000000")=>{let i=[];i.push({x:t,y:e-n/2}),i.push({x:t+o,y:e-n/2}),i.push({x:t+o,y:e+n/2}),i.push({x:t,y:e+n/2}),i.push({x:t,y:e-n/2}),P.push({path:i,type:l,col:s})},st=(t,e,o,n,l="#000000")=>{const s=[];for(let l=e-n/2;l<e+n/2;l+=V)s.push({x:t,y:l}),s.push({x:t+o,y:l});lt(t,e,o,n,"filled-outline",l),P.push({path:s,type:"filled",col:l})},it=(t,e,n,l,s="#000000")=>{const i=[[]],r=[{x:t,y:e-l/2},{x:t+n,y:e-l/2},{x:t+n,y:e+l/2},{x:t,y:e+l/2},{x:t,y:e-l/2}];let h=0;for(let s=e-2*l,c=0;s<e+2*l;s+=V){let e={x:t-n,y:s+50*o},l={x:t+2*n,y:s};const a=v([e,l],r);0===a.length?(l={},e={}):1===a.length?l=a[0]:2===a.length&&([e,l]=a),i[c].push(e),i[c].push(l),h++,h===Math.round(4*W)&&(s+=5*V*W,h=0,c++,i.push([]))}for(let t=0;t<i.length-1;t++)P.push({path:i[t],type:"filled-hatch",col:s});lt(t,e,n,l,"outline-hatch",s)},rt=(t,e,o,n,l="#000000")=>{const s=[[]];let i=0;for(let l=e-n/2,r=0;l<e+n/2;l+=V)s[r].push({x:t,y:l}),s[r].push({x:t+o,y:l}),i++,i===Math.round(6*W)&&(l+=4*V*W,i=0,r++,s.push([]));for(let t=0;t<s.length;t++)P.push({path:s[t],type:"filled-hatch",col:l});lt(t,e,o,n,"outline-hatch",l)},ht=()=>{P.forEach(t=>{const e=t.path,o=t.type,n=t.col;if(X.active&&void 0!==e&&e.length>0){const t=at(n);L.push({path:[],col:n,colName:t,type:o});for(let t=0;t<e.length;t++){const o=a(e[t].x,e[t].y);isNaN(o.x)||isNaN(o.y)||L[j].path.push(a(e[t].x,e[t].y))}j++}})},ct=()=>{var t,e;C={rotation:p(0,2*Math.PI),noise1:p(1e-5,5e-4),noise2:.001,noiseHeight1:.001,noiseHeight2:.001,scale:(t=15,e=40,Math.floor(p(t,e))),overlapAllowed:u()<.5};const o=(t=>{let e=[];for(let o in t)e=e.concat(new Array(t[o][1]).fill(t[o][0]));return x(e)})(I),n=H[o];$=n.bg,q=n.colors,R=u()<.64,U=C.scale;const l=Math.round(r(U,15,39,0,2));O.breakout=R,O.scale=["Small","Medium","Large"][l],O.broken=u()<.6,O.fullSelection=u()<.73;const s=window.location.search,i=new URLSearchParams(s),h=Number(i.get("density"));0!==h&&(W=h),W&&W>1&&W<3.01&&(V=1/W)},at=t=>"#FFFFFF"===t?"White/Silver":"#0058b9"===t?"Micron Blue":"#F00"===t?"Micron Red":"#023c19"===t?"Micron Hunter Green":"#880018"===t?"Micron Burgundy":"#000"===t?"Micron Black":void 0;window.onkeypress=t=>{32==t.which&&(X.download=!0,X.hideFill=!0,h(L,X,$))},tokenData.plot?(J(),K(),X.hideFill=!0,h(L,X,$)):(J(),K(),h(L,X,$))