import{e as It}from"./deduplicate-d84e5ef3.js";import{H as D}from"./InterleavedLayout-f58607b0.js";import{e as l}from"./VertexAttribute-0e674613.js";import{C as P}from"./enums-bdecffa2.js";import{t as Ot}from"./VertexElementDescriptor-2925c6af.js";import{ik as nt,it as At,hS as dt,fm as W,cP as ot,cr as z,iu as ht,iv as St,cs as lt,cQ as rt,cu as ut,bT as w,cT as Tt,ij as Et}from"./index-b5c8f851.js";function Y(t,e=0){const o=t.stride;return Array.from(t.fields.keys()).map(s=>{const r=t.fields.get(s),c=r.constructor.ElementCount,g=wt(r.constructor.ElementType),a=r.offset,p=!(!r.optional||!r.optional.glNormalized);return new Ot(s,c,g,a,o,p,e)})}function wt(t){const e=vt[t];if(e)return e;throw new Error("BufferType not supported in WebGL")}const vt={u8:P.UNSIGNED_BYTE,u16:P.UNSIGNED_SHORT,u32:P.UNSIGNED_INT,i8:P.BYTE,i16:P.SHORT,i32:P.INT,f32:P.FLOAT},$t=D().vec3f(l.POSITION).u16(l.COMPONENTINDEX),yt=D().vec2u8(l.SIDENESS);Y(yt);const K=D().vec3f(l.POSITION0).vec3f(l.POSITION1).vec3f(l.NORMAL).u16(l.COMPONENTINDEX).u8(l.VARIANTOFFSET,{glNormalized:!0}).u8(l.VARIANTSTROKE).u8(l.VARIANTEXTENSION,{glNormalized:!0}),k=D().vec3f(l.POSITION0).vec3f(l.POSITION1).vec3f(l.NORMALA).vec3f(l.NORMALB).u16(l.COMPONENTINDEX).u8(l.VARIANTOFFSET,{glNormalized:!0}).u8(l.VARIANTSTROKE).u8(l.VARIANTEXTENSION,{glNormalized:!0});l.POSITION0,l.POSITION1,l.COMPONENTINDEX,l.VARIANTOFFSET,l.VARIANTSTROKE,l.VARIANTEXTENSION,l.NORMAL,l.NORMALA,l.NORMALB,l.SIDENESS;const R=-1;var st;function Vt(t,e,o,s=Dt){const r=t.vertices.position,c=t.vertices.componentIndex,g=nt(s.anglePlanar),a=nt(s.angleSignificantEdge),p=Math.cos(a),f=Math.cos(g),u=G.edge,O=u.position0,A=u.position1,I=u.faceNormal0,v=u.faceNormal1,d=xt(t),$=Mt(t),n=$.length/4,i=e.allocate(n);let N=0;const m=n,h=o.allocate(m);let E=0,y=0,S=0;const J=At(0,n),_=new Float32Array(n);_.forEach((L,T,F)=>{r.getVec($[4*T],O),r.getVec($[4*T+1],A),F[T]=dt(O,A)}),J.sort((L,T)=>_[T]-_[L]);const Z=new Array,tt=new Array;for(let L=0;Le}function Lt(t,e){const o=ht(t.cosAngle),s=G.fwd,r=G.ortho;return St(s,t.position1,t.position0),o*(z(lt(r,t.faceNormal0,t.faceNormal1),s)>0?-1:1)>e}function Mt(t){const e=t.faces.length/3,o=t.faces,s=t.neighbors;let r=0;for(let a=0;a{n{if(n{const N=2*n,m=i-n;for(let h=1;h=0&&f[N+2*S]>E;S--)f[N+2*S+2]=f[N+2*S],f[N+2*S+3]=f[N+2*S+1];f[N+2*S+2]=E,f[N+2*S+3]=y}};for(let n=0;nn===t[3*i]?0:n===t[3*i+1]?1:n===t[3*i+2]?2:-1,d=(n,i)=>{const N=v(n,i);I[3*i+N]=-1},$=(n,i,N,m)=>{const h=v(n,i);I[3*i+h]=m;const E=v(N,m);I[3*m+E]=i};for(let n=0;n