three-live 1.3.2 → 1.4.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.
- package/README.md +4 -1
- package/dist/index.d.ts +190 -0
- package/dist/three-author-engine.js +171 -163
- package/dist/three-author.cjs +145 -163
- package/dist/three-author.d.ts +190 -0
- package/dist/three-author.js +145 -163
- package/dist/three-convert.cjs +142 -160
- package/dist/three-convert.d.ts +190 -0
- package/dist/three-convert.js +142 -160
- package/dist/three-live-ai.cjs +41 -0
- package/dist/three-live-ai.d.ts +759 -0
- package/dist/three-live-ai.js +41 -0
- package/dist/three-live-ai.min.js +41 -0
- package/dist/three-live-animation.cjs +6 -6
- package/dist/three-live-animation.d.ts +190 -0
- package/dist/three-live-animation.js +5 -5
- package/dist/three-live-animation.min.js +5 -5
- package/dist/three-live-cad.cjs +2 -2
- package/dist/three-live-cad.d.ts +190 -0
- package/dist/three-live-cad.js +2 -2
- package/dist/three-live-cad.min.js +2 -2
- package/dist/three-live-element.cjs +50 -85
- package/dist/three-live-element.d.ts +190 -0
- package/dist/three-live-element.js +50 -85
- package/dist/three-live-full.cjs +907 -189
- package/dist/three-live-full.js +907 -189
- package/dist/three-live-full.min.js +907 -189
- package/dist/three-live-procedural.cjs +16 -0
- package/dist/three-live-procedural.d.ts +759 -0
- package/dist/three-live-procedural.js +16 -0
- package/dist/three-live-procedural.min.js +16 -0
- package/dist/three-live-sandbox.html +11 -1
- package/dist/three-live-studio.cjs +72 -17
- package/dist/three-live-studio.d.ts +190 -0
- package/dist/three-live-studio.js +72 -17
- package/dist/three-live-studio.min.js +73 -18
- package/dist/three-live-tsl.cjs +103 -0
- package/dist/three-live-tsl.d.ts +759 -0
- package/dist/three-live-tsl.js +103 -0
- package/dist/three-live-tsl.min.js +103 -0
- package/dist/three-live-viewer.cjs +50 -85
- package/dist/three-live-viewer.d.ts +190 -0
- package/dist/three-live-viewer.js +50 -85
- package/dist/three-live-viewer.min.js +50 -85
- package/dist/three-live-webgpu.cjs +585 -0
- package/dist/three-live-webgpu.d.ts +759 -0
- package/dist/three-live-webgpu.js +585 -0
- package/dist/three-live-webgpu.min.js +585 -0
- package/dist/three-live.cjs +147 -165
- package/dist/three-live.js +147 -165
- package/dist/three-live.min.js +147 -165
- package/dist/three-view.cjs +49 -84
- package/dist/three-view.d.ts +190 -0
- package/dist/three-view.js +50 -85
- package/dist/three-xr.cjs +141 -159
- package/dist/three-xr.d.ts +190 -0
- package/dist/three-xr.js +140 -158
- package/package.json +21 -1
package/dist/three-live-cad.js
CHANGED
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
|
-
*/var me="__THREE_LIVE_REGISTRY__";function be(){let S=typeof globalThis<"u"?globalThis:{};if(!S[me]){let E={plugins:[],decoders:new Map};try{Object.defineProperty(S,me,{value:E,writable:!1,configurable:!1,enumerable:!1})}catch{S[me]=E}}return S[me]}var bt=be().plugins;function pt(S){let E=be();E.workerExtensionInstallers||(E.workerExtensionInstallers=[]),E.workerExtensionInstallers.includes(S)||E.workerExtensionInstallers.push(S)}function yt(S){let E=be().plugins;E.some(L=>L.name===S.name)||E.push(S),S.onRegister?.()}var xt=8192,ft=2048,gt=128,mt=4096;function we(S,E){if(!S||!S.BufferGeometry)return null;let L=S.Vector2,Ne=S.Vector3,We=S.Quaternion,Me=S.Matrix4,Ze=S.Matrix3,Ue=S.Color,de=S.BufferAttribute,U=S.BufferGeometry,Ke=S.Material,Te=S.MeshStandardMaterial,ue=S.Mesh,le=8192,K=2048,_e=128,ze=4096,H=(t,e)=>{let r=t==null?NaN:Number(t);return Number.isFinite(r)?r:e};class ce{constructor(e){this.currentPoint=new L(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)this.lineTo(e[r].x,e[r].y);return this}moveTo(e,r){let s=Number(e)||0,n=Number(r)||0;return this.currentPoint.set(s,n),this.segments.push({type:"move",pts:[s,n]}),this}lineTo(e,r){let s=Number(e)||0,n=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,n),this.segments.push({type:"line",pts:[s,n]}),this}quadraticCurveTo(e,r,s,n){let l=this.currentPoint.x,h=this.currentPoint.y,u=Number(e)||0,c=Number(r)||0,i=Number(s)||0,p=Number(n)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[l,h]}),this.currentPoint.set(i,p),this.segments.push({type:"quad",pts:[l,h,u,c,i,p]}),this}bezierCurveTo(e,r,s,n,l,h){let u=this.currentPoint.x,c=this.currentPoint.y,i=Number(e)||0,p=Number(r)||0,a=Number(s)||0,o=Number(n)||0,y=Number(l)||0,f=Number(h)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,c]}),this.currentPoint.set(y,f),this.segments.push({type:"cubic",pts:[u,c,i,p,a,o,y,f]}),this}absarc(e,r,s,n,l,h=!1){return this.absellipse(e,r,s,s,n,l,h,0)}arc(e,r,s,n,l,h=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(r)||0),s,n,l,h)}absellipse(e,r,s,n,l,h,u=!1,c=0){let i=Number(e)||0,p=Number(r)||0,a=Math.max(0,Number(s)||0),o=Math.max(0,Number(n)||0),y=Number(l)||0,f=Number(h)||0,b=u?1:0,g=Number(c)||0;this.segments.push({type:"arc",pts:[i,p,a,o,y,f,b,g]});let x=Math.cos(g),m=Math.sin(g),d=a*Math.cos(f),M=o*Math.sin(f);return this.currentPoint.set(i+d*x-M*m,p+d*m+M*x),this}ellipse(e,r,s,n,l,h,u=!1,c=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(r)||0),s,n,l,h,u,c)}closePath(){if(this.segments.length>0){let e=this.segments[0],r=0,s=0;if(e.type==="arc"){let n=e.pts[0],l=e.pts[1],h=e.pts[2],u=e.pts[3],c=e.pts[4],i=e.pts[7],p=Math.cos(i),a=Math.sin(i),o=h*Math.cos(c),y=u*Math.sin(c);r=n+o*p-y*a,s=l+o*a+y*p}else r=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-r,this.currentPoint.y-s)>1e-6&&this.lineTo(r,s)}return this}getPoints(e=12){let r=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],n=(l,h)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-l,u.y-h)<1e-6)return}s.push(new L(l,h))};for(let l of this.segments){let h=l.pts;if(l.type==="move"||l.type==="line")n(h[0],h[1]);else if(l.type==="quad"){let u=h[0],c=h[1],i=h[2],p=h[3],a=h[4],o=h[5];n(u,c);for(let y=1;y<=r;y++){let f=y/r,b=1-f;n(b*b*u+2*b*f*i+f*f*a,b*b*c+2*b*f*p+f*f*o)}}else if(l.type==="cubic"){let u=h[0],c=h[1],i=h[2],p=h[3],a=h[4],o=h[5],y=h[6],f=h[7];n(u,c);for(let b=1;b<=r;b++){let g=b/r,x=1-g,m=x*x,d=g*g;n(m*x*u+3*m*g*i+3*x*d*a+d*g*y,m*x*c+3*m*g*p+3*x*d*o+d*g*f)}}else if(l.type==="arc"){let u=h[0],c=h[1],i=h[2],p=h[3],a=h[4],o=h[5],y=h[6]!==0,f=h[7],b=Math.PI*2,g=o-a,x=Math.abs(g)<1e-9;for(;g<0;)g+=b;for(;g>b;)g-=b;g<1e-9&&(g=x?0:b),y&&!x&&(g=g===b?-b:g-b);let m=Math.cos(f),d=Math.sin(f),M=Math.max(2,r);for(let P=0;P<=M;P++){let z=P/M,v=a+z*g,w=i*Math.cos(v),_=p*Math.sin(v);n(u+w*m-_*d,c+w*d+_*m)}}}if(s.length>2){let l=s[0],h=s[s.length-1];Math.hypot(l.x-h.x,l.y-h.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}clone(){let e=new this.constructor;return e.currentPoint.copy(this.currentPoint),e.segments=this.segments.map(r=>({type:r.type,pts:[...r.pts]})),Array.isArray(this.holes)&&(e.holes=this.holes.map(r=>r.clone())),e}}class pe extends ce{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(r=>r.getPoints(e))}}}function ye(t){let e=0,r=t.length;for(let s=0,n=r-1;s<r;n=s++)e+=t[n].x*t[s].y-t[s].x*t[n].y;return e*.5}function et(t,e,r,s,n,l,h,u){let c=h-r,i=u-s,p=n-r,a=l-s,o=t-r,y=e-s,f=c*c+i*i,b=c*p+i*a,g=c*o+i*y,x=p*p+a*a,m=p*o+a*y,d=f*x-b*b;if(Math.abs(d)<1e-12)return!1;let M=1/d,P=(x*g-b*m)*M,z=(f*m-b*g)*M;return P>=-1e-7&&z>=-1e-7&&P+z<=1+1e-7}function Ee(t,e){let r=t.slice();ye(r)<0&&r.reverse();let s=r.map(c=>new L(c.x,c.y)),n=r.map((c,i)=>i),l=[];for(let c of e){if(!c||c.length<3)continue;let i=c.slice();ye(i)>0&&i.reverse();let p=[],a=-1/0,o=0;for(let y=0;y<i.length;y++){let f=i[y],b=s.length;s.push(new L(f.x,f.y)),p.push(b),f.x>a&&(a=f.x,o=y)}l.push({pts:i,indices:p,maxX:a,maxIdx:o})}l.sort((c,i)=>i.maxX-c.maxX);let h=(c,i,p)=>(i.x-c.x)*(p.y-c.y)-(i.y-c.y)*(p.x-c.x),u=(c,i,p)=>{for(let a=0;a<p.length;a++){let o=p[a],y=p[(a+1)%p.length];if(h(c,i,o)*h(c,i,y)<0&&h(o,y,c)*h(o,y,i)<0)return!0}return!1};for(let c of l){let i=c.pts[c.maxIdx],p=i.x,a=n.length,o=n.map(x=>s[x]),y=x=>Math.hypot(o[x].x-p,o[x].y-i.y),f=o.map((x,m)=>m).sort((x,m)=>+(o[x].x<p)-+(o[m].x<p)||y(x)-y(m)),b=f[0];for(let x of f){let m=o[x],d=o[(x+a-1)%a],M=o[(x+1)%a],P=h(m,M,i)>=0,z=h(d,m,i)>=0;if((h(d,m,M)>=0?P&&z:P||z)&&!u(i,m,o)&&!l.some(v=>u(i,m,v.pts))){b=x;break}}let g=[];for(let x=0;x<=b;x++)g.push(n[x]);for(let x=0;x<=c.indices.length;x++){let m=c.indices[(c.maxIdx+x)%c.indices.length];g.push(m)}for(let x=b;x<n.length;x++)g.push(n[x]);n=g}return{merged:n.map(c=>s[c]),mergedIndices:n,allVertices:s}}function Ae(t,e){let r=[],s=t.slice();if(s.length<3)return r;let n=s.length*s.length+64,l=0;for(;s.length>2&&n-- >0;){let h=s.length,u=s[(l+h-1)%h],c=s[l%h],i=s[(l+1)%h],p=e[u],a=e[c],o=e[i];if((a.x-p.x)*(o.y-p.y)-(a.y-p.y)*(o.x-p.x)>1e-9){let y=!0,f=Math.min(p.x,a.x,o.x)-1e-7,b=Math.max(p.x,a.x,o.x)+1e-7,g=Math.min(p.y,a.y,o.y)-1e-7,x=Math.max(p.y,a.y,o.y)+1e-7;for(let m=0;m<h;m++){let d=s[m];if(d===u||d===c||d===i)continue;let M=e[d];if(M.x>=f&&M.x<=b&&M.y>=g&&M.y<=x&&et(M.x,M.y,p.x,p.y,a.x,a.y,o.x,o.y)&&(M.x-p.x)*(M.x-p.x)+(M.y-p.y)*(M.y-p.y)>=1e-12&&(M.x-a.x)*(M.x-a.x)+(M.y-a.y)*(M.y-a.y)>=1e-12&&(M.x-o.x)*(M.x-o.x)+(M.y-o.y)*(M.y-o.y)>=1e-12){y=!1;break}}if(y){r.push([u,c,i]),s.splice(l%h,1),l=Math.max(0,l%h-1);continue}}l++,l>=h*2&&(r.push([u,c,i]),s.splice((l-1)%h,1),l=0)}return r}function ke(t,e){let r=t instanceof pe?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},s=r.shape.length;for(let n of r.holes)s+=n.length;if(s>ze)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${ze})`);return r}function Ie(t){let e=1/0,r=1/0,s=-1/0,n=-1/0;for(let l of t)l.x<e&&(e=l.x),l.y<r&&(r=l.y),l.x>s&&(s=l.x),l.y>n&&(n=l.y);return[e,r,Math.max(1e-6,s-e),Math.max(1e-6,n-r)]}class tt extends U{constructor(e=new pe,r=12){super();let s=Array.isArray(e)?e:[e],n=[],l=[],h=[],u=[];for(let c of s){if(!(c instanceof ce))continue;let i=ke(c,r);if(i.shape.length<3)continue;let{mergedIndices:p,allVertices:a}=Ee(i.shape,i.holes),o=Ae(p,a),y=n.length/3,[f,b,g,x]=Ie(a);for(let m of a)n.push(m.x,m.y,0),l.push(0,0,1),h.push((m.x-f)/g,(m.y-b)/x);for(let[m,d,M]of o)u.push(y+m,y+d,y+M)}xe(this,n,l,h,u)}}function xe(t,e,r,s,n){return t.setAttribute("position",new de(e,3)),t.setAttribute("normal",new de(r,3)),t.setAttribute("uv",new de(s,2)),t.setIndex(n),t}function rt(t){let e=t.length,r=[];for(let s=0;s<e;s++){let n=t[(s+e-1)%e],l=t[s],h=t[(s+1)%e],u=l.x-n.x,c=l.y-n.y,i=Math.hypot(u,c)||1;u/=i,c/=i;let p=h.x-l.x,a=h.y-l.y,o=Math.hypot(p,a)||1;p/=o,a/=o;let y=c,f=-u,b=a,g=-p,x=y+b,m=f+g,d=Math.hypot(x,m);if(d>1e-6){x/=d,m/=d;let M=Math.max(.35,x*y+m*f);r.push(new L(x/M,m/M))}else r.push(new L(y,f))}return r}class st extends U{constructor(e=new pe,r={}){super();let s=Array.isArray(e)?e:[e],n=Math.max(1,Math.min(64,Math.floor(H(r.curveSegments,12)))),l=H(r.depth??r.amount,1),h=Math.max(1,Math.min(32,Math.floor(H(r.steps,1)))),u=!!(r.bevelEnabled??!1),c=u?Math.max(0,H(r.bevelThickness,.06)):0,i=u?Math.max(0,H(r.bevelSize,c*.8)):0,p=u?H(r.bevelOffset,0):0,a=u?Math.max(1,Math.min(8,Math.floor(H(r.bevelSegments,2)))):0,o=[],y=[],f=[],b=[];for(let g of s){if(!(g instanceof ce))continue;let x=ke(g,n);if(x.shape.length<3)continue;let m=x.shape.slice();ye(m)<0&&m.reverse();let d=[];for(let T of x.holes){if(T.length<3)continue;let N=T.slice();ye(N)>0&&N.reverse(),d.push(N)}let{mergedIndices:M,allVertices:P}=Ee(m,d),z=Ae(M,P),v=[m,...d],w=[];for(let T of v){let N=rt(T);for(let R of N)w.push(R)}let[_,B,D,Y]=Ie(P);for(let[T,N]of[[-c,-1],[l+c,1]]){let R=o.length/3;for(let X=0;X<P.length;X++){let k=P[X],I=w[X]??new L(0,0),C=k.x+I.x*p,q=k.y+I.y*p;o.push(C,q,T),y.push(0,0,N),f.push((C-_)/D,(q-B)/Y)}for(let[X,k,I]of z)b.push(R+X,R+(N<0?I:k),R+(N<0?k:I))}let A=[];if(u&&a>0)for(let T=0;T<a;T++){let N=T/a*Math.PI/2;A.push({z:-c*Math.cos(N),expand:p+i*Math.sin(N)})}for(let T=0;T<=h;T++){let N=T/h;A.push({z:N*l,expand:p+i})}if(u&&a>0)for(let T=1;T<=a;T++){let N=T/a*Math.PI/2;A.push({z:l+c*Math.sin(N),expand:p+i*Math.cos(N)})}let G=0;for(let T of v){let N=T.length;for(let R=0;R<A.length-1;R++){let X=A[R],k=A[R+1];for(let I=0;I<N;I++){let C=(I+1)%N,q=T[I],O=T[C],V=w[G+I],$=w[G+C],j=q.x+V.x*X.expand,F=q.y+V.y*X.expand,ee=O.x+$.x*X.expand,te=O.y+$.y*X.expand,he=O.x+$.x*k.expand,ae=O.y+$.y*k.expand,J=q.x+V.x*k.expand,W=q.y+V.y*k.expand,Z=ee-j,Q=te-F,ut=J-j,ct=W-F,Ye=k.z-X.z,re=Q*Ye,se=-Z*Ye,ne=Z*ct-Q*ut,Se=Math.hypot(re,se,ne)||1;re/=Se,se/=Se,ne/=Se;let ie=o.length/3;o.push(j,F,X.z,ee,te,X.z,he,ae,k.z,J,W,k.z),y.push(re,se,ne,re,se,ne,re,se,ne,re,se,ne);let je=I/N,Fe=(I+1)/N,Le=R/(A.length-1),Qe=(R+1)/(A.length-1);f.push(je,Le,Fe,Le,Fe,Qe,je,Qe),b.push(ie,ie+1,ie+2,ie,ie+2,ie+3)}}G+=N}}xe(this,o,y,f,b)}}function Xe(t){return{x:t.x,y:t.y,z:t.z,nx:t.nx,ny:t.ny,nz:t.nz,u:t.u,v:t.v}}function nt(t){return{x:t.x,y:t.y,z:t.z,nx:-t.nx,ny:-t.ny,nz:-t.nz,u:t.u,v:t.v}}function it(t,e,r){let s=t.nx+(e.nx-t.nx)*r,n=t.ny+(e.ny-t.ny)*r,l=t.nz+(e.nz-t.nz)*r,h=Math.hypot(s,n,l)||1;return{x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r,z:t.z+(e.z-t.z)*r,nx:s/h,ny:n/h,nz:l/h,u:t.u+(e.u-t.u)*r,v:t.v+(e.v-t.v)*r}}function lt(t){if(t.length<3)return null;let e=t[0],r=t[1],s=t[2],n=r.x-e.x,l=r.y-e.y,h=r.z-e.z,u=s.x-e.x,c=s.y-e.y,i=s.z-e.z,p=l*i-h*c,a=h*u-n*i,o=n*c-l*u,y=Math.hypot(p,a,o);if(y<1e-9)return null;p/=y,a/=y,o/=y;let f=p*e.x+a*e.y+o*e.z;return{vertices:t,nx:p,ny:a,nz:o,w:f}}function ot(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=nt(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let Re=1e-5,De=0,ve=1,fe=2,qe=3;function Be(t,e,r,s,n,l,h,u,c){let i=0,p=[];for(let a=0;a<n.vertices.length;a++){let o=n.vertices[a],y=t*o.x+e*o.y+r*o.z-s,f=y<-Re?fe:y>Re?ve:De;i|=f,p.push(f)}switch(i){case De:{t*n.nx+e*n.ny+r*n.nz>0?l.push(n):h.push(n);break}case ve:u.push(n);break;case fe:c.push(n);break;case qe:{let a=[],o=[],y=n.vertices.length;for(let m=0;m<y;m++){let d=(m+1)%y,M=p[m],P=p[d],z=n.vertices[m],v=n.vertices[d];if(M!==fe&&a.push(z),M!==ve&&o.push(M!==fe?Xe(z):z),(M|P)===qe){let w=v.x-z.x,_=v.y-z.y,B=v.z-z.z,D=t*w+e*_+r*B,Y=Math.abs(D)>1e-12?(s-(t*z.x+e*z.y+r*z.z))/D:.5,A=it(z,v,Math.max(0,Math.min(1,Y)));a.push(A),o.push(Xe(A))}}let{nx:f,ny:b,nz:g,w:x}=n;a.length>=3&&u.push({vertices:a,nx:f,ny:b,nz:g,w:x}),o.length>=3&&c.push({vertices:o,nx:f,ny:b,nz:g,w:x});break}default:break}}class oe{constructor(e,r=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,r)}invert(){for(let r=0;r<this.polygons.length;r++)ot(this.polygons[r]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,r=0){if(!this.hasPlane||e.length===0)return e.slice();if(r>=K)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${K})`);let s=[],n=[];for(let l=0;l<e.length;l++)Be(this.nx,this.ny,this.nz,this.w,e[l],s,n,s,n);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,r+1)),this.back?n=n.length>0?this.back.clipPolygons(n,r+1):[]:n=[],s.concat(n)}clipTo(e,r=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),r<K&&(this.front&&this.front.clipTo(e,r+1),this.back&&this.back.clipTo(e,r+1))}allPolygons(e=[]){for(let r=0;r<this.polygons.length;r++)e.push(this.polygons[r]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,r=0){if(!e.length)return;if(!this.hasPlane){let l=e[e.length>>1];this.nx=l.nx,this.ny=l.ny,this.nz=l.nz,this.w=l.w,this.hasPlane=!0}if(r>=K)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${K})`);let s=[],n=[];for(let l=0;l<e.length;l++)Be(this.nx,this.ny,this.nz,this.w,e[l],this.polygons,this.polygons,s,n);s.length>0&&(this.front||(this.front=new oe),this.front.build(s,r+1)),n.length>0&&(this.back||(this.back=new oe),this.back.build(n,r+1))}}function Ce(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let r=t.attributes.position;if(!r||r.count===0)return[];let s=t.attributes.normal,n=t.attributes.uv,l=t.index?t.index.array:null,h=Math.floor(l?l.length/3:r.count/3);if(h>le)throw new RangeError(`SecurityError: CSG input triangle count (${h}) exceeds MAX_CSG_TRIANGLES (${le})`);let u=e?e.elements:null,c=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,i=u?new Ze().getNormalMatrix(e).elements:null,p=o=>{let y=r.getX(o),f=r.getY(o),b=r.getZ(o),g=s?s.getX(o):NaN,x=s?s.getY(o):NaN,m=s?s.getZ(o):NaN;if(u&&i){let P=u[0]*y+u[4]*f+u[8]*b+u[12],z=u[1]*y+u[5]*f+u[9]*b+u[13],v=u[2]*y+u[6]*f+u[10]*b+u[14];y=P,f=z,b=v;let w=i[0]*g+i[3]*x+i[6]*m,_=i[1]*g+i[4]*x+i[7]*m,B=i[2]*g+i[5]*x+i[8]*m,D=Math.hypot(w,_,B)||1;g=w/D,x=_/D,m=B/D}let d=n?n.getX(o):0,M=n?n.getY(o):0;return{x:y,y:f,z:b,nx:g,ny:x,nz:m,u:d,v:M}},a=[];for(let o=0;o<h;o++){let y=l?l[o*3]:o*3,f=l?l[o*3+1]:o*3+1,b=l?l[o*3+2]:o*3+2,g=lt(c?[p(y),p(b),p(f)]:[p(y),p(f),p(b)]);g&&a.push(g)}return a}function ht(t){let e=[],r=[],s=[],n=[];for(let h of t){let u=h.vertices;if(u.length<3)continue;let c=e.length/3;for(let i of u)e.push(i.x,i.y,i.z),Number.isFinite(i.nx)&&i.nx*i.nx+i.ny*i.ny+i.nz*i.nz>.5?r.push(i.nx,i.ny,i.nz):r.push(h.nx,h.ny,h.nz),s.push(i.u,i.v);for(let i=1;i<u.length-1;i++)n.push(c,c+i,c+i+1)}let l=xe(new U,e,r,s,n);return l._csgPolygons=t,l}function at(t,e,r){if(t.length+e.length>le)throw new RangeError(`SecurityError: Combined CSG triangle count (${t.length+e.length}) exceeds MAX_CSG_TRIANGLES (${le})`);if(t.length===0)return r==="union"?e:[];if(e.length===0)return r==="intersect"?[]:t;let s=1/0,n=1/0,l=1/0,h=-1/0,u=-1/0,c=-1/0;for(let y=0;y<e.length;y++){let f=e[y].vertices;for(let b=0;b<f.length;b++){let g=f[b];g.x<s&&(s=g.x),g.y<n&&(n=g.y),g.z<l&&(l=g.z),g.x>h&&(h=g.x),g.y>u&&(u=g.y),g.z>c&&(c=g.z)}}s-=1e-4,n-=1e-4,l-=1e-4,h+=1e-4,u+=1e-4,c+=1e-4;let i=[],p=[];for(let y=0;y<t.length;y++){let f=t[y],b=f.vertices,g=1/0,x=1/0,m=1/0,d=-1/0,M=-1/0,P=-1/0;for(let z=0;z<b.length;z++){let v=b[z];v.x<g&&(g=v.x),v.y<x&&(x=v.y),v.z<m&&(m=v.z),v.x>d&&(d=v.x),v.y>M&&(M=v.y),v.z>P&&(P=v.z)}d<s||g>h||M<n||x>u||P<l||m>c?p.push(f):i.push(f)}if(i.length===0)return r==="union"?t.concat(e):r==="subtract"?t:[];let a=new oe(i),o=new oe(e);return r==="union"?(a.clipTo(o),o.clipTo(a),o.invert(),o.clipTo(a),o.invert(),a.build(o.allPolygons()),p.concat(a.allPolygons())):r==="subtract"?(a.invert(),a.clipTo(o),o.clipTo(a),o.invert(),o.clipTo(a),o.invert(),a.build(o.allPolygons()),a.invert(),p.concat(a.allPolygons())):(a.invert(),o.clipTo(a),o.invert(),a.clipTo(o),o.clipTo(a),a.build(o.allPolygons()),a.invert(),a.allPolygons())}function He(t,e,r,s=null,n=null){let l=Ce(t,s),h=Ce(e,n);return ht(at(l,h,r))}function Pe(t,e,r){let s=t instanceof ue||!!t?.isMesh,n=e instanceof ue||!!e?.isMesh,l=s?t.geometry:t,h=n?e.geometry:e,u=null;if(n)if(e.updateMatrix(),s){t.updateMatrix();let a=new Me().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),o=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,y=new Me().compose(new Ne(0,0,0),new We(-t.quaternion.x/o,-t.quaternion.y/o,-t.quaternion.z/o,t.quaternion.w/o),new Ne(1,1,1)),f=new Me().makeTranslation(-t.position.x,-t.position.y,-t.position.z);u=a.multiply(y).multiply(f).multiply(e.matrix)}else u=e.matrix;let c=He(l,h,r,null,u),i=s?t.material:new Te,p=new ue(c,i);return s&&(p.position.copy(t.position),p.quaternion.copy(t.quaternion),p.scale.copy(t.scale),p.name=t.name),p}let ge={toGeometry:He,subtract(t,e){return Pe(t,e,"subtract")},union(t,e){return Pe(t,e,"union")},intersect(t,e){return Pe(t,e,"intersect")}},Ge={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class Oe extends U{constructor(e="",r={}){super();let s=String(e??"").slice(0,_e),n=Math.max(.005,Math.min(100,H(r.size,.2))),l=!!(r.bevelEnabled??!1),h=l?Math.max(0,Math.min(2,H(r.bevelThickness,n*.04))):0,u=l?Math.max(0,Math.min(2,H(r.bevelSize,n*.03))):0,c=Math.max(.001,Math.min(20,H(r.depth??r.height,n*.2)))+h*2,i=n*.085+u,p=n*.68,a=n*.82,o=[],y=[],f=[],b=[],g=(d,M,P,z,v,w,_)=>{let B=P-d,D=z-M,Y=Math.hypot(B,D),A=1,G=0;Y>1e-6&&(A=B/Y,G=D/Y);let T=-G*v,N=A*v,R=A*v*.6,X=G*v*.6,k=d-R+T,I=M-X+N,C=d-R-T,q=M-X-N,O=P+R-T,V=z+X-N,$=P+R+T,j=z+X+N,F=(ee,te,he,ae,J,W,Z)=>{let Q=o.length/3;o.push(ee[0],ee[1],ee[2],te[0],te[1],te[2],he[0],he[1],he[2],ae[0],ae[1],ae[2]),y.push(J,W,Z,J,W,Z,J,W,Z,J,W,Z),f.push(0,0,1,0,1,1,0,1),b.push(Q,Q+1,Q+2,Q,Q+2,Q+3)};F([k,I,_],[C,q,_],[O,V,_],[$,j,_],0,0,1),F([C,q,w],[k,I,w],[$,j,w],[O,V,w],0,0,-1),F([k,I,w],[C,q,w],[C,q,_],[k,I,_],-A,-G,0),F([O,V,w],[$,j,w],[$,j,_],[O,V,_],A,G,0),F([C,q,w],[O,V,w],[O,V,_],[C,q,_],G,-A,0),F([$,j,w],[k,I,w],[k,I,_],[$,j,_],-G,A,0)},x=0,m=0;for(let d=0;d<s.length;d++){let M=s[d];if(M===`
|
|
17
|
-
`){
|
|
16
|
+
*/var me="__THREE_LIVE_REGISTRY__";function be(){let z=typeof globalThis<"u"?globalThis:{};if(!z[me]){let _={plugins:[],decoders:new Map};try{Object.defineProperty(z,me,{value:_,writable:!1,configurable:!1,enumerable:!1})}catch{z[me]=_}}return z[me]}var bt=be().plugins;function pt(z){let _=be();_.workerExtensionInstallers||(_.workerExtensionInstallers=[]),_.workerExtensionInstallers.includes(z)||_.workerExtensionInstallers.push(z)}function yt(z){let _=be().plugins;_.some(F=>F.name===z.name)||_.push(z),z.onRegister?.()}var ft=8192,xt=2048,gt=128,mt=4096;function Ne(z,_){if(!z||!z.BufferGeometry)return null;let F=z.Vector2,Se=z.Vector3,Je=z.Quaternion,de=z.Matrix4,Ke=z.Matrix3,Ze=z.Color,ve=z.BufferAttribute,Z=z.BufferGeometry,Qe=z.Material,Ae=z.MeshStandardMaterial,ue=z.Mesh,le=8192,Q=2048,_e=128,Me=4096,H=(n,e)=>{let t=n==null?NaN:Number(n);return Number.isFinite(t)?t:e};class ce{constructor(e){this.currentPoint=new F(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){let r=Number(e)||0,s=Number(t)||0;return this.currentPoint.set(r,s),this.segments.push({type:"move",pts:[r,s]}),this}lineTo(e,t){let r=Number(e)||0,s=Number(t)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(r,s),this.segments.push({type:"line",pts:[r,s]}),this}quadraticCurveTo(e,t,r,s){let l=this.currentPoint.x,h=this.currentPoint.y,a=Number(e)||0,c=Number(t)||0,i=Number(r)||0,p=Number(s)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[l,h]}),this.currentPoint.set(i,p),this.segments.push({type:"quad",pts:[l,h,a,c,i,p]}),this}bezierCurveTo(e,t,r,s,l,h){let a=this.currentPoint.x,c=this.currentPoint.y,i=Number(e)||0,p=Number(t)||0,u=Number(r)||0,o=Number(s)||0,y=Number(l)||0,x=Number(h)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,c]}),this.currentPoint.set(y,x),this.segments.push({type:"cubic",pts:[a,c,i,p,u,o,y,x]}),this}absarc(e,t,r,s,l,h=!1){return this.absellipse(e,t,r,r,s,l,h,0)}arc(e,t,r,s,l,h=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),r,s,l,h)}absellipse(e,t,r,s,l,h,a=!1,c=0){let i=Number(e)||0,p=Number(t)||0,u=Math.max(0,Number(r)||0),o=Math.max(0,Number(s)||0),y=Number(l)||0,x=Number(h)||0,b=a?1:0,g=Number(c)||0;this.segments.push({type:"arc",pts:[i,p,u,o,y,x,b,g]});let f=Math.cos(g),m=Math.sin(g),v=u*Math.cos(x),d=o*Math.sin(x);return this.currentPoint.set(i+v*f-d*m,p+v*m+d*f),this}ellipse(e,t,r,s,l,h,a=!1,c=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),r,s,l,h,a,c)}add(e){if(e&&typeof e.getPoints=="function"){this.segments.push({type:"curve",pts:[],curve:e});let t=e.getPoint?.(1);t&&this.currentPoint.set(Number(t.x)||0,Number(t.y)||0)}return this}splineThru(e){if(!Array.isArray(e)||e.length===0)return this;let t=z.SplineCurve||_?.authorNamespace?.SplineCurve;if(t)return this.add(new t([this.currentPoint.clone(),...e]));for(let r of e)r&&this.lineTo(Number(r.x)||0,Number(r.y)||0);return this}closePath(){if(this.segments.length>0){let e=this.segments[0],t=0,r=0;if(e.type==="curve"&&e.curve?.getPoint){let s=e.curve.getPoint(0);t=Number(s?.x)||0,r=Number(s?.y)||0}else if(e.type==="arc"){let s=e.pts[0],l=e.pts[1],h=e.pts[2],a=e.pts[3],c=e.pts[4],i=e.pts[7],p=Math.cos(i),u=Math.sin(i),o=h*Math.cos(c),y=a*Math.sin(c);t=s+o*p-y*u,r=l+o*u+y*p}else t=e.pts[0],r=e.pts[1];Math.hypot(this.currentPoint.x-t,this.currentPoint.y-r)>1e-6&&this.lineTo(t,r)}return this}getPoints(e=12){let t=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),r=[],s=(l,h)=>{if(r.length>0){let a=r[r.length-1];if(Math.hypot(a.x-l,a.y-h)<1e-6)return}r.push(new F(l,h))};for(let l of this.segments){let h=l.pts;if(l.type==="move"||l.type==="line")s(h[0],h[1]);else if(l.type==="quad"){let a=h[0],c=h[1],i=h[2],p=h[3],u=h[4],o=h[5];s(a,c);for(let y=1;y<=t;y++){let x=y/t,b=1-x;s(b*b*a+2*b*x*i+x*x*u,b*b*c+2*b*x*p+x*x*o)}}else if(l.type==="cubic"){let a=h[0],c=h[1],i=h[2],p=h[3],u=h[4],o=h[5],y=h[6],x=h[7];s(a,c);for(let b=1;b<=t;b++){let g=b/t,f=1-g,m=f*f,v=g*g;s(m*f*a+3*m*g*i+3*f*v*u+v*g*y,m*f*c+3*m*g*p+3*f*v*o+v*g*x)}}else if(l.type==="arc"){let a=h[0],c=h[1],i=h[2],p=h[3],u=h[4],o=h[5],y=h[6]!==0,x=h[7],b=Math.PI*2,g=o-u,f=Math.abs(g)<1e-9;for(;g<0;)g+=b;for(;g>b;)g-=b;g<1e-9&&(g=f?0:b),y&&!f&&(g=g===b?-b:g-b);let m=Math.cos(x),v=Math.sin(x),d=Math.max(2,t);for(let w=0;w<=d;w++){let M=w/d,P=u+M*g,N=i*Math.cos(P),E=p*Math.sin(P);s(a+N*m-E*v,c+N*v+E*m)}}else if(l.type==="curve"&&l.curve?.getPoints)for(let a of l.curve.getPoints(t))a&&s(Number(a.x)||0,Number(a.y)||0)}if(r.length>2){let l=r[0],h=r[r.length-1];Math.hypot(l.x-h.x,l.y-h.y)<1e-6&&r.pop()}return r}getSpacedPoints(e=12){return this.getPoints(e)}clone(){let e=new this.constructor;return e.currentPoint.copy(this.currentPoint),e.segments=this.segments.map(t=>({type:t.type,pts:[...t.pts],...t.curve?{curve:t.curve.clone?t.curve.clone():t.curve}:{}})),Array.isArray(this.holes)&&(e.holes=this.holes.map(t=>t.clone())),e}}class pe extends ce{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(t=>t.getPoints(e))}}}function ye(n){let e=0,t=n.length;for(let r=0,s=t-1;r<t;s=r++)e+=n[s].x*n[r].y-n[r].x*n[s].y;return e*.5}function et(n,e,t,r,s,l,h,a){let c=h-t,i=a-r,p=s-t,u=l-r,o=n-t,y=e-r,x=c*c+i*i,b=c*p+i*u,g=c*o+i*y,f=p*p+u*u,m=p*o+u*y,v=x*f-b*b;if(Math.abs(v)<1e-12)return!1;let d=1/v,w=(f*g-b*m)*d,M=(x*m-b*g)*d;return w>=-1e-7&&M>=-1e-7&&w+M<=1+1e-7}function Ee(n,e){let t=n.slice();ye(t)<0&&t.reverse();let r=t.map(c=>new F(c.x,c.y)),s=t.map((c,i)=>i),l=[];for(let c of e){if(!c||c.length<3)continue;let i=c.slice();ye(i)>0&&i.reverse();let p=[],u=-1/0,o=0;for(let y=0;y<i.length;y++){let x=i[y],b=r.length;r.push(new F(x.x,x.y)),p.push(b),x.x>u&&(u=x.x,o=y)}l.push({pts:i,indices:p,maxX:u,maxIdx:o})}l.sort((c,i)=>i.maxX-c.maxX);let h=(c,i,p)=>(i.x-c.x)*(p.y-c.y)-(i.y-c.y)*(p.x-c.x),a=(c,i,p)=>{for(let u=0;u<p.length;u++){let o=p[u],y=p[(u+1)%p.length];if(h(c,i,o)*h(c,i,y)<0&&h(o,y,c)*h(o,y,i)<0)return!0}return!1};for(let c of l){let i=c.pts[c.maxIdx],p=i.x,u=s.length,o=s.map(f=>r[f]),y=f=>Math.hypot(o[f].x-p,o[f].y-i.y),x=o.map((f,m)=>m).sort((f,m)=>+(o[f].x<p)-+(o[m].x<p)||y(f)-y(m)),b=x[0];for(let f of x){let m=o[f],v=o[(f+u-1)%u],d=o[(f+1)%u],w=h(m,d,i)>=0,M=h(v,m,i)>=0;if((h(v,m,d)>=0?w&&M:w||M)&&!a(i,m,o)&&!l.some(P=>a(i,m,P.pts))){b=f;break}}let g=[];for(let f=0;f<=b;f++)g.push(s[f]);for(let f=0;f<=c.indices.length;f++){let m=c.indices[(c.maxIdx+f)%c.indices.length];g.push(m)}for(let f=b;f<s.length;f++)g.push(s[f]);s=g}return{merged:s.map(c=>r[c]),mergedIndices:s,allVertices:r}}function Te(n,e){let t=[],r=n.slice();if(r.length<3)return t;let s=r.length*r.length+64,l=0;for(;r.length>2&&s-- >0;){let h=r.length,a=r[(l+h-1)%h],c=r[l%h],i=r[(l+1)%h],p=e[a],u=e[c],o=e[i];if((u.x-p.x)*(o.y-p.y)-(u.y-p.y)*(o.x-p.x)>1e-9){let y=!0,x=Math.min(p.x,u.x,o.x)-1e-7,b=Math.max(p.x,u.x,o.x)+1e-7,g=Math.min(p.y,u.y,o.y)-1e-7,f=Math.max(p.y,u.y,o.y)+1e-7;for(let m=0;m<h;m++){let v=r[m];if(v===a||v===c||v===i)continue;let d=e[v];if(d.x>=x&&d.x<=b&&d.y>=g&&d.y<=f&&et(d.x,d.y,p.x,p.y,u.x,u.y,o.x,o.y)&&(d.x-p.x)*(d.x-p.x)+(d.y-p.y)*(d.y-p.y)>=1e-12&&(d.x-u.x)*(d.x-u.x)+(d.y-u.y)*(d.y-u.y)>=1e-12&&(d.x-o.x)*(d.x-o.x)+(d.y-o.y)*(d.y-o.y)>=1e-12){y=!1;break}}if(y){t.push([a,c,i]),r.splice(l%h,1),l=Math.max(0,l%h-1);continue}}l++,l>=h*2&&(t.push([a,c,i]),r.splice((l-1)%h,1),l=0)}return t}function ke(n,e){let t=n instanceof pe?n.extractPoints(e):{shape:n.getPoints(e),holes:[]},r=t.shape.length;for(let s of t.holes)r+=s.length;if(r>Me)throw new RangeError(`SecurityError: shape point count (${r}) exceeds MAX_SHAPE_POINTS (${Me})`);return t}function Ie(n){let e=1/0,t=1/0,r=-1/0,s=-1/0;for(let l of n)l.x<e&&(e=l.x),l.y<t&&(t=l.y),l.x>r&&(r=l.x),l.y>s&&(s=l.y);return[e,t,Math.max(1e-6,r-e),Math.max(1e-6,s-t)]}class tt extends Z{constructor(e=new pe,t=12){super();let r=Array.isArray(e)?e:[e],s=[],l=[],h=[],a=[];for(let c of r){if(!(c instanceof ce))continue;let i=ke(c,t);if(i.shape.length<3)continue;let{mergedIndices:p,allVertices:u}=Ee(i.shape,i.holes),o=Te(p,u),y=s.length/3,[x,b,g,f]=Ie(u);for(let m of u)s.push(m.x,m.y,0),l.push(0,0,1),h.push((m.x-x)/g,(m.y-b)/f);for(let[m,v,d]of o)a.push(y+m,y+v,y+d)}fe(this,s,l,h,a)}}function fe(n,e,t,r,s){return n.setAttribute("position",new ve(e,3)),n.setAttribute("normal",new ve(t,3)),n.setAttribute("uv",new ve(r,2)),n.setIndex(s),n}function nt(n){let e=n.length,t=[];for(let r=0;r<e;r++){let s=n[(r+e-1)%e],l=n[r],h=n[(r+1)%e],a=l.x-s.x,c=l.y-s.y,i=Math.hypot(a,c)||1;a/=i,c/=i;let p=h.x-l.x,u=h.y-l.y,o=Math.hypot(p,u)||1;p/=o,u/=o;let y=c,x=-a,b=u,g=-p,f=y+b,m=x+g,v=Math.hypot(f,m);if(v>1e-6){f/=v,m/=v;let d=Math.max(.35,f*y+m*x);t.push(new F(f/d,m/d))}else t.push(new F(y,x))}return t}class rt extends Z{constructor(e=new pe,t={}){super();let r=Array.isArray(e)?e:[e],s=Math.max(1,Math.min(64,Math.floor(H(t.curveSegments,12)))),l=H(t.depth??t.amount,1),h=Math.max(1,Math.min(32,Math.floor(H(t.steps,1)))),a=!!(t.bevelEnabled??!1),c=a?Math.max(0,H(t.bevelThickness,.06)):0,i=a?Math.max(0,H(t.bevelSize,c*.8)):0,p=a?H(t.bevelOffset,0):0,u=a?Math.max(1,Math.min(8,Math.floor(H(t.bevelSegments,2)))):0,o=[],y=[],x=[],b=[];for(let g of r){if(!(g instanceof ce))continue;let f=ke(g,s);if(f.shape.length<3)continue;let m=f.shape.slice();ye(m)<0&&m.reverse();let v=[];for(let A of f.holes){if(A.length<3)continue;let S=A.slice();ye(S)>0&&S.reverse(),v.push(S)}let{mergedIndices:d,allVertices:w}=Ee(m,v),M=Te(d,w),P=[m,...v],N=[];for(let A of P){let S=nt(A);for(let D of S)N.push(D)}let[E,q,X,Y]=Ie(w);for(let[A,S]of[[-c,-1],[l+c,1]]){let D=o.length/3;for(let R=0;R<w.length;R++){let k=w[R],I=N[R]??new F(0,0),B=k.x+I.x*p,C=k.y+I.y*p;o.push(B,C,A),y.push(0,0,S),x.push((B-E)/X,(C-q)/Y)}for(let[R,k,I]of M)b.push(D+R,D+(S<0?I:k),D+(S<0?k:I))}let T=[];if(a&&u>0)for(let A=0;A<u;A++){let S=A/u*Math.PI/2;T.push({z:-c*Math.cos(S),expand:p+i*Math.sin(S)})}for(let A=0;A<=h;A++){let S=A/h;T.push({z:S*l,expand:p+i})}if(a&&u>0)for(let A=1;A<=u;A++){let S=A/u*Math.PI/2;T.push({z:l+c*Math.sin(S),expand:p+i*Math.cos(S)})}let L=0;for(let A of P){let S=A.length;for(let D=0;D<T.length-1;D++){let R=T[D],k=T[D+1];for(let I=0;I<S;I++){let B=(I+1)%S,C=A[I],V=A[B],G=N[L+I],O=N[L+B],j=C.x+G.x*R.expand,$=C.y+G.y*R.expand,ee=V.x+O.x*R.expand,te=V.y+O.y*R.expand,he=V.x+O.x*k.expand,ae=V.y+O.y*k.expand,U=C.x+G.x*k.expand,J=C.y+G.y*k.expand,K=ee-j,W=te-$,ut=U-j,ct=J-$,Ye=k.z-R.z,ne=W*Ye,re=-K*Ye,se=K*ct-W*ut,we=Math.hypot(ne,re,se)||1;ne/=we,re/=we,se/=we;let ie=o.length/3;o.push(j,$,R.z,ee,te,R.z,he,ae,k.z,U,J,k.z),y.push(ne,re,se,ne,re,se,ne,re,se,ne,re,se);let je=I/S,$e=(I+1)/S,Fe=D/(T.length-1),We=(D+1)/(T.length-1);x.push(je,Fe,$e,Fe,$e,We,je,We),b.push(ie,ie+1,ie+2,ie,ie+2,ie+3)}}L+=S}}fe(this,o,y,x,b)}}function Re(n){return{x:n.x,y:n.y,z:n.z,nx:n.nx,ny:n.ny,nz:n.nz,u:n.u,v:n.v}}function st(n){return{x:n.x,y:n.y,z:n.z,nx:-n.nx,ny:-n.ny,nz:-n.nz,u:n.u,v:n.v}}function it(n,e,t){let r=n.nx+(e.nx-n.nx)*t,s=n.ny+(e.ny-n.ny)*t,l=n.nz+(e.nz-n.nz)*t,h=Math.hypot(r,s,l)||1;return{x:n.x+(e.x-n.x)*t,y:n.y+(e.y-n.y)*t,z:n.z+(e.z-n.z)*t,nx:r/h,ny:s/h,nz:l/h,u:n.u+(e.u-n.u)*t,v:n.v+(e.v-n.v)*t}}function lt(n){if(n.length<3)return null;let e=n[0],t=n[1],r=n[2],s=t.x-e.x,l=t.y-e.y,h=t.z-e.z,a=r.x-e.x,c=r.y-e.y,i=r.z-e.z,p=l*i-h*c,u=h*a-s*i,o=s*c-l*a,y=Math.hypot(p,u,o);if(y<1e-9)return null;p/=y,u/=y,o/=y;let x=p*e.x+u*e.y+o*e.z;return{vertices:n,nx:p,ny:u,nz:o,w:x}}function ot(n){n.vertices.reverse();for(let e=0;e<n.vertices.length;e++)n.vertices[e]=st(n.vertices[e]);n.nx=-n.nx,n.ny=-n.ny,n.nz=-n.nz,n.w=-n.w}let De=1e-5,Xe=0,Pe=1,xe=2,Ce=3;function qe(n,e,t,r,s,l,h,a,c){let i=0,p=[];for(let u=0;u<s.vertices.length;u++){let o=s.vertices[u],y=n*o.x+e*o.y+t*o.z-r,x=y<-De?xe:y>De?Pe:Xe;i|=x,p.push(x)}switch(i){case Xe:{n*s.nx+e*s.ny+t*s.nz>0?l.push(s):h.push(s);break}case Pe:a.push(s);break;case xe:c.push(s);break;case Ce:{let u=[],o=[],y=s.vertices.length;for(let m=0;m<y;m++){let v=(m+1)%y,d=p[m],w=p[v],M=s.vertices[m],P=s.vertices[v];if(d!==xe&&u.push(M),d!==Pe&&o.push(d!==xe?Re(M):M),(d|w)===Ce){let N=P.x-M.x,E=P.y-M.y,q=P.z-M.z,X=n*N+e*E+t*q,Y=Math.abs(X)>1e-12?(r-(n*M.x+e*M.y+t*M.z))/X:.5,T=it(M,P,Math.max(0,Math.min(1,Y)));u.push(T),o.push(Re(T))}}let{nx:x,ny:b,nz:g,w:f}=s;u.length>=3&&a.push({vertices:u,nx:x,ny:b,nz:g,w:f}),o.length>=3&&c.push({vertices:o,nx:x,ny:b,nz:g,w:f});break}default:break}}class oe{constructor(e,t=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,t)}invert(){for(let t=0;t<this.polygons.length;t++)ot(this.polygons[t]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,t=0){if(!this.hasPlane||e.length===0)return e.slice();if(t>=Q)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${Q})`);let r=[],s=[];for(let l=0;l<e.length;l++)qe(this.nx,this.ny,this.nz,this.w,e[l],r,s,r,s);return this.front&&r.length>0&&(r=this.front.clipPolygons(r,t+1)),this.back?s=s.length>0?this.back.clipPolygons(s,t+1):[]:s=[],r.concat(s)}clipTo(e,t=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),t<Q&&(this.front&&this.front.clipTo(e,t+1),this.back&&this.back.clipTo(e,t+1))}allPolygons(e=[]){for(let t=0;t<this.polygons.length;t++)e.push(this.polygons[t]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,t=0){if(!e.length)return;if(!this.hasPlane){let l=e[e.length>>1];this.nx=l.nx,this.ny=l.ny,this.nz=l.nz,this.w=l.w,this.hasPlane=!0}if(t>=Q)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${Q})`);let r=[],s=[];for(let l=0;l<e.length;l++)qe(this.nx,this.ny,this.nz,this.w,e[l],this.polygons,this.polygons,r,s);r.length>0&&(this.front||(this.front=new oe),this.front.build(r,t+1)),s.length>0&&(this.back||(this.back=new oe),this.back.build(s,t+1))}}function Be(n,e){if(!e&&n._csgPolygons)return n._csgPolygons;let t=n.attributes.position;if(!t||t.count===0)return[];let r=n.attributes.normal,s=n.attributes.uv,l=n.index?n.index.array:null,h=Math.floor(l?l.length/3:t.count/3);if(h>le)throw new RangeError(`SecurityError: CSG input triangle count (${h}) exceeds MAX_CSG_TRIANGLES (${le})`);let a=e?e.elements:null,c=a?a[0]*(a[5]*a[10]-a[9]*a[6])-a[4]*(a[1]*a[10]-a[9]*a[2])+a[8]*(a[1]*a[6]-a[5]*a[2])<0:!1,i=a?new Ke().getNormalMatrix(e).elements:null,p=o=>{let y=t.getX(o),x=t.getY(o),b=t.getZ(o),g=r?r.getX(o):NaN,f=r?r.getY(o):NaN,m=r?r.getZ(o):NaN;if(a&&i){let w=a[0]*y+a[4]*x+a[8]*b+a[12],M=a[1]*y+a[5]*x+a[9]*b+a[13],P=a[2]*y+a[6]*x+a[10]*b+a[14];y=w,x=M,b=P;let N=i[0]*g+i[3]*f+i[6]*m,E=i[1]*g+i[4]*f+i[7]*m,q=i[2]*g+i[5]*f+i[8]*m,X=Math.hypot(N,E,q)||1;g=N/X,f=E/X,m=q/X}let v=s?s.getX(o):0,d=s?s.getY(o):0;return{x:y,y:x,z:b,nx:g,ny:f,nz:m,u:v,v:d}},u=[];for(let o=0;o<h;o++){let y=l?l[o*3]:o*3,x=l?l[o*3+1]:o*3+1,b=l?l[o*3+2]:o*3+2,g=lt(c?[p(y),p(b),p(x)]:[p(y),p(x),p(b)]);g&&u.push(g)}return u}function ht(n){let e=[],t=[],r=[],s=[];for(let h of n){let a=h.vertices;if(a.length<3)continue;let c=e.length/3;for(let i of a)e.push(i.x,i.y,i.z),Number.isFinite(i.nx)&&i.nx*i.nx+i.ny*i.ny+i.nz*i.nz>.5?t.push(i.nx,i.ny,i.nz):t.push(h.nx,h.ny,h.nz),r.push(i.u,i.v);for(let i=1;i<a.length-1;i++)s.push(c,c+i,c+i+1)}let l=fe(new Z,e,t,r,s);return l._csgPolygons=n,l}function at(n,e,t){if(n.length+e.length>le)throw new RangeError(`SecurityError: Combined CSG triangle count (${n.length+e.length}) exceeds MAX_CSG_TRIANGLES (${le})`);if(n.length===0)return t==="union"?e:[];if(e.length===0)return t==="intersect"?[]:n;let r=1/0,s=1/0,l=1/0,h=-1/0,a=-1/0,c=-1/0;for(let y=0;y<e.length;y++){let x=e[y].vertices;for(let b=0;b<x.length;b++){let g=x[b];g.x<r&&(r=g.x),g.y<s&&(s=g.y),g.z<l&&(l=g.z),g.x>h&&(h=g.x),g.y>a&&(a=g.y),g.z>c&&(c=g.z)}}r-=1e-4,s-=1e-4,l-=1e-4,h+=1e-4,a+=1e-4,c+=1e-4;let i=[],p=[];for(let y=0;y<n.length;y++){let x=n[y],b=x.vertices,g=1/0,f=1/0,m=1/0,v=-1/0,d=-1/0,w=-1/0;for(let M=0;M<b.length;M++){let P=b[M];P.x<g&&(g=P.x),P.y<f&&(f=P.y),P.z<m&&(m=P.z),P.x>v&&(v=P.x),P.y>d&&(d=P.y),P.z>w&&(w=P.z)}v<r||g>h||d<s||f>a||w<l||m>c?p.push(x):i.push(x)}if(i.length===0)return t==="union"?n.concat(e):t==="subtract"?n:[];let u=new oe(i),o=new oe(e);return t==="union"?(u.clipTo(o),o.clipTo(u),o.invert(),o.clipTo(u),o.invert(),u.build(o.allPolygons()),p.concat(u.allPolygons())):t==="subtract"?(u.invert(),u.clipTo(o),o.clipTo(u),o.invert(),o.clipTo(u),o.invert(),u.build(o.allPolygons()),u.invert(),p.concat(u.allPolygons())):(u.invert(),o.clipTo(u),o.invert(),u.clipTo(o),o.clipTo(u),u.build(o.allPolygons()),u.invert(),u.allPolygons())}function He(n,e,t,r=null,s=null){let l=Be(n,r),h=Be(e,s);return ht(at(l,h,t))}function ze(n,e,t){let r=n instanceof ue||!!n?.isMesh,s=e instanceof ue||!!e?.isMesh,l=r?n.geometry:n,h=s?e.geometry:e,a=null;if(s)if(e.updateMatrix(),r){n.updateMatrix();let u=new de().makeScale(1/(n.scale.x||1),1/(n.scale.y||1),1/(n.scale.z||1)),o=Math.hypot(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w)||1,y=new de().compose(new Se(0,0,0),new Je(-n.quaternion.x/o,-n.quaternion.y/o,-n.quaternion.z/o,n.quaternion.w/o),new Se(1,1,1)),x=new de().makeTranslation(-n.position.x,-n.position.y,-n.position.z);a=u.multiply(y).multiply(x).multiply(e.matrix)}else a=e.matrix;let c=He(l,h,t,null,a),i=r?n.material:new Ae,p=new ue(c,i);return r&&(p.position.copy(n.position),p.quaternion.copy(n.quaternion),p.scale.copy(n.scale),p.name=n.name),p}let ge={toGeometry:He,subtract(n,e){return ze(n,e,"subtract")},union(n,e){return ze(n,e,"union")},intersect(n,e){return ze(n,e,"intersect")}},Le={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class Ve extends Z{constructor(e="",t={}){super();let r=String(e??"").slice(0,_e),s=Math.max(.005,Math.min(100,H(t.size,.2))),l=!!(t.bevelEnabled??!1),h=l?Math.max(0,Math.min(2,H(t.bevelThickness,s*.04))):0,a=l?Math.max(0,Math.min(2,H(t.bevelSize,s*.03))):0,c=Math.max(.001,Math.min(20,H(t.depth??t.height,s*.2)))+h*2,i=s*.085+a,p=s*.68,u=s*.82,o=[],y=[],x=[],b=[],g=(v,d,w,M,P,N,E)=>{let q=w-v,X=M-d,Y=Math.hypot(q,X),T=1,L=0;Y>1e-6&&(T=q/Y,L=X/Y);let A=-L*P,S=T*P,D=T*P*.6,R=L*P*.6,k=v-D+A,I=d-R+S,B=v-D-A,C=d-R-S,V=w+D-A,G=M+R-S,O=w+D+A,j=M+R+S,$=(ee,te,he,ae,U,J,K)=>{let W=o.length/3;o.push(ee[0],ee[1],ee[2],te[0],te[1],te[2],he[0],he[1],he[2],ae[0],ae[1],ae[2]),y.push(U,J,K,U,J,K,U,J,K,U,J,K),x.push(0,0,1,0,1,1,0,1),b.push(W,W+1,W+2,W,W+2,W+3)};$([k,I,E],[B,C,E],[V,G,E],[O,j,E],0,0,1),$([B,C,N],[k,I,N],[O,j,N],[V,G,N],0,0,-1),$([k,I,N],[B,C,N],[B,C,E],[k,I,E],-T,-L,0),$([V,G,N],[O,j,N],[O,j,E],[V,G,E],T,L,0),$([B,C,N],[V,G,N],[V,G,E],[B,C,E],L,-T,0),$([O,j,N],[k,I,N],[k,I,E],[O,j,E],-L,T,0)},f=0,m=0;for(let v=0;v<r.length;v++){let d=r[v];if(d===`
|
|
17
|
+
`){f=0,m-=s*1.35;continue}if(d===" "||d===" "){f+=u*(d===" "?.75:3);continue}if(d==="\r")continue;let w=d.toUpperCase(),M=d!==w&&d>="a"&&d<="z",P=Le[w]??Le["?"],N=M?s*.76:s,E=M?p*.88:p;for(let q of P)for(let X=0;X<q.length-1;X++){let Y=q[X],T=q[X+1];g(f+Y[0]*E,m+Y[1]*N,f+T[0]*E,m+T[1]*N,i,-c*.5,c*.5)}f+=M?u*.88:u}fe(this,o,y,x,b),t.center!==!1?this.center():this.computeBoundingBox()}}function Ge(n){if(!n)return;let e=n,t=n.userData?.xr?.text??n.userData?.xr?.label??n.userData?.xr?.title??n.userData?.xr?.caption??n.userData?.xr?.spatialLabel;if(t!=null&&t!==!1){let s=e.geometry?.attributes?.position;if((!s||s.count===0)&&n.userData._textApplied!==!0){let l="",h=.08,a=.015,c;if(typeof t=="string"||typeof t=="number")l=String(t);else if(typeof t=="object"){let i=t;l=String(i.text??i.value??""),i.size!==void 0&&(h=Number(i.size)||.08),(i.depth!==void 0||i.height!==void 0)&&(a=Number(i.depth??i.height)||h*.2),(typeof i.color=="string"||typeof i.color=="number")&&(c=i.color)}l.trim().length>0&&(e.geometry=new Ve(l,{size:h,depth:a}),n.userData._textApplied=!0,e.material instanceof Qe?c!==void 0&&n.userData._autoTextColorApplied!==!0&&(e.material.color=new Ze(c),n.userData._autoTextColorApplied=!0):e.material=new Ae({color:c??16317180}))}}let r=n.userData?.csg;if(r&&typeof r=="object"&&n.userData._csgApplied!==!0&&e.geometry instanceof Z&&e.geometry.attributes.position?.count>0){n.userData._csgApplied=!0;let s=Array.isArray(r)?r:[r],l=e.geometry;for(let h of s){if(!h||typeof h!="object")continue;let a=h,c=String(a.op??a.operation??"subtract"),i=c==="union"||c==="intersect"?c:"subtract",p=a.target??a.mesh??a.geometry;if(p instanceof ue||p instanceof Z)try{let u=i==="union"?ge.union(e,p):i==="intersect"?ge.intersect(e,p):ge.subtract(e,p);e.geometry!==l&&e.geometry.dispose?.(),e.geometry=u.geometry}catch(u){typeof console<"u"&&console.warn("[three-live] userData.csg skipped:",u)}}}}let Oe={Path:ce,Shape:pe,ShapeGeometry:tt,ExtrudeGeometry:rt,TextGeometry:Ve,CSG:ge,MAX_CSG_TRIANGLES:le,MAX_BSP_DEPTH:Q,MAX_TEXT_GEOMETRY_CHARS:_e,MAX_SHAPE_POINTS:Me,materializeDeclarativeGeometry:Ge};return _&&typeof _=="object"&&(_.authorNamespace||(_.authorNamespace={}),Object.assign(_.authorNamespace,Oe),_._cadMaterialize=Ge,_.materializeDeclarativeGeometry=n=>{_._cadMaterialize?.(n),_._lodMaterialize?.(n),_._procMaterialize?.(n)}),Oe}var Ue={name:"cad",onRegister(){pt(Ne);let z=be(),_=z.threeNamespace??(typeof globalThis<"u"?globalThis.THREE:void 0);_&&Ne(_,z)}};yt(Ue);export{xt as MAX_BSP_DEPTH,ft as MAX_CSG_TRIANGLES,mt as MAX_SHAPE_POINTS,gt as MAX_TEXT_GEOMETRY_CHARS,Ue as cadPlugin,Ne as installCadExtension};
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
|
-
*/var ThreeLiveCAD=(()=>{var ve=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,tt=Object.prototype.hasOwnProperty,rt=(v,S)=>{for(var D in S)ve(v,D,{get:S[D],enumerable:!0})},nt=(v,S,D,oe)=>{if(S&&typeof S=="object"||typeof S=="function")for(let W of et(S))!tt.call(v,W)&&W!==D&&ve(v,W,{get:()=>S[W],enumerable:!(oe=Ke(S,W))||oe.enumerable});return v},st=v=>nt(ve({},"__esModule",{value:!0}),v),Te={};rt(Te,{MAX_BSP_DEPTH:()=>ht,MAX_CSG_TRIANGLES:()=>ot,MAX_SHAPE_POINTS:()=>ut,MAX_TEXT_GEOMETRY_CHARS:()=>at,cadPlugin:()=>Ae,installCadExtension:()=>ze});var pe="__THREE_LIVE_REGISTRY__";function ye(){let v=typeof globalThis<"u"?globalThis:{};if(!v[pe]){let S={plugins:[],decoders:new Map};try{Object.defineProperty(v,pe,{value:S,writable:!1,configurable:!1,enumerable:!1})}catch{v[pe]=S}}return v[pe]}var Nt=ye().plugins;function it(v){let S=ye();S.workerExtensionInstallers||(S.workerExtensionInstallers=[]),S.workerExtensionInstallers.includes(v)||S.workerExtensionInstallers.push(v)}function lt(v){let S=ye().plugins;S.some(D=>D.name===v.name)||S.push(v),v.onRegister?.()}var ot=8192,ht=2048,at=128,ut=4096;function ze(v,S){if(!v||!v.BufferGeometry)return null;let D=v.Vector2,oe=v.Vector3,W=v.Quaternion,Pe=v.Matrix4,ct=v.Matrix3,pt=v.Color,Se=v.BufferAttribute,K=v.BufferGeometry,yt=v.Material,Ce=v.MeshStandardMaterial,fe=v.Mesh,he=8192,ee=2048,Ge=128,we=4096,q=(t,e)=>{let r=t==null?NaN:Number(t);return Number.isFinite(r)?r:e};class xe{constructor(e){this.currentPoint=new D(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let r=1;r<e.length;r++)this.lineTo(e[r].x,e[r].y);return this}moveTo(e,r){let n=Number(e)||0,s=Number(r)||0;return this.currentPoint.set(n,s),this.segments.push({type:"move",pts:[n,s]}),this}lineTo(e,r){let n=Number(e)||0,s=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(n,s),this.segments.push({type:"line",pts:[n,s]}),this}quadraticCurveTo(e,r,n,s){let l=this.currentPoint.x,h=this.currentPoint.y,u=Number(e)||0,c=Number(r)||0,i=Number(n)||0,p=Number(s)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[l,h]}),this.currentPoint.set(i,p),this.segments.push({type:"quad",pts:[l,h,u,c,i,p]}),this}bezierCurveTo(e,r,n,s,l,h){let u=this.currentPoint.x,c=this.currentPoint.y,i=Number(e)||0,p=Number(r)||0,a=Number(n)||0,o=Number(s)||0,y=Number(l)||0,x=Number(h)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,c]}),this.currentPoint.set(y,x),this.segments.push({type:"cubic",pts:[u,c,i,p,a,o,y,x]}),this}absarc(e,r,n,s,l,h=!1){return this.absellipse(e,r,n,n,s,l,h,0)}arc(e,r,n,s,l,h=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(r)||0),n,s,l,h)}absellipse(e,r,n,s,l,h,u=!1,c=0){let i=Number(e)||0,p=Number(r)||0,a=Math.max(0,Number(n)||0),o=Math.max(0,Number(s)||0),y=Number(l)||0,x=Number(h)||0,b=u?1:0,g=Number(c)||0;this.segments.push({type:"arc",pts:[i,p,a,o,y,x,b,g]});let f=Math.cos(g),m=Math.sin(g),d=a*Math.cos(x),M=o*Math.sin(x);return this.currentPoint.set(i+d*f-M*m,p+d*m+M*f),this}ellipse(e,r,n,s,l,h,u=!1,c=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(r)||0),n,s,l,h,u,c)}closePath(){if(this.segments.length>0){let e=this.segments[0],r=0,n=0;if(e.type==="arc"){let s=e.pts[0],l=e.pts[1],h=e.pts[2],u=e.pts[3],c=e.pts[4],i=e.pts[7],p=Math.cos(i),a=Math.sin(i),o=h*Math.cos(c),y=u*Math.sin(c);r=s+o*p-y*a,n=l+o*a+y*p}else r=e.pts[0],n=e.pts[1];Math.hypot(this.currentPoint.x-r,this.currentPoint.y-n)>1e-6&&this.lineTo(r,n)}return this}getPoints(e=12){let r=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),n=[],s=(l,h)=>{if(n.length>0){let u=n[n.length-1];if(Math.hypot(u.x-l,u.y-h)<1e-6)return}n.push(new D(l,h))};for(let l of this.segments){let h=l.pts;if(l.type==="move"||l.type==="line")s(h[0],h[1]);else if(l.type==="quad"){let u=h[0],c=h[1],i=h[2],p=h[3],a=h[4],o=h[5];s(u,c);for(let y=1;y<=r;y++){let x=y/r,b=1-x;s(b*b*u+2*b*x*i+x*x*a,b*b*c+2*b*x*p+x*x*o)}}else if(l.type==="cubic"){let u=h[0],c=h[1],i=h[2],p=h[3],a=h[4],o=h[5],y=h[6],x=h[7];s(u,c);for(let b=1;b<=r;b++){let g=b/r,f=1-g,m=f*f,d=g*g;s(m*f*u+3*m*g*i+3*f*d*a+d*g*y,m*f*c+3*m*g*p+3*f*d*o+d*g*x)}}else if(l.type==="arc"){let u=h[0],c=h[1],i=h[2],p=h[3],a=h[4],o=h[5],y=h[6]!==0,x=h[7],b=Math.PI*2,g=o-a,f=Math.abs(g)<1e-9;for(;g<0;)g+=b;for(;g>b;)g-=b;g<1e-9&&(g=f?0:b),y&&!f&&(g=g===b?-b:g-b);let m=Math.cos(x),d=Math.sin(x),M=Math.max(2,r);for(let w=0;w<=M;w++){let z=w/M,P=a+z*g,N=i*Math.cos(P),T=p*Math.sin(P);s(u+N*m-T*d,c+N*d+T*m)}}}if(n.length>2){let l=n[0],h=n[n.length-1];Math.hypot(l.x-h.x,l.y-h.y)<1e-6&&n.pop()}return n}getSpacedPoints(e=12){return this.getPoints(e)}clone(){let e=new this.constructor;return e.currentPoint.copy(this.currentPoint),e.segments=this.segments.map(r=>({type:r.type,pts:[...r.pts]})),Array.isArray(this.holes)&&(e.holes=this.holes.map(r=>r.clone())),e}}class ge extends xe{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(r=>r.getPoints(e))}}}function me(t){let e=0,r=t.length;for(let n=0,s=r-1;n<r;s=n++)e+=t[s].x*t[n].y-t[n].x*t[s].y;return e*.5}function ft(t,e,r,n,s,l,h,u){let c=h-r,i=u-n,p=s-r,a=l-n,o=t-r,y=e-n,x=c*c+i*i,b=c*p+i*a,g=c*o+i*y,f=p*p+a*a,m=p*o+a*y,d=x*f-b*b;if(Math.abs(d)<1e-12)return!1;let M=1/d,w=(f*g-b*m)*M,z=(x*m-b*g)*M;return w>=-1e-7&&z>=-1e-7&&w+z<=1.0000001}function Ie(t,e){let r=t.slice();me(r)<0&&r.reverse();let n=r.map(c=>new D(c.x,c.y)),s=r.map((c,i)=>i),l=[];for(let c of e){if(!c||c.length<3)continue;let i=c.slice();me(i)>0&&i.reverse();let p=[],a=-1/0,o=0;for(let y=0;y<i.length;y++){let x=i[y],b=n.length;n.push(new D(x.x,x.y)),p.push(b),x.x>a&&(a=x.x,o=y)}l.push({pts:i,indices:p,maxX:a,maxIdx:o})}l.sort((c,i)=>i.maxX-c.maxX);let h=(c,i,p)=>(i.x-c.x)*(p.y-c.y)-(i.y-c.y)*(p.x-c.x),u=(c,i,p)=>{for(let a=0;a<p.length;a++){let o=p[a],y=p[(a+1)%p.length];if(h(c,i,o)*h(c,i,y)<0&&h(o,y,c)*h(o,y,i)<0)return!0}return!1};for(let c of l){let i=c.pts[c.maxIdx],p=i.x,a=s.length,o=s.map(f=>n[f]),y=f=>Math.hypot(o[f].x-p,o[f].y-i.y),x=o.map((f,m)=>m).sort((f,m)=>+(o[f].x<p)-+(o[m].x<p)||y(f)-y(m)),b=x[0];for(let f of x){let m=o[f],d=o[(f+a-1)%a],M=o[(f+1)%a],w=h(m,M,i)>=0,z=h(d,m,i)>=0;if((h(d,m,M)>=0?w&&z:w||z)&&!u(i,m,o)&&!l.some(P=>u(i,m,P.pts))){b=f;break}}let g=[];for(let f=0;f<=b;f++)g.push(s[f]);for(let f=0;f<=c.indices.length;f++){let m=c.indices[(c.maxIdx+f)%c.indices.length];g.push(m)}for(let f=b;f<s.length;f++)g.push(s[f]);s=g}return{merged:s.map(c=>n[c]),mergedIndices:s,allVertices:n}}function Xe(t,e){let r=[],n=t.slice();if(n.length<3)return r;let s=n.length*n.length+64,l=0;for(;n.length>2&&s-- >0;){let h=n.length,u=n[(l+h-1)%h],c=n[l%h],i=n[(l+1)%h],p=e[u],a=e[c],o=e[i];if((a.x-p.x)*(o.y-p.y)-(a.y-p.y)*(o.x-p.x)>1e-9){let y=!0,x=Math.min(p.x,a.x,o.x)-1e-7,b=Math.max(p.x,a.x,o.x)+1e-7,g=Math.min(p.y,a.y,o.y)-1e-7,f=Math.max(p.y,a.y,o.y)+1e-7;for(let m=0;m<h;m++){let d=n[m];if(d===u||d===c||d===i)continue;let M=e[d];if(M.x>=x&&M.x<=b&&M.y>=g&&M.y<=f&&ft(M.x,M.y,p.x,p.y,a.x,a.y,o.x,o.y)&&(M.x-p.x)*(M.x-p.x)+(M.y-p.y)*(M.y-p.y)>=1e-12&&(M.x-a.x)*(M.x-a.x)+(M.y-a.y)*(M.y-a.y)>=1e-12&&(M.x-o.x)*(M.x-o.x)+(M.y-o.y)*(M.y-o.y)>=1e-12){y=!1;break}}if(y){r.push([u,c,i]),n.splice(l%h,1),l=Math.max(0,l%h-1);continue}}l++,l>=h*2&&(r.push([u,c,i]),n.splice((l-1)%h,1),l=0)}return r}function ke(t,e){let r=t instanceof ge?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},n=r.shape.length;for(let s of r.holes)n+=s.length;if(n>we)throw new RangeError(`SecurityError: shape point count (${n}) exceeds MAX_SHAPE_POINTS (${we})`);return r}function De(t){let e=1/0,r=1/0,n=-1/0,s=-1/0;for(let l of t)l.x<e&&(e=l.x),l.y<r&&(r=l.y),l.x>n&&(n=l.x),l.y>s&&(s=l.y);return[e,r,Math.max(1e-6,n-e),Math.max(1e-6,s-r)]}class xt extends K{constructor(e=new ge,r=12){super();let n=Array.isArray(e)?e:[e],s=[],l=[],h=[],u=[];for(let c of n){if(!(c instanceof xe))continue;let i=ke(c,r);if(i.shape.length<3)continue;let{mergedIndices:p,allVertices:a}=Ie(i.shape,i.holes),o=Xe(p,a),y=s.length/3,[x,b,g,f]=De(a);for(let m of a)s.push(m.x,m.y,0),l.push(0,0,1),h.push((m.x-x)/g,(m.y-b)/f);for(let[m,d,M]of o)u.push(y+m,y+d,y+M)}be(this,s,l,h,u)}}function be(t,e,r,n,s){return t.setAttribute("position",new Se(e,3)),t.setAttribute("normal",new Se(r,3)),t.setAttribute("uv",new Se(n,2)),t.setIndex(s),t}function gt(t){let e=t.length,r=[];for(let n=0;n<e;n++){let s=t[(n+e-1)%e],l=t[n],h=t[(n+1)%e],u=l.x-s.x,c=l.y-s.y,i=Math.hypot(u,c)||1;u/=i,c/=i;let p=h.x-l.x,a=h.y-l.y,o=Math.hypot(p,a)||1;p/=o,a/=o;let y=c,x=-u,b=a,g=-p,f=y+b,m=x+g,d=Math.hypot(f,m);if(d>1e-6){f/=d,m/=d;let M=Math.max(.35,f*y+m*x);r.push(new D(f/M,m/M))}else r.push(new D(y,x))}return r}class mt extends K{constructor(e=new ge,r={}){super();let n=Array.isArray(e)?e:[e],s=Math.max(1,Math.min(64,Math.floor(q(r.curveSegments,12)))),l=q(r.depth??r.amount,1),h=Math.max(1,Math.min(32,Math.floor(q(r.steps,1)))),u=!!(r.bevelEnabled??!1),c=u?Math.max(0,q(r.bevelThickness,.06)):0,i=u?Math.max(0,q(r.bevelSize,c*.8)):0,p=u?q(r.bevelOffset,0):0,a=u?Math.max(1,Math.min(8,Math.floor(q(r.bevelSegments,2)))):0,o=[],y=[],x=[],b=[];for(let g of n){if(!(g instanceof xe))continue;let f=ke(g,s);if(f.shape.length<3)continue;let m=f.shape.slice();me(m)<0&&m.reverse();let d=[];for(let E of f.holes){if(E.length<3)continue;let _=E.slice();me(_)>0&&_.reverse(),d.push(_)}let{mergedIndices:M,allVertices:w}=Ie(m,d),z=Xe(M,w),P=[m,...d],N=[];for(let E of P){let _=gt(E);for(let X of _)N.push(X)}let[T,O,k,$]=De(w);for(let[E,_]of[[-c,-1],[l+c,1]]){let X=o.length/3;for(let I=0;I<w.length;I++){let C=w[I],G=N[I]??new D(0,0),j=C.x+G.x*p,R=C.y+G.y*p;o.push(j,R,E),y.push(0,0,_),x.push((j-T)/k,(R-O)/$)}for(let[I,C,G]of z)b.push(X+I,X+(_<0?G:C),X+(_<0?C:G))}let A=[];if(u&&a>0)for(let E=0;E<a;E++){let _=E/a*Math.PI/2;A.push({z:-c*Math.cos(_),expand:p+i*Math.sin(_)})}for(let E=0;E<=h;E++){let _=E/h;A.push({z:_*l,expand:p+i})}if(u&&a>0)for(let E=1;E<=a;E++){let _=E/a*Math.PI/2;A.push({z:l+c*Math.sin(_),expand:p+i*Math.cos(_)})}let H=0;for(let E of P){let _=E.length;for(let X=0;X<A.length-1;X++){let I=A[X],C=A[X+1];for(let G=0;G<_;G++){let j=(G+1)%_,R=E[G],L=E[j],B=N[H+G],V=N[H+j],Y=R.x+B.x*I.expand,F=R.y+B.y*I.expand,te=L.x+V.x*I.expand,re=L.y+V.y*I.expand,ue=L.x+V.x*C.expand,ce=L.y+V.y*C.expand,J=R.x+B.x*C.expand,Z=R.y+B.y*C.expand,Q=te-Y,U=re-F,St=J-Y,wt=Z-F,Ue=C.z-I.z,ne=U*Ue,se=-Q*Ue,ie=Q*wt-U*St,Ee=Math.hypot(ne,se,ie)||1;ne/=Ee,se/=Ee,ie/=Ee;let le=o.length/3;o.push(Y,F,I.z,te,re,I.z,ue,ce,C.z,J,Z,C.z),y.push(ne,se,ie,ne,se,ie,ne,se,ie,ne,se,ie);let We=G/_,Je=(G+1)/_,Ze=X/(A.length-1),Qe=(X+1)/(A.length-1);x.push(We,Ze,Je,Ze,Je,Qe,We,Qe),b.push(le,le+1,le+2,le,le+2,le+3)}}H+=_}}be(this,o,y,x,b)}}function Re(t){return{x:t.x,y:t.y,z:t.z,nx:t.nx,ny:t.ny,nz:t.nz,u:t.u,v:t.v}}function bt(t){return{x:t.x,y:t.y,z:t.z,nx:-t.nx,ny:-t.ny,nz:-t.nz,u:t.u,v:t.v}}function Mt(t,e,r){let n=t.nx+(e.nx-t.nx)*r,s=t.ny+(e.ny-t.ny)*r,l=t.nz+(e.nz-t.nz)*r,h=Math.hypot(n,s,l)||1;return{x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r,z:t.z+(e.z-t.z)*r,nx:n/h,ny:s/h,nz:l/h,u:t.u+(e.u-t.u)*r,v:t.v+(e.v-t.v)*r}}function dt(t){if(t.length<3)return null;let e=t[0],r=t[1],n=t[2],s=r.x-e.x,l=r.y-e.y,h=r.z-e.z,u=n.x-e.x,c=n.y-e.y,i=n.z-e.z,p=l*i-h*c,a=h*u-s*i,o=s*c-l*u,y=Math.hypot(p,a,o);if(y<1e-9)return null;p/=y,a/=y,o/=y;let x=p*e.x+a*e.y+o*e.z;return{vertices:t,nx:p,ny:a,nz:o,w:x}}function vt(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=bt(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let Oe=1e-5,je=0,Ne=1,Me=2,qe=3;function He(t,e,r,n,s,l,h,u,c){let i=0,p=[];for(let a=0;a<s.vertices.length;a++){let o=s.vertices[a],y=t*o.x+e*o.y+r*o.z-n,x=y<-Oe?Me:y>Oe?Ne:je;i|=x,p.push(x)}switch(i){case je:{t*s.nx+e*s.ny+r*s.nz>0?l.push(s):h.push(s);break}case Ne:u.push(s);break;case Me:c.push(s);break;case qe:{let a=[],o=[],y=s.vertices.length;for(let m=0;m<y;m++){let d=(m+1)%y,M=p[m],w=p[d],z=s.vertices[m],P=s.vertices[d];if(M!==Me&&a.push(z),M!==Ne&&o.push(M!==Me?Re(z):z),(M|w)===qe){let N=P.x-z.x,T=P.y-z.y,O=P.z-z.z,k=t*N+e*T+r*O,$=Math.abs(k)>1e-12?(n-(t*z.x+e*z.y+r*z.z))/k:.5,A=Mt(z,P,Math.max(0,Math.min(1,$)));a.push(A),o.push(Re(A))}}let{nx:x,ny:b,nz:g,w:f}=s;a.length>=3&&u.push({vertices:a,nx:x,ny:b,nz:g,w:f}),o.length>=3&&c.push({vertices:o,nx:x,ny:b,nz:g,w:f});break}default:break}}class ae{constructor(e,r=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,r)}invert(){for(let r=0;r<this.polygons.length;r++)vt(this.polygons[r]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,r=0){if(!this.hasPlane||e.length===0)return e.slice();if(r>=ee)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ee})`);let n=[],s=[];for(let l=0;l<e.length;l++)He(this.nx,this.ny,this.nz,this.w,e[l],n,s,n,s);return this.front&&n.length>0&&(n=this.front.clipPolygons(n,r+1)),this.back?s=s.length>0?this.back.clipPolygons(s,r+1):[]:s=[],n.concat(s)}clipTo(e,r=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),r<ee&&(this.front&&this.front.clipTo(e,r+1),this.back&&this.back.clipTo(e,r+1))}allPolygons(e=[]){for(let r=0;r<this.polygons.length;r++)e.push(this.polygons[r]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,r=0){if(!e.length)return;if(!this.hasPlane){let l=e[e.length>>1];this.nx=l.nx,this.ny=l.ny,this.nz=l.nz,this.w=l.w,this.hasPlane=!0}if(r>=ee)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ee})`);let n=[],s=[];for(let l=0;l<e.length;l++)He(this.nx,this.ny,this.nz,this.w,e[l],this.polygons,this.polygons,n,s);n.length>0&&(this.front||(this.front=new ae),this.front.build(n,r+1)),s.length>0&&(this.back||(this.back=new ae),this.back.build(s,r+1))}}function Le(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let r=t.attributes.position;if(!r||r.count===0)return[];let n=t.attributes.normal,s=t.attributes.uv,l=t.index?t.index.array:null,h=Math.floor(l?l.length/3:r.count/3);if(h>he)throw new RangeError(`SecurityError: CSG input triangle count (${h}) exceeds MAX_CSG_TRIANGLES (${he})`);let u=e?e.elements:null,c=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,i=u?new ct().getNormalMatrix(e).elements:null,p=o=>{let y=r.getX(o),x=r.getY(o),b=r.getZ(o),g=n?n.getX(o):NaN,f=n?n.getY(o):NaN,m=n?n.getZ(o):NaN;if(u&&i){let w=u[0]*y+u[4]*x+u[8]*b+u[12],z=u[1]*y+u[5]*x+u[9]*b+u[13],P=u[2]*y+u[6]*x+u[10]*b+u[14];y=w,x=z,b=P;let N=i[0]*g+i[3]*f+i[6]*m,T=i[1]*g+i[4]*f+i[7]*m,O=i[2]*g+i[5]*f+i[8]*m,k=Math.hypot(N,T,O)||1;g=N/k,f=T/k,m=O/k}let d=s?s.getX(o):0,M=s?s.getY(o):0;return{x:y,y:x,z:b,nx:g,ny:f,nz:m,u:d,v:M}},a=[];for(let o=0;o<h;o++){let y=l?l[o*3]:o*3,x=l?l[o*3+1]:o*3+1,b=l?l[o*3+2]:o*3+2,g=dt(c?[p(y),p(b),p(x)]:[p(y),p(x),p(b)]);g&&a.push(g)}return a}function zt(t){let e=[],r=[],n=[],s=[];for(let h of t){let u=h.vertices;if(u.length<3)continue;let c=e.length/3;for(let i of u)e.push(i.x,i.y,i.z),Number.isFinite(i.nx)&&i.nx*i.nx+i.ny*i.ny+i.nz*i.nz>.5?r.push(i.nx,i.ny,i.nz):r.push(h.nx,h.ny,h.nz),n.push(i.u,i.v);for(let i=1;i<u.length-1;i++)s.push(c,c+i,c+i+1)}let l=be(new K,e,r,n,s);return l._csgPolygons=t,l}function Pt(t,e,r){if(t.length+e.length>he)throw new RangeError(`SecurityError: Combined CSG triangle count (${t.length+e.length}) exceeds MAX_CSG_TRIANGLES (${he})`);if(t.length===0)return r==="union"?e:[];if(e.length===0)return r==="intersect"?[]:t;let n=1/0,s=1/0,l=1/0,h=-1/0,u=-1/0,c=-1/0;for(let y=0;y<e.length;y++){let x=e[y].vertices;for(let b=0;b<x.length;b++){let g=x[b];g.x<n&&(n=g.x),g.y<s&&(s=g.y),g.z<l&&(l=g.z),g.x>h&&(h=g.x),g.y>u&&(u=g.y),g.z>c&&(c=g.z)}}n-=1e-4,s-=1e-4,l-=1e-4,h+=1e-4,u+=1e-4,c+=1e-4;let i=[],p=[];for(let y=0;y<t.length;y++){let x=t[y],b=x.vertices,g=1/0,f=1/0,m=1/0,d=-1/0,M=-1/0,w=-1/0;for(let z=0;z<b.length;z++){let P=b[z];P.x<g&&(g=P.x),P.y<f&&(f=P.y),P.z<m&&(m=P.z),P.x>d&&(d=P.x),P.y>M&&(M=P.y),P.z>w&&(w=P.z)}d<n||g>h||M<s||f>u||w<l||m>c?p.push(x):i.push(x)}if(i.length===0)return r==="union"?t.concat(e):r==="subtract"?t:[];let a=new ae(i),o=new ae(e);return r==="union"?(a.clipTo(o),o.clipTo(a),o.invert(),o.clipTo(a),o.invert(),a.build(o.allPolygons()),p.concat(a.allPolygons())):r==="subtract"?(a.invert(),a.clipTo(o),o.clipTo(a),o.invert(),o.clipTo(a),o.invert(),a.build(o.allPolygons()),a.invert(),p.concat(a.allPolygons())):(a.invert(),o.clipTo(a),o.invert(),a.clipTo(o),o.clipTo(a),a.build(o.allPolygons()),a.invert(),a.allPolygons())}function Be(t,e,r,n=null,s=null){let l=Le(t,n),h=Le(e,s);return zt(Pt(l,h,r))}function _e(t,e,r){let n=t instanceof fe||!!t?.isMesh,s=e instanceof fe||!!e?.isMesh,l=n?t.geometry:t,h=s?e.geometry:e,u=null;if(s)if(e.updateMatrix(),n){t.updateMatrix();let a=new Pe().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),o=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,y=new Pe().compose(new oe(0,0,0),new W(-t.quaternion.x/o,-t.quaternion.y/o,-t.quaternion.z/o,t.quaternion.w/o),new oe(1,1,1)),x=new Pe().makeTranslation(-t.position.x,-t.position.y,-t.position.z);u=a.multiply(y).multiply(x).multiply(e.matrix)}else u=e.matrix;let c=Be(l,h,r,null,u),i=n?t.material:new Ce,p=new fe(c,i);return n&&(p.position.copy(t.position),p.quaternion.copy(t.quaternion),p.scale.copy(t.scale),p.name=t.name),p}let de={toGeometry:Be,subtract(t,e){return _e(t,e,"subtract")},union(t,e){return _e(t,e,"union")},intersect(t,e){return _e(t,e,"intersect")}},Ve={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class $e extends K{constructor(e="",r={}){super();let n=String(e??"").slice(0,Ge),s=Math.max(.005,Math.min(100,q(r.size,.2))),l=!!(r.bevelEnabled??!1),h=l?Math.max(0,Math.min(2,q(r.bevelThickness,s*.04))):0,u=l?Math.max(0,Math.min(2,q(r.bevelSize,s*.03))):0,c=Math.max(.001,Math.min(20,q(r.depth??r.height,s*.2)))+h*2,i=s*.085+u,p=s*.68,a=s*.82,o=[],y=[],x=[],b=[],g=(d,M,w,z,P,N,T)=>{let O=w-d,k=z-M,$=Math.hypot(O,k),A=1,H=0;$>1e-6&&(A=O/$,H=k/$);let E=-H*P,_=A*P,X=A*P*.6,I=H*P*.6,C=d-X+E,G=M-I+_,j=d-X-E,R=M-I-_,L=w+X-E,B=z+I-_,V=w+X+E,Y=z+I+_,F=(te,re,ue,ce,J,Z,Q)=>{let U=o.length/3;o.push(te[0],te[1],te[2],re[0],re[1],re[2],ue[0],ue[1],ue[2],ce[0],ce[1],ce[2]),y.push(J,Z,Q,J,Z,Q,J,Z,Q,J,Z,Q),x.push(0,0,1,0,1,1,0,1),b.push(U,U+1,U+2,U,U+2,U+3)};F([C,G,T],[j,R,T],[L,B,T],[V,Y,T],0,0,1),F([j,R,N],[C,G,N],[V,Y,N],[L,B,N],0,0,-1),F([C,G,N],[j,R,N],[j,R,T],[C,G,T],-A,-H,0),F([L,B,N],[V,Y,N],[V,Y,T],[L,B,T],A,H,0),F([j,R,N],[L,B,N],[L,B,T],[j,R,T],H,-A,0),F([V,Y,N],[C,G,N],[C,G,T],[V,Y,T],-H,A,0)},f=0,m=0;for(let d=0;d<n.length;d++){let M=n[d];if(M===`
|
|
17
|
-
`){f=0,m-=s*1.35;continue}if(
|
|
16
|
+
*/var ThreeLiveCAD=(()=>{var ve=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,tt=Object.prototype.hasOwnProperty,nt=(v,z)=>{for(var I in z)ve(v,I,{get:z[I],enumerable:!0})},rt=(v,z,I,oe)=>{if(z&&typeof z=="object"||typeof z=="function")for(let W of et(z))!tt.call(v,W)&&W!==I&&ve(v,W,{get:()=>z[W],enumerable:!(oe=Ke(z,W))||oe.enumerable});return v},st=v=>rt(ve({},"__esModule",{value:!0}),v),Te={};nt(Te,{MAX_BSP_DEPTH:()=>ht,MAX_CSG_TRIANGLES:()=>ot,MAX_SHAPE_POINTS:()=>ut,MAX_TEXT_GEOMETRY_CHARS:()=>at,cadPlugin:()=>Ee,installCadExtension:()=>ze});var pe="__THREE_LIVE_REGISTRY__";function ye(){let v=typeof globalThis<"u"?globalThis:{};if(!v[pe]){let z={plugins:[],decoders:new Map};try{Object.defineProperty(v,pe,{value:z,writable:!1,configurable:!1,enumerable:!1})}catch{v[pe]=z}}return v[pe]}var wt=ye().plugins;function it(v){let z=ye();z.workerExtensionInstallers||(z.workerExtensionInstallers=[]),z.workerExtensionInstallers.includes(v)||z.workerExtensionInstallers.push(v)}function lt(v){let z=ye().plugins;z.some(I=>I.name===v.name)||z.push(v),v.onRegister?.()}var ot=8192,ht=2048,at=128,ut=4096;function ze(v,z){if(!v||!v.BufferGeometry)return null;let I=v.Vector2,oe=v.Vector3,W=v.Quaternion,Pe=v.Matrix4,ct=v.Matrix3,pt=v.Color,Ne=v.BufferAttribute,K=v.BufferGeometry,yt=v.Material,Ce=v.MeshStandardMaterial,fe=v.Mesh,he=8192,ee=2048,Ge=128,Se=4096,H=(n,e)=>{let t=n==null?NaN:Number(n);return Number.isFinite(t)?t:e};class xe{constructor(e){this.currentPoint=new I(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){let r=Number(e)||0,s=Number(t)||0;return this.currentPoint.set(r,s),this.segments.push({type:"move",pts:[r,s]}),this}lineTo(e,t){let r=Number(e)||0,s=Number(t)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(r,s),this.segments.push({type:"line",pts:[r,s]}),this}quadraticCurveTo(e,t,r,s){let l=this.currentPoint.x,h=this.currentPoint.y,a=Number(e)||0,c=Number(t)||0,i=Number(r)||0,p=Number(s)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[l,h]}),this.currentPoint.set(i,p),this.segments.push({type:"quad",pts:[l,h,a,c,i,p]}),this}bezierCurveTo(e,t,r,s,l,h){let a=this.currentPoint.x,c=this.currentPoint.y,i=Number(e)||0,p=Number(t)||0,u=Number(r)||0,o=Number(s)||0,y=Number(l)||0,x=Number(h)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,c]}),this.currentPoint.set(y,x),this.segments.push({type:"cubic",pts:[a,c,i,p,u,o,y,x]}),this}absarc(e,t,r,s,l,h=!1){return this.absellipse(e,t,r,r,s,l,h,0)}arc(e,t,r,s,l,h=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),r,s,l,h)}absellipse(e,t,r,s,l,h,a=!1,c=0){let i=Number(e)||0,p=Number(t)||0,u=Math.max(0,Number(r)||0),o=Math.max(0,Number(s)||0),y=Number(l)||0,x=Number(h)||0,b=a?1:0,g=Number(c)||0;this.segments.push({type:"arc",pts:[i,p,u,o,y,x,b,g]});let f=Math.cos(g),m=Math.sin(g),M=u*Math.cos(x),d=o*Math.sin(x);return this.currentPoint.set(i+M*f-d*m,p+M*m+d*f),this}ellipse(e,t,r,s,l,h,a=!1,c=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),r,s,l,h,a,c)}add(e){if(e&&typeof e.getPoints=="function"){this.segments.push({type:"curve",pts:[],curve:e});let t=e.getPoint?.(1);t&&this.currentPoint.set(Number(t.x)||0,Number(t.y)||0)}return this}splineThru(e){if(!Array.isArray(e)||e.length===0)return this;let t=v.SplineCurve||z?.authorNamespace?.SplineCurve;if(t)return this.add(new t([this.currentPoint.clone(),...e]));for(let r of e)r&&this.lineTo(Number(r.x)||0,Number(r.y)||0);return this}closePath(){if(this.segments.length>0){let e=this.segments[0],t=0,r=0;if(e.type==="curve"&&e.curve?.getPoint){let s=e.curve.getPoint(0);t=Number(s?.x)||0,r=Number(s?.y)||0}else if(e.type==="arc"){let s=e.pts[0],l=e.pts[1],h=e.pts[2],a=e.pts[3],c=e.pts[4],i=e.pts[7],p=Math.cos(i),u=Math.sin(i),o=h*Math.cos(c),y=a*Math.sin(c);t=s+o*p-y*u,r=l+o*u+y*p}else t=e.pts[0],r=e.pts[1];Math.hypot(this.currentPoint.x-t,this.currentPoint.y-r)>1e-6&&this.lineTo(t,r)}return this}getPoints(e=12){let t=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),r=[],s=(l,h)=>{if(r.length>0){let a=r[r.length-1];if(Math.hypot(a.x-l,a.y-h)<1e-6)return}r.push(new I(l,h))};for(let l of this.segments){let h=l.pts;if(l.type==="move"||l.type==="line")s(h[0],h[1]);else if(l.type==="quad"){let a=h[0],c=h[1],i=h[2],p=h[3],u=h[4],o=h[5];s(a,c);for(let y=1;y<=t;y++){let x=y/t,b=1-x;s(b*b*a+2*b*x*i+x*x*u,b*b*c+2*b*x*p+x*x*o)}}else if(l.type==="cubic"){let a=h[0],c=h[1],i=h[2],p=h[3],u=h[4],o=h[5],y=h[6],x=h[7];s(a,c);for(let b=1;b<=t;b++){let g=b/t,f=1-g,m=f*f,M=g*g;s(m*f*a+3*m*g*i+3*f*M*u+M*g*y,m*f*c+3*m*g*p+3*f*M*o+M*g*x)}}else if(l.type==="arc"){let a=h[0],c=h[1],i=h[2],p=h[3],u=h[4],o=h[5],y=h[6]!==0,x=h[7],b=Math.PI*2,g=o-u,f=Math.abs(g)<1e-9;for(;g<0;)g+=b;for(;g>b;)g-=b;g<1e-9&&(g=f?0:b),y&&!f&&(g=g===b?-b:g-b);let m=Math.cos(x),M=Math.sin(x),d=Math.max(2,t);for(let S=0;S<=d;S++){let P=S/d,N=u+P*g,w=i*Math.cos(N),T=p*Math.sin(N);s(a+w*m-T*M,c+w*M+T*m)}}else if(l.type==="curve"&&l.curve?.getPoints)for(let a of l.curve.getPoints(t))a&&s(Number(a.x)||0,Number(a.y)||0)}if(r.length>2){let l=r[0],h=r[r.length-1];Math.hypot(l.x-h.x,l.y-h.y)<1e-6&&r.pop()}return r}getSpacedPoints(e=12){return this.getPoints(e)}clone(){let e=new this.constructor;return e.currentPoint.copy(this.currentPoint),e.segments=this.segments.map(t=>({type:t.type,pts:[...t.pts],...t.curve?{curve:t.curve.clone?t.curve.clone():t.curve}:{}})),Array.isArray(this.holes)&&(e.holes=this.holes.map(t=>t.clone())),e}}class ge extends xe{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(t=>t.getPoints(e))}}}function me(n){let e=0,t=n.length;for(let r=0,s=t-1;r<t;s=r++)e+=n[s].x*n[r].y-n[r].x*n[s].y;return e*.5}function ft(n,e,t,r,s,l,h,a){let c=h-t,i=a-r,p=s-t,u=l-r,o=n-t,y=e-r,x=c*c+i*i,b=c*p+i*u,g=c*o+i*y,f=p*p+u*u,m=p*o+u*y,M=x*f-b*b;if(Math.abs(M)<1e-12)return!1;let d=1/M,S=(f*g-b*m)*d,P=(x*m-b*g)*d;return S>=-1e-7&&P>=-1e-7&&S+P<=1.0000001}function De(n,e){let t=n.slice();me(t)<0&&t.reverse();let r=t.map(c=>new I(c.x,c.y)),s=t.map((c,i)=>i),l=[];for(let c of e){if(!c||c.length<3)continue;let i=c.slice();me(i)>0&&i.reverse();let p=[],u=-1/0,o=0;for(let y=0;y<i.length;y++){let x=i[y],b=r.length;r.push(new I(x.x,x.y)),p.push(b),x.x>u&&(u=x.x,o=y)}l.push({pts:i,indices:p,maxX:u,maxIdx:o})}l.sort((c,i)=>i.maxX-c.maxX);let h=(c,i,p)=>(i.x-c.x)*(p.y-c.y)-(i.y-c.y)*(p.x-c.x),a=(c,i,p)=>{for(let u=0;u<p.length;u++){let o=p[u],y=p[(u+1)%p.length];if(h(c,i,o)*h(c,i,y)<0&&h(o,y,c)*h(o,y,i)<0)return!0}return!1};for(let c of l){let i=c.pts[c.maxIdx],p=i.x,u=s.length,o=s.map(f=>r[f]),y=f=>Math.hypot(o[f].x-p,o[f].y-i.y),x=o.map((f,m)=>m).sort((f,m)=>+(o[f].x<p)-+(o[m].x<p)||y(f)-y(m)),b=x[0];for(let f of x){let m=o[f],M=o[(f+u-1)%u],d=o[(f+1)%u],S=h(m,d,i)>=0,P=h(M,m,i)>=0;if((h(M,m,d)>=0?S&&P:S||P)&&!a(i,m,o)&&!l.some(N=>a(i,m,N.pts))){b=f;break}}let g=[];for(let f=0;f<=b;f++)g.push(s[f]);for(let f=0;f<=c.indices.length;f++){let m=c.indices[(c.maxIdx+f)%c.indices.length];g.push(m)}for(let f=b;f<s.length;f++)g.push(s[f]);s=g}return{merged:s.map(c=>r[c]),mergedIndices:s,allVertices:r}}function ke(n,e){let t=[],r=n.slice();if(r.length<3)return t;let s=r.length*r.length+64,l=0;for(;r.length>2&&s-- >0;){let h=r.length,a=r[(l+h-1)%h],c=r[l%h],i=r[(l+1)%h],p=e[a],u=e[c],o=e[i];if((u.x-p.x)*(o.y-p.y)-(u.y-p.y)*(o.x-p.x)>1e-9){let y=!0,x=Math.min(p.x,u.x,o.x)-1e-7,b=Math.max(p.x,u.x,o.x)+1e-7,g=Math.min(p.y,u.y,o.y)-1e-7,f=Math.max(p.y,u.y,o.y)+1e-7;for(let m=0;m<h;m++){let M=r[m];if(M===a||M===c||M===i)continue;let d=e[M];if(d.x>=x&&d.x<=b&&d.y>=g&&d.y<=f&&ft(d.x,d.y,p.x,p.y,u.x,u.y,o.x,o.y)&&(d.x-p.x)*(d.x-p.x)+(d.y-p.y)*(d.y-p.y)>=1e-12&&(d.x-u.x)*(d.x-u.x)+(d.y-u.y)*(d.y-u.y)>=1e-12&&(d.x-o.x)*(d.x-o.x)+(d.y-o.y)*(d.y-o.y)>=1e-12){y=!1;break}}if(y){t.push([a,c,i]),r.splice(l%h,1),l=Math.max(0,l%h-1);continue}}l++,l>=h*2&&(t.push([a,c,i]),r.splice((l-1)%h,1),l=0)}return t}function Xe(n,e){let t=n instanceof ge?n.extractPoints(e):{shape:n.getPoints(e),holes:[]},r=t.shape.length;for(let s of t.holes)r+=s.length;if(r>Se)throw new RangeError(`SecurityError: shape point count (${r}) exceeds MAX_SHAPE_POINTS (${Se})`);return t}function Ie(n){let e=1/0,t=1/0,r=-1/0,s=-1/0;for(let l of n)l.x<e&&(e=l.x),l.y<t&&(t=l.y),l.x>r&&(r=l.x),l.y>s&&(s=l.y);return[e,t,Math.max(1e-6,r-e),Math.max(1e-6,s-t)]}class xt extends K{constructor(e=new ge,t=12){super();let r=Array.isArray(e)?e:[e],s=[],l=[],h=[],a=[];for(let c of r){if(!(c instanceof xe))continue;let i=Xe(c,t);if(i.shape.length<3)continue;let{mergedIndices:p,allVertices:u}=De(i.shape,i.holes),o=ke(p,u),y=s.length/3,[x,b,g,f]=Ie(u);for(let m of u)s.push(m.x,m.y,0),l.push(0,0,1),h.push((m.x-x)/g,(m.y-b)/f);for(let[m,M,d]of o)a.push(y+m,y+M,y+d)}be(this,s,l,h,a)}}function be(n,e,t,r,s){return n.setAttribute("position",new Ne(e,3)),n.setAttribute("normal",new Ne(t,3)),n.setAttribute("uv",new Ne(r,2)),n.setIndex(s),n}function gt(n){let e=n.length,t=[];for(let r=0;r<e;r++){let s=n[(r+e-1)%e],l=n[r],h=n[(r+1)%e],a=l.x-s.x,c=l.y-s.y,i=Math.hypot(a,c)||1;a/=i,c/=i;let p=h.x-l.x,u=h.y-l.y,o=Math.hypot(p,u)||1;p/=o,u/=o;let y=c,x=-a,b=u,g=-p,f=y+b,m=x+g,M=Math.hypot(f,m);if(M>1e-6){f/=M,m/=M;let d=Math.max(.35,f*y+m*x);t.push(new I(f/d,m/d))}else t.push(new I(y,x))}return t}class mt extends K{constructor(e=new ge,t={}){super();let r=Array.isArray(e)?e:[e],s=Math.max(1,Math.min(64,Math.floor(H(t.curveSegments,12)))),l=H(t.depth??t.amount,1),h=Math.max(1,Math.min(32,Math.floor(H(t.steps,1)))),a=!!(t.bevelEnabled??!1),c=a?Math.max(0,H(t.bevelThickness,.06)):0,i=a?Math.max(0,H(t.bevelSize,c*.8)):0,p=a?H(t.bevelOffset,0):0,u=a?Math.max(1,Math.min(8,Math.floor(H(t.bevelSegments,2)))):0,o=[],y=[],x=[],b=[];for(let g of r){if(!(g instanceof xe))continue;let f=Xe(g,s);if(f.shape.length<3)continue;let m=f.shape.slice();me(m)<0&&m.reverse();let M=[];for(let _ of f.holes){if(_.length<3)continue;let A=_.slice();me(A)>0&&A.reverse(),M.push(A)}let{mergedIndices:d,allVertices:S}=De(m,M),P=ke(d,S),N=[m,...M],w=[];for(let _ of N){let A=gt(_);for(let k of A)w.push(k)}let[T,O,X,Y]=Ie(S);for(let[_,A]of[[-c,-1],[l+c,1]]){let k=o.length/3;for(let D=0;D<S.length;D++){let C=S[D],G=w[D]??new I(0,0),q=C.x+G.x*p,R=C.y+G.y*p;o.push(q,R,_),y.push(0,0,A),x.push((q-T)/X,(R-O)/Y)}for(let[D,C,G]of P)b.push(k+D,k+(A<0?G:C),k+(A<0?C:G))}let E=[];if(a&&u>0)for(let _=0;_<u;_++){let A=_/u*Math.PI/2;E.push({z:-c*Math.cos(A),expand:p+i*Math.sin(A)})}for(let _=0;_<=h;_++){let A=_/h;E.push({z:A*l,expand:p+i})}if(a&&u>0)for(let _=1;_<=u;_++){let A=_/u*Math.PI/2;E.push({z:l+c*Math.sin(A),expand:p+i*Math.cos(A)})}let L=0;for(let _ of N){let A=_.length;for(let k=0;k<E.length-1;k++){let D=E[k],C=E[k+1];for(let G=0;G<A;G++){let q=(G+1)%A,R=_[G],j=_[q],B=w[L+G],V=w[L+q],$=R.x+B.x*D.expand,F=R.y+B.y*D.expand,te=j.x+V.x*D.expand,ne=j.y+V.y*D.expand,ue=j.x+V.x*C.expand,ce=j.y+V.y*C.expand,J=R.x+B.x*C.expand,Z=R.y+B.y*C.expand,Q=te-$,U=ne-F,Nt=J-$,St=Z-F,Ue=C.z-D.z,re=U*Ue,se=-Q*Ue,ie=Q*St-U*Nt,_e=Math.hypot(re,se,ie)||1;re/=_e,se/=_e,ie/=_e;let le=o.length/3;o.push($,F,D.z,te,ne,D.z,ue,ce,C.z,J,Z,C.z),y.push(re,se,ie,re,se,ie,re,se,ie,re,se,ie);let We=G/A,Je=(G+1)/A,Ze=k/(E.length-1),Qe=(k+1)/(E.length-1);x.push(We,Ze,Je,Ze,Je,Qe,We,Qe),b.push(le,le+1,le+2,le,le+2,le+3)}}L+=A}}be(this,o,y,x,b)}}function Re(n){return{x:n.x,y:n.y,z:n.z,nx:n.nx,ny:n.ny,nz:n.nz,u:n.u,v:n.v}}function bt(n){return{x:n.x,y:n.y,z:n.z,nx:-n.nx,ny:-n.ny,nz:-n.nz,u:n.u,v:n.v}}function dt(n,e,t){let r=n.nx+(e.nx-n.nx)*t,s=n.ny+(e.ny-n.ny)*t,l=n.nz+(e.nz-n.nz)*t,h=Math.hypot(r,s,l)||1;return{x:n.x+(e.x-n.x)*t,y:n.y+(e.y-n.y)*t,z:n.z+(e.z-n.z)*t,nx:r/h,ny:s/h,nz:l/h,u:n.u+(e.u-n.u)*t,v:n.v+(e.v-n.v)*t}}function Mt(n){if(n.length<3)return null;let e=n[0],t=n[1],r=n[2],s=t.x-e.x,l=t.y-e.y,h=t.z-e.z,a=r.x-e.x,c=r.y-e.y,i=r.z-e.z,p=l*i-h*c,u=h*a-s*i,o=s*c-l*a,y=Math.hypot(p,u,o);if(y<1e-9)return null;p/=y,u/=y,o/=y;let x=p*e.x+u*e.y+o*e.z;return{vertices:n,nx:p,ny:u,nz:o,w:x}}function vt(n){n.vertices.reverse();for(let e=0;e<n.vertices.length;e++)n.vertices[e]=bt(n.vertices[e]);n.nx=-n.nx,n.ny=-n.ny,n.nz=-n.nz,n.w=-n.w}let Oe=1e-5,qe=0,we=1,de=2,He=3;function Le(n,e,t,r,s,l,h,a,c){let i=0,p=[];for(let u=0;u<s.vertices.length;u++){let o=s.vertices[u],y=n*o.x+e*o.y+t*o.z-r,x=y<-Oe?de:y>Oe?we:qe;i|=x,p.push(x)}switch(i){case qe:{n*s.nx+e*s.ny+t*s.nz>0?l.push(s):h.push(s);break}case we:a.push(s);break;case de:c.push(s);break;case He:{let u=[],o=[],y=s.vertices.length;for(let m=0;m<y;m++){let M=(m+1)%y,d=p[m],S=p[M],P=s.vertices[m],N=s.vertices[M];if(d!==de&&u.push(P),d!==we&&o.push(d!==de?Re(P):P),(d|S)===He){let w=N.x-P.x,T=N.y-P.y,O=N.z-P.z,X=n*w+e*T+t*O,Y=Math.abs(X)>1e-12?(r-(n*P.x+e*P.y+t*P.z))/X:.5,E=dt(P,N,Math.max(0,Math.min(1,Y)));u.push(E),o.push(Re(E))}}let{nx:x,ny:b,nz:g,w:f}=s;u.length>=3&&a.push({vertices:u,nx:x,ny:b,nz:g,w:f}),o.length>=3&&c.push({vertices:o,nx:x,ny:b,nz:g,w:f});break}default:break}}class ae{constructor(e,t=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,t)}invert(){for(let t=0;t<this.polygons.length;t++)vt(this.polygons[t]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,t=0){if(!this.hasPlane||e.length===0)return e.slice();if(t>=ee)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ee})`);let r=[],s=[];for(let l=0;l<e.length;l++)Le(this.nx,this.ny,this.nz,this.w,e[l],r,s,r,s);return this.front&&r.length>0&&(r=this.front.clipPolygons(r,t+1)),this.back?s=s.length>0?this.back.clipPolygons(s,t+1):[]:s=[],r.concat(s)}clipTo(e,t=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),t<ee&&(this.front&&this.front.clipTo(e,t+1),this.back&&this.back.clipTo(e,t+1))}allPolygons(e=[]){for(let t=0;t<this.polygons.length;t++)e.push(this.polygons[t]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,t=0){if(!e.length)return;if(!this.hasPlane){let l=e[e.length>>1];this.nx=l.nx,this.ny=l.ny,this.nz=l.nz,this.w=l.w,this.hasPlane=!0}if(t>=ee)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ee})`);let r=[],s=[];for(let l=0;l<e.length;l++)Le(this.nx,this.ny,this.nz,this.w,e[l],this.polygons,this.polygons,r,s);r.length>0&&(this.front||(this.front=new ae),this.front.build(r,t+1)),s.length>0&&(this.back||(this.back=new ae),this.back.build(s,t+1))}}function je(n,e){if(!e&&n._csgPolygons)return n._csgPolygons;let t=n.attributes.position;if(!t||t.count===0)return[];let r=n.attributes.normal,s=n.attributes.uv,l=n.index?n.index.array:null,h=Math.floor(l?l.length/3:t.count/3);if(h>he)throw new RangeError(`SecurityError: CSG input triangle count (${h}) exceeds MAX_CSG_TRIANGLES (${he})`);let a=e?e.elements:null,c=a?a[0]*(a[5]*a[10]-a[9]*a[6])-a[4]*(a[1]*a[10]-a[9]*a[2])+a[8]*(a[1]*a[6]-a[5]*a[2])<0:!1,i=a?new ct().getNormalMatrix(e).elements:null,p=o=>{let y=t.getX(o),x=t.getY(o),b=t.getZ(o),g=r?r.getX(o):NaN,f=r?r.getY(o):NaN,m=r?r.getZ(o):NaN;if(a&&i){let S=a[0]*y+a[4]*x+a[8]*b+a[12],P=a[1]*y+a[5]*x+a[9]*b+a[13],N=a[2]*y+a[6]*x+a[10]*b+a[14];y=S,x=P,b=N;let w=i[0]*g+i[3]*f+i[6]*m,T=i[1]*g+i[4]*f+i[7]*m,O=i[2]*g+i[5]*f+i[8]*m,X=Math.hypot(w,T,O)||1;g=w/X,f=T/X,m=O/X}let M=s?s.getX(o):0,d=s?s.getY(o):0;return{x:y,y:x,z:b,nx:g,ny:f,nz:m,u:M,v:d}},u=[];for(let o=0;o<h;o++){let y=l?l[o*3]:o*3,x=l?l[o*3+1]:o*3+1,b=l?l[o*3+2]:o*3+2,g=Mt(c?[p(y),p(b),p(x)]:[p(y),p(x),p(b)]);g&&u.push(g)}return u}function zt(n){let e=[],t=[],r=[],s=[];for(let h of n){let a=h.vertices;if(a.length<3)continue;let c=e.length/3;for(let i of a)e.push(i.x,i.y,i.z),Number.isFinite(i.nx)&&i.nx*i.nx+i.ny*i.ny+i.nz*i.nz>.5?t.push(i.nx,i.ny,i.nz):t.push(h.nx,h.ny,h.nz),r.push(i.u,i.v);for(let i=1;i<a.length-1;i++)s.push(c,c+i,c+i+1)}let l=be(new K,e,t,r,s);return l._csgPolygons=n,l}function Pt(n,e,t){if(n.length+e.length>he)throw new RangeError(`SecurityError: Combined CSG triangle count (${n.length+e.length}) exceeds MAX_CSG_TRIANGLES (${he})`);if(n.length===0)return t==="union"?e:[];if(e.length===0)return t==="intersect"?[]:n;let r=1/0,s=1/0,l=1/0,h=-1/0,a=-1/0,c=-1/0;for(let y=0;y<e.length;y++){let x=e[y].vertices;for(let b=0;b<x.length;b++){let g=x[b];g.x<r&&(r=g.x),g.y<s&&(s=g.y),g.z<l&&(l=g.z),g.x>h&&(h=g.x),g.y>a&&(a=g.y),g.z>c&&(c=g.z)}}r-=1e-4,s-=1e-4,l-=1e-4,h+=1e-4,a+=1e-4,c+=1e-4;let i=[],p=[];for(let y=0;y<n.length;y++){let x=n[y],b=x.vertices,g=1/0,f=1/0,m=1/0,M=-1/0,d=-1/0,S=-1/0;for(let P=0;P<b.length;P++){let N=b[P];N.x<g&&(g=N.x),N.y<f&&(f=N.y),N.z<m&&(m=N.z),N.x>M&&(M=N.x),N.y>d&&(d=N.y),N.z>S&&(S=N.z)}M<r||g>h||d<s||f>a||S<l||m>c?p.push(x):i.push(x)}if(i.length===0)return t==="union"?n.concat(e):t==="subtract"?n:[];let u=new ae(i),o=new ae(e);return t==="union"?(u.clipTo(o),o.clipTo(u),o.invert(),o.clipTo(u),o.invert(),u.build(o.allPolygons()),p.concat(u.allPolygons())):t==="subtract"?(u.invert(),u.clipTo(o),o.clipTo(u),o.invert(),o.clipTo(u),o.invert(),u.build(o.allPolygons()),u.invert(),p.concat(u.allPolygons())):(u.invert(),o.clipTo(u),o.invert(),u.clipTo(o),o.clipTo(u),u.build(o.allPolygons()),u.invert(),u.allPolygons())}function Be(n,e,t,r=null,s=null){let l=je(n,r),h=je(e,s);return zt(Pt(l,h,t))}function Ae(n,e,t){let r=n instanceof fe||!!n?.isMesh,s=e instanceof fe||!!e?.isMesh,l=r?n.geometry:n,h=s?e.geometry:e,a=null;if(s)if(e.updateMatrix(),r){n.updateMatrix();let u=new Pe().makeScale(1/(n.scale.x||1),1/(n.scale.y||1),1/(n.scale.z||1)),o=Math.hypot(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w)||1,y=new Pe().compose(new oe(0,0,0),new W(-n.quaternion.x/o,-n.quaternion.y/o,-n.quaternion.z/o,n.quaternion.w/o),new oe(1,1,1)),x=new Pe().makeTranslation(-n.position.x,-n.position.y,-n.position.z);a=u.multiply(y).multiply(x).multiply(e.matrix)}else a=e.matrix;let c=Be(l,h,t,null,a),i=r?n.material:new Ce,p=new fe(c,i);return r&&(p.position.copy(n.position),p.quaternion.copy(n.quaternion),p.scale.copy(n.scale),p.name=n.name),p}let Me={toGeometry:Be,subtract(n,e){return Ae(n,e,"subtract")},union(n,e){return Ae(n,e,"union")},intersect(n,e){return Ae(n,e,"intersect")}},Ve={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class Ye extends K{constructor(e="",t={}){super();let r=String(e??"").slice(0,Ge),s=Math.max(.005,Math.min(100,H(t.size,.2))),l=!!(t.bevelEnabled??!1),h=l?Math.max(0,Math.min(2,H(t.bevelThickness,s*.04))):0,a=l?Math.max(0,Math.min(2,H(t.bevelSize,s*.03))):0,c=Math.max(.001,Math.min(20,H(t.depth??t.height,s*.2)))+h*2,i=s*.085+a,p=s*.68,u=s*.82,o=[],y=[],x=[],b=[],g=(M,d,S,P,N,w,T)=>{let O=S-M,X=P-d,Y=Math.hypot(O,X),E=1,L=0;Y>1e-6&&(E=O/Y,L=X/Y);let _=-L*N,A=E*N,k=E*N*.6,D=L*N*.6,C=M-k+_,G=d-D+A,q=M-k-_,R=d-D-A,j=S+k-_,B=P+D-A,V=S+k+_,$=P+D+A,F=(te,ne,ue,ce,J,Z,Q)=>{let U=o.length/3;o.push(te[0],te[1],te[2],ne[0],ne[1],ne[2],ue[0],ue[1],ue[2],ce[0],ce[1],ce[2]),y.push(J,Z,Q,J,Z,Q,J,Z,Q,J,Z,Q),x.push(0,0,1,0,1,1,0,1),b.push(U,U+1,U+2,U,U+2,U+3)};F([C,G,T],[q,R,T],[j,B,T],[V,$,T],0,0,1),F([q,R,w],[C,G,w],[V,$,w],[j,B,w],0,0,-1),F([C,G,w],[q,R,w],[q,R,T],[C,G,T],-E,-L,0),F([j,B,w],[V,$,w],[V,$,T],[j,B,T],E,L,0),F([q,R,w],[j,B,w],[j,B,T],[q,R,T],L,-E,0),F([V,$,w],[C,G,w],[C,G,T],[V,$,T],-L,E,0)},f=0,m=0;for(let M=0;M<r.length;M++){let d=r[M];if(d===`
|
|
17
|
+
`){f=0,m-=s*1.35;continue}if(d===" "||d===" "){f+=u*(d===" "?.75:3);continue}if(d==="\r")continue;let S=d.toUpperCase(),P=d!==S&&d>="a"&&d<="z",N=Ve[S]??Ve["?"],w=P?s*.76:s,T=P?p*.88:p;for(let O of N)for(let X=0;X<O.length-1;X++){let Y=O[X],E=O[X+1];g(f+Y[0]*T,m+Y[1]*w,f+E[0]*T,m+E[1]*w,i,-c*.5,c*.5)}f+=P?u*.88:u}be(this,o,y,x,b),t.center!==!1?this.center():this.computeBoundingBox()}}function $e(n){if(!n)return;let e=n,t=n.userData?.xr?.text??n.userData?.xr?.label??n.userData?.xr?.title??n.userData?.xr?.caption??n.userData?.xr?.spatialLabel;if(t!=null&&t!==!1){let s=e.geometry?.attributes?.position;if((!s||s.count===0)&&n.userData._textApplied!==!0){let l="",h=.08,a=.015,c;if(typeof t=="string"||typeof t=="number")l=String(t);else if(typeof t=="object"){let i=t;l=String(i.text??i.value??""),i.size!==void 0&&(h=Number(i.size)||.08),(i.depth!==void 0||i.height!==void 0)&&(a=Number(i.depth??i.height)||h*.2),(typeof i.color=="string"||typeof i.color=="number")&&(c=i.color)}l.trim().length>0&&(e.geometry=new Ye(l,{size:h,depth:a}),n.userData._textApplied=!0,e.material instanceof yt?c!==void 0&&n.userData._autoTextColorApplied!==!0&&(e.material.color=new pt(c),n.userData._autoTextColorApplied=!0):e.material=new Ce({color:c??16317180}))}}let r=n.userData?.csg;if(r&&typeof r=="object"&&n.userData._csgApplied!==!0&&e.geometry instanceof K&&e.geometry.attributes.position?.count>0){n.userData._csgApplied=!0;let s=Array.isArray(r)?r:[r],l=e.geometry;for(let h of s){if(!h||typeof h!="object")continue;let a=h,c=String(a.op??a.operation??"subtract"),i=c==="union"||c==="intersect"?c:"subtract",p=a.target??a.mesh??a.geometry;if(p instanceof fe||p instanceof K)try{let u=i==="union"?Me.union(e,p):i==="intersect"?Me.intersect(e,p):Me.subtract(e,p);e.geometry!==l&&e.geometry.dispose?.(),e.geometry=u.geometry}catch(u){typeof console<"u"&&console.warn("[three-live] userData.csg skipped:",u)}}}}let Fe={Path:xe,Shape:ge,ShapeGeometry:xt,ExtrudeGeometry:mt,TextGeometry:Ye,CSG:Me,MAX_CSG_TRIANGLES:he,MAX_BSP_DEPTH:ee,MAX_TEXT_GEOMETRY_CHARS:Ge,MAX_SHAPE_POINTS:Se,materializeDeclarativeGeometry:$e};return z&&typeof z=="object"&&(z.authorNamespace||(z.authorNamespace={}),Object.assign(z.authorNamespace,Fe),z._cadMaterialize=$e,z.materializeDeclarativeGeometry=n=>{z._cadMaterialize?.(n),z._lodMaterialize?.(n),z._procMaterialize?.(n)}),Fe}var Ee={name:"cad",onRegister(){it(ze);let v=ye(),z=v.threeNamespace??(typeof globalThis<"u"?globalThis.THREE:void 0);z&&ze(z,v)}};return lt(Ee),st(Te)})();
|