text: !function(){var e,t;e=this,t=function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(n);class a extends t.Loader{constructor(e){if(super(e),void 0===o.default)throw Error("THREE.VRMLLoader: External library chevrotain.min.js required.")}load(e,n,r,o){const a=this,s=""===a.path?t.LoaderUtils.extractUrlBase(e):a.path,l=new t.FileLoader(a.manager);l.setPath(a.path),l.setRequestHeader(a.requestHeader),l.setWithCredentials(a.withCredentials),l.load(e,(function(t){try{n(a.parse(t,s))}catch(t){o?o(t):console.error(t),a.manager.itemError(e)}}),r,o)}parse(e,n){const r={};function a(e){e.DEF&&(r[e.DEF]=e);const t=e.fields;for(let e=0,n=t.length;e<n;e++){const n=t[e];if("node"===n.type){const e=n.values;for(let t=0,n=e.length;t<n;t++)a(e[t])}}}function l(e){return e.USE?function(e){const t=l(r[e]);return t.isObject3D||t.isMaterial?t.clone():t}(e.USE):(void 0!==e.build||(e.build=function(e){const n=e.name;let r;switch(n){case"Group":case"Transform":case"Collision":r=function(e){const n=new t.Group,r=e.fields;for(let e=0,o=r.length;e<o;e++){const o=r[e],a=o.name,s=o.values;switch(a){case"bboxCenter":case"bboxSize":case"center":case"collide":case"scaleOrientation":case"proxy":break;case"children":p(s,n);break;case"rotation":const e=new t.Vector3(s[0],s[1],s[2]),r=s[3];n.quaternion.setFromAxisAngle(e,r);break;case"scale":n.scale.set(s[0],s[1],s[2]);break;case"translation":n.position.set(s[0],s[1],s[2]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}return n}(e);break;case"Background":r=function(e){const n=new t.Group;let r,o,a,s;const l=e.fields;for(let e=0,t=l.length;e<t;e++){const t=l[e],n=t.name,i=t.values;switch(n){case"groundAngle":r=i;break;case"groundColor":o=i;break;case"backUrl":case"bottomUrl":case"frontUrl":case"leftUrl":case"rightUrl":case"topUrl":break;case"skyAngle":a=i;break;case"skyColor":s=i;break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}const i=1e4;if(s){const e=new t.SphereGeometry(i,32,16),r=new t.MeshBasicMaterial({fog:!1,side:t.BackSide,depthWrite:!1,depthTest:!1});s.length>3?(N(e,i,a,I(s),!0),r.vertexColors=!0):r.color.setRGB(s[0],s[1],s[2]);const o=new t.Mesh(e,r);n.add(o)}if(o&&o.length>0){const e=new t.SphereGeometry(i,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),a=new t.MeshBasicMaterial({fog:!1,side:t.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});N(e,i,r,I(o),!1);const s=new t.Mesh(e,a);n.add(s)}return n.renderOrder=-1/0,n}(e);break;case"Shape":r=function(e){const n=e.fields;let r,o,a=new t.MeshBasicMaterial({color:0});for(let e=0,t=n.length;e<t;e++){const t=n[e],o=t.name,s=t.values;switch(o){case"appearance":null!==s[0]&&(a=l(s[0]));break;case"geometry":null!==s[0]&&(r=l(s[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}if(r&&r.attributes.position){const e=r._type;if("points"===e){const e=new t.PointsMaterial({color:16777215});void 0!==r.attributes.color?e.vertexColors=!0:a.isMeshPhongMaterial&&e.color.copy(a.emissive),o=new t.Points(r,e)}else if("line"===e){const e=new t.LineBasicMaterial({color:16777215});void 0!==r.attributes.color?e.vertexColors=!0:a.isMeshPhongMaterial&&e.color.copy(a.emissive),o=new t.LineSegments(r,e)}else void 0!==r._solid&&(a.side=r._solid?t.FrontSide:t.DoubleSide),void 0!==r.attributes.color&&(a.vertexColors=!0),o=new t.Mesh(r,a)}else o=new t.Object3D,o.visible=!1;return o}(e);break;case"Appearance":r=function(e){let n,r=new t.MeshPhongMaterial;const o=e.fields;for(let e=0,a=o.length;e<a;e++){const a=o[e],s=a.name,i=a.values;switch(s){case"material":if(null!==i[0]){const e=l(i[0]);e.diffuseColor&&r.color.copy(e.diffuseColor),e.emissiveColor&&r.emissive.copy(e.emissiveColor),e.shininess&&(r.shininess=e.shininess),e.specularColor&&r.specular.copy(e.specularColor),e.transparency&&(r.opacity=1-e.transparency),e.transparency>0&&(r.transparent=!0)}else r=new t.MeshBasicMaterial({color:0});break;case"texture":const e=i[0];null!==e&&("ImageTexture"!==e.name&&"PixelTexture"!==e.name||(r.map=l(e)));break;case"textureTransform":null!==i[0]&&(n=l(i[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}if(r.map){if(r.map.__type){switch(r.map.__type){case u.INTENSITY_ALPHA:r.opacity=1;break;case u.RGB:r.color.set(16777215);break;case u.RGBA:r.color.set(16777215),r.opacity=1}delete r.map.__type}n&&(r.map.center.copy(n.center),r.map.rotation=n.rotation,r.map.repeat.copy(n.scale),r.map.offset.copy(n.translation))}return r}(e);break;case"Material":r=function(e){const n={},r=e.fields;for(let e=0,o=r.length;e<o;e++){const o=r[e],a=o.name,s=o.values;switch(a){case"ambientIntensity":break;case"diffuseColor":n.diffuseColor=new t.Color(s[0],s[1],s[2]);break;case"emissiveColor":case"specularColor":n.emissiveColor=new t.Color(s[0],s[1],s[2]);break;case"shininess":n.shininess=s[0];break;case"transparency":n.transparency=s[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}return n}(e);break;case"ImageTexture":r=function(e){let n,r=t.RepeatWrapping,o=t.RepeatWrapping;const a=e.fields;for(let e=0,s=a.length;e<s;e++){const s=a[e],l=s.name,i=s.values;switch(l){case"url":const e=i[0];e&&(n=B.load(e));break;case"repeatS":!1===i[0]&&(r=t.ClampToEdgeWrapping);break;case"repeatT":!1===i[0]&&(o=t.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",l)}}return n&&(n.wrapS=r,n.wrapT=o),n}(e);break;case"PixelTexture":r=function(e){let n,r=t.RepeatWrapping,o=t.RepeatWrapping;const a=e.fields;for(let e=0,s=a.length;e<s;e++){const s=a[e],l=s.name,i=s.values;switch(l){case"image":const e=i[0],a=i[1],s=d(i[2]),c=new Uint8Array(4*e*a),u={r:0,g:0,b:0,a:0};for(let e=3,t=0,n=i.length;e<n;e++,t++){f(i[e],s,u);const n=4*t;c[n+0]=u.r,c[n+1]=u.g,c[n+2]=u.b,c[n+3]=u.a}n=new t.DataTexture(c,e,a),n.needsUpdate=!0,n.__type=s;break;case"repeatS":!1===i[0]&&(r=t.ClampToEdgeWrapping);break;case"repeatT":!1===i[0]&&(o=t.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",l)}}return n&&(n.wrapS=r,n.wrapT=o),n}(e);break;case"TextureTransform":r=function(e){const n={center:new t.Vector2,rotation:new t.Vector2,scale:new t.Vector2,translation:new t.Vector2},r=e.fields;for(let e=0,t=r.length;e<t;e++){const t=r[e],o=t.name,a=t.values;switch(o){case"center":n.center.set(a[0],a[1]);break;case"rotation":n.rotation=a[0];break;case"scale":n.scale.set(a[0],a[1]);break;case"translation":n.translation.set(a[0],a[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}return n}(e);break;case"IndexedFaceSet":r=function(e){let n,r,o,a,s,i,c,u,f=!0,d=!0,p=0,m=!0,g=!0;const w=e.fields;for(let e=0,t=w.length;e<t;e++){const t=w[e],h=t.name,b=t.values;switch(h){case"color":const e=b[0];null!==e&&(n=l(e));break;case"coord":const t=b[0];null!==t&&(r=l(t));break;case"normal":const x=b[0];null!==x&&(o=l(x));break;case"texCoord":const w=b[0];null!==w&&(a=l(w));break;case"ccw":f=b[0];break;case"colorIndex":s=b;break;case"colorPerVertex":m=b[0];break;case"convex":break;case"coordIndex":i=b;break;case"creaseAngle":p=b[0];break;case"normalIndex":c=b;break;case"normalPerVertex":g=b[0];break;case"solid":d=b[0];break;case"texCoordIndex":u=b;break;default:console.warn("THREE.VRMLLoader: Unknown field:",h)}}if(void 0===i)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new t.BufferGeometry;const L=h(i,f);let E,k,y;n&&(E=!0===m?s&&s.length>0?T(L,h(s,f),n,3):U(L,new t.Float32BufferAttribute(n,3)):s&&s.length>0?A(L,b(x(n,s),i)):A(L,b(n,i))),k=o?!0===g?c&&c.length>0?T(L,h(c,f),o,3):U(L,new t.Float32BufferAttribute(o,3)):c&&c.length>0?A(L,b(x(o,c),i)):A(L,b(o,i)):M(L,r,p),a&&(y=u&&u.length>0?T(L,h(u,f),a,2):U(L,new t.Float32BufferAttribute(a,2)));const S=new t.BufferGeometry,R=U(L,new t.Float32BufferAttribute(r,3));return S.setAttribute("position",R),S.setAttribute("normal",k),E&&S.setAttribute("color",E),y&&S.setAttribute("uv",y),S._solid=d,S._type="mesh",S}(e);break;case"IndexedLineSet":r=function(e){let n,r,o,a,s=!0;const i=e.fields;for(let e=0,t=i.length;e<t;e++){const t=i[e],c=t.name,u=t.values;switch(c){case"color":const e=u[0];null!==e&&(n=l(e));break;case"coord":const t=u[0];null!==t&&(r=l(t));break;case"colorIndex":o=u;break;case"colorPerVertex":s=u[0];break;case"coordIndex":a=u;break;default:console.warn("THREE.VRMLLoader: Unknown field:",c)}}let c;const u=m(a);n&&(c=!0===s?o.length>0?T(u,m(o),n,3):U(u,new t.Float32BufferAttribute(n,3)):o.length>0?R(u,g(x(n,o),a)):R(u,g(n,a)));const f=new t.BufferGeometry,d=U(u,new t.Float32BufferAttribute(r,3));return f.setAttribute("position",d),c&&f.setAttribute("color",c),f._type="line",f}(e);break;case"PointSet":r=function(e){let n,r;const o=e.fields;for(let e=0,t=o.length;e<t;e++){const t=o[e],a=t.name,s=t.values;switch(a){case"color":const e=s[0];null!==e&&(n=l(e));break;case"coord":const t=s[0];null!==t&&(r=l(t));break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}const a=new t.BufferGeometry;return a.setAttribute("position",new t.Float32BufferAttribute(r,3)),n&&a.setAttribute("color",new t.Float32BufferAttribute(n,3)),a._type="points",a}(e);break;case"Box":r=function(e){const n=new t.Vector3(2,2,2),r=e.fields;for(let e=0,t=r.length;e<t;e++){const t=r[e],o=t.name,a=t.values;"size"===o?(n.x=a[0],n.y=a[1],n.z=a[2]):console.warn("THREE.VRMLLoader: Unknown field:",o)}return new t.BoxGeometry(n.x,n.y,n.z)}(e);break;case"Cone":r=function(e){let n=1,r=2,o=!1;const a=e.fields;for(let e=0,t=a.length;e<t;e++){const t=a[e],s=t.name,l=t.values;switch(s){case"bottom":o=!l[0];break;case"bottomRadius":n=l[0];break;case"height":r=l[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}return new t.ConeGeometry(n,r,16,1,o)}(e);break;case"Cylinder":r=function(e){let n=1,r=2;const o=e.fields;for(let e=0,t=o.length;e<t;e++){const t=o[e],a=t.name,s=t.values;switch(a){case"bottom":case"side":case"top":break;case"radius":n=s[0];break;case"height":r=s[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}return new t.CylinderGeometry(n,n,r,16,1)}(e);break;case"Sphere":r=function(e){let n=1;const r=e.fields;for(let e=0,t=r.length;e<t;e++){const t=r[e],o=t.name,a=t.values;"radius"===o?n=a[0]:console.warn("THREE.VRMLLoader: Unknown field:",o)}return new t.SphereGeometry(n,16,16)}(e);break;case"ElevationGrid":r=function(e){let n,r,o,a,s=!0,i=!0,c=!0,u=!0,f=0,d=2,p=2,h=1,b=1;const x=e.fields;for(let e=0,t=x.length;e<t;e++){const t=x[e],m=t.name,g=t.values;switch(m){case"color":const e=g[0];null!==e&&(n=l(e));break;case"normal":const t=g[0];null!==t&&(r=l(t));break;case"texCoord":const x=g[0];null!==x&&(o=l(x));break;case"height":a=g;break;case"ccw":u=g[0];break;case"colorPerVertex":s=g[0];break;case"creaseAngle":f=g[0];break;case"normalPerVertex":i=g[0];break;case"solid":c=g[0];break;case"xDimension":d=g[0];break;case"xSpacing":h=g[0];break;case"zDimension":p=g[0];break;case"zSpacing":b=g[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",m)}}const m=[],g=[],w=[],L=[];for(let e=0;e<p;e++)for(let t=0;t<d;t++){const l=e*d+t,c=h*e,u=a[l],f=b*t;if(m.push(c,u,f),n&&!0===s){const e=n[3*l+0],t=n[3*l+1],r=n[3*l+2];w.push(e,t,r)}if(r&&!0===i){const e=r[3*l+0],t=r[3*l+1],n=r[3*l+2];g.push(e,t,n)}if(o){const e=o[2*l+0],t=o[2*l+1];L.push(e,t)}else L.push(e/(d-1),t/(p-1))}const E=[];for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){const n=e+t*d,r=e+(t+1)*d,o=e+1+(t+1)*d,a=e+1+t*d;!0===u?(E.push(n,o,r),E.push(o,n,a)):(E.push(n,r,o),E.push(o,a,n))}const k=U(E,new t.Float32BufferAttribute(m,3)),y=U(E,new t.Float32BufferAttribute(L,2));let S,T;if(n)if(!1===s){for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){const r=e+t*(d-1),o=n[3*r+0],a=n[3*r+1],s=n[3*r+2];w.push(o,a,s),w.push(o,a,s),w.push(o,a,s),w.push(o,a,s),w.push(o,a,s),w.push(o,a,s)}S=new t.Float32BufferAttribute(w,3)}else S=U(E,new t.Float32BufferAttribute(w,3));if(r)if(!1===i){for(let e=0;e<d-1;e++)for(let t=0;t<p-1;t++){const n=e+t*(d-1),o=r[3*n+0],a=r[3*n+1],s=r[3*n+2];g.push(o,a,s),g.push(o,a,s),g.push(o,a,s),g.push(o,a,s),g.push(o,a,s),g.push(o,a,s)}T=new t.Float32BufferAttribute(g,3)}else T=U(E,new t.Float32BufferAttribute(g,3));else T=M(E,m,f);const A=new t.BufferGeometry;return A.setAttribute("position",k),A.setAttribute("normal",T),A.setAttribute("uv",y),S&&A.setAttribute("color",S),A._solid=c,A._type="mesh",A}(e);break;case"Extrusion":r=function(e){let n,r,o=[1,1,1,-1,-1,-1,-1,1,1,1],a=[0,0,0,0,1,0],s=!0,l=!0,i=0,c=!0,u=!0;const f=e.fields;for(let e=0,t=f.length;e<t;e++){const t=f[e],d=t.name,p=t.values;switch(d){case"beginCap":s=p[0];break;case"ccw":l=p[0];break;case"convex":break;case"creaseAngle":i=p[0];break;case"crossSection":o=p;break;case"endCap":c=p[0];break;case"orientation":r=p;break;case"scale":n=p;break;case"solid":u=p[0];break;case"spine":a=p;break;default:console.warn("THREE.VRMLLoader: Unknown field:",d)}}const d=o[0]===o[o.length-2]&&o[1]===o[o.length-1],p=[],h=new t.Vector3,b=new t.Vector3,x=new t.Vector3,m=new t.Vector3,g=new t.Quaternion;for(let e=0,t=0,s=0,l=a.length;e<l;e+=3,t+=2,s+=4){h.fromArray(a,e),b.x=n?n[t+0]:1,b.y=1,b.z=n?n[t+1]:1,x.x=r?r[s+0]:0,x.y=r?r[s+1]:0,x.z=r?r[s+2]:1;const l=r?r[s+3]:0;for(let e=0,t=o.length;e<t;e+=2)m.x=o[e+0],m.y=0,m.z=o[e+1],m.multiply(b),g.setFromAxisAngle(x,l),m.applyQuaternion(g),m.add(h),p.push(m.x,m.y,m.z)}const w=[],L=a.length/3,E=o.length/2;for(let e=0;e<L-1;e++)for(let t=0;t<E-1;t++){const n=t+e*E;let r=t+1+e*E;const o=t+(e+1)*E;let a=t+1+(e+1)*E;t===E-2&&!0===d&&(r=e*E,a=(e+1)*E),!0===l?(w.push(n,r,o),w.push(o,r,a)):(w.push(n,o,r),w.push(o,a,r))}if(!0===s||!0===c){const e=[];for(let n=0,r=o.length;n<r;n+=2)e.push(new t.Vector2(o[n],o[n+1]));const n=t.ShapeUtils.triangulateShape(e,[]),r=[];for(let e=0,t=n.length;e<t;e++){const t=n[e];r.push(t[0],t[1],t[2])}if(!0===s)for(let e=0,t=r.length;e<t;e+=3)!0===l?w.push(r[e+0],r[e+1],r[e+2]):w.push(r[e+0],r[e+2],r[e+1]);if(!0===c){const e=E*(L-1);for(let t=0,n=r.length;t<n;t+=3)!0===l?w.push(e+r[t+0],e+r[t+2],e+r[t+1]):w.push(e+r[t+0],e+r[t+1],e+r[t+2])}}const k=U(w,new t.Float32BufferAttribute(p,3)),y=M(w,p,i),S=new t.BufferGeometry;return S.setAttribute("position",k),S.setAttribute("normal",y),S._solid=u,S._type="mesh",S}(e);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":r=function(e){return e.fields[0].values}(e);break;case"WorldInfo":r=function(e){const t={},n=e.fields;for(let e=0,r=n.length;e<r;e++){const r=n[e],o=r.name,a=r.values;switch(o){case"title":t.title=a[0];break;case"info":t.info=a;break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}return t}(e);break;case"Anchor":case"Billboard":case"Inline":case"LOD":case"Switch":case"AudioClip":case"DirectionalLight":case"PointLight":case"Script":case"Sound":case"SpotLight":case"CylinderSensor":case"PlaneSensor":case"ProximitySensor":case"SphereSensor":case"TimeSensor":case"TouchSensor":case"VisibilitySensor":case"Text":case"FontStyle":case"MovieTexture":case"ColorInterpolator":case"CoordinateInterpolator":case"NormalInterpolator":case"OrientationInterpolator":case"PositionInterpolator":case"ScalarInterpolator":case"Fog":case"NavigationInfo":case"Viewpoint":break;default:console.warn("THREE.VRMLLoader: Unknown node:",n)}return void 0!==r&&void 0!==e.DEF&&!0===r.hasOwnProperty("name")&&(r.name=e.DEF),r}(e)),e.build)}function f(e,t,n){let r;switch(t){case u.INTENSITY:r=parseInt(e),n.r=r,n.g=r,n.b=r,n.a=1;break;case u.INTENSITY_ALPHA:r=parseInt("0x"+e.substring(2,4)),n.r=r,n.g=r,n.b=r,n.a=parseInt("0x"+e.substring(4,6));break;case u.RGB:n.r=parseInt("0x"+e.substring(2,4)),n.g=parseInt("0x"+e.substring(4,6)),n.b=parseInt("0x"+e.substring(6,8)),n.a=1;break;case u.RGBA:n.r=parseInt("0x"+e.substring(2,4)),n.g=parseInt("0x"+e.substring(4,6)),n.b=parseInt("0x"+e.substring(6,8)),n.a=parseInt("0x"+e.substring(8,10))}}function d(e){let t;switch(e){case 1:t=u.INTENSITY;break;case 2:t=u.INTENSITY_ALPHA;break;case 3:t=u.RGB;break;case 4:t=u.RGBA}return t}function p(e,n){for(let r=0,o=e.length;r<o;r++){const o=l(e[r]);o instanceof t.Object3D&&n.add(o)}}function h(e,t){const n=[];let r=0;for(let o=0,a=e.length;o<a;o++){const s=e[r],l=e[o+(t?1:2)],i=e[o+(t?2:1)];n.push(s,l,i),(-1===e[o+3]||o+3>=a)&&(o+=3,r=o+1)}return n}function b(e,t){const n=[];let r=0;for(let o=0,a=t.length;o<a;o++){const s=3*r,l=e[s],i=e[s+1],c=e[s+2];n.push(l,i,c),(-1===t[o+3]||o+3>=a)&&(o+=3,r++)}return n}function x(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=3*t[r],a=e[o],s=e[o+1],l=e[o+2];n.push(a,s,l)}return n}function m(e){const t=[];for(let n=0,r=e.length;n<r;n++){const o=e[n],a=e[n+1];t.push(o,a),(-1===e[n+2]||n+2>=r)&&(n+=2)}return t}function g(e,t){const n=[];let r=0;for(let o=0,a=t.length;o<a;o++){const s=3*r,l=e[s],i=e[s+1],c=e[s+2];n.push(l,i,c),(-1===t[o+2]||o+2>=a)&&(o+=2,r++)}return n}const w=new t.Vector3,L=new t.Vector3,E=new t.Vector3,k=new t.Vector2,y=new t.Vector2,S=new t.Vector2;function T(e,n,r,o){const a=[];for(let t=0,s=e.length;t<s;t+=3){const e=n[t],s=n[t+1],l=n[t+2];2===o?(k.fromArray(r,e*o),y.fromArray(r,s*o),S.fromArray(r,l*o),a.push(k.x,k.y),a.push(y.x,y.y),a.push(S.x,S.y)):(w.fromArray(r,e*o),L.fromArray(r,s*o),E.fromArray(r,l*o),a.push(w.x,w.y,w.z),a.push(L.x,L.y,L.z),a.push(E.x,E.y,E.z))}return new t.Float32BufferAttribute(a,o)}function A(e,n){const r=[];for(let t=0,o=0,a=e.length;t<a;t+=3,o++)w.fromArray(n,3*o),r.push(w.x,w.y,w.z),r.push(w.x,w.y,w.z),r.push(w.x,w.y,w.z);return new t.Float32BufferAttribute(r,3)}function R(e,n){const r=[];for(let t=0,o=0,a=e.length;t<a;t+=2,o++)w.fromArray(n,3*o),r.push(w.x,w.y,w.z),r.push(w.x,w.y,w.z);return new t.Float32BufferAttribute(r,3)}function U(e,n){const r=n.array,o=n.itemSize,a=new r.constructor(e.length*o);let s=0,l=0;for(let t=0,n=e.length;t<n;t++){s=e[t]*o;for(let e=0;e<o;e++)a[l++]=r[s++]}return new t.Float32BufferAttribute(a,o)}const v=new t.Vector3,C=new t.Vector3;function M(e,n,r){const o=[],a={};for(let t=0,r=e.length;t<r;t+=3){const r=e[t],s=e[t+1],l=e[t+2],i=new c(r,s,l);w.fromArray(n,3*r),L.fromArray(n,3*s),E.fromArray(n,3*l),C.subVectors(E,L),v.subVectors(w,L),C.cross(v),C.normalize(),i.normal.copy(C),void 0===a[r]&&(a[r]=[]),void 0===a[s]&&(a[s]=[]),void 0===a[l]&&(a[l]=[]),a[r].push(i.normal),a[s].push(i.normal),a[l].push(i.normal),o.push(i)}const s=[];for(let e=0,t=o.length;e<t;e++){const t=o[e],l=V(a[t.a],t.normal,r),i=V(a[t.b],t.normal,r),c=V(a[t.c],t.normal,r);w.fromArray(n,3*t.a),L.fromArray(n,3*t.b),E.fromArray(n,3*t.c),s.push(l.x,l.y,l.z),s.push(i.x,i.y,i.z),s.push(c.x,c.y,c.z)}return new t.Float32BufferAttribute(s,3)}function V(e,n,r){const o=new t.Vector3;if(0===r)o.copy(n);else for(let t=0,a=e.length;t<a;t++)e[t].angleTo(n)<r&&o.add(e[t]);return o.normalize()}function I(e){const n=[];for(let r=0,o=e.length;r<o;r+=3)n.push(new t.Color(e[r],e[r+1],e[r+2]));return n}function N(e,n,r,o,a){const s=[],l=!0===a?0:Math.PI;for(let e=0,i=o.length;e<i;e++){let o=0===e?0:r[e-1];o=!0===a?o:l-o;const i=new t.Vector3;i.setFromSphericalCoords(n,o,0),s.push(i)}const i=e.index,c=e.attributes.position,u=new t.BufferAttribute(new Float32Array(3*e.attributes.position.count),3),f=new t.Vector3,d=new t.Color;for(let e=0;e<i.count;e++){const t=i.getX(e);let n,r;f.fromBufferAttribute(c,t);let l=1;for(let e=1;e<s.length;e++){n=e-1,r=e;const t=s[n],o=s[r];if(!0===a){if(f.y<=t.y&&f.y>o.y){l=Math.abs(t.y-f.y)/Math.abs(t.y-o.y);break}}else if(f.y>=t.y&&f.y<o.y){l=Math.abs(t.y-f.y)/Math.abs(t.y-o.y);break}}const p=o[n],h=o[r];d.copy(p).lerp(h,l),u.setXYZ(t,d.r,d.g,d.b)}e.setAttribute("color",u)}const B=new t.TextureLoader(this.manager);if(B.setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),-1===e.indexOf("#VRML V2.0"))throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const F=function(e){const t=function(){const e=o.default.createToken,t=e({name:"RouteIdentifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),n=e({name:"Identifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/,longer_alt:t}),r=["Anchor","Billboard","Collision","Group","Transform","Inline","LOD","Switch","AudioClip","DirectionalLight","PointLight","Script","Shape","Sound","SpotLight","WorldInfo","CylinderSensor","PlaneSensor","ProximitySensor","SphereSensor","TimeSensor","TouchSensor","VisibilitySensor","Box","Cone","Cylinder","ElevationGrid","Extrusion","IndexedFaceSet","IndexedLineSet","PointSet","Sphere","Color","Coordinate","Normal","TextureCoordinate","Appearance","FontStyle","ImageTexture","Material","MovieTexture","PixelTexture","TextureTransform","ColorInterpolator","CoordinateInterpolator","NormalInterpolator","OrientationInterpolator","PositionInterpolator","ScalarInterpolator","Background","Fog","NavigationInfo","Viewpoint","Text"],a=e({name:"Version",pattern:/#VRML.*/,longer_alt:n}),s=e({name:"NodeName",pattern:new RegExp(r.join("|")),longer_alt:n}),l=e({name:"DEF",pattern:/DEF/,longer_alt:n}),i=e({name:"USE",pattern:/USE/,longer_alt:n}),c=e({name:"ROUTE",pattern:/ROUTE/,longer_alt:n}),u=e({name:"TO",pattern:/TO/,longer_alt:n}),f=e({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),d=e({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),p=e({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),h=e({name:"TrueLiteral",pattern:/TRUE/}),b=e({name:"FalseLiteral",pattern:/FALSE/}),x=e({name:"NullLiteral",pattern:/NULL/}),m=e({name:"LSquare",pattern:/\[/}),g=e({name:"RSquare",pattern:/]/}),w=e({name:"LCurly",pattern:/{/}),L=e({name:"RCurly",pattern:/}/}),E=e({name:"Comment",pattern:/#.*/,group:o.default.Lexer.SKIPPED}),k=[e({name:"WhiteSpace",pattern:/[ ,\s]/,group:o.default.Lexer.SKIPPED}),s,l,i,c,u,h,b,x,a,n,t,f,d,p,m,g,w,L,E],y={};for(let e=0,t=k.length;e<t;e++){const t=k[e];y[t.name]=t}return{tokens:k,tokenVocabulary:y}}(),n=new s(t.tokens),r=new i(t.tokenVocabulary),a=function(e){function t(){e.call(this),this.validateVisitor()}function n(e,t){const n={type:null,values:[]};if(t.node){n.type="node";for(let r=0,o=t.node.length;r<o;r++){const o=t.node[r];n.values.push(e.visit(o))}}if(t.use){n.type="use";for(let r=0,o=t.use.length;r<o;r++){const o=t.use[r];n.values.push(e.visit(o))}}if(t.StringLiteral){n.type="string";for(let e=0,r=t.StringLiteral.length;e<r;e++){const r=t.StringLiteral[e];n.values.push(r.image.replace(/'|"/g,""))}}if(t.NumberLiteral){n.type="number";for(let e=0,r=t.NumberLiteral.length;e<r;e++){const r=t.NumberLiteral[e];n.values.push(parseFloat(r.image))}}if(t.HexLiteral){n.type="hex";for(let e=0,r=t.HexLiteral.length;e<r;e++){const r=t.HexLiteral[e];n.values.push(r.image)}}if(t.TrueLiteral){n.type="boolean";for(let e=0,r=t.TrueLiteral.length;e<r;e++)"TRUE"===t.TrueLiteral[e].image&&n.values.push(!0)}if(t.FalseLiteral){n.type="boolean";for(let e=0,r=t.FalseLiteral.length;e<r;e++)"FALSE"===t.FalseLiteral[e].image&&n.values.push(!1)}return t.NullLiteral&&(n.type="null",t.NullLiteral.forEach((function(){n.values.push(null)}))),n}return t.prototype=Object.assign(Object.create(e.prototype),{constructor:t,vrml:function(e){const t={version:this.visit(e.version),nodes:[],routes:[]};for(let n=0,r=e.node.length;n<r;n++){const r=e.node[n];t.nodes.push(this.visit(r))}if(e.route)for(let n=0,r=e.route.length;n<r;n++){const r=e.route[n];t.routes.push(this.visit(r))}return t},version:function(e){return e.Version[0].image},node:function(e){const t={name:e.NodeName[0].image,fields:[]};if(e.field)for(let n=0,r=e.field.length;n<r;n++){const r=e.field[n];t.fields.push(this.visit(r))}return e.def&&(t.DEF=this.visit(e.def[0])),t},field:function(e){const t={name:e.Identifier[0].image,type:null,values:null};let n;return e.singleFieldValue&&(n=this.visit(e.singleFieldValue[0])),e.multiFieldValue&&(n=this.visit(e.multiFieldValue[0])),t.type=n.type,t.values=n.values,t},def:function(e){return(e.Identifier||e.NodeName)[0].image},use:function(e){return{USE:(e.Identifier||e.NodeName)[0].image}},singleFieldValue:function(e){return n(this,e)},multiFieldValue:function(e){return n(this,e)},route:function(e){return{FROM:e.RouteIdentifier[0].image,TO:e.RouteIdentifier[1].image}}}),new t}(r.getBaseCstVisitorConstructor()),l=n.lex(e);r.input=l.tokens;const c=r.vrml();if(r.errors.length>0)throw console.error(r.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return a.visit(c)}(e),O=function(e){const n=e.nodes,r=new t.Scene;for(let e=0,t=n.length;e<t;e++)a(n[e]);for(let e=0,o=n.length;e<o;e++){const o=n[e],a=l(o);a instanceof t.Object3D&&r.add(a),"WorldInfo"===o.name&&(r.userData.worldInfo=a)}return r}(F);return O}}class s{constructor(e){this.lexer=new o.default.Lexer(e)}lex(e){const t=this.lexer.tokenize(e);if(t.errors.length>0)throw console.error(t.errors),Error("THREE.VRMLLexer: Lexing errors detected.");return t}}const l=o.default.CstParser;class i extends l{constructor(e){super(e);const t=this,n=e.Version,r=e.LCurly,o=e.RCurly,a=e.LSquare,s=e.RSquare,l=e.Identifier,i=e.RouteIdentifier,c=e.StringLiteral,u=e.HexLiteral,f=e.NumberLiteral,d=e.TrueLiteral,p=e.FalseLiteral,h=e.NullLiteral,b=e.DEF,x=e.USE,m=e.ROUTE,g=e.TO,w=e.NodeName;t.RULE("vrml",(function(){t.SUBRULE(t.version),t.AT_LEAST_ONE((function(){t.SUBRULE(t.node)})),t.MANY((function(){t.SUBRULE(t.route)}))})),t.RULE("version",(function(){t.CONSUME(n)})),t.RULE("node",(function(){t.OPTION((function(){t.SUBRULE(t.def)})),t.CONSUME(w),t.CONSUME(r),t.MANY((function(){t.SUBRULE(t.field)})),t.CONSUME(o)})),t.RULE("field",(function(){t.CONSUME(l),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])})),t.RULE("def",(function(){t.CONSUME(b),t.OR([{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(w)}}])})),t.RULE("use",(function(){t.CONSUME(x),t.OR([{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(w)}}])})),t.RULE("singleFieldValue",(function(){t.AT_LEAST_ONE((function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(d)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(h)}}])}))})),t.RULE("multiFieldValue",(function(){t.CONSUME(a),t.MANY((function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(c)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(h)}}])})),t.CONSUME(s)})),t.RULE("route",(function(){t.CONSUME(m),t.CONSUME(i),t.CONSUME(g),t.CONSUME2(i)})),this.performSelfAnalysis()}}class c{constructor(e,n,r){this.a=e,this.b=n,this.c=r,this.normal=new t.Vector3}}const u={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};e.VRMLLoader=a,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three"),require("../libs/chevrotain.module.min.js")):"function"==typeof define&&define.amd?define(["exports","three","../libs/chevrotain.module.min"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE=e["THREE-STD"]||{},e.THREE,e.THREE)}();
  