@splinetool/loader 0.9.87 → 0.9.88

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.
@@ -1327,4 +1327,4 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
1327
1327
  return color.xyz;
1328
1328
 
1329
1329
  }`,[ot.simplex,e,o,s])}}();import{Matrix3 as _w}from"three";function yf(n,t,e){n.setUvTransform(e[0],e[1],t[0],t[1],0,0,0)}var xa=class extends bn{constructor(e,r){super(new _w);this.repeat=e;this.offset=r;yf(this.value,e,r)}updateMatrix(){yf(this.value,this.repeat,this.offset)}};var pr=class{constructor(t,e,r,o){this.id=t;this.uuid=e;this.data=r;this.uniforms={};for(let i in o)this.uniforms[`f${this.id}_${i}`]=o[i];for(let i in r)dc(i,this,r)}get type(){return this.data.type}static create(t,e,r,o){if(r.type==="light")return dr.createLigherLayer(t,e,r,o);if(r.type==="texture"){let i=o.image(r.texture.image),s=new Ai(i,r.texture.wrapping),l=new ya(i),c=new xa(r.texture.repeat,r.texture.offset),p=new Y(r.crop?1:0),a=new ge(r.projection??0),u=new ge(["x","y","z"].indexOf(r.axis)??0),d=new ge(r.side??0),m=new Ke(r.size?new uo(r.size[0],r.size[1]):new uo(100,100)),f=new Y(r.alpha??1),h=new ge(r.mode??0),g=new gi(s,l,p,a,u,d,m,c,f,h),x=new ve(g.calpha,"f");return new We(t,e,r,{texture:s,textureSize:l,crop:p,projection:a,axis:u,side:d,size:m,mat:c,alpha:f,mode:h},g,h,x)}else if(r.type==="matcap"){let i=o.image(r.texture.image),s=new Ai(i,r.texture.wrapping),l=new Y(r.alpha??1),c=new ge(r.mode??0),p=new Ti(s,l,c),a=new ve(p.calpha,"f");return new We(t,e,r,{texture:s,alpha:l,mode:c},p,c,a)}else if(r.type==="displace")if(r.displacementType==="noise"){let i=new Ze(new ur(...r.offset)),s=new Y(r.scale??10),l=new Y(r.intensity??8),c=new Y(r.movement??1),p=new ge(r.noiseType??0),a=new fi(l,c,i,s,p);return new Ni(t,e,r,{offset:i,scale:s,intensity:l,movement:c,noiseType:p},a)}else throw new Error;else return ww(t,e,r,o)}updateByOp(t,e,r){let o=t;if(o.path[0]===void 0){if(o.type===0)return"type"in o.props||"category"in o.props?!0:gf(o.props,r,this,e)}else if(o.path[0]==="texture")return"texture"in e?pc(o.props,r,this):!0;return!1}dispose(){}hasValueByKey(t){return this.uniforms[t]!==void 0}hasValue(t){return this.hasValueByKey(`f${this.id}_${t}`)}setValue(t,e){let r=`f${this.id}_${t}`;this.hasValueByKey(r)&&e!==void 0&&(this.uniforms[r].value=e)}getNode(t){let e=`f${this.id}_${t}`;if(this.hasValueByKey(e))return this.uniforms[e]}getValue(t){let e=`f${this.id}_${t}`;if(this.hasValueByKey(e))return this.uniforms[e].value}getName(t){let r=/f\d+_(.*)/.exec(t);if(r&&r.length>1)return r[1];console.log(`Layer.getName: error ${t}`)}getNames(){let t=[];for(let e in this.uniforms){let r=this.getName(e);r&&t.push(r)}return t}},We=class extends pr{constructor(e,r,o,i,s,l,c){super(e,r,o,i);this.color=s;this.mode=l;this.alpha=c}},Ni=class extends pr{constructor(e,r,o,i,s){super(e,r,o,i);this.position=s}},dr=class extends pr{constructor(e,r,o,i,s){super(e,r,o,s);this.data=o;this.node=i}static createLigherLayer(e,r,o,i){let s,l=new Y(o.alpha),c=new ge(o.mode),p;if(o.category==="lambert"){s=new vi;let a=new Se(i.color(o.emissive)??0);p={emissive:a},s.emissive=a}else if(o.category==="phong"){s=new ga;let a=new Y(o.shininess??30),u=new Se(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}else if(o.category==="toon"){s=new _i;let a=new Y(o.shininess??30),u=new Se(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}else if(o.category==="physical"){s=new bi;let a=new Y(o.roughness??.3),u=new Y(o.metalness??0),d=new Y(o.reflectivity??.5);p={roughness:a,metalness:u,reflectivity:d},s.roughness=a,s.metalness=u,s.reflectivity=d}else s=new so,p={};return s.alpha=new Y(1),s.shadingAlpha=l,s.shadingBlend=c,p.alpha=s.shadingAlpha,p.mode=s.shadingBlend,new dr(e,r,o,s,p)}};function xf(n){let t=n instanceof pr?n.type:n;return t==="texture"||t==="displace_map"||t==="matcap"}function Sw(n,t,e,r){switch(n.type){case"color":{let o=new Se(r.color??5855577),i=new Y(r.alpha??1),s=new ve("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ge(r.mode??0);return o.alpha=i,new We(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}case"fresnel":{let o=new Se(r.color??16777215),i=new Y(r.bias??.1),s=new Y(r.scale??1),l=new Y(r.intensity??2),c=new Y(r.factor??1),p=new Y(r.alpha??1),a=new ge(r.mode??0),u=new li(o,i,s,l,c,p,a),d=new ve(u.calpha,"f");return new We(t,e,n,{color:o,bias:i,scale:s,intensity:l,factor:c,alpha:p,mode:a},u,a,d)}case"rainbow":{let o=new Y(r.filmThickness??30),i=new Y(r.movement??0),s=new Ze(r.wavelengths??new ur(0,0,0)),l=new Y(r.noiseStrength??0),c=new Y(r.noiseScale??1),p=new Ze(r.offset??new ur(0,0,0)),a=new Y(r.alpha??1),u=new ci(o,i,s,l,c,p,a),d=new ve(u.calpha,"f"),m=new ge(r.mode??0);return new We(t,e,n,{filmThickness:o,movement:i,wavelengths:s,noiseStrength:l,noiseScale:c,offset:p,alpha:a,mode:m},u,m,d)}case"transmission":{let o=new Y(r.thickness??10),i=new Y(r.ior??1.5),s=new Y(r.roughness??.5),l=Je.transmissionSize,c=Je.transmissionRenderTarget,p=Je.transmissionRenderTargetDepth,a=window.innerWidth,u=window.innerHeight,d=a>=u?new Ke(u/a,1):new Ke(1,a/u),m=new Y(r.alpha??1),f=new pi(o,i,s,l,c,p,d,m),h=new ve(f.calpha,"f"),g=new ge(r.mode??0);return new We(t,e,n,{thickness:o,ior:i,roughness:s,aspectRatio:d,alpha:m,mode:g},f,g,h)}case"toon":{let o=new ge(r.positioning??0),i;r.colors?i=new Vt(r.colors.length,r.colors):(i=new Vt(10,new Tn(0,0,0,1)),i.value[1]=new Tn(1,1,1,1));let s;r.steps?s=new Ft(r.steps.length,r.steps):(s=new Ft(10,1),s.value[0]=0);let l=new Ze(r.source??new ur(0,0,0)),c=new qr(r.isWorldSpace??!0),p=new Y(r.noiseStrength??0),a=new Y(r.noiseScale??1),u=new Lt(r.shadowColor),d=new Ze(r.offset??new ur(0,0,0)),m=new Y(r.alpha??1),f=new Ci(o,i,s,l,c,p,a,u,d,m),h=new ve(f.calpha,"f"),g=new ge(r.mode??0);return new We(t,e,n,{positioning:o,colors:i,steps:s,source:l,isWorldSpace:c,noiseStrength:p,noiseScale:a,shadowColor:u,offset:d,alpha:m,mode:g},f,g,h)}case"outline":{let o=new Se(r.outlineColor??16777215),i=new Se(r.contourColor??16777215),s=new Y(r.outlineWidth??.1),l=new Y(r.contourWidth??.1),c=new Y(r.outlineThreshold??.1),p=new Y(r.contourThreshold??.1),a=new Y(r.outlineSmoothing??.1),u=new Y(r.contourFrequency??.1),d=new Ze(r.contourDirections??new ur(0,1,0)),m=new qr(r.positionalLines??!1),f=new qr(r.compensation??!0),h=Je.normalRenderTarget,g=Je.normalRenderTargetDepth,x=Je.pixelRatioNode,v=Je.resolution,A=new Y(r.alpha??1),_=new ui(o,i,s,l,c,p,a,u,d,m,f,v,h,g,x,A),b=new ve(_.calpha,"f"),D=new ge(r.mode??0);return new We(t,e,n,{outlineColor:o,contourColor:i,outlineWidth:s,contourWidth:l,outlineThreshold:c,contourThreshold:p,outlineSmoothing:a,contourFrequency:u,contourDirection:d,positionalLines:m,compensation:f,alpha:A,mode:D},_,D,b)}case"depth":{let o=new ge(r.gradientType??0),i=new qr(r.smooth??!1),s=new Y(r.near??50),l=new Y(r.far??200),c=new Y(r.isVector??1),p=new Y(r.isWorldSpace??0),a=new Ze(r.origin??new ur),u=new Ze(r.direction??new ur),d=new ge(r.num??0),m;r.colors?m=new Vt(d.value+1,r.colors):(m=new Vt(d.value+1,new Tn(0,0,0,1)),m.value[1]=new Tn(1,1,1,1));let f;r.steps?f=new Ft(d.value+1,r.steps):(f=new Ft(d.value+1,1),f.value[0]=0);let h=new Y(r.alpha??1),g=new ge(r.mode??0),x=new di(o,i,s,l,c,p,a,u,m,f,d,h),v=new ve(x.calpha,"f");return new We(t,e,n,{gradientType:o,smooth:i,near:s,far:l,isVector:c,isWorldSpace:p,origin:a,direction:u,colors:m,steps:f,num:d,alpha:h,mode:g},x,g,v)}case"noise":{let o=new Y(r.scale??1),i=new Ze(r.size??new ur(100,100,100)),s=new Y(r.move??1),l=new Ke(r.fA??new uo(1.7,9.2)),c=new Ke(r.fB??new uo(8.3,2.8)),p=new Ke(r.distortion??new uo(1,1)),a=new Lt(r.colorA),u=new Lt(r.colorB),d=new Lt(r.colorC),m=new Lt(r.colorD),f=new Y(r.alpha??1),h=new ge(r.mode??0),g=new ge(r.noiseType??0),x=new ai(o,i,s,l,c,p,a,u,d,m,f,g),v=new ve(x.calpha,"f");return new We(t,e,n,{scale:o,size:i,move:s,fA:l,fB:c,distortion:p,colorA:a,colorB:u,colorC:d,colorD:m,alpha:f,mode:h,noiseType:g},x,h,v)}case"normal":{let o=new Ze(r.cnormal??new ur(1,1,1)),i=new Y(r.alpha??1),s=new ge(r.mode??0),l=new xi(o,i),c=new ve("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return c.keywords.alpha=i,new We(t,e,n,{cnormal:o,alpha:i,mode:s},l,s,c)}case"gradient":{let o=new ge(r.gradientType??0),i=new qr(r.smooth??!1),s;r.colors?s=new Vt(r.colors.length,r.colors):(s=new Vt(10,new Tn(0,0,0,1)),s.value[1]=new Tn(1,1,1,1));let l;r.steps?l=new Ft(r.steps.length,r.steps):(l=new Ft(10,1),l.value[0]=0);let c=new Ke(r.offset??new uo(0,0)),p=new Ke(r.morph??new uo(0,0)),a=new Y(r.angle??0),u=new Y(r.alpha??1),d=new ge(r.mode??0),m=new hi(o,i,s,l,c,p,a,u),f=new ve(m.calpha,"f");return new We(t,e,n,{gradientType:o,smooth:i,colors:s,steps:l,offset:c,morph:p,angle:a,alpha:u,mode:d},m,d,f)}default:{let o=new Se(1,0,0,1),i=new Y(1),s=new ve("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ge(0);return o.alpha=i,new We(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}}}function ww(n,t,e,r){let o=mf(e,r);return Sw(e,n,t,o)}function dc(n,t,e){if(e.type==="displace"&&(n==="intensity"||n==="visible")){let r=t.uniforms[`f${t.id}_intensity`];return r?(r.value=e.intensity*(e.visible?1:0),r):void 0}if(e.type!=="displace"&&(n==="alpha"||n==="visible")){let r=t.uniforms[`f${t.id}_alpha`];if(!r)return;if(r.value=e.alpha*(e.visible?1:0),e.type==="outline"&&n=="visible"){let o=t.uniforms[`f${t.id}_compensation`];o&&(o.value=e.compensation&&e.visible)}return r}}var vf=n=>n.tagName==="VIDEO",An=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;vf(s)?i=s.videoWidth/s.videoHeight:i=s.width/s.height,o>i&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*i/o):r.repeat.set(1,1*i/o)),o<i&&(r.imageType=="WEBCAM"?r.repeat.set(1*o/i*-1,1):r.repeat.set(1*o/i,1)),o==i&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(t,e,r){let o=t/e,i=r.image!==void 0?r.image.width/r.image.height:1,s;o>i?s={x:1,y:i/o}:o<i?s={x:o/i,y:1}:s={x:1,y:1},r.repeat.set(s.x,s.y),r.updateMatrix()}static resizeTextureLayers(t,e,r){let o=r.layers;for(let i=0;i<o.length;i++){let s=o[i];xf(s)&&An.resizeTextureLayer(t,e,s.uniforms[`f${s.id}_texture`].value)}}static resizeComplex(t,e,r,o){let i=t/e,s,l=r.image;vf(l)?s=l.videoWidth/l.videoHeight:s=l.width/l.height,o.geometry.type.includes("Shape")?(i>s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*-1,1/e*s/i):r.repeat.set(1/t,1/e*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*i/s*-1,1/e):r.repeat.set(1/t*i/s,1/e)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*-1,1/e):r.repeat.set(1/t,1/e))):(i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var va=class extends Xe{constructor(e,r){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.layers&&An.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Cn=class extends Xe{constructor(e,r){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var ba=class extends Cn{constructor(e,r){super(e,r);this.objectType="NonParametric"}};import{DoubleSide as Tw,Mesh as Aw,MeshBasicMaterial as Cw,ShapeBufferGeometry as Nw,Vector2 as Ow,Vector3 as Pw}from"three";import{FontLoader as Iw}from"three/examples/jsm/loaders/FontLoader.js";var Ge=class extends Aw{constructor({char:e,originalChar:r,fontFamily:o,letterSpacing:i,fontSize:s,LOD:l=16},c=new Cw({color:0,opacity:1,visible:!0,transparent:!0,side:Tw})){let p=Ge.loadChar(e,o,l);super(p.geometry,c);this.char=e,this.originalChar=r??e,this.fontFamily=o,this.letterSpacing=i,this.fontSize=s,this.LOD=l,this.resolution=p.resolution,this.glyphsHa=p.glyphsHa,this.localPosition=new Ow,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return Ge._fontPath}static set FONTS_PATH(e){Ge._fontPath=e}updatePosition(e,r){this.localPosition.copy(e);let o=new Pw(this.localPosition.x,-this.localPosition.y,0);this.position.copy(o).add(r)}updateFontSize(e){let r=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let r=Ge.loadChar(this.char,e,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(e){if(this.char===e)return;this.char=e;let r=Ge.loadChar(e,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let r=Ge.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new Ge(e).copy(this)}static loadFont(e){return new Promise(function(r,o){Ge.fontCache[e]?r(Ge.fontCache[e]):new Iw().load(Ge.FONTS_PATH+e+".json",s=>{Ge.fontCache[e]=s,r(s)},void 0,o)})}static loadChar(e,r,o){if(Ge.charCache[e]){if(Ge.charCache[e][o]&&Ge.charCache[e][o].fontFamily===r)return Ge.charCache[e][o]}else Ge.charCache[e]={};let i=Ge.fontCache[r],s=i.generateShapes(e,1);return Ge.charCache[e][o]={geometry:new Nw(s,o),fontFamily:r,resolution:i.data.resolution,glyphsHa:i.data.glyphs[e].ha},Ge.charCache[e][o]}},zt=Ge;zt.charCache={},zt.fontCache={},zt._fontPath="/_assets/_fonts/";import{DoubleSide as _f,MeshBasicMaterial as Sf,Vector3 as Lw,Object3D as Mw}from"three";import{Vector2 as bf}from"three";var _a=new bf,po=class{constructor(t,e,r){this.message=[];this.endLine=!0;this.yLinePos=t,this.lineHeight=e,this.maxCharSize=r,this.nextChar3DPos=new bf(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(t,e,r=this.message.length){this.message.splice(r,0,t),t.fontSize>this.maxCharSize?(this.maxCharSize=t.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(e)):(t.updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=t.charSize)}deleteChar3D(t=this.message.length-1){let e=this.message[t];if(e)return this.message.splice(t,1),this.nextChar3DPos.x-=e.charSize,e}isEndLine(t){this.endLine=t}fullUpdate(t,e=0){this.nextChar3DPos.x=0;for(let r=e,o=this.message.length;r<o;r+=1)this.message[r].updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(t){let e,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){e=this.message[r];break}r-=1}return!!(r>=0&&e&&e.localPosition.x+e.charSize>t)}containSpaceOverFlow(t=this.message.length-1){for(let e=t;e>=0;e-=1)if(this.message[e].char===" ")return!0;return!1}containSpace(t=this.message.length-1){if(this.endLine)return!0;for(let e=t;e>=0;e-=1)if(this.message[e].char===" ")return!0;return!1}popWord(t=this.message.length-1){let e=[],r=!0,o;for(o=t;o>=0;o-=1)if(this.message[o].char===" "){r=!1,e.length===0&&(o-=1,e.splice(0,0,this.message[o]));break}else e.splice(0,0,this.message[o]);return r?e=[]:this.message.splice(o+1,e.length),e}getWord(t=0,e=1){let r=[],o=t;for(o=t;;o+=e){if(!this.message[o]||this.message[o].char===" "){r.length===0&&this.message[o]&&(r.push(this.message[o]),this.message.splice(o,1));break}e>0?(r.push(this.message[o]),this.message.splice(o,1),o-=e):(r.splice(0,0,this.message[o]),this.message.splice(o,1))}return r}getWordAtIndex(t){let e=[];for(let r=t;r<this.message.length&&this.message[r].char!==" ";r++)e.push(this.message[r]);for(let r=t-1;r>=0&&this.message[r].char!==" ";r--)e.splice(0,0,this.message[r]);return e}wordSize(t=0,e=-1){let r=0,o=t;for(;o>=0&&o<this.message.length;){if(this.message[o].char===" "){r===0&&(r=this.message[o].charSize);break}r+=this.message[o].charSize,o+=e}return(o<0||o>=this.message.length)&&!this.endLine?this.message[t]?this.message[t].charSize:999999999:r===0?999999999:r}spaceLeft(t){return t-this.nextChar3DPos.x}popChar(t=this.message.length-1){return this.nextChar3DPos.x-=this.message[t].charSize,this.message.splice(t,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(t){this.yLinePos=t,this.updateNextCharPosY()}updatelineHeight(t){this.lineHeight=t,this.updateNextCharPosY()}updateFontSize(t,e=0,r=this.message.length-1){for(let o=e;o<=r;o+=1)this.message[o].updateFontSize(t);this.maxCharSize=t,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let t=0;for(let e=0;e<this.message.length;e++)this.message[e].char===" "&&(t+=1);return t}alignText(t,e,r,o,i){switch(r){case 1:this.leftAlign(t,i);break;case 3:this.centerAlign(this.spaceLeft(e),t,i);break;case 2:this.rightAlign(this.spaceLeft(e),t,i);break;case 4:this.justifyAlign(this.spaceLeft(e),t,i);break}}offsetCharacters(t,e,r){_a.set(e,r);let o=this.message.length;for(let i=0;i<o;i++)this.message[i].updatePosition(this.message[i].localPosition.add(_a),t)}leftAlign(t,e){this.align=1,this.offsetCharacters(t,0,e)}centerAlign(t,e,r){this.align=3,this.offsetCharacters(e,t/2,r)}rightAlign(t,e,r){this.align=2,this.offsetCharacters(e,t,r)}justifyAlign(t,e,r){if(this.align=4,this.endLine){this.offsetCharacters(e,0,r);return}let o=this.countSpaces();if(o===0){this.offsetCharacters(e,0,r);return}let i=t/o,s=0;for(let l=0;l<this.message.length;l++)this.message[l].char===" "&&(s+=i),_a.set(s,r),this.message[l].updatePosition(this.message[l].localPosition.add(_a),e)}clone(){let t=new po(this.yLinePos,this.lineHeight,this.maxCharSize);t.nextChar3DPos=this.nextChar3DPos.clone(),t.align=this.align,t.endLine=this.endLine;for(let e=0;e<this.message.length;e++)t.message.push(this.message[e].clone());return t}};var hc=class extends Xe{constructor(e){super(e,new Sf({transparent:!0,opacity:1,visible:!1,side:_f}));this.objectType="TextFrame";this.charContainer=new Mw,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:1,horizontalAlignment:1,verticalAlignment:1,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new Lw(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,r,o){let i=Ks.create({parameters:{width:r.width,height:r.height}}),s=new hc(i).fromState(r,o);return s.uuid=e,s}async updateText(e){this.clearText();let r=this.userData.textFrame,o=r.fontFamily;await zt.loadFont(o),r.text=e;let i=r.textOrigin,s=new Sf({visible:r.visible,transparent:!0,side:_f}),l=e.split(`
1330
- `),c=0;this.userData.textFrame.textLines=l.map((p,a)=>{let u=new po(c,r.lineHeight,r.fontSize);return u.message=p.split("").map(d=>{let m={char:d,fontFamily:o,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},f=s.clone();f.color=r.hexColor,f.opacity=r.opacity;let h=new zt(m,f);return u.addChar3D(h,i),this.charContainer.add(h),h}),c+=u.maxCharSize*u.lineHeight,u}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let e=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;e.length;)e.pop()}raycast(e,r){let o=[];if(super.raycast(e,o),o.length>0){r.push(o[0]);return}let i=[];for(let s=0,l=this.charContainer.children.length;s<l;++s)if(this.charContainer.children[s]instanceof zt&&(e.intersectObject(this.charContainer.children[s],!1,i),i.length>0)){i[0].object=this,r.push(i[0]);return}}updateGeometry(e){let r=this.userData,o=this.geometry.userData,i=o.parameters.width,s=o.parameters.height,l=e.parameters?.width??i,c=e.parameters?.height??s,p=r.textFrame;super.updateGeometry(e),p.maxLineSize=l,p.textOrigin.set(-.5*l,.5*c,0),c!==s?(this.checkOverFlow(),this.checkCapacity()):l!==i&&(i<l?this.checkCapacity():i>l&&this.checkOverFlow())}checkOverFlow(e=0){let r=this.userData,o=r.textFrame.textOrigin,i=r.textFrame.textLines;for(let s=e;s<i.length;s++){i[s].updateYLinePos(this.getNewLinePosition(s)),i[s].fullUpdate(o);let l=[];for(;i[s].checkOverFlow(r.textFrame.maxLineSize);)i[s].containSpaceOverFlow()?l.unshift(i[s].getWord(i[s].message.length-1,-1)):l.unshift(i[s].popChar());if(l.length>0){i[s+1]===void 0?(i[s].isEndLine(!1),this.createTextLine()):i[s].endLine&&(this.createTextLine(s+1),i[s].isEndLine(!1),i[s+1].isEndLine(!0));let c=0;for(let p=0;p<l.length;p+=1)for(let a=0;a<l[p].length;a+=1)i[s+1].addChar3D(l[p][a],o,c),c+=1;i[s+1].fullUpdate(o)}i[s].fullUpdate(o)}this.textFullUpdate(e)}checkCapacity(e=0){let r=this.userData,o=r.textFrame.textOrigin,i=r.textFrame.maxLineSize,s=r.textFrame.textLines;for(let l=e;l<s.length;l+=1)if(s[l].updateYLinePos(this.getNewLinePosition(l)),s[l].fullUpdate(o),!!s[l-1])for(;!s[l-1].endLine;){let c,p=s[l-1].spaceLeft(i);if(s[l].wordSize(0,1)<=p){s[l].containSpace()?c=s[l].getWord(0,1):c=s[l].popChar(0);for(let a=0;a<c.length;a+=1)c[a]&&s[l-1].addChar3D(c[a],o)}else{s[l].isEmpty()?(s[l].endLine&&s[l-1].isEndLine(!0),s.splice(l,1),l-=1):(s[l].updateYLinePos(this.getNewLinePosition(l)),s[l].fullUpdate(o));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let o=this.userData.textFrame;o.textLines.splice(e,0,new po(this.getNewLinePosition(e),o.lineHeight,o.fontSize))}textFullUpdate(e=0){let o=this.userData.textFrame,i=o.textLines,s=this.getVerticalAlignmentOffSet();for(let l=e;l<i.length;l++)i[l].updateYLinePos(this.getNewLinePosition(l)),i[l].fullUpdate(o.textOrigin),i[l].alignText(o.textOrigin,o.maxLineSize,o.horizontalAlignment,o.verticalAlignment,s)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(e){let o=this.userData.textFrame.textLines,i=0;for(let s=0;s<e;s+=1)i+=o[s].maxCharSize*o[s].lineHeight;return i}updateColor(e){let r=this.userData;r.textFrame.hexColor=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.color?.isColor&&(c.color=e)}}}updateOpacity(e){let r=this.userData;r.textFrame.opacity=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.opacity=e}}}updateVisible(e){let r=this.userData;r.textFrame.visible=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.visible=e}}}async updateFontFamily(e){await zt.loadFont(e);let o=this.userData.textFrame,i=o.textLines;o.fontFamily=e;for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)l[c].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let o=this.userData.textFrame,i=o.textLines,s=o.fontSize;o.fontSize=e;for(let l=0;l<i.length;l++)i[l].updateFontSize(e);this.textFullUpdate(),e>s?this.checkOverFlow():e<s&&this.checkCapacity()}async updateTextTransform(e){let o=this.userData.textFrame;await zt.loadFont(o.fontFamily);let i=o.textLines;switch(o.textTransform=e,e){case 2:for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)i[s].message[c].updateChar(l[c].char.toUpperCase())}break;case 3:for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)i[s].message[c].updateChar(l[c].char.toLowerCase())}break;default:for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)i[s].message[c].updateChar(l[c].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let r=this.userData,o=r.textFrame.textLines;r.textFrame.letterSpacing=e;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++)s[l].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let r=this.userData;r.textFrame.LOD=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let r=this.userData,o=r.textFrame.textLines;r.textFrame.lineHeight=e;for(let i=0;i<o.length;i++)o[i].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let r=this.userData;r.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let r=this.userData;r.textFrame.horizontalAlignment=e,this.textFullUpdate()}fromTextFrameData(e,r){if(e.color!==void 0){let o=Ve(e.color,r);this.updateColor(o),this.updateOpacity(o.a)}e.alpha!==void 0&&this.updateOpacity(e.alpha),e.font!==void 0&&this.updateFontFamily(e.font),e.horizontalAlign!==void 0&&this.updateHorizontalAlignment(e.horizontalAlign),e.verticalAlign!==void 0&&this.updateVerticalAlignment(e.verticalAlign),e.textTransform!==void 0&&this.updateTextTransform(e.textTransform),e.fontSize!==void 0&&this.updateFontSize(e.fontSize),e.lineHeight!==void 0&&this.updateLineHeight(e.lineHeight),e.letterSpacing!==void 0&&this.updateLetterSpacing(e.letterSpacing),e.text!==void 0&&e.text!==""&&this.updateText(e.text),(e.width!==void 0||e.height!==void 0)&&this.updateGeometry({parameters:{width:e.width,height:e.height}})}fromState(e,r){return super.fromState(e),this.fromTextFrameData(e,r),this}},mo=hc;mo.VerticalAlign=Za,mo.HorizontalAlign=Qa,mo.TextTransform=Ja;import{NormalBlending as Dw,ShaderMaterial as Bw}from"three";var Ut=class extends Bw{constructor(e,r){super(void 0);this.data=e;this.layerIdGen=0;this.type="NodeMaterial";this.uniformsBackup={};this.fog=!0,this.updaters=[],this.dithering=!0,this.vertexColors=!0,this.onBeforeCompile=this._onBeforeCompile,this.transparent=!0,this.reset(e,r)}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.data.category}reset(e,r){let o=e.layers??vr.defaultTwoLayerData("phong").layers;this.layers=o.map(i=>pr.create(this.layerIdGen++,i.id,i.data,r)),this.layers.reverse(),this.name=e.name??"Untitled Material",this.onUpdate(r)}getLayersOfType(e){return this.layers.filter(r=>r.type===e)}getLayerByUuid(e){return this.layers.find(r=>r.uuid===e)}onUpdate(e){this.lightLayer=this.layers.find(r=>r instanceof dr),this.lightLayer===void 0&&(this.lightLayer=new dr(0,"",Fr.defaultData("light","basic"),new so,{})),this.dispose(),this.needsUpdate=!0,this.blendColors(),this.blendAfterColors(),this.blendPositions()}updateByOp(e,r,o){if(this.data=r,e.path[0]==="layers"){let i=e.path[1];if(i===void 0){if(this.layers.reverse(),e.type===4){let s=pr.create(this.layerIdGen++,e.id,e.data,o);this.layers.splice(e.localIndex,0,s)}else if(e.type===5)this.layers.splice(e.localIndex,1)[0].dispose();else if(e.type===6){let s=this.layers.findIndex(c=>c.uuid===e.id),l=this.layers[s];this.layers.splice(s,1),this.layers.splice(e.localIndex,0,l)}this.layers.reverse(),this.onUpdate(o)}else{let s=this.layers.find(l=>l.uuid===i);if(s){let l=r.layers.data(i);if(s.updateByOp({...e,path:e.path.slice(2)},l,o)){let p=pr.create(this.layerIdGen++,i,l,o);this.layers.splice(this.layers.findIndex(a=>a.uuid===i),1,p),this.onUpdate(o)}}}}}blendColors(){let e=this.layers.findIndex(o=>o instanceof We),r=this.layers.findIndex(o=>o instanceof dr);if(e!==-1&&e<r){let o=this.layers[e].color;for(let i=e+1;i<r;++i){let s=this.layers[i];s instanceof We&&(o=new mi(o,s.color,s.alpha,s.mode))}this.fragment.color=o}else this.fragment.color=void 0}blendAfterColors(){let e=new ve("outgoingLight","f"),r=this.layers.findIndex(o=>o instanceof dr);if(this.layers.length>r+1){for(let o=r+1;o<this.layers.length;++o){let i=this.layers[o];i instanceof We&&(e=new mi(e,i.color,i.alpha,i.mode))}this.fragment.afterColor=e}else this.fragment.afterColor=void 0}blendPositions(){let e=this.layers.filter(r=>r instanceof Ni);if(e.length>0){let r=e[0].position;for(let o=1;o<e.length;++o)e[o]&&(r=new ft(r,e[o].position,ft.ADD),r=new ft(r,new Y(.5).setReadonly(!0),ft.MUL));this.fragment.position=r}else this.fragment.position=void 0}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}_onBeforeCompile(e,r){this.build({renderer:r}),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=this.extensions.derivatives===!0,e.extensionFragDepth=this.extensions.fragDepth===!0,e.extensionDrawBuffers=this.extensions.drawBuffers===!0,e.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}clampUniformsForPreview(e,r){let o=(i,s,l)=>Math.min(Math.max(i,s),l);for(let i of this.layers)if(i.type==="displace"){this.uniformsBackup[`f${i.id}_intensity`]=i.uniforms[`f${i.id}_intensity`].value;let s=o(i.uniforms[`f${i.id}_intensity`].value,e,r);i.uniforms[`f${i.id}_intensity`].value=s}}restoreClampedUniforms(){for(let e of this.layers)e.type==="displace"&&(e.uniforms[`f${e.id}_intensity`].value=this.uniformsBackup[`f${e.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(e){for(let r=0;r<this.updaters.length;++r)e.updateNode(this.updaters[r])}build(e){e=e??{};let r=e.builder??new ha;return this.lights=this.lightLayer.data.category!=="basic",r.setMaterial(this,e.renderer),r.build(this.fragment,this.fragment),this.vertexShader=r.getCode("vertex"),this.fragmentShader=r.getCode("fragment"),this.defines=r.defines,this.uniforms=r.uniforms,this.extensions=r.extensions,this.updaters=r.updaters,this.transparent=r.requires.transparent||this.blending>Dw,this}dispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(Ut.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(n){n===!0&&this.version++,this.needsCompile=n},get:function(){return this.needsCompile}}});var fo=class extends Ut{};var Cf=Sc(wf());var Tf=new Map;function Af(n){if(typeof n=="string")return n;let t=Tf.get(n);return t||(t={url:URL.createObjectURL(new Blob([n]))},Tf.set(n,t)),t.url}var Nn=class{constructor({src:t,volume:e,delay:r,loop:o}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._isStarted=!1;this.onEnd=()=>{this._loop>1?this.loopsRemaining===1/0?this.play():this.loopsRemaining>1?(this.play(),this.loopsRemaining--):this._isStarted=!1:this._isStarted=!1};let i;typeof t=="string"?i={src:t}:i={src:Af(t),format:"wav"},this.sound=new Cf.Howl(i),this.sound.on("end",this.onEnd),this._src=t,e!==void 0&&(this.volume=e),r!==void 0&&(this.delay=r),o!==void 0&&(this.loop=o)}get src(){return this._src}get isStarted(){return this._isStarted}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,r){this.sound.on(t,e,r)}off(t,e,r){this.sound.off(t,e,r)}play(){this._isStarted=!0,this.delay?(this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)):this.sound.play()}pause(){this._isStarted=!1,this.sound.pause(),this.clearFade(),this.clearDelay()}stop(){this._isStarted=!1,this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay()}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}};var Oi=class{constructor(t){this.deletedMaterial=new fo(vr.defaultTwoLayerData("basic"),this);this.deletedImage=new co(Es.emptyImage);this.materials={};this.images={};this.colors={};this.audios={};this.penumbraSize=[];this.onImageLoad=()=>{this._onImageLoad&&this._onImageLoad()};this.reset(t)}setOnImageLoad(t){this._onImageLoad=t}reset(t){for(let[e,r]of Object.entries(t.images))this.addImage(e,r);for(let[e,r]of Object.entries(t.colors))this.addColor(e,r);for(let[e,r]of Object.entries(t.materials))this.addMaterial(e,new fo(r,this));for(let[e,r]of Object.entries(t.audios))this.addAudio(e,r.data);this.penumbraSize=t.penumbraSize}addMaterial(t,e){e.uuid=t,this.materials[t]=e}deleteMaterial(t){this.materials[t]&&(this.materials[t].dispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):new Ut(t,this)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.images[t].updateSrc(e.data),!0):(this.images[t]=new co(e,this.onImageLoad),!1)}deleteImage(t){this.images[t]&&delete this.images[t]}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):new wn(t,this.onImageLoad)}getImages(){return this.images}addColor(t,e){return this.colors[t]?("a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new $r(e.r,e.g,e.b,e.a):this.colors[t]=new $r(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){let r=this.colors[t];return this.colors[t].r=e.r??r.r,this.colors[t].g=e.g??r.g,this.colors[t].b=e.b??r.b,this.colors[t].a=e.a??r.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}color(t){let e;if(typeof t=="string"){let r=this.getColor(t);r?e=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Ue(0,0,0,0))}else return"a"in t?new Ue(t.r,t.g,t.b,t.a):new Ue(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Nn)return e;{let r=new Nn({src:e});return this.audios[t]=r,r}}deleteAudio(t){this.audios[t]&&delete this.audios[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._onImageLoad=void 0,Object.values(this.audios).forEach(e=>{e instanceof Nn&&e.dispose()}),this.audios={}}},rH=new Oi(qo.emptyData());import{DRACOLoader as Ew}from"three/examples/jsm/loaders/DRACOLoader.js";var Yr;function Gw(){return Yr||(Yr=new Ew,Yr.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),Yr.decoderPending}async function Rw(n){if(Yr){let t={attributeIDs:Yr.defaultAttributeIDs,attributeTypes:Yr.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await Yr.decodeGeometry(new Int8Array(n).buffer,t)}catch(r){console.error(r)}if(e)return{index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,o])=>({name:r,itemSize:o.itemSize,array:o.array}))}}return null}async function Nf(n,t){let[e,r]=Ea(As.deserialize(new Uint8Array(n)));bd(e);let o=[];e.scene.objects.traverse((i,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&o.push(s)}),o.length&&await Gw();for(let i of o){let s=await Rw(Er(i.geometry.data.draco));if(s){s.index&&(i.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let l={};s.attributes.forEach(({name:c,array:p,itemSize:a})=>{l[c]={array:p,itemSize:a,type:"Float32Array",normalized:!1}}),i.geometry.data.attributes=l,i.geometry.data.draco=void 0}}return t&&t(e),r.result().data}import{HemisphereLight as o1,Scene as n1,Vector3 as i1,Fog as s1,Box3 as a1}from"three";import{Box3 as Fw,Matrix4 as ho,Sphere as If,Vector3 as Vw}from"three";var Mf=Sc(Pf());var gc;Qs.then(n=>{gc=n});var Df=new ho,zw=new ho,Uw=new ho,kt=new Fw,Kr=new Vw,kw=new ho,jw=new ho,On=class extends Xe{constructor(e,r,o,i){super(o??r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new ho;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new ho;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:l}=Pt.build(r.geometry,void 0,void 0,!r.flatShading),c=o.material(r.material),p=new On(i,s,l||void 0,c);return r.geometry.phongAngle!==void 0&&(p.phongAngle=r.geometry.phongAngle),p.calcBoundingBox(),p.freeSubdivPointer(),p.uuid=e,p.fromState(r),p}buildFromStore(e,r){let{originalGeometry:o,subdividedGeometry:i,subdivPointer:s}=Pt.build(e,r,this.subdivPointer,this.smoothShading,this.shearScale);e.phongAngle!==void 0&&(this.phongAngle=e.phongAngle),this.subdivPointer=s,o!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=o),i!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0),this.geometry=this.subdividedGeometry??this.originalGeometry,Hr(this),Wr(this),e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){Pt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&Pt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Pt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Pt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(e,r){this.geometry=this.originalGeometry,Xe.prototype.raycast.call(this,e,r),this.geometry=this.subdividedGeometry??this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,r=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:o,v:i,q:s}=(0,Mf.SVD)(r),l=Df.set(o[0][0],o[0][1],o[0][2],0,o[1][0],o[1][1],o[1][2],0,o[2][0],o[2][1],o[2][2],0,0,0,0,1),c=zw.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),p=Uw.copy(c).transpose();this.shearScale=kw.makeScale(s[0],s[1],s[2]).multiply(p).premultiply(c),this.shearScaleInv=jw.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(l,p),s.every(a=>Math.abs(s[0]-a)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new If);let r=e.attributes.position,o=e.boundingSphere.center;kt.setFromBufferAttribute(r),kt.getCenter(o),e.boundingSphere.radius=o.distanceTo(kt.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),kt.getSize(Kr);let i={width:Kr.x,height:Kr.y,depth:Kr.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;kt.min.set(e[0],e[2],e[4]),kt.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(kt.min.applyMatrix4(this.shearScaleInv),kt.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new If);let o=r.boundingSphere.center;kt.getCenter(o),r.boundingSphere.radius=o.distanceTo(kt.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),kt.getSize(Kr);let i={width:Kr.x,height:Kr.y,depth:Kr.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(gc.free_bvh(this.subdivPointer),gc.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,Lf(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Lf(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters={...e.parameters}}};function Lf(n,t,e,r){let o=n.position.array,i=n.normal.array,s=Df.makeScale(t,e,r).invert().elements,l,c,p;for(var a=0,u=o.length;a<u;a+=3)o[a]*=t,o[a+1]*=e,o[a+2]*=r,l=i[a],c=i[a+1],p=i[a+2],i[a]=s[0]*l+s[4]*c+s[8]*p,i[a+1]=s[1]*l+s[5]*c+s[9]*p,i[a+2]=s[2]*l+s[6]*c+s[10]*p}import{BackSide as Hw,BufferGeometry as Ww,DoubleSide as qw,FrontSide as $w}from"three";function Bf(n,t){t.flatShading!==void 0&&(n.flatShading=t.flatShading,n.needsUpdate=!0),t.wireframe!==void 0&&(n.wireframe=t.wireframe),t.side!==void 0&&(t.side===0?n.side=$w:t.side===1?n.side=Hw:n.side=qw)}function Xw(n,t){if(Array.isArray(n.material))for(let e of n.material)Bf(e,t);else{let e=n.material;Bf(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function Ef(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=On.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new Ww:ta(t.geometry,e),i="materials"in t?t.materials.map(s=>e.material(s)):e.material(t.material);Is.is2DParametricMesh(o.userData.type)?r=new va(o,i):o?.userData.type==="VectorGeometry"?r=new an(o,i):t.geometry.type==="NonParametricGeometry"?r=new ba(o,i):t.geometry.type==="BooleanGeometry"?(r=new na(void 0,i),r.booleanOp=t.geometry.operation,t.geometry.phongAngle!==void 0&&(r.phongAngle=t.geometry.phongAngle)):r=new Cn(o,i),r.uuid=n,r.fromState(t,e)}return Xw(r,t),r}function Gf(n,t,e){return t.type==="Mesh"?Ef(n,t,e):t.type==="TextFrame"?mo.createFromState(n,t,e):t.type==="Empty"?io.createFromState(n,t):t.type==="PointLight"?fn.createFromState(n,t,e):t.type==="SpotLight"?hn.createFromState(n,t,e):t.type==="DirectionalLight"?mn.createFromState(n,t,e):Vo.is(t.type)?Tr.createFromState(n,t):(console.error(t),new io)}import{Mesh as Vf,Ray as Kw,Matrix4 as Qw,Raycaster as Zw}from"three";function Rf(n,t){let e=!1,r=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline");return o.length>0&&(n.layers.set(8),r.length>0&&n.layers.enable(3),e=!0,Wr(n),Hr(n)),r.length===0&&o.length===0&&n.layers.set(0),e}function Ff(n,t){if(!t.layers)return!1;let e=!1,r=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline");return r.length>0&&(n.layers.set(3),o.length>0&&n.layers.enable(8),e=!0),r.length===0&&o.length===0&&n.layers.set(0),e}function zf(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof Vf&&e.objectType!=="TextFrame")if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Rf(e,e.material[r])&&(t=!0);else Rf(e,e.material)&&(t=!0)}),t}function Uf(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof Vf)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Ff(e,e.material[r])&&(t=!0);else Ff(e,e.material)&&(t=!0)}),t}function kf(n){"material"in n&&Jw(n.material),"geometry"in n&&n.geometry.dispose()}function Jw(n){wc(n).forEach(t=>{t instanceof fo||t.dispose()})}var e1=new Zw,t1=new Qw,r1=new Kw;function jf(n,t,e){let r=n.cloner;if(r)for(let o of r.children){let i=t1.copy(o.matrixWorld).invert(),s=r1.copy(t.ray).applyMatrix4(i),l=n.matrixWorld;s.applyMatrix4(l);let c=e1;c.set(s.origin,s.direction),c.near=t.near,c.far=t.far,c.intersectObject(n,!1).length>0&&e.push({object:n})}}var Hf=new i1,yc=class extends Js(n1){constructor(e,r){super();this.objectType="Scene";this.backupFog=new s1(16777215,.1,2e3);this.fogUseBGColor=!1;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this.bgColor=new Ue(1,1,1,1);this.entityByUuid={};this.ambientLight=new o1(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.postprocessing=e.postprocessing,this.init(e,r)}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=Uf(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=zf(this),this.needsNormalDirty=!1),this._needsNormal}find(e){if(e===""||e===void 0)return;let r=this.entityByUuid[e];return r===void 0?this.getObjectByProperty("uuid",e):r}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,r){if(this.createChildrenObjects(e.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(Ve(e.backgroundColor,r)),this.updateFog(e.fog,r),this.updateAmbientLight(e.environment.ambientLight,r),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let o=this.find(e.publish.playCamera);o instanceof Tr&&this.switchActiveCamera(o)}this.traverse(o=>{Jt(o)&&o.recomputeBoolean()})}clearScene(){this.traverseEntity(e=>{kf(e)});for(let e of this.children)rr(e)&&e.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Tr.createFromState(yc.PERSONAL_CAMERA_ID,{...Ms.defaultData,name:"Personal Camera"});return e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let r=[],o=i=>{for(let s of i.children)rr(s)&&!s.raycastLock&&s.visible&&((Zt(s)||Zs(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,r),jf(s,e,r)),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)rr(r)&&r.traverseEntity(e)}traverseVisibleEntity(e){for(let r of this.children)rr(r)&&r.visible&&r.traverseVisibleEntity(e)}updateFog(e,r){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Ve(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}dispose(){this.clearScene()}updateAmbientLight(e,r){Cm(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=Ve(e.groundColor,r)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}createChildrenObjects(e,r,o){for(let i of e)this.createChildObject(i.id,i.data,i.children,r,o)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let r of e.children)this.unregisterObject(r)}createChildObject(e,r,o,i,s){let l=Gf(e,r,s);return l&&(this.entityByUuid[e]=l,i.add(l),Jt(i)&&Zt(l)&&(l.prevBooleanObjectParent=i),this.createChildrenObjects(o,l,s)),l}getCenter(e){let r=[];for(let i=0,s=e.length;i<s;++i){let{id:l,recursive:c}=e[i],p=this.find(l),a=c?p.recursiveBBox:p.singleBBox;r.push(...a.vertices)}let o=new a1;return o.setFromPoints(r),o.getCenter(Hf),Hf}copyMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e);o?r.copy(o.matrixWorld):r.identity()}copyParentMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e)?.parent;o?r.copy(o.matrixWorld):r.identity()}traverseMaterial(e){this.traverseEntity(r=>{if(r instanceof Xe)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof Ut&&e(r.material[o]);else r.material instanceof Ut&&e(r.material)})}updateCanvasSize(e,r){this.activeCamera.setViewplaneSize(e,r);let o,i;e>=r?(o=r/e,i=1):(o=1,i=e/r),this.traverseMaterial(s=>{s.getLayersOfType("transmission").forEach(c=>{c.uniforms[`f${c.id}_aspectRatio`].value.x=o,c.uniforms[`f${c.id}_aspectRatio`].value.y=i})})}},Pi=yc;Pi.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";import{Mesh as NW}from"three";import{mergeBufferGeometries as IW}from"three/examples/jsm/utils/BufferGeometryUtils.js";function Wf(n){let t;if(!!n.index)for(let e=0;e<n.index.array.length;e+=3)t=n.index.array[e],n.index.array[e]=n.index.array[e+2],n.index.array[e+2]=t}import{Color as qf,ShaderLib as l1}from"three";function $f(n){let t=new Set;return n.traverse(e=>{if(Zt(e))if(Me(e.material))e.material.forEach(r=>{let o=r;t.has(o)||t.add(o)});else{let r=e.material;t.has(r)||t.add(r)}}),t.forEach(e=>{if(e instanceof Array)return;let r=e.onBeforeCompile.bind(e);c1(e)?(Object.assign(e,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new qf,specularColor:new qf}),e.onBeforeCompile=(o,i)=>{r&&r(o,i),o.uniforms=Object.assign(l1.physical.uniforms,o.uniforms),e.getLayersOfType("transmission").forEach(s=>{o.uniforms.transmissionSamplerMap.value&&(s.uniforms["f"+s.id+"_transmissionSamplerMap"].value=o.uniforms.transmissionSamplerMap.value,s.uniforms["f"+s.id+"_transmissionSamplerSize"].value=o.uniforms.transmissionSamplerSize.value)})}):u1(e)||(e.onBeforeCompile=(o,i)=>{r&&r(o,i),e.transparent=!1})}),n}function c1(n){return n.getLayersOfType("transmission").length>0}function u1(n){let t=0;return n.layers.forEach(e=>{if(e.type!=="light"&&e.type!=="fresnel"){let r=e.uniforms["f"+e.id+"_alpha"];r&&(t+=(1-t)*r.value)}}),t<1}function Xf(n){return n.traverse(t=>{if(t.type==="Camera"){let e=t;e.type=e.cameraType}}),n}function Yf(n){let t=[],e=(r,o=0)=>{let i=o>0?r+o:r;return t.includes(i)?e(r,o+1):i};return n.traverse(r=>{if(t.includes(r.name)){let o=r.name,i=e(r.name);if(r.name=i,r.isMesh){let s=r;s.material instanceof Array?s.material.forEach(l=>{l.name=l.name.replace(o,i)}):s.material.isAsset||(s.material.name=s.material.name.replace(o,i))}}t.push(r.name)}),n}import{mergeBufferGeometries as p1}from"three/examples/jsm/utils/BufferGeometryUtils.js";function Kf(n){let t=[];return n.traverse(e=>{e instanceof no&&t.push(e)}),t.forEach(e=>{let r=e.object,i=e.children.map(l=>{l.updateMatrix();let c=l.geometry.clone().applyMatrix4(l.matrix);return l.matrix.determinant()<0&&Wf(c),c}),s=p1(e.parameters.hideBase?i:[r.geometry,...i]);r.geometry=s,r.remove(e),r.cloner=void 0}),n}function Qf(n){return n.traverse(t=>{t.matrixAutoUpdate=!0}),n}function Zf(n){Object.values(n.shared.materials).forEach(t=>{xc(t)}),n.scene.objects.traverse((t,e)=>{"material"in e?xc(e.material):"materials"in e&&e.materials.forEach(r=>{xc(r)})})}function xc(n){if(typeof n=="string")return;let t=[];n.layers.forEach((e,r)=>{e.type==="outline"&&t.push(r)}),t.reverse().forEach(e=>{n.layers.delete(e)}),t.length&&console.warn("The Spline Loader currently does not support the outline layer.")}var Jf="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",vc=class extends m1{load(t,e,r,o=console.error){let i=new d1(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(Jf+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(Jf),i.load(t,async s=>{try{if(typeof s=="string")throw new Error("The .spline file is not binary!");let l=await this.parse(s);e(l)}catch(l){o(l)}},r,o)}async parse(t){let e=await Nf(t,Zf),r=new Oi(e.shared);Object.values(r.getMaterials()).forEach(s=>Object.assign(s,{isAsset:!0}));let o=new Pi(e.scene,r);o.remove(o.personalCamera),e.scene.environment.ambientLight.enabled||o.remove(o.ambientLight);let i=e.scene.publish.playCamera;if(i){let s=o.find(i);s&&Am(s)&&Object.assign(s,{makeDefault:!0})}return o=Kf(o),o=$f(o),o=Xf(o),o=Yf(o),o=Qf(o),o}};export{vc as default};
1330
+ `),c=0;this.userData.textFrame.textLines=l.map((p,a)=>{let u=new po(c,r.lineHeight,r.fontSize);return u.message=p.split("").map(d=>{let m={char:d,fontFamily:o,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},f=s.clone();f.color=r.hexColor,f.opacity=r.opacity;let h=new zt(m,f);return u.addChar3D(h,i),this.charContainer.add(h),h}),c+=u.maxCharSize*u.lineHeight,u}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let e=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;e.length;)e.pop()}raycast(e,r){let o=[];if(super.raycast(e,o),o.length>0){r.push(o[0]);return}let i=[];for(let s=0,l=this.charContainer.children.length;s<l;++s)if(this.charContainer.children[s]instanceof zt&&(e.intersectObject(this.charContainer.children[s],!1,i),i.length>0)){i[0].object=this,r.push(i[0]);return}}updateGeometry(e){let r=this.userData,o=this.geometry.userData,i=o.parameters.width,s=o.parameters.height,l=e.parameters?.width??i,c=e.parameters?.height??s,p=r.textFrame;super.updateGeometry(e),p.maxLineSize=l,p.textOrigin.set(-.5*l,.5*c,0),c!==s?(this.checkOverFlow(),this.checkCapacity()):l!==i&&(i<l?this.checkCapacity():i>l&&this.checkOverFlow())}checkOverFlow(e=0){let r=this.userData,o=r.textFrame.textOrigin,i=r.textFrame.textLines;for(let s=e;s<i.length;s++){i[s].updateYLinePos(this.getNewLinePosition(s)),i[s].fullUpdate(o);let l=[];for(;i[s].checkOverFlow(r.textFrame.maxLineSize);)i[s].containSpaceOverFlow()?l.unshift(i[s].getWord(i[s].message.length-1,-1)):l.unshift(i[s].popChar());if(l.length>0){i[s+1]===void 0?(i[s].isEndLine(!1),this.createTextLine()):i[s].endLine&&(this.createTextLine(s+1),i[s].isEndLine(!1),i[s+1].isEndLine(!0));let c=0;for(let p=0;p<l.length;p+=1)for(let a=0;a<l[p].length;a+=1)i[s+1].addChar3D(l[p][a],o,c),c+=1;i[s+1].fullUpdate(o)}i[s].fullUpdate(o)}this.textFullUpdate(e)}checkCapacity(e=0){let r=this.userData,o=r.textFrame.textOrigin,i=r.textFrame.maxLineSize,s=r.textFrame.textLines;for(let l=e;l<s.length;l+=1)if(s[l].updateYLinePos(this.getNewLinePosition(l)),s[l].fullUpdate(o),!!s[l-1])for(;!s[l-1].endLine;){let c,p=s[l-1].spaceLeft(i);if(s[l].wordSize(0,1)<=p){s[l].containSpace()?c=s[l].getWord(0,1):c=s[l].popChar(0);for(let a=0;a<c.length;a+=1)c[a]&&s[l-1].addChar3D(c[a],o)}else{s[l].isEmpty()?(s[l].endLine&&s[l-1].isEndLine(!0),s.splice(l,1),l-=1):(s[l].updateYLinePos(this.getNewLinePosition(l)),s[l].fullUpdate(o));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let o=this.userData.textFrame;o.textLines.splice(e,0,new po(this.getNewLinePosition(e),o.lineHeight,o.fontSize))}textFullUpdate(e=0){let o=this.userData.textFrame,i=o.textLines,s=this.getVerticalAlignmentOffSet();for(let l=e;l<i.length;l++)i[l].updateYLinePos(this.getNewLinePosition(l)),i[l].fullUpdate(o.textOrigin),i[l].alignText(o.textOrigin,o.maxLineSize,o.horizontalAlignment,o.verticalAlignment,s)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(e){let o=this.userData.textFrame.textLines,i=0;for(let s=0;s<e;s+=1)i+=o[s].maxCharSize*o[s].lineHeight;return i}updateColor(e){let r=this.userData;r.textFrame.hexColor=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.color?.isColor&&(c.color=e)}}}updateOpacity(e){let r=this.userData;r.textFrame.opacity=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.opacity=e}}}updateVisible(e){let r=this.userData;r.textFrame.visible=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.visible=e}}}async updateFontFamily(e){await zt.loadFont(e);let o=this.userData.textFrame,i=o.textLines;o.fontFamily=e;for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)l[c].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let o=this.userData.textFrame,i=o.textLines,s=o.fontSize;o.fontSize=e;for(let l=0;l<i.length;l++)i[l].updateFontSize(e);this.textFullUpdate(),e>s?this.checkOverFlow():e<s&&this.checkCapacity()}async updateTextTransform(e){let o=this.userData.textFrame;await zt.loadFont(o.fontFamily);let i=o.textLines;switch(o.textTransform=e,e){case 2:for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)i[s].message[c].updateChar(l[c].char.toUpperCase())}break;case 3:for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)i[s].message[c].updateChar(l[c].char.toLowerCase())}break;default:for(let s=0;s<i.length;s++){let l=i[s].message;for(let c=0;c<l.length;c++)i[s].message[c].updateChar(l[c].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let r=this.userData,o=r.textFrame.textLines;r.textFrame.letterSpacing=e;for(let i=0;i<o.length;i++){let s=o[i].message;for(let l=0;l<s.length;l++)s[l].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let r=this.userData;r.textFrame.LOD=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let r=this.userData,o=r.textFrame.textLines;r.textFrame.lineHeight=e;for(let i=0;i<o.length;i++)o[i].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let r=this.userData;r.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let r=this.userData;r.textFrame.horizontalAlignment=e,this.textFullUpdate()}fromTextFrameData(e,r){if(e.color!==void 0){let o=Ve(e.color,r);this.updateColor(o),this.updateOpacity(o.a)}e.alpha!==void 0&&this.updateOpacity(e.alpha),e.font!==void 0&&this.updateFontFamily(e.font),e.horizontalAlign!==void 0&&this.updateHorizontalAlignment(e.horizontalAlign),e.verticalAlign!==void 0&&this.updateVerticalAlignment(e.verticalAlign),e.textTransform!==void 0&&this.updateTextTransform(e.textTransform),e.fontSize!==void 0&&this.updateFontSize(e.fontSize),e.lineHeight!==void 0&&this.updateLineHeight(e.lineHeight),e.letterSpacing!==void 0&&this.updateLetterSpacing(e.letterSpacing),e.text!==void 0&&e.text!==""&&this.updateText(e.text),(e.width!==void 0||e.height!==void 0)&&this.updateGeometry({parameters:{width:e.width,height:e.height}})}fromState(e,r){return super.fromState(e),this.fromTextFrameData(e,r),this}},mo=hc;mo.VerticalAlign=Za,mo.HorizontalAlign=Qa,mo.TextTransform=Ja;import{NormalBlending as Dw,ShaderMaterial as Bw}from"three";var Ut=class extends Bw{constructor(e,r){super(void 0);this.data=e;this.layerIdGen=0;this.type="NodeMaterial";this.uniformsBackup={};this.fog=!0,this.updaters=[],this.dithering=!0,this.vertexColors=!0,this.onBeforeCompile=this._onBeforeCompile,this.transparent=!0,this.reset(e,r)}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.data.category}reset(e,r){let o=e.layers??vr.defaultTwoLayerData("phong").layers;this.layers=o.map(i=>pr.create(this.layerIdGen++,i.id,i.data,r)),this.layers.reverse(),this.name=e.name??"Untitled Material",this.onUpdate(r)}getLayersOfType(e){return this.layers.filter(r=>r.type===e)}getLayerByUuid(e){return this.layers.find(r=>r.uuid===e)}onUpdate(e){this.lightLayer=this.layers.find(r=>r instanceof dr),this.lightLayer===void 0&&(this.lightLayer=new dr(0,"",Fr.defaultData("light","basic"),new so,{})),this.dispose(),this.needsUpdate=!0,this.blendColors(),this.blendAfterColors(),this.blendPositions()}updateByOp(e,r,o){if(this.data=r,e.path[0]==="layers"){let i=e.path[1];if(i===void 0){if(this.layers.reverse(),e.type===4){let s=pr.create(this.layerIdGen++,e.id,e.data,o);this.layers.splice(e.localIndex,0,s)}else if(e.type===5)this.layers.splice(e.localIndex,1)[0].dispose();else if(e.type===6){let s=this.layers.findIndex(c=>c.uuid===e.id),l=this.layers[s];this.layers.splice(s,1),this.layers.splice(e.localIndex,0,l)}this.layers.reverse(),this.onUpdate(o)}else{let s=this.layers.find(l=>l.uuid===i);if(s){let l=r.layers.data(i);if(s.updateByOp({...e,path:e.path.slice(2)},l,o)){let p=pr.create(this.layerIdGen++,i,l,o);this.layers.splice(this.layers.findIndex(a=>a.uuid===i),1,p),this.onUpdate(o)}}}}}blendColors(){let e=this.layers.findIndex(o=>o instanceof We),r=this.layers.findIndex(o=>o instanceof dr);if(e!==-1&&e<r){let o=this.layers[e].color;for(let i=e+1;i<r;++i){let s=this.layers[i];s instanceof We&&(o=new mi(o,s.color,s.alpha,s.mode))}this.fragment.color=o}else this.fragment.color=void 0}blendAfterColors(){let e=new ve("outgoingLight","f"),r=this.layers.findIndex(o=>o instanceof dr);if(this.layers.length>r+1){for(let o=r+1;o<this.layers.length;++o){let i=this.layers[o];i instanceof We&&(e=new mi(e,i.color,i.alpha,i.mode))}this.fragment.afterColor=e}else this.fragment.afterColor=void 0}blendPositions(){let e=this.layers.filter(r=>r instanceof Ni);if(e.length>0){let r=e[0].position;for(let o=1;o<e.length;++o)e[o]&&(r=new ft(r,e[o].position,ft.ADD),r=new ft(r,new Y(.5).setReadonly(!0),ft.MUL));this.fragment.position=r}else this.fragment.position=void 0}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}_onBeforeCompile(e,r){this.build({renderer:r}),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=this.extensions.derivatives===!0,e.extensionFragDepth=this.extensions.fragDepth===!0,e.extensionDrawBuffers=this.extensions.drawBuffers===!0,e.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}clampUniformsForPreview(e,r){let o=(i,s,l)=>Math.min(Math.max(i,s),l);for(let i of this.layers)if(i.type==="displace"){this.uniformsBackup[`f${i.id}_intensity`]=i.uniforms[`f${i.id}_intensity`].value;let s=o(i.uniforms[`f${i.id}_intensity`].value,e,r);i.uniforms[`f${i.id}_intensity`].value=s}}restoreClampedUniforms(){for(let e of this.layers)e.type==="displace"&&(e.uniforms[`f${e.id}_intensity`].value=this.uniformsBackup[`f${e.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(e){for(let r=0;r<this.updaters.length;++r)e.updateNode(this.updaters[r])}build(e){e=e??{};let r=e.builder??new ha;return this.lights=this.lightLayer.data.category!=="basic",r.setMaterial(this,e.renderer),r.build(this.fragment,this.fragment),this.vertexShader=r.getCode("vertex"),this.fragmentShader=r.getCode("fragment"),this.defines=r.defines,this.uniforms=r.uniforms,this.extensions=r.extensions,this.updaters=r.updaters,this.transparent=r.requires.transparent||this.blending>Dw,this}dispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(Ut.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(n){n===!0&&this.version++,this.needsCompile=n},get:function(){return this.needsCompile}}});var fo=class extends Ut{};var Cf=Sc(wf());var Tf=new Map;function Af(n){if(typeof n=="string")return n;let t=Tf.get(n);return t||(t={url:URL.createObjectURL(new Blob([n]))},Tf.set(n,t)),t.url}var Nn=class{constructor({src:t,volume:e,delay:r,loop:o}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._isStarted=!1;this.onEnd=()=>{this._loop>1?this.loopsRemaining===1/0?this.play():this.loopsRemaining>1?(this.play(),this.loopsRemaining--):this._isStarted=!1:this._isStarted=!1};let i;typeof t=="string"?i={src:t}:i={src:Af(t),format:"wav"},this.sound=new Cf.Howl(i),this.sound.on("end",this.onEnd),this._src=t,e!==void 0&&(this.volume=e),r!==void 0&&(this.delay=r),o!==void 0&&(this.loop=o)}get src(){return this._src}get isStarted(){return this._isStarted}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,r){this.sound.on(t,e,r)}off(t,e,r){this.sound.off(t,e,r)}play(){this._isStarted=!0,this.delay?(this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)):this.sound.play()}pause(){this._isStarted=!1,this.sound.pause(),this.clearFade(),this.clearDelay()}stop(){this._isStarted=!1,this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay()}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}};var Oi=class{constructor(t){this.deletedMaterial=new fo(vr.defaultTwoLayerData("basic"),this);this.deletedImage=new co(Es.emptyImage);this.materials={};this.images={};this.colors={};this.audios={};this.penumbraSize=[];this.onImageLoad=()=>{this._onImageLoad&&this._onImageLoad()};this.reset(t)}setOnImageLoad(t){this._onImageLoad=t}reset(t){for(let[e,r]of Object.entries(t.images))this.addImage(e,r);for(let[e,r]of Object.entries(t.colors))this.addColor(e,r);for(let[e,r]of Object.entries(t.materials))this.addMaterial(e,new fo(r,this));for(let[e,r]of Object.entries(t.audios))this.addAudio(e,r.data);this.penumbraSize=t.penumbraSize}addMaterial(t,e){e.uuid=t,this.materials[t]=e}deleteMaterial(t){this.materials[t]&&(this.materials[t].dispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):new Ut(t,this)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.images[t].updateSrc(e.data),!0):(this.images[t]=new co(e,this.onImageLoad),!1)}deleteImage(t){this.images[t]&&delete this.images[t]}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):new wn(t,this.onImageLoad)}getImages(){return this.images}addColor(t,e){return this.colors[t]?("a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new $r(e.r,e.g,e.b,e.a):this.colors[t]=new $r(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){let r=this.colors[t];return this.colors[t].r=e.r??r.r,this.colors[t].g=e.g??r.g,this.colors[t].b=e.b??r.b,this.colors[t].a=e.a??r.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}color(t){let e;if(typeof t=="string"){let r=this.getColor(t);r?e=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Ue(0,0,0,0))}else return"a"in t?new Ue(t.r,t.g,t.b,t.a):new Ue(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Nn)return e;{let r=new Nn({src:e});return this.audios[t]=r,r}}deleteAudio(t){this.audios[t]&&delete this.audios[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._onImageLoad=void 0,Object.values(this.audios).forEach(e=>{e instanceof Nn&&e.dispose()}),this.audios={}}},rH=new Oi(qo.emptyData());import{DRACOLoader as Ew}from"three/examples/jsm/loaders/DRACOLoader.js";var Yr;function Gw(){return Yr||(Yr=new Ew,Yr.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),Yr.decoderPending}async function Rw(n){if(Yr){let t={attributeIDs:Yr.defaultAttributeIDs,attributeTypes:Yr.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await Yr.decodeGeometry(new Int8Array(n).buffer,t)}catch(r){console.error(r)}if(e)return{index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,o])=>({name:r,itemSize:o.itemSize,array:o.array}))}}return null}async function Nf(n,t){let[e,r]=Ea(As.deserialize(new Uint8Array(n)));bd(e);let o=[];e.scene.objects.traverse((i,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&o.push(s)}),o.length&&await Gw();for(let i of o){let s=await Rw(Er(i.geometry.data.draco));if(s){s.index&&(i.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let l={};s.attributes.forEach(({name:c,array:p,itemSize:a})=>{l[c]={array:p,itemSize:a,type:"Float32Array",normalized:!1}}),i.geometry.data.attributes=l,i.geometry.data.draco=void 0}}return t&&t(e),r.result().data}import{HemisphereLight as o1,Scene as n1,Vector3 as i1,Fog as s1,Box3 as a1}from"three";import{Box3 as Fw,Matrix4 as ho,Sphere as If,Vector3 as Vw}from"three";var Mf=Sc(Pf());var gc;Qs.then(n=>{gc=n});var Df=new ho,zw=new ho,Uw=new ho,kt=new Fw,Kr=new Vw,kw=new ho,jw=new ho,On=class extends Xe{constructor(e,r,o,i){super(o??r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new ho;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new ho;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:l}=Pt.build(r.geometry,void 0,void 0,!r.flatShading),c=o.material(r.material),p=new On(i,s,l||void 0,c);return r.geometry.phongAngle!==void 0&&(p.phongAngle=r.geometry.phongAngle),p.calcBoundingBox(),p.freeSubdivPointer(),p.uuid=e,p.fromState(r),p}buildFromStore(e,r){let{originalGeometry:o,subdividedGeometry:i,subdivPointer:s}=Pt.build(e,r,this.subdivPointer,this.smoothShading,this.shearScale);e.phongAngle!==void 0&&(this.phongAngle=e.phongAngle),this.subdivPointer=s,o!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=o),i!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0),this.geometry=this.subdividedGeometry??this.originalGeometry,Hr(this),Wr(this),e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){Pt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&Pt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Pt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Pt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(e,r){this.geometry=this.originalGeometry,Xe.prototype.raycast.call(this,e,r),this.geometry=this.subdividedGeometry??this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,r=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:o,v:i,q:s}=(0,Mf.SVD)(r),l=Df.set(o[0][0],o[0][1],o[0][2],0,o[1][0],o[1][1],o[1][2],0,o[2][0],o[2][1],o[2][2],0,0,0,0,1),c=zw.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),p=Uw.copy(c).transpose();this.shearScale=kw.makeScale(s[0],s[1],s[2]).multiply(p).premultiply(c),this.shearScaleInv=jw.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(l,p),s.every(a=>Math.abs(s[0]-a)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new If);let r=e.attributes.position,o=e.boundingSphere.center;kt.setFromBufferAttribute(r),kt.getCenter(o),e.boundingSphere.radius=o.distanceTo(kt.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),kt.getSize(Kr);let i={width:Kr.x,height:Kr.y,depth:Kr.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;kt.min.set(e[0],e[2],e[4]),kt.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(kt.min.applyMatrix4(this.shearScaleInv),kt.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new If);let o=r.boundingSphere.center;kt.getCenter(o),r.boundingSphere.radius=o.distanceTo(kt.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),kt.getSize(Kr);let i={width:Kr.x,height:Kr.y,depth:Kr.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(gc.free_bvh(this.subdivPointer),gc.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,Lf(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Lf(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters={...e.parameters}}};function Lf(n,t,e,r){let o=n.position.array,i=n.normal.array,s=Df.makeScale(t,e,r).invert().elements,l,c,p;for(var a=0,u=o.length;a<u;a+=3)o[a]*=t,o[a+1]*=e,o[a+2]*=r,l=i[a],c=i[a+1],p=i[a+2],i[a]=s[0]*l+s[4]*c+s[8]*p,i[a+1]=s[1]*l+s[5]*c+s[9]*p,i[a+2]=s[2]*l+s[6]*c+s[10]*p}import{BackSide as Hw,BufferGeometry as Ww,DoubleSide as qw,FrontSide as $w}from"three";function Bf(n,t){t.flatShading!==void 0&&(n.flatShading=t.flatShading,n.needsUpdate=!0),t.wireframe!==void 0&&(n.wireframe=t.wireframe),t.side!==void 0&&(t.side===0?n.side=$w:t.side===1?n.side=Hw:n.side=qw)}function Xw(n,t){if(Array.isArray(n.material))for(let e of n.material)Bf(e,t);else{let e=n.material;Bf(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function Ef(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=On.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new Ww:ta(t.geometry,e),i="materials"in t?t.materials.map(s=>e.material(s)):e.material(t.material);Is.is2DParametricMesh(o.userData.type)?r=new va(o,i):o?.userData.type==="VectorGeometry"?r=new an(o,i):t.geometry.type==="NonParametricGeometry"?r=new ba(o,i):t.geometry.type==="BooleanGeometry"?(r=new na(void 0,i),r.booleanOp=t.geometry.operation,t.geometry.phongAngle!==void 0&&(r.phongAngle=t.geometry.phongAngle)):r=new Cn(o,i),r.uuid=n,r.fromState(t,e)}return Xw(r,t),r}function Gf(n,t,e){return t.type==="Mesh"?Ef(n,t,e):t.type==="TextFrame"?mo.createFromState(n,t,e):t.type==="Empty"?io.createFromState(n,t):t.type==="PointLight"?fn.createFromState(n,t,e):t.type==="SpotLight"?hn.createFromState(n,t,e):t.type==="DirectionalLight"?mn.createFromState(n,t,e):Vo.is(t.type)?Tr.createFromState(n,t):(console.error(t),new io)}import{Mesh as Vf,Ray as Kw,Matrix4 as Qw,Raycaster as Zw}from"three";function Rf(n,t){let e=!1,r=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline");return o.length>0&&(n.layers.set(8),r.length>0&&n.layers.enable(3),e=!0,Wr(n),Hr(n)),r.length===0&&o.length===0&&n.layers.set(0),e}function Ff(n,t){if(!t.layers)return!1;let e=!1,r=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline");return r.length>0&&(n.layers.set(3),o.length>0&&n.layers.enable(8),e=!0),r.length===0&&o.length===0&&n.layers.set(0),e}function zf(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof Vf&&e.objectType!=="TextFrame")if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Rf(e,e.material[r])&&(t=!0);else Rf(e,e.material)&&(t=!0)}),t}function Uf(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof Vf)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Ff(e,e.material[r])&&(t=!0);else Ff(e,e.material)&&(t=!0)}),t}function kf(n){"material"in n&&Jw(n.material),"geometry"in n&&n.geometry.dispose()}function Jw(n){wc(n).forEach(t=>{t instanceof fo||t.dispose()})}var e1=new Zw,t1=new Qw,r1=new Kw;function jf(n,t,e){let r=n.cloner;if(r)for(let o of r.children){let i=t1.copy(o.matrixWorld).invert(),s=r1.copy(t.ray).applyMatrix4(i),l=n.matrixWorld;s.applyMatrix4(l);let c=e1;c.set(s.origin,s.direction),c.near=t.near,c.far=t.far,c.intersectObject(n,!1).length>0&&e.push({object:n})}}var Hf=new i1,yc=class extends Js(n1){constructor(e,r){super();this.objectType="Scene";this.backupFog=new s1(16777215,.1,2e3);this.fogUseBGColor=!1;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this.bgColor=new Ue(1,1,1,1);this.entityByUuid={};this.ambientLight=new o1(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.postprocessing=e.postprocessing,this.init(e,r)}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=Uf(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=zf(this),this.needsNormalDirty=!1),this._needsNormal}find(e){if(e===""||e===void 0)return;let r=this.entityByUuid[e];return r===void 0?this.getObjectByProperty("uuid",e):r}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,r){if(this.createChildrenObjects(e.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(Ve(e.backgroundColor,r)),this.updateFog(e.fog,r),this.updateAmbientLight(e.environment.ambientLight,r),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let o=this.find(e.publish.playCamera);o instanceof Tr&&this.switchActiveCamera(o)}this.traverse(o=>{Jt(o)&&o.recomputeBoolean()})}clearScene(){this.traverseEntity(e=>{kf(e)});for(let e of this.children)rr(e)&&e.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Tr.createFromState(yc.PERSONAL_CAMERA_ID,{...Ms.defaultData,name:"Personal Camera"});return e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let r=[],o=i=>{for(let s of i.children)rr(s)&&!s.raycastLock&&s.visible&&((Zt(s)||Zs(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,r),jf(s,e,r)),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)rr(r)&&r.traverseEntity(e)}traverseVisibleEntity(e){for(let r of this.children)rr(r)&&r.visible&&r.traverseVisibleEntity(e)}updateFog(e,r){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Ve(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}dispose(){this.clearScene()}updateAmbientLight(e,r){Cm(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=Ve(e.groundColor,r)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}createChildrenObjects(e,r,o){for(let i of e)this.createChildObject(i.id,i.data,i.children,r,o)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let r of e.children)this.unregisterObject(r)}createChildObject(e,r,o,i,s){let l=Gf(e,r,s);return l&&(this.entityByUuid[e]=l,i.add(l),Jt(i)&&Zt(l)&&(l.prevBooleanObjectParent=i),this.createChildrenObjects(o,l,s)),l}getCenter(e){let r=[];for(let i=0,s=e.length;i<s;++i){let{id:l,recursive:c}=e[i],p=this.find(l),a=c?p.recursiveBBox:p.singleBBox;r.push(...a.vertices)}let o=new a1;return o.setFromPoints(r),o.getCenter(Hf),Hf}copyMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e);o?r.copy(o.matrixWorld):r.identity()}copyParentMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e)?.parent;o?r.copy(o.matrixWorld):r.identity()}traverseMaterial(e){this.traverseEntity(r=>{if(r instanceof Xe)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof Ut&&e(r.material[o]);else r.material instanceof Ut&&e(r.material)})}updateCanvasSize(e,r){this.activeCamera.setViewplaneSize(e,r);let o,i;e>=r?(o=r/e,i=1):(o=1,i=e/r),this.traverseMaterial(s=>{s.getLayersOfType("transmission").forEach(c=>{c.uniforms[`f${c.id}_aspectRatio`].value.x=o,c.uniforms[`f${c.id}_aspectRatio`].value.y=i})})}},Pi=yc;Pi.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";import{Mesh as T5}from"three";import{mergeBufferGeometries as N5}from"three/examples/jsm/utils/BufferGeometryUtils.js";function Wf(n){let t;if(!!n.index)for(let e=0;e<n.index.array.length;e+=3)t=n.index.array[e],n.index.array[e]=n.index.array[e+2],n.index.array[e+2]=t}import{Color as qf,ShaderLib as l1}from"three";function $f(n){let t=new Set;return n.traverse(e=>{if(Zt(e))if(Me(e.material))e.material.forEach(r=>{let o=r;t.has(o)||t.add(o)});else{let r=e.material;t.has(r)||t.add(r)}}),t.forEach(e=>{if(e instanceof Array)return;let r=e.onBeforeCompile.bind(e);c1(e)?(Object.assign(e,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new qf,specularColor:new qf}),e.onBeforeCompile=(o,i)=>{r&&r(o,i),o.uniforms=Object.assign(l1.physical.uniforms,o.uniforms),e.getLayersOfType("transmission").forEach(s=>{o.uniforms.transmissionSamplerMap.value&&(s.uniforms["f"+s.id+"_transmissionSamplerMap"].value=o.uniforms.transmissionSamplerMap.value,s.uniforms["f"+s.id+"_transmissionSamplerSize"].value=o.uniforms.transmissionSamplerSize.value)})}):u1(e)||(e.onBeforeCompile=(o,i)=>{r&&r(o,i),e.transparent=!1})}),n}function c1(n){return n.getLayersOfType("transmission").length>0}function u1(n){let t=0;return n.layers.forEach(e=>{if(e.type!=="light"&&e.type!=="fresnel"){let r=e.uniforms["f"+e.id+"_alpha"];r&&(t+=(1-t)*r.value)}}),t<1}function Xf(n){return n.traverse(t=>{if(t.type==="Camera"){let e=t;e.type=e.cameraType}}),n}function Yf(n){let t=[],e=(r,o=0)=>{let i=o>0?r+o:r;return t.includes(i)?e(r,o+1):i};return n.traverse(r=>{if(t.includes(r.name)){let o=r.name,i=e(r.name);if(r.name=i,r.isMesh){let s=r;s.material instanceof Array?s.material.forEach(l=>{l.name=l.name.replace(o,i)}):s.material.isAsset||(s.material.name=s.material.name.replace(o,i))}}t.push(r.name)}),n}import{mergeBufferGeometries as p1}from"three/examples/jsm/utils/BufferGeometryUtils.js";function Kf(n){let t=[];return n.traverse(e=>{e instanceof no&&t.push(e)}),t.forEach(e=>{let r=e.object,i=e.children.map(l=>{l.updateMatrix();let c=l.geometry.clone().applyMatrix4(l.matrix);return l.matrix.determinant()<0&&Wf(c),c}),s=p1(e.parameters.hideBase?i:[r.geometry,...i]);r.geometry=s,r.remove(e),r.cloner=void 0}),n}function Qf(n){return n.traverse(t=>{t.matrixAutoUpdate=!0}),n}function Zf(n){Object.values(n.shared.materials).forEach(t=>{xc(t)}),n.scene.objects.traverse((t,e)=>{"material"in e?xc(e.material):"materials"in e&&e.materials.forEach(r=>{xc(r)})})}function xc(n){if(typeof n=="string")return;let t=[];n.layers.forEach((e,r)=>{e.type==="outline"&&t.push(r)}),t.reverse().forEach(e=>{n.layers.delete(e)}),t.length&&console.warn("The Spline Loader currently does not support the outline layer.")}var Jf="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",vc=class extends m1{load(t,e,r,o=console.error){let i=new d1(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(Jf+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(Jf),i.load(t,async s=>{try{if(typeof s=="string")throw new Error("The .spline file is not binary!");let l=await this.parse(s);e(l)}catch(l){o(l)}},r,o)}async parse(t){let e=await Nf(t,Zf),r=new Oi(e.shared);Object.values(r.getMaterials()).forEach(s=>Object.assign(s,{isAsset:!0}));let o=new Pi(e.scene,r);o.remove(o.personalCamera),e.scene.environment.ambientLight.enabled||o.remove(o.ambientLight);let i=e.scene.publish.playCamera;if(i){let s=o.find(i);s&&Am(s)&&Object.assign(s,{makeDefault:!0})}return o=Kf(o),o=$f(o),o=Xf(o),o=Yf(o),o=Qf(o),o}};export{vc as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splinetool/loader",
3
- "version": "0.9.87",
3
+ "version": "0.9.88",
4
4
  "type": "module",
5
5
  "main": "./build/SplineLoader.js",
6
6
  "module": "./build/SplineLoader.js",