@splinetool/loader 0.9.133 → 0.9.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/SplineLoader.cjs +1 -1
- package/build/SplineLoader.js +1 -1
- package/package.json +1 -1
package/build/SplineLoader.cjs
CHANGED
|
@@ -1331,7 +1331,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
1331
1331
|
|
|
1332
1332
|
return color.xyz;
|
|
1333
1333
|
|
|
1334
|
-
}`,[yt.simplex,e,o,s])}}();var Am=require("three");function Tm(n,t,e){n.setUvTransform(e[0],e[1],t[0],t[1],0,0,0)}var Ua=class extends Rn{constructor(e,r){super(new Am.Matrix3);this.repeat=e;this.offset=r;Tm(this.value,e,r)}updateMatrix(){Tm(this.value,this.repeat,this.offset)}};var Ir=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)_c(i,this,r)}get type(){return this.data.type}static create(t,e,r,o){if(r.type==="light")return Pr.createLigherLayer(t,e,r,o);if(r.type==="texture"){let i=o.image(r.texture.image),s=new Zi(i,r.texture.wrapping),l=new za(i),c=new Ua(r.texture.repeat,r.texture.offset),p=new Y(r.crop?1:0),a=new ve(r.projection??0),u=new ve(["x","y","z"].indexOf(r.axis)??0),d=new ve(r.side??0),f=new lt(r.size?new De.Vector2(r.size[0],r.size[1]):new De.Vector2(100,100)),m=new Y(r.alpha??1),h=new ve(r.mode??0),g=new ji(s,l,p,a,u,d,f,c,m,h),v=new Ae(g.calpha,"f");return new rt(t,e,r,{texture:s,textureSize:l,crop:p,projection:a,axis:u,side:d,size:f,mat:c,alpha:m,mode:h},g,h,v)}else if(r.type==="matcap"){let i=o.image(r.texture.image),s=new Zi(i,r.texture.wrapping),l=new Y(r.alpha??1),c=new ve(r.mode??0),p=new Qi(s,l,c),a=new Ae(p.calpha,"f");return new rt(t,e,r,{texture:s,alpha:l,mode:c},p,c,a)}else if(r.type==="displace")if(r.displacementType==="noise"){let i=new ft(new De.Vector3(...r.offset)),s=new Y(r.scale??10),l=new Y(r.intensity??8),c=new Y(r.movement??1),p=new ve(r.noiseType??0),a=new zi(l,c,i,s,p);return new es(t,e,r,{offset:i,scale:s,intensity:l,movement:c,noiseType:p},a)}else throw new Error;else return iw(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:wm(o.props,r,this,e)}else if(o.path[0]==="texture")return"texture"in e?wc(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}},rt=class extends Ir{constructor(e,r,o,i,s,l,c){super(e,r,o,i);this.color=s;this.mode=l;this.alpha=c}},es=class extends Ir{constructor(e,r,o,i,s){super(e,r,o,i);this.position=s}},Pr=class extends Ir{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 ve(o.mode),p;if(!o.visible)s=new Eo,p={};else if(o.category==="lambert"){s=new qi;let a=new Ie(i.color(o.emissive)??0);p={emissive:a},s.emissive=a}else if(o.category==="toon"){s=new Yi;let a=new Y(o.shininess??30),u=new Ie(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}else if(o.category==="physical"){s=new $i;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 Fa;let a=new Y(o.shininess??30),u=new Ie(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}return s.alpha=new Y(1),s.shadingAlpha=l,s.shadingBlend=c,p.alpha=s.shadingAlpha,p.mode=s.shadingBlend,new Pr(e,r,o,s,p)}};function Nm(n){let t=n instanceof Ir?n.type:n;return t==="texture"||t==="displace_map"||t==="matcap"}function nw(n,t,e,r){switch(n.type){case"color":{let o=new Ie(r.color??5855577),i=new Y(r.alpha??1),s=new Ae("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ve(r.mode??0);return o.alpha=i,new rt(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}case"fresnel":{let o=new Ie(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 ve(r.mode??0),u=new Bi(o,i,s,l,c,p,a),d=new Ae(u.calpha,"f");return new rt(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 ft(r.wavelengths??new De.Vector3(0,0,0)),l=new Y(r.noiseStrength??0),c=new Y(r.noiseScale??1),p=new ft(r.offset??new De.Vector3(0,0,0)),a=new Y(r.alpha??1),u=new Di(o,i,s,l,c,p,a),d=new Ae(u.calpha,"f"),f=new ve(r.mode??0);return new rt(t,e,n,{filmThickness:o,movement:i,wavelengths:s,noiseStrength:l,noiseScale:c,offset:p,alpha:a,mode:f},u,f,d)}case"transmission":{let o=new Y(r.thickness??10),i=new Y(r.ior??1.5),s=new Y(r.roughness??.5),l=mt.transmissionSize,c=mt.transmissionRenderTarget,p=mt.transmissionRenderTargetDepth,a=window.innerWidth,u=window.innerHeight,d=a>=u?new lt(u/a,1):new lt(1,a/u),f=new Y(r.alpha??1),m=new Ri(o,i,s,l,c,p,d,f),h=new Ae(m.calpha,"f"),g=new ve(r.mode??0);return new rt(t,e,n,{thickness:o,ior:i,roughness:s,aspectRatio:d,alpha:f,mode:g},m,g,h)}case"toon":{let o=new ve(r.positioning??0),i;r.colors?i=new nr(r.colors.length,r.colors):(i=new nr(10,new De.Vector4(0,0,0,1)),i.value[1]=new De.Vector4(1,1,1,1));let s;r.steps?s=new or(r.steps.length,r.steps):(s=new or(10,1),s.value[0]=0);let l=new ft(r.source??new De.Vector3(0,0,0)),c=new co(r.isWorldSpace??!0),p=new Y(r.noiseStrength??0),a=new Y(r.noiseScale??1),u=new Xt(r.shadowColor),d=new ft(r.offset??new De.Vector3(0,0,0)),f=new Y(r.alpha??1),m=new Ji(o,i,s,l,c,p,a,u,d,f),h=new Ae(m.calpha,"f"),g=new ve(r.mode??0);return new rt(t,e,n,{positioning:o,colors:i,steps:s,source:l,isWorldSpace:c,noiseStrength:p,noiseScale:a,shadowColor:u,offset:d,alpha:f,mode:g},m,g,h)}case"outline":{let o=new Ie(r.outlineColor??16777215),i=new Ie(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 ft(r.contourDirections??new De.Vector3(0,1,0)),f=new co(r.positionalLines??!1),m=new co(r.compensation??!0),h=mt.normalRenderTarget,g=mt.normalRenderTargetDepth,v=mt.pixelRatioNode,x=mt.resolution,w=new Y(r.alpha??1),S=new Gi(o,i,s,l,c,p,a,u,d,f,m,x,h,g,v,w),b=new Ae(S.calpha,"f"),I=new ve(r.mode??0);return new rt(t,e,n,{outlineColor:o,contourColor:i,outlineWidth:s,contourWidth:l,outlineThreshold:c,contourThreshold:p,outlineSmoothing:a,contourFrequency:u,contourDirection:d,positionalLines:f,compensation:m,alpha:w,mode:I},S,I,b)}case"depth":{let o=new ve(r.gradientType??0),i=new co(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 ft(r.origin??new De.Vector3),u=new ft(r.direction??new De.Vector3),d;r.colors?d=new nr(r.colors.length,r.colors):(d=new nr(2,new De.Vector4(0,0,0,1)),d.value[1]=new De.Vector4(1,1,1,1));let f;r.steps?f=new or(r.steps.length,r.steps):(f=new or(2,1),f.value[0]=0);let m=new Y(r.alpha??1),h=new ve(r.mode??0),g=new Vi(o,i,s,l,c,p,a,u,d,f,m),v=new Ae(g.calpha,"f");return new rt(t,e,n,{gradientType:o,smooth:i,near:s,far:l,isVector:c,isWorldSpace:p,origin:a,direction:u,colors:d,steps:f,alpha:m,mode:h},g,h,v)}case"noise":{let o=new Y(r.scale??1),i=new ft(r.size??new De.Vector3(100,100,100)),s=new Y(r.move??1),l=new lt(r.fA??new De.Vector2(1.7,9.2)),c=new lt(r.fB??new De.Vector2(8.3,2.8)),p=new lt(r.distortion??new De.Vector2(1,1)),a=new Xt(r.colorA),u=new Xt(r.colorB),d=new Xt(r.colorC),f=new Xt(r.colorD),m=new Y(r.alpha??1),h=new ve(r.mode??0),g=new ve(r.noiseType??0),v=new Mi(o,i,s,l,c,p,a,u,d,f,m,g),x=new Ae(v.calpha,"f");return new rt(t,e,n,{scale:o,size:i,move:s,fA:l,fB:c,distortion:p,colorA:a,colorB:u,colorC:d,colorD:f,alpha:m,mode:h,noiseType:g},v,h,x)}case"normal":{let o=new ft(r.cnormal??new De.Vector3(1,1,1)),i=new Y(r.alpha??1),s=new ve(r.mode??0),l=new Hi(o,i),c=new Ae("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return c.keywords.alpha=i,new rt(t,e,n,{cnormal:o,alpha:i,mode:s},l,s,c)}case"gradient":{let o=new ve(r.gradientType??0),i=new co(r.smooth??!1),s;r.colors?s=new nr(r.colors.length,r.colors):(s=new nr(10,new De.Vector4(0,0,0,1)),s.value[1]=new De.Vector4(1,1,1,1));let l;r.steps?l=new or(r.steps.length,r.steps):(l=new or(10,1),l.value[0]=0);let c=new lt(r.offset??new De.Vector2(0,0)),p=new lt(r.morph??new De.Vector2(0,0)),a=new Y(r.angle??0),u=new Y(r.alpha??1),d=new ve(r.mode??0),f=new Ui(o,i,s,l,c,p,a,u),m=new Ae(f.calpha,"f");return new rt(t,e,n,{gradientType:o,smooth:i,colors:s,steps:l,offset:c,morph:p,angle:a,alpha:u,mode:d},f,d,m)}default:{let o=new Ie(1,0,0,1),i=new Y(1),s=new Ae("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ve(0);return o.alpha=i,new rt(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}}}function iw(n,t,e,r){let o=ym(e,r);return nw(e,n,t,o)}function _c(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 Ft=class extends ja.ShaderMaterial{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??Rt.defaultTwoLayerData("phong").layers;this.layers=o.map(i=>Ir.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 Pr),this.lightLayer===void 0&&(this.lightLayer=new Pr(0,"",{...fr.defaultData("light","phong"),visible:!1},new Eo,{})),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=Ir.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=Ir.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 rt),r=this.layers.findIndex(o=>o instanceof Pr);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 rt&&(o=new Fi(o,s.color,s.alpha,s.mode))}this.fragment.color=o}else this.fragment.color=void 0}blendAfterColors(){let e=new Ae("outgoingLight","f"),r=this.layers.findIndex(o=>o instanceof Pr);if(this.layers.length>r+1){for(let o=r+1;o<this.layers.length;++o){let i=this.layers[o];i instanceof rt&&(e=new Fi(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 es);if(e.length>0){let r=e[0].position;for(let o=1;o<e.length;++o)e[o]&&(r=new Ct(r,e[o].position,Ct.ADD),r=new Ct(r,new Y(.5).setReadonly(!0),Ct.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(){let e="[";for(let{data:r}of this.data.layers)if(r.type==="light")e+=`"${r.visible?r.category.toUpperCase():"Basic"}"`;else{let o=(bc[r.type]??[]).map(l=>r[l]),i=(Sc[r.type]??[]).map(l=>r[l]?.length??0),s=[...o,...i];s.length?e+=`["${r.type}", "${s.join('","')}"],`:e+=`"${r.type}",`}return e=e.slice(0,-1)+"]",e}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 Ra;return this.lights=this.lightLayer.data.visible,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>ja.NormalBlending,this}dispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(Ft.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 zt=require("three");function sw(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position||!n.geometry.attributes.normal)return;let t=new Map,e=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,o=new Float32Array(e.length);for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=new zt.Vector3(r[i],r[i+1],r[i+2]);t.has(s)?t.get(s)?.normals.push(l):t.set(s,{normals:[l],result:new zt.Vector3})}t.forEach((i,s)=>{for(let l of i.normals)i.result.add(l);i.result.divideScalar(i.normals.length)});for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=t.get(s)?.result;l&&(o[i]=l.x,o[i+1]=l.y,o[i+2]=l.z)}n.geometry.setAttribute("extrudeNormal",new zt.Float32BufferAttribute(o,3))}function aw(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=new zt.Vector3;for(let o=0;o<t.length;o+=3)r.set(t[o],t[o+1],t[o+2]).normalize(),e[o]=r.x,e[o+1]=r.y,e[o+2]=r.z;n.geometry.setAttribute("extrudeNormal",new zt.Float32BufferAttribute(e,3))}function Or(n){if(Array.isArray(n.material)){for(let t of n.material)if(t.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof Ft)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"||n.objectType==="TextFrame"&&n.data?.geometry?.depth===0?aw(n):sw(n)}function Cr(n){if(!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=parseInt(n.uuid.replace(/\D/g,"")),o=[zt.MathUtils.seededRandom(r),zt.MathUtils.seededRandom(r+1e4),zt.MathUtils.seededRandom(r+2e4)];for(let i=0;i<t.length;i++)e[i]=o[i%3];n.geometry.setAttribute("randomColor",new zt.BufferAttribute(e,3))}var ut=class extends $t(ka.Mesh){constructor(e,r){super(e,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new ka.Matrix4;this.booleanExclude=null;Array.isArray(r)&&e.groups.length===0&&e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(e){}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}updateGeometry(e,r){let o=this.geometry,i=tc[o.userData.type],s=this.objectType==="NonParametric"?Object.assign({},o.userData,{geometry:o}):o.userData,l=i.build(i.normalizeInputs(e,s)),c=o.uuid;this.geometry.dispose(),this.geometry=l,this.geometry.uuid=c,this.geometry.computeBoundingSphere(),Or(this),o.getAttribute("randomColor")&&Cr(this)}clone(e){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,o=Ni(r),i=this.material;return new this.constructor(o,i).copy(this,e)}copy(e,r=!0){return super.copy(e,r),e.cloner&&(this.cloner=new No(e,e.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new No(this)),this.cloner.fromClonerState(e))}fromState(e,r){return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=e.castShadow??!0,this.receiveShadow=e.receiveShadow??!0,this.booleanExclude=e.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Jt.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),br(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)vr(e)&&(e.freeBooleanPointer(),br(e)&&e.invalidateUpstreamBooleanData())}};var lw=new fo.Vector3(0,0,1),Im=new fo.Vector3,Pm=new fo.Vector3,Om=new fo.Matrix3,jn=class extends ut{constructor(e=dt.create({}),r){super(e,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new fo.EventDispatcher;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e,r){if(super.updateGeometry(e,r),"userData"in this.geometry){let o=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:o})}}setShape(e){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=e,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),Om.getNormalMatrix(this.matrixWorld),Im.copy(lw).applyMatrix3(Om).normalize(),Pm.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Im,Pm)}clone(e){let r=this.shape.clone(),o=this.material,i=this.geometry.userData,s=dt.create(Object.assign({},i,{shape:r})),l=new jn(s,o).copy(this,e);return l.shape=r,r.update(),l}raycast(e,r){ut.prototype.raycast.call(this,e,r)}};var Lr=(n,t)=>class extends n{constructor(){super(...arguments);this.objectHelper=new t(this)}get geometryHelper(){return t.geometryHelper}raycast(o,i){this.objectHelper.raycast(o,i)}fromLightState(o,i){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;o.color!==void 0&&(s.color=st(o.color,i)),o.intensity!==void 0&&(s.intensity=o.intensity),o.depth!==void 0&&(s.shadow.camera.far=o.depth,s.shadow.needsUpdate=!0),o.shadows!==void 0&&(this.castShadow=o.shadows)}return this}};var kn=new ze.Vector3,Nc=new ze.Vector3,Ur=class extends Lr($t(ze.Camera),ga){constructor(e=window.innerWidth,r=window.innerHeight,o=45,i,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=r,this.orthoCamera=new ze.OrthographicCamera(e*-.5,e*.5,r*.5,r*-.5,i??-5e4,s),this.perspCamera=new ze.PerspectiveCamera(o,e/r,i??50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(e,r){let o=new Ur().fromState(r);return o.objectHelper.update(),o.uuid=e,o}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(kn),this.targetOffset=kn.distanceTo(e)}getTarget(e=new ze.Vector3){return this.getWorldDirection(Nc),this.getWorldPosition(kn),Nc.multiplyScalar(this.targetOffset),e.copy(kn).add(Nc),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(kn),kn.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new ze.Quaternion),r=new ze.Vector3(0,0,1).applyQuaternion(e),o=new ze.Vector3().copy(ze.Object3D.DefaultUp);this.isUpVectorFlipped&&o.negate(),o.applyQuaternion(e);let i=new ze.Vector3().copy(ze.Object3D.DefaultUp).projectOnPlane(r),s=new ze.Vector3().crossVectors(i,o).dot(r)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(o)*s}getViewFrontToObject(e){let r=e.getWorldPosition(new ze.Vector3),i=e.getWorldDirection(new ze.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){let r=e.getWorldPosition(new ze.Vector3),i=this.getWorldDirection(new ze.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,r){this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=e/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,o,i,s,l){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,o,i,s,l):this.orthoCamera.setViewOffset(e,r,o,i,s,l)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return fn(r,e)}fromCameraState(e){let{orthographic:r,perspective:o}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),o!==void 0&&(o.near!==void 0&&(this.perspCamera.near=o.near),o.fov!==void 0&&(this.perspCamera.fov=o.fov),o.zoom!==void 0&&(this.perspCamera.zoom=o.zoom)),e.type==="PerspectiveCamera"?(this.zoom=this.perspCamera.zoom,this.fov=this.perspCamera.fov,this.near=this.perspCamera.near):(this.near=this.orthoCamera.near,this.zoom=this.orthoCamera.zoom),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};var ts=require("three");var Cm=new ts.Matrix4;var Ha=class extends ut{constructor(e=new ts.BufferGeometry,r){super(e,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];br(s)&&s.recomputeBoolean(e===!0,r)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(lm(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5&&(s.booleanMeshSetAddress=Jt.getMeshSet(s.geometry,e===!0,r)),s.booleanMeshSetAddress===-1)return;Jt.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else br(s)&&s.needsTransformForDownstream===!0?(Jt.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Cm.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Jt.transformMeshSet(s.booleanMeshSetAddress,Cm),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(e===!0)return Jt.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let o=this.geometry;o.dispose(),this.geometry=new ts.BufferGeometry,this.geometry.userData=o.userData,this.geometry.boundingSphere=o.boundingSphere;try{this.booleanMeshSetAddress=Jt.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Or(this),Cr(this)}updateGeometry(e,r){let o=e.parameters;o.operation!==void 0&&(this.booleanOp=o.operation),o.phongAngle!==void 0&&(this.phongAngle=o.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var Lm=require("three");var Do=class extends Lr($t(Lm.Group),yn){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,r){let o=new Do().fromState(r);return o.uuid=e,o.objectHelper.update(),o}};var Go=require("three");var Hn=class extends Lr($t(Go.DirectionalLight),gn){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=-1e4,o.far=2500;let i=new Go.CameraHelper(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Hn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Go.CameraHelper&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Go.CameraHelper&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Go.CameraHelper&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(e,r){let o=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,r),e.size!==void 0&&im(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),o&&this.update(),this}fromState(e,r){return super.fromState(e),this.fromDirectionalLightState(e,r),this}};var xt=require("three");var Wn=class extends Lr($t(xt.PointLight),xn){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;let i=new xt.Vector3(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new xt.Vector3(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z),l=new xt.Box3(i,s),c=new xt.Box3Helper(l,new xt.Color(16755200));c.visible=!1,this._gizmos.shadowmap=c,this.update()}static createFromState(e,r,o){let i=new Wn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof xt.Box3Helper&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof xt.Box3Helper&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let r=this._gizmos[e];if(r instanceof xt.Box3Helper){let o=this.shadow.camera,i=new xt.Vector3(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new xt.Vector3(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z);r.box.set(i,s),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromPointLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromPointLightState(e,r),this}};var Mt=require("three");var Mm=new Mt.Vector3,Em=new Mt.Vector3,Bm=new Mt.Quaternion,qn=class extends Lr($t(Mt.SpotLight),gi){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=Mt.MathUtils.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let i=new Mt.CameraHelper(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new qn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Mt.CameraHelper&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Mt.CameraHelper&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Mt.CameraHelper&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Em.setFromMatrixPosition(this.matrixWorld),Bm.setFromRotationMatrix(this.matrixWorld),Mm.copy(this.up).applyQuaternion(Bm).negate().multiplyScalar(this.distance),this.target.position.copy(Em).add(Mm),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromSpotLightState(e,r),this}};var Dm=n=>n.tagName==="VIDEO",$n=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;Dm(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];Nm(s)&&$n.resizeTextureLayer(t,e,s.uniforms[`f${s.id}_texture`].value)}}static resizeComplex(t,e,r,o){let i=t/e,s,l=r.image;Dm(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 Wa=class extends ut{constructor(e,r){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e,r){super.updateGeometry(e,r),this.material.layers&&$n.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Xn=class extends ut{constructor(e,r){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var qa=class extends Xn{constructor(e,r){super(e,r);this.objectType="NonParametric"}};var Rm,os=new Promise(n=>{Rm=n}),Gm=!1;async function Vm(){if(Gm)return;let n=await import("./opentype.js");Rm(n),Gm=!0}var ns=class{async load(t,e,r=()=>{}){let{load:o}=await os;o(t,(i,s)=>{i||!s?r(i??"Something went wrong"):e(s)})}async parse(t){let{parse:e}=await os;try{return e(t)}catch(r){console.error(r)}}};async function cw(n){return await(await fetch(n)).arrayBuffer()}var uw=new ns;async function Ic(n){let t,e,r=!1;if(n.url?(t=await cw(n.url),e=n.url,r=n.url.startsWith("/")):n.data&&(t=n.data.buffer),t){let o=await uw.parse(t);if(o)return{font:o,url:e,intercepted:r,arr:t}}}var Yn=require("three");var Fm=new Yn.Vector3,zm=new Yn.Matrix4,Um=new Yn.Ray;function jm(n){let t=!1;return n.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="TextGeometry"&&(t=!0)}),t}var $a=class extends ut{constructor(e,r,o){super(new On(r.geometry,o),o.material(r.material));this.data=r;this.objectType="TextFrame";this.wrappedText=[""];this.charWidths=[];this.charCoords=[];this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.name=r.name,this.uuid=e,this.updateState(r,o)}async updateGeometry(e,r){let o=e.parameters,i={...this.geometry.userData.parameters,...o};this.geometry.userData={parameters:i,type:"TextGeometry"},r&&(o.font||!this.geometry.font&&r.getFont(i.font))&&await this.geometry.updateFont(o.font??i.font,r),await this.geometry.update(i),Or(this),Cr(this);let{wrappedText:s,charCoords:l,charWidths:c}=this.geometry;this.wrappedText=s,this.charWidths=c,this.charCoords=l,this.resetBBoxNeedsUpdate()}updateState(e,r){this.data=e,this.material=r.material(e.material),this.fromState(e,r),this.updateGeometry({parameters:e.geometry},r)}get font(){return this.geometry.font}get initialOffsetY(){return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,this.geometry.userData.parameters.height,this.fontScale,this.geometry.userData.parameters.verticalAlign)??0}get fontScale(){return this.font?this.geometry.userData.parameters.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){return this.geometry.userData.parameters.fontSize*this.geometry.userData.parameters.lineHeight}raycast(e,r){let{matrixWorld:o}=this;if(zm.copy(o).invert(),Um.copy(e.ray).applyMatrix4(zm),Um.intersectBox(this.singleBBox,Fm)){let i=Fm.applyMatrix4(o),s=e.ray.origin.distanceTo(i);r.push({distance:s,point:i.clone(),object:this})}}};var wt=require("three");var qm=tl(Hm());var Pc;Pa.then(n=>{Pc=n});var $m=new wt.Matrix4,pw=new wt.Matrix4,dw=new wt.Matrix4,ir=new wt.Box3,mo=new wt.Vector3,fw=new wt.Matrix4,mw=new wt.Matrix4;var Kn=class extends ut{constructor(e,r,o,i){super(o??r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new wt.Matrix4;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new wt.Matrix4;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:l}=qt.build(r.geometry,void 0,void 0,!r.flatShading),c=o.material(r.material),p=new Kn(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}=qt.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,Or(this),Cr(this),e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){qt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&qt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=qt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=qt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(e,r){this.geometry=this.originalGeometry,ut.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,qm.SVD)(r),l=$m.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=pw.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=dw.copy(c).transpose();this.shearScale=fw.makeScale(s[0],s[1],s[2]).multiply(p).premultiply(c),this.shearScaleInv=mw.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 wt.Sphere);let r=e.attributes.position,o=e.boundingSphere.center;ir.setFromBufferAttribute(r),ir.getCenter(o),e.boundingSphere.radius=o.distanceTo(ir.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ir.getSize(mo);let i={width:mo.x,height:mo.y,depth:mo.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;ir.min.set(e[0],e[2],e[4]),ir.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(ir.min.applyMatrix4(this.shearScaleInv),ir.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new wt.Sphere);let o=r.boundingSphere.center;ir.getCenter(o),r.boundingSphere.radius=o.distanceTo(ir.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ir.getSize(mo);let i={width:mo.x,height:mo.y,depth:mo.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(Pc.free_bvh(this.subdivPointer),Pc.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e,r){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,Wm(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Wm(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 Wm(n,t,e,r){let o=n.position.array,i=n.normal.array,s=$m.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}var ho=require("three");function Xm(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=ho.FrontSide:t.side===1?n.side=ho.BackSide:n.side=ho.DoubleSide)}function hw(n,t){if(Array.isArray(n.material))for(let e of n.material)Xm(e,t);else{let e=n.material;Xm(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function Ym(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=Kn.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new ho.BufferGeometry:Oa(t.geometry,e),i="materials"in t?t.materials.map(s=>e.material(s)):e.material(t.material);Es.is2DParametricMesh(o.userData.type)?r=new Wa(o,i):o?.userData.type==="VectorGeometry"?r=new jn(o,i):t.geometry.type==="NonParametricGeometry"?r=new qa(o,i):t.geometry.type==="BooleanGeometry"?(r=new Ha(void 0,i),r.booleanOp=t.geometry.operation,t.geometry.phongAngle!==void 0&&(r.phongAngle=t.geometry.phongAngle)):r=new Xn(o,i),r.uuid=n,r.fromState(t,e)}return hw(r,t),r}function Km(n,t,e){return t.type==="Mesh"?t.geometry.type==="TextGeometry"?new $a(n,t,e):Ym(n,t,e):t.type==="Empty"?Do.createFromState(n,t):t.type==="PointLight"?Wn.createFromState(n,t,e):t.type==="SpotLight"?qn.createFromState(n,t,e):t.type==="DirectionalLight"?Hn.createFromState(n,t,e):Wo.is(t.type)?Ur.createFromState(n,t):(console.error(t),new Do)}var Ro=class extends Ft{};var jr=require("three");function Qm(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,Cr(n),Or(n)),r.length===0&&o.length===0&&n.layers.set(0),e}function Zm(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 Jm(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof jr.Mesh)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Qm(e,e.material[r])&&(t=!0);else Qm(e,e.material)&&(t=!0)}),t}function eh(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof jr.Mesh)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Zm(e,e.material[r])&&(t=!0);else Zm(e,e.material)&&(t=!0)}),t}function th(n){"material"in n&&yw(n.material),"geometry"in n&&n.geometry.dispose()}function yw(n){Bd(n).forEach(t=>{t instanceof Ro||t.dispose()})}var xw=new jr.Raycaster,vw=new jr.Matrix4,bw=new jr.Ray;function rh(n,t,e){let r=n.cloner;if(r)for(let o of r.children){let i=vw.copy(o.matrixWorld).invert(),s=bw.copy(t.ray).applyMatrix4(i),l=n.matrixWorld;s.applyMatrix4(l);let c=xw;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 oh=new Mr.Vector3,Oc=class extends Ea(Mr.Scene){constructor(e,r){super();this.objectType="Scene";this.backupFog=new Mr.Fog(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 tt(1,1,1,1);this.entityByUuid={};this.ambientLight=new Mr.HemisphereLight(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),this.matrixAutoUpdate=!1}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=eh(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=Jm(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(st(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 Ur&&this.switchActiveCamera(o)}this.traverse(o=>{br(o)&&o.recomputeBoolean()})}clearScene(){this.traverseEntity(e=>{th(e)});for(let e of this.children)wr(e)&&e.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Ur.createFromState(Oc.PERSONAL_CAMERA_ID,{...aa.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)wr(s)&&!s.raycastLock&&s.visible&&((vr(s)||La(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,r),rh(s,e,r)),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)wr(r)&&r.traverseEntity(e)}traverseVisibleEntity(e){for(let r of this.children)wr(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=st(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}dispose(){this.clearScene()}updateAmbientLight(e,r){nm(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=st(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=Km(e,r,s);return l&&(this.entityByUuid[e]=l,i.add(l),br(i)&&vr(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 Mr.Box3;return o.setFromPoints(r),o.getCenter(oh),oh}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 ut)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof Ft&&e(r.material[o]);else r.material instanceof Ft&&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})})}},is=Oc;is.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var ah=tl(nh());var ih=new Map;function sh(n){if(typeof n=="string")return n;let t=ih.get(n);return t||(t={url:URL.createObjectURL(new Blob([n]))},ih.set(n,t)),t.url}var Qn=class{constructor({src:t,volume:e,delay:r,loop:o}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let i;typeof t=="string"?i={src:t}:i={src:sh(t),format:"wav"},this.sound=new ah.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 status(){return this._status}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}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}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._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}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 ot=require("three"),Ka=class{constructor(){this.type="ShapePath";this.color=new ot.Color;this.subPaths=[];this.currentPath=null}moveTo(t,e){return this.currentPath=new ot.Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,r,o){return this.currentPath?.quadraticCurveTo(t,e,r,o),this}bezierCurveTo(t,e,r,o,i,s){return this.currentPath?.bezierCurveTo(t,e,r,o,i,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let e={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},r={loc:e.ORIGIN,t:0};function o(h,g,v,x){let w=h.x,S=g.x,b=v.x,I=x.x,_=h.y,y=g.y,P=v.y,A=x.y,O=(I-b)*(_-P)-(A-P)*(w-b),T=(S-w)*(_-P)-(y-_)*(w-b),L=(A-P)*(S-w)-(I-b)*(y-_),B=O/L,j=T/L;if(L===0&&O!==0||B<=0||B>=1||j<0||j>1)return null;if(O===0&&L===0){for(let te=0;te<2;te++)if(i(te===0?v:x,h,g),r.loc===e.ORIGIN){let ne=te===0?v:x;return{x:ne.x,y:ne.y,t:r.t}}else if(r.loc===e.BETWEEN){let ne=+(w+r.t*(S-w)).toPrecision(10),ae=+(_+r.t*(y-_)).toPrecision(10);return{x:ne,y:ae,t:r.t}}return null}else{for(let ae=0;ae<2;ae++)if(i(ae===0?v:x,h,g),r.loc===e.ORIGIN){let U=ae===0?v:x;return{x:U.x,y:U.y,t:r.t}}let te=+(w+B*(S-w)).toPrecision(10),ne=+(_+B*(y-_)).toPrecision(10);return{x:te,y:ne,t:B}}}function i(h,g,v){let x=v.x-g.x,w=v.y-g.y,S=h.x-g.x,b=h.y-g.y,I=x*b-S*w;if(h.x===g.x&&h.y===g.y){r.loc=e.ORIGIN,r.t=0;return}if(h.x===v.x&&h.y===v.y){r.loc=e.DESTINATION,r.t=1;return}if(I<-Number.EPSILON){r.loc=e.LEFT;return}if(I>Number.EPSILON){r.loc=e.RIGHT;return}if(x*S<0||w*b<0){r.loc=e.BEHIND;return}if(Math.sqrt(x*x+w*w)<Math.sqrt(S*S+b*b)){r.loc=e.BEYOND;return}let _;x!==0?_=S/x:_=b/w,r.loc=e.BETWEEN,r.t=_}function s(h,g){let v=[],x=[];for(let w=1;w<h.length;w++){let S=h[w-1],b=h[w];for(let I=1;I<g.length;I++){let _=g[I-1],y=g[I],P=o(S,b,_,y);P!==null&&v.find(A=>A.t<=P.t+Number.EPSILON&&A.t>=P.t-Number.EPSILON)===void 0&&(v.push(P),x.push(new ot.Vector2(P.x,P.y)))}}return x}function l(h,g,v){let x=new ot.Vector2;g.getCenter(x);let w=[];return v.forEach(S=>{S.boundingBox.containsPoint(x)&&s(h,S.points).forEach(I=>{w.push({identifier:S.identifier,isCW:S.isCW,point:I})})}),w.sort((S,b)=>S.point.x-b.point.x),w}function c(h,g,v,x,w){(w==null||w==="")&&(w="nonzero");let S=new ot.Vector2;h.boundingBox.getCenter(S);let b=[new ot.Vector2(v,S.y),new ot.Vector2(x,S.y)],I=l(b,h.boundingBox,g);I.sort((T,L)=>T.point.x-L.point.x);let _=[],y=[];I.forEach(T=>{T.identifier===h.identifier?_.push(T):y.push(T)});let P=_[0].point.x,A=[],O=0;for(;O<y.length&&y[O].point.x<P;)A.length>0&&A[A.length-1]===y[O].identifier?A.pop():A.push(y[O].identifier),O++;if(A.push(h.identifier),w==="evenodd"){let T=A.length%2===0,L=A[A.length-2];return{identifier:h.identifier,isHole:T,for:L}}else if(w==="nonzero"){let T=!0,L=null,B=null;for(let j=0;j<A.length;j++){let te=A[j];g[te]&&(T?(B=g[te].isCW,T=!1,L=te):B!==g[te].isCW&&(B=g[te].isCW,T=!0))}return{identifier:h.identifier,isHole:T,for:L}}else console.warn('fill-rule: "'+w+'" is currently not implemented.')}let p=0,a=999999999,u=-999999999,d=[];this.subPaths.forEach(h=>{let g=h.getPoints(),v=-999999999,x=999999999,w=-999999999,S=999999999;for(let b=0;b<g.length;b++){let I=g[b];I.y>v&&(v=I.y),I.y<x&&(x=I.y),I.x>w&&(w=I.x),I.x<S&&(S=I.x)}u<=w&&(u=w+1),a>=S&&(a=S-1),g.length&&d.push({curves:h.curves,points:g,isCW:ot.ShapeUtils.isClockWise(g),identifier:p++,boundingBox:new ot.Box2(new ot.Vector2(S,x),new ot.Vector2(w,v))})});let f=d.map(h=>c(h,d,a,u,this.userData?.style.fillRule)),m=[];return d.forEach(h=>{let g=f[h.identifier];if(g&&!g.isHole){let v=new ot.Shape;v.curves=h.curves,f.filter(w=>w?.isHole&&w.for===h.identifier).forEach(w=>{if(w){let S=d[w.identifier],b=new ot.Path;b.curves=S.curves,v.holes.push(b)}}),m.push(v)}}),m}};var Zn=require("three");var lh=require("three/examples/jsm/loaders/DRACOLoader.js");var go;function Sw(){return go||(go=new lh.DRACOLoader,go.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),go.decoderPending}async function ww(n){if(go){let t={attributeIDs:go.defaultAttributeIDs,attributeTypes:go.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await go.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 ch(n,t){let[e,r]=il(Is.deserialize(new Uint8Array(n)));Ud(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 Sw();for(let i of o){let s=await ww(Tt(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}function _w(n,t){return t.state.glyphIndex===n||t.state.fina===n||t.state.medi===n||t.state.init===n}var Qa=class{constructor(t,e){this._arrayBuffer=new ArrayBuffer(1);this._isLoaded=!1;this._intercepted=!1;this._isUserFont=t.isUserFont??!1,this._loadingPromise=Ic(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}update(t,e){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=Ic(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}async reverseLigaturesTable(t,e,r){let{Bidi:o}=await os,i=new o,s=u=>t.charToGlyphIndex(u.char);i.registerModifier("glyphIndex",null,s),i.applyFeatures(t,t.defaultRenderOptions.features),i.getTextGlyphs(e);let l=i.tokenizer.tokens,c=[],p=0,a=r.length===l.length;for(let u=0;u<r.length;u++){let d=r[u].index,f=String.fromCharCode(r[u].unicode),m=l[p];if(_w(d,m)||a)c.push({char:f,index:d,replacements:[m.state.glyphIndex],replacementChars:[m.char]}),p++;else{let h=m.char,g="",v=[m.state.glyphIndex],x=[],w=!1;for(;!w;)p++,g=e.charAt(p),h+=g,v.push(t.charToGlyphIndex(g)),x=t.stringToGlyphs(h),x.length===1&&x[0].index===d&&(w=!0),p>e.length&&(w=!0);c.push({char:f,index:d,replacements:v,replacementChars:Array.from(h)}),p++}}return c}async generateShapes(t,e){await this._loadingPromise;let r=this.font,o=e.fontSize/this.unitsPerEm,i=e.fontSize*e.lineHeight,s=t.map(x=>this.getTextWidth(x,e)),l=e.width,c=this.getCharWidth(`
|
|
1334
|
+
}`,[yt.simplex,e,o,s])}}();var Am=require("three");function Tm(n,t,e){n.setUvTransform(e[0],e[1],t[0],t[1],0,0,0)}var Ua=class extends Rn{constructor(e,r){super(new Am.Matrix3);this.repeat=e;this.offset=r;Tm(this.value,e,r)}updateMatrix(){Tm(this.value,this.repeat,this.offset)}};var Ir=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)_c(i,this,r)}get type(){return this.data.type}static create(t,e,r,o){if(r.type==="light")return Pr.createLigherLayer(t,e,r,o);if(r.type==="texture"){let i=o.image(r.texture.image),s=new Zi(i,r.texture.wrapping),l=new za(i),c=new Ua(r.texture.repeat,r.texture.offset),p=new Y(r.crop?1:0),a=new ve(r.projection??0),u=new ve(["x","y","z"].indexOf(r.axis)??0),d=new ve(r.side??0),f=new lt(r.size?new De.Vector2(r.size[0],r.size[1]):new De.Vector2(100,100)),m=new Y(r.alpha??1),h=new ve(r.mode??0),g=new ji(s,l,p,a,u,d,f,c,m,h),v=new Ae(g.calpha,"f");return new rt(t,e,r,{texture:s,textureSize:l,crop:p,projection:a,axis:u,side:d,size:f,mat:c,alpha:m,mode:h},g,h,v)}else if(r.type==="matcap"){let i=o.image(r.texture.image),s=new Zi(i,r.texture.wrapping),l=new Y(r.alpha??1),c=new ve(r.mode??0),p=new Qi(s,l,c),a=new Ae(p.calpha,"f");return new rt(t,e,r,{texture:s,alpha:l,mode:c},p,c,a)}else if(r.type==="displace")if(r.displacementType==="noise"){let i=new ft(new De.Vector3(...r.offset)),s=new Y(r.scale??10),l=new Y(r.intensity??8),c=new Y(r.movement??1),p=new ve(r.noiseType??0),a=new zi(l,c,i,s,p);return new es(t,e,r,{offset:i,scale:s,intensity:l,movement:c,noiseType:p},a)}else throw new Error;else return iw(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:wm(o.props,r,this,e)}else if(o.path[0]==="texture")return"texture"in e?wc(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}},rt=class extends Ir{constructor(e,r,o,i,s,l,c){super(e,r,o,i);this.color=s;this.mode=l;this.alpha=c}},es=class extends Ir{constructor(e,r,o,i,s){super(e,r,o,i);this.position=s}},Pr=class extends Ir{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 ve(o.mode),p;if(!o.visible)s=new Eo,p={};else if(o.category==="lambert"){s=new qi;let a=new Ie(i.color(o.emissive)??0);p={emissive:a},s.emissive=a}else if(o.category==="toon"){s=new Yi;let a=new Y(o.shininess??30),u=new Ie(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}else if(o.category==="physical"){s=new $i;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 Fa;let a=new Y(o.shininess??30),u=new Ie(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}return s.alpha=new Y(1),s.shadingAlpha=l,s.shadingBlend=c,p.alpha=s.shadingAlpha,p.mode=s.shadingBlend,new Pr(e,r,o,s,p)}};function Nm(n){let t=n instanceof Ir?n.type:n;return t==="texture"||t==="displace_map"||t==="matcap"}function nw(n,t,e,r){switch(n.type){case"color":{let o=new Ie(r.color??5855577),i=new Y(r.alpha??1),s=new Ae("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ve(r.mode??0);return o.alpha=i,new rt(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}case"fresnel":{let o=new Ie(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 ve(r.mode??0),u=new Bi(o,i,s,l,c,p,a),d=new Ae(u.calpha,"f");return new rt(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 ft(r.wavelengths??new De.Vector3(0,0,0)),l=new Y(r.noiseStrength??0),c=new Y(r.noiseScale??1),p=new ft(r.offset??new De.Vector3(0,0,0)),a=new Y(r.alpha??1),u=new Di(o,i,s,l,c,p,a),d=new Ae(u.calpha,"f"),f=new ve(r.mode??0);return new rt(t,e,n,{filmThickness:o,movement:i,wavelengths:s,noiseStrength:l,noiseScale:c,offset:p,alpha:a,mode:f},u,f,d)}case"transmission":{let o=new Y(r.thickness??10),i=new Y(r.ior??1.5),s=new Y(r.roughness??.5),l=mt.transmissionSize,c=mt.transmissionRenderTarget,p=mt.transmissionRenderTargetDepth,a=window.innerWidth,u=window.innerHeight,d=a>=u?new lt(u/a,1):new lt(1,a/u),f=new Y(r.alpha??1),m=new Ri(o,i,s,l,c,p,d,f),h=new Ae(m.calpha,"f"),g=new ve(r.mode??0);return new rt(t,e,n,{thickness:o,ior:i,roughness:s,aspectRatio:d,alpha:f,mode:g},m,g,h)}case"toon":{let o=new ve(r.positioning??0),i;r.colors?i=new nr(r.colors.length,r.colors):(i=new nr(10,new De.Vector4(0,0,0,1)),i.value[1]=new De.Vector4(1,1,1,1));let s;r.steps?s=new or(r.steps.length,r.steps):(s=new or(10,1),s.value[0]=0);let l=new ft(r.source??new De.Vector3(0,0,0)),c=new co(r.isWorldSpace??!0),p=new Y(r.noiseStrength??0),a=new Y(r.noiseScale??1),u=new Xt(r.shadowColor),d=new ft(r.offset??new De.Vector3(0,0,0)),f=new Y(r.alpha??1),m=new Ji(o,i,s,l,c,p,a,u,d,f),h=new Ae(m.calpha,"f"),g=new ve(r.mode??0);return new rt(t,e,n,{positioning:o,colors:i,steps:s,source:l,isWorldSpace:c,noiseStrength:p,noiseScale:a,shadowColor:u,offset:d,alpha:f,mode:g},m,g,h)}case"outline":{let o=new Ie(r.outlineColor??16777215),i=new Ie(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 ft(r.contourDirections??new De.Vector3(0,1,0)),f=new co(r.positionalLines??!1),m=new co(r.compensation??!0),h=mt.normalRenderTarget,g=mt.normalRenderTargetDepth,v=mt.pixelRatioNode,x=mt.resolution,w=new Y(r.alpha??1),S=new Gi(o,i,s,l,c,p,a,u,d,f,m,x,h,g,v,w),b=new Ae(S.calpha,"f"),I=new ve(r.mode??0);return new rt(t,e,n,{outlineColor:o,contourColor:i,outlineWidth:s,contourWidth:l,outlineThreshold:c,contourThreshold:p,outlineSmoothing:a,contourFrequency:u,contourDirection:d,positionalLines:f,compensation:m,alpha:w,mode:I},S,I,b)}case"depth":{let o=new ve(r.gradientType??0),i=new co(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 ft(r.origin??new De.Vector3),u=new ft(r.direction??new De.Vector3),d;r.colors?d=new nr(r.colors.length,r.colors):(d=new nr(2,new De.Vector4(0,0,0,1)),d.value[1]=new De.Vector4(1,1,1,1));let f;r.steps?f=new or(r.steps.length,r.steps):(f=new or(2,1),f.value[0]=0);let m=new Y(r.alpha??1),h=new ve(r.mode??0),g=new Vi(o,i,s,l,c,p,a,u,d,f,m),v=new Ae(g.calpha,"f");return new rt(t,e,n,{gradientType:o,smooth:i,near:s,far:l,isVector:c,isWorldSpace:p,origin:a,direction:u,colors:d,steps:f,alpha:m,mode:h},g,h,v)}case"noise":{let o=new Y(r.scale??1),i=new ft(r.size??new De.Vector3(100,100,100)),s=new Y(r.move??1),l=new lt(r.fA??new De.Vector2(1.7,9.2)),c=new lt(r.fB??new De.Vector2(8.3,2.8)),p=new lt(r.distortion??new De.Vector2(1,1)),a=new Xt(r.colorA),u=new Xt(r.colorB),d=new Xt(r.colorC),f=new Xt(r.colorD),m=new Y(r.alpha??1),h=new ve(r.mode??0),g=new ve(r.noiseType??0),v=new Mi(o,i,s,l,c,p,a,u,d,f,m,g),x=new Ae(v.calpha,"f");return new rt(t,e,n,{scale:o,size:i,move:s,fA:l,fB:c,distortion:p,colorA:a,colorB:u,colorC:d,colorD:f,alpha:m,mode:h,noiseType:g},v,h,x)}case"normal":{let o=new ft(r.cnormal??new De.Vector3(1,1,1)),i=new Y(r.alpha??1),s=new ve(r.mode??0),l=new Hi(o,i),c=new Ae("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return c.keywords.alpha=i,new rt(t,e,n,{cnormal:o,alpha:i,mode:s},l,s,c)}case"gradient":{let o=new ve(r.gradientType??0),i=new co(r.smooth??!1),s;r.colors?s=new nr(r.colors.length,r.colors):(s=new nr(10,new De.Vector4(0,0,0,1)),s.value[1]=new De.Vector4(1,1,1,1));let l;r.steps?l=new or(r.steps.length,r.steps):(l=new or(10,1),l.value[0]=0);let c=new lt(r.offset??new De.Vector2(0,0)),p=new lt(r.morph??new De.Vector2(0,0)),a=new Y(r.angle??0),u=new Y(r.alpha??1),d=new ve(r.mode??0),f=new Ui(o,i,s,l,c,p,a,u),m=new Ae(f.calpha,"f");return new rt(t,e,n,{gradientType:o,smooth:i,colors:s,steps:l,offset:c,morph:p,angle:a,alpha:u,mode:d},f,d,m)}default:{let o=new Ie(1,0,0,1),i=new Y(1),s=new Ae("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ve(0);return o.alpha=i,new rt(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}}}function iw(n,t,e,r){let o=ym(e,r);return nw(e,n,t,o)}function _c(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 Ft=class extends ja.ShaderMaterial{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??Rt.defaultTwoLayerData("phong").layers;this.layers=o.map(i=>Ir.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 Pr),this.lightLayer===void 0&&(this.lightLayer=new Pr(0,"",{...fr.defaultData("light","phong"),visible:!1},new Eo,{})),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=Ir.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=Ir.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 rt),r=this.layers.findIndex(o=>o instanceof Pr);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 rt&&(o=new Fi(o,s.color,s.alpha,s.mode))}this.fragment.color=o}else this.fragment.color=void 0}blendAfterColors(){let e=new Ae("outgoingLight","f"),r=this.layers.findIndex(o=>o instanceof Pr);if(this.layers.length>r+1){for(let o=r+1;o<this.layers.length;++o){let i=this.layers[o];i instanceof rt&&(e=new Fi(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 es);if(e.length>0){let r=e[0].position;for(let o=1;o<e.length;++o)e[o]&&(r=new Ct(r,e[o].position,Ct.ADD),r=new Ct(r,new Y(.5).setReadonly(!0),Ct.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(){let e="[";for(let{data:r}of this.data.layers)if(r.type==="light")e+=`"${r.visible?r.category.toUpperCase():"Basic"}"`;else{let o=(bc[r.type]??[]).map(l=>r[l]),i=(Sc[r.type]??[]).map(l=>r[l]?.length??0),s=[...o,...i];s.length?e+=`["${r.type}", "${s.join('","')}"],`:e+=`"${r.type}",`}return e=e.slice(0,-1)+"]",e}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 Ra;return this.lights=this.lightLayer.data.visible,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>ja.NormalBlending,this}dispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(Ft.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 zt=require("three");function sw(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position||!n.geometry.attributes.normal)return;let t=new Map,e=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,o=new Float32Array(e.length);for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=new zt.Vector3(r[i],r[i+1],r[i+2]);t.has(s)?t.get(s)?.normals.push(l):t.set(s,{normals:[l],result:new zt.Vector3})}t.forEach((i,s)=>{for(let l of i.normals)i.result.add(l);i.result.divideScalar(i.normals.length)});for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=t.get(s)?.result;l&&(o[i]=l.x,o[i+1]=l.y,o[i+2]=l.z)}n.geometry.setAttribute("extrudeNormal",new zt.Float32BufferAttribute(o,3))}function aw(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=new zt.Vector3;for(let o=0;o<t.length;o+=3)r.set(t[o],t[o+1],t[o+2]).normalize(),e[o]=r.x,e[o+1]=r.y,e[o+2]=r.z;n.geometry.setAttribute("extrudeNormal",new zt.Float32BufferAttribute(e,3))}function Or(n){if(Array.isArray(n.material)){for(let t of n.material)if(t.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof Ft)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"||n.objectType==="TextFrame"&&n.data?.geometry?.depth===0?aw(n):sw(n)}function Cr(n){if(!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=parseInt(n.uuid.replace(/\D/g,"")),o=[zt.MathUtils.seededRandom(r),zt.MathUtils.seededRandom(r+1e4),zt.MathUtils.seededRandom(r+2e4)];for(let i=0;i<t.length;i++)e[i]=o[i%3];n.geometry.setAttribute("randomColor",new zt.BufferAttribute(e,3))}var ut=class extends $t(ka.Mesh){constructor(e,r){super(e,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new ka.Matrix4;this.booleanExclude=null;Array.isArray(r)&&e.groups.length===0&&e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(e){}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}updateGeometry(e,r){let o=this.geometry,i=tc[o.userData.type],s=this.objectType==="NonParametric"?Object.assign({},o.userData,{geometry:o}):o.userData,l=i.build(i.normalizeInputs(e,s)),c=o.uuid;this.geometry.dispose(),this.geometry=l,this.geometry.uuid=c,this.geometry.computeBoundingSphere(),Or(this),o.getAttribute("randomColor")&&Cr(this)}clone(e){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,o=Ni(r),i=this.material;return new this.constructor(o,i).copy(this,e)}copy(e,r=!0){return super.copy(e,r),e.cloner&&(this.cloner=new No(e,e.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new No(this)),this.cloner.fromClonerState(e))}fromState(e,r){return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=e.castShadow??!0,this.receiveShadow=e.receiveShadow??!0,this.booleanExclude=e.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Jt.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),br(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)vr(e)&&(e.freeBooleanPointer(),br(e)&&e.invalidateUpstreamBooleanData())}};var lw=new fo.Vector3(0,0,1),Im=new fo.Vector3,Pm=new fo.Vector3,Om=new fo.Matrix3,jn=class extends ut{constructor(e=dt.create({}),r){super(e,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new fo.EventDispatcher;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e,r){if(super.updateGeometry(e,r),"userData"in this.geometry){let o=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:o})}}setShape(e){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=e,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),Om.getNormalMatrix(this.matrixWorld),Im.copy(lw).applyMatrix3(Om).normalize(),Pm.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Im,Pm)}clone(e){let r=this.shape.clone(),o=this.material,i=this.geometry.userData,s=dt.create(Object.assign({},i,{shape:r})),l=new jn(s,o).copy(this,e);return l.shape=r,r.update(),l}raycast(e,r){ut.prototype.raycast.call(this,e,r)}};var Lr=(n,t)=>class extends n{constructor(){super(...arguments);this.objectHelper=new t(this)}get geometryHelper(){return t.geometryHelper}raycast(o,i){this.objectHelper.raycast(o,i)}fromLightState(o,i){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;o.color!==void 0&&(s.color=st(o.color,i)),o.intensity!==void 0&&(s.intensity=o.intensity),o.depth!==void 0&&(s.shadow.camera.far=o.depth,s.shadow.needsUpdate=!0),o.shadows!==void 0&&(this.castShadow=o.shadows)}return this}};var kn=new ze.Vector3,Nc=new ze.Vector3,Ur=class extends Lr($t(ze.Camera),ga){constructor(e=window.innerWidth,r=window.innerHeight,o=45,i,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=r,this.orthoCamera=new ze.OrthographicCamera(e*-.5,e*.5,r*.5,r*-.5,i??-5e4,s),this.perspCamera=new ze.PerspectiveCamera(o,e/r,i??50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(e,r){let o=new Ur().fromState(r);return o.objectHelper.update(),o.uuid=e,o}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(kn),this.targetOffset=kn.distanceTo(e)}getTarget(e=new ze.Vector3){return this.getWorldDirection(Nc),this.getWorldPosition(kn),Nc.multiplyScalar(this.targetOffset),e.copy(kn).add(Nc),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(kn),kn.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new ze.Quaternion),r=new ze.Vector3(0,0,1).applyQuaternion(e),o=new ze.Vector3().copy(ze.Object3D.DefaultUp);this.isUpVectorFlipped&&o.negate(),o.applyQuaternion(e);let i=new ze.Vector3().copy(ze.Object3D.DefaultUp).projectOnPlane(r),s=new ze.Vector3().crossVectors(i,o).dot(r)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(o)*s}getViewFrontToObject(e){let r=e.getWorldPosition(new ze.Vector3),i=e.getWorldDirection(new ze.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){let r=e.getWorldPosition(new ze.Vector3),i=this.getWorldDirection(new ze.Vector3).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,r){this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=e/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,o,i,s,l){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,o,i,s,l):this.orthoCamera.setViewOffset(e,r,o,i,s,l)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return fn(r,e)}fromCameraState(e){let{orthographic:r,perspective:o}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),o!==void 0&&(o.near!==void 0&&(this.perspCamera.near=o.near),o.fov!==void 0&&(this.perspCamera.fov=o.fov),o.zoom!==void 0&&(this.perspCamera.zoom=o.zoom)),e.type==="PerspectiveCamera"?(this.zoom=this.perspCamera.zoom,this.fov=this.perspCamera.fov,this.near=this.perspCamera.near):(this.near=this.orthoCamera.near,this.zoom=this.orthoCamera.zoom),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};var ts=require("three");var Cm=new ts.Matrix4;var Ha=class extends ut{constructor(e=new ts.BufferGeometry,r){super(e,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];br(s)&&s.recomputeBoolean(e===!0,r)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(lm(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5&&(s.booleanMeshSetAddress=Jt.getMeshSet(s.geometry,e===!0,r)),s.booleanMeshSetAddress===-1)return;Jt.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else br(s)&&s.needsTransformForDownstream===!0?(Jt.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Cm.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Jt.transformMeshSet(s.booleanMeshSetAddress,Cm),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(e===!0)return Jt.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let o=this.geometry;o.dispose(),this.geometry=new ts.BufferGeometry,this.geometry.userData=o.userData,this.geometry.boundingSphere=o.boundingSphere;try{this.booleanMeshSetAddress=Jt.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Or(this),Cr(this)}updateGeometry(e,r){let o=e.parameters;o.operation!==void 0&&(this.booleanOp=o.operation),o.phongAngle!==void 0&&(this.phongAngle=o.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var Lm=require("three");var Do=class extends Lr($t(Lm.Group),yn){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,r){let o=new Do().fromState(r);return o.uuid=e,o.objectHelper.update(),o}};var Go=require("three");var Hn=class extends Lr($t(Go.DirectionalLight),gn){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=-1e4,o.far=2500;let i=new Go.CameraHelper(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Hn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Go.CameraHelper&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Go.CameraHelper&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Go.CameraHelper&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(e,r){let o=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,r),e.size!==void 0&&im(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),o&&this.update(),this}fromState(e,r){return super.fromState(e),this.fromDirectionalLightState(e,r),this}};var xt=require("three");var Wn=class extends Lr($t(xt.PointLight),xn){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;let i=new xt.Vector3(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new xt.Vector3(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z),l=new xt.Box3(i,s),c=new xt.Box3Helper(l,new xt.Color(16755200));c.visible=!1,this._gizmos.shadowmap=c,this.update()}static createFromState(e,r,o){let i=new Wn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof xt.Box3Helper&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof xt.Box3Helper&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let r=this._gizmos[e];if(r instanceof xt.Box3Helper){let o=this.shadow.camera,i=new xt.Vector3(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new xt.Vector3(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z);r.box.set(i,s),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromPointLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromPointLightState(e,r),this}};var Mt=require("three");var Mm=new Mt.Vector3,Em=new Mt.Vector3,Bm=new Mt.Quaternion,qn=class extends Lr($t(Mt.SpotLight),gi){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=Mt.MathUtils.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let i=new Mt.CameraHelper(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new qn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Mt.CameraHelper&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Mt.CameraHelper&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Mt.CameraHelper&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Em.setFromMatrixPosition(this.matrixWorld),Bm.setFromRotationMatrix(this.matrixWorld),Mm.copy(this.up).applyQuaternion(Bm).negate().multiplyScalar(this.distance),this.target.position.copy(Em).add(Mm),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromSpotLightState(e,r),this}};var Dm=n=>n.tagName==="VIDEO",$n=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;Dm(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];Nm(s)&&$n.resizeTextureLayer(t,e,s.uniforms[`f${s.id}_texture`].value)}}static resizeComplex(t,e,r,o){let i=t/e,s,l=r.image;Dm(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 Wa=class extends ut{constructor(e,r){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e,r){super.updateGeometry(e,r),this.material.layers&&$n.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Xn=class extends ut{constructor(e,r){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var qa=class extends Xn{constructor(e,r){super(e,r);this.objectType="NonParametric"}};var Rm,os=new Promise(n=>{Rm=n}),Gm=!1;async function Vm(){if(Gm)return;let n=await import("./opentype.js");Rm(n),Gm=!0}var ns=class{async load(t,e,r=()=>{}){let{load:o}=await os;o(t,(i,s)=>{i||!s?r(i??"Something went wrong"):e(s)})}async parse(t){let{parse:e}=await os;try{return e(t)}catch(r){console.error(r)}}};async function cw(n){return await(await fetch(n)).arrayBuffer()}var uw=new ns;async function Ic(n){let t,e,r=!1;if(n.url?(t=await cw(n.url),e=n.url,r=n.url.startsWith("/")):n.data&&(t=n.data.buffer),t){let o=await uw.parse(t);if(o)return{font:o,url:e,intercepted:r,arr:t}}}var Yn=require("three");var Fm=new Yn.Vector3,zm=new Yn.Matrix4,Um=new Yn.Ray;function jm(n){let t=!1;return n.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="TextGeometry"&&(t=!0)}),t}var $a=class extends ut{constructor(e,r,o){super(new On(r.geometry,o),o.material(r.material));this.data=r;this.objectType="TextFrame";this.wrappedText=[""];this.charWidths=[];this.charCoords=[];this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.name=r.name,this.uuid=e,this.updateState(r,o)}async updateGeometry(e,r){let o=e.parameters,i={...this.geometry.userData.parameters,...o};this.geometry.userData={parameters:i,type:"TextGeometry"},r&&(o.font||!this.geometry.font&&r.getFont(i.font))&&await this.geometry.updateFont(o.font??i.font,r),await this.geometry.update(i),Or(this),Cr(this);let{wrappedText:s,charCoords:l,charWidths:c}=this.geometry;this.wrappedText=s,this.charWidths=c,this.charCoords=l,this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateState(e,r){this.data=e,this.material=r.material(e.material),this.fromState(e,r),this.updateGeometry({parameters:e.geometry},r)}get font(){return this.geometry.font}get initialOffsetY(){return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,this.geometry.userData.parameters.height,this.fontScale,this.geometry.userData.parameters.verticalAlign)??0}get fontScale(){return this.font?this.geometry.userData.parameters.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){return this.geometry.userData.parameters.fontSize*this.geometry.userData.parameters.lineHeight}raycast(e,r){let{matrixWorld:o}=this;if(zm.copy(o).invert(),Um.copy(e.ray).applyMatrix4(zm),Um.intersectBox(this.singleBBox,Fm)){let i=Fm.applyMatrix4(o),s=e.ray.origin.distanceTo(i);r.push({distance:s,point:i.clone(),object:this})}}};var wt=require("three");var qm=tl(Hm());var Pc;Pa.then(n=>{Pc=n});var $m=new wt.Matrix4,pw=new wt.Matrix4,dw=new wt.Matrix4,ir=new wt.Box3,mo=new wt.Vector3,fw=new wt.Matrix4,mw=new wt.Matrix4;var Kn=class extends ut{constructor(e,r,o,i){super(o??r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new wt.Matrix4;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new wt.Matrix4;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:l}=qt.build(r.geometry,void 0,void 0,!r.flatShading),c=o.material(r.material),p=new Kn(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}=qt.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,Or(this),Cr(this),e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){qt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&qt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=qt.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=qt.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(e,r){this.geometry=this.originalGeometry,ut.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,qm.SVD)(r),l=$m.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=pw.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=dw.copy(c).transpose();this.shearScale=fw.makeScale(s[0],s[1],s[2]).multiply(p).premultiply(c),this.shearScaleInv=mw.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 wt.Sphere);let r=e.attributes.position,o=e.boundingSphere.center;ir.setFromBufferAttribute(r),ir.getCenter(o),e.boundingSphere.radius=o.distanceTo(ir.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ir.getSize(mo);let i={width:mo.x,height:mo.y,depth:mo.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;ir.min.set(e[0],e[2],e[4]),ir.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(ir.min.applyMatrix4(this.shearScaleInv),ir.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new wt.Sphere);let o=r.boundingSphere.center;ir.getCenter(o),r.boundingSphere.radius=o.distanceTo(ir.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ir.getSize(mo);let i={width:mo.x,height:mo.y,depth:mo.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(Pc.free_bvh(this.subdivPointer),Pc.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e,r){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,Wm(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Wm(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 Wm(n,t,e,r){let o=n.position.array,i=n.normal.array,s=$m.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}var ho=require("three");function Xm(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=ho.FrontSide:t.side===1?n.side=ho.BackSide:n.side=ho.DoubleSide)}function hw(n,t){if(Array.isArray(n.material))for(let e of n.material)Xm(e,t);else{let e=n.material;Xm(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function Ym(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=Kn.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new ho.BufferGeometry:Oa(t.geometry,e),i="materials"in t?t.materials.map(s=>e.material(s)):e.material(t.material);Es.is2DParametricMesh(o.userData.type)?r=new Wa(o,i):o?.userData.type==="VectorGeometry"?r=new jn(o,i):t.geometry.type==="NonParametricGeometry"?r=new qa(o,i):t.geometry.type==="BooleanGeometry"?(r=new Ha(void 0,i),r.booleanOp=t.geometry.operation,t.geometry.phongAngle!==void 0&&(r.phongAngle=t.geometry.phongAngle)):r=new Xn(o,i),r.uuid=n,r.fromState(t,e)}return hw(r,t),r}function Km(n,t,e){return t.type==="Mesh"?t.geometry.type==="TextGeometry"?new $a(n,t,e):Ym(n,t,e):t.type==="Empty"?Do.createFromState(n,t):t.type==="PointLight"?Wn.createFromState(n,t,e):t.type==="SpotLight"?qn.createFromState(n,t,e):t.type==="DirectionalLight"?Hn.createFromState(n,t,e):Wo.is(t.type)?Ur.createFromState(n,t):(console.error(t),new Do)}var Ro=class extends Ft{};var jr=require("three");function Qm(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,Cr(n),Or(n)),r.length===0&&o.length===0&&n.layers.set(0),e}function Zm(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 Jm(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof jr.Mesh)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Qm(e,e.material[r])&&(t=!0);else Qm(e,e.material)&&(t=!0)}),t}function eh(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof jr.Mesh)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)Zm(e,e.material[r])&&(t=!0);else Zm(e,e.material)&&(t=!0)}),t}function th(n){"material"in n&&yw(n.material),"geometry"in n&&n.geometry.dispose()}function yw(n){Bd(n).forEach(t=>{t instanceof Ro||t.dispose()})}var xw=new jr.Raycaster,vw=new jr.Matrix4,bw=new jr.Ray;function rh(n,t,e){let r=n.cloner;if(r)for(let o of r.children){let i=vw.copy(o.matrixWorld).invert(),s=bw.copy(t.ray).applyMatrix4(i),l=n.matrixWorld;s.applyMatrix4(l);let c=xw;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 oh=new Mr.Vector3,Oc=class extends Ea(Mr.Scene){constructor(e,r){super();this.objectType="Scene";this.backupFog=new Mr.Fog(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 tt(1,1,1,1);this.entityByUuid={};this.ambientLight=new Mr.HemisphereLight(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),this.matrixAutoUpdate=!1}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=eh(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=Jm(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(st(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 Ur&&this.switchActiveCamera(o)}this.traverse(o=>{br(o)&&o.recomputeBoolean()})}clearScene(){this.traverseEntity(e=>{th(e)});for(let e of this.children)wr(e)&&e.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Ur.createFromState(Oc.PERSONAL_CAMERA_ID,{...aa.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)wr(s)&&!s.raycastLock&&s.visible&&((vr(s)||La(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,r),rh(s,e,r)),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)wr(r)&&r.traverseEntity(e)}traverseVisibleEntity(e){for(let r of this.children)wr(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=st(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}dispose(){this.clearScene()}updateAmbientLight(e,r){nm(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=st(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=Km(e,r,s);return l&&(this.entityByUuid[e]=l,i.add(l),br(i)&&vr(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 Mr.Box3;return o.setFromPoints(r),o.getCenter(oh),oh}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 ut)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof Ft&&e(r.material[o]);else r.material instanceof Ft&&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})})}},is=Oc;is.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var ah=tl(nh());var ih=new Map;function sh(n){if(typeof n=="string")return n;let t=ih.get(n);return t||(t={url:URL.createObjectURL(new Blob([n]))},ih.set(n,t)),t.url}var Qn=class{constructor({src:t,volume:e,delay:r,loop:o}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let i;typeof t=="string"?i={src:t}:i={src:sh(t),format:"wav"},this.sound=new ah.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 status(){return this._status}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}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}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._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}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 ot=require("three"),Ka=class{constructor(){this.type="ShapePath";this.color=new ot.Color;this.subPaths=[];this.currentPath=null}moveTo(t,e){return this.currentPath=new ot.Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,r,o){return this.currentPath?.quadraticCurveTo(t,e,r,o),this}bezierCurveTo(t,e,r,o,i,s){return this.currentPath?.bezierCurveTo(t,e,r,o,i,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let e={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},r={loc:e.ORIGIN,t:0};function o(h,g,v,x){let w=h.x,S=g.x,b=v.x,I=x.x,_=h.y,y=g.y,P=v.y,A=x.y,O=(I-b)*(_-P)-(A-P)*(w-b),T=(S-w)*(_-P)-(y-_)*(w-b),L=(A-P)*(S-w)-(I-b)*(y-_),B=O/L,j=T/L;if(L===0&&O!==0||B<=0||B>=1||j<0||j>1)return null;if(O===0&&L===0){for(let te=0;te<2;te++)if(i(te===0?v:x,h,g),r.loc===e.ORIGIN){let ne=te===0?v:x;return{x:ne.x,y:ne.y,t:r.t}}else if(r.loc===e.BETWEEN){let ne=+(w+r.t*(S-w)).toPrecision(10),ae=+(_+r.t*(y-_)).toPrecision(10);return{x:ne,y:ae,t:r.t}}return null}else{for(let ae=0;ae<2;ae++)if(i(ae===0?v:x,h,g),r.loc===e.ORIGIN){let U=ae===0?v:x;return{x:U.x,y:U.y,t:r.t}}let te=+(w+B*(S-w)).toPrecision(10),ne=+(_+B*(y-_)).toPrecision(10);return{x:te,y:ne,t:B}}}function i(h,g,v){let x=v.x-g.x,w=v.y-g.y,S=h.x-g.x,b=h.y-g.y,I=x*b-S*w;if(h.x===g.x&&h.y===g.y){r.loc=e.ORIGIN,r.t=0;return}if(h.x===v.x&&h.y===v.y){r.loc=e.DESTINATION,r.t=1;return}if(I<-Number.EPSILON){r.loc=e.LEFT;return}if(I>Number.EPSILON){r.loc=e.RIGHT;return}if(x*S<0||w*b<0){r.loc=e.BEHIND;return}if(Math.sqrt(x*x+w*w)<Math.sqrt(S*S+b*b)){r.loc=e.BEYOND;return}let _;x!==0?_=S/x:_=b/w,r.loc=e.BETWEEN,r.t=_}function s(h,g){let v=[],x=[];for(let w=1;w<h.length;w++){let S=h[w-1],b=h[w];for(let I=1;I<g.length;I++){let _=g[I-1],y=g[I],P=o(S,b,_,y);P!==null&&v.find(A=>A.t<=P.t+Number.EPSILON&&A.t>=P.t-Number.EPSILON)===void 0&&(v.push(P),x.push(new ot.Vector2(P.x,P.y)))}}return x}function l(h,g,v){let x=new ot.Vector2;g.getCenter(x);let w=[];return v.forEach(S=>{S.boundingBox.containsPoint(x)&&s(h,S.points).forEach(I=>{w.push({identifier:S.identifier,isCW:S.isCW,point:I})})}),w.sort((S,b)=>S.point.x-b.point.x),w}function c(h,g,v,x,w){(w==null||w==="")&&(w="nonzero");let S=new ot.Vector2;h.boundingBox.getCenter(S);let b=[new ot.Vector2(v,S.y),new ot.Vector2(x,S.y)],I=l(b,h.boundingBox,g);I.sort((T,L)=>T.point.x-L.point.x);let _=[],y=[];I.forEach(T=>{T.identifier===h.identifier?_.push(T):y.push(T)});let P=_[0].point.x,A=[],O=0;for(;O<y.length&&y[O].point.x<P;)A.length>0&&A[A.length-1]===y[O].identifier?A.pop():A.push(y[O].identifier),O++;if(A.push(h.identifier),w==="evenodd"){let T=A.length%2===0,L=A[A.length-2];return{identifier:h.identifier,isHole:T,for:L}}else if(w==="nonzero"){let T=!0,L=null,B=null;for(let j=0;j<A.length;j++){let te=A[j];g[te]&&(T?(B=g[te].isCW,T=!1,L=te):B!==g[te].isCW&&(B=g[te].isCW,T=!0))}return{identifier:h.identifier,isHole:T,for:L}}else console.warn('fill-rule: "'+w+'" is currently not implemented.')}let p=0,a=999999999,u=-999999999,d=[];this.subPaths.forEach(h=>{let g=h.getPoints(),v=-999999999,x=999999999,w=-999999999,S=999999999;for(let b=0;b<g.length;b++){let I=g[b];I.y>v&&(v=I.y),I.y<x&&(x=I.y),I.x>w&&(w=I.x),I.x<S&&(S=I.x)}u<=w&&(u=w+1),a>=S&&(a=S-1),g.length&&d.push({curves:h.curves,points:g,isCW:ot.ShapeUtils.isClockWise(g),identifier:p++,boundingBox:new ot.Box2(new ot.Vector2(S,x),new ot.Vector2(w,v))})});let f=d.map(h=>c(h,d,a,u,this.userData?.style.fillRule)),m=[];return d.forEach(h=>{let g=f[h.identifier];if(g&&!g.isHole){let v=new ot.Shape;v.curves=h.curves,f.filter(w=>w?.isHole&&w.for===h.identifier).forEach(w=>{if(w){let S=d[w.identifier],b=new ot.Path;b.curves=S.curves,v.holes.push(b)}}),m.push(v)}}),m}};var Zn=require("three");var lh=require("three/examples/jsm/loaders/DRACOLoader.js");var go;function Sw(){return go||(go=new lh.DRACOLoader,go.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),go.decoderPending}async function ww(n){if(go){let t={attributeIDs:go.defaultAttributeIDs,attributeTypes:go.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await go.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 ch(n,t){let[e,r]=il(Is.deserialize(new Uint8Array(n)));Ud(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 Sw();for(let i of o){let s=await ww(Tt(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}function _w(n,t){return t.state.glyphIndex===n||t.state.fina===n||t.state.medi===n||t.state.init===n}var Qa=class{constructor(t,e){this._arrayBuffer=new ArrayBuffer(1);this._isLoaded=!1;this._intercepted=!1;this._isUserFont=t.isUserFont??!1,this._loadingPromise=Ic(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}update(t,e){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=Ic(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}async reverseLigaturesTable(t,e,r){let{Bidi:o}=await os,i=new o,s=u=>t.charToGlyphIndex(u.char);i.registerModifier("glyphIndex",null,s),i.applyFeatures(t,t.defaultRenderOptions.features),i.getTextGlyphs(e);let l=i.tokenizer.tokens,c=[],p=0,a=r.length===l.length;for(let u=0;u<r.length;u++){let d=r[u].index,f=String.fromCharCode(r[u].unicode),m=l[p];if(_w(d,m)||a)c.push({char:f,index:d,replacements:[m.state.glyphIndex],replacementChars:[m.char]}),p++;else{let h=m.char,g="",v=[m.state.glyphIndex],x=[],w=!1;for(;!w;)p++,g=e.charAt(p),h+=g,v.push(t.charToGlyphIndex(g)),x=t.stringToGlyphs(h),x.length===1&&x[0].index===d&&(w=!0),p>e.length&&(w=!0);c.push({char:f,index:d,replacements:v,replacementChars:Array.from(h)}),p++}}return c}async generateShapes(t,e){await this._loadingPromise;let r=this.font,o=e.fontSize/this.unitsPerEm,i=e.fontSize*e.lineHeight,s=t.map(x=>this.getTextWidth(x,e)),l=e.width,c=this.getCharWidth(`
|
|
1335
1335
|
`,e),p=e.horizontalAlign===1?c:0,a=this.computeSpaceWidthForLine(t,0,e),u=this.getLineInitialOffsetX(s[0],l,e.horizontalAlign,t[0],c),d=this.getLineInitialOffsetY(i,t.length,e.height,o,e.verticalAlign),f=[],m=t.map(x=>[]),h=t.map(x=>[]),g;for(let x=0;x<t.length;x++){let w=t[x],S={features:{liga:!0}},b=[];try{b=r.stringToGlyphs(w,S)}catch(_){console.warn(_)}u=this.getLineInitialOffsetX(s[x],l,e.horizontalAlign,w,c);let I=[];try{I=await this.reverseLigaturesTable(r,w,b)}catch(_){console.warn(_)}a=this.computeSpaceWidthForLine(t,x,e);for(let _=0;_<b.length;_++){let y=b[_],P=y.index===0?`
|
|
1336
1336
|
`:y.unicode?String.fromCharCode(y.unicode):void 0,A=I[_],O=0,T=0;_===0&&e.horizontalAlign===2&&y.leftSideBearing!==void 0&&(T=-y.leftSideBearing*o),g&&(O=r.getKerningValue(y,g)*o),u+=T+O;let L=0;if(P===`
|
|
1337
1337
|
`)L=p;else if(P===" ")L=a;else{let B=this.createPath(y,o,u,d,e);B&&(L=B.offsetX-(O+T),f.push(B.path))}if(A.replacements.length===1)h[x].push([u,d]),m[x].push(L);else{let B=A.replacements.map(ae=>(r.glyphs.get(ae).advanceWidth??0)*o),j=B.reduce((ae,U)=>ae+=U,0),te=B.map(ae=>ae/j),ne=u;for(let ae=0;ae<te.length;ae++){let U=L*te[ae];h[x].push([ne,d]),m[x].push(U),ne+=U}}u+=L,g=y}d-=i}let v=[];for(let x=0,w=f.length;x<w;x++)v.push(...f[x].toShapes());return{shapes:v,charWidths:m,lineWidths:s,charCoords:h}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,r,o,i){return(r===3||r===2)&&o.indexOf(`
|
package/build/SplineLoader.js
CHANGED
|
@@ -1331,7 +1331,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
1331
1331
|
|
|
1332
1332
|
return color.xyz;
|
|
1333
1333
|
|
|
1334
|
-
}`,[it.simplex,e,o,s])}}();import{Matrix3 as V1}from"three";function Im(n,t,e){n.setUvTransform(e[0],e[1],t[0],t[1],0,0,0)}var _a=class extends Sn{constructor(e,r){super(new V1);this.repeat=e;this.offset=r;Im(this.value,e,r)}updateMatrix(){Im(this.value,this.repeat,this.offset)}};var mr=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)yc(i,this,r)}get type(){return this.data.type}static create(t,e,r,o){if(r.type==="light")return hr.createLigherLayer(t,e,r,o);if(r.type==="texture"){let i=o.image(r.texture.image),s=new Ei(i,r.texture.wrapping),l=new wa(i),c=new _a(r.texture.repeat,r.texture.offset),p=new Y(r.crop?1:0),a=new ye(r.projection??0),u=new ye(["x","y","z"].indexOf(r.axis)??0),d=new ye(r.side??0),f=new Ke(r.size?new yo(r.size[0],r.size[1]):new yo(100,100)),m=new Y(r.alpha??1),h=new ye(r.mode??0),g=new Ti(s,l,p,a,u,d,f,c,m,h),v=new Se(g.calpha,"f");return new He(t,e,r,{texture:s,textureSize:l,crop:p,projection:a,axis:u,side:d,size:f,mat:c,alpha:m,mode:h},g,h,v)}else if(r.type==="matcap"){let i=o.image(r.texture.image),s=new Ei(i,r.texture.wrapping),l=new Y(r.alpha??1),c=new ye(r.mode??0),p=new Mi(s,l,c),a=new Se(p.calpha,"f");return new He(t,e,r,{texture:s,alpha:l,mode:c},p,c,a)}else if(r.type==="displace")if(r.displacementType==="noise"){let i=new et(new fr(...r.offset)),s=new Y(r.scale??10),l=new Y(r.intensity??8),c=new Y(r.movement??1),p=new ye(r.noiseType??0),a=new wi(l,c,i,s,p);return new Di(t,e,r,{offset:i,scale:s,intensity:l,movement:c,noiseType:p},a)}else throw new Error;else return z1(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:Nm(o.props,r,this,e)}else if(o.path[0]==="texture")return"texture"in e?gc(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}},He=class extends mr{constructor(e,r,o,i,s,l,c){super(e,r,o,i);this.color=s;this.mode=l;this.alpha=c}},Di=class extends mr{constructor(e,r,o,i,s){super(e,r,o,i);this.position=s}},hr=class extends mr{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 ye(o.mode),p;if(!o.visible)s=new ho,p={};else if(o.category==="lambert"){s=new Ii;let a=new _e(i.color(o.emissive)??0);p={emissive:a},s.emissive=a}else if(o.category==="toon"){s=new Oi;let a=new Y(o.shininess??30),u=new _e(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}else if(o.category==="physical"){s=new Pi;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 ba;let a=new Y(o.shininess??30),u=new _e(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}return s.alpha=new Y(1),s.shadingAlpha=l,s.shadingBlend=c,p.alpha=s.shadingAlpha,p.mode=s.shadingBlend,new hr(e,r,o,s,p)}};function Pm(n){let t=n instanceof mr?n.type:n;return t==="texture"||t==="displace_map"||t==="matcap"}function F1(n,t,e,r){switch(n.type){case"color":{let o=new _e(r.color??5855577),i=new Y(r.alpha??1),s=new Se("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ye(r.mode??0);return o.alpha=i,new He(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}case"fresnel":{let o=new _e(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 ye(r.mode??0),u=new gi(o,i,s,l,c,p,a),d=new Se(u.calpha,"f");return new He(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 et(r.wavelengths??new fr(0,0,0)),l=new Y(r.noiseStrength??0),c=new Y(r.noiseScale??1),p=new et(r.offset??new fr(0,0,0)),a=new Y(r.alpha??1),u=new yi(o,i,s,l,c,p,a),d=new Se(u.calpha,"f"),f=new ye(r.mode??0);return new He(t,e,n,{filmThickness:o,movement:i,wavelengths:s,noiseStrength:l,noiseScale:c,offset:p,alpha:a,mode:f},u,f,d)}case"transmission":{let o=new Y(r.thickness??10),i=new Y(r.ior??1.5),s=new Y(r.roughness??.5),l=tt.transmissionSize,c=tt.transmissionRenderTarget,p=tt.transmissionRenderTargetDepth,a=window.innerWidth,u=window.innerHeight,d=a>=u?new Ke(u/a,1):new Ke(1,a/u),f=new Y(r.alpha??1),m=new vi(o,i,s,l,c,p,d,f),h=new Se(m.calpha,"f"),g=new ye(r.mode??0);return new He(t,e,n,{thickness:o,ior:i,roughness:s,aspectRatio:d,alpha:f,mode:g},m,g,h)}case"toon":{let o=new ye(r.positioning??0),i;r.colors?i=new kt(r.colors.length,r.colors):(i=new kt(10,new An(0,0,0,1)),i.value[1]=new An(1,1,1,1));let s;r.steps?s=new jt(r.steps.length,r.steps):(s=new jt(10,1),s.value[0]=0);let l=new et(r.source??new fr(0,0,0)),c=new Kr(r.isWorldSpace??!0),p=new Y(r.noiseStrength??0),a=new Y(r.noiseScale??1),u=new Et(r.shadowColor),d=new et(r.offset??new fr(0,0,0)),f=new Y(r.alpha??1),m=new Bi(o,i,s,l,c,p,a,u,d,f),h=new Se(m.calpha,"f"),g=new ye(r.mode??0);return new He(t,e,n,{positioning:o,colors:i,steps:s,source:l,isWorldSpace:c,noiseStrength:p,noiseScale:a,shadowColor:u,offset:d,alpha:f,mode:g},m,g,h)}case"outline":{let o=new _e(r.outlineColor??16777215),i=new _e(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 et(r.contourDirections??new fr(0,1,0)),f=new Kr(r.positionalLines??!1),m=new Kr(r.compensation??!0),h=tt.normalRenderTarget,g=tt.normalRenderTargetDepth,v=tt.pixelRatioNode,x=tt.resolution,w=new Y(r.alpha??1),S=new xi(o,i,s,l,c,p,a,u,d,f,m,x,h,g,v,w),b=new Se(S.calpha,"f"),I=new ye(r.mode??0);return new He(t,e,n,{outlineColor:o,contourColor:i,outlineWidth:s,contourWidth:l,outlineThreshold:c,contourThreshold:p,outlineSmoothing:a,contourFrequency:u,contourDirection:d,positionalLines:f,compensation:m,alpha:w,mode:I},S,I,b)}case"depth":{let o=new ye(r.gradientType??0),i=new Kr(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 et(r.origin??new fr),u=new et(r.direction??new fr),d;r.colors?d=new kt(r.colors.length,r.colors):(d=new kt(2,new An(0,0,0,1)),d.value[1]=new An(1,1,1,1));let f;r.steps?f=new jt(r.steps.length,r.steps):(f=new jt(2,1),f.value[0]=0);let m=new Y(r.alpha??1),h=new ye(r.mode??0),g=new bi(o,i,s,l,c,p,a,u,d,f,m),v=new Se(g.calpha,"f");return new He(t,e,n,{gradientType:o,smooth:i,near:s,far:l,isVector:c,isWorldSpace:p,origin:a,direction:u,colors:d,steps:f,alpha:m,mode:h},g,h,v)}case"noise":{let o=new Y(r.scale??1),i=new et(r.size??new fr(100,100,100)),s=new Y(r.move??1),l=new Ke(r.fA??new yo(1.7,9.2)),c=new Ke(r.fB??new yo(8.3,2.8)),p=new Ke(r.distortion??new yo(1,1)),a=new Et(r.colorA),u=new Et(r.colorB),d=new Et(r.colorC),f=new Et(r.colorD),m=new Y(r.alpha??1),h=new ye(r.mode??0),g=new ye(r.noiseType??0),v=new hi(o,i,s,l,c,p,a,u,d,f,m,g),x=new Se(v.calpha,"f");return new He(t,e,n,{scale:o,size:i,move:s,fA:l,fB:c,distortion:p,colorA:a,colorB:u,colorC:d,colorD:f,alpha:m,mode:h,noiseType:g},v,h,x)}case"normal":{let o=new et(r.cnormal??new fr(1,1,1)),i=new Y(r.alpha??1),s=new ye(r.mode??0),l=new Ni(o,i),c=new Se("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return c.keywords.alpha=i,new He(t,e,n,{cnormal:o,alpha:i,mode:s},l,s,c)}case"gradient":{let o=new ye(r.gradientType??0),i=new Kr(r.smooth??!1),s;r.colors?s=new kt(r.colors.length,r.colors):(s=new kt(10,new An(0,0,0,1)),s.value[1]=new An(1,1,1,1));let l;r.steps?l=new jt(r.steps.length,r.steps):(l=new jt(10,1),l.value[0]=0);let c=new Ke(r.offset??new yo(0,0)),p=new Ke(r.morph??new yo(0,0)),a=new Y(r.angle??0),u=new Y(r.alpha??1),d=new ye(r.mode??0),f=new _i(o,i,s,l,c,p,a,u),m=new Se(f.calpha,"f");return new He(t,e,n,{gradientType:o,smooth:i,colors:s,steps:l,offset:c,morph:p,angle:a,alpha:u,mode:d},f,d,m)}default:{let o=new _e(1,0,0,1),i=new Y(1),s=new Se("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ye(0);return o.alpha=i,new He(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}}}function z1(n,t,e,r){let o=_m(e,r);return F1(e,n,t,o)}function yc(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 _t=class extends j1{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??St.defaultTwoLayerData("phong").layers;this.layers=o.map(i=>mr.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 hr),this.lightLayer===void 0&&(this.lightLayer=new hr(0,"",{...Jt.defaultData("light","phong"),visible:!1},new ho,{})),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=mr.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=mr.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 He),r=this.layers.findIndex(o=>o instanceof hr);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 He&&(o=new Si(o,s.color,s.alpha,s.mode))}this.fragment.color=o}else this.fragment.color=void 0}blendAfterColors(){let e=new Se("outgoingLight","f"),r=this.layers.findIndex(o=>o instanceof hr);if(this.layers.length>r+1){for(let o=r+1;o<this.layers.length;++o){let i=this.layers[o];i instanceof He&&(e=new Si(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 Di);if(e.length>0){let r=e[0].position;for(let o=1;o<e.length;++o)e[o]&&(r=new ht(r,e[o].position,ht.ADD),r=new ht(r,new Y(.5).setReadonly(!0),ht.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(){let e="[";for(let{data:r}of this.data.layers)if(r.type==="light")e+=`"${r.visible?r.category.toUpperCase():"Basic"}"`;else{let o=(mc[r.type]??[]).map(l=>r[l]),i=(hc[r.type]??[]).map(l=>r[l]?.length??0),s=[...o,...i];s.length?e+=`["${r.type}", "${s.join('","')}"],`:e+=`"${r.type}",`}return e=e.slice(0,-1)+"]",e}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 va;return this.lights=this.lightLayer.data.visible,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>U1,this}dispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(_t.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(n){n===!0&&this.version++,this.needsCompile=n},get:function(){return this.needsCompile}}});import{MathUtils as bc,BufferAttribute as k1,Vector3 as Sc,Float32BufferAttribute as Om}from"three";function H1(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position||!n.geometry.attributes.normal)return;let t=new Map,e=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,o=new Float32Array(e.length);for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=new Sc(r[i],r[i+1],r[i+2]);t.has(s)?t.get(s)?.normals.push(l):t.set(s,{normals:[l],result:new Sc})}t.forEach((i,s)=>{for(let l of i.normals)i.result.add(l);i.result.divideScalar(i.normals.length)});for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=t.get(s)?.result;l&&(o[i]=l.x,o[i+1]=l.y,o[i+2]=l.z)}n.geometry.setAttribute("extrudeNormal",new Om(o,3))}function W1(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=new Sc;for(let o=0;o<t.length;o+=3)r.set(t[o],t[o+1],t[o+2]).normalize(),e[o]=r.x,e[o+1]=r.y,e[o+2]=r.z;n.geometry.setAttribute("extrudeNormal",new Om(e,3))}function gr(n){if(Array.isArray(n.material)){for(let t of n.material)if(t.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof _t)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"||n.objectType==="TextFrame"&&n.data?.geometry?.depth===0?W1(n):H1(n)}function yr(n){if(!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=parseInt(n.uuid.replace(/\D/g,"")),o=[bc.seededRandom(r),bc.seededRandom(r+1e4),bc.seededRandom(r+2e4)];for(let i=0;i<t.length;i++)e[i]=o[i%3];n.geometry.setAttribute("randomColor",new k1(e,3))}var Ze=class extends Mt(q1){constructor(e,r){super(e,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new $1;this.booleanExclude=null;Array.isArray(r)&&e.groups.length===0&&e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(e){}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}updateGeometry(e,r){let o=this.geometry,i=Zl[o.userData.type],s=this.objectType==="NonParametric"?Object.assign({},o.userData,{geometry:o}):o.userData,l=i.build(i.normalizeInputs(e,s)),c=o.uuid;this.geometry.dispose(),this.geometry=l,this.geometry.uuid=c,this.geometry.computeBoundingSphere(),gr(this),o.getAttribute("randomColor")&&yr(this)}clone(e){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,o=ui(r),i=this.material;return new this.constructor(o,i).copy(this,e)}copy(e,r=!0){return super.copy(e,r),e.cloner&&(this.cloner=new uo(e,e.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new uo(this)),this.cloner.fromClonerState(e))}fromState(e,r){return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=e.castShadow??!0,this.receiveShadow=e.receiveShadow??!0,this.booleanExclude=e.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Ft.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),sr(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)ir(e)&&(e.freeBooleanPointer(),sr(e)&&e.invalidateUpstreamBooleanData())}};var K1=new wc(0,0,1),Cm=new wc,Lm=new wc,Mm=new Y1,Nn=class extends Ze{constructor(e=Je.create({}),r){super(e,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new X1;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e,r){if(super.updateGeometry(e,r),"userData"in this.geometry){let o=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:o})}}setShape(e){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=e,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),Mm.getNormalMatrix(this.matrixWorld),Cm.copy(K1).applyMatrix3(Mm).normalize(),Lm.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Cm,Lm)}clone(e){let r=this.shape.clone(),o=this.material,i=this.geometry.userData,s=Je.create(Object.assign({},i,{shape:r})),l=new Nn(s,o).copy(this,e);return l.shape=r,r.update(),l}raycast(e,r){Ze.prototype.raycast.call(this,e,r)}};var xr=(n,t)=>class extends n{constructor(){super(...arguments);this.objectHelper=new t(this)}get geometryHelper(){return t.geometryHelper}raycast(o,i){this.objectHelper.raycast(o,i)}fromLightState(o,i){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;o.color!==void 0&&(s.color=Xe(o.color,i)),o.intensity!==void 0&&(s.intensity=o.intensity),o.depth!==void 0&&(s.shadow.camera.far=o.depth,s.shadow.needsUpdate=!0),o.shadows!==void 0&&(this.castShadow=o.shadows)}return this}};var In=new Ht,_c=new Ht,Or=class extends xr(Mt(Q1),Ys){constructor(e=window.innerWidth,r=window.innerHeight,o=45,i,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=io.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=r,this.orthoCamera=new Z1(e*-.5,e*.5,r*.5,r*-.5,i??-5e4,s),this.perspCamera=new J1(o,e/r,i??50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(e,r){let o=new Or().fromState(r);return o.objectHelper.update(),o.uuid=e,o}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(In),this.targetOffset=In.distanceTo(e)}getTarget(e=new Ht){return this.getWorldDirection(_c),this.getWorldPosition(In),_c.multiplyScalar(this.targetOffset),e.copy(In).add(_c),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(In),In.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new e_),r=new Ht(0,0,1).applyQuaternion(e),o=new Ht().copy(Em.DefaultUp);this.isUpVectorFlipped&&o.negate(),o.applyQuaternion(e);let i=new Ht().copy(Em.DefaultUp).projectOnPlane(r),s=new Ht().crossVectors(i,o).dot(r)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(o)*s}getViewFrontToObject(e){let r=e.getWorldPosition(new Ht),i=e.getWorldDirection(new Ht).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){let r=e.getWorldPosition(new Ht),i=this.getWorldDirection(new Ht).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,r){this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=e/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,o,i,s,l){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,o,i,s,l):this.orthoCamera.setViewOffset(e,r,o,i,s,l)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ko(r,e)}fromCameraState(e){let{orthographic:r,perspective:o}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),o!==void 0&&(o.near!==void 0&&(this.perspCamera.near=o.near),o.fov!==void 0&&(this.perspCamera.fov=o.fov),o.zoom!==void 0&&(this.perspCamera.zoom=o.zoom)),e.type==="PerspectiveCamera"?(this.zoom=this.perspCamera.zoom,this.fov=this.perspCamera.fov,this.near=this.perspCamera.near):(this.near=this.orthoCamera.near,this.zoom=this.orthoCamera.zoom),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};import{BufferGeometry as Bm,Matrix4 as t_}from"three";var Dm=new t_;var Ta=class extends Ze{constructor(e=new Bm,r){super(e,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];sr(s)&&s.recomputeBoolean(e===!0,r)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(fm(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5&&(s.booleanMeshSetAddress=Ft.getMeshSet(s.geometry,e===!0,r)),s.booleanMeshSetAddress===-1)return;Ft.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else sr(s)&&s.needsTransformForDownstream===!0?(Ft.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Dm.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Ft.transformMeshSet(s.booleanMeshSetAddress,Dm),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(e===!0)return Ft.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let o=this.geometry;o.dispose(),this.geometry=new Bm,this.geometry.userData=o.userData,this.geometry.boundingSphere=o.boundingSphere;try{this.booleanMeshSetAddress=Ft.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,gr(this),yr(this)}updateGeometry(e,r){let o=e.parameters;o.operation!==void 0&&(this.booleanOp=o.operation),o.phongAngle!==void 0&&(this.phongAngle=o.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};import{Group as r_}from"three";var xo=class extends xr(Mt(r_),en){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,r){let o=new xo().fromState(r);return o.uuid=e,o.objectHelper.update(),o}};import{DirectionalLight as o_,CameraHelper as Aa}from"three";var Pn=class extends xr(Mt(o_),Jo){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=-1e4,o.far=2500;let i=new Aa(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Pn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Aa&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Aa&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Aa&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(e,r){let o=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,r),e.size!==void 0&&lm(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),o&&this.update(),this}fromState(e,r){return super.fromState(e),this.fromDirectionalLightState(e,r),this}};import{PointLight as n_,Vector3 as Na,Box3 as i_,Box3Helper as Ia,Color as s_}from"three";var On=class extends xr(Mt(n_),tn){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;let i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z),l=new i_(i,s),c=new Ia(l,new s_(16755200));c.visible=!1,this._gizmos.shadowmap=c,this.update()}static createFromState(e,r,o){let i=new On().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ia&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ia&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let r=this._gizmos[e];if(r instanceof Ia){let o=this.shadow.camera,i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z);r.box.set(i,s),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromPointLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromPointLightState(e,r),this}};import{SpotLight as a_,CameraHelper as Pa,MathUtils as l_,Vector3 as Fm,Quaternion as c_}from"three";var Gm=new Fm,Rm=new Fm,Vm=new c_,Cn=class extends xr(Mt(a_),Zn){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=l_.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let i=new Pa(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Cn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Pa&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Pa&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Pa&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Rm.setFromMatrixPosition(this.matrixWorld),Vm.setFromRotationMatrix(this.matrixWorld),Gm.copy(this.up).applyQuaternion(Vm).negate().multiplyScalar(this.distance),this.target.position.copy(Rm).add(Gm),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromSpotLightState(e,r),this}};var zm=n=>n.tagName==="VIDEO",Ln=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;zm(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];Pm(s)&&Ln.resizeTextureLayer(t,e,s.uniforms[`f${s.id}_texture`].value)}}static resizeComplex(t,e,r,o){let i=t/e,s,l=r.image;zm(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 Oa=class extends Ze{constructor(e,r){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e,r){super.updateGeometry(e,r),this.material.layers&&Ln.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Mn=class extends Ze{constructor(e,r){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var Ca=class extends Mn{constructor(e,r){super(e,r);this.objectType="NonParametric"}};var jm,Ri=new Promise(n=>{jm=n}),Um=!1;async function km(){if(Um)return;let n=await import("./opentype.js");jm(n),Um=!0}var Vi=class{async load(t,e,r=()=>{}){let{load:o}=await Ri;o(t,(i,s)=>{i||!s?r(i??"Something went wrong"):e(s)})}async parse(t){let{parse:e}=await Ri;try{return e(t)}catch(r){console.error(r)}}};async function u_(n){return await(await fetch(n)).arrayBuffer()}var p_=new Vi;async function Tc(n){let t,e,r=!1;if(n.url?(t=await u_(n.url),e=n.url,r=n.url.startsWith("/")):n.data&&(t=n.data.buffer),t){let o=await p_.parse(t);if(o)return{font:o,url:e,intercepted:r,arr:t}}}import{Vector3 as d_,Matrix4 as f_,Ray as m_}from"three";var Hm=new d_,Wm=new f_,qm=new m_;function $m(n){let t=!1;return n.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="TextGeometry"&&(t=!0)}),t}var La=class extends Ze{constructor(e,r,o){super(new fn(r.geometry,o),o.material(r.material));this.data=r;this.objectType="TextFrame";this.wrappedText=[""];this.charWidths=[];this.charCoords=[];this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.name=r.name,this.uuid=e,this.updateState(r,o)}async updateGeometry(e,r){let o=e.parameters,i={...this.geometry.userData.parameters,...o};this.geometry.userData={parameters:i,type:"TextGeometry"},r&&(o.font||!this.geometry.font&&r.getFont(i.font))&&await this.geometry.updateFont(o.font??i.font,r),await this.geometry.update(i),gr(this),yr(this);let{wrappedText:s,charCoords:l,charWidths:c}=this.geometry;this.wrappedText=s,this.charWidths=c,this.charCoords=l,this.resetBBoxNeedsUpdate()}updateState(e,r){this.data=e,this.material=r.material(e.material),this.fromState(e,r),this.updateGeometry({parameters:e.geometry},r)}get font(){return this.geometry.font}get initialOffsetY(){return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,this.geometry.userData.parameters.height,this.fontScale,this.geometry.userData.parameters.verticalAlign)??0}get fontScale(){return this.font?this.geometry.userData.parameters.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){return this.geometry.userData.parameters.fontSize*this.geometry.userData.parameters.lineHeight}raycast(e,r){let{matrixWorld:o}=this;if(Wm.copy(o).invert(),qm.copy(e.ray).applyMatrix4(Wm),qm.intersectBox(this.singleBBox,Hm)){let i=Hm.applyMatrix4(o),s=e.ray.origin.distanceTo(i);r.push({distance:s,point:i.clone(),object:this})}}};import{Box3 as h_,Matrix4 as vo,Sphere as Km,Vector3 as g_}from"three";var Zm=Lc(Ym());var Ac;pa.then(n=>{Ac=n});var Jm=new vo,y_=new vo,x_=new vo,Wt=new h_,Jr=new g_,v_=new vo,b_=new vo;var En=class extends Ze{constructor(e,r,o,i){super(o??r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new vo;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new vo;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:l}=Ct.build(r.geometry,void 0,void 0,!r.flatShading),c=o.material(r.material),p=new En(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}=Ct.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,gr(this),yr(this),e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){Ct.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&Ct.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Ct.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Ct.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(e,r){this.geometry=this.originalGeometry,Ze.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,Zm.SVD)(r),l=Jm.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=y_.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=x_.copy(c).transpose();this.shearScale=v_.makeScale(s[0],s[1],s[2]).multiply(p).premultiply(c),this.shearScaleInv=b_.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 Km);let r=e.attributes.position,o=e.boundingSphere.center;Wt.setFromBufferAttribute(r),Wt.getCenter(o),e.boundingSphere.radius=o.distanceTo(Wt.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Wt.getSize(Jr);let i={width:Jr.x,height:Jr.y,depth:Jr.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;Wt.min.set(e[0],e[2],e[4]),Wt.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(Wt.min.applyMatrix4(this.shearScaleInv),Wt.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Km);let o=r.boundingSphere.center;Wt.getCenter(o),r.boundingSphere.radius=o.distanceTo(Wt.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Wt.getSize(Jr);let i={width:Jr.x,height:Jr.y,depth:Jr.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(Ac.free_bvh(this.subdivPointer),Ac.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e,r){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,Qm(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Qm(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 Qm(n,t,e,r){let o=n.position.array,i=n.normal.array,s=Jm.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 S_,BufferGeometry as w_,DoubleSide as __,FrontSide as T_}from"three";function eh(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=T_:t.side===1?n.side=S_:n.side=__)}function A_(n,t){if(Array.isArray(n.material))for(let e of n.material)eh(e,t);else{let e=n.material;eh(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function th(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=En.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new w_:da(t.geometry,e),i="materials"in t?t.materials.map(s=>e.material(s)):e.material(t.material);ps.is2DParametricMesh(o.userData.type)?r=new Oa(o,i):o?.userData.type==="VectorGeometry"?r=new Nn(o,i):t.geometry.type==="NonParametricGeometry"?r=new Ca(o,i):t.geometry.type==="BooleanGeometry"?(r=new Ta(void 0,i),r.booleanOp=t.geometry.operation,t.geometry.phongAngle!==void 0&&(r.phongAngle=t.geometry.phongAngle)):r=new Mn(o,i),r.uuid=n,r.fromState(t,e)}return A_(r,t),r}function rh(n,t,e){return t.type==="Mesh"?t.geometry.type==="TextGeometry"?new La(n,t,e):th(n,t,e):t.type==="Empty"?xo.createFromState(n,t):t.type==="PointLight"?On.createFromState(n,t,e):t.type==="SpotLight"?Cn.createFromState(n,t,e):t.type==="DirectionalLight"?Pn.createFromState(n,t,e):Oo.is(t.type)?Or.createFromState(n,t):(console.error(t),new xo)}var bo=class extends _t{};import{Mesh as ih,Ray as I_,Matrix4 as P_,Raycaster as O_}from"three";function oh(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,yr(n),gr(n)),r.length===0&&o.length===0&&n.layers.set(0),e}function nh(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 sh(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof ih)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)oh(e,e.material[r])&&(t=!0);else oh(e,e.material)&&(t=!0)}),t}function ah(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof ih)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)nh(e,e.material[r])&&(t=!0);else nh(e,e.material)&&(t=!0)}),t}function lh(n){"material"in n&&C_(n.material),"geometry"in n&&n.geometry.dispose()}function C_(n){Ld(n).forEach(t=>{t instanceof bo||t.dispose()})}var L_=new O_,M_=new P_,E_=new I_;function ch(n,t,e){let r=n.cloner;if(r)for(let o of r.children){let i=M_.copy(o.matrixWorld).invert(),s=E_.copy(t.ray).applyMatrix4(i),l=n.matrixWorld;s.applyMatrix4(l);let c=L_;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 uh=new G_,Nc=class extends ga(D_){constructor(e,r){super();this.objectType="Scene";this.backupFog=new R_(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 ke(1,1,1,1);this.entityByUuid={};this.ambientLight=new B_(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),this.matrixAutoUpdate=!1}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=ah(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=sh(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(Xe(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 Or&&this.switchActiveCamera(o)}this.traverse(o=>{sr(o)&&o.recomputeBoolean()})}clearScene(){this.traverseEntity(e=>{lh(e)});for(let e of this.children)lr(e)&&e.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Or.createFromState(Nc.PERSONAL_CAMERA_ID,{...Fs.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)lr(s)&&!s.raycastLock&&s.visible&&((ir(s)||ha(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,r),ch(s,e,r)),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)lr(r)&&r.traverseEntity(e)}traverseVisibleEntity(e){for(let r of this.children)lr(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=Xe(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}dispose(){this.clearScene()}updateAmbientLight(e,r){am(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=Xe(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=rh(e,r,s);return l&&(this.entityByUuid[e]=l,i.add(l),sr(i)&&ir(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 V_;return o.setFromPoints(r),o.getCenter(uh),uh}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 Ze)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof _t&&e(r.material[o]);else r.material instanceof _t&&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})})}},Fi=Nc;Fi.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var mh=Lc(ph());var dh=new Map;function fh(n){if(typeof n=="string")return n;let t=dh.get(n);return t||(t={url:URL.createObjectURL(new Blob([n]))},dh.set(n,t)),t.url}var Bn=class{constructor({src:t,volume:e,delay:r,loop:o}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let i;typeof t=="string"?i={src:t}:i={src:fh(t),format:"wav"},this.sound=new mh.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 status(){return this._status}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}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}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._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}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()}};import{Box2 as F_,Vector2 as So,Path as hh,Shape as z_,ShapeUtils as U_,Color as j_}from"three";var Ba=class{constructor(){this.type="ShapePath";this.color=new j_;this.subPaths=[];this.currentPath=null}moveTo(t,e){return this.currentPath=new hh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,r,o){return this.currentPath?.quadraticCurveTo(t,e,r,o),this}bezierCurveTo(t,e,r,o,i,s){return this.currentPath?.bezierCurveTo(t,e,r,o,i,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let e={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},r={loc:e.ORIGIN,t:0};function o(h,g,v,x){let w=h.x,S=g.x,b=v.x,I=x.x,_=h.y,y=g.y,P=v.y,A=x.y,O=(I-b)*(_-P)-(A-P)*(w-b),T=(S-w)*(_-P)-(y-_)*(w-b),L=(A-P)*(S-w)-(I-b)*(y-_),B=O/L,j=T/L;if(L===0&&O!==0||B<=0||B>=1||j<0||j>1)return null;if(O===0&&L===0){for(let te=0;te<2;te++)if(i(te===0?v:x,h,g),r.loc===e.ORIGIN){let ne=te===0?v:x;return{x:ne.x,y:ne.y,t:r.t}}else if(r.loc===e.BETWEEN){let ne=+(w+r.t*(S-w)).toPrecision(10),se=+(_+r.t*(y-_)).toPrecision(10);return{x:ne,y:se,t:r.t}}return null}else{for(let se=0;se<2;se++)if(i(se===0?v:x,h,g),r.loc===e.ORIGIN){let U=se===0?v:x;return{x:U.x,y:U.y,t:r.t}}let te=+(w+B*(S-w)).toPrecision(10),ne=+(_+B*(y-_)).toPrecision(10);return{x:te,y:ne,t:B}}}function i(h,g,v){let x=v.x-g.x,w=v.y-g.y,S=h.x-g.x,b=h.y-g.y,I=x*b-S*w;if(h.x===g.x&&h.y===g.y){r.loc=e.ORIGIN,r.t=0;return}if(h.x===v.x&&h.y===v.y){r.loc=e.DESTINATION,r.t=1;return}if(I<-Number.EPSILON){r.loc=e.LEFT;return}if(I>Number.EPSILON){r.loc=e.RIGHT;return}if(x*S<0||w*b<0){r.loc=e.BEHIND;return}if(Math.sqrt(x*x+w*w)<Math.sqrt(S*S+b*b)){r.loc=e.BEYOND;return}let _;x!==0?_=S/x:_=b/w,r.loc=e.BETWEEN,r.t=_}function s(h,g){let v=[],x=[];for(let w=1;w<h.length;w++){let S=h[w-1],b=h[w];for(let I=1;I<g.length;I++){let _=g[I-1],y=g[I],P=o(S,b,_,y);P!==null&&v.find(A=>A.t<=P.t+Number.EPSILON&&A.t>=P.t-Number.EPSILON)===void 0&&(v.push(P),x.push(new So(P.x,P.y)))}}return x}function l(h,g,v){let x=new So;g.getCenter(x);let w=[];return v.forEach(S=>{S.boundingBox.containsPoint(x)&&s(h,S.points).forEach(I=>{w.push({identifier:S.identifier,isCW:S.isCW,point:I})})}),w.sort((S,b)=>S.point.x-b.point.x),w}function c(h,g,v,x,w){(w==null||w==="")&&(w="nonzero");let S=new So;h.boundingBox.getCenter(S);let b=[new So(v,S.y),new So(x,S.y)],I=l(b,h.boundingBox,g);I.sort((T,L)=>T.point.x-L.point.x);let _=[],y=[];I.forEach(T=>{T.identifier===h.identifier?_.push(T):y.push(T)});let P=_[0].point.x,A=[],O=0;for(;O<y.length&&y[O].point.x<P;)A.length>0&&A[A.length-1]===y[O].identifier?A.pop():A.push(y[O].identifier),O++;if(A.push(h.identifier),w==="evenodd"){let T=A.length%2===0,L=A[A.length-2];return{identifier:h.identifier,isHole:T,for:L}}else if(w==="nonzero"){let T=!0,L=null,B=null;for(let j=0;j<A.length;j++){let te=A[j];g[te]&&(T?(B=g[te].isCW,T=!1,L=te):B!==g[te].isCW&&(B=g[te].isCW,T=!0))}return{identifier:h.identifier,isHole:T,for:L}}else console.warn('fill-rule: "'+w+'" is currently not implemented.')}let p=0,a=999999999,u=-999999999,d=[];this.subPaths.forEach(h=>{let g=h.getPoints(),v=-999999999,x=999999999,w=-999999999,S=999999999;for(let b=0;b<g.length;b++){let I=g[b];I.y>v&&(v=I.y),I.y<x&&(x=I.y),I.x>w&&(w=I.x),I.x<S&&(S=I.x)}u<=w&&(u=w+1),a>=S&&(a=S-1),g.length&&d.push({curves:h.curves,points:g,isCW:U_.isClockWise(g),identifier:p++,boundingBox:new F_(new So(S,x),new So(w,v))})});let f=d.map(h=>c(h,d,a,u,this.userData?.style.fillRule)),m=[];return d.forEach(h=>{let g=f[h.identifier];if(g&&!g.isHole){let v=new z_;v.curves=h.curves,f.filter(w=>w?.isHole&&w.for===h.identifier).forEach(w=>{if(w){let S=d[w.identifier],b=new hh;b.curves=S.curves,v.holes.push(b)}}),m.push(v)}}),m}};import{CubicBezierCurve as q_,LineCurve as $_,QuadraticBezierCurve as X_}from"three";import{DRACOLoader as k_}from"three/examples/jsm/loaders/DRACOLoader.js";var eo;function H_(){return eo||(eo=new k_,eo.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),eo.decoderPending}async function W_(n){if(eo){let t={attributeIDs:eo.defaultAttributeIDs,attributeTypes:eo.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await eo.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 gh(n,t){let[e,r]=Ua(is.deserialize(new Uint8Array(n)));Vd(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 H_();for(let i of o){let s=await W_(ut(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}function Y_(n,t){return t.state.glyphIndex===n||t.state.fina===n||t.state.medi===n||t.state.init===n}var Da=class{constructor(t,e){this._arrayBuffer=new ArrayBuffer(1);this._isLoaded=!1;this._intercepted=!1;this._isUserFont=t.isUserFont??!1,this._loadingPromise=Tc(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}update(t,e){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=Tc(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}async reverseLigaturesTable(t,e,r){let{Bidi:o}=await Ri,i=new o,s=u=>t.charToGlyphIndex(u.char);i.registerModifier("glyphIndex",null,s),i.applyFeatures(t,t.defaultRenderOptions.features),i.getTextGlyphs(e);let l=i.tokenizer.tokens,c=[],p=0,a=r.length===l.length;for(let u=0;u<r.length;u++){let d=r[u].index,f=String.fromCharCode(r[u].unicode),m=l[p];if(Y_(d,m)||a)c.push({char:f,index:d,replacements:[m.state.glyphIndex],replacementChars:[m.char]}),p++;else{let h=m.char,g="",v=[m.state.glyphIndex],x=[],w=!1;for(;!w;)p++,g=e.charAt(p),h+=g,v.push(t.charToGlyphIndex(g)),x=t.stringToGlyphs(h),x.length===1&&x[0].index===d&&(w=!0),p>e.length&&(w=!0);c.push({char:f,index:d,replacements:v,replacementChars:Array.from(h)}),p++}}return c}async generateShapes(t,e){await this._loadingPromise;let r=this.font,o=e.fontSize/this.unitsPerEm,i=e.fontSize*e.lineHeight,s=t.map(x=>this.getTextWidth(x,e)),l=e.width,c=this.getCharWidth(`
|
|
1334
|
+
}`,[it.simplex,e,o,s])}}();import{Matrix3 as V1}from"three";function Im(n,t,e){n.setUvTransform(e[0],e[1],t[0],t[1],0,0,0)}var _a=class extends Sn{constructor(e,r){super(new V1);this.repeat=e;this.offset=r;Im(this.value,e,r)}updateMatrix(){Im(this.value,this.repeat,this.offset)}};var mr=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)yc(i,this,r)}get type(){return this.data.type}static create(t,e,r,o){if(r.type==="light")return hr.createLigherLayer(t,e,r,o);if(r.type==="texture"){let i=o.image(r.texture.image),s=new Ei(i,r.texture.wrapping),l=new wa(i),c=new _a(r.texture.repeat,r.texture.offset),p=new Y(r.crop?1:0),a=new ye(r.projection??0),u=new ye(["x","y","z"].indexOf(r.axis)??0),d=new ye(r.side??0),f=new Ke(r.size?new yo(r.size[0],r.size[1]):new yo(100,100)),m=new Y(r.alpha??1),h=new ye(r.mode??0),g=new Ti(s,l,p,a,u,d,f,c,m,h),v=new Se(g.calpha,"f");return new He(t,e,r,{texture:s,textureSize:l,crop:p,projection:a,axis:u,side:d,size:f,mat:c,alpha:m,mode:h},g,h,v)}else if(r.type==="matcap"){let i=o.image(r.texture.image),s=new Ei(i,r.texture.wrapping),l=new Y(r.alpha??1),c=new ye(r.mode??0),p=new Mi(s,l,c),a=new Se(p.calpha,"f");return new He(t,e,r,{texture:s,alpha:l,mode:c},p,c,a)}else if(r.type==="displace")if(r.displacementType==="noise"){let i=new et(new fr(...r.offset)),s=new Y(r.scale??10),l=new Y(r.intensity??8),c=new Y(r.movement??1),p=new ye(r.noiseType??0),a=new wi(l,c,i,s,p);return new Di(t,e,r,{offset:i,scale:s,intensity:l,movement:c,noiseType:p},a)}else throw new Error;else return z1(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:Nm(o.props,r,this,e)}else if(o.path[0]==="texture")return"texture"in e?gc(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}},He=class extends mr{constructor(e,r,o,i,s,l,c){super(e,r,o,i);this.color=s;this.mode=l;this.alpha=c}},Di=class extends mr{constructor(e,r,o,i,s){super(e,r,o,i);this.position=s}},hr=class extends mr{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 ye(o.mode),p;if(!o.visible)s=new ho,p={};else if(o.category==="lambert"){s=new Ii;let a=new _e(i.color(o.emissive)??0);p={emissive:a},s.emissive=a}else if(o.category==="toon"){s=new Oi;let a=new Y(o.shininess??30),u=new _e(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}else if(o.category==="physical"){s=new Pi;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 ba;let a=new Y(o.shininess??30),u=new _e(i.color(o.specular)??1118481);p={shininess:a,specular:u},s.shininess=a,s.specular=u}return s.alpha=new Y(1),s.shadingAlpha=l,s.shadingBlend=c,p.alpha=s.shadingAlpha,p.mode=s.shadingBlend,new hr(e,r,o,s,p)}};function Pm(n){let t=n instanceof mr?n.type:n;return t==="texture"||t==="displace_map"||t==="matcap"}function F1(n,t,e,r){switch(n.type){case"color":{let o=new _e(r.color??5855577),i=new Y(r.alpha??1),s=new Se("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ye(r.mode??0);return o.alpha=i,new He(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}case"fresnel":{let o=new _e(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 ye(r.mode??0),u=new gi(o,i,s,l,c,p,a),d=new Se(u.calpha,"f");return new He(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 et(r.wavelengths??new fr(0,0,0)),l=new Y(r.noiseStrength??0),c=new Y(r.noiseScale??1),p=new et(r.offset??new fr(0,0,0)),a=new Y(r.alpha??1),u=new yi(o,i,s,l,c,p,a),d=new Se(u.calpha,"f"),f=new ye(r.mode??0);return new He(t,e,n,{filmThickness:o,movement:i,wavelengths:s,noiseStrength:l,noiseScale:c,offset:p,alpha:a,mode:f},u,f,d)}case"transmission":{let o=new Y(r.thickness??10),i=new Y(r.ior??1.5),s=new Y(r.roughness??.5),l=tt.transmissionSize,c=tt.transmissionRenderTarget,p=tt.transmissionRenderTargetDepth,a=window.innerWidth,u=window.innerHeight,d=a>=u?new Ke(u/a,1):new Ke(1,a/u),f=new Y(r.alpha??1),m=new vi(o,i,s,l,c,p,d,f),h=new Se(m.calpha,"f"),g=new ye(r.mode??0);return new He(t,e,n,{thickness:o,ior:i,roughness:s,aspectRatio:d,alpha:f,mode:g},m,g,h)}case"toon":{let o=new ye(r.positioning??0),i;r.colors?i=new kt(r.colors.length,r.colors):(i=new kt(10,new An(0,0,0,1)),i.value[1]=new An(1,1,1,1));let s;r.steps?s=new jt(r.steps.length,r.steps):(s=new jt(10,1),s.value[0]=0);let l=new et(r.source??new fr(0,0,0)),c=new Kr(r.isWorldSpace??!0),p=new Y(r.noiseStrength??0),a=new Y(r.noiseScale??1),u=new Et(r.shadowColor),d=new et(r.offset??new fr(0,0,0)),f=new Y(r.alpha??1),m=new Bi(o,i,s,l,c,p,a,u,d,f),h=new Se(m.calpha,"f"),g=new ye(r.mode??0);return new He(t,e,n,{positioning:o,colors:i,steps:s,source:l,isWorldSpace:c,noiseStrength:p,noiseScale:a,shadowColor:u,offset:d,alpha:f,mode:g},m,g,h)}case"outline":{let o=new _e(r.outlineColor??16777215),i=new _e(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 et(r.contourDirections??new fr(0,1,0)),f=new Kr(r.positionalLines??!1),m=new Kr(r.compensation??!0),h=tt.normalRenderTarget,g=tt.normalRenderTargetDepth,v=tt.pixelRatioNode,x=tt.resolution,w=new Y(r.alpha??1),S=new xi(o,i,s,l,c,p,a,u,d,f,m,x,h,g,v,w),b=new Se(S.calpha,"f"),I=new ye(r.mode??0);return new He(t,e,n,{outlineColor:o,contourColor:i,outlineWidth:s,contourWidth:l,outlineThreshold:c,contourThreshold:p,outlineSmoothing:a,contourFrequency:u,contourDirection:d,positionalLines:f,compensation:m,alpha:w,mode:I},S,I,b)}case"depth":{let o=new ye(r.gradientType??0),i=new Kr(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 et(r.origin??new fr),u=new et(r.direction??new fr),d;r.colors?d=new kt(r.colors.length,r.colors):(d=new kt(2,new An(0,0,0,1)),d.value[1]=new An(1,1,1,1));let f;r.steps?f=new jt(r.steps.length,r.steps):(f=new jt(2,1),f.value[0]=0);let m=new Y(r.alpha??1),h=new ye(r.mode??0),g=new bi(o,i,s,l,c,p,a,u,d,f,m),v=new Se(g.calpha,"f");return new He(t,e,n,{gradientType:o,smooth:i,near:s,far:l,isVector:c,isWorldSpace:p,origin:a,direction:u,colors:d,steps:f,alpha:m,mode:h},g,h,v)}case"noise":{let o=new Y(r.scale??1),i=new et(r.size??new fr(100,100,100)),s=new Y(r.move??1),l=new Ke(r.fA??new yo(1.7,9.2)),c=new Ke(r.fB??new yo(8.3,2.8)),p=new Ke(r.distortion??new yo(1,1)),a=new Et(r.colorA),u=new Et(r.colorB),d=new Et(r.colorC),f=new Et(r.colorD),m=new Y(r.alpha??1),h=new ye(r.mode??0),g=new ye(r.noiseType??0),v=new hi(o,i,s,l,c,p,a,u,d,f,m,g),x=new Se(v.calpha,"f");return new He(t,e,n,{scale:o,size:i,move:s,fA:l,fB:c,distortion:p,colorA:a,colorB:u,colorC:d,colorD:f,alpha:m,mode:h,noiseType:g},v,h,x)}case"normal":{let o=new et(r.cnormal??new fr(1,1,1)),i=new Y(r.alpha??1),s=new ye(r.mode??0),l=new Ni(o,i),c=new Se("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return c.keywords.alpha=i,new He(t,e,n,{cnormal:o,alpha:i,mode:s},l,s,c)}case"gradient":{let o=new ye(r.gradientType??0),i=new Kr(r.smooth??!1),s;r.colors?s=new kt(r.colors.length,r.colors):(s=new kt(10,new An(0,0,0,1)),s.value[1]=new An(1,1,1,1));let l;r.steps?l=new jt(r.steps.length,r.steps):(l=new jt(10,1),l.value[0]=0);let c=new Ke(r.offset??new yo(0,0)),p=new Ke(r.morph??new yo(0,0)),a=new Y(r.angle??0),u=new Y(r.alpha??1),d=new ye(r.mode??0),f=new _i(o,i,s,l,c,p,a,u),m=new Se(f.calpha,"f");return new He(t,e,n,{gradientType:o,smooth:i,colors:s,steps:l,offset:c,morph:p,angle:a,alpha:u,mode:d},f,d,m)}default:{let o=new _e(1,0,0,1),i=new Y(1),s=new Se("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");s.keywords.alpha=i;let l=new ye(0);return o.alpha=i,new He(t,e,n,{color:o,alpha:i,mode:l},o,l,s)}}}function z1(n,t,e,r){let o=_m(e,r);return F1(e,n,t,o)}function yc(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 _t=class extends j1{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??St.defaultTwoLayerData("phong").layers;this.layers=o.map(i=>mr.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 hr),this.lightLayer===void 0&&(this.lightLayer=new hr(0,"",{...Jt.defaultData("light","phong"),visible:!1},new ho,{})),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=mr.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=mr.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 He),r=this.layers.findIndex(o=>o instanceof hr);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 He&&(o=new Si(o,s.color,s.alpha,s.mode))}this.fragment.color=o}else this.fragment.color=void 0}blendAfterColors(){let e=new Se("outgoingLight","f"),r=this.layers.findIndex(o=>o instanceof hr);if(this.layers.length>r+1){for(let o=r+1;o<this.layers.length;++o){let i=this.layers[o];i instanceof He&&(e=new Si(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 Di);if(e.length>0){let r=e[0].position;for(let o=1;o<e.length;++o)e[o]&&(r=new ht(r,e[o].position,ht.ADD),r=new ht(r,new Y(.5).setReadonly(!0),ht.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(){let e="[";for(let{data:r}of this.data.layers)if(r.type==="light")e+=`"${r.visible?r.category.toUpperCase():"Basic"}"`;else{let o=(mc[r.type]??[]).map(l=>r[l]),i=(hc[r.type]??[]).map(l=>r[l]?.length??0),s=[...o,...i];s.length?e+=`["${r.type}", "${s.join('","')}"],`:e+=`"${r.type}",`}return e=e.slice(0,-1)+"]",e}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 va;return this.lights=this.lightLayer.data.visible,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>U1,this}dispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}getHash(){let e="{";return e+='"fragment":'+this.fragment.getHash(),e+="}",e}};Object.defineProperties(_t.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(n){n===!0&&this.version++,this.needsCompile=n},get:function(){return this.needsCompile}}});import{MathUtils as bc,BufferAttribute as k1,Vector3 as Sc,Float32BufferAttribute as Om}from"three";function H1(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position||!n.geometry.attributes.normal)return;let t=new Map,e=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,o=new Float32Array(e.length);for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=new Sc(r[i],r[i+1],r[i+2]);t.has(s)?t.get(s)?.normals.push(l):t.set(s,{normals:[l],result:new Sc})}t.forEach((i,s)=>{for(let l of i.normals)i.result.add(l);i.result.divideScalar(i.normals.length)});for(let i=0;i<e.length;i+=3){let s=`${e[i]}_${e[i+1]}_${e[i+2]}`,l=t.get(s)?.result;l&&(o[i]=l.x,o[i+1]=l.y,o[i+2]=l.z)}n.geometry.setAttribute("extrudeNormal",new Om(o,3))}function W1(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=new Sc;for(let o=0;o<t.length;o+=3)r.set(t[o],t[o+1],t[o+2]).normalize(),e[o]=r.x,e[o+1]=r.y,e[o+2]=r.z;n.geometry.setAttribute("extrudeNormal",new Om(e,3))}function gr(n){if(Array.isArray(n.material)){for(let t of n.material)if(t.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof _t)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"||n.objectType==="TextFrame"&&n.data?.geometry?.depth===0?W1(n):H1(n)}function yr(n){if(!n.geometry.attributes.position)return;let t=n.geometry.attributes.position.array,e=new Float32Array(t.length),r=parseInt(n.uuid.replace(/\D/g,"")),o=[bc.seededRandom(r),bc.seededRandom(r+1e4),bc.seededRandom(r+2e4)];for(let i=0;i<t.length;i++)e[i]=o[i%3];n.geometry.setAttribute("randomColor",new k1(e,3))}var Ze=class extends Mt(q1){constructor(e,r){super(e,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new $1;this.booleanExclude=null;Array.isArray(r)&&e.groups.length===0&&e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(e){}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}updateGeometry(e,r){let o=this.geometry,i=Zl[o.userData.type],s=this.objectType==="NonParametric"?Object.assign({},o.userData,{geometry:o}):o.userData,l=i.build(i.normalizeInputs(e,s)),c=o.uuid;this.geometry.dispose(),this.geometry=l,this.geometry.uuid=c,this.geometry.computeBoundingSphere(),gr(this),o.getAttribute("randomColor")&&yr(this)}clone(e){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,o=ui(r),i=this.material;return new this.constructor(o,i).copy(this,e)}copy(e,r=!0){return super.copy(e,r),e.cloner&&(this.cloner=new uo(e,e.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new uo(this)),this.cloner.fromClonerState(e))}fromState(e,r){return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=e.castShadow??!0,this.receiveShadow=e.receiveShadow??!0,this.booleanExclude=e.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Ft.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),sr(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)ir(e)&&(e.freeBooleanPointer(),sr(e)&&e.invalidateUpstreamBooleanData())}};var K1=new wc(0,0,1),Cm=new wc,Lm=new wc,Mm=new Y1,Nn=class extends Ze{constructor(e=Je.create({}),r){super(e,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new X1;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e,r){if(super.updateGeometry(e,r),"userData"in this.geometry){let o=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:o})}}setShape(e){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=e,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),Mm.getNormalMatrix(this.matrixWorld),Cm.copy(K1).applyMatrix3(Mm).normalize(),Lm.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Cm,Lm)}clone(e){let r=this.shape.clone(),o=this.material,i=this.geometry.userData,s=Je.create(Object.assign({},i,{shape:r})),l=new Nn(s,o).copy(this,e);return l.shape=r,r.update(),l}raycast(e,r){Ze.prototype.raycast.call(this,e,r)}};var xr=(n,t)=>class extends n{constructor(){super(...arguments);this.objectHelper=new t(this)}get geometryHelper(){return t.geometryHelper}raycast(o,i){this.objectHelper.raycast(o,i)}fromLightState(o,i){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;o.color!==void 0&&(s.color=Xe(o.color,i)),o.intensity!==void 0&&(s.intensity=o.intensity),o.depth!==void 0&&(s.shadow.camera.far=o.depth,s.shadow.needsUpdate=!0),o.shadows!==void 0&&(this.castShadow=o.shadows)}return this}};var In=new Ht,_c=new Ht,Or=class extends xr(Mt(Q1),Ys){constructor(e=window.innerWidth,r=window.innerHeight,o=45,i,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=io.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=r,this.orthoCamera=new Z1(e*-.5,e*.5,r*.5,r*-.5,i??-5e4,s),this.perspCamera=new J1(o,e/r,i??50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(e,r){let o=new Or().fromState(r);return o.objectHelper.update(),o.uuid=e,o}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(In),this.targetOffset=In.distanceTo(e)}getTarget(e=new Ht){return this.getWorldDirection(_c),this.getWorldPosition(In),_c.multiplyScalar(this.targetOffset),e.copy(In).add(_c),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(In),In.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new e_),r=new Ht(0,0,1).applyQuaternion(e),o=new Ht().copy(Em.DefaultUp);this.isUpVectorFlipped&&o.negate(),o.applyQuaternion(e);let i=new Ht().copy(Em.DefaultUp).projectOnPlane(r),s=new Ht().crossVectors(i,o).dot(r)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(o)*s}getViewFrontToObject(e){let r=e.getWorldPosition(new Ht),i=e.getWorldDirection(new Ht).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){let r=e.getWorldPosition(new Ht),i=this.getWorldDirection(new Ht).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,r){this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=e/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,o,i,s,l){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,o,i,s,l):this.orthoCamera.setViewOffset(e,r,o,i,s,l)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ko(r,e)}fromCameraState(e){let{orthographic:r,perspective:o}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),o!==void 0&&(o.near!==void 0&&(this.perspCamera.near=o.near),o.fov!==void 0&&(this.perspCamera.fov=o.fov),o.zoom!==void 0&&(this.perspCamera.zoom=o.zoom)),e.type==="PerspectiveCamera"?(this.zoom=this.perspCamera.zoom,this.fov=this.perspCamera.fov,this.near=this.perspCamera.near):(this.near=this.orthoCamera.near,this.zoom=this.orthoCamera.zoom),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};import{BufferGeometry as Bm,Matrix4 as t_}from"three";var Dm=new t_;var Ta=class extends Ze{constructor(e=new Bm,r){super(e,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(e,r=!0){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];sr(s)&&s.recomputeBoolean(e===!0,r)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(fm(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5&&(s.booleanMeshSetAddress=Ft.getMeshSet(s.geometry,e===!0,r)),s.booleanMeshSetAddress===-1)return;Ft.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else sr(s)&&s.needsTransformForDownstream===!0?(Ft.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Dm.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Ft.transformMeshSet(s.booleanMeshSetAddress,Dm),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(e===!0)return Ft.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let o=this.geometry;o.dispose(),this.geometry=new Bm,this.geometry.userData=o.userData,this.geometry.boundingSphere=o.boundingSphere;try{this.booleanMeshSetAddress=Ft.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,gr(this),yr(this)}updateGeometry(e,r){let o=e.parameters;o.operation!==void 0&&(this.booleanOp=o.operation),o.phongAngle!==void 0&&(this.phongAngle=o.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};import{Group as r_}from"three";var xo=class extends xr(Mt(r_),en){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,r){let o=new xo().fromState(r);return o.uuid=e,o.objectHelper.update(),o}};import{DirectionalLight as o_,CameraHelper as Aa}from"three";var Pn=class extends xr(Mt(o_),Jo){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=-1e4,o.far=2500;let i=new Aa(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Pn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Aa&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Aa&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Aa&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(e,r){let o=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,r),e.size!==void 0&&lm(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),o&&this.update(),this}fromState(e,r){return super.fromState(e),this.fromDirectionalLightState(e,r),this}};import{PointLight as n_,Vector3 as Na,Box3 as i_,Box3Helper as Ia,Color as s_}from"three";var On=class extends xr(Mt(n_),tn){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;let i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z),l=new i_(i,s),c=new Ia(l,new s_(16755200));c.visible=!1,this._gizmos.shadowmap=c,this.update()}static createFromState(e,r,o){let i=new On().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ia&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ia&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let r=this._gizmos[e];if(r instanceof Ia){let o=this.shadow.camera,i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z);r.box.set(i,s),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}fromPointLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromPointLightState(e,r),this}};import{SpotLight as a_,CameraHelper as Pa,MathUtils as l_,Vector3 as Fm,Quaternion as c_}from"three";var Gm=new Fm,Rm=new Fm,Vm=new c_,Cn=class extends xr(Mt(a_),Zn){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let o=this.shadow.camera;o.fov=l_.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let i=new Pa(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Cn().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Pa&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Pa&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Pa&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Rm.setFromMatrixPosition(this.matrixWorld),Vm.setFromRotationMatrix(this.matrixWorld),Gm.copy(this.up).applyQuaternion(Vm).negate().multiplyScalar(this.distance),this.target.position.copy(Rm).add(Gm),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromSpotLightState(e,r),this}};var zm=n=>n.tagName==="VIDEO",Ln=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;zm(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];Pm(s)&&Ln.resizeTextureLayer(t,e,s.uniforms[`f${s.id}_texture`].value)}}static resizeComplex(t,e,r,o){let i=t/e,s,l=r.image;zm(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 Oa=class extends Ze{constructor(e,r){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e,r){super.updateGeometry(e,r),this.material.layers&&Ln.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Mn=class extends Ze{constructor(e,r){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var Ca=class extends Mn{constructor(e,r){super(e,r);this.objectType="NonParametric"}};var jm,Ri=new Promise(n=>{jm=n}),Um=!1;async function km(){if(Um)return;let n=await import("./opentype.js");jm(n),Um=!0}var Vi=class{async load(t,e,r=()=>{}){let{load:o}=await Ri;o(t,(i,s)=>{i||!s?r(i??"Something went wrong"):e(s)})}async parse(t){let{parse:e}=await Ri;try{return e(t)}catch(r){console.error(r)}}};async function u_(n){return await(await fetch(n)).arrayBuffer()}var p_=new Vi;async function Tc(n){let t,e,r=!1;if(n.url?(t=await u_(n.url),e=n.url,r=n.url.startsWith("/")):n.data&&(t=n.data.buffer),t){let o=await p_.parse(t);if(o)return{font:o,url:e,intercepted:r,arr:t}}}import{Vector3 as d_,Matrix4 as f_,Ray as m_}from"three";var Hm=new d_,Wm=new f_,qm=new m_;function $m(n){let t=!1;return n.scene.objects.traverse((e,r)=>{r.type==="Mesh"&&r.geometry.type==="TextGeometry"&&(t=!0)}),t}var La=class extends Ze{constructor(e,r,o){super(new fn(r.geometry,o),o.material(r.material));this.data=r;this.objectType="TextFrame";this.wrappedText=[""];this.charWidths=[];this.charCoords=[];this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.name=r.name,this.uuid=e,this.updateState(r,o)}async updateGeometry(e,r){let o=e.parameters,i={...this.geometry.userData.parameters,...o};this.geometry.userData={parameters:i,type:"TextGeometry"},r&&(o.font||!this.geometry.font&&r.getFont(i.font))&&await this.geometry.updateFont(o.font??i.font,r),await this.geometry.update(i),gr(this),yr(this);let{wrappedText:s,charCoords:l,charWidths:c}=this.geometry;this.wrappedText=s,this.charWidths=c,this.charCoords=l,this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateState(e,r){this.data=e,this.material=r.material(e.material),this.fromState(e,r),this.updateGeometry({parameters:e.geometry},r)}get font(){return this.geometry.font}get initialOffsetY(){return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,this.geometry.userData.parameters.height,this.fontScale,this.geometry.userData.parameters.verticalAlign)??0}get fontScale(){return this.font?this.geometry.userData.parameters.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){return this.geometry.userData.parameters.fontSize*this.geometry.userData.parameters.lineHeight}raycast(e,r){let{matrixWorld:o}=this;if(Wm.copy(o).invert(),qm.copy(e.ray).applyMatrix4(Wm),qm.intersectBox(this.singleBBox,Hm)){let i=Hm.applyMatrix4(o),s=e.ray.origin.distanceTo(i);r.push({distance:s,point:i.clone(),object:this})}}};import{Box3 as h_,Matrix4 as vo,Sphere as Km,Vector3 as g_}from"three";var Zm=Lc(Ym());var Ac;pa.then(n=>{Ac=n});var Jm=new vo,y_=new vo,x_=new vo,Wt=new h_,Jr=new g_,v_=new vo,b_=new vo;var En=class extends Ze{constructor(e,r,o,i){super(o??r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new vo;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new vo;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:l}=Ct.build(r.geometry,void 0,void 0,!r.flatShading),c=o.material(r.material),p=new En(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}=Ct.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,gr(this),yr(this),e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){Ct.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&Ct.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Ct.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Ct.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(e,r){this.geometry=this.originalGeometry,Ze.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,Zm.SVD)(r),l=Jm.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=y_.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=x_.copy(c).transpose();this.shearScale=v_.makeScale(s[0],s[1],s[2]).multiply(p).premultiply(c),this.shearScaleInv=b_.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 Km);let r=e.attributes.position,o=e.boundingSphere.center;Wt.setFromBufferAttribute(r),Wt.getCenter(o),e.boundingSphere.radius=o.distanceTo(Wt.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Wt.getSize(Jr);let i={width:Jr.x,height:Jr.y,depth:Jr.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;Wt.min.set(e[0],e[2],e[4]),Wt.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(Wt.min.applyMatrix4(this.shearScaleInv),Wt.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Km);let o=r.boundingSphere.center;Wt.getCenter(o),r.boundingSphere.radius=o.distanceTo(Wt.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Wt.getSize(Jr);let i={width:Jr.x,height:Jr.y,depth:Jr.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(Ac.free_bvh(this.subdivPointer),Ac.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e,r){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,Qm(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Qm(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 Qm(n,t,e,r){let o=n.position.array,i=n.normal.array,s=Jm.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 S_,BufferGeometry as w_,DoubleSide as __,FrontSide as T_}from"three";function eh(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=T_:t.side===1?n.side=S_:n.side=__)}function A_(n,t){if(Array.isArray(n.material))for(let e of n.material)eh(e,t);else{let e=n.material;eh(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function th(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=En.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new w_:da(t.geometry,e),i="materials"in t?t.materials.map(s=>e.material(s)):e.material(t.material);ps.is2DParametricMesh(o.userData.type)?r=new Oa(o,i):o?.userData.type==="VectorGeometry"?r=new Nn(o,i):t.geometry.type==="NonParametricGeometry"?r=new Ca(o,i):t.geometry.type==="BooleanGeometry"?(r=new Ta(void 0,i),r.booleanOp=t.geometry.operation,t.geometry.phongAngle!==void 0&&(r.phongAngle=t.geometry.phongAngle)):r=new Mn(o,i),r.uuid=n,r.fromState(t,e)}return A_(r,t),r}function rh(n,t,e){return t.type==="Mesh"?t.geometry.type==="TextGeometry"?new La(n,t,e):th(n,t,e):t.type==="Empty"?xo.createFromState(n,t):t.type==="PointLight"?On.createFromState(n,t,e):t.type==="SpotLight"?Cn.createFromState(n,t,e):t.type==="DirectionalLight"?Pn.createFromState(n,t,e):Oo.is(t.type)?Or.createFromState(n,t):(console.error(t),new xo)}var bo=class extends _t{};import{Mesh as ih,Ray as I_,Matrix4 as P_,Raycaster as O_}from"three";function oh(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,yr(n),gr(n)),r.length===0&&o.length===0&&n.layers.set(0),e}function nh(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 sh(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof ih)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)oh(e,e.material[r])&&(t=!0);else oh(e,e.material)&&(t=!0)}),t}function ah(n){let t=!1;return n.traverseEntity(e=>{if(e instanceof ih)if(Array.isArray(e.material))for(let r=0;r<e.material.length;r++)nh(e,e.material[r])&&(t=!0);else nh(e,e.material)&&(t=!0)}),t}function lh(n){"material"in n&&C_(n.material),"geometry"in n&&n.geometry.dispose()}function C_(n){Ld(n).forEach(t=>{t instanceof bo||t.dispose()})}var L_=new O_,M_=new P_,E_=new I_;function ch(n,t,e){let r=n.cloner;if(r)for(let o of r.children){let i=M_.copy(o.matrixWorld).invert(),s=E_.copy(t.ray).applyMatrix4(i),l=n.matrixWorld;s.applyMatrix4(l);let c=L_;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 uh=new G_,Nc=class extends ga(D_){constructor(e,r){super();this.objectType="Scene";this.backupFog=new R_(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 ke(1,1,1,1);this.entityByUuid={};this.ambientLight=new B_(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),this.matrixAutoUpdate=!1}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=ah(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=sh(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(Xe(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 Or&&this.switchActiveCamera(o)}this.traverse(o=>{sr(o)&&o.recomputeBoolean()})}clearScene(){this.traverseEntity(e=>{lh(e)});for(let e of this.children)lr(e)&&e.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Or.createFromState(Nc.PERSONAL_CAMERA_ID,{...Fs.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)lr(s)&&!s.raycastLock&&s.visible&&((ir(s)||ha(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,r),ch(s,e,r)),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)lr(r)&&r.traverseEntity(e)}traverseVisibleEntity(e){for(let r of this.children)lr(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=Xe(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}dispose(){this.clearScene()}updateAmbientLight(e,r){am(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=Xe(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=rh(e,r,s);return l&&(this.entityByUuid[e]=l,i.add(l),sr(i)&&ir(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 V_;return o.setFromPoints(r),o.getCenter(uh),uh}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 Ze)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)r.material[o]instanceof _t&&e(r.material[o]);else r.material instanceof _t&&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})})}},Fi=Nc;Fi.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var mh=Lc(ph());var dh=new Map;function fh(n){if(typeof n=="string")return n;let t=dh.get(n);return t||(t={url:URL.createObjectURL(new Blob([n]))},dh.set(n,t)),t.url}var Bn=class{constructor({src:t,volume:e,delay:r,loop:o}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let i;typeof t=="string"?i={src:t}:i={src:fh(t),format:"wav"},this.sound=new mh.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 status(){return this._status}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}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}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._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}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()}};import{Box2 as F_,Vector2 as So,Path as hh,Shape as z_,ShapeUtils as U_,Color as j_}from"three";var Ba=class{constructor(){this.type="ShapePath";this.color=new j_;this.subPaths=[];this.currentPath=null}moveTo(t,e){return this.currentPath=new hh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,r,o){return this.currentPath?.quadraticCurveTo(t,e,r,o),this}bezierCurveTo(t,e,r,o,i,s){return this.currentPath?.bezierCurveTo(t,e,r,o,i,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let e={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},r={loc:e.ORIGIN,t:0};function o(h,g,v,x){let w=h.x,S=g.x,b=v.x,I=x.x,_=h.y,y=g.y,P=v.y,A=x.y,O=(I-b)*(_-P)-(A-P)*(w-b),T=(S-w)*(_-P)-(y-_)*(w-b),L=(A-P)*(S-w)-(I-b)*(y-_),B=O/L,j=T/L;if(L===0&&O!==0||B<=0||B>=1||j<0||j>1)return null;if(O===0&&L===0){for(let te=0;te<2;te++)if(i(te===0?v:x,h,g),r.loc===e.ORIGIN){let ne=te===0?v:x;return{x:ne.x,y:ne.y,t:r.t}}else if(r.loc===e.BETWEEN){let ne=+(w+r.t*(S-w)).toPrecision(10),se=+(_+r.t*(y-_)).toPrecision(10);return{x:ne,y:se,t:r.t}}return null}else{for(let se=0;se<2;se++)if(i(se===0?v:x,h,g),r.loc===e.ORIGIN){let U=se===0?v:x;return{x:U.x,y:U.y,t:r.t}}let te=+(w+B*(S-w)).toPrecision(10),ne=+(_+B*(y-_)).toPrecision(10);return{x:te,y:ne,t:B}}}function i(h,g,v){let x=v.x-g.x,w=v.y-g.y,S=h.x-g.x,b=h.y-g.y,I=x*b-S*w;if(h.x===g.x&&h.y===g.y){r.loc=e.ORIGIN,r.t=0;return}if(h.x===v.x&&h.y===v.y){r.loc=e.DESTINATION,r.t=1;return}if(I<-Number.EPSILON){r.loc=e.LEFT;return}if(I>Number.EPSILON){r.loc=e.RIGHT;return}if(x*S<0||w*b<0){r.loc=e.BEHIND;return}if(Math.sqrt(x*x+w*w)<Math.sqrt(S*S+b*b)){r.loc=e.BEYOND;return}let _;x!==0?_=S/x:_=b/w,r.loc=e.BETWEEN,r.t=_}function s(h,g){let v=[],x=[];for(let w=1;w<h.length;w++){let S=h[w-1],b=h[w];for(let I=1;I<g.length;I++){let _=g[I-1],y=g[I],P=o(S,b,_,y);P!==null&&v.find(A=>A.t<=P.t+Number.EPSILON&&A.t>=P.t-Number.EPSILON)===void 0&&(v.push(P),x.push(new So(P.x,P.y)))}}return x}function l(h,g,v){let x=new So;g.getCenter(x);let w=[];return v.forEach(S=>{S.boundingBox.containsPoint(x)&&s(h,S.points).forEach(I=>{w.push({identifier:S.identifier,isCW:S.isCW,point:I})})}),w.sort((S,b)=>S.point.x-b.point.x),w}function c(h,g,v,x,w){(w==null||w==="")&&(w="nonzero");let S=new So;h.boundingBox.getCenter(S);let b=[new So(v,S.y),new So(x,S.y)],I=l(b,h.boundingBox,g);I.sort((T,L)=>T.point.x-L.point.x);let _=[],y=[];I.forEach(T=>{T.identifier===h.identifier?_.push(T):y.push(T)});let P=_[0].point.x,A=[],O=0;for(;O<y.length&&y[O].point.x<P;)A.length>0&&A[A.length-1]===y[O].identifier?A.pop():A.push(y[O].identifier),O++;if(A.push(h.identifier),w==="evenodd"){let T=A.length%2===0,L=A[A.length-2];return{identifier:h.identifier,isHole:T,for:L}}else if(w==="nonzero"){let T=!0,L=null,B=null;for(let j=0;j<A.length;j++){let te=A[j];g[te]&&(T?(B=g[te].isCW,T=!1,L=te):B!==g[te].isCW&&(B=g[te].isCW,T=!0))}return{identifier:h.identifier,isHole:T,for:L}}else console.warn('fill-rule: "'+w+'" is currently not implemented.')}let p=0,a=999999999,u=-999999999,d=[];this.subPaths.forEach(h=>{let g=h.getPoints(),v=-999999999,x=999999999,w=-999999999,S=999999999;for(let b=0;b<g.length;b++){let I=g[b];I.y>v&&(v=I.y),I.y<x&&(x=I.y),I.x>w&&(w=I.x),I.x<S&&(S=I.x)}u<=w&&(u=w+1),a>=S&&(a=S-1),g.length&&d.push({curves:h.curves,points:g,isCW:U_.isClockWise(g),identifier:p++,boundingBox:new F_(new So(S,x),new So(w,v))})});let f=d.map(h=>c(h,d,a,u,this.userData?.style.fillRule)),m=[];return d.forEach(h=>{let g=f[h.identifier];if(g&&!g.isHole){let v=new z_;v.curves=h.curves,f.filter(w=>w?.isHole&&w.for===h.identifier).forEach(w=>{if(w){let S=d[w.identifier],b=new hh;b.curves=S.curves,v.holes.push(b)}}),m.push(v)}}),m}};import{CubicBezierCurve as q_,LineCurve as $_,QuadraticBezierCurve as X_}from"three";import{DRACOLoader as k_}from"three/examples/jsm/loaders/DRACOLoader.js";var eo;function H_(){return eo||(eo=new k_,eo.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),eo.decoderPending}async function W_(n){if(eo){let t={attributeIDs:eo.defaultAttributeIDs,attributeTypes:eo.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await eo.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 gh(n,t){let[e,r]=Ua(is.deserialize(new Uint8Array(n)));Vd(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 H_();for(let i of o){let s=await W_(ut(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}function Y_(n,t){return t.state.glyphIndex===n||t.state.fina===n||t.state.medi===n||t.state.init===n}var Da=class{constructor(t,e){this._arrayBuffer=new ArrayBuffer(1);this._isLoaded=!1;this._intercepted=!1;this._isUserFont=t.isUserFont??!1,this._loadingPromise=Tc(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}update(t,e){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=Tc(t).then(r=>{r&&(this._arrayBuffer=r.arr,this._url=r.url,this.font=r.font,this._intercepted=r.intercepted,this._isLoaded=!0,e())})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}async reverseLigaturesTable(t,e,r){let{Bidi:o}=await Ri,i=new o,s=u=>t.charToGlyphIndex(u.char);i.registerModifier("glyphIndex",null,s),i.applyFeatures(t,t.defaultRenderOptions.features),i.getTextGlyphs(e);let l=i.tokenizer.tokens,c=[],p=0,a=r.length===l.length;for(let u=0;u<r.length;u++){let d=r[u].index,f=String.fromCharCode(r[u].unicode),m=l[p];if(Y_(d,m)||a)c.push({char:f,index:d,replacements:[m.state.glyphIndex],replacementChars:[m.char]}),p++;else{let h=m.char,g="",v=[m.state.glyphIndex],x=[],w=!1;for(;!w;)p++,g=e.charAt(p),h+=g,v.push(t.charToGlyphIndex(g)),x=t.stringToGlyphs(h),x.length===1&&x[0].index===d&&(w=!0),p>e.length&&(w=!0);c.push({char:f,index:d,replacements:v,replacementChars:Array.from(h)}),p++}}return c}async generateShapes(t,e){await this._loadingPromise;let r=this.font,o=e.fontSize/this.unitsPerEm,i=e.fontSize*e.lineHeight,s=t.map(x=>this.getTextWidth(x,e)),l=e.width,c=this.getCharWidth(`
|
|
1335
1335
|
`,e),p=e.horizontalAlign===1?c:0,a=this.computeSpaceWidthForLine(t,0,e),u=this.getLineInitialOffsetX(s[0],l,e.horizontalAlign,t[0],c),d=this.getLineInitialOffsetY(i,t.length,e.height,o,e.verticalAlign),f=[],m=t.map(x=>[]),h=t.map(x=>[]),g;for(let x=0;x<t.length;x++){let w=t[x],S={features:{liga:!0}},b=[];try{b=r.stringToGlyphs(w,S)}catch(_){console.warn(_)}u=this.getLineInitialOffsetX(s[x],l,e.horizontalAlign,w,c);let I=[];try{I=await this.reverseLigaturesTable(r,w,b)}catch(_){console.warn(_)}a=this.computeSpaceWidthForLine(t,x,e);for(let _=0;_<b.length;_++){let y=b[_],P=y.index===0?`
|
|
1336
1336
|
`:y.unicode?String.fromCharCode(y.unicode):void 0,A=I[_],O=0,T=0;_===0&&e.horizontalAlign===2&&y.leftSideBearing!==void 0&&(T=-y.leftSideBearing*o),g&&(O=r.getKerningValue(y,g)*o),u+=T+O;let L=0;if(P===`
|
|
1337
1337
|
`)L=p;else if(P===" ")L=a;else{let B=this.createPath(y,o,u,d,e);B&&(L=B.offsetX-(O+T),f.push(B.path))}if(A.replacements.length===1)h[x].push([u,d]),m[x].push(L);else{let B=A.replacements.map(se=>(r.glyphs.get(se).advanceWidth??0)*o),j=B.reduce((se,U)=>se+=U,0),te=B.map(se=>se/j),ne=u;for(let se=0;se<te.length;se++){let U=L*te[se];h[x].push([ne,d]),m[x].push(U),ne+=U}}u+=L,g=y}d-=i}let v=[];for(let x=0,w=f.length;x<w;x++)v.push(...f[x].toShapes());return{shapes:v,charWidths:m,lineWidths:s,charCoords:h}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,r,o,i){return(r===3||r===2)&&o.indexOf(`
|