@korial29/tiny-fps 1.13.0 → 1.14.0

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.
@@ -1,4 +1,4 @@
1
- import{Bt as e,G as t,J as n,P as r,Qt as i,Xt as a,Y as o,Yt as s,Zt as c,nr as l,nt as u,q as d,ur as f}from"./brick-9u0Ivbak.js";import{A as p,C as m,D as h,E as g,O as _,S as v,T as y,_ as b,b as x,g as S,i as C,k as w,l as ee,n as te,o as ne,w as T,x as re,y as ie}from"./paint-B4kXABUP.js";import{t as ae}from"./stone-D9uD6njP.js";var E=(e,t=1,n=1,r)=>({l:e,c:[t],s:n,r}),D=(e,t=1,n=-1)=>({l:n,c:e.map(e=>e*t),s:1}),O=125,oe=D([.48,.49,.51],1,C),k=oe,A=E(f.STEEL,.45),se=E(f.METAL,.7),ce=D([.03,.03,.035]),j=D([.13,.135,.15]),le=[.8,.3,.04],ue=D([1,.36,.05],1,C),de=D([.03,.06,.09],1,r),fe=D([0,0,0],1,-7),pe=D([.64,.59,.48],1,ee),me=D([1,.62,.25],1,-2),M=[0,-99,0],N=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),P=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],he=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],F=e=>{let t=Math.hypot(e[0],e[1],e[2])||1;return[e[0]/t,e[1]/t,e[2]/t]},I=(e,t)=>e.map((e,n)=>(e+t[n])/2),L=(e,t,n=1)=>e.map((e,r)=>e+t[r]*n),R=[0,1,3,2],z=[],ge=(e,t)=>0,_e=(e,t,n,r)=>{if(n.l<0)z.push(e[0],e[1],e[2],t[0],t[1],t[2],n.c[0]*r,n.c[1]*r,n.l,n.c[2]*r);else{let[i,a]=Math.abs(t[1])>.7?[e[0],e[2]]:Math.abs(t[0])>.7?[e[2],e[1]]:[e[0],e[1]],[o,s]=n.r?[a,i]:[i,a];z.push(e[0],e[1],e[2],t[0],t[1],t[2],o*n.s,s*n.s,n.l,Math.min(n.c[0]*r,1.99))}},B=(e,t,n,r=1)=>{let i=[0,0,0];if(e.forEach((t,n)=>{let r=e[(n+1)%e.length];i=L(i,[(t[1]-r[1])*(t[2]+r[2]),(t[2]-r[2])*(t[0]+r[0]),(t[0]-r[0])*(t[1]+r[1])])}),Math.hypot(i[0],i[1],i[2])<1e-9)return;i=F(i);let a=P(I(e[0],e[2]),n);i[0]*a[0]+i[1]*a[1]+i[2]*a[2]<0&&(i=i.map(e=>-e));for(let n=1;n<e.length-1;n++)for(let a of[0,n,n+1])_e(e[a],i,t,typeof r==`number`?r:r[a])},V=(e,t,n,r,i,a=i,o=!1)=>{for(let s=0;s<e.length-1;s++){let c=n(s);c&&B([e[s],e[s+1],t[s+1],t[s]],c,o?L(e[s],P(e[s],r)):r,i&&a?[i[s],i[s+1],a[s+1],a[s]]:1)}},H=(e,t,n,r=n,i=4)=>{let a=I(e,t);for(let o=0;o<6;o++)if(!(i>>o&1)){let[i,s,c]=[o>>1,(1+(o>>1))%3,(2+(o>>1))%3];B(R.map(n=>{let r=[0,0,0];return[r[i],r[s],r[c]]=[(1&o?t:e)[i],(1&n?t:e)[s],(2&n?t:e)[c]],r}),o==3?r:n,a)}},ve=(e,t,n,r,i=n)=>{let a=F(P(t,e)),o=F(he(a,Math.abs(a[1])>.9?[1,0,0]:[0,1,0])),s=he(o,a),[c,l]=[e,t].map(e=>R.map(t=>L(L(e,o,((1&t)-.5)*n),s,((t>>1)-.5)*i))),u=I(e,t);V([...c,c[0]],[...l,l[0]],()=>r,u),B(c,r,u),B(l,r,u)},ye=E(f.STEEL,.6),U=(e,t,n,r,i,o=1,s=M)=>{let c=7*e[0]+3*Math.abs(e[2]-O)+e[1],l=(e,t)=>a(e,c+1.37*t,11+t),u=P(t,e),d=Math.hypot(n[0],n[1],n[2]),f=F(he(u,n)),p=P(I(e,t),s);f[0]*p[0]+f[1]*p[1]+f[2]*p[2]<0&&(f=f.map(e=>-e));let m=Math.sign(f[0]*n[0]+f[1]*n[1]+f[2]*n[2])||1,h=1/r;for(let t=0;t<r;t++){let a=(t+.3*(l(t,0)-.5)*(t>0))*h,c=(t+1+.3*(l(t+1,0)-.5)*(t<r-1))*h,p=.3+.7*l(t,1),g=m*d*(.15+.5*l(t,2)),_=.5*(l(t,3)-.5)*d,v=(t,r)=>L(L(L(e,u,a+(c-a)*t),n,p*r),f,g*r*r*p+_*(t-.5)*r*p),y=[.08+.3*l(t,4),.92-.3*l(t,5)],b=.35+.25*l(t,6),x=l(t,7),S=[[0,0],[1,0],[y[1],b],...x<.45?[[.25+.5*l(t,8),1]]:x<.8?[[.55+.3*l(t,8),.75+.25*l(t,9)],[.15+.3*l(t,9),1]]:[[.7+.2*l(t,8),1],[.5,.55+.15*l(t,9)],[.1+.2*l(t,9),.9]],[y[0],b+.1*(l(t,10)-.5)]],C=S.map(([e,t])=>v(e,t)),w=S.map(([,e])=>o*(1-.45*e));for(let e=1;e<C.length-1;e++){let t=[C[0],C[e],C[e+1]],n=[w[0],w[e],w[e+1]];B(t,i,s,n),i.l!=-7&&B(t.map(e=>L(e,f,-.012)),ye,L(C[0],f,9),n.map(e=>Math.min(1,.5+e)))}}},be=(e,t,n,r,i,a=0,o=[1,1])=>{let[s,c,l,u]=[e[0]-a,t[0]+a,e[2]-a,t[2]+a],d=e=>[[s+n,l],[c-n,l],[c,l+n],[c,u-n],[c-n,u],[s+n,u],[s,u-n],[s,l+n],[s+n,l]].map(([t,n])=>[t,e,n]),[f,p]=[d(e[1]),d(t[1])];V(f,p,()=>r,I(e,t),f.map(()=>o[0]),f.map(()=>o[1])),i&&B(p.slice(1),i,e)},xe=({min:e,max:t})=>{let n=I(e,t);if(ge(n[0],n[2])<.3||e[1]>ge(n[0],n[2]))return;let r=(r,i)=>{let[o,s]=[r+1&2?t[0]+i:e[0]-i,2&r?t[2]+i:e[2]-i],c=ge(o,s);return[o,c+(i?-.04:Math.min(.12+.35*a(r%4,n[0]+n[2],5),t[1]-c)),s]};for(let e=0;e<4;e++){let t=[r(e,0),r(e+1,0),r(e+1,.9),r(e,.9)];B(t,pe,M,t.map(e=>.92+.16*c(e[0]/11,e[2]/11,5)))}},Se=(e,t,n,r=[1,1,1])=>d(z,e,t,[[-n[2],0,n[0]],[0,1,0],n],[0,0,0],r),Ce=e=>{z=e},we=(e,t,n=()=>1,r=!1)=>{let i=(t,n)=>e[Math.min(Math.max(t,0),e.length-1)][Math.min(Math.max(n,0),e[0].length-1)],a=e.map((e,t)=>e.map((e,n)=>{let a=he(P(i(t+1,n),i(t-1,n)),P(i(t,n+1),i(t,n-1))),o=Math.hypot(a[0],a[1],a[2])*(r?-1:1);return o?[a[0]/o,a[1]/o,a[2]/o]:[0,1,0]}));for(let r=0;r<e.length-1;r++)for(let i=0;i<e[0].length-1;i++){let o=t(r,i);if(o)for(let t of[0,1,3,0,3,2]){let[s,c]=[r+(1&t),i+(t>>1)];_e(e[s][c],a[s][c],o,n(e[s][c]))}}},Te=(e,t,n=()=>1)=>{let r=z;Ce([]);for(let r=0;r<e.length;r+=6)_e(e.slice(r,r+3),e.slice(r+3,r+6),t,n(e.slice(r,r+3)));let i=z;return Ce(r),i},Ee=[-7,-6.6,-6,-5,-4,-3,-2.05,-1.75,-.9,0,1,1.95,2.25,2.9,3.6,4.3,5,5.5,6,6.5],De=[[2.75,6.72],[2.5,6.93],[2.3,7],[0,7],[0,7]],W=Ee.length+De.length,Oe=2*W-2,ke=e=>Ee[e]??De[e-Ee.length][1],[Ae,je,Me,Ne]=[92,104,114,2.4],G=S[1],Pe=(e,t)=>{let n=T[e].cut,r=n[0][2];for(let e=1;e<n.length;e++)r+=(n[e][2]-n[e-1][2])*N((t-n[e][0]+1)/2);let i=e>1?Math.max(t-99,0)/(Me-99):0;return[r,e>1?N((t-94)/5):0,1-.85*i,Ne*i]},K=(e,t,n)=>{let[r,i,a]=Pe(e,t);return(w(n)+((e=>e<0?Math.max(0,7+2*e):e>=5.6?2.38:e>=3.15?4.34-.8*(e-3.15):7-.844*e)(n)-w(n))*i)*r*a},Fe=(e,t,n,r,i)=>{let[,a,o,s]=Pe(e,t);return[t,x.axis[e]-s+(r>0?r*(1-.2*a):Math.max(r,3.5*a-7))*o,O+i*n]},Ie=(e,t,n,r)=>Fe(e,t,K(e,t,n),n,r),Le=(e,t)=>{let n=e>1&&t>Ae?t<je?5*(t-Ae)/12:5*(Me-t)/10:0,r=Array.from({length:W},(r,i)=>{let a=ke(i),o=t-n*Math.min(Math.max((a-G)/(7-G),0),1),[s,c,l]=Pe(e,o),u=De[i-Ee.length],d=u?(i==W-2?2.5*s-x.skin:Math.min(u[0],u[0]+(2.38-u[0])*c)*s)*l:K(e,o,a);return t=>Fe(e,o,d,a,t)});return[...r.map(e=>e(1)),...r.slice(0,-1).reverse().map(e=>e(-1))]},Re=(e,t,n)=>{let{cut:r,tears:i,holes:a}=T[e],o=[t,n,...i.flatMap(e=>[e[0],e[1]]),...a.filter(e=>e[0]==2).flatMap(e=>[e[1],e[2]]),...r.slice(1).flatMap(e=>[-1,-.33,.33,1].map(t=>e[0]+t))].filter(e=>e>=t&&e<=n).sort((e,t)=>e-t),s=[];return o.forEach((e,t)=>{let n=e-(o[t-1]??e);if(t&&n<.05)return;let r=Math.ceil(n/2);for(let t=1;t<r;t++)s.push(e-n*(r-t)/r);s.push(e)}),s},ze=[93.5,95,95.3,98,98.3,101,101.3,je,106.5,109,111.5,113,Me],Be=[[98.3,101,2.9,5,1],[98.3,101,3.6,5.5,-1]],Ve=e=>[T[e].floor,...v.filter(t=>t>T[e].floor+.5&&t<7)],He=(e,t,n)=>{let r=Ve(e),i=r[Math.min(n,r.length-2)],a=r[Math.min(n,r.length-2)+1],o=i<S[0]?r[0]:i<S[1]?S[0]:S[1];return Math.max(Math.min(w(a),w(o))*Pe(e,t)[0]-x.skin,.05)},Ue=(e,t,n,r)=>[t,x.axis[e]+Ve(e)[n],O+r*He(e,t,n)],We=e=>S.some(t=>Math.abs(t-e)<1e-6),Ge=(e,t,n,r,i)=>T[e].tears.some(([e,a,o,s])=>t>=e-.01&&n<=a+.01&&r>=o-.01&&i<=s+.01),Ke=e=>[...e?[[x.sections[e][0],-1]]:[],...e<2?[[x.sections[e][1],1]]:[]],qe=e=>{let t=x.axis[e],n=Ke(e).map(e=>e[0]),{tears:r,holes:i}=T[e];return a=>{let[o,s,l]=[a[0],a[1]-t,Math.abs(a[2]-O)],u=.9*c(o/1.7,a[1]/1.7+a[2]/2.3,9),d=Math.min(9,...n.map(e=>Math.abs(o-e)));for(let[e,t,n,i]of r)l>2.4&&(d=Math.min(d,Math.hypot(Math.max(e-o,o-t,0),Math.max(n-s,s-i,0))));for(let[e,t,n]of i)e==2&&s>5&&(d=Math.min(d,1.4*Math.hypot(Math.max(t-o,o-n,0),.5*l)));return(.1+.9*N((d-u)/1.1))*(.5+.5*N((s+6.3+.5*u)/2.4))*(.93+.07*c(o/5,(a[1]+a[2])/4,4+e))}},Je=[[0,1.75,1,2],[.75,1,1,2],[.75,0,1,1],[0,0,1,.25],[0,0,.25,1],[0,1,.25,2],[0,.875,1,1.125]],Ye=[63,102,91,7],Xe=t(o([[0,-.1],[.7,-.1],[1,.6],[1.5,1.4],[1.7,1.8],[1.5,1.72],[.6,.3],[0,.3]],14),[.15,.14,.14]),Ze=[[0,0],[11,0],[12.5,1.2],[10.5,8.5],[9.2,10],[6.4,10],[5.2,8.8]],Qe=[...Ze.slice(0,3),[11.6,4.4],[10.2,3.5],[9,5.2],[7.4,4],[5.9,5.6],[3.3,5.5]],$e=(e,t,n)=>e.slice(1).forEach((r,i)=>U(e[i],r,t,2,k,.14,n)),et=(e,t)=>{let[n,r]=x.sections[e],i=x.axis[e],o=e>1?[...Re(e,n,Ae),...ze]:Re(e,n,r),s=qe(e),c=e=>[e,i,O];if(we(o.map(t=>Le(e,t)),(n,r)=>{let i=(e=>e<W-1?e:Oe-1-e)(r),[a,s,c,l]=[o[n],o[n+1],ke(i),ke(i+1)];if(i==W-2?((e,t,n)=>T[e].holes.some(([e,r,i])=>e==2&&t>=r-.01&&n<=i+.01))(e,a,s):Ge(e,a,s,c,l)||e>1&&((e,t,n,r,i)=>Be.some(([a,o,s,c,l])=>l==i&&e>=a-.01&&t<=o+.01&&n>=s-.01&&r<=c+.01))(a,s,c,l,r<W-1?1:-1))return;let u=a>=Ae&&s<=je&&s-a>.5&&c>=G&&(l<=6.5||i>W-4&&a>=98);return t||u?t&&u?fe:void 0:c==-.9?ue:k},s),t)return;let l=Ve(e);for(let t of[-1,1])for(let[n,r,a,s]of T[e].tears){let u=l.map((e,t)=>[e,t]).filter(([e])=>e>=a&&e<=s),d=[(n+r)/2,i+(a+s)/2,O+6*t];for(let[i,a]of[[n,.4],[r,-.4]]){let n=u.map(([n])=>Ie(e,i,n,t));V(n,u.map(([,n])=>Ue(e,i,n,t)),()=>ye,d,void 0,void 0,!0),$e(n,[a,0,.12*t],c(i))}let f=o.filter(e=>e>=n&&e<=r);for(let[[r,i],a]of[[u[0],.35],[u[u.length-1],-.35]]){let o=We(r)?-.02:We(r+.3)?.02:0,s=f.map(n=>L(Ie(e,n,r,t),[0,o,0]));V(s,f.map(n=>L(Ue(e,n,i,t),[0,o,0])),()=>ye,d,void 0,void 0,!0),$e(s,[0,a,.12*t],c(n))}}for(let[t,n]of Ke(e)){let r=Le(e,t);V(r,r.map((t,r)=>L(t,[n*(.15+1.1*a(r,e,3+n)),0,0])),()=>k,c(t),r.map(()=>.1));for(let r of[-1,1])V(l.map(n=>Ie(e,t,n,r)),l.map((n,i)=>Ue(e,t,i,r)),e=>1&e?A:j,c(t-9*n))}},tt=E(f.GRATE,1.7,2),nt=[0,99,0],rt=(e,t,n,r,i)=>R.map(a=>[1&a?t:e,n,2&a?i:r]),it=D([.3,.31,.16]),at=D([.15,.16,.085]),q=D([.17,.17,.18]),J=D([.13,.135,.145]),ot=D([.2,.21,.12]),st=D([.06,.22,.12],1,-2),ct=D([.3,.15,.02],1,-2),Y=D([.02,.025,.03]),X=(e,t,n,r)=>{let i=F(P(t,e)),a=F(he(i,Math.abs(i[1])>.9?[1,0,0]:[0,1,0])),o=he(a,i),s=.58*n,c=[0,1,2,0].map(e=>L(L([0,0,0],a,s*Math.cos(2.0944*e)),o,s*Math.sin(2.0944*e)));V(c.map(t=>L(e,t)),c.map(e=>L(t,e)),()=>r,I(e,t))},Z=(e,t,n,r,i,a=i)=>{let o=n=>L(L(L(e,t[0],n[0]),t[1],n[1]),t[2],n[2]),s=o(I(n,r));for(let e=0;e<6;e++){let[t,c,l]=[e>>1,(1+(e>>1))%3,(2+(e>>1))%3];B(R.map(i=>{let a=[0,0,0];return[a[t],a[c],a[l]]=[(1&e?r:n)[t],(1&i?r:n)[c],(2&i?r:n)[l]],o(a)}),e==3?a:i,s)}},lt=(e,t,n)=>e.map(e=>{let[r,i]=[Math.cos(n),Math.sin(n)],a=(1-r)*(t[0]*e[0]+t[1]*e[1]+t[2]*e[2]),o=he(t,e);return[0,1,2].map(n=>e[n]*r+o[n]*i+t[n]*a)}),ut=(e,t,n,r,i)=>{let o=(e,t,a)=>[e,n+t,O+i*(r-a)],s=[0,n,O+i*(r+9)],[c,l,u]=[.22,.64,.55],d=Math.floor((t-e)/u),f=(e+t-d*u)/2,p=f+d*u;X(o(f,1.2,c-.03),o(p,1.2,c-.03),.045,q),X(o(f,.46,c),o(p,.46,c),.04,q),X(o(f,.45,l),o(p,.45,l),.04,q);for(let e=0;e<=d;e+=2){let t=f+e*u;X(o(t,0,l-.1),o(t,.45,l),.035,q),X(o(t,.46,c),o(t,1.2,c-.03),.03,q)}for(let e=0;e<d;e++){let[t,r]=[f+e*u+.035,f+(e+1)*u-.035],d=Math.round(20*t)+(i>0?7919:0),p=a(d,Math.round(4*n),61),m=.85+.3*a(d,3,62);if(p<.95){B([o(t,.5,c+.015),o(r,.5,c+.015),o(r,1.17,c),o(t,1.17,c)],at,s,m);for(let e of[.3,.7]){let n=t+e*(r-t);B([o(n-.03,.5,c+.03),o(n+.03,.5,c+.03),o(n+.03,1.17,c+.02),o(n-.03,1.17,c+.02)],it,s,m)}for(let e of[.7,.98])B([o(t,e,c+.035),o(r,e,c+.035),o(r,e+.1,c+.035),o(t,e+.1,c+.035)],it,s,m)}if(p<.58){let e=[o(t,.46,c),o(r,.46,c),o(r,.42,(c+l)/2),o(t,.42,(c+l)/2)];B(e,it,M,m),B([e[3],e[2],o(r,.45,l),o(t,.45,l)],it,M,m)}else p<.84?B([o(t,.5,c+.07),o(r,.5,c+.07),o(r,.92,c+.09),o(t,.92,c+.09)],it,s,.8*m):p<.93&&B([o(t,.46,c),o(r,.46,c),o(r-.04,.08,c+.18),o(t+.06,.1,c+.2)],it,s,.75*m);if(a(d,5,63)<.3){let e=t+(r-t)*(.25+.5*a(d,6,64)),n=.15+.2*a(d,7,65),i=.06*(a(d,8,66)-.5);B([o(e-.025,.44,l+.02),o(e+.025,.44,l+.02),o(e+.025+i,n,l+.05),o(e-.025+i,n,l+.05)],at,s,m),B([o(e-.04+i,n,l+.055),o(e+.04+i,n,l+.055),o(e+.04+i,n-.06,l+.055),o(e-.04+i,n-.06,l+.055)],q,s)}}},dt=[[1,-1,44.6,57.1],[1,-1,60.9,73.4],[1,0,44.6,47.3],[1,0,55.3,66.8],[1,0,70.7,73.4],[2,-1,82.6,88.9],[2,-1,91.1,94.5],[2,0,91.2,94.5]],ft=()=>{Ce([]),et(2,`glass`);let e=x.axis[2];for(let[t,n,r,i,a]of Be){let o=Ee.indexOf(r),s=Ee.indexOf(i),c=(e,t)=>Le(2,e)[a>0?t:Oe-t],l=[Array.from({length:s-o+1},(e,n)=>c(t,o+n)),Array.from({length:s-o+1},(e,t)=>c(n,o+t)),[c(t,o),c(n,o)],[c(t,s),c(n,s)]],u=I(I(c(t,o),c(n,s)),I(c(n,o),c(t,s)));for(let t of l)t.slice(1).forEach((n,r)=>{let i=F(P(u,I(t[r],n)));U(t[r],n,i.map(e=>.45*e),3,fe,1,[t[r][0],e,O])})}return z},pt=()=>{for(let[e,t,n,r]of dt){let i=t<0?0:Ve(e).indexOf(S[t]);for(let t of[-1,1])ut(n,r,x.axis[e]+Ve(e)[i],He(e,(n+r)/2,i),t)}(()=>{let e=x.axis[2],t=e+G,n=n=>{let[,r,i,a]=Pe(2,n);return K(2,n,(t-e+a)/((1-.2*r)*i))},r=[97,98.5,100,101.4];r.slice(1).forEach((e,i)=>{let[a,o]=[r[i],e].map(e=>n(e)-.12);B([[r[i],t,O-a],[e,t,O-o],[e,t,O+o],[r[i],t,O+a]],E(f.METAL,.3),M)});let i=[1,0,0],o=[0,1,0],s=[0,0,1];for(let e of[-1,1]){let n=[98.35,t,O+.85*e],r=[i,o,s];e<0&&(r=lt(lt(r,i,-.32),o,.35),n[1]+=.06),Z(n,r,[-.2,0,-.17],[.2,.32,.17],J),Z(n,r,[-.26,.32,-.26],[.27,.44,.26],ot);let a=lt(r,r[2],.22),c=L(L(n,r[0],-.24),r[1],.42);Z(c,a,[-.13,0,-.26],[0,.82,.26],ot),Z(c,a,[-.12,.84,-.16],[.03,1.08,.16],J);for(let e of[-.24,.24]){let t=e=>L(L(L(c,a[0],e[0]),a[1],e[1]),a[2],e[2]);B([t([.01,.8,.5*e-.04]),t([.01,.8,.5*e+.04]),t([.02,.05,.7*e+.04]),t([.02,.05,.7*e-.04])],at,t([-1,.4,0]));let i=e=>L(L(L(n,r[0],e[0]),r[1],e[1]),r[2],e[2]);X(i([-.22,.68,1.25*e]),i([.2,.68,1.25*e]),.06,J),X(i([.14,.68,1.25*e]),i([.14,.42,1.1*e]),.035,q)}}Z([98.75,t,O],[i,o,s],[0,0,-.22],[1.7,.66,.22],J);for(let e=0;e<4;e++){let n=[99.15+(e==1||e==2?.12:0),t+.66,124.87+.26*e/3],r=L(n,[e%3?.16:-.1,.24,0]);X(n,r,.035,q),Z(r,[i,o,s],[-.035,-.02,-.04],[.035,.05,.04],e<2?ot:Y)}for(let e=0;e<3;e++)B(rt(99.6+.3*e,99.82+.3*e,t+.665,124.85,125.15),e==1?ct:Y,M);let c=lt([i,o,s],s,.28);Z([100.45,t,O],c,[0,0,-1.75],[.85,.92,1.75],J),Z(L([100.45,t,O],c[1],.92),c,[-.18,0,-1.6],[.6,.07,1.6],Y);for(let e=0;e<2;e++)for(let n=0;n<9;n++){let r=3*n/8-1.5,i=n==3||n==5?.17:.1,o=a(n,e,71),s=n==4?Y:o<.45?st:o<.55?ct:Y,l=L(L([100.45,t,O],c[1],.38+.3*e),c[0],-.005);B(R.map(e=>L(L(l,c[1],(2&e?1:-1)*(i-.02)),c[2],r+(1&e?i:-i))),s,L(l,[9,0,0]))}let l=lt([i,o,s],s,-.35),u=[99.1,Fe(2,97.6,0,x.r,1)[1]-.75,O];Z(u,l,[-1.6,-.07,-.5],[0,.07,.5],J,Y);for(let e=0;e<5;e++){let t=L(L(u,l[0],-.2-.3*e),l[1],-.075);B(R.map(n=>L(L(t,l[0],1&n?.1:-.1),l[2],(2&n?.3:-.3)+.08*(e-2))),e==1?ct:e==3?st:Y,L(t,l[1],9))}for(let e=0;e<4;e++){let t=L(u,l[0],-.4-.35*e);X(t,L(t,[.1*(e-1.5),-.5-.4*a(e,1,72),.15*(e-1.5)]),.03,1&e?ce:q)}Z([97.5,t,125.35],lt([i,o,s],o,.6),[-.3,0,-.2],[.3,.05,.2],J,Y),Z([97.3,t,123.1],lt([i,o,s],o,-.4),[-.25,0,-.22],[.25,.1,.22],ot);for(let e of[-1,1]){let r=O+e*(n(99.6)-.25);B([[99,t,r],[100.2,t,r],[100.1,t+.7,r-.12*e],[99.1,t+.65,r-.12*e]],J,[99.6,t,O])}})()},mt=[[0,0],[.08,.3],[.3,.8],[.55,1],[.8,.75],[.95,.3],[1,0]],ht=e=>{let t=re.pieces.filter(e=>e.kind==`wingpiece`&&e.min[2]>O),n=O+x.r+T[1].fair[1][2];g.pieces.forEach(([r,i,a,,,o],s)=>{let l=e=>n+g.span*e+a,u=t.filter(e=>e.min[2]>l(r)-.01&&e.max[2]<l(i)+.01).sort((e,t)=>e.min[2]-t.min[2]),[d,f]=[u[0],u[u.length-1]],m=e=>(e.min[2]+e.max[2])/2,h=e=>d.max[1]+(f.max[1]-d.max[1])*(l(e)-m(d))/(m(f)-m(d)),v=Math.ceil(g.span*(i-r)/1.4),y=(t,n,a)=>{let s=Math.min(t,47.49),[c,u]=[_(g.trail,s),_(g.lead,s)];return[(d=[c+(u-c)*n+o*v*((t-r)/(i-r)-.5),h(t)-a*p(t),l(t)])[0],d[1],O+e*(d[2]-O)];var d},b=[r,...[...g.lead,...g.trail].map(e=>e[1]).filter(e=>e>r+.01&&e<i-.01).flatMap(e=>[e-.01,e+.01]),i].sort((e,t)=>e-t),x=b.flatMap((e,t)=>t&&e-b[t-1]>3.4?[(e+b[t-1])/2,e]:[e]),S=e=>.12+.88*N((Math.min(s?Math.abs(Math.abs(e[2]-O)+O-l(r)):9,s<2?Math.abs(Math.abs(e[2]-O)+O-l(i)):9)-.7*c(e[0]/1.3,e[2]/1.3,17))/.9);we(x.map(e=>mt.map(([t])=>y(e,t,0))),()=>k,S,e<0),we(x.map(e=>mt.map(([t,n])=>y(e,t,n))),()=>k,e=>.75*S(e),e>0);for(let[t,n]of[...s?[[r,-1]]:[],...s<2?[[i,1]]:[]]){let[r,i]=[0,1].map(e=>mt.map(([n,r])=>y(t,n,e*r))),a=y(t-3*n,.5,.5);V(r,i,()=>ce,a),$e(r,[0,.06,e*n*.3],L(a,[0,-9,0]));for(let e of[.3,.62])ve(y(t-.4*n,e,.5),y(t+.45*n,e+.01*n,.6),.14,A,.6*p(t))}})},[gt,_t]=[.85,.7].map(e=>E(f.STEEL+te,e,1,!0)),vt=E(f.WOOD,1.35,1,!0),yt=E(f.WOOD,1.1,.5,!0),bt=t(o([[0,.1],[.3,.1],[.36,0],[.52,0],[.6,.15],[.6,.85],[.52,1],[.36,1],[.3,.9],[0,.9]],12),[.05,.05,.055]),xt=Te(o([[0,0],[1.5,0],[2.1,2.5],[2.2,4],[2.7,6.5],[2.75,12.5],[2.45,17.5],[2.1,19],[1.75,19.1],[1.5,17.6],[0,17.4]],16),k,e=>Math.hypot(e[0],e[1])<1.7&&e[2]<-16?.05:(.12+.88*N((-e[2]-5-3*c(e[0],2*e[1]-e[2]/2,61))/5))*(.55+.45*N((e[1]+2.2)/1.6))),St={panel:({min:e,max:t},n,r)=>{let i=.55+.45*a(e[0],e[2],51),o=D(oe.c,i,C),s=t[0]-e[0]<1?0:t[2]-e[2]<1?2:-1;if(s>=0){H(e,t,o,j);let[n,i]=[e.slice(),t.slice()];n[1]=i[1]=t[1],n[s]=i[s]=(e[s]+t[s])/2,U(n,i,[0,.4,0],9,k,.3);for(let n of[.5,1.1,1.7]){let[i,a]=[e.slice(),t.slice()];i[1]=a[1]=t[1]-n,i[s]=a[s]=(r>0?e:t)[s]-.04*r,ve(i,a,.08,j)}return}H(e,t,A,o);let c=[0,1,3,2,0].map(n=>[1&n?t[0]:e[0],t[1],2&n?t[2]:e[2]]);c.slice(1).forEach((n,r)=>{let i=P(I(c[r],n),[(e[0]+t[0])/2,t[1],(e[2]+t[2])/2]);U(c[r],n,[.35*Math.sign(i[0]),-.12,.35*Math.sign(i[2])],4,k,.35)}),i>.75&&B(R.map(n=>[e[0]+(1&n?1.1:.7),t[1]+.02,2&n?t[2]:e[2]]),D(le),M,i)},container:({min:e,max:t})=>{H(e,t,gt);let n=t[0]-e[0]>t[2]-e[2]?0:2;for(let r=e[n]+.3;r<t[n]-.2;r+=.6){let[i,a]=[e.map(e=>e-.05),t.map(e=>e+.05)];[i[n],a[n],i[1],a[1]]=[r,r+.3,e[1],t[1]-.15],H(i,a,_t)}for(let r of[.35,.65]){let i=L(e,P(t,e),r);[i[n],i[1]]=[e[n]-.04,e[1]],ve(i,[i[0],t[1]-.1,i[2]],.08,j)}},crate:({min:e,max:t},n)=>{if(t[1]-e[1]>1.2){H(e,t,E(f.STEEL,.75));for(let n of[.33,.66]){let r=e[0]+(t[0]-e[0])*n;H([r-.02,e[1]+.1,e[2]-.01],[r+.02,t[1]-.1,t[2]+.01],ce)}}else{H(e,t,E(f.WOOD),n&&D(n,.75));for(let n of R){let[r,i]=[1&n?t[0]-.09:e[0]-.01,2&n?t[2]-.09:e[2]-.01];H([r,e[1],i],[r+.1,t[1]+.01,i+.1],vt,vt,55^1<<(1&n)^(2&n?32:16))}for(let n of[.25,.75]){let r=e[2]+(t[2]-e[2])*n;H([e[0]-.02,e[1],r-.1],[t[0]+.02,t[1]+.02,r+.1],j)}}},dais:({min:e,max:t},n=le)=>{H(e,t,A,D(n,.6)),B(R.map(n=>[1&n?t[0]-.5:e[0]+.5,t[1]+.02,2&n?t[2]-.5:e[2]+.5]),D(n,.95),M)},shelter:({min:e,max:t},n)=>{if(!n)return void H(e,t,yt);let[r,i]=[6,4],a=(n,a,o)=>[e[0]+(t[0]-e[0])*n/r,t[1]-o-.3*Math.sin(Math.PI*n/r)*Math.sin(Math.PI*a/i),e[2]+(t[2]-e[2])*a/i];for(let t=0;t<r;t++)for(let r=0;r<=i;r++)for(let o of[0,.03]){let[s,c]=[a(t,r,o),a(t+1,r,o)],l=D(n,1&t?.7:.8,ne);r<i&&B([s,c,a(t+1,r+1,o),a(t,r+1,o)],l,[e[0],o?99:-99,e[2]]),r%i<1&&B([s,c,L(c,M,1/99),L(s,M,1/99)],l,[e[0],e[1],o?99:-99])}},gear:({min:e,max:t},n)=>{if(n)return be(e,t,.4,D(n,.7),D(n,.55)),void be([e[0],t[1]-.9,e[2]],[t[0],t[1]-.6,t[2]],.4,j,void 0,.04);let r=(e[2]+t[2])/2;for(let n=0;n<3;n++)Se(bt,[e[0]+.7+1.5*n,t[1]-.6,t[2]],[0,0,-1],[1,1,t[2]-e[2]]);H([e[0]+.3,t[1]-.8,r-.2],[t[0]-.3,t[1]-.4,r+.2],A)},fallen:({max:e},t,n)=>{if(!t)return;let[r,i,,a,o]=b[0],s=F([1,0,n*o]),c=[r,e[1]-2.2,O+n*(i-O)];Se(xt,L(c,s,-a/2),s,[.84,.8,1]),Se(Xe,L(c,s,-a/2+.3),s.map(e=>-e),[1.15,1.15,1.15]);let l=[-1,3.5].map(e=>L(L(c,s,e),[0,2.1,0])),u=[.5*-s[2],1.1,.5*s[0]];V(l,l.map(e=>L(e,u)),()=>j,c),U(L(l[0],u),L(l[1],u),u,6,k,.16,c)},rail:({min:e,max:t})=>{H([e[0]+.14,e[1],e[2]],[t[0]-.14,t[1],t[2]],A);for(let n of[e[1],t[1]-.07])H([e[0],n,e[2]],[t[0],n+.07,t[2]],A,A,0)},engine:({min:e,max:t},n=le)=>{let r=(e[0]+t[0])/2,i=e=>((e,t,n,r)=>[...e,...e.map(([e,t])=>[-e,t]).reverse()].map(([e,i])=>[t+e,n+i,r]))([[2.5,-5],[2.5,-.4],[2.1,0]],r,t[1],e),o=[r,t[1]-2.5,(e[2]+t[2])/2],s=i(0).map((e,t)=>.45+.4*a(t,3,62));V(i(e[2]),i(t[2]),e=>e==2?D(n,.6):k,o,s);for(let[n,a]of[[e[2],-1],[t[2],1]]){B(i(n),ce,o);let e=(e,t,i)=>[r+e*Math.cos(t),o[1]+e*Math.sin(t),n+a*i],t=Math.PI/7;for(let n=0;n<14;n++){let r=n*t;B([e(.5,r,.2),e(2.25,r-.1,.22),e(2.25,r+.22,.05),e(.5,r+.3,.08)],D([.42,.43,.46]),o),B([e(0,0,.3),e(.55,r,.1),e(.55,r+t,.1)],j,o),B([e(2.3,r,.04),e(2.3,r+t,.04),e(2.48,r+t,.04),e(2.48,r,.04)],se,o)}}},pod:({min:e,max:t},n,r)=>{let i=l[r>0?0:1],o=e[1]+.5,s=I(e,t),[c,u]=[s[0],(r>0?e[2]:t[2])-.04*r];be(e,t,.42,k,D(oe.c,.8,C),0,[.5,1]),be(e,[t[0],o+.8,t[2]],.42,ce,void 0,.04),be([e[0],o+2,e[2]],[t[0],o+2.4,t[2]],.42,D(i,.8),void 0,.03),B(R.map(e=>[c+(1&e?.65:-.65),o+(2&e?1.95:0),u]),ce,s);for(let e of[-.7,.7])ve([c+e,o,u],[c+e,o+2,u],.1,j),B(R.map(t=>[c+3.03*Math.sign(e),o+(2&t?1.7:1.2),s[2]+(1&t?.3:-.3)]),de,s);ve([c-.7,o+2,u],[c+.7,o+2,u],.1,j),H([c+1,o-.1,u-2.6*r-.95],[c+2.3,o+.1,u-2.6*r+.95],k);let d=[c,o+.28,s[2]+7*r],f=e=>{let t=3+1.3*a(e%14,r,71);return[c+t*Math.cos(e*Math.PI/7),o+.03+.2*a(e%14,r,72),d[2]+t*Math.sin(e*Math.PI/7)]};for(let e=0;e<14;e++)B([d,f(e),f(e+1)],D(1&e?le:[.8,.8,.76],.9),M)},heap:({min:e,max:t},n=le,r=1,i=0)=>{let[o,s]=i?[0,2]:[2,0];H(e,t,j,i?j:D(n,.55));let c=Math.round((t[s]-e[s])/1.6);for(let n of i?[i]:[-1,1]){let r=(n<0?e:t)[o];for(let i=0;i<c;i++){let l=e=>a(i,7*r+e,41),u=(a,l,u)=>{let d=[0,l,0];return d[s]=e[s]+(t[s]-e[s])*(i+a)/c,d[o]=r+n*u,d},d=t[1]-.15-.5*l(3),f=.12+.12*l(4),p=[u(.05,e[1],f),u(.95,e[1],f),u(.95,d,.02),u(.05,d-.2*l(6),.02)],m=u(.5,d/2,-9);B(p,l(5)>.45?k:se,m,[.75,.75,1,1]),U(p[3],p[2],[0,.35,0],3,se,.9,m)}}},frame:({min:e,max:t},n,r)=>{H([e[0]+.2,e[1],e[2]],[t[0]-.2,t[1],t[2]],j),H([e[0],t[1]-.16,e[2]],t,A,A,0),H([e[0],t[1]-.8,e[2]],[t[0],t[1]-.64,t[2]],A,A,0);let i=(e[2]+t[2])/2;ve([e[0]+.14,t[1],i-.7*r],[e[0]+.14,t[1]+3.4,i+.6*r],.26,A)}};St.float=St.raft=St.panel,St.jam=(e,t,n)=>St.heap(e,t,n,x.sections.some(t=>t[1]==e.max[0])?1:-1);var Ct=[`pod`,`dais`,`crate`,`shelter`],wt=[`shelter`,`float`,`raft`,`engine`,`dais`,`fallen`,`rail`],Tt=e=>Object.values((e=>{let n=e.relief&&{relief:i(e.relief)};ge=(e,t)=>{let r=n?s(n,e,t):0;return r>-1e9?r:0};let r=e=>(Ce([]),e(),z),c=t=>()=>{for(let n of re.pieces){let r=Ct.includes(n.kind)&&Math.abs((n.min[2]+n.max[2])/2-O)>1;if(St[n.kind]&&r==t){let t=e.brushes.find(e=>e.min.every((t,r)=>t==n.min[r]&&e.max[r]==n.max[r]));St[n.kind](n,t?.tint,(n.min[2]+n.max[2])/2<O?-1:1),wt.includes(n.kind)||xe(n)}}};return{cabin:r(pt),hull:r(()=>{T.forEach((e,t)=>et(t)),T.forEach(({fair:e},t)=>{let n=qe(t);for(let[r,i,a]of e){let e=t>1&&i>Ae?je:i,o=Math.ceil((e-r)/2),s=Array.from({length:o+1},(t,n)=>r+n*(e-r)/o);for(let o of[-1,1]){let c=n=>{let r=K(t,n,0),s=n>i?(x.r+a-K(t,i,0))*(1-(n-i)/(e-i))+.05:x.r+a-r;return[[K(t,n,G)-.15,G],[r+s-.3,G],[r+s-.08,G-.08],[r+s,G-.3],[r+s-.06,G-.75],[r+.6*s,.2],[r+.25*s,-.8],[K(t,n,-1.7)-.15,-1.7]].map(([e,r])=>Fe(t,n,e,r,o))};we(s.map(c),()=>k,n,o>0);for(let[n,a]of[[r,-1],[i,1]])if(n==e||n==r){let e=c(n);B(e,j,[n-9*a,0,O+8*o]),$e(e.slice(0,6),[.5*a,0,0],[n,x.axis[t],O])}}}})}),ends:r(()=>{(()=>{let[e]=x.sections[0],t=x.axis[0],n=Le(0,e);n.slice(1).forEach((r,i)=>B([[e,t,O],n[i],r],j,[e+9,t,O],.8)),Se(Xe,[e+.2,t+1.6,O],[-1,0,0],[1.75,1.75,1.75]);for(let n of[-1,1]){let r=[10.5,t+.4,O+n*(K(0,15,.4)-.5)];Se(Te(o([[0,0],[1,.4],[1.5,3],[1.5,8],[.9,10],[0,10.3]],10),k,e=>.25+.75*N((-e[2]-2)/5)*N(1.6-n*e[0])),r,[1,0,0]);let i=[3,7.5].map(e=>[r[0]+e,r[1],r[2]+1.45*n]);V(i,i.map(e=>L(e,[0,.5,0])),()=>j,r),U(i[0],i[1],[0,.2,1.1*n],7,k,.16,r),U(L(i[0],[0,.5,0]),L(i[1],[0,.5,0]),[0,.1,.8*n],5,k,.2);let a=.45,s=r=>(n>0?Ze:Qe).map(([i,o])=>{let s=e+14-i,c=K(0,Math.max(s,e),5.3)-.3+o*Math.sin(a),l=r*(.35-.017*o);return[s,t+5.3+o*Math.cos(a)-l*Math.sin(a),O+n*(c+l*Math.cos(a))]}),[c,l]=[-1,1].map(e=>{let t=s(e);return B(t,k,s(-e)[3],t.map((e,t)=>n<0&&t>2?.2:t>2?.95:.8)),t});V([...c,c[0]],[...l,l[0]],()=>j,I(c[0],c[3])),Ye.forEach((e,r)=>Je.forEach(([i,a,o,s],c)=>{e>>c&1&&B(R.map(e=>{let[t,c]=[16.6+n*(1.5*(r-2)+1.05*(1&e?o:i)),2.5+1.05*(2&e?s:a)];return Fe(0,t,K(0,t,c)+.03,c,n)}),D([.05,.08,.16],1,C),[17,t,O])}))}})(),(()=>{let e=Le(2,Me),n=I(e[0],e[W-1]);e.slice(1).forEach((t,r)=>B([L(n,[.5,0,0]),e[r],t],j,[0,n[1],O])),Se(t(o([[0,0],[.22,0],[.08,2.4],[0,2.4]],6),[.2,.2,.22]),L(n,[.3,-.1,0]),[1,0,0])})()}),inside:r(()=>T.forEach((e,t)=>(e=>{let[t,n]=x.sections[e],r=x.axis[e],{cut:i,tears:o,holes:s}=T[e],c=Ve(e),[l,u]=[i[0][3]?i[0][1]:t,e>1?Ae:n],d=Re(e,t,u).filter(e=>e>=l);for(let t of[-1,1]){we(d.map(n=>c.map((r,i)=>Ue(e,n,i,t))),(t,n)=>Ge(e,d[t],d[t+1],c[n],c[n+1])?void 0:se,()=>1,t>0);for(let n=l+2.5;n<u;n+=5)c.slice(1).forEach((i,a)=>{if(!S.includes(i)&&!o.some(([e,t,r,o])=>n>e-.3&&n<t+.3&&c[a]>=r&&i<=o)){let[i,o]=[a,a+1].map(r=>[[-.08,0],[-.08,.2],[.08,.2],[.08,0]].map(([i,a])=>L(Ue(e,n,r,t),[i,0,-t*a])));V(i,o,()=>A,[n,r,O+20*t])}})}l>t&&B([1,-1].flatMap(t=>(t>0?c:[...c].reverse()).map(n=>Ue(e,l,c.indexOf(n),t))),se,[l-9,r,O]);for(let{kind:i,min:a,max:o}of re.pieces){if(i!=`deck`||a[0]<t||o[0]>n)continue;let s=o[1]>r+6.9,[c,l]=[a.slice(),o.slice()];s&&e>1&&(l[0]=Math.min(l[0],Ae));let u=Math.min(...[c[0],(c[0]+l[0])/2,l[0]].map(t=>K(e,t,Math.min(o[1]-r,6.4))))-.3;[c[2],l[2]]=[Math.max(c[2],O-u),Math.min(l[2],O+u)],l[0]>c[0]&&l[2]>c[2]&&H(c,l,s?se:A,tt,s?8:a[1]<r-6.9?52:0)}for(let[t,n,i,a]of s){let o=r+S[t],s=Math.min(a,(t>1?2.5:w(S[t]))*Pe(e,(n+i)/2)[0]-x.skin),c=t>1?k:se,l=t>1?.14:.5;for(let[e,t]of[[n,.4],[i,-.4]])U([e,o,O-s],[e,o,O+s],[t,-.3,0],6,c,l);if(a<9)for(let e of[-1,1])U([n,o,O+e*s],[i,o,O+e*s],[0,-.3,.4*-e],6,c,l)}[...S.slice(0,2),6.8].forEach((t,n)=>{let i=r+t-.33;for(let t=l+2;t<u;t+=5){let r=O+(n>1?2.1:3.9)*Pe(e,t)[0]*(a(t,n,43)<.5?-1:1),o=[t+1.6,i+.03,O+4*(a(t,n,41)-.5)],c=(e,t,r)=>s.some(([i,a,o,s])=>i==n&&e>a-r&&e<o+r&&Math.abs(t-O)<s+.3);c(t,r,.8)||c(o[0],o[2],.3)||(B(rt(t-.5,t+.5,i,r-.07,r+.07),me,nt),ve(o,L(o,[.2,-.3-.8*a(t,n,42),.25]),.05,ce))}})})(t))),wings:r(()=>[1,-1].forEach(ht)),debris:r(c(!1)),camps:r(c(!0))}})(e)).flat(),[Et,Dt,Q,Ot]=[ie.trees+5,70,14,80],[kt,At]=[Et-Q-Ot,u/4*Q],jt=2*(kt+At)+250+2*(Dt-Q),Mt=x.sections[2][1]+3-Et,$=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),Nt=(e,t,n=1.15)=>{let[r,i]=[(e-x.sections[2][1]+2)/32,(t-125)/26],a=r*r+i*i;return a<3?$(2.2*(n-Math.sqrt(a)-.3*c(e/7,t/7,6)))*$((e-ie.trees+6)/10):0},[Pt,Ft]=[[.2,.13,.06],[.05,.045,.04]],It=e=>{for(let t=0;t<e.length;t+=10){let n=Nt(e[t],e[t+2],1.3);if(n>0){let[r,i,a]=[Math.min(2*n,1),1-Math.max(2*n-1.2,0),4*e[t+7]];for(let n=0;n<3;n++){let o=t+(n<2?6+n:9);e[o]=(e[o]+(Pt[n]*a-e[o])*r)*i}}}},Lt=e=>{if(e>jt/2){let[t,n,r,i]=Lt(jt-e);return[t,250-n,r,-i]}let[t,n]=[(e-kt)/Q,Q-Dt];return e<kt?[Ot+e,-Dt,0,-1]:e<kt+At?[Et-Q+Q*Math.sin(t),n-Q*Math.cos(t),Math.sin(t),-Math.cos(t)]:[Et,n+e-kt-At,1,0]},Rt=(e,t)=>{let[n,r,i,a]=Lt(e),o=t+Mt*i*$((22-Math.abs(r-125))/10);return[n+i*o,r+a*o,$((n-Ot)/30)]},zt=[[1,0,0],[0,0,1],[0,1,0]],Bt=[3,4,5].map(e=>t(o([[.9,0],[1.1,1]],e),[1,1,1])),Vt=[o([[0,-1],[1,0],[0,1]],4),o([[0,-1],[.85,-.45],[.9,.35],[0,1]],5)].map(e=>t(e,[1,1,1])),Ht=[.4,.33,.24],Ut=[.3,.2,.08],Wt=[[.16,.34,.07],[.1,.26,.06],[.22,.29,.08]],Gt=[[.05,.15,.04],[.08,.2,.05],[.04,.12,.05],[.11,.21,.04]],Kt=(e,t,n,r,i,a,o,[s,c,l])=>{let[u,d]=[Math.cos(n),Math.sin(n)],[f,p,m]=t;for(let t=0;t<o;t++){let n=(t+.5)/o,h=Math.max(r-2.1*n,-1.45),[g,_]=[Math.cos(h)*i/o,Math.sin(h)*i/o],[v,y,b]=[f+u*g,p+_,m+d*g],x=a*(.3+2.8*n*(1-n));for(let t of[-x,x]){let n=(f+v)/2+.4*u*g-d*t,r=(p+y)/2+.4*_-.45*x,i=(m+b)/2+.4*d*g+u*t,a=_*(i-m)-d*g*(r-p),o=d*g*(n-f)-u*g*(i-m),h=u*g*(r-p)-_*(n-f),S=(o<0?-1:1)/(Math.hypot(a,o,h)||1);[a,o,h]=[a*S,o*S+.6,h*S];let C=1/Math.hypot(a,o,h);e.push(f,p,m,a*C,o*C,h*C,.6*s,.6*c,-1,.6*l),e.push(v,y,b,a*C,o*C,h*C,.6*s,.6*c,-1,.6*l),e.push(n,r,i,a*C,o*C,h*C,s,c,-1,l)}[f,p,m]=[v,y,b]}},qt=(e,t,r,i,o,s,c,l,f)=>{let p=e=>a(s,e,77),m=8+5*p(1)+(2-c),h=[2,4,8][c],g=e=>[t+l*e*e,r+m*e,i+f*e*e];for(let t=0;t<h;t++){let r=t/h,i=o*(.62+.38*(1-r)*(1-r)),a=t%2?.8:1;n(e,Bt[c],g(r),g(r+1/h),[1,0,0],1,i,Ht.map(e=>e*a))}let _=g(1),v=[6,9,11][c];for(let t=0;t<v;t++)Kt(e,_,u*(t+.6*p(10+t))/v,[1.15,.55,-.05][t%3]+.3*p(30+t),3.8+p(50+t)+.3*(2-c),.8+.15*(2-c),[3,4,6][c],Wt[t%3]);for(let t=0;c>1&&t<3;t++){let n=u*(t/3+p(70));d(e,Vt[0],[_[0]+.24*Math.cos(n),_[1]-.3,_[2]+.24*Math.sin(n)],zt,[0,0,0],.17,Ut)}},Jt=(e,t,r,i,o,s)=>{let c=e=>a(o,e,78),l=8+7*c(1),f=[t+2*c(2)-1,r+.7*l,i+2*c(3)-1];n(e,Bt[+!s],[t,r,i],f,[1,0,0],1,.3+.2*c(4),Ht);for(let t=0;t<4;t++){let[n,r]=[u*(t/3+c(5)),.2*l+1.4*c(6+t)],i=t<3?.8*r:0;d(e,Vt[+!s],[f[0]+i*Math.cos(n),f[1]+(t<3?c(10+t):.5*r),f[2]+i*Math.sin(n)],zt,[0,0,0],[r,r,.7*r],Gt[Math.floor(4*c(14+t))])}},Yt=(e,t,r,i,o)=>{let s=e=>a(o,e,81),c=(i<125?-1:1)*(.3+1.1*s(1)),[l,d,f]=[Math.cos(c),Math.sin(c),t(r,i)],[p,m,h]=[.5+6*s(2)*s(2),.2+.14*s(3),4+5*s(4)],g=Ft.map(e=>e*(.6+.9*s(5))),_=[r+.25*p*l,f+p,i+.25*p*d];n(e,Bt[1],[r,f-m,i],_,[1,0,0],1,m,g);for(let t=0;t<2;t++)Kt(e,_,u*s(6+t),2.5,.5+.6*s(8+t),.5*m,1,g);let v=[r+h*l,t(r+h*l,i+h*d)+m,i+h*d],y=s(10)<.7;y&&n(e,Bt[1],p<2.5?_:[r,f+m,i],v,[0,1,0],1,.8*m,g);for(let t=0;t<2&&(y||p>3.5);t++)Kt(e,y?v:_,c+5*s(11+t),y?.5:-.2,2+s(13+t),.5,3,Pt)},Xt=(e,t,n,r,i,o)=>{let s=e=>a(i,e,79),c=6-o;for(let i=0;i<c;i++)Kt(e,[t,n+.1+.3*o,r],u*(i+s(i))/c,1+.3*o+.3*s(10+i),(1+.5*s(20+i))*(1+1.4*o),.3+.7*o,2,Wt[(i+o)%2])},Zt=(t,n,[r,i,o,s,l,u=0],d)=>{let{reach:f}=h(l,o,s),p=n(r,i)+u,m=p+e(s),g=t.length;ae(t,d,e=>{let t=f(e);return[r+e[0]*t,m+e[1]*t,i+e[2]*t]},p,p+s,l,.72+.14*a(l,5,41),u?void 0:n);for(let e=g;e<t.length;e+=10){let n=ie.water+.4+1.2*c(.4*t[e],.4*t[e+2],9);t[e+9]*=.4+.6*$((t[e+1]-n)/1.5)}Qt(t,g)},Qt=(e,t)=>{for(let n=t;n<e.length;n+=30){let[t,r,i]=[n,n+10,n+20],[a,o,s]=[e[r]-e[t],e[r+1]-e[t+1],e[r+2]-e[t+2]],[c,l,u]=[e[i]-e[t],e[i+1]-e[t+1],e[i+2]-e[t+2]],[d,f,p]=[o*u-s*l,s*c-a*u,a*l-o*c],m=Math.hypot(d,f,p)||1;for(let n of[t,r,i]){let[t,r,i]=[.75*e[n+3]+.25*d/m,.75*e[n+4]+.25*f/m,.75*e[n+5]+.25*p/m],a=Math.hypot(t,r,i)||1;[e[n+3],e[n+4],e[n+5]]=[t/a,r/a,i/a]}}},$t=(e,t,n)=>{let r=[],i=(e,n)=>a(e,n,90+t),o=e=>100+e+50*t;m.forEach(e=>Zt(r,n,e,4));for(let t=0;t<7;t++)Zt(r,e,[34+8*t+5*i(t,1),266+26*i(t,2),2.5+2.5*i(t,3),1.8+2.4*i(t,4),o(t)],3);for(let t=0;t<6;t++){let[n,a]=[94+7*t+4*i(t,5),264+t%3*9+6*i(t,6)],[s,c]=[7+3*i(t,7),7+5*i(t,8)+2*t];Zt(r,e,[n,a,s,c,o(10+t)],4);let l=[n+1.5*i(t,9)-.75,a+1.5*i(t,10)-.75,.6*s,.55*c];Zt(r,e,[...l,o(20+t),.8*c],3),i(t,11)<.5&&Zt(r,e,[l[0]+.5,l[1]-.4,.35*s,.4*c,o(30+t),1.3*c],2)}for(let t=0;t<5;t++)Zt(r,e,[12-9*t+4*i(t,12),264+9*t+6*i(t,13),2.5+2*i(t,14),4+5*i(t,15),o(40+t)],3);for(let n=0;n<8;n++){let a=n/7;Zt(r,e,[ie.sea-12-62*a+6*i(n,13),286-14*a*a+8*i(n,14),7-4.5*a,6-4*a,140+n+50*t],2)}return r},en=e=>4.5*$(e/2)+5*$((e-1.5)/5)+8*$((e-6)/12)+.14*Math.max(e-18,0),tn=[0,.8,1.7,3,4.5,6.5,9,12,16,21,28,37,49,65,88,120];function*nn(e){let t=(e=>Object.values((e=>{let t=e.relief&&{relief:i(e.relief)},n=(e,n)=>{let r=t?s(t,e,n):0;return r>-1e9?r:0},r=$t(n,0,n).concat((e=>{let t=e.slice();for(let n=0;n<e.length;n+=30)for(let r=0;r<3;r++){let[i,a]=[n+10*r,n+(3-r)%3*10];for(let n=0;n<10;n++)t[i+n]=e[a+n];t[i+2]=250-t[i+2],t[i+5]=-t[i+5]}return t})($t((e,t)=>n(e,250-t),1,n))),o=[];y.forEach(([e,t,r],i)=>{for(let s of[0,1]){let[c,l]=[2*i+s,s?250-t:t],u=1.2+2.6*a(c,1,70);qt(o,e,n(e,l),l,r,c,2,-u,u*(2*a(c,2,70)-1))}});let l=[],u=[];[2,6,11,17,24].forEach((e,t)=>{let r=t<2?7.5:7;for(let i=0;i*r<jt;i++){let o=e=>a(i,e,80+t),s=(i+o(1))*r,c=e+3*o(2),[d,f,p]=Rt(s,c);if(o(3)>.85*p)continue;let m=Nt(d,f);if(m>.3){Yt(u,n,d,f,1e3+100*t+i);continue}let h=n(d,f)+Math.max(p*(1-$(2.5*m))*en(c)-5,0),[,,g,_]=Lt(s),v=1e3+100*t+i;if(o(4)>.25+.15*t){let e=1+2.5*o(5),[n,r]=[-g*e+2*o(6)-1,-_*e+2*o(7)-1];qt(l,d,h,f,.28,v,+(t<2),n,r)}else Jt(l,d,h,f,v,t>1)}});for(let e=0;e<18;e++){let t=t=>a(e,t,88),r=x.r+2+14*t(2);Yt(u,n,Et+1+16*t(1),125+(1&e?r:-r),e)}let f=[];for(let e=0;4*e<jt;e++){let t=t=>a(e,t,86),[r,i,o]=Rt(4*(e+t(1)),-.5-3*t(2)*t(2));t(3)<o&&Nt(r,i)<.3&&Xt(f,r,n(r,i),i,e,0)}for(let e=0;2.4*e<jt;e++){let t=t=>a(e,t,87),[r,i,o]=Rt(2.4*(e+t(1)),.8-2.3*t(2)),s=1+.8*t(4);t(3)>o||Nt(r,i)>.3||(t(5)<.6?Xt(f,r,n(r,i),i,500+e,1):d(f,Vt[1],[r,n(r,i)+.6*s,i],zt,[0,0,0],[s,s,.8*s],Gt[e%4]))}let p=[];return((e,t,n)=>{let r=Math.ceil(jt/2.5),i=tn.length,o=new Float64Array((r+1)*i*4);for(let e=0;e<=r;e++){let s=e/r*jt,[l,u]=Rt(s,0),d=n(l,u);for(let r=0;r<i;r++){let l=tn[r],[u,f,p]=Rt(s,l),m=c(u/6,f/6,3)+.5*c(u/2.3,f/2.3,4)-.75,h=4*(e*i+r);o[h]=u+(a(e,r,61)-.5)*Math.min(l,3),o[h+2]=f+(a(e,r,62)-.5)*Math.min(l,3);let g=$(2.5*Nt(u,f));o[h+1]=d+(n(u,f)-d)*g-.4+p*(1-g)*(en(l)+40*$((l-25)/95)*(.4+.6*c(u/70,f/70,5))+(m*Math.min(.5+.13*l,4)+(a(e,r,63)-.5)*(1.4+.05*l))*$(l/1.5)*(1-.8*$((l-50)/50))),o[h+3]=(.4*(m/1.5+.5)+.6*a(e,r,64))*(1-.5*$((l-20)/50));for(let n=0;p>.3&&g<.9&&r&&r<6&&n<2;n++){let i=t=>a(2*e+n,r,65+t),[,,c,l]=Lt(s);Kt(t,[o[h],o[h+1]-.3,o[h+2]],Math.atan2(-l,-c)+3*i(0)-1.5,.3+.8*i(1),1.3+1.3*i(2),.9,1,(n?Wt:Gt)[Math.floor(3*i(3))])}}}let s=(e,t)=>4*(e*i+t);for(let t=0;t<r;t++)for(let n=0;n<i-1;n++){let r=t+n&1,i=[s(t,n),s(t+1,n),s(t+1,n+1),s(t,n+1)];for(let t of[0,1]){let[n,a,s]=[i[r],i[r+1+t],i[(r+2+t)%4]],[c,l,u]=[o[a]-o[n],o[a+1]-o[n+1],o[a+2]-o[n+2]],[d,f,p]=[o[s]-o[n],o[s+1]-o[n+1],o[s+2]-o[n+2]],[m,h,g]=[l*p-u*f,u*d-c*p,c*f-l*d],_=(h<0?-1:1)/(Math.hypot(m,h,g)||1),v=(o[n+3]+o[a+3]+o[s+3])/3;for(let t of[n,a,s])e.push(o[t],o[t+1],o[t+2],m*_,h*_,g*_),e.push(.02+.06*v,.06+.13*v,-1,.02+.03*v)}}})(p,f,n),[o,l,f,p].forEach(It),{rocks:r,palms:o,forest:l,brush:f,canopy:p,snags:u}})(e)).flat())(e);return yield,{land:t.concat(Tt(e)),sky:[],glass:ft(),rock:`{vec3 gn=normalize(N);float gp=max(length(dFdx(P)),length(dFdy(P)));
1
+ import{$t as e,F as t,J as n,K as r,Qt as i,Vt as a,X as o,Xt as s,Y as c,Zt as l,dr as u,rr as d,rt as f}from"./brick-CfuEIQ9e.js";import{A as p,C as m,D as h,E as g,O as _,S as v,T as y,_ as b,b as x,g as S,i as C,k as w,l as ee,n as te,o as ne,w as T,x as re,y as ie}from"./paint-DbTB8EPG.js";import{t as ae}from"./stone-BqYQDnkI.js";var E=(e,t=1,n=1,r)=>({l:e,c:[t],s:n,r}),D=(e,t=1,n=-1)=>({l:n,c:e.map(e=>e*t),s:1}),O=125,oe=D([.48,.49,.51],1,C),k=oe,A=E(u.STEEL,.45),se=E(u.METAL,.7),ce=D([.03,.03,.035]),j=D([.13,.135,.15]),le=[.8,.3,.04],ue=D([1,.36,.05],1,C),de=D([.03,.06,.09],1,t),fe=D([0,0,0],1,-7),pe=D([.64,.59,.48],1,ee),me=D([1,.62,.25],1,-2),M=[0,-99,0],N=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),P=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],he=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],F=e=>{let t=Math.hypot(e[0],e[1],e[2])||1;return[e[0]/t,e[1]/t,e[2]/t]},I=(e,t)=>e.map((e,n)=>(e+t[n])/2),L=(e,t,n=1)=>e.map((e,r)=>e+t[r]*n),R=[0,1,3,2],z=[],ge=(e,t)=>0,_e=(e,t,n,r)=>{if(n.l<0)z.push(e[0],e[1],e[2],t[0],t[1],t[2],n.c[0]*r,n.c[1]*r,n.l,n.c[2]*r);else{let[i,a]=Math.abs(t[1])>.7?[e[0],e[2]]:Math.abs(t[0])>.7?[e[2],e[1]]:[e[0],e[1]],[o,s]=n.r?[a,i]:[i,a];z.push(e[0],e[1],e[2],t[0],t[1],t[2],o*n.s,s*n.s,n.l,Math.min(n.c[0]*r,1.99))}},B=(e,t,n,r=1)=>{let i=[0,0,0];if(e.forEach((t,n)=>{let r=e[(n+1)%e.length];i=L(i,[(t[1]-r[1])*(t[2]+r[2]),(t[2]-r[2])*(t[0]+r[0]),(t[0]-r[0])*(t[1]+r[1])])}),Math.hypot(i[0],i[1],i[2])<1e-9)return;i=F(i);let a=P(I(e[0],e[2]),n);i[0]*a[0]+i[1]*a[1]+i[2]*a[2]<0&&(i=i.map(e=>-e));for(let n=1;n<e.length-1;n++)for(let a of[0,n,n+1])_e(e[a],i,t,typeof r==`number`?r:r[a])},V=(e,t,n,r,i,a=i,o=!1)=>{for(let s=0;s<e.length-1;s++){let c=n(s);c&&B([e[s],e[s+1],t[s+1],t[s]],c,o?L(e[s],P(e[s],r)):r,i&&a?[i[s],i[s+1],a[s+1],a[s]]:1)}},H=(e,t,n,r=n,i=4)=>{let a=I(e,t);for(let o=0;o<6;o++)if(!(i>>o&1)){let[i,s,c]=[o>>1,(1+(o>>1))%3,(2+(o>>1))%3];B(R.map(n=>{let r=[0,0,0];return[r[i],r[s],r[c]]=[(1&o?t:e)[i],(1&n?t:e)[s],(2&n?t:e)[c]],r}),o==3?r:n,a)}},ve=(e,t,n,r,i=n)=>{let a=F(P(t,e)),o=F(he(a,Math.abs(a[1])>.9?[1,0,0]:[0,1,0])),s=he(o,a),[c,l]=[e,t].map(e=>R.map(t=>L(L(e,o,((1&t)-.5)*n),s,((t>>1)-.5)*i))),u=I(e,t);V([...c,c[0]],[...l,l[0]],()=>r,u),B(c,r,u),B(l,r,u)},ye=E(u.STEEL,.6),U=(e,t,n,r,i,a=1,o=M)=>{let s=7*e[0]+3*Math.abs(e[2]-O)+e[1],c=(e,t)=>l(e,s+1.37*t,11+t),u=P(t,e),d=Math.hypot(n[0],n[1],n[2]),f=F(he(u,n)),p=P(I(e,t),o);f[0]*p[0]+f[1]*p[1]+f[2]*p[2]<0&&(f=f.map(e=>-e));let m=Math.sign(f[0]*n[0]+f[1]*n[1]+f[2]*n[2])||1,h=1/r;for(let t=0;t<r;t++){let s=(t+.3*(c(t,0)-.5)*(t>0))*h,l=(t+1+.3*(c(t+1,0)-.5)*(t<r-1))*h,p=.3+.7*c(t,1),g=m*d*(.15+.5*c(t,2)),_=.5*(c(t,3)-.5)*d,v=(t,r)=>L(L(L(e,u,s+(l-s)*t),n,p*r),f,g*r*r*p+_*(t-.5)*r*p),y=[.08+.3*c(t,4),.92-.3*c(t,5)],b=.35+.25*c(t,6),x=c(t,7),S=[[0,0],[1,0],[y[1],b],...x<.45?[[.25+.5*c(t,8),1]]:x<.8?[[.55+.3*c(t,8),.75+.25*c(t,9)],[.15+.3*c(t,9),1]]:[[.7+.2*c(t,8),1],[.5,.55+.15*c(t,9)],[.1+.2*c(t,9),.9]],[y[0],b+.1*(c(t,10)-.5)]],C=S.map(([e,t])=>v(e,t)),w=S.map(([,e])=>a*(1-.45*e));for(let e=1;e<C.length-1;e++){let t=[C[0],C[e],C[e+1]],n=[w[0],w[e],w[e+1]];B(t,i,o,n),i.l!=-7&&B(t.map(e=>L(e,f,-.012)),ye,L(C[0],f,9),n.map(e=>Math.min(1,.5+e)))}}},be=(e,t,n,r,i,a=0,o=[1,1])=>{let[s,c,l,u]=[e[0]-a,t[0]+a,e[2]-a,t[2]+a],d=e=>[[s+n,l],[c-n,l],[c,l+n],[c,u-n],[c-n,u],[s+n,u],[s,u-n],[s,l+n],[s+n,l]].map(([t,n])=>[t,e,n]),[f,p]=[d(e[1]),d(t[1])];V(f,p,()=>r,I(e,t),f.map(()=>o[0]),f.map(()=>o[1])),i&&B(p.slice(1),i,e)},xe=({min:e,max:t})=>{let n=I(e,t);if(ge(n[0],n[2])<.3||e[1]>ge(n[0],n[2]))return;let r=(r,i)=>{let[a,o]=[r+1&2?t[0]+i:e[0]-i,2&r?t[2]+i:e[2]-i],s=ge(a,o);return[a,s+(i?-.04:Math.min(.12+.35*l(r%4,n[0]+n[2],5),t[1]-s)),o]};for(let e=0;e<4;e++){let t=[r(e,0),r(e+1,0),r(e+1,.9),r(e,.9)];B(t,pe,M,t.map(e=>.92+.16*i(e[0]/11,e[2]/11,5)))}},Se=(e,t,r,i=[1,1,1])=>n(z,e,t,[[-r[2],0,r[0]],[0,1,0],r],[0,0,0],i),Ce=e=>{z=e},we=(e,t,n=()=>1,r=!1)=>{let i=(t,n)=>e[Math.min(Math.max(t,0),e.length-1)][Math.min(Math.max(n,0),e[0].length-1)],a=e.map((e,t)=>e.map((e,n)=>{let a=he(P(i(t+1,n),i(t-1,n)),P(i(t,n+1),i(t,n-1))),o=Math.hypot(a[0],a[1],a[2])*(r?-1:1);return o?[a[0]/o,a[1]/o,a[2]/o]:[0,1,0]}));for(let r=0;r<e.length-1;r++)for(let i=0;i<e[0].length-1;i++){let o=t(r,i);if(o)for(let t of[0,1,3,0,3,2]){let[s,c]=[r+(1&t),i+(t>>1)];_e(e[s][c],a[s][c],o,n(e[s][c]))}}},Te=(e,t,n=()=>1)=>{let r=z;Ce([]);for(let r=0;r<e.length;r+=6)_e(e.slice(r,r+3),e.slice(r+3,r+6),t,n(e.slice(r,r+3)));let i=z;return Ce(r),i},Ee=[-7,-6.6,-6,-5,-4,-3,-2.05,-1.75,-.9,0,1,1.95,2.25,2.9,3.6,4.3,5,5.5,6,6.5],De=[[2.75,6.72],[2.5,6.93],[2.3,7],[0,7],[0,7]],W=Ee.length+De.length,Oe=2*W-2,ke=e=>Ee[e]??De[e-Ee.length][1],[Ae,je,Me,Ne]=[92,104,114,2.4],G=S[1],Pe=(e,t)=>{let n=T[e].cut,r=n[0][2];for(let e=1;e<n.length;e++)r+=(n[e][2]-n[e-1][2])*N((t-n[e][0]+1)/2);let i=e>1?Math.max(t-99,0)/(Me-99):0;return[r,e>1?N((t-94)/5):0,1-.85*i,Ne*i]},K=(e,t,n)=>{let[r,i,a]=Pe(e,t);return(w(n)+((e=>e<0?Math.max(0,7+2*e):e>=5.6?2.38:e>=3.15?4.34-.8*(e-3.15):7-.844*e)(n)-w(n))*i)*r*a},Fe=(e,t,n,r,i)=>{let[,a,o,s]=Pe(e,t);return[t,x.axis[e]-s+(r>0?r*(1-.2*a):Math.max(r,3.5*a-7))*o,O+i*n]},Ie=(e,t,n,r)=>Fe(e,t,K(e,t,n),n,r),Le=(e,t)=>{let n=e>1&&t>Ae?t<je?5*(t-Ae)/12:5*(Me-t)/10:0,r=Array.from({length:W},(r,i)=>{let a=ke(i),o=t-n*Math.min(Math.max((a-G)/(7-G),0),1),[s,c,l]=Pe(e,o),u=De[i-Ee.length],d=u?(i==W-2?2.5*s-x.skin:Math.min(u[0],u[0]+(2.38-u[0])*c)*s)*l:K(e,o,a);return t=>Fe(e,o,d,a,t)});return[...r.map(e=>e(1)),...r.slice(0,-1).reverse().map(e=>e(-1))]},Re=(e,t,n)=>{let{cut:r,tears:i,holes:a}=T[e],o=[t,n,...i.flatMap(e=>[e[0],e[1]]),...a.filter(e=>e[0]==2).flatMap(e=>[e[1],e[2]]),...r.slice(1).flatMap(e=>[-1,-.33,.33,1].map(t=>e[0]+t))].filter(e=>e>=t&&e<=n).sort((e,t)=>e-t),s=[];return o.forEach((e,t)=>{let n=e-(o[t-1]??e);if(t&&n<.05)return;let r=Math.ceil(n/2);for(let t=1;t<r;t++)s.push(e-n*(r-t)/r);s.push(e)}),s},ze=[93.5,95,95.3,98,98.3,101,101.3,je,106.5,109,111.5,113,Me],Be=[[98.3,101,2.9,5,1],[98.3,101,3.6,5.5,-1]],Ve=e=>[T[e].floor,...v.filter(t=>t>T[e].floor+.5&&t<7)],He=(e,t,n)=>{let r=Ve(e),i=r[Math.min(n,r.length-2)],a=r[Math.min(n,r.length-2)+1],o=i<S[0]?r[0]:i<S[1]?S[0]:S[1];return Math.max(Math.min(w(a),w(o))*Pe(e,t)[0]-x.skin,.05)},Ue=(e,t,n,r)=>[t,x.axis[e]+Ve(e)[n],O+r*He(e,t,n)],We=e=>S.some(t=>Math.abs(t-e)<1e-6),Ge=(e,t,n,r,i)=>T[e].tears.some(([e,a,o,s])=>t>=e-.01&&n<=a+.01&&r>=o-.01&&i<=s+.01),Ke=e=>[...e?[[x.sections[e][0],-1]]:[],...e<2?[[x.sections[e][1],1]]:[]],qe=e=>{let t=x.axis[e],n=Ke(e).map(e=>e[0]),{tears:r,holes:a}=T[e];return o=>{let[s,c,l]=[o[0],o[1]-t,Math.abs(o[2]-O)],u=.9*i(s/1.7,o[1]/1.7+o[2]/2.3,9),d=Math.min(9,...n.map(e=>Math.abs(s-e)));for(let[e,t,n,i]of r)l>2.4&&(d=Math.min(d,Math.hypot(Math.max(e-s,s-t,0),Math.max(n-c,c-i,0))));for(let[e,t,n]of a)e==2&&c>5&&(d=Math.min(d,1.4*Math.hypot(Math.max(t-s,s-n,0),.5*l)));return(.1+.9*N((d-u)/1.1))*(.5+.5*N((c+6.3+.5*u)/2.4))*(.93+.07*i(s/5,(o[1]+o[2])/4,4+e))}},Je=[[0,1.75,1,2],[.75,1,1,2],[.75,0,1,1],[0,0,1,.25],[0,0,.25,1],[0,1,.25,2],[0,.875,1,1.125]],Ye=[63,102,91,7],Xe=r(o([[0,-.1],[.7,-.1],[1,.6],[1.5,1.4],[1.7,1.8],[1.5,1.72],[.6,.3],[0,.3]],14),[.15,.14,.14]),Ze=[[0,0],[11,0],[12.5,1.2],[10.5,8.5],[9.2,10],[6.4,10],[5.2,8.8]],Qe=[...Ze.slice(0,3),[11.6,4.4],[10.2,3.5],[9,5.2],[7.4,4],[5.9,5.6],[3.3,5.5]],$e=(e,t,n)=>e.slice(1).forEach((r,i)=>U(e[i],r,t,2,k,.14,n)),et=(e,t)=>{let[n,r]=x.sections[e],i=x.axis[e],a=e>1?[...Re(e,n,Ae),...ze]:Re(e,n,r),o=qe(e),s=e=>[e,i,O];if(we(a.map(t=>Le(e,t)),(n,r)=>{let i=(e=>e<W-1?e:Oe-1-e)(r),[o,s,c,l]=[a[n],a[n+1],ke(i),ke(i+1)];if(i==W-2?((e,t,n)=>T[e].holes.some(([e,r,i])=>e==2&&t>=r-.01&&n<=i+.01))(e,o,s):Ge(e,o,s,c,l)||e>1&&((e,t,n,r,i)=>Be.some(([a,o,s,c,l])=>l==i&&e>=a-.01&&t<=o+.01&&n>=s-.01&&r<=c+.01))(o,s,c,l,r<W-1?1:-1))return;let u=o>=Ae&&s<=je&&s-o>.5&&c>=G&&(l<=6.5||i>W-4&&o>=98);return t||u?t&&u?fe:void 0:c==-.9?ue:k},o),t)return;let c=Ve(e);for(let t of[-1,1])for(let[n,r,o,l]of T[e].tears){let u=c.map((e,t)=>[e,t]).filter(([e])=>e>=o&&e<=l),d=[(n+r)/2,i+(o+l)/2,O+6*t];for(let[i,a]of[[n,.4],[r,-.4]]){let n=u.map(([n])=>Ie(e,i,n,t));V(n,u.map(([,n])=>Ue(e,i,n,t)),()=>ye,d,void 0,void 0,!0),$e(n,[a,0,.12*t],s(i))}let f=a.filter(e=>e>=n&&e<=r);for(let[[r,i],a]of[[u[0],.35],[u[u.length-1],-.35]]){let o=We(r)?-.02:We(r+.3)?.02:0,c=f.map(n=>L(Ie(e,n,r,t),[0,o,0]));V(c,f.map(n=>L(Ue(e,n,i,t),[0,o,0])),()=>ye,d,void 0,void 0,!0),$e(c,[0,a,.12*t],s(n))}}for(let[t,n]of Ke(e)){let r=Le(e,t);V(r,r.map((t,r)=>L(t,[n*(.15+1.1*l(r,e,3+n)),0,0])),()=>k,s(t),r.map(()=>.1));for(let r of[-1,1])V(c.map(n=>Ie(e,t,n,r)),c.map((n,i)=>Ue(e,t,i,r)),e=>1&e?A:j,s(t-9*n))}},tt=E(u.GRATE,1.7,2),nt=[0,99,0],rt=(e,t,n,r,i)=>R.map(a=>[1&a?t:e,n,2&a?i:r]),it=D([.3,.31,.16]),at=D([.15,.16,.085]),q=D([.17,.17,.18]),J=D([.13,.135,.145]),ot=D([.2,.21,.12]),st=D([.06,.22,.12],1,-2),ct=D([.3,.15,.02],1,-2),Y=D([.02,.025,.03]),X=(e,t,n,r)=>{let i=F(P(t,e)),a=F(he(i,Math.abs(i[1])>.9?[1,0,0]:[0,1,0])),o=he(a,i),s=.58*n,c=[0,1,2,0].map(e=>L(L([0,0,0],a,s*Math.cos(2.0944*e)),o,s*Math.sin(2.0944*e)));V(c.map(t=>L(e,t)),c.map(e=>L(t,e)),()=>r,I(e,t))},Z=(e,t,n,r,i,a=i)=>{let o=n=>L(L(L(e,t[0],n[0]),t[1],n[1]),t[2],n[2]),s=o(I(n,r));for(let e=0;e<6;e++){let[t,c,l]=[e>>1,(1+(e>>1))%3,(2+(e>>1))%3];B(R.map(i=>{let a=[0,0,0];return[a[t],a[c],a[l]]=[(1&e?r:n)[t],(1&i?r:n)[c],(2&i?r:n)[l]],o(a)}),e==3?a:i,s)}},lt=(e,t,n)=>e.map(e=>{let[r,i]=[Math.cos(n),Math.sin(n)],a=(1-r)*(t[0]*e[0]+t[1]*e[1]+t[2]*e[2]),o=he(t,e);return[0,1,2].map(n=>e[n]*r+o[n]*i+t[n]*a)}),ut=(e,t,n,r,i)=>{let a=(e,t,a)=>[e,n+t,O+i*(r-a)],o=[0,n,O+i*(r+9)],[s,c,u]=[.22,.64,.55],d=Math.floor((t-e)/u),f=(e+t-d*u)/2,p=f+d*u;X(a(f,1.2,s-.03),a(p,1.2,s-.03),.045,q),X(a(f,.46,s),a(p,.46,s),.04,q),X(a(f,.45,c),a(p,.45,c),.04,q);for(let e=0;e<=d;e+=2){let t=f+e*u;X(a(t,0,c-.1),a(t,.45,c),.035,q),X(a(t,.46,s),a(t,1.2,s-.03),.03,q)}for(let e=0;e<d;e++){let[t,r]=[f+e*u+.035,f+(e+1)*u-.035],d=Math.round(20*t)+(i>0?7919:0),p=l(d,Math.round(4*n),61),m=.85+.3*l(d,3,62);if(p<.95){B([a(t,.5,s+.015),a(r,.5,s+.015),a(r,1.17,s),a(t,1.17,s)],at,o,m);for(let e of[.3,.7]){let n=t+e*(r-t);B([a(n-.03,.5,s+.03),a(n+.03,.5,s+.03),a(n+.03,1.17,s+.02),a(n-.03,1.17,s+.02)],it,o,m)}for(let e of[.7,.98])B([a(t,e,s+.035),a(r,e,s+.035),a(r,e+.1,s+.035),a(t,e+.1,s+.035)],it,o,m)}if(p<.58){let e=[a(t,.46,s),a(r,.46,s),a(r,.42,(s+c)/2),a(t,.42,(s+c)/2)];B(e,it,M,m),B([e[3],e[2],a(r,.45,c),a(t,.45,c)],it,M,m)}else p<.84?B([a(t,.5,s+.07),a(r,.5,s+.07),a(r,.92,s+.09),a(t,.92,s+.09)],it,o,.8*m):p<.93&&B([a(t,.46,s),a(r,.46,s),a(r-.04,.08,s+.18),a(t+.06,.1,s+.2)],it,o,.75*m);if(l(d,5,63)<.3){let e=t+(r-t)*(.25+.5*l(d,6,64)),n=.15+.2*l(d,7,65),i=.06*(l(d,8,66)-.5);B([a(e-.025,.44,c+.02),a(e+.025,.44,c+.02),a(e+.025+i,n,c+.05),a(e-.025+i,n,c+.05)],at,o,m),B([a(e-.04+i,n,c+.055),a(e+.04+i,n,c+.055),a(e+.04+i,n-.06,c+.055),a(e-.04+i,n-.06,c+.055)],q,o)}}},dt=[[1,-1,44.6,57.1],[1,-1,60.9,73.4],[1,0,44.6,47.3],[1,0,55.3,66.8],[1,0,70.7,73.4],[2,-1,82.6,88.9],[2,-1,91.1,94.5],[2,0,91.2,94.5]],ft=()=>{Ce([]),et(2,`glass`);let e=x.axis[2];for(let[t,n,r,i,a]of Be){let o=Ee.indexOf(r),s=Ee.indexOf(i),c=(e,t)=>Le(2,e)[a>0?t:Oe-t],l=[Array.from({length:s-o+1},(e,n)=>c(t,o+n)),Array.from({length:s-o+1},(e,t)=>c(n,o+t)),[c(t,o),c(n,o)],[c(t,s),c(n,s)]],u=I(I(c(t,o),c(n,s)),I(c(n,o),c(t,s)));for(let t of l)t.slice(1).forEach((n,r)=>{let i=F(P(u,I(t[r],n)));U(t[r],n,i.map(e=>.45*e),3,fe,1,[t[r][0],e,O])})}return z},pt=()=>{for(let[e,t,n,r]of dt){let i=t<0?0:Ve(e).indexOf(S[t]);for(let t of[-1,1])ut(n,r,x.axis[e]+Ve(e)[i],He(e,(n+r)/2,i),t)}(()=>{let e=x.axis[2],t=e+G,n=n=>{let[,r,i,a]=Pe(2,n);return K(2,n,(t-e+a)/((1-.2*r)*i))},r=[97,98.5,100,101.4];r.slice(1).forEach((e,i)=>{let[a,o]=[r[i],e].map(e=>n(e)-.12);B([[r[i],t,O-a],[e,t,O-o],[e,t,O+o],[r[i],t,O+a]],E(u.METAL,.3),M)});let i=[1,0,0],a=[0,1,0],o=[0,0,1];for(let e of[-1,1]){let n=[98.35,t,O+.85*e],r=[i,a,o];e<0&&(r=lt(lt(r,i,-.32),a,.35),n[1]+=.06),Z(n,r,[-.2,0,-.17],[.2,.32,.17],J),Z(n,r,[-.26,.32,-.26],[.27,.44,.26],ot);let s=lt(r,r[2],.22),c=L(L(n,r[0],-.24),r[1],.42);Z(c,s,[-.13,0,-.26],[0,.82,.26],ot),Z(c,s,[-.12,.84,-.16],[.03,1.08,.16],J);for(let e of[-.24,.24]){let t=e=>L(L(L(c,s[0],e[0]),s[1],e[1]),s[2],e[2]);B([t([.01,.8,.5*e-.04]),t([.01,.8,.5*e+.04]),t([.02,.05,.7*e+.04]),t([.02,.05,.7*e-.04])],at,t([-1,.4,0]));let i=e=>L(L(L(n,r[0],e[0]),r[1],e[1]),r[2],e[2]);X(i([-.22,.68,1.25*e]),i([.2,.68,1.25*e]),.06,J),X(i([.14,.68,1.25*e]),i([.14,.42,1.1*e]),.035,q)}}Z([98.75,t,O],[i,a,o],[0,0,-.22],[1.7,.66,.22],J);for(let e=0;e<4;e++){let n=[99.15+(e==1||e==2?.12:0),t+.66,124.87+.26*e/3],r=L(n,[e%3?.16:-.1,.24,0]);X(n,r,.035,q),Z(r,[i,a,o],[-.035,-.02,-.04],[.035,.05,.04],e<2?ot:Y)}for(let e=0;e<3;e++)B(rt(99.6+.3*e,99.82+.3*e,t+.665,124.85,125.15),e==1?ct:Y,M);let s=lt([i,a,o],o,.28);Z([100.45,t,O],s,[0,0,-1.75],[.85,.92,1.75],J),Z(L([100.45,t,O],s[1],.92),s,[-.18,0,-1.6],[.6,.07,1.6],Y);for(let e=0;e<2;e++)for(let n=0;n<9;n++){let r=3*n/8-1.5,i=n==3||n==5?.17:.1,a=l(n,e,71),o=n==4?Y:a<.45?st:a<.55?ct:Y,c=L(L([100.45,t,O],s[1],.38+.3*e),s[0],-.005);B(R.map(e=>L(L(c,s[1],(2&e?1:-1)*(i-.02)),s[2],r+(1&e?i:-i))),o,L(c,[9,0,0]))}let c=lt([i,a,o],o,-.35),d=[99.1,Fe(2,97.6,0,x.r,1)[1]-.75,O];Z(d,c,[-1.6,-.07,-.5],[0,.07,.5],J,Y);for(let e=0;e<5;e++){let t=L(L(d,c[0],-.2-.3*e),c[1],-.075);B(R.map(n=>L(L(t,c[0],1&n?.1:-.1),c[2],(2&n?.3:-.3)+.08*(e-2))),e==1?ct:e==3?st:Y,L(t,c[1],9))}for(let e=0;e<4;e++){let t=L(d,c[0],-.4-.35*e);X(t,L(t,[.1*(e-1.5),-.5-.4*l(e,1,72),.15*(e-1.5)]),.03,1&e?ce:q)}Z([97.5,t,125.35],lt([i,a,o],a,.6),[-.3,0,-.2],[.3,.05,.2],J,Y),Z([97.3,t,123.1],lt([i,a,o],a,-.4),[-.25,0,-.22],[.25,.1,.22],ot);for(let e of[-1,1]){let r=O+e*(n(99.6)-.25);B([[99,t,r],[100.2,t,r],[100.1,t+.7,r-.12*e],[99.1,t+.65,r-.12*e]],J,[99.6,t,O])}})()},mt=[[0,0],[.08,.3],[.3,.8],[.55,1],[.8,.75],[.95,.3],[1,0]],ht=e=>{let t=re.pieces.filter(e=>e.kind==`wingpiece`&&e.min[2]>O),n=O+x.r+T[1].fair[1][2];g.pieces.forEach(([r,a,o,,,s],c)=>{let l=e=>n+g.span*e+o,u=t.filter(e=>e.min[2]>l(r)-.01&&e.max[2]<l(a)+.01).sort((e,t)=>e.min[2]-t.min[2]),[d,f]=[u[0],u[u.length-1]],m=e=>(e.min[2]+e.max[2])/2,h=e=>d.max[1]+(f.max[1]-d.max[1])*(l(e)-m(d))/(m(f)-m(d)),v=Math.ceil(g.span*(a-r)/1.4),y=(t,n,i)=>{let o=Math.min(t,47.49),[c,u]=[_(g.trail,o),_(g.lead,o)];return[(d=[c+(u-c)*n+s*v*((t-r)/(a-r)-.5),h(t)-i*p(t),l(t)])[0],d[1],O+e*(d[2]-O)];var d},b=[r,...[...g.lead,...g.trail].map(e=>e[1]).filter(e=>e>r+.01&&e<a-.01).flatMap(e=>[e-.01,e+.01]),a].sort((e,t)=>e-t),x=b.flatMap((e,t)=>t&&e-b[t-1]>3.4?[(e+b[t-1])/2,e]:[e]),S=e=>.12+.88*N((Math.min(c?Math.abs(Math.abs(e[2]-O)+O-l(r)):9,c<2?Math.abs(Math.abs(e[2]-O)+O-l(a)):9)-.7*i(e[0]/1.3,e[2]/1.3,17))/.9);we(x.map(e=>mt.map(([t])=>y(e,t,0))),()=>k,S,e<0),we(x.map(e=>mt.map(([t,n])=>y(e,t,n))),()=>k,e=>.75*S(e),e>0);for(let[t,n]of[...c?[[r,-1]]:[],...c<2?[[a,1]]:[]]){let[r,i]=[0,1].map(e=>mt.map(([n,r])=>y(t,n,e*r))),a=y(t-3*n,.5,.5);V(r,i,()=>ce,a),$e(r,[0,.06,e*n*.3],L(a,[0,-9,0]));for(let e of[.3,.62])ve(y(t-.4*n,e,.5),y(t+.45*n,e+.01*n,.6),.14,A,.6*p(t))}})},[gt,_t]=[.85,.7].map(e=>E(u.STEEL+te,e,1,!0)),vt=E(u.WOOD,1.35,1,!0),yt=E(u.WOOD,1.1,.5,!0),bt=r(o([[0,.1],[.3,.1],[.36,0],[.52,0],[.6,.15],[.6,.85],[.52,1],[.36,1],[.3,.9],[0,.9]],12),[.05,.05,.055]),xt=Te(o([[0,0],[1.5,0],[2.1,2.5],[2.2,4],[2.7,6.5],[2.75,12.5],[2.45,17.5],[2.1,19],[1.75,19.1],[1.5,17.6],[0,17.4]],16),k,e=>Math.hypot(e[0],e[1])<1.7&&e[2]<-16?.05:(.12+.88*N((-e[2]-5-3*i(e[0],2*e[1]-e[2]/2,61))/5))*(.55+.45*N((e[1]+2.2)/1.6))),St={panel:({min:e,max:t},n,r)=>{let i=.55+.45*l(e[0],e[2],51),a=D(oe.c,i,C),o=t[0]-e[0]<1?0:t[2]-e[2]<1?2:-1;if(o>=0){H(e,t,a,j);let[n,i]=[e.slice(),t.slice()];n[1]=i[1]=t[1],n[o]=i[o]=(e[o]+t[o])/2,U(n,i,[0,.4,0],9,k,.3);for(let n of[.5,1.1,1.7]){let[i,a]=[e.slice(),t.slice()];i[1]=a[1]=t[1]-n,i[o]=a[o]=(r>0?e:t)[o]-.04*r,ve(i,a,.08,j)}return}H(e,t,A,a);let s=[0,1,3,2,0].map(n=>[1&n?t[0]:e[0],t[1],2&n?t[2]:e[2]]);s.slice(1).forEach((n,r)=>{let i=P(I(s[r],n),[(e[0]+t[0])/2,t[1],(e[2]+t[2])/2]);U(s[r],n,[.35*Math.sign(i[0]),-.12,.35*Math.sign(i[2])],4,k,.35)}),i>.75&&B(R.map(n=>[e[0]+(1&n?1.1:.7),t[1]+.02,2&n?t[2]:e[2]]),D(le),M,i)},container:({min:e,max:t})=>{H(e,t,gt);let n=t[0]-e[0]>t[2]-e[2]?0:2;for(let r=e[n]+.3;r<t[n]-.2;r+=.6){let[i,a]=[e.map(e=>e-.05),t.map(e=>e+.05)];[i[n],a[n],i[1],a[1]]=[r,r+.3,e[1],t[1]-.15],H(i,a,_t)}for(let r of[.35,.65]){let i=L(e,P(t,e),r);[i[n],i[1]]=[e[n]-.04,e[1]],ve(i,[i[0],t[1]-.1,i[2]],.08,j)}},crate:({min:e,max:t},n)=>{if(t[1]-e[1]>1.2){H(e,t,E(u.STEEL,.75));for(let n of[.33,.66]){let r=e[0]+(t[0]-e[0])*n;H([r-.02,e[1]+.1,e[2]-.01],[r+.02,t[1]-.1,t[2]+.01],ce)}}else{H(e,t,E(u.WOOD),n&&D(n,.75));for(let n of R){let[r,i]=[1&n?t[0]-.09:e[0]-.01,2&n?t[2]-.09:e[2]-.01];H([r,e[1],i],[r+.1,t[1]+.01,i+.1],vt,vt,55^1<<(1&n)^(2&n?32:16))}for(let n of[.25,.75]){let r=e[2]+(t[2]-e[2])*n;H([e[0]-.02,e[1],r-.1],[t[0]+.02,t[1]+.02,r+.1],j)}}},dais:({min:e,max:t},n=le)=>{H(e,t,A,D(n,.6)),B(R.map(n=>[1&n?t[0]-.5:e[0]+.5,t[1]+.02,2&n?t[2]-.5:e[2]+.5]),D(n,.95),M)},shelter:({min:e,max:t},n)=>{if(!n)return void H(e,t,yt);let[r,i]=[6,4],a=(n,a,o)=>[e[0]+(t[0]-e[0])*n/r,t[1]-o-.3*Math.sin(Math.PI*n/r)*Math.sin(Math.PI*a/i),e[2]+(t[2]-e[2])*a/i];for(let t=0;t<r;t++)for(let r=0;r<=i;r++)for(let o of[0,.03]){let[s,c]=[a(t,r,o),a(t+1,r,o)],l=D(n,1&t?.7:.8,ne);r<i&&B([s,c,a(t+1,r+1,o),a(t,r+1,o)],l,[e[0],o?99:-99,e[2]]),r%i<1&&B([s,c,L(c,M,1/99),L(s,M,1/99)],l,[e[0],e[1],o?99:-99])}},gear:({min:e,max:t},n)=>{if(n)return be(e,t,.4,D(n,.7),D(n,.55)),void be([e[0],t[1]-.9,e[2]],[t[0],t[1]-.6,t[2]],.4,j,void 0,.04);let r=(e[2]+t[2])/2;for(let n=0;n<3;n++)Se(bt,[e[0]+.7+1.5*n,t[1]-.6,t[2]],[0,0,-1],[1,1,t[2]-e[2]]);H([e[0]+.3,t[1]-.8,r-.2],[t[0]-.3,t[1]-.4,r+.2],A)},fallen:({max:e},t,n)=>{if(!t)return;let[r,i,,a,o]=b[0],s=F([1,0,n*o]),c=[r,e[1]-2.2,O+n*(i-O)];Se(xt,L(c,s,-a/2),s,[.84,.8,1]),Se(Xe,L(c,s,-a/2+.3),s.map(e=>-e),[1.15,1.15,1.15]);let l=[-1,3.5].map(e=>L(L(c,s,e),[0,2.1,0])),u=[.5*-s[2],1.1,.5*s[0]];V(l,l.map(e=>L(e,u)),()=>j,c),U(L(l[0],u),L(l[1],u),u,6,k,.16,c)},rail:({min:e,max:t})=>{H([e[0]+.14,e[1],e[2]],[t[0]-.14,t[1],t[2]],A);for(let n of[e[1],t[1]-.07])H([e[0],n,e[2]],[t[0],n+.07,t[2]],A,A,0)},engine:({min:e,max:t},n=le)=>{let r=(e[0]+t[0])/2,i=e=>((e,t,n,r)=>[...e,...e.map(([e,t])=>[-e,t]).reverse()].map(([e,i])=>[t+e,n+i,r]))([[2.5,-5],[2.5,-.4],[2.1,0]],r,t[1],e),a=[r,t[1]-2.5,(e[2]+t[2])/2],o=i(0).map((e,t)=>.45+.4*l(t,3,62));V(i(e[2]),i(t[2]),e=>e==2?D(n,.6):k,a,o);for(let[n,o]of[[e[2],-1],[t[2],1]]){B(i(n),ce,a);let e=(e,t,i)=>[r+e*Math.cos(t),a[1]+e*Math.sin(t),n+o*i],t=Math.PI/7;for(let n=0;n<14;n++){let r=n*t;B([e(.5,r,.2),e(2.25,r-.1,.22),e(2.25,r+.22,.05),e(.5,r+.3,.08)],D([.42,.43,.46]),a),B([e(0,0,.3),e(.55,r,.1),e(.55,r+t,.1)],j,a),B([e(2.3,r,.04),e(2.3,r+t,.04),e(2.48,r+t,.04),e(2.48,r,.04)],se,a)}}},pod:({min:e,max:t},n,r)=>{let i=d[r>0?0:1],a=e[1]+.5,o=I(e,t),[s,c]=[o[0],(r>0?e[2]:t[2])-.04*r];be(e,t,.42,k,D(oe.c,.8,C),0,[.5,1]),be(e,[t[0],a+.8,t[2]],.42,ce,void 0,.04),be([e[0],a+2,e[2]],[t[0],a+2.4,t[2]],.42,D(i,.8),void 0,.03),B(R.map(e=>[s+(1&e?.65:-.65),a+(2&e?1.95:0),c]),ce,o);for(let e of[-.7,.7])ve([s+e,a,c],[s+e,a+2,c],.1,j),B(R.map(t=>[s+3.03*Math.sign(e),a+(2&t?1.7:1.2),o[2]+(1&t?.3:-.3)]),de,o);ve([s-.7,a+2,c],[s+.7,a+2,c],.1,j),H([s+1,a-.1,c-2.6*r-.95],[s+2.3,a+.1,c-2.6*r+.95],k);let u=[s,a+.28,o[2]+7*r],f=e=>{let t=3+1.3*l(e%14,r,71);return[s+t*Math.cos(e*Math.PI/7),a+.03+.2*l(e%14,r,72),u[2]+t*Math.sin(e*Math.PI/7)]};for(let e=0;e<14;e++)B([u,f(e),f(e+1)],D(1&e?le:[.8,.8,.76],.9),M)},heap:({min:e,max:t},n=le,r=1,i=0)=>{let[a,o]=i?[0,2]:[2,0];H(e,t,j,i?j:D(n,.55));let s=Math.round((t[o]-e[o])/1.6);for(let n of i?[i]:[-1,1]){let r=(n<0?e:t)[a];for(let i=0;i<s;i++){let c=e=>l(i,7*r+e,41),u=(c,l,u)=>{let d=[0,l,0];return d[o]=e[o]+(t[o]-e[o])*(i+c)/s,d[a]=r+n*u,d},d=t[1]-.15-.5*c(3),f=.12+.12*c(4),p=[u(.05,e[1],f),u(.95,e[1],f),u(.95,d,.02),u(.05,d-.2*c(6),.02)],m=u(.5,d/2,-9);B(p,c(5)>.45?k:se,m,[.75,.75,1,1]),U(p[3],p[2],[0,.35,0],3,se,.9,m)}}},frame:({min:e,max:t},n,r)=>{H([e[0]+.2,e[1],e[2]],[t[0]-.2,t[1],t[2]],j),H([e[0],t[1]-.16,e[2]],t,A,A,0),H([e[0],t[1]-.8,e[2]],[t[0],t[1]-.64,t[2]],A,A,0);let i=(e[2]+t[2])/2;ve([e[0]+.14,t[1],i-.7*r],[e[0]+.14,t[1]+3.4,i+.6*r],.26,A)}};St.float=St.raft=St.panel,St.jam=(e,t,n)=>St.heap(e,t,n,x.sections.some(t=>t[1]==e.max[0])?1:-1);var Ct=[`pod`,`dais`,`crate`,`shelter`],wt=[`shelter`,`float`,`raft`,`engine`,`dais`,`fallen`,`rail`],Tt=t=>Object.values((t=>{let n=t.relief&&{relief:e(t.relief)};ge=(e,t)=>{let r=n?s(n,e,t):0;return r>-1e9?r:0};let i=e=>(Ce([]),e(),z),a=e=>()=>{for(let n of re.pieces){let r=Ct.includes(n.kind)&&Math.abs((n.min[2]+n.max[2])/2-O)>1;if(St[n.kind]&&r==e){let e=t.brushes.find(e=>e.min.every((t,r)=>t==n.min[r]&&e.max[r]==n.max[r]));St[n.kind](n,e?.tint,(n.min[2]+n.max[2])/2<O?-1:1),wt.includes(n.kind)||xe(n)}}};return{cabin:i(pt),hull:i(()=>{T.forEach((e,t)=>et(t)),T.forEach(({fair:e},t)=>{let n=qe(t);for(let[r,i,a]of e){let e=t>1&&i>Ae?je:i,o=Math.ceil((e-r)/2),s=Array.from({length:o+1},(t,n)=>r+n*(e-r)/o);for(let o of[-1,1]){let c=n=>{let r=K(t,n,0),s=n>i?(x.r+a-K(t,i,0))*(1-(n-i)/(e-i))+.05:x.r+a-r;return[[K(t,n,G)-.15,G],[r+s-.3,G],[r+s-.08,G-.08],[r+s,G-.3],[r+s-.06,G-.75],[r+.6*s,.2],[r+.25*s,-.8],[K(t,n,-1.7)-.15,-1.7]].map(([e,r])=>Fe(t,n,e,r,o))};we(s.map(c),()=>k,n,o>0);for(let[n,a]of[[r,-1],[i,1]])if(n==e||n==r){let e=c(n);B(e,j,[n-9*a,0,O+8*o]),$e(e.slice(0,6),[.5*a,0,0],[n,x.axis[t],O])}}}})}),ends:i(()=>{(()=>{let[e]=x.sections[0],t=x.axis[0],n=Le(0,e);n.slice(1).forEach((r,i)=>B([[e,t,O],n[i],r],j,[e+9,t,O],.8)),Se(Xe,[e+.2,t+1.6,O],[-1,0,0],[1.75,1.75,1.75]);for(let n of[-1,1]){let r=[10.5,t+.4,O+n*(K(0,15,.4)-.5)];Se(Te(o([[0,0],[1,.4],[1.5,3],[1.5,8],[.9,10],[0,10.3]],10),k,e=>.25+.75*N((-e[2]-2)/5)*N(1.6-n*e[0])),r,[1,0,0]);let i=[3,7.5].map(e=>[r[0]+e,r[1],r[2]+1.45*n]);V(i,i.map(e=>L(e,[0,.5,0])),()=>j,r),U(i[0],i[1],[0,.2,1.1*n],7,k,.16,r),U(L(i[0],[0,.5,0]),L(i[1],[0,.5,0]),[0,.1,.8*n],5,k,.2);let a=.45,s=r=>(n>0?Ze:Qe).map(([i,o])=>{let s=e+14-i,c=K(0,Math.max(s,e),5.3)-.3+o*Math.sin(a),l=r*(.35-.017*o);return[s,t+5.3+o*Math.cos(a)-l*Math.sin(a),O+n*(c+l*Math.cos(a))]}),[c,l]=[-1,1].map(e=>{let t=s(e);return B(t,k,s(-e)[3],t.map((e,t)=>n<0&&t>2?.2:t>2?.95:.8)),t});V([...c,c[0]],[...l,l[0]],()=>j,I(c[0],c[3])),Ye.forEach((e,r)=>Je.forEach(([i,a,o,s],c)=>{e>>c&1&&B(R.map(e=>{let[t,c]=[16.6+n*(1.5*(r-2)+1.05*(1&e?o:i)),2.5+1.05*(2&e?s:a)];return Fe(0,t,K(0,t,c)+.03,c,n)}),D([.05,.08,.16],1,C),[17,t,O])}))}})(),(()=>{let e=Le(2,Me),t=I(e[0],e[W-1]);e.slice(1).forEach((n,r)=>B([L(t,[.5,0,0]),e[r],n],j,[0,t[1],O])),Se(r(o([[0,0],[.22,0],[.08,2.4],[0,2.4]],6),[.2,.2,.22]),L(t,[.3,-.1,0]),[1,0,0])})()}),inside:i(()=>T.forEach((e,t)=>(e=>{let[t,n]=x.sections[e],r=x.axis[e],{cut:i,tears:a,holes:o}=T[e],s=Ve(e),[c,u]=[i[0][3]?i[0][1]:t,e>1?Ae:n],d=Re(e,t,u).filter(e=>e>=c);for(let t of[-1,1]){we(d.map(n=>s.map((r,i)=>Ue(e,n,i,t))),(t,n)=>Ge(e,d[t],d[t+1],s[n],s[n+1])?void 0:se,()=>1,t>0);for(let n=c+2.5;n<u;n+=5)s.slice(1).forEach((i,o)=>{if(!S.includes(i)&&!a.some(([e,t,r,a])=>n>e-.3&&n<t+.3&&s[o]>=r&&i<=a)){let[i,a]=[o,o+1].map(r=>[[-.08,0],[-.08,.2],[.08,.2],[.08,0]].map(([i,a])=>L(Ue(e,n,r,t),[i,0,-t*a])));V(i,a,()=>A,[n,r,O+20*t])}})}c>t&&B([1,-1].flatMap(t=>(t>0?s:[...s].reverse()).map(n=>Ue(e,c,s.indexOf(n),t))),se,[c-9,r,O]);for(let{kind:i,min:a,max:o}of re.pieces){if(i!=`deck`||a[0]<t||o[0]>n)continue;let s=o[1]>r+6.9,[c,l]=[a.slice(),o.slice()];s&&e>1&&(l[0]=Math.min(l[0],Ae));let u=Math.min(...[c[0],(c[0]+l[0])/2,l[0]].map(t=>K(e,t,Math.min(o[1]-r,6.4))))-.3;[c[2],l[2]]=[Math.max(c[2],O-u),Math.min(l[2],O+u)],l[0]>c[0]&&l[2]>c[2]&&H(c,l,s?se:A,tt,s?8:a[1]<r-6.9?52:0)}for(let[t,n,i,a]of o){let o=r+S[t],s=Math.min(a,(t>1?2.5:w(S[t]))*Pe(e,(n+i)/2)[0]-x.skin),c=t>1?k:se,l=t>1?.14:.5;for(let[e,t]of[[n,.4],[i,-.4]])U([e,o,O-s],[e,o,O+s],[t,-.3,0],6,c,l);if(a<9)for(let e of[-1,1])U([n,o,O+e*s],[i,o,O+e*s],[0,-.3,.4*-e],6,c,l)}[...S.slice(0,2),6.8].forEach((t,n)=>{let i=r+t-.33;for(let t=c+2;t<u;t+=5){let r=O+(n>1?2.1:3.9)*Pe(e,t)[0]*(l(t,n,43)<.5?-1:1),a=[t+1.6,i+.03,O+4*(l(t,n,41)-.5)],s=(e,t,r)=>o.some(([i,a,o,s])=>i==n&&e>a-r&&e<o+r&&Math.abs(t-O)<s+.3);s(t,r,.8)||s(a[0],a[2],.3)||(B(rt(t-.5,t+.5,i,r-.07,r+.07),me,nt),ve(a,L(a,[.2,-.3-.8*l(t,n,42),.25]),.05,ce))}})})(t))),wings:i(()=>[1,-1].forEach(ht)),debris:i(a(!1)),camps:i(a(!0))}})(t)).flat(),[Et,Dt,Q,Ot]=[ie.trees+5,70,14,80],[kt,At]=[Et-Q-Ot,f/4*Q],jt=2*(kt+At)+250+2*(Dt-Q),Mt=x.sections[2][1]+3-Et,$=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),Nt=(e,t,n=1.15)=>{let[r,a]=[(e-x.sections[2][1]+2)/32,(t-125)/26],o=r*r+a*a;return o<3?$(2.2*(n-Math.sqrt(o)-.3*i(e/7,t/7,6)))*$((e-ie.trees+6)/10):0},[Pt,Ft]=[[.2,.13,.06],[.05,.045,.04]],It=e=>{for(let t=0;t<e.length;t+=10){let n=Nt(e[t],e[t+2],1.3);if(n>0){let[r,i,a]=[Math.min(2*n,1),1-Math.max(2*n-1.2,0),4*e[t+7]];for(let n=0;n<3;n++){let o=t+(n<2?6+n:9);e[o]=(e[o]+(Pt[n]*a-e[o])*r)*i}}}},Lt=e=>{if(e>jt/2){let[t,n,r,i]=Lt(jt-e);return[t,250-n,r,-i]}let[t,n]=[(e-kt)/Q,Q-Dt];return e<kt?[Ot+e,-Dt,0,-1]:e<kt+At?[Et-Q+Q*Math.sin(t),n-Q*Math.cos(t),Math.sin(t),-Math.cos(t)]:[Et,n+e-kt-At,1,0]},Rt=(e,t)=>{let[n,r,i,a]=Lt(e),o=t+Mt*i*$((22-Math.abs(r-125))/10);return[n+i*o,r+a*o,$((n-Ot)/30)]},zt=[[1,0,0],[0,0,1],[0,1,0]],Bt=[3,4,5].map(e=>r(o([[.9,0],[1.1,1]],e),[1,1,1])),Vt=[o([[0,-1],[1,0],[0,1]],4),o([[0,-1],[.85,-.45],[.9,.35],[0,1]],5)].map(e=>r(e,[1,1,1])),Ht=[.4,.33,.24],Ut=[.3,.2,.08],Wt=[[.16,.34,.07],[.1,.26,.06],[.22,.29,.08]],Gt=[[.05,.15,.04],[.08,.2,.05],[.04,.12,.05],[.11,.21,.04]],Kt=(e,t,n,r,i,a,o,[s,c,l])=>{let[u,d]=[Math.cos(n),Math.sin(n)],[f,p,m]=t;for(let t=0;t<o;t++){let n=(t+.5)/o,h=Math.max(r-2.1*n,-1.45),[g,_]=[Math.cos(h)*i/o,Math.sin(h)*i/o],[v,y,b]=[f+u*g,p+_,m+d*g],x=a*(.3+2.8*n*(1-n));for(let t of[-x,x]){let n=(f+v)/2+.4*u*g-d*t,r=(p+y)/2+.4*_-.45*x,i=(m+b)/2+.4*d*g+u*t,a=_*(i-m)-d*g*(r-p),o=d*g*(n-f)-u*g*(i-m),h=u*g*(r-p)-_*(n-f),S=(o<0?-1:1)/(Math.hypot(a,o,h)||1);[a,o,h]=[a*S,o*S+.6,h*S];let C=1/Math.hypot(a,o,h);e.push(f,p,m,a*C,o*C,h*C,.6*s,.6*c,-1,.6*l),e.push(v,y,b,a*C,o*C,h*C,.6*s,.6*c,-1,.6*l),e.push(n,r,i,a*C,o*C,h*C,s,c,-1,l)}[f,p,m]=[v,y,b]}},qt=(e,t,r,i,a,o,s,u,d)=>{let p=e=>l(o,e,77),m=8+5*p(1)+(2-s),h=[2,4,8][s],g=e=>[t+u*e*e,r+m*e,i+d*e*e];for(let t=0;t<h;t++){let n=t/h,r=a*(.62+.38*(1-n)*(1-n)),i=t%2?.8:1;c(e,Bt[s],g(n),g(n+1/h),[1,0,0],1,r,Ht.map(e=>e*i))}let _=g(1),v=[6,9,11][s];for(let t=0;t<v;t++)Kt(e,_,f*(t+.6*p(10+t))/v,[1.15,.55,-.05][t%3]+.3*p(30+t),3.8+p(50+t)+.3*(2-s),.8+.15*(2-s),[3,4,6][s],Wt[t%3]);for(let t=0;s>1&&t<3;t++){let r=f*(t/3+p(70));n(e,Vt[0],[_[0]+.24*Math.cos(r),_[1]-.3,_[2]+.24*Math.sin(r)],zt,[0,0,0],.17,Ut)}},Jt=(e,t,r,i,a,o)=>{let s=e=>l(a,e,78),u=8+7*s(1),d=[t+2*s(2)-1,r+.7*u,i+2*s(3)-1];c(e,Bt[+!o],[t,r,i],d,[1,0,0],1,.3+.2*s(4),Ht);for(let t=0;t<4;t++){let[r,i]=[f*(t/3+s(5)),.2*u+1.4*s(6+t)],a=t<3?.8*i:0;n(e,Vt[+!o],[d[0]+a*Math.cos(r),d[1]+(t<3?s(10+t):.5*i),d[2]+a*Math.sin(r)],zt,[0,0,0],[i,i,.7*i],Gt[Math.floor(4*s(14+t))])}},Yt=(e,t,n,r,i)=>{let a=e=>l(i,e,81),o=(r<125?-1:1)*(.3+1.1*a(1)),[s,u,d]=[Math.cos(o),Math.sin(o),t(n,r)],[p,m,h]=[.5+6*a(2)*a(2),.2+.14*a(3),4+5*a(4)],g=Ft.map(e=>e*(.6+.9*a(5))),_=[n+.25*p*s,d+p,r+.25*p*u];c(e,Bt[1],[n,d-m,r],_,[1,0,0],1,m,g);for(let t=0;t<2;t++)Kt(e,_,f*a(6+t),2.5,.5+.6*a(8+t),.5*m,1,g);let v=[n+h*s,t(n+h*s,r+h*u)+m,r+h*u],y=a(10)<.7;y&&c(e,Bt[1],p<2.5?_:[n,d+m,r],v,[0,1,0],1,.8*m,g);for(let t=0;t<2&&(y||p>3.5);t++)Kt(e,y?v:_,o+5*a(11+t),y?.5:-.2,2+a(13+t),.5,3,Pt)},Xt=(e,t,n,r,i,a)=>{let o=e=>l(i,e,79),s=6-a;for(let i=0;i<s;i++)Kt(e,[t,n+.1+.3*a,r],f*(i+o(i))/s,1+.3*a+.3*o(10+i),(1+.5*o(20+i))*(1+1.4*a),.3+.7*a,2,Wt[(i+a)%2])},Zt=(e,t,[n,r,o,s,c,u=0],d)=>{let{reach:f}=h(c,o,s),p=t(n,r)+u,m=p+a(s),g=e.length;ae(e,d,e=>{let t=f(e);return[n+e[0]*t,m+e[1]*t,r+e[2]*t]},p,p+s,c,.72+.14*l(c,5,41),u?void 0:t);for(let t=g;t<e.length;t+=10){let n=ie.water+.4+1.2*i(.4*e[t],.4*e[t+2],9);e[t+9]*=.4+.6*$((e[t+1]-n)/1.5)}Qt(e,g)},Qt=(e,t)=>{for(let n=t;n<e.length;n+=30){let[t,r,i]=[n,n+10,n+20],[a,o,s]=[e[r]-e[t],e[r+1]-e[t+1],e[r+2]-e[t+2]],[c,l,u]=[e[i]-e[t],e[i+1]-e[t+1],e[i+2]-e[t+2]],[d,f,p]=[o*u-s*l,s*c-a*u,a*l-o*c],m=Math.hypot(d,f,p)||1;for(let n of[t,r,i]){let[t,r,i]=[.75*e[n+3]+.25*d/m,.75*e[n+4]+.25*f/m,.75*e[n+5]+.25*p/m],a=Math.hypot(t,r,i)||1;[e[n+3],e[n+4],e[n+5]]=[t/a,r/a,i/a]}}},$t=(e,t,n)=>{let r=[],i=(e,n)=>l(e,n,90+t),a=e=>100+e+50*t;m.forEach(e=>Zt(r,n,e,4));for(let t=0;t<7;t++)Zt(r,e,[34+8*t+5*i(t,1),266+26*i(t,2),2.5+2.5*i(t,3),1.8+2.4*i(t,4),a(t)],3);for(let t=0;t<6;t++){let[n,o]=[94+7*t+4*i(t,5),264+t%3*9+6*i(t,6)],[s,c]=[7+3*i(t,7),7+5*i(t,8)+2*t];Zt(r,e,[n,o,s,c,a(10+t)],4);let l=[n+1.5*i(t,9)-.75,o+1.5*i(t,10)-.75,.6*s,.55*c];Zt(r,e,[...l,a(20+t),.8*c],3),i(t,11)<.5&&Zt(r,e,[l[0]+.5,l[1]-.4,.35*s,.4*c,a(30+t),1.3*c],2)}for(let t=0;t<5;t++)Zt(r,e,[12-9*t+4*i(t,12),264+9*t+6*i(t,13),2.5+2*i(t,14),4+5*i(t,15),a(40+t)],3);for(let n=0;n<8;n++){let a=n/7;Zt(r,e,[ie.sea-12-62*a+6*i(n,13),286-14*a*a+8*i(n,14),7-4.5*a,6-4*a,140+n+50*t],2)}return r},en=e=>4.5*$(e/2)+5*$((e-1.5)/5)+8*$((e-6)/12)+.14*Math.max(e-18,0),tn=[0,.8,1.7,3,4.5,6.5,9,12,16,21,28,37,49,65,88,120];function*nn(t){let r=(t=>Object.values((t=>{let r=t.relief&&{relief:e(t.relief)},a=(e,t)=>{let n=r?s(r,e,t):0;return n>-1e9?n:0},o=$t(a,0,a).concat((e=>{let t=e.slice();for(let n=0;n<e.length;n+=30)for(let r=0;r<3;r++){let[i,a]=[n+10*r,n+(3-r)%3*10];for(let n=0;n<10;n++)t[i+n]=e[a+n];t[i+2]=250-t[i+2],t[i+5]=-t[i+5]}return t})($t((e,t)=>a(e,250-t),1,a))),c=[];y.forEach(([e,t,n],r)=>{for(let i of[0,1]){let[o,s]=[2*r+i,i?250-t:t],u=1.2+2.6*l(o,1,70);qt(c,e,a(e,s),s,n,o,2,-u,u*(2*l(o,2,70)-1))}});let u=[],d=[];[2,6,11,17,24].forEach((e,t)=>{let n=t<2?7.5:7;for(let r=0;r*n<jt;r++){let i=e=>l(r,e,80+t),o=(r+i(1))*n,s=e+3*i(2),[c,f,p]=Rt(o,s);if(i(3)>.85*p)continue;let m=Nt(c,f);if(m>.3){Yt(d,a,c,f,1e3+100*t+r);continue}let h=a(c,f)+Math.max(p*(1-$(2.5*m))*en(s)-5,0),[,,g,_]=Lt(o),v=1e3+100*t+r;if(i(4)>.25+.15*t){let e=1+2.5*i(5),[n,r]=[-g*e+2*i(6)-1,-_*e+2*i(7)-1];qt(u,c,h,f,.28,v,+(t<2),n,r)}else Jt(u,c,h,f,v,t>1)}});for(let e=0;e<18;e++){let t=t=>l(e,t,88),n=x.r+2+14*t(2);Yt(d,a,Et+1+16*t(1),125+(1&e?n:-n),e)}let f=[];for(let e=0;4*e<jt;e++){let t=t=>l(e,t,86),[n,r,i]=Rt(4*(e+t(1)),-.5-3*t(2)*t(2));t(3)<i&&Nt(n,r)<.3&&Xt(f,n,a(n,r),r,e,0)}for(let e=0;2.4*e<jt;e++){let t=t=>l(e,t,87),[r,i,o]=Rt(2.4*(e+t(1)),.8-2.3*t(2)),s=1+.8*t(4);t(3)>o||Nt(r,i)>.3||(t(5)<.6?Xt(f,r,a(r,i),i,500+e,1):n(f,Vt[1],[r,a(r,i)+.6*s,i],zt,[0,0,0],[s,s,.8*s],Gt[e%4]))}let p=[];return((e,t,n)=>{let r=Math.ceil(jt/2.5),a=tn.length,o=new Float64Array((r+1)*a*4);for(let e=0;e<=r;e++){let s=e/r*jt,[c,u]=Rt(s,0),d=n(c,u);for(let r=0;r<a;r++){let c=tn[r],[u,f,p]=Rt(s,c),m=i(u/6,f/6,3)+.5*i(u/2.3,f/2.3,4)-.75,h=4*(e*a+r);o[h]=u+(l(e,r,61)-.5)*Math.min(c,3),o[h+2]=f+(l(e,r,62)-.5)*Math.min(c,3);let g=$(2.5*Nt(u,f));o[h+1]=d+(n(u,f)-d)*g-.4+p*(1-g)*(en(c)+40*$((c-25)/95)*(.4+.6*i(u/70,f/70,5))+(m*Math.min(.5+.13*c,4)+(l(e,r,63)-.5)*(1.4+.05*c))*$(c/1.5)*(1-.8*$((c-50)/50))),o[h+3]=(.4*(m/1.5+.5)+.6*l(e,r,64))*(1-.5*$((c-20)/50));for(let n=0;p>.3&&g<.9&&r&&r<6&&n<2;n++){let i=t=>l(2*e+n,r,65+t),[,,a,c]=Lt(s);Kt(t,[o[h],o[h+1]-.3,o[h+2]],Math.atan2(-c,-a)+3*i(0)-1.5,.3+.8*i(1),1.3+1.3*i(2),.9,1,(n?Wt:Gt)[Math.floor(3*i(3))])}}}let s=(e,t)=>4*(e*a+t);for(let t=0;t<r;t++)for(let n=0;n<a-1;n++){let r=t+n&1,i=[s(t,n),s(t+1,n),s(t+1,n+1),s(t,n+1)];for(let t of[0,1]){let[n,a,s]=[i[r],i[r+1+t],i[(r+2+t)%4]],[c,l,u]=[o[a]-o[n],o[a+1]-o[n+1],o[a+2]-o[n+2]],[d,f,p]=[o[s]-o[n],o[s+1]-o[n+1],o[s+2]-o[n+2]],[m,h,g]=[l*p-u*f,u*d-c*p,c*f-l*d],_=(h<0?-1:1)/(Math.hypot(m,h,g)||1),v=(o[n+3]+o[a+3]+o[s+3])/3;for(let t of[n,a,s])e.push(o[t],o[t+1],o[t+2],m*_,h*_,g*_),e.push(.02+.06*v,.06+.13*v,-1,.02+.03*v)}}})(p,f,a),[c,u,f,p].forEach(It),{rocks:o,palms:c,forest:u,brush:f,canopy:p,snags:d}})(t)).flat())(t);return yield,{land:r.concat(Tt(t)),sky:[],glass:ft(),rock:`{vec3 gn=normalize(N);float gp=max(length(dFdx(P)),length(dFdy(P)));
2
2
  float g1=vn3(P*.13),g2=vn3(P*.5+3.),gu=0.;
3
3
  vec3 gb=vec3(.6,.585,.56)*(.62+.52*g1+.2*g2)*mix(vec3(.97,.99,1.03),vec3(1.05,1.,.93),g2),gc=gb;
4
4
  float f0=1.-smoothstep(.15,.6,gp*17.),gf=1.-smoothstep(.15,.6,gp*5.),gd=smoothstep(.2,.8,g2);
@@ -1,4 +1,4 @@
1
- import{Bt as e,G as t,Q as n,Qt as r,V as i,Xt as a,Y as o,Yt as s,Zt as c,nr as l,q as u,ur as d}from"./brick-9u0Ivbak.js";var f=125,[p,m]=l,{METAL:h,STEEL:g,PAINT:_,WOOD:v,STONE:y,GRATE:b}=d,x=[1,.42,.08],S={sea:0,shore:30,trees:90,east:110,cape:-6,water:0},C={east:S.trees+5,cape:S.cape-4},w={r:7,sunk:2,sections:[[6,36],[44,74],[82,106]],axis:[4,6.25,7.5],spine:2.5,skin:.85},T=e=>{let t=Math.max(1-e*e/(w.r*w.r),0);return Math.max(w.r*Math.sqrt(Math.sqrt(t*Math.sqrt(t))),e>0?w.spine:0)},E=[-4,-2.05,-1.75,0,1.95,2.25,3.6,5,5.5,6,6.5,7],D=[-1.75,2.25,w.r],O=(E.map(e=>[e,T(e)]),[{cut:[[6,7,.7,9],[7,13,.76],[13,20,.9],[20,36,1]],floor:-4.75,holes:[[0,14,20,3],[1,24,29,9],[2,13,18.5,2.3]],tears:[[21,30,-1.75,1.95],[31,36,2.25,5]],fair:[[30,36,3]],crates:[[18.3,-1],[24.2,0],[16.8,1]]},{cut:[[44,74,1]],floor:-5,holes:[[0,51.5,56,3.2],[0,67,70.5,9],[1,44,48,9],[1,60.5,65.5,3],[2,44,47,9],[2,53,58,2.2]],tears:[[57.5,60.5,-4,-2.05],[47.5,55,-1.75,1.95],[64,71,2.25,5]],fair:[[44,47.5,3.2],[55,71,4.4],[71,74,3]],crates:[[54.3,-1],[60.7,0],[56.3,1]]},{cut:[[82,90,1],[90,97,.85]],floor:-5,holes:[[0,86.5,90,3],[1,82,85,9],[2,87.5,91.5,2]],tears:[[84.5,91,-1.75,1.95]],fair:[[82,84.5,2.7],[91,95,1.5]],crates:[[88.3,-1],[83.3,0],[87.7,1]]}]),k={floor:w.axis[1]+O[1].floor,ceil:w.axis[1]+E[1],half:4.525,x:w.sections[1],door:O[1].tears[0],lintel:E[1]-O[1].floor,walls:[],way:2.4},A={root:[45,71],lead:[[71,0],[69,8],[64,18],[61.5,26],[60,26],[59,38],[60.5,38],[59,42],[57.5,46.5],[54,47.5]],trail:[[45,0],[46.5,10],[50,30],[52.5,44],[54,47.5]],span:.78,pieces:[[0,14,0,8.5,6.4,0],[16,30,2,6.8,3.6,.17],[32,47.5,4,3.3,1.6,-.2]],rails:[53.5,58]},j=[[38.5,150.3,2.7,19,.78],[4.5,137,2.5,9]],M=[60,219,4],N=1.25,ee=[[38,237,3.5,2.6,1],[57,242,3,2.2,2],[47,251,4,3,3],[66,254,4.5,3.6,4],[78,241,4,3.4,5],[33,256,2.8,1.8,6],[87,250,5.5,5,7],[97,243,6,6.5,8],[100,256,7.5,9,9],[89,262,7,7,10]],te=(t,n,r)=>{let i=e=>a(t,e,151),o=2*i(1)-1,[s,l]=[(1-o*o)/(1+o*o),2*o/(1+o*o)],u=r-e(r),[d,f]=[n*(.85+.3*i(2)),n*(.6+.3*i(3))],p=e(r)+.7*r,m=[4,8].map(e=>{let[t,n,r]=[2*i(e)-1,.35*i(e+1),2*i(e+2)-1],a=Math.sqrt(t*t+n*n+r*r);return[t/a,n/a,r/a,.7+.2*i(e+3)]}),h=e=>{let t=(e[0]*s+e[2]*l)/d,n=(e[2]*s-e[0]*l)/f,r=e[1]/u,[i,a,o]=[t*t*t*t,r*r*r*r,n*n*n*n];return .25/Math.sqrt(Math.sqrt(i+a+o))+.75/Math.sqrt(Math.sqrt(Math.sqrt(i*i+a*a+o*o)))},g=e=>{if(e[1]<0){let t=Math.sqrt(e[0]*e[0]+e[2]*e[2]);return t<1e-6?p:Math.min(g([e[0]/t,0,e[2]/t])/t,p/-e[1])}let n=h(e);for(let[t,r,i,a]of m){let o=e[0]*t+e[1]*r+e[2]*i;if(o>.001){let e=a*h([t,r,i])/o,s=Math.max(.2-Math.abs(n-e),0)/.2;n=Math.min(n,e)-.05*s*s}}return n*(.95+.08*c(1.3*e[0]+t,1.3*e[2]+1.1*e[1],t+3))};return{reach:g}},ne=Array.from({length:28},(e,t)=>[S.trees+3*a(t,1,7),134+4*t+2*a(t,2,7),.22+.1*a(t,3,7)]),P=e=>Math.min(Math.max(e,0),1),F=e=>P(e)*P(e)*(3-2*P(e)),re=(e,t)=>Math.sqrt(e*e+t*t),ie=[[57,132,61,138,k.floor-.95],[56,171,66,175,1.3],[44,209,76,229,N]],ae=[1.5,1.2],oe=(e,t)=>{let n=Math.abs(t-f),{shore:r,trees:i}=S,a=e>r?2.5*(e-r)/(i-r):(e-r)/10;a+=.9*F((e-46)/24)*(c(e/13,n/13,5)-.45)*F((n-14)/10),a+=F((e-r)/14)*(1-F((e-102)/8))*(ae[1]*P(1-Math.abs(n-12)/5)-ae[0]*(1-F((n-2)/7))),a+=1.8*P(1-re(e-110,n)/9);for(let[t,r,i,o,s]of ie){let c=re(Math.max(t-e,e-i,0),Math.max(r-f-n,f+n-o,0));a=s+(a-s)*F((c-6)/6)}return a},I=(e,t)=>{let[n,r]=[Math.floor(e/4),Math.floor((t-1)/4)],[i,a]=[e/4-n,(t-1)/4-r],o=(e,t)=>Math.fround(oe(4*(n+e),1+4*(r+t))),[s,c]=[o(0,0),o(1,1)];return i>=a?s+(o(1,0)-s)*i+(c-o(1,0))*a:s+(o(0,1)-s)*a+(c-o(0,1))*i},L=(e,t,n,r,i,a,o,s)=>({min:[e,t,n],max:[r,i,a],top:o,side:o,...s?{tint:s}:{}}),R=e=>({...e,ghost:!0}),se=e=>({...e,min:[e.min[0],e.min[1],250-e.max[2]],max:[e.max[0],e.max[1],250-e.min[2]],...e.tint?{tint:e.tint===p?m:e.tint}:{}}),ce=([e,t,n])=>[e,t,250-n],z=(e,...t)=>[...e,...e.map(ce),...t],B=[],V=[],H=(e,t,n)=>(e.push({kind:t,min:n.min,max:n.max}),R(n)),U=(e,t,n,r)=>{let i=[0,.25,.5,.75,1].flatMap(i=>[0,.25,.5,.75,1].map(a=>I(e+(n-e)*i,t+(r-t)*a)));return[Math.max(...i),Math.min(...i)]},W=(e,t,n,r,i,a,o,s)=>{let[c,l]=U(t,n,r,i);return H(B,e,L(t,l-.5,n,r,Math.round(32*(c+a))/32,i,o,s))},G=e=>[(e.min[0]+e.max[0])/2,e.max[1],(e.min[2]+e.max[2])/2],K=(e,t,n,r,i,a,o,s=0)=>{let c=[],l=t,u=(o,s,l)=>{let[u,d]=[Math.max(o,t),Math.min(s,n)];if(d>u&&l<a)for(let[t,n]of l>0?[[-a,-l],[l,a]]:[[-a,a]])c.push(H(V,e,L(u,r,f+t,d,i,f+n,e==`deck`?b:h)))};for(let[e,t,r]of[...o,[n,n,0]])u(l,e,s),u(e,t,r),l=Math.max(l,t);return c},le=w.axis.map(e=>e+w.r),ue=w.sections.slice(1).map(([e],t)=>{let n=w.sections[t][1],[r,i]=U(n,123.5,e,126.5),a=Math.round(32*(Math.max(r,S.water)+1.875))/32;return{x:(n+e)/2,top:a,heap:L(n,i-.5,123.5,e,a,126.5,g,x)}}),de=w.sections.flatMap(([e,t],n)=>[n&&[e,e+1],n<2&&[t-1,t]].filter(e=>e).map(e=>{let[t,r]=e,i=w.axis[n],a=Math.round(16*T(O[n].floor))/16-w.skin;return L(t,i+O[n].floor,f-a,r,i+E[1],f+a,h)})),fe=[36,74].flatMap(e=>{let[t,n]=U(e,128,e+1.2,130.5),r=L(e,n-.5,128,e+1.2,Math.round(32*(t+1.4))/32,130.5,g);return[r,se(r)]}),pe=L(.5,-.3,121,5,.4,129,h),me=[...O.flatMap(({cut:e,floor:t,holes:n,tears:r,fair:i,crates:a},o)=>{let s=w.axis[o],c=[t,...E.filter(e=>e>t+.5)];return[...e.flatMap(([e,a,o,l=w.skin])=>{let u=e=>Math.round(16*o*T(e))/16;return[...K(`deck`,e,a,s-w.r,s+t,u(t),[]),...c.slice(1).flatMap((d,f)=>{let p=c[f],m=D.indexOf(d),h=d<w.r?u(m<0?(p+d)/2:d):o*w.spine,g=p<D[0]?t:p<D[1]?D[0]:D[1];return[...m<0?K(`skin`,e,a,s+p,s+d,h,r.filter(e=>e[2]<=p&&e[3]>=d).map(([e,t])=>[e,t,99]),Math.min(u(d),u(g))-l):K(`deck`,e,a,s+p,s+d,h,n.filter(e=>e[0]==m).map(([,e,t,n])=>[e,t,Math.min(n,h-l)])),...p>=0&&d<=D[1]?i.flatMap(([t,n,r])=>K(`fairing`,Math.max(t,e),Math.min(n,a),s+p,s+d,w.r+r,[],h)):[]]})]}),...a.map(([e,n])=>{let r=s+(D[n]??t);return H(V,`crate`,L(e,r,124.25,e+1.5,r+[1,1.4,2][n+1],125.75,v))})]}),...ue.map(e=>H(V,`heap`,e.heap)),...fe.map(e=>H(V,`frame`,e)),...de.map(e=>H(V,`jam`,e)),H(V,`raft`,pe),R(L(C.east,-10,C.cape-2,C.east+2,40,250-C.cape+2,y))],he=e=>.6-.45*e/47.5,ge=(e,t)=>{let n=e.findIndex(e=>e[1]>t),[r,i]=[e[n-1],e[n]];return r[0]+(i[0]-r[0])*(t-r[1])/(i[1]-r[1])},_e=Array.from({length:6},(e,t)=>{let[n,r,i,,a]=j[0],o=n-7.5+2.5*t,s=r+a*(o+1.25-n);return W(`fallen`,o,s-i-.2,o+2.5,s+i+.2,3.5,h,t?void 0:x)}),ve=[...[G(_e[3]),[j[1][0]-1.5,1.3,j[1][1]+3.5]].flatMap(([e,t,n])=>[[e,t,n,42,1.3,7],[e,t,250-n,42,1.3,7]]),...w.sections.flatMap(([e,t],n)=>[n&&e-.6,n<2&&t+.6].filter(e=>e).map(e=>[+e,w.axis[n]+4.2,125,28,.9,4]))],ye=[.55,2.3],be=(()=>{let[e,t,n,r]=j[1];return H(B,`engine`,L(e-n,-5,t-r/2,e+n,1.4,t+r/2,h,x))})(),q=[H(B,`float`,L(16,-1.6,141,22,.35,144,h)),H(B,`float`,L(10,-.2,138,13,.5,141,h)),H(B,`float`,L(23,-1.6,132.6,26,.2,135,h))],xe=H(B,`pod`,L(M[0]-3,.75,M[1]-3,M[0]+3,4.25,M[1]+3,h)),Se=H(B,`dais`,L(M[0]-2,.75,M[1]-10,M[0]+2,1.3,M[1]-6,_,p)),J=(e,t,n=.4,r)=>W(`crate`,e-1.5,t-1.5,e+1.5,t+1.5,n,v,r),Ce=(e,t)=>[L(e-2.6,4.85,t-2.1,e+2.6,5,t+2.1,_,p),...[-1,1].flatMap(n=>[-1,1].map(r=>L(e+2.5*n-.1,.75,t+2*r-.1,e+2.5*n+.1,4.85,t+2*r+.1,g)))].map(e=>H(B,`shelter`,e)),[we,Te]=[J(49,221),J(71,221)],[Ee,De]=[J(84,185,.4,p),J(33,153,.4,p)],Oe=W(`panel`,67,184.5,70.5,188,.65,h),ke=W(`container`,68.5,176,71.1,182,1.875,h,x),Ae=W(`gear`,68.6,170.6,71,173,2.9,g,[.95,.75,.1]),je=W(`container`,64,164.5,67.5,168,2.6,h,x),Me=W(`gear`,67.6,169.6,72,170.6,1.2,g),Y={camp:[J(76,213),J(40,217)],west:[W(`panel`,44.5,191.5,47.5,194.5,.5,h),W(`container`,33,173.7,39,176.3,2.2,h,x),W(`panel`,41,163.5,44,166.5,.4,h),W(`panel`,25.5,159.5,28.5,162.5,.5,h),W(`panel`,50.5,139.5,53.5,142.5,.4,h),W(`container`,49.5,132.4,52.5,135,2.6,h,x)],east:[W(`panel`,62.5,145.5,65.5,148.5,.4,h),J(80,171),J(85.5,165),J(84,153),W(`panel`,84.5,135.5,87.5,138.5,.4,h)],cover:[W(`panel`,78,156.6,83,157,2.6,h),W(`panel`,30,166.6,35,167,2.2,h),W(`container`,76,190,82,192.6,2.6,h,x)]},Ne=(t,n,r,i,a,o)=>{let{reach:s}=te(a,r,i),c=U(t-.8*r,n-.8*r,t+.8*r,n+.8*r),l=I(t,n)+e(i),u=l+s([0,1,0])-.1,d=(e,t,n)=>{let r=Math.sqrt(e*e+t*t+n*n)||1;return r<=s([e/r,t/r,n/r])},f=(e,t)=>{if(!d(e,t,0))return;let n=n=>{let[i,a]=[0,1.6*r];for(let r=0;r<9;r++){let r=(i+a)/2;d(e,t,n*r)?i=r:a=r}return n*i};return[n(-1),n(1)]},p=[],[m,h]=[r<5?1:r<8?2:3,i<5?1:i<12?2:3];for(let e=c[1]-.5;e<u-.3;e+=h){let i=Math.min(e+h,u);for(let a=-1.5*r;a<1.5*r;a+=m){let r=[.1,.5,.9].flatMap(t=>[Math.max(e,c[1])+.05,i].map(e=>f(a+m*t,e-l)));if(r.every(e=>e)){let s=n+Math.max(...r.map(e=>e[0])),c=Math.min(n+Math.min(...r.map(e=>e[1])),o);c-s>.4&&p.push([t+a,e,s,t+a+m,i,c])}}}return p},X=ee.map(([e,t,n,r,i])=>({at:[e,I(e,t),t],R:n,H:r,s:i,parts:Ne(e,t,n,r,i,250-C.cape)})),Pe=[...A.pieces.flatMap(([e,t,n,r,i,a],o)=>{let s=(e,t=n)=>f+w.r+O[1].fair[1][2]+A.span*e+t,c=Math.ceil((s(t)-s(e))/1.4),l=Math.max(c,Math.ceil((r-i)/.15-1e-9)+1),u=A.pieces[o-1];return[...Array.from({length:l},(n,o)=>{let u=e+(t-e)*(o+.5)/l,d=a*c*((o+.5)/l-.5),[f,p]=[A.trail,A.lead].map(e=>Math.round(8*(ge(e,u)+d))/8),[m,g]=[o,o+1].map(n=>s(e+(t-e)*n/l)),_=r+(i-r)*o/(l-1);return H(B,`wingpiece`,L(f,_-he(u),m,p,_,g,h))}),...u?A.rails.map(t=>{let n=Math.min(u[4],r);return H(B,`rail`,L(t-.225,n-.45,s(u[1],u[2]),t+.225,n,s(e),g))}):[]]}),..._e,be,...q,xe,Se,we,Te,...Ce(49,221),...Ce(71,221),Ee,De,Oe,ke,Ae,Me,je,...Object.values(Y).flat(),...ne.map(([e,t,n])=>{let r=I(e,t);return R(L(e-n,r-1,t-n,e+n,r+9,t+n,v))}),...X.flatMap(e=>e.parts).map(([e,t,n,r,i,a])=>R(L(e,t,n,r,i,a,y))),R(L(-60,-10,250-C.cape,C.east+2,40,250-C.cape+2,y))],Fe={hull:w.sections.map(([e,t],n)=>[e,t,w.axis[n]]),pieces:[...V,...B,...B.map(({kind:e,min:t,max:n})=>({kind:e,min:[t[0],t[1],250-n[2]],max:[n[0],n[1],250-t[2]]}))],crags:[...X,...X.map(e=>({...e,at:[e.at[0],e.at[1],250-e.at[2]],parts:e.parts.map(([e,t,n,r,i,a])=>[e,t,250-a,r,i,250-n])}))]},Ie=[46,54,62,70].flatMap(e=>[[e,N,226,0],[e+4,N,229,0]]),Le=e=>{let t=t=>e?t:ce(t);return{base:t(G(Se)),spawns:e?Ie:Ie.map(([e,t,n])=>[e,t,250-n,Math.PI]),rack:t(G(we)),blade:t(G(Te)),rifle:t(G(Ee)),rail:t(G(De))}},Re=[70.5,w.axis[1]+D[1],128],ze={armor:!0,name:`Landfall`,tag:`Beach · wreck`,lore:`A ship came down across a Caribbean beach, its tail in the lagoon and its nose in the trees. The survivors camp at either end of the sand and fight over the wreck between them.`,brushes:[...Pe,...Pe.map(se),...me],teams:[Le(!0),Le(!1)],packs:z([G(Y.camp[0]),G(Y.west[2]),G(Y.west[4]),G(q[0]),G(Y.east[3])],...ue.map(({x:e,top:t})=>[e,t,f])),ammo:z([G(Oe),G(ke),G(Ae),G(Y.west[0]),G(Y.west[1]),G(Y.west[3]),G(Y.east[0]),G(Y.east[1]),G(Y.east[4])],[51,k.floor,f],[67,k.floor,f]),cells:z([G(Y.camp[1]),G(je),G(q[1]),G(Y.east[2]),Re],[59,k.floor,f]),vests:z([G(be)],[63,le[1],f]),floor:-1.4,water:S.water,fires:ve.map(([e,t,n,,r])=>[e,t,n,.6*r+ye[0],ye[1]]),relief:{hole:[0,0,0,0],bound:[56,f,100,185],cell:4,origin:[0,1],at:oe},sun:{dir:[-.47,.83,.3],color:[3.2,3,2.6]},sky:[[.1,.32,.75],[.55,.75,.9]],fog:[.6,.78,.9,.0012],scenery:`beach`},Be=-1.09,Z=[16,48,120,280,600,1100],[Ve,He]=[.08,-40],[Ue,We]=[[.64,.59,.48],[.3,.25,.15]],Ge=[.1,.2,.12],Q=(e,t,n)=>Math.min(Math.max(e,t),n),Ke=t(o([[0,-1],[1,0],[0,1]],4),[1,1,1]),[qe,Je]=[72,17],Ye=/* @__PURE__ */ new WeakMap,Xe=e=>{let t=Ye.get(e);if(t)return t;let o=e.relief&&r(e.relief),[l,d,f,p,m]=o?[o.x0,o.z0,o.cell,o.nx,o.nz]:[S.sea,0,10,(S.east-S.sea)/10+1,26],h=Z.length,g=(e,t)=>[...Z.map(t=>e-t).reverse(),...Array.from({length:t},(t,n)=>e+n*f),...Z.map(n=>e+(t-1)*f+n)],[_,v]=[g(l,p),g(d,m)],[y,b]=[_.length,v.length],x=new Float64Array(y*b);for(let e=0;e<b;e++)for(let t=0;t<y;t++){let[n,r]=[Q(t-h,0,p-1),Q(e-h,0,m-1)],i=o?o.h[n+r*p]:S.water+.1*(l+n*f-S.shore);x[t+e*y]=Math.max(i-Ve*Math.max(l-_[t],0),He)}let C=(e,t)=>x[Q(e,0,y-1)+Q(t,0,b-1)*y],T=[],E=[];for(let e=0;e<b;e++)for(let t=0;t<y;t++){let[r,i,a]=[_[t],v[e],C(t,e)],[s,l]=[Math.max(t-1,0),Math.min(t+1,y-1)],[u,d]=[Math.max(e-1,0),Math.min(e+1,b-1)],f=o?n([(C(s,e)-C(l,e))/(_[l]-_[s]),1,(C(t,u)-C(t,d))/(v[d]-v[u])]):[0,1,0],p=.92+.16*c(r/11,i/11,5),m=Q((r-S.trees-2)/14,0,1),h=Ue.map((e,t)=>(e+(We[t]-e)*m)*p);T.push([r,o?a:S.water-.02,i,...f,h[0],h[1],-1.09,h[2]]),E.push([r,S.water+.05,i,0,1,0,S.water+.05-a,0,-5,0])}let D=[[],[]],O=o?.hole??[0,0,0,0];for(let e=0;e<b-1;e++)for(let t=0;t<y-1;t++){let[n,r,i,a]=[t+e*y,t+1+e*y,t+1+(e+1)*y,t+(e+1)*y];_[t]>=O[0]&&_[t+1]<=O[2]&&v[e]>=O[1]&&v[e+1]<=O[3]||D[0].push(...T[n],...T[i],...T[r],...T[n],...T[a],...T[i]),Math.min(x[n],x[r],x[i],x[a])<S.water+.05&&D[1].push(...E[n],...E[i],...E[r],...E[n],...E[a],...E[i])}if((e=>{let[t,n,r,i]=[28,S.sea-840,125,560],a=e=>{let n=e/t;return 70*(4*n*(1-n))**.7*(.45+.75*c(5*n,3,9))},o=(e,o)=>[n-60*o,o?a(e):S.water-1,r+(e/t-.5)*i,.6,.8,0,Ge[0],Ge[1],-1,Ge[2]];for(let n=0;n<t;n++)e.push(...o(n,0),...o(n+1,0),...o(n+1,1),...o(n,0),...o(n+1,1),...o(n,1))})(D[0]),o){let e={relief:o};((e,t)=>{let[n,r]=[S.shore+4,w.sections[2][1]];for(let o=0;o<qe;o++){let s=e=>a(o,e,31),[c,l]=[n+(r-n)*s(1),3+(Je-3)*s(2)*s(2)];if(l<w.r+1.5&&w.sections.some(([e,t])=>c>e&&c<t))continue;let[d,f,p]=[125+(s(3)<.5?l:-l),.12+.3*s(4)*s(4),.03+.04*s(5)];u(e,Ke,[c,t(c,d)+.2*f,d],i(7*s(5),0),[0,0,0],[f*(.6+s(6)),.7*f,f],[p,p,p])}})(D[0],(t,n)=>s(e,t,n))}return Ye.set(e,D),D},Ze=e=>Xe(e)[0],Qe=e=>Xe(e)[1],$e=`0.05+0.05*sin(T*.55+q.y*.13+4.*vn(q*.05))`,et=`if(d.y>0.){vec2 q=d.xz/(d.y+.1)*2.+T*.003;float f=vn(q)+.5*vn(q*2.3+5.)+.25*vn(q*5.1);
1
+ import{$ as e,$t as t,H as n,J as r,K as i,Qt as a,Vt as o,X as s,Xt as c,Zt as l,dr as u,rr as d}from"./brick-CfuEIQ9e.js";var f=125,[p,m]=d,{METAL:h,STEEL:g,PAINT:_,WOOD:v,STONE:y,GRATE:b}=u,x=[1,.42,.08],S={sea:0,shore:30,trees:90,east:110,cape:-6,water:0},C={east:S.trees+5,cape:S.cape-4},w={r:7,sunk:2,sections:[[6,36],[44,74],[82,106]],axis:[4,6.25,7.5],spine:2.5,skin:.85},T=e=>{let t=Math.max(1-e*e/(w.r*w.r),0);return Math.max(w.r*Math.sqrt(Math.sqrt(t*Math.sqrt(t))),e>0?w.spine:0)},E=[-4,-2.05,-1.75,0,1.95,2.25,3.6,5,5.5,6,6.5,7],D=[-1.75,2.25,w.r],O=(E.map(e=>[e,T(e)]),[{cut:[[6,7,.7,9],[7,13,.76],[13,20,.9],[20,36,1]],floor:-4.75,holes:[[0,14,20,3],[1,24,29,9],[2,13,18.5,2.3]],tears:[[21,30,-1.75,1.95],[31,36,2.25,5]],fair:[[30,36,3]],crates:[[18.3,-1],[24.2,0],[16.8,1]]},{cut:[[44,74,1]],floor:-5,holes:[[0,51.5,56,3.2],[0,67,70.5,9],[1,44,48,9],[1,60.5,65.5,3],[2,44,47,9],[2,53,58,2.2]],tears:[[57.5,60.5,-4,-2.05],[47.5,55,-1.75,1.95],[64,71,2.25,5]],fair:[[44,47.5,3.2],[55,71,4.4],[71,74,3]],crates:[[54.3,-1],[60.7,0],[56.3,1]]},{cut:[[82,90,1],[90,97,.85]],floor:-5,holes:[[0,86.5,90,3],[1,82,85,9],[2,87.5,91.5,2]],tears:[[84.5,91,-1.75,1.95]],fair:[[82,84.5,2.7],[91,95,1.5]],crates:[[88.3,-1],[83.3,0],[87.7,1]]}]),k={floor:w.axis[1]+O[1].floor,ceil:w.axis[1]+E[1],half:4.525,x:w.sections[1],door:O[1].tears[0],lintel:E[1]-O[1].floor,walls:[],way:2.4},A={root:[45,71],lead:[[71,0],[69,8],[64,18],[61.5,26],[60,26],[59,38],[60.5,38],[59,42],[57.5,46.5],[54,47.5]],trail:[[45,0],[46.5,10],[50,30],[52.5,44],[54,47.5]],span:.78,pieces:[[0,14,0,8.5,6.4,0],[16,30,2,6.8,3.6,.17],[32,47.5,4,3.3,1.6,-.2]],rails:[53.5,58]},j=[[38.5,150.3,2.7,19,.78],[4.5,137,2.5,9]],M=[60,219,4],N=1.25,ee=[[38,237,3.5,2.6,1],[57,242,3,2.2,2],[47,251,4,3,3],[66,254,4.5,3.6,4],[78,241,4,3.4,5],[33,256,2.8,1.8,6],[87,250,5.5,5,7],[97,243,6,6.5,8],[100,256,7.5,9,9],[89,262,7,7,10]],te=(e,t,n)=>{let r=t=>l(e,t,151),i=2*r(1)-1,[s,c]=[(1-i*i)/(1+i*i),2*i/(1+i*i)],u=n-o(n),[d,f]=[t*(.85+.3*r(2)),t*(.6+.3*r(3))],p=o(n)+.7*n,m=[4,8].map(e=>{let[t,n,i]=[2*r(e)-1,.35*r(e+1),2*r(e+2)-1],a=Math.sqrt(t*t+n*n+i*i);return[t/a,n/a,i/a,.7+.2*r(e+3)]}),h=e=>{let t=(e[0]*s+e[2]*c)/d,n=(e[2]*s-e[0]*c)/f,r=e[1]/u,[i,a,o]=[t*t*t*t,r*r*r*r,n*n*n*n];return .25/Math.sqrt(Math.sqrt(i+a+o))+.75/Math.sqrt(Math.sqrt(Math.sqrt(i*i+a*a+o*o)))},g=t=>{if(t[1]<0){let e=Math.sqrt(t[0]*t[0]+t[2]*t[2]);return e<1e-6?p:Math.min(g([t[0]/e,0,t[2]/e])/e,p/-t[1])}let n=h(t);for(let[e,r,i,a]of m){let o=t[0]*e+t[1]*r+t[2]*i;if(o>.001){let t=a*h([e,r,i])/o,s=Math.max(.2-Math.abs(n-t),0)/.2;n=Math.min(n,t)-.05*s*s}}return n*(.95+.08*a(1.3*t[0]+e,1.3*t[2]+1.1*t[1],e+3))};return{reach:g}},ne=Array.from({length:28},(e,t)=>[S.trees+3*l(t,1,7),134+4*t+2*l(t,2,7),.22+.1*l(t,3,7)]),P=e=>Math.min(Math.max(e,0),1),F=e=>P(e)*P(e)*(3-2*P(e)),re=(e,t)=>Math.sqrt(e*e+t*t),ie=[[57,132,61,138,k.floor-.95],[56,171,66,175,1.3],[44,209,76,229,N]],ae=[1.5,1.2],oe=(e,t)=>{let n=Math.abs(t-f),{shore:r,trees:i}=S,o=e>r?2.5*(e-r)/(i-r):(e-r)/10;o+=.9*F((e-46)/24)*(a(e/13,n/13,5)-.45)*F((n-14)/10),o+=F((e-r)/14)*(1-F((e-102)/8))*(ae[1]*P(1-Math.abs(n-12)/5)-ae[0]*(1-F((n-2)/7))),o+=1.8*P(1-re(e-110,n)/9);for(let[t,r,i,a,s]of ie){let c=re(Math.max(t-e,e-i,0),Math.max(r-f-n,f+n-a,0));o=s+(o-s)*F((c-6)/6)}return o},I=(e,t)=>{let[n,r]=[Math.floor(e/4),Math.floor((t-1)/4)],[i,a]=[e/4-n,(t-1)/4-r],o=(e,t)=>Math.fround(oe(4*(n+e),1+4*(r+t))),[s,c]=[o(0,0),o(1,1)];return i>=a?s+(o(1,0)-s)*i+(c-o(1,0))*a:s+(o(0,1)-s)*a+(c-o(0,1))*i},L=(e,t,n,r,i,a,o,s)=>({min:[e,t,n],max:[r,i,a],top:o,side:o,...s?{tint:s}:{}}),R=e=>({...e,ghost:!0}),se=e=>({...e,min:[e.min[0],e.min[1],250-e.max[2]],max:[e.max[0],e.max[1],250-e.min[2]],...e.tint?{tint:e.tint===p?m:e.tint}:{}}),ce=([e,t,n])=>[e,t,250-n],z=(e,...t)=>[...e,...e.map(ce),...t],B=[],V=[],H=(e,t,n)=>(e.push({kind:t,min:n.min,max:n.max}),R(n)),U=(e,t,n,r)=>{let i=[0,.25,.5,.75,1].flatMap(i=>[0,.25,.5,.75,1].map(a=>I(e+(n-e)*i,t+(r-t)*a)));return[Math.max(...i),Math.min(...i)]},W=(e,t,n,r,i,a,o,s)=>{let[c,l]=U(t,n,r,i);return H(B,e,L(t,l-.5,n,r,Math.round(32*(c+a))/32,i,o,s))},G=e=>[(e.min[0]+e.max[0])/2,e.max[1],(e.min[2]+e.max[2])/2],K=(e,t,n,r,i,a,o,s=0)=>{let c=[],l=t,u=(o,s,l)=>{let[u,d]=[Math.max(o,t),Math.min(s,n)];if(d>u&&l<a)for(let[t,n]of l>0?[[-a,-l],[l,a]]:[[-a,a]])c.push(H(V,e,L(u,r,f+t,d,i,f+n,e==`deck`?b:h)))};for(let[e,t,r]of[...o,[n,n,0]])u(l,e,s),u(e,t,r),l=Math.max(l,t);return c},le=w.axis.map(e=>e+w.r),ue=w.sections.slice(1).map(([e],t)=>{let n=w.sections[t][1],[r,i]=U(n,123.5,e,126.5),a=Math.round(32*(Math.max(r,S.water)+1.875))/32;return{x:(n+e)/2,top:a,heap:L(n,i-.5,123.5,e,a,126.5,g,x)}}),de=w.sections.flatMap(([e,t],n)=>[n&&[e,e+1],n<2&&[t-1,t]].filter(e=>e).map(e=>{let[t,r]=e,i=w.axis[n],a=Math.round(16*T(O[n].floor))/16-w.skin;return L(t,i+O[n].floor,f-a,r,i+E[1],f+a,h)})),fe=[36,74].flatMap(e=>{let[t,n]=U(e,128,e+1.2,130.5),r=L(e,n-.5,128,e+1.2,Math.round(32*(t+1.4))/32,130.5,g);return[r,se(r)]}),pe=L(.5,-.3,121,5,.4,129,h),me=[...O.flatMap(({cut:e,floor:t,holes:n,tears:r,fair:i,crates:a},o)=>{let s=w.axis[o],c=[t,...E.filter(e=>e>t+.5)];return[...e.flatMap(([e,a,o,l=w.skin])=>{let u=e=>Math.round(16*o*T(e))/16;return[...K(`deck`,e,a,s-w.r,s+t,u(t),[]),...c.slice(1).flatMap((d,f)=>{let p=c[f],m=D.indexOf(d),h=d<w.r?u(m<0?(p+d)/2:d):o*w.spine,g=p<D[0]?t:p<D[1]?D[0]:D[1];return[...m<0?K(`skin`,e,a,s+p,s+d,h,r.filter(e=>e[2]<=p&&e[3]>=d).map(([e,t])=>[e,t,99]),Math.min(u(d),u(g))-l):K(`deck`,e,a,s+p,s+d,h,n.filter(e=>e[0]==m).map(([,e,t,n])=>[e,t,Math.min(n,h-l)])),...p>=0&&d<=D[1]?i.flatMap(([t,n,r])=>K(`fairing`,Math.max(t,e),Math.min(n,a),s+p,s+d,w.r+r,[],h)):[]]})]}),...a.map(([e,n])=>{let r=s+(D[n]??t);return H(V,`crate`,L(e,r,124.25,e+1.5,r+[1,1.4,2][n+1],125.75,v))})]}),...ue.map(e=>H(V,`heap`,e.heap)),...fe.map(e=>H(V,`frame`,e)),...de.map(e=>H(V,`jam`,e)),H(V,`raft`,pe),R(L(C.east,-10,C.cape-2,C.east+2,40,250-C.cape+2,y))],he=e=>.6-.45*e/47.5,ge=(e,t)=>{let n=e.findIndex(e=>e[1]>t),[r,i]=[e[n-1],e[n]];return r[0]+(i[0]-r[0])*(t-r[1])/(i[1]-r[1])},_e=Array.from({length:6},(e,t)=>{let[n,r,i,,a]=j[0],o=n-7.5+2.5*t,s=r+a*(o+1.25-n);return W(`fallen`,o,s-i-.2,o+2.5,s+i+.2,3.5,h,t?void 0:x)}),ve=[...[G(_e[3]),[j[1][0]-1.5,1.3,j[1][1]+3.5]].flatMap(([e,t,n])=>[[e,t,n,42,1.3,7],[e,t,250-n,42,1.3,7]]),...w.sections.flatMap(([e,t],n)=>[n&&e-.6,n<2&&t+.6].filter(e=>e).map(e=>[+e,w.axis[n]+4.2,125,28,.9,4]))],ye=[.55,2.3],be=(()=>{let[e,t,n,r]=j[1];return H(B,`engine`,L(e-n,-5,t-r/2,e+n,1.4,t+r/2,h,x))})(),q=[H(B,`float`,L(16,-1.6,141,22,.35,144,h)),H(B,`float`,L(10,-.2,138,13,.5,141,h)),H(B,`float`,L(23,-1.6,132.6,26,.2,135,h))],xe=H(B,`pod`,L(M[0]-3,.75,M[1]-3,M[0]+3,4.25,M[1]+3,h)),Se=H(B,`dais`,L(M[0]-2,.75,M[1]-10,M[0]+2,1.3,M[1]-6,_,p)),J=(e,t,n=.4,r)=>W(`crate`,e-1.5,t-1.5,e+1.5,t+1.5,n,v,r),Ce=(e,t)=>[L(e-2.6,4.85,t-2.1,e+2.6,5,t+2.1,_,p),...[-1,1].flatMap(n=>[-1,1].map(r=>L(e+2.5*n-.1,.75,t+2*r-.1,e+2.5*n+.1,4.85,t+2*r+.1,g)))].map(e=>H(B,`shelter`,e)),[we,Te]=[J(49,221),J(71,221)],[Ee,De]=[J(84,185,.4,p),J(33,153,.4,p)],Oe=W(`panel`,67,184.5,70.5,188,.65,h),ke=W(`container`,68.5,176,71.1,182,1.875,h,x),Ae=W(`gear`,68.6,170.6,71,173,2.9,g,[.95,.75,.1]),je=W(`container`,64,164.5,67.5,168,2.6,h,x),Me=W(`gear`,67.6,169.6,72,170.6,1.2,g),Y={camp:[J(76,213),J(40,217)],west:[W(`panel`,44.5,191.5,47.5,194.5,.5,h),W(`container`,33,173.7,39,176.3,2.2,h,x),W(`panel`,41,163.5,44,166.5,.4,h),W(`panel`,25.5,159.5,28.5,162.5,.5,h),W(`panel`,50.5,139.5,53.5,142.5,.4,h),W(`container`,49.5,132.4,52.5,135,2.6,h,x)],east:[W(`panel`,62.5,145.5,65.5,148.5,.4,h),J(80,171),J(85.5,165),J(84,153),W(`panel`,84.5,135.5,87.5,138.5,.4,h)],cover:[W(`panel`,78,156.6,83,157,2.6,h),W(`panel`,30,166.6,35,167,2.2,h),W(`container`,76,190,82,192.6,2.6,h,x)]},Ne=(e,t,n,r,i,a)=>{let{reach:s}=te(i,n,r),c=U(e-.8*n,t-.8*n,e+.8*n,t+.8*n),l=I(e,t)+o(r),u=l+s([0,1,0])-.1,d=(e,t,n)=>{let r=Math.sqrt(e*e+t*t+n*n)||1;return r<=s([e/r,t/r,n/r])},f=(e,t)=>{if(!d(e,t,0))return;let r=r=>{let[i,a]=[0,1.6*n];for(let n=0;n<9;n++){let n=(i+a)/2;d(e,t,r*n)?i=n:a=n}return r*i};return[r(-1),r(1)]},p=[],[m,h]=[n<5?1:n<8?2:3,r<5?1:r<12?2:3];for(let r=c[1]-.5;r<u-.3;r+=h){let i=Math.min(r+h,u);for(let o=-1.5*n;o<1.5*n;o+=m){let n=[.1,.5,.9].flatMap(e=>[Math.max(r,c[1])+.05,i].map(t=>f(o+m*e,t-l)));if(n.every(e=>e)){let s=t+Math.max(...n.map(e=>e[0])),c=Math.min(t+Math.min(...n.map(e=>e[1])),a);c-s>.4&&p.push([e+o,r,s,e+o+m,i,c])}}}return p},X=ee.map(([e,t,n,r,i])=>({at:[e,I(e,t),t],R:n,H:r,s:i,parts:Ne(e,t,n,r,i,250-C.cape)})),Pe=[...A.pieces.flatMap(([e,t,n,r,i,a],o)=>{let s=(e,t=n)=>f+w.r+O[1].fair[1][2]+A.span*e+t,c=Math.ceil((s(t)-s(e))/1.4),l=Math.max(c,Math.ceil((r-i)/.15-1e-9)+1),u=A.pieces[o-1];return[...Array.from({length:l},(n,o)=>{let u=e+(t-e)*(o+.5)/l,d=a*c*((o+.5)/l-.5),[f,p]=[A.trail,A.lead].map(e=>Math.round(8*(ge(e,u)+d))/8),[m,g]=[o,o+1].map(n=>s(e+(t-e)*n/l)),_=r+(i-r)*o/(l-1);return H(B,`wingpiece`,L(f,_-he(u),m,p,_,g,h))}),...u?A.rails.map(t=>{let n=Math.min(u[4],r);return H(B,`rail`,L(t-.225,n-.45,s(u[1],u[2]),t+.225,n,s(e),g))}):[]]}),..._e,be,...q,xe,Se,we,Te,...Ce(49,221),...Ce(71,221),Ee,De,Oe,ke,Ae,Me,je,...Object.values(Y).flat(),...ne.map(([e,t,n])=>{let r=I(e,t);return R(L(e-n,r-1,t-n,e+n,r+9,t+n,v))}),...X.flatMap(e=>e.parts).map(([e,t,n,r,i,a])=>R(L(e,t,n,r,i,a,y))),R(L(-60,-10,250-C.cape,C.east+2,40,250-C.cape+2,y))],Fe={hull:w.sections.map(([e,t],n)=>[e,t,w.axis[n]]),pieces:[...V,...B,...B.map(({kind:e,min:t,max:n})=>({kind:e,min:[t[0],t[1],250-n[2]],max:[n[0],n[1],250-t[2]]}))],crags:[...X,...X.map(e=>({...e,at:[e.at[0],e.at[1],250-e.at[2]],parts:e.parts.map(([e,t,n,r,i,a])=>[e,t,250-a,r,i,250-n])}))]},Ie=[46,54,62,70].flatMap(e=>[[e,N,226,0],[e+4,N,229,0]]),Le=e=>{let t=t=>e?t:ce(t);return{base:t(G(Se)),spawns:e?Ie:Ie.map(([e,t,n])=>[e,t,250-n,Math.PI]),rack:t(G(we)),blade:t(G(Te)),rifle:t(G(Ee)),rail:t(G(De))}},Re=[70.5,w.axis[1]+D[1],128],ze={armor:!0,name:`Landfall`,tag:`Beach · wreck`,lore:`A ship came down across a Caribbean beach, its tail in the lagoon and its nose in the trees. The survivors camp at either end of the sand and fight over the wreck between them.`,brushes:[...Pe,...Pe.map(se),...me],teams:[Le(!0),Le(!1)],packs:z([G(Y.camp[0]),G(Y.west[2]),G(Y.west[4]),G(q[0]),G(Y.east[3])],...ue.map(({x:e,top:t})=>[e,t,f])),ammo:z([G(Oe),G(ke),G(Ae),G(Y.west[0]),G(Y.west[1]),G(Y.west[3]),G(Y.east[0]),G(Y.east[1]),G(Y.east[4])],[51,k.floor,f],[67,k.floor,f]),cells:z([G(Y.camp[1]),G(je),G(q[1]),G(Y.east[2]),Re],[59,k.floor,f]),vests:z([G(be)],[63,le[1],f]),floor:-1.4,water:S.water,fires:ve.map(([e,t,n,,r])=>[e,t,n,.6*r+ye[0],ye[1]]),relief:{hole:[0,0,0,0],bound:[56,f,100,185],cell:4,origin:[0,1],at:oe},sun:{dir:[-.47,.83,.3],color:[3.2,3,2.6]},sky:[[.1,.32,.75],[.55,.75,.9]],fog:[.6,.78,.9,.0012],scenery:`beach`},Be=-1.09,Z=[16,48,120,280,600,1100],[Ve,He]=[.08,-40],[Ue,We]=[[.64,.59,.48],[.3,.25,.15]],Ge=[.1,.2,.12],Q=(e,t,n)=>Math.min(Math.max(e,t),n),Ke=i(s([[0,-1],[1,0],[0,1]],4),[1,1,1]),[qe,Je]=[72,17],Ye=/* @__PURE__ */ new WeakMap,Xe=i=>{let o=Ye.get(i);if(o)return o;let s=i.relief&&t(i.relief),[u,d,f,p,m]=s?[s.x0,s.z0,s.cell,s.nx,s.nz]:[S.sea,0,10,(S.east-S.sea)/10+1,26],h=Z.length,g=(e,t)=>[...Z.map(t=>e-t).reverse(),...Array.from({length:t},(t,n)=>e+n*f),...Z.map(n=>e+(t-1)*f+n)],[_,v]=[g(u,p),g(d,m)],[y,b]=[_.length,v.length],x=new Float64Array(y*b);for(let e=0;e<b;e++)for(let t=0;t<y;t++){let[n,r]=[Q(t-h,0,p-1),Q(e-h,0,m-1)],i=s?s.h[n+r*p]:S.water+.1*(u+n*f-S.shore);x[t+e*y]=Math.max(i-Ve*Math.max(u-_[t],0),He)}let C=(e,t)=>x[Q(e,0,y-1)+Q(t,0,b-1)*y],T=[],E=[];for(let t=0;t<b;t++)for(let n=0;n<y;n++){let[r,i,o]=[_[n],v[t],C(n,t)],[c,l]=[Math.max(n-1,0),Math.min(n+1,y-1)],[u,d]=[Math.max(t-1,0),Math.min(t+1,b-1)],f=s?e([(C(c,t)-C(l,t))/(_[l]-_[c]),1,(C(n,u)-C(n,d))/(v[d]-v[u])]):[0,1,0],p=.92+.16*a(r/11,i/11,5),m=Q((r-S.trees-2)/14,0,1),h=Ue.map((e,t)=>(e+(We[t]-e)*m)*p);T.push([r,s?o:S.water-.02,i,...f,h[0],h[1],-1.09,h[2]]),E.push([r,S.water+.05,i,0,1,0,S.water+.05-o,0,-5,0])}let D=[[],[]],O=s?.hole??[0,0,0,0];for(let e=0;e<b-1;e++)for(let t=0;t<y-1;t++){let[n,r,i,a]=[t+e*y,t+1+e*y,t+1+(e+1)*y,t+(e+1)*y];_[t]>=O[0]&&_[t+1]<=O[2]&&v[e]>=O[1]&&v[e+1]<=O[3]||D[0].push(...T[n],...T[i],...T[r],...T[n],...T[a],...T[i]),Math.min(x[n],x[r],x[i],x[a])<S.water+.05&&D[1].push(...E[n],...E[i],...E[r],...E[n],...E[a],...E[i])}if((e=>{let[t,n,r,i]=[28,S.sea-840,125,560],o=e=>{let n=e/t;return 70*(4*n*(1-n))**.7*(.45+.75*a(5*n,3,9))},s=(e,a)=>[n-60*a,a?o(e):S.water-1,r+(e/t-.5)*i,.6,.8,0,Ge[0],Ge[1],-1,Ge[2]];for(let n=0;n<t;n++)e.push(...s(n,0),...s(n+1,0),...s(n+1,1),...s(n,0),...s(n+1,1),...s(n,1))})(D[0]),s){let e={relief:s};((e,t)=>{let[i,a]=[S.shore+4,w.sections[2][1]];for(let o=0;o<qe;o++){let s=e=>l(o,e,31),[c,u]=[i+(a-i)*s(1),3+(Je-3)*s(2)*s(2)];if(u<w.r+1.5&&w.sections.some(([e,t])=>c>e&&c<t))continue;let[d,f,p]=[125+(s(3)<.5?u:-u),.12+.3*s(4)*s(4),.03+.04*s(5)];r(e,Ke,[c,t(c,d)+.2*f,d],n(7*s(5),0),[0,0,0],[f*(.6+s(6)),.7*f,f],[p,p,p])}})(D[0],(t,n)=>c(e,t,n))}return Ye.set(i,D),D},Ze=e=>Xe(e)[0],Qe=e=>Xe(e)[1],$e=`0.05+0.05*sin(T*.55+q.y*.13+4.*vn(q*.05))`,et=`if(d.y>0.){vec2 q=d.xz/(d.y+.1)*2.+T*.003;float f=vn(q)+.5*vn(q*2.3+5.)+.25*vn(q*5.1);
2
2
  f=smoothstep(1.05,1.4,f)*smoothstep(0.,.05,d.y)*(1.-smoothstep(.12,.4,d.y));
3
3
  s=mix(s,vec3(1.22,1.2,1.17)*(.8+.3*max(dot(d,O),0.)),f*.9);}`,tt=e=>`{vec2 q=P.xz;float d=C.x-(${$e});if(d<0.)discard;\nfloat ds=length(P-E),pf=length(fwidth(q)),fz=${e},fo;vec3 V=(E-P)/ds;\nvec2 w=q+1.5*vn(q*.09+T*.04),gd=vec2(0);\nfor(int i=0;i<(ds<18.?7:5);i++){float k=.6*exp(.66*float(i)),a=(float(i)-2.)*.8;vec2 dr=vec2(cos(a),sin(a));\ngd+=dr*cos(k*dot(dr,w)-T*sqrt(k)*1.3+a*5.)*(1.-smoothstep(.15,.6,k*pf))*(i<5?.055:.04-.04*smoothstep(6.,18.,ds));}\ngd*=.35+.65*smoothstep(0.,.6,d);\nvec3 n=normalize(vec3(-gd.x,1,-gd.y));float fr=.02+.6*pow(clamp(1.-dot(n,V),0.,1.),5.);\nfloat fn=vn(q*1.7+vec2(T*.12,0))*vn(q*5.-vec2(T*.2,T*.07));\nfo=smoothstep(.03+.06*fn,0.,d)+smoothstep(.3,.55,fn+.3*sin(d*14.+T*.8+3.*vn(q*.3)))*(1.-smoothstep(.05,.4,d));\nfo=min(fo,1.)*(1.-smoothstep(.3,1.2,pf)*.5);\nvec3 tr=exp(-vec3(.42,.07,.055)*d*2.4);\nif(Z>1.5){o=vec4(tr*(1.-fr)*(1.-fo)*(1.-fz),1);return;}\nvec4 sq=W*vec4(P,1);sq.xyz=sq.xyz*.5+.5;\nfloat sv=mix(texture(D,vec4(sq.xy,0,sq.z-.0004)),1.,smoothstep(.8,1.,max(max(abs(sq.x-.5),abs(sq.y-.5)),abs(sq.z-.5))*2.));\nvec3 lw=e(X*max(O.y,0.)*sv+H[0]),r=reflect(-V,n);r.y=abs(r.y)+.25;r=normalize(r);\nvec3 sc=mix(vec3(.02,.42,.5),vec3(.004,.09,.3),1.-exp(-d*.18))*lw*(1.-tr.g*tr.g);\nvec3 c=(sc*(1.-fr)+(K1(r,0.)+sv*X*2.*pow(max(dot(n,nz(O+V)),0.),600.))*fr)*(1.-fo)+fo*.9*lw;\nc=mix(c,F.rgb,fz);if(Vn>0)c=hv(c);o=vec4(c,1);return;}`,$=[(w.sections[1][0]+w.sections[1][1])/2,w.sections[2][1]-2],nt=`{vec2 q=P.xz;float y=P.y-${S.water}.,f1=1.-smoothstep(.3,1.,pw*9.),f2=1.-smoothstep(.3,1.,pw*2.5),f3=1.-smoothstep(.3,1.,pw*80.);\nbw=1.-smoothstep(.08,.3+.12*vn(q*.4),y);\nfloat rp=sin((dot(q,vec2(.95,.3))+1.2*vn(q*.3))*18.)*smoothstep(.3,.7,vn(q*.07+5.))*f1*(1.-.6*bw);\nfloat dr=dot(q,vec2(.27,.86))+2.5*vn(q*.04);\nh+=smoothstep(.4,1.6,y)*(.24*(sin(dr)+.35*sin(2.*dr))*smoothstep(.2,.7,vn(q*.025+7.))+.9*vn(q*.06))+.018*rp+f2*.04*(vn(q*2.2)-.5)+f1*.012*(vn(q*6.+3.)-.5)+(1.-smoothstep(.3,1.,pw*40.))*.006*(vn(q*28.)-.5);\nc*=(.88+.24*vn(q*.13+9.))*(1.+.05*rp+f3*.16*(vn(q*170.)-.5)+f1*.07*(vn(q*37.)-.5));\nc*=mix(vec3(1),vec3(.52,.47,.4),bw);\nif(y<0.){vec2 u=q*3.+vn(q*.8)*2.;float ca=vn(u+T*.3)-vn(u+7.-T*.25);c*=1.+.45*f2*pow(max(1.-abs(ca)*2.5,0.),6.)*smoothstep(0.,-.3,y);}\nfloat wl=0.05-(${$e});bw*=.35+.65*smoothstep(wl+.12,wl,y);float cz=abs(q.y-125.);if(cz<40.){\nfloat ht=max(max(1.-abs(q.x-${$[0]}.)/26.,1.-abs(q.x-${$[1]}.)/14.),0.),\nwd=cz/(1.+1.2*smoothstep(${$[1]-14}.,${$[1]+6}.,q.x))+6.*vn(vec2(q.x*.06,q.y*.15))+30.\n-30.*smoothstep(8.,20.,q.x)*(1.-smoothstep(${$[1]+8}.,${$[1]+26}.,q.x))-3.*ht;\nc*=mix(vec3(1),vec3(.13,.09,.07),(1.-smoothstep(18.,29.,wd))*(.7+.3*vn(q*.7)));\nif(wd<19.){vec2 u=q*2.5+2.*vn(q*.3),ic=floor(u),fc=fract(u);float d1=9.,d2=9.,id=0.;\nfor(int j=0;j<9;j++){vec2 g=vec2(j%3,j/3)-1.,o=ic+g,pt=g+vec2(h3(vec3(o,1)),h3(vec3(o,2)))-fc;float d=dot(pt,pt);\nif(d<d1){d2=d1;d1=d;id=h3(vec3(o,3));}else if(d<d2)d2=d;}\nfloat fk=1.-smoothstep(.3,1.,pw*8.),e=sqrt(d2)-sqrt(d1),fe=fk*min(19.-wd,1.),ck=mix(1.,smoothstep(0.,.1,e),fe),cb=mix(1.,smoothstep(0.,.25,e),fe),a=step(wd+1.5*id,18.),gl=a*smoothstep(.8,.86,vn(q*.3));\nh=cb*mix(h,.02+f2*.012*vn(q*5.),a)*(1.-gl);c*=.4+.6*ck;\nc=mix(c,vec3(1,.94,.88)*(.03+.05*id+.2*ck*vn(q*2.5)*vn(q*9.))*ck*(1.-.7*gl)+vec3(2.,.4,.05)*(1.-ck)*fk*ht*step(.75,id)*smoothstep(9.,4.,cz),a);\nbw=mix(bw,gl,a);}}}`,rt=`c+=bw*k*(.02+.3*fr);`,it=-1.05,at=.25,ot=`{vec2 q=vec2(P.x,abs(n.y)>.7?P.z:P.y*1.3)*.5,d=abs(fract(q)-.5);hk=smoothstep(.25,.55,C.x);
4
4
  c*=1.-.4*hk*smoothstep(.006+pw,.006,min(d.x,d.y))*(1.-smoothstep(.02,.09,pw));if(dot(n,E-P)<0.){c*=.18;hk=0.;}}`,st=e=>`{float ds=length(P-E),fz=${e};vec3 V=(E-P)/ds,n=normalize(N)*sign(dot(N,V));float fr=.07+.8*pow(max(1.-abs(dot(n,V)),0.),4.);\nif(Z>1.5){o=vec4(vec3(.56,.7,.68)*(1.-fr)*(1.-fz),1);return;}\nvec3 c=(K1(reflect(-V,n),0.)+X*3.*pow(max(dot(n,nz(O+V)),0.),300.))*fr;c=mix(c,F.rgb,fz);if(Vn>0)c=hv(c);o=vec4(c,1);return;}`,ct=`c+=hk*(mix(vec3(.8,.72,.56),k,smoothstep(-.3,.05,r.y))*(.06+.35*fr)+vec3(.15,.135,.105)*clamp(.5-m.y,0.,1.));`,lt=-1.098,ut=`{bool rf=abs(n.y)>.5;vec2 q=rf?P.xz:vec2(P.x+P.z,P.y);float f=1.-smoothstep(.002,.008,pw),w=sin(q.x*785.)*sin(q.y*785.),te;\nif(rf)te=vn(q*.45+3.)+.35*vn(q*.9+17.)-.08*vn(q*6.)-.04*vn(q*19.)-.88;\nelse{float d=${5 .toFixed(3)}-P.y,l=.25+.5*vn(vec2(q.x*2.2,1.))+.12*vn(vec2(q.x*9.,2.))+.05*vn(vec2(q.x*31.,3.));te=max(d-l,(vn(vec2(q.x*7.,d*1.2))-.72)*smoothstep(l-.6,l,d))*2.;}\nif(te>0.)discard;\nh+=f*.004*w+.02*(vn(q*2.5)-.5);c*=(1.+.18*f*w)*(.78+.34*vn(q*1.3+4.))*mix(1.,.62,smoothstep(.5,.8,vn(q*.7+11.)))*mix(.45,1.,smoothstep(0.,.06,-te));}`;export{he as A,ee as C,te as D,A as E,ge as O,E as S,ne as T,j as _,ot as a,w as b,nt as c,tt as d,rt as f,D as g,ze as h,it as i,T as k,Be as l,Ze as m,at as n,lt as o,Qe as p,ct as r,ut as s,st as t,et as u,ve as v,O as w,Fe as x,S as y};
@@ -0,0 +1 @@
1
+ import{$ as e,Q as t,dr as n,r}from"./brick-CfuEIQ9e.js";var i=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),a=[1,2,3,4,6].map(t=>{let n=(1+Math.sqrt(5))/2,r=[[-1,n,0],[1,n,0],[-1,-n,0],[1,-n,0],[0,-1,n],[0,1,n],[0,-1,-n],[0,1,-n],[n,0,-1],[n,0,1],[-n,0,-1],[-n,0,1]].map(t=>e(t));return[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]].map(e=>e.map(e=>r[e])).flatMap(([n,r,i])=>{let a=(a,o)=>e(n.map((e,n)=>e+((r[n]-e)*a+(i[n]-e)*o)/t)),o=[];for(let e=0;e<t;e++)for(let n=0;e+n<t;n++)o.push([a(e,n),a(e+1,n),a(e,n+1)]),e+n<t-1&&o.push([a(e+1,n),a(e+1,n+1),a(e,n+1)]);return o})}),o=(o,s,c,l,u,d,f,p)=>{let m=/* @__PURE__ */ new Map,h=(typeof s==`number`?a[s-1]:s).map(e=>e.map(e=>{let t=(e=>e.map(e=>Math.round(1e4*e)).join())(e),n=m.get(t);if(!n){let r=c(e);n={p:r,n:[0,0,0],low:!!p&&r[1]<p(r[0],r[2])-.05},m.set(t,n)}return n}));for(let e of h){let n=r(t(e[1].p,e[0].p),t(e[2].p,e[0].p));e.forEach(e=>e.n=[e.n[0]+n[0],e.n[1]+n[1],e.n[2]+n[2]])}for(let a of h){if(a.every(e=>e.low))continue;let s=r(t(a[1].p,a[0].p),t(a[2].p,a[0].p)),c=Math.abs(s[1])>Math.max(Math.abs(s[0]),Math.abs(s[2])),p=Math.abs(s[0])>Math.abs(s[2]);for(let{p:t,n:r}of a){let a=Math.hypot(...r)>1e-12?e(r):[0,1,0];o.push(...t,...a,...c?[t[0],t[2]]:p?[t[2]+3*d,t[1]]:[t[0]+3*d,t[1]],n.ROCK,.85*f*(.55+.45*i((t[1]-l)/(.3*(u-l)))))}}};export{o as t};
@@ -1 +1 @@
1
- import{ur as e}from"./brick-9u0Ivbak.js";var t,n=Object.keys(e).length,r=(e,t,n)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,144665)|0;return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},i=(e,t,n,i)=>{let[a,o]=[Math.floor(e),Math.floor(t)],[s,c]=[e-a,t-o].map(e=>e*e*(3-2*e)),l=(e,t)=>r((a+e)%n,(o+t)%n,i);return(l(0,0)*(1-s)+l(1,0)*s)*(1-c)+(l(0,1)*(1-s)+l(1,1)*s)*c},a=(e,t,n,r,a)=>{let[o,s]=[0,.5];for(let c=0;c<r;c++,s/=2)o+=s*i(e*(1<<c),t*(1<<c),n<<c,a+c);return o/(1-2*s)},o=(e,t,n)=>e.map((e,r)=>e+(t[r]-e)*n),s=(e,t)=>e.map(e=>e*t),c=e=>Math.min(Math.max(e,0),1),l=2*Math.PI,u=[];u[e.BRICK]=(e,t)=>{let n=Math.floor(8*t),a=4*e+.5*(1&n),[o,l,u]=[Math.floor(a)%4,a%1,8*t%1],d=i(16*e,16*t,16,5),f=.8+.4*d;return l<.05||u<.1?[s([165,160,150],.7+.3*f),.1+.1*d]:[s([170,78,56],(.8+.4*r(o,n,1))*f*(.85+.15*u)),.7+.2*d+.1*c(12*Math.min(l-.05,u-.1))]},u[e.TILE]=(e,t)=>{let[n,a]=[Math.floor(4*e),Math.floor(4*t)],[o,l]=[4*e%1,4*t%1],u=i(16*e,16*t,16,7),d=.9+.2*u;return o<.05||l<.05?[s([85,85,80],d),.1]:[s([196,190,172],d*(.88+.08*(n+a&1)+.1*r(n,a,2))),.8+.1*u+.1*c(14*(Math.min(o,l)-.05))]},u[e.LAVA]=(e,t)=>{let n=a(4*e,4*t,4,4,11),r=Math.max(0,1-7*Math.abs(n-.5))**2;return[o(o([55,8,4],[230,70,8],n),[255,215,90],r),.5]},u[e.STONE]=(e,t)=>{let n=a(8*e,8*t,8,4,3);return[s([128,124,120],.45+.7*(1.3*n+.1*r(Math.floor(128*e),Math.floor(128*t),4))),c(1.4*n-.2)]},u[e.METAL]=(e,t)=>{let[n,a,l,u]=[Math.floor(2*e),Math.floor(2*t),2*e%1,2*t%1],d=c(6*(i(8*e,8*t,8,13)-.68)),f=e=>.4*Math.min(Math.max(Math.round((e-.1)/.4),0),2)+.1,[p,m]=[f(l),f(u)],h=p==m&&p==.5?1:Math.hypot(l-p,u-m),g=c(1-h/.07),_=s([98,108,124],(.9+.2*i(32*e,32*t,32,9)+.12*r(n,a,6))*(1+.3*g)*(.65+.35*c((h-.06)/.04)));return Math.min(l,u,1-l,1-u)<.03?[s([40,44,50],1+d),.05]:[o(_,[105,68,45],.7*d),.5+.1*(1-d)+.4*g]},u[e.WOOD]=(e,t)=>{let n=Math.floor(8*t),a=2*e+2*r(n,0,8),[s,u,d]=[Math.floor(a)%2,a%1,8*t%1],f=r(n,s,3),p=.5+.5*Math.sin(l*(40*t+2.5*i(4*e,4*t,4,21)+7*f));return d<.08||u<.015?[[28,18,10],.05]:[o([92,58,32],[158,106,62],.6*p+.35*f),.7+.15*p+.15*c(15*(d-.08))]},u[e.MOSS]=(e,t)=>{let n=Math.floor(4*t),l=2*e+.5*(1&n),[u,d,f]=[Math.floor(l)%2,l%1,4*t%1],p=Math.min(d,1-d,.5*(f<.5?f:1-f)),m=d<.04||f<.06,h=c(12*(.3*a(12*e,12*t,12,3,17)-.03-p)),g=i(64*e,64*t,64,19),_=s([128,126,118],(.7+.4*r(u,n,5))*(.7+.5*i(16*e,16*t,16,15)));return[o(m?s(_,.45):_,o([52,100,34],[96,148,56],g),h),m?.1+.6*h*g:.6+.2*c(30*p)+.2*h*g]},u[e.GRATE]=(e,t)=>{let[n,r]=[8*e%1,8*t%1],a=Math.max(Math.abs(n-.5),Math.abs(r-.5)),l=Math.min(Math.abs(n-.5),Math.abs(r-.5))>.43,u=i(16*e,16*t,16,23);return a<.36?[[9,9,12],0]:[s(o([104,108,116],[96,80,68],c(4*(u-.55))),(l?1.25:1)-2.2*(.5-a)+.2*u),l?1:.6+.4*c(12*(a-.36))]},u[e.CONCRETE]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],o=a(4*e,4*t,4,3,41),c=r(Math.floor(128*e),Math.floor(128*t),43)>.992,l=Math.hypot(n%.5-.25,i%.5-.25)<.02,u=(.94+.1*o+.03*r(Math.floor(2*e),Math.floor(2*t),44))*(c||l?.9:1);return n<.015||i<.015?[s([160,164,172],u),.3]:[s([206,209,214],u),l?.5:.8+.2*o-(c?.15:0)]},u[e.GLASS]=(e,t)=>{let n=2*e%1,r=((n+.7*t)%1-.5)/.12,i=Math.exp(-r*r);return n<.03||t<.03?[s([150,158,170],1-.3*n),.9]:[o(o([7,20,44],[48,88,136],t**2),[120,160,200],.18*i),.4]},u[e.STEEL]=(e,t)=>{let n=Math.floor(128*t),a=.5*r(n,3,31)+.5*i(8*e,0,8,n+7),o=4*e%1;return o<.03?[[60,66,76],.1]:[s([176,184,196],.8+.35*a+(o>.97?.15:0)),.6+.2*a]},u[e.PAINT]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],a=r(Math.floor(128*e),Math.floor(128*t),47);return n<.02||i<.02?[[200,200,206],.3]:[s([246,246,248],.96+.06*a),.85+.04*a]},u[e.ROCK]=(e,t)=>{let n=a(4*e,4*t,4,4,21),l=c(8*(i(2*e,2*t,2,24)-.55))*Math.max(0,1-110*Math.abs(a(2*e,2*t,2,3,23)-.5)),[u,d]=[Math.floor(64*e),Math.floor(64*t)],[f,p]=[64*e%1-.5,64*t%1-.5],m=r(u,d,25),h=m<.06?c(1-Math.hypot(f,p)/(.2+3*m)):0,g=m>.96?.35:0;return[o(o(o(s([84,82,79],.65+.6*n+.1*r(Math.floor(128*e),Math.floor(128*t),27)),[150,146,140],g),[30,29,28],.7*h),[26,25,24],.7*l),c(.35+.5*n-.3*h-.25*l)]};var d,f,p=()=>t??=m(),m=()=>{let e=new Uint8ClampedArray(128*n*128*4);return u.forEach((t,n)=>{for(let r=0;r<16384;r++){let[i,a]=t(r%128/128,Math.floor(r/128)/128);e.set([...i,255*a],4*(128*n*128+r))}}),e},[h,g]=[6,16],_=()=>{for(;v(););return d},v=()=>{if(d)return!1;let e=(f??=function*(){let e=h,t=e*g,n=3,r=Float64Array.from({length:e*e*e*3},()=>.1+.8*(n=16807*n%2147483647)/2147483647),i=new Uint8Array(t*t*t);for(let n=0;n<t;n++){n%8==7&&(yield);let a=(n+.5)/g,o=Math.floor(a);for(let s=0;s<t;s++){let c=(s+.5)/g,l=Math.floor(c);for(let u=0;u<t;u++){let d=(u+.5)/g,f=Math.floor(d),p=9,m=9;for(let t=o-1;t<=o+1;t++)for(let n=l-1;n<=l+1;n++)for(let i=f-1;i<=f+1;i++){let o=3*((i+e)%e+(n+e)%e*e+(t+e)%e*e*e),s=d-i-r[o],l=c-n-r[o+1],u=a-t-r[o+2],f=s*s+l*l+u*u;f<p?(m=p,p=f):f<m&&(m=f)}i[u+(s+n*t)*t]=255*Math.min(Math.sqrt(m)-Math.sqrt(p),1)}}}return i}()).next();return e.done&&([d,f]=[e.value,void 0]),!e.done};export{_ as a,r as i,h as n,v as o,g as r,p as s,n as t};
1
+ import{dr as e}from"./brick-CfuEIQ9e.js";var t,n=Object.keys(e).length,r=(e,t,n)=>{let r=Math.imul(e,374761393)+Math.imul(t,668265263)+Math.imul(n,144665)|0;return r=Math.imul(r^r>>>13,1274126177),((r^r>>>16)>>>0)/4294967296},i=(e,t,n,i)=>{let[a,o]=[Math.floor(e),Math.floor(t)],[s,c]=[e-a,t-o].map(e=>e*e*(3-2*e)),l=(e,t)=>r((a+e)%n,(o+t)%n,i);return(l(0,0)*(1-s)+l(1,0)*s)*(1-c)+(l(0,1)*(1-s)+l(1,1)*s)*c},a=(e,t,n,r,a)=>{let[o,s]=[0,.5];for(let c=0;c<r;c++,s/=2)o+=s*i(e*(1<<c),t*(1<<c),n<<c,a+c);return o/(1-2*s)},o=(e,t,n)=>e.map((e,r)=>e+(t[r]-e)*n),s=(e,t)=>e.map(e=>e*t),c=e=>Math.min(Math.max(e,0),1),l=2*Math.PI,u=[];u[e.BRICK]=(e,t)=>{let n=Math.floor(8*t),a=4*e+.5*(1&n),[o,l,u]=[Math.floor(a)%4,a%1,8*t%1],d=i(16*e,16*t,16,5),f=.8+.4*d;return l<.05||u<.1?[s([165,160,150],.7+.3*f),.1+.1*d]:[s([170,78,56],(.8+.4*r(o,n,1))*f*(.85+.15*u)),.7+.2*d+.1*c(12*Math.min(l-.05,u-.1))]},u[e.TILE]=(e,t)=>{let[n,a]=[Math.floor(4*e),Math.floor(4*t)],[o,l]=[4*e%1,4*t%1],u=i(16*e,16*t,16,7),d=.9+.2*u;return o<.05||l<.05?[s([85,85,80],d),.1]:[s([196,190,172],d*(.88+.08*(n+a&1)+.1*r(n,a,2))),.8+.1*u+.1*c(14*(Math.min(o,l)-.05))]},u[e.LAVA]=(e,t)=>{let n=a(4*e,4*t,4,4,11),r=Math.max(0,1-7*Math.abs(n-.5))**2;return[o(o([55,8,4],[230,70,8],n),[255,215,90],r),.5]},u[e.STONE]=(e,t)=>{let n=a(8*e,8*t,8,4,3);return[s([128,124,120],.45+.7*(1.3*n+.1*r(Math.floor(128*e),Math.floor(128*t),4))),c(1.4*n-.2)]},u[e.METAL]=(e,t)=>{let[n,a,l,u]=[Math.floor(2*e),Math.floor(2*t),2*e%1,2*t%1],d=c(6*(i(8*e,8*t,8,13)-.68)),f=e=>.4*Math.min(Math.max(Math.round((e-.1)/.4),0),2)+.1,[p,m]=[f(l),f(u)],h=p==m&&p==.5?1:Math.hypot(l-p,u-m),g=c(1-h/.07),_=s([98,108,124],(.9+.2*i(32*e,32*t,32,9)+.12*r(n,a,6))*(1+.3*g)*(.65+.35*c((h-.06)/.04)));return Math.min(l,u,1-l,1-u)<.03?[s([40,44,50],1+d),.05]:[o(_,[105,68,45],.7*d),.5+.1*(1-d)+.4*g]},u[e.WOOD]=(e,t)=>{let n=Math.floor(8*t),a=2*e+2*r(n,0,8),[s,u,d]=[Math.floor(a)%2,a%1,8*t%1],f=r(n,s,3),p=.5+.5*Math.sin(l*(40*t+2.5*i(4*e,4*t,4,21)+7*f));return d<.08||u<.015?[[28,18,10],.05]:[o([92,58,32],[158,106,62],.6*p+.35*f),.7+.15*p+.15*c(15*(d-.08))]},u[e.MOSS]=(e,t)=>{let n=Math.floor(4*t),l=2*e+.5*(1&n),[u,d,f]=[Math.floor(l)%2,l%1,4*t%1],p=Math.min(d,1-d,.5*(f<.5?f:1-f)),m=d<.04||f<.06,h=c(12*(.3*a(12*e,12*t,12,3,17)-.03-p)),g=i(64*e,64*t,64,19),_=s([128,126,118],(.7+.4*r(u,n,5))*(.7+.5*i(16*e,16*t,16,15)));return[o(m?s(_,.45):_,o([52,100,34],[96,148,56],g),h),m?.1+.6*h*g:.6+.2*c(30*p)+.2*h*g]},u[e.GRATE]=(e,t)=>{let[n,r]=[8*e%1,8*t%1],a=Math.max(Math.abs(n-.5),Math.abs(r-.5)),l=Math.min(Math.abs(n-.5),Math.abs(r-.5))>.43,u=i(16*e,16*t,16,23);return a<.36?[[9,9,12],0]:[s(o([104,108,116],[96,80,68],c(4*(u-.55))),(l?1.25:1)-2.2*(.5-a)+.2*u),l?1:.6+.4*c(12*(a-.36))]},u[e.CONCRETE]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],o=a(4*e,4*t,4,3,41),c=r(Math.floor(128*e),Math.floor(128*t),43)>.992,l=Math.hypot(n%.5-.25,i%.5-.25)<.02,u=(.94+.1*o+.03*r(Math.floor(2*e),Math.floor(2*t),44))*(c||l?.9:1);return n<.015||i<.015?[s([160,164,172],u),.3]:[s([206,209,214],u),l?.5:.8+.2*o-(c?.15:0)]},u[e.GLASS]=(e,t)=>{let n=2*e%1,r=((n+.7*t)%1-.5)/.12,i=Math.exp(-r*r);return n<.03||t<.03?[s([150,158,170],1-.3*n),.9]:[o(o([7,20,44],[48,88,136],t**2),[120,160,200],.18*i),.4]},u[e.STEEL]=(e,t)=>{let n=Math.floor(128*t),a=.5*r(n,3,31)+.5*i(8*e,0,8,n+7),o=4*e%1;return o<.03?[[60,66,76],.1]:[s([176,184,196],.8+.35*a+(o>.97?.15:0)),.6+.2*a]},u[e.PAINT]=(e,t)=>{let[n,i]=[2*e%1,2*t%1],a=r(Math.floor(128*e),Math.floor(128*t),47);return n<.02||i<.02?[[200,200,206],.3]:[s([246,246,248],.96+.06*a),.85+.04*a]},u[e.ROCK]=(e,t)=>{let n=a(4*e,4*t,4,4,21),l=c(8*(i(2*e,2*t,2,24)-.55))*Math.max(0,1-110*Math.abs(a(2*e,2*t,2,3,23)-.5)),[u,d]=[Math.floor(64*e),Math.floor(64*t)],[f,p]=[64*e%1-.5,64*t%1-.5],m=r(u,d,25),h=m<.06?c(1-Math.hypot(f,p)/(.2+3*m)):0,g=m>.96?.35:0;return[o(o(o(s([84,82,79],.65+.6*n+.1*r(Math.floor(128*e),Math.floor(128*t),27)),[150,146,140],g),[30,29,28],.7*h),[26,25,24],.7*l),c(.35+.5*n-.3*h-.25*l)]};var d,f,p=()=>t??=m(),m=()=>{let e=new Uint8ClampedArray(128*n*128*4);return u.forEach((t,n)=>{for(let r=0;r<16384;r++){let[i,a]=t(r%128/128,Math.floor(r/128)/128);e.set([...i,255*a],4*(128*n*128+r))}}),e},[h,g]=[6,16],_=()=>{for(;v(););return d},v=()=>{if(d)return!1;let e=(f??=function*(){let e=h,t=e*g,n=3,r=Float64Array.from({length:e*e*e*3},()=>.1+.8*(n=16807*n%2147483647)/2147483647),i=new Uint8Array(t*t*t);for(let n=0;n<t;n++){n%8==7&&(yield);let a=(n+.5)/g,o=Math.floor(a);for(let s=0;s<t;s++){let c=(s+.5)/g,l=Math.floor(c);for(let u=0;u<t;u++){let d=(u+.5)/g,f=Math.floor(d),p=9,m=9;for(let t=o-1;t<=o+1;t++)for(let n=l-1;n<=l+1;n++)for(let i=f-1;i<=f+1;i++){let o=3*((i+e)%e+(n+e)%e*e+(t+e)%e*e*e),s=d-i-r[o],l=c-n-r[o+1],u=a-t-r[o+2],f=s*s+l*l+u*u;f<p?(m=p,p=f):f<m&&(m=f)}i[u+(s+n*t)*t]=255*Math.min(Math.sqrt(m)-Math.sqrt(p),1)}}}return i}()).next();return e.done&&([d,f]=[e.value,void 0]),!e.done};export{_ as a,r as i,h as n,v as o,g as r,p as s,n as t};
@@ -0,0 +1 @@
1
+ import{$ as e,$t as t,Bt as n,F as r,G as i,Ht as a,It as o,J as s,K as c,Lt as l,Mt as u,Nt as d,P as f,Pt as p,Q as m,Rt as h,Ut as g,V as _,Vt as v,Wt as y,X as b,Xt as x,Y as S,Z as C,a as w,an as ee,cn as te,cr as ne,d as re,dr as T,en as ie,i as E,in as ae,k as oe,ln as D,n as O,nn as se,o as ce,on as le,q as ue,r as k,rn as de,rt as A,sn as fe,t as pe,tn as me,tt as he,u as ge,un as j,zt as _e}from"./brick-CfuEIQ9e.js";import{i as M}from"./textures-BQ8WtdV5.js";import{t as ve}from"./stone-BqYQDnkI.js";var ye=[.8,.82,.86],be=[.35,.36,.4],xe=ie.filter(e=>e.min[1]===2.48&&e.max[1]===4),[N,P]=me,F=[N,0,P],I=22.4,Se=[-.6,.6,.53],Ce=[[2,1],[0,2],[0,1]],we=[1.25,1.3,1.4],Te=[.56,.48,.28],Ee=[.04,.04,.05],{CONCRETE:De,METAL:Oe,PAINT:ke}=T,[L,Ae,R,z,je,Me]=[[.86,.87,.9],[.55,.57,.6],[.32,.33,.36],[.07,.075,.085],[.42,.52,.66],[.2,.13,.08]],[B,V,H,Ne,Pe,Fe]=[[.3,.8,1],[.35,1,.5],[1,.7,.25],[1,.2,.15],[.7,.35,1],[1,.35,.85]],Ie=(e,t,n,r=1,[i,a]=Ce[1])=>{for(let o of[0,1,2,0,2,3])e.push(...t[o],...Se),typeof n==`number`?e.push(t[o][i],t[o][a],n,r):e.push(n[0],n[1],-2,n[2])},U=(e,t,n,r,i,a,o)=>Ie(e,[[0,0],[1,0],[1,1],[0,1]].map(([e,a])=>{let o=[0,0,0],[s,c]=[(t+1)%3,(t+2)%3];return[o[t],o[s],o[c]]=[n,(e?i:r)[s],(a?i:r)[c]],o}),a,o,Ce[t]),Le=(e,{min:t,max:n,top:r,side:i},a=0)=>{for(let o=0;o<3;o++)U(e,o,t[o],t,n,i,a+(o==1?.4:1.25-.15*o)),U(e,o,n[o],t,n,o==1?r:i,a+(o==1?1.85:1.25-.15*o))},Re=(e,t)=>{let n=e.length;t();let r=he(e,0);for(let t=n;t<e.length;t+=10){if(r[t+8]==-1){let e=2.2*(.72+.28*r[t+4]-.12*Math.abs(r[t+3]));r[t+6]*=e,r[t+7]*=e,r[t+9]*=e}[r[t+3],r[t+4],r[t+5]]=Se}},ze=(e,t,n,r,i,a)=>{for(let[o,s,c]of[[r,r+.1,0],[i-.1,i,0],[r,i,a-.1]])U(e,t,n,[o,c,o],[s,a,s],we)},Be=(e,t,n,r,i,a,o,s=[])=>{[...s,[i,i,0]].forEach(([i,c,l],u)=>{let[d,f]=[[0,0,0],[0,a,0]];[d[2-t],f[2-t]]=[u?s[u-1][1]:r,i],U(e,t,n,d,f,ke,o),c>i&&([d[1],d[2-t],f[2-t]]=[l,i,c],U(e,t,n,d,f,ke,o))})},Ve=[[-1,96.2,242.65,98.6,242.7,1,2.3,3],[-1,96.2,229.3,98.6,229.35,1,2.3,1],[-1,61.4,242.65,63.8,242.7,1,2.3,3],[-1,61.4,229.3,63.8,229.35,1,2.3,1],[-1,73.3,252.4,73.35,255.4,4.3,5.5,0],[-1,86.65,252.4,86.7,255.4,4.3,5.5,2],[-1,73.3,216.6,73.35,219.6,1,2.3,0],[-1,86.65,216.6,86.7,219.6,1,2.3,2]],He=(t,n,r,i,a,o)=>{let s=he(t,0);for(let c=n;c<t.length;c+=10){let t=[0,1,2].map(e=>s[c+e]-r[e]),n=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];[s[c+3],s[c+4],s[c+5]]=e([0,1,2].map(e=>i[e]+o*(t[e]-n*i[e])/a)),s[c+8]=f}},Ue=[[-A/4-Math.asin(te[0][2]/I),-A/4+Math.asin(te[0][2]/I),te[0][3]],[-Math.acos((D[1].min[0]-N)/I),Math.asin((D[0].max[2]-P)/I),te[1][3]]],We=e=>e.filter((t,n)=>{let r=n-n%30;return Math.max(e[r],e[r+10],e[r+20])>-.49}),Ge=We(c(b([[1,0],[1,1]],12),ye)),Ke=We(c(b([[1.06,0],[1.06,.3]],12),be)),[W,qe]=me,Je=22.4,G=A/48,Ye=[.4,.42,.46],Xe=[.27,.29,.33],[K,Ze,Qe,$e,et,tt,nt]=[[.16,.17,.2],[.6,.62,.66],[1,.8,.45],[.7,.9,1],[1,.6,.2],[1,.12,.08],[.35,1,.5]],rt=[.6,.64,.48],it=c(b([[1,0],[1,1]],6),[1,1,1]),at=c(b([[0,-1],[1,0],[0,1]],6),[1,1,1]),ot=c(b([[0,0],[1,.4],[.93,.42],[0,.12]],12),[.82,.84,.88]),st=(e,t,n,r,i=Ze)=>S(e,it,t,n,rt,1,r,i),ct=(e,t,n,r,i=2.2)=>{let a=e.length;s(e,at,t,pe,[0,0,0],n,r),i&&ge(e,a,i)},lt=(e,t,n)=>w(e,1.8,()=>E(e,[[t-.15,.03,n-.15],[t+.15,.03,n-.15],[t+.15,.03,n+.15],[t-.15,.03,n+.15]],$e,[t,-5,n])),ut=e=>[Je*Math.cos(e*A/40),12*Math.sin(e*A/40)],q=(t,n,r=.02)=>{let i=Math.max(n-5,0),a=Math.floor(i),[o,s]=[ut(a),ut(a+1)],[c,l]=[o[0]+(s[0]-o[0])*(i-a),o[1]+(s[1]-o[1])*(i-a)],u=e([c/Je/Je,l/144,0]),d=c*Math.cos(G/2)/Math.cos((t%G+G)%G-G/2)+r*u[0];return[W+d*Math.cos(t),Math.min(n,5)+l+r*u[1],qe+d*Math.sin(t)]},dt=Ue.map(([e,t])=>[e-.03,t+.03]),ft=e=>!dt.some(([t,n])=>[e,e-A].some(e=>e>t&&e<n)),pt=[...Array.from({length:35},(e,t)=>(2*t+1)*A/70).filter(e=>ft(e-.03)&&ft(e+.03)).map(e=>{let[t,n]=[Math.cos(e),Math.sin(e)];return[W+22.419999999999998*t,4.02,qe+22.419999999999998*n,t,n,.38,0]}),...fe.flatMap(({min:e,max:t})=>[-1,1].flatMap(n=>[-2,2].map(r=>[(n>0?t[0]:e[0])+.02*n,3.1,(e[2]+t[2])/2+r,n,0,.45,1]))).filter(([e,,t])=>!D.some(n=>e>n.min[0]-.5&&e<n.max[0]+.5&&t>n.min[2]-.6&&t<n.max[2]+.6))],mt=(e,[t,n,r,i,a],o,s,c)=>E(e,Array.from({length:12},(e,c)=>{let l=o*Math.cos(c*A/12);return[t+s*i-a*l,n+o*Math.sin(c*A/12),r+s*a+i*l]}),c,[t-i,n,r-a]),ht=(e,[t,n,r,i,a],o,s)=>{let c=e.length,l=e=>{let c=o*Math.cos(e*A/12);return[t+s*i-a*c,n+o*Math.sin(e*A/12),r+s*a+i*c]},u=[t+s*i,n,r+s*a];for(let o=0;o<12;o++)E(e,[u,l(o),l(o+1)],Qe,[t-i,n,r-a]);ge(e,c,.7),He(e,c,u,[i,0,a],o,.8)},[gt,J]=[160,280],Y=[80,0,140],_t=Y,vt=e([.3,.62,-.75]),X=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),Z=(e,t,n)=>{let[r,i]=[Math.floor(e),Math.floor(t)],[a,o]=[e-r,t-i].map(e=>e*e*(3-2*e)),s=(e,t)=>M(r+e,i+t,n);return(s(0,0)*(1-a)+s(1,0)*a)*(1-o)+(s(0,1)*(1-a)+s(1,1)*a)*o},yt=(e,t,n)=>.55*Z(e,t,n)+.3*Z(2*e,2*t,n+1)+.15*Z(4*e,4*t,n+2),bt=c(b([[1,0],[1,1]],6),[.5,.52,.56]),xt=c(b([[0,-1],[1,0],[0,1]],6),[1,1,1]),St=c(b([[0,0],[.5,1.6],[.85,3.5],[1,6],[1,10],[.8,12.5],[.55,14],[0,14]],12),[.9,.9,.92]),Ct=c(b([[0,0],[2.2,.6],[0,.9]],12),[.8,.82,.86]),wt=(t,n,r)=>{let i=e=>e[0]*n[0]+e[1]*n[1]+e[2]*n[2]-r,a=[],o=t.map(e=>{let t=[];return e.forEach((n,r)=>{let o=e[(r+1)%e.length],[s,c]=[i(n),i(o)];if(s<=0&&t.push(n),s*c<0){let e=s/(s-c),r=[n[0]+(o[0]-n[0])*e,n[1]+(o[1]-n[1])*e,n[2]+(o[2]-n[2])*e];t.push(r),a.some(e=>Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])+Math.abs(e[2]-r[2])<1e-9)||a.push(r)}}),t}).filter(e=>e.length>2);if(a.length>2){let t=a.reduce((e,t)=>e.map((e,n)=>e+t[n]/a.length),[0,0,0]),r=e(k(n,Math.abs(n[1])<.9?[0,1,0]:[1,0,0])),i=k(n,r),s=e=>{let n=[e[0]-t[0],e[1]-t[1],e[2]-t[2]];return Math.atan2(n[0]*i[0]+n[1]*i[1]+n[2]*i[2],n[0]*r[0]+n[1]*r[1]+n[2]*r[2])};o.push(a.sort((e,t)=>s(e)-s(t)))}return o},Tt=[0,1,2].flatMap(e=>[-1,1].map(t=>[[-1,-1],[1,-1],[1,1],[-1,1]].map(([n,r])=>{let i=[0,0,0];return i[e]=1.2*t,i[(e+1)%3]=1.2*n,i[(e+2)%3]=1.2*r,i}))),Et=(t,n,[r,i,a],o,s,c=!0)=>{let l=(e,t)=>M(e,t,o),u=wt(Tt,[0,-1,0],.35),d=(e,t,n)=>{let r=Math.sqrt(1-e*e);u=wt(u,[r*Math.cos(t),e,r*Math.sin(t)],n)};d(.92+.08*l(0,1),A*l(0,2),.72+.15*l(0,3));for(let[e,t,n,r,i,a]of[[7,-.4,.2,.62,.2,0],[8,-.05,.25,.74,.18,.3],[6,.45,.3,.6,.2,.6],[c?14:0,-.22,.2,.78,.1,.5],[c?12:0,.24,.2,.76,.1,.15],[c?9:0,.66,.2,.74,.1,.4]])for(let o=0;o<e;o++){let s=10*e+o;d(t+n*l(s,1),A*((o+a+.45*l(s,2))/e),r+i*l(s,3))}let[f,p]=[.8+.4*M(o,1,9),A*M(o,2,9)],[m,h]=[Math.cos(p),Math.sin(p)],g=([e,t,o])=>{let[s,c]=[e*r*f,o*a*(2-f)];return[n[0]+s*m-c*h,n[1]+t*i,n[2]+s*h+c*m]};u.forEach((r,i)=>{let a=r.map(g).filter((e,t,n)=>Math.hypot(...e.map((e,r)=>e-n[(t+n.length-1)%n.length][r]))>1e-5);if(a.length<3)return;let o=e(k([a[1][0]-a[0][0],a[1][1]-a[0][1],a[1][2]-a[0][2]],[a[2][0]-a[0][0],a[2][1]-a[0][1],a[2][2]-a[0][2]]));o[0]*(a[0][0]-n[0])+o[1]*(a[0][1]-n[1])+o[2]*(a[0][2]-n[2])<0&&(a.reverse(),o.forEach((e,t)=>o[t]=-e));let c=e(k(o,Math.abs(o[1])<.9?[0,1,0]:[1,0,0])),u=k(o,c),d=.85*s*(.88+.24*l(i,7))*(.8+.2*Math.sqrt(Math.max(o[1]+1,0)/2)),f=e=>[...e,...o,e[0]*c[0]+e[1]*c[1]+e[2]*c[2]+7*l(0,5),e[0]*u[0]+e[1]*u[1]+e[2]*u[2]+7*l(0,6),T.ROCK,d];for(let e=1;e<a.length-1;e++)t.push(...f(a[0]),...f(a[e]),...f(a[e+1]))})},Dt=(t,n,r,a,o,s,c)=>{let l=k(m(n[1],n[0]),m(n[2],n[0]));if(Math.hypot(...l)<1e-9)return;l=e(l),i(l,m(n[0],r))<0&&(n.reverse(),l=l.map(e=>-e));let u=(n[0][1]+n[1][1]+n[2][1])/3,d=.85*c*(.86+.28*M(t.length,s,7))*(.55+.45*X((u-a)/(.3*(o-a))))*(.82+.18*Math.max(l[1],0));for(let e of n)t.push(...e,...l,...Math.abs(l[1])>.7?[e[0],e[2]]:Math.abs(l[0])>Math.abs(l[2])?[e[2]+3*s,e[1]]:[e[0]+3*s,e[1]],T.ROCK,d)},Ot=(e,t,n,r,i,a)=>{let[o,s,c,l,u,d]=t[0],f=[(o+l)/2,n+.3*(u-n),(c+d)/2],[p,m]=[(i>1?.54:.5)*(l-o),(i>1?.54:.5)*(d-c)];ve(e,i>2?5:i>1?3:l-o>1.4?2:1,e=>{let t=e[1]>0?u-f[1]:f[1]-s,n=[e[0]/p,e[1]/t,e[2]/m].map(e=>e*e),a=i>1?1/Math.sqrt(Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2])):1/Math.sqrt(n[0]+n[1]+n[2]),o=a*(.93+.14*Z(1.3*e[0]+r,1.3*e[2]+e[1],r));return[f[0]+e[0]*o,Math.min(f[1]+e[1]*a,u),f[2]+e[2]*o]},n,u,r,a)},kt=(e,t,n)=>{s(e,c(b([[13,0],[13,.27],[0,.27]],32),[.13,.13,.15]),[t,0,n],pe,[0,0,0],1),re(e,[t,.29,n],7.6,8,[.8,.8,.82]);for(let r=0;r<24;r++){let i=r*A/24,[a,o]=[t+11.6*Math.cos(i),n+11.6*Math.sin(i)],s=(e,t)=>[a+e,.31,o+t];w(e,1.8,()=>E(e,[s(-.25,-.25),s(.25,-.25),s(.25,.25),s(-.25,.25)],r%3?[1,.95,.8]:[1,.45,.1],[a,-5,o]))}},At=(e,t,n,r,i=10,a=[1,.93,.75])=>{s(e,bt,[t,r,n],pe,[0,0,0],[.2,.2,i]),s(e,bt,[t,r,n],pe,[0,0,0],[.5,.5,.5]),w(e,ce,()=>s(e,xt,[t,r+i+.4,n],pe,[0,0,0],[.55,.55,.45],a))},jt=(e,t)=>{let n=(n,r)=>{let[i,a]=[t[n],A*(r+.5*n)/e];return[Math.sqrt(1-i*i)*Math.cos(a),i,Math.sqrt(1-i*i)*Math.sin(a)]},r=[];for(let i=0;i<e;i++){r.push([[0,1,0],n(0,i+1),n(0,i)]);for(let e=0;e+1<t.length;e++)r.push([n(e,i),n(e,i+1),n(e+1,i)],[n(e+1,i),n(e,i+1),n(e+1,i+1)])}return r},Mt=[jt(6,[-.35]),jt(5,[.45,-.35]),jt(9,[.62,.1,-.35])],Nt=[.08,.2,.45],Pt=(e,t,n,r,i,a,o)=>{Ot(e,[[t,a-4,n,r,a,i]],a-3.4,o,3,.9),Ot(e,[[t+.15,-17,n+.15,r-.15,a-3,i-.15]],-15,o+9,2,.5)},Ft=[[0,.02,.6],[.55,.04,.72],[.88,.2,1.05],[1,.24,1.12],[1.4,.015,1]],It=({brushes:e},t,n,r)=>!e.some(e=>e.max[1]>0&&Math.hypot(Math.max(e.min[0]-t,t-e.max[0],0),Math.max(e.min[2]-n,n-e.max[2],0))<r+.5)&&[0,1,2,3,4].every(i=>{let[a,o]=i?[t+r*Math.cos(1.57*i),n+r*Math.sin(1.57*i)]:[t,n];return Math.abs(a-Y[0])<=Y[0]-.5&&Math.abs(o-Y[2])<=Y[2]-.5&&e.some(e=>e.max[1]==0&&a>e.min[0]&&a<e.max[0]&&o>e.min[2]&&o<e.max[2])}),Lt=(e,t)=>{let n=[0,20,40,60,80,120,160,200,240];return[...n.map(t=>e-t).reverse(),...Array.from({length:(t-e)/20-1},(t,n)=>e+20*(n+1)),...n.map(e=>t+e)]},Rt=[[0,0,0,1],[-.6,-.25,0,.9],[-3,-.2,.7,.95],[-7,.1,.9,.85],[-7.4,.8,.9,.5],[-14,1,1.2,.55],[-14.5,1.7,1.2,.3],[-22,2.1,1.5,.34],[-30,5.6,1.5,.12]],zt=(()=>{let e=e=>p[Math.min(Math.max(e,0),p.length-1)],t=[[0,140]];for(let n=0;n<=p.length;n++){let[r,i]=[e(n-1),e(n)];Math.abs(r-i)>.5?t.push([n,148+r],[n,148+i]):t.push([n,148+Math.min(r,i)-.12*M(n,1,71)])}return[...t,[p.length,140]]})(),Bt=[[640,75,4,.17,.02,3],[690,95,3,.16,.03,5],[740,115,3,.15,.04,8]],Vt=(e,t,n,r)=>{let i=(i,a)=>Z(e*n/i+7*r,t*n/i-3*r,r+a),a=n=>{let i=A*M(r,n,97);return e*Math.cos(i)+t*Math.sin(i)},o=Math.max(X((a(1)-.93)/.07),.8*X((a(2)-.95)/.05)),s=Math.max(X((a(3)-.985)/.015),X((a(4)-.985)/.015)),c=1-Math.abs(2*i(150,2)-1);return(.42+.2*i(520,1)+.14*c*c+.24*o)*(1-.5*s)+.1*(i(60,3)-.5)+.04*(i(24,4)-.5)};function*Ht(r){let f=[];(e=>{(e=>{(e=>{let t=Array.from({length:9},(e,t)=>{let n=(t+1)/10*(A/4);return[I*Math.cos(n),5+12*Math.sin(n)]}),n=[];s(n,c(b([[I,0],[I,5],...t,[0,17]],48),ye),[N,0,P],pe,[0,0,0],1);let r=(e,t)=>(t?Math.ceil:Math.floor)(e*48/A)*A/48;for(let t=0;t<n.length;t+=30){let[i,a,o]=[t,t+10,t+20],s=Math.atan2(n[i+2]+n[a+2]+n[o+2]-3*P,n[i]+n[a]+n[o]-3*N);if(Math.max(n[i+1],n[a+1],n[o+1])>5.01||!Ue.some(([e,t])=>s>r(e,0)&&s<r(t,1)))for(let r=t;r<t+30;r++)e.push(n[r])}let i=(e,t)=>[N+I*Math.cos(e),t,P+I*Math.sin(e),Math.cos(e),0,Math.sin(e),ye[0],ye[1],-1,ye[2]];for(let[t,n,a]of Ue){let o=[r(t,0),t];for(let e=Math.ceil(t*48/A);e*A/48<n;e++)o.push(e*A/48);o.push(n,r(n,1)),o.slice(1).forEach((t,n)=>{let r=o[n],s=n&&n<o.length-2?a:0;e.push(...i(r,s),...i(t,s),...i(t,5),...i(r,s),...i(t,5),...i(r,5))})}let a=(e,t,n)=>[N+(I+n)*Math.cos(e),t,P+(I+n)*Math.sin(e)];for(let t=0;t<70;t++){let n=t*A/70,r=n>A/2?n-A:n;if(Ue.some(([e,t])=>r>e-.04&&r<t+.04))continue;let i=(e,t,r,i)=>[[-e,t],[e,t],[e,r],[-e,r]].map(([e,t])=>a(n+e/I,t,i));E(e,i(.72,1.5,2.9,.04),[.06,.06,.08],[N,2.2,P]);let o=e.length;w(e,.56,()=>E(e,i(.6,1.7,2.7,.07),[1,.85,.5],[N,2.2,P])),He(e,o,a(n,2.2,.07),[Math.cos(n),0,Math.sin(n)],.6,.25)}let[,o,l,u,d]=te[0],f=P+o-d;for(let[t,n,r]of[[-l-.3,-l-.02,0],[l+.02,l+.3,0],[-l-.3,l+.3,u]])O(e,[N+t,r,f-.1],[N+n,u+.3,f+.5],be),U(e,2,f-.12,[N+t+.09,r+.09,0],[N+n-.09,u+.21,0],we)})(e),(e=>{let t=[...de,...de.map(([e,t])=>[t,e]).reverse()];for(let[n,r]of t)U(e,1,.02,[N-n,0,P-r],[N+n,0,P+r],De,1.85);let n=t.flatMap(([e,n],r)=>[[e,n],...t[r+1]?[[t[r+1][0],n]]:[]]),r=[...n,...n.map(([e,t])=>[-e,t]).reverse(),...n.map(([e,t])=>[-e,-t]),...n.map(([e,t])=>[e,-t]).reverse()];r.forEach((t,n)=>{let i=r[(n+1)%r.length],a=t[0]==i[0]?0:2,o=2-a,[s,c]=[F[a]+t[a/2],Math.sign(t[a/2])],[l,u]=[t[o/2],i[o/2]].sort((e,t)=>e-t),d=te.find(e=>e[a/2]==t[a/2]&&e[o/2]>l&&e[o/2]<u),[f,p,m,h]=d?[d[o/2],d[2],d[3],d[4]]:[l,0,0,0],g=(t,n,r,i,l,u=0,d=0)=>{let[f,p]=[[0,r,0],[0,i,0]];[f[o],p[o]]=[F[o]+t,F[o]+n],U(e,a,s-c*d,f,p,l,u)};Be(e,a,s,F[o]+l,F[o]+u,8,1.7,d&&[[F[o]+f-p,F[o]+f+p,m]]),g(l,u,0,.25,Ee,0,.02),g(l,u,7.4,7.6,we,0,.03);let _=u-l>6?Math.floor((u-l)/2.4):0;for(let e=0;e<_;e++){let t=l+(u-l)*(e+.5)/_;for(let e of[1.5,4.9])(e>m||Math.abs(t-f)>p+.8)&&(g(t-.72,t+.72,e,e+1.4,Ee,0,.02),g(t-.6,t+.6,e+.2,e+1.2,Te,0,.04))}let v=Math.ceil((u-l)/4.2);for(let n=0;n<v;n++){let r=(e,n)=>{let r=[0,8,0];[r[a],r[o]]=[t[a/2],l+(u-l)*e/v];let i=n?21.55/Math.hypot(r[0],r[2]):1;return[N+r[0]*i,8,P+r[2]*i]};Ie(e,[r(n,0),r(n+1,0),r(n+1,1),r(n,1)],De,1)}if(d){let[t,n]=[[0,0,0],[0,m,0]];[t[a],n[a]]=[s,s+c*h].sort((e,t)=>e-t),[t[o],n[o]]=[F[o]+f-p,F[o]+f+p],U(e,o,t[o],t,n,ke,1.4),U(e,o,n[o],t,n,ke,1.4),U(e,1,m,t,n,ke,.9),U(e,1,.02,t,n,De,1.85),ze(e,a,s-.03*c,t[o],n[o],m)}});let[i,a,o]=[32,6,Math.asin(3/11.7)],s=(e,t)=>{let[n,r]=[o+(A/4-o)*t/a,e*A/i],s=(I-.3)*Math.cos(n);return[N+s*Math.cos(r),5+11.7*Math.sin(n),P+s*Math.sin(r)]};for(let t=0;t<a;t++)for(let n=0;n<i;n++){let r=.31-.028*t-.018*(n+t&1);Ie(e,[s(n,t),s(n+1,t),s(n+1,t+1),s(n,t+1)],[r,r,1.06*r])}for(let t=0;t<16;t+=2){let n=e=>[N+3*Math.cos(e*A/16),16.2,P+3*Math.sin(e*A/16)];Ie(e,[[N,16.2,P],n(t),n(t+1),n(t+2)],we)}se.forEach(t=>Le(e,t))})(e),(e=>{D.forEach(({min:t,max:n},r)=>{let i=r?2:0,[a,o,s]=[t[i],r?D[0].min[2]:n[i],(t[2-i]+n[2-i])/2],c=e=>i?[s,1.75,e]:[e,1.75,s],l=(n[2-i]-t[2-i])/2+.1;S(e,Ge,c(a),c(o),[0,1,0],1,[1.75,l]);for(let t=5;t<o-a-1;t+=5)S(e,Ke,c(a+t),c(a+t+.3),[0,1,0],.3,[1.75,l]);Be(e,2-i,t[2-i]+j+.02,a,o,ae,1.4),Be(e,2-i,n[2-i]-j-.02,r?a:D[1].min[0],o,ae,1.4),U(e,1,ae-.01,t,n,ke,.9);let[u,d]=[[...t],[...n]];[u[2-i],d[2-i]]=[s-.15,s+.15],U(e,1,ae-.02,u,d,we)})})(e),(e=>{for(let{min:t,max:n}of fe){let r=[(t[0]+n[0])/2,2.5,(t[2]+n[2])/2];for(let i of[-1,1]){let a=i>0?n[2]:t[2];for(let n=0;n<7;n++){let o=t[0]+1+2*n;if(xe.some(e=>Math.abs(e.min[2]-a)<1&&o+.72>e.min[0]&&o-.72<e.max[0]))continue;let s=(e,t,n,r)=>[[-e,t],[e,t],[e,n],[-e,n]].map(([e,t])=>[o+e,t,a+i*r]);E(e,s(.72,2.6,3.8,.02),[.06,.06,.08],r);let c=e.length;w(e,.5,()=>E(e,s(.6,2.7,3.7,.04),[.9,.95,1],r)),He(e,c,[o,3.2,a+.04*i],[0,0,i],.6,.25),Ie(e,s(.56,2.6,3.8,-j-.04),Ee),Ie(e,s(.46,2.7,3.7,-j-.06),[.45,.48,.5])}}for(let r of[0,2])for(let[i,a]of[[t[r],j+.02],[n[r]-j,-.02]])Be(e,r,i+a,t[2-r]+j,n[2-r]-j,4,1.5,xe.filter(e=>Math.abs(e.min[r]-i)<.01).map(e=>[e.min[2-r],e.max[2-r],ae]));U(e,1,3.99,t,n,ke,.9);for(let i=0;i<3;i++){let a=t[0]+(n[0]-t[0])*(i+.5)/3;U(e,1,3.98,[a-1.2,0,r[2]-.3],[a+1.2,0,r[2]+.3],we)}}})(e);for(let{min:t,max:n}of[...fe,...D])U(e,1,.02,t,n,Oe,1.99);for(let{min:t,max:n}of xe){let r=n[0]-t[0]<1?0:2;for(let i of[t[r]-.02,n[r]+.02])ze(e,r,i,t[2-r],n[2-r],t[1])}})(e),(e=>{(e=>{let t=(t,n=Ye)=>E(e,t,n,[W,5,qe]),n=(e,n,r,i,a,o)=>{for(let s=e;s<n-1e-9;){let e=Math.min(n,(Math.floor(s/G+1e-9)+1)*G);t([q(s,r,o),q(e,r,o),q(e,i,o),q(s,i,o)],a),s=e}};for(let[t,r]of[[dt[0][1],dt[1][0]],[dt[1][1],dt[0][0]+A]])n(t,r,0,.45,K),w(e,1.6,()=>n(t,r,.16,.3,$e,.035)),n(t,r,3.18,3.32);n(0,A,4.55,5.01,K,.03),[.4,1.9,2.5,3.7,5.2].forEach(e=>n(e,e+.05,4.68,4.86,Ze,.045));for(let e=0;e<70;e++){let n=(e+.5)*A/70,r=.07/Je;ft(n)&&[0,2].includes(e%5)&&t([q(n-r,.45),q(n+r,.45),q(n+r,4.55),q(n-r,4.55)])}let r=(e,n=.1,r,i=.03)=>e.slice(1).forEach(([a,o],s)=>{let[c,l]=e[s],u=Math.max(Math.abs(a-c),Math.abs(o-l)),d=(e,t)=>{let[r,s]=[c+(a-c)*e/u,l+(o-l)*e/u];return a==c?q(r*G+t*n/ut(s)[0],5+s,i):q(r*G,5+s+t*n/2.5,i)};for(let e=0;e<u;e++)t([d(e,-1),d(e,1),d(e+1,1),d(e+1,-1)],r)});for(let t=0;t<12;t++){let n=4*t;r([[n,0],[n,9]],.22,Xe,.05),1&t?(w(e,1.6,()=>r([[n,1],[n,8]],.04,$e,.065)),r([[n,4],[n+2,2],[n+4,4]]),r([[n,6],[n+1,7],[n+3,7],[n+4,6]])):(r([[n,2],[n+1,3],[n+3,3],[n+4,2]]),r([[n+1,3],[n+1,5],[n+2,6],[n+3,5],[n+3,3]]))}n(0,A,13.75,14.15,Xe,.05),w(e,1.6,()=>n(0,A,13.9,14,$e,.065));for(let[t,r]of[[5,0],[22,1],[34,0]])n(t*G+.02,(t+2)*G-.02,5.25+r,5.8+r,K,.03),w(e,2,()=>n(t*G+.04,t*G+.05,5.65+r,5.72+r,nt,.045));let[,i,a,o,s]=te[0],c=qe+i-s;for(let[t,n,r]of[[-a-.62,-a-.3,0],[a+.3,a+.62,0],[-a-.62,a+.62,o+.3]])O(e,[W+t,r,c-.04],[W+n,o+.62,c+.6],K),w(e,1.5,()=>E(e,[[t+.1,r+.1],[n-.1,r+.1],[n-.1,o+.52],[t+.1,o+.52]].map(([e,t])=>[W+e,t,c-.055]),et,[W,1,qe]));for(let t=1;t<7;t++)for(let n of[-2.6,2.6])lt(e,W+n,c-2.5*t);let l=(e,t=0,n=0)=>[W+t,e,qe+n];ct(e,l(17),.7,K,0),st(e,l(17),l(25.099999999999998),.11),[1.9,1.5,1.1].forEach((t,n)=>{let r=20+1.6*n;st(e,1&n?l(r,0,-t):l(r,-t),1&n?l(r,0,t):l(r,t),.06)}),ct(e,l(25.4),.34,tt)})(e),(e=>{D.forEach(({min:t,max:n},r)=>{let i=r?2:0,a=2-i,[o,s]=[t[i],r?D[0].min[2]:n[i]];for(let r=1;o+5*r/3<s-1;r++)if(r%3){let[s,c]=[[0,0,0],[0,3.53,0]];[s[i],c[i]]=[o+5*r/3-.06,o+5*r/3+.06];for(let r of[0,1]){s[a]=r?n[a]:t[a]-.12,c[a]=s[a]+.12,O(e,s,c,Ye,12|(i?32:2)>>r);let o=r?c[a]+.015:s[a]-.015;w(e,1.8,()=>E(e,[[s[i]+.015,2.7],[c[i]-.015,2.7],[c[i]-.015,2.9],[s[i]+.015,2.9]].map(([e,t])=>{let n=[0,t,0];return[n[i],n[a]]=[e,o],n}),$e,[(t[0]+n[0])/2,2.8,(t[2]+n[2])/2]))}[s[a],c[a],s[1]]=[t[a]-.12,n[a]+.12,3.5],O(e,s,c,Ye,4|(i?48:3))}})})(e),(e=>{fe.forEach(({min:t,max:n},r)=>{for(let r of[0,2]){let i=2-r;for(let a of[-1,1]){let o=a>0?n[r]:t[r],s=(r?1:16)*(a>0?1:2),c=(e,t,n)=>{let s=[0,t,0];return[s[r],s[i]]=[o+a*n,e],s},l=(t,n,r,i=0)=>O(e,t.map((e,t)=>Math.min(e,n[t])),t.map((e,t)=>Math.max(e,n[t])),r,i),u=(t,n,r,i,a,o)=>E(e,[c(t,n,a),c(r,n,a),c(r,i,a),c(t,i,a)],o,c(t,n,-1)),[d]=xe.filter(e=>Math.abs((a>0?e.max[r]:e.min[r])-o)<.01&&e.min[i]>t[i]&&e.max[i]<n[i]).map(e=>{let t=(e.min[i]+e.max[i])/2;return e.max[i]-e.min[i]>3?[t-2.25,t+2.25,3.62,0]:[t-1.32,t+1.32,ae+.14,t]});l(c(t[i]-.06,4.7,0),c(n[i]+.06,5,.06),K,s|(r?48:3));for(let[e,r]of d?[[t[i],d[0]],[d[1],n[i]]]:[[t[i],n[i]]])l(c(e,0,0),c(r,.3,.04),Ye,4|s);let f=(t[i]+n[i])/2;for(let i of r?[1,-1]:[]){let r=i>0?t[0]:n[0],a=d?d[i>0?0:1]:f-.8*i;(a-r)*i>4.2&&(u(r,1,r+3*i,1.1,.02,Ye),u(r+4*i,2,a,2.1,.02,Ye),E(e,[c(r+3*i,1,.02),c(r+4*i,2,.02),c(r+4*i,2.1,.02),c(r+3*i,1.1,.02)],Ye,c(r,1,-1)))}if(r&&w(e,1.6,()=>u(t[0]+.3,4.82,n[0]-.3,4.9,.075,$e)),!r&&!d){u(f-1.1,.9,f+1.1,1.9,.02,K);for(let e=0;e<4;e++)u(f-1,1.05+.2*e,f+1,1.15+.2*e,.035,Ze)}if(d?.[3]){let t=d[3];l(c(t-.5,2.95,0),c(t+.5,3.05,.22),K,s),w(e,1.8,()=>l(c(t-.4,2.83,0),c(t+.4,2.95,.12),Qe,8|s)),l(c(t-.05,4.1,0),c(t+.05,4.2,.5),K,s),l(c(t-.5,4.2,.32),c(t+.5,4.42,.5),Ze),w(e,2,()=>u(t-.42,4.27,t-.3,4.35,.515,nt)),st(e,c(t+.35,4.42,.41),c(t+.35,5.4,.41),.03),ct(e,c(t+.35,5.45,.41),.07,tt);for(let n of[1.5,3.5,5.5])for(let r of[t-1.5,t+1.5]){let[t,,i]=c(r,0,n);lt(e,t,i)}}}}if(r){let r=n[0]-.7;O(e,[r-.3,5,t[2]+2],[r+.3,5.2,n[2]-2],K),[3.4,4.6,2.8].forEach((n,i)=>{let a=t[2]+2.5+1.5*i;st(e,[r,5.2,a],[r,5.2+n,a],.04),ct(e,[r,5.26+n,a],.07,1&i?tt:$e)})}else{let r=[n[0]-1.4,6.35,t[2]+1.4],i=e=>[r[0]+.6*e,r[1]+.8*e,r[2]];O(e,[r[0]-.4,5,r[2]-.4],[r[0]+.4,5.12,r[2]+.4],K),st(e,[r[0],5,r[2]],r,.16),ct(e,r,.26,K,0),S(e,ot,i(.1),i(1.1),rt,1,1.15),st(e,i(.2),i(1.05),.03),ct(e,i(1.1),.08,tt)}})})(e),(e=>{for(let t of pt){let n=t[5];if(mt(e,t,n+.1,0,K),ht(e,t,n,.015),t[6]){let r=e.length,i=[t[0],t[1],t[2],-t[3],-t[4]];mt(e,i,n+.1,j+.06,[.04,.04,.05]),mt(e,i,n,j+.08,[.45,.48,.5]);for(let t=r;t<e.length;t+=10)[e[t+3],e[t+4],e[t+5],e[t+8]]=[...Se,-2]}}})(e)})(e);for(let[t,n]of d.pads.slice(0,d.pads.length/2))kt(e,t,n);for(let[t,n]of d.masts.slice(0,d.masts.length/2))At(e,t,n,0)})(f),r.relief&&((t,n)=>{let{at:r}=n.relief,i=zt,a=(e,t)=>Math.max(r(e,Math.max(t,148)),0),o=e=>X(4*(Z(e/6,.5,82)-.35))*(.55+.45*Z(e/1.7,.5,83)),s=([e,t],n)=>{let[r,i,s]=Rt[n];return[e,n?r:a(e,t),t-i-s*o(e)*+!!n]};for(let n=0;n<i.length-1;n++){let[r,a]=[i[n],i[n+1]];for(let i=0;i<Rt.length-1;i++){let c=[s(r,i),s(a,i),s(a,i+1),s(r,i+1)];for(let[s,l,u]of n+i&1?[[0,1,2],[0,2,3]]:[[0,1,3],[1,2,3]]){let d=k(m(c[l],c[s]),m(c[u],c[s]));if(Math.hypot(...d)<1e-9)continue;d=e(d),d=d[2]>0||Math.abs(d[2])<1e-9&&d[1]<0?d.map(e=>-e):d;let f=Rt[i][3]*(.82+.3*M(n,i,73))*(.7+.3*o((r[0]+a[0])/2));for(let e of[c[s],c[l],c[u]])t.push(...e,...d,e[0]+e[2],e[1],T.ROCK,f)}}}d.pillars.forEach(([e,n,r,i,a],o)=>n>140&&Pt(t,e,n,r,i,a,o+400)),E(t,[[-2,-30,140],[162,-30,140],[162,-30,158],[-2,-30,158]],[.012,.012,.015]);for(let e=0;e<9;e++){let n=6+17*e+8*M(e,1,77);w(t,.1,()=>E(t,[[n,-29.9,140],[n+9+6*M(e,2,77),-29.9,140],[n+5,-29.9,140.25+.3*M(e,3,77)]],[.2,.55,1]));let r=1.5+2.5*M(e,4,77);Et(t,[n,-29.6,142.5+5*M(e,5,77)],[r,.7*r,r],e+200,.25,!1)}})(f,r);let g=r.relief?.at??(()=>0);d.crags.forEach(e=>((e,{at:[t,n,r],R:i,H:o,s},c)=>{let{reach:l}=a(s,i,o),u=[t,n+v(o),r];ve(e,i<1.5?3:i<2.5?4:5,e=>{let t=l(e);return[u[0]+e[0]*t,u[1]+e[1]*t,u[2]+e[2]*t]},n,n+o,s,.8+.4*M(s,5,41),c)})(f,e,g));let _=f.concat((e=>{let t=[];for(let n=0;n<e.length;n+=30)for(let r of[0,2,1]){let i=n+10*r;t.push(e[i],e[i+1],J-e[i+2],e[i+3],e[i+4],-e[i+5],...e.slice(i+6,i+10))}return t})(f));yield,r.relief&&((e,r)=>{for(let[i,a,o,s,c]of(e=>{let r=t(e.relief),[i,a,o,s]=r.bound,c=(e,t)=>{if(e>r.hole[0]-.3&&e<r.hole[2]+.3&&t>r.hole[1]-.3&&t<r.hole[3]+.3||r.pits.some(n=>e>=n[0]-.3&&e<=n[2]+.3&&t>=n[1]-.3&&t<=n[3]+.3))return NaN;let[n,i]=[(e-r.x0)/r.cell,(t-r.z0)/r.cell],[a,o]=[Math.floor(n),Math.floor(i)],[s,c]=[n-a,i-o],l=a+o*r.nx,[u,d,f,p]=[r.h[l],r.h[l+1],r.h[l+r.nx],r.h[l+r.nx+1]];return s>=c?u+(d-u)*s+(p-d)*c:u+(f-u)*c+(p-f)*s},l=[],f=(e,t,r,f=1)=>{if(((e,t)=>{let r=t-J/2,l=([t,n,i,a])=>Math.hypot(Math.max(t-e,e-i,0),Math.max(n-r,r-a,0));return r>.3&&Math.hypot((e-i)/o,(t-a)/s)<.97&&!u.some(e=>l(e)<2.5)&&!n.some(e=>l(e)<1)&&!d.pits.some(n=>Math.abs(e-n.x)<h+.5&&Math.abs(t-n.z)<h+.5)&&!d.crags.some(n=>Math.hypot(e-n.at[0],t-n.at[2])<1.3*n.R)&&Number.isFinite(c(e,t))})(e,t)){let n=M(r,3,211);l.push([e,c(e,t),t,n<.62?0:n<.945+.055*(1-f)?1:2,r])}};d.sites.forEach(([e,t,n],r)=>{for(let i=0;i<Math.round(8+5*n);i++){let a=e=>M(r,5*i+e,201),o=n*(.1+1.7*a(1)*a(1));f(e+o*Math.cos(A*a(2)),t+o*Math.sin(A*a(2)),1e3*r+i)}}),d.crags.forEach(({at:[e,,t],R:n},r)=>{for(let i=0;i<Math.round(8+5*n);i++){let a=e=>M(r,5*i+e,215),o=n*(1.32+.75*a(1)*a(1));f(e+o*Math.cos(A*a(2)),t+o*Math.sin(A*a(2)),5e5+1e3*r+i)}}),d.bowls.forEach(([e,t,n],r)=>{for(let i=0;t>=J/2&&i<Math.round(1.1*n);i++){let a=e=>M(r,5*i+e,203),o=i%5<2?.94+.16*a(1):1.15+1.25*a(1)*a(1);f(e+o*n*Math.cos(A*a(2)),t+o*n*Math.sin(A*a(2)),1e5+1e3*r+i)}});for(let e=0;e<60;e++){let t=t=>M(e,t,205),n=1+158*t(1),r=p[Math.floor(n)];f(n,J/2+8+Math.max(r,0)+.5+2.5*t(2)*t(2),2e5+e,.5)}for(let e=0;e<18;e++){let t=t=>M(e,t,207),[n,r,a]=[i+o*(1.8*t(1)-.9),J/2+4+(s-8)*t(2),A*t(3)];for(let i=0;i<10+12*t(4);i++)a+=.5*(M(e,10+i,208)-.5),[n,r]=[n+(1+1.4*M(e,40+i,208))*Math.cos(a),r+(1+1.4*M(e,40+i,208))*Math.sin(a)],f(n+.8*(M(e,70+i,208)-.5),r+.8*(M(e,100+i,208)-.5),3e5+100*e+i,.6)}for(let e=0;e<520;e++){let t=t=>M(e,t,209),[n,r]=[i+o*(2*t(1)-1),J/2+s*t(2)];(Z(n/20,r/20,77)>.62||t(3)<.04)&&f(n,r,4e5+e,.7)}return[...l,...l.map(([e,,t,n,r])=>[e,c(e,J-t),J-t,n,r])]})(r)){let t=e=>M(c,e,213),n=Nt[s]*(.88+.24*t(1)),[r,l,u]=[n/2,n/2*(.65+.35*t(2)),n*(.5+.3*t(3))],[d,f]=[Math.cos(A*t(4)),Math.sin(A*t(4))],p=a+.1*u;ve(e,Mt[s],e=>{let[t,n]=[e[0]*d+e[2]*f,e[2]*d-e[0]*f],a=(.9+.2*Z(1.3*e[0]+c,1.3*e[2]+e[1],c%97))/Math.hypot(t/r,2*e[1]/u,n/l);return[i+e[0]*a,p+e[1]*a,o+e[2]*a]},a,p+u/2,c,.5+.25*t(5))}})(_,r);for(let[e,t,n,r,i]of d.pillars)t<140&&r>140&&Pt(_,e,t,n,r,i,401);return((e,n)=>{let r={relief:n.relief&&t(n.relief)},i=(e,t,i)=>!n.relief||Array.from({length:17},(e,t)=>t*A/16).every((n,a)=>x(r,e+(a?i*Math.cos(n):0),t+(a?i*Math.sin(n):0))===0);for(let t=0,r=0;r<72&&t<900;t++){let[a,o,s]=[gt*M(t,1,61),J*M(t,2,61),.6+2*M(t,3,61)**2];if(!It(n,a,o,1.5*s)||!i(a,o,1.5*s)||Math.abs(o-Y[2])<24||(n.rovers??[]).some(([e,,t])=>Math.hypot(a-e,o-t)<6))continue;r++;let c=(e,n)=>{let[r,i,c]=Ft[e],[l,u]=[r*(e&&e<4?.86+.28*M(t,n%12,67):1),e===2||e===3?i*(.55+.45*M(t,n%12,68)):i],d=n*A/12,[f,p]=[Math.cos(d),Math.sin(d)],[m,h]=[Ft[Math.max(e-1,0)],Ft[Math.min(e+1,Ft.length-1)]],g=-3*(h[1]-m[1])/((h[0]-m[0])*s),_=Math.hypot(g,1),[v,y]=[a+f*l*s,o+p*l*s];return[v,u,y,g*f/_,1/_,g*p/_,v,y,T.STONE,c]};for(let t=0;t<Ft.length-1;t++)for(let n=0;n<12;n++){let[r,i,a,o]=[c(t,n),c(t+1,n),c(t+1,n+1),c(t,n+1)];e.push(...r,...a,...i,...r,...o,...a)}}})(_,r),yield,r.relief&&(((t,n)=>{let{at:r}=n.relief,i=(e,t)=>r(e,Math.max(t,148));for(let n of[1,-1]){let r=(t,r)=>{let a=e([i(t-1,r)-i(t+1,r),2,n*(i(t,r-1)-i(t,r+1))]);return[t,Math.max(i(t,r),0),140+n*(r-140),...a,t,140+n*(r-140),T.STONE,1]};for(let e=0;e<zt.length-1;e++){let[n,i]=[zt[e],zt[e+1]];if(n[0]!==i[0]){let[e,a,o,s]=[r(n[0],156),r(i[0],156),r(i[0],i[1]),r(n[0],n[1])];t.push(...e,...o,...a,...e,...s,...o)}}}})(_,r),(t=>{for(let[n,{x:r,z:i,level:a,rows:s}]of d.pits.entries()){let c=(e,t)=>s[e]?.[2+t]??0,u=Array.from({length:s.length+1},(e,t)=>[s[0][0]+t,-Math.min(c(t-1,0),c(t,0)),Math.min(c(t-1,1),c(t,1))]),d=(e,t)=>[e,a,t,0,1,0,e,t,T.STONE,.6+.4*X((Math.hypot(e-r,t-i)-l)/3)],f=(e,n,r,i)=>t.push(...e,...r,...n,...e,...i,...r);for(let[e,t]of[[i-h,i-l],[i+l,i+h]])for(let n=r-h;n<r+h;n+=2)f(d(n,e),d(n+2,e),d(n+2,t),d(n,t));for(let s=0;s<u.length-1;s++){let[[c,l,p],[m,g,_]]=[u[s],u[s+1]];f(d(r-h,c),d(r+l,c),d(r+g,m),d(r-h,m)),f(d(r+p,c),d(r+h,c),d(r+h,m),d(r+_,m));for(let c of[1,2]){let l=[a,a-.6,a-5,a-10,o],d=(e,t)=>[r+e[c]+(c>1?-1:1)*(t&&t<4?.9*M(e[0],t,83+c)-.25:0),l[t],e[0]];for(let f=0;f<4;f++){let p=[d(u[s],f),d(u[s+1],f),d(u[s+1],f+1),d(u[s],f+1)],m=[r+(c>1?99:-99),l[f],i],h=t.length;Dt(t,[p[0],p[1],p[2]],m,o-12,a,n+f,1.2),Dt(t,[p[0],p[2],p[3]],m,o-12,a,n+f,1.2);for(let n=h+3;n<t.length;n+=10){let r=e([t[n],t[n+1]+.9,t[n+2]]);[t[n],t[n+1],t[n+2]]=r}}}}let p=(e,t)=>[e,o,t,0,1,0,e,t,T.STONE,.5];f(p(r-l-1.5,i-l),p(r+l+1.5,i-l),p(r+l+1.5,i+l),p(r-l-1.5,i+l));let m=s[l][3],g=(a-o)/_e;for(let e=0;e<_e-1;e++){let a=r+m-1.3*(_e-1-e);Ot(t,[[a,o-1,i-1,a+1.3,o+g*(e+1),i+1]],o,9*n+e,2,.9)}for(let e=0;e<20;e++){let o=A*(e+M(n,e,85))/20,[s,c,u]=[r+(l+1.6)*Math.cos(o),i+(l+1.6)*Math.sin(o),.3+.35*M(n,e,86)];Ot(t,[[s-u,a-.3,c-u,s+u,a+.9*u,c+u]],a,40*n+e,1,.9)}}})(_),yield,((e,n)=>{let{at:r}=n.relief,i={relief:t(n.relief)};d.bowls.forEach(([t,n,a],o)=>{let s=a<12?0:Math.round(A*a/1.5),c=Array.from({length:s},(e,i)=>{let[o,c]=[Math.cos(A*i/s),Math.sin(A*i/s)],[l,u]=[a,-1/0];for(let e=.8*a;e<1.3*a;e+=.5){let i=r(t+o*e,n+c*e);[l,u]=i>u?[e,i]:[l,u]}return l}),l=Array.from({length:s},(e,r)=>{let[a,l]=[Math.cos(A*r/s),Math.sin(A*r/s)],u=[-2,-1,0,1,2].reduce((e,t)=>e+c[(r+t+s)%s],0)/5,d=M(r,o,87);return[-2.4,-1.2,0,1.2,2.4].map((e,s)=>{let[c,f]=[t+a*(u+e),n+l*(u+e)],p=[.04,.12,.1+.15*d,.1,.04][s],m=[.62+.3*M(r>>1,o,88),.9,1.22+.2*d,1.1,1][s];return[c,x(i,c,f)+p,f,0,1,0,c,f,T.STONE,m]})});l.forEach((t,n)=>{let r=l[(n+1)%s];for(let n=0;n<4;n++)[t[n],t[n+1],r[n],r[n+1]].every(e=>Number.isFinite(e[1]))&&e.push(...t[n],...r[n+1],...r[n],...t[n],...t[n+1],...r[n+1])})})})(_,r),yield,((n,r)=>{let i=t(r.relief),[a,o,s,c]=i.bound,[l,u]=[Lt(i.x0,a+s),Lt(i.z0,o+c)],f=(e,t)=>{let[n,a]=[(e-i.x0)/i.cell,(t-i.z0)/i.cell];return n%1||a%1||n<0||a<0||n>=i.nx||a>=i.nz?r.relief.at(e,t):i.h[n+a*i.nx]},p=(e,t)=>d.bowls.reduce((n,[r,i,a])=>{let o=Math.hypot(e-r,t-i),s=o/a,c=Z((e-r)/o*5+r,(t-i)/o*5+i,19);return s>1.05&&s<2.4?n+.22*X(5*(c-.55))*X((2.4-s)/.9)*X(6*(s-1.05)):n},0),m=/* @__PURE__ */ new Map,g=(t,n)=>{let r=4096*t+n,i=m.get(r);if(!i){let a=f(t,n),o=[f(t-4,n)-f(t+4,n),f(t,n-4)-f(t,n+4)],s=a===0&&o[0]===0&&o[1]===0,c=e=>s?0:1.4*(M(t,n,131+e)-.5);i=[t,a,n,...e([o[0]+c(0),8,o[1]+c(1)]),t,n,T.STONE,Math.min(Math.max(1+a/60,.78),1.2)+p(t,n)],m.set(r,i)}return i},_=(e,t)=>{let[n,r,i,d]=[l[e],l[e+1],u[t],u[t+1]];if(!(n<r&&i<d))return 0;let f=Math.hypot((Math.min(Math.max(a,n),r)-a)/s,(Math.min(Math.max(o,i),d)-o)/c);return f<1?2:+(f<1.65)};for(let e=0;e<l.length-1;e++)for(let t=0;t<u.length-1;t++){let[r,a,o,s,c]=[l[e],l[e+1],u[t],u[t+1],_(e,t)];if(c>1)for(let e=r;e<a;e+=i.cell)for(let t=o;t<s;t+=i.cell){if(e>=i.hole[0]&&e<i.hole[2]&&t>=i.hole[1]-8&&t<i.hole[3]+8||d.pits.some(n=>e>=n.x-h&&e<n.x+h&&t>=n.z-h&&t<n.z+h))continue;let[r,a,o,s]=[g(e,t),g(e+i.cell,t),g(e+i.cell,t+i.cell),g(e,t+i.cell)];n.push(...r,...o,...a,...r,...s,...o)}else if(c){let i=[];for(let[n,c,l,u,d]of[[r,o,a,o,_(e,t-1)],[a,o,a,s,_(e+1,t)],[a,s,r,s,_(e,t+1)],[r,s,r,o,_(e-1,t)]]){let e=d>1?5:1;for(let t=0;t<e;t++)i.push(g(n+(l-n)*t/e,c+(u-c)*t/e))}let c=g((r+a)/2,(o+s)/2);i.forEach((e,t)=>n.push(...c,...i[(t+1)%i.length],...e))}}})(_,r),yield,((t,n)=>{let{at:r}=n.relief,i=e(k([0,1,0],vt)),a=[i,k(vt,i),vt];for(let[e,n]of d.dishes)At(t,e,n,r(e,n),6,[1,.25,.15]),s(t,Ct,[e,r(e,n)+5.2,n],a,[0,0,-.9],1);for(let[e,n,i,a]of d.ramps)for(let o of[-8,8])At(t,e+o*a,n-o*i,r(e+o*a,n-o*i),2.2,[1,.45,.1]);let[c,l]=d.wreck,u=o,f=e([.8,-.35,.5]),p=e(k([0,1,0],f));s(t,St,[c-3,u+3.1,l-2],[p,k(f,p),f],[0,0,0],[1.6,1.4,.55],[.6,.6,.62]),E(t,[[c+3,u,l+4],[c+6.5,u+.2,l+5],[c+4,u+2.6,l+5.5]],[.7,.3,.14]),At(t,c-3.4,l+2.6,u,3.5,[1,.12,.08])})(_,r)),((t,n)=>{for(let[r,a,o,s,c,l]of Bt){let u=t=>{let u=t*A/480,[d,f]=[Math.cos(u),Math.sin(u)],p=a*Vt(d,f,r,l),m=(t+1)*A/480,h=(a*Vt(Math.cos(m),Math.sin(m),r,l)-p)/(r*A/480);return Array.from({length:o+1},(t,a)=>{let u=a/o,m=r-.3*p*(1-u),g=r/(30+26*(1-u))*(1+.05*u),_=2*Z(d*g+l+1.7*u,f*g-1.3*u,l+9)-1,v=e([-d-f*(-1.5*h-1.6*_*(1-.5*u)),.75,d*(-1.5*h-1.6*_*(1-.5*u))-f]),y=Math.max(i(v,n),0),b=(.8+.3*Z(d*r/90-l,f*r/90+2.3*u,l+11))*(.72+.28*X(.5+.9*_))*(c+(s-c)*Math.min(1.2*y+(a===o?.3:0),1));return[Y[0]+d*m,(p+25)*u-25,Y[2]+f*m,d,0,f,b,b,-2,1.03*b]})},d=u(0);for(let e=1;e<=480;e++){let n=u(e%480);for(let e=0;e<o;e++)t.push(...d[e],...n[e],...n[e+1],...d[e],...n[e+1],...d[e+1]);d=n}}})(_,e(r.sun.dir)),_}var Ut=()=>{let t=[];return(t=>{let n=vt,r=n.map(e=>-e),i=e([r[2],0,-r[0]]),a=k(r,i),o=n.map((e,t)=>Y[t]+800*e),s=n.map((e,t)=>o[t]+100*e),[c,l]=[28,64],u=(e,t)=>o.map((n,r)=>n+60*e*(i[r]*Math.cos(t)+a[r]*Math.sin(t))),d=t.length;for(let e=0;e<c;e++)for(let n=0;n<l;n++){let[r,i]=[n*A/l,(n+1)*A/l],[a,o]=[(e+.5)/c,(n+.5)*A/l],[d,f]=[a*Math.cos(o),a*Math.sin(o)],p=Math.sqrt(1-a*a),[m,h]=[(Math.atan2(d,p)+1.5)/A*12,6*(Math.asin(f)/Math.PI+.5)],g=yt(m,h,11)>.5?ue([.13,.32,.09],[.4,.3,.15],yt(2*m,2*h,13)):[.03,.16,.5],_=Math.abs(f)>.93?1:X(4*(yt(1.5*m+4,3*h,17)-.5));g=ue(g,[.95,.97,1],_).map(e=>e*(.55+.45*Math.max(0,.3*d+.25*f+.9*p))*(.6+.4*p)),E(t,e?[u(e/c,r),u((e+1)/c,r),u((e+1)/c,i),u(e/c,i)]:[u(0,0),u(1/c,r),u(1/c,i)],g,s)}ge(t,d,1.5)})(t),t},{FORWARD:Wt,BACK:Gt,JUMP:Kt,CROUCH:qt,SPRINT:Jt,USE:Yt}=ne,Q=[.78,.8,.84],Xt=[.95,.68,.22],Zt=[.06,.06,.07],Qt=[.9,.9,.88],$t=[.14,.24,.55],en=[.75,.42,.2],tn=[3.2,.35,.15],nn=2*Math.PI,rn=(e,t,n,r,i)=>e.push(...t,...n,r[0],r[1],i,r[2]),$=(e,t,n,r,i=-1)=>{let[[a,o],[s,c],[l,u]]=[0,1,2].map(e=>[t[e],n[e]]),d=[[[0,1,0],[[a,c,l],[a,c,u],[o,c,u],[o,c,l]]],[[0,-1,0],[[a,s,l],[o,s,l],[o,s,u],[a,s,u]]],[[1,0,0],[[o,s,l],[o,c,l],[o,c,u],[o,s,u]]],[[-1,0,0],[[a,s,l],[a,s,u],[a,c,u],[a,c,l]]],[[0,0,1],[[a,s,u],[o,s,u],[o,c,u],[a,c,u]]],[[0,0,-1],[[a,s,l],[a,c,l],[o,c,l],[o,s,l]]]];for(let[t,n]of d)for(let a of[0,1,2,0,2,3])rn(e,n[a],t,r,i)},an=(e,t,n,r)=>{let i=c(b(e,r),t);for(let e=8;e<i.length;e+=10)i[e]=n;return i},on=(e,t,n,r,i,a=-1,o=48)=>s(e,an(t,i,a,o),n,_(r,Math.abs(r[1])>.9?[1,0,0]:[0,1,0]),[0,0,0],1),sn=(e,t,n,i,a,o=r)=>S(e,an([[0,0],[i,0],[i,1],[0,1]],a,o,8),t,n,[0,1,0],1),cn=(e,t,n)=>{let r=43758.5453*Math.sin(127.1*e+311.7*t+74.7*n);return 2*(r-Math.floor(r))-1},ln=(e,t,n,r,i=-2)=>{for(let a of[0,1,2,0,2,3])rn(e,[t[a][0],n,t[a][1]],[0,1,0],r,i)},un=[.55,.57,.6],dn=[.9,.45,.08],fn=[.95,.75,.1],pn=[.4,2.6,1.6],mn=[2.6,1.3,.25],hn=[.08,.35,.8],gn=[2.2,2.3,2.6];function*_n(e,t){let n=yield*Ht(e);return yield,n=n.concat((({brushes:e},t)=>{let n=[];for(let r of e)r.ghost&&r.tint&&Le(n,r,2*Math.max(0,t.indexOf(`${r.tint}`)));let r=[];(e=>{[...le,...Ve].forEach(t=>((e,[t,n,r,i,a,o,c,l])=>{let u=1&l?2:0,[d,f]=[[n,o,r],[i,c,a]],p=l<2?1:-1,m=(e,t,n)=>{let r=[0,o+t,0];return r[u]=(p>0?d[u]:f[u])+p*n,r[2-u]=d[2-u]+e,r},[h,g,_]=[f[2-u]-d[2-u],f[u]-d[u],c-o],v=(t,n,r)=>{let[i,a]=[m(t[0],t[1],t[2]),m(n[0],n[1],n[2])];O(e,i.map((e,t)=>Math.min(e,a[t])),i.map((e,t)=>Math.max(e,a[t])),r)},y=(t,n,r,i,a,o,s=1)=>w(e,s,()=>E(e,[m(t,n,a),m(r,n,a),m(r,i,a),m(t,i,a)],o,m(t,n,a-1))),b=(e,t,n,r,i,a)=>{v([e,t,i-.06],[n,r,i],z),y(e+.04,t+.04,n-.04,r-.04,i+.005,a,.45);for(let o=0;r-t>.3&&o<4;o++){let s=r-.12-o*((r-t-.16)/4);y(e+.08,s-.025,e+.08+(n-e-.16)*(.4+(7*e+o)%4*.15),s,i+.01,a,1.1)}};Re(e,()=>{if(t==ee.BENCH){v([0,_-.06,0],[h,_,g],L),v([.05,0,0],[h-.05,_-.06,g-.06],Ae);for(let e=1.1;e<h-.5;e+=1.1)v([e-.01,.1,g-.06],[e+.01,_-.1,g-.05],z);for(let e=0;e<4;e++){let t=1.4+2.75*e;v([t-.05,_,.16],[t+.05,_+.22,.22],z),b(t-.45,_+.2,t+.45,_+.75,.28,[B,V,H,B][e]),v([t-.3,_,.45],[t+.3,_+.025,.65],R),v([t+.7,_,.2],[t+.82,_+.2,.32],[V,je,H,Pe][e])}}else if(t==ee.SAMPLES){v([0,_-.05,0],[h,_,g],R),v([.15,.18,.15],[h-.15,.22,g-.15],z);for(let e of[.1,h-.2])for(let t of[.1,g-.2])v([e,0,t],[e+.1,_-.05,t+.1],z);for(let e=0;e<4;e++){let t=.25+1.2*e;v([t,_,.3],[t+.9,_+.07,1.2],z),y(t+.05,_+.015,t+.85,_+.055,1.205,B,1.2),v([t+.28,_+.07,.55],[t+.62,_+.07+(.16+e%3*.07),.95],[.4+.05*e,.38,.35]);for(let[e,n]of[[0,.3],[.88,.3],[0,1.18],[.88,1.18]])v([t+e,_+.07,n],[t+e+.02,_+.55,n+.02],Ae);v([t,_+.53,.3],[t+.9,_+.55,1.2],[.5,.6,.66])}}else if(t==ee.RACKS){v([0,0,0],[h,_,g],z);for(let e=0;e<3;e++){let t=.1+1.63*e;for(let n=0;n<12;n++){let r=.25+.2*n;y(t,r,t+1.43,r+.16,g+.01,R,.25);for(let i=0;i<5;i++){let a=[V,H,V,B,Ne,null][(7*e+5*n+3*i)%6];a&&y(t+.1+.08*i,r+.06,t+.14+.08*i,r+.1,g+.015,a,1.6)}}y(t,_-.4,t+1.43,_-.34,g+.01,B,.9)}}else if(t==ee.SCOPE){v([.2,0,.2],[1,.1,1],z),v([.45,.1,.45],[.75,.85,.75],L),y(.52,.55,.68,.65,.755,V,1.4),v([.35,.85,.35],[.85,1.05,.85],R);let[t,n]=[m(.6,.9,.2),m(1.4,2.8,2.1)];S(e,C(2,1,[1,1],[0,0]),t,n,[1,0,0],1,.2,L),S(e,C(2,1,[1,1],[0,0]),m(1.3,2.56,1.86),m(1.42,2.83,2.13),[1,0,0],1,.24,z),S(e,C(2,1,[1,1],[0,0]),m(.86,1.4,.6),m(1.2,2.2,1.4),[1,0,0],1,.05,R)}else if(t==ee.ANALYSER){v([0,0,0],[h,.9,g],L),v([0,.9,0],[h,_,.5],L),b(.12,.92,.95,1.26,.56,V),v([1.1,.9,.55],[1.88,1.18,1.1],R),y(1.16,.95,1.82,1.13,1.105,Pe,1.3);for(let e=0;e<6;e++)y(.15+.12*e,.74,.22+.12*e,.8,g+.005,[H,V,B][e%3],1.4);for(let e of[.3,.6])v([.05,e,g],[h-.05,e+.015,g+.005],z)}else if(t==ee.PLANTS){for(let e of[0,h/2-.03,h-.06])v([e,0,0],[e+.06,_,g],R);v([0,_-.04,0],[h,_,g],L);for(let t of[.3,.9,1.5]){v([0,t,0],[h,t+.04,g],L),v([.1,t+.04,.12],[h-.1,t+.18,g-.12],Me);for(let e=.25;e<h-.15;e+=.4)v([e-.1,t+.18,.2],[e+.1,t+.18+(.12+(10*e+3*t)%3*.06),g-.2],10*e%2<1?[.18,.5,.16]:[.3,.62,.2]);w(e,1.1,()=>v([.1,t+.53,.3],[h-.1,t+.56,g-.3],Fe))}}else if(t==ee.LOCKERS){v([0,0,0],[h,_,g],je);for(let e=0;e<6;e++){let t=.8*e;e&&v([t-.01,.05,g],[t+.01,_-.05,g+.01],z);for(let e=0;e<3;e++)v([t+.2,1.7+.08*e,g],[t+.6,1.73+.08*e,g+.01],z);v([t+.64,.95,g],[t+.68,1.2,g+.04],Ae),y(t+.3,1.5,t+.5,1.56,g+.012,H,.8)}}else if(t==ee.SUIT){v([.1,0,.1],[.9,.06,.9],z),v([.47,.06,.06],[.53,1.7,.14],R);for(let e of[.27,.54])v([e-.02,.06,.36],[e+.21,.22,.68],R),v([e,.22,.4],[e+.19,.95,.62],L);v([.22,.95,.32],[.78,1.58,.7],L),v([.25,1,.14],[.75,1.62,.32],Ae);for(let e of[.08,.78])v([e,1,.4],[e+.14,1.54,.6],L),v([e,.88,.4],[e+.14,1,.6],R);y(.34,1.3,.5,1.42,.705,B,1),y(.56,1.34,.64,1.42,.705,Ne,1.2),s(e,C(2,0,[1,1]),m(.5,1.8,.5),pe,[0,0,0],.21,L),y(.38,1.74,.62,1.88,.715,H,.7)}else{v([0,0,0],[h,_,.05],R),y(.1,.35,.6*h,_-.1,.055,B,.5);for(let e=0;e<12;e++)y(.66*h+e%3*.2,.4+.25*(e>>2),.66*h+e%3*.2+.1,.5+.25*(e>>2),.055,[V,H,Ne,B][e%4],1.3);y(.1,.1,h-.1,.18,.055,H,.9)}})})(e,t));let[,t]=te[0],n=P+t+.03;U(e,2,n,[N-3,3.4,0],[N+3,4.3,0],Ee);for(let t of[3.42,4.22])U(e,2,n+.01,[N-2.95,t,0],[N+2.95,t+.05,0],we);for(let t=0;t<9;t++){let r=N-2.6+.6*t;U(e,2,n+.01,[r,3.9,0],[r+.45,4.1,0],[.9,.95,1]),U(e,2,n+.01,[r+.05,3.6,0],[r+.3+t%2*.1,3.7,0],B)}for(let[t,n]of[[N+16.6,.3],[N+17.1,.15]])Re(e,()=>O(e,[t,2.94,P-6.7],[t+n,3.06,P+6.7],z));D.forEach(({min:t,max:n},r)=>{let i=r?2:0,[a,o]=[t[i],r?D[0].min[2]:n[i]],s=t[2-i]+j,c=[0,2,0],l=[0,2.1,0];[c[i],l[i],c[2-i],l[2-i]]=[a,o,s,s+.12],Re(e,()=>O(e,c,l,z));for(let t=a+2.5;t<o-1;t+=5){let[n,r]=[[0,1.3,0],[0,1.5,0]];[n[i],r[i]]=[t-.2,t+.2],U(e,2-i,s+.03,n,r,V)}});for(let t of xe){let n=t.max[0]-t.min[0]<1?0:2,[r]=fe.filter(({min:e,max:n})=>e[0]<=t.min[0]&&t.max[0]<=n[0]&&e[2]<=t.min[2]&&t.max[2]<=n[2]),i=(r.min[n]+r.max[n])/2>t.min[n]?1:-1,a=(i>0?t.max[n]:t.min[n])+.02*i,[o,s]=[t.min[2-n],t.max[2-n]];if(D.some(e=>[0,2].every(n=>e.min[n]<=t.max[n]+.01&&t.min[n]-.01<=e.max[n])))continue;for(let t=0;o+.3*t<s;t++){let[r,i]=[[0,ae+.05,0],[0,ae+.35,0]];[r[2-n],i[2-n]]=[o+.3*t,Math.min(o+.3*t+.15,s)],U(e,n,a,r,i,H),[r[2-n],i[2-n]]=[i[2-n],Math.min(o+.3*t+.3,s)],U(e,n,a,r,i,z)}let c=(o+s)/2,[l,u]=[[0,3.2,0],[0,3.45,0]];[l[2-n],u[2-n]]=[c-.15,c+.15],U(e,n,a,l,u,Ne)}})(r);for(let e of r)n.push(e);for(let e=0;e<r.length;e+=30)for(let t of[0,2,1]){let i=e+10*t;n.push(r[i],r[i+1],280-r[i+2],r[i+3],r[i+4],-r[i+5],...r.slice(i+6,i+10))}return n})(e,t)),e.station&&(yield,n=n.concat((({hall:[e],post:t,hull:[n,i,a,o],gun:s})=>{let c=[],{R:l}=g,u=t[0][1],[d,f]=[e[0],e[0]+48],p=[d,f].flatMap(e=>{let t=Math.acos((e-n)/l);return[t,nn-t]}),m=[...Array.from({length:72},(e,t)=>t*nn/72),...p,nn].sort((e,t)=>e-t);for(let e=i;e<o-.01;e+=2){let t=e>=u+30&&e<o-14;for(let i=0;i+1<m.length;i++){let[o,s]=[m[i],m[i+1]],p=(o+s)/2,h=n+l*Math.cos(p);if(h>d&&h<f&&e>=u-2&&e<u+16)continue;let g=t,_=g?.22:.03;for(let[t,o]of[[i,e],[i+1,e],[i+1,e+2],[i,e],[i+1,e+2],[i,e+2]]){let e=m[t],i=t%(m.length-1),[s,u]=[cn(i,o,1)*_,cn(i,o,2)*_],d=[Math.cos(e)+s*Math.sin(e),u,Math.sin(e)-s*Math.cos(e)];rn(c,[n+l*Math.cos(e),o,a+l*Math.sin(e)],d,g?Xt:Q,g?oe:r)}}}on(c,[[l,0],[l-3,3],[.6*l,y.DOME-1],[0,y.DOME]],[n,o,a],[0,1,0],Q,r);let h=[n-16,o+y.MAST,a];sn(c,[h[0],o+4,a],h,.8,Q);let _=Array.from({length:6},(e,t)=>[2.4*t,3.6*(t/5)**2]);on(c,[..._,...[..._].reverse().map(([e,t])=>[e,t-.3])],h,[-.6,.8,0],Qt,-1,20);let v=y.BARREL*l,b=i-s[1];on(c,[[l,0],[l-1.5,2],[v+2,2.6],[0,2.6]],[n,i,a],[0,-1,0],Q,r),on(c,[[0,2.6],[v+2,2.6],[v+2,5],[v,6.5],[v,b-4],[v+3,b-1.5],[v+3,b],[v-2,b],[v-3,b-10],[0,b-10.5]],[n,i,a],[0,-1,0],Zt,r);for(let e=10;e<b-8;e+=7)on(c,[[0,e],[v+.8,e],[v+.8,e+1.6],[0,e+1.6]],[n,i,a],[0,-1,0],Q,r);on(c,[[0,b-10.3],[v-3.5,b-10.1],[0,b-9.9]],[n,i,a],[0,-1,0],tn,-2),$(c,[n-v-8,s[1]-18,a-16],[n-v-7.2,s[1]+8,a+16],Qt,r),sn(c,[n-v-1,s[1]+3,a],[n-v-7.2,s[1]+3,a],.6,Q);let x=i+(o-i)*y.WING,[S,C,w]=[y.PANEL,y.SPAN,y.GAP];for(let e of[-1,1]){let t=n+e*(l+y.BOOM);sn(c,[n+e*l,x,a],[t,x,a],1.4,Q),$(c,[Math.min(t,t+3*e),x-6,a-2],[Math.max(t,t+3*e),x+6,a+2],Q,r),sn(c,[t,x,a],[t+e*(4*(S+w)+2),x,a],.6,en);for(let n=0;n<4;n++){let i=t+e*(3+n*(S+w)),[o,s]=[Math.min(i,i+e*S),Math.max(i,i+e*S)];$(c,[o,x-C/2,a-.2],[s,x+C/2,a+.2],$t,r);for(let e of[x-C/2,x+C/2-.6,x-.3,x-C/4,x+C/4-.3])$(c,[o,e,a-.3],[s,e+.6,a+.3],Q,r);for(let e of[o,o+S/2-.3,s-.6])$(c,[e,x-C/2,a-.3],[e+.6,x+C/2,a+.3],Q,r)}}return c})(e.station),(({hall:[e],post:t,hull:[n,,i]})=>{let a=[],o=t[0][1],[s,c]=[e[0]+4,e[0]+44],[l,u]=[i-g.R,i+g.R];for(let[e,t,n,r]of[[s+.5,2.4,.25,1],[s+.5,3.1,.16,1],[s+.7,8.5,.4,1],[c-.5,4.6,.25,-1],[c-.7,8.5,.4,-1]]){sn(a,[e,o+t,l+5],[e,o+t,u-5],n,un);for(let i=l+8;i<u-5;i+=8)$(a,[Math.min(e,e-.5*r),o+t-n-.1,i-.15],[Math.max(e,e-.5*r)+.01,o+t+n+.1,i+.15],Zt),i/8%3<1&&sn(a,[e,o+t,i+1.5],[e,o+t,i+1.8],n+.12,dn,-1)}for(let e of[s+.6,c-.6])for(let t of[l+6,u-6])sn(a,[e,o,t],[e,o+14,t],.3,un);for(let e of[n-10,n+10])sn(a,[e,o+13.2,l+5],[e,o+13.2,u-5],.6,un);for(let e=l+10;e<u-5;e+=12)$(a,[n-4,o+13.7,e-.6],[n+4,o+13.9,e+.6],gn,-2);for(let e of[-1,1]){let[t,r]=[n+6,i+10*e];for(let e=0;e<32;e++){let[n,i]=[e*nn/32,(e+1)*nn/32],s=(e,n)=>[t+n*Math.cos(e),r+n*Math.sin(e)];ln(a,[s(n,7),s(i,7),s(i,6.4),s(n,6.4)],o+.03,fn,-1),e%4==0&&$(a,[t+7.4*Math.cos(n)-.15,o,r+7.4*Math.sin(n)-.15],[t+7.4*Math.cos(n)+.15,o+.12,r+7.4*Math.sin(n)+.15],mn,-2)}let d=e<0?l:u;for(let n=r+10*e;e*(d-n)>4;n+=5*e)for(let r of[-1,1])ln(a,[[t+.4*r,n+1.2*e],[t+3.2*r,n-.6*e],[t+3.2*r,n-1.3*e],[t+.4*r,n+.5*e]],o+.04,mn);ln(a,[[s,d-.6*e],[c,d-.6*e],[c,d-.2*e],[s,d-.2*e]],o+.04,pn);for(let t of[s+.06,c-.06])$(a,[t-.06,o,d-.6*e-.2],[t+.06,o+11,d-.6*e+.2],pn,-2);$(a,[s,o+10.94,d-.6*e-.2],[c,o+11,d-.6*e+.2],pn,-2)}let[d,f]=[c+4.2,c+13.5];for(let e of[-1,1]){let t=i+8*e;$(a,[d,o,Math.min(t,t-1.1*e)],[f,o+1,Math.max(t,t-1.1*e)],Zt,r);for(let n=d+.4;n<f-1.5;n+=2.3)$(a,[n,o+1.4,Math.min(t,t-.05*e)],[n+1.9,o+2.6,Math.max(t,t-.05*e)],hn,-2)}return $(a,[c+17.94,o+1.2,i-4],[c+18,o+3.4,i+4],hn,-2),a})(e.station))),yield,{land:n,sky:Ut(),heavens:_t}}export{_n as default};
@@ -0,0 +1,8 @@
1
+ import type { Vec3 } from '../mesh';
2
+ import type { Out } from '../verts';
3
+ /**
4
+ * Turns the vertices of `o` from `from` on into a pane on the PANE layer, facing `out`, its middle
5
+ * at `mid`: each normal leans out from the middle by `bulge` at `r` metres, so the glass looks domed
6
+ * and the sky and the sun in it move across it. Keeps the glow's colour (glow() first).
7
+ */
8
+ export declare const glaze: (dst: Out, from: number, mid: Vec3, out: Vec3, r: number, bulge: number) => void;
@@ -27,6 +27,13 @@ export declare const GLOSS = -1.12;
27
27
  * tinted, turned yellow olive under a blue sky).
28
28
  */
29
29
  export declare const GILT = -1.42;
30
+ /**
31
+ * The layer of a lit pane of glass (Tranquility's portholes, the user, 2026-11-27: reflections on
32
+ * them): a glow like -2, with the sky, the horizon and the ground mirrored in it over the glow, more
33
+ * at a grazing angle, and the sun's highlight. Its normals bulge to the rim so the mirror moves
34
+ * across it.
35
+ */
36
+ export declare const PANE = -2.2;
30
37
  /**
31
38
  * Hair: a band of layers from HAIR_ROOT (the root) to HAIR_ROOT - HAIR_SPAN (the tip), how far along
32
39
  * its strand a point is: the shader takes the strand's way from the band's gradient (Kajiya-Kay
@@ -0,0 +1,27 @@
1
+ export declare const PAINT: number[];
2
+ export declare const DARK: number[];
3
+ /** The beams over the doorways of the modules. */
4
+ export declare const LINTELS: import("../../shared/world").Brush[];
5
+ export declare const CX: number, CZ: number;
6
+ export declare const C: number[];
7
+ export declare const R = 22.4;
8
+ /** The hall's walls are drawn this high, where a ledge closes them against the inner shell: over a double jump from the mezzanine. */
9
+ export declare const TOP = 8;
10
+ /**
11
+ * The normal of what is drawn indoors, whichever way it faces: up and away from the sun (east,
12
+ * low), in both halves. The sun's shadow map is 64 m wide, so a true normal would be sunlit seen
13
+ * from across the hall; with this one a texture takes the sky's ambient only. It leans off all
14
+ * three axes: the shader's relief needs a normal out of the face's plane.
15
+ */
16
+ export declare const INDOORS: number[];
17
+ /** Texture axes of a face flat on x, y and z: world metres, as the brushes'. */
18
+ export declare const UV: number[][];
19
+ /** Lamps, the windows' glass seen from inside, their frames. */
20
+ export declare const LAMP: number[];
21
+ export declare const GLASS: number[];
22
+ export declare const FRAME: number[];
23
+ export declare const CONCRETE: 8, METAL: 4, WHITE: 11;
24
+ /** Flat colours of the kit. */
25
+ export declare const SNOW: number[], GREY: number[], IRON: number[], INK: number[], BLUISH: number[], SOIL: number[];
26
+ /** Glows: screens, status lights, grow lights. */
27
+ export declare const CYAN: number[], GREEN: number[], AMBER: number[], RED: number[], MAUVE: number[], PINK: number[];
@@ -0,0 +1,8 @@
1
+ import type { Out } from '../verts';
2
+ /**
3
+ * The hall in the dome, all drawn here (shared/moonbase.ts collides with it as ghosts): its floor,
4
+ * its stepped wall with windows and a strip of light, the mouths through the wall, the ledge that
5
+ * closes the wall against the shell, the shell from inside with a lamp at its top, and what stands
6
+ * in it.
7
+ */
8
+ export declare const hall: (o: Out) => void;
@@ -0,0 +1,10 @@
1
+ import type { WorldDef } from '../../shared/world';
2
+ import type { Out } from '../verts';
3
+ /** Red's half of the base: the dome, its hall, the tubes and the modules, a metal floor in the last two, a lit frame in each of their doorways. */
4
+ export declare const moonbase: (o: Out) => void;
5
+ /**
6
+ * The base's furnishing, both halves, which render.ts draws beside the scenery: the flags' daises
7
+ * (the ghosts with a team tint, shared/moon.ts) as the hall's fittings but in their tint, `keys`
8
+ * being the renderer's palette, then the dressing of red's half and its mirror for blue.
9
+ */
10
+ export declare const furnishing: ({ brushes }: WorldDef, keys: string[]) => number[];
@@ -0,0 +1,21 @@
1
+ import type { Brush } from '../../shared/world';
2
+ import type { Vec3 } from '../mesh';
3
+ import type { Out } from '../verts';
4
+ /** A quad indoors: textured, `l` its light (under 2), or glowing in an rgb. */
5
+ export declare const quad: (o: Out, p: Vec3[], c: number | number[], l?: number, [u, v]?: number[]) => void;
6
+ /** quad() on the face of the box lo..hi that is flat on the axis k, moved to `at`. */
7
+ export declare const panel: (o: Out, k: number, at: number, lo: number[], hi: number[], c: number | number[], l?: number) => void;
8
+ /** A box indoors, as a brush: its top in the top texture, the rest in the side one, each face lit by where it looks; `tint` twice the palette index of its tint. */
9
+ export declare const block: (o: Out, { min, max, top, side }: Brush, tint?: number) => void;
10
+ /**
11
+ * What `make` adds, moved indoors: the indoor normal, and a flat colour shaded by where its face
12
+ * looked, brighter since it takes the ambient only (about what the textured walls get).
13
+ */
14
+ export declare const inside: (o: Out, make: () => void) => void;
15
+ /** A lit frame just inside a doorway h high from c0 to c1, in the plane of the axis k at `at`. */
16
+ export declare const frame: (o: Out, k: number, at: number, c0: number, c1: number, h: number) => void;
17
+ /**
18
+ * A white wall indoors in the plane of the axis k at `at`, along the other one from s to t and up
19
+ * to y, `l` its light, open at each door (from, to, height).
20
+ */
21
+ export declare const lining: (o: Out, k: number, at: number, s: number, t: number, y: number, l: number, doors?: number[][]) => void;
@@ -0,0 +1,12 @@
1
+ import type { Out } from '../verts';
2
+ /**
3
+ * Draws a piece of kit, (kind, x0, z0, x1, z1, y0, y1, the way its front looks: 0 +x, 1 +z, 2 -x,
4
+ * 3 -z), in its own frame: u along it from its start, y up from its foot, w out from its back.
5
+ */
6
+ export declare const piece: (o: Out, [kind, x0, z0, x1, z1, y0, y1, f]: number[]) => void;
7
+ /**
8
+ * The dressing of the base, red's half: the lab kit on its ghosts, panels on the walls, a sign over
9
+ * the door, cables under the east deck, cable trays and status lights along the tubes, hazard
10
+ * stripes and a beacon over each airlock.
11
+ */
12
+ export declare const dressing: (o: Out) => void;
@@ -0,0 +1,9 @@
1
+ import type { Out } from '../verts';
2
+ /** The openings of the drawn drum, as angles about the centre and a height: the door, and the tubes' boxes where they come through. */
3
+ export declare const GAPS: number[][];
4
+ /** The dome: a drum with a band of windows under a hemisphere (radius 22, top at 17), open at the door and at the tubes; a lit portal at the door. */
5
+ export declare const dome: (o: Out) => void;
6
+ /** A rounded tube over each tube of the map, from its module to where the two meet, with a rib every 5 m; inside, white walls and a ceiling with a strip of light. */
7
+ export declare const tubes: (o: Out) => void;
8
+ /** The strips of windows on the long faces of the two modules, outside and inside, but over a doorway; three lamps under each roof. */
9
+ export declare const modules: (o: Out) => void;
@@ -1,21 +1,3 @@
1
- import type { Brush, WorldDef } from '../shared/world';
2
- import type { Out } from './verts';
3
- /** The beams over the doorways of the modules. */
4
- export declare const LINTELS: Brush[];
5
- /**
6
- * The normal of what is drawn indoors, whichever way it faces: up and away from the sun (east,
7
- * low), in both halves. The sun's shadow map is 64 m wide, so a true normal would be sunlit seen
8
- * from across the hall; with this one a texture takes the sky's ambient only. It leans off all
9
- * three axes: the shader's relief needs a normal out of the face's plane.
10
- */
11
- export declare const INDOORS: number[];
12
- /** The openings of the drawn drum, as angles about the centre and a height: the door, and the tubes' boxes where they come through. */
13
- export declare const GAPS: number[][];
14
- /** Red's half of the base: the dome, its hall, the tubes and the modules, a metal floor in the last two, a lit frame in each of their doorways. */
15
- export declare const moonbase: (o: Out) => void;
16
- /**
17
- * The base's furnishing, both halves, which render.ts draws beside the scenery: the flags' daises
18
- * (the ghosts with a team tint, shared/moon.ts) as the hall's fittings but in their tint, `keys`
19
- * being the renderer's palette, then the dressing of red's half and its mirror for blue.
20
- */
21
- export declare const furnishing: ({ brushes }: WorldDef, keys: string[]) => number[];
1
+ export * from './moonbase/index';
2
+ export { GAPS } from './moonbase/shell';
3
+ export { INDOORS, LINTELS } from './moonbase/constants';
@@ -1,7 +1,7 @@
1
1
  import type { Brush, WorldDef } from '../../shared/world';
2
2
  export declare const VERT: string;
3
3
  export declare const POST_VERT = "#version 300 es\nout vec2 U;void main(){U=vec2(gl_VertexID&1,gl_VertexID>>1)*2.;gl_Position=vec4(U*2.-1.,0,1);}";
4
- export declare const POST_FRAG = "#version 300 es\nprecision highp float;uniform sampler2D S[4];uniform vec4 Y;uniform float L,Dp;in vec2 U;out vec4 o;\nvec3 b(vec2 x){vec3 c=texture(S[0],x).rgb;return c*smoothstep(.9,2.,max(c.r,max(c.g,c.b)));}\n#define T(k)texture(S[0],U+Y.xy*(k)).rgb\nvoid main(){\nvec3 c;\nif(Y.z<1.)c=(b(U+Y.xy)+b(U-Y.xy)+b(U+Y.xy*vec2(1,-1))+b(U-Y.xy*vec2(1,-1)))/4.;\nelse if(Y.z<2.)c=T(0.)*.227+(T(1.3846)+T(-1.3846))*.3162+(T(3.2308)+T(-3.2308))*.0703;\nelse{\nvec3 s=texture(S[0],U).rgb;\nif(Dp>0.){vec2 e=Y.xy*3.,f=e*.7;s=mix(s,(s+texture(S[0],U+e*vec2(1,0)).rgb+texture(S[0],U-e*vec2(1,0)).rgb+texture(S[0],U+e*vec2(0,1)).rgb+texture(S[0],U-e*vec2(0,1)).rgb+texture(S[0],U+f).rgb+texture(S[0],U-f).rgb+texture(S[0],U+f*vec2(1,-1)).rgb+texture(S[0],U-f*vec2(1,-1)).rgb)/9.,Dp);}\nc=s+texture(S[1],U).rgb*1.3+texture(S[2],U).rgb*1.+texture(S[3],U).rgb*.7;\nvec2 q=U-.5;\nc=min(c,.6)+.4*(1.-exp(-max(c-.6,0.)/.4));\nc=mix(c,c*vec3(.3,.7,.95)+vec3(0,.025,.045),Dp*.85);\nfloat a=atan(q.y,q.x)*24.,h=fract(sin(floor(a)*12.9898)*43758.5453);\nc+=L*step(.85-.5*L,h)*sin(fract(a)*3.1416)*smoothstep(.2,.6,length(q))*fract(length(q)*3.-Y.w*.002+h*9.)*.22;\nc*=1.-(.7+.3*L+.4*Dp)*dot(q,q);\nc=pow(max(c*vec3(.97,1.,1.03),0.),vec3(.92))+(fract(sin(dot(gl_FragCoord.xy+Y.w,vec2(12.9898,78.233)))*43758.5453)-.5)*.03;}\no=vec4(c,1);}";
4
+ export declare const POST_FRAG = "#version 300 es\nprecision highp float;uniform sampler2D S[4];uniform vec4 Y;uniform float L,Dp;in vec2 U;out vec4 o;\nvec3 b(vec2 x){vec3 c=texture(S[0],x).rgb;if(any(isnan(c)))return vec3(0);return c*smoothstep(.9,2.,max(c.r,max(c.g,c.b)));}\n#define T(k)texture(S[0],U+Y.xy*(k)).rgb\nvoid main(){\nvec3 c;\nif(Y.z<1.)c=(b(U+Y.xy)+b(U-Y.xy)+b(U+Y.xy*vec2(1,-1))+b(U-Y.xy*vec2(1,-1)))/4.;\nelse if(Y.z<2.)c=T(0.)*.227+(T(1.3846)+T(-1.3846))*.3162+(T(3.2308)+T(-3.2308))*.0703;\nelse{\nvec3 s=texture(S[0],U).rgb;\nif(any(isnan(s))){s=textureOffset(S[0],U,ivec2(0,-2)).rgb;if(any(isnan(s)))s=vec3(0);}\nif(Dp>0.){vec2 e=Y.xy*3.,f=e*.7;s=mix(s,(s+texture(S[0],U+e*vec2(1,0)).rgb+texture(S[0],U-e*vec2(1,0)).rgb+texture(S[0],U+e*vec2(0,1)).rgb+texture(S[0],U-e*vec2(0,1)).rgb+texture(S[0],U+f).rgb+texture(S[0],U-f).rgb+texture(S[0],U+f*vec2(1,-1)).rgb+texture(S[0],U-f*vec2(1,-1)).rgb)/9.,Dp);}\nc=s+texture(S[1],U).rgb*1.3+texture(S[2],U).rgb*1.+texture(S[3],U).rgb*.7;\nvec2 q=U-.5;\nc=min(c,.6)+.4*(1.-exp(-max(c-.6,0.)/.4));\nc=mix(c,c*vec3(.3,.7,.95)+vec3(0,.025,.045),Dp*.85);\nfloat a=atan(q.y,q.x)*24.,h=fract(sin(floor(a)*12.9898)*43758.5453);\nc+=L*step(.85-.5*L,h)*sin(fract(a)*3.1416)*smoothstep(.2,.6,length(q))*fract(length(q)*3.-Y.w*.002+h*9.)*.22;\nc*=1.-(.7+.3*L+.4*Dp)*dot(q,q);\nc=pow(max(c*vec3(.97,1.,1.03),0.),vec3(.92))+(fract(sin(dot(gl_FragCoord.xy+Y.w,vec2(12.9898,78.233)))*43758.5453)-.5)*.03;}\no=vec4(c,1);}";
5
5
  /**
6
6
  * Blinn-Phong strength and exponent: a row per TEX id in order (brick, tile, lava, stone, metal, wood,
7
7
  * moss, grate, concrete, glass, steel, paint, rock), then the flat bodies, then polished metal (SHINE),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "1.13.0",
5
+ "version": "1.14.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"
@@ -1 +0,0 @@
1
- import{Q as e,Z as t,r as n,ur as r}from"./brick-9u0Ivbak.js";var i=e=>(e=Math.min(Math.max(e,0),1))*e*(3-2*e),a=[1,2,3,4,6].map(t=>{let n=(1+Math.sqrt(5))/2,r=[[-1,n,0],[1,n,0],[-1,-n,0],[1,-n,0],[0,-1,n],[0,1,n],[0,-1,-n],[0,1,-n],[n,0,-1],[n,0,1],[-n,0,-1],[-n,0,1]].map(t=>e(t));return[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]].map(e=>e.map(e=>r[e])).flatMap(([n,r,i])=>{let a=(a,o)=>e(n.map((e,n)=>e+((r[n]-e)*a+(i[n]-e)*o)/t)),o=[];for(let e=0;e<t;e++)for(let n=0;e+n<t;n++)o.push([a(e,n),a(e+1,n),a(e,n+1)]),e+n<t-1&&o.push([a(e+1,n),a(e+1,n+1),a(e,n+1)]);return o})}),o=(o,s,c,l,u,d,f,p)=>{let m=/* @__PURE__ */ new Map,h=(typeof s==`number`?a[s-1]:s).map(e=>e.map(e=>{let t=(e=>e.map(e=>Math.round(1e4*e)).join())(e),n=m.get(t);if(!n){let r=c(e);n={p:r,n:[0,0,0],low:!!p&&r[1]<p(r[0],r[2])-.05},m.set(t,n)}return n}));for(let e of h){let r=n(t(e[1].p,e[0].p),t(e[2].p,e[0].p));e.forEach(e=>e.n=[e.n[0]+r[0],e.n[1]+r[1],e.n[2]+r[2]])}for(let a of h){if(a.every(e=>e.low))continue;let s=n(t(a[1].p,a[0].p),t(a[2].p,a[0].p)),c=Math.abs(s[1])>Math.max(Math.abs(s[0]),Math.abs(s[2])),p=Math.abs(s[0])>Math.abs(s[2]);for(let{p:t,n}of a){let a=Math.hypot(...n)>1e-12?e(n):[0,1,0];o.push(...t,...a,...c?[t[0],t[2]]:p?[t[2]+3*d,t[1]]:[t[0]+3*d,t[1]],r.ROCK,.85*f*(.55+.45*i((t[1]-l)/(.3*(u-l)))))}}};export{o as t};