gl-draw 0.15.25 → 0.15.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var We=Object.defineProperty,qe=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var ce=Object.getOwnPropertySymbols;var je=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable;var Ee=(u,e,t)=>e in u?We(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t,B=(u,e)=>{for(var t in e||(e={}))je.call(e,t)&&Ee(u,t,e[t]);if(ce)for(var t of ce(e))Be.call(e,t)&&Ee(u,t,e[t]);return u},le=(u,e)=>qe(u,ke(e));var de=(u,e)=>{var t={};for(var n in u)je.call(u,n)&&e.indexOf(n)<0&&(t[n]=u[n]);if(u!=null&&ce)for(var n of ce(u))e.indexOf(n)<0&&Be.call(u,n)&&(t[n]=u[n]);return t};var se=(u,e,t)=>new Promise((n,s)=>{var i=r=>{try{m(t.next(r))}catch(f){s(f)}},a=r=>{try{m(t.throw(r))}catch(f){s(f)}},m=r=>r.done?n(r.value):Promise.resolve(r.value).then(i,a);m((t=t.apply(u,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("three/examples/jsm/lines/LineMaterial"),Ie=require("three/examples/jsm/lines/LineSegmentsGeometry"),P=require("../WebGPULineSegments2.js"),c=require("three"),pe=require("three/examples/jsm/utils/BufferGeometryUtils"),Pe=require("../uvGenerator.js"),he=require("three-bvh-csg"),Fe=require("three/examples/jsm/lights/RectAreaLightUniformsLib"),Ye=require("@tweenjs/tween.js"),Ze=require("three/examples/jsm/lines/LineSegments2");function $e(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const ee=$e(Ye);function D(u,e=0){const t=u[0].index!==null,n=new Set(Object.keys(u[0].attributes)),s=new Set(Object.keys(u[0].morphAttributes)),i={},a={},m=u[0].morphTargetsRelative,r=new c.BufferGeometry;let f=0;for(let o=0;o<u.length;++o){const l=u[o];let b=0;if(t!==(l.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in l.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;i[d]===void 0&&(i[d]=[]),i[d].push(l.attributes[d]),b++}if(b!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". Make sure all geometries have the same number of attributes."),null;if(m!==l.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in l.morphAttributes){if(!s.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". .morphAttributes must be consistent throughout all geometries."),null;a[d]===void 0&&(a[d]=[]),a[d].push(l.morphAttributes[d])}if(e){let d;if(t)d=l.index.count;else if(l.attributes.position!==void 0)d=l.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". The geometry must have either an index or a position attribute"),null;if(e===1)r.addGroup(f,d,o);else if(e===2&&l.groups.length>0)for(let y of l.groups){let C=y.materialIndex;r.addGroup(f+y.start,Math.min(y.count,d),C)}f+=d}}if(t){let o=0;const l=[];for(let b=0;b<u.length;++b){const d=u[b].index;for(let y=0;y<d.count;++y)l.push(d.getX(y)+o);o+=u[b].attributes.position.count}r.setIndex(l)}for(const o in i){const l=pe.mergeAttributes(i[o]);if(!l)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+o+" attribute."),null;r.setAttribute(o,l)}for(const o in a){const l=a[o][0].length;if(l===0)break;r.morphAttributes=r.morphAttributes||{},r.morphAttributes[o]=[];for(let b=0;b<l;++b){const d=[];for(let C=0;C<a[o].length;++C)d.push(a[o][C][b]);const y=pe.mergeAttributes(d);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+o+" morphAttribute."),null;r.morphAttributes[o].push(y)}}return e===2?pe.mergeGroups(r):r}const Ve=u=>{const m=u,{coordinate:e,startHeight:t,height:n}=m,s=de(m,["coordinate","startHeight","height"]);let i=t||0;return typeof t!="undefined"&&typeof n!="undefined"&&(i=t+n),new P.PolygonGeometry([e],le(B({},s),{startHeight:t,endHeight:i}))};class Je extends P.BaseObject{constructor(e){super(),this.options=B({},e)}create(){const r=this.options,{geometry:e,coordinateArr:t,coordinate:n,material:s,useGroups:i}=r,a=de(r,["geometry","coordinateArr","coordinate","material","useGroups"]);let m=e;if(!m&&n)m=Ve(B({coordinate:n},a));else if(!m&&t){const f=t.map(o=>Ve(B({coordinate:o},a)));m=D(f,i!=null?i:0)}this.createMesh(m,s)}}const Qe={ArcCurve:c.ArcCurve,CatmullRomCurve3:c.CatmullRomCurve3,CubicBezierCurve:c.CubicBezierCurve,CubicBezierCurve3:c.CubicBezierCurve3,EllipseCurve:c.EllipseCurve,LineCurve:c.LineCurve,LineCurve3:c.LineCurve3,QuadraticBezierCurve:c.QuadraticBezierCurve,QuadraticBezierCurve3:c.QuadraticBezierCurve3,SplineCurve:c.SplineCurve};class J extends c.BufferGeometry{constructor(e=new c.Shape([new c.Vector2(.5,.5),new c.Vector2(-.5,.5),new c.Vector2(-.5,-.5),new c.Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,s=[],i=[];for(let m=0,r=e.length;m<r;m++){const f=e[m];a(f)}this.setAttribute("position",new c.Float32BufferAttribute(s,3)),this.setAttribute("uv",new c.Float32BufferAttribute(i,2)),this.computeVertexNormals();function a(m){var ve,Se,Ae;const r=[],f=t.curveSegments!==void 0?t.curveSegments:12,o=t.steps!==void 0?t.steps:1,l=t.depth!==void 0?t.depth:1;let b=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:d-.1,C=t.bevelOffset!==void 0?t.bevelOffset:0,A=t.bevelSegments!==void 0?t.bevelSegments:3;const M=t.extrudePath,j=t.UVGenerator!==void 0?t.UVGenerator:Ke,S=(ve=t.hasTop)!=null?ve:!0,V=(Se=t.hasBottom)!=null?Se:!0,Q=(Ae=t.hasSide)!=null?Ae:!0;let H,Y=!1,U,te,ne,N;M&&(H=M.getSpacedPoints(o),Y=!0,b=!1,U=M.computeFrenetFrames(o,!1),te=new c.Vector3,ne=new c.Vector3,N=new c.Vector3),b||(A=0,d=0,y=0,C=0);const ge=m.extractPoints(f);let I=ge.shape;const _=ge.holes;if(!c.ShapeUtils.isClockWise(I)){I=I.reverse();for(let h=0,p=_.length;h<p;h++){const g=_[h];c.ShapeUtils.isClockWise(g)&&(_[h]=g.reverse())}}function ye(h){const g=10000000000000001e-36;let w=h[0];for(let x=1;x<=h.length;x++){const L=x%h.length,v=h[L],T=v.x-w.x,G=v.y-w.y,E=T*T+G*G,z=Math.max(Math.abs(v.x),Math.abs(v.y),Math.abs(w.x),Math.abs(w.y)),$=g*z*z;if(E<=$){h.splice(L,1),x--;continue}w=v}}ye(I),_.forEach(ye);const ue=_.length,R=I;for(let h=0;h<ue;h++){const p=_[h];I=I.concat(p)}function K(h,p,g){return p||console.error("THREE.ExtrudeGeometry: vec does not exist"),h.clone().addScaledVector(p,g)}const X=I.length;function be(h,p,g){let w,x,L;const v=h.x-p.x,T=h.y-p.y,G=g.x-h.x,E=g.y-h.y,z=v*v+T*T,$=v*E-T*G;if(Math.abs($)>Number.EPSILON){const O=Math.sqrt(z),Me=Math.sqrt(G*G+E*E),Le=p.x-T/O,Ce=p.y+v/O,Ne=g.x-E/Me,Xe=g.y+G/Me,Te=((Ne-Le)*E-(Xe-Ce)*G)/(v*E-T*G);w=Le+v*Te-h.x,x=Ce+T*Te-h.y;const Ge=w*w+x*x;if(Ge<=2)return new c.Vector2(w,x);L=Math.sqrt(Ge/2)}else{let O=!1;v>Number.EPSILON?G>Number.EPSILON&&(O=!0):v<-Number.EPSILON?G<-Number.EPSILON&&(O=!0):Math.sign(T)===Math.sign(E)&&(O=!0),O?(w=-T,x=v,L=Math.sqrt(z)):(w=v,x=T,L=Math.sqrt(z/2))}return new c.Vector2(w/L,x/L)}const oe=[];for(let h=0,p=R.length,g=p-1,w=h+1;h<p;h++,g++,w++)g===p&&(g=0),w===p&&(w=0),oe[h]=be(R[h],R[g],R[w]);const fe=[];let F,ie=oe.concat();for(let h=0,p=ue;h<p;h++){const g=_[h];F=[];for(let w=0,x=g.length,L=x-1,v=w+1;w<x;w++,L++,v++)L===x&&(L=0),v===x&&(v=0),F[w]=be(g[w],g[L],g[v]);fe.push(F),ie=ie.concat(F)}let Z;if(A===0)Z=c.ShapeUtils.triangulateShape(R,_);else{const h=[],p=[];for(let g=0;g<A;g++){const w=g/A,x=d*Math.cos(w*Math.PI/2),L=y*Math.sin(w*Math.PI/2)+C;for(let v=0,T=R.length;v<T;v++){const G=K(R[v],oe[v],L);W(G.x,G.y,-x),w===0&&h.push(G)}for(let v=0,T=ue;v<T;v++){const G=_[v];F=fe[v];const E=[];for(let z=0,$=G.length;z<$;z++){const O=K(G[z],F[z],L);W(O.x,O.y,-x),w===0&&E.push(O)}w===0&&p.push(E)}}Z=c.ShapeUtils.triangulateShape(h,p)}const re=Z.length,xe=y+C;for(let h=0;h<X;h++){const p=b?K(I[h],ie[h],xe):I[h];Y?(ne.copy(U.normals[0]).multiplyScalar(p.x),te.copy(U.binormals[0]).multiplyScalar(p.y),N.copy(H[0]).add(ne).add(te),W(N.x,N.y,N.z)):W(p.x,p.y,0)}for(let h=1;h<=o;h++)for(let p=0;p<X;p++){const g=b?K(I[p],ie[p],xe):I[p];Y?(ne.copy(U.normals[h]).multiplyScalar(g.x),te.copy(U.binormals[h]).multiplyScalar(g.y),N.copy(H[h]).add(ne).add(te),W(N.x,N.y,N.z)):W(g.x,g.y,l/o*h)}for(let h=A-1;h>=0;h--){const p=h/A,g=d*Math.cos(p*Math.PI/2),w=y*Math.sin(p*Math.PI/2)+C;for(let x=0,L=R.length;x<L;x++){const v=K(R[x],oe[x],w);W(v.x,v.y,l+g)}for(let x=0,L=_.length;x<L;x++){const v=_[x];F=fe[x];for(let T=0,G=v.length;T<G;T++){const E=K(v[T],F[T],w);Y?W(E.x,E.y+H[o-1].y,H[o-1].x+g):W(E.x,E.y,l+g)}}}Re(),Q&&De();function Re(){const h=s.length/3;if(b){let p=0,g=X*p;if(V)for(let w=0;w<re;w++){const x=Z[w];ae(x[2]+g,x[1]+g,x[0]+g)}if(p=o+A*2,g=X*p,S)for(let w=0;w<re;w++){const x=Z[w];ae(x[0]+g,x[1]+g,x[2]+g)}}else{if(V)for(let p=0;p<re;p++){const g=Z[p];ae(g[2],g[1],g[0])}if(S)for(let p=0;p<re;p++){const g=Z[p];ae(g[0]+X*o,g[1]+X*o,g[2]+X*o)}}n.addGroup(h,s.length/3-h,0)}function De(){const h=s.length/3;let p=0;we(R,p),p+=R.length;for(let g=0,w=_.length;g<w;g++){const x=_[g];we(x,p),p+=x.length}n.addGroup(h,s.length/3-h,1)}function we(h,p){let g=h.length;for(;--g>=0;){const w=g;let x=g-1;x<0&&(x=h.length-1);for(let L=0,v=o+A*2;L<v;L++){const T=X*L,G=X*(L+1),E=p+w+T,z=p+x+T,$=p+x+G,O=p+w+G;He(E,z,$,O)}}}function W(h,p,g){r.push(h),r.push(p),r.push(g)}function ae(h,p,g){q(h),q(p),q(g);const w=s.length/3,x=j.generateTopUV(n,s,w-3,w-2,w-1);k(x[0]),k(x[1]),k(x[2])}function He(h,p,g,w){q(h),q(p),q(w),q(p),q(g),q(w);const x=s.length/3,L=j.generateSideWallUV(n,s,x-6,x-3,x-2,x-1);k(L[0]),k(L[1]),k(L[3]),k(L[1]),k(L[2]),k(L[3])}function q(h){s.push(r[h*3+0]),s.push(r[h*3+1]),s.push(r[h*3+2])}function k(h){i.push(h.x),i.push(h.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return et(t,n,e)}static fromJSON(e,t){const n=[];for(let i=0,a=e.shapes.length;i<a;i++){const m=t[e.shapes[i]];n.push(m)}const s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new Qe[`${s.type}`]().fromJSON(s)),new J(n,e.options)}}const Ke={generateTopUV:function(u,e,t,n,s){const i=e[t*3],a=e[t*3+1],m=e[n*3],r=e[n*3+1],f=e[s*3],o=e[s*3+1];return[new c.Vector2(i,a),new c.Vector2(m,r),new c.Vector2(f,o)]},generateSideWallUV:function(u,e,t,n,s,i){const a=e[t*3],m=e[t*3+1],r=e[t*3+2],f=e[n*3],o=e[n*3+1],l=e[n*3+2],b=e[s*3],d=e[s*3+1],y=e[s*3+2],C=e[i*3],A=e[i*3+1],M=e[i*3+2];return Math.abs(m-o)<Math.abs(a-f)?[new c.Vector2(a,1-r),new c.Vector2(f,1-l),new c.Vector2(b,1-y),new c.Vector2(C,1-M)]:[new c.Vector2(m,1-r),new c.Vector2(o,1-l),new c.Vector2(d,1-y),new c.Vector2(A,1-M)]}};function et(u,e,t){if(t.shapes=[],Array.isArray(u))for(let n=0,s=u.length;n<s;n++){const i=u[n];t.shapes.push(i.uuid)}else t.shapes.push(u.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class tt extends J{constructor(e,t){super(e,t);const n=new he.Brush(new J(e,le(B({},t),{hasTop:!0,hasSide:!0,hasBottom:!1})));n.updateMatrixWorld();const s=new c.Box3().setFromObject(n),i=new c.Vector3;s.getSize(i);const a=new c.Vector3(s.min.x+i.x/2,s.min.y+i.y/2,0);let m=t.topSegments,r=t.box3;if(r){r=r.union(s);const M=new c.Vector3;r.getSize(M);const j=Math.max(i.x/M.x,i.y/M.y);m=Math.ceil(t.topSegments*j)}if(m<4)return this;const f=new c.PlaneGeometry(i.x,i.y,m,m),o=new he.Brush(f);o.position.set(a.x,a.y,a.z),o.updateMatrixWorld();const b=new he.Evaluator().evaluate(o,n,he.INTERSECTION),d=b.geometry.getAttribute("position"),y=new c.Float32BufferAttribute(d.count*2,2);for(let M=0;M<d.count;M++){const j=d.getZ(M);d.setZ(M,t.depth+j)}if(r){const M=r.min,j=r.max,S=new c.Vector3().subVectors(j,M);for(let V=0;V<d.count;V++){const Q=d.getX(V),H=d.getY(V),Y=(Q-M.x)/S.x,U=(H-M.y)/S.y;y.setXY(V,Y,U)}b.geometry.setAttribute("uv",y)}d.needsUpdate=!0;const C=new J(e,le(B({},t),{hasTop:!1})),A=D([b.geometry,C],2);this.copy(A.toNonIndexed())}}const _e=u=>{const{split:e,depth:t,points:n,box3:s,hasTop:i,hasBottom:a,hasSide:m,sideRepeat:r,topSegments:f}=u,o=f?tt:J,l=new o(new c.Shape(n),{depth:t,bevelEnabled:!1,box3:s,UVGenerator:Pe.getUVGenerator({split:e,box3:s,sideRepeat:r}),hasTop:i,hasBottom:a,hasSide:m,topSegments:f});return Pe.claerUVGenerator(),l};class nt extends P.BaseObject{constructor(e){super(),this.options=B({depth:1},e)}create(){return se(this,null,function*(){const{points:e,pointsArr:t,useGroups:n,depth:s,geometry:i,geometryArr:a,material:m,box3:r,split:f,hasTop:o,hasBottom:l,hasSide:b}=this.options,d=Array.isArray(s)?s:[s],y=Array.isArray(r)?r:[r],C=m;let A=i;C||console.log("material is null"),!A&&e?A=_e({points:e,depth:d[0],box3:y[0],split:f,hasTop:o,hasBottom:l,hasSide:b}):!A&&t?A=D(t.map((M,j)=>{var S,V;return _e({points:M,depth:(S=d[j])!=null?S:d[0],box3:(V=y[j])!=null?V:y[0],split:f,hasTop:o,hasBottom:l,hasSide:b})}),n!=null?n:0):!A&&a&&a.length>1?A=D(a,n!=null?n:0):!A&&a&&a.length===1&&([A]=a),this.createMesh(A,C)})}addGeometries(e){const t=this.object3d,n=D([t.geometry,...e]);t.geometry=n}setTextureAnisotropic(e,t){e.anisotropy=t||this.pencil.renderer.capabilities.getMaxAnisotropy()}}const st=u=>{const{topColor:e,sideColor:t,sideMap:n,createCanvasObjectURL:s,split:i,maxAnisotropy:a}=u;return new Promise(m=>{const r=n?document.createElement("img"):{src:"",onload:()=>{},width:128,height:128};r.onload=()=>{const f=i,o=document.createElement("canvas"),l=o.getContext("2d");o.height=r.height/(1-f),o.width=r.width,f&&e&&(l.fillStyle=e,l.fillRect(0,0,r.width,o.height*f)),n&&r instanceof HTMLImageElement?l.drawImage(r,0,o.height*f,r.width,r.height):t&&(l.fillStyle=t,l.fillRect(0,o.height*f,r.width,r.height)),s&&o.toBlob(d=>{console.log(URL.createObjectURL(d))});const b=new c.CanvasTexture(o);m(b)},n?r.src=n:r instanceof HTMLImageElement||r.onload()})};class ot extends P.BaseObject{create(){this.createGroup()}}class it extends P.BaseObject{constructor(e){super(),this.rectAreaLightUniformsLibInit=!1,this.options=e}create(){var t,n,s,i,a,m,r,f,o,l,b,d,y,C,A,M,j;const e=this.options;if(e.type==="AmbientLight"){const S=new c.AmbientLight(e.color);S.name="环境光",this.object3d=S}else if(e.type==="DirectionalLight"){const S=new c.DirectionalLight(e.color,e.intensity);S.name="平行光",S.target.position.set(0,0,0),this.object3d=S,S.target.name="平行光目标",S.shadow.camera.name="平行光阴影相机",S.shadow.camera.userData.directionalLightShadow=!0,this.directionalLight=S}else if(e.type==="PointLight"){const S=new c.PointLight((t=e.color)!=null?t:16777215,(n=e.intensity)!=null?n:1,(s=e.distance)!=null?s:0,(i=e.decay)!=null?i:2);S.name="点光源",this.object3d=S,this.pointLight=S}else if(e.type==="SpotLight"){const S=new c.SpotLight((a=e.color)!=null?a:16777215,(m=e.intensity)!=null?m:1,(r=e.distance)!=null?r:0,(f=e.angle)!=null?f:Math.PI/3,(o=e.penumbra)!=null?o:1,(l=e.decay)!=null?l:2);S.name="聚光灯",this.object3d=S,this.spotLight=S,S.target.name="聚光灯目标"}else if(e.type==="HemisphereLight"){const S=new c.HemisphereLight((b=e.color)!=null?b:16777215,(d=e.groundColor)!=null?d:16777215,(y=e.intensity)!=null?y:1);S.name="半球光",this.object3d=S,this.hemisphereLight=S}else if(e.type==="RectAreaLight"){this.rectAreaLightUniformsLibInit||(Fe.RectAreaLightUniformsLib.init(),this.rectAreaLightUniformsLibInit=!0);const S=new c.RectAreaLight((C=e.color)!=null?C:16777215,(A=e.intensity)!=null?A:1,(M=e.width)!=null?M:10,(j=e.height)!=null?j:10);S.name="矩形区域光",this.object3d=S,this.rectAreaLight=S}}render(){const e=this.object3d;e.target&&this.pencil.scene.add(e.target);const t=this.pencil.cameraTarget;if(this.spotLight||this.directionalLight){const n=this.spotLight||this.directionalLight;n.position.copy(t),n.target.position.copy(t)}else this.pointLight&&this.pointLight.position.copy(t)}dispose(){const e=this.object3d;e.target&&this.pencil.scene.remove(e.target),super.dispose()}}class Ue extends c.BufferGeometry{constructor(e=[],t="none",n){super(),this.type="MeshLineGeometry",this.pointCount=0,this._points=[],this.shape="none",this.shapeFunction=s=>1,this.matrixWorld=new c.Matrix4,this.shape=t,n&&(this.shapeFunction=n),e.length>0&&this.setPoints(e)}convertToVector3Array(e){if(typeof e[0]=="number"){const t=[],n=e;for(let s=0;s<n.length;s+=3)t.push(new c.Vector3(n[s],n[s+1],n[s+2]));return t}else return e.map(t=>{if(t instanceof c.Vector2)return new c.Vector3(t.x,t.y,0);if(t instanceof c.Vector3)return t;if(Array.isArray(t)&&t.length===2)return new c.Vector3(t[0],t[1],0);if(Array.isArray(t)&&t.length===3)return new c.Vector3(t[0],t[1],t[2])}).filter(Boolean)}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){!e||e.length===0||(this._points=this.convertToVector3Array(e),this.pointCount=this._points.length,t&&(this.shapeFunction=t,this.shape="custom"),this.initializeGeometry(),this.updateGeometry())}initializeGeometry(){const e=new c.BufferAttribute(new Float32Array(this.pointCount*6),3),t=new c.BufferAttribute(new Float32Array(this.pointCount*6),3),n=new c.BufferAttribute(new Float32Array(this.pointCount*6),3),s=new c.BufferAttribute(new Float32Array(this.pointCount*2),1),i=new c.BufferAttribute(new Float32Array(this.pointCount*2),1),a=new c.BufferAttribute(new Float32Array(this.pointCount*2),1),m=new c.BufferAttribute(new Float32Array(this.pointCount*4),2),r=new c.BufferAttribute(new Uint16Array((this.pointCount-1)*6),1);this.shape==="taper"&&(this.shapeFunction=f=>1*Math.pow(4*f*(1-f),1));for(let f=0,o=0,l=0;f<this.pointCount;f+=1,o+=2,l+=6){s.setX(o,f/this.pointCount),s.setX(o+1,f/this.pointCount),i.setX(o,1),i.setX(o+1,-1);const b=this.shape==="none"?1:this.shapeFunction(f/(this.pointCount-1));a.setX(o,b),a.setX(o+1,b);const d=f/(this.pointCount-1);if(m.setXY(o,d,0),m.setXY(o+1,d,1),f<this.pointCount-1){const y=f*2;r.setX(l+0,y+0),r.setX(l+1,y+1),r.setX(l+2,y+2),r.setX(l+3,y+2),r.setX(l+4,y+1),r.setX(l+5,y+3)}}this.setAttribute("position",e),this.setAttribute("previous",t),this.setAttribute("next",n),this.setAttribute("counters",s),this.setAttribute("side",i),this.setAttribute("width",a),this.setAttribute("uv",m),this.setIndex(r)}updateGeometry(){if(!this._points[0])return;const e=this.getAttribute("position"),t=this.getAttribute("previous"),n=this.getAttribute("next");let s=0,i=0,a=0;const m=this._points[0];t.setXYZ(i,m.x,m.y,m.z),i+=1,t.setXYZ(i,m.x,m.y,m.z),i+=1;for(let f=0;f<this.pointCount;f++){const o=this._points[f];e.setXYZ(s,o.x,o.y,o.z),s+=1,e.setXYZ(s,o.x,o.y,o.z),s+=1,f<this.pointCount-1&&(t.setXYZ(i,o.x,o.y,o.z),i+=1,t.setXYZ(i,o.x,o.y,o.z),i+=1),f>0&&f+1<=this.pointCount&&(n.setXYZ(a,o.x,o.y,o.z),a+=1,n.setXYZ(a,o.x,o.y,o.z),a+=1)}const r=this._points[this.pointCount-1];n.setXYZ(a,r.x,r.y,r.z),a+=1,n.setXYZ(a,r.x,r.y,r.z),a+=1,e.needsUpdate=!0,t.needsUpdate=!0,n.needsUpdate=!0,this.computeBoundingSphere(),this.computeBoundingBox()}get points(){return this._points}set points(e){this.setPoints(e)}updatePoints(e,t){const n=this.convertToVector3Array(e);if(n.length!==this.pointCount){console.warn("MeshLineGeometry: Cannot update points with different length. Use setPoints() instead.");return}this._points=n,t&&(this.shapeFunction=t,this.shape="custom",this.initializeGeometry()),this.updateGeometry()}setShape(e,t){this.shape=e,t&&(this.shapeFunction=t),this._points.length>0&&(this.initializeGeometry(),this.updateGeometry())}}function rt(u,e){const t=new c.Matrix4,n=new c.Ray,s=new c.Sphere,i=new c.Vector3,a=this.geometry;if(s.copy(a.boundingSphere),s.applyMatrix4(this.matrixWorld),!u.ray.intersectSphere(s,i))return;t.copy(this.matrixWorld).invert(),n.copy(u.ray).applyMatrix4(t);const m=new c.Vector3,r=new c.Vector3,f=new c.Vector3,o=this instanceof c.LineSegments?2:1,l=a.index,b=a.attributes;if(l!==null){const d=l.array,y=b.position.array,C=b.width.array;for(let A=0,M=d.length-1;A<M;A+=o){const j=d[A],S=d[A+1];m.fromArray(y,j*3),r.fromArray(y,S*3);const V=C[Math.floor(A/3)]!==void 0?C[Math.floor(A/3)]:1,Q=u.params.Line.threshold+this.material.lineWidth*V/2,H=Q*Q;if(n.distanceSqToSegment(m,r,i,f)>H)continue;i.applyMatrix4(this.matrixWorld);const U=u.ray.origin.distanceTo(i);U<u.near||U>u.far||(e.push({distance:U,point:f.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:void 0,object:this}),A=M)}}}const me=u=>{const{setPointWidth:e,nodes:t}=u,n=new Ue;return n.setPoints(t,e),n};let at=class extends P.BaseObject{constructor(e={}){super(),this.options=B({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return se(this,null,function*(){const{nodes:e,nodesArr:t,geometry:n,geometryArr:s,material:i,useGroups:a,setPointWidth:m,lineWidthArr:r,materialParameters:f}=this.options;let o=i,l=n;!o&&f&&(o=this.getMaterial(f)),!l&&e?l=me({nodes:e,setPointWidth:m}):!l&&t?l=D(t.map((b,d)=>{let y=m;return!y&&r&&(y=()=>{var C;return(C=r[d])!=null?C:r[0]}),me({nodes:b,setPointWidth:y})}),a!=null?a:0):!l&&s&&s.length>1?l=D(s,a!=null?a:0):!l&&s&&s.length===1&&([l]=s),this.createMesh(l,o)})}setGeometry(e,t){const n=me({nodes:e,setPointWidth:t}),s=this.object3d,i=s.geometry;s.geometry=n,i.dispose()}getMaterial(e){const{width:t,height:n}=this.pencil.getSize(),s=new P.MeshLineMaterial(B({color:new c.Color("#ffffff")},e));return s.uniforms.resolution.value.set(t,n),s}addGeometries(e){const t=this.object3d,n=D([t.geometry,...e]);t.geometry=n}resize(e,t){var n,s;(s=(n=this.material)==null?void 0:n.uniforms)==null||s.resolution.value.set(e,t)}handleMaterialChange(e){if(e){const{width:t,height:n}=this.pencil.getSize();this.resize(t,n)}}animate({duration:e=1e3,delay:t=0,repeat:n=0,lineLoop:s,onRepeat:i,onUpdate:a,onComplete:m,startShow:r}={}){const{offset:f,offsetLoop:o}=this.material.uniforms;if(this.material.userData.tween)return;const l=s!=null?s:!0;f.value.x=1,o.value=l&&r?1:0;let b=0;const d=new ee.Tween(f.value).to({x:-1},e).delay(t).repeat(n).onUpdate(({x:y})=>{l&&y<=0&&o.value===0&&(o.value=1),a&&a(y)}).onRepeat(()=>{b+=1,i&&i(b)}).onComplete(()=>{m&&m()}).start();this.material.userData.tween=!0,this.material.addEventListener("dispose",()=>{d.stop(),ee.remove(d),this.material.userData.tween=null})}render(){const{width:e,height:t}=this.pencil.getSize();this.resize(e,t)}};const ze=u=>{const{points:e}=u,t=e.reduce((s,i,a)=>(a<e.length-1&&s.push(i,e[a+1]),s),[]);return new c.BufferGeometry().setFromPoints(t)};class ct extends P.BaseObject{constructor(e={}){super(),this.options=B({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return se(this,null,function*(){const{points:e,pointsArr:t,geometry:n,geometryArr:s,material:i,useGroups:a,setPointWidth:m,lineWidthArr:r,materialParameters:f,instanceCount:o}=this.options;let l=i,b=n;!l&&f&&(l=this.getMaterial(f)),!b&&e?b=ze({points:e}):!b&&t?b=D(t.map(y=>ze({points:y})),a!=null?a:0):!b&&s&&s.length>1?b=D(s,a!=null?a:0):!b&&s&&s.length===1&&([b]=s);const d=new Ie.LineSegmentsGeometry().fromLineSegments(new c.LineSegments(b));if(this.pencil.options.WebGPUTHREE){o&&(d.instanceCount=o);const y=new P.LineSegments2(d,l);y.computeLineDistances(),this.object3d=y}else{const y=new Ze.LineSegments2(d,l);y.computeLineDistances(),this.object3d=y}})}getMaterial(e){return new Oe.LineMaterial(B({color:new c.Color("#ffffff")},e))}}class lt extends P.BaseObject{constructor(e){super(),this.objectType="BaseObject#Node",this.onNodePointerIndex=[],this.options=B({type:"2d"},e)}create(){const{position:e,children:t}=this.options,n=document.createElement("div");this.element=n,t&&n.appendChild(t),this.options.type==="3d"?this.createCSS3DObject(n):this.options.type==="3dSprite"?this.createCSS3DSprite(n):this.createCSS2DObject(n),e&&this.object3d.position.copy(e)}setChildren(e){this.options.children=e,this.element.innerHTML="",this.element.appendChild(e)}showAndEnsureVisible(){const e=this.options.children;e&&(e.style.visibility="hidden",this.show(),setTimeout(()=>{e.style.visibility="",this.ensureVisible()}))}moveElementToViewport(){const e=this.options.children;if(!e)return;const t=e.getBoundingClientRect(),n=window.innerWidth,s=window.innerHeight;let i=0,a=0;t.left<0?i=-t.left:t.right>n&&(i=n-t.right),t.top<0?a=-t.top:t.bottom>s&&(a=s-t.bottom),t.left+i<0&&(i=-t.left),t.top+a<0&&(a=-t.top),(i!==0||a!==0)&&(e.style.transform=`translate(${i}px, ${a}px)`)}ensureVisible(){const e=this.options.children;if(!e)return;e.style.transform&&(e.style.transform="");const t=new IntersectionObserver(n=>{n.forEach(s=>{s.isIntersecting&&(this.moveElementToViewport(),t.disconnect())})});t.observe(e)}onPointerEvent(e,t){const n=this.lead.handlePickNode([this],e,t);this.onNodePointerIndex.push(n)}dispose(){this.onNodePointerIndex.forEach(e=>{this.lead.removePickNode(e)}),super.dispose()}}class ht extends P.BaseObject{constructor(e){super(),this.options=B({maxDepth:10,percentDepth:!1,innerRadius:25,outRadius:42,activeIndex:-1},e)}create(){return se(this,null,function*(){this.createGroup();const{data:e,maxDepth:t,colors:n,material:s,percentDepth:i,activeIndex:a}=this.options,m=Math.max(...e),r=e.reduce((o,l)=>o+l,0);let f=Math.PI/2;e.forEach((o,l)=>{if(o===0)return;const b=Math.PI*2*(o/r),d=n[l],y=i?t*(o/m):t,C=this.createGeometry(y,b),A=s?s.clone():new c.MeshBasicMaterial({color:d});s&&A.color.set(d);const M=new c.Mesh(C,A);M.userData.depth=y,M.userData.index=l,M.rotateZ(f),f+=b,this.add(M)}),a!==-1&&this.setActive(a)})}createGeometry(e,t){const{outRadius:n,innerRadius:s}=this.options,i=new c.Shape;return i.moveTo(n,0),i.lineTo(s,0),i.absarc(0,0,s,0,t,!1),i.absarc(0,0,n,t,0,!0),new J(i,{curveSegments:48,depth:e,bevelEnabled:!1})}handlePick(e,t=1.3){const{object:n}=this.pencil.pick(e,this.object3d.children)||{},s=n?this.object3d.children.findIndex(i=>i===n):this.options.activeIndex;return this.setActive(s,t)}setActive(e,t=1.3){const n=this.object3d.children[e];if(this.object3d.children.forEach(s=>{if(!(n&&n===s)&&s.scale.z!==1){if(s.userData.levTween)return;s.userData.enTween&&(s.userData.enTween.stop(),s.userData.enTween=null);const i=new ee.Tween(s.scale).to({z:1},100);s.userData.levTween=i,i.start()}}),n){if(n.userData.enTween)return;n.userData.levTween&&(n.userData.levTween.stop(),n.userData.levTween=null);const s=new ee.Tween(n.scale).to({z:t},100);return n.userData.enTween=s,s.start(),n.userData.index}return-1}render(){this.object3d.scale.z=0,new ee.Tween(this.object3d.scale).to({z:1},1e3).easing(ee.Easing.Sinusoidal.InOut).start()}}Object.defineProperty(exports,"Line2Material",{enumerable:!0,get:()=>Oe.LineMaterial});Object.defineProperty(exports,"LineSegmentsGeometry",{enumerable:!0,get:()=>Ie.LineSegmentsGeometry});exports.MeshLineMaterial=P.MeshLineMaterial;exports.getConicPolygonGeometry=P.PolygonGeometry;exports.getConicPolygonGeometryMetas=P.getMetas;exports.ConicPolygon=Je;exports.ExtrudePolygon=nt;exports.Group=ot;exports.Light=it;exports.Line=at;exports.Line2=ct;exports.MeshLineGeometry=Ue;exports.MeshLineRaycast=rt;exports.Node=lt;exports.Pie=ht;exports.getSplitTexture=st;
1
+ "use strict";var qe=Object.defineProperty,ke=Object.defineProperties;var Fe=Object.getOwnPropertyDescriptors;var ce=Object.getOwnPropertySymbols;var Be=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable;var je=(u,e,t)=>e in u?qe(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t,B=(u,e)=>{for(var t in e||(e={}))Be.call(e,t)&&je(u,t,e[t]);if(ce)for(var t of ce(e))Pe.call(e,t)&&je(u,t,e[t]);return u},le=(u,e)=>ke(u,Fe(e));var me=(u,e)=>{var t={};for(var n in u)Be.call(u,n)&&e.indexOf(n)<0&&(t[n]=u[n]);if(u!=null&&ce)for(var n of ce(u))e.indexOf(n)<0&&Pe.call(u,n)&&(t[n]=u[n]);return t};var se=(u,e,t)=>new Promise((n,s)=>{var o=r=>{try{m(t.next(r))}catch(f){s(f)}},a=r=>{try{m(t.throw(r))}catch(f){s(f)}},m=r=>r.done?n(r.value):Promise.resolve(r.value).then(o,a);m((t=t.apply(u,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ie=require("three/examples/jsm/lines/LineMaterial"),Ue=require("three/examples/jsm/lines/LineSegmentsGeometry"),P=require("../WebGPULineSegments2.js"),c=require("three"),pe=require("three/examples/jsm/utils/BufferGeometryUtils"),Ve=require("../uvGenerator.js"),he=require("three-bvh-csg"),Ye=require("three/examples/jsm/lights/RectAreaLightUniformsLib"),Ze=require("@tweenjs/tween.js"),$e=require("three/examples/jsm/lines/LineSegments2");function Je(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>u[t]})}}return e.default=u,Object.freeze(e)}const ee=Je(Ze);function H(u,e=0){const t=u[0].index!==null,n=new Set(Object.keys(u[0].attributes)),s=new Set(Object.keys(u[0].morphAttributes)),o={},a={},m=u[0].morphTargetsRelative,r=new c.BufferGeometry;let f=0;for(let i=0;i<u.length;++i){const l=u[i];let b=0;if(t!==(l.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in l.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;o[d]===void 0&&(o[d]=[]),o[d].push(l.attributes[d]),b++}if(b!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". Make sure all geometries have the same number of attributes."),null;if(m!==l.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in l.morphAttributes){if(!s.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". .morphAttributes must be consistent throughout all geometries."),null;a[d]===void 0&&(a[d]=[]),a[d].push(l.morphAttributes[d])}if(e){let d;if(t)d=l.index.count;else if(l.attributes.position!==void 0)d=l.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+i+". The geometry must have either an index or a position attribute"),null;if(e===1)r.addGroup(f,d,i);else if(e===2&&l.groups.length>0)for(let y of l.groups){let T=y.materialIndex;r.addGroup(f+y.start,Math.min(y.count,d),T)}f+=d}}if(t){let i=0;const l=[];for(let b=0;b<u.length;++b){const d=u[b].index;for(let y=0;y<d.count;++y)l.push(d.getX(y)+i);i+=u[b].attributes.position.count}r.setIndex(l)}for(const i in o){const l=pe.mergeAttributes(o[i]);if(!l)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+i+" attribute."),null;r.setAttribute(i,l)}for(const i in a){const l=a[i][0].length;if(l===0)break;r.morphAttributes=r.morphAttributes||{},r.morphAttributes[i]=[];for(let b=0;b<l;++b){const d=[];for(let T=0;T<a[i].length;++T)d.push(a[i][T][b]);const y=pe.mergeAttributes(d);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+i+" morphAttribute."),null;r.morphAttributes[i].push(y)}}return e===2?pe.mergeGroups(r):r}const _e=u=>{const m=u,{coordinate:e,startHeight:t,height:n}=m,s=me(m,["coordinate","startHeight","height"]);let o=t||0;return typeof t!="undefined"&&typeof n!="undefined"&&(o=t+n),new P.PolygonGeometry([e],le(B({},s),{startHeight:t,endHeight:o}))};class Qe extends P.BaseObject{constructor(e){super(),this.options=B({},e)}create(){const r=this.options,{geometry:e,coordinateArr:t,coordinate:n,material:s,useGroups:o}=r,a=me(r,["geometry","coordinateArr","coordinate","material","useGroups"]);let m=e;if(!m&&n)m=_e(B({coordinate:n},a));else if(!m&&t){const f=t.map(i=>_e(B({coordinate:i},a)));m=H(f,o!=null?o:0)}this.createMesh(m,s)}}const Ke={ArcCurve:c.ArcCurve,CatmullRomCurve3:c.CatmullRomCurve3,CubicBezierCurve:c.CubicBezierCurve,CubicBezierCurve3:c.CubicBezierCurve3,EllipseCurve:c.EllipseCurve,LineCurve:c.LineCurve,LineCurve3:c.LineCurve3,QuadraticBezierCurve:c.QuadraticBezierCurve,QuadraticBezierCurve3:c.QuadraticBezierCurve3,SplineCurve:c.SplineCurve};class J extends c.BufferGeometry{constructor(e=new c.Shape([new c.Vector2(.5,.5),new c.Vector2(-.5,.5),new c.Vector2(-.5,-.5),new c.Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,s=[],o=[];for(let m=0,r=e.length;m<r;m++){const f=e[m];a(f)}this.setAttribute("position",new c.Float32BufferAttribute(s,3)),this.setAttribute("uv",new c.Float32BufferAttribute(o,2)),this.computeVertexNormals();function a(m){var Se,Ae,Me;const r=[],f=t.curveSegments!==void 0?t.curveSegments:12,i=t.steps!==void 0?t.steps:1,l=t.depth!==void 0?t.depth:1;let b=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:d-.1,T=t.bevelOffset!==void 0?t.bevelOffset:0,A=t.bevelSegments!==void 0?t.bevelSegments:3;const M=t.extrudePath,j=t.UVGenerator!==void 0?t.UVGenerator:et,S=(Se=t.hasTop)!=null?Se:!0,V=(Ae=t.hasBottom)!=null?Ae:!0,Q=(Me=t.hasSide)!=null?Me:!0;let N,Y=!1,U,te,ne,D;M&&(N=M.getSpacedPoints(i),Y=!0,b=!1,U=M.computeFrenetFrames(i,!1),te=new c.Vector3,ne=new c.Vector3,D=new c.Vector3),b||(A=0,d=0,y=0,T=0);const ye=m.extractPoints(f);let I=ye.shape;const _=ye.holes;if(!c.ShapeUtils.isClockWise(I)){I=I.reverse();for(let h=0,p=_.length;h<p;h++){const g=_[h];c.ShapeUtils.isClockWise(g)&&(_[h]=g.reverse())}}function be(h){const g=10000000000000001e-36;let w=h[0];for(let x=1;x<=h.length;x++){const L=x%h.length,v=h[L],C=v.x-w.x,G=v.y-w.y,E=C*C+G*G,z=Math.max(Math.abs(v.x),Math.abs(v.y),Math.abs(w.x),Math.abs(w.y)),$=g*z*z;if(E<=$){h.splice(L,1),x--;continue}w=v}}be(I),_.forEach(be);const fe=_.length,R=I;for(let h=0;h<fe;h++){const p=_[h];I=I.concat(p)}function K(h,p,g){return p||console.error("THREE.ExtrudeGeometry: vec does not exist"),h.clone().addScaledVector(p,g)}const W=I.length;function xe(h,p,g){let w,x,L;const v=h.x-p.x,C=h.y-p.y,G=g.x-h.x,E=g.y-h.y,z=v*v+C*C,$=v*E-C*G;if(Math.abs($)>Number.EPSILON){const O=Math.sqrt(z),Le=Math.sqrt(G*G+E*E),Te=p.x-C/O,Ce=p.y+v/O,We=g.x-E/Le,Xe=g.y+G/Le,Ge=((We-Te)*E-(Xe-Ce)*G)/(v*E-C*G);w=Te+v*Ge-h.x,x=Ce+C*Ge-h.y;const Ee=w*w+x*x;if(Ee<=2)return new c.Vector2(w,x);L=Math.sqrt(Ee/2)}else{let O=!1;v>Number.EPSILON?G>Number.EPSILON&&(O=!0):v<-Number.EPSILON?G<-Number.EPSILON&&(O=!0):Math.sign(C)===Math.sign(E)&&(O=!0),O?(w=-C,x=v,L=Math.sqrt(z)):(w=v,x=C,L=Math.sqrt(z/2))}return new c.Vector2(w/L,x/L)}const ie=[];for(let h=0,p=R.length,g=p-1,w=h+1;h<p;h++,g++,w++)g===p&&(g=0),w===p&&(w=0),ie[h]=xe(R[h],R[g],R[w]);const de=[];let F,oe=ie.concat();for(let h=0,p=fe;h<p;h++){const g=_[h];F=[];for(let w=0,x=g.length,L=x-1,v=w+1;w<x;w++,L++,v++)L===x&&(L=0),v===x&&(v=0),F[w]=xe(g[w],g[L],g[v]);de.push(F),oe=oe.concat(F)}let Z;if(A===0)Z=c.ShapeUtils.triangulateShape(R,_);else{const h=[],p=[];for(let g=0;g<A;g++){const w=g/A,x=d*Math.cos(w*Math.PI/2),L=y*Math.sin(w*Math.PI/2)+T;for(let v=0,C=R.length;v<C;v++){const G=K(R[v],ie[v],L);X(G.x,G.y,-x),w===0&&h.push(G)}for(let v=0,C=fe;v<C;v++){const G=_[v];F=de[v];const E=[];for(let z=0,$=G.length;z<$;z++){const O=K(G[z],F[z],L);X(O.x,O.y,-x),w===0&&E.push(O)}w===0&&p.push(E)}}Z=c.ShapeUtils.triangulateShape(h,p)}const re=Z.length,we=y+T;for(let h=0;h<W;h++){const p=b?K(I[h],oe[h],we):I[h];Y?(ne.copy(U.normals[0]).multiplyScalar(p.x),te.copy(U.binormals[0]).multiplyScalar(p.y),D.copy(N[0]).add(ne).add(te),X(D.x,D.y,D.z)):X(p.x,p.y,0)}for(let h=1;h<=i;h++)for(let p=0;p<W;p++){const g=b?K(I[p],oe[p],we):I[p];Y?(ne.copy(U.normals[h]).multiplyScalar(g.x),te.copy(U.binormals[h]).multiplyScalar(g.y),D.copy(N[h]).add(ne).add(te),X(D.x,D.y,D.z)):X(g.x,g.y,l/i*h)}for(let h=A-1;h>=0;h--){const p=h/A,g=d*Math.cos(p*Math.PI/2),w=y*Math.sin(p*Math.PI/2)+T;for(let x=0,L=R.length;x<L;x++){const v=K(R[x],ie[x],w);X(v.x,v.y,l+g)}for(let x=0,L=_.length;x<L;x++){const v=_[x];F=de[x];for(let C=0,G=v.length;C<G;C++){const E=K(v[C],F[C],w);Y?X(E.x,E.y+N[i-1].y,N[i-1].x+g):X(E.x,E.y,l+g)}}}He(),Q&&Ne();function He(){const h=s.length/3;if(b){let p=0,g=W*p;if(V)for(let w=0;w<re;w++){const x=Z[w];ae(x[2]+g,x[1]+g,x[0]+g)}if(p=i+A*2,g=W*p,S)for(let w=0;w<re;w++){const x=Z[w];ae(x[0]+g,x[1]+g,x[2]+g)}}else{if(V)for(let p=0;p<re;p++){const g=Z[p];ae(g[2],g[1],g[0])}if(S)for(let p=0;p<re;p++){const g=Z[p];ae(g[0]+W*i,g[1]+W*i,g[2]+W*i)}}n.addGroup(h,s.length/3-h,0)}function Ne(){const h=s.length/3;let p=0;ve(R,p),p+=R.length;for(let g=0,w=_.length;g<w;g++){const x=_[g];ve(x,p),p+=x.length}n.addGroup(h,s.length/3-h,1)}function ve(h,p){let g=h.length;for(;--g>=0;){const w=g;let x=g-1;x<0&&(x=h.length-1);for(let L=0,v=i+A*2;L<v;L++){const C=W*L,G=W*(L+1),E=p+w+C,z=p+x+C,$=p+x+G,O=p+w+G;De(E,z,$,O)}}}function X(h,p,g){r.push(h),r.push(p),r.push(g)}function ae(h,p,g){q(h),q(p),q(g);const w=s.length/3,x=j.generateTopUV(n,s,w-3,w-2,w-1);k(x[0]),k(x[1]),k(x[2])}function De(h,p,g,w){q(h),q(p),q(w),q(p),q(g),q(w);const x=s.length/3,L=j.generateSideWallUV(n,s,x-6,x-3,x-2,x-1);k(L[0]),k(L[1]),k(L[3]),k(L[1]),k(L[2]),k(L[3])}function q(h){s.push(r[h*3+0]),s.push(r[h*3+1]),s.push(r[h*3+2])}function k(h){o.push(h.x),o.push(h.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return tt(t,n,e)}static fromJSON(e,t){const n=[];for(let o=0,a=e.shapes.length;o<a;o++){const m=t[e.shapes[o]];n.push(m)}const s=e.options.extrudePath;return s!==void 0&&(e.options.extrudePath=new Ke[`${s.type}`]().fromJSON(s)),new J(n,e.options)}}const et={generateTopUV:function(u,e,t,n,s){const o=e[t*3],a=e[t*3+1],m=e[n*3],r=e[n*3+1],f=e[s*3],i=e[s*3+1];return[new c.Vector2(o,a),new c.Vector2(m,r),new c.Vector2(f,i)]},generateSideWallUV:function(u,e,t,n,s,o){const a=e[t*3],m=e[t*3+1],r=e[t*3+2],f=e[n*3],i=e[n*3+1],l=e[n*3+2],b=e[s*3],d=e[s*3+1],y=e[s*3+2],T=e[o*3],A=e[o*3+1],M=e[o*3+2];return Math.abs(m-i)<Math.abs(a-f)?[new c.Vector2(a,1-r),new c.Vector2(f,1-l),new c.Vector2(b,1-y),new c.Vector2(T,1-M)]:[new c.Vector2(m,1-r),new c.Vector2(i,1-l),new c.Vector2(d,1-y),new c.Vector2(A,1-M)]}};function tt(u,e,t){if(t.shapes=[],Array.isArray(u))for(let n=0,s=u.length;n<s;n++){const o=u[n];t.shapes.push(o.uuid)}else t.shapes.push(u.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class nt extends J{constructor(e,t){super(e,t);const n=new he.Brush(new J(e,le(B({},t),{hasTop:!0,hasSide:!0,hasBottom:!1})));n.updateMatrixWorld();const s=new c.Box3().setFromObject(n),o=new c.Vector3;s.getSize(o);const a=new c.Vector3(s.min.x+o.x/2,s.min.y+o.y/2,0);let m=t.topSegments,r=t.box3;if(r){r=r.union(s);const M=new c.Vector3;r.getSize(M);const j=Math.max(o.x/M.x,o.y/M.y);m=Math.ceil(t.topSegments*j)}if(m<4)return this;const f=new c.PlaneGeometry(o.x,o.y,m,m),i=new he.Brush(f);i.position.set(a.x,a.y,a.z),i.updateMatrixWorld();const b=new he.Evaluator().evaluate(i,n,he.INTERSECTION),d=b.geometry.getAttribute("position"),y=new c.Float32BufferAttribute(d.count*2,2);for(let M=0;M<d.count;M++){const j=d.getZ(M);d.setZ(M,t.depth+j)}if(r){const M=r.min,j=r.max,S=new c.Vector3().subVectors(j,M);for(let V=0;V<d.count;V++){const Q=d.getX(V),N=d.getY(V),Y=(Q-M.x)/S.x,U=(N-M.y)/S.y;y.setXY(V,Y,U)}b.geometry.setAttribute("uv",y)}d.needsUpdate=!0;const T=new J(e,le(B({},t),{hasTop:!1})),A=H([b.geometry,T],2);this.copy(A.toNonIndexed())}}const ze=u=>{const{split:e,depth:t,points:n,box3:s,hasTop:o,hasBottom:a,hasSide:m,sideRepeat:r,topSegments:f}=u,i=f?nt:J,l=new i(new c.Shape(n),{depth:t,bevelEnabled:!1,box3:s,UVGenerator:Ve.getUVGenerator({split:e,box3:s,sideRepeat:r}),hasTop:o,hasBottom:a,hasSide:m,topSegments:f});return Ve.claerUVGenerator(),l};class st extends P.BaseObject{constructor(e){super(),this.options=B({depth:1},e)}create(){return se(this,null,function*(){const{points:e,pointsArr:t,useGroups:n,depth:s,geometry:o,geometryArr:a,material:m,box3:r,split:f,hasTop:i,hasBottom:l,hasSide:b}=this.options,d=Array.isArray(s)?s:[s],y=Array.isArray(r)?r:[r],T=m;let A=o;T||console.log("material is null"),!A&&e?A=ze({points:e,depth:d[0],box3:y[0],split:f,hasTop:i,hasBottom:l,hasSide:b}):!A&&t?A=H(t.map((M,j)=>{var S,V;return ze({points:M,depth:(S=d[j])!=null?S:d[0],box3:(V=y[j])!=null?V:y[0],split:f,hasTop:i,hasBottom:l,hasSide:b})}),n!=null?n:0):!A&&a&&a.length>1?A=H(a,n!=null?n:0):!A&&a&&a.length===1&&([A]=a),this.createMesh(A,T)})}addGeometries(e){const t=this.object3d,n=H([t.geometry,...e]);t.geometry=n}setTextureAnisotropic(e,t){e.anisotropy=t||this.pencil.renderer.capabilities.getMaxAnisotropy()}}const it=u=>{const{topColor:e,sideColor:t,sideMap:n,createCanvasObjectURL:s,split:o,maxAnisotropy:a}=u;return new Promise(m=>{const r=n?document.createElement("img"):{src:"",onload:()=>{},width:128,height:128};r.onload=()=>{const f=o,i=document.createElement("canvas"),l=i.getContext("2d");i.height=r.height/(1-f),i.width=r.width,f&&e&&(l.fillStyle=e,l.fillRect(0,0,r.width,i.height*f)),n&&r instanceof HTMLImageElement?l.drawImage(r,0,i.height*f,r.width,r.height):t&&(l.fillStyle=t,l.fillRect(0,i.height*f,r.width,r.height)),s&&i.toBlob(d=>{console.log(URL.createObjectURL(d))});const b=new c.CanvasTexture(i);m(b)},n?r.src=n:r instanceof HTMLImageElement||r.onload()})};class ot extends P.BaseObject{create(){this.createGroup()}}class rt extends P.BaseObject{constructor(e){super(),this.rectAreaLightUniformsLibInit=!1,this.options=e}create(){var t,n,s,o,a,m,r,f,i,l,b,d,y,T,A,M,j;const e=this.options;if(e.type==="AmbientLight"){const S=new c.AmbientLight(e.color);S.name="环境光",this.object3d=S}else if(e.type==="DirectionalLight"){const S=new c.DirectionalLight(e.color,e.intensity);S.name="平行光",S.target.position.set(0,0,0),this.object3d=S,S.target.name="平行光目标",S.shadow.camera.name="平行光阴影相机",S.shadow.camera.userData.directionalLightShadow=!0,this.directionalLight=S}else if(e.type==="PointLight"){const S=new c.PointLight((t=e.color)!=null?t:16777215,(n=e.intensity)!=null?n:1,(s=e.distance)!=null?s:0,(o=e.decay)!=null?o:2);S.name="点光源",this.object3d=S,this.pointLight=S}else if(e.type==="SpotLight"){const S=new c.SpotLight((a=e.color)!=null?a:16777215,(m=e.intensity)!=null?m:1,(r=e.distance)!=null?r:0,(f=e.angle)!=null?f:Math.PI/3,(i=e.penumbra)!=null?i:1,(l=e.decay)!=null?l:2);S.name="聚光灯",this.object3d=S,this.spotLight=S,S.target.name="聚光灯目标"}else if(e.type==="HemisphereLight"){const S=new c.HemisphereLight((b=e.color)!=null?b:16777215,(d=e.groundColor)!=null?d:16777215,(y=e.intensity)!=null?y:1);S.name="半球光",this.object3d=S,this.hemisphereLight=S}else if(e.type==="RectAreaLight"){this.rectAreaLightUniformsLibInit||(Ye.RectAreaLightUniformsLib.init(),this.rectAreaLightUniformsLibInit=!0);const S=new c.RectAreaLight((T=e.color)!=null?T:16777215,(A=e.intensity)!=null?A:1,(M=e.width)!=null?M:10,(j=e.height)!=null?j:10);S.name="矩形区域光",this.object3d=S,this.rectAreaLight=S}}render(){const e=this.object3d;e.target&&this.pencil.scene.add(e.target);const t=this.pencil.cameraTarget;if(this.spotLight||this.directionalLight){const n=this.spotLight||this.directionalLight;n.position.copy(t),n.target.position.copy(t)}else this.pointLight&&this.pointLight.position.copy(t)}dispose(){const e=this.object3d;e.target&&this.pencil.scene.remove(e.target),super.dispose()}}class Re extends c.BufferGeometry{constructor(e=[],t="none",n){super(),this.type="MeshLineGeometry",this.pointCount=0,this._points=[],this.shape="none",this.shapeFunction=s=>1,this.matrixWorld=new c.Matrix4,this.shape=t,n&&(this.shapeFunction=n),e.length>0&&this.setPoints(e)}convertToVector3Array(e){if(typeof e[0]=="number"){const t=[],n=e;for(let s=0;s<n.length;s+=3)t.push(new c.Vector3(n[s],n[s+1],n[s+2]));return t}else return e.map(t=>{if(t instanceof c.Vector2)return new c.Vector3(t.x,t.y,0);if(t instanceof c.Vector3)return t;if(Array.isArray(t)&&t.length===2)return new c.Vector3(t[0],t[1],0);if(Array.isArray(t)&&t.length===3)return new c.Vector3(t[0],t[1],t[2])}).filter(Boolean)}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){!e||e.length===0||(this._points=this.convertToVector3Array(e),this.pointCount=this._points.length,t&&(this.shapeFunction=t,this.shape="custom"),this.initializeGeometry(),this.updateGeometry())}initializeGeometry(){const e=new c.BufferAttribute(new Float32Array(this.pointCount*6),3),t=new c.BufferAttribute(new Float32Array(this.pointCount*6),3),n=new c.BufferAttribute(new Float32Array(this.pointCount*6),3),s=new c.BufferAttribute(new Float32Array(this.pointCount*2),1),o=new c.BufferAttribute(new Float32Array(this.pointCount*2),1),a=new c.BufferAttribute(new Float32Array(this.pointCount*2),1),m=new c.BufferAttribute(new Float32Array(this.pointCount*4),2),r=new c.BufferAttribute(new Uint16Array((this.pointCount-1)*6),1);this.shape==="taper"&&(this.shapeFunction=f=>1*Math.pow(4*f*(1-f),1));for(let f=0,i=0,l=0;f<this.pointCount;f+=1,i+=2,l+=6){s.setX(i,f/this.pointCount),s.setX(i+1,f/this.pointCount),o.setX(i,1),o.setX(i+1,-1);const b=this.shape==="none"?1:this.shapeFunction(f/(this.pointCount-1));a.setX(i,b),a.setX(i+1,b);const d=f/(this.pointCount-1);if(m.setXY(i,d,0),m.setXY(i+1,d,1),f<this.pointCount-1){const y=f*2;r.setX(l+0,y+0),r.setX(l+1,y+1),r.setX(l+2,y+2),r.setX(l+3,y+2),r.setX(l+4,y+1),r.setX(l+5,y+3)}}this.setAttribute("position",e),this.setAttribute("previous",t),this.setAttribute("next",n),this.setAttribute("counters",s),this.setAttribute("side",o),this.setAttribute("width",a),this.setAttribute("uv",m),this.setIndex(r)}updateGeometry(){if(!this._points[0])return;const e=this.getAttribute("position"),t=this.getAttribute("previous"),n=this.getAttribute("next");let s=0,o=0,a=0;const m=this._points[0];t.setXYZ(o,m.x,m.y,m.z),o+=1,t.setXYZ(o,m.x,m.y,m.z),o+=1;for(let f=0;f<this.pointCount;f++){const i=this._points[f];e.setXYZ(s,i.x,i.y,i.z),s+=1,e.setXYZ(s,i.x,i.y,i.z),s+=1,f<this.pointCount-1&&(t.setXYZ(o,i.x,i.y,i.z),o+=1,t.setXYZ(o,i.x,i.y,i.z),o+=1),f>0&&f+1<=this.pointCount&&(n.setXYZ(a,i.x,i.y,i.z),a+=1,n.setXYZ(a,i.x,i.y,i.z),a+=1)}const r=this._points[this.pointCount-1];n.setXYZ(a,r.x,r.y,r.z),a+=1,n.setXYZ(a,r.x,r.y,r.z),a+=1,e.needsUpdate=!0,t.needsUpdate=!0,n.needsUpdate=!0,this.computeBoundingSphere(),this.computeBoundingBox()}get points(){return this._points}set points(e){this.setPoints(e)}updatePoints(e,t){const n=this.convertToVector3Array(e);if(n.length!==this.pointCount){console.warn("MeshLineGeometry: Cannot update points with different length. Use setPoints() instead.");return}this._points=n,t&&(this.shapeFunction=t,this.shape="custom",this.initializeGeometry()),this.updateGeometry()}setShape(e,t){this.shape=e,t&&(this.shapeFunction=t),this._points.length>0&&(this.initializeGeometry(),this.updateGeometry())}}function at(u,e){const t=new c.Matrix4,n=new c.Ray,s=new c.Sphere,o=new c.Vector3,a=this.geometry;if(s.copy(a.boundingSphere),s.applyMatrix4(this.matrixWorld),!u.ray.intersectSphere(s,o))return;t.copy(this.matrixWorld).invert(),n.copy(u.ray).applyMatrix4(t);const m=new c.Vector3,r=new c.Vector3,f=new c.Vector3,i=this instanceof c.LineSegments?2:1,l=a.index,b=a.attributes;if(l!==null){const d=l.array,y=b.position.array,T=b.width.array;for(let A=0,M=d.length-1;A<M;A+=i){const j=d[A],S=d[A+1];m.fromArray(y,j*3),r.fromArray(y,S*3);const V=T[Math.floor(A/3)]!==void 0?T[Math.floor(A/3)]:1,Q=u.params.Line.threshold+this.material.lineWidth*V/2,N=Q*Q;if(n.distanceSqToSegment(m,r,o,f)>N)continue;o.applyMatrix4(this.matrixWorld);const U=u.ray.origin.distanceTo(o);U<u.near||U>u.far||(e.push({distance:U,point:f.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:void 0,object:this}),A=M)}}}const ge=u=>{const{setPointWidth:e,nodes:t}=u,n=new Re;return n.setPoints(t,e),n},ue=new WeakMap;let ct=class extends P.BaseObject{constructor(e={}){super(),this.options=B({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return se(this,null,function*(){const{nodes:e,nodesArr:t,geometry:n,geometryArr:s,material:o,useGroups:a,setPointWidth:m,lineWidthArr:r,materialParameters:f}=this.options;let i=o,l=n;!i&&f&&(i=this.getMaterial(f)),!l&&e?l=ge({nodes:e,setPointWidth:m}):!l&&t?l=H(t.map((b,d)=>{let y=m;return!y&&r&&(y=()=>{var T;return(T=r[d])!=null?T:r[0]}),ge({nodes:b,setPointWidth:y})}),a!=null?a:0):!l&&s&&s.length>1?l=H(s,a!=null?a:0):!l&&s&&s.length===1&&([l]=s),this.createMesh(l,i)})}setGeometry(e,t){const n=ge({nodes:e,setPointWidth:t}),s=this.object3d,o=s.geometry;s.geometry=n,o.dispose()}getMaterial(e){const{width:t,height:n}=this.pencil.getSize(),s=new P.MeshLineMaterial(B({color:new c.Color("#ffffff")},e));return s.uniforms.resolution.value.set(t,n),s}addGeometries(e){const t=this.object3d,n=H([t.geometry,...e]);t.geometry=n}resize(e,t){var n,s;(s=(n=this.material)==null?void 0:n.uniforms)==null||s.resolution.value.set(e,t)}handleMaterialChange(e){if(e){const{width:t,height:n}=this.pencil.getSize();this.resize(t,n)}}animate({duration:e=1e3,delay:t=0,repeat:n=0,lineLoop:s,onRepeat:o,onUpdate:a,onComplete:m,startShow:r}={}){const{offset:f,offsetLoop:i}=this.material.uniforms;if(ue.get(this.material)&&this.stopAnimation(),e===0)return;const l=s!=null?s:!0;f.value.x=1,i.value=l&&r?1:0;let b=0;const d=new ee.Tween(f.value).to({x:-1},e).delay(t).repeat(n).onUpdate(({x:y})=>{l&&y<=0&&i.value===0&&(i.value=1),a==null||a(y)}).onRepeat(()=>{b+=1,o==null||o(b)}).onComplete(()=>{m==null||m()}).start();ue.set(this.material,d),this.material.addEventListener("dispose",()=>{this.stopAnimation()})}stopAnimation(){const e=ue.get(this.material);e&&(e.stop(),ee.remove(e),ue.delete(this.material),this.material.uniforms.offset.value.x=0,this.material.uniforms.offsetLoop.value=1)}render(){const{width:e,height:t}=this.pencil.getSize();this.resize(e,t)}};const Oe=u=>{const{points:e}=u,t=e.reduce((s,o,a)=>(a<e.length-1&&s.push(o,e[a+1]),s),[]);return new c.BufferGeometry().setFromPoints(t)};class lt extends P.BaseObject{constructor(e={}){super(),this.options=B({},e)}get material(){var e;return(e=this.object3d)==null?void 0:e.material}create(){return se(this,null,function*(){const{points:e,pointsArr:t,geometry:n,geometryArr:s,material:o,useGroups:a,setPointWidth:m,lineWidthArr:r,materialParameters:f,instanceCount:i}=this.options;let l=o,b=n;!l&&f&&(l=this.getMaterial(f)),!b&&e?b=Oe({points:e}):!b&&t?b=H(t.map(y=>Oe({points:y})),a!=null?a:0):!b&&s&&s.length>1?b=H(s,a!=null?a:0):!b&&s&&s.length===1&&([b]=s);const d=new Ue.LineSegmentsGeometry().fromLineSegments(new c.LineSegments(b));if(this.pencil.options.WebGPUTHREE){i&&(d.instanceCount=i);const y=new P.LineSegments2(d,l);y.computeLineDistances(),this.object3d=y}else{const y=new $e.LineSegments2(d,l);y.computeLineDistances(),this.object3d=y}})}getMaterial(e){return new Ie.LineMaterial(B({color:new c.Color("#ffffff")},e))}}class ht extends P.BaseObject{constructor(e){super(),this.objectType="BaseObject#Node",this.onNodePointerIndex=[],this.options=B({type:"2d"},e)}create(){const{position:e,children:t}=this.options,n=document.createElement("div");this.element=n,t&&n.appendChild(t),this.options.type==="3d"?this.createCSS3DObject(n):this.options.type==="3dSprite"?this.createCSS3DSprite(n):this.createCSS2DObject(n),e&&this.object3d.position.copy(e)}setChildren(e){this.options.children=e,this.element.innerHTML="",this.element.appendChild(e)}showAndEnsureVisible(){const e=this.options.children;e&&(e.style.visibility="hidden",this.show(),setTimeout(()=>{e.style.visibility="",this.ensureVisible()}))}moveElementToViewport(){const e=this.options.children;if(!e)return;const t=e.getBoundingClientRect(),n=window.innerWidth,s=window.innerHeight;let o=0,a=0;t.left<0?o=-t.left:t.right>n&&(o=n-t.right),t.top<0?a=-t.top:t.bottom>s&&(a=s-t.bottom),t.left+o<0&&(o=-t.left),t.top+a<0&&(a=-t.top),(o!==0||a!==0)&&(e.style.transform=`translate(${o}px, ${a}px)`)}ensureVisible(){const e=this.options.children;if(!e)return;e.style.transform&&(e.style.transform="");const t=new IntersectionObserver(n=>{n.forEach(s=>{s.isIntersecting&&(this.moveElementToViewport(),t.disconnect())})});t.observe(e)}onPointerEvent(e,t){const n=this.lead.handlePickNode([this],e,t);this.onNodePointerIndex.push(n)}dispose(){this.onNodePointerIndex.forEach(e=>{this.lead.removePickNode(e)}),super.dispose()}}class ut extends P.BaseObject{constructor(e){super(),this.options=B({maxDepth:10,percentDepth:!1,innerRadius:25,outRadius:42,activeIndex:-1},e)}create(){return se(this,null,function*(){this.createGroup();const{data:e,maxDepth:t,colors:n,material:s,percentDepth:o,activeIndex:a}=this.options,m=Math.max(...e),r=e.reduce((i,l)=>i+l,0);let f=Math.PI/2;e.forEach((i,l)=>{if(i===0)return;const b=Math.PI*2*(i/r),d=n[l],y=o?t*(i/m):t,T=this.createGeometry(y,b),A=s?s.clone():new c.MeshBasicMaterial({color:d});s&&A.color.set(d);const M=new c.Mesh(T,A);M.userData.depth=y,M.userData.index=l,M.rotateZ(f),f+=b,this.add(M)}),a!==-1&&this.setActive(a)})}createGeometry(e,t){const{outRadius:n,innerRadius:s}=this.options,o=new c.Shape;return o.moveTo(n,0),o.lineTo(s,0),o.absarc(0,0,s,0,t,!1),o.absarc(0,0,n,t,0,!0),new J(o,{curveSegments:48,depth:e,bevelEnabled:!1})}handlePick(e,t=1.3){const{object:n}=this.pencil.pick(e,this.object3d.children)||{},s=n?this.object3d.children.findIndex(o=>o===n):this.options.activeIndex;return this.setActive(s,t)}setActive(e,t=1.3){const n=this.object3d.children[e];if(this.object3d.children.forEach(s=>{if(!(n&&n===s)&&s.scale.z!==1){if(s.userData.levTween)return;s.userData.enTween&&(s.userData.enTween.stop(),s.userData.enTween=null);const o=new ee.Tween(s.scale).to({z:1},100);s.userData.levTween=o,o.start()}}),n){if(n.userData.enTween)return;n.userData.levTween&&(n.userData.levTween.stop(),n.userData.levTween=null);const s=new ee.Tween(n.scale).to({z:t},100);return n.userData.enTween=s,s.start(),n.userData.index}return-1}render(){this.object3d.scale.z=0,new ee.Tween(this.object3d.scale).to({z:1},1e3).easing(ee.Easing.Sinusoidal.InOut).start()}}Object.defineProperty(exports,"Line2Material",{enumerable:!0,get:()=>Ie.LineMaterial});Object.defineProperty(exports,"LineSegmentsGeometry",{enumerable:!0,get:()=>Ue.LineSegmentsGeometry});exports.MeshLineMaterial=P.MeshLineMaterial;exports.getConicPolygonGeometry=P.PolygonGeometry;exports.getConicPolygonGeometryMetas=P.getMetas;exports.ConicPolygon=Qe;exports.ExtrudePolygon=st;exports.Group=ot;exports.Light=rt;exports.Line=ct;exports.Line2=lt;exports.MeshLineGeometry=Re;exports.MeshLineRaycast=at;exports.Node=ht;exports.Pie=ut;exports.getSplitTexture=it;