memoscan
← all memos

Memo 0x5e53ca41…730704 on Ethereum

we=[0,775.903,20.023,724.176,58.401,637.409,98.448,565.658,160.186,473.885,161.855,487.234,146.838,525.612,136.826,570.664,128.483,627.397,123.477,679.124,123.477,720.839,126.814,754.211,135.157,755.88,151.843,740.862,165.192,714.165,186.884,659.1,216.919,594.025,250.291,533.955,287.001,475.553,318.704,427.164,358.751,367.094,390.454,318.704,412.146,292.007,418.821,302.018,393.792,350.408,377.106,402.135,355.414,470.548,327.047,568.996,293.675,695.81,256.966,829.299,230.268,952.776,208.576,1059.567,193.559,1161.352,181.878,1256.462,190.221,1328.213],Pe=[589.019,103.454,590.687,118.471,580.676,163.524,552.309,250.291,527.28,323.71,498.914,410.478,477.222,490.571,450.524,594.025,430.501,699.147,418.821,769.229,412.146,814.281,415.484,829.299,427.164,824.293,445.519,785.915,478.891,714.165,510.594,647.42,545.635,582.344,585.682,503.92,635.74,410.478,687.467,323.71,730.851,258.634,742.531,238.611,752.543,248.623,712.496,340.396,645.752,468.879,604.036,545.635,574.001,612.379,550.641,679.124,537.292,714.165,532.286,735.856,553.978,745.868,575.67,734.188,610.711,710.827,640.746,700.816,667.443,690.804,677.455,664.106,694.141,667.443,697.478,692.473,694.141,730.851,704.153,762.554,734.188,790.921,750.874,819.287,769.229,887.7,779.24,977.805,782.577,1057.898,780.909,1144.666,769.229,1243.113,744.199,1329.881,712.496,1396.625,687.467,1426.66,667.443,1436.672,644.083,1426.66,629.065,1396.625,627.397,1344.899,632.403,1261.468,645.752,1183.044,662.438,1097.945,687.467,1011.177,715.833,916.066,740.862,850.99,780.909,732.519,817.618,635.74,862.671,528.949,907.723,427.164,946.101,342.065,986.148,258.634,1021.189,196.896,1052.892,143.5,1064.572,126.814,1072.915,130.151,1066.241,145.169,1017.851,213.582,971.13,303.687,934.421,390.454,902.717,472.216,881.025,542.298,862.671,622.391,859.333,670.781,861.002,715.833,872.682,745.868,886.031,755.88,902.717,752.543,924.409,735.856,951.107,700.816,979.473,660.769,994.491,629.065,1004.502,612.379,1016.183,620.722,1001.165,657.432,989.485,700.816,994.491,727.513,1021.189,749.205,1049.555,734.188,1062.904,715.833,1056.229,694.141,1036.206,689.135,1036.206,675.787,1069.578,684.13,1096.276,680.792,1121.305,662.438,1136.323,644.083,1148.003,647.42,1154.677,659.1,1151.34,689.135,1149.671,719.17,1159.683,735.856,1173.032,737.525,1188.049,725.845,1201.398,665.775,1226.427,575.67,1256.462,478.891,1291.503,373.768,1326.544,278.658,1356.579,205.239,1379.939,140.163,1409.974,75.087,1433.335,25.029,1448.352,0,1456.695,3.337,1451.69,23.361,1429.998,65.076,1386.614,165.192,1356.579,251.96,1331.55,323.71,1311.526,382.111,1294.84,452.193,1281.491,532.286,1276.486,614.048,1276.486,665.775,1278.154,697.478,1289.835,725.845,1303.183,739.194,1319.869,739.194,1333.218,727.513,1349.904,697.478,1371.596,660.769,1398.294,625.728,1424.992,600.699,1441.678,589.019,1448.352,597.362,1443.347,615.717,1436.672,649.089,1435.003,674.118,1441.678,697.478,1456.695,709.159,1478.387,710.827,1511.759,702.484,1538.457,697.478,1561.818,704.153,1576.835,712.496,1591.853,719.17,1605.202,717.502,1620.219,712.496],Re=[1563.486,590.687,1605.202,580.676,1653.591,577.339,1695.306,580.676,1742.027,584.013,1787.08,587.35,1838.807,587.35,1887.196,582.344,1923.906,577.339,1948.935,570.664],Ce="0xd41b2ae5027c6dfbf",Be="922a90723773ff2d7da06c",Ee="9a37c3d6faea34c6579e360d3";var Le,Se;function Te(e){var t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}const ke=new Proxy(new URLSearchParams(window.location.search),{get:(e,t)=>e.get(t)});let Me;function Ae(){if("oilBorder"==Me)for(let e=te.length-1;e>=Math.max(0,te.length-100);e--)if(te[e].length>2&&te[e].length<16){let t=rt(te[e]);if(De(t[0],-.95,.95)&&De(t[1],-1.4,1.4)){let e=Jt(4,.004,Zt(t));new o(e,I,Nt("tiny"))}}}let Ie=-1;function We(e,t,r,n=!0,o=0,i=null){null==i&&(i=O);let l,s=Ie>0?Ie:lr(.2,.6),a="dome"==e?.5*s:"pillar"==e?0:lr(.4,.8),u=n?t.y-.5*a-r[3][1]:lr(.5,.9);switch(e){case"dome":l=function(e,t,r,n,o,i,l,s){let a=[[.5*-t+e.x,.5*-t-n+e.y],[.5*-t+e.x,-t+e.y]],u=hr();for(let r=N-N/12;r>0;r-=N/12)u.set(.5*t,0),u.rotateAround(O,r),u.x+=e.x,u.y+=e.y-.5*t,a.push([u.x,u.y]);return a.push([.5*t+e.x,-t+e.y],[.5*t+e.x,.5*-t-n+e.y]),Fe(a,o,i,l,s)}(t,s,0,u,o,i,n,r);break;case"crown":l=function(e,t,r,n,o,i,l,s){let a=[[.5*-t+e.x,-r+e.y],[0+e.x,0+e.y],[.5*t+e.x,-r+e.y]];return Fe(a,o,i,l,s)}(t,s,a,0,o,i,n,r);break;case"trough":l=function(e,t,r,n,o,i,l,s){let a=[[.5*-t+e.x,e.y],[e.x,-r+e.y],[.5*t+e.x,e.y]];return Fe(a,o,i,l,s)}(t,s,a,0,o,i,n,r);break;case"m":l=function(e,t,r,n,o,i,l,s){let a=[[.5*-t+e.x,-r+e.y],[.5*-t+e.x,e.y],[e.x,.75*(-r+e.y)],[.5*t+e.x,e.y],[.5*t+e.x,-r+e.y]];lr()<.5?a.shift():a.pop();return Fe(a,o,i,l,s)}(t,s,a,0,o,i,n,r);break;case"x":l=function(e,t,r,n,o,i,l,s){let a=[[.5*-t+e.x,-r+e.y],[0+e.x,0+e.y],[.5*t+e.x,-r+e.y]],u=Fe(a,o,i,l,s),h=[[.5*-t+e.x,r+e.y],[0+e.x,0+e.y],[.5*t+e.x,r+e.y]],c=Fe(h,o,i,l,s),f=Tt([u,c]);null!=f&&f.length>0&&(u=f[0]);return u}(t,s,a,0,o,i,n,r);break;case"obelisk":l=function(e,t,r,n,o,i,l,s){let a=[[.5*-t+e.x,-r-n+e.y],[.5*-t+e.x,-r+e.y],[0+e.x,0+e.y],[.5*t+e.x,-r+e.y],[.5*t+e.x,-r-n+e.y]];return Fe(a,o,i,l,s)}(t,s,a,u,o,i,n,r);break;case"yArc":l=function(e,t,r,n,o,i,l,s){let a=e.clone().add(hr(.5*-t,0)),u=e.clone().add(hr(.5*t,0)),h=e.clone(),c=e.clone().add(hr(0,-r)),f=c.clone().lerp(a,.5),d=c.clone().lerp(u,.5),p=h.clone().lerp(f,.5),g=h.clone().lerp(d,.5),y=dr(c.x,c.y,h.x,h.y),v=dr(h.x,h.y,a.x,a.y),x=(y+v)*lr(.25,.75),b=Ye(c,p,a,x),m=Ye(c,g,u,x),w=[b,m],P=null;if(n>0){let e=Oe([[[c.x,c.y],[c.x,c.y-n]]],.012);null!=e&&e.length>0&&(P=e[0])}let R=Oe(w,.012);R=Tt(R);let C=[[100,100],[101,101]];null!=R&&R.length>0&&(C=R[0]);Lt(C,o,i,!1);let B=C;if(null!=P){Lt(P,o,i,!1);let e=Tt([C,P]);null!=e&&e.length>0&&(B=e[0])}return B}(t,s,a,u,o,i);break;case"pillar":l=function(e,t,r,n,o,i,l,s){let a=[[e.x,e.y],[e.x,.5*-n+e.y],[e.x,-n+e.y]],u=Fe(a,o,i,l,s,1);return u}(t,0,0,u,o,i,n,r)}return l}function Fe(e,t,r,n,o,i=0){let l=e;if(Lt(l,t,r,!1,!1),n){let e=Ne(l[0],l[1],o),t=Ne(l[l.length-1],l[l.length-2],o);null==e||0!=i&&-1!=i||l.unshift(e),null==t||0!=i&&1!=i||l.push(t)}let s=Oe([l],.012),a=[[100,100],[101,101]];return null!=s&&s.length>0&&(a=s[0]),a}function Ne(e,t,r){let n=Zt(e),o=Zt(t),i=n.clone().sub(o).normalize().multiplyScalar(5).add(n);return function(e,t,r=!1){Wt(t);let n=[];for(let o=0;o<t.length-1;o++){let i=t[o],l=t[o+1],s=Qt(e[0],e[1],i,l);if(null!=s&&null!=s&&(n.push(s),r))break}return n}([er(n),er(i)],r,!0)[0]}function Oe(e,t){let r=[];for(let n=0;n<e.length;n++){let o=t;try{St(e[n]);let t=h.data(e[n]).arcSegments(3).offsetLines(o);t.length;let i=0;for(let e=1;e<t.length;e++)t[e].length>t[i].length&&(i=e);let l=Tr(t[i],.001);St(l),r.push(l)}catch(e){}}return r}let _e=.01;function De(e,t,r){return e<=r&&e>=t}function qe(e,t,r){let n,o,i,l,s,a,u,h,c=new ft(0),f=e.bL,d=e.tR,p=e.center,g=d.x-f.x,y=d.y-f.y;switch(wt(e.poly,c,0,"bg"),t){case"qCircle":n=e.tL,a=Jt(32,g-.001,n,O,0,O,_,r,p),wt(a,c,0,"obj");break;case"tri":o=er(e.tL.clone().rotateAround(p,r)),i=er(e.tR.clone().rotateAround(p,r)),l=er(e.bR.clone().rotateAround(p,r)),s=er(e.tL.clone().rotateAround(p,r)),a=[o,i,l,s],wt(a,c,0,"obj");break;case"tallTri":o=er(e.tL.clone().rotateAround(p,r)),i=er(e.tR.clone().rotateAround(p,r)),l=er(e.bR.clone().lerp(f,.5).rotateAround(p,r)),s=er(e.tL.clone().rotateAround(p,r)),a=[o,i,l,s],wt(a,c,0,"obj");break;case"halfCircles":a=Jt(8,.5*g-.001,p.clone().add(hr(.5*g,0)),O,0,O,_),u=Jt(8,.5*g-.001,p.clone().add(hr(-.5*g,0)),O,0,O,_),Lt(a,r,p,!1),Lt(u,r,p,!1),wt(a,c,0,"obj"),wt(u,c,0,"obj");break;case"diagonal":a=Xt(hr(2*g,.04),p,r+.25*N),wt(a,c,0,"obj");break;case"straight":a=Xt(hr(2*g,.04),p,r),wt(a,c,0,"obj");break;case"x":a=Xt(hr(2*g,.04),p,r+.25*N),u=Xt(hr(2*g,.04),p,r+.75*N);let t=Tt([a,u]);t.length>0?wt(t[0],c,0,"obj"):(wt(a,c,0,"obj"),wt(u,c,0,"obj"));break;case"plus":a=Xt(hr(2*g,.04),p,r),u=Xt(hr(2*g,.04),p,r+.5*N);let d=Tt([a,u]);d.length>0?wt(d[0],c,0,"obj"):(wt(a,c,0,"obj"),wt(u,c,0,"obj"));break;case"lines":let v=p.clone().sub(hr(.5*g,0)),x=hr(g/4,0);a=Xt(hr(g/8,y),v.add(x),0),u=Xt(hr(g/8,y),v.add(x),0),h=Xt(hr(g/8,y),v.add(x),0),Lt(a,r,p,!1),Lt(u,r,p,!1),Lt(h,r,p,!1),wt(a,c,0,"obj"),wt(u,c,0,"obj"),wt(h,c,0,"obj");break;case"circle":a=Jt(24,.5*g-.001,p,O,0,O,_),wt(a,c,0,"obj")}return c.externallyMaskWithPoly(e.poly),c.allExistingPolys}function Ve(e){let t=[];for(let r=0;r<e.edges.length;r++)t.push([...e.edges[r]]);return{face:[...e.face],edges:t}}function ze(e){let t=null;return t=lr()<.6?function(e){let t=[],r=ir(0,6,.85),n=ir(0,7,.85);0==r&&0==n&&(lr()>.5?r++:n++);(1==r&&0==n||1==n&&0==r)&&lr()>.25&&(lr()>.5?r++:n++);let o=.0015,i=e+o,l=pt(1),s=l[1].x-l[3].x,a=l[1].y-l[3].y,u=lr(-.25,.25)*N,h=lr(-.25,.25)*N;lr()<.15&&(u=0);lr()<.15&&(h=0);let c=s/(r+1),f=!1,d=5;1==subIdInt&&(d=.5);let p=.1;for(let e=0;e<r;e++){if(!(lr()<p&&r>1&&!f)){let r=hr(c*(e+1)-.5*s+lr(.4*-c,.4*c),0),n=Gt(hr(o,9),r,u,d,_,0,0,r),l=Gt(hr(i,9),r,u,d,_,0,0,r);t.push({skinny:n,thick:l,slope:u,pos:r})}}let g=a/(n+1),y=!1,v=1!=subIdInt&&lr()<.5;for(let e=0;e<n;e++){if(!(lr()<p&&n>1&&!y)){let r=g*(e+1)-.5*a;v&&1!=subIdInt&&(r+=lr(.4*-g,.4*g));let n=hr(0,r),l=Gt(hr(9,o),n,h,d,_,0,0,n),s=Gt(hr(9,i),n,h,d,_,0,0,n);t.push({skinny:l,thick:s,slope:h,pos:n})}}return t}(e):function(e){let t=[],r=ir(3,10),n=.0015,o=e+n,i=pt(1),l=i[1].x-i[3].x,s=i[1].y-i[3].y,a=hr(lr(-1e3,1e3),lr(-1e3,1e3));for(let e=0;e<r;e++){let e=hr(lr(.5*-l*.8,.5*l*.8),lr(.5*-s*.75,.5*s*.75)),r=2*pr(e,.1,1,a)*N,i=hr(1,0).rotateAround(O,r).normalize(),u=5;1==subIdInt&&(u=.5);let h=Gt(hr(n,10),e,r,u,_,0,O,O),c=Gt(hr(o,10),e,r,u,_,0,O,O),f=!1;for(let r=0;r<t.length;r++){let n=t[r].slope.distanceTo(i),o=t[r].pos.distanceTo(e);n<.15&&o<.25&&(f=!0)}f||t.push({skinny:h,thick:c,slope:i,pos:e})}return t}(e),t}function je(e,t,r,n){let o=Kt(new t3.EllipseCurve(e.x,e.y,t,t,0,1.9*Math.PI,!1,n+N).getPoints(Math.floor(500*t))),i=null;try{let e=h.data(o).arcSegments(3).offsetLines(r);e.length;let t=Tr(e[0],.002);St(t),i=t}catch(e){}return i}function Ue(e,t,r){let n=[],o=0;for(let i=0;i<e.length;i++){let l={ramp:null,roundabout:null},s=lr(t,r);try{let t=h.data(e[i]).arcSegments(3).offsetLines(s);if(t.length>1)continue;let r=Tr(t[0],.001);if(St(r),l.ramp=r,lr()<.1&&o<2){let t=Math.floor(e[i].length/2),r=lr(.07,.14),n=Zt(e[i][t]),a=Zt(e[i][t+1]),u=Zt(e[i][t-1]),h=a.clone().sub(u);h.set(h.y,-h.x),h.normalize();let c=Math.atan2(h.y,h.x);h.multiplyScalar(r+.1*s),n.add(h);let f=null;f=lr()<.2?je(n,r,s,c):Jt(24,r,n,O,0,O),null!=f&&(o++,l.roundabout=f)}n.push(l)}catch(e){}}return n}function He(e,t,r){var n=hr();return n.x=e[0]+r*(t[0]-e[0]),n.y=e[1]+r*(t[1]-e[1]),n}function Xe(e){Wt(e);let t=[];for(let r=0;r<e.length-1;r++){let n=r,o=r+1,i=r+2;i>=e.length-1&&(i-=e.length-1),o>=e.length-1&&(o-=e.length-1);let l=e[n],s=e[o],a=e[i],u=dr(l[0],l[1],s[0],s[1]),h=dr(s[0],s[1],a[0],a[1]);if(u<.1||h<.1)continue;let c=Zt(a).clone().sub(Zt(s)),f=Zt(l).clone().sub(Zt(s)),d=f.clone().normalize(),p=c.clone().normalize(),g=er(d),y=er(p),v=hr(),x=hr();c.multiplyScalar(.5),f.multiplyScalar(.5);let b=u+h,m=lr(),w=ir(0,4,5);for(let e=0;e<w;e++){let r,n=.2*(e+1);v.set(d.x,d.y),v.multiplyScalar(n).add(Zt(s)).add(f),x.set(p.x,p.y),x.multiplyScalar(n).add(Zt(s)).add(c),g=er(v),y=er(x);let o=lr()<.05,i=lr()<.05;if(m>.5||i){r=Je(v,He(g,s,lr(.3,.7)),He(s,y,lr(.3,.7)),x,b)}else if(m<=.5||o){r=Ye(v,Zt(s),x,b)}t.push(r)}}return t}function Ye(e,t,r,n){const o=new t3.QuadraticBezierCurve(e,t,r),i=Math.round(n/.02);let l=Kt(o.getPoints(i));return 1!=subIdInt&&(l=Tr(l,.001)),l}function Je(e,t,r,n,o){const i=new t3.CubicBezierCurve(e,t,r,n),l=Math.round(o/.04);let s=Kt(i.getPoints(l));return 1!=subIdInt&&(s=Tr(s,.001)),s}function Ge(e,t){for(let r=0;r<e.length;r++){let n=Zt(e[r]),o=2*pr(n,1,1,O)*N,i=hr(.15*t,0).rotateAround(O,o);n.add(i),e[r][0]=n.x,e[r][1]=n.y}}function Qe(e,t,r,n,o){let i=new ft(0),l=r,s=$t(e.verts),a=2*Math.max(e.ww,e.hh),u=2*pr(e.center,.05,1,O)*N,h=Xt(hr(a,t),e.center,u);i.addPoly(s),i.slicePolysWithPoly($t(h));for(let e=0;e<r;e++){let r;if(r=t>0?Ft(s,t):[s],null==r||r.length<=0)break;s=Tr(r[0],.001);let n="translation";e==l-1&&(n="lastTranslation"),wt(s,i,0,n),i.slicePolysWithPoly($t(h))}return i.externallyMaskWithPoly(e.verts),i.allExistingPolys}function $e(e,t,r,n,o,i,l,s){let a=new ft(0),u=n,h=$t(e.verts);a.addPoly(h);Math.max(e.ww,e.hh);for(let n=0;n<u;n++){let i=t;l&&(i*=lr(.75,1.5));let h=hr(i*(n+1),0).rotateAround(O,r),d=$t(e.verts);if(s){Ge(d,cr().clamp((n+1)/6,0,1))}null!=o&&Lt(d,o*N*(n+1),e.avgCenter,!0),Et(d,h);let p=kt(d),g={bL:p[3],tR:p[1]};if(c=e,(f=g).bL.x>c.tR.x||f.tR.x<c.bL.x||f.tR.y<c.bL.y||f.bL.y>c.tR.y)break;let y="translation";n==u-1&&(y="lastTranslation"),wt(d,a,0,y)}var c,f;return a.externallyMaskWithPoly(e.verts),a.allExistingPolys}function Ke(e,t,r,n,o,i,l,s,a){let u,h,c=$t(e.verts);if(u=null!=e.center.x?e.avgCenter:hr(e.center[0],e.center[1]),h=n>0?Ft(c,n):[c],null==h||h.length<=0)return{allExistingPolys:[e]};let f=h[0];if(It(f)<P)return{allExistingPolys:[e]};let d=pr(u,.05,2*N,O),p=N-d-.5*N,g=st(Bt(c,2,e.avgCenter,!0,!0),d);Wt(g);let y=Zt(g[0]),v=(Zt(g[1]),Zt(g[2])),x=Zt(g[3]),b=1*dr(x.x,x.y,v.x,v.y),m=1*dr(x.x,x.y,y.x,y.y),w=Math.floor(m/t);0==w&&(w=1);let R=b/1,C=hr();C.subVectors(v,x);let B=C.clone().normalize().multiplyScalar(.5*R),E=.5*(m-(w-1)*t);0==E&&(E=.5*t);let L=hr();L.subVectors(y,x).normalize().multiplyScalar(t);let S=hr();S.subVectors(y,x).normalize(),S.multiplyScalar(E);let T=new ft(0);"internal"==a?T.addPolyNoIntersection(f,mt(f,0,"subBG")):T.addPolyNoIntersection(c,mt(c,0,"subBG"));let k=x.clone();if(k.add(S),"solid"!=a)for(let e=0;e<w;e++){for(let e=0;e<1;e++)if(lr()<o){const e=k.clone().add(B),t=Gt(hr(1*R,r),e,-d,.05,l,s,O,O,i);Wt(t),T.addPolyNoIntersection(t,mt(t,0,"subLine"))}k.add(L)}let M=new ft;if("internal"==a){T.externallyMaskWithPoly(f),wt(c,M,0,"subBorder"),wt(Xt(hr(2*R,.05),e.avgCenter,p),M,0,"subBorder");for(let e=0;e<T.allExistingPolys.length;e++){let t=T.allExistingPolys[e];M.addPolyNoIntersection(t.verts,mt(t.verts,0,t.vars.type))}M.externallyMaskWithPoly(e.verts)}else if("external"==a){T.externallyMaskWithPoly(c);for(let e=0;e<T.allExistingPolys.length;e++){let t=T.allExistingPolys[e];M.addPolyNoIntersection(t.verts,mt(t.verts,0,t.vars.type))}M.addPolyNoIntersection(f,mt(f,0,"subLine")),M.externallyMaskWithPoly(e.verts)}else if("solid"==a){wt(c,M,0,"subBorder"),wt(Xt(hr(1.5*R,.04),e.avgCenter,p),M,0,"subBorder"),wt(f,M,0,"subSolid"),M.externallyMaskWithPoly(e.verts)}return M}function Ze(e){let t=.015;"inverted"==Me&&(t=.04);let r=[],n=Ft(e.verts,t);if(null==n)return[];if(e.area>.03)for(let t=0;t<n.length;t++){if(n[t].length<3)continue;e.verts=n[t];let o=tt(e);for(let e=0;e<o.length;e++){let t=o[e];r.push([...t])}}return r}function et(e,t=null,r=null){let n=Mt(e),o=(e.area,gt(n[3],n[1],.3));o.length<1&&o.push(er(e.center));let i=new ft(.5);for(let e=0;e<o.length;e++){wt(Jt(7,.405,hr(o[e][0],o[e][1]),hr(1,1),.01,O),i,0,"subzone")}return i.externallyMaskWithPoly(e.verts),i.allExistingPolys}function tt(e,t=null,r=null){let n=Mt(e),o=(e.area,gt(n[3],n[1],.015)),i=new ft(0);for(let e=0;e<o.length;e++){let t=Jt(3,.0015,hr(o[e][0],o[e][1]),hr(1,1),0,O);i.addPolyNoIntersection(t,null)}return i.externallyMaskWithPoly(e.verts,1,null,!0),i.getPlainPolys()}function rt(e){let t=e[0][0]==e[e.length-1][0]&&e[0][1]==e[e.length-1][1]?1:0,r=[0,0];for(let n=0;n<e.length-t;n++)r[0]+=e[n][0],r[1]+=e[n][1];return r[0]/=e.length-t,r[1]/=e.length-t,r}function nt(){return"lines"!=Me&&"offsetLines"!=Me}let ot=[];function it(e,t=null){let r;if(null==t){let e=lr();r=e<.01?"middle":e<.13?"LoR":e<.25?"ToB":e<.45?"TaB":e<.675?"LaR":e<.95?"LaRaTaB":"noise"}else r=t;let n,o,i,l=e[1].x,s=e[1].y,a=l*(lr()<.5?-1.05:1.05),u=s*(lr()<.5?-1.05:1.05),h=null,c=null,f=null,d=null,p=1;if("noise"!=r)if("LaRaTaB"!=r){if("middle"==r)if(p=1.5,lr()>.5){o=hr(lr(-.2,.2),lr(.5*e[3].y,.5*e[0].y)),n=1,i=hr(lr(2,3),lr(.2,.4))}else{let t=lr(-.2,.2);o=hr(lr(.5*e[3].x,.5*e[2].x),t),n=1,i=hr(lr(.1,.2),lr(2,3))}else if("ToB"==r||"TaB"==r){o=hr(lr(e[3].x,e[2].x),u),n=1,i=hr(lr(1,3),.6)}else if("LoR"==r||"LaR"==r){o=hr(a,lr(e[3].y,e[0].y)),n=1,i=hr(.5,lr(1,3))}let t=lr(.02,.1)*p;if(h=Jt(24,n,o,_,t,O,i),"LaR"==r||"TaB"==r||"LaRaTaB"==r){if("LaR"==r){o=hr(-1*a,lr(e[3].y,e[0].y)),n=1,i=hr(.5,lr(1,3))}else if("TaB"==r){o=hr(lr(e[3].x,e[2].x),-1*u),n=1,i=hr(lr(1,3),.6)}c=Jt(24,n,o,_,t,O,i)}}else{let t=lr(e[3].x,e[2].x),r=u;o=hr(t,r),n=1,i=hr(lr(1,3),.4);let l=lr(.02,.1);h=Jt(24,n,o,_,l,O,i),t=lr(e[3].x,e[2].x),r=-1*u,o=hr(t,r),n=1,i=hr(lr(1,3),.4),c=Jt(24,n,o,_,l,O,i),t=a,r=lr(e[3].y,e[0].y),o=hr(t,r),i=hr(.4,lr(1,4)),f=Jt(24,n,o,_,l,O,i),t=-1*a,r=lr(e[3].y,e[0].y),o=hr(t,r),n=1,i=hr(.4,lr(1,4)),d=Jt(24,n,o,_,l,O,i)}else h="noise",c="noise",f="noise",d="noise";null!=h&&ot.push(h),null!=c&&ot.push(c),null!=f&&ot.push(f),null!=d&&ot.push(d)}function lt(e){if("noise"==ot[0]){return pr(e,.5,1,O)>.5}for(let t=0;t<ot.length;t++)if(At([e.x,e.y],ot[t]))return!0;return!1}function st(e,t){let r=rt(e),n=Kt(kt(Lt(e,t,r,!0,!0)));return Lt(n,-t,r,!0,!1),St(n),n}function at(e){let t=[];for(let r=0;r<e.length;r++)t.push(hr(e[r].x,e[r].y));return t}class ut{constructor(e,t,r){this.rawVerts=at(e);let n=kt(this.rawVerts,!0);this.tL=n[0],this.tR=n[1],this.bR=n[2],this.bL=n[3],this.ww=n[1].x-n[3].x,this.hh=n[1].y-n[3].y,this.transform=t,this.rOffset=O,this.center=hr(cr().lerp(this.bL.x,this.tR.x,.5),cr().lerp(this.bL.y,this.tR.y,.5)),this.tArr=at(e),this.utArr=at(e);let o=t.ls,i=t.lo;null!=o&&1!=o&&this.setLocalScaleOfPoints(this.tArr,this.center,o);let l=t.lr;if(null!=l&&r>0)if("noise"==l){let e=pr(this.center,.035,2*N,O);this.setLocalRotOfPoints(this.tArr,this.center,e)}else this.setLocalRotOfPoints(this.tArr,this.center,l);let s=t.r;0!=s&&(this.rotatePoints(this.tArr,s),this.rotatePoints(this.utArr,s));let a=t.s;this.scalePoints(this.tArr,a),this.scalePoints(this.utArr,a);let u=t.t;this.translatePoints(this.tArr,u),this.translatePoints(this.utArr,u),null!=i&&0!=i&&(this.tArr=this.offsetPoints(Kt(this.tArr),i)),this.tArr.length>3&&(this.tTL=this.tArr[0],this.tTR=this.tArr[1],this.tBR=this.tArr[2],this.tBL=this.tArr[3],this.utTL=this.utArr[0],this.utTR=this.utArr[1],this.utBR=this.utArr[2],this.utBL=this.utArr[3],this.tCenter=hr(cr().lerp(this.tBL.x,this.tTR.x,.5),cr().lerp(this.tBL.y,this.tTR.y,.5))),this.lowestPoint=this.getLowestPoint(),this.poly=Kt(this.tArr),St(this.poly),Wt(this.poly),this.tArea=It(this.poly),this.unscaledPoly=Kt(this.utArr),St(this.unscaledPoly),Wt(this.poly)}addNoiseToPoints(e,t,r){for(let r=0;r<e.length;r++){let n=pr(e[r],.1,2*N,xt),o=(pr(e[r],.01,t,vt),hr(t,0));o.rotateAround(O,n),e[r].add(o)}}offsetPoints(e,t){let r=Ft(e,t);if(null!=r){let t=0;for(let e=0;e<r.length;e++)It(r[e])>It(r[t])&&(t=e);if(r[t].length>2){e=Tr(r[t],.005)}}return or(e)}setLocalScaleOfPoints(e,t,r){for(let n=0;n<e.length;n++)e[n].sub(t),e[n].multiplyScalar(r),e[n].add(t)}setLocalRotOfPoints(e,t,r){for(let n=0;n<e.length;n++)e[n].sub(t),e[n].rotateAround(O,r),e[n].add(t)}translatePoints(e,t){for(let r=0;r<e.length;r++)e[r].add(t)}rotatePoints(e,t){for(let r=0;r<e.length;r++)e[r].rotateAround(O,t)}scalePoints(e,t){for(let r=0;r<e.length;r++)e[r].multiply(t)}getLowestPoint(){let e=this.tArr[0];for(let t=1;t<this.tArr.length;t++)this.tArr[t].y<e.y&&(e=this.tArr[t]);return e}}function ht(e,t,r,n,o,i,l=.75,s=1){let a=o,u=i;if(r<s&&(a=1,u=1),r<=n){let h=lr()<a,c=lr()<u,f=r+1;if(h&&c){let a=new ut([e.tL,hr(e.center.x,e.tR.y),e.center,hr(e.bL.x,e.center.y)],e.transform,r),u=new ut([hr(e.center.x,e.tL.y),e.tR,hr(e.bR.x,e.center.y),e.center],e.transform,r),h=new ut([e.center,hr(e.tR.x,e.center.y),e.bR,hr(e.center.x,e.bL.y)],e.transform,r),c=new ut([hr(e.tL.x,e.center.y),e.center,hr(e.center.x,e.bR.y),e.bL],e.transform,r);ht(a,t,f,n,o*l,i*l,l,s),ht(u,t,f,n,o*l,i*l,l,s),ht(h,t,f,n,o*l,i*l,l,s),ht(c,t,f,n,o*l,i*l,l,s)}else if(c){let a=new ut([e.tL,hr(e.center.x,e.tR.y),hr(e.center.x,e.bR.y),e.bL],e.transform,r),u=new ut([hr(e.center.x,e.tL.y),e.tR,e.bR,hr(e.center.x,e.bL.y)],e.transform,r);ht(a,t,f,n,o*l,i*l,l,s),ht(u,t,f,n,o*l,i*l,l,s)}else if(h){let a=new ut([e.tL,e.tR,hr(e.bR.x,e.center.y),hr(e.bL.x,e.center.y)],e.transform,r),u=new ut([hr(e.tL.x,e.center.y),hr(e.tR.x,e.center.y),e.bR,e.bL],e.transform,r);ht(a,t,f,n,o*l,i*l,l,s),ht(u,t,f,n,o*l,i*l,l,s)}else t.push(e)}else t.push(e)}class ct{constructor(e,t,r=null,n=!1){this.verts,this.verts=n?e:$t(e);let o=t;null==o&&(o={colors:null,tier:0,type:null}),this.vars=o,this.verts.length>8&&Tr(this.verts,.001),St(this.verts),Wt(this.verts),this.area=null==r?It(this.verts):r,this.center=hr(),this.tL,this.tR,this.bR,this.bL,this.avgCenter,this.ww,this.hh,this.calculateBounds(),this.small=this.area<Z,this.thinAndLong=this.small&&(this.ww>.12||this.hh>.12),null==this.vars.colors&&(this.vars.colors=x.getNColor(this.verts,0,this.center))}calculateBounds(){var e=1e3,t=-1e3,r=1e3,n=-1e3;this.avgCenter=hr();for(let i=0;i<this.verts.length;i++){var o=this.verts[i];0!=i&&(this.avgCenter.x+=o[0],this.avgCenter.y+=o[1]),e=Math.min(o[0],e),t=Math.max(o[0],t),r=Math.min(o[1],r),n=Math.max(o[1],n)}this.avgCenter.divideScalar(this.verts.length-1),this.tL=hr(e,n),this.tR=hr(t,n),this.bR=hr(t,r),this.bL=hr(e,r),this.ww=this.tR.x-this.bL.x,this.hh=this.tR.y-this.bL.y,this.center=this.bL.clone().lerp(this.tR,.5)}}class ft{constructor(e){this.allExistingPolys=[],this.likelihood=e}recalculateAllVars(){for(let e=0;e<this.allExistingPolys.length;e++)this.allExistingPolys[e].calculateBounds(),this.allExistingPolys[e].vars.colors=x.getNColor(this.allExistingPolys[e].verts,0,this.allExistingPolys[e].center)}addPolyNoIntersection(e,t){let r=new ct(e,t);this.allExistingPolys.push(r)}addPoly(e,t,r=!0,n=!1){let o=new ct(e,t);if(0==this.allExistingPolys.length)return void(r&&this.allExistingPolys.push(o));let i=[],l=[];for(let e=0;e<this.allExistingPolys.length;e++)this.bbsTouching(o,this.allExistingPolys[e])?l.push(this.allExistingPolys[e]):i.push(this.allExistingPolys[e]);let s=[],a=!1;for(let e=0;e<l.length;e++){if(s.length>1e3){s.push(l[e]);continue}let t,r=Rt(o.verts),n=Rt(l[e].verts);try{t=PolyBool.intersect(r,n)}catch(t){a=!0,s.push(l[e]);continue}if(t.regions.length>0){let t=PolyBool.difference(n,r);for(let r=0;r<t.regions.length;r++){let n=t.regions[r],o=It(n);n.length>0&&o>P?s.push(new ct(n,l[e].vars,o,!0)):o<P&&o>ee&&te.push(n)}}else s.push(l[e])}let u=[];r&&u.push(o);let h=[];if(r&&(lr()<this.likelihood||n)&&!a)for(let e=0;e<l.length;e++){let n=[];for(let o=0;o<u.length&&!(n.length>1e3);o++){let i=Rt(u[o].verts),s=Rt(l[e].verts),a=null;try{a=PolyBool.intersect(i,s)}catch(t){h.push(l[e]),n.push(u[o]);continue}if(null!=a&&a.regions.length>0&&r){for(let r=0;r<a.regions.length;r++){let n=a.regions[r],o=It(n);if(n.length>0&&o>P){let r=lr()>.5?t:l[e].vars;h.push(new ct(n,r,o,!0))}else o<P&&o>ee&&te.push(n)}let r=PolyBool.difference(i,s);if(r.regions.length>0)for(let e=0;e<r.regions.length;e++){let o=r.regions[e],i=It(o);o.length>0&&i>P?n.push(new ct(o,t,i,!0)):i<P&&i>ee&&te.push(o)}}else r&&n.push(u[o])}u=[...n]}this.allExistingPolys=[...s],this.allExistingPolys.push(...i),this.allExistingPolys.push(...h),this.allExistingPolys.push(...u)}getPlainPolys(){let e=[];for(let t=0;t<this.allExistingPolys.length;t++)e.push(this.allExistingPolys[t].verts);return e}bbsTouching(e,t){return!(t.bL.x>e.tR.x||t.tR.x<e.bL.x||t.tR.y<e.bL.y||t.bL.y>e.tR.y)}externallyMaskWithPoly(e,t=1,r=[],n=!1){let o=Rt(e),i=[];for(let e=0;e<this.allExistingPolys.length;e++)if(lr()<=t||!r.includes(this.allExistingPolys[e].vars.type)){let t,r=Rt(this.allExistingPolys[e].verts);try{t=PolyBool.intersect(o,r)}catch(e){continue}if(t.regions.length>0)for(let r=0;r<t.regions.length;r++){let o=t.regions[r],l=It(o);n&&l>0||l>P?i.push(new ct(o,this.allExistingPolys[e].vars,l,!0)):l<P&&l>ee&&te.push(o)}}else i.push(this.allExistingPolys[e]);this.allExistingPolys=[...i]}slicePolysWithPoly(e,t=!1,r=0){let n=Rt(e),o=[];for(let e=0;e<this.allExistingPolys.length;e++){let t,i=Rt(this.allExistingPolys[e].verts);try{t=PolyBool.intersect(n,i)}catch(e){continue}if(t.regions.length>0){for(let n=0;n<t.regions.length;n++){let i=t.regions[n],l=It(i);if(i.length>0&&l>P){let t=lr()<.9?mt(i,r):this.allExistingPolys[e].vars,n=new ct(i,t,l,!0);o.push(n)}else l<P&&l>ee&&te.push(i)}