three-live 1.3.1 → 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 +191 -0
- package/dist/three-author-engine.js +179 -144
- package/dist/three-author.cjs +153 -144
- package/dist/three-author.d.ts +191 -0
- package/dist/three-author.js +153 -144
- package/dist/three-convert.cjs +150 -141
- package/dist/three-convert.d.ts +191 -0
- package/dist/three-convert.js +150 -141
- 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 +191 -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 +191 -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 +191 -0
- package/dist/three-live-element.js +50 -85
- package/dist/three-live-full.cjs +915 -170
- package/dist/three-live-full.js +917 -172
- package/dist/three-live-full.min.js +915 -170
- 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 +191 -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 +191 -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 +155 -146
- package/dist/three-live.js +155 -146
- package/dist/three-live.min.js +155 -146
- package/dist/three-view.cjs +49 -84
- package/dist/three-view.d.ts +191 -0
- package/dist/three-view.js +50 -85
- package/dist/three-xr.cjs +150 -141
- package/dist/three-xr.d.ts +191 -0
- package/dist/three-xr.js +150 -141
- package/package.json +39 -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 A=typeof globalThis<"u"?globalThis:{};if(!A[me]){let E={plugins:[],decoders:new Map};try{Object.defineProperty(A,me,{value:E,writable:!1,configurable:!1,enumerable:!1})}catch{A[me]=E}}return A[me]}var wt=be().plugins;function bt(A){let E=be();E.workerExtensionInstallers||(E.workerExtensionInstallers=[]),E.workerExtensionInstallers.includes(A)||E.workerExtensionInstallers.push(A)}function Mt(A){let E=be().plugins;E.some(B=>B.name===A.name)||E.push(A),A.onRegister?.()}var dt=8192,vt=2048,zt=128,Pt=4096;function Se(A,E){if(!A||!A.BufferGeometry)return null;let B=A.Vector2,Ne=A.Vector3,st=A.Quaternion,Me=A.Matrix4,nt=A.Matrix3,rt=A.Color,de=A.BufferAttribute,ee=A.BufferGeometry,it=A.Material,_e=A.MeshStandardMaterial,ue=A.Mesh,he=8192,te=2048,Ae=128,ve=4096,H=(t,e)=>{let s=t==null?NaN:Number(t);return Number.isFinite(s)?s:e};class ce{constructor(e){this.currentPoint=new B(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 s=1;s<e.length;s++)this.lineTo(e[s].x,e[s].y);return this}moveTo(e,s){let n=Number(e)||0,i=Number(s)||0;return this.currentPoint.set(n,i),this.segments.push({type:"move",pts:[n,i]}),this}lineTo(e,s){let n=Number(e)||0,i=Number(s)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(n,i),this.segments.push({type:"line",pts:[n,i]}),this}quadraticCurveTo(e,s,n,i){let h=this.currentPoint.x,o=this.currentPoint.y,a=Number(e)||0,u=Number(s)||0,r=Number(n)||0,p=Number(i)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[h,o]}),this.currentPoint.set(r,p),this.segments.push({type:"quad",pts:[h,o,a,u,r,p]}),this}bezierCurveTo(e,s,n,i,h,o){let a=this.currentPoint.x,u=this.currentPoint.y,r=Number(e)||0,p=Number(s)||0,c=Number(n)||0,l=Number(i)||0,f=Number(h)||0,x=Number(o)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,u]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[a,u,r,p,c,l,f,x]}),this}absarc(e,s,n,i,h,o=!1){return this.absellipse(e,s,n,n,i,h,o,0)}arc(e,s,n,i,h,o=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(s)||0),n,i,h,o)}absellipse(e,s,n,i,h,o,a=!1,u=0){let r=Number(e)||0,p=Number(s)||0,c=Math.max(0,Number(n)||0),l=Math.max(0,Number(i)||0),f=Number(h)||0,x=Number(o)||0,m=a?1:0,y=Number(u)||0;this.segments.push({type:"arc",pts:[r,p,c,l,f,x,m,y]});let g=Math.cos(y),b=Math.sin(y),v=c*Math.cos(x),M=l*Math.sin(x);return this.currentPoint.set(r+v*g-M*b,p+v*b+M*g),this}ellipse(e,s,n,i,h,o,a=!1,u=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(s)||0),n,i,h,o,a,u)}closePath(){if(this.segments.length>0){let e=this.segments[0],s=0,n=0;if(e.type==="arc"){let i=e.pts[0],h=e.pts[1],o=e.pts[2],a=e.pts[3],u=e.pts[4],r=e.pts[7],p=Math.cos(r),c=Math.sin(r),l=o*Math.cos(u),f=a*Math.sin(u);s=i+l*p-f*c,n=h+l*c+f*p}else s=e.pts[0],n=e.pts[1];Math.hypot(this.currentPoint.x-s,this.currentPoint.y-n)>1e-6&&this.lineTo(s,n)}return this}getPoints(e=12){let s=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),n=[],i=(h,o)=>{if(n.length>0){let a=n[n.length-1];if(Math.hypot(a.x-h,a.y-o)<1e-6)return}n.push(new B(h,o))};for(let h of this.segments){let o=h.pts;if(h.type==="move"||h.type==="line")i(o[0],o[1]);else if(h.type==="quad"){let a=o[0],u=o[1],r=o[2],p=o[3],c=o[4],l=o[5];i(a,u);for(let f=1;f<=s;f++){let x=f/s,m=1-x;i(m*m*a+2*m*x*r+x*x*c,m*m*u+2*m*x*p+x*x*l)}}else if(h.type==="cubic"){let a=o[0],u=o[1],r=o[2],p=o[3],c=o[4],l=o[5],f=o[6],x=o[7];i(a,u);for(let m=1;m<=s;m++){let y=m/s,g=1-y,b=g*g,v=y*y;i(b*g*a+3*b*y*r+3*g*v*c+v*y*f,b*g*u+3*b*y*p+3*g*v*l+v*y*x)}}else if(h.type==="arc"){let a=o[0],u=o[1],r=o[2],p=o[3],c=o[4],l=o[5],f=o[6]!==0,x=o[7],m=Math.PI*2,y=l-c,g=Math.abs(y)<1e-9;for(;y<0;)y+=m;for(;y>m;)y-=m;y<1e-9&&(y=g?0:m),f&&!g&&(y=y===m?-m:y-m);let b=Math.cos(x),v=Math.sin(x),M=Math.max(2,s);for(let S=0;S<=M;S++){let z=S/M,w=c+z*y,N=r*Math.cos(w),_=p*Math.sin(w);i(a+N*b-_*v,u+N*v+_*b)}}}if(n.length>2){let h=n[0],o=n[n.length-1];Math.hypot(h.x-o.x,h.y-o.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(s=>({type:s.type,pts:[...s.pts]})),Array.isArray(this.holes)&&(e.holes=this.holes.map(s=>s.clone())),e}}class pe extends ce{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(s=>s.getPoints(e))}}}function ye(t){let e=0,s=t.length;for(let n=0,i=s-1;n<s;i=n++)e+=t[i].x*t[n].y-t[n].x*t[i].y;return e*.5}function lt(t,e,s,n,i,h,o,a){let u=o-s,r=a-n,p=i-s,c=h-n,l=t-s,f=e-n,x=u*u+r*r,m=u*p+r*c,y=u*l+r*f,g=p*p+c*c,b=p*l+c*f,v=x*g-m*m;if(Math.abs(v)<1e-12)return!1;let M=1/v,S=(g*y-m*b)*M,z=(x*b-m*y)*M;return S>=-1e-7&&z>=-1e-7&&S+z<=1+1e-7}function Te(t,e){let s=t.slice();ye(s)<0&&s.reverse();let n=s.map(u=>new B(u.x,u.y)),i=s.map((u,r)=>r),h=[];for(let u of e){if(!u||u.length<3)continue;let r=u.slice();ye(r)>0&&r.reverse();let p=[],c=-1/0,l=0;for(let f=0;f<r.length;f++){let x=r[f],m=n.length;n.push(new B(x.x,x.y)),p.push(m),x.x>c&&(c=x.x,l=f)}h.push({pts:r,indices:p,maxX:c,maxIdx:l})}h.sort((u,r)=>r.maxX-u.maxX);let o=(u,r,p)=>(r.x-u.x)*(p.y-u.y)-(r.y-u.y)*(p.x-u.x),a=(u,r,p)=>{for(let c=0;c<p.length;c++){let l=p[c],f=p[(c+1)%p.length];if(o(u,r,l)*o(u,r,f)<0&&o(l,f,u)*o(l,f,r)<0)return!0}return!1};for(let u of h){let r=u.pts[u.maxIdx],p=r.x,c=i.length,l=i.map(g=>n[g]),f=g=>Math.hypot(l[g].x-p,l[g].y-r.y),x=l.map((g,b)=>b).sort((g,b)=>+(l[g].x<p)-+(l[b].x<p)||f(g)-f(b)),m=x[0];for(let g of x){let b=l[g],v=l[(g+c-1)%c],M=l[(g+1)%c],S=o(b,M,r)>=0,z=o(v,b,r)>=0;if((o(v,b,M)>=0?S&&z:S||z)&&!a(r,b,l)&&!h.some(w=>a(r,b,w.pts))){m=g;break}}let y=[];for(let g=0;g<=m;g++)y.push(i[g]);for(let g=0;g<=u.indices.length;g++){let b=u.indices[(u.maxIdx+g)%u.indices.length];y.push(b)}for(let g=m;g<i.length;g++)y.push(i[g]);i=y}return{merged:i.map(u=>n[u]),mergedIndices:i,allVertices:n}}function Ee(t,e){let s=[],n=t.slice();if(n.length<3)return s;let i=n.length*n.length+64,h=0;for(;n.length>2&&i-- >0;){let o=n.length,a=n[(h+o-1)%o],u=n[h%o],r=n[(h+1)%o],p=e[a],c=e[u],l=e[r];if((c.x-p.x)*(l.y-p.y)-(c.y-p.y)*(l.x-p.x)>1e-9){let f=!0;for(let x=0;x<o;x++){let m=n[x];if(m===a||m===u||m===r)continue;let y=e[m];if(lt(y.x,y.y,p.x,p.y,c.x,c.y,l.x,l.y)&&Math.hypot(y.x-p.x,y.y-p.y)>=1e-6&&Math.hypot(y.x-c.x,y.y-c.y)>=1e-6&&Math.hypot(y.x-l.x,y.y-l.y)>=1e-6){f=!1;break}}if(f){s.push([a,u,r]),n.splice(h%o,1),h=Math.max(0,h%o-1);continue}}h++,h>=o*2&&(s.push([a,u,r]),n.splice((h-1)%o,1),h=0)}return s}function Ge(t,e){let s=t instanceof pe?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},n=s.shape.length;for(let i of s.holes)n+=i.length;if(n>ve)throw new RangeError(`SecurityError: shape point count (${n}) exceeds MAX_SHAPE_POINTS (${ve})`);return s}class ot extends ee{constructor(e=new pe,s=12){super();let n=Array.isArray(e)?e:[e],i=[],h=[],o=[],a=[];for(let u of n){if(!(u instanceof ce))continue;let r=Ge(u,s);if(r.shape.length<3)continue;let{mergedIndices:p,allVertices:c}=Te(r.shape,r.holes),l=Ee(p,c),f=i.length/3,x=1/0,m=1/0,y=-1/0,g=-1/0;for(let M of c)M.x<x&&(x=M.x),M.y<m&&(m=M.y),M.x>y&&(y=M.x),M.y>g&&(g=M.y);let b=Math.max(1e-6,y-x),v=Math.max(1e-6,g-m);for(let M of c)i.push(M.x,M.y,0),h.push(0,0,1),o.push((M.x-x)/b,(M.y-m)/v);for(let[M,S,z]of l)a.push(f+M,f+S,f+z)}fe(this,i,h,o,a)}}function fe(t,e,s,n,i){return t.setAttribute("position",new de(e,3)),t.setAttribute("normal",new de(s,3)),t.setAttribute("uv",new de(n,2)),t.setIndex(i),t}function ht(t){let e=t.length,s=[];for(let n=0;n<e;n++){let i=t[(n+e-1)%e],h=t[n],o=t[(n+1)%e],a=h.x-i.x,u=h.y-i.y,r=Math.hypot(a,u)||1;a/=r,u/=r;let p=o.x-h.x,c=o.y-h.y,l=Math.hypot(p,c)||1;p/=l,c/=l;let f=u,x=-a,m=c,y=-p,g=f+m,b=x+y,v=Math.hypot(g,b);if(v>1e-6){g/=v,b/=v;let M=Math.max(.35,g*f+b*x);s.push(new B(g/M,b/M))}else s.push(new B(f,x))}return s}class at extends ee{constructor(e=new pe,s={}){super();let n=Array.isArray(e)?e:[e],i=Math.max(1,Math.min(64,Math.floor(H(s.curveSegments,12)))),h=H(s.depth??s.amount,1),o=Math.max(1,Math.min(32,Math.floor(H(s.steps,1)))),a=!!(s.bevelEnabled??!1),u=a?Math.max(0,H(s.bevelThickness,.06)):0,r=a?Math.max(0,H(s.bevelSize,u*.8)):0,p=a?H(s.bevelOffset,0):0,c=a?Math.max(1,Math.min(8,Math.floor(H(s.bevelSegments,2)))):0,l=[],f=[],x=[],m=[];for(let y of n){if(!(y instanceof ce))continue;let g=Ge(y,i);if(g.shape.length<3)continue;let b=g.shape.slice();ye(b)<0&&b.reverse();let v=[];for(let d of g.holes){if(d.length<3)continue;let P=d.slice();ye(P)>0&&P.reverse(),v.push(P)}let{mergedIndices:M,allVertices:S}=Te(b,v),z=Ee(M,S),w=[b,...v],N=[];for(let d of w){let P=ht(d);for(let T of P)N.push(T)}let _=1/0,X=1/0,I=-1/0,q=-1/0;for(let d of S)d.x<_&&(_=d.x),d.y<X&&(X=d.y),d.x>I&&(I=d.x),d.y>q&&(q=d.y);let R=Math.max(1e-6,I-_),O=Math.max(1e-6,q-X),se=-u,ne=h+u,$=l.length/3;for(let d=0;d<S.length;d++){let P=S[d],T=N[d]??new B(0,0),G=P.x+T.x*p,C=P.y+T.y*p;l.push(G,C,se),f.push(0,0,-1),x.push((G-_)/R,(C-X)/O)}for(let[d,P,T]of z)m.push($+d,$+T,$+P);let F=l.length/3;for(let d=0;d<S.length;d++){let P=S[d],T=N[d]??new B(0,0),G=P.x+T.x*p,C=P.y+T.y*p;l.push(G,C,ne),f.push(0,0,1),x.push((G-_)/R,(C-X)/O)}for(let[d,P,T]of z)m.push(F+d,F+P,F+T);let k=[];if(a&&c>0)for(let d=0;d<c;d++){let P=d/c*Math.PI/2;k.push({z:-u*Math.cos(P),expand:p+r*Math.sin(P)})}for(let d=0;d<=o;d++){let P=d/o;k.push({z:P*h,expand:p+r})}if(a&&c>0)for(let d=1;d<=c;d++){let P=d/c*Math.PI/2;k.push({z:h+u*Math.sin(P),expand:p+r*Math.cos(P)})}let V=0;for(let d of w){let P=d.length;for(let T=0;T<k.length-1;T++){let G=k[T],C=k[T+1];for(let D=0;D<P;D++){let Y=(D+1)%P,Z=d[D],U=d[Y],Q=N[V+D],W=N[V+Y],J=Z.x+Q.x*G.expand,K=Z.y+Q.y*G.expand,L=U.x+W.x*G.expand,j=U.y+W.y*G.expand,gt=U.x+W.x*C.expand,mt=U.y+W.y*C.expand,Ye=Z.x+Q.x*C.expand,je=Z.y+Q.y*C.expand,$e=L-J,Fe=j-K,Ze=0,Ue=Ye-J,Qe=je-K,We=C.z-G.z,re=Fe*We-Ze*Qe,ie=Ze*Ue-$e*We,le=$e*Qe-Fe*Ue,we=Math.hypot(re,ie,le)||1;re/=we,ie/=we,le/=we;let oe=l.length/3;l.push(J,K,G.z,L,j,G.z,gt,mt,C.z,Ye,je,C.z),f.push(re,ie,le,re,ie,le,re,ie,le,re,ie,le);let Je=D/P,Ke=(D+1)/P,Le=T/(k.length-1),et=(T+1)/(k.length-1);x.push(Je,Le,Ke,Le,Ke,et,Je,et),m.push(oe,oe+1,oe+2,oe,oe+2,oe+3)}}V+=P}}fe(this,l,f,x,m)}}function Ce(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 ut(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 ct(t,e,s){let n=t.nx+(e.nx-t.nx)*s,i=t.ny+(e.ny-t.ny)*s,h=t.nz+(e.nz-t.nz)*s,o=Math.hypot(n,i,h)||1;return{x:t.x+(e.x-t.x)*s,y:t.y+(e.y-t.y)*s,z:t.z+(e.z-t.z)*s,nx:n/o,ny:i/o,nz:h/o,u:t.u+(e.u-t.u)*s,v:t.v+(e.v-t.v)*s}}function pt(t){if(t.length<3)return null;let e=t[0],s=t[1],n=t[2],i=s.x-e.x,h=s.y-e.y,o=s.z-e.z,a=n.x-e.x,u=n.y-e.y,r=n.z-e.z,p=h*r-o*u,c=o*a-i*r,l=i*u-h*a,f=Math.hypot(p,c,l);if(f<1e-9)return null;p/=f,c/=f,l/=f;let x=p*e.x+c*e.y+l*e.z;return{vertices:t,nx:p,ny:c,nz:l,w:x}}function yt(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=ut(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let Ie=1e-5,Xe=0,ze=1,xe=2,Re=3;function ke(t,e,s,n,i,h,o,a,u){let r=0,p=[];for(let c=0;c<i.vertices.length;c++){let l=i.vertices[c],f=t*l.x+e*l.y+s*l.z-n,x=f<-Ie?xe:f>Ie?ze:Xe;r|=x,p.push(x)}switch(r){case Xe:{t*i.nx+e*i.ny+s*i.nz>0?h.push(i):o.push(i);break}case ze:a.push(i);break;case xe:u.push(i);break;case Re:{let c=[],l=[],f=i.vertices.length;for(let b=0;b<f;b++){let v=(b+1)%f,M=p[b],S=p[v],z=i.vertices[b],w=i.vertices[v];if(M!==xe&&c.push(z),M!==ze&&l.push(M!==xe?Ce(z):z),(M|S)===Re){let N=w.x-z.x,_=w.y-z.y,X=w.z-z.z,I=t*N+e*_+s*X,q=Math.abs(I)>1e-12?(n-(t*z.x+e*z.y+s*z.z))/I:.5,R=ct(z,w,Math.max(0,Math.min(1,q)));c.push(R),l.push(Ce(R))}}let{nx:x,ny:m,nz:y,w:g}=i;c.length>=3&&a.push({vertices:c,nx:x,ny:m,nz:y,w:g}),l.length>=3&&u.push({vertices:l,nx:x,ny:m,nz:y,w:g});break}default:break}}class ae{constructor(e,s=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,s)}invert(){for(let s=0;s<this.polygons.length;s++)yt(this.polygons[s]);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,s=0){if(!this.hasPlane||e.length===0)return e.slice();if(s>=te)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${te})`);let n=[],i=[];for(let h=0;h<e.length;h++)ke(this.nx,this.ny,this.nz,this.w,e[h],n,i,n,i);return this.front&&n.length>0&&(n=this.front.clipPolygons(n,s+1)),this.back?i=i.length>0?this.back.clipPolygons(i,s+1):[]:i=[],n.concat(i)}clipTo(e,s=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),s<te&&(this.front&&this.front.clipTo(e,s+1),this.back&&this.back.clipTo(e,s+1))}allPolygons(e=[]){for(let s=0;s<this.polygons.length;s++)e.push(this.polygons[s]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,s=0){if(!e.length)return;if(!this.hasPlane){let h=e[e.length>>1];this.nx=h.nx,this.ny=h.ny,this.nz=h.nz,this.w=h.w,this.hasPlane=!0}if(s>=te)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${te})`);let n=[],i=[];for(let h=0;h<e.length;h++)ke(this.nx,this.ny,this.nz,this.w,e[h],this.polygons,this.polygons,n,i);n.length>0&&(this.front||(this.front=new ae),this.front.build(n,s+1)),i.length>0&&(this.back||(this.back=new ae),this.back.build(i,s+1))}}function De(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let s=t.attributes.position;if(!s||s.count===0)return[];let n=t.attributes.normal,i=t.attributes.uv,h=t.index?t.index.array:null,o=Math.floor(h?h.length/3:s.count/3);if(o>he)throw new RangeError(`SecurityError: CSG input triangle count (${o}) exceeds MAX_CSG_TRIANGLES (${he})`);let a=e?e.elements:null,u=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,r=a?new nt().getNormalMatrix(e).elements:null,p=l=>{let f=s.getX(l),x=s.getY(l),m=s.getZ(l),y=n?n.getX(l):NaN,g=n?n.getY(l):NaN,b=n?n.getZ(l):NaN;if(a&&r){let S=a[0]*f+a[4]*x+a[8]*m+a[12],z=a[1]*f+a[5]*x+a[9]*m+a[13],w=a[2]*f+a[6]*x+a[10]*m+a[14];f=S,x=z,m=w;let N=r[0]*y+r[3]*g+r[6]*b,_=r[1]*y+r[4]*g+r[7]*b,X=r[2]*y+r[5]*g+r[8]*b,I=Math.hypot(N,_,X)||1;y=N/I,g=_/I,b=X/I}let v=i?i.getX(l):0,M=i?i.getY(l):0;return{x:f,y:x,z:m,nx:y,ny:g,nz:b,u:v,v:M}},c=[];for(let l=0;l<o;l++){let f=h?h[l*3]:l*3,x=h?h[l*3+1]:l*3+1,m=h?h[l*3+2]:l*3+2,y=pt(u?[p(f),p(m),p(x)]:[p(f),p(x),p(m)]);y&&c.push(y)}return c}function ft(t){let e=[],s=[],n=[],i=[];for(let o of t){let a=o.vertices;if(a.length<3)continue;let u=e.length/3;for(let r of a)e.push(r.x,r.y,r.z),Number.isFinite(r.nx)&&r.nx*r.nx+r.ny*r.ny+r.nz*r.nz>.5?s.push(r.nx,r.ny,r.nz):s.push(o.nx,o.ny,o.nz),n.push(r.u,r.v);for(let r=1;r<a.length-1;r++)i.push(u,u+r,u+r+1)}let h=fe(new ee,e,s,n,i);return h._csgPolygons=t,h}function xt(t,e,s){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 s==="union"?e:[];if(e.length===0)return s==="intersect"?[]:t;let n=1/0,i=1/0,h=1/0,o=-1/0,a=-1/0,u=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let m=0;m<x.length;m++){let y=x[m];y.x<n&&(n=y.x),y.y<i&&(i=y.y),y.z<h&&(h=y.z),y.x>o&&(o=y.x),y.y>a&&(a=y.y),y.z>u&&(u=y.z)}}n-=1e-4,i-=1e-4,h-=1e-4,o+=1e-4,a+=1e-4,u+=1e-4;let r=[],p=[];for(let f=0;f<t.length;f++){let x=t[f],m=x.vertices,y=1/0,g=1/0,b=1/0,v=-1/0,M=-1/0,S=-1/0;for(let z=0;z<m.length;z++){let w=m[z];w.x<y&&(y=w.x),w.y<g&&(g=w.y),w.z<b&&(b=w.z),w.x>v&&(v=w.x),w.y>M&&(M=w.y),w.z>S&&(S=w.z)}v<n||y>o||M<i||g>a||S<h||b>u?p.push(x):r.push(x)}if(r.length===0)return s==="union"?t.concat(e):s==="subtract"?t:[];let c=new ae(r),l=new ae(e);return s==="union"?(c.clipTo(l),l.clipTo(c),l.invert(),l.clipTo(c),l.invert(),c.build(l.allPolygons()),p.concat(c.allPolygons())):s==="subtract"?(c.invert(),c.clipTo(l),l.clipTo(c),l.invert(),l.clipTo(c),l.invert(),c.build(l.allPolygons()),c.invert(),p.concat(c.allPolygons())):(c.invert(),l.clipTo(c),l.invert(),c.clipTo(l),l.clipTo(c),c.build(l.allPolygons()),c.invert(),c.allPolygons())}function qe(t,e,s,n=null,i=null){let h=De(t,n),o=De(e,i);return ft(xt(h,o,s))}function Pe(t,e,s){let n=t instanceof ue||!!t?.isMesh,i=e instanceof ue||!!e?.isMesh,h=n?t.geometry:t,o=i?e.geometry:e,a=null;if(i)if(e.updateMatrix(),n){t.updateMatrix();let c=new Me().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),l=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,f=new Me().compose(new Ne(0,0,0),new st(-t.quaternion.x/l,-t.quaternion.y/l,-t.quaternion.z/l,t.quaternion.w/l),new Ne(1,1,1)),x=new Me().makeTranslation(-t.position.x,-t.position.y,-t.position.z);a=c.multiply(f).multiply(x).multiply(e.matrix)}else a=e.matrix;let u=qe(h,o,s,null,a),r=n?t.material:new _e,p=new ue(u,r);return n&&(p.position.copy(t.position),p.quaternion.copy(t.quaternion),p.scale.copy(t.scale),p.name=t.name),p}let ge={toGeometry:qe,subtract(t,e){return Pe(t,e,"subtract")},union(t,e){return Pe(t,e,"union")},intersect(t,e){return Pe(t,e,"intersect")}},He={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 Be extends ee{constructor(e="",s={}){super();let n=String(e??"").slice(0,Ae),i=Math.max(.005,Math.min(100,H(s.size,.2))),h=!!(s.bevelEnabled??!1),o=h?Math.max(0,Math.min(2,H(s.bevelThickness,i*.04))):0,a=h?Math.max(0,Math.min(2,H(s.bevelSize,i*.03))):0,u=Math.max(.001,Math.min(20,H(s.depth??s.height,i*.2)))+o*2,r=i*.085+a,p=i*.68,c=i*.82,l=[],f=[],x=[],m=[],y=(v,M,S,z,w,N,_)=>{let X=S-v,I=z-M,q=Math.hypot(X,I),R=1,O=0;q>1e-6&&(R=X/q,O=I/q);let se=-O*w,ne=R*w,$=R*w*.6,F=O*w*.6,k=v-$+se,V=M-F+ne,d=v-$-se,P=M-F-ne,T=S+$-se,G=z+F-ne,C=S+$+se,D=z+F+ne,Y=(Z,U,Q,W,J,K,L)=>{let j=l.length/3;l.push(Z[0],Z[1],Z[2],U[0],U[1],U[2],Q[0],Q[1],Q[2],W[0],W[1],W[2]),f.push(J,K,L,J,K,L,J,K,L,J,K,L),x.push(0,0,1,0,1,1,0,1),m.push(j,j+1,j+2,j,j+2,j+3)};Y([k,V,_],[d,P,_],[T,G,_],[C,D,_],0,0,1),Y([d,P,N],[k,V,N],[C,D,N],[T,G,N],0,0,-1),Y([k,V,N],[d,P,N],[d,P,_],[k,V,_],-R,-O,0),Y([T,G,N],[C,D,N],[C,D,_],[T,G,_],R,O,0),Y([d,P,N],[T,G,N],[T,G,_],[d,P,_],O,-R,0),Y([C,D,N],[k,V,N],[k,V,_],[C,D,_],-O,R,0)},g=0,b=0;for(let v=0;v<n.length;v++){let M=n[v];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 Me=Object.defineProperty,it=Object.getOwnPropertyDescriptor,lt=Object.getOwnPropertyNames,ot=Object.prototype.hasOwnProperty,ht=(z,N)=>{for(var X in N)Me(z,X,{get:N[X],enumerable:!0})},at=(z,N,X,ae)=>{if(N&&typeof N=="object"||typeof N=="function")for(let K of lt(N))!ot.call(z,K)&&K!==X&&Me(z,K,{get:()=>N[K],enumerable:!(ae=it(N,K))||ae.enumerable});return z},ut=z=>at(Me({},"__esModule",{value:!0}),z),Ae={};ht(Ae,{MAX_BSP_DEPTH:()=>ft,MAX_CSG_TRIANGLES:()=>yt,MAX_SHAPE_POINTS:()=>gt,MAX_TEXT_GEOMETRY_CHARS:()=>xt,cadPlugin:()=>Ee,installCadExtension:()=>Pe});var pe="__THREE_LIVE_REGISTRY__";function ye(){let z=typeof globalThis<"u"?globalThis:{};if(!z[pe]){let N={plugins:[],decoders:new Map};try{Object.defineProperty(z,pe,{value:N,writable:!1,configurable:!1,enumerable:!1})}catch{z[pe]=N}}return z[pe]}var Gt=ye().plugins;function ct(z){let N=ye();N.workerExtensionInstallers||(N.workerExtensionInstallers=[]),N.workerExtensionInstallers.includes(z)||N.workerExtensionInstallers.push(z)}function pt(z){let N=ye().plugins;N.some(X=>X.name===z.name)||N.push(z),z.onRegister?.()}var yt=8192,ft=2048,xt=128,gt=4096;function Pe(z,N){if(!z||!z.BufferGeometry)return null;let X=z.Vector2,ae=z.Vector3,K=z.Quaternion,ze=z.Matrix4,mt=z.Matrix3,bt=z.Color,we=z.BufferAttribute,te=z.BufferGeometry,dt=z.Material,ke=z.MeshStandardMaterial,fe=z.Mesh,ue=8192,ne=2048,Ge=128,Se=4096,B=(t,e)=>{let n=t==null?NaN:Number(t);return Number.isFinite(n)?n:e};class xe{constructor(e){this.currentPoint=new X(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 n=1;n<e.length;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){let r=Number(e)||0,i=Number(n)||0;return this.currentPoint.set(r,i),this.segments.push({type:"move",pts:[r,i]}),this}lineTo(e,n){let r=Number(e)||0,i=Number(n)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(r,i),this.segments.push({type:"line",pts:[r,i]}),this}quadraticCurveTo(e,n,r,i){let h=this.currentPoint.x,o=this.currentPoint.y,a=Number(e)||0,u=Number(n)||0,s=Number(r)||0,p=Number(i)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[h,o]}),this.currentPoint.set(s,p),this.segments.push({type:"quad",pts:[h,o,a,u,s,p]}),this}bezierCurveTo(e,n,r,i,h,o){let a=this.currentPoint.x,u=this.currentPoint.y,s=Number(e)||0,p=Number(n)||0,c=Number(r)||0,l=Number(i)||0,f=Number(h)||0,x=Number(o)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,u]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[a,u,s,p,c,l,f,x]}),this}absarc(e,n,r,i,h,o=!1){return this.absellipse(e,n,r,r,i,h,o,0)}arc(e,n,r,i,h,o=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),r,i,h,o)}absellipse(e,n,r,i,h,o,a=!1,u=0){let s=Number(e)||0,p=Number(n)||0,c=Math.max(0,Number(r)||0),l=Math.max(0,Number(i)||0),f=Number(h)||0,x=Number(o)||0,m=a?1:0,y=Number(u)||0;this.segments.push({type:"arc",pts:[s,p,c,l,f,x,m,y]});let g=Math.cos(y),b=Math.sin(y),M=c*Math.cos(x),d=l*Math.sin(x);return this.currentPoint.set(s+M*g-d*b,p+M*b+d*g),this}ellipse(e,n,r,i,h,o,a=!1,u=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),r,i,h,o,a,u)}closePath(){if(this.segments.length>0){let e=this.segments[0],n=0,r=0;if(e.type==="arc"){let i=e.pts[0],h=e.pts[1],o=e.pts[2],a=e.pts[3],u=e.pts[4],s=e.pts[7],p=Math.cos(s),c=Math.sin(s),l=o*Math.cos(u),f=a*Math.sin(u);n=i+l*p-f*c,r=h+l*c+f*p}else n=e.pts[0],r=e.pts[1];Math.hypot(this.currentPoint.x-n,this.currentPoint.y-r)>1e-6&&this.lineTo(n,r)}return this}getPoints(e=12){let n=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),r=[],i=(h,o)=>{if(r.length>0){let a=r[r.length-1];if(Math.hypot(a.x-h,a.y-o)<1e-6)return}r.push(new X(h,o))};for(let h of this.segments){let o=h.pts;if(h.type==="move"||h.type==="line")i(o[0],o[1]);else if(h.type==="quad"){let a=o[0],u=o[1],s=o[2],p=o[3],c=o[4],l=o[5];i(a,u);for(let f=1;f<=n;f++){let x=f/n,m=1-x;i(m*m*a+2*m*x*s+x*x*c,m*m*u+2*m*x*p+x*x*l)}}else if(h.type==="cubic"){let a=o[0],u=o[1],s=o[2],p=o[3],c=o[4],l=o[5],f=o[6],x=o[7];i(a,u);for(let m=1;m<=n;m++){let y=m/n,g=1-y,b=g*g,M=y*y;i(b*g*a+3*b*y*s+3*g*M*c+M*y*f,b*g*u+3*b*y*p+3*g*M*l+M*y*x)}}else if(h.type==="arc"){let a=o[0],u=o[1],s=o[2],p=o[3],c=o[4],l=o[5],f=o[6]!==0,x=o[7],m=Math.PI*2,y=l-c,g=Math.abs(y)<1e-9;for(;y<0;)y+=m;for(;y>m;)y-=m;y<1e-9&&(y=g?0:m),f&&!g&&(y=y===m?-m:y-m);let b=Math.cos(x),M=Math.sin(x),d=Math.max(2,n);for(let _=0;_<=d;_++){let P=_/d,S=c+P*y,T=s*Math.cos(S),A=p*Math.sin(S);i(a+T*b-A*M,u+T*M+A*b)}}}if(r.length>2){let h=r[0],o=r[r.length-1];Math.hypot(h.x-o.x,h.y-o.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(n=>({type:n.type,pts:[...n.pts]})),Array.isArray(this.holes)&&(e.holes=this.holes.map(n=>n.clone())),e}}class ge extends xe{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(n=>n.getPoints(e))}}}function me(t){let e=0,n=t.length;for(let r=0,i=n-1;r<n;i=r++)e+=t[i].x*t[r].y-t[r].x*t[i].y;return e*.5}function vt(t,e,n,r,i,h,o,a){let u=o-n,s=a-r,p=i-n,c=h-r,l=t-n,f=e-r,x=u*u+s*s,m=u*p+s*c,y=u*l+s*f,g=p*p+c*c,b=p*l+c*f,M=x*g-m*m;if(Math.abs(M)<1e-12)return!1;let d=1/M,_=(g*y-m*b)*d,P=(x*b-m*y)*d;return _>=-1e-7&&P>=-1e-7&&_+P<=1.0000001}function Ce(t,e){let n=t.slice();me(n)<0&&n.reverse();let r=n.map(u=>new X(u.x,u.y)),i=n.map((u,s)=>s),h=[];for(let u of e){if(!u||u.length<3)continue;let s=u.slice();me(s)>0&&s.reverse();let p=[],c=-1/0,l=0;for(let f=0;f<s.length;f++){let x=s[f],m=r.length;r.push(new X(x.x,x.y)),p.push(m),x.x>c&&(c=x.x,l=f)}h.push({pts:s,indices:p,maxX:c,maxIdx:l})}h.sort((u,s)=>s.maxX-u.maxX);let o=(u,s,p)=>(s.x-u.x)*(p.y-u.y)-(s.y-u.y)*(p.x-u.x),a=(u,s,p)=>{for(let c=0;c<p.length;c++){let l=p[c],f=p[(c+1)%p.length];if(o(u,s,l)*o(u,s,f)<0&&o(l,f,u)*o(l,f,s)<0)return!0}return!1};for(let u of h){let s=u.pts[u.maxIdx],p=s.x,c=i.length,l=i.map(g=>r[g]),f=g=>Math.hypot(l[g].x-p,l[g].y-s.y),x=l.map((g,b)=>b).sort((g,b)=>+(l[g].x<p)-+(l[b].x<p)||f(g)-f(b)),m=x[0];for(let g of x){let b=l[g],M=l[(g+c-1)%c],d=l[(g+1)%c],_=o(b,d,s)>=0,P=o(M,b,s)>=0;if((o(M,b,d)>=0?_&&P:_||P)&&!a(s,b,l)&&!h.some(S=>a(s,b,S.pts))){m=g;break}}let y=[];for(let g=0;g<=m;g++)y.push(i[g]);for(let g=0;g<=u.indices.length;g++){let b=u.indices[(u.maxIdx+g)%u.indices.length];y.push(b)}for(let g=m;g<i.length;g++)y.push(i[g]);i=y}return{merged:i.map(u=>r[u]),mergedIndices:i,allVertices:r}}function Ie(t,e){let n=[],r=t.slice();if(r.length<3)return n;let i=r.length*r.length+64,h=0;for(;r.length>2&&i-- >0;){let o=r.length,a=r[(h+o-1)%o],u=r[h%o],s=r[(h+1)%o],p=e[a],c=e[u],l=e[s];if((c.x-p.x)*(l.y-p.y)-(c.y-p.y)*(l.x-p.x)>1e-9){let f=!0;for(let x=0;x<o;x++){let m=r[x];if(m===a||m===u||m===s)continue;let y=e[m];if(vt(y.x,y.y,p.x,p.y,c.x,c.y,l.x,l.y)&&Math.hypot(y.x-p.x,y.y-p.y)>=1e-6&&Math.hypot(y.x-c.x,y.y-c.y)>=1e-6&&Math.hypot(y.x-l.x,y.y-l.y)>=1e-6){f=!1;break}}if(f){n.push([a,u,s]),r.splice(h%o,1),h=Math.max(0,h%o-1);continue}}h++,h>=o*2&&(n.push([a,u,s]),r.splice((h-1)%o,1),h=0)}return n}function Re(t,e){let n=t instanceof ge?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},r=n.shape.length;for(let i of n.holes)r+=i.length;if(r>Se)throw new RangeError(`SecurityError: shape point count (${r}) exceeds MAX_SHAPE_POINTS (${Se})`);return n}class Mt extends te{constructor(e=new ge,n=12){super();let r=Array.isArray(e)?e:[e],i=[],h=[],o=[],a=[];for(let u of r){if(!(u instanceof xe))continue;let s=Re(u,n);if(s.shape.length<3)continue;let{mergedIndices:p,allVertices:c}=Ce(s.shape,s.holes),l=Ie(p,c),f=i.length/3,x=1/0,m=1/0,y=-1/0,g=-1/0;for(let d of c)d.x<x&&(x=d.x),d.y<m&&(m=d.y),d.x>y&&(y=d.x),d.y>g&&(g=d.y);let b=Math.max(1e-6,y-x),M=Math.max(1e-6,g-m);for(let d of c)i.push(d.x,d.y,0),h.push(0,0,1),o.push((d.x-x)/b,(d.y-m)/M);for(let[d,_,P]of l)a.push(f+d,f+_,f+P)}be(this,i,h,o,a)}}function be(t,e,n,r,i){return t.setAttribute("position",new we(e,3)),t.setAttribute("normal",new we(n,3)),t.setAttribute("uv",new we(r,2)),t.setIndex(i),t}function Pt(t){let e=t.length,n=[];for(let r=0;r<e;r++){let i=t[(r+e-1)%e],h=t[r],o=t[(r+1)%e],a=h.x-i.x,u=h.y-i.y,s=Math.hypot(a,u)||1;a/=s,u/=s;let p=o.x-h.x,c=o.y-h.y,l=Math.hypot(p,c)||1;p/=l,c/=l;let f=u,x=-a,m=c,y=-p,g=f+m,b=x+y,M=Math.hypot(g,b);if(M>1e-6){g/=M,b/=M;let d=Math.max(.35,g*f+b*x);n.push(new X(g/d,b/d))}else n.push(new X(f,x))}return n}class zt extends te{constructor(e=new ge,n={}){super();let r=Array.isArray(e)?e:[e],i=Math.max(1,Math.min(64,Math.floor(B(n.curveSegments,12)))),h=B(n.depth??n.amount,1),o=Math.max(1,Math.min(32,Math.floor(B(n.steps,1)))),a=!!(n.bevelEnabled??!1),u=a?Math.max(0,B(n.bevelThickness,.06)):0,s=a?Math.max(0,B(n.bevelSize,u*.8)):0,p=a?B(n.bevelOffset,0):0,c=a?Math.max(1,Math.min(8,Math.floor(B(n.bevelSegments,2)))):0,l=[],f=[],x=[],m=[];for(let y of r){if(!(y instanceof xe))continue;let g=Re(y,i);if(g.shape.length<3)continue;let b=g.shape.slice();me(b)<0&&b.reverse();let M=[];for(let v of g.holes){if(v.length<3)continue;let w=v.slice();me(w)>0&&w.reverse(),M.push(w)}let{mergedIndices:d,allVertices:_}=Ce(b,M),P=Ie(d,_),S=[b,...M],T=[];for(let v of S){let w=Pt(v);for(let E of w)T.push(E)}let A=1/0,I=1/0,C=-1/0,O=-1/0;for(let v of _)v.x<A&&(A=v.x),v.y<I&&(I=v.y),v.x>C&&(C=v.x),v.y>O&&(O=v.y);let R=Math.max(1e-6,C-A),q=Math.max(1e-6,O-I),re=-u,se=h+u,Y=l.length/3;for(let v=0;v<_.length;v++){let w=_[v],E=T[v]??new X(0,0),k=w.x+E.x*p,G=w.y+E.y*p;l.push(k,G,re),f.push(0,0,-1),x.push((k-A)/R,(G-I)/q)}for(let[v,w,E]of P)m.push(Y+v,Y+E,Y+w);let $=l.length/3;for(let v=0;v<_.length;v++){let w=_[v],E=T[v]??new X(0,0),k=w.x+E.x*p,G=w.y+E.y*p;l.push(k,G,se),f.push(0,0,1),x.push((k-A)/R,(G-I)/q)}for(let[v,w,E]of P)m.push($+v,$+w,$+E);let D=[];if(a&&c>0)for(let v=0;v<c;v++){let w=v/c*Math.PI/2;D.push({z:-u*Math.cos(w),expand:p+s*Math.sin(w)})}for(let v=0;v<=o;v++){let w=v/o;D.push({z:w*h,expand:p+s})}if(a&&c>0)for(let v=1;v<=c;v++){let w=v/c*Math.PI/2;D.push({z:h+u*Math.sin(w),expand:p+s*Math.cos(w)})}let H=0;for(let v of S){let w=v.length;for(let E=0;E<D.length-1;E++){let k=D[E],G=D[E+1];for(let L=0;L<w;L++){let j=(L+1)%w,F=v[L],J=v[j],Z=T[H+L],U=T[H+j],Q=F.x+Z.x*k.expand,W=F.y+Z.y*k.expand,ee=J.x+U.x*k.expand,V=J.y+U.y*k.expand,Et=J.x+U.x*G.expand,kt=J.y+U.y*G.expand,Fe=F.x+Z.x*G.expand,Je=F.y+Z.y*G.expand,Ze=ee-Q,Ue=V-W,Qe=0,We=Fe-Q,Ke=Je-W,et=G.z-k.z,ie=Ue*et-Qe*Ke,le=Qe*We-Ze*et,oe=Ze*Ke-Ue*We,Te=Math.hypot(ie,le,oe)||1;ie/=Te,le/=Te,oe/=Te;let he=l.length/3;l.push(Q,W,k.z,ee,V,k.z,Et,kt,G.z,Fe,Je,G.z),f.push(ie,le,oe,ie,le,oe,ie,le,oe,ie,le,oe);let tt=L/w,nt=(L+1)/w,rt=E/(D.length-1),st=(E+1)/(D.length-1);x.push(tt,rt,nt,rt,nt,st,tt,st),m.push(he,he+1,he+2,he,he+2,he+3)}}H+=w}}be(this,l,f,x,m)}}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 wt(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 St(t,e,n){let r=t.nx+(e.nx-t.nx)*n,i=t.ny+(e.ny-t.ny)*n,h=t.nz+(e.nz-t.nz)*n,o=Math.hypot(r,i,h)||1;return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n,z:t.z+(e.z-t.z)*n,nx:r/o,ny:i/o,nz:h/o,u:t.u+(e.u-t.u)*n,v:t.v+(e.v-t.v)*n}}function Nt(t){if(t.length<3)return null;let e=t[0],n=t[1],r=t[2],i=n.x-e.x,h=n.y-e.y,o=n.z-e.z,a=r.x-e.x,u=r.y-e.y,s=r.z-e.z,p=h*s-o*u,c=o*a-i*s,l=i*u-h*a,f=Math.hypot(p,c,l);if(f<1e-9)return null;p/=f,c/=f,l/=f;let x=p*e.x+c*e.y+l*e.z;return{vertices:t,nx:p,ny:c,nz:l,w:x}}function _t(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=wt(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let De=1e-5,Le=0,Ne=1,de=2,Oe=3;function Be(t,e,n,r,i,h,o,a,u){let s=0,p=[];for(let c=0;c<i.vertices.length;c++){let l=i.vertices[c],f=t*l.x+e*l.y+n*l.z-r,x=f<-De?de:f>De?Ne:Le;s|=x,p.push(x)}switch(s){case Le:{t*i.nx+e*i.ny+n*i.nz>0?h.push(i):o.push(i);break}case Ne:a.push(i);break;case de:u.push(i);break;case Oe:{let c=[],l=[],f=i.vertices.length;for(let b=0;b<f;b++){let M=(b+1)%f,d=p[b],_=p[M],P=i.vertices[b],S=i.vertices[M];if(d!==de&&c.push(P),d!==Ne&&l.push(d!==de?Xe(P):P),(d|_)===Oe){let T=S.x-P.x,A=S.y-P.y,I=S.z-P.z,C=t*T+e*A+n*I,O=Math.abs(C)>1e-12?(r-(t*P.x+e*P.y+n*P.z))/C:.5,R=St(P,S,Math.max(0,Math.min(1,O)));c.push(R),l.push(Xe(R))}}let{nx:x,ny:m,nz:y,w:g}=i;c.length>=3&&a.push({vertices:c,nx:x,ny:m,nz:y,w:g}),l.length>=3&&u.push({vertices:l,nx:x,ny:m,nz:y,w:g});break}default:break}}class ce{constructor(e,n=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,n)}invert(){for(let n=0;n<this.polygons.length;n++)_t(this.polygons[n]);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,n=0){if(!this.hasPlane||e.length===0)return e.slice();if(n>=ne)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ne})`);let r=[],i=[];for(let h=0;h<e.length;h++)Be(this.nx,this.ny,this.nz,this.w,e[h],r,i,r,i);return this.front&&r.length>0&&(r=this.front.clipPolygons(r,n+1)),this.back?i=i.length>0?this.back.clipPolygons(i,n+1):[]:i=[],r.concat(i)}clipTo(e,n=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),n<ne&&(this.front&&this.front.clipTo(e,n+1),this.back&&this.back.clipTo(e,n+1))}allPolygons(e=[]){for(let n=0;n<this.polygons.length;n++)e.push(this.polygons[n]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,n=0){if(!e.length)return;if(!this.hasPlane){let h=e[e.length>>1];this.nx=h.nx,this.ny=h.ny,this.nz=h.nz,this.w=h.w,this.hasPlane=!0}if(n>=ne)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ne})`);let r=[],i=[];for(let h=0;h<e.length;h++)Be(this.nx,this.ny,this.nz,this.w,e[h],this.polygons,this.polygons,r,i);r.length>0&&(this.front||(this.front=new ce),this.front.build(r,n+1)),i.length>0&&(this.back||(this.back=new ce),this.back.build(i,n+1))}}function qe(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let n=t.attributes.position;if(!n||n.count===0)return[];let r=t.attributes.normal,i=t.attributes.uv,h=t.index?t.index.array:null,o=Math.floor(h?h.length/3:n.count/3);if(o>ue)throw new RangeError(`SecurityError: CSG input triangle count (${o}) exceeds MAX_CSG_TRIANGLES (${ue})`);let a=e?e.elements:null,u=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,s=a?new mt().getNormalMatrix(e).elements:null,p=l=>{let f=n.getX(l),x=n.getY(l),m=n.getZ(l),y=r?r.getX(l):NaN,g=r?r.getY(l):NaN,b=r?r.getZ(l):NaN;if(a&&s){let _=a[0]*f+a[4]*x+a[8]*m+a[12],P=a[1]*f+a[5]*x+a[9]*m+a[13],S=a[2]*f+a[6]*x+a[10]*m+a[14];f=_,x=P,m=S;let T=s[0]*y+s[3]*g+s[6]*b,A=s[1]*y+s[4]*g+s[7]*b,I=s[2]*y+s[5]*g+s[8]*b,C=Math.hypot(T,A,I)||1;y=T/C,g=A/C,b=I/C}let M=i?i.getX(l):0,d=i?i.getY(l):0;return{x:f,y:x,z:m,nx:y,ny:g,nz:b,u:M,v:d}},c=[];for(let l=0;l<o;l++){let f=h?h[l*3]:l*3,x=h?h[l*3+1]:l*3+1,m=h?h[l*3+2]:l*3+2,y=Nt(u?[p(f),p(m),p(x)]:[p(f),p(x),p(m)]);y&&c.push(y)}return c}function Tt(t){let e=[],n=[],r=[],i=[];for(let o of t){let a=o.vertices;if(a.length<3)continue;let u=e.length/3;for(let s of a)e.push(s.x,s.y,s.z),Number.isFinite(s.nx)&&s.nx*s.nx+s.ny*s.ny+s.nz*s.nz>.5?n.push(s.nx,s.ny,s.nz):n.push(o.nx,o.ny,o.nz),r.push(s.u,s.v);for(let s=1;s<a.length-1;s++)i.push(u,u+s,u+s+1)}let h=be(new te,e,n,r,i);return h._csgPolygons=t,h}function At(t,e,n){if(t.length+e.length>ue)throw new RangeError(`SecurityError: Combined CSG triangle count (${t.length+e.length}) exceeds MAX_CSG_TRIANGLES (${ue})`);if(t.length===0)return n==="union"?e:[];if(e.length===0)return n==="intersect"?[]:t;let r=1/0,i=1/0,h=1/0,o=-1/0,a=-1/0,u=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let m=0;m<x.length;m++){let y=x[m];y.x<r&&(r=y.x),y.y<i&&(i=y.y),y.z<h&&(h=y.z),y.x>o&&(o=y.x),y.y>a&&(a=y.y),y.z>u&&(u=y.z)}}r-=1e-4,i-=1e-4,h-=1e-4,o+=1e-4,a+=1e-4,u+=1e-4;let s=[],p=[];for(let f=0;f<t.length;f++){let x=t[f],m=x.vertices,y=1/0,g=1/0,b=1/0,M=-1/0,d=-1/0,_=-1/0;for(let P=0;P<m.length;P++){let S=m[P];S.x<y&&(y=S.x),S.y<g&&(g=S.y),S.z<b&&(b=S.z),S.x>M&&(M=S.x),S.y>d&&(d=S.y),S.z>_&&(_=S.z)}M<r||y>o||d<i||g>a||_<h||b>u?p.push(x):s.push(x)}if(s.length===0)return n==="union"?t.concat(e):n==="subtract"?t:[];let c=new ce(s),l=new ce(e);return n==="union"?(c.clipTo(l),l.clipTo(c),l.invert(),l.clipTo(c),l.invert(),c.build(l.allPolygons()),p.concat(c.allPolygons())):n==="subtract"?(c.invert(),c.clipTo(l),l.clipTo(c),l.invert(),l.clipTo(c),l.invert(),c.build(l.allPolygons()),c.invert(),p.concat(c.allPolygons())):(c.invert(),l.clipTo(c),l.invert(),c.clipTo(l),l.clipTo(c),c.build(l.allPolygons()),c.invert(),c.allPolygons())}function He(t,e,n,r=null,i=null){let h=qe(t,r),o=qe(e,i);return Tt(At(h,o,n))}function _e(t,e,n){let r=t instanceof fe||!!t?.isMesh,i=e instanceof fe||!!e?.isMesh,h=r?t.geometry:t,o=i?e.geometry:e,a=null;if(i)if(e.updateMatrix(),r){t.updateMatrix();let c=new ze().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),l=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,f=new ze().compose(new ae(0,0,0),new K(-t.quaternion.x/l,-t.quaternion.y/l,-t.quaternion.z/l,t.quaternion.w/l),new ae(1,1,1)),x=new ze().makeTranslation(-t.position.x,-t.position.y,-t.position.z);a=c.multiply(f).multiply(x).multiply(e.matrix)}else a=e.matrix;let u=He(h,o,n,null,a),s=r?t.material:new ke,p=new fe(u,s);return r&&(p.position.copy(t.position),p.quaternion.copy(t.quaternion),p.scale.copy(t.scale),p.name=t.name),p}let ve={toGeometry:He,subtract(t,e){return _e(t,e,"subtract")},union(t,e){return _e(t,e,"union")},intersect(t,e){return _e(t,e,"intersect")}},je={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 te{constructor(e="",n={}){super();let r=String(e??"").slice(0,Ge),i=Math.max(.005,Math.min(100,B(n.size,.2))),h=!!(n.bevelEnabled??!1),o=h?Math.max(0,Math.min(2,B(n.bevelThickness,i*.04))):0,a=h?Math.max(0,Math.min(2,B(n.bevelSize,i*.03))):0,u=Math.max(.001,Math.min(20,B(n.depth??n.height,i*.2)))+o*2,s=i*.085+a,p=i*.68,c=i*.82,l=[],f=[],x=[],m=[],y=(M,d,_,P,S,T,A)=>{let I=_-M,C=P-d,O=Math.hypot(I,C),R=1,q=0;O>1e-6&&(R=I/O,q=C/O);let re=-q*S,se=R*S,Y=R*S*.6,$=q*S*.6,D=M-Y+re,H=d-$+se,v=M-Y-re,w=d-$-se,E=_+Y-re,k=P+$-se,G=_+Y+re,L=P+$+se,j=(F,J,Z,U,Q,W,ee)=>{let V=l.length/3;l.push(F[0],F[1],F[2],J[0],J[1],J[2],Z[0],Z[1],Z[2],U[0],U[1],U[2]),f.push(Q,W,ee,Q,W,ee,Q,W,ee,Q,W,ee),x.push(0,0,1,0,1,1,0,1),m.push(V,V+1,V+2,V,V+2,V+3)};j([D,H,A],[v,w,A],[E,k,A],[G,L,A],0,0,1),j([v,w,T],[D,H,T],[G,L,T],[E,k,T],0,0,-1),j([D,H,T],[v,w,T],[v,w,A],[D,H,A],-R,-q,0),j([E,k,T],[G,L,T],[G,L,A],[E,k,A],R,q,0),j([v,w,T],[E,k,T],[E,k,A],[v,w,A],q,-R,0),j([G,L,T],[D,H,T],[D,H,A],[G,L,A],-q,R,0)},g=0,b=0;for(let M=0;M<r.length;M++){let d=r[M];if(d===`
|
|
17
|
-
`){
|
|
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)})();
|