x_ite
Version:
X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.
2 lines • 1.38 MB
JavaScript
/* X_ITE v12.2.4 */
var t={477(e,t,i){i.d(t,{A:()=>a});var n=i(5185),s=i(2696);function r(e=0,t=e,i=t){this.x=e,this.y=t,this.z=i}Object.assign(r.prototype,{*[Symbol.iterator](){yield this.x,yield this.y,yield this.z},copy(){const e=Object.create(r.prototype);return e.x=this.x,e.y=this.y,e.z=this.z,e},assign({x:e,y:t,z:i}){return this.x=e,this.y=t,this.z=i,this},set(e=0,t=e,i=t){return this.x=e,this.y=t,this.z=i,this},equals({x:e,y:t,z:i}){return this.x===e&&this.y===t&&this.z===i},negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},inverse(){return this.x=1/this.x,this.y=1/this.y,this.z=1/this.z,this},add({x:e,y:t,z:i}){return this.x+=e,this.y+=t,this.z+=i,this},subtract({x:e,y:t,z:i}){return this.x-=e,this.y-=t,this.z-=i,this},multiply(e){return this.x*=e,this.y*=e,this.z*=e,this},multVec({x:e,y:t,z:i}){return this.x*=e,this.y*=t,this.z*=i,this},divide(e){return this.x/=e,this.y/=e,this.z/=e,this},divVec({x:e,y:t,z:i}){return this.x/=e,this.y/=t,this.z/=i,this},cross({x:e,y:t,z:i}){const{x:n,y:s,z:r}=this;return this.x=s*i-r*t,this.y=r*e-n*i,this.z=n*t-s*e,this},normalize(){const e=Math.hypot(this.x,this.y,this.z);return e&&(this.x/=e,this.y/=e,this.z/=e),this},dot({x:e,y:t,z:i}){return this.x*e+this.y*t+this.z*i},squaredNorm(){const{x:e,y:t,z:i}=this;return e*e+t*t+i*i},norm(){return Math.hypot(this.x,this.y,this.z)},distance({x:e,y:t,z:i}){return Math.hypot(this.x-e,this.y-t,this.z-i)},lerp({x:e,y:t,z:i},n){const{x:s,y:r,z:o}=this;return this.x=s+n*(e-s),this.y=r+n*(t-r),this.z=o+n*(i-o),this},slerp:(()=>{const e=new r;return function(t,i){return n.A.simpleSlerp(this,e.assign(t),i)}})(),abs(){const{x:e,y:t,z:i}=this;return this.x=Math.abs(e),this.y=Math.abs(t),this.z=Math.abs(i),this},min(e){let{x:t,y:i,z:n}=this;for(const{x:e,y:s,z:r}of arguments)t=Math.min(t,e),i=Math.min(i,s),n=Math.min(n,r);return this.x=t,this.y=i,this.z=n,this},max(e){let{x:t,y:i,z:n}=this;for(const{x:e,y:s,z:r}of arguments)t=Math.max(t,e),i=Math.max(i,s),n=Math.max(n,r);return this.x=t,this.y=i,this.z=n,this},clamp({x:e,y:t,z:i},{x:s,y:r,z:o}){return this.x=n.A.clamp(this.x,e,s),this.y=n.A.clamp(this.y,t,r),this.z=n.A.clamp(this.z,i,o),this},toString(){return this.x+" "+this.y+" "+this.z}});for(const e of Object.keys(r.prototype))Object.defineProperty(r.prototype,e,{enumerable:!1});Object.defineProperties(r.prototype,{length:{value:3},0:{get(){return this.x},set(e){this.x=e}},1:{get(){return this.y},set(e){this.y=e}},2:{get(){return this.z},set(e){this.z=e}}}),Object.assign(r,{ZERO:Object.freeze(new r),ONE:Object.freeze(new r(1)),X_AXIS:Object.freeze(new r(1,0,0)),Y_AXIS:Object.freeze(new r(0,1,0)),Z_AXIS:Object.freeze(new r(0,0,1)),NEGATIVE_ONE:Object.freeze(new r(-1)),NEGATIVE_X_AXIS:Object.freeze(new r(-1,0,0)),NEGATIVE_Y_AXIS:Object.freeze(new r(0,-1,0)),NEGATIVE_Z_AXIS:Object.freeze(new r(0,0,-1))});const o=r,a=s.A.add("Vector3",o)},608(e,t,i){i.d(t,{A:()=>o});var n=i(2696);let s=0;const r=Object.freeze({BBOX:s++,POINTER:s++,CAMERA:s++,PICKING:s++,COLLISION:s++,SHADOW:s++,DISPLAY:s++}),o=n.A.add("TraverseType",r)},611(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(2417),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.name,e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"ExternProtoDeclarationArray",enumerable:!0}});const a=o,l=r.A.add("ExternProtoDeclarationArray",a)},620(e){var t;t=function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}return i.m=e,i.c=t,i.p="",i(0)}([function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.isNotPNG=function(e){return e===a},t.isNotAPNG=function(e){return e===l},t.default=function(e){var t=new Uint8Array(e);if(Array.prototype.some.call(h,function(e,i){return e!==t[i]}))return a;var i=!1;if(c(t,function(e){return!(i="acTL"===e)}),!i)return l;var n=[],s=[],r=null,u=null,f=0,m=new o.APNG;if(c(t,function(e,t,i,a){var l=new DataView(t.buffer);switch(e){case"IHDR":r=t.subarray(i+8,i+8+a),m.width=l.getUint32(i+8),m.height=l.getUint32(i+12);break;case"acTL":m.numPlays=l.getUint32(i+8+4);break;case"fcTL":u&&(m.frames.push(u),f++),(u=new o.Frame).width=l.getUint32(i+8+4),u.height=l.getUint32(i+8+8),u.left=l.getUint32(i+8+12),u.top=l.getUint32(i+8+16);var h=l.getUint16(i+8+20),c=l.getUint16(i+8+22);0===c&&(c=100),u.delay=1e3*h/c,u.delay<=10&&(u.delay=100),m.playTime+=u.delay,u.disposeOp=l.getUint8(i+8+24),u.blendOp=l.getUint8(i+8+25),u.dataParts=[],0===f&&2===u.disposeOp&&(u.disposeOp=1);break;case"fdAT":u&&u.dataParts.push(t.subarray(i+8+4,i+8+a));break;case"IDAT":u&&u.dataParts.push(t.subarray(i+8,i+8+a));break;case"IEND":s.push(d(t,i,12+a));break;default:n.push(d(t,i,12+a))}}),u&&m.frames.push(u),0==m.frames.length)return l;var A=new Blob(n),_=new Blob(s);return m.frames.forEach(function(e){var t=[];t.push(h),r.set(g(e.width),0),r.set(g(e.height),4),t.push(p("IHDR",r)),t.push(A),e.dataParts.forEach(function(e){return t.push(p("IDAT",e))}),t.push(_),e.imageData=new Blob(t,{type:"image/png"}),delete e.dataParts,t=null}),m};var n,s=i(1),r=(n=s)&&n.__esModule?n:{default:n},o=i(2),a=new Error("Not a PNG"),l=new Error("Not an animated PNG"),h=new Uint8Array([137,80,78,71,13,10,26,10]);function c(e,t){var i=new DataView(e.buffer),n=8,s=void 0,r=void 0,o=void 0;do{r=i.getUint32(n),o=t(s=u(e,n+4,4),e,n,r),n+=12+r}while(!1!==o&&"IEND"!=s&&n<e.length)}function u(e,t,i){var n=Array.prototype.slice.call(e.subarray(t,t+i));return String.fromCharCode.apply(String,n)}function d(e,t,i){var n=new Uint8Array(i);return n.set(e.subarray(t,t+i)),n}var p=function(e,t){var i=e.length+t.length,n=new Uint8Array(i+8),s=new DataView(n.buffer);s.setUint32(0,t.length),n.set(function(e){for(var t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}(e),4),n.set(t,8);var o=(0,r.default)(n,4,i);return s.setUint32(i+4,o),n},g=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=-1,s=t,r=t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-t);s<r;s++)n=n>>>8^i[255&(n^e[s])];return-1^n};for(var i=new Uint32Array(256),n=0;n<256;n++){for(var s=n,r=0;r<8;r++)s=1&s?3988292384^s>>>1:s>>>1;i[n]=s}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Frame=t.APNG=void 0;var n,s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(3),o=(n=r)&&n.__esModule?n:{default:n};function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.APNG=function(){function e(){a(this,e),this.width=0,this.height=0,this.numPlays=0,this.playTime=0,this.frames=[]}return s(e,[{key:"createImages",value:function(){return Promise.all(this.frames.map(function(e){return e.createImage()}))}},{key:"getPlayer",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.createImages().then(function(){return new o.default(t,e,i)})}}]),e}(),t.Frame=function(){function e(){a(this,e),this.left=0,this.top=0,this.width=0,this.height=0,this.delay=0,this.disposeOp=0,this.blendOp=0,this.imageData=null,this.imageElement=null}return s(e,[{key:"createImage",value:function(){var e=this;return this.imageElement?Promise.resolve():new Promise(function(t,i){var n=URL.createObjectURL(e.imageData);e.imageElement=document.createElement("img"),e.imageElement.onload=function(){URL.revokeObjectURL(n),t()},e.imageElement.onerror=function(){URL.revokeObjectURL(n),e.imageElement=null,i(new Error("Image creation error"))},e.imageElement.src=n})}}]),e}()},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});var n,s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(4),o=function(e){function t(e,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return s.playbackRate=1,s._currentFrameNumber=0,s._ended=!1,s._paused=!0,s._numPlays=0,s._rafId=null,s._apng=e,s.context=i,s.stop(),n&&s.play(),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),s(t,[{key:"renderNextFrame",value:function(){this._currentFrameNumber=(this._currentFrameNumber+1)%this._apng.frames.length,this._currentFrameNumber===this._apng.frames.length-1&&(this._numPlays++,0!==this._apng.numPlays&&this._numPlays>=this._apng.numPlays&&(this._ended=!0,this._paused=!0)),this._prevFrame&&1==this._prevFrame.disposeOp?this.context.clearRect(this._prevFrame.left,this._prevFrame.top,this._prevFrame.width,this._prevFrame.height):this._prevFrame&&2==this._prevFrame.disposeOp&&this.context.putImageData(this._prevFrameData,this._prevFrame.left,this._prevFrame.top);var e=this.currentFrame;this._prevFrame=e,this._prevFrameData=null,2==e.disposeOp&&(this._prevFrameData=this.context.getImageData(e.left,e.top,e.width,e.height)),0==e.blendOp&&this.context.clearRect(e.left,e.top,e.width,e.height),this.context.drawImage(e.imageElement,e.left,e.top),this.emit("frame",this._currentFrameNumber),this._ended&&this.emit("end")}},{key:"play",value:function(){var e=this;this._rafId&&cancelAnimationFrame(this._rafId),this.emit("play"),this._ended&&this.stop(),this._paused=!1;var t=performance.now()+this.currentFrame.delay/this.playbackRate;this._rafId=requestAnimationFrame(function i(n){if(!e._ended&&!e._paused){if(n>=t){for(;n-t>=e._apng.playTime/e.playbackRate;)t+=e._apng.playTime/e.playbackRate,e._numPlays++;do{e.renderNextFrame(),t+=e.currentFrame.delay/e.playbackRate}while(!e._ended&&!e._paused&&n>t)}e._rafId=requestAnimationFrame(i)}})}},{key:"pause",value:function(){this._paused||(this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this.emit("pause"),this._paused=!0)}},{key:"stop",value:function(){this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this.emit("stop"),this._numPlays=0,this._ended=!1,this._paused=!0,this._currentFrameNumber=-1,this.context.clearRect(0,0,this._apng.width,this._apng.height),this.renderNextFrame()}},{key:"currentFrameNumber",get:function(){return this._currentFrameNumber}},{key:"currentFrame",get:function(){return this._apng.frames[this._currentFrameNumber]}},{key:"paused",get:function(){return this._paused}},{key:"ended",get:function(){return this._ended}}]),t}(((n=r)&&n.__esModule?n:{default:n}).default);t.default=o},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function s(e){return"object"==typeof e&&null!==e}function r(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,o,a,l,h;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(r(i=this._events[e]))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),i.apply(this,a)}else if(s(i))for(a=Array.prototype.slice.call(arguments,1),o=(h=i.slice()).length,l=0;l<o;l++)h[l].apply(this,a);return!0},i.prototype.addListener=function(e,t){var o;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(o=r(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&o>0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var i=!1;function s(){this.removeListener(e,s),i||(i=!0,t.apply(this,arguments))}return s.listener=t,this.on(e,s),this},i.prototype.removeListener=function(e,t){var i,r,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(i=this._events[e]).length,r=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){r=a;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n(i=this._events[e]))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}}])},e.exports=t()},797(e,t,i){i.d(t,{A:()=>S});var n=i(8015),s=i(3819),r=i(8001),o=i(5053),a=i(937),l=i(3454),h=i(2696);const c=new class{#e;async initialize(){return this.#e=this.#e??new Promise(async e=>{const t={wbg:{__wbindgen_string_new:(e,t)=>{const i=this.#t(e,t);return this.#i(i)},__wbindgen_rethrow:e=>{throw this.#n(e)}}},i=await fetch(l.A.getLibraryURL("mikktspace_bg.wasm")),{instance:n}=await this.#s(i,t);this.#r=n.exports,e()})}isInitialized(){return!!this.#r}async#s(e,t){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"===e.headers.get("Content-Type"))throw t}const i=await e.arrayBuffer();return await WebAssembly.instantiate(i,t)}generateTangents(e,t,i){try{const n=this.#r.__wbindgen_add_to_stack_pointer(-16),s=this.#o(e,this.#r.__wbindgen_malloc),r=this.#a,o=this.#o(t,this.#r.__wbindgen_malloc),a=this.#a,l=this.#o(i,this.#r.__wbindgen_malloc),h=this.#a;this.#r.generateTangents(n,s,r,o,a,l,h);const c=this.#l()[n/4+0],u=this.#l()[n/4+1],d=this.#h(c,u).slice();return this.#r.__wbindgen_free(c,4*u),d}finally{this.#r.__wbindgen_add_to_stack_pointer(16)}}#r;#c=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});#u;#d(){return this.#u?.buffer!==this.#r.memory.buffer&&(this.#u=new Uint8Array(this.#r.memory.buffer)),this.#u}#t(e,t){return this.#c.decode(this.#d().subarray(e,e+t))}#p=Array.from({length:32}).concat([void 0,null,!0,!1]);#g=this.#p.length;#i(e){this.#g===this.#p.length&&this.#p.push(this.#p.length+1);const t=this.#g;return this.#g=this.#p[t],this.#p[t]=e,t}#f(e){return this.#p[e]}#m(e){e<36||(this.#p[e]=this.#g,this.#g=e)}#n(e){const t=this.#f(e);return this.#m(e),t}#A;#_(){return this.#A?.buffer!==this.#r.memory.buffer&&(this.#A=new Float32Array(this.#r.memory.buffer)),this.#A}#a=0;#o(e,t){const i=t(4*e.length);return this.#_().set(e,i/4),this.#a=e.length,i}#y;#l(){return this.#y?.buffer!==this.#r.memory.buffer&&(this.#y=new Int32Array(this.#r.memory.buffer)),this.#y}#h(e,t){return this.#_().subarray(e/4,e/4+t)}},u=h.A.add("MikkTSpace",c);var d=i(477),p=i(8392),g=i(9582),f=i(5687),m=i(1522),A=i(5185),_=i(2514);const y=[d.A.Z_AXIS,d.A.NEGATIVE_Z_AXIS,d.A.Y_AXIS,d.A.NEGATIVE_Y_AXIS,d.A.X_AXIS];function w(e){r.A.call(this,e),this.addType(o.A.X3DGeometryNode),this.addChildObjects(o.A.outputOnly,"transparent",new n.A.SFBool,o.A.outputOnly,"bbox_changed",new n.A.SFTime,o.A.outputOnly,"rebuild",new n.A.SFTime(Date.now()/1e3)),this.min=new d.A,this.max=new d.A,this.bbox=f.A.Extents(this.min,this.max),this.solid=!0,this.geometryType=3,this.colorMaterial=!1,this.attribNodes=[],this.attribArrays=[],this.textureCoordinateMapping=new Map,this.multiTexCoords=[],this.coordIndices=w.createArray(),this.texCoords=w.createArray(),this.fogDepths=w.createArray(),this.colors=w.createArray(),this.tangents=w.createArray(),this.normals=w.createArray(),this.vertices=w.createArray(),this.hasFogCoords=!1,this.hasNormals=!1,this.geometryKey="",this.vertexCount=0,this.planes=[];for(let e=0;e<5;++e)this.planes[e]=new m.A}class x extends Array{#w=new Float32Array;assign(e){const t=e.length;this.length=t;for(let i=0;i<t;++i)this[i]=e[i]}getValue(){return this.#w}shrinkToFit(){return this.length===this.#w.length?this.#w.set(this):this.#w=new Float32Array(this),this.#w}}Object.defineProperty(w,"createArray",{value:()=>new x}),Object.assign(Object.setPrototypeOf(w.prototype,r.A.prototype),{setup(){r.A.prototype.setup.call(this),this.rebuild()},initialize(){r.A.prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();this.getLive().addInterest("set_live__",this),this.addInterest("requestRebuild",this),this._rebuild.addInterest("rebuild",this),this.coordIndexBuffer=t.createBuffer(),this.attribBuffers=[],this.textureCoordinateNode=e.getDefaultTextureCoordinate(),this.texCoordBuffers=Array.from({length:e.getMaxTexCoords()},()=>t.createBuffer()),this.fogDepthBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.tangentBuffer=t.createBuffer(),this.normalBuffer=t.createBuffer(),this.vertexBuffer=t.createBuffer(),this.vertexArrayObject=new s.A(t),this.setCCW(!0),this.set_live__()},getGeometryType(){return this.geometryType},setGeometryType(e){this.geometryType=e},setTransparent(e){!!e!==this._transparent.getValue()&&(this._transparent=e)},isTransparent(){return this._transparent.getValue()},getBBox(){return this.bbox},setBBox(e){if(!e.equals(this.bbox)){e.getExtents(this.min,this.max),this.bbox.assign(e);for(let e=0;e<5;++e)this.planes[e].set(e%2?this.min:this.max,y[e]);this._bbox_changed.addEvent()}},getMin(){return this.min},getMax(){return this.max},getMatrix:()=>g.A.IDENTITY,setSolid(e){this.solid=e},isSolid(){return this.solid},setCCW(e){const t=this.getBrowser().getContext();this.frontFace=e?t.CCW:t.CW,this.backFace=e?t.CW:t.CCW},getCoordIndices(){return this.coordIndices},getAttrib(){return this.attribNodes},getAttribs(){return this.attribArrays},getAttribBuffers(){return this.attribBuffers},getFogDepths(){return this.fogDepths},getColors(){return this.colors},getMultiTexCoords(){return this.multiTexCoords},getTexCoords(){return this.texCoords},getTextureCoordinate(){return this.textureCoordinateNode},setTextureCoordinate(e){this.textureCoordinateNode.removeInterest("updateTextureCoordinateMapping",this),this.textureCoordinateNode=e??this.getBrowser().getDefaultTextureCoordinate(),this.textureCoordinateNode.addInterest("updateTextureCoordinateMapping",this),this.updateTextureCoordinateMapping()},getTextureCoordinateMapping(){return this.textureCoordinateMapping},updateTextureCoordinateMapping(){this.textureCoordinateMapping.clear(),this.textureCoordinateNode.getTextureCoordinateMapping(this.textureCoordinateMapping)},getTangents(){return this.tangents},getNormals(){return this.normals},getVertices(){return this.vertices},updateVertexArrays(){this.vertexArrayObject.update(),this.updateInstances=!0},generateTexCoords(){const e=this.texCoords;if(0===e.length){const t=this.getTexCoordParams(),i=t.min,n=t.Sindex,s=t.Tindex,r=t.Ssize,o=i[n],a=i[s],l=this.vertices.getValue(),h=l.length;for(let t=0;t<h;t+=4)e.push((l[t+n]-o)/r,(l[t+s]-a)/r,0,1);e.shrinkToFit()}this.getMultiTexCoords().push(e)},getTexCoordParams:(()=>{const e={min:new d.A,Ssize:0,Sindex:0,Tindex:0};return function(){const t=this.getBBox(),i=t.size,n=i.x,s=i.y,r=i.z;return e.min.assign(t.center).subtract(i.divide(2)),n>=s&&n>=r?(e.Ssize=n,e.Sindex=0,e.Tindex=s>=r?1:2):s>=n&&s>=r?(e.Ssize=s,e.Sindex=1,e.Tindex=n>=r?0:2):(e.Ssize=r,e.Sindex=2,e.Tindex=n>=s?0:1),e}})(),generateTangents(){try{if(this.geometryType<2)return;if(!this.vertices.length)return;if(!u.isInitialized())return void u.initialize().then(()=>{this.generateTangents(),this.transfer(),this.updateGeometryKey(),this.updateRenderFunctions(),this.getBrowser().addBrowserEvent()});const e=this.vertices.getValue().filter((e,t)=>t%4<3),t=this.normals.getValue(),i=this.multiTexCoords[0].getValue().filter((e,t)=>t%4<2),n=u.generateTangents(e,t,i),s=n.length;for(let e=3;e<s;e+=4)n[e]=-n[e];this.tangents.assign(n),this.tangents.shrinkToFit()}catch(e){_.A&&console.error(e)}},refineNormals(e,t,i){if(i<=0)return t;const n=Math.cos(A.A.clamp(i,0,Math.PI)),s=[];for(const i of e.values())for(const e of i){const r=t[e],o=new d.A;for(const e of i){const i=t[e];i.dot(r)>n&&o.add(i)}s[e]=o.normalize()}return s},transformLine(e){},transformMatrix(e){},intersectsLine:(()=>{const e=new g.A,t={u:0,v:0,t:0},i=new d.A,n=new d.A,s=new d.A;return function(r,o,a){if(this.intersectsBBox(r)){this.transformLine(r),this.transformMatrix(e.assign(o));const l=this.multiTexCoords[0].getValue(),h=this.normals.getValue(),c=this.vertices.getValue(),u=this.vertexCount;for(let e=0;e<u;e+=3){const o=4*e;if(i.x=c[o],i.y=c[o+1],i.z=c[o+2],n.x=c[o+4],n.y=c[o+5],n.z=c[o+6],s.x=c[o+8],s.y=c[o+9],s.z=c[o+10],!r.intersectsTriangle(i,n,s,t))continue;const{u,v:g,t:f}=t,m=new d.A(u*c[o]+g*c[o+4]+f*c[o+8],u*c[o+1]+g*c[o+5]+f*c[o+9],u*c[o+2]+g*c[o+6]+f*c[o+10]),A=new p.A(u*l[o]+g*l[o+4]+f*l[o+8],u*l[o+1]+g*l[o+5]+f*l[o+9],u*l[o+2]+g*l[o+6]+f*l[o+10],u*l[o+3]+g*l[o+7]+f*l[o+11]),_=3*e,y=new d.A(u*h[_]+g*h[_+3]+f*h[_+6],u*h[_+1]+g*h[_+4]+f*h[_+7],u*h[_+2]+g*h[_+5]+f*h[_+8]);a.push({texCoord:A,normal:y,point:this.getMatrix().multVecMatrix(m)})}}return a.length}})(),intersectsBBox:(()=>{const e=new d.A;return function(t){const{min:i,max:n,planes:s}=this,r=i.x,o=n.x,a=i.y,l=n.y,h=i.z,c=n.z;return!!(s[0].intersectsLine(t,e)&&e.x>=r&&e.x<=o&&e.y>=a&&e.y<=l)||(!!(s[1].intersectsLine(t,e)&&e.x>=r&&e.x<=o&&e.y>=a&&e.y<=l)||(!!(s[2].intersectsLine(t,e)&&e.x>=r&&e.x<=o&&e.z>=h&&e.z<=c)||(!!(s[3].intersectsLine(t,e)&&e.x>=r&&e.x<=o&&e.z>=h&&e.z<=c)||!!(s[4].intersectsLine(t,e)&&e.y>=a&&e.y<=l&&e.z>=h&&e.z<=c))))}})(),set_live__(){},connectOptions(e){const t=this.getBrowser(),i=this.isLive()&&t.getBrowserOption("AlwaysUpdateGeometries");this.getLive().getValue()||i?(e.addInterest("requestRebuild",this),e.getModificationTime()>=this._rebuild.getValue()&&this.requestRebuild()):e.removeInterest("requestRebuild",this)},requestRebuild(){this._rebuild=Date.now()/1e3},rebuild(){this.clear(),this.build();for(const e of this.attribArrays)e.shrinkToFit();for(const e of this.multiTexCoords)e.shrinkToFit();this.coordIndices.shrinkToFit(),this.fogDepths.shrinkToFit(),this.colors.shrinkToFit(),this.tangents.shrinkToFit(),this.normals.shrinkToFit(),this.vertices.shrinkToFit(),this.updateBBox(),this.multiTexCoords.length||this.generateTexCoords(),this.tangents.length||this.generateTangents(),this.transfer(),this.updateGeometryKey(),this.updateRenderFunctions()},clear(){this.min.set(Number.POSITIVE_INFINITY),this.max.set(Number.NEGATIVE_INFINITY);{const e=this.attribArrays;for(const t of e)t.length=0;const t=this.attribNodes.length;for(let i=e.length;i<t;++i)e[i]=w.createArray();e.length=t}this.coordIndices.length=0,this.fogDepths.length=0,this.colors.length=0,this.multiTexCoords.length=0,this.texCoords.length=0,this.tangents.length=0,this.normals.length=0,this.vertices.length=0},updateBBox:(()=>{const e=new d.A;return function(){const t=this.vertices.getValue(),i=t.length,n=this.min,s=this.max;if(i){if(n.x===Number.POSITIVE_INFINITY)for(let r=0;r<i;r+=4){const{[r]:i,[r+1]:o,[r+2]:a}=t;e.set(i,o,a),n.min(e),s.max(e)}this.bbox.setExtents(n,s)}else this.bbox.setExtents(n.set(0),s.set(0));for(let e=0;e<5;++e)this.planes[e].set(e%2?n:s,y[e]);this._bbox_changed.addEvent()}})(),transfer(){const e=this.getBrowser().getContext();e.bindBuffer(e.ARRAY_BUFFER,this.coordIndexBuffer),e.bufferData(e.ARRAY_BUFFER,this.coordIndices.getValue(),e.DYNAMIC_DRAW);for(let t=this.attribBuffers.length,i=this.attribArrays.length;t<i;++t)this.attribBuffers.push(e.createBuffer());for(let t=0,i=this.attribArrays.length;t<i;++t)e.bindBuffer(e.ARRAY_BUFFER,this.attribBuffers[t]),e.bufferData(e.ARRAY_BUFFER,this.attribArrays[t].getValue(),e.DYNAMIC_DRAW);const t=this.hasFogCoords;e.bindBuffer(e.ARRAY_BUFFER,this.fogDepthBuffer),e.bufferData(e.ARRAY_BUFFER,this.fogDepths.getValue(),e.DYNAMIC_DRAW),this.hasFogCoords=!!this.fogDepths.length,this.hasFogCoords!==t&&this.updateVertexArrays();const i=this.colorMaterial;e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colors.getValue(),e.DYNAMIC_DRAW),this.colorMaterial=!!this.colors.length,this.colorMaterial!==i&&this.updateVertexArrays();for(let t=0,i=this.multiTexCoords.length;t<i;++t)e.bindBuffer(e.ARRAY_BUFFER,this.texCoordBuffers[t]),e.bufferData(e.ARRAY_BUFFER,this.multiTexCoords[t].getValue(),e.DYNAMIC_DRAW);const n=this.hasTangents;e.bindBuffer(e.ARRAY_BUFFER,this.tangentBuffer),e.bufferData(e.ARRAY_BUFFER,this.tangents.getValue(),e.DYNAMIC_DRAW),this.hasTangents=!!this.tangents.length,this.hasTangents!==n&&this.updateVertexArrays();const s=this.hasNormals;e.bindBuffer(e.ARRAY_BUFFER,this.normalBuffer),e.bufferData(e.ARRAY_BUFFER,this.normals.getValue(),e.DYNAMIC_DRAW),this.hasNormals=!!this.normals.length,this.hasNormals!==s&&this.updateVertexArrays(),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.getValue(),e.DYNAMIC_DRAW),this.vertexCount=this.vertices.length/4},updateGeometryKey(){let e="";e+=this.geometryType,e+=this.hasFogCoords?1:0,e+=this.colorMaterial?1:0,e+=this.hasTangents?1:0,e+=this.hasNormals?1:0,this.geometryKey=e},updateRenderFunctions(){this.vertexCount?(delete this.displaySimple,delete this.display,delete this.displaySimpleInstanced,delete this.displayInstanced):(this.displaySimple=Function.prototype,this.display=Function.prototype,this.displaySimpleInstanced=Function.prototype,this.displayInstanced=Function.prototype)},traverse(e,t){},displaySimple(e,t,i){this.vertexArrayObject.enable(i.getProgram())&&(this.coordIndices.length&&i.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0),this.multiTexCoords.length&&i.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),this.hasNormals&&i.enableNormalAttribute(e,this.normalBuffer,0,0),i.enableVertexAttribute(e,this.vertexBuffer,0,0)),e.drawArrays(e.TRIANGLES,0,this.vertexCount)},display(e,t){const{viewport:i,appearanceNode:n,modelViewMatrix:s}=t,r=this.getBrowser(),o=r.getPrimitiveMode(e.TRIANGLES),a=n.getRenderModes(),l=n.getShader(this,t);e.viewport(...i);for(const t of a)t.enable(e);const h=g.A.prototype.determinant3.call(s)>0;if(e.frontFace(h?this.frontFace:this.backFace),this.solid||!n.getBackMaterial())this.displayGeometry(e,t,l,o,!0,!0);else{const i=n.getBackShader(this,t);this.displayGeometry(e,t,i,o,!0,!1),this.displayGeometry(e,t,l,o,!1,!0)}for(const t of a)t.disable(e);r.resetTextureUnits()},displayGeometry(e,t,i,n,s,r){if(i.enable(e),i.setUniforms(e,t,this,r),this.vertexArrayObject.enable(i.getProgram())){const t=this.getAttrib(),n=this.getAttribBuffers();this.coordIndices.length&&i.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0);for(let s=0,r=t.length;s<r;++s)t[s].enable(e,i,n[s]);this.hasFogCoords&&i.enableFogDepthAttribute(e,this.fogDepthBuffer,0,0),this.colorMaterial&&i.enableColorAttribute(e,this.colorBuffer,0,0),this.hasTangents&&i.enableTangentAttribute(e,this.tangentBuffer,0,0),i.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),i.enableNormalAttribute(e,this.normalBuffer,0,0),i.enableVertexAttribute(e,this.vertexBuffer,0,0)}t.transparent||s!==r?(e.enable(e.CULL_FACE),s&&!this.solid&&(e.cullFace(e.FRONT),e.drawArrays(n,0,this.vertexCount)),r&&(e.cullFace(e.BACK),e.drawArrays(n,0,this.vertexCount))):(this.solid?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),e.drawArrays(n,0,this.vertexCount))},displaySimpleInstanced(e,t,i){const n=i.getInstances();if(n.vertexArrayObject.update(this.updateInstances).enable(t.getProgram())){const{instancesStride:s,particleOffset:r,matrixOffset:o,normalMatrixOffset:a}=i;void 0!==r&&t.enableParticleAttribute(e,n,s,r,1),t.enableInstanceMatrixAttribute(e,n,s,o,1),void 0!==a&&t.enableInstanceNormalMatrixAttribute(e,n,s,a,1),this.coordIndices.length&&t.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0),t.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),t.enableNormalAttribute(e,this.normalBuffer,0,0),t.enableVertexAttribute(e,this.vertexBuffer,0,0),this.updateInstances=!1}e.drawArraysInstanced(e.TRIANGLES,0,this.vertexCount,i.getNumInstances())},displayInstanced(e,t,i){const{viewport:n,appearanceNode:s,modelViewMatrix:r}=t,o=this.getBrowser(),a=o.getPrimitiveMode(e.TRIANGLES),l=s.getRenderModes(),h=s.getShader(this,t);e.viewport(...n);for(const t of l)t.enable(e);const c=g.A.prototype.determinant3.call(r)>0;if(e.frontFace(c?this.frontFace:this.backFace),this.solid||!s.getBackMaterial())this.displayInstancedGeometry(e,t,h,a,!0,!0,i);else{const n=s.getBackShader(this,t);this.displayInstancedGeometry(e,t,n,a,!0,!1,i),this.displayInstancedGeometry(e,t,h,a,!1,!0,i)}for(const t of l)t.disable(e);o.resetTextureUnits()},displayInstancedGeometry(e,t,i,n,s,r,o){i.enable(e),i.setUniforms(e,t,this,r);const a=o.getInstances();if(a.vertexArrayObject.update(this.updateInstances).enable(i.getProgram())){const{instancesStride:t,particleOffset:n,velocityOffset:s,matrixOffset:r,normalMatrixOffset:l}=o,h=this.getAttrib(),c=this.getAttribBuffers();void 0!==n&&i.enableParticleAttribute(e,a,t,n,1),void 0!==s&&i.enableParticleVelocityAttribute(e,a,t,s,1),i.enableInstanceMatrixAttribute(e,a,t,r,1),void 0!==l&&i.enableInstanceNormalMatrixAttribute(e,a,t,l,1),this.coordIndices.length&&i.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0);for(let t=0,n=h.length;t<n;++t)h[t].enable(e,i,c[t]);this.hasFogCoords&&i.enableFogDepthAttribute(e,this.fogDepthBuffer,0,0),this.colorMaterial&&i.enableColorAttribute(e,this.colorBuffer,0,0),this.hasTangents&&i.enableTangentAttribute(e,this.tangentBuffer,0,0),i.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),i.enableNormalAttribute(e,this.normalBuffer,0,0),i.enableVertexAttribute(e,this.vertexBuffer,0,0),this.updateInstances=!1}t.transparent||s!==r?(e.enable(e.CULL_FACE),s&&!this.solid&&(e.cullFace(e.FRONT),e.drawArraysInstanced(n,0,this.vertexCount,o.getNumInstances())),r&&(e.cullFace(e.BACK),e.drawArraysInstanced(n,0,this.vertexCount,o.getNumInstances()))):(this.solid?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),e.drawArraysInstanced(n,0,this.vertexCount,o.getNumInstances()))}},{getFogCoord(){return this.fogCoordNode},getColor(){return this.colorNode},getTexCoord(){return this.texCoordNode},getTangent(){return this.tangentNode},getNormal(){return this.normalNode},getCoord(){return this.coordNode},set_attrib__(){const e=this.getAttrib();for(const t of e)t.removeInterest("requestRebuild",this),t._attribute_changed.removeInterest("updateVertexArrays",this);e.length=0;for(const t of this._attrib){const i=(0,a.A)(o.A.X3DVertexAttributeNode,t);i&&e.push(i)}for(const t of e)t.addInterest("requestRebuild",this),t._attribute_changed.addInterest("updateVertexArrays",this);this.updateVertexArrays()},set_fogCoord__(){this.fogCoordNode?.removeInterest("requestRebuild",this),this.fogCoordNode=(0,a.A)(o.A.FogCoordinate,this._fogCoord),this.fogCoordNode?.addInterest("requestRebuild",this)},set_color__(){this.colorNode?.removeInterest("requestRebuild",this),this.colorNode=(0,a.A)(o.A.X3DColorNode,this._color),this.colorNode?.addInterest("requestRebuild",this),this.setTransparent(this.colorNode?.isTransparent())},set_texCoord__(){this.texCoordNode?.removeInterest("requestRebuild",this),this.texCoordNode=(0,a.A)(o.A.X3DTextureCoordinateNode,this._texCoord),this.texCoordNode?.addInterest("requestRebuild",this),this.setTextureCoordinate(this.texCoordNode)},set_tangent__(){this.tangentNode?.removeInterest("requestRebuild",this),this.tangentNode=(0,a.A)(o.A.X3DTangentNode,this._tangent),this.tangentNode?.addInterest("requestRebuild",this)},set_normal__(){this.normalNode?.removeInterest("requestRebuild",this),this.normalNode=(0,a.A)(o.A.X3DNormalNode,this._normal),this.normalNode?.addInterest("requestRebuild",this)},set_coord__(){this.coordNode?.removeInterest("requestRebuild",this),this.coordNode=(0,a.A)(o.A.X3DCoordinateNode,this._coord),this.coordNode?.addInterest("requestRebuild",this)}}),Object.defineProperties(w,r.A.getStaticProperties("X3DGeometryNode","Rendering",1));const b=w,S=h.A.add("X3DGeometryNode",b)},937(e,t,i){i.d(t,{A:()=>r});var n=i(8015);const s=function(e,t,i=!0){try{if(t&&(t instanceof n.A.SFNode&&(t=t.getValue()),t&&(t=i?t.getInnerNode():t.valueOf()).getType().includes(e)))return t}catch{}return null},r=i(2696).A.add("X3DCast",s)},991(e,t,i){i.d(t,{A:()=>o});var n=i(2462),s=i(2696);const r=n.A.WEAK_REF&&n.A.FINALIZATION_REGISTRY?class{#x=new Map;#b=new FinalizationRegistry(e=>this.#x.delete(e));constructor(e){if(e)for(const t of e)this.add(t)}*[Symbol.iterator](){yield*this.values()}get size(){return this.#x.size}add(e){this.#x.set(e.getId(),new WeakRef(e)),this.#b.register(e,e.getId(),e)}clear(){for(const e of this.values())this.#b.unregister(e);this.#x.clear()}delete(e){this.#x.delete(e.getId()),this.#b.unregister(e)}forEach(e,t){for(const i of this.values())e.call(t,i,i,this)}has(e){return this.#x.has(e.getId())}*entries(){for(const e of this.values())yield[e,e]}*keys(){yield*this.values()}*values(){for(const e of this.#x.values()){const t=e.deref();t&&(yield t)}}}:class extends Set{constructor(e){super(e)}},o=s.A.add("IterableWeakSet",r)},1166(e,t,i){i.d(t,{A:()=>a});var n=i(5185),s=i(2696);function r(e=0,t=e){this.x=e,this.y=t}Object.assign(r.prototype,{*[Symbol.iterator](){yield this.x,yield this.y},copy(){const e=Object.create(r.prototype);return e.x=this.x,e.y=this.y,e},assign({x:e,y:t}){return this.x=e,this.y=t,this},set(e=0,t=e){return this.x=e,this.y=t,this},equals({x:e,y:t}){return this.x===e&&this.y===t},negate(){return this.x=-this.x,this.y=-this.y,this},inverse(){return this.x=1/this.x,this.y=1/this.y,this},add({x:e,y:t}){return this.x+=e,this.y+=t,this},subtract({x:e,y:t}){return this.x-=e,this.y-=t,this},multiply(e){return this.x*=e,this.y*=e,this},multVec({x:e,y:t}){return this.x*=e,this.y*=t,this},divide(e){return this.x/=e,this.y/=e,this},divVec({x:e,y:t}){return this.x/=e,this.y/=t,this},normalize(){const e=Math.hypot(this.x,this.y);return e&&(this.x/=e,this.y/=e),this},dot({x:e,y:t}){return this.x*e+this.y*t},squaredNorm(){const{x:e,y:t}=this;return e*e+t*t},norm(){return Math.hypot(this.x,this.y)},distance({x:e,y:t}){return Math.hypot(this.x-e,this.y-t)},lerp({x:e,y:t},i){const{x:n,y:s}=this;return this.x=n+i*(e-n),this.y=s+i*(t-s),this},abs(){const{x:e,y:t}=this;return this.x=Math.abs(e),this.y=Math.abs(t),this},min(e){let{x:t,y:i}=this;for(const{x:e,y:n}of arguments)t=Math.min(t,e),i=Math.min(i,n);return this.x=t,this.y=i,this},max(e){let{x:t,y:i}=this;for(const{x:e,y:n}of arguments)t=Math.max(t,e),i=Math.max(i,n);return this.x=t,this.y=i,this},clamp({x:e,y:t},{x:i,y:s}){return this.x=n.A.clamp(this.x,e,i),this.y=n.A.clamp(this.y,t,s),this},toString(){return this.x+" "+this.y}});for(const e of Object.keys(r.prototype))Object.defineProperty(r.prototype,e,{enumerable:!1});Object.defineProperties(r.prototype,{length:{value:2},0:{get(){return this.x},set(e){this.x=e}},1:{get(){return this.y},set(e){this.y=e}}}),Object.assign(r,{ZERO:Object.freeze(new r),ONE:Object.freeze(new r(1)),X_AXIS:Object.freeze(new r(1,0)),Y_AXIS:Object.freeze(new r(0,1)),NEGATIVE_ONE:Object.freeze(new r(-1)),NEGATIVE_X_AXIS:Object.freeze(new r(-1,0)),NEGATIVE_Y_AXIS:Object.freeze(new r(0,-1))});const o=r,a=s.A.add("Vector2",o)},1256(e,t,i){i.d(t,{A:()=>p});var n=i(1166),s=i(477),r=i(2696);function o(...e){if(e.length)for(let t=0;t<4;++t)this[t]=e[t];else this.identity()}Object.assign(o.prototype,{*[Symbol.iterator](){for(let e=0;e<4;++e)yield this[e]},copy(){const e=Object.create(o.prototype);for(let t=0;t<4;++t)e[t]=this[t];return e},assign(e){for(let t=0;t<4;++t)this[t]=e[t];return this},equals(e){return this[0]===e[0]&&this[1]===e[1]&&this[2]===e[2]&&this[3]===e[3]},set1(e,t,i){this[e*this.order+t]=i},get1(e,t){return this[e*this.order+t]},set(){switch(arguments.length){case 0:this.identity();break;case 4:for(let e=0;e<4;++e)this[e]=arguments[e]}return this},determinant1(){return this[0]},determinant(){const{0:e,1:t,2:i,3:n}=this;return e*n-t*i},transpose(){const e=this[1];return this[1]=this[2],this[2]=e,this},inverse(){const{0:e,1:t,2:i,3:n}=this,s=e*n-t*i;return this[0]=n/s,this[1]=-t/s,this[2]=-i/s,this[3]=e/s,this},multLeft(e){const{0:t,1:i,2:n,3:s}=this,{0:r,1:o,2:a,3:l}=e;return this[0]=t*r+n*o,this[1]=i*r+s*o,this[2]=t*a+n*l,this[3]=i*a+s*l,this},multRight(e){const{0:t,1:i,2:n,3:s}=this,{0:r,1:o,2:a,3:l}=e;return this[0]=r*t+a*i,this[1]=o*t+l*i,this[2]=r*n+a*s,this[3]=o*n+l*s,this},multVecMatrix(e){if("number"==typeof e){const t=e,i=t*this[1]+this[3];return(t*this[0]+this[2])/i}{const{x:t,y:i}=e;return e.x=t*this[0]+i*this[2],e.y=t*this[1]+i*this[3],e}},multMatrixVec(e){if("number"==typeof e){const t=e,i=t*this[2]+this[3];return(t*this[0]+this[1])/i}{const{x:t,y:i}=e;return e.x=t*this[0]+i*this[1],e.y=t*this[2]+i*this[3],e}},identity(){this[0]=1,this[1]=0,this[2]=0,this[3]=1},toString(){return Array.prototype.join.call(this," ")}});for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o.prototype,{order:{value:2},length:{value:4},x:{get:(()=>{const e=new n.A;return function(){return e.set(this[0],this[1])}})()},y:{get:(()=>{const e=new n.A;return function(){return e.set(this[2],this[3])}})()},xAxis:{get(){return this[0]}},origin:{get(){return this[2]}},submatrix:{get(){return this[0]}}}),Object.assign(o,{IDENTITY:Object.freeze(new o)});const a=o,l=r.A.add("Matrix2",a);var h=i(5575);function c(...e){if(e.length)for(let t=0;t<9;++t)this[t]=e[t];else this.identity()}Object.assign(c.prototype,{*[Symbol.iterator](){for(let e=0;e<9;++e)yield this[e]},copy(){const e=Object.create(c.prototype);for(let t=0;t<9;++t)e[t]=this[t];return e},assign(e){for(let t=0;t<9;++t)this[t]=e[t];return this},equals(e){return this[0]===e[0]&&this[1]===e[1]&&this[2]===e[2]&&this[3]===e[3]&&this[4]===e[4]&&this[5]===e[5]&&this[6]===e[6]&&this[7]===e[7]&&this[8]===e[8]},set1(e,t,i){return this[e*this.order+t]=i,this},get1(e,t){return this[e*this.order+t]},set:(()=>{const e=new n.A;return function(t,i,s,r,o){switch(this.identity(),arguments.length){case 1:t&&!t.equals(n.A.ZERO)&&this.translate(t);break;case 2:t&&!t.equals(n.A.ZERO)&&this.translate(t),i&&this.rotate(i);break;case 3:t&&!t.equals(n.A.ZERO)&&this.translate(t),i&&this.rotate(i),s&&!s.equals(n.A.ONE)&&this.scale(s);break;case 4:t&&!t.equals(n.A.ZERO)&&this.translate(t),i&&this.rotate(i),s&&!s.equals(n.A.ONE)&&(r?(this.rotate(r),this.scale(s),this.rotate(-r)):this.scale(s));break;case 5:{t&&!t.equals(n.A.ZERO)&&this.translate(t);const a=o&&!o.equals(n.A.ZERO);a&&this.translate(o),i&&this.rotate(i),s&&!s.equals(n.A.ONE)&&(r?(this.rotate(r),this.scale(s),this.rotate(-r)):this.scale(s)),a&&this.translate(e.assign(o).negate());break}case 9:for(let e=0;e<9;++e)this[e]=arguments[e]}return this}})(),get:(()=>{const e=new n.A;return function(t,i,n,s,r){switch(arguments.length){case 1:t.set(this[6],this[7]);break;case 2:case 3:case 4:this.factor(t,i,n,s);break;case 5:r?(u.set(e.assign(r).negate()),u.multLeft(this),u.translate(r),u.get(t,i,n,s)):this.factor(t,i,n,s)}}})(),factor:(()=>{const e=new n.A,t=new l,i=new l,s=new l,r={values:[],vectors:[[],[]]};return function(n,o,a,l){n?.set(this[6],this[7]);const c=this.submatrix,u=c.determinant()<0?-1:1;s.assign(c).transpose().multLeft(c);const d=(0,h.A)(s,r);i.set(d.vectors[0][0],d.vectors[1][0],d.vectors[0][1],d.vectors[1][1]),l&&(l[0]=i[0],l[1]=i[1],l[2]=Math.atan2(i[1],i[0])),e.set(u*Math.sqrt(d.values[0]),u*Math.sqrt(d.values[1])),a?.assign(e),o&&(t[0]=1/e.x,t[3]=1/e.y,c.multLeft(i).multLeft(t).multLeft(i.transpose()),o[0]=c[0],o[1]=c[1],o[2]=Math.atan2(c[1],c[0]))}})(),determinant2(){const{0:e,1:t,3:i,4:n}=this;return e*n-t*i},determinant(){const{0:e,1:t,2:i,3:n,4:s,5:r,6:o,7:a,8:l}=this;return e*(s*l-r*a)-t*(n*l-r*o)+i*(n*a-s*o)},transpose(){let e;return e=this[1],this[1]=this[3],this[3]=e,e=this[2],this[2]=this[6],this[6]=e,e=this[5],this[5]=this[7],this[7]=e,this},inverse(){const{0:e,1:t,2:i,3:n,4:s,5:r,6:o,7:a,8:l}=this,h=e*s,c=e*a,u=n*t,d=n*a,p=o*t,g=o*s;let f=h*l-c*r-u*l+d*i+p*r-g*i;f=1/f;const m=(s*l-a*r)*f,A=-(t*l-a*i)*f,_=(t*r-s*i)*f,y=-(n*l-o*r)*f,w=(e*l-o*i)*f,x=-(e*r-n*i)*f;return this[0]=m,this[1]=A,this[2]=_,this[3]=y,this[4]=w,this[5]=x,this[6]=(d-g)*f,this[7]=-(c-p)*f,this[8]=(h-u)*f,this},multLeft(e){const{0:t,1:i,2:n,3:s,4:r,5:o,6:a,7:l,8:h}=this,{0:c,1:u,2:d,3:p,4:g,5:f,6:m,7:A,8:_}=e;return this[0]=t*c+s*u+a*d,this[1]=i*c+r*u+l*d,this[2]=n*c+o*u+h*d,this[3]=t*p+s*g+a*f,this[4]=i*p+r*g+l*f,this[5]=n*p+o*g+h*f,this[6]=t*m+s*A+a*_,this[7]=i*m+r*A+l*_,this[8]=n*m+o*A+h*_,this},multRight(e){const{0:t,1:i,2:n,3:s,4:r,5:o,6:a,7:l,8:h}=this,{0:c,1:u,2:d,3:p,4:g,5:f,6:m,7:A,8:_}=e;return this[0]=t*c+i*p+n*m,this[1]=t*u+i*g+n*A,this[2]=t*d+i*f+n*_,this[3]=s*c+r*p+o*m,this[4]=s*u+r*g+o*A,this[5]=s*d+r*f+o*_,this[6]=a*c+l*p+h*m,this[7]=a*u+l*g+h*A,this[8]=a*d+l*f+h*_,this},multVecMatrix(e){if(2===e.length){const{x:t,y:i}=e,n=t*this[2]+i*this[5]+this[8];return e.x=(t*this[0]+i*this[3]+this[6])/n,e.y=(t*this[1]+i*this[4]+this[7])/n,e}{const{x:t,y:i,z:n}=e;return e.x=t*this[0]+i*this[3]+n*this[6],e.y=t*this[1]+i*this[4]+n*this[7],e.z=t*this[2]+i*this[5]+n*this[8],e}},multMatrixVec(e){if(2===e.length){const{x:t,y:i}=e,n=t*this[6]+i*this[7]+this[8];return e.x=(t*this[0]+i*this[1]+this[2])/n,e.y=(t*this[3]+i*this[4]+this[5])/n,e}{const{x:t,y:i,z:n}=e;return e.x=t*this[0]+i*this[1]+n*this[2],e.y=t*this[3]+i*this[4]+n*this[5],e.z=t*this[6]+i*this[7]+n*this[8],e}},multDirMatrix(e){const{x:t,y:i}=e;return e.x=t*this[0]+i*this[3],e.y=t*this[1]+i*this[4],e},multMatrixDir(e){const{x:t,y:i}=e;return e.x=t*this[0]+i*this[1],e.y=t*this[3]+i*this[4],e},identity(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=1,this[5]=0,this[6]=0,this[7]=0,this[8]=1,this},translate(e){const{x:t,y:i}=e;return this[6]+=this[0]*t+this[3]*i,this[7]+=this[1]*t+this[4]*i,this},rotate(e){return this.multLeft(c.Rotation(e))},scale(e){const{x:t,y:i}=e;return this[0]*=t,this[3]*=i,this[1]*=t,this[4]*=i,this},skewX(e){const t=Math.tan(e);return this[3]+=this[0]*t,this[4]+=this[1]*t,this[5]+=this[2]*t,this},skewY(e){const t=Math.tan(e);return this[0]+=this[3]*t,this[1]+=this[4]*t,this[2]+=this[5]*t,this},toString(){return Array.prototype.join.call(this," ")}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});Object.defineProperties(c.prototype,{order:{value:3},length:{value:9},x:{get:(()=>{const e=new s.A;return function(){return e.set(this[0],this[1],this[2])}})()},y:{get:(()=>{const e=new s.A;return function(){return e.set(this[3],this[4],this[5])}})()},z:{get:(()=>{const e=new s.A;return function(){return e.set(this[6],this[7],this[8])}})()},xAxis:{get:(()=>{const e=new n.A;return function(){return e.set(this[0],this[1])}})()},yAxis:{get:(()=>{const e=new n.A;return function(){return e.set(this[3],this[4])}})()},origin:{get:(()=>{const e=new n.A;return function(){return e.set(this[6],this[7])}})()},submatrix:{get:(()=>{const e=new l;return function(){return e[0]=this[0],e[1]=this[1],e[2]=this[3],e[3]=this[4],e}})()}}),Object.assign(c,{IDENTITY:Object.freeze(new c),Rotation(e){const t=Math.sin(e),i=Math.cos(e);return new c(i,t,0,-t,i,0,0,0,1)},Matrix2:e=>new c(e[0],e[1],0,e[2],e[3],0,0,0,1)});const u=new c,d=c,p=r.A.add("Matrix3",d)},1262(e,t,i){i.d(t,{A:()=>h});var n=i(8015),s=i(8001),r=i(6761),o=i(2696);class a extends s.A{#S;#T;#v;#O;#E;#N;#C;#I;constructor(e,t,i=s.A,n){super(e.getExecutionContext()),this.#S=e,this.#T=e.lastIndex,this.#v=e.lineNumber,this.#E=e.getNamedNodes(),this.#N=e.getImportedNodes(),this.#O=t,this.#C=i,this.#I=n}getComponentInfo(){return this.#C.componentInfo}getContainerField(){return this.#C.containerField}getSpecificationRange(){return this.#C.specificationRange}replaceWithNode(){const e=this.#O,t=this.#E.get(e)??this.#N.get(e),i=t instanceof r.A?t.getExportedNode(this.#C):t;if(!i)throw this.#S.lastIndex=this.#T,this.#S.lineNumber=this.#v,new Error(`Named node '${e}' not found.`);this.#S.checkNodeType(i,this.#O,this.#C,this.#I);for(const e of Array.from(this.getParents()))e instanceof n.A.SFNode&&e.setValue(i)}}const l=a,h=o.A.add("Placeholder",l)},1264(e,t,i){i.d(t,{A:()=>o});var n=i(2696);const s={parse(e){return this.lastIndex=e.lastIndex,e.result=this.exec(e.input),!!e.result&&(e.lastIndex=this.lastIndex,!0)},lookahead(e){const t=e.lastIndex,i=this.parse(e);return e.lastIndex=t,i}};const r=function(e){for(const t of Object.values(e))Object.assign(t,s);return e},o=n.A.add("Expressions",r)},1461(e,t,i){i.d(t,{A:()=>d});var n=i(5768),s=i(5543),r=i(5595),o=i(8187),a=i(937),l=i(5053),h=i(2696);function c(e){s.A.call(this,e),this.addType(l.A.X3DWorld),this.addChildObjects(l.A.outputOnly,"activeLayer",new n.A(this.layer0)),this.defaultLayerSet=new r.A(e),this.layerSet=this.defaultLayerSet,this.layer0=new o.A(e)}Object.assign(Object.setPrototypeOf(c.prototype,s.A.prototype),{initialize(){s.A.prototype.initialize.call(this),this.layerSet.setPrivate(!0),this.layerSet.setup(),this.layerSet.setLayer0(this.layer0),this.layerSet._activeLayer.addInterest("set_rootNodes__",this),this.getExecutionContext().getRootNodes().addInterest("set_rootNodes__",this),this.set_rootNodes__(),this.layer0.setPrivate(!0),this.layer0.setLayer0(!0),this.layer0.setup(),this.set_activeLayer__()},getCache(){return this.getBrowser().getBrowserOption("Cache")},getLayerSet(){return this.layerSet},getActiveLayer(){return this._activeLayer.getValue()},getLayer0(){return this.layer0},set_rootNodes__(){const e=this.layerSet,t=this.getExecutionContext().getRootNodes();this.layerSet=this.defaultLayerSet,this.layer0._children=t;for(const e of t){const t=(0,a.A)(l.A.LayerSet,e);t&&(this.layerSet=t)}this.layerSet!==e&&(this.layerSet.setLayer0(this.layer0),e._activeLayerNode.removeInterest("set_activeLayer__",this),this.layerSet._activeLayerNode.addInterest("set_activeLayer__",this),this.set_activeLayer__())},set_activeLayer__(){this._activeLayer=this.layerSet.getActiveLayer()},bindBindables(){const e=this.getExecutionContext().getWorldURL();this.layerSet.bindBindables(decodeURIComponent(new URL(e).hash.substring(1)))},traverse(e,t){this.layerSet.traverse(e,t)}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});Object.defineProperties(c,{typeName:{value:"X3DWorld",enumerable:!0}}),l.A.addConstant(c.typeName);const u=c,d=h.A.add("X3DWorld",u)},1467(e,t,i){i.d(t,{A:()=>g});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(5464),l=i(1815),h=i(5053),c=i(9401),u=i(2696);function d(e){a.A.call(this,e),this.addType(h.A.Background)}Object.assign(Object.setPrototypeOf(d.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this);const e=new l.A(this.getExecutionContext()),t=new l.A(this.getExecutionContext()),i=new l.A(this.getExecutionContext()),n=new l.A(this.getExecutionContext()),s=new l.A(this.getExecutionContext()),r=new l.A(this.getExecutionContext()),o=this.getBrowser().getBackgroundTextureProperties();this._frontUrl.addFieldInterest(e._url),this._backUrl.addFieldInterest(t._url),this._leftUrl.addFieldInterest(i._url),this._rightUrl.addFieldInterest(n._url),this._topUrl.addFieldInterest(s._url),this._bottomUrl.addFieldInterest(r._url),e._url=this._frontUrl,t._url=this._backUrl,i._url=this._leftUrl,n._url=this._rightUrl,s._url=this._topUrl,r._url=this._bottomUrl,e._textureProperties=o,t._textureProperties=o,i._textureProperties=o,n._textureProperties=o,s._textureProperties=o,r._textureProperties=o,e.setup(),t.setup(),i.setup(),n.setup(),s.setup(),r.setup(),this.set_texture__(0,e),this.set_texture__(1,t),this.set_texture__(2,i),this.set_texture__(3,n),this.set_texture__(4,s),this.set_texture__(5,r)}}),Object.defineProperties(d,{...o.A.getStaticProperties("Background","EnvironmentalEffects",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(h.A.inputOutput,"metadata",new n.A.SFNode),new s.A(h.A.inputOnly,"set_bind",new n.A.SFBool),new s.A(h.A.inputOutput,"frontUrl",new n.A.MFString),new s.A(h.A.inputOutput,"backUrl",new n.A.MFString),new s.A(h.A.inputOutput,"leftUrl",new n.A.MFString),new s.A(h.A.inputOutput,"rightUrl",new n.A.MFString),new s.A(h.A.inputOutput,"topUrl",new n.A.MFString),new s.A(h.A.inputOutput,"bottomUrl",new n.A.MFString),new s.A(h.A.inputOutput,"skyAngle",new n.A.MFFloat),new s.A(h.A.inputOutput,"skyColor",new n.A.MFColor(new c.A)),new s.A(h.A.inputOutput,"groundAngle",new n.A.MFFloat),new s.A(h.A.inputOutput,"groundColor",new n.A.MFColor),new s.A(h.A.inputOutput,"transparency",new n.A.SFFloat),new s.A(h.A.outputOnly,"isBound",new n.A.SFBool),new s.A(h.A.outputOnly,"bindTime",new n.A.SFTime)]),enumerable:!0}});const p=d,g=u.A.add("Background",p)},1490(e,t,i){i.d(t,{A:()=>p});var n=i(1522),s=i(2844),r=i(1166),o=i(477),a=i(8392),l=i(9582),h=i(4803),c=i(2696);function u(...e){this.viewport=new a.A,this.points=Array.from({length:8},()=>new o.A),this.normals=Array.from({length:6},()=>new o.A),this.edges=Array.from({length:8},()=>new o.A),this.planes=Array.from({length:6},()=>new n.A),e.length&&this.set(...e)}Object.assign(u.prototype,{set:(()=>{const e=new l.A;return function(t,i){this.viewport.assign(i);const[n,r,o,a,l,h,c,d]=this.points,p=i[0],g=p+i[2],f=i[1],m=f+i[3];e.assign(t).inverse(),u.unProjectPointMatrix(p,f,0,e,i,n),u.unProjectPointMatrix(g,f,0,e,i,r),u.unProjectPointMatrix(g,m,0,e,i,o),u.unProjectPointMatrix(p,m,0,e,i,a),u.unProjectPointMatrix(p,f,1,e,i,l),u.unProjectPointMatrix(g,f,1,e,i,h),u.unProjectPointMatrix(g,m,1,e,i,c),u.unProjectPointMatrix(p,m,1,e,i,d);const A=this.normals;s.A.normal(n,r,o,A[0]),s.A.normal(d,l,n,A[1]),s.A.normal(c,o,r,A[2]),s.A.normal(o,c,d,A[3]),s.A.normal(r,n,l,A[4]),s.A.normal(l,d,c,A[5]);const _=this.planes;return _[0].set(r,A[0]),_[1].set(l,A[1]),_[2].set(o,A[2]),_[3].set(c,A[3]),_[4].set(n,A[4]),_[5].set(d,A[5]),this.edges.tainted=!0,this}})(),getViewport(){return this.viewport},getEdges(){const e=this.edges;if(e.tainted){const[t,i,n,s,r,o,a,l]=this.points;e[0].assign(t).subtract(i),e[1].assign(i).subtract(n),e[2].assign(n).subtract(s),e[3].assign(s).subtract(t),e[4].assign(t).subtract(r),e[5].assign(i).subtract(o),e[6].assign(n).subtract(a),e[7].assign(s).subtract(l),e.tainted=!1}return e},intersectsSphere(e,t){for(const i of this.planes)if(i.getDistanceToPoint(t)>e)return!1;return!0},intersectsBox:(()=>{const e=Array.from({length:8},()=>new o.A),t=Array.from({length:3},()=>new o.A),i=Array.from({length:3},()=>new o.A),n=Array.from({length:24},()=>new o.A);return function(s){s.getPoints(e);const r=this.points;if(h.A.isSeparated(s.getNormals(t),e,r))return!1;if(h.A.isSeparated(this.normals,e,r))return!1;s.getAxes(i);const o=this.getEdges();for(let e=0;e<3;++e)for(let t=0;t<8;++t)n[3*e+t].assign(i[e]).cross(o[t]);return!h.A.isSeparated(n,e,r)}})()}),Object.assign(u,{unProjectPoint:(()=>{const e=new l.A;return function(t,i,n,s,r,o,a){return this.unProjectPointMatrix(t,i,n,e.assign(s).multRight(r).inverse(),o,a)}})(),unProjectPointMatrix:(()=>{const e=new a.A;return function(t,i,n,s,r,o){e.set((t-r[0])/r[2]*2-1,(i-r[1])/r[3]*2-1,2*n-1,1),s.multVecMatrix(e);const a=1/e.w;return o.set(e.x*a,e.y*a,e.z*a,1)}})(),unProjectRay:(()=>{const e=new l.A;return function(t,i,n,s,r,o){return this.unProjectRayMatrix(t,i,e.assign(n).multRight(s).inverse(),r,o)}})(),unProjectRayMatrix:(()=>{const e=new o.A,t=new o.A;return function(i,n,s,r,o){return u.unProjectPointMatrix(i,n,0,s,r,e),u.unProjectPointMatrix(i,n,.9,s,r,t),o.setPoints(e,t)}})(),projectPoint:(()=>{const e=new a.A;return function(t,i,n,s,r){4===t.length?e.assign(t):e.set(t.x,t.y,t.z,1),n.multVecMatrix(i.multVecMatrix(e));const o=1/(2*e.w);return r.set((e.x*o+.5)*s[2]+s[0],(e.y*o+.5)*s[3]+s[1],e.z*o+.5)}})(),projectPointMatrix:(()=>{const e=new a.A;return function(t,i,n,s){4===t.length?e.assign(t):e.set(t.x,t.y,t.z,1),i.multVecMatrix(e);const r=1/(2*e.w);return s.set((e.x*r+.5)*n[2]+n[0],(e.y*r+.5)*n[3]+n[1],e.z*r+.5)}})(),projectLine:(()=>{const e=new l.A;return function(t,i,n,s,r){return this.projectLineMatrix(t,e.assign(i).multRight(n),s,r)}})(),projectLineMatrix:(()=>{const e=new r.A,t=new r.A,i=new o.A;return function(n,s,r,o){return u.projectPointMatrix(n.point,s,r,e),u.projectPointMatrix(i.assign(n.direction).multiply(1e9).add(n.point),s,r,t),o.setPoints(e,t)}})()});const d=u,p=c.A.add("ViewVolume",d)},1522(e,t,i){i.d(t,{A:()=>c});var n=i(477),s=i(9582),r=i(2696);const o=new n.A,a=new s.A;function l(e=n.A.ZERO,t=n.A.Z_AXIS){this.normal=new n.A,this.set(e,t)}Object.assign(l.prototype,{copy(){const e=Object.create(l.prototype);return e.normal=this.normal.copy(),e.distanceFromOrigin=this.distanceFromOrigin,e},assign(e){return this.normal.assign(e.normal),this.distanceFromOrigin=e.distanceFromOrigin,this},equals(e){return this.distanceFromOrigin===e.distanceFromOrigin&&this.normal.equals(e.normal)},set(e=n.A.ZERO,t=n.A.Z_AXIS){return this.normal.assign(t),this.distanceFromOrigin=t.dot(e),this},multLeft(e){return o.assign(this.normal).multiply(this.distanceFromOrigin),a.assign(e).submatrix.inverse().multVecMatrix(this.normal).normalize(),e.multMatrixVec(o),this.distanceFromOrigin=this.normal.dot(o),this},multRight(e){return o.assign(this.normal).multiply(this.distanceFromOrigin),a.assign(e).submatrix.inverse().multMatrixVec(this.normal).normalize(),e.multVecMatrix(o),this.distanceFromOrigin=this.normal.dot(o),this},getDistanceToPoint(e){return e.dot(this.normal)-this.distanceFromOrigin},getPerpendicularVectorToPoint(e,t=new n.A){return t.assign(this.normal).multiply(-this.getDistanceToPoint(e))},getClosestPointToPoint(e,t=new n.A){return this.getPerpendicularVectorToPoint(e,t).add(e)},intersectsLine(e,t){const{point:i,direction:n}=e,s=n.dot(this.normal);if(0===s)return!1;const r=(this.distanceFromOrigin-this.normal.dot(i))/s;return t.assign(n).multiply(r).add(i),!0},toString(){return`${this.normal}, ${this.distanceFromOrigin}`}});const h=l,c=r.A.add("Plane3",h)},1526(e,t){var i,n,s;n=[],i=function(){var e=function(e){return e.reduce(function(e,t){return 2*e+t},0)},t=function(e){for(var t=[],i=7;i>=0;i--)t.push(!!(e&1<<i));return t},i=function(e){this.data=e,this.len=this.data.length,this.pos=0,this.readByte=function(){if(this.pos>=this.data.length)throw new Error("Attempted to read past end of stream.");return e instanceof Uint8Array?e[this.pos++]:255&e.charCodeAt(this.pos++)},this.readBytes=function(e){for(var t=[],i=0;i<e;i++)t.push(this.readByte());return t},this.read=function(e){for(var t="",i=0;i<e;i++)t+=String.fromCharCode(this.readByte());return t},this.readUnsigned=function(){var e=this.readBytes(2);return(e[1]<<8)+e[0]}},n=function(e,t){for(var i,n,s=0,r=function(e){for(var i=0,n=0;n<e;n++)t.charCodeAt(s>>3)&1<<(7&s)&&(i|=1<<n),s++;return i},o=[],a=1<<e,l=a+1,h=e+1,c=[],u=function(){c=[],h=e+1;for(var t=0;t<a;t++)c[t]=[t];c[a]=[],c[l]=null};;)if(n=i,(i=r(h))!==a){if(i===l)break;if(i<c.length)n!==a&&c.push(c[n].concat(c[i][0]));else{if(i!==c.length)throw new Error("Invalid LZW code.");c.push(c[n].concat(c[n][0]))}o.push.apply(o,c[i]),c.length===1<<h&&h<12&&h++}else u();return o},s=function(i,s){s||(s={});var r=function(e){for(var t=[],n=0;n<e;n++)t.push(i.readBytes(3));return t},o=function(){var e,t;t="";do{e=i.readByte(),t+=i.read(e)}while(0!==e);return t},a=function(){var n={};if(n.sig=i.read(3),n.ver=i.read(3),"GIF"!==n.sig)throw new Error("Not a GIF file.");n.width=i.readUnsigned(),n.height=i.readUnsigned();var o=t(i.readByte());n.gctFlag=o.shift(),n.colorRes=e(o.splice(0,3)),n.sorted=o.shift(),n.gctSize=e(o.splice(0,3)),n.bgColor=i.readByte(),n.pixelAspectRatio=i.readByte(),n.gctFlag&&(n.gct=r(1<<n.gctSize+1)),s.hdr&&s.hdr(n)},l=function(n){var r=function(n){i.readByte();var r=t(i.readByte());n.reserved=r.splice(0,3),n.disposalMethod=e(r.splice(0,3)),n.userInput=r.shift(),n.transparencyGiven=r.shift(),n.delayTime=i.readUnsigned(),n.transparencyIndex=i.readByte(),n.terminator=i.readByte(),s.gce&&s.gce(n)},a=function(e){e.comment=o(),s.com&&s.com(e)},l=function(e){i.readByte(),e.ptHeader=i.readBytes(12),e.ptData=o(),s.pte&&s.pte(e)},h=function(e){var t=function(e){i.readByte(),e.unknown=i.readByte(),e.iterations=i.readUnsigned(),e.terminator=i.readByte(),s.app&&s.app.NETSCAPE&&s.app.NETSCAPE(e)},n=function(e){e.appData=o(),s.app&&s.app[e.identifier]&&s.app[e.identifier](e)};i.readByte(),e.identifier=i.read(8),e.authCode=i.read(3),"NETSCAPE"===e.identifier?t(e):n(e)},c=function(e){e.data=o(),s.unknown&&s.unknown(e)};switch(n.label=i.readByte(),n.label){case 249:n.extType="gce",r(n);break;case 254:n.extType="com",a(n);break;case 1:n.extType="pte",l(n);break;case 255:n.extType="app",h(n);break;default:n.extType="unknown",c(n)}},h=function(a){var l=function(e,t){for(var i=new Array(e.length),n=e.length/t,s=function(n,s){var r=e.slice(s*t,(s+1)*t);i.splice.apply(i,[n*t,t].concat(r))},r=[0,4,2,1],o=[8,8,4,2],a=0,l=0;l<4;l++)for(var h=r[l];h<n;h+=o[l])s(h,a),a++;return i};a.leftPos=i.readUnsigned(),a.topPos=i.readUnsigned(),a.width=i.readUnsigned(),a.height=i.readUnsigned();var h=t(i.readByte());a.lctFlag=h.shift(),a.interlaced=h.shift(),a.sorted=h.shift(),a.reserved=h.splice(0,2),a.lctSize=e(h.splice(0,3)),a.lctFlag&&(a.lct=r(1<<a.lctSize+1)),a.lzwMinCodeSize=i.readByte();var c=o();a.pixels=n(a.lzwMinCodeSize,c),a.interlaced&&(a.pixels=l(a.pixels,a.width)),s.img&&s.img(a)},c=function(){var e={};switch(e.sentinel=i.readByte(),String.fromCharCode(e.sentinel)){case"!":e.type="ext",l(e);break;case",":e.type="img",h(e);break;case";":e.type="eof",s.eof&&s.eof(e);break;default:throw new Error("Unknown block: 0x"+e.sentinel.toString(16))}"eof"!==e.type&&setTimeout(c,0)};a(),setTimeout(c,0)},r=function(e){var t,n,r={vp_l:0,vp_t:0,vp_w:null,vp_h:null,c_w:null,c_h:null};for(var o in e)r[o]=e[o];r.vp_w&&r.vp_h&&(r.is_vp=!0);var a=null,l=!1,h=null,c=null,u=null,d=null,p=null,g=null,f=null,m=!0,A=!0,_=!1,y=[],w=[],x=r.gif;void 0===r.auto_play&&(r.auto_play=!x.getAttribute("rel:auto_play")||"1"==x.getAttribute("rel:auto_play"));var b,S,T,v,O=r.hasOwnProperty("on_end")?r.on_end:null,E=r.hasOwnProperty("on_error")?r.on_error:null,N=r.hasOwnProperty("loop_delay")?r.loop_delay:0,C=r.hasOwnProperty("loop_mode")?r.loop_mode:"auto",I=!r.hasOwnProperty("draw_while_loading")||r.draw_while_loading,F=!!I&&(!r.hasOwnProperty("show_progress_bar")||r.show_progress_bar),M=r.hasOwnProperty("progressbar_height")?r.progressbar_height:25,R=r.hasOwnProperty("progressbar_background_color")?r.progressbar_background_color:"rgba(255,255,255,0.4)",P=r.hasOwnProperty("progressbar_foreground_color")?r.progressbar_foreground_color:"rgba(255,0,22,.8)",V=function(){h=null,c=null,p=u,u=null,g=null},D=function(){try{s(t,W)}catch(e){j("parse")}},L=function(e,t){b.width=e*Z(),b.height=t*Z(),T.style.minWidth=e*Z()+"px",v.width=e,v.height=t,v.style.width=e+"px",v.style.height=t+"px",v.getContext("2d",{willReadFrequently:!0}).setTransform(1,0,0,1,0,0)},B=function(e,t){w[e]?(void 0!==t.x&&(w[e].x=t.x),void 0!==t.y&&(w[e].y=t.y)):w[e]=t},k=function(e,t,i){if(i&&F){var n,s,o,a=M;r.is_vp?_?(s=(r.vp_t+r.vp_h-a)/Z(),a/=Z(),n=r.vp_l/Z()+e/t*(r.vp_w/Z()),o=b.width/Z()):(s=r.vp_t+r.vp_h-a,n=r.vp_l+e/t*r.vp_w,o=b.width):(s=(b.height-a)/(_?Z():1),n=e/t*b.width/(_?Z():1),o=b.width/(_?Z():1),a/=_?Z():1),S.fillStyle=R,S.fillRect(n,s,o-n,a),S.fillStyle=P,S.fillRect(0,s,n,a)}},j=function(e){var t=function(){S.fillStyle="black",S.fillRect(0,0,r.c_w?r.c_w:n.width,r.c_h?r.c_h:n.height),S.strokeStyle="red",S.lineWidth=3,S.moveTo(0,0),S.lineTo(r.c_w?r.c_w:n.width,r.c_h?r.c_h:n.height),S.moveTo(0,r.c_h?r.c_h:n.height),S.lineTo(r.c_w?r.c_w:n.width,0),S.stroke()};a=e,n={width:x.width,height:x.height},y=[],t(),e&&E?.(e)},U=function(e){L((n=e).width,n.height)},X=function(e){z(),V(),h=e.transparencyGiven?e.transparencyIndex:null,c=e.delayTime,u=e.disposalMethod},z=function(){g&&(y.push({data:g.getImageData(0,0,n.width,n.height),delay:c}),w.push({x:0,y:0}))},G=function(e){g||(g=v.getContext("2d",{willReadFrequently:!0}));var t=y.length,i=e.lctFlag?e.lct:n.gct;t>0&&(3===p?null!==d?g.putImageData(y[d].data,0,0):g.clearRect(f.leftPos,f.topPos,f.width,f.height):d=t-1,2===p&&g.clearRect(f.leftPos,f.topPos,f.width,f.height));var s=g.getImageData(e.leftPos,e.topPos,e.width,e.height);e.pixels.forEach(function(e,t){e!==h&&(s.data[4*t+0]=i[e][0],s.data[4*t+1]=i[e][1],s.data[4*t+2]=i[e][2],s.data[4*t+3]=255)}),g.putImageData(s,e.leftPos,e.topPos),_||(S.scale(Z(),Z()),_=!0),I&&(S.drawImage(v,0,0),I=r.auto_play),f=e},H=function(){var e,t,i,n=-1,s=0,o=function(){return(n+(A?1:-1)+y.length)%y.length},l=function(e){n+=e,c()},h=(e=!1,t=function(){null!==O&&O(x),s++,!1!==C||s<0?i():(e=!1,m=!1)},i=function(){if(e=m){l(1);var s=10*y[n].delay;s||(s=100),0===o()?(s+=N,setTimeout(t,s)):setTimeout(i,s)}},function(){e||setTimeout(i,0)}),c=function(){var e;(n=parseInt(n,10))>y.length-1&&(n=0),n<0&&(n=0),e=w[n],v.getContext("2d",{willReadFrequently:!0}).putImageData(y[n].data,e.x,e.y),S.globalCompositeOperation="copy",S.drawImage(v,0,0)},u=function(){m=!0,h()};return{init:function(){a||(r.c_w&&r.c_h||S.scale(Z(),Z()),r.auto_play?h():(n=0,c()))},step:h,play:u,pause:function(){m=!1},playing:m,move_relative:l,current_frame:function(){return n},length:function(){return y.length},move_to:function(e){n=e,c()}}}(),$=function(e){k(t.pos,t.data.length,e)},Y=function(){},q=function(e,t){return function(i){e(i),$(t)}},W={hdr:q(U),gce:q(X),com:q(Y),app:{NETSCAPE:q(Y)},img:q(G,!0),eof:function(e){z(),$(!1),r.c_w&&r.c_h||(b.width=n.width*Z(),b.height=n.height*Z()),H.init(),l=!1,J&&J(x)}},K=function(){var e=x.parentNode,t=document.createElement("div");b=document.createElement("canvas"),S=b.getContext("2d",{willReadFrequently:!0}),T=document.createElement("div"),v=document.createElement("canvas"),t.width=b.width=x.width,t.height=b.height=x.height,T.style.minWidth=x.width+"px",t.className="jsgif",T.className="jsgif_toolbar",t.appendChild(b),t.appendChild(T),e.insertBefore(t,x),e.removeChild(x),r.c_w&&r.c_h&&L(r.c_w,r.c_h),Q=!0},Z=function(){return r.max_width&&n&&n.width>r.max_width?r.max_width/n.width:1},Q=!1,J=!1,ee=function(e){return!l&&(J=e||!1,l=!0,y=[],V(),d=null,p=null,g=null,f=null,!0)},te=function(){return y.reduce(function(e,t){return e+t.delay},0)};return{play:H.play,pause:H.pause,move_relative:H.move_relative,move_to:H.move_to,get_playing:function(){return m},get_canvas:function(){return b},get_canvas_scale:function(){return Z()},get_loading:function(){return l},get_auto_play:function(){return r.auto_play},get_length:function(){return H.length()},get_frames:function(){return y},get_duration:function(){return te()},get_duration_ms:function(){return 10*te()},get_current_frame:function(){return H.current_frame()},load_url:function(e,n){if(ee(n)){var s=new XMLHttpRequest;s.open("GET",e,!0),"overrideMimeType"in s?s.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in s?s.responseType="arraybuffer":s.setRequestHeader("Accept-Charset","x-user-defined"),s.onloadstart=function(){Q||K()},s.onload=function(e){200!=this.status&&j("xhr - response"),"response"in this||(this.response=new VBArray(this.responseText).toArray().map(String.fromCharCode).join(""));var n=this.response;n.toString().indexOf("ArrayBuffer")>0&&(n=new Uint8Array(n)),t=new i(n),setTimeout(D,0)},s.onprogress=function(e){e.lengthComputable&&k(e.loaded,e.total,!0)},s.onerror=function(){j("xhr")},s.send()}},load:function(e){this.load_url(x.getAttribute("rel:animated_src")||x.src,e)},load_raw:function(e,n){ee(n)&&(Q||K(),t=new i(e),setTimeout(D,0))},set_frame_offset:B}};return r},void 0===(s="function"==typeof i?i.apply(t,n):i)||(e.exports=s)},1725(e,t,i){i.d(t,{A:()=>a});var n=i(2696);let s=0;const r={AUTO:s++,OPAQUE:s++,MASK:s++,BLEND:s++},o=Object.assign(new Map(Object.entries(r)),r),a=n.A.add("AlphaMode",o)},1730(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(8067),l=i(5053),h=i(5319),c=i(2696);function u(e){a.A.call(this,e),this.addType(l.A.OrientationInterpolator),this._keyValue.setUnit("angle"),this._value_changed.setUnit("angle")}Object.assign(Object.setPrototypeOf(u.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new n.A.SFRotation),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate:(()=>{const e=new h.A,t=new h.A;return function(i,n,s){e.assign(this._keyValue[i].getValue()),t.assign(this._keyValue[n].getValue()),this._value_changed=e.slerp(t,s)}})()}),Object.defineProperties(u,{...o.A.getStaticProperties("OrientationInterpolator","Interpolation",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOnly,"set_fraction",new n.A.SFFloat),new s.A(l.A.inputOutput,"key",new n.A.MFFloat),new s.A(l.A.inputOutput,"keyValue",new n.A.MFRotation),new s.A(l.A.outputOnly,"value_changed",new n.A.SFRotation)]),enumerable:!0}});const d=u,p=c.A.add("OrientationInterpolator",d)},1766(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(8001),r=i(2251),o=i(2919),a=i(608),l=i(5053),h=i(937),c=i(2696);function u(e){r.A.call(this,e),o.A.call(this,e),this.addType(l.A.X3DGroupingNode),this.addChildObjects(l.A.outputOnly,"rebuild",new n.A.SFTime),this.setBoundedObject(!0),this.setPointingObject(!0),this.setCollisionObject(!0),this.setShadowObject(!0),this.setVisibleObject(!0),this.allowedTypes=new Set,this.pointingDeviceSensorNodes=new Set,this.pointingObjects=new Set,this.clipPlaneNodes=new Set,this.displayNodes=new Set,this.cameraObjects=new Set,this.pickableSensorNodes=new Set,this.pickableObjects=new Set,this.collisionObjects=new Set,this.shadowObjects=new Set,this.childNodes=new Set,this.visibleObjects=new Set,this.boundedObjects=new Set,this.sensors=[]}Object.assign(Object.setPrototypeOf(u.prototype,r.A.prototype),o.A.prototype,{initialize(){r.A.prototype.initialize.call(this),o.A.prototype.initialize.call(this),this._rebuild.addInterest("set_children__",this),this._transformSensors.addInterest("set_pickableObjects__",this),this._bboxSize.addInterest("set_boundedObjects__",this),this._addChildren.addInterest("set_addChildren__",this),this._removeChildren.addInterest("set_removeChildren__",this),this._children.addInterest("requestRebuild",this),this.set_children__()},addAllowedTypes(...e){for(const t of e)this.allowedTypes.add(t)},getBBox(e,t){return this.isDefaultBBoxSize()?this.getSubBBox(e,t):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getSubBBox(e,t){return o.A.prototype.getBBox.call(this,this.boundedObjects,e,t)},getShapes(e,t){for(const i of this.visibleObjects)i.getShapes(e,t);return e},requestRebuild(){this._rebuild.addEvent()},set_addChildren__(){if(0===this._addChildren.length)return;this._addChildren.setTainted(!0);const e=new Set(this._addChildren);for(const t of this._children)e.delete(t);this.addChildren(e),this._children.isTainted()||(this._children.removeInterest("requestRebuild",this),this._children.addInterest("connectChildren",this));for(const t of e)this._children.push(t);this._addChildren.length=0,this._addChildren.setTainted(!1)},set_removeChildren__(){if(0!==this._removeChildren.length){if(this._removeChildren.setTainted(!0),this._children.length>0){const e=new Set(this._removeChildren);this.removeChildren(e),this._children.isTainted()||(this._children.removeInterest("requestRebuild",this),this._children.addInterest("connectChildren",this)),this._children=this._children.filter(t=>!e.has(t))}this._removeChildren.length=0,this._removeChildren.setTainted(!1)}},set_children__(){this.clearChildren(),this.addChildren(this._children)},connectChildren(){this._children.removeInterest("connectChildren",this),this._children.addInterest("requestRebuild",this)},clearChildren(){for(const e of this.childNodes)e._isBoundedObject.removeInterest("requestRebuild",this),e._isPointingObject.removeInterest("requestRebuild",this),e._isCameraObject.removeInterest("requestRebuild",this),e._isPickableObject.removeInterest("requestRebuild",this),e._isCollisionObject.removeInterest("requestRebuild",this),e._isShadowObject.removeInterest("requestRebuild",this),e._isVisibleObject.removeInterest("requestRebuild",this),(0,h.A)(l.A.X3DBoundedObject,e)&&(e._display.removeInterest("requestRebuild",this),e._bboxDisplay.removeInterest("requestRebuild",this));this.boundedObjects.clear(),this.pointingDeviceSensorNodes.clear(),this.pointingObjects.clear(),this.clipPlaneNodes.clear(),this.displayNodes.clear(),this.cameraObjects.clear(),this.pickableSensorNodes.clear(),this.pickableObjects.clear(),this.collisionObjects.clear(),this.shadowObjects.clear(),this.childNodes.clear(),this.visibleObjects.clear()},addChildren(e){for(const t of e)this.addChild(t);this.set_objects__()},addChild(e){const t=(0,h.A)(l.A.X3DChildNode,e);if(!t)return;const i=t.getType();if(!this.allowedTypes.size||i.some(Set.prototype.has,this.allowedTypes))for(let e=i.length-1;e>=0;--e){switch(i[e]){case l.A.X3DPointingDeviceSensorNode:this.pointingDeviceSensorNodes.add(t);continue;case l.A.ClipPlane:this.clipPlaneNodes.add(t),this.displayNodes.add(t);continue;case l.A.LocalFog:case l.A.X3DLightNode:this.displayNodes.add(t);continue;case l.A.TransformSensor:case l.A.X3DPickSensorNode:t.isPickableObject()&&this.pickableSensorNodes.add(t);continue;case l.A.X3DChildNode:t._isBoundedObject.addInterest("requestRebuild",this),t._isPointingObject.addInterest("requestRebuild",this),t._isCameraObject.addInterest("requestRebuild",this),t._isPickableObject.addInterest("requestRebuild",this),t._isCollisionObject.addInterest("requestRebuild",this),t._isShadowObject.addInterest("requestRebuild",this),t._isVisibleObject.addInterest("requestRebuild",this),this.childNodes.add(t),t.isVisible()&&(t.isBoundedObject()&&this.boundedObjects.add(t),t.isPointingObject()&&this.pointingObjects.add(t),t.isCameraObject()&&this.cameraObjects.add(t),t.isPickableObject()&&!this.pickableSensorNodes.has(t)&&this.pickableObjects.add(t),t.isCollisionObject()&&this.collisionObjects.add(t),t.isShadowObject()&&this.shadowObjects.add(t),t.isVisibleObject()&&this.visibleObjects.add(t)),(0,h.A)(l.A.X3DBoundedObject,t)&&(t._display.addInterest("requestRebuild",this),t._bboxDisplay.addInterest("requestRebuild",this),t.isBBoxVisible()&&this.visibleObjects.add(t.getBBoxNode()));break;default:continue}break}},removeChildren(e){for(const t of e)this.removeChild(t);this.set_objects__()},removeChild(e){const t=(0,h.A)(l.A.X3DChildNode,e);if(!t)return;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case l.A.X3DPointingDeviceSensorNode:this.pointingDeviceSensorNodes.delete(t);continue;case l.A.ClipPlane:this.clipPlaneNodes.delete(t),this.displayNodes.delete(t);continue;case l.A.LocalFog:case l.A.X3DLightNode:this.displayNodes.delete(t);continue;case l.A.TransformSensor:case l.A.X3DPickSensorNode:this.pickableSensorNodes.delete(t);continue;case l.A.X3DChildNode:t._isBoundedObject.removeInterest("requestRebuild",this),t._isPointingObject.removeInterest("requestRebuild",this),t._isCameraObject.removeInterest("requestRebuild",this),t._isPickableObject.removeInterest("requestRebuild",this),t._isCollisionObject.removeInterest("requestRebuild",this),t._isShadowObject.removeInterest("requestRebuild",this),t._isVisibleObject.removeInterest("requestRebuild",this),(0,h.A)(l.A.X3DBoundedObject,t)&&(t._display.removeInterest("requestRebuild",this),t._bboxDisplay.removeInterest("requestRebuild",this)),this.boundedObjects.delete(t),this.pointingObjects.delete(t),this.cameraObjects.delete(t),this.pickableObjects.delete(t),this.collisionObjects.delete(t),this.shadowObjects.delete(t),this.childNodes.delete(t),this.visibleObjects.delete(t);break;default:continue}break}},set_objects__(){this.set_boundedObjects__(),this.set_pointingObjects__(),this.set_cameraObjects__(),this.set_pickableObjects__(),this.set_collisionObjects__(),this.set_shadowObjects__(),this.set_visibleObjects__()},set_boundedObjects__(){this.setBoundedObject(this.boundedObjects.size||!this.isDefaultBBoxSize())},set_pointingObjects__(){this.setPointingObject(this.pointingObjects.size)},set_cameraObjects__(){this.setCameraObject(this.cameraObjects.size)},set_pickableObjects__(){this.setPickableObject(this.getTransformSensors().size||this.pickableSensorNodes.size||this.pickableObjects.size)},set_collisionObjects__(){this.setCollisionObject(this.collisionObjects.size)},set_shadowObjects__(){this.setShadowObject(this.shadowObjects.size)},set_visibleObjects__(){this.setVisibleObject(this.visibleObjects.size)},traverse(e,t){switch(e){case a.A.POINTER:{const{sensors:i,pointingDeviceSensorNodes:n,clipPlaneNodes:s,pointingObjects:r}=this;if(n.size){for(const e of n)e.push(t,i);i.length&&t.getSensors().push(i)}for(const e of s)e.push(t);for(const i of r)i.traverse(e,t);for(const e of s)e.pop(t);return void(i.length&&(i.length=0,t.getSensors().pop()))}case a.A.CAMERA:for(const i of this.cameraObjects)i.traverse(e,t);return;case a.A.PICKING:{if(this.getTransformSensors().size){const e=t.getModelViewMatrix().get();for(const t of this.getTransformSensors())t.collect(e)}for(const i of this.pickableSensorNodes)i.traverse(e,t);const i=this.getBrowser(),n=i.getPickingHierarchy();if(n.push(this),i.getPickable().at(-1))for(const i of this.visibleObjects)i.traverse(e,t);else for(const i of this.pickableObjects)i.traverse(e,t);return void n.pop()}case a.A.COLLISION:{const{clipPlaneNodes:i,collisionObjects:n}=this;for(const e of i)e.push(t);for(const i of n)i.traverse(e,t);for(const e of i)e.pop(t);return}case a.A.SHADOW:{const{clipPlaneNodes:i,shadowObjects:n}=this;for(const e of i)e.push(t);for(const i of n)i.traverse(e,t);for(const e of i)e.pop(t);return}case a.A.DISPLAY:{const{displayNodes:i,visibleObjects:n}=this;for(const e of i)e.push(t,this);for(const i of n)i.traverse(e,t);for(const e of i)e.pop(t);return}}},dispose(){o.A.prototype.dispose.call(this),r.A.prototype.dispose.call(this)}}),Object.defineProperties(u,s.A.getStaticProperties("X3DGroupingNode","Grouping",1));const d=u,p=c.A.add("X3DGroupingNode",d)},1794(e,t,i){i.d(t,{A:()=>G});var n=i(8015),s=i(8001),r=i(5041),o=i(608),a=i(7319),l=i(5185),h=i(2696);function c(e,t){this.array=e,this.auxiliary=[],t&&(this.compare=t)}Object.assign(c.prototype,{compare:(e,t)=>e<t,sort(e,t){this.mergeSort(e,t-1)},mergeSort(e,t){if(e<t){const i=e+t>>>1;this.mergeSort(e,i),this.mergeSort(i+1,t),this.merge(e,i,t)}},merge(e,t,i){const{array:n,auxiliary:s,compare:r}=this;let o,a,l;for(o=0,a=e;a<=t;)s[o++]=n[a++];for(o=0,l=e;l<a&&a<=i;)r(n[a],s[o])?n[l++]=n[a++]:n[l++]=s[o++];for(;l<a;)n[l++]=s[o++]}});const u=c,d=h.A.add("MergeSort",u);var p=i(2342),g=i(7854),f=i(1490),m=i(477),A=i(8392),_=i(5319),y=i(9582),w=i(6732),x=i(1522),b=i(1840);function S(e){const t=e.getBrowser();this.partialRenderKey="",this.renderKey="",this.renderCount=0,this.view=null,this.viewVolumes=[],this.projectionMatrix=new w.A(y.A),this.modelViewMatrix=new w.A(y.A),this.viewMatrix=new w.A(y.A),this.cameraSpaceMatrix=new w.A(y.A),this.viewportArray=new Int32Array(4),this.projectionMatrixArray=new Float32Array(16),this.eyeMatrixArray=new Float32Array(16),this.viewMatrixArray=new Float32Array(16),this.cameraSpaceMatrixArray=new Float32Array(16),this.hitRay=new g.A,this.sensors=[[]],this.viewpointGroups=[],this.lights=[],this.globalLightsKeys=[],this.globalLights=[],this.localObjectsKeys=[],this.localObjects=[],this.globalShadows=[!1],this.globalShadow=!1,this.localShadows=[!1],this.localFogs=[null],this.layouts=[],this.hAnimNode=[null],this.invHumanoidMatrix=new w.A(y.A),this.generatedCubeMapTextures=[],this.collisions=[],this.collisionTime=new b.A,this.numPointingShapes=0,this.numCollisionShapes=0,this.numShadowShapes=0,this.numOpaqueShapes=0,this.numTransparentShapes=0,this.pointingShapes=[],this.collisionShapes=[],this.activeCollisions=[],this.shadowShapes=[],this.opaqueShapes=[],this.transparentShapes=[],this.transparencySorter=new d(this.transparentShapes,(e,t)=>e.distance<t.distance),this.renderPasses=0,this.renderPass=a.A.NONE,this.speed=0,this.depthBuffer=new r.A({browser:t,width:16,height:16,float:!0,colorTextures:2})}function T(e,t){const i=t.length;for(let n=0;n<i;++n)e[n]=t[n];e.length=i}Object.assign(S.prototype,{initialize(){const e=this.getBrowser();e.getRenderingProperties()._Shading.addInterest("set_renderKey__",this),e.getRenderingProperties()._LogarithmicDepthBuffer.addInterest("set_renderKey__",this),e.getRenderingProperties()._XRSession.addInterest("set_renderKey__",this),e.getBrowserOptions()._ColorSpace.addInterest("set_renderKey__",this),e.getBrowserOptions()._OrderIndependentTransparency.addInterest("set_renderKey__",this),e.getBrowserOptions()._ToneMapping.addInterest("set_renderKey__",this),this.getViewpointStack().addInterest("set_renderKey__",this),this.set_renderKey__()},isIndependent:()=>!0,set_renderKey__(){const e=this.getBrowser();this.logarithmicDepthBuffer=e.getRenderingProperty("LogarithmicDepthBuffer")||this.getViewpoint().getLogarithmicDepthBuffer(),this.orderIndependentTransparency=e.getBrowserOption("OrderIndependentTransparency");let t="";switch(t+="FLAT"===e.getRenderingProperty("Shading")?1:0,t+=e.getRenderingProperty("XRSession")?1:0,t+=this.logarithmicDepthBuffer?1:0,t+=this.orderIndependentTransparency?1:0,e.getBrowserOption("ColorSpace")){case"SRGB":t+=0;break;default:t+=1;break;case"LINEAR":t+=2}switch(e.getBrowserOption("ToneMapping")){default:t+=0;break;case"ACES_NARKOWICZ":t+=1;break;case"ACES_HILL":t+=2;break;case"ACES_HILL_EXPOSURE_BOOST":t+=3;break;case"KHR_PBR_NEUTRAL":t+=4}this.partialRenderKey=t},getLogarithmicDepthBuffer(){return this.logarithmicDepthBuffer},getOrderIndependentTransparency(){return this.orderIndependentTransparency},getRenderKey(){return this.renderKey},getRenderCount(){return this.renderCount},advanceRenderCount:(()=>{let e=0;return function(){e===Number.MAX_SAFE_INTEGER&&(e=0),this.renderCount=++e}})(),getFramebuffers(){return this.getBrowser().getFramebuffers()},getView(){return this.view},getViewVolumes(){return this.viewVolumes},getViewVolume(){return this.viewVolumes.at(-1)},getProjectionMatrix(){return this.projectionMatrix},getProjectionMatrixWithLimits(e,t,i){return this.getViewpoint().getProjectionMatrixWithLimits(e,t,i)},getModelViewMatrix(){return this.modelViewMatrix},getViewMatrix(){return this.viewMatrix},getCameraSpaceMatrix(){return this.cameraSpaceMatrix},getViewportArray(){return this.viewportArray},getProjectionMatrixArray(){return this.projectionMatrixArray},getEyeMatrixArray(){return this.eyeMatrixArray},getViewMatrixArray(){return this.viewMatrixArray},getCameraSpaceMatrixArray(){return this.cameraSpaceMatrixArray},getHitRay(){return this.hitRay},getSensors(){return this.sensors},getViewpointGroups(){return this.viewpointGroups},getLights(){return this.lights},getGlobalLights(){return this.globalLights},getGlobalLightsKeys(){return this.globalLightsKeys},getLocalObjects(){return this.localObjects},getLocalObjectsKeys(){return this.localObjectsKeys},pushGlobalShadows(e){this.globalShadows.push(e||this.globalShadows.at(-1))},getGlobalShadows(){return this.globalShadows},getGlobalShadow(){return this.globalShadow},pushLocalShadows(e){this.localShadows.push(e||this.localShadows.at(-1))},popLocalShadows(){this.localShadows.pop()},setGlobalFog:(()=>{const e=new y.A;return function(t){if(t.getFogType()){const i=this.localFogs[0]||t.getFogs().pop();e.assign(t.getModelMatrix()).multRight(this.getViewMatrix().get()),i.set(t,e),this.localFogs[0]=i}else this.localFogs[0]=null}})(),getLocalFogs(){return this.localFogs},getLayouts(){return this.layouts},getParentLayout(){return this.layouts.at(-1)},getHAnimNode(){return this.hAnimNode},getInvHumanoidMatrix(){return this.invHumanoidMatrix},getGeneratedCubeMapTextures(){return this.generatedCubeMapTextures},getCollisions(){return this.collisions},getCollisionTime(){return this.collisionTime},getNumPointingShapes(){return this.numPointingShapes},getPointingShapes(){return this.pointingShapes},getNumCollisionShapes(){return this.numCollisionShapes},getCollisionShapes(){return this.collisionShapes},getNumShadowShapes(){return this.numShadowShapes},getShadowShapes(){return this.shadowShapes},getNumOpaqueShapes(){return this.numOpaqueShapes},getOpaqueShapes(){return this.opaqueShapes},getNumTransparentShapes(){return this.numTransparentShapes},getTransparentShapes(){return this.transparentShapes},getRenderPass(){return this.renderPass},constrainTranslation:(()=>{const e=new x.A,t=new m.A,i=new m.A,n=new m.A;return function(s,r=!0,o=!0){const a=this.getClosestObject(s),h=this.getNavigationInfo().getCollisionRadius(),c=a.distance-h;if(c>0){const r=s.norm();if(r>c){if(t.assign(s).normalize().multiply(c),!o)return t;const h=l.A.clamp(this.getBrowser().getBrowserOption("WallFriction"),0,1);return e.set(t,a.normal),e.getClosestPointToPoint(s,i),e.set(m.A.ZERO,this.getViewpoint().getUpVector()),e.getClosestPointToPoint(i,n),n.subtract(t).normalize().multiply(r*(1-h)),this.constrainTranslation(n,!1,!1)}return s}return r?(t.assign(s).normalize().multiply(c),this.constrainTranslation(t,!1,!1)):s.assign(m.A.ZERO)}})(),getClosestObject:(()=>{const e=new y.A,t=new y.A,i=new y.A,n=new _.A,s=new _.A;return function(r){this.collisionTime.start();const o=this.getNavigationInfo(),a=this.getViewpoint(),l=o.getCollisionRadius(),h=o.getStepHeight()-o.getAvatarHeight(),c=a.getNearDistance(o),u=o.getAvatarHeight();p.A.ortho(-l,l,Math.min(h,-l),l,c,Math.max(2*l,2*u),e),n.assign(a._orientation.getValue()).inverse().multRight(a.getOrientation()),s.setFromToVec(m.A.NEGATIVE_Z_AXIS,r).multRight(n),a.straightenHorizon(s),i.assign(a.getModelMatrix()).translate(a.getUserPosition()).rotate(s).inverse().multLeft(a.getCameraSpaceMatrix()),t.assign(i).multRight(e),this.getProjectionMatrix().push(t);const d=this.getCollisionShape(e);return d.modelViewMatrix.multRight(i).submatrix.inverse().multMatrixVec(d.normal),s.multVecRot(d.normal).normalize(),this.getProjectionMatrix().pop(),this.collisionTime.stop(),d}})(),getCollisionShape:(()=>{const e=new A.A(0,0,16,16),t=new f.A(y.A.IDENTITY,e),i={id:-1,distance:0,normal:new m.A,modelViewMatrix:new y.A};return function(n){this.depthBuffer.bind(),this.viewVolumes.push(t),this.depth(this.collisionShapes,this.numCollisionShapes,!0);const s=this.depthBuffer.readDepth(n,e,i);if(this.viewVolumes.pop(),s.id<0)s.node=null;else{const e=this.collisionShapes[s.id];s.node=e.shapeNode,s.modelViewMatrix.assign(e.modelViewMatrix)}return s}})(),render(e,t,i){switch(e){case o.A.POINTER:this.numPointingShapes=0,t.call(i,e,this),this.pointing(this.pointingShapes,this.numPointingShapes);break;case o.A.COLLISION:this.numCollisionShapes=0,t.call(i,e,this),this.collide(),this.gravitate();break;case o.A.SHADOW:this.numShadowShapes=0,t.call(i,e,this),this.depth(this.shadowShapes,this.numShadowShapes,!1);break;case o.A.DISPLAY:this.lightIndex=0,this.renderPasses=0,this.numOpaqueShapes=0,this.numTransparentShapes=0,this.setGlobalFog(this.getFog()),t.call(i,e,this),this.draw()}},setHitRay(e,t,i){f.A.unProjectRay(i.x,i.y,y.A.IDENTITY,e,t,this.hitRay)},addPointingShape:(()=>{const e=new m.A,t=new m.A;return function(i){const n=this.getModelViewMatrix().get();n.multDirMatrix(e.assign(i.getBBoxSize())),n.multVecMatrix(t.assign(i.getBBoxCenter()));const s=e.norm()/2,r=this.viewVolumes.at(-1);if(!r.intersectsSphere(s,t))return!1;const o=this.numPointingShapes++;if(o===this.pointingShapes.length){const e={renderObject:this,modelViewMatrix:new Float32Array(16),viewport:new A.A,clipPlanes:[],sensors:[],get renderContext(){return this}};this.pointingShapes.push(e)}const a=this.pointingShapes[o];return a.modelViewMatrix.set(n),a.viewport.assign(r.getViewport()),a.hAnimNode=this.hAnimNode.at(-1),a.shapeNode=i,T(a.clipPlanes,this.localObjects),T(a.sensors,this.sensors.at(-1)),!0}})(),addCollisionShape:(()=>{const e=new m.A,t=new m.A;return function(i){const n=this.getModelViewMatrix().get();n.multDirMatrix(e.assign(i.getBBoxSize())),n.multVecMatrix(t.assign(i.getBBoxCenter()));const s=e.norm()/2;if(!this.viewVolumes.at(-1).intersectsSphere(s,t))return!1;const r=this.numCollisionShapes++;if(r===this.collisionShapes.length){const e={renderObject:this,modelViewMatrix:new Float32Array(16),collisions:[],clipPlanes:[],get renderContext(){return this}};this.collisionShapes.push(e)}const o=this.collisionShapes[r];return o.modelViewMatrix.set(n),o.hAnimNode=this.hAnimNode.at(-1),o.shapeNode=i,T(o.clipPlanes,this.localObjects),T(o.collisions,this.collisions),!0}})(),addShadowShape:(()=>{const e=new m.A,t=new m.A;return function(i){const n=this.getModelViewMatrix().get();n.multDirMatrix(e.assign(i.getBBoxSize())),n.multVecMatrix(t.assign(i.getBBoxCenter()));const s=e.norm()/2,r=this.viewVolumes.at(-1);if(!r.intersectsSphere(s,t))return!1;const o=this.numShadowShapes++;if(o===this.shadowShapes.length){const e={renderObject:this,modelViewMatrix:new Float32Array(16),viewport:new A.A,clipPlanes:[],get renderContext(){return this}};this.shadowShapes.push(e)}const a=this.shadowShapes[o];return a.modelViewMatrix.set(n),a.viewport.assign(r.getViewport()),a.hAnimNode=this.hAnimNode.at(-1),a.shapeNode=i,T(a.clipPlanes,this.localObjects),!0}})(),addDisplayShape:(()=>{const e=new m.A,t=new m.A;return function(i){const n=this.getModelViewMatrix().get();n.multDirMatrix(e.assign(i.getBBoxSize())),n.multVecMatrix(t.assign(i.getBBoxCenter()));const s=e.norm()/2,r=this.viewVolumes.at(-1);if(!r.intersectsSphere(s,t))return!1;let o;if(i.isTransparent()){const e=this.numTransparentShapes++;e===this.transparentShapes.length&&this.transparentShapes.push(this.createRenderContext(!0)),o=this.transparentShapes[e],o.distance=t.z}else{const e=this.numOpaqueShapes++;e===this.opaqueShapes.length&&this.opaqueShapes.push(this.createRenderContext(!1)),o=this.opaqueShapes[e]}return this.renderPasses|=i.getRenderPasses(),o.modelViewMatrix.set(n),o.viewport.assign(r.getViewport()),o.shadows=this.localShadows.at(-1),o.fogNode=this.localFogs.at(-1),o.hAnimNode=this.hAnimNode.at(-1),o.shapeNode=i,o.appearanceNode=i.getAppearance(),T(o.localObjects,this.localObjects),T(o.localObjectsKeys,this.localObjectsKeys),!0}})(),createRenderContext(e){return{renderObject:this,transparent:e,modelViewMatrix:new Float32Array(16),viewport:new A.A,localObjects:[],localObjectsKeys:[],get renderContext(){return this}}},pointing:(()=>{const e=new Float32Array(16);return function(t,i){const n=this.getBrowser(),s=n.getContext(),r=this.viewVolumes.at(-1).getViewport(),{x:o,y:a}=n.getPointer();e.set(this.getProjectionMatrix().get()),s.viewport(r.x-o,r.y-a,r.z,r.w),s.scissor(0,0,1,1),s.clear(s.DEPTH_BUFFER_BIT),s.disable(s.CULL_FACE);for(let r=0;r<i;++r){const{renderContext:i,modelViewMatrix:l,viewport:h,shapeNode:c,hAnimNode:u,clipPlanes:d}=t[r],p=c.getAppearance(),g=c.getGeometryContext(),f=p.getDepthMode(),m=p.getStyleProperties(g.geometryType),A=n.getPointingShader(d.length,c,u),_=n.addPointingShape(i);s.viewport(h.x-o,h.y-a,h.z,h.w),A.enable(s),A.setClipPlanes(s,d),s.uniformMatrix4fv(A.x3d_ProjectionMatrix,!1,e),s.uniformMatrix4fv(A.x3d_ModelViewMatrix,!1,l),s.uniform1f(A.x3d_Id,_),f?.enable(s),m?.setShaderUniforms(s,A),u?.setShaderUniforms(s,A),c.displaySimple(s,i,A),f?.disable(s),n.resetTextureUnits()}}})(),collide:(()=>{const e=[m.A.X_AXIS,m.A.Y_AXIS,m.A.Z_AXIS,m.A.NEGATIVE_X_AXIS,m.A.NEGATIVE_Y_AXIS,m.A.NEGATIVE_Z_AXIS],t=new Set,i=[];return function(){if(!this.getBrowser().getCollisionCount())return;const n=this.getNavigationInfo().getCollisionRadius()*Math.SQRT2;if(this.numCollisionShapes){for(const i of e){const e=this.getClosestObject(i);e.id<0||(e.distance>n||t.add(e.id))}for(const e of t){const{collisions:t}=this.collisionShapes[e];for(const e of t)i.push(e)}t.clear()}for(const e of this.activeCollisions)i.includes(e)||e.set_active__(!1);for(const e of i)e.set_active__(!0);T(this.activeCollisions,i),i.length=0}})(),gravitate:(()=>{const e=new y.A,t=new y.A,i=new m.A,n=new _.A;return function(){const s=this.getBrowser();if(s.getActiveLayer()!==this)return;if("WALK"!==s.getCurrentViewer())return;const r=this.getNavigationInfo(),o=this.getViewpoint(),a=r.getCollisionRadius(),l=r.getAvatarHeight(),h=r.getStepHeight(),c=o.getNearDistance(r);p.A.ortho(-a,a,-a,a,c,2*Math.max(a,l),e);const u=o.getUpVector(),d=n.setFromToVec(m.A.Z_AXIS,u);t.assign(o.getModelMatrix()).translate(o.getUserPosition()).rotate(d).inverse().multRight(e).multLeft(o.getCameraSpaceMatrix()),this.getProjectionMatrix().push(t);let g=this.getCollisionShape(e).distance;this.getProjectionMatrix().pop(),g-=l;const f=n.setFromToVec(m.A.Y_AXIS,u);if(g>0){const e=this.speed?s.getCurrentFrameRate():1e6;this.speed-=s.getBrowserOptions()._Gravity.getValue()/e;let t=this.speed/e;t<-g&&(t=-g,this.speed=0);const n=f.multVecRot(i.set(0,t,0));o._positionOffset=n.add(o._positionOffset.getValue())}else if(this.speed=0,g=-g,g>.01&&g<h){const e=f.multVecRot(i.set(0,g,0));o._positionOffset=e.add(o._positionOffset.getValue())}}})(),depth:(()=>{const e=new Float32Array(16);return function(t,i,n){const s=this.getBrowser(),r=s.getContext(),o=this.viewVolumes.at(-1).getViewport();e.set(this.getProjectionMatrix().get()),r.viewport(...o),r.scissor(...o),r.clearColor(1,-1,-1,-1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.disable(r.CULL_FACE);for(let o=0;o<i;++o){const{renderContext:i,clipPlanes:a,modelViewMatrix:l,shapeNode:h,hAnimNode:c}=t[o],u=h.getAppearance(),d=h.getGeometryContext(),p=u.getStyleProperties(d.geometryType),g=s.getDepthShader(n,a.length,h,c);g.enable(r),g.setClipPlanes(r,a),r.uniform1i(g.x3d_Id,o),r.uniformMatrix4fv(g.x3d_ProjectionMatrix,!1,e),r.uniformMatrix4fv(g.x3d_ModelViewMatrix,!1,l),p?.setShaderUniforms(r,g),c?.setShaderUniforms(r,g),h.displaySimple(r,i,g),s.resetTextureUnits()}}})(),draw(){const e=this.isIndependent(),t=this.getBrowser(),i=t.getContext(),n=t.getPose(),s=this.getFramebuffers(),r=s.length,o=this.viewVolumes.at(-1).getViewport(),l=this.lights,h=this.globalLightsKeys,c=h.join(""),u=this.globalLights,d=this.generatedCubeMapTextures,p=this.globalShadows,g=this.getNavigationInfo()._headlight.getValue();if(this.viewportArray.set(o),this.viewMatrixArray.set(this.getViewMatrix().get()),this.cameraSpaceMatrixArray.set(this.getCameraSpaceMatrix().get()),e){for(const e of l)e.renderShadowMap(this);for(const e of d)e.renderTexture(this)}if(this.globalShadow=p.at(-1),!this.orderIndependentTransparency){const{numTransparentShapes:e,transparencySorter:t}=this;t.sort(0,e)}for(let e=0;e<r;++e){this.advanceRenderCount();const r=this.view=n?.views[e];r?(this.projectionMatrixArray.set(r.projectionMatrix),this.eyeMatrixArray.set(r.matrix)):(this.projectionMatrixArray.set(this.getProjectionMatrix().get()),this.eyeMatrixArray.set(y.A.IDENTITY)),g&&t.getHeadlight().setGlobalVariables(this);for(const e of l)e.setGlobalVariables(this);if(this.renderPasses!==a.A.NONE){if(this.renderPasses&a.A.VOLUME_SCATTER_BIT){t.resetShapeId(),this.renderPass=a.A.VOLUME_SCATTER_KEY,this.renderKey=`.${this.partialRenderKey}.${this.renderPass}.${c}.`;const e=t.getVolumeScatterBuffer();this.drawShapes(a.A.VOLUME_SCATTER_KEY,i,t,e,i.COLOR_BUFFER_BIT,o)}if(this.renderPasses&a.A.TRANSMISSION_BIT){this.renderPass=a.A.TRANSMISSION_KEY,this.renderKey=`.${this.partialRenderKey}.${this.renderPass}.${c}.`;const e=t.getTransmissionBuffer();this.drawShapes(a.A.TRANSMISSION_KEY,i,t,e,i.COLOR_BUFFER_BIT,o),i.bindTexture(i.TEXTURE_2D,e.getColorTexture()),i.generateMipmap(i.TEXTURE_2D)}}this.renderPass=a.A.RENDER_KEY,this.renderKey=`.${this.partialRenderKey}.${this.renderPass}.${c}.`;const h=s[e];this.drawShapes(a.A.RENDER_KEY,i,t,h,0,o)}if(this.view=null,e){const e=t.getLocalObjects();for(const t of e)t.dispose();e.length=0;for(const e of u)e.dispose();t.resetGlobalTextureUnits()}h.length=0,u.length=0,l.length=0,p.length=1,d.length=0},drawShapes(e,t,i,n,s,r){const{opaqueShapes:o,numOpaqueShapes:a,transparentShapes:l,numTransparentShapes:h}=this;n.bind(),t.viewport(...r),t.scissor(...r),t.clearColor(0,0,0,0),t.clear(t.DEPTH_BUFFER_BIT|s),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA),this.getBackground()[e]?.display(t,this);for(let i=0;i<a;++i){const{renderContext:n,shapeNode:s}=o[i];s[e]?.display(t,n)}n.getOIT()&&n.bindTransparency(),t.depthMask(!1),t.enable(t.BLEND);for(let i=0;i<h;++i){const{renderContext:n,shapeNode:s}=l[i];s[e]?.display(t,n)}t.depthMask(!0),t.disable(t.BLEND),n.getOIT()&&n.compose()}});const v=S,O=h.A.add("X3DRenderObject",v);var E=i(5543);function N(e,t){E.A.call(this,e),this.nodes=[t]}Object.assign(Object.setPrototypeOf(N.prototype,E.A.prototype),{get(){return this.nodes},top(){return this.nodes.at(-1)},pushOnTop(e){e!==this.nodes[0]&&(this.nodes.at(-1)._isBound=!1,this.nodes.push(e)),e._isBound=!0,e._bindTime=this.getBrowser().getCurrentTime(),this.addNodeEvent()},update(e,t,i){if(!t.length&&!i.length)return;const n=this.top(),s=this.nodes.at(-1);for(const e of t){const t=this.nodes.indexOf(e);t>0&&this.nodes.splice(t,1)}s!==this.nodes[0]&&i.some(e=>!e._set_bind.getValue()&&e===s)&&this.nodes.pop();for(const e of i){if(!e._set_bind.getValue())continue;const t=this.nodes.indexOf(e);t>-1&&this.nodes.splice(t,1),this.nodes.push(e)}const r=this.nodes.at(-1);r!==s?(s._isBound=!1,r._isBound=!0,r._bindTime=this.getBrowser().getCurrentTime(),r.transitionStart(e,n)):i.includes(r)&&r.transitionStart(e,n),this.addNodeEvent()}});for(const e of Object.keys(N.prototype))Object.defineProperty(N.prototype,e,{enumerable:!1});Object.defineProperties(N,{typeName:{value:"BindableStack",enumerable:!0}});const C=N,I=h.A.add("BindableStack",C);var F=i(6138);function M(e,t){E.A.call(this,e),this.modificationCount=0,this.nodes=[t],this.collectedNodes=[t],this.changedNodes=[],this.removedNodes=[]}Object.assign(Object.setPrototypeOf(M.prototype,E.A.prototype),{get(){return this.nodes},getBound(e){const t=this.nodes.length;if(1===t)return this.nodes[0];if(e)for(let i=1;i<t;++i){const t=this.nodes[i];if(!(t.getExecutionContext().getOuterNode()?.getScene()??t.getScene()).getExecutionContext()&&t.getName()==e)return t}for(let e=1;e<t;++e){const t=this.nodes[e];if(!(t.getExecutionContext().getOuterNode()?.getScene()??t.getScene()).getExecutionContext()&&t._isBound.getValue())return t}for(let e=1;e<t;++e){const t=this.nodes[e];if(!(t.getExecutionContext().getOuterNode()?.getScene()??t.getScene()).getExecutionContext())return t}return this.nodes[0]},push(e){return this.collectedNodes.push(e)},update(e,t){const{collectedNodes:i,changedNodes:n,removedNodes:s}=this;for(const e of i)e.getModificationCount()>this.modificationCount&&n.push(e);if(!function(e,t){const i=e.length;if(i!==t.length)return!1;for(let n=0;n<i;++n)if(e[n]!==t[n])return!1;return!0}(i,this.nodes)){for(const e of this.nodes)i.includes(e)||s.push(e);const e=this.nodes;this.nodes=i,this.collectedNodes=e,this.addNodeEvent()}this.collectedNodes.length=1,t.update(e,s,n),n.length=0,s.length=0,this.modificationCount=F.A.getModificationCount()}});for(const e of Object.keys(M.prototype))Object.defineProperty(M.prototype,e,{enumerable:!1});Object.defineProperties(M,{typeName:{value:"BindableList",enumerable:!0}});const R=M,P=h.A.add("BindableList",R);var V=i(8219),D=i(1997),L=i(6855),B=i(1467),k=i(937),j=i(5053),U=i(5687);function X(e,t,i){let r;s.A.call(this,e),O.call(this,e),this.addType(j.A.X3DLayerNode),this.addChildObjects(j.A.inputOutput,"hidden",new n.A.SFBool,j.A.outputOnly,"display",new n.A.SFBool(!0)),e.getSpecificationVersion()<=3.3&&this.addAlias("isPickable",this._pickable),e.hasComponent("Picking")&&(r=e.createNode("PickableGroup",!1),r&&(this._pickable.addFieldInterest(r._pickable),this._objectType.addFieldInterest(r._objectType))),r??=new V.A(e),r._children=[i],r.setPrivate(!0),this.active=!1,this.layer0=!1,this.groupNodes=r,this.defaultNavigationInfo=new D.A(e),this.defaultViewpoint=t,this.defaultBackground=new B.A(e),this.defaultFog=new L.A(e),this.navigationInfoStack=new I(e,this.defaultNavigationInfo),this.viewpointStack=new I(e,this.defaultViewpoint),this.backgroundStack=new I(e,this.defaultBackground),this.fogStack=new I(e,this.defaultFog),this.navigationInfos=new P(e,this.defaultNavigationInfo),this.viewpoints=new P(e,this.defaultViewpoint),this.backgrounds=new P(e,this.defaultBackground),this.fogs=new P(e,this.defaultFog),this.defaultBackground.setHidden(!0),this.defaultFog.setHidden(!0)}Object.assign(Object.setPrototypeOf(X.prototype,s.A.prototype),O.prototype,{layer0:!1,initialize(){s.A.prototype.initialize.call(this),O.prototype.initialize.call(this),this.defaultNavigationInfo.setup(),this.defaultViewpoint.setup(),this.defaultBackground.setup(),this.defaultFog.setup(),this.navigationInfoStack.setup(),this.viewpointStack.setup(),this.backgroundStack.setup(),this.fogStack.setup(),this.navigationInfos.setup(),this.viewpoints.setup(),this.backgrounds.setup(),this.fogs.setup(),this._hidden.addInterest("set_visible_and_hidden__",this),this._visible.addInterest("set_visible_and_hidden__",this),this._viewport.addInterest("set_viewport__",this),this.set_visible_and_hidden__(),this.set_viewport__()},isHidden(){return this._hidden.getValue()},setHidden(e){e!==this._hidden.getValue()&&(this._hidden=e)},getBBox(e,t){return this.groupNodes.getBBox(e,t)},isLayer0(){return this.layer0},setLayer0(e){this.layer0=e,this.defaultBackground.setHidden(!e)},getLayer(){return this},getGroups(){return this.groupNodes},getViewport(){return this.viewportNode},getBackground(){return this.backgroundStack.top()},getFog(){return this.fogStack.top()},getNavigationInfo(){return this.navigationInfoStack.top()},getViewpoint(){return this.viewpointStack.top()},getBackgrounds(){return this.backgrounds},getFogs(){return this.fogs},getNavigationInfos(){return this.navigationInfos},getViewpoints(){return this.viewpoints},getUserViewpoints(){const e=this.getBrowser(),t=e.getBrowserOption("EnableInlineViewpoints"),i=e.currentScene;return Array.from(new Set(this.viewpoints.get().filter(e=>e.getDescriptions().length).filter(e=>t||e.getScene()===i)))},getBackgroundStack(){return this.backgroundStack},getFogStack(){return this.fogStack},getNavigationInfoStack(){return this.navigationInfoStack},getViewpointStack(){return this.viewpointStack},viewAll(e=1,t=1,i=!1){const n=this.getViewpoint(),s=this.getBBox(new U.A).multRight(n.getModelMatrix().copy().inverse());s.size.equals(m.A.ZERO)||n.lookAt(this,s.center,n.getLookAtDistance(s),e,t,i)},straightenView(){this.getViewpoint().straightenView(this)},set_visible_and_hidden__(){const e=this._visible.getValue()&&!this._hidden.getValue();e!==this._display.getValue()&&(this._display=e)},set_viewport__(){this.viewportNode=(0,k.A)(j.A.X3DViewportNode,this._viewport)??this.getBrowser().getDefaultViewport()},bindBindables(e){this.traverse(o.A.CAMERA,this);const t=this.navigationInfos.getBound(),i=this.backgrounds.getBound(),n=this.fogs.getBound(),s=this.viewpoints.getBound(e);this.navigationInfoStack.pushOnTop(t),this.backgroundStack.pushOnTop(i),this.fogStack.pushOnTop(n),this.viewpointStack.pushOnTop(s),s.resetUserOffsets(),s._viewAll.getValue()&&s.viewAll(this.getBBox(new U.A)),s.update()},traverse:(()=>{const e=new y.A;return function(t,i=this){const n=this.getBrowser(),s=this.getViewpoint(),r=n.getPose();if(r?.views.length)switch(t){case o.A.POINTER:{const t=this.getNavigationInfo(),i=s.getFarDistance(t),o=n.getPointingInputSource();p.A.ortho(-1,1,-1,1,0,i,e),this.getProjectionMatrix().push(e),this.getCameraSpaceMatrix().push(o.matrix),this.getViewMatrix().push(o.inverse),this!==n.getActiveLayer()&&(this.getCameraSpaceMatrix().multRight(r.viewMatrix),this.getViewMatrix().multLeft(r.cameraSpaceMatrix)),this.getCameraSpaceMatrix().multRight(s.getCameraSpaceMatrix()),this.getViewMatrix().multLeft(s.getViewMatrix());break}case o.A.COLLISION:this.getProjectionMatrix().push(r.views[0].projectionMatrix),this.getCameraSpaceMatrix().push(s.getCameraSpaceMatrix()),this.getViewMatrix().push(s.getViewMatrix());break;default:this.getProjectionMatrix().push(r.views[0].projectionMatrix),this===n.getActiveLayer()?(this.getCameraSpaceMatrix().push(r.cameraSpaceMatrix),this.getViewMatrix().push(r.viewMatrix),this.getCameraSpaceMatrix().multRight(s.getCameraSpaceMatrix()),this.getViewMatrix().multLeft(s.getViewMatrix())):(this.getCameraSpaceMatrix().push(s.getCameraSpaceMatrix()),this.getViewMatrix().push(s.getViewMatrix()))}else this.getProjectionMatrix().push(s.getProjectionMatrix(this)),this.getCameraSpaceMatrix().push(s.getCameraSpaceMatrix()),this.getViewMatrix().push(s.getViewMatrix());switch(t){case o.A.POINTER:this.pointer(t,i);break;case o.A.CAMERA:this.camera(t,i);break;case o.A.PICKING:this.picking(t,i);break;case o.A.COLLISION:this.collision(t,i);break;case o.A.SHADOW:case o.A.DISPLAY:this.display(t,i)}this.getViewMatrix().pop(),this.getCameraSpaceMatrix().pop(),this.getProjectionMatrix().pop()}})(),pointer(e,t){if(!this._pointerEvents.getValue())return;const i=this.getBrowser(),n=this.viewportNode.getRectangle();if(i.getPointingLayer()){if(i.getPointingLayer()!==this)return}else if(!i.isPointerInRectangle(n))return;const{viewportNode:s,groupNodes:r}=this;this.setHitRay(this.getProjectionMatrix().get(),n,i.getPointer()),this.getModelViewMatrix().push(this.getViewMatrix().get()),s.push(this),t.render(e,r.traverse,r),s.pop(this),this.getModelViewMatrix().pop()},camera(e,t){this.getModelViewMatrix().push(y.A.IDENTITY);const{viewportNode:i,groupNodes:n}=this;i.push(this),n.traverse(e,t),i.pop(this),this.getModelViewMatrix().pop(),this.navigationInfos.update(this,this.navigationInfoStack),this.viewpoints.update(this,this.viewpointStack),this.backgrounds.update(this,this.backgroundStack),this.fogs.update(this,this.fogStack),this.getViewpoint().update()},picking(e,t){if(!this._pickable.getValue())return;const{viewportNode:i,groupNodes:n}=this;this.getModelViewMatrix().push(y.A.IDENTITY),i.push(this),n.traverse(e,t),i.pop(this),this.getModelViewMatrix().pop()},collision:(()=>{const e=new y.A;return function(t,i){const n=this.getNavigationInfo();if(n._transitionActive.getValue())return;const s=n.getCollisionRadius(),r=n.getAvatarHeight(),o=Math.max(2*s,2*r),{viewportNode:a,groupNodes:l}=this;p.A.ortho(-o,o,-o,o,-o,o,e),this.getProjectionMatrix().push(e),this.getModelViewMatrix().push(this.getViewMatrix().get()),a.push(this),i.render(t,l.traverse,l),a.pop(this),this.getModelViewMatrix().pop(),this.getProjectionMatrix().pop()}})(),display(e,t){const{viewportNode:i,groupNodes:n}=this;this.getNavigationInfo().enable(e,t),this.getModelViewMatrix().push(this.getViewMatrix().get()),i.push(this),t.render(e,n.traverse,n),i.pop(this),this.getModelViewMatrix().pop()}}),Object.defineProperties(X,s.A.getStaticProperties("X3DLayerNode","Layering",1));const z=X,G=h.A.add("X3DLayerNode",z)},1799(e,t,i){i.d(t,{A:()=>x});var n=i(8015),s=i(8001),r=i(6138),o=i(8442),a=i(8188),l=i(4275),h=i(1730),c=i(6576),u=i(937),d=i(5053),p=i(477),g=i(5319),f=i(1256),m=i(9582),A=i(5687),_=i(2696);function y(e){r.A.call(this,e),this.addType(d.A.X3DViewpointNode),this.addChildObjects(d.A.inputOutput,"positionOffset",new n.A.SFVec3f,d.A.inputOutput,"orientationOffset",new n.A.SFRotation,d.A.inputOutput,"scaleOffset",new n.A.SFVec3f(1,1,1),d.A.inputOutput,"scaleOrientationOffset",new n.A.SFRotation,d.A.inputOutput,"centerOfRotationOffset",new n.A.SFVec3f,d.A.inputOutput,"fieldOfViewScale",new n.A.SFFloat(1)),this._nearDistance.setUnit("length"),this._farDistance.setUnit("length"),this.descriptions=[],this.userPosition=new p.A,this.userOrientation=new g.A,this.userCenterOfRotation=new p.A,this.modelMatrix=new m.A,this.cameraSpaceMatrix=new m.A(1,0,0,0,0,1,0,0,0,0,1,0,0,0,10,1),this.viewMatrix=new m.A(1,0,0,0,0,1,0,0,0,0,1,0,0,0,-10,1);const t=this.getBrowser().getPrivateScene();this.timeSensor=new o.A(t),this.easeInEaseOut=new a.A(t),this.positionInterpolator=new l.A(t),this.orientationInterpolator=new h.A(t),this.scaleInterpolator=new l.A(t),this.scaleOrientationInterpolator=new h.A(t),this.fieldOfViewScaleInterpolator=new c.A(t)}Object.assign(Object.setPrototypeOf(y.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.timeSensor._stopTime=1,this.timeSensor.setup(),this.easeInEaseOut._key=new n.A.MFFloat(0,1),this.easeInEaseOut._easeInEaseOut=new n.A.MFVec2f(new n.A.SFVec2f,new n.A.SFVec2f),this.easeInEaseOut.setup(),this.positionInterpolator._key=new n.A.MFFloat(0,1),this.orientationInterpolator._key=new n.A.MFFloat(0,1),this.scaleInterpolator._key=new n.A.MFFloat(0,1),this.scaleOrientationInterpolator._key=new n.A.MFFloat(0,1),this.fieldOfViewScaleInterpolator._key=new n.A.MFFloat(0,1),this.positionInterpolator.setup(),this.orientationInterpolator.setup(),this.scaleInterpolator.setup(),this.scaleOrientationInterpolator.setup(),this.fieldOfViewScaleInterpolator.setup(),this.timeSensor._fraction_changed.addFieldInterest(this.easeInEaseOut._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.positionInterpolator._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.orientationInterpolator._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.scaleInterpolator._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.scaleOrientationInterpolator._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.fieldOfViewScaleInterpolator._set_fraction),this.positionInterpolator._value_changed.addFieldInterest(this._positionOffset),this.orientationInterpolator._value_changed.addFieldInterest(this._orientationOffset),this.scaleInterpolator._value_changed.addFieldInterest(this._scaleOffset),this.scaleOrientationInterpolator._value_changed.addFieldInterest(this._scaleOrientationOffset),this.fieldOfViewScaleInterpolator._value_changed.addFieldInterest(this._fieldOfViewScale),this._nearDistance.addInterest("set_nearDistance__",this),this._farDistance.addInterest("set_farDistance__",this),this._viewAll.addInterest("set_viewAll__",this),this._navigationInfo.addInterest("set_navigationInfo__",this),this._isBound.addInterest("set_bound__",this),this.set_nearDistance__(),this.set_farDistance__(),this.set_navigationInfo__()},set_nearDistance__(){const e=this._nearDistance.getValue();this.nearDistance=e>=0?e:void 0},set_farDistance__(){const e=this._farDistance.getValue();this.farDistance=e>=0?e:void 0},set_viewAll__(){this._viewAll.getValue()&&this._isBound.getValue()&&(this._set_bind=!0)},set_navigationInfo__(){this.navigationInfoNode&&this._isBound.removeFieldInterest(this.navigationInfoNode._set_bind),this.navigationInfoNode=(0,u.A)(d.A.NavigationInfo,this._navigationInfo),this.navigationInfoNode&&this._isBound.addFieldInterest(this.navigationInfoNode._set_bind)},set_bound__(){this._isBound.getValue()?this.getBrowser().setDescription(this._description):this.timeSensor._stopTime=Date.now()/1e3},set_active__(e,t){t.getValue()||(this.timeSensor._isActive.removeInterest("set_active__",this),this._isBound.getValue()&&1===this.timeSensor._fraction_changed.getValue()&&(e._transitionComplete=!0))},setInterpolators(){},getDescriptions(){return this.descriptions},getPosition(){return this._position.getValue()},setPosition(e){this._position=e},getOrientation(){return this._orientation.getValue()},setOrientation(e){this._orientation=e},getCenterOfRotation(){return this._centerOfRotation.getValue()},setCenterOfRotation(e){this._centerOfRotation=e},getUserPosition(){return this.userPosition.assign(this.getPosition()).add(this._positionOffset.getValue())},setUserPosition(e){this._positionOffset=this.userPosition.assign(e).subtract(this.getPosition())},getUserOrientation(){return this.userOrientation.assign(this.getOrientation()).multRight(this._orientationOffset.getValue())},setUserOrientation(e){this._orientationOffset=this.userOrientation.assign(this.getOrientation()).inverse().multRight(e)},getUserCenterOfRotation(){return this.userCenterOfRotation.assign(this.getCenterOfRotation()).add(this._centerOfRotationOffset.getValue())},setUserCenterOfRotation(e){this._centerOfRotationOffset=this.userCenterOfRotation.assign(e).subtract(this.getCenterOfRotation())},getFieldOfViewScale(){return this._fieldOfViewScale.getValue()},setFieldOfViewScale(e){this._fieldOfViewScale=e},getNearDistance(e){return this.nearDistance??e?.getNearValue()},setNearDistance(e){this.nearDistance=e},getFarDistance(e){return this.farDistance??(e?e.getFarValue()||this.getMaxFarValue():void 0)},setFarDistance(e){this.farDistance=e},getProjectionMatrix(e){const t=e.getNavigationInfo();return this.getProjectionMatrixWithLimits(this.getNearDistance(t),this.getFarDistance(t),e.getLayer().getViewport().getRectangle())},getCameraSpaceMatrix(){return this.cameraSpaceMatrix},getViewMatrix(){return this.viewMatrix},getModelMatrix(){return this.modelMatrix},getMaxFarValue(){return this.getBrowser().getRenderingProperty("LogarithmicDepthBuffer")?1e10:1e5},getUpVector:()=>p.A.Y_AXIS,getSpeedFactor:()=>1,setVRMLTransition(e){this.VRMLTransition=e},getVRMLTransition(){return this.VRMLTransition},checkTransition(e){return!(!this.timeSensor._isActive.getValue()||this.timeSensor._description.getValue()!==e)||(this.timeSensor._description=e,!1)},transitionStart(e,t){if(this._jump.getValue()){if(this.checkTransition("transitionStart"))return;const i=this.getRelativeTransformation(t);this._retainUserOffsets.getValue()||this.resetUserOffsets(),this._viewAll.getValue()&&this.viewAll(e.getBBox(new A.A));const s=e.getNavigationInfo(),r=s._transitionTime.getValue();let o=s.getTransitionType();switch(2==this.getExecutionContext().getSpecificationVersion()&&(o=this.getVRMLTransition()?"LINEAR":"TELEPORT"),this.setVRMLTransition(!1),r<=0&&(o="TELEPORT"),this.constructor!==t.constructor&&(o="TELEPORT"),o){case"TELEPORT":return void(s._transitionComplete=!0);case"ANIMATE":this.easeInEaseOut._easeInEaseOut=new n.A.MFVec2f(new n.A.SFVec2f(0,1),new n.A.SFVec2f(1,0));break;default:this.easeInEaseOut._easeInEaseOut=new n.A.MFVec2f(new n.A.SFVec2f,new n.A.SFVec2f)}s._transitionStart=!0,this.timeSensor._cycleInterval=r,this.timeSensor._stopTime=Date.now()/1e3,this.timeSensor._startTime=Date.now()/1e3,this.timeSensor._isActive.addInterest("set_active__",this,s),this.positionInterpolator._keyValue=new n.A.MFVec3f(i.position,this._positionOffset),this.orientationInterpolator._keyValue=new n.A.MFRotation(i.orientation,this._orientationOffset),this.scaleInterpolator._keyValue=new n.A.MFVec3f(i.scale,this._scaleOffset),this.scaleOrientationInterpolator._keyValue=new n.A.MFRotation(i.scaleOrientation,this._scaleOrientationOffset),this._positionOffset=i.position,this._orientationOffset=i.orientation,this._scaleOffset=i.scale,this._scaleOrientationOffset=i.scaleOrientation,this.setInterpolators(t,i)}else{this.transitionStop();e.getNavigationInfo()._transitionComplete=!0;const i=this.getRelativeTransformation(t);this._positionOffset=i.position,this._orientationOffset=i.orientation,this._scaleOffset=i.scale,this._scaleOrientationOffset=i.scaleOrientation,this.setInterpolators(t,i)}},transitionStop(){this.timeSensor._stopTime=Date.now()/1e3,this.timeSensor._isActive.removeInterest("set_active__",this)},resetUserOffsets(){this._positionOffset=p.A.ZERO,this._orientationOffset=g.A.IDENTITY,this._scaleOffset=p.A.ONE,this._scaleOrientationOffset=g.A.IDENTITY,this._centerOfRotationOffset=p.A.ZERO,this._fieldOfViewScale=1,this.set_nearDistance__(),this.set_farDistance__()},getRelativeTransformation:(()=>{const e=new p.A,t=new g.A,i=new p.A,n=new g.A;return function(s){return this.modelMatrix.copy().multRight(s.getViewMatrix()).inverse().get(e,t,i,n),e.subtract(this.getPosition()),t.multLeft(this.getOrientation().copy().inverse()),{position:e,orientation:t,scale:i,scaleOrientation:n}}})(),getLookAtRotation:(()=>{const e=new p.A,t=new p.A,i=new p.A,n=new f.A,s=new g.A;return function(r,o){const a=this.getUpVector(!0);return i.assign(r).subtract(o).normalize(),e.assign(a).cross(i).normalize(),t.assign(i).cross(e).normalize(),n.set(...e,...t,...i),s.setMatrix(n),s}})(),lookAtPoint(e,t,i=1,n=1,s=!1){this.getCameraSpaceMatrix().multVecMatrix(t),this.getModelMatrix().copy().inverse().multVecMatrix(t);const r=2*this.getNearDistance(e.getNavigationInfo());this.lookAt(e,t,r,i,n,s)},lookAtBBox(e,t,i=1,n=1,s=!1){t.size.equals(p.A.ZERO)||(t=t.copy().multRight(this.getModelMatrix().copy().inverse()),this.lookAt(e,t.center,this.getLookAtDistance(t),i,n,s))},lookAt(e,t,i,s=1,r=1,o=!1){this.timeSensor._description="lookAt";const a=t.copy().add(this.getUserOrientation().multVecRot(new p.A(0,0,i))).subtract(this.getPosition());e.getNavigationInfo()._transitionStart=!0,this.timeSensor._cycleInterval=s,this.timeSensor._stopTime=Date.now()/1e3,this.timeSensor._startTime=Date.now()/1e3,this.timeSensor._isActive.addInterest("set_active__",this,e.getNavigationInfo()),this.easeInEaseOut._easeInEaseOut=new n.A.MFVec2f(new n.A.SFVec2f(0,1),new n.A.SFVec2f(1,0));const l=this._positionOffset.getValue().copy().lerp(a,r),h=this.getPosition().copy().add(l).subtract(t);let c=this._orientationOffset.getValue().copy().multRight(new g.A(this.getUserOrientation().multVecRot(new p.A(0,0,1)),h));o&&(c=this.getOrientation().copy().inverse().multRight(this.straightenHorizon(this.getOrientation().copy().multRight(c)))),this.positionInterpolator._keyValue=new n.A.MFVec3f(this._positionOffset,l),this.orientationInterpolator._keyValue=new n.A.MFRotation(this._orientationOffset,c),this.scaleInterpolator._keyValue=new n.A.MFVec3f(this._scaleOffset,p.A.ONE),this.scaleOrientationInterpolator._keyValue=new n.A.MFRotation(this._scaleOrientationOffset,this._scaleOrientationOffset);const u=this.getRelativeTransformation(this);this._fieldOfViewScale=1,this._centerOfRotationOffset=t.copy().subtract(this.getCenterOfRotation()),this.nearDistance=.0125*i,this.farDistance=this.nearDistance*this.getMaxFarValue()/.125,this.setInterpolators(this,u)},straightenView(e){if(this.checkTransition("straightenView"))return;e.getNavigationInfo()._transitionStart=!0,this.timeSensor._cycleInterval=1,this.timeSensor._stopTime=Date.now()/1e3,this.timeSensor._startTime=Date.now()/1e3,this.timeSensor._isActive.addInterest("set_active__",this,e.getNavigationInfo()),this.easeInEaseOut._easeInEaseOut=new n.A.MFVec2f(new n.A.SFVec2f(0,1),new n.A.SFVec2f(1,0));const t=this.getOrientation().copy().inverse().multRight(this.straightenHorizon(this.getUserOrientation()));this.positionInterpolator._keyValue=new n.A.MFVec3f(this._positionOffset,this._positionOffset),this.orientationInterpolator._keyValue=new n.A.MFRotation(this._orientationOffset,t),this.scaleInterpolator._keyValue=new n.A.MFVec3f(this._scaleOffset,this._scaleOffset),this.scaleOrientationInterpolator._keyValue=new n.A.MFRotation(this._scaleOrientationOffset,this._scaleOrientationOffset);const i=this.getRelativeTransformation(this);this._fieldOfViewScale=1,this.setInterpolators(this,i)},straightenHorizon(e,t=this.getUpVector(!0)){return e.straighten(t)},viewAll(e){if(e.copy().multRight(this.modelMatrix.copy().inverse()),e.size.equals(p.A.ZERO))this.set_nearDistance__(),this.set_farDistance__();else{const t=this.getUserPosition().copy().subtract(e.center).normalize(),i=this.getLookAtDistance(e),n=e.center.copy().add(t.multiply(i)),s=this.getLookAtRotation(n,e.center);this._positionOffset=n.subtract(this.getPosition()),this._orientationOffset=this.getOrientation().copy().inverse().multRight(s),this._centerOfRotationOffset=e.center.copy().subtract(this.getCenterOfRotation()),this._fieldOfViewScale=1,this.nearDistance=.0125*i,this.farDistance=this.nearDistance*this.getMaxFarValue()/.125}},traverse(e,t){this.navigationInfoNode?.traverse(e,t),this.descriptions.length=0;const i=this._description.getValue();if(i&&t.getViewpointGroups().every(e=>e.getDisplayed())){for(const e of t.getViewpointGroups()){const t=e._description.getValue();t&&this.descriptions.push(t)}this.descriptions.push(i)}t.getLayer().getViewpoints().push(this),this.modelMatrix.assign(t.getModelViewMatrix().get())},update(){this.cameraSpaceMatrix.set(this.getUserPosition(),this.getUserOrientation(),this._scaleOffset.getValue(),this._scaleOrientationOffset.getValue()),this.cameraSpaceMatrix.multRight(this.modelMatrix),this.viewMatrix.assign(this.cameraSpaceMatrix).inverse()}}),Object.defineProperties(y,s.A.getStaticProperties("X3DViewpointNode","Navigation",1));const w=y,x=_.A.add("X3DViewpointNode",w)},1815(e,t,i){i.d(t,{A:()=>f});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(2743),l=i(8764),h=i(5053),c=i(2514),u=i(2696),d=i(9340);function p(e){a.A.call(this,e),l.A.call(this,e),this.addType(h.A.ImageTexture),this.image=d("<img></img>"),this.urlStack=new n.A.MFString,this.getMatrix().set([1,0,0,0,0,-1,0,0,0,0,1,0,0,1,0,1])}Object.assign(Object.setPrototypeOf(p.prototype,a.A.prototype),l.A.prototype,{initialize(){a.A.prototype.initialize.call(this),l.A.prototype.initialize.call(this),this._colorSpaceConversion.addInterest("loadNow",this),this.image.on("load",this.setImage.bind(this)).on("abort error",this.setError.bind(this)).attr("crossorigin","anonymous"),this.requestImmediateLoad().catch(Function.prototype)},getTextureType:()=>1,unloadData(){this.clearTexture()},loadData(){this.urlStack.setValue(this._url),this.loadNext()},loadNext(){if(0===this.urlStack.length)return this.clearTexture(),void this.setLoadState(h.A.FAILED_STATE);this.URL=new URL(this.urlStack.shift(),this.getExecutionContext().getBaseURL()),this.URL.pathname.match(/\.ktx2?(?:\.gz)?$/)||this.URL.href.match(/^data:image\/ktx2[;,]/)?(this.setLinear(!0),this.setMipMaps(!1),this.getBrowser().getKTXDecoder().then(e=>e.loadKTXFromURL(this.URL,this.getCache())).then(e=>this.setKTXTexture(e)).catch(e=>this.setError({type:e.message}))):(this.setLinear(!1),this.setMipMaps(!0),"data:"!==this.URL.protocol&&(this.getCache()||this.URL.searchParams.set("_",Date.now())),this.image.attr("src",this.URL))},setError(e){"data:"!==this.URL.protocol&&console.warn(`Error loading image '${decodeURI(this.URL)}:'`,e.type),this.loadNext()},setKTXTexture(e){if(e.target!==this.getTarget())return this.setError({type:"Invalid KTX texture target, must be 'TEXTURE_2D'."});c.A&&"data:"!==this.URL.protocol&&console.info(`Done loading image texture '${decodeURI(this.URL)}'.`);try{this.setTexture(e),this.setTransparent(!1),this.setWidth(e.baseWidth),this.setHeight(e.baseHeight),this.updateTextureParameters(),this.setLoadState(h.A.COMPLETE_STATE)}catch(e){this.setError({type:e.message})}},setImage(){c.A&&"data:"!==this.URL.protocol&&console.info(`Done loading image texture '${decodeURI(this.URL)}'.`);try{const e=this.image[0],{width:t,height:i}=e;this.setTextureData(t,i,this._colorSpaceConversion.getValue(),this.isTransparent(),e),this.setTransparent(this.isImageTransparent(this.getTextureData(this.getTexture(),t,i))),this.setLoadState(h.A.COMPLETE_STATE),this.addNodeEvent()}catch(e){this.setError({type:e.message})}},dispose(){l.A.prototype.dispose.call(this),a.A.prototype.dispose.call(this)}}),Object.defineProperties(p,{...o.A.getStaticProperties("ImageTexture","Texturing",1,"texture","2.0"),fieldDefinitions:{value:new r.A([new s.A(h.A.inputOutput,"metadata",new n.A.SFNode),new s.A(h.A.inputOutput,"description",new n.A.SFString),new s.A(h.A.inputOutput,"load",new n.A.SFBool(!0)),new s.A(h.A.inputOutput,"url",new n.A.MFString),new s.A(h.A.inputOutput,"autoRefresh",new n.A.SFTime(0)),new s.A(h.A.inputOutput,"autoRefreshTimeLimit",new n.A.SFTime(3600)),new s.A(h.A.initializeOnly,"colorSpaceConversion",new n.A.SFBool(!0)),new s.A(h.A.initializeOnly,"repeatS",new n.A.SFBool(!0)),new s.A(h.A.initializeOnly,"repeatT",new n.A.SFBool(!0)),new s.A(h.A.initializeOnly,"textureProperties",new n.A.SFNode)]),enumerable:!0}});const g=p,f=u.A.add("ImageTexture",g)},1840(e,t,i){i.d(t,{A:()=>r});var n=i(2696);const s=class{#F=0;#M=0;cycles=0;elapsedTime=0;start(){this.#F=Date.now()}stop(){this.#F<=this.#M||(this.#M=Date.now(),this.cycles+=1,this.elapsedTime+=this.#M-this.#F)}reset(){this.#F=0,this.#M=0,this.cycles=0,this.elapsedTime=0}get averageTime(){return this.cycles?this.elapsedTime/this.cycles:0}},r=n.A.add("StopWatch",s)},1891(e,t){!function(e){var t=(e,t,i,n)=>{let s=65535&e,r=e>>>16&65535,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+t[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16};const i=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})()),n=(e,t,n,s)=>{const r=i,o=s+n;e^=-1;for(let i=s;i<o;i++)e=e>>>8^r[255&(e^t[i])];return-1^e};var s=n;const r=16209,o=16191;var a=function(e,t){let i,n,s,a,l,h,c,u,d,p,g,f,m,A,_,y,w,x,b,S,T,v,O,E;const N=e.state;i=e.next_in,O=e.input,n=i+(e.avail_in-5),s=e.next_out,E=e.output,a=s-(t-e.avail_out),l=s+(e.avail_out-257),h=N.dmax,c=N.wsize,u=N.whave,d=N.wnext,p=N.window,g=N.hold,f=N.bits,m=N.lencode,A=N.distcode,_=(1<<N.lenbits)-1,y=(1<<N.distbits)-1;e:do{f<15&&(g+=O[i++]<<f,f+=8,g+=O[i++]<<f,f+=8),w=m[g&_];t:for(;;){if(x=w>>>24,g>>>=x,f-=x,x=w>>>16&255,0===x)E[s++]=65535&w;else{if(!(16&x)){if(64&x){if(32&x){N.mode=o;break e}e.msg="invalid literal/length code",N.mode=r;break e}w=m[(65535&w)+(g&(1<<x)-1)];continue t}for(b=65535&w,x&=15,x&&(f<x&&(g+=O[i++]<<f,f+=8),b+=g&(1<<x)-1,g>>>=x,f-=x),f<15&&(g+=O[i++]<<f,f+=8,g+=O[i++]<<f,f+=8),w=A[g&y];;){if(x=w>>>24,g>>>=x,f-=x,x=w>>>16&255,16&x){if(S=65535&w,x&=15,f<x&&(g+=O[i++]<<f,f+=8,f<x&&(g+=O[i++]<<f,f+=8)),S+=g&(1<<x)-1,S>h){e.msg="invalid distance too far back",N.mode=r;break e}if(g>>>=x,f-=x,x=s-a,S>x){if(x=S-x,x>u&&N.sane){e.msg="invalid distance too far back",N.mode=r;break e}if(T=0,v=p,0===d){if(T+=c-x,x<b){b-=x;do{E[s++]=p[T++]}while(--x);T=s-S,v=E}}else if(d<x){if(T+=c+d-x,x-=d,x<b){b-=x;do{E[s++]=p[T++]}while(--x);if(T=0,d<b){x=d,b-=x;do{E[s++]=p[T++]}while(--x);T=s-S,v=E}}}else if(T+=d-x,x<b){b-=x;do{E[s++]=p[T++]}while(--x);T=s-S,v=E}for(;b>2;)E[s++]=v[T++],E[s++]=v[T++],E[s++]=v[T++],b-=3;b&&(E[s++]=v[T++],b>1&&(E[s++]=v[T++]))}else{T=s-S;do{E[s++]=E[T++],E[s++]=E[T++],E[s++]=E[T++],b-=3}while(b>2);b&&(E[s++]=E[T++],b>1&&(E[s++]=E[T++]))}break}if(64&x){e.msg="invalid distance code",N.mode=r;break e}w=A[(65535&w)+(g&(1<<x)-1)]}}break}}while(i<n&&s<l);b=f>>3,i-=b,f-=b<<3,g&=(1<<f)-1,e.next_in=i,e.next_out=s,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=s<l?l-s+257:257-(s-l),N.hold=g,N.bits=f};const l=15,h=852,c=592,u=0,d=1,p=2,g=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),f=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),m=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),A=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var _=(e,t,i,n,s,r,o,a)=>{const _=a.bits;let y,w,x,b,S,T,v=0,O=0,E=0,N=0,C=0,I=0,F=0,M=0,R=0,P=0,V=null;const D=new Uint16Array(l+1),L=new Uint16Array(l+1);let B,k,j,U=null;for(v=0;v<=l;v++)D[v]=0;for(O=0;O<n;O++)D[t[i+O]]++;for(C=_,N=l;N>=1&&0===D[N];N--);if(C>N&&(C=N),0===N)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(E=1;E<N&&0===D[E];E++);for(C<E&&(C=E),M=1,v=1;v<=l;v++)if(M<<=1,M-=D[v],M<0)return-1;if(M>0&&(e===u||1!==N))return-1;for(L[1]=0,v=1;v<l;v++)L[v+1]=L[v]+D[v];for(O=0;O<n;O++)0!==t[i+O]&&(o[L[t[i+O]]++]=O);if(e===u?(V=U=o,T=20):e===d?(V=g,U=f,T=257):(V=m,U=A,T=0),P=0,O=0,v=E,S=r,I=C,F=0,x=-1,R=1<<C,b=R-1,e===d&&R>h||e===p&&R>c)return 1;for(;;){B=v-F,o[O]+1<T?(k=0,j=o[O]):o[O]>=T?(k=U[o[O]-T],j=V[o[O]-T]):(k=96,j=0),y=1<<v-F,w=1<<I,E=w;do{w-=y,s[S+(P>>F)+w]=B<<24|k<<16|j}while(0!==w);for(y=1<<v-1;P&y;)y>>=1;if(0!==y?(P&=y-1,P+=y):P=0,O++,0===--D[v]){if(v===N)break;v=t[i+o[O]]}if(v>C&&(P&b)!==x){for(0===F&&(F=C),S+=E,I=v-F,M=1<<I;I+F<N&&(M-=D[I+F],!(M<=0));)I++,M<<=1;if(R+=1<<I,e===d&&R>h||e===p&&R>c)return 1;x=P&b,s[x]=C<<24|I<<16|S-r}}return 0!==P&&(s[S+P]=v-F<<24|64<<16),a.bits=C,0},y={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const w=0,x=1,b=2,{Z_FINISH:S,Z_BLOCK:T,Z_TREES:v,Z_OK:O,Z_STREAM_END:E,Z_NEED_DICT:N,Z_STREAM_ERROR:C,Z_DATA_ERROR:I,Z_MEM_ERROR:F,Z_BUF_ERROR:M,Z_DEFLATED:R}=y,P=16180,V=16181,D=16182,L=16183,B=16184,k=16185,j=16186,U=16187,X=16188,z=16189,G=16190,H=16191,$=16192,Y=16193,q=16194,W=16195,K=16196,Z=16197,Q=16198,J=16199,ee=16200,te=16201,ie=16202,ne=16203,se=16204,re=16205,oe=16206,ae=16207,le=16208,he=16209,ce=16210,ue=16211,de=852,pe=592,ge=15,fe=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function me(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ae=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<P||t.mode>ue?1:0},_e=e=>{if(Ae(e))return C;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(de),t.distcode=t.distdyn=new Int32Array(pe),t.sane=1,t.back=-1,O},ye=e=>{if(Ae(e))return C;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,_e(e)},we=(e,t)=>{let i;if(Ae(e))return C;const n=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?C:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,ye(e))},xe=(e,t)=>{if(!e)return C;const i=new me;e.state=i,i.strm=e,i.window=null,i.mode=P;const n=we(e,t);return n!==O&&(e.state=null),n};let be,Se,Te=!0;const ve=e=>{if(Te){be=new Int32Array(512),Se=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(_(x,e.lens,0,288,be,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_(b,e.lens,0,32,Se,0,e.work,{bits:5}),Te=!1}e.lencode=be,e.lenbits=9,e.distcode=Se,e.distbits=5},Oe=(e,t,i,n)=>{let s;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),n>=r.wsize?(r.window.set(t.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(t.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(t.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=s))),0},Ee=(e,i)=>{const n=i.length;let s,r,o;return Ae(e)?C:(s=e.state,0!==s.wrap&&s.mode!==G?C:s.mode===G&&(r=1,r=t(r,i,n,0),r!==s.check)?I:(o=Oe(e,i,n,n),o?(s.mode=ce,F):(s.havedict=1,O)))};var Ne={inflateReset:ye,inflateReset2:we,inflateResetKeep:_e,inflateInit:e=>xe(e,ge),inflateInit2:xe,inflate:(e,i)=>{let n,r,o,l,h,c,u,d,p,g,f,m,A,y,ue,de,pe,ge,me,_e,ye,we,xe=0;const be=new Uint8Array(4);let Se,Te;const Ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ae(e)||!e.output||!e.input&&0!==e.avail_in)return C;n=e.state,n.mode===H&&(n.mode=$),h=e.next_out,o=e.output,u=e.avail_out,l=e.next_in,r=e.input,c=e.avail_in,d=n.hold,p=n.bits,g=c,f=u,we=O;e:for(;;)switch(n.mode){case P:if(0===n.wrap){n.mode=$;break}for(;p<16;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(2&n.wrap&&35615===d){0===n.wbits&&(n.wbits=15),n.check=0,be[0]=255&d,be[1]=d>>>8&255,n.check=s(n.check,be,2,0),d=0,p=0,n.mode=V;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=he;break}if((15&d)!==R){e.msg="unknown compression method",n.mode=he;break}if(d>>>=4,p-=4,ye=8+(15&d),0===n.wbits&&(n.wbits=ye),ye>15||ye>n.wbits){e.msg="invalid window size",n.mode=he;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&d?z:H,d=0,p=0;break;case V:for(;p<16;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(n.flags=d,(255&n.flags)!==R){e.msg="unknown compression method",n.mode=he;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=he;break}n.head&&(n.head.text=d>>8&1),512&n.flags&&4&n.wrap&&(be[0]=255&d,be[1]=d>>>8&255,n.check=s(n.check,be,2,0)),d=0,p=0,n.mode=D;case D:for(;p<32;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}n.head&&(n.head.time=d),512&n.flags&&4&n.wrap&&(be[0]=255&d,be[1]=d>>>8&255,be[2]=d>>>16&255,be[3]=d>>>24&255,n.check=s(n.check,be,4,0)),d=0,p=0,n.mode=L;case L:for(;p<16;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}n.head&&(n.head.xflags=255&d,n.head.os=d>>8),512&n.flags&&4&n.wrap&&(be[0]=255&d,be[1]=d>>>8&255,n.check=s(n.check,be,2,0)),d=0,p=0,n.mode=B;case B:if(1024&n.flags){for(;p<16;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}n.length=d,n.head&&(n.head.extra_len=d),512&n.flags&&4&n.wrap&&(be[0]=255&d,be[1]=d>>>8&255,n.check=s(n.check,be,2,0)),d=0,p=0}else n.head&&(n.head.extra=null);n.mode=k;case k:if(1024&n.flags&&(m=n.length,m>c&&(m=c),m&&(n.head&&(ye=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+m),ye)),512&n.flags&&4&n.wrap&&(n.check=s(n.check,r,m,l)),c-=m,l+=m,n.length-=m),n.length))break e;n.length=0,n.mode=j;case j:if(2048&n.flags){if(0===c)break e;m=0;do{ye=r[l+m++],n.head&&ye&&n.length<65536&&(n.head.name+=String.fromCharCode(ye))}while(ye&&m<c);if(512&n.flags&&4&n.wrap&&(n.check=s(n.check,r,m,l)),c-=m,l+=m,ye)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=U;case U:if(4096&n.flags){if(0===c)break e;m=0;do{ye=r[l+m++],n.head&&ye&&n.length<65536&&(n.head.comment+=String.fromCharCode(ye))}while(ye&&m<c);if(512&n.flags&&4&n.wrap&&(n.check=s(n.check,r,m,l)),c-=m,l+=m,ye)break e}else n.head&&(n.head.comment=null);n.mode=X;case X:if(512&n.flags){for(;p<16;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(4&n.wrap&&d!==(65535&n.check)){e.msg="header crc mismatch",n.mode=he;break}d=0,p=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=H;break;case z:for(;p<32;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}e.adler=n.check=fe(d),d=0,p=0,n.mode=G;case G:if(0===n.havedict)return e.next_out=h,e.avail_out=u,e.next_in=l,e.avail_in=c,n.hold=d,n.bits=p,N;e.adler=n.check=1,n.mode=H;case H:if(i===T||i===v)break e;case $:if(n.last){d>>>=7&p,p-=7&p,n.mode=oe;break}for(;p<3;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}switch(n.last=1&d,d>>>=1,p-=1,3&d){case 0:n.mode=Y;break;case 1:if(ve(n),n.mode=J,i===v){d>>>=2,p-=2;break e}break;case 2:n.mode=K;break;case 3:e.msg="invalid block type",n.mode=he}d>>>=2,p-=2;break;case Y:for(d>>>=7&p,p-=7&p;p<32;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",n.mode=he;break}if(n.length=65535&d,d=0,p=0,n.mode=q,i===v)break e;case q:n.mode=W;case W:if(m=n.length,m){if(m>c&&(m=c),m>u&&(m=u),0===m)break e;o.set(r.subarray(l,l+m),h),c-=m,l+=m,u-=m,h+=m,n.length-=m;break}n.mode=H;break;case K:for(;p<14;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(n.nlen=257+(31&d),d>>>=5,p-=5,n.ndist=1+(31&d),d>>>=5,p-=5,n.ncode=4+(15&d),d>>>=4,p-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=he;break}n.have=0,n.mode=Z;case Z:for(;n.have<n.ncode;){for(;p<3;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}n.lens[Ee[n.have++]]=7&d,d>>>=3,p-=3}for(;n.have<19;)n.lens[Ee[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Se={bits:n.lenbits},we=_(w,n.lens,0,19,n.lencode,0,n.work,Se),n.lenbits=Se.bits,we){e.msg="invalid code lengths set",n.mode=he;break}n.have=0,n.mode=Q;case Q:for(;n.have<n.nlen+n.ndist;){for(;xe=n.lencode[d&(1<<n.lenbits)-1],ue=xe>>>24,de=xe>>>16&255,pe=65535&xe,!(ue<=p);){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(pe<16)d>>>=ue,p-=ue,n.lens[n.have++]=pe;else{if(16===pe){for(Te=ue+2;p<Te;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(d>>>=ue,p-=ue,0===n.have){e.msg="invalid bit length repeat",n.mode=he;break}ye=n.lens[n.have-1],m=3+(3&d),d>>>=2,p-=2}else if(17===pe){for(Te=ue+3;p<Te;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}d>>>=ue,p-=ue,ye=0,m=3+(7&d),d>>>=3,p-=3}else{for(Te=ue+7;p<Te;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}d>>>=ue,p-=ue,ye=0,m=11+(127&d),d>>>=7,p-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=he;break}for(;m--;)n.lens[n.have++]=ye}}if(n.mode===he)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=he;break}if(n.lenbits=9,Se={bits:n.lenbits},we=_(x,n.lens,0,n.nlen,n.lencode,0,n.work,Se),n.lenbits=Se.bits,we){e.msg="invalid literal/lengths set",n.mode=he;break}if(n.distbits=6,n.distcode=n.distdyn,Se={bits:n.distbits},we=_(b,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Se),n.distbits=Se.bits,we){e.msg="invalid distances set",n.mode=he;break}if(n.mode=J,i===v)break e;case J:n.mode=ee;case ee:if(c>=6&&u>=258){e.next_out=h,e.avail_out=u,e.next_in=l,e.avail_in=c,n.hold=d,n.bits=p,a(e,f),h=e.next_out,o=e.output,u=e.avail_out,l=e.next_in,r=e.input,c=e.avail_in,d=n.hold,p=n.bits,n.mode===H&&(n.back=-1);break}for(n.back=0;xe=n.lencode[d&(1<<n.lenbits)-1],ue=xe>>>24,de=xe>>>16&255,pe=65535&xe,!(ue<=p);){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(de&&!(240&de)){for(ge=ue,me=de,_e=pe;xe=n.lencode[_e+((d&(1<<ge+me)-1)>>ge)],ue=xe>>>24,de=xe>>>16&255,pe=65535&xe,!(ge+ue<=p);){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}d>>>=ge,p-=ge,n.back+=ge}if(d>>>=ue,p-=ue,n.back+=ue,n.length=pe,0===de){n.mode=re;break}if(32&de){n.back=-1,n.mode=H;break}if(64&de){e.msg="invalid literal/length code",n.mode=he;break}n.extra=15&de,n.mode=te;case te:if(n.extra){for(Te=n.extra;p<Te;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,p-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ie;case ie:for(;xe=n.distcode[d&(1<<n.distbits)-1],ue=xe>>>24,de=xe>>>16&255,pe=65535&xe,!(ue<=p);){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(!(240&de)){for(ge=ue,me=de,_e=pe;xe=n.distcode[_e+((d&(1<<ge+me)-1)>>ge)],ue=xe>>>24,de=xe>>>16&255,pe=65535&xe,!(ge+ue<=p);){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}d>>>=ge,p-=ge,n.back+=ge}if(d>>>=ue,p-=ue,n.back+=ue,64&de){e.msg="invalid distance code",n.mode=he;break}n.offset=pe,n.extra=15&de,n.mode=ne;case ne:if(n.extra){for(Te=n.extra;p<Te;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,p-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=he;break}n.mode=se;case se:if(0===u)break e;if(m=f-u,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=he;break}m>n.wnext?(m-=n.wnext,A=n.wsize-m):A=n.wnext-m,m>n.length&&(m=n.length),y=n.window}else y=o,A=h-n.offset,m=n.length;m>u&&(m=u),u-=m,n.length-=m;do{o[h++]=y[A++]}while(--m);0===n.length&&(n.mode=ee);break;case re:if(0===u)break e;o[h++]=n.length,u--,n.mode=ee;break;case oe:if(n.wrap){for(;p<32;){if(0===c)break e;c--,d|=r[l++]<<p,p+=8}if(f-=u,e.total_out+=f,n.total+=f,4&n.wrap&&f&&(e.adler=n.check=n.flags?s(n.check,o,f,h-f):t(n.check,o,f,h-f)),f=u,4&n.wrap&&(n.flags?d:fe(d))!==n.check){e.msg="incorrect data check",n.mode=he;break}d=0,p=0}n.mode=ae;case ae:if(n.wrap&&n.flags){for(;p<32;){if(0===c)break e;c--,d+=r[l++]<<p,p+=8}if(4&n.wrap&&d!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=he;break}d=0,p=0}n.mode=le;case le:we=E;break e;case he:we=I;break e;case ce:return F;default:return C}return e.next_out=h,e.avail_out=u,e.next_in=l,e.avail_in=c,n.hold=d,n.bits=p,(n.wsize||f!==e.avail_out&&n.mode<he&&(n.mode<oe||i!==S))&&Oe(e,e.output,e.next_out,f-e.avail_out),g-=e.avail_in,f-=e.avail_out,e.total_in+=g,e.total_out+=f,n.total+=f,4&n.wrap&&f&&(e.adler=n.check=n.flags?s(n.check,o,f,e.next_out-f):t(n.check,o,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===H?128:0)+(n.mode===J||n.mode===q?256:0),(0===g&&0===f||i===S)&&we===O&&(we=M),we},inflateEnd:e=>{if(Ae(e))return C;let t=e.state;return t.window&&(t.window=null),e.state=null,O},inflateGetHeader:(e,t)=>{if(Ae(e))return C;const i=e.state;return 2&i.wrap?(i.head=t,t.done=!1,O):C},inflateSetDictionary:Ee,inflateInfo:"pako inflate (from Nodeca project)"};const Ce=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ie=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Ce(i,t)&&(e[t]=i[t])}}return e},Fe=e=>{let t=0;for(let i=0,n=e.length;i<n;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,n=0,s=e.length;t<s;t++){let s=e[t];i.set(s,n),n+=s.length}return i},Me={assign:Ie,flattenChunks:Fe};let Re=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Re=!1}const Pe=new Uint8Array(256);for(let e=0;e<256;e++)Pe[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Pe[254]=Pe[254]=1;var Ve=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,n,s,r,o=e.length,a=0;for(s=0;s<o;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<o&&(n=e.charCodeAt(s+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),s++)),a+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(a),r=0,s=0;r<a;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<o&&(n=e.charCodeAt(s+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),s++)),i<128?t[r++]=i:i<2048?(t[r++]=192|i>>>6,t[r++]=128|63&i):i<65536?(t[r++]=224|i>>>12,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i);return t};const De=(e,t)=>{if(t<65534&&e.subarray&&Re)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i};var Le=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,s;const r=new Array(2*i);for(s=0,n=0;n<i;){let t=e[n++];if(t<128){r[s++]=t;continue}let o=Pe[t];if(o>4)r[s++]=65533,n+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&n<i;)t=t<<6|63&e[n++],o--;o>1?r[s++]=65533:t<65536?r[s++]=t:(t-=65536,r[s++]=55296|t>>10&1023,r[s++]=56320|1023&t)}}return De(r,s)},Be={string2buf:Ve,buf2string:Le,utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Pe[e[i]]>t?i:t}},ke={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function je(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Ue=je;function Xe(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var ze=Xe;const Ge=Object.prototype.toString,{Z_NO_FLUSH:He,Z_FINISH:$e,Z_OK:Ye,Z_STREAM_END:qe,Z_NEED_DICT:We,Z_STREAM_ERROR:Ke,Z_DATA_ERROR:Ze,Z_MEM_ERROR:Qe}=y;function Je(e){this.options=Me.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ue,this.strm.avail_out=0;let i=Ne.inflateInit2(this.strm,t.windowBits);if(i!==Ye)throw new Error(ke[i]);if(this.header=new ze,Ne.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Be.string2buf(t.dictionary):"[object ArrayBuffer]"===Ge.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Ne.inflateSetDictionary(this.strm,t.dictionary),i!==Ye)))throw new Error(ke[i])}function et(e,t){const i=new Je(t);if(i.push(e),i.err)throw i.msg||ke[i.err];return i.result}function tt(e,t){return(t=t||{}).raw=!0,et(e,t)}Je.prototype.push=function(e,t){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:He,"[object ArrayBuffer]"===Ge.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=Ne.inflate(i,o),r===We&&s&&(r=Ne.inflateSetDictionary(i,s),r===Ye?r=Ne.inflate(i,o):r===Ze&&(r=We));i.avail_in>0&&r===qe&&i.state.wrap>0&&0!==e[i.next_in];)Ne.inflateReset(i),r=Ne.inflate(i,o);switch(r){case Ke:case Ze:case We:case Qe:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===qe))if("string"===this.options.to){let e=Be.utf8border(i.output,i.next_out),t=i.next_out-e,s=Be.buf2string(i.output,e);i.next_out=t,i.avail_out=n-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==Ye||0!==a){if(r===qe)return r=Ne.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Je.prototype.onData=function(e){this.chunks.push(e)},Je.prototype.onEnd=function(e){e===Ye&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Me.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var it=Je,nt=et,st=tt,rt=et,ot=y,at={Inflate:it,inflate:nt,inflateRaw:st,ungzip:rt,constants:ot};e.Inflate=it,e.constants=ot,e.default=at,e.inflate=nt,e.inflateRaw=st,e.ungzip=rt,Object.defineProperty(e,"__esModule",{value:!0})}(t)},1937(e,t,i){i.d(t,{A:()=>g});var n=i(8381),s=i(5053),r=i(8001),o=i(2696),a=i(9340);const l=Symbol(),h=Symbol(),c=Symbol(),u={get(e,t){if(t in e)return e[t];const i=e.getSharedNode(),n=i?.[t];return"function"==typeof n?n.bind(i):n},set(e,t,i){if(t in e)e[t]=i;else{const n=e.getSharedNode();n&&(n[t]=i)}return!0},has:(e,t)=>t in(e.getSharedNode()??{}),ownKeys:e=>Object.keys(e.getSharedNode()??{}),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e.getSharedNode()??{},t)};function d(e,t,i){r.A.call(this,e);const n=new Proxy(this,u);return this[l]=t,this[c]=i,this.setup(),n}Object.assign(Object.setPrototypeOf(d.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.getExecutionContext().importedNodes.addInterest("update",this),this.update()},getExtendedEventHandling:()=>!1,setTypeHint(e){this[c]??=e},getSharedNode(){return a.try(()=>this[h].getSharedNode())??null},getImportedNode(){return this[h]},getInnerNode(){return this[h].getSharedNode().getInnerNode()},getName(){return this[l]},setName(e){this[l]=e,this._name_changed=Date.now()/1e3},...Object.fromEntries([["getComponentInfo","componentInfo"],["getContainerField","containerField"],["getSpecificationRange","specificationRange"],["getTypeName","typeName"]].map(([e,t])=>[e,function(){return this.getSharedNode()?.[e]()??this.constructor[t]}])),...Object.fromEntries(["getType","getFieldDefinitions","getPredefinedField","getPredefinedFields","getUserDefinedField","getUserDefinedFields","getField","getFields","getChangedFields","isDefaultValue","hasRoutes"].map(e=>[e,function(...t){return this.getSharedNode()?.[e](...t)??r.A.prototype[e].call(this,...t)}])),update(){const e=this.getExecutionContext().getImportedNodes().get(this[l])??null;this[h]?.getInlineNode()._loadState.removeInterest("set_loadState__",this),this[h]=e,this[h]?.getInlineNode()._loadState.addInterest("set_loadState__",this),this.set_loadState__()},set_loadState__(){this[h]?.getInlineNode().checkLoadState()===s.A.COMPLETE_STATE&&(this[c]=this.getSharedNode()?.constructor??this[c]),this._typeName_changed=Date.now()/1e3,n.A.prototype.addEvent.call(this)},toVRMLStream(e){e.CheckSpace(),e.string+="USE",e.Space(),e.string+=this[l],e.NeedsSpace()},toXMLStream(e){e.openTag(this.getTypeName()),e.html&&"Script"===this.getTypeName()&&e.attribute("type","model/x3d+xml"),e.attribute("USE",this[l]),e.containerField(this.getContainerField()),e.closeTag(this.getTypeName())},toJSONStream(e){e.beginObject(this.getTypeName(),!1,!0),e.stringProperty("@USE",this[l],!1),e.endObject(),e.endObject()}}),Object.defineProperties(d.prototype,{constructor:{get(){return this[c]??r.A}}}),Object.defineProperties(d,r.A.getStaticProperties("X3DImportedNodeProxy","Core",2,"children","4.1"));const p=d,g=o.A.add("X3DImportedNodeProxy",p)},1997(e,t,i){i.d(t,{A:()=>d});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(6138),l=i(5053),h=i(2696);function c(e){a.A.call(this,e),this.addType(l.A.NavigationInfo),this.addChildObjects(l.A.outputOnly,"transitionStart",new n.A.SFBool,l.A.outputOnly,"transitionActive",new n.A.SFBool,l.A.outputOnly,"availableViewers",new n.A.MFString,l.A.outputOnly,"viewer",new n.A.SFString),this._avatarSize.setUnit("length"),this._speed.setUnit("speed"),this._visibilityLimit.setUnit("length")}Object.assign(Object.setPrototypeOf(c.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this),this._type.addInterest("set_type__",this),this._headlight.addInterest("set_headlight__",this),this._visibilityLimit.addInterest("set_visibilityLimit__",this),this._transitionStart.addInterest("set_transitionStart__",this),this._transitionComplete.addInterest("set_transitionComplete__",this),this._isBound.addInterest("set_isBound__",this),this.set_type__(),this.set_headlight__(),this.set_visibilityLimit__()},getViewer(){return this._viewer.getValue()},getCollisionRadius(){return this._avatarSize.length>0&&this._avatarSize[0]>0?this._avatarSize[0]:.25},getAvatarHeight(){return this._avatarSize.length>1?this._avatarSize[1]:1.6},getStepHeight(){return this._avatarSize.length>2?this._avatarSize[2]:.75},getNearValue(){const e=this.getCollisionRadius();return 0===e?1e-5:e/2},getFarValue(){return this.visibilityLimit},getTransitionType:(()=>{const e=new Set(["TELEPORT","LINEAR","ANIMATE"]);return function(){for(const t of this._transitionType)if(e.has(t))return t;return"LINEAR"}})(),set_type__(){this._viewer="EXAMINE";for(const e of this._type){switch(e){case"EXAMINE":case"WALK":case"FLY":case"LOOKAT":case"PLANE":case"NONE":this._viewer=e;break;case"PLANE_create3000.github.io":case"PLANE_create3000.de":this._viewer="PLANE";break;default:continue}break}let e=!1,t=!1,i=!1,n=!1,s=!1,r=!1;if(this._type.length)for(const o of this._type){switch(o){case"EXAMINE":default:e=!0;continue;case"WALK":t=!0;continue;case"FLY":i=!0;continue;case"LOOKAT":r=!0;continue;case"PLANE":case"PLANE_create3000.github.io":case"PLANE_create3000.de":n=!0;continue;case"NONE":s=!0;continue;case"ANY":e=!0,t=!0,i=!0,n=!0,s=!0,r=!0}break}else e=!0,t=!0,i=!0,n=!0,s=!0,r=!0;this._availableViewers.length=0,e&&this._availableViewers.push("EXAMINE"),t&&this._availableViewers.push("WALK"),i&&this._availableViewers.push("FLY"),n&&this._availableViewers.push("PLANE"),r&&this._availableViewers.push("LOOKAT"),s&&this._availableViewers.push("NONE")},set_headlight__(){this._headlight.getValue()?delete this.enable:this.enable=Function.prototype},set_visibilityLimit__(){this.visibilityLimit=Math.max(this._visibilityLimit.getValue(),0)},set_transitionStart__(){this._transitionActive.getValue()||(this._transitionActive=!0)},set_transitionComplete__(){this._transitionActive.getValue()&&(this._transitionActive=!1)},set_isBound__(){this._isBound.getValue()||this._transitionActive.getValue()&&(this._transitionActive=!1)},enable(e,t){if(!this._headlight.getValue())return;const i=this.getBrowser().getHeadlight();t.getGlobalLights().push(i),t.getGlobalLightsKeys().push(i.lightNode.getLightKey())},traverse(e,t){t.getLayer().getNavigationInfos().push(this)}}),Object.defineProperties(c,{...o.A.getStaticProperties("NavigationInfo","Navigation",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOnly,"set_bind",new n.A.SFBool),new s.A(l.A.inputOutput,"type",new n.A.MFString("EXAMINE","ANY")),new s.A(l.A.inputOutput,"avatarSize",new n.A.MFFloat(.25,1.6,.75)),new s.A(l.A.inputOutput,"speed",new n.A.SFFloat(1)),new s.A(l.A.inputOutput,"headlight",new n.A.SFBool(!0)),new s.A(l.A.inputOutput,"visibilityLimit",new n.A.SFFloat),new s.A(l.A.inputOutput,"transitionType",new n.A.MFString("LINEAR")),new s.A(l.A.inputOutput,"transitionTime",new n.A.SFTime(1)),new s.A(l.A.outputOnly,"transitionComplete",new n.A.SFBool),new s.A(l.A.outputOnly,"isBound",new n.A.SFBool),new s.A(l.A.outputOnly,"bindTime",new n.A.SFTime)]),enumerable:!0}});const u=c,d=h.A.add("NavigationInfo",u)},2141(e,t,i){i.d(t,{A:()=>l});var n=i(8001),s=i(5053),r=i(2696);function o(e){n.A.call(this,e),this.addType(s.A.X3DAppearanceChildNode)}Object.setPrototypeOf(o.prototype,n.A.prototype),Object.defineProperties(o,n.A.getStaticProperties("X3DAppearanceChildNode","Shape",1));const a=o,l=r.A.add("X3DAppearanceChildNode",a)},2204(e,t,i){i.d(t,{A:()=>f});var n=i(9401),s=i(2696);const r=Symbol.for("X_ITE.Color3.r"),o=Symbol.for("X_ITE.Color3.g"),a=Symbol.for("X_ITE.Color3.b"),l=Symbol();function h(e=0,t=e,i=t,n=i){this[r]=e,this[o]=t,this[a]=i,this[l]=n}Object.assign(h.prototype,{*[Symbol.iterator](){yield this[r],yield this[o],yield this[a],yield this[l]},copy(){const e=Object.create(h.prototype);return e[r]=this[r],e[o]=this[o],e[a]=this[a],e[l]=this[l],e},assign(e){return this[r]=e[r],this[o]=e[o],this[a]=e[a],this[l]=e[l],this},set(e=0,t=e,i=t,n=i){return this[r]=e,this[o]=t,this[a]=i,this[l]=n,this},equals(e){return this[r]===e[r]&&this[o]===e[o]&&this[a]===e[a]&&this[l]===e[l]},getHSVA(e){return n.A.prototype.getHSV.call(this,e),e[3]=this[l],e},setHSVA(e,t,i,s){return n.A.prototype.setHSV.call(this,e,t,i),this[l]=s,this},linearToSRGB(e=new h){return n.A.prototype.linearToSRGB.call(this,e),e[l]=this[l],e},sRGBToLinear(e=new h){return n.A.prototype.sRGBToLinear.call(this,e),e[l]=this[l],e},toString(){return this[r]+" "+this[o]+" "+this[a]+" "+this[l]}});for(const e of Object.keys(h.prototype))Object.defineProperty(h.prototype,e,{enumerable:!1});const c={get(){return this[r]},set(e){this[r]=e}},u={get(){return this[o]},set(e){this[o]=e}},d={get(){return this[a]},set(e){this[a]=e}},p={get(){return this[l]},set(e){this[l]=e}};Object.defineProperties(h.prototype,{length:{value:4},0:c,1:u,2:d,3:p,r:Object.assign({enumerable:!0},c),g:Object.assign({enumerable:!0},u),b:Object.assign({enumerable:!0},d),a:Object.assign({enumerable:!0},p)}),Object.assign(h,{TRANSPARENT:Object.freeze(new h),BLACK:Object.freeze(new h(0,0,0,1)),WHITE:Object.freeze(new h(1)),HSVA(e,t,i,n){const s=Object.create(this.prototype);return s.setHSVA(e,t,i,n),s},lerp(e,t,i,s){const r=e[3];return n.A.lerp(e,t,i,s),s[3]=r+i*(t[3]-r),s}});const g=h,f=s.A.add("Color4",g)},2244(e,t,i){i.d(t,{A:()=>C});var n=i(8015),s=i(5543),r=i(2919),o=i(2695),a=i(9101),l=i(6761),h=i(8894),c=i(1937),u=i(611),d=i(6061),p=i(6007),g=i(2417),f=i(5542),m=i(8588),A=i(937),_=i(5053),y=i(4068),w=i(2696);const x=Symbol(),b=Symbol(),S=Symbol(),T=Symbol(),v=Symbol(),O=Symbol();function E(e,t=null,i=e.getBrowser()){s.A.call(this,e,i),this.addType(_.A.X3DExecutionContext),this.addChildObjects(_.A.initializeOnly,"rootNodes",new n.A.MFNode,_.A.inputOutput,"countPrimitives",new n.A.SFBool(!0),_.A.outputOnly,"worldInfos",new n.A.MFNode,_.A.outputOnly,"sceneGraph_changed",new n.A.SFTime),this._rootNodes.setPrivate(!1),this._rootNodes.collectCloneCount=()=>1,e&&(this._countPrimitives.addReference(e._countPrimitives),this._sceneGraph_changed.addFieldInterest(e._sceneGraph_changed)),this[x]=t,this[b]=new a.A,this[S]=new h.A,this[T]=new d.A,this[v]=new u.A,this[O]=new f.A,this[b].addParent(this),this[S].addParent(this),this[T].addParent(this),this[v].addParent(this),this[O].addParent(this)}Object.assign(Object.setPrototypeOf(E.prototype,s.A.prototype),{getLocalScene(){return this.getExecutionContext().getLocalScene()},setExecutionContext(e){this.getExecutionContext()&&(this._countPrimitives.removeReference(this.getExecutionContext()._countPrimitives),this._sceneGraph_changed.removeFieldInterest(this.getExecutionContext()._sceneGraph_changed)),s.A.prototype.setExecutionContext.call(this,e),e&&(this._countPrimitives.addReference(e._countPrimitives),this._sceneGraph_changed.addFieldInterest(e._sceneGraph_changed))},getOuterNode(){return this[x]},getCountPrimitives(){return this._countPrimitives.getValue()},setCountPrimitives(e){this._countPrimitives=(this.getExecutionContext()?.getCountPrimitives()??!0)&&e},getBBox(e,t){const i=Array.from(this.getRootNodes(),e=>(0,A.A)(_.A.X3DBoundedObject,e)).filter(e=>e);return r.A.prototype.getBBox(i,e,t)},getSpecificationVersion(){return this.getExecutionContext().getSpecificationVersion()},getEncoding(){return this.getExecutionContext().getEncoding()},getWorldURL(){return this.getExecutionContext().getWorldURL()},getBaseURL(){return this.getExecutionContext().getBaseURL()},getProfile(){return this.getExecutionContext().getProfile()},hasComponent(e,t){return this.getExecutionContext().hasComponent(e,t)},getComponents(){return this.getExecutionContext().getComponents()},fromUnit(e,t){return this.getExecutionContext().fromUnit(e,t)},toUnit(e,t){return this.getExecutionContext().toUnit(e,t)},getUnits(){return this.getExecutionContext().getUnits()},createNode(e,t=!0){if(e=String(e),!1===t){const t=this.getBrowser().getConcreteNodes().get(e);if(!t)return null;const{from:i,to:n}=t.specificationRange;return this.getSpecificationVersion()<i||this.getSpecificationVersion()>n?null:(this.hasComponent(t.componentInfo.name)||console.warn(`Node type '${e}' does not match component/profile statements in '${this.getWorldURL()}'.`),new t(this))}{const t=this.getBrowser().getConcreteNodes().get(e);if(!t)throw new Error(`Unknown node type '${e}'.`);const{from:i,to:n}=t.specificationRange;if(this.getSpecificationVersion()<i||this.getSpecificationVersion()>n)throw new Error(`Node type '${e}' does not match specification version in '${this.getWorldURL()}.`);this.hasComponent(t.componentInfo.name)||console.warn(`Node type '${e}' does not match component/profile statements in '${this.getWorldURL()}'.`);const s=new t(this);return s.setup(),y.A.get(s)}},createProto(e,t=!0){e=String(e);for(let i=this;;){const n=i.protos.get(e)??i.externprotos.get(e);if(n)return n.createInstance(this,t);if(i.isScene)break;i=i.getExecutionContext()}if(!1===t)return null;throw new Error(`Unknown proto or externproto type '${e}'.`)},addNamedNode(e,t){if(e=String(e),!(t=(0,A.A)(_.A.X3DNode,t,!1)))throw new Error("Couldn't add named node: node must be of type X3DNode.");if(t.getExecutionContext()!==this)throw new Error("Couldn't add named node: node does not belong to this execution context.");if(0===e.length)throw new Error("Couldn't add named node: node name is empty.");if(this[b].has(e))throw new Error(`Couldn't add named node: node named '${e}' is already in use.`);if(this[b].get(t.getName())?.getValue()===t)throw new Error(`Couldn't add named node: node named '${t.getName()}' already has a name.`);t.setName(e),this[b].add(e,y.A.get(t))},updateNamedNode(e,t){if(e=String(e),!(t=(0,A.A)(_.A.X3DNode,t,!1)))throw new Error("Couldn't update named node: node must be of type X3DNode.");if(t.getExecutionContext()!==this)throw new Error("Couldn't update named node: node does not belong to this execution context.");if(0===e.length)throw new Error("Couldn't update named node: node name is empty.");this.removeNamedNode(e),this[b].update(t.getName(),e,y.A.get(t)),t.setName(e),this._namedNodes_changed=Date.now()/1e3},removeNamedNode(e){e=String(e);const t=this[b].get(e);t?.getValue()?.setName(""),this[b].remove(e),this._namedNodes_changed=Date.now()/1e3},getNamedNode(e){e=String(e);const t=this[b].get(e);if(t?.getValue())return t;throw new Error(`Named node '${e}' not found.`)},getNamedNodes(){return this[b]},getUniqueName(e){return(0,o.l)(this[b],e)},addImportedNode(e,t,i=t){if(t=String(t),i=String(i),this[S].has(i))throw new Error(`Couldn't add imported node: imported name '${i}' already in use.`);this.updateImportedNode(e,t,i)},updateImportedNode(e,t,i){if(e=(0,A.A)(_.A.Inline,e,!1),t=String(t),i=void 0===i?t:String(i),!e)throw new Error("Node must be of type Inline node.");if(e.getExecutionContext()!==this)throw new Error("Couldn't update imported node: Inline node does not belong to this execution context.");if(0===t.length)throw new Error("Couldn't update imported node: exported name is empty.");if(0===i.length)throw new Error("Couldn't update imported node: imported name is empty.");this.removeImportedNode(i);const n=new l.A(this,e,t,i);this[S].add(i,n),n.updateExportedNode(),this._sceneGraph_changed=Date.now()/1e3},renameImportedNode(e,t){const i=this[S].get(e);if(!i)throw new Error("Couldn't rename imported node: imported node does not exists.");if(this[S].get(t))throw new Error("Couldn't rename imported node: new imported name does already exists.");i[Symbol.for("X_ITE.X3DImportedNode.setImportName")](t),this[S].update(e,t,i),this._sceneGraph_changed=Date.now()/1e3},removeImportedNode(e){e=String(e);const t=this[S].get(e);t&&(t.dispose(),this[S].remove(e),this._sceneGraph_changed=Date.now()/1e3)},getImportedNode(e){e=String(e);const t=this[S].get(e);if(t)return t.exportedNode;throw new Error(`Imported node '${e}' not found.`)},getImportedNodes(){return this[S]},getUniqueImportName(e){return(0,o.l)(this[S],e)},getLocalNode(e){e=String(e);try{return this.getNamedNode(e)}catch{const t=this[S].get(e);if(t)return t;throw new Error(`Unknown named or imported node '${e}'.`)}},getLocalizedNode(e){if(!(e=(0,A.A)(_.A.X3DNode,e,!1)??(e instanceof l.A?e:null)))throw new Error("Couldn't get localized node: node must be of type X3DNode.");if(e.getExecutionContext()===this)return e instanceof c.A?e.getImportedNode():e;for(const t of this[S])try{if(t.getSharedNode()===e)return t}catch{}return e},setRootNodes(){},getRootNodes(){return this._rootNodes},getProtoDeclaration(e){e=String(e);const t=this[T].get(e);if(t)return t;throw new Error(`Proto declaration '${e}' not found.`)},addProtoDeclaration(e,t){if(e=String(e),!(t instanceof p.A))throw new Error("Couldn't add proto declaration: proto must be of type X3DProtoDeclaration.");if(t.getExecutionContext()!==this)throw new Error("Couldn't add proto declaration: proto does not belong to this execution context.");if(this[T].has(e))throw new Error(`Couldn't add proto declaration: proto '${e}' already in use.`);if(this[T].get(t.getName())===t)throw new Error(`Couldn't add proto declaration: proto '${t.getName()}' already added.`);if(0===e.length)throw new Error("Couldn't add proto declaration: proto name is empty.");this[v].has(e)&&console.warn(`Added proto '${e}' will override extern proto with same name.`),this.getBrowser().getConcreteNodes().has(e)&&console.warn(`Added proto '${e}', but will not override built-in node of same type if profile/components include this node.`),this[T].add(e,t),t.setName(e),this._sceneGraph_changed=Date.now()/1e3},updateProtoDeclaration(e,t){if(e=String(e),!(t instanceof p.A))throw new Error("Couldn't update proto declaration: proto must be of type X3DProtoDeclaration.");if(t.getExecutionContext()!==this)throw new Error("Couldn't update proto declaration: proto does not belong to this execution context.");if(0===e.length)throw new Error("Couldn't update proto declaration: proto name is empty.");this[v].has(e)&&console.warn(`Added proto '${e}' will override extern proto with same name.`),this.getBrowser().getConcreteNodes().has(e)&&console.warn(`Added proto '${e}', but will not override built-in node of same type if profile/components include this node.`),this[T].update(t.getName(),e,t),t.setName(e),this._sceneGraph_changed=Date.now()/1e3},removeProtoDeclaration(e){e=String(e),this[T].remove(e),this._sceneGraph_changed=Date.now()/1e3},getProtoDeclarations(){return this[T]},getUniqueProtoName(e){return(0,o.l)(this[T],e)},getExternProtoDeclaration(e){e=String(e);const t=this[v].get(e);if(t)return t;throw new Error(`Extern proto declaration '${e}' not found.`)},addExternProtoDeclaration(e,t){if(e=String(e),!(t instanceof g.A))throw new Error("Couldn't add extern proto declaration: extern proto must be of type X3DExternProtoDeclaration.");if(t.getExecutionContext()!==this)throw new Error("Couldn't add extern proto declaration: extern proto does not belong to this execution context.");if(this[v].has(e))throw new Error(`Couldn't add extern proto declaration: extern proto '${e}' already in use.`);if(this[v].get(t.getName())===t)throw new Error(`Couldn't add extern proto declaration: extern proto '${t.getName()}' already added.`);if(0===e.length)throw new Error("Couldn't add extern proto declaration: extern proto name is empty.");this[T].has(e)&&console.warn(`Added extern proto '${e}' will be overridden by proto with same name.`),this.getBrowser().getConcreteNodes().has(e)&&console.warn(`Added extern proto '${e}', but will not override built-in node of same type if profile/components include this node.`),this[v].add(e,t),t.setName(e),this._sceneGraph_changed=Date.now()/1e3},updateExternProtoDeclaration(e,t){if(e=String(e),!(t instanceof g.A))throw new Error("Couldn't update extern proto declaration: extern proto must be of type X3DExternProtoDeclaration.");if(t.getExecutionContext()!==this)throw new Error("Couldn't update extern proto declaration: extern proto does not belong to this execution context.");if(0===e.length)throw new Error("Couldn't update extern proto declaration: extern proto name is empty.");this[T].has(e)&&console.warn(`Added extern proto '${e}' will be overridden by proto with same name.`),this.getBrowser().getConcreteNodes().has(e)&&console.warn(`Added extern proto '${e}', but will not override built-in node of same type if profile/components include this node.`),this[v].update(t.getName(),e,t),t.setName(e),this._sceneGraph_changed=Date.now()/1e3},removeExternProtoDeclaration(e){e=String(e),this[v].remove(e),this._sceneGraph_changed=Date.now()/1e3},getExternProtoDeclarations(){return this[v]},getUniqueExternProtoName(e){return(0,o.l)(this[v],e)},addRoute(e,t,i,n){try{const s=e instanceof l.A?e:null,r=i instanceof l.A?i:null;if(e=(0,A.A)(_.A.X3DNode,e,!1)??s,t=String(t),i=(0,A.A)(_.A.X3DNode,i,!1)??r,n=String(n),!e)throw new Error("source node must be of type X3DNode.");if(!i)throw new Error("destination node must be of type X3DNode.");e=this.getLocalizedNode(e),i=this.getLocalizedNode(i);const o=m.A.getRouteId(e,t,i,n),a=this[O].get(o);if(a)return a;{const s=new m.A(this,e,t,i,n);return this[O].add(o,s),s}}catch(e){throw new Error(`Bad ROUTE specification: ${e.message}`)}},deleteRoute(e){4===arguments.length&&(e=this.getRoute(...arguments)),e instanceof m.A&&this[O].get(e.getRouteId())===e&&(this[O].remove(e.getRouteId()),e.dispose())},getRoute(e,t,i,n){const s=e instanceof l.A?e:null,r=i instanceof l.A?i:null;if(e=(0,A.A)(_.A.X3DNode,e,!1)??s,t=String(t),i=(0,A.A)(_.A.X3DNode,i,!1)??r,n=String(n),!e)throw new Error("Bad ROUTE specification: sourceNode must be of type X3DNode.");if(!i)throw new Error("Bad ROUTE specification: destinationNode must be of type X3DNode.");return e=this.getLocalizedNode(e),i=this.getLocalizedNode(i),this[O].get(m.A.getRouteId(e,t,i,n))},getRoutes(){return this[O]},getWorldInfos(){return this._worldInfos},addWorldInfo(e){this._worldInfos.push(e)},removeWorldInfo(e){for(const[t,i]of this._worldInfos.entries())if(i.getValue()===e){this._worldInfos.splice(t,1);break}},toVRMLStream(e){e.PushExecutionContext(this),e.NamedNodes(this.getNamedNodes()),e.ImportedNodes(this.getImportedNodes()),this.getExternProtoDeclarations().toVRMLStream(e),this.getProtoDeclarations().toVRMLStream(e);const t=this.getRootNodes(),i=t.length-1;for(const[n,s]of t.entries())e.Indent(),s?s.toVRMLStream(e):e.NULL(),e.TidyBreak(),n!==i&&e.TidyBreak();const n=this.getImportedNodes();n.length&&(e.TidyBreak(),n.toVRMLStream(e));const s=this.getRoutes();s.length&&(e.TidyBreak(),s.toVRMLStream(e)),e.PopExecutionContext()},toXMLStream(e){e.PushExecutionContext(this),e.NamedNodes(this.getNamedNodes()),e.ImportedNodes(this.getImportedNodes()),this.getExternProtoDeclarations().toXMLStream(e),this.getProtoDeclarations().toXMLStream(e);const t=this.getRootNodes();t.length&&(t.toXMLStream(e),e.TidyBreak()),this.getImportedNodes().toXMLStream(e),this.getRoutes().toXMLStream(e),e.PopExecutionContext()},toJSONStream(e){e.PushExecutionContext(this),e.NamedNodes(this.getNamedNodes()),e.ImportedNodes(this.getImportedNodes());let t=!1;t=this.getExternProtoDeclarations().toJSONStream(e,t),t=this.getProtoDeclarations().toJSONStream(e,t);for(const i of this.getRootNodes())t&&(e.string+=","),e.TidyBreak(),e.Indent(),i?i.toJSONStream(e):e.string+="null",t=!0;return this.getImportedNodes().toJSONStream(e,t),this.getRoutes().toJSONStream(e,t),e.PopExecutionContext(),t},dispose(){for(const e of Array.from(this[O]))this.deleteRoute(e);this[x]=null,this[b].clear(),this[S].clear(),this[T].clear(),this[v].clear(),this[O].clear(),s.A.prototype.dispose.call(this)}});for(const e of Object.keys(E.prototype))Object.defineProperty(E.prototype,e,{enumerable:!1});Object.defineProperties(E.prototype,{isScene:{value:!1,enumerable:!0},specificationVersion:{get:E.prototype.getSpecificationVersion,enumerable:!0},encoding:{get:E.prototype.getEncoding,enumerable:!0},profile:{get:E.prototype.getProfile,enumerable:!0},components:{get:E.prototype.getComponents,enumerable:!0},worldURL:{get:E.prototype.getWorldURL,enumerable:!0},baseURL:{get:E.prototype.getBaseURL,enumerable:!0},units:{get:E.prototype.getUnits,enumerable:!0},namedNodes:{get:E.prototype.getNamedNodes,enumerable:!0},importedNodes:{get:E.prototype.getImportedNodes,enumerable:!0},rootNodes:{get:E.prototype.getRootNodes,set:E.prototype.setRootNodes,enumerable:!0},protos:{get:E.prototype.getProtoDeclarations,enumerable:!0},externprotos:{get:E.prototype.getExternProtoDeclarations,enumerable:!0},routes:{get:E.prototype.getRoutes,enumerable:!0}}),Object.defineProperties(E,{typeName:{value:"X3DExecutionContext",enumerable:!0}}),_.A.addConstant(E.typeName);const N=E,C=w.A.add("X3DExecutionContext",N)},2251(e,t,i){i.d(t,{A:()=>c});var n=i(8015),s=i(8001),r=i(5053),o=i(608),a=i(2696);function l(e){this.getExecutionContext()||(s.A.call(this,e),this.addType(r.A.X3DChildNode),this.addChildObjects(r.A.outputOnly,"isBoundedObject",new n.A.SFBool,r.A.outputOnly,"isPointingObject",new n.A.SFBool,r.A.outputOnly,"isCameraObject",new n.A.SFBool,r.A.outputOnly,"isPickableObject",new n.A.SFBool,r.A.outputOnly,"isCollisionObject",new n.A.SFBool,r.A.outputOnly,"isShadowObject",new n.A.SFBool,r.A.outputOnly,"isVisibleObject",new n.A.SFBool))}Object.assign(Object.setPrototypeOf(l.prototype,s.A.prototype),{setBoundedObject(e){!!e!==this._isBoundedObject.getValue()&&(this._isBoundedObject=e)},isBoundedObject(){return this._isBoundedObject.getValue()},setPointingObject(e){!!e!==this._isPointingObject.getValue()&&(this._isPointingObject=e)},isPointingObject(){return this._isPointingObject.getValue()},setCameraObject(e){!!e!==this._isCameraObject.getValue()&&(this._isCameraObject=e)},isCameraObject(){return this._isCameraObject.getValue()},setPickableObject(e){!!e!==this._isPickableObject.getValue()&&(this._isPickableObject=e)},isPickableObject(){return this._isPickableObject.getValue()},setShadowObject(e){!!e!==this._isShadowObject.getValue()&&(this._isShadowObject=e)},isShadowObject(){return this._isShadowObject.getValue()},setCollisionObject(e){!!e!==this._isCollisionObject.getValue()&&(this._isCollisionObject=e)},isCollisionObject(){return this._isCollisionObject.getValue()},setVisibleObject(e){!!e!==this._isVisibleObject.getValue()&&(this._isVisibleObject=e)},isVisibleObject(){return this._isVisibleObject.getValue()},isVisible:()=>!0,connectChildNode(e,t){t?.includes(o.A.BBOX)||(e._isBoundedObject.addFieldInterest(this._isBoundedObject),this.setBoundedObject(e.isBoundedObject())),t?.includes(o.A.POINTER)||(e._isPointingObject.addFieldInterest(this._isPointingObject),this.setPointingObject(e.isPointingObject())),t?.includes(o.A.CAMERA)||(e._isCameraObject.addFieldInterest(this._isCameraObject),this.setCameraObject(e.isCameraObject())),t?.includes(o.A.PICKING)||(e._isPickableObject.addFieldInterest(this._isPickableObject),this.setPickableObject(e.isPickableObject())),t?.includes(o.A.COLLISION)||(e._isCollisionObject.addFieldInterest(this._isCollisionObject),this.setCollisionObject(e.isCollisionObject())),t?.includes(o.A.SHADOW)||(e._isShadowObject.addFieldInterest(this._isShadowObject),this.setShadowObject(e.isShadowObject())),t?.includes(o.A.DISPLAY)||(e._isVisibleObject.addFieldInterest(this._isVisibleObject),this.setVisibleObject(e.isVisibleObject()))},disconnectChildNode(e){e._isBoundedObject.removeFieldInterest(this._isBoundedObject),e._isPointingObject.removeFieldInterest(this._isPointingObject),e._isCameraObject.removeFieldInterest(this._isCameraObject),e._isPickableObject.removeFieldInterest(this._isPickableObject),e._isCollisionObject.removeFieldInterest(this._isCollisionObject),e._isShadowObject.removeFieldInterest(this._isShadowObject),e._isVisibleObject.removeFieldInterest(this._isVisibleObject)},getShapes:(e,t)=>e}),Object.defineProperties(l,s.A.getStaticProperties("X3DChildNode","Core",1));const h=l,c=a.A.add("X3DChildNode",h)},2342(e,t,i){i.d(t,{A:()=>o});var n=i(477),s=i(2696);const r={frustum(e,t,i,n,s,r,o){const a=t-e,l=n-i,h=r-s,c=2*s,u=(t+e)/a,d=(n+i)/l,p=-(r+s)/h,g=-c*r/h,f=c/a,m=c/l;return o.set(f,0,0,0,0,m,0,0,u,d,p,-1,0,0,g,0)},perspective(e,t,i,n,s,r){const o=Math.tan(e/2)*t;if(n>s){const e=n*o/s;return this.frustum(-e,e,-o,o,t,i,r)}{const e=s*o/n;return this.frustum(-o,o,-e,e,t,i,r)}},perspective2(e,t,i,n,s,r){const o=Math.tan(e/2)*t;return this.frustum(-o,o,-o,o,t,i,r)},ortho(e,t,i,n,s,r,o){const a=t-e,l=n-i,h=r-s,c=2/a,u=2/l,d=-2/h,p=-(t+e)/a,g=-(n+i)/l,f=-(r+s)/h;return o.set(c,0,0,0,0,u,0,0,0,0,d,0,p,g,f,1)},orthoBox:(()=>{const e=new n.A,t=new n.A;return function(i,n){return i.getExtents(e,t),this.ortho(e.x,t.x,e.y,t.y,-t.z,-e.z,n)}})()},o=s.A.add("Camera",r)},2361(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(8001),r=i(9713),o=i(5053),a=i(937),l=i(9582),h=i(5185),c=i(2696);function u(e){r.A.call(this,e),this.addType(o.A.X3DSingleTextureNode),this.addChildObjects(o.A.outputOnly,"linear",new n.A.SFBool),this.matrix=new Float32Array(l.A.IDENTITY)}Object.assign(Object.setPrototypeOf(u.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this._textureProperties.addInterest("set_textureProperties__",this,!0);const e=this.getBrowser().getContext();this.texture=e.createTexture(),this.set_textureProperties__(!1)},getCount:()=>1,getTextureTypeString(){switch(this.getTextureType()){case 1:case 2:return"2D";case 3:return"3D";case 4:return"CUBE"}},getTexture(){return this.texture},setTexture(e){this.getBrowser().getContext().deleteTexture(this.texture),this.texture=e,this.addNodeEvent()},isLinear(){return this._linear.getValue()},setLinear(e){!!e!==this._linear.getValue()&&(this._linear=e)},canMipMaps(){return this.mipMaps},setMipMaps(e){this.mipMaps=e},getMatrix(){return this.matrix},isImageTransparent(e){const t=e.length;for(let i=3;i<t;i+=4)if(255!==e[i])return!0;return!1},set_textureProperties__(e){this.texturePropertiesNode&&this.texturePropertiesNode.removeInterest("updateTextureParameters",this),this.texturePropertiesNode=(0,a.A)(o.A.TextureProperties,this._textureProperties)??this.getBrowser().getDefaultTextureProperties(),this.texturePropertiesNode.addInterest("updateTextureParameters",this),e&&this.updateTextureParameters()},updateTextureParameters(e,t,i,n,s,r,o,a){const l=this.getBrowser(),c=l.getContext();c.bindTexture(e,this.getTexture()),!t&&Math.max(n,s)<l.getMinTextureSize()?(c.texParameteri(e,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(e,c.TEXTURE_MAG_FILTER,c.NEAREST)):this.canMipMaps()&&i._generateMipMaps.getValue()?(c.generateMipmap(e),c.texParameteri(e,c.TEXTURE_MIN_FILTER,c[i.getMinificationFilter()]),c.texParameteri(e,c.TEXTURE_MAG_FILTER,c[i.getMagnificationFilter()])):(c.texParameteri(e,c.TEXTURE_MIN_FILTER,c[i.getMinificationFilter(!1)]),c.texParameteri(e,c.TEXTURE_MAG_FILTER,c[i.getMagnificationFilter(!1)])),t?(c.texParameteri(e,c.TEXTURE_WRAP_S,c[i.getBoundaryModeS()]),c.texParameteri(e,c.TEXTURE_WRAP_T,c[i.getBoundaryModeT()]),c.texParameteri(e,c.TEXTURE_WRAP_R,c[i.getBoundaryModeR()])):(c.texParameteri(e,c.TEXTURE_WRAP_S,r?c.REPEAT:c.CLAMP_TO_EDGE),c.texParameteri(e,c.TEXTURE_WRAP_T,o?c.REPEAT:c.CLAMP_TO_EDGE),c.texParameteri(e,c.TEXTURE_WRAP_R,a?c.REPEAT:c.CLAMP_TO_EDGE));const u=l.getAnisotropicExtension();if(u){const t=c.getParameter(u.MAX_TEXTURE_MAX_ANISOTROPY_EXT);c.texParameterf(e,u.TEXTURE_MAX_ANISOTROPY_EXT,h.A.clamp(i._anisotropicDegree.getValue(),0,t))}},getTextureBits(){return this.isLinear()<<3|this.getTextureType()},updateTextureBits(e,t=0){e.add(4*t,this.getTextureBits())},getShaderOptions(e,t=0,i=!1){"number"==typeof t?(e.push(`X3D_TEXTURE_${t}_${this.getTextureTypeString()}`),1===this.getTextureType()&&e.push(`X3D_TEXTURE_${t}_FLIP_Y`),this.isLinear()&&e.push(`X3D_TEXTURE_${t}_LINEAR`)):(i=i?"_EXT":"",e.push(`X3D_${t}_TEXTURE${i}`,`X3D_${t}_TEXTURE${i}_${this.getTextureTypeString()}`),1===this.getTextureType()&&e.push(`X3D_${t}_TEXTURE${i}_FLIP_Y`),this.isLinear()&&e.push(`X3D_${t}_TEXTURE${i}_LINEAR`))},setNamedShaderUniforms(e,t,i,n,s){this.setShaderUniforms(e,t),e.uniform1i(t.textureTransformMapping,n.get(i)??0),e.uniform1i(t.textureCoordinateMapping,s.get(i)??0)}}),Object.defineProperties(u,s.A.getStaticProperties("X3DSingleTextureNode","Texturing",1));const d=u,p=c.A.add("X3DSingleTextureNode",d)},2417(e,t,i){i.d(t,{A:()=>f});var n=i(8015),s=i(5717),r=i(3999),o=i(8764),a=i(4632),l=i(5053),h=i(2696);const c=Symbol(),u=Symbol(),d=Symbol();function p(e,t){a.A.call(this,e),o.A.call(this,e),this.addType(l.A.X3DExternProtoDeclaration),this.addChildObjects(l.A.inputOutput,"load",new n.A.SFBool(!0),l.A.inputOutput,"url",t.copy(),l.A.inputOutput,"autoRefresh",new n.A.SFTime(0),l.A.inputOutput,"autoRefreshTimeLimit",new n.A.SFTime(3600)),this.getBrowser()[d]??=new Map}Object.assign(Object.setPrototypeOf(p.prototype,a.A.prototype),o.A.prototype,{initialize(){a.A.prototype.initialize.call(this),o.A.prototype.initialize.call(this)},getAppInfo(){return this[c]?.getAppInfo()||a.A.prototype.getAppInfo.call(this)},setAppInfo(e){this[c]?this[c].setAppInfo(e):a.A.prototype.setAppInfo.call(this,e)},getDocumentation(){return this[c]?.getDocumentation()||a.A.prototype.getDocumentation.call(this)},setDocumentation(e){this[c]?this[c].setDocumentation(e):a.A.prototype.setDocumentation.call(this,e)},getProtoDeclaration(){return this[c]},setProtoDeclaration(e){this[c]=e,e&&(this.getFieldDefinitions().assign(e.getFieldDefinitions()),this.getUserDefinedFields().assign(e.getUserDefinedFields())),this.updateInstances()},async loadData(){const e=this.getBrowser();if(!this._url.length)return void this.setError(new Error("No URL given."));const{default:t}=await Promise.resolve().then(i.bind(i,8939));for(const i of this._url)try{const n=new URL(i,this.getExecutionContext().getBaseURL()),s=new URL(n),r=e.getBrowserOption("Cache");s.hash="";const o=r?e[d].get(s.href):null,a=o??new Promise(e=>{new t(this).createX3DFromURL([s],null,e)});o||s.search||e[d].set(s.href,a);const l=await a;if(!l)continue;return void this.setInternalScene(l,n,r)}catch(e){console.warn(e.message)}this.setError(new Error("File could not be loaded."))},getInternalScene(){return this[u]},setInternalScene(e,t,i){const n=this.getBrowser();this[u]===n.getDefaultScene()||this[d]||this[u]?.dispose(),this[u]=e,this[d]=i;const s=decodeURIComponent(t.hash.substring(1)),r=s?this[u].protos.get(s):this[u].protos[0];if(!r)throw new Error("PROTO not found");this[u].setExecutionContext(this[d]?n.getDefaultScene():this.getExecutionContext()),this[u].setLive(!0),this.setLoadState(l.A.COMPLETE_STATE),this.setProtoDeclaration(r)},setError(e){console.error(`Error loading extern prototype '${this.getName()}':`,e),this[u]=this.getBrowser().getDefaultScene(),this.setLoadState(l.A.FAILED_STATE),this.setProtoDeclaration(null)},toVRMLStream(e){e.Indent(),e.string+="EXTERNPROTO",e.Space(),e.string+=this.getName(),e.TidySpace(),e.string+="[";const t=this.getUserDefinedFields();if(0===t.length)e.TidySpace();else{let i=0,n=0;for(const s of t)i=Math.max(i,s.getTypeName().length),n=Math.max(n,e.AccessType(s.getAccessType()).length);e.TidyBreak(),e.IncIndent();const s=t.at(-1);for(const r of t)this.toVRMLStreamUserDefinedField(e,r,i,n),r===s?e.TidyBreak():e.Break();e.DecIndent(),e.Indent()}e.string+="]",e.TidyBreak(),e.Indent(),this._url.toVRMLStream(e)},toVRMLStreamUserDefinedField(e,t,i,n){e.Indent(),e.string+=e.AccessType(t.getAccessType()).padEnd(n,e.TidySpace()),e.Space(),e.string+=t.getTypeName().padEnd(i,e.TidySpace()),e.Space(),e.string+=t.getName()},toXMLStream(e){e.openTag("ExternProtoDeclare"),e.attribute("name",this.getName()),e.Space(),e.string+="url='",this._url.toXMLStream(e),e.string+="'",this.getAppInfo()&&e.attribute("appinfo",this.getAppInfo()),this.getDocumentation()&&e.attribute("documentation",this.getDocumentation());const t=this.getUserDefinedFields();if(t.length){e.endTag(),e.IncIndent();for(const i of t)e.openTag("field"),e.attribute("accessType",e.AccessType(i.getAccessType())),e.attribute("type",i.getTypeName()),e.attribute("name",i.getName()),i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.closeTag("field"),e.TidyBreak();e.DecIndent(),e.closingTag("ExternProtoDeclare")}else e.closeTag("ExternProtoDeclare")},toJSONStream(e){e.TidyBreak(),e.Indent(),e.beginObject("ExternProtoDeclare",!1,!0),e.stringProperty("@name",this.getName(),!1),this.getAppInfo()&&e.stringProperty("@appinfo",this.getAppInfo()),this.getDocumentation()&&e.stringProperty("@documentation",this.getDocumentation());const t=this.getUserDefinedFields();if(t.length){e.beginArray("field");for(const i of t)e.beginObject("",i!==t[0]),e.stringProperty("@accessType",e.AccessType(i.getAccessType()),!1),e.stringProperty("@type",i.getTypeName()),e.stringProperty("@name",i.getName()),i.getAppInfo()&&e.stringProperty("@appinfo",i.getAppInfo()),i.getDocumentation()&&e.stringProperty("@documentation",i.getDocumentation()),e.endObject();e.endArray()}e.string+=",",e.TidyBreak(),e.Indent(),e.string+='"',e.string+="@url",e.string+='"',e.string+=":",e.TidySpace(),this._url.toJSONStream(e),e.endObject(),e.endObject()}});for(const e of Object.keys(p.prototype))Object.defineProperty(p.prototype,e,{enumerable:!1});Object.defineProperties(p.prototype,{isExternProto:{value:!0,enumerable:!0},urls:{get(){return this._url},enumerable:!0},loadState:{get:p.prototype.checkLoadState,enumerable:!0}}),Object.defineProperties(p,{typeName:{value:"X3DExternProtoDeclaration",enumerable:!0},fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode)]),enumerable:!0}}),l.A.addConstant(p.typeName);const g=p,f=h.A.add("X3DExternProtoDeclaration",g)},2462(e,t,i){i.d(t,{A:()=>a});var n=i(2514),s=i(2696);const r={get ENVIRONMENT(){return n.A?"BROWSER":"MODULE"},WEAK_REF:"undefined"!=typeof WeakRef,FINALIZATION_REGISTRY:"undefined"!=typeof FinalizationRegistry};(()=>{function e(e){if((e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]}const t=Reflect.getPrototypeOf(Int8Array);for(const i of[Array,String,t])void 0===i.prototype.at&&Object.defineProperty(i.prototype,"at",{value:e,writable:!0,enumerable:!1,configurable:!0})})(),r.WEAK_REF||(n.A&&console.info("Added shim for WeakRef."),window.WeakRef=class{#R;constructor(e){this.#R=e}deref(){return this.#R}}),r.FINALIZATION_REGISTRY||(n.A&&console.info("Added shim for FinalizationRegistry."),window.FinalizationRegistry=class{register(){}unregister(){}}),(()=>{for(const e of[Map,WeakMap])e.prototype.getOrInsert??=function(e,t){return this.has(e)?this.get(e):(this.set(e,t),t)};for(const e of[Map,WeakMap])e.prototype.getOrInsertComputed??=function(e,t){if(this.has(e))return this.get(e);const i=t(e);return this.set(e,i),i}})();const o=r,a=s.A.add("Features",o)},2514(e,t,i){i.d(t,{A:()=>n});const n=i(2696).A.add("DEVELOPMENT",!1)},2681(e,t,i){i.d(t,{A:()=>O});var n=i(4839),s=i(1264),r=i(8015),o=i(2804),a=i(6761),l=i(2417),h=i(6007),c=i(5053),u=i(1262),d=i(9401),p=i(2204),g=i(1256),f=i(9582),m=i(5319),A=i(1166),_=i(477),y=i(8392),w=i(2514),x=i(2696),b=i(9340);const S=(0,s.A)({Whitespaces:/[\x20\n,\t\r]+/gy,Comment:/#\/\*[\s\S]*?\*\/#|#.*?(?=[\n\r]|$)/gy,Comment3_2:/#.*?(?=[\n\r]|$)/gy,Break:/\r?\n/g,Header:/^#(VRML|X3D) V(.*?) (utf8)(?:[ \t]+(.*?))?[ \t]*[\n\r]/gy,AS:/AS/gy,COMPONENT:/COMPONENT/gy,DEF:/DEF/gy,EXPORT:/EXPORT/gy,EXTERNPROTO:/EXTERNPROTO/gy,FALSE:/FALSE|false/gy,IMPORT:/IMPORT/gy,IS:/IS/gy,META:/META/gy,NULL:/NULL|null/gy,TRUE:/TRUE|true/gy,PROFILE:/PROFILE/gy,PROTO:/PROTO/gy,ROUTE:/ROUTE/gy,TO:/TO/gy,UNIT:/UNIT/gy,USE:/USE/gy,OpenBrace:/\{/gy,CloseBrace:/\}/gy,OpenBracket:/\[/gy,CloseBracket:/\]/gy,Period:/\./gy,Colon:/\:/gy,Id:/[^\x30-\x39\x00-\x20\x22\x23\x27\x2b\x2c\x2d\x2e\x5b\x5c\x5d\x7b\x7d\x7f]{1}[^\x00-\x20\x22\x23\x27\x2c\x2e\x5b\x5c\x5d\x7b\x7d\x7f]*/gy,ComponentNameId:/[^\x30-\x39\x00-\x20\x22\x23\x27\x2b\x2c\x2d\x2e\x5b\x5c\x5d\x7b\x7d\x7f\x3a]{1}[^\x00-\x20\x22\x23\x27\x2c\x2e\x5b\x5c\x5d\x7b\x7d\x7f\x3a]*/gy,initializeOnly:/initializeOnly/gy,inputOnly:/inputOnly/gy,outputOnly:/outputOnly/gy,inputOutput:/inputOutput/gy,field:/field/gy,eventIn:/eventIn/gy,eventOut:/eventOut/gy,exposedField:/exposedField/gy,FieldType:/[SM]F(?:Bool|ColorRGBA|Color|Double|Float|Image|Int32|Matrix3d|Matrix3f|Matrix4d|Matrix4f|Node|Rotation|String|Time|Vec2d|Vec2f|Vec3d|Vec3f|Vec4d|Vec4f)/gy,int32:/(?:0[xX][\da-fA-F]+)|(?:[+-]?\d+)/gy,double:/[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?)/gy,doubleQuotes:/"/gy,noDoubleQuotes:/[^"]+/gy,CONSTANTS:/([+-]?)\b(NAN|INFINITY|INF|PI|PI2|PI1_4|PI2_4|PI3_4|PI4_4|PI5_4|PI6_4|PI7_4|PI8_4|PI1_2|PI2_2|PI3_2|PI4_2|PI1_3|PI2_3|PI3_3|PI4_3|PI5_3|PI6_3|SQRT1_2|SQRT2)\b/giy,HTMLColor:/[a-zA-Z]+|0[xX][\da-fA-F]+|rgba?\(.*?\)/gy});function T(e){n.A.call(this,e),this.Grammar={Comment:S.Comment}}Object.assign(Object.setPrototypeOf(T.prototype,n.A.prototype),{accessTypes:new Map([["field",c.A.initializeOnly],["eventIn",c.A.inputOnly],["eventOut",c.A.outputOnly],["exposedField",c.A.inputOutput],["initializeOnly",c.A.initializeOnly],["inputOnly",c.A.inputOnly],["outputOnly",c.A.outputOnly],["inputOutput",c.A.inputOutput]]),SFImage:new r.A.SFImage,SFNode:new r.A.SFNode,MFString:new r.A.MFString,Color3:new d.A,Color4:new p.A,Matrix3:new g.A,Matrix4:new f.A,Rotation4:new m.A,Vector2:new A.A,Vector3:new _.A,Vector4:new y.A,CONSTANTS:new Map([["NAN",Number.NaN],["INFINITY",Number.POSITIVE_INFINITY],["INF",Number.POSITIVE_INFINITY],["PI",Math.PI],["PI2",2*Math.PI],["PI1_4",1*Math.PI/4],["PI2_4",2*Math.PI/4],["PI3_4",3*Math.PI/4],["PI4_4",4*Math.PI/4],["PI5_4",5*Math.PI/4],["PI6_4",6*Math.PI/4],["PI7_4",7*Math.PI/4],["PI8_4",8*Math.PI/4],["PI1_2",1*Math.PI/2],["PI2_2",2*Math.PI/2],["PI3_2",3*Math.PI/2],["PI4_2",4*Math.PI/2],["PI1_3",1*Math.PI/3],["PI2_3",2*Math.PI/3],["PI3_3",3*Math.PI/3],["PI4_3",4*Math.PI/3],["PI5_3",5*Math.PI/3],["PI6_3",6*Math.PI/3],["SQRT1_2",Math.SQRT1_2],["SQRT2",Math.SQRT2]]),unknownLevel:0,getEncoding:()=>"STRING",setInput(e){this.input=e,this.lineNumber=1,this.lastIndex=0},isValid(){return"string"==typeof this.input&&(!this.input.match(/^#VRML V1.0/)&&!!this.input.match(/^(?:#X3D|#VRML|(?:[\x20\n,\t\r]*|#.*?[\r\n])*(PROFILE|COMPONENT|META|UNIT|EXTERNPROTO|PROTO|DEF|NULL|IMPORT|EXPORT|ROUTE|\w+(?:[\x20\n,\t\r]*|#.*?[\r\n])\{|$))/))},parseIntoScene(e,t){try{this.resolve=e,this.reject=t,this.getScene().setEncoding("VRML"),this.getScene().setProfile(this.getBrowser().getProfile("Full")),this.x3dScene()}catch(e){throw new Error(this.getError(e))}},getError(e){w.A&&console.error(e);const t=e.message,i=this.lastIndex===this.input.length?"Unexpected end of file. ":"";let n=this.getLine(),s=this.getLastLine(),r=this.getLastLine(),o=s.length-n.length+1;s.length>80&&(s=s.substring(o-40,o+40),r="",o=40);let a=this.getExecutionContext().getWorldURL();a.startsWith("data:")&&(a=a.substring(0,a.indexOf(",")));return`\n********************************************************************************\nParser error at line ${this.lineNumber}:${o}\nin '${a}'\n\n${r}\n${s}\n${Array(o).join(" ")}^\n${i}${t}\n********************************************************************************\n`},getLine(){let e=this.input,t=this.lastIndex,i="";for(;t<e.length&&"\n"!==e[t]&&"\r"!==e[t];)i+=e[t++];return this.lastIndex=t,i},getLastLine(){let e=this.input,t=Math.min(this.lastIndex,this.input.length-1),i="";for(t<e.length&&("\n"!==e[t]||"\r"!==e[t])&&--t;t>=0&&"\n"!==e[t]&&"\r"!==e[t];)i=e[t--]+i;return this.lastIndex=t,i},comments(){for(;this.comment(););},comment(){return!!this.whitespaces()||this.Grammar.Comment.parse(this)},whitespaces(){return!!S.Whitespaces.parse(this)&&(this.lines(this.result[0]),!0)},lines(e){const t=e.match(S.Break);t&&(this.lineNumber+=t.length)},x3dScene:(()=>{const e=["EnvironmentalSensor","PointingDeviceSensor","Scripting","Sound","Text"];return function(){const t=this.getBrowser(),i=this.getScene();if(this.headerStatement(),this.profileStatement(),this.componentStatements(),this.unitStatements(),this.metaStatements(),"2.0"===i.getSpecificationVersion()){i.setProfile(t.getProfile("Interchange"));for(const n of e)i.updateComponent(t.getComponent(n))}if(this.resolve)t.loadComponents(i).then(()=>{try{if(this.statements(this.getExecutionContext().rootNodes),this.setupNodes(),this.lastIndex<this.input.length)throw new Error("Unknown statement.");this.resolve(i)}catch(e){throw new Error(this.getError(e))}}).catch(this.reject);else if(this.statements(this.getExecutionContext().rootNodes),this.setupNodes(),this.lastIndex<this.input.length)throw new Error("Unknown statement.")}})(),headerStatement(){return!!S.Header.parse(this)&&(this.lines(this.result[0]),this.getScene().setSpecificationVersion(this.result[2]),this.getScene().getSpecificationVersion()<=3.2&&(this.Grammar.Comment=S.Comment3_2),!0)},profileStatement(){if(this.comments(),S.PROFILE.parse(this)){if(this.profileNameId()){const e=this.getBrowser().getProfile(this.result[0]);return void this.getScene().setProfile(e)}throw new Error("Expected a profile name.")}},componentStatements(){let e;for(;e=this.componentStatement();)this.getScene().hasComponent(e)||this.getScene().updateComponent(e)},componentStatement(){if(this.comments(),S.COMPONENT.parse(this)){if(this.componentNameId()){const e=this.result[0];if(this.comments(),S.Colon.parse(this)){if(this.componentSupportLevel()){const t=this.value;return this.getBrowser().getComponent(e,t)}throw new Error("Expected a component support level.")}throw new Error("Expected a ':' after component name.")}throw new Error("Expected a component name.")}return null},componentSupportLevel(){return this.int32()},unitStatements(){for(;this.unitStatement(););},unitStatement(){if(this.comments(),S.UNIT.parse(this)){if(this.categoryNameId()){const e=this.result[0];if(this.unitNameId()){const t=this.result[0];if(this.unitConversionFactor()){const i=this.value;try{return this.getScene().updateUnit(e,t,i),!0}catch(e){return console.warn(`Parser error at line ${this.lineNumber}: ${e.message}`),!0}}throw new Error("Expected unit conversion factor.")}throw new Error("Expected unit name identifier.")}throw new Error("Expected category name identifier after UNIT statement.")}return!1},unitConversionFactor(){return this.double()},metaStatements(){for(;this.metaStatement(););},metaStatement(){if(this.comments(),S.META.parse(this)){if(this.metaKey()){const e=this.value;if(this.metaValue()){const t=this.value;return this.getScene().addMetaData(e,t),!0}throw new Error("Expected metadata value.")}throw new Error("Expected metadata key.")}return!1},metaKey(){return this.string()},metaValue(){return this.string()},exportStatement(){if(this.comments(),S.EXPORT.parse(this)){if(this.nodeNameId()){const e=this.result[0];this.comments();const t=this.getScene().getLocalNode(e);let i;if(S.AS.parse(this)){if(!this.exportedNodeNameId())throw new Error("No name given after AS.");i=this.result[0]}else i=e;try{const e=this.getScene().getExportedNode(i);this.getScene().addExportedNode(this.getScene().getUniqueExportName(i),e)}catch{}return this.getScene().updateExportedNode(i,t),!0}throw new Error("No name given after EXPORT.")}return!1},importStatement(){if(this.comments(),S.IMPORT.parse(this)){if(this.nodeNameId()){const e=this.result[0],t=this.getExecutionContext().getNamedNode(e);if(this.comments(),S.Period.parse(this)){if(this.exportedNodeNameId()){const e=this.result[0];let i;if(this.comments(),S.AS.parse(this)){if(!this.nodeNameId())throw new Error("No name given after AS.");i=this.result[0]}else i=e;return this.renameExistingNode(i),this.getExecutionContext().addImportedNode(t,e,i),this.getImportedNodes().has(i)||this.getImportedNodes().set(i,this.getExecutionContext().getImportedNodes().get(i)),!0}throw new Error("Expected exported node name.")}throw new Error("Expected a '.' after exported node name.")}throw new Error("No name given after IMPORT statement.")}return!1},statements(e){for(;this.statement(e););},statement(e){if(this.protoStatement())return!0;if(this.routeStatement())return!0;if(this.importStatement())return!0;if(this.exportStatement())return!0;const t=this.nodeStatement();return!1!==t&&(e.push(t),!0)},nodeStatement(){if(this.comments(),S.DEF.parse(this)){if(this.nodeNameId())return this.node(this.result[0]);throw new Error("No name given after DEF.")}if(S.USE.parse(this)){if(this.nodeNameId()){const e=this.result[0];try{const t=this.getExecutionContext().getLocalNode(e);return t instanceof a.A?t.getExportedNode():t.getValue()}catch{const t=this.getPlaceholders().get(e);if(t)return t;{const t=new u.A(this,e);return this.getPlaceholders().set(e,t),t}}}throw new Error("No name given after USE.")}return S.NULL.parse(this)?null:this.node("")},protoStatement(){return!!this.proto()||!!this.externproto()},protoStatements(){for(;this.protoStatement(););},proto(){if(this.comments(),S.PROTO.parse(this)){if(this.nodeTypeId()){const e=this.result[0];if(this.comments(),S.OpenBracket.parse(this)){const t=this.interfaceDeclarations();if(this.comments(),S.CloseBracket.parse(this)){if(this.comments(),S.OpenBrace.parse(this)){const i=new h.A(this.getExecutionContext());for(const e of t)i.addUserDefinedField(e.getAccessType(),e.getName(),e);if(this.pushExecutionContext(i.getBody()),this.protoBody(i.getBody().rootNodes),this.setupNodes(),this.popExecutionContext(),this.comments(),S.CloseBrace.parse(this)){i.setup();try{const t=this.getExecutionContext().getProtoDeclaration(e);console.warn(`A proto named '${e}' is already defined and will be overridden.`),this.getExecutionContext().updateProtoDeclaration(this.getExecutionContext().getUniqueProtoName(e),t)}catch{}return this.getExecutionContext().updateProtoDeclaration(e,i),!0}throw new Error("Expected a '}' at the end of PROTO body.")}throw new Error("Expected a '{' at the beginning of PROTO body.")}throw new Error("Expected a ']' at the end of PROTO interface declaration.")}throw new Error("Expected a '[' at the beginning of PROTO interface declaration.")}throw new Error("Invalid PROTO definition name.")}return!1},protoBody(e){this.protoStatements();const t=this.rootNodeStatement();!1!==t&&e.push(t),this.statements(e)},rootNodeStatement(){if(this.comments(),S.DEF.parse(this)){if(this.nodeNameId()){const e=this.result[0],t=this.node(e);if(!1!==t)return t;throw new Error("Expected node type name after DEF.")}throw new Error("No name given after DEF.")}const e=this.node("");return!1!==e&&e},interfaceDeclarations(){const e=[];let t;for(;t=this.interfaceDeclaration();)e.push(t);return e},restrictedInterfaceDeclaration(){if(this.comments(),S.inputOnly.parse(this)||S.eventIn.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.inputOnlyId()){const t=this.result[0],i=new r.A[e];return i.setAccessType(c.A.inputOnly),i.setName(t),i}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}if(S.outputOnly.parse(this)||S.eventOut.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.outputOnlyId()){const t=this.result[0],i=new r.A[e];return i.setAccessType(c.A.outputOnly),i.setName(t),i}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}if(S.initializeOnly.parse(this)||S.field.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.initializeOnlyId()){const t=this.result[0],i=new r.A[e];if(this.fieldValue(i))return i.setAccessType(c.A.initializeOnly),i.setName(t),i;throw new Error(`Couldn't read value for field '${t}'.`)}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}return null},interfaceDeclaration(){const e=this.restrictedInterfaceDeclaration();if(e)return e;if(this.comments(),S.inputOutput.parse(this)||S.exposedField.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.inputOutputId()){const t=this.result[0],i=new r.A[e];if(this.fieldValue(i))return i.setAccessType(c.A.inputOutput),i.setName(t),i;throw new Error(`Couldn't read value for field '${t}'.`)}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}return null},externproto(){if(this.comments(),S.EXTERNPROTO.parse(this)){if(this.nodeTypeId()){const e=this.result[0];if(this.comments(),S.OpenBracket.parse(this)){const t=this.externInterfaceDeclarations();if(this.comments(),S.CloseBracket.parse(this)){if(this.URLList(this.MFString)){const i=new l.A(this.getExecutionContext(),this.MFString);for(const e of t)i.addUserDefinedField(e.getAccessType(),e.getName(),e);i.setup();try{const t=this.getExecutionContext().getExternProtoDeclaration(e);console.warn(`A extern proto named '${e}' is already defined and will be overridden.`),this.getExecutionContext().updateExternProtoDeclaration(this.getExecutionContext().getUniqueExternProtoName(e),t)}catch{}return this.getExecutionContext().updateExternProtoDeclaration(e,i),!0}throw new Error(`Expected a URL list after EXTERNPROTO interface declaration '${e}'.`)}throw new Error("Expected a ']' at the end of EXTERNPROTO interface declaration.")}throw new Error("Expected a '[' at the beginning of EXTERNPROTO interface declaration.")}throw new Error("Invalid EXTERNPROTO definition name.")}return!1},externInterfaceDeclarations(){const e=[];let t;for(;t=this.externInterfaceDeclaration();)e.push(t);return e},externInterfaceDeclaration(){if(this.comments(),S.inputOnly.parse(this)||S.eventIn.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.inputOnlyId()){const t=this.result[0],i=new r.A[e];return i.setAccessType(c.A.inputOnly),i.setName(t),i}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}if(S.outputOnly.parse(this)||S.eventOut.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.outputOnlyId()){const t=this.result[0],i=new r.A[e];return i.setAccessType(c.A.outputOnly),i.setName(t),i}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}if(S.initializeOnly.parse(this)||S.field.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.initializeOnlyId()){const t=this.result[0],i=new r.A[e];return i.setAccessType(c.A.initializeOnly),i.setName(t),i}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}if(S.inputOutput.parse(this)||S.exposedField.parse(this)){if(this.fieldType()){const e=this.result[0];if(this.inputOutputId()){const t=this.result[0],i=new r.A[e];return i.setAccessType(c.A.inputOutput),i.setName(t),i}throw new Error("Expected a name for field.")}throw this.Id(),new Error(`Unknown event or field type: '${this.result[0]}'.`)}return null},URLList(e){return this.mfstringValue(e)},routeStatement(){if(this.comments(),S.ROUTE.parse(this)){if(this.nodeNameId()){const e=this.result[0],t=this.getExecutionContext().getLocalNode(e);if(this.comments(),S.Period.parse(this)){if(this.outputOnlyId()){const e=this.result[0];if(this.comments(),S.TO.parse(this)){if(this.nodeNameId()){const i=this.result[0],n=this.getExecutionContext().getLocalNode(i);if(this.comments(),S.Period.parse(this)){if(this.inputOnlyId())try{const i=this.result[0];return this.getExecutionContext().addRoute(t,e,n,i),!0}catch(e){return console.warn(`Parser error at line ${this.lineNumber}: ${e.message}`),!0}throw new Error("Bad ROUTE specification: Expected a field name.")}throw new Error("Bad ROUTE specification: Expected a '.' after node name.")}throw new Error("Bad ROUTE specification: Expected a node name.")}throw new Error("Bad ROUTE specification: Expected a 'TO'.")}throw new Error("Bad ROUTE specification: Expected a field name.")}throw new Error("Bad ROUTE specification: Expected a '.' after node name.")}throw new Error("Bad ROUTE specification: Expected a node name.")}return!1},node(e){if(this.nodeTypeId()){const t=this.result[0],i=this.getExecutionContext().createNode(t,!1)??this.getExecutionContext().createProto(t,!1);if(!i)return this.unknownLevel||console.warn(`Parser error at line ${this.lineNumber}: Unknown node type or proto '${t}'. You probably have insufficient component/profile statements, and/or an inappropriate specification version.`),this.comments(),!(!S.OpenBrace.parse(this)||(++this.unknownLevel,this.nodeBody(this.getExecutionContext().createNode("WorldInfo",!1)),--this.unknownLevel,this.comments(),!S.CloseBrace.parse(this)))&&null;if(e.length&&(this.getNamedNodes().has(e)||this.getNamedNodes().set(e,i),this.renameExistingNode(e),this.getExecutionContext().updateNamedNode(e,i)),this.comments(),S.OpenBrace.parse(this)){if(i.canUserDefinedFields()?this.scriptBody(i):this.nodeBody(i),this.comments(),S.CloseBrace.parse(this))return this.isInsideProtoDeclaration()||this.getNodes().push(i),i;throw new Error("Expected '}' at the end of node body.")}throw new Error("Expected '{' at the beginning of node body.")}return!1},scriptBody(e){for(;this.scriptBodyElement(e););},scriptBodyElement(e){const{lastIndex:t,lineNumber:i}=this;if(this.Id()){const t=this.accessTypes.get(this.result[0]);if(t&&this.fieldType()){const i=this.result[0];if(this.Id()){const n=this.result[0];if(this.comments(),S.IS.parse(this)){if(this.isInsideProtoDeclaration()){if(this.Id()){const s=this.result[0];let o;try{o=this.getOuterNode().getField(s)}catch{return console.warn(`Parser error at line ${this.lineNumber}: No such event or field '${s}' inside PROTO ${this.getOuterNode().getName()} interface declaration.`),!0}if(c.A[i]===o.getType()){if(o.isReference(t)){let s=b.try(()=>e.getUserDefinedField(n));if(s||(s=new r.A[i],e.addUserDefinedField(t,n,s)),t===s.getAccessType()&&o.getType()===s.getType())return s.addReference(o),!0;throw new Error(`Couldn't add field '${n}', field already exists with different access type or data type.`)}throw new Error(`Field '${n}' and '${o.getName()}' in PROTO '${this.getOuterNode().getName()}' are incompatible as an IS mapping.`)}throw new Error(`Field '${n}' and '${o.getName()}' in PROTO '${this.getOuterNode().getName()}' have different types.`)}throw new Error("No name give after IS statement.")}throw new Error("IS statement outside PROTO definition.")}}}}this.lastIndex=t,this.lineNumber=i;const n=this.interfaceDeclaration();if(n){const t=b.try(()=>e.getUserDefinedField(n.getName()));if(t){if(t.getAccessType()===n.getAccessType()&&t.getType()===n.getType())return t.assign(n),!0;throw new Error(`Couldn't set value for field '${n.getName()}', field already exists with different access type or data type.`)}return e.addUserDefinedField(n.getAccessType(),n.getName(),n),!0}return this.nodeBodyElement(e)},nodeBody(e){for(;this.nodeBodyElement(e););},nodeBodyElement(e){if(this.protoStatement())return!0;if(this.routeStatement())return!0;if(this.Id()){const t=this.result[0];let i;try{i=e.getPredefinedField(t)}catch{const{lastIndex:i,lineNumber:n}=this;if(this.unknownValue())return this.unknownLevel||console.warn(`Parser error at line ${n}: Unknown field '${t}' in class '${e.getTypeName()}'.`),!0;throw this.lastIndex=i,this.lineNumber=n,new Error(`Unknown field '${t}' in class '${e.getTypeName()}'.`)}if(this.comments(),S.IS.parse(this)){if(this.isInsideProtoDeclaration()){if(this.Id()){const e=this.result[0];let t;try{t=this.getOuterNode().getField(e)}catch{return console.warn(`Parser error at line ${this.lineNumber}: No such event or field '${e}' inside PROTO ${this.getOuterNode().getName()}`),!0}if(i.getType()===t.getType()){if(t.isReference(i.getAccessType()))return i.addReference(t),!0;throw new Error(`Field '${i.getName()}' and '${t.getName()}' in PROTO ${this.getOuterNode().getName()} are incompatible as an IS mapping.`)}throw new Error(`Field '${i.getName()}' and '${t.getName()}' in PROTO ${this.getOuterNode().getName()} have different types.`)}throw new Error("No name give after IS statement.")}throw new Error("IS statement outside PROTO definition.")}if(i.isInitializable()){if(this.fieldValue(i))return!0;throw new Error(`Couldn't read value for field '${t}'.`)}if(!this.unknownValue())throw new Error(`Couldn't read value for field '${t}'.`);return console.warn(`Parser error at line ${this.lineNumber}: Couldn't assign value to ${this.accessTypeToString(i.getAccessType())} field '${t}'.`),!0}return!1},profileNameId(){return this.Id()},componentNameId(){return this.comments(),S.ComponentNameId.parse(this)},categoryNameId(){return this.Id()},unitNameId(){return this.Id()},exportedNodeNameId(){return this.Id()},nodeNameId(){return this.Id()},nodeTypeId(){return this.Id()},initializeOnlyId(){return this.Id()},inputOnlyId(){return this.Id()},outputOnlyId(){return this.Id()},inputOutputId(){return this.Id()},Id(){return this.comments(),S.Id.parse(this)},fieldType(){return this.comments(),S.FieldType.parse(this)},fieldValue(e){return this[e.getType()](e,e.getUnit())},bool(){return this.comments(),S.TRUE.parse(this)?(this.value=!0,!0):!!S.FALSE.parse(this)&&(this.value=!1,!0)},double(){return this.comments(),S.double.parse(this)?(this.value=parseFloat(this.result[0]),!0):!!S.CONSTANTS.parse(this)&&(this.value=this.CONSTANTS.get(this.result[2].toUpperCase()),"-"===this.result[1]&&(this.value=-this.value),!0)},int32(){return this.comments(),!!S.int32.parse(this)&&(this.value=parseInt(this.result[0]),!0)},string(){if(this.comments(),S.doubleQuotes.parse(this)){let e="";for(;S.noDoubleQuotes.parse(this);){e+=this.result[0];const t=e.match(/\\+$/);if(!t||t[0].length%2==0)break;S.doubleQuotes.parse(this),e+='"'}if(S.doubleQuotes.parse(this))return this.lines(e),this.value=r.A.SFString.unescape(e),!0}return!1},sfboolValue(e){return!!this.bool()&&(e.setValue(this.value),!0)},mfboolValue(e){if(e.length=0,this.bool())return e.push(this.value),!0;if(S.OpenBracket.parse(this)){if(this.sfboolValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfboolValues(e){const t=[];for(;this.bool();)t.push(this.value);return e.setValue(t),0!==e.length},sfcolorValue(e){const t=this.lastIndex;if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;return e.r=t,e.g=i,e.b=n,!0}}}if(this.lastIndex=t,this.comments(),S.HTMLColor.parse(this)){const t=this.convertColor(this.result[0].replace(/0x/i,"#"));return e.r=t[0],e.g=t[1],e.b=t[2],!0}return!1},mfcolorValue(e){if(e.length=0,this.sfcolorValue(this.Color3))return e.push(this.Color3),!0;if(S.OpenBracket.parse(this)){if(this.sfcolorValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfcolorValues(e){const t=[];for(;this.double();)t.push(this.value);return e.setValue(t),0!==e.length},sfcolorrgbaValue(e){const t=this.lastIndex;if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;if(this.double()){const s=this.value;return e.r=t,e.g=i,e.b=n,e.a=s,!0}}}}if(this.lastIndex=t,this.comments(),S.HTMLColor.parse(this)){const t=this.convertColor(this.result[0].replace(/0x/i,"#"));return e.r=t[0],e.g=t[1],e.b=t[2],e.a=t[3],!0}return!1},mfcolorrgbaValue(e){if(e.length=0,this.sfcolorrgbaValue(this.Color4))return e.push(this.Color4),!0;if(S.OpenBracket.parse(this)){if(this.sfcolorValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfdoubleValue(e){return!!this.double()&&(e.setValue(this.fromUnit(e.getUnit(),this.value)),!0)},mfdoubleValue(e){if(e.length=0,this.double())return e.push(this.fromUnit(e.getUnit(),this.value)),!0;if(S.OpenBracket.parse(this)){if(this.sfdoubleValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfdoubleValues(e){const t=e.getUnit(),i=[];for(;this.double();)i.push(this.fromUnit(t,this.value));return e.setValue(i),0!==e.length},sfimageValue(e){if(this.int32()){const t=this.value;if(this.int32()){const i=this.value;if(this.int32()){const n=this.value,s=t*i,r=[];for(let e=0;e<s;++e){if(!this.int32())return!1;r.push(this.value)}return e.width=t,e.height=i,e.comp=n,e.array=r,!0}}}return!1},mfimageValue(e){if(e.length=0,this.sfimageValue(this.SFImage))return e.push(this.SFImage),!0;if(S.OpenBracket.parse(this)){if(this.sfimageValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfimageValues(e){e.length=0;const t=e.getTarget(),i=this.SFImage;for(;this.sfimageValue(i);)t.push(i);return 0!==e.length},sfint32Value(e){return!!this.int32()&&(e.setValue(this.value),!0)},mfint32Value(e){if(e.length=0,this.int32())return e.push(this.value),!0;if(S.OpenBracket.parse(this)){if(this.sfint32Values(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfint32Values(e){const t=[];for(;this.int32();)t.push(this.value);return e.setValue(t),0!==e.length},sfmatrix3Value(e){if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;if(this.double()){const s=this.value;if(this.double()){const r=this.value;if(this.double()){const o=this.value;if(this.double()){const a=this.value;if(this.double()){const l=this.value;if(this.double()){const h=this.value;return e[0]=t,e[1]=i,e[2]=n,e[3]=s,e[4]=r,e[5]=o,e[6]=a,e[7]=l,e[8]=h,!0}}}}}}}}}return!1},mfmatrix3Value(e){if(e.length=0,this.sfmatrix3Value(this.Matrix3))return e.push(this.Matrix3),!0;if(S.OpenBracket.parse(this)){if(this.sfmatrixValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfmatrixValues(e){const t=[];for(;this.double();)t.push(this.value);return e.setValue(t),0!==e.length},sfmatrix4Value(e){if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;if(this.double()){const s=this.value;if(this.double()){const r=this.value;if(this.double()){const o=this.value;if(this.double()){const a=this.value;if(this.double()){const l=this.value;if(this.double()){const h=this.value;if(this.double()){const c=this.value;if(this.double()){const u=this.value;if(this.double()){const d=this.value;if(this.double()){const p=this.value;if(this.double()){const g=this.value;if(this.double()){const f=this.value;if(this.double()){const m=this.value;return e[0]=t,e[1]=i,e[2]=n,e[3]=s,e[4]=r,e[5]=o,e[6]=a,e[7]=l,e[8]=h,e[9]=c,e[10]=u,e[11]=d,e[12]=p,e[13]=g,e[14]=f,e[15]=m,!0}}}}}}}}}}}}}}}}return!1},mfmatrix4Value(e){if(e.length=0,this.sfmatrix4Value(this.Matrix4))return e.push(this.Matrix4),!0;if(S.OpenBracket.parse(this)){if(this.sfmatrixValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfnodeValue(e){const t=this.nodeStatement();return!1!==t&&(e.setValue(t),!0)},mfnodeValue(e){e.length=0;const t=this.nodeStatement();if(!1!==t)return e.push(t),!0;if(S.OpenBracket.parse(this)){if(this.nodeStatements(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},nodeStatements(e){this.statements(e)},sfrotationValue(e){if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;if(this.double()){const s=this.value;return e.x=t,e.y=i,e.z=n,e.angle=this.fromUnit("angle",s),!0}}}}return!1},mfrotationValue(e){if(e.length=0,this.sfrotationValue(this.Rotation4))return e.push(this.Rotation4),!0;if(S.OpenBracket.parse(this)){if(this.sfrotationValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfrotationValues(e){e.length=0;const t=e.getTarget(),i=this.Rotation4;for(;this.sfrotationValue(i);)t.push(i);return 0!==e.length},sfstringValue(e){return!!this.string()&&(e.setValue(this.value),!0)},mfstringValue(e){if(e.length=0,this.string())return e.push(this.value),!0;if(S.OpenBracket.parse(this)){if(this.sfstringValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfstringValues(e){const t=[];for(;this.string();)t.push(this.value);return e.setValue(t),0!==e.length},sfvec2Value(e,t){if(this.double()){const i=this.value;if(this.double()){const n=this.value;return e.x=this.fromUnit(t,i),e.y=this.fromUnit(t,n),!0}}return!1},mfvec2Value(e){if(e.length=0,this.sfvec2Value(this.Vector2,e.getUnit()))return e.push(this.Vector2),!0;if(S.OpenBracket.parse(this)){if(this.sfvecValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfvecValues(e){const t=e.getUnit(),i=[];for(;this.double();)i.push(this.fromUnit(t,this.value));return e.setValue(i),0!==e.length},sfvec3Value(e,t){if(this.double()){const i=this.value;if(this.double()){const n=this.value;if(this.double()){const s=this.value;return e.x=this.fromUnit(t,i),e.y=this.fromUnit(t,n),e.z=this.fromUnit(t,s),!0}}}return!1},mfvec3Value(e){if(e.length=0,this.sfvec3Value(this.Vector3,e.getUnit()))return e.push(this.Vector3),!0;if(S.OpenBracket.parse(this)){if(this.sfvecValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfvec4Value(e,t){if(this.double()){const i=this.value;if(this.double()){const n=this.value;if(this.double()){const s=this.value;if(this.double()){const r=this.value;return e.x=this.fromUnit(t,i),e.y=this.fromUnit(t,n),e.z=this.fromUnit(t,s),e.w=this.fromUnit(t,r),!0}}}}return!1},mfvec4Value(e){if(e.length=0,this.sfvec4Value(this.Vector4,e.getUnit()))return e.push(this.Vector4),!0;if(S.OpenBracket.parse(this)){if(this.sfvecValues(e),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},unknownValue(){try{return++this.unknownLevel,this.comments(),!!(S.IS.parse(this)&&this.isInsideProtoDeclaration()&&this.Id())||!!this.mfunknownValue()}finally{--this.unknownLevel}},sfunknownValue(){return!!this.sfboolValue(new r.A.SFBool)||(!!this.sfdoubleValues(new r.A.MFFloat)||(!!this.sfstringValue(new r.A.SFString)||!!this.sfnodeValue(new r.A.SFNode)))},mfunknownValue(){if(this.sfunknownValue())return!0;if(S.OpenBracket.parse(this)){if(this.sfunknownValues(),S.CloseBracket.parse(this))return!0;throw new Error("Expected ']'.")}return!1},sfunknownValues(){for(;this.sfunknownValue(););},accessTypeToString(e){switch(e){case c.A.initializeOnly:return"initializeOnly";case c.A.inputOnly:return"inputOnly";case c.A.outputOnly:return"outputOnly";case c.A.inputOutput:return"inputOutput"}}}),Object.assign(T.prototype,{[c.A.SFBool]:T.prototype.sfboolValue,[c.A.SFColor]:T.prototype.sfcolorValue,[c.A.SFColorRGBA]:T.prototype.sfcolorrgbaValue,[c.A.SFDouble]:T.prototype.sfdoubleValue,[c.A.SFFloat]:T.prototype.sfdoubleValue,[c.A.SFImage]:T.prototype.sfimageValue,[c.A.SFInt32]:T.prototype.sfint32Value,[c.A.SFMatrix3f]:T.prototype.sfmatrix3Value,[c.A.SFMatrix3d]:T.prototype.sfmatrix3Value,[c.A.SFMatrix4f]:T.prototype.sfmatrix4Value,[c.A.SFMatrix4d]:T.prototype.sfmatrix4Value,[c.A.SFNode]:T.prototype.sfnodeValue,[c.A.SFRotation]:T.prototype.sfrotationValue,[c.A.SFString]:T.prototype.sfstringValue,[c.A.SFTime]:T.prototype.sfdoubleValue,[c.A.SFVec2d]:T.prototype.sfvec2Value,[c.A.SFVec2f]:T.prototype.sfvec2Value,[c.A.SFVec3d]:T.prototype.sfvec3Value,[c.A.SFVec3f]:T.prototype.sfvec3Value,[c.A.SFVec4d]:T.prototype.sfvec4Value,[c.A.SFVec4f]:T.prototype.sfvec4Value,[c.A.VrmlMatrix]:T.prototype.sfmatrix4Value,[c.A.MFBool]:T.prototype.mfboolValue,[c.A.MFColor]:T.prototype.mfcolorValue,[c.A.MFColorRGBA]:T.prototype.mfcolorrgbaValue,[c.A.MFDouble]:T.prototype.mfdoubleValue,[c.A.MFFloat]:T.prototype.mfdoubleValue,[c.A.MFImage]:T.prototype.mfimageValue,[c.A.MFInt32]:T.prototype.mfint32Value,[c.A.MFMatrix3d]:T.prototype.mfmatrix3Value,[c.A.MFMatrix3f]:T.prototype.mfmatrix3Value,[c.A.MFMatrix4d]:T.prototype.mfmatrix4Value,[c.A.MFMatrix4f]:T.prototype.mfmatrix4Value,[c.A.MFNode]:T.prototype.mfnodeValue,[c.A.MFRotation]:T.prototype.mfrotationValue,[c.A.MFString]:T.prototype.mfstringValue,[c.A.MFTime]:T.prototype.mfdoubleValue,[c.A.MFVec2d]:T.prototype.mfvec2Value,[c.A.MFVec2f]:T.prototype.mfvec2Value,[c.A.MFVec3d]:T.prototype.mfvec3Value,[c.A.MFVec3f]:T.prototype.mfvec3Value,[c.A.MFVec4d]:T.prototype.mfvec4Value,[c.A.MFVec4f]:T.prototype.mfvec4Value}),o.A.prototype.fromVRMLString=function(e,t){const i=new T(t);if(i.setUnits(!!t),i.setInput(e),!i.fieldValue(this))throw new Error(`Couldn't read value for field '${this.getName()}'.`);i.setupNodes()};const v=T,O=x.A.add("VRMLParser",v)},2695(e,t,i){i.d(t,{l:()=>n});const n=function(e,t=""){if((t=String(t))&&!e.has(t))return t;if((t=t.replace(/_\d+$/,""))&&!e.has(t))return t;let i,n="",s=1;do{i=s,s<<=1,n=`${t}_${i}`}while(e.has(n));if(i>>>=1,s>>>=1,i&&s){for(;i<s;){const n=i+s>>>1;e.has(`${t}_${n}`)?i=n+1:s=n}n=`${t}_${i}`}return n}},2696(e,t,i){i.d(t,{A:()=>s});const n={};Object.defineProperty(n,"add",{value(e,t){if(n.hasOwnProperty(e))return console.error(new Error(`Namespace: "${e}" already exists.`)),t;const i=window[Symbol.for("X_ITE.X3D-12.2.4")];return i&&(i[e]=t),n[e]=t}});const s=n.add("Namespace",n)},2743(e,t,i){i.d(t,{A:()=>c});var n=i(8001),s=i(2361),r=i(5053),o=i(2696);const a=new Uint8Array([255,255,255,255]);function l(e){s.A.call(this,e),this.addType(r.A.X3DTexture2DNode);const t=this.getBrowser().getContext();this.target=t.TEXTURE_2D,this.width=0,this.height=0}Object.assign(Object.setPrototypeOf(l.prototype,s.A.prototype),{initialize(){s.A.prototype.initialize.call(this),this._repeatS.addInterest("updateTextureParameters",this),this._repeatT.addInterest("updateTextureParameters",this);const e=this.getBrowser().getContext();e.bindTexture(e.TEXTURE_2D,this.getTexture()),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a)},getTarget(){return this.target},getWidth(){return this.width},setWidth(e){this.width=e},getHeight(){return this.height},setHeight(e){this.height=e},clearTexture(){this.setTextureData(1,1,!1,!1,a)},getTextureData(e=this.getTexture(),t=this.getWidth(),i=this.getHeight()){const n=this.getBrowser().getContext(),s=n.createFramebuffer(),r=new Uint8Array(t*i*4);return n.bindFramebuffer(n.FRAMEBUFFER,s),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),n.readPixels(0,0,t,i,n.RGBA,n.UNSIGNED_BYTE,r),n.deleteFramebuffer(s),r},setTextureData(e,t,i,n,s){this.width=e,this.height=t;const r=this.getBrowser().getContext(),o=r.getParameter(r.MAX_TEXTURE_SIZE);if(e>o||t>o)throw new Error(`At least one dimension (${e} × ${t}) is greater than the maximum texture size (${o} px).`);r.bindTexture(r.TEXTURE_2D,this.getTexture()),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,i?r.BROWSER_DEFAULT_WEBGL:r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,t,0,r.RGBA,r.UNSIGNED_BYTE,s),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL),this.setTransparent(n),this.updateTextureParameters(),this.addNodeEvent()},updateTextureData(e){const t=this.getBrowser().getContext();t.bindTexture(t.TEXTURE_2D,this.getTexture()),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,e),this.texturePropertiesNode._generateMipMaps.getValue()&&t.generateMipmap(t.TEXTURE_2D),this.addNodeEvent()},updateTextureParameters(){s.A.prototype.updateTextureParameters.call(this,this.target,this._textureProperties.getValue(),this.texturePropertiesNode,this.width,this.height,this._repeatS.getValue(),this._repeatT.getValue(),!1)},setShaderUniforms(e,t){const i=this.getBrowser().popTextureUnit();e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this.getTexture()),e.uniform1i(t.texture2D,i)}}),Object.defineProperties(l,n.A.getStaticProperties("X3DTexture2DNode","Texturing",1));const h=l,c=o.A.add("X3DTexture2DNode",h)},2804(e,t,i){i.d(t,{A:()=>T});var n=i(8381),s=i(5053),r=i(8944),o=i(991),a=i(2696);const l=Symbol(),h=Symbol(),c=Symbol(),u=Symbol(),d=Symbol(),p=Symbol(),g=Symbol(),f=Symbol(),m=Symbol(),A=Symbol(),_=Symbol(),y=Symbol(),w=Symbol.for("X_ITE.X3DField.uniformLocation"),x=[];function b(e){n.A.call(this),this[l]=e}Object.assign(Object.setPrototypeOf(b.prototype,n.A.prototype),{[l]:void 0,[h]:s.A.initializeOnly,[c]:void 0,[u]:null,[d]:null,[p]:null,[g]:null,[f]:null,[m]:null,[A]:null,[w]:null,[_]:"",[y]:"",create(){return new this.constructor},equals(e){return this[l]===e.valueOf()},assign(e){this.set(e.getValue()),this.addEvent()},set(e){this[l]=e},setValue(e){this.set(e instanceof this.constructor?e.getValue():e),this.addEvent()},getValue(){return this[l]},getType(){return this.constructor.type},setAccessType(e){this[h]=e},getAccessType(){return this[h]},isInitializable(){return!!(this[h]&s.A.initializeOnly)},isInput(){return!!(this[h]&s.A.inputOnly)},isOutput(){return!!(this[h]&s.A.outputOnly)},isReadable(){return this[h]!==s.A.inputOnly},isWritable(){return this[h]!==s.A.outputOnly},setUnit(e){this[c]=e},getUnit(){return this[c]},isReference(e){return e===this[h]||e===s.A.inputOutput},addReference(e){const t=this.getReferences();if(!t.has(e)){switch(t.add(e),this.getAccessType()&e.getAccessType()){case s.A.initializeOnly:e.addFieldInterest(this),this.processEvent(r.A.from(e));break;case s.A.inputOnly:e.addFieldInterest(this);break;case s.A.outputOnly:this.addFieldInterest(e);break;case s.A.inputOutput:e.addFieldInterest(this),this.addFieldInterest(e),this.processEvent(r.A.from(e))}this.processReferencesCallbacks()}},removeReference(e){switch(this[u]?.delete(e),this.getAccessType()&e.getAccessType()){case s.A.initializeOnly:case s.A.inputOnly:e.removeFieldInterest(this);break;case s.A.outputOnly:this.removeFieldInterest(e);break;case s.A.inputOutput:e.removeFieldInterest(this),this.removeFieldInterest(e)}this.processReferencesCallbacks()},getReferences(){return this[u]??=new o.A},addReferencesCallback(e,t){this[d]=new Map(this[d]),this[d].set(e,t)},removeReferencesCallback(e){this[d]?.delete(e)},getReferencesCallbacks(){return this[d]??=new Map},processReferencesCallbacks(){for(const e of this[d]?.values()??x)e()},addFieldInterest(e){this.getFieldInterests().add(e)},removeFieldInterest(e){this[p]?.delete(e)},getFieldInterests(){return this[p]??=new o.A},addFieldCallback(e,t){this[g]=new Map(this[g]),this[g].set(e,t)},removeFieldCallback(e){this[g]?.delete(e)},getFieldCallbacks(){return this[g]??=new Map},addInputRoute(e){this.getInputRoutes().add(e),this.processRouteCallbacks()},removeInputRoute(e){this[f]?.delete(e),this.processRouteCallbacks()},getInputRoutes(){return this[f]??=new o.A},addOutputRoute(e){this.getOutputRoutes().add(e),this.processRouteCallbacks()},removeOutputRoute(e){this[m]?.delete(e),this.processRouteCallbacks()},getOutputRoutes(){return this[m]??=new o.A},addRouteCallback(e,t){this[A]=new Map(this[A]),this[A].set(e,t)},removeRouteCallback(e){this[A]?.delete(e)},getRouteCallbacks(){return this[A]??=new Map},processRouteCallbacks(){for(const e of this[A]?.values()??x)e()},processEvent(e=r.A.create(this)){e.add(this),this.setTainted(!1);const t=e.field;t!==this&&this.set(t.getValue(),t.length),this.processInterests();let i=!0;for(const t of this[p]??x)e.has(t)||(i?(i=!1,t.addEventObject(this,e)):t.addEventObject(this,r.A.copy(e)));i&&r.A.push(e);for(const e of this[g]?.values()??x)e(this.valueOf())},getAppInfo(){return this[_]},setAppInfo(e){this[_]=String(e)},setDocumentation(e){this[y]=String(e)},getDocumentation(){return this[y]},fromString(e,t){this.fromVRMLString(e,t)},fromVRMLString(e,t){},fromXMLString(e,t){},dispose(){for(const e of this[u]??x)e.removeFieldInterest(this);for(const e of Array.from(this[f]??x))e.dispose();for(const e of Array.from(this[m]??x))e.dispose();this[u]?.clear(),this[d]?.clear(),this[p]?.clear(),this[g]?.clear(),this[f]?.clear(),this[m]?.clear(),this[A]?.clear(),n.A.prototype.dispose.call(this)}});for(const e of Object.keys(b.prototype))Object.defineProperty(b.prototype,e,{enumerable:!1});const S=b,T=a.A.add("X3DField",S)},2844(e,t,i){i.d(t,{A:()=>l});var n=i(477),s=i(2696),r=i(5704);const o={area:(()=>{const e=new n.A,t=new n.A;return function(i,n,s){return e.assign(n).subtract(i).cross(t.assign(s).subtract(i)).norm()/2}})(),normal(e,t,i,n){const s=i.x-t.x,r=i.y-t.y,o=i.z-t.z,a=e.x-t.x,l=e.y-t.y,h=e.z-t.z;return n.set(r*h-o*l,o*a-s*h,s*l-r*a),n.normalize()},quadNormal(e,t,i,n,s){const r=i.x-e.x,o=i.y-e.y,a=i.z-e.z,l=n.x-t.x,h=n.y-t.y,c=n.z-t.z;return s.set(o*c-a*h,a*l-r*c,r*h-o*l),s.normalize()},triangulatePolygon:(()=>{const e=new r.GluTesselator;return e.gluTessCallback(r.gluEnum.GLU_TESS_VERTEX_DATA,function(e,t){t.push(e)}),e.gluTessCallback(r.gluEnum.GLU_TESS_COMBINE,function(e,t,i){return t[0]}),e.gluTessProperty(r.gluEnum.GLU_TESS_WINDING_RULE,r.windingRule.GLU_TESS_WINDING_ODD),function(t,i){e.gluTessBeginPolygon(i),e.gluTessBeginContour();for(const i of t)e.gluTessVertex(i,i.index);return e.gluTessEndContour(),e.gluTessEndPolygon(),i}})(),triangulateConvexPolygon(e,t){const i=e.length-1;for(let n=1;n<i;++n)t.push(e[0],e[n],e[n+1]);return t}},a=o,l=s.A.add("Triangle3",a)},2857(e,t,i){i.d(t,{A:()=>d});var n=i(8015),s=i(8001),r=i(5053),o=i(3281),a=i(2696);const l=(0,o.A)(h);function h(){this.fogMatrix=new Float32Array(9)}function c(e){this.addType(r.A.X3DFogObject),this.addChildObjects(r.A.inputOutput,"hidden",new n.A.SFBool),this._visibilityStart.setUnit("length"),this._visibilityRange.setUnit("length"),this.colorArray=new Float32Array(3)}Object.assign(h.prototype,{set(e,t){this.fogNode=e,this.fogMatrix.set(t.submatrix.inverse())},getFogType(){return this.fogNode.getFogType()},setShaderUniforms(e,t){if(t.hasFog(this))return;const i=this.fogNode;e.uniform3fv(t.x3d_FogColor,i.colorArray),e.uniform1f(t.x3d_FogVisibilityStart,i.visibilityStart),e.uniform1f(t.x3d_FogVisibilityRange,i.visibilityRange),e.uniformMatrix3fv(t.x3d_FogMatrix,!1,this.fogMatrix)},dispose(){l.push(this)}}),Object.assign(c.prototype,{initialize(){this._hidden.addInterest("set_fogType__",this),this._fogType.addInterest("set_fogType__",this),this._color.addInterest("set_color__",this),this._visibilityStart.addInterest("set_visibilityRange__",this),this._visibilityRange.addInterest("set_visibilityRange__",this),this.set_color__(),this.set_visibilityRange__()},isHidden(){return this._hidden.getValue()},setHidden(e){e!==this._hidden.getValue()&&(this._hidden=e)},getFogType(){return this.fogType},getFogs:()=>l,set_fogType__:(()=>{const e=new Map([["LINEAR",1],["EXPONENTIAL",2]]);return function(){this._hidden.getValue()||0===this.visibilityRange&&0===this.visibilityStart?this.fogType=0:this.fogType=e.get(this._fogType.getValue())||1}})(),set_color__(){this.colorArray.set(this._color.getValue())},set_visibilityRange__(){const e=Math.max(this._visibilityStart.getValue(),0),t=Math.max(this._visibilityRange.getValue(),0);this.visibilityStart=Math.min(e,t),this.visibilityRange=t,this.set_fogType__()},dispose(){}}),Object.defineProperties(c,s.A.getStaticProperties("X3DFogObject","EnvironmentalEffects",1));const u=c,d=a.A.add("X3DFogObject",u)},2894(e,t,i){i.d(t,{A:()=>a});var n=i(9721),s=i(2696);function r(e,t,i){Object.defineProperties(this,{category:{value:e,enumerable:!0},name:{value:t,enumerable:!0},conversionFactor:{value:i,enumerable:!0}})}Object.assign(Object.setPrototypeOf(r.prototype,n.A.prototype),{toVRMLStream(e){e.Indent(),e.string+="UNIT",e.Space(),e.string+=this.category,e.Space(),e.string+=this.name,e.Space(),e.string+=this.conversionFactor},toXMLStream(e){e.openTag("unit"),e.attribute("category",this.category),e.attribute("name",this.name),e.attribute("conversionFactor",this.conversionFactor),e.closeTag("unit")},toJSONStream(e,t){if(1===this.conversionFactor)throw new Error("conversionFactor is 1");e.beginObject("",!1),e.stringProperty("@category",this.category,!1),e.stringProperty("@name",this.name),e.numberProperty("@conversionFactor",this.conversionFactor),e.endObject()}});for(const e of Object.keys(r.prototype))Object.defineProperty(r.prototype,e,{enumerable:!1});Object.defineProperty(r.prototype,"conversion_factor",{get(){return this.conversionFactor}}),Object.defineProperties(r,{typeName:{value:"UnitInfo",enumerable:!0}});const o=r,a=s.A.add("UnitInfo",o)},2895(e,t,i){i.d(t,{A:()=>h});var n=i(8001),s=i(2251),r=i(5053),o=i(2696);function a(e){s.A.call(this,e),this.addType(r.A.X3DSensorNode)}Object.setPrototypeOf(a.prototype,s.A.prototype),Object.defineProperties(a,n.A.getStaticProperties("X3DSensorNode","Core",1));const l=a,h=o.A.add("X3DSensorNode",l)},2919(e,t,i){i.d(t,{A:()=>y});var n=i(8015),s=i(8001),r=i(5053),o=i(5717),a=i(3999),l=i(2251),h=i(608),c=i(9582),u=i(5687),d=i(477),p=i(2696);function g(e,t){l.A.call(this,e),this.boundedObject=t,this.bboxShape=this.getBrowser().getBBoxShape()}Object.assign(Object.setPrototypeOf(g.prototype,l.A.prototype),{getMatrix:(()=>{const e=new u.A,t=new c.A,i=new d.A(1e-6);return function(){this.boundedObject.getBBox(e);const n=1===this.getBrowser().getRenderingProperty("ContentScale")?d.A.ZERO:i,s=e.size.max(n),r=e.center;return t.set(r,null,s)}})(),getShapes(e,t){const i=t.copy().multLeft(this.getMatrix());return this.bboxShape.getShapes(e,i)},traverse(e,t){if(e===h.A.PICKING)return;const i=t.getModelViewMatrix();i.push(),i.multLeft(this.getMatrix()),this.bboxShape.traverse(e,t),i.pop()}}),Object.defineProperties(g,{...s.A.getStaticProperties("X3DBBoxNode","Grouping",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(r.A.inputOutput,"metadata",new n.A.SFNode)]),enumerable:!0}});const f=g,m=p.A.add("X3DBBoxNode",f);function A(e){this.addType(r.A.X3DBoundedObject),this.addChildObjects(r.A.outputOnly,"hidden",new n.A.SFBool,r.A.outputOnly,"display",new n.A.SFBool(!0),r.A.outputOnly,"transformSensors",new n.A.SFTime),this._bboxSize.setUnit("length"),this._bboxCenter.setUnit("length"),this.childBBox=new u.A,this.transformSensorNodes=new Set}Object.assign(A.prototype,{childBBox:new u.A,initialize(){this._hidden.addInterest("set_visible_and_hidden__",this),this._visible.addInterest("set_visible_and_hidden__",this),this.set_visible_and_hidden__()},isVisible(){return this._display.getValue()},isHidden(){return this._hidden.getValue()},setHidden(e){e!==this._hidden.getValue()&&(this._hidden=e)},isDefaultBBoxSize:(()=>{const e=new d.A(-1);return function(){return this._bboxSize.getValue().equals(e)}})(),isBBoxVisible(){return this._bboxDisplay.getValue()},getBBox(e,t,i){const n=this.childBBox;t.set();for(const s of e)t.add(s.getBBox?.(n,i)??n.set());return t},getBBoxNode(){return this.bboxNode??=(()=>{const e=new m(this.getExecutionContext(),this);return e.setPrivate(!0),e.setup(),e})()},addTransformSensor(e){this.transformSensorNodes.add(e),this._transformSensors=this.getBrowser().getCurrentTime()},removeTransformSensor(e){this.transformSensorNodes.delete(e),this._transformSensors=this.getBrowser().getCurrentTime()},getTransformSensors(){return this.transformSensorNodes},set_visible_and_hidden__(){const e=this._visible.getValue()&&!this._hidden.getValue();e!==this._display.getValue()&&(this._display=e)},dispose(){}}),Object.defineProperties(A,s.A.getStaticProperties("X3DBoundedObject","Grouping",1));const _=A,y=p.A.add("X3DBoundedObject",_)},3097(e,t,i){i.d(t,{A:()=>u});var n=i(8381),s=i(2696);const r=Symbol(),o=Symbol(),a=Symbol(),l={get(e,t){const i=e[t];if(void 0!==i)return i;if("string"==typeof t){const i=+t;return Number.isInteger(i)?e[r][i]:void 0}},set:(e,t,i)=>void 0!==e[t]&&(e[t]=i,!0),has:(e,t)=>Number.isInteger(+t)?t<e[r].length:t in e,ownKeys:e=>Object.keys(e[r]),getOwnPropertyDescriptor(e,t){if("string"!=typeof t)return;const i=+t;if(Number.isInteger(i)&&i<e[r].length){const i=Object.getOwnPropertyDescriptor(e[r],t);return i&&(i.writable=!1),i}}};function h(e,t){const i=new Proxy(this,l);n.A.call(this),this[r]=[],this[o]=new Map,this[a]=t;for(const[t,i]of e)this.add(t,i);return i}Object.assign(Object.setPrototypeOf(h.prototype,n.A.prototype),{*[Symbol.iterator](){yield*this[r]},copy(){const e=new this.constructor;return e.assign(this),e},clear(){this[r].length=0,this[o].clear(),this.addEvent()},assign(e){if(!(e instanceof this.constructor))throw new Error("Couldn't assign info array, wrong type.");this[r]=Array.from(e[r]),this[o]=new Map(e[o]),this.addEvent()},equals(e){const t=this[r],i=e[r],n=t.length;if(t===i)return!0;if(n!==i.length)return!1;for(let e=0;e<n;++e)if(t[e]!==i[e])return!1;return!0},has(e){return this[o].has(e)},get(e){return this[o].get(e)},add(e,t){if(this[o].has(e))throw new Error(`Couldn't add value to ${this.getTypeName()}, key '${e}' already exists.`);if(!(t instanceof this[a]))throw new Error(`Couldn't add value to ${this.getTypeName()}, value for key '${e}' has wrong type.`);this[r].push(t),this[o].set(e,t),this.addEvent()},alias(e,t){this[o].set(e,t),this.addEvent()},update(e,t,i){if(!(i instanceof this[a]))throw new Error(`Couldn't update value of ${this.getTypeName()}, value for key '${key}' has wrong type.`);const n=this[o].get(e);if(e!==t&&this.remove(t),this[o].delete(e),this[o].set(t,i),void 0!==n){const e=this[r].indexOf(n);e>-1&&(this[r][e]=i)}else this[r].push(i);this.addEvent()},remove(e){const t=this[o].get(e);if(void 0===t)return;const i=this[r].indexOf(t);this[o].delete(e),i>-1&&this[r].splice(i,1),this.addEvent()},at:Array.prototype.at,entries:Array.prototype.entries,every:Array.prototype.every,filter(e,t){return new this.constructor(Array.prototype.filter.call(this,e,t))},find:Array.prototype.find,findIndex:Array.prototype.findIndex,findLast:Array.prototype.findLast,findLastIndex:Array.prototype.findLastIndex,flat:Array.prototype.flat,flatMap:Array.prototype.flatMap,forEach:Array.prototype.forEach,includes:Array.prototype.includes,indexOf:Array.prototype.indexOf,join:Array.prototype.join,keys:Array.prototype.keys,lastIndexOf:Array.prototype.lastIndexOf,map(e,t){return new this.constructor(Array.prototype.map.call(this,e,t))},reduce:Array.prototype.reduce,reduceRight:Array.prototype.reduceRight,slice(e,t){return new this.constructor(Array.prototype.slice.call(this,e,t))},some:Array.prototype.some,toReversed(){return new this.constructor([...this].reverse())},toSorted(e){return new this.constructor([...this].sort(e))},toSpliced(e,t,...i){const n=[...this];return n.splice(e,t,...i),new this.constructor(n)},values:Array.prototype.values,with(e,t){const i=[...this];return i[e]=t,new this.constructor(i)},toVRMLStream(e){const t=this.getTypeName().includes("Proto");for(const i of this[r])try{i.toVRMLStream(e),e.Break(),t&&e.TidyBreak()}catch(e){}},toXMLStream(e){for(const t of this[r])try{t.toXMLStream(e),e.TidyBreak()}catch(e){}},toJSONStream(e,t=!1){for(const i of this[r])try{t&&(e.string+=","),i.toJSONStream(e,!0),t=!0}catch{e.RemoveComma()}return t}});for(const e of Object.keys(h.prototype))Object.defineProperty(h.prototype,e,{enumerable:!1});Object.defineProperties(h.prototype,{length:{get(){return this[r].length}}});const c=h,u=s.A.add("X3DInfoArray",c)},3278(e,t,i){i.d(t,{A:()=>f});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(1799),l=i(5053),h=i(2342),c=i(1166),u=i(9582),d=i(2696);function p(e){a.A.call(this,e),this.addType(l.A.Viewpoint),this._position.setUnit("length"),this._centerOfRotation.setUnit("length"),this._fieldOfView.setUnit("angle"),this.projectionMatrix=new u.A}Object.assign(Object.setPrototypeOf(p.prototype,a.A.prototype),{getRelativeTransformation(e){const t=a.A.prototype.getRelativeTransformation.call(this,e);return e.constructor===this.constructor&&(t.fieldOfView=e.getUserFieldOfView()),t},setInterpolators(e,t){if(e.constructor===this.constructor){const e=t.fieldOfView/this.getUserFieldOfView();this.fieldOfViewScaleInterpolator._keyValue=new n.A.MFFloat(e,this._fieldOfViewScale.getValue()),this._fieldOfViewScale=e}else this.fieldOfViewScaleInterpolator._keyValue=new n.A.MFFloat(this._fieldOfViewScale.getValue(),this._fieldOfViewScale.getValue()),this._fieldOfViewScale=this._fieldOfViewScale.getValue()},getLogarithmicDepthBuffer:()=>!1,getFieldOfView(){const e=this._fieldOfView.getValue();return e>0&&e<Math.PI?e:Math.PI/4},setFieldOfView(e){this._fieldOfView=e},getUserFieldOfView(){const e=this._fieldOfView.getValue()*this._fieldOfViewScale.getValue();return e>0&&e<Math.PI?e:Math.PI/4},getScreenScale(e,t,i){const n=t[2],s=t[3],r=this.getBrowser().getPose(),o=r?1/r.views[0].projectionMatrix[5]:Math.tan(this.getUserFieldOfView()/2);let a=Math.abs(e.z)*o*2;return a/=n>s?s:n,i.set(a,a,a)},getViewportSize:(()=>{const e=new c.A;return function(t,i){const n=t[2],s=t[3],r=i*Math.tan(this.getUserFieldOfView()/2)*2,o=n/s;return o>1?e.set(r*o,r):e.set(r,r/o)}})(),getLookAtDistance(e){return e.size.norm()/2/Math.tan(this.getUserFieldOfView()/2)},getProjectionMatrixWithLimits(e,t,i){return h.A.perspective(this.getUserFieldOfView(),e,t,i[2],i[3],this.projectionMatrix)}}),Object.defineProperties(p,{...o.A.getStaticProperties("Viewpoint","Navigation",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOnly,"set_bind",new n.A.SFBool),new s.A(l.A.inputOutput,"description",new n.A.SFString),new s.A(l.A.inputOutput,"position",new n.A.SFVec3f(0,0,10)),new s.A(l.A.inputOutput,"orientation",new n.A.SFRotation),new s.A(l.A.inputOutput,"centerOfRotation",new n.A.SFVec3f),new s.A(l.A.inputOutput,"fieldOfView",new n.A.SFFloat(.785398)),new s.A(l.A.inputOutput,"nearDistance",new n.A.SFFloat(-1)),new s.A(l.A.inputOutput,"farDistance",new n.A.SFFloat(-1)),new s.A(l.A.inputOutput,"viewAll",new n.A.SFBool),new s.A(l.A.inputOutput,"jump",new n.A.SFBool(!0)),new s.A(l.A.inputOutput,"retainUserOffsets",new n.A.SFBool),new s.A(l.A.outputOnly,"isBound",new n.A.SFBool),new s.A(l.A.outputOnly,"bindTime",new n.A.SFTime),new s.A(l.A.inputOutput,"navigationInfo",new n.A.SFNode)]),enumerable:!0}});const g=p,f=d.A.add("Viewpoint",g)},3281(e,t,i){i.d(t,{A:()=>s});const n=function(e){return Object.assign([],{top:0,pop(){return 0!==this.top?this[--this.top]:new e},push(e){this[this.top++]=e},clear(){this.length=0,this.top=0}})},s=i(2696).A.add("ObjectCache",n)},3454(e,t,i){i.d(t,{A:()=>a});var n=i(2462),s=i(3788),r=i(2696);const o={getScriptURL:(()=>{let e;switch(n.A.ENVIRONMENT){case"NODE":e=i.g.require("url").pathToFileURL(__filename).href;break;case"BROWSER":e=document.currentScript?.src??document.location.href;break;case"MODULE":e=import.meta.url}return e=e.replace("/x_ite@latest/",`/x_ite@${s.A}/`),function(){return e}})(),getProviderURL(e){if(!e)return"https://create3000.github.io/x_ite/";const t=this.getScriptURL().match(/\.min\.m?js$/)?".min":"";return new URL(`assets/components/${e}Component${t}.js`,this.getScriptURL()).href},getFontsURL(e){return new URL(`assets/fonts/${e}`,this.getScriptURL()).href},getLinetypeURL(){return new URL("assets/linetype/linetypes.png",this.getScriptURL()).href},getHatchingURL(e){return new URL(`assets/hatching/${e}.png`,this.getScriptURL()).href},getLibraryURL(e){return new URL(`assets/lib/${e}`,this.getScriptURL()).href}},a=r.A.add("URLs",o)},3788(e,t,i){i.d(t,{A:()=>n});const n=i(2696).A.add("BROWSER_VERSION","12.2.4")},3819(e,t,i){i.d(t,{A:()=>o});var n=i(2696);function s(e){this.gl=e,this.vertexArrays=new Map}Object.assign(s.prototype,{update(e=!0){return e&&this.dispose(),this},enable(e){const{gl:t,vertexArrays:i}=this,n=i.get(e);if(n)return t.bindVertexArray(n),!1;{i.size>100&&this.dispose();const n=t.createVertexArray();return i.set(e,n),t.bindVertexArray(n),!0}},dispose(){const{gl:e,vertexArrays:t}=this;for(const i of t.values())e.deleteVertexArray(i);t.clear()}});const r=s,o=n.A.add("VertexArray",r)},3880(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(9949),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.name,e]),s.A)}Object.assign(Object.setPrototypeOf(o.prototype,n.A.prototype),{add(e,{level:t,title:i,providerURL:r,external:o=!1,dependencies:a=[]}){n.A.prototype.add.call(this,e,new s.A(e,t,i,r,o,a))}});for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"ComponentInfoArray",enumerable:!0}});const a=o,l=r.A.add("ComponentInfoArray",a)},3937(t,i,n){n.d(i,{A:()=>g});var s=n(477),r=n(1256),o=n(5185),a=n(2696);function l(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}Object.assign(l.prototype,{*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w},copy(){const e=Object.create(l.prototype);return e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w,e},assign({x:e,y:t,z:i,w:n}){return this.x=e,this.y=t,this.z=i,this.w=n,this},set(e=0,t=0,i=0,n=1){return this.x=e,this.y=t,this.z=i,this.w=n,this},setMatrix(e){const t=e[0]>e[4]?e[0]>e[8]?0:2:e[4]>e[8]?1:2,i=e[0]+e[4]+e[8];if(i>e[3*t+t]){this[3]=Math.sqrt(i+1)/2;const t=4*this[3];this[0]=(e[5]-e[7])/t,this[1]=(e[6]-e[2])/t,this[2]=(e[1]-e[3])/t}else{const i=(t+1)%3,n=(t+2)%3;this[t]=Math.sqrt(e[3*t+t]-e[3*i+i]-e[3*n+n]+1)/2;const s=4*this[t];this[i]=(e[3*t+i]+e[3*i+t])/s,this[n]=(e[3*t+n]+e[3*n+t])/s,this[3]=(e[3*i+n]-e[3*n+i])/s}return this},getMatrix(e=new r.A){const{x:t,y:i,z:n,w:s}=this,o=t*t,a=t*i,l=i*i,h=i*n,c=n*t,u=n*n,d=s*t,p=s*i,g=s*n;return e[0]=1-2*(l+u),e[1]=2*(a+g),e[2]=2*(c-p),e[3]=2*(a-g),e[4]=1-2*(u+o),e[5]=2*(h+d),e[6]=2*(c+p),e[7]=2*(h-d),e[8]=1-2*(l+o),e},setEuler(e,t,i,n="XYZ"){e/=2,t/=2,i/=2;const s=Math.sin(e),r=Math.sin(t),o=Math.sin(i),a=Math.cos(e),l=Math.cos(t),h=Math.cos(i);switch(n){case"XYZ":this.x=s*l*h+a*r*o,this.y=a*r*h-s*l*o,this.z=a*l*o+s*r*h,this.w=a*l*h-s*r*o;break;case"ZYX":this.x=s*l*h-a*r*o,this.y=a*r*h+s*l*o,this.z=a*l*o-s*r*h,this.w=a*l*h+s*r*o;break;case"YXZ":this.x=s*l*h+a*r*o,this.y=a*r*h-s*l*o,this.z=a*l*o-s*r*h,this.w=a*l*h+s*r*o;break;case"ZXY":this.x=s*l*h-a*r*o,this.y=a*r*h+s*l*o,this.z=a*l*o+s*r*h,this.w=a*l*h-s*r*o;break;case"YZX":this.x=s*l*h+a*r*o,this.y=a*r*h+s*l*o,this.z=a*l*o-s*r*h,this.w=a*l*h-s*r*o;break;case"XZY":this.x=s*l*h-a*r*o,this.y=a*r*h-s*l*o,this.z=a*l*o+s*r*h,this.w=a*l*h+s*r*o}return this},getEuler(e=[],t="XYZ"){const{0:i,1:n,2:s,3:r,4:a,5:l,6:h,7:c,8:u}=this.getMatrix(d);switch(t){case"XYZ":e[1]=Math.asin(o.A.clamp(h,-1,1)),Math.abs(h)<.9999999?(e[0]=Math.atan2(-c,u),e[2]=Math.atan2(-r,i)):(e[0]=Math.atan2(l,a),e[2]=0);break;case"ZYX":e[1]=Math.asin(-o.A.clamp(s,-1,1)),Math.abs(s)<.9999999?(e[0]=Math.atan2(l,u),e[2]=Math.atan2(n,i)):(e[0]=0,e[2]=Math.atan2(-r,a));break;case"YXZ":e[0]=Math.asin(-o.A.clamp(c,-1,1)),Math.abs(c)<.9999999?(e[1]=Math.atan2(h,u),e[2]=Math.atan2(n,a)):(e[1]=Math.atan2(-s,i),e[2]=0);break;case"ZXY":e[0]=Math.asin(o.A.clamp(l,-1,1)),Math.abs(l)<.9999999?(e[1]=Math.atan2(-s,u),e[2]=Math.atan2(-r,a)):(e[1]=0,e[2]=Math.atan2(n,i));break;case"YZX":e[2]=Math.asin(o.A.clamp(n,-1,1)),Math.abs(n)<.9999999?(e[0]=Math.atan2(-c,a),e[1]=Math.atan2(-s,i)):(e[0]=0,e[1]=Math.atan2(h,u));break;case"XZY":e[2]=Math.asin(-o.A.clamp(r,-1,1)),Math.abs(r)<.9999999?(e[0]=Math.atan2(l,a),e[1]=Math.atan2(h,i)):(e[0]=Math.atan2(-c,u),e[1]=0)}return e},isReal(){return!(this.x||this.y||this.z)},isImag(){return!this.w},equals({x:e,y:t,z:i,w:n}){return this.x===e&&this.y===t&&this.z===i&&this.w===n},negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},inverse(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},add({x:e,y:t,z:i,w:n}){return this.x+=e,this.y+=t,this.z+=i,this.w+=n,this},subtract({x:e,y:t,z:i,w:n}){return this.x-=e,this.y-=t,this.z-=i,this.w-=n,this},multiply(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},multLeft(e){const{x:t,y:i,z:n,w:s}=this,{x:r,y:o,z:a,w:l}=e;return this.x=s*r+t*l+i*a-n*o,this.y=s*o+i*l+n*r-t*a,this.z=s*a+n*l+t*o-i*r,this.w=s*l-t*r-i*o-n*a,this},multRight(e){const{x:t,y:i,z:n,w:s}=this,{x:r,y:o,z:a,w:l}=e;return this.x=l*t+r*s+o*n-a*i,this.y=l*i+o*s+a*t-r*n,this.z=l*n+a*s+r*i-o*t,this.w=l*s-r*t-o*i-a*n,this},divide(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this},multVecQuat(e){const{x:t,y:i,z:n,w:s}=this,{x:r,y:o,z:a}=e,l=2*(i*a-n*o),h=2*(n*r-t*a),c=2*(t*o-i*r);return e.x+=s*l+i*c-n*h,e.y+=s*h+n*l-t*c,e.z+=s*c+t*h-i*l,e},multQuatVec(e){const{x:t,y:i,z:n,w:s}=this,{x:r,y:o,z:a}=e,l=2*(n*o-i*a),h=2*(t*a-n*r),c=2*(i*r-t*o);return e.x+=s*l-i*c+n*h,e.y+=s*h-n*l+t*c,e.z+=s*c-t*h+i*l,e},normalize(){const e=Math.hypot(this.x,this.y,this.z,this.w);return e&&(this.x/=e,this.y/=e,this.z/=e,this.w/=e),this},dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},squaredNorm(){const{x:e,y:t,z:i,w:n}=this;return e*e+t*t+i*i+n*n},norm(){return Math.hypot(this.x,this.y,this.z,this.w)},pow(t){if(t instanceof l)return this.assign(e.assign(t).multRight(this.log()).exp());if(this.isReal())return this.set(0,0,0,this.w**t);const i=this.norm(),n=i**t,s=t*Math.acos(this.w/i),r=n/this.imag.norm()*Math.sin(s);return this.x*=r,this.y*=r,this.z*=r,this.w=n*Math.cos(s),this},log(){if(this.isReal())return this.w>0?this.set(0,0,0,Math.log(this.w)):this.set(Math.PI,0,0,Math.log(-this.w));const e=this.norm(),t=this.imag.normalize().multiply(Math.acos(this.w/e)),i=Math.log(e);return this.x=t.x,this.y=t.y,this.z=t.z,this.w=i,this},exp(){if(this.isReal())return this.set(0,0,0,Math.exp(this.w));const e=this.imag,t=e.norm(),i=Math.exp(this.w),n=i*Math.cos(t),s=e.multiply(i*Math.sin(t)/t);return this.x=s.x,this.y=s.y,this.z=s.z,this.w=n,this},slerp(e,t){return o.A.slerp(this,h.assign(e),t)},squad(e,t,i,n){return o.A.slerp(o.A.slerp(this,h.assign(i),n),o.A.slerp(c.assign(e),u.assign(t),n),2*n*(1-n))},toString(){return this.x+" "+this.y+" "+this.z+" "+this.w}});for(const e of Object.keys(l.prototype))Object.defineProperty(l.prototype,e,{enumerable:!1});Object.defineProperties(l.prototype,{length:{value:4},0:{get(){return this.x},set(e){this.x=e}},1:{get(){return this.y},set(e){this.y=e}},2:{get(){return this.z},set(e){this.z=e}},3:{get(){return this.w},set(e){this.w=e}},real:{get(){return this.w}},imag:{get:(()=>{const e=new s.A;return function(){return e.set(this.x,this.y,this.z)}})()}}),Object.assign(l,{IDENTITY:Object.freeze(new l),spline:(()=>{const e=new l,t=new l,i=new l,n=new l;return function(s,r,o){return e.assign(s),t.assign(r),i.assign(o),e.dot(t)<0&&e.negate(),i.dot(t)<0&&i.negate(),n.assign(t).inverse(),t.multRight(h.assign(n).multRight(e).log().add(c.assign(n).multRight(i).log()).divide(-4).exp()).normalize().copy()}})()});const h=new l,c=new l,u=new l,d=new r.A,p=l,g=a.A.add("Quaternion",p)},3967(e,t,i){i.d(t,{A:()=>c});var n=i(8015),s=i(8001),r=i(2251),o=i(5053),a=i(2696);function l(e){this.addType(o.A.X3DTimeDependentNode),this.addChildObjects(o.A.outputOnly,"initialized",new n.A.SFTime,o.A.inputOutput,"evenLive",new n.A.SFBool),this.startTimeValue=0,this.pauseTimeValue=0,this.resumeTimeValue=0,this.stopTimeValue=0,this.start=0,this.pause=0,this.pauseInterval=0,this.timeouts=new Map,this.disabled=!1}Object.assign(Object.setPrototypeOf(l.prototype,r.A.prototype),{initialize(){this.getLive().addInterest("set_live__",this),this._evenLive.addInterest(Symbol.for("X_ITE.X3DBaseNode.set_live__"),this),this._initialized.addInterest("set_loop__",this),this._enabled.addInterest("set_enabled__",this),this._loop.addInterest("set_loop__",this),this._startTime.addInterest("set_startTime__",this),this._pauseTime.addInterest("set_pauseTime__",this),this._resumeTime.addInterest("set_resumeTime__",this),this._stopTime.addInterest("set_stopTime__",this),this.startTimeValue=this._startTime.getValue(),this.pauseTimeValue=this._pauseTime.getValue(),this.resumeTimeValue=this._resumeTime.getValue(),this.stopTimeValue=this._stopTime.getValue(),this._initialized=this.getBrowser().getCurrentTime()},checkLiveState(){return this.isLive()&&(this.getExecutionContext().getLive().getValue()||this._evenLive.getValue())},getElapsedTime(){return this.getBrowser().getCurrentTime()-this.start-this.pauseInterval},resetElapsedTime(){this.start=this.getBrowser().getCurrentTime(),this.pause=this.getBrowser().getCurrentTime(),this.pauseInterval=0},set_live__(){this.getLive().getValue()?this.disabled&&(this.disabled=!1,this._isActive.getValue()&&!this._isPaused.getValue()&&this.real_resume()):this.disabled||!this._isActive.getValue()||this._isPaused.getValue()||(this.disabled=!0,this.real_pause())},set_enabled__(){this._enabled.getValue()?this.set_loop__():this.stop()},set_loop__(){this._enabled.getValue()&&this._loop.getValue()&&this.stopTimeValue<=this.startTimeValue&&this.startTimeValue<=this.getBrowser().getCurrentTime()&&this.do_start(),this.set_loop()},set_startTime__(){this.startTimeValue=this._startTime.getValue(),this._enabled.getValue()&&(this.removeTimeout("start"),this.startTimeValue<=this.getBrowser().getCurrentTime()?this.do_start():this.addTimeout("start","do_start",this.startTimeValue))},set_pauseTime__(){if(this.pauseTimeValue=this._pauseTime.getValue(),this._enabled.getValue()){if(this.removeTimeout("pause"),this.pauseTimeValue<=this.resumeTimeValue)return;this.pauseTimeValue<=this.getBrowser().getCurrentTime()?this.do_pause():this.addTimeout("pause","do_pause",this.pauseTimeValue)}},set_resumeTime__(){if(this.resumeTimeValue=this._resumeTime.getValue(),this._enabled.getValue()){if(this.removeTimeout("resume"),this.resumeTimeValue<=this.pauseTimeValue)return;this.resumeTimeValue<=this.getBrowser().getCurrentTime()?this.do_resume():this.addTimeout("resume","do_resume",this.resumeTimeValue)}},set_stopTime__(){if(this.stopTimeValue=this._stopTime.getValue(),this._enabled.getValue()){if(this.removeTimeout("stop"),this.stopTimeValue<=this.startTimeValue)return;this.stopTimeValue<=this.getBrowser().getCurrentTime()?this.do_stop():this.addTimeout("stop","do_stop",this.stopTimeValue)}},do_start(){this._isActive.getValue()||(this.resetElapsedTime(),this._isActive=!0,this._elapsedTime=0,this.set_start(),this.getLive().getValue()?this.getBrowser().timeEvents().addInterest("set_time",this):(this.disabled=!0,this.real_pause()))},do_pause(){this._isActive.getValue()&&!this._isPaused.getValue()&&(this._isPaused=!0,this.getLive().getValue()&&this.real_pause())},real_pause(){this.pause=Date.now()/1e3,this.set_pause(),this.getBrowser().timeEvents().removeInterest("set_time",this)},do_resume(){this._isActive.getValue()&&this._isPaused.getValue()&&(this._isPaused=!1,this.getLive().getValue()&&this.real_resume())},real_resume(){const e=Date.now()/1e3-this.pause;this.pauseInterval+=e,this.set_resume(e),this.getBrowser().timeEvents().addInterest("set_time",this),this.getBrowser().addBrowserEvent()},do_stop(){this.stop()},stop(){this._isActive.getValue()&&(this.set_stop(),this._elapsedTime=this.getElapsedTime(),this._isPaused.getValue()&&(this._isPaused=!1),this._isActive=!1,this.getBrowser().timeEvents().removeInterest("set_time",this))},addTimeout(e,t,i){const n=1e3*(i-this.getBrowser().getCurrentTime());this.removeTimeout(e),this.timeouts.set(e,setTimeout(()=>this.processTimeout(t),n))},removeTimeout(e){clearTimeout(this.timeouts.get(e)),this.timeouts.delete(e)},processTimeout(e){this._enabled.getValue()&&this.getLive().getValue()&&(this.getBrowser().advanceOnlyTime(),this[e]())},set_loop:Function.prototype,set_start:Function.prototype,set_pause:Function.prototype,set_resume:Function.prototype,set_stop:Function.prototype,set_time:Function.prototype,dispose(){for(const e of[...this.timeouts.keys()])this.removeTimeout(e)}}),Object.defineProperties(l,s.A.getStaticProperties("X3DTimeDependentNode","Time",1));const h=l,c=a.A.add("X3DTimeDependentNode",h)},3979(e,t,i){var n,s,r;s=[i(9340)],n=function(e){var t,i,n=!!e.fn.on,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in window.document||window.document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],o=Array.prototype.slice;if(e.event.fixHooks)for(var a=s.length;a;)e.event.fixHooks[s[--a]]=e.event.mouseHooks;var l=e.event.special.mousewheel={version:"3.2.2",setup:function(){if(this.addEventListener)for(var t=r.length;t;)this.addEventListener(r[--t],h,!1);else this.onmousewheel=h;e.data(this,"mousewheel-line-height",l.getLineHeight(this)),e.data(this,"mousewheel-page-height",l.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=r.length;t;)this.removeEventListener(r[--t],h,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),n=i["offsetParent"in e.fn?"offsetParent":"parent"]();return n.length||(n=e("body")),parseInt(n.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function h(n){var s=n||window.event,r=o.call(arguments,1),a=0,h=0,u=0,d=0;if((n=e.event.fix(s)).type="mousewheel","detail"in s&&(u=-1*s.detail),"wheelDelta"in s&&(u=s.wheelDelta),"wheelDeltaY"in s&&(u=s.wheelDeltaY),"wheelDeltaX"in s&&(h=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(h=-1*u,u=0),a=0===u?h:u,"deltaY"in s&&(a=u=-1*s.deltaY),"deltaX"in s&&(h=s.deltaX,0===u&&(a=-1*h)),0!==u||0!==h){if(1===s.deltaMode){var p=e.data(this,"mousewheel-line-height");a*=p,u*=p,h*=p}else if(2===s.deltaMode){var g=e.data(this,"mousewheel-page-height");a*=g,u*=g,h*=g}if(d=Math.max(Math.abs(u),Math.abs(h)),(!i||d<i)&&(i=d,c(s,d)&&(i/=40)),c(s,d)&&(a/=40,h/=40,u/=40),a=Math[a>=1?"floor":"ceil"](a/i),h=Math[h>=1?"floor":"ceil"](h/i),u=Math[u>=1?"floor":"ceil"](u/i),l.settings.normalizeOffset&&this.getBoundingClientRect){var f=this.getBoundingClientRect();n.offsetX=n.clientX-f.left,n.offsetY=n.clientY-f.top}return n.deltaX=h,n.deltaY=u,n.deltaFactor=i,n.deltaMode=0,r.unshift(n,a,h,u),t&&window.clearTimeout(t),t=window.setTimeout(function(){i=null},200),(e.event.dispatch||e.event.handle).apply(this,r)}}function c(e,t){return l.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}e.fn.extend({mousewheel:function(e){return e?this[n?"on":"bind"]("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this[n?"off":"unbind"]("mousewheel",e)}})},void 0===(r="function"==typeof n?n.apply(t,s):n)||(e.exports=r)},3999(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(5717),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.name,e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"FieldDefinitionArray",enumerable:!0}});const a=o,l=r.A.add("FieldDefinitionArray",a)},4068(e,t,i){i.d(t,{A:()=>l});var n=i(5768),s=i(2696);const r=new WeakMap;function o(){this.getValue()?.dispose(),n.A.prototype.dispose.call(this)}const a={get(e){const t=r.get(e);if(t)return t;{const t=new n.A(e);return this.set(e,t),t}},set(e,t){Object.defineProperty(t,"dispose",{value:o,writable:!0,configurable:!0}),r.set(e,t)},delete(e){r.delete(e)}},l=s.A.add("SFNodeCache",a)},4275(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(8067),l=i(5053),h=i(477),c=i(2696);function u(e){a.A.call(this,e),this.addType(l.A.PositionInterpolator)}Object.assign(Object.setPrototypeOf(u.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new n.A.SFVec3f),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate:(()=>{const e=new h.A;return function(t,i,n){this._value_changed=e.assign(this._keyValue[t].getValue()).lerp(this._keyValue[i].getValue(),n)}})()}),Object.defineProperties(u,{...o.A.getStaticProperties("PositionInterpolator","Interpolation",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOnly,"set_fraction",new n.A.SFFloat),new s.A(l.A.inputOutput,"key",new n.A.MFFloat),new s.A(l.A.inputOutput,"keyValue",new n.A.MFVec3f),new s.A(l.A.outputOnly,"value_changed",new n.A.SFVec3f)]),enumerable:!0}});const d=u,p=c.A.add("PositionInterpolator",d)},4632(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(5543),r=i(8664),o=i(4068),a=i(5053),l=i(2696);const h=Symbol(),c=Symbol();function u(e){s.A.call(this,e),this.addType(a.A.X3DProtoDeclarationNode),this.addChildObjects(a.A.outputOnly,"updateInstances",new n.A.SFTime),this[h]="",this[c]=""}Object.assign(Object.setPrototypeOf(u.prototype,s.A.prototype),{canUserDefinedFields:()=>!0,getAppInfo(){return this[h]},setAppInfo(e){this[h]=String(e)},getDocumentation(){return this[c]},setDocumentation(e){this[c]=String(e)},createInstance(e,t=!0){if(!1===t)return new r.A(e,this);{const t=new r.A(e,this);return t.setup(),o.A.get(t)}},newInstance(){return this.createInstance(this.getExecutionContext())},requestUpdateInstances(){this._updateInstances=Date.now()/1e3},updateInstances(){this._updateInstances.processEvent()}});for(const e of Object.keys(u.prototype))Object.defineProperty(u.prototype,e,{enumerable:!1});Object.defineProperties(u.prototype,{name:{get:u.prototype.getName,enumerable:!0},fields:{get:u.prototype.getFieldDefinitions,enumerable:!0},appInfo:{get:u.prototype.getAppInfo,set:u.prototype.setAppInfo,enumerable:!0},documentation:{get:u.prototype.getDocumentation,set:u.prototype.setDocumentation,enumerable:!0}}),Object.defineProperties(u,{typeName:{value:"X3DProtoDeclarationNode",enumerable:!0}}),a.A.addConstant(u.typeName);const d=u,p=l.A.add("X3DProtoDeclarationNode",d)},4705(e,t,i){i.d(t,{A:()=>o});var n=i(2696);function s(e=0,t=0){this.real=e,this.imag=t}Object.assign(s.prototype,{*[Symbol.iterator](){yield this.real,yield this.imag},copy(){const e=Object.create(s.prototype);return e.real=this.real,e.imag=this.imag,e},assign(e){return this.real=e.real,this.imag=e.imag,this},equals(e){return this.real===e.real&&this.imag===e.imag},set(e=0,t=0){return this.real=e,this.imag=t,this},setPolar(e,t){return this.real=e*Math.cos(t),this.imag=e*Math.sin(t),this},conjugate(){return this.imag=-this.imag,this},negate(){return this.real=-this.real,this.imag=-this.imag,this},inverse(){const e=this.real*this.real+this.imag*this.imag;return this.real/=e,this.imag/=-e,this},add(e){return this.real+=e.real,this.imag+=e.imag,this},subtract(e){return this.real-=e.real,this.imag-=e.imag,this},multiply(e){return this.real*=e,this.imag*=e,this},multComp(e){const{real:t,imag:i}=this,{real:n,imag:s}=e;return this.real=t*n-i*s,this.imag=t*s+i*n,this},divide(e){return this.real/=e,this.imag/=e,this},divComp(e){const{real:t,imag:i}=this,{real:n,imag:s}=e,r=n*n+s*s;return this.real=(t*n+i*s)/r,this.imag=(i*n-t*s)/r,this},toString(){let e="";return e+=this.real,this.imag<0?(e+=this.imag,e+="i"):this.imag>0&&(e+="+",e+=this.imag,e+="i"),e}});for(const e of Object.keys(s.prototype))Object.defineProperty(s.prototype,e,{enumerable:!1});Object.defineProperties(s.prototype,{length:{value:2},0:{get(){return this.real},set(e){this.real=e}},1:{get(){return this.imag},set(e){this.imag=e}},magnitude:{get(){return this.real?this.imag?Math.hypot(this.real,this.imag):Math.abs(this.real):Math.abs(this.imag)},set(e){this.setPolar(e,this.angle)}},angle:{get(){return Math.atan2(this.imag,this.real)},set(e){this.setPolar(this.magnitude,e)}}}),Object.assign(s,{Polar:(e,t)=>Object.create(s.prototype).setPolar(e,t)});const r=s,o=n.A.add("Complex",r)},4803(e,t,i){i.d(t,{A:()=>u});var n=i(2696);const s={min:0,max:0},r={min:0,max:0};function o(){}function a(e,t,i){i.min=Number.POSITIVE_INFINITY,i.max=Number.NEGATIVE_INFINITY;for(const n of e){const e=n.dot(t);e<i.min&&(i.min=e),e>i.max&&(i.max=e)}}function l(e,t,i,n){return h(i,e,t)||h(e,i,n)}function h(e,t,i){return t<=e&&e<=i}o.isSeparated=function(e,t,i){for(const n of e)if(a(t,n,s),a(i,n,r),!l(s.min,s.max,r.min,r.max))return!0;return!1};const c=o,u=n.A.add("SAT",c)},4839(e,t,i){i.d(t,{A:()=>l});var n=i(6007),s=i(2696),r=i(9340);function o(e){this.scene=e,this.executionContexts=[e],this.prototypes=[],this.placeholders=new Map,this.namedNodes=new Map,this.importedNodes=new Map,this.nodes=new Map}Object.assign(o.prototype,{getBrowser(){return this.scene.getBrowser()},getScene(){return this.scene},getExecutionContext(){return this.executionContexts.at(-1)},pushExecutionContext(e){return this.executionContexts.push(e)},popExecutionContext(){this.executionContexts.pop()},getOuterNode(){return this.getExecutionContext()?.getOuterNode()},isInsideProtoDeclaration(){return this.getOuterNode()instanceof n.A},loadComponents(){return this.getBrowser().loadComponents(this.getScene())},setUnits(e){e?delete this.fromUnit:this.fromUnit=function(e,t){return t}},fromUnit(e,t){return this.scene.fromUnit(e,t)},convertColor(e,t="white"){const i=r("<div></div>").hide().css("color",t).appendTo(r("body")),n=r("<div></div>").css("color",e).appendTo(i),s=window.getComputedStyle(n[0]).color.replace(/^rgba?\(|\)$/g,"").split(/[\s,]+/).map(e=>parseFloat(e));return i.remove(),s[0]/=255,s[1]/=255,s[2]/=255,"number"!=typeof s[3]&&(s[3]=1),s},sanitizeName:(e="")=>e=(e=(e=(e=e.replace(/^[\x30-\x39\x00-\x20\x22\x23\x27\x2b\x2c\x2d\x2e\x5b\x5c\x5d\x7b\x7d\x7f]*/,"")).replace(/[\x00-\x20\x22\x23\x27\x2c\x2e\x5b\x5c\x5d\x7b\x7d\x7f]+/g,"-")).trim().replace(/[\s_-]+/g,"-")).replace(/^-+|-+$/g,""),renameExistingNode(e){const t=this.getExecutionContext();try{const i=t.getNamedNode(e);t.updateNamedNode(t.getUniqueName(e),i)}catch{}try{const i=t.getUniqueImportName(e);t.renameImportedNode(e,i)}catch{}},getNodes(){return this.getContainer(this.nodes,Array)},getPlaceholders(){return this.getContainer(this.placeholders,Map)},getNamedNodes(){return this.getContainer(this.namedNodes,Map)},getImportedNodes(){return this.getContainer(this.importedNodes,Map)},getContainer(e,t){const i=this.getExecutionContext(),n=e.get(i);if(n)return n;{const n=new t;return e.set(i,n),n}},checkNodeType(){},setupNodes(){const e=this.getPlaceholders(),t=this.getNodes();e.forEach(e=>e.replaceWithNode()),e.clear(),this.isInsideProtoDeclaration()||t.forEach(e=>e.setup()),t.length=0}});const a=o,l=s.A.add("X3DParser",a)},5041(e,t,i){i.d(t,{A:()=>h});var n=i(1490),s=i(477),r=i(9582),o=i(2696);function a({browser:e,width:t,height:i,float:n=!1,mipMaps:s=!1,colorTextures:r=1}){const o=e.getContext();this.context=o,this.width=t,this.height=i,Object.defineProperty(this,"array",{get(){const e=n?new Float32Array(t*i*4):new Uint8Array(t*i*4);return Object.defineProperty(this,"array",{value:e}),e},configurable:!0});const a=o.getParameter(o.FRAMEBUFFER_BINDING);this.frameBuffer=o.createFramebuffer(),o.bindFramebuffer(o.FRAMEBUFFER,this.frameBuffer),o.drawBuffers(Array.from({length:r},(e,t)=>o.COLOR_ATTACHMENT0+t)),this.colorTextures=[];for(let e=0;e<r;++e)this.colorTextures[e]=o.createTexture(),o.bindTexture(o.TEXTURE_2D,this.colorTextures[e]),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),s?(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR)):(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST)),n?o.texImage2D(o.TEXTURE_2D,0,o.RGBA32F,t,i,0,o.RGBA,o.FLOAT,null):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,t,i,0,o.RGBA,o.UNSIGNED_BYTE,null),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+e,o.TEXTURE_2D,this.colorTextures[e],0);this.depthTexture=o.createTexture(),o.bindTexture(o.TEXTURE_2D,this.depthTexture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texImage2D(o.TEXTURE_2D,0,o.DEPTH_COMPONENT24,t,i,0,o.DEPTH_COMPONENT,o.UNSIGNED_INT,null),o.framebufferTexture2D(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.TEXTURE_2D,this.depthTexture,0);const l=o.checkFramebufferStatus(o.FRAMEBUFFER)===o.FRAMEBUFFER_COMPLETE;if(o.bindFramebuffer(o.FRAMEBUFFER,a),!l)throw new Error("Couldn't create frame buffer.")}Object.assign(a.prototype,{getOIT:()=>!1,getWidth(){return this.width},getHeight(){return this.height},getColorTexture(e=0){return this.colorTextures[e]},getDepthTexture(){return this.depthTexture},readPixels(){const{context:e,array:t,width:i,height:n}=this;return e.readPixels(0,0,i,n,e.RGBA,e.UNSIGNED_BYTE,t),t},readDepth:(()=>{const e=new r.A,t=new s.A;return function(i,s,r){const{context:o,array:a,width:l,height:h}=this;o.readBuffer(o.COLOR_ATTACHMENT0),o.readPixels(0,0,l,h,o.RGBA,o.FLOAT,a);let c=0,u=0,d=Number.POSITIVE_INFINITY,p=-1;for(let e=0,t=0;e<h;++e)for(let i=0;i<l;++i,t+=4){const n=a[t];n<d&&(c=i,u=e,d=n,p=t)}return e.assign(i).inverse(),n.A.unProjectPointMatrix(c,u,d,e,s,t),r.distance=-t.z,r.id=a[p+1],o.readBuffer(o.COLOR_ATTACHMENT1),o.readPixels(0,0,l,h,o.RGBA,o.FLOAT,a),r.normal.set(a[p],a[p+1],a[p+2]),r}})(),bind(){const e=this.context;e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer)},dispose(){const e=this.context;e.deleteFramebuffer(this.frameBuffer);for(const t of this.colorTextures)e.deleteTexture(t);e.deleteTexture(this.depthTexture)}});for(const e of Object.keys(a.prototype))Object.defineProperty(a.prototype,e,{enumerable:!1});const l=a,h=o.A.add("TextureBuffer",l)},5053(e,t,i){i.d(t,{A:()=>a});var n=i(2696);const s={[Symbol.toStringTag]:"X3DConstants"};let r=1e3;Object.defineProperty(s,"addConstant",{value(e,t){this.hasOwnProperty(e)||this.hasOwnProperty(t)||(Object.defineProperty(this,e,{value:t??++r,enumerable:!0}),Object.defineProperty(this,this[e],{value:e}))}}),Object.entries({initializeOnly:1,inputOnly:2,outputOnly:4,inputOutput:7}).forEach(([e,t])=>s.addConstant(e,t)),["CONNECTION_ERROR","BROWSER_EVENT","INITIALIZED_EVENT","SHUTDOWN_EVENT","INITIALIZED_ERROR","NOT_STARTED_STATE","IN_PROGRESS_STATE","COMPLETE_STATE","FAILED_STATE","SFBool","SFColor","SFColorRGBA","SFDouble","SFFloat","SFImage","SFInt32","SFMatrix3d","SFMatrix3f","SFMatrix4d","SFMatrix4f","SFNode","SFRotation","SFString","SFTime","SFVec2d","SFVec2f","SFVec3d","SFVec3f","SFVec4d","SFVec4f","VrmlMatrix","MFBool","MFColor","MFColorRGBA","MFDouble","MFFloat","MFImage","MFInt32","MFMatrix3d","MFMatrix3f","MFMatrix4d","MFMatrix4f","MFNode","MFRotation","MFString","MFTime","MFVec2d","MFVec2f","MFVec3d","MFVec3f","MFVec4d","MFVec4f"].forEach(e=>s.addConstant(e));const o=s,a=n.A.add("X3DConstants",o)},5185(e,t,i){i.d(t,{A:()=>o});var n=i(2696);const s={radians:e=>e*(Math.PI/180),degrees:e=>e*(180/Math.PI),random:(e,t)=>e+Math.random()*(t-e),fract:e=>e%1,clamp:(e,t,i)=>Math.min(Math.max(e,t),i),interval:(e,t,i)=>e>=i?(e-t)%(i-t)+t:e<t?(e-i)%(i-t)+i:e,project:(e,t,i,n,s)=>n+(e-t)/(i-t)*(s-n),roundToMultiple:(e,t)=>Math.ceil(e/t)*t,lerp:(e,t,i)=>e+i*(t-e),slerp(e,t,i,n=!0){let s=e.dot(t);if(n&&s<0&&(s=-s,t.negate()),s>=1)return e;const r=Math.acos(s),o=Math.sin(r),a=Math.sin((1-i)*r)/o,l=Math.sin(i*r)/o;return e.x=e.x*a+t.x*l,e.y=e.y*a+t.y*l,e.z=e.z*a+t.z*l,e.w=e.w*a+t.w*l,e},simpleSlerp(e,t,i){return this.slerp(e,t,i,!1)},isPowerOfTwo:e=>!(e-1&e),nextPowerOfTwo:e=>s.isPowerOfTwo(e)?e:1<<32-Math.clz32(e),bitCount:e=>16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24,cmp:(e,t)=>e>t?1:e<t?-1:0,less:(e,t)=>e<t,greater:(e,t)=>e>t,lowerBound(e,t,i,n,r=s.less){let o=0,a=0,l=i-t;for(;l>0;)a=l>>>1,o=t+a,r(e[o],n)?(t=++o,l-=a+1):l=a;return t},upperBound(e,t,i,n,r=s.less){let o=0,a=0,l=i-t;for(;l>0;)a=l>>>1,o=t+a,r(n,e[o])?l=a:(t=++o,l-=a+1);return t}},r=s,o=n.A.add("Algorithm",r)},5197(e,t,i){i.d(t,{A:()=>a});var n=i(2804),s=(i(2462),i(2696));function r(e){n.A.call(this,e)}Object.assign(Object.setPrototypeOf(r.prototype,n.A.prototype),{at:Array.prototype.at,concat:Array.prototype.concat,entries:Array.prototype.entries,every:Array.prototype.every,fill:Array.prototype.fill,filter(){const e=new this.constructor;for(const t of Array.prototype.filter.call(this,...arguments))e.push(t);return e},find:Array.prototype.find,findIndex:Array.prototype.findIndex,findLast:Array.prototype.findLast,findLastIndex:Array.prototype.findLastIndex,flat:Array.prototype.flat,flatMap:Array.prototype.flatMap,forEach:Array.prototype.forEach,includes:Array.prototype.includes,indexOf:Array.prototype.indexOf,join:Array.prototype.join,keys:Array.prototype.keys,lastIndexOf:Array.prototype.lastIndexOf,map(){const e=new this.constructor;for(const t of Array.prototype.map.call(this,...arguments))e.push(t);return e},reduce:Array.prototype.reduce,reduceRight:Array.prototype.reduceRight,reverse:Array.prototype.reverse,slice(){const e=new this.constructor;for(const t of Array.prototype.slice.call(this,...arguments))e.push(t);return e},some:Array.prototype.some,sort:Array.prototype.sort,toReversed(){return this.copy().reverse()},toSorted(){return this.copy().sort(...arguments)},toSpliced(){const e=this.copy();return e.splice(...arguments),e},values:Array.prototype.values,with(e,t){const i=this.copy();return i[e]=t,i}});for(const e of Object.keys(r.prototype))Object.defineProperty(r.prototype,e,{enumerable:!1});const o=r,a=s.A.add("X3DArrayField",o)},5319(e,t,i){i.d(t,{A:()=>w});var n=i(3937),s=i(477),r=i(8392),o=i(1256),a=i(5185),l=i(2696);const h=Symbol(),c=Symbol(),u=Symbol(),d=Symbol(),p=Symbol();function g(e,t,i,r){switch(this[h]=0,this[c]=0,this[u]=1,this[d]=0,arguments.length){case 0:return void(this[p]=new n.A);case 1:return this[p]=arguments[0],void this.update();case 2:{const e=arguments[0],t=arguments[1];return this[p]=new n.A,t instanceof s.A?this.setFromToVec(e,t):void this.set(e.x,e.y,e.z,t)}case 4:return this[p]=new n.A,void this.set(e,t,i,r)}}Object.assign(g.prototype,{*[Symbol.iterator](){yield this[h],yield this[c],yield this[u],yield this[d]},update(){const e=this.get();return this[h]=e.x,this[c]=e.y,this[u]=e.z,this[d]=e.w,this},copy(){const e=Object.create(g.prototype);return e[h]=this[h],e[c]=this[c],e[u]=this[u],e[d]=this[d],e[p]=this[p].copy(),e},assign(e){return this[h]=e[h],this[c]=e[c],this[u]=e[u],this[d]=e[d],this[p].assign(e[p]),this},set(e=0,t=0,i=1,n=0){this[h]=e,this[c]=t,this[u]=i,this[d]=n;const s=Math.hypot(e,t,i);if(0===s)return this[p].set(0,0,0,1),this;const r=a.A.interval(n/2,0,Math.PI),o=Math.sin(r)/s;return this[p].set(e*o,t*o,i*o,Math.cos(r)),this},get:(()=>{const e=new r.A;return function(){const t=this[p];if(Math.abs(t.w)>1)return r.A.Z_AXIS;{const i=2*Math.acos(t.w),n=Math.sin(i/2);if(0===n)return r.A.Z_AXIS;{const s=t.imag.divide(n);return e.set(s.x,s.y,s.z,i)}}}})(),setAxisAngle(e,t){return this.set(e.x,e.y,e.z,t)},setFromToVec:(()=>{const e=new s.A,t=new s.A,i=new s.A,n=new s.A;return function(r,o){e.assign(r).normalize(),t.assign(o).normalize();const l=a.A.clamp(e.dot(t),-1,1),h=i.assign(e).cross(t).normalize();return 0===h.norm()?l>0?this[p].set(0,0,0,1):(n.assign(e).cross(s.A.X_AXIS),0===n.squaredNorm()&&n.assign(e).cross(s.A.Y_AXIS),n.normalize(),this[p].set(n.x,n.y,n.z,0)):(h.multiply(Math.sqrt(Math.abs(1-l)/2)),this[p].set(h.x,h.y,h.z,Math.sqrt(Math.abs(1+l)/2))),this.update(),this}})(),setAxis(e){this.set(e.x,e.y,e.z,this[d])},getAxis(e=new s.A){return e.set(this[h],this[c],this[u])},setQuaternion(e){return this[p].assign(e).normalize(),this.update(),this},getQuaternion(e=new n.A){return e.assign(this[p])},setMatrix(e){return this[p].setMatrix(e).normalize(),this.update(),this},getMatrix(e=new o.A){return this[p].getMatrix(e)},setEuler(e,t,i,n="XYZ"){return this[p].setEuler(e,t,i,n),this.update(),this},getEuler(e=[],t="XYZ"){return this[p].getEuler(e,t)},equals(e){return this[p].equals(e[p])},inverse(){return this[p].inverse(),this.update(),this},multLeft(e){return this[p].multLeft(e[p]).normalize(),this.update(),this},multRight(e){return this[p].multRight(e[p]).normalize(),this.update(),this},multVecRot(e){return this[p].multVecQuat(e)},multRotVec(e){return this[p].multQuatVec(e)},normalize(){return this[p].normalize(),this.update(),this},pow(e){return this[p].pow(e),this.update(),this},slerp(e,t){return this[p].slerp(e[p],t),this.update(),this},squad(e,t,i,n){return this[p].squad(e[p],t[p],i[p],n),this.update(),this},straighten:(()=>{const e=new s.A,t=new s.A,i=new s.A,n=new g;return function(r=s.A.Y_AXIS){if(i.assign(r).normalize(),this.multVecRot(e.assign(s.A.X_AXIS).negate()),this.multVecRot(t.assign(s.A.Z_AXIS)),Math.abs(t.dot(i))>=1)return this;const o=t.cross(i).normalize();return o.dot(e)<=-1?(n.setAxisAngle(s.A.Z_AXIS,Math.PI),this.multLeft(n)):(n.setFromToVec(e,o),this.multRight(n))}})(),toString(){return this[h]+" "+this[c]+" "+this[u]+" "+this[d]}});for(const e of Object.keys(g.prototype))Object.defineProperty(g.prototype,e,{enumerable:!1});const f={get(){return this[h]},set(e){this[h]=e,this.set(e,this[c],this[u],this[d])},enumerable:!0},m={get(){return this[c]},set(e){this[c]=e,this.set(this[h],e,this[u],this[d])},enumerable:!0},A={get(){return this[u]},set(e){this[u]=e,this.set(this[h],this[c],e,this[d])},enumerable:!0},_={get(){return this[d]},set(e){this[d]=e,this.set(this[h],this[c],this[u],e)},enumerable:!0};Object.defineProperties(g.prototype,{length:{value:4},x:f,y:m,z:A,angle:_}),f.enumerable=!1,m.enumerable=!1,A.enumerable=!1,_.enumerable=!1,Object.defineProperties(g.prototype,{0:f,1:m,2:A,3:_}),Object.assign(g,{IDENTITY:Object.freeze(new g),fromQuaternion:e=>(new g).setQuaternion(e),fromMatrix:e=>(new g).setMatrix(e),fromEuler:(e,t,i,n="XYZ")=>(new g).setEuler(e,t,i,n),spline(e,t,i){const s=Object.create(this.prototype);return s[p]=n.A.spline(e[p],t[p],i[p]),s.update(),s}});const y=g,w=l.A.add("Rotation4",y)},5464(e,t,i){i.d(t,{A:()=>x});var n=i(8015),s=i(8001),r=i(6138),o=i(5948),a=i(3819),l=i(608),h=i(1725),c=i(5053),u=i(7319),d=i(4705),p=i(477),g=i(5319),f=i(9582),m=i(5185),A=i(6973),_=i(2696);function y(e){r.A.call(this,e),this.addType(c.A.X3DBackgroundNode),this.addChildObjects(c.A.inputOutput,"hidden",new n.A.SFBool),this.setVisibleObject(!0),this._skyAngle.setUnit("angle"),this._groundAngle.setUnit("angle"),this.modelMatrix=new f.A,this.clipPlanes=[],this.colors=[],this.sphere=[],this.textureNodes=new Array(6),this.textureBits=new A.A,this.sphereContext=new o.A({colorMaterial:!0}),this.texturesContext=new o.A({localObjectsKeys:this.sphereContext.localObjectsKeys}),this.localObjectsKeys=this.sphereContext.localObjectsKeys,this[u.A.RENDER_KEY]=this,this[u.A.TRANSMISSION_KEY]=this,this[u.A.VOLUME_SCATTER_KEY]=null}Object.assign(Object.setPrototypeOf(y.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this);const e=this.getBrowser().getContext();this.colorBuffer=e.createBuffer(),this.sphereBuffer=e.createBuffer(),this.texCoordBuffers=[e.createBuffer()],this.textureBuffers=Array.from({length:6},()=>e.createBuffer()),this.sphereArrayObject=new a.A(e),this.textureArrayObjects=Array.from({length:6},()=>new a.A(e)),this._groundAngle.addInterest("build",this),this._groundColor.addInterest("build",this),this._skyAngle.addInterest("build",this),this._skyColor.addInterest("build",this),this.build(),this.transferRectangle()},isHidden(){return this._hidden.getValue()},setHidden(e){e!==this._hidden.getValue()&&(this._hidden=e)},isTransparent(){if(this._hidden.getValue())return!0;if(this._transparency.getValue()<=0)return!1;if(6!==this.textureBits.size)return!0;for(const e of this.textureBits)if(this.textureNodes[e]._transparent.getValue())return!0;return!1},getRenderPassNodes(){return this.renderPassNodes},set_texture__(e,t){this.textureNodes[e]?.removeInterest(`set_loadState${e}__`,this),this.textureNodes[e]=t,t?.addInterest(`set_loadState${e}__`,this,e,t),this.set_loadState__(e,t)},set_loadState__(e,t){this.setTextureBit(e,t?.checkLoadState())},setTextureBit(e,t){this.textureBits.set(e,t===c.A.COMPLETE_STATE)},getColor:(e,t,i)=>t[m.A.upperBound(i,0,i.length,e)],build(){if(this.colors.length=0,this.sphere.length=0,0===this._groundColor.length&&1==this._skyColor.length){this.sphere.vertices=36,this.sphere.push(1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,1,1,-1,1,1,-1,1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,1,-1,1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,1);const e=this._skyColor[0];for(let t=0,i=this.sphere.vertices;t<i;++t)this.colors.push(...e,1)}else{if(this._skyColor.length>this._skyAngle.length){const e=this._skyAngle.slice();(0===e.length||e[0]>0)&&e.unshift(0),e.at(-1)<Math.PI&&e.push(Math.PI),2===e.length&&e.splice(1,0,(e[0]+e[1])/2),this.buildSphere(e,this._skyAngle,this._skyColor,!1)}if(this._groundColor.length>this._groundAngle.length){const e=this._groundAngle.slice().reverse();(0===e.length||e[0]<Math.PI/2)&&e.unshift(Math.PI/2),e.at(-1)>0&&e.push(0),this.buildSphere(e,this._groundAngle,this._groundColor,!0)}}this.transferSphere()},buildSphere:(()=>{const e=new d.A,t=new d.A,i=new d.A,n=new d.A,s=new d.A,r=new d.A;return function(o,a,l,h){const c=h?Math.PI/2:Math.PI,u=o.length-1;for(let d=0;d<u;++d){let u=m.A.clamp(o[d],0,c),p=m.A.clamp(o[d+1],0,c);h&&(u=Math.PI-u,p=Math.PI-p),e.setPolar(1,u),t.setPolar(1,p);const g=this.getColor(o[d],l,a),f=this.getColor(o[d+1],l,a);for(let o=0;o<20;++o){const a=o<19?o+1:0;let l=2*Math.PI*(o/20);i.setPolar(-e.imag,l),n.setPolar(-t.imag,l),l=2*Math.PI*(a/20),s.setPolar(-t.imag,l),r.setPolar(-e.imag,l),this.colors.push(...g,1,...f,1,...f,1,...g,1,...g,1,...f,1),this.sphere.push(i.imag,e.real,i.real,1,s.imag,t.real,s.real,1,n.imag,t.real,n.real,1,i.imag,e.real,i.real,1,r.imag,e.real,r.real,1,s.imag,t.real,s.real,1)}}}})(),transferSphere(){const e=this.getBrowser().getContext();e.bindBuffer(e.ARRAY_BUFFER,this.colorBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.colors),e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.sphereBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.sphere),e.DYNAMIC_DRAW),this.sphereCount=this.sphere.length/4},transferRectangle:(()=>{const e=new Float32Array([1,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,0,0,1]),t=[new Float32Array([1,1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,-1,1,1,-1,-1,1]),new Float32Array([-1,1,1,1,1,1,1,1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,1]),new Float32Array([-1,1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1]),new Float32Array([1,1,1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1,1,-1,-1,1,1,-1,1,1]),new Float32Array([1,1,1,1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1]),new Float32Array([1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1])];return function(){const i=this.getBrowser().getContext();i.bindBuffer(i.ARRAY_BUFFER,this.texCoordBuffers[0]),i.bufferData(i.ARRAY_BUFFER,e,i.DYNAMIC_DRAW);for(let e=0;e<6;++e)i.bindBuffer(i.ARRAY_BUFFER,this.textureBuffers[e]),i.bufferData(i.ARRAY_BUFFER,t[e],i.DYNAMIC_DRAW)}})(),traverse(e,t){switch(e){case l.A.CAMERA:return t.getLayer().getBackgrounds().push(this),void this.modelMatrix.assign(t.getModelViewMatrix().get());case l.A.DISPLAY:{const e=t.getLocalObjects(),i=this.clipPlanes,n=this.localObjectsKeys;let s=0;for(const t of e)t.isClipPlane&&(i[s++]=t);return i.length=s,n.length=s,void n.fill(0)}}},display:(()=>{const e=new Float32Array(16),t=new f.A,i=new f.A(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1),n=new Float32Array(16),s=new f.A,r=new g.A,o=new p.A;return function(a,l){if(this._hidden.getValue())return;const h=this.getBrowser();if(h.getWireframe()){const e=a.getExtension("WEBGL_polygon_mode");e?.polygonModeWEBGL(a.FRONT_AND_BACK,e.FILL_WEBGL)}a.disable(a.DEPTH_TEST),a.depthMask(!1),a.enable(a.CULL_FACE),a.frontFace(a.CCW),e.set(t.assign(l.getProjectionMatrixArray()).multRight(i));const c=l.getViewpoint().getMaxFarValue();if(s.assign(this.modelMatrix),s.multRight(l.getViewMatrix().get()),s.get(null,r),s.identity(),s.rotate(r),s.scale(o.set(c,c,c)),n.set(s),this.drawSphere(l,n,e),+this.textureBits&&this.drawCube(l,n,e),a.depthMask(!0),a.enable(a.DEPTH_TEST),a.disable(a.BLEND),h.getWireframe()){const e=a.getExtension("WEBGL_polygon_mode");e?.polygonModeWEBGL(a.FRONT_AND_BACK,e.LINE_WEBGL)}}})(),drawSphere(e,t,i){const n=m.A.clamp(this._transparency.getValue(),0,1);if(1===n)return;const s=this.getBrowser(),r=s.getContext(),o=this.sphereContext;o.alphaMode=n?h.A.BLEND:h.A.OPAQUE,o.renderObject=e;const a=s.getDefaultMaterial().getShader(o);a.enable(r),a.setClipPlanes(r,this.clipPlanes,e),r.uniformMatrix4fv(a.x3d_ProjectionMatrix,!1,i),r.uniformMatrix4fv(a.x3d_EyeMatrix,!1,e.getEyeMatrixArray()),r.uniformMatrix4fv(a.x3d_ModelViewMatrix,!1,t),r.uniform3f(a.x3d_EmissiveColor,1,1,1),r.uniform1f(a.x3d_Transparency,n),r.uniform1i(a.x3d_TextureCoordinateGenerator[0].mode,0),this.sphereArrayObject.enable(a.getProgram())&&(a.enableColorAttribute(r,this.colorBuffer,0,0),a.enableVertexAttribute(r,this.sphereBuffer,0,0)),n?r.enable(r.BLEND):r.disable(r.BLEND),r.drawArrays(r.TRIANGLES,0,this.sphereCount)},drawCube:(()=>{const e=new Float32Array(f.A.IDENTITY);return function(t,i,n){const s=this.getBrowser(),r=s.getContext(),o=this.texturesContext;for(const a of this.textureBits){const l=this.textureNodes[a];o.alphaMode=l._transparent.getValue()?h.A.BLEND:h.A.OPAQUE,o.textureNode=l,o.renderObject=t;const c=s.getDefaultMaterial().getShader(o);c.enable(r),c.setClipPlanes(r,this.clipPlanes,t),r.uniformMatrix4fv(c.x3d_ProjectionMatrix,!1,n),r.uniformMatrix4fv(c.x3d_EyeMatrix,!1,t.getEyeMatrixArray()),r.uniformMatrix4fv(c.x3d_ModelViewMatrix,!1,i),r.uniformMatrix4fv(c.x3d_TextureMatrix[0],!1,e),r.uniform3f(c.x3d_EmissiveColor,1,1,1),r.uniform1f(c.x3d_Transparency,0),r.uniform1i(c.x3d_TextureCoordinateGenerator[0].mode,0),this.drawRectangle(r,s,c,l,this.textureBuffers[a],this.textureArrayObjects[a])}}})(),drawRectangle(e,t,i,n,s,r){n.setShaderUniforms(e,i.x3d_Texture[0]),r.enable(i.getProgram())&&(i.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),i.enableVertexAttribute(e,s,0,0)),n._transparent.getValue()?e.enable(e.BLEND):e.disable(e.BLEND),e.drawArrays(e.TRIANGLES,0,6),t.resetTextureUnits()}}),Object.defineProperties(y,s.A.getStaticProperties("X3DBackgroundNode","EnvironmentalEffects",1));for(let e=0;e<6;++e)y.prototype[`set_loadState${e}__`]=function(e,t){this.set_loadState__(e,t)};const w=y,x=_.A.add("X3DBackgroundNode",w)},5542(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(8588),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.getId(),e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"RouteArray",enumerable:!0}});const a=o,l=r.A.add("RouteArray",a)},5543(e,t,i){i.d(t,{A:()=>C});var n=i(8381),s=i(8944),r=i(5717),o=i(3999),a=i(3097),l=i(2804),h=i(2696);function c(e=[]){return a.A.call(this,Array.from(e,e=>[e.getName(),e]),l.A)}Object.setPrototypeOf(c.prototype,a.A.prototype);for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});Object.defineProperties(c,{typeName:{value:"FieldArray",enumerable:!0}});const u=c,d=h.A.add("FieldArray",u);var p=i(8015),g=i(5053),f=i(9039);const m=Symbol(),A=Symbol(),_=Symbol(),y=Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions"),w=Symbol(),x=Symbol(),b=Symbol(),S=Symbol(),T=Symbol(),v=Symbol.for("X_ITE.X3DBaseNode.set_live__");function O(e,t=e.getBrowser()){if(!this[A]){n.A.call(this),this[m]=t,this[A]=e,this[_]=[],this[y]=this.constructor.fieldDefinitions??this[y],this[w]=new d,this[x]=new d,this[b]=[],this[T]=!0,this[S]=!1,this.canUserDefinedFields()&&(this[y]=new o.A(this[y]));for(const e of this[y])this.addPredefinedField(e);this.addChildObjects(g.A.outputOnly,"name_changed",new p.A.SFTime,g.A.outputOnly,"typeName_changed",new p.A.SFTime,g.A.outputOnly,"parents_changed",new p.A.SFTime)}}Object.assign(Object.setPrototypeOf(O.prototype,n.A.prototype),{[y]:new o.A([]),setName(e){n.A.prototype.setName.call(this,e),this._name_changed=Date.now()/1e3},getBrowser(){return this[m]},getScene(){return this[A]?.getLocalScene()??null},getExecutionContext(){return this[A]},setExecutionContext(e){if(!this[_].includes(g.A.X3DScene))throw new Error(`${this.getTypeName()}.setExecutionContext is not supported.`);this.getOuterNode?.()?.getLive().removeInterest(v,this),this[A]?.getLive().removeInterest(v,this),this[m].getLive().removeInterest(v,this),this[A]=e,this.getOuterNode?.()?this.getOuterNode().getLive().addInterest(v,this):this[A]?this[A].getLive().addInterest(v,this):this[m].getLive().addInterest(v,this),this[v]()},addType(e){this[_].push(e)},getType(){return this[_]},setup(){Object.freeze(this[_]),this[y].addParent(this),this[w].addParent(this),this[x].addParent(this);for(const e of this[b])e.setTainted(!1);for(const e of this[w])e.setTainted(!1);for(const e of this[x])e.setTainted(!1);this.initialize(),this[S]=!0},initialize(){},isInitialized(){return this[S]},getInnerNode(){return this},isLive(){return this[T]},setLive(e){this[T]=!!e.valueOf(),this[v]()},getLive:(()=>{function e(){return this._live}return function(){return Object.defineProperty(this,"getLive",{value:e}),this.addChildObjects(g.A.outputOnly,"live",new p.A.SFBool(this.checkLiveState())),this._live.removeParent(this),this.getOuterNode?.()?this.getOuterNode().getLive().addInterest(v,this):this[A]&&this!==this[m]?this[A].getLive().addInterest(v,this):this[A]||this===this[m]||this[m].getLive().addInterest(v,this),this._live}})(),checkLiveState(){return this.getOuterNode?.()?this[T]&&this.getOuterNode().getLive().getValue():this[A]&&this!==this[m]?this[T]&&this[A].getLive().getValue():this[A]||this===this[m]?this[T]:this[T]&&this[m].isLive()},[v](){const e=this._live;if(e)if(this.checkLiveState()){if(e.getValue())return;e.set(!0),e.processEvent()}else e.getValue()&&(e.set(!1),e.processEvent())},addChildObjects(...e){const t=e.length;for(let i=0;i<t;i+=3)this.addChildObject(e[i],e[i+1],e[i+2])},addChildObject(e,t,i){this[b].push(i),i.setPrivate(!0),i.setTainted(!0),i.addParent(this),i.setName(t),i.setAccessType(e),Object.defineProperty(this,`_${t}`,{get:()=>i,set(e){i.setValue(e)}})},getFieldDefinitions(){return this[y]},getField(e){const t=E(this[x],e)??E(this[w],e);if(t)return t;throw new Error(`Unknown field '${e}' in node class ${this.getTypeName()}.`)},getFields(){return[...this[w],...this[x]]},addPredefinedField(e){const t=e.getAccessType(),i=e.getName(),n=e.getValue().copy();n.setTainted(!this[S]),n.addParent(this),n.setName(i),n.setAccessType(t),this[w].add(i,n),Object.defineProperty(this,`_${i}`,{get:()=>n,set(e){n.setValue(e)},configurable:!0})},addAlias(e,t){this[w].alias(e,t),t.isInitializable()&&f.A.addFieldName(e)},removePredefinedField(e){const t=this[w].get(e);t&&(t.removeParent(this),this[w].remove(e),delete this[`_${t.getName()}`])},getPredefinedField(e){const t=E(this[w],e);if(t)return t;throw new Error(`Unknown predefined field '${e}' in node class ${this.getTypeName()}.`)},getPredefinedFields(){return this[w]},canUserDefinedFields:()=>!1,addUserDefinedField(e,t,i){if(!this.canUserDefinedFields())throw new Error("Couldn't add user-defined field, node does not support this.");this[x].has(t)&&this.removeUserDefinedField(t),i.setTainted(!this[S]),i.addParent(this),i.setName(t),i.setAccessType(e),this[y].remove(t),this[y].add(t,new r.A(e,t,i)),this[x].add(t,i)},removeUserDefinedField(e){const t=this[x].get(e);t&&(t.removeParent(this),this[y].remove(e),this[x].remove(e))},getUserDefinedField(e){const t=E(this[x],e);if(t)return t;throw new Error(`Unknown user-defined field '${e}' in node class ${this.getTypeName()}.`)},getUserDefinedFields(){return this[x]},getChangedFields(e=!1){const t=[];if(e)for(const e of this[x])t.push(e);for(const i of this[w])if(e&&(i.getInputRoutes().size||i.getOutputRoutes().size))t.push(i);else{if(0===i.getReferences().size){if(!i.isInitializable())continue;if(this.isDefaultValue(i))continue}t.push(i)}return t},isDefaultValue(e){const t=e.getName(),i=(this[x].get(t)??this[w].get(t))===e?this[y].get(t):this.constructor.fieldDefinitions?.get(t);return i?.getValue().equals(e)??e.getModificationTime()<0},getExtendedEventHandling:()=>!0,addEvent(e){e.isTainted()?e.setModificationTime(Date.now()/1e3):(e.setTainted(!0),this.addEventObject(e,s.A.create(e)))},addEventObject(e,t){const i=this[m];e.setModificationTime(Date.now()/1e3),i.addTaintedField(e,t),i.addBrowserEvent(),this.isTainted()||(e.isInput()||this.getExtendedEventHandling()&&e.isInitializable())&&this.addNodeEvent()},addNodeEvent(){if(this.setModificationTime(Date.now()/1e3),this.isTainted())return;const e=this[m];this.setTainted(!0),e.addTaintedNode(this),e.addBrowserEvent()},parentsChanged(){const e=Date.now()/1e3;this[A]&&(this[A]._sceneGraph_changed=e),this._parents_changed=e},dispose(){this.getOuterNode?.()?.getLive().removeInterest(v,this),this[A]?.getLive().removeInterest(v,this),this[m]?.getLive().removeInterest(v,this),this.setLive(!1);for(const e of this[b])e.dispose();for(const e of this[w])e.dispose();for(const e of this[x])e.dispose();n.A.prototype.dispose.call(this)}});const E=(()=>{const e=/^set_(.*?)$/,t=/^(.*?)_changed$/;return function(i,n){const s=i.get(n);if(s)return s;const r=n.match(e);if(r){const e=i.get(r[1]);if(e?.getAccessType()===g.A.inputOutput)return e}else{const e=n.match(t);if(e){const t=i.get(e[1]);if(t?.getAccessType()===g.A.inputOutput)return t}}}})();for(const e of Object.keys(O.prototype))Object.defineProperty(O.prototype,e,{enumerable:!1});Object.defineProperties(O.prototype,{name_changed:{get(){return this._name_changed}},typeName_changed:{get(){return this._typeName_changed}},parents_changed:{get(){return this._parents_changed}}});const N=O,C=h.A.add("X3DBaseNode",N)},5575(e,t,i){i.d(t,{A:()=>l});var n=i(2696);const s=[],r=[],o=[];const a=function(e,t){const i=e.order,n=e.length,a=t.values,l=t.vectors;let h,c,u,d,p,g,f,m,A,_,y,w,x;for(w=0;w<i;++w)for(s[w]=s[w]??[],r[w]=a[w]=e.get1(w,w),o[w]=0,x=0;x<i;++x)l[w][x]=w===x?1:0,s[w][x]=e.get1(x,w);for(w=0;w<50;++w){for(h=0,_=0;_<i-1;++_)for(y=_+1;y<i;++y)h+=Math.abs(s[_][y]);if(0===h)break;for(A=w<3?.2*h/n:0,_=0;_<i-1;++_)for(y=_+1;y<i;++y)if(m=100*Math.abs(s[_][y]),w>3&&Math.abs(a[_])+m===Math.abs(a[_])&&Math.abs(a[y])+m===Math.abs(a[y]))s[_][y]=0;else if(Math.abs(s[_][y])>A){for(f=a[y]-a[_],Math.abs(f)+m===Math.abs(f)?p=s[_][y]/f:(c=.5*f/s[_][y],p=1/(Math.abs(c)+Math.sqrt(1+c*c)),c<0&&(p=-p)),u=1/Math.sqrt(1+p*p),d=p*u,g=d/(1+u),f=p*s[_][y],o[_]-=f,o[y]+=f,a[_]-=f,a[y]+=f,s[_][y]=0,x=0;x<_;++x)m=s[x][_],f=s[x][y],s[x][_]=m-d*(f+m*g),s[x][y]=f+d*(m-f*g);for(x=_+1;x<y;++x)m=s[_][x],f=s[x][y],s[_][x]=m-d*(f+m*g),s[x][y]=f+d*(m-f*g);for(x=y+1;x<i;++x)m=s[_][x],f=s[y][x],s[_][x]=m-d*(f+m*g),s[y][x]=f+d*(m-f*g);for(x=0;x<i;++x)m=l[x][_],f=l[x][y],l[x][_]=m-d*(f+m*g),l[x][y]=f+d*(m-f*g)}for(_=0;_<i;++_)a[_]=r[_]+=o[_],o[_]=0}return t},l=n.A.add("eigen_decomposition",a)},5595(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(8187),l=i(937),h=i(5053),c=i(2696);function u(e){o.A.call(this,e),this.addType(h.A.LayerSet),this.addChildObject(h.A.outputOnly,"activeLayerNode",new n.A.SFNode),this.layerNodes=[new a.A(e)],this.layerNode0=this.layerNodes[0]}Object.assign(Object.setPrototypeOf(u.prototype,o.A.prototype),{initialize(){o.A.prototype.initialize.call(this),this.layerNode0.setPrivate(!0),this.layerNode0.setup(),this.layerNode0.setLayer0(!0),this._activeLayer.addInterest("set_activeLayer__",this),this._order.addInterest("set_layers__",this),this._layers.addInterest("set_layers__",this),this.set_layers__()},getActiveLayer(){return this._activeLayerNode.getValue()},getLayer0(){return this.layerNode0},setLayer0(e){this.layerNode0=e,this.set_layers__()},getLayers(){return this.layerNodes},set_activeLayer__(){let e;if(0===this._activeLayer.getValue())e=this.layerNode0;else{const t=this._activeLayer.getValue()-1;e=t>=0&&t<this._layers.length?(0,l.A)(h.A.X3DLayerNode,this._layers[t]):null}e?._display.getValue()||(e=null),this._activeLayerNode.getValue()!==e&&(this._activeLayerNode=e)},set_layers__(){const e=this._layers.getValue();for(const e of this.layerNodes)e._display.removeInterest("set_layers__",this);this.layerNodes.length=0;for(let t of this._order)if(0===t)this.layerNode0._display.addInterest("set_layers__",this),this.layerNodes.push(this.layerNode0);else if(--t,t>=0&&t<e.length){const i=(0,l.A)(h.A.X3DLayerNode,e[t]);if(!i)continue;i._display.addInterest("set_layers__",this),i._display.getValue()&&this.layerNodes.push(i)}this.set_activeLayer__()},bindBindables(e){this.layerNode0?.bindBindables(e);for(const t of this._layers){const i=(0,l.A)(h.A.X3DLayerNode,t);i?.bindBindables(e)}},traverse(e,t){for(const i of this.layerNodes)i.traverse(e,t)}}),Object.defineProperties(u,{...o.A.getStaticProperties("LayerSet","Layering",1,"children","3.2"),fieldDefinitions:{value:new r.A([new s.A(h.A.inputOutput,"metadata",new n.A.SFNode),new s.A(h.A.inputOutput,"activeLayer",new n.A.SFInt32),new s.A(h.A.inputOutput,"order",new n.A.MFInt32(0)),new s.A(h.A.inputOutput,"layers",new n.A.MFNode)]),enumerable:!0}});const d=u,p=c.A.add("LayerSet",d)},5687(e,t,i){i.d(t,{A:()=>h});var n=i(9582),s=i(477),r=i(4803),o=i(2696);function a(...e){this.matrix=new n.A,this.set(...arguments)}Object.assign(a.prototype,{copy(){const e=Object.create(a.prototype);return e.matrix=this.matrix.copy(),e},assign(e){return this.matrix.assign(e.matrix),this},equals(e){return this.matrix.equals(e.matrix)},getMatrix(){return this.matrix},set(e,t){switch(arguments.length){case 0:return this.matrix.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this;case 2:return this.matrix.set(e.x/2,0,0,0,0,e.y/2,0,0,0,0,e.z/2,0,t.x,t.y,t.z,1),this}},setExtents(e,t){const i=(t.x-e.x)/2,n=(t.y-e.y)/2,s=(t.z-e.z)/2,r=(t.x+e.x)/2,o=(t.y+e.y)/2,a=(t.z+e.z)/2;return this.matrix.set(i,0,0,0,0,n,0,0,0,0,s,0,r,o,a,1),this},getExtents(e,t){this.getAbsoluteExtents(e,t),e.add(this.center),t.add(this.center)},getAbsoluteExtents:(()=>{const e=new s.A,t=new s.A,i=new s.A;return function(n,s){const r=this.matrix,o=r.xAxis,a=r.yAxis,l=r.zAxis;e.assign(a).add(l);const h=l.subtract(a);t.assign(o).add(e),i.assign(o).add(h);const c=e.subtract(o),u=h.subtract(o);n.assign(t).min(c,u,i),s.assign(t).max(c,u,i),t.negate(),c.negate(),u.negate(),i.negate(),n.min(t,c,u,i),s.max(t,c,u,i)}})(),getPoints:(()=>{const e=new s.A,t=new s.A,i=new s.A,n=new s.A;return function(s){const r=this.matrix;e.assign(r.xAxis),t.assign(r.yAxis),i.assign(r.zAxis),n.assign(t).add(i);const o=i.subtract(t);s[0].assign(e).add(n),s[1].assign(n).subtract(e),s[2].assign(o).subtract(e),s[3].assign(e).add(o),s[4].assign(s[2]).negate(),s[5].assign(s[3]).negate(),s[6].assign(s[0]).negate(),s[7].assign(s[1]).negate();const a=this.center;return s[0].add(a),s[1].add(a),s[2].add(a),s[3].add(a),s[4].add(a),s[5].add(a),s[6].add(a),s[7].add(a),s}})(),getAxes(e){const t=this.matrix;return e[0].assign(t.xAxis),e[1].assign(t.yAxis),e[2].assign(t.zAxis),e},getNormals:(()=>{const e=new s.A,t=new s.A,i=new s.A,n=[s.A.X_AXIS,s.A.Y_AXIS,s.A.Z_AXIS];return function(r){const o=this.matrix;if(e.assign(o.xAxis),t.assign(o.yAxis),i.assign(o.zAxis),0===e.squaredNorm()&&(e.assign(t).cross(i),0===e.squaredNorm())){for(const i of n)if(e.assign(i).cross(t),0!==e.squaredNorm())break;if(0===e.squaredNorm()){for(const t of n)if(e.assign(t).cross(i),0!==e.squaredNorm())break;0===e.squaredNorm()&&e.assign(s.A.X_AXIS)}}if(0===t.squaredNorm()&&(t.assign(i).cross(e),0===t.squaredNorm())){for(const e of n)if(t.assign(e).cross(i),0!==t.squaredNorm())break;if(0===t.squaredNorm()){for(const i of n)if(t.assign(i).cross(e),0!==t.squaredNorm())break;0===t.squaredNorm()&&t.assign(s.A.Y_AXIS)}}if(0===i.squaredNorm()&&(i.assign(e).cross(t),0===i.squaredNorm())){for(const t of n)if(i.assign(t).cross(e),0!==i.squaredNorm())break;if(0===i.squaredNorm()){for(const e of n)if(i.assign(e).cross(t),0!==i.squaredNorm())break;0===i.squaredNorm()&&i.assign(s.A.Z_AXIS)}}return r[0].assign(t).cross(i).normalize(),r[1].assign(i).cross(e).normalize(),r[2].assign(e).cross(t).normalize(),r}})(),isEmpty(){return 0===this.matrix[15]},add:(()=>{const e=new s.A,t=new s.A,i=new s.A,n=new s.A;return function(s){return this.isEmpty()?this.assign(s):s.isEmpty()?this:(this.getExtents(e,t),s.getExtents(i,n),this.setExtents(e.min(i),t.max(n)))}})(),multLeft(e){return this.matrix.multLeft(e),this},multRight(e){return this.matrix.multRight(e),this},containsPoint:(()=>{const e=new s.A,t=new s.A;return function(i){return this.getExtents(e,t),e.x<=i.x&&t.x>=i.x&&e.y<=i.y&&t.y>=i.y&&e.z<=i.z&&t.z>=i.z}})(),intersectsBox:(()=>{const e=Array.from({length:8},()=>new s.A),t=Array.from({length:8},()=>new s.A),i=Array.from({length:3},()=>new s.A),n=Array.from({length:3},()=>new s.A),o=Array.from({length:9},()=>new s.A),a=Array.from({length:3},()=>new s.A);return function(s){if(this.isEmpty())return!1;if(s.isEmpty())return!1;if(this.getPoints(e),s.getPoints(t),r.A.isSeparated(this.getNormals(a),e,t))return!1;if(r.A.isSeparated(s.getNormals(a),e,t))return!1;this.getAxes(i),s.getAxes(n);for(let e=0;e<3;++e)for(let t=0;t<3;++t)o[3*e+t].assign(i[e]).cross(n[t]);return!r.A.isSeparated(o,e,t)}})(),toString(){return`${this.size}, ${this.center}`}}),Object.assign(a,{Extents:(e,t)=>(new a).setExtents(e,t),Points(e){const t=new s.A(Number.POSITIVE_INFINITY),i=new s.A(Number.NEGATIVE_INFINITY);for(const n of e)t.min(n),i.max(n);return(new a).setExtents(t,i)}}),Object.defineProperties(a.prototype,{size:{get:(()=>{const e=new s.A,t=new s.A;return function(){return this.getAbsoluteExtents(e,t),t.subtract(e)}})(),enumerable:!0},center:{get(){return this.matrix.origin},enumerable:!0}});const l=a,h=o.A.add("Box3",l)},5704(e){var t={DEBUG:!1,assert:function(e,i){if(t.DEBUG&&!e)throw new Error("Assertion failed"+(i?": "+i:""))},GLU_TESS_MAX_COORD:1e150,TRUE_PROJECT:!1,GLU_TESS_DEFAULT_TOLERANCE:0,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111,GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901}};t.PQHandle,t.geom={},t.geom.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},t.geom.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},t.geom.edgeEval=function(e,t,i){var n=t.s-e.s,s=i.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-i.t)*(n/(n+s)):t.t-i.t+(i.t-e.t)*(s/(n+s)):0},t.geom.edgeSign=function(e,t,i){var n=t.s-e.s,s=i.s-t.s;return n+s>0?(t.t-i.t)*n+(t.t-e.t)*s:0},t.geom.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},t.geom.transEval=function(e,t,i){var n=t.t-e.t,s=i.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-i.s)*(n/(n+s)):t.s-i.s+(i.s-e.s)*(s/(n+s)):0},t.geom.transSign=function(e,t,i){var n=t.t-e.t,s=i.t-t.t;return n+s>0?(t.s-i.s)*n+(t.s-e.s)*s:0},t.geom.edgeGoesLeft=function(e){return t.geom.vertLeq(e.dst(),e.org)},t.geom.edgeGoesRight=function(e){return t.geom.vertLeq(e.org,e.dst())},t.geom.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},t.geom.vertCCW=function(e,t,i){return e.s*(t.t-i.t)+t.s*(i.t-e.t)+i.s*(e.t-t.t)>=0},t.geom.interpolate_=function(e,t,i,n){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+n)/2:t+e/(e+i)*(n-t):n+i/(e+i)*(t-n)},t.geom.edgeIntersect=function(e,i,n,s,r){var o,a,l;t.geom.vertLeq(e,i)||(l=e,e=i,i=l),t.geom.vertLeq(n,s)||(l=n,n=s,s=l),t.geom.vertLeq(e,n)||(l=e,e=n,n=l,l=i,i=s,s=l),t.geom.vertLeq(n,i)?t.geom.vertLeq(i,s)?((o=t.geom.edgeEval(e,n,i))+(a=t.geom.edgeEval(n,i,s))<0&&(o=-o,a=-a),r.s=t.geom.interpolate_(o,n.s,a,i.s)):((o=t.geom.edgeSign(e,n,i))+(a=-t.geom.edgeSign(e,s,i))<0&&(o=-o,a=-a),r.s=t.geom.interpolate_(o,n.s,a,s.s)):r.s=(n.s+i.s)/2,t.geom.transLeq(e,i)||(l=e,e=i,i=l),t.geom.transLeq(n,s)||(l=n,n=s,s=l),t.geom.transLeq(e,n)||(l=e,e=n,n=l,l=i,i=s,s=l),t.geom.transLeq(n,i)?t.geom.transLeq(i,s)?((o=t.geom.transEval(e,n,i))+(a=t.geom.transEval(n,i,s))<0&&(o=-o,a=-a),r.t=t.geom.interpolate_(o,n.t,a,i.t)):((o=t.geom.transSign(e,n,i))+(a=-t.geom.transSign(e,s,i))<0&&(o=-o,a=-a),r.t=t.geom.interpolate_(o,n.t,a,s.t)):r.t=(n.t+i.t)/2},t.mesh={},t.mesh.makeEdge=function(e){var i=t.mesh.makeEdgePair_(e.eHead);return t.mesh.makeVertex_(i,e.vHead),t.mesh.makeVertex_(i.sym,e.vHead),t.mesh.makeFace_(i,e.fHead),i},t.mesh.meshSplice=function(e,i){var n=!1,s=!1;e!==i&&(i.org!==e.org&&(s=!0,t.mesh.killVertex_(i.org,e.org)),i.lFace!==e.lFace&&(n=!0,t.mesh.killFace_(i.lFace,e.lFace)),t.mesh.splice_(i,e),s||(t.mesh.makeVertex_(i,e.org),e.org.anEdge=e),n||(t.mesh.makeFace_(i,e.lFace),e.lFace.anEdge=e))},t.mesh.deleteEdge=function(e){var i=e.sym,n=!1;e.lFace!==e.rFace()&&(n=!0,t.mesh.killFace_(e.lFace,e.rFace())),e.oNext===e?t.mesh.killVertex_(e.org,null):(e.rFace().anEdge=e.oPrev(),e.org.anEdge=e.oNext,t.mesh.splice_(e,e.oPrev()),n||t.mesh.makeFace_(e,e.lFace)),i.oNext===i?(t.mesh.killVertex_(i.org,null),t.mesh.killFace_(i.lFace,null)):(e.lFace.anEdge=i.oPrev(),i.org.anEdge=i.oNext,t.mesh.splice_(i,i.oPrev())),t.mesh.killEdge_(e)},t.mesh.addEdgeVertex=function(e){var i=t.mesh.makeEdgePair_(e),n=i.sym;return t.mesh.splice_(i,e.lNext),i.org=e.dst(),t.mesh.makeVertex_(n,i.org),i.lFace=n.lFace=e.lFace,i},t.mesh.splitEdge=function(e){var i=t.mesh.addEdgeVertex(e).sym;return t.mesh.splice_(e.sym,e.sym.oPrev()),t.mesh.splice_(e.sym,i),e.sym.org=i.org,i.dst().anEdge=i.sym,i.sym.lFace=e.rFace(),i.winding=e.winding,i.sym.winding=e.sym.winding,i},t.mesh.connect=function(e,i){var n=!1,s=t.mesh.makeEdgePair_(e),r=s.sym;return i.lFace!==e.lFace&&(n=!0,t.mesh.killFace_(i.lFace,e.lFace)),t.mesh.splice_(s,e.lNext),t.mesh.splice_(r,i),s.org=e.dst(),r.org=i.org,s.lFace=r.lFace=e.lFace,e.lFace.anEdge=r,n||t.mesh.makeFace_(s,e.lFace),s},t.mesh.zapFace=function(e){var i,n=e.anEdge,s=n.lNext;do{if(s=(i=s).lNext,i.lFace=null,null===i.rFace()){i.oNext===i?t.mesh.killVertex_(i.org,null):(i.org.anEdge=i.oNext,t.mesh.splice_(i,i.oPrev()));var r=i.sym;r.oNext===r?t.mesh.killVertex_(r.org,null):(r.org.anEdge=r.oNext,t.mesh.splice_(r,r.oPrev())),t.mesh.killEdge_(i)}}while(i!==n);var o=e.prev,a=e.next;a.prev=o,o.next=a},t.mesh.meshUnion=function(e,t){var i=e.fHead,n=e.vHead,s=e.eHead,r=t.fHead,o=t.vHead,a=t.eHead;return r.next!==r&&(i.prev.next=r.next,r.next.prev=i.prev,r.prev.next=i,i.prev=r.prev),o.next!==o&&(n.prev.next=o.next,o.next.prev=n.prev,o.prev.next=n,n.prev=o.prev),a.next!==a&&(s.sym.next.sym.next=a.next,a.next.sym.next=s.sym.next,a.sym.next.sym.next=s,s.sym.next=a.sym.next),e},t.mesh.deleteMesh=function(e){},t.mesh.makeEdgePair_=function(e){var i=new t.GluHalfEdge,n=new t.GluHalfEdge,s=e.sym.next;return n.next=s,s.sym.next=i,i.next=e,e.sym.next=n,i.sym=n,i.oNext=i,i.lNext=n,n.sym=i,n.oNext=n,n.lNext=i,i},t.mesh.splice_=function(e,t){var i=e.oNext,n=t.oNext;i.sym.lNext=t,n.sym.lNext=e,e.oNext=n,t.oNext=i},t.mesh.makeVertex_=function(e,i){var n=i.prev,s=new t.GluVertex(i,n);n.next=s,i.prev=s,s.anEdge=e;var r=e;do{r.org=s,r=r.oNext}while(r!==e)},t.mesh.makeFace_=function(e,i){var n=i.prev,s=new t.GluFace(i,n);n.next=s,i.prev=s,s.anEdge=e,s.inside=i.inside;var r=e;do{r.lFace=s,r=r.lNext}while(r!==e)},t.mesh.killEdge_=function(e){var t=e.next,i=e.sym.next;t.sym.next=i,i.sym.next=t},t.mesh.killVertex_=function(e,t){var i=e.anEdge,n=i;do{n.org=t,n=n.oNext}while(n!==i);var s=e.prev,r=e.next;r.prev=s,s.next=r},t.mesh.killFace_=function(e,t){var i=e.anEdge,n=i;do{n.lFace=t,n=n.lNext}while(n!==i);var s=e.prev,r=e.next;r.prev=s,s.next=r},t.normal={},t.normal.S_UNIT_X_=1,t.normal.S_UNIT_Y_=0,t.normal.projectPolygon=function(e,i,n,s){var r=!1,o=[i,n,s];0===i&&0===n&&0===s&&(t.normal.computeNormal_(e,o),r=!0);var a,l=t.normal.longAxis_(o),h=e.mesh.vHead;if(t.TRUE_PROJECT){t.normal.normalize_(o);var c=[0,0,0],u=[0,0,0];c[l]=0,c[(l+1)%3]=t.normal.S_UNIT_X_,c[(l+2)%3]=t.normal.S_UNIT_Y_;var d=t.normal.dot_(c,o);for(c[0]-=d*o[0],c[1]-=d*o[1],c[2]-=d*o[2],t.normal.normalize_(c),u[0]=o[1]*c[2]-o[2]*c[1],u[1]=o[2]*c[0]-o[0]*c[2],u[2]=o[0]*c[1]-o[1]*c[0],t.normal.normalize_(u),a=h.next;a!==h;a=a.next)a.s=t.normal.dot_(a.coords,c),a.t=t.normal.dot_(a.coords,u)}else{var p=(l+1)%3,g=(l+2)%3,f=o[l]>0?1:-1;for(a=h.next;a!==h;a=a.next)a.s=a.coords[p],a.t=f*a.coords[g]}r&&t.normal.checkOrientation_(e)},t.normal.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},t.normal.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},t.normal.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},t.normal.computeNormal_=function(e,i){var n,s=[-2*t.GLU_TESS_MAX_COORD,-2*t.GLU_TESS_MAX_COORD,-2*t.GLU_TESS_MAX_COORD],r=[2*t.GLU_TESS_MAX_COORD,2*t.GLU_TESS_MAX_COORD,2*t.GLU_TESS_MAX_COORD],o=[],a=[],l=e.mesh.vHead;for(n=l.next;n!==l;n=n.next)for(var h=0;h<3;++h){var c=n.coords[h];c<r[h]&&(r[h]=c,a[h]=n),c>s[h]&&(s[h]=c,o[h]=n)}var u=0;if(s[1]-r[1]>s[0]-r[0]&&(u=1),s[2]-r[2]>s[u]-r[u]&&(u=2),r[u]>=s[u])return i[0]=0,i[1]=0,void(i[2]=1);var d=0,p=a[u],g=o[u],f=[0,0,0],m=[p.coords[0]-g.coords[0],p.coords[1]-g.coords[1],p.coords[2]-g.coords[2]],A=[0,0,0];for(n=l.next;n!==l;n=n.next){A[0]=n.coords[0]-g.coords[0],A[1]=n.coords[1]-g.coords[1],A[2]=n.coords[2]-g.coords[2],f[0]=m[1]*A[2]-m[2]*A[1],f[1]=m[2]*A[0]-m[0]*A[2],f[2]=m[0]*A[1]-m[1]*A[0];var _=f[0]*f[0]+f[1]*f[1]+f[2]*f[2];_>d&&(d=_,i[0]=f[0],i[1]=f[1],i[2]=f[2])}d<=0&&(i[0]=i[1]=i[2]=0,i[t.normal.longAxis_(m)]=1)},t.normal.checkOrientation_=function(e){for(var t=0,i=e.mesh.fHead,n=i.next;n!==i;n=n.next){var s=n.anEdge;if(!(s.winding<=0))do{t+=(s.org.s-s.dst().s)*(s.org.t+s.dst().t),s=s.lNext}while(s!==n.anEdge)}if(t<0)for(var r=e.mesh.vHead,o=r.next;o!==r;o=o.next)o.t=-o.t},t.render={},t.render.renderMesh=function(e,i,n){for(var s=!1,r=-1,o=i.fHead.prev;o!==i.fHead;o=o.prev)if(o.inside){s||(e.callBeginCallback(t.primitiveType.GL_TRIANGLES),s=!0);var a=o.anEdge;do{if(n){var l=a.rFace().inside?0:1;r!==l&&(r=l,e.callEdgeFlagCallback(!!r))}e.callVertexCallback(a.org.data),a=a.lNext}while(a!==o.anEdge)}s&&e.callEndCallback()},t.render.renderBoundary=function(e,i){for(var n=i.fHead.next;n!==i.fHead;n=n.next)if(n.inside){e.callBeginCallback(t.primitiveType.GL_LINE_LOOP);var s=n.anEdge;do{e.callVertexCallback(s.org.data),s=s.lNext}while(s!==n.anEdge);e.callEndCallback()}},t.sweep={},t.sweep.SENTINEL_COORD_=4*t.GLU_TESS_MAX_COORD,t.sweep.TOLERANCE_NONZERO_=!1,t.sweep.computeInterior=function(e){var i;for(e.fatalError=!1,t.sweep.removeDegenerateEdges_(e),t.sweep.initPriorityQ_(e),t.sweep.initEdgeDict_(e);null!==(i=e.pq.extractMin());){for(;;){var n=e.pq.minimum();if(null===n||!t.geom.vertEq(n,i))break;n=e.pq.extractMin(),t.sweep.spliceMergeVertices_(e,i.anEdge,n.anEdge)}t.sweep.sweepEvent_(e,i)}var s=e.dict.getMin().getKey();e.event=s.eUp.org,t.sweep.doneEdgeDict_(e),t.sweep.donePriorityQ_(e),t.sweep.removeDegenerateFaces_(e.mesh),e.mesh.checkMesh()},t.sweep.addWinding_=function(e,t){e.winding+=t.winding,e.sym.winding+=t.sym.winding},t.sweep.edgeLeq_=function(e,i,n){var s=e.event,r=i.eUp,o=n.eUp;return r.dst()===s?o.dst()===s?t.geom.vertLeq(r.org,o.org)?t.geom.edgeSign(o.dst(),r.org,o.org)<=0:t.geom.edgeSign(r.dst(),o.org,r.org)>=0:t.geom.edgeSign(o.dst(),s,o.org)<=0:o.dst()===s?t.geom.edgeSign(r.dst(),s,r.org)>=0:t.geom.edgeEval(r.dst(),s,r.org)>=t.geom.edgeEval(o.dst(),s,o.org)},t.sweep.deleteRegion_=function(e,t){t.fixUpperEdge,t.eUp.activeRegion=null,e.dict.deleteNode(t.nodeUp),t.nodeUp=null},t.sweep.fixUpperEdge_=function(e,i){t.mesh.deleteEdge(e.eUp),e.fixUpperEdge=!1,e.eUp=i,i.activeRegion=e},t.sweep.topLeftRegion_=function(e){var i=e.eUp.org;do{e=e.regionAbove()}while(e.eUp.org===i);if(e.fixUpperEdge){var n=t.mesh.connect(e.regionBelow().eUp.sym,e.eUp.lNext);t.sweep.fixUpperEdge_(e,n),e=e.regionAbove()}return e},t.sweep.topRightRegion_=function(e){var t=e.eUp.dst();do{e=e.regionAbove()}while(e.eUp.dst()===t);return e},t.sweep.addRegionBelow_=function(e,i,n){var s=new t.ActiveRegion;return s.eUp=n,s.nodeUp=e.dict.insertBefore(i.nodeUp,s),n.activeRegion=s,s},t.sweep.isWindingInside_=function(e,i){switch(e.windingRule){case t.windingRule.GLU_TESS_WINDING_ODD:return!!(1&i);case t.windingRule.GLU_TESS_WINDING_NONZERO:return 0!==i;case t.windingRule.GLU_TESS_WINDING_POSITIVE:return i>0;case t.windingRule.GLU_TESS_WINDING_NEGATIVE:return i<0;case t.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return i>=2||i<=-2}return!1},t.sweep.computeWinding_=function(e,i){i.windingNumber=i.regionAbove().windingNumber+i.eUp.winding,i.inside=t.sweep.isWindingInside_(e,i.windingNumber)},t.sweep.finishRegion_=function(e,i){var n=i.eUp,s=n.lFace;s.inside=i.inside,s.anEdge=n,t.sweep.deleteRegion_(e,i)},t.sweep.finishLeftRegions_=function(e,i,n){for(var s=i,r=i.eUp;s!==n;){s.fixUpperEdge=!1;var o=s.regionBelow(),a=o.eUp;if(a.org!==r.org){if(!o.fixUpperEdge){t.sweep.finishRegion_(e,s);break}a=t.mesh.connect(r.lPrev(),a.sym),t.sweep.fixUpperEdge_(o,a)}r.oNext!==a&&(t.mesh.meshSplice(a.oPrev(),a),t.mesh.meshSplice(r,a)),t.sweep.finishRegion_(e,s),r=o.eUp,s=o}return r},t.sweep.addRightEdges_=function(e,i,n,s,r,o){var a=!0,l=n;do{t.sweep.addRegionBelow_(e,i,l.sym),l=l.oNext}while(l!==s);null===r&&(r=i.regionBelow().eUp.rPrev());for(var h,c=i,u=r;(l=(h=c.regionBelow()).eUp.sym).org===u.org;)l.oNext!==u&&(t.mesh.meshSplice(l.oPrev(),l),t.mesh.meshSplice(u.oPrev(),l)),h.windingNumber=c.windingNumber-l.winding,h.inside=t.sweep.isWindingInside_(e,h.windingNumber),c.dirty=!0,!a&&t.sweep.checkForRightSplice_(e,c)&&(t.sweep.addWinding_(l,u),t.sweep.deleteRegion_(e,c),t.mesh.deleteEdge(u)),a=!1,c=h,u=l;c.dirty=!0,o&&t.sweep.walkDirtyRegions_(e,c)},t.sweep.callCombine_=function(e,i,n,s,r){var o=[i.coords[0],i.coords[1],i.coords[2]];i.data=null,i.data=e.callCombineCallback(o,n,s),null===i.data&&(r?e.fatalError||(e.callErrorCallback(t.errorType.GLU_TESS_NEED_COMBINE_CALLBACK),e.fatalError=!0):i.data=n[0])},t.sweep.spliceMergeVertices_=function(e,i,n){var s=[null,null,null,null];s[0]=i.org.data,s[1]=n.org.data,t.sweep.callCombine_(e,i.org,s,[.5,.5,0,0],!1),t.mesh.meshSplice(i,n)},t.sweep.vertexWeights_=function(e,i,n,s,r){var o=t.geom.vertL1dist(i,e),a=t.geom.vertL1dist(n,e),l=r,h=r+1;s[l]=.5*a/(o+a),s[h]=.5*o/(o+a),e.coords[0]+=s[l]*i.coords[0]+s[h]*n.coords[0],e.coords[1]+=s[l]*i.coords[1]+s[h]*n.coords[1],e.coords[2]+=s[l]*i.coords[2]+s[h]*n.coords[2]},t.sweep.getIntersectData_=function(e,i,n,s,r,o){var a=[0,0,0,0],l=[n.data,s.data,r.data,o.data];i.coords[0]=i.coords[1]=i.coords[2]=0,t.sweep.vertexWeights_(i,n,s,a,0),t.sweep.vertexWeights_(i,r,o,a,2),t.sweep.callCombine_(e,i,l,a,!0)},t.sweep.checkForRightSplice_=function(e,i){var n=i.regionBelow(),s=i.eUp,r=n.eUp;if(t.geom.vertLeq(s.org,r.org)){if(t.geom.edgeSign(r.dst(),s.org,r.org)>0)return!1;t.geom.vertEq(s.org,r.org)?s.org!==r.org&&(e.pq.remove(s.org.pqHandle),t.sweep.spliceMergeVertices_(e,r.oPrev(),s)):(t.mesh.splitEdge(r.sym),t.mesh.meshSplice(s,r.oPrev()),i.dirty=n.dirty=!0)}else{if(t.geom.edgeSign(s.dst(),r.org,s.org)<0)return!1;i.regionAbove().dirty=i.dirty=!0,t.mesh.splitEdge(s.sym),t.mesh.meshSplice(r.oPrev(),s)}return!0},t.sweep.checkForLeftSplice_=function(e,i){var n,s=i.regionBelow(),r=i.eUp,o=s.eUp;if(t.geom.vertLeq(r.dst(),o.dst())){if(t.geom.edgeSign(r.dst(),o.dst(),r.org)<0)return!1;i.regionAbove().dirty=i.dirty=!0,n=t.mesh.splitEdge(r),t.mesh.meshSplice(o.sym,n),n.lFace.inside=i.inside}else{if(t.geom.edgeSign(o.dst(),r.dst(),o.org)>0)return!1;i.dirty=s.dirty=!0,n=t.mesh.splitEdge(o),t.mesh.meshSplice(r.lNext,o.sym),n.rFace().inside=i.inside}return!0},t.sweep.checkForIntersect_=function(e,i){var n=i.regionBelow(),s=i.eUp,r=n.eUp,o=s.org,a=r.org,l=s.dst(),h=r.dst(),c=new t.GluVertex;if(o===a)return!1;if(Math.min(o.t,l.t)>Math.max(a.t,h.t))return!1;if(t.geom.vertLeq(o,a)){if(t.geom.edgeSign(h,o,a)>0)return!1}else if(t.geom.edgeSign(l,a,o)<0)return!1;t.geom.edgeIntersect(l,o,h,a,c),t.geom.vertLeq(c,e.event)&&(c.s=e.event.s,c.t=e.event.t);var u=t.geom.vertLeq(o,a)?o:a;if(t.geom.vertLeq(u,c)&&(c.s=u.s,c.t=u.t),t.geom.vertEq(c,o)||t.geom.vertEq(c,a))return t.sweep.checkForRightSplice_(e,i),!1;if(!t.geom.vertEq(l,e.event)&&t.geom.edgeSign(l,e.event,c)>=0||!t.geom.vertEq(h,e.event)&&t.geom.edgeSign(h,e.event,c)<=0){if(h===e.event)return t.mesh.splitEdge(s.sym),t.mesh.meshSplice(r.sym,s),s=(i=t.sweep.topLeftRegion_(i)).regionBelow().eUp,t.sweep.finishLeftRegions_(e,i.regionBelow(),n),t.sweep.addRightEdges_(e,i,s.oPrev(),s,s,!0),!0;if(l===e.event){t.mesh.splitEdge(r.sym),t.mesh.meshSplice(s.lNext,r.oPrev()),n=i;var d=(i=t.sweep.topRightRegion_(i)).regionBelow().eUp.rPrev();return n.eUp=r.oPrev(),r=t.sweep.finishLeftRegions_(e,n,null),t.sweep.addRightEdges_(e,i,r.oNext,s.rPrev(),d,!0),!0}return t.geom.edgeSign(l,e.event,c)>=0&&(i.regionAbove().dirty=i.dirty=!0,t.mesh.splitEdge(s.sym),s.org.s=e.event.s,s.org.t=e.event.t),t.geom.edgeSign(h,e.event,c)<=0&&(i.dirty=n.dirty=!0,t.mesh.splitEdge(r.sym),r.org.s=e.event.s,r.org.t=e.event.t),!1}return t.mesh.splitEdge(s.sym),t.mesh.splitEdge(r.sym),t.mesh.meshSplice(r.oPrev(),s),s.org.s=c.s,s.org.t=c.t,s.org.pqHandle=e.pq.insert(s.org),t.sweep.getIntersectData_(e,s.org,o,l,a,h),i.regionAbove().dirty=i.dirty=n.dirty=!0,!1},t.sweep.walkDirtyRegions_=function(e,i){for(var n=i.regionBelow();;){for(;n.dirty;)i=n,n=n.regionBelow();if(!i.dirty&&(n=i,null===(i=i.regionAbove())||!i.dirty))return;i.dirty=!1;var s=i.eUp,r=n.eUp;if(s.dst()!==r.dst()&&t.sweep.checkForLeftSplice_(e,i)&&(n.fixUpperEdge?(t.sweep.deleteRegion_(e,n),t.mesh.deleteEdge(r),r=(n=i.regionBelow()).eUp):i.fixUpperEdge&&(t.sweep.deleteRegion_(e,i),t.mesh.deleteEdge(s),s=(i=n.regionAbove()).eUp)),s.org!==r.org)if(s.dst()===r.dst()||i.fixUpperEdge||n.fixUpperEdge||s.dst()!==e.event&&r.dst()!==e.event)t.sweep.checkForRightSplice_(e,i);else if(t.sweep.checkForIntersect_(e,i))return;s.org===r.org&&s.dst()===r.dst()&&(t.sweep.addWinding_(r,s),t.sweep.deleteRegion_(e,i),t.mesh.deleteEdge(s),i=n.regionAbove())}},t.sweep.connectRightVertex_=function(e,i,n){var s,r=n.oNext,o=i.regionBelow(),a=i.eUp,l=o.eUp,h=!1;(a.dst()!==l.dst()&&t.sweep.checkForIntersect_(e,i),t.geom.vertEq(a.org,e.event)&&(t.mesh.meshSplice(r.oPrev(),a),r=(i=t.sweep.topLeftRegion_(i)).regionBelow().eUp,t.sweep.finishLeftRegions_(e,i.regionBelow(),o),h=!0),t.geom.vertEq(l.org,e.event)&&(t.mesh.meshSplice(n,l.oPrev()),n=t.sweep.finishLeftRegions_(e,o,null),h=!0),h)?t.sweep.addRightEdges_(e,i,n.oNext,r,r,!0):(s=t.geom.vertLeq(l.org,a.org)?l.oPrev():a,s=t.mesh.connect(n.lPrev(),s),t.sweep.addRightEdges_(e,i,s,s.oNext,s.oNext,!1),s.sym.activeRegion.fixUpperEdge=!0,t.sweep.walkDirtyRegions_(e,i))},t.sweep.connectLeftDegenerate_=function(e,i,n){var s=i.eUp;if(t.geom.vertEq(s.org,n))t.sweep.TOLERANCE_NONZERO_&&t.sweep.spliceMergeVertices_(e,s,n.anEdge);else{if(!t.geom.vertEq(s.dst(),n))return t.mesh.splitEdge(s.sym),i.fixUpperEdge&&(t.mesh.deleteEdge(s.oNext),i.fixUpperEdge=!1),t.mesh.meshSplice(n.anEdge,s),void t.sweep.sweepEvent_(e,n);if(t.sweep.TOLERANCE_NONZERO_){var r=(i=t.sweep.topRightRegion_(i)).regionBelow(),o=r.eUp.sym,a=o.oNext,l=a;r.fixUpperEdge&&(t.sweep.deleteRegion_(e,r),t.mesh.deleteEdge(o),o=a.oPrev()),t.mesh.meshSplice(n.anEdge,o),t.geom.edgeGoesLeft(a)||(a=null),t.sweep.addRightEdges_(e,i,o.oNext,l,a,!0)}}},t.sweep.connectLeftVertex_=function(e,i){var n=new t.ActiveRegion;n.eUp=i.anEdge.sym;var s=e.dict.search(n).getKey(),r=s.regionBelow(),o=s.eUp,a=r.eUp;if(0!==t.geom.edgeSign(o.dst(),i,o.org)){var l,h=t.geom.vertLeq(a.dst(),o.dst())?s:r;if(s.inside||h.fixUpperEdge){if(h===s)l=t.mesh.connect(i.anEdge.sym,o.lNext);else l=t.mesh.connect(a.dNext(),i.anEdge).sym;h.fixUpperEdge?t.sweep.fixUpperEdge_(h,l):t.sweep.computeWinding_(e,t.sweep.addRegionBelow_(e,s,l)),t.sweep.sweepEvent_(e,i)}else t.sweep.addRightEdges_(e,s,i.anEdge,i.anEdge,null,!0)}else t.sweep.connectLeftDegenerate_(e,s,i)},t.sweep.sweepEvent_=function(e,i){e.event=i;for(var n=i.anEdge;null===n.activeRegion;)if((n=n.oNext)===i.anEdge)return void t.sweep.connectLeftVertex_(e,i);var s=t.sweep.topLeftRegion_(n.activeRegion),r=s.regionBelow(),o=r.eUp,a=t.sweep.finishLeftRegions_(e,r,null);a.oNext===o?t.sweep.connectRightVertex_(e,s,a):t.sweep.addRightEdges_(e,s,a.oNext,o,o,!0)},t.sweep.addSentinel_=function(e,i){var n=new t.ActiveRegion,s=t.mesh.makeEdge(e.mesh);s.org.s=t.sweep.SENTINEL_COORD_,s.org.t=i,s.dst().s=-t.sweep.SENTINEL_COORD_,s.dst().t=i,e.event=s.dst(),n.eUp=s,n.windingNumber=0,n.inside=!1,n.fixUpperEdge=!1,n.sentinel=!0,n.dirty=!1,n.nodeUp=e.dict.insert(n)},t.sweep.initEdgeDict_=function(e){e.dict=new t.Dict(e,t.sweep.edgeLeq_),t.sweep.addSentinel_(e,-t.sweep.SENTINEL_COORD_),t.sweep.addSentinel_(e,t.sweep.SENTINEL_COORD_)},t.sweep.doneEdgeDict_=function(e){for(var i;null!==(i=e.dict.getMin().getKey());)i.sentinel,t.sweep.deleteRegion_(e,i);e.dict=null},t.sweep.removeDegenerateEdges_=function(e){for(var i,n=e.mesh.eHead,s=n.next;s!==n;s=i){i=s.next;var r=s.lNext;t.geom.vertEq(s.org,s.dst())&&s.lNext.lNext!==s&&(t.sweep.spliceMergeVertices_(e,r,s),t.mesh.deleteEdge(s),r=(s=r).lNext),r.lNext===s&&(r!==s&&(r!==i&&r!==i.sym||(i=i.next),t.mesh.deleteEdge(r)),s!==i&&s!==i.sym||(i=i.next),t.mesh.deleteEdge(s))}},t.sweep.initPriorityQ_=function(e){var i=new t.PriorityQ;e.pq=i;var n,s=e.mesh.vHead;for(n=s.next;n!==s;n=n.next)n.pqHandle=i.insert(n);i.init()},t.sweep.donePriorityQ_=function(e){e.pq.deleteQ(),e.pq=null},t.sweep.removeDegenerateFaces_=function(e){for(var i,n=e.fHead.next;n!==e.fHead;n=i){i=n.next;var s=n.anEdge;s.lNext.lNext===s&&(t.sweep.addWinding_(s.oNext,s),t.mesh.deleteEdge(s))}},t.tessmono={},t.tessmono.tessellateMonoRegion_=function(e){for(var i=e.anEdge;t.geom.vertLeq(i.dst(),i.org);i=i.lPrev());for(;t.geom.vertLeq(i.org,i.dst());i=i.lNext);for(var n,s=i.lPrev();i.lNext!==s;)if(t.geom.vertLeq(i.dst(),s.org)){for(;s.lNext!==i&&(t.geom.edgeGoesLeft(s.lNext)||t.geom.edgeSign(s.org,s.dst(),s.lNext.dst())<=0);)s=(n=t.mesh.connect(s.lNext,s)).sym;s=s.lPrev()}else{for(;s.lNext!==i&&(t.geom.edgeGoesRight(i.lPrev())||t.geom.edgeSign(i.dst(),i.org,i.lPrev().org)>=0);)n=t.mesh.connect(i,i.lPrev()),i=n.sym;i=i.lNext}for(;s.lNext.lNext!==i;)s=(n=t.mesh.connect(s.lNext,s)).sym},t.tessmono.tessellateInterior=function(e){for(var i,n=e.fHead.next;n!==e.fHead;n=i)i=n.next,n.inside&&t.tessmono.tessellateMonoRegion_(n)},t.tessmono.discardExterior=function(e){for(var i,n=e.fHead.next;n!==e.fHead;n=i)i=n.next,n.inside||t.mesh.zapFace(n)},t.tessmono.setWindingNumber=function(e,i,n){for(var s,r=e.eHead.next;r!==e.eHead;r=s)s=r.next,r.rFace().inside!==r.lFace.inside?r.winding=r.lFace.inside?i:-i:n?t.mesh.deleteEdge(r):r.winding=0},t.Dict=function(e,i){this.head_=new t.DictNode,this.frame_=e,this.leq_=i},t.Dict.prototype.deleteDict_=function(){},t.Dict.prototype.insertBefore=function(e,i){do{e=e.prev}while(null!==e.key&&!this.leq_(this.frame_,e.key,i));var n=new t.DictNode(i,e.next,e);return e.next.prev=n,e.next=n,n},t.Dict.prototype.insert=function(e){return this.insertBefore(this.head_,e)},t.Dict.prototype.deleteNode=function(e){e.next.prev=e.prev,e.prev.next=e.next},t.Dict.prototype.search=function(e){var t=this.head_;do{t=t.next}while(null!==t.key&&!this.leq_(this.frame_,e,t.key));return t},t.Dict.prototype.getMin=function(){return this.head_.next},t.Dict.prototype.getMax=function(){return this.head_.prev},t.DictNode=function(e,t,i){this.key=e||null,this.next=t||this,this.prev=i||this},t.DictNode.prototype.getKey=function(){return this.key},t.DictNode.prototype.getSuccessor=function(){return this.next},t.DictNode.prototype.getPredecessor=function(){return this.prev},t.GluTesselator=function(){this.state_=t.GluTesselator.tessState_.T_DORMANT,this.lastEdge_=null,this.mesh=null,this.errorCallback_=null,this.normal_=[0,0,0],this.windingRule=t.windingRule.GLU_TESS_WINDING_ODD,this.fatalError=!1,this.dict=null,this.pq=null,this.event=null,this.combineCallback_=null,this.boundaryOnly_=!1,this.beginCallback_=null,this.edgeFlagCallback_=null,this.vertexCallback_=null,this.endCallback_=null,this.meshCallback_=null,this.polygonData_=null},t.GluTesselator.tessState_={T_DORMANT:0,T_IN_POLYGON:1,T_IN_CONTOUR:2},t.GluTesselator.prototype.gluDeleteTess=function(){this.requireState_(t.GluTesselator.tessState_.T_DORMANT)},t.GluTesselator.prototype.gluTessProperty=function(e,i){switch(e){case t.gluEnum.GLU_TESS_TOLERANCE:return;case t.gluEnum.GLU_TESS_WINDING_RULE:var n=i;switch(n){case t.windingRule.GLU_TESS_WINDING_ODD:case t.windingRule.GLU_TESS_WINDING_NONZERO:case t.windingRule.GLU_TESS_WINDING_POSITIVE:case t.windingRule.GLU_TESS_WINDING_NEGATIVE:case t.windingRule.GLU_TESS_WINDING_ABS_GEQ_TWO:return void(this.windingRule=n)}break;case t.gluEnum.GLU_TESS_BOUNDARY_ONLY:return void(this.boundaryOnly_=!!i);default:return void this.callErrorCallback(t.gluEnum.GLU_INVALID_ENUM)}this.callErrorCallback(t.gluEnum.GLU_INVALID_VALUE)},t.GluTesselator.prototype.gluGetTessProperty=function(e){switch(e){case t.gluEnum.GLU_TESS_TOLERANCE:return 0;case t.gluEnum.GLU_TESS_WINDING_RULE:return this.windingRule;case t.gluEnum.GLU_TESS_BOUNDARY_ONLY:return this.boundaryOnly_;default:this.callErrorCallback(t.gluEnum.GLU_INVALID_ENUM)}return!1},t.GluTesselator.prototype.gluTessNormal=function(e,t,i){this.normal_[0]=e,this.normal_[1]=t,this.normal_[2]=i},t.GluTesselator.prototype.gluTessCallback=function(e,i){var n=i||null;switch(e){case t.gluEnum.GLU_TESS_BEGIN:case t.gluEnum.GLU_TESS_BEGIN_DATA:return void(this.beginCallback_=n);case t.gluEnum.GLU_TESS_EDGE_FLAG:case t.gluEnum.GLU_TESS_EDGE_FLAG_DATA:return void(this.edgeFlagCallback_=n);case t.gluEnum.GLU_TESS_VERTEX:case t.gluEnum.GLU_TESS_VERTEX_DATA:return void(this.vertexCallback_=n);case t.gluEnum.GLU_TESS_END:case t.gluEnum.GLU_TESS_END_DATA:return void(this.endCallback_=n);case t.gluEnum.GLU_TESS_ERROR:case t.gluEnum.GLU_TESS_ERROR_DATA:return void(this.errorCallback_=n);case t.gluEnum.GLU_TESS_COMBINE:case t.gluEnum.GLU_TESS_COMBINE_DATA:return void(this.combineCallback_=n);case t.gluEnum.GLU_TESS_MESH:return void(this.meshCallback_=n);default:return void this.callErrorCallback(t.gluEnum.GLU_INVALID_ENUM)}},t.GluTesselator.prototype.gluTessVertex=function(e,i){var n=!1,s=[0,0,0];this.requireState_(t.GluTesselator.tessState_.T_IN_CONTOUR);for(var r=0;r<3;++r){var o=e[r];o<-t.GLU_TESS_MAX_COORD&&(o=-t.GLU_TESS_MAX_COORD,n=!0),o>t.GLU_TESS_MAX_COORD&&(o=t.GLU_TESS_MAX_COORD,n=!0),s[r]=o}n&&this.callErrorCallback(t.errorType.GLU_TESS_COORD_TOO_LARGE),this.addVertex_(s,i)},t.GluTesselator.prototype.gluTessBeginPolygon=function(e){this.requireState_(t.GluTesselator.tessState_.T_DORMANT),this.state_=t.GluTesselator.tessState_.T_IN_POLYGON,this.mesh=new t.GluMesh,this.polygonData_=e},t.GluTesselator.prototype.gluTessBeginContour=function(){this.requireState_(t.GluTesselator.tessState_.T_IN_POLYGON),this.state_=t.GluTesselator.tessState_.T_IN_CONTOUR,this.lastEdge_=null},t.GluTesselator.prototype.gluTessEndContour=function(){this.requireState_(t.GluTesselator.tessState_.T_IN_CONTOUR),this.state_=t.GluTesselator.tessState_.T_IN_POLYGON},t.GluTesselator.prototype.gluTessEndPolygon=function(){if(this.requireState_(t.GluTesselator.tessState_.T_IN_POLYGON),this.state_=t.GluTesselator.tessState_.T_DORMANT,t.normal.projectPolygon(this,this.normal_[0],this.normal_[1],this.normal_[2]),t.sweep.computeInterior(this),!this.fatalError){var e=this.mesh;if(this.boundaryOnly_?t.tessmono.setWindingNumber(e,1,!0):t.tessmono.tessellateInterior(e),this.mesh.checkMesh(),this.beginCallback_||this.endCallback_||this.vertexCallback_||this.edgeFlagCallback_)if(this.boundaryOnly_)t.render.renderBoundary(this,this.mesh);else{var i=!!this.edgeFlagCallback_;t.render.renderMesh(this,this.mesh,i)}if(this.meshCallback_)return t.tessmono.discardExterior(this.mesh),this.meshCallback_(this.mesh),this.mesh=null,void(this.polygonData_=null)}t.mesh.deleteMesh(this.mesh),this.polygonData_=null,this.mesh=null},t.GluTesselator.prototype.requireState_=function(e){this.state_!==e&&this.gotoState_(e)},t.GluTesselator.prototype.gotoState_=function(e){for(;this.state_!==e;)if(this.state_<e)switch(this.state_){case t.GluTesselator.tessState_.T_DORMANT:this.callErrorCallback(t.errorType.GLU_TESS_MISSING_BEGIN_POLYGON),this.gluTessBeginPolygon(null);break;case t.GluTesselator.tessState_.T_IN_POLYGON:this.callErrorCallback(t.errorType.GLU_TESS_MISSING_BEGIN_CONTOUR),this.gluTessBeginContour()}else switch(this.state_){case t.GluTesselator.tessState_.T_IN_CONTOUR:this.callErrorCallback(t.errorType.GLU_TESS_MISSING_END_CONTOUR),this.gluTessEndContour();break;case t.GluTesselator.tessState_.T_IN_POLYGON:this.callErrorCallback(t.errorType.GLU_TESS_MISSING_END_POLYGON),this.gluTessEndPolygon()}},t.GluTesselator.prototype.addVertex_=function(e,i){var n=this.lastEdge_;null===n?(n=t.mesh.makeEdge(this.mesh),t.mesh.meshSplice(n,n.sym)):(t.mesh.splitEdge(n),n=n.lNext),n.org.data=i,n.org.coords[0]=e[0],n.org.coords[1]=e[1],n.org.coords[2]=e[2],n.winding=1,n.sym.winding=-1,this.lastEdge_=n},t.GluTesselator.prototype.callBeginCallback=function(e){this.beginCallback_&&this.beginCallback_(e,this.polygonData_)},t.GluTesselator.prototype.callVertexCallback=function(e){this.vertexCallback_&&this.vertexCallback_(e,this.polygonData_)},t.GluTesselator.prototype.callEdgeFlagCallback=function(e){this.edgeFlagCallback_&&this.edgeFlagCallback_(e,this.polygonData_)},t.GluTesselator.prototype.callEndCallback=function(){this.endCallback_&&this.endCallback_(this.polygonData_)},t.GluTesselator.prototype.callCombineCallback=function(e,t,i){return this.combineCallback_&&this.combineCallback_(e,t,i,this.polygonData_)||null},t.GluTesselator.prototype.callErrorCallback=function(e){this.errorCallback_&&this.errorCallback_(e,this.polygonData_)},t.GluFace=function(e,t){this.next=e||this,this.prev=t||this,this.anEdge=null,this.data=null,this.inside=!1},t.GluHalfEdge=function(e){this.next=e||this,this.sym=null,this.oNext=null,this.lNext=null,this.org=null,this.lFace=null,this.activeRegion=null,this.winding=0},t.GluHalfEdge.prototype.rFace=function(){return this.sym.lFace},t.GluHalfEdge.prototype.dst=function(){return this.sym.org},t.GluHalfEdge.prototype.oPrev=function(){return this.sym.lNext},t.GluHalfEdge.prototype.lPrev=function(){return this.oNext.sym},t.GluHalfEdge.prototype.dPrev=function(){return this.lNext.sym},t.GluHalfEdge.prototype.rPrev=function(){return this.sym.oNext},t.GluHalfEdge.prototype.dNext=function(){return this.rPrev().sym},t.GluHalfEdge.prototype.rNext=function(){return this.oPrev().sym},t.GluMesh=function(){this.vHead=new t.GluVertex,this.fHead=new t.GluFace,this.eHead=new t.GluHalfEdge,this.eHeadSym=new t.GluHalfEdge,this.eHead.sym=this.eHeadSym,this.eHeadSym.sym=this.eHead},t.GluMesh.prototype.checkMesh=function(){if(t.DEBUG){var e,i,n,s=this.fHead,r=this.vHead,o=this.eHead,a=s;for(a=s;(i=a.next)!==s;a=i){e=i.anEdge;do{e=e.lNext}while(e!==i.anEdge)}var l=r;for(l=r;(n=l.next)!==r;l=n){e=n.anEdge;do{e=e.oNext}while(e!==n.anEdge)}var h=o;for(h=o;(e=h.next)!==o;h=e);}},t.GluVertex=function(e,t){this.next=e||this,this.prev=t||this,this.anEdge=null,this.data=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0},t.PriorityQ=function(){this.verts_=[],this.order_=null,this.size_=0,this.initialized_=!1,this.heap_=new t.PriorityQHeap},t.PriorityQ.prototype.deleteQ=function(){this.heap_=null,this.order_=null,this.verts_=null},t.PriorityQ.prototype.init=function(){this.order_=[];for(var e=0;e<this.size_;e++)this.order_[e]=e;var i,n=(i=this.verts_,function(e,n){return t.geom.vertLeq(i[e],i[n])?1:-1});if(this.order_.sort(n),this.initialized_=!0,this.heap_.init(),t.DEBUG){var s=0+this.size_-1;for(e=0;e<s;++e);}},t.PriorityQ.prototype.insert=function(e){if(this.initialized_)return this.heap_.insert(e);var t=this.size_++;return this.verts_[t]=e,-(t+1)},t.PriorityQ.prototype.extractMin=function(){if(0===this.size_)return this.heap_.extractMin();var e=this.verts_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var i=this.heap_.minimum();if(t.geom.vertLeq(i,e))return this.heap_.extractMin()}do{--this.size_}while(this.size_>0&&null===this.verts_[this.order_[this.size_-1]]);return e},t.PriorityQ.prototype.minimum=function(){if(0===this.size_)return this.heap_.minimum();var e=this.verts_[this.order_[this.size_-1]];if(!this.heap_.isEmpty()){var i=this.heap_.minimum();if(t.geom.vertLeq(i,e))return i}return e},t.PriorityQ.prototype.remove=function(e){if(e>=0)this.heap_.remove(e);else for(e=-(e+1),this.verts_[e]=null;this.size_>0&&null===this.verts_[this.order_[this.size_-1]];)--this.size_},t.PriorityQHeap=function(){this.heap_=t.PriorityQHeap.reallocNumeric_([0],t.PriorityQHeap.INIT_SIZE_+1),this.verts_=[null,null],this.handles_=[0,0],this.size_=0,this.max_=t.PriorityQHeap.INIT_SIZE_,this.freeList_=0,this.initialized_=!1,this.heap_[1]=1},t.PriorityQHeap.INIT_SIZE_=32,t.PriorityQHeap.reallocNumeric_=function(e,t){for(var i=new Array(t),n=0;n<e.length;n++)i[n]=e[n];for(;n<t;n++)i[n]=0;return i},t.PriorityQHeap.prototype.init=function(){for(var e=this.size_;e>=1;--e)this.floatDown_(e);this.initialized_=!0},t.PriorityQHeap.prototype.insert=function(e){var i,n=++this.size_;return 2*n>this.max_&&(this.max_*=2,this.handles_=t.PriorityQHeap.reallocNumeric_(this.handles_,this.max_+1)),0===this.freeList_?i=n:(i=this.freeList_,this.freeList_=this.handles_[this.freeList_]),this.verts_[i]=e,this.handles_[i]=n,this.heap_[n]=i,this.initialized_&&this.floatUp_(n),i},t.PriorityQHeap.prototype.isEmpty=function(){return 0===this.size_},t.PriorityQHeap.prototype.minimum=function(){return this.verts_[this.heap_[1]]},t.PriorityQHeap.prototype.extractMin=function(){var e=this.heap_,t=this.verts_,i=this.handles_,n=e[1],s=t[n];return this.size_>0&&(e[1]=e[this.size_],i[e[1]]=1,t[n]=null,i[n]=this.freeList_,this.freeList_=n,--this.size_>0&&this.floatDown_(1)),s},t.PriorityQHeap.prototype.remove=function(e){var i=this.heap_,n=this.verts_,s=this.handles_,r=s[e];if(i[r]=i[this.size_],s[i[r]]=r,r<=--this.size_)if(r<=1)this.floatDown_(r);else{var o=n[i[r]],a=n[i[r>>1]];t.geom.vertLeq(a,o)?this.floatDown_(r):this.floatUp_(r)}n[e]=null,s[e]=this.freeList_,this.freeList_=e},t.PriorityQHeap.prototype.floatDown_=function(e){for(var i=this.heap_,n=this.verts_,s=this.handles_,r=e,o=i[r];;){var a=r<<1;a<this.size_&&t.geom.vertLeq(n[i[a+1]],n[i[a]])&&(a+=1);var l=i[a];if(a>this.size_||t.geom.vertLeq(n[o],n[l]))return i[r]=o,void(s[o]=r);i[r]=l,s[l]=r,r=a}},t.PriorityQHeap.prototype.floatUp_=function(e){for(var i=this.heap_,n=this.verts_,s=this.handles_,r=e,o=i[r];;){var a=r>>1,l=i[a];if(0===a||t.geom.vertLeq(n[l],n[o]))return i[r]=o,void(s[o]=r);i[r]=l,s[l]=r,r=a}},t.ActiveRegion=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},t.ActiveRegion.prototype.regionBelow=function(){return this.nodeUp.getPredecessor().getKey()},t.ActiveRegion.prototype.regionAbove=function(){return this.nodeUp.getSuccessor().getKey()},e.exports=t},5717(e,t,i){i.d(t,{A:()=>c});var n=i(9721),s=i(2696);const r=Symbol(),o=Symbol(),a=Symbol();function l(e,t,i){this[r]=e,this[o]=t,this[a]=i}Object.assign(Object.setPrototypeOf(l.prototype,n.A.prototype),{getAccessType(){return this[r]},getDataType(){return this[a].getType()},getName(){return this[o]},getValue(){return this[a]},getAppInfo(){return this[a].getAppInfo()},setAppInfo(e){return this[a].setAppInfo(e)},getDocumentation(){return this[a].getDocumentation()},setDocumentation(e){this[a].setDocumentation(e)}});for(const e of Object.keys(l.prototype))Object.defineProperty(l.prototype,e,{enumerable:!1});Object.defineProperties(l.prototype,{accessType:{get:l.prototype.getAccessType,enumerable:!0},dataType:{get:l.prototype.getDataType,enumerable:!0},name:{get:l.prototype.getName,enumerable:!0},value:{get(){return this.getValue().valueOf()},enumerable:!0},appInfo:{get:l.prototype.getAppInfo,set:l.prototype.setAppInfo,enumerable:!0},documentation:{get:l.prototype.getDocumentation,set:l.prototype.setDocumentation,enumerable:!0}}),Object.defineProperties(l,{typeName:{value:"X3DFieldDefinition",enumerable:!0}});const h=l,c=s.A.add("X3DFieldDefinition",h)},5768(e,t,i){i.d(t,{A:()=>d});var n=i(2804),s=i(5053),r=i(4068),o=i(2696);const a=Symbol(),l=Symbol(),h={get(e,t){try{const i=e[t];if(void 0!==i)return i;const n=e.getValue().getField(t);if(n.getAccessType()===s.A.inputOnly)return;return n.valueOf()}catch{return}},set(e,t,i){if(t in e)return e[t]=i,!0;try{const n=e.getValue().getField(t);return n.getAccessType()!==s.A.outputOnly&&n.setValue(i),!0}catch(i){return console.error(e,t,i),!1}},has(e,t){try{return!!e.getValue().getField(t)}catch{return t in e}},ownKeys(e){const t=e.getValue(),i=[];if(t)for(const{name:e}of t.getFieldDefinitions())i.push(e);return i},getOwnPropertyDescriptor(e,t){const i=e.getValue();if(i){const n=i.getFieldDefinitions().get(t);if(n)return{value:this.get(e,t),writable:n.accessType!==s.A.outputOnly,enumerable:!0,configurable:!0}}}};function c(e){const t=new Proxy(this,h);return this[a]=this,this[l]=t,e?.getType().includes(s.A.X3DNode)?(e.addParent(t),n.A.call(this,e)):n.A.call(this,null),t}Object.assign(Object.setPrototypeOf(c.prototype,n.A.prototype),{[a]:null,[l]:null,copy(e){const t=this[a].getValue();if(t&&e){const i=t.copy(e);return i.isInitialized()||e.getExecutionContext().getOuterNode()?.getType().includes(s.A.X3DProtoDeclaration)||i.setup(),new c(i)}return new c(t)},equals(e){const t=this[a];return e?t.getValue()===e.getValue():null===t.getValue()},isDefaultValue(){return null===this[a].getValue()},set(e){const t=this[a],i=t.getValue();i?.removeParent(t[l]),e?.getType().includes(s.A.X3DNode)?(e.addParent(t[l]),n.A.prototype.set.call(t,e)):n.A.prototype.set.call(t,null)},getNodeTypeName(){const e=this[a].getValue();if(e)return e.getTypeName();throw new Error("SFNode.getNodeTypeName: node is null.")},getNodeName(){const e=this[a].getValue();if(e)return e.getName();throw new Error("SFNode.getNodeName: node is null.")},getNodeDisplayName(){const e=this[a].getValue();if(e)return e.getDisplayName();throw new Error("SFNode.getNodeDisplayName: node is null.")},getNodeType(){const e=this[a].getValue();if(e)return Array.from(e.getType());throw new Error("SFNode.getNodeType: node is null.")},getFieldDefinition(e){const t=this.getFieldDefinitions().get(e);if(t)return t;throw new Error(`Unknown field '${e}' in node class ${this.getNodeTypeName()}.`)},getFieldDefinitions(){const e=this[a].getValue();if(e)return e.getFieldDefinitions();throw new Error("SFNode.getFieldDefinitions: node is null.")},getField(e){const t=this[a].getValue();if(t)return t.getField(e);throw new Error("SFNode is disposed.")},addFieldCallback(...e){const t=this[a];switch(e.length){case 2:{const[i,s]=e;return n.A.prototype.addFieldCallback.call(t,i,s)}case 3:{const[i,n,s]=e,r=t.getValue();if(r)return r.getField(n).addFieldCallback(i,s);throw new Error("SFNode.addFieldCallback: node is null.")}}},removeFieldCallback(...e){const t=this[a];switch(e.length){case 1:{const i=[e];return n.A.prototype.removeFieldCallback.call(t,i)}case 2:{const[i,n]=e,s=t.getValue();if(s)return s.getField(n).removeFieldCallback(i);throw new Error("SFNode.removeFieldCallback: node is null.")}}},getNodeUserData(e){const t=this[a].getValue();if(t)return t.getUserData(e);throw new Error("SFNode.getNodeUserData: node is null.")},setNodeUserData(e,t){const i=this[a].getValue();if(i)return i.setUserData(e,t);throw new Error("SFNode.setNodeUserData: node is null.")},removeNodeUserData(e){const t=this[a].getValue();if(t)return t.removeUserData(e);throw new Error("SFNode.removeNodeUserData: node is null.")},valueOf(){const e=this[a].getValue();return e?r.A.get(e):null},toStream(e){const t=this[a].getValue();t?t.toStream(e):e.NULL()},toVRMLStream(e){const t=this[a].getValue();t?t.toVRMLStream(e):e.NULL()},toXMLStream(e){const t=this[a].getValue();t?t.toXMLStream(e):e.string+="\x3c!-- NULL --\x3e"},toJSONStream(e){this.toJSONStreamValue(e)},toJSONStreamValue(e){const t=this[a].getValue();t?t.toJSONStream(e):e.string+="null"},dispose(){const e=this[a];e.set(null),e.processInterests(),n.A.prototype.dispose.call(e)}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});Object.defineProperties(c,{type:{value:s.A.SFNode,enumerable:!0},typeName:{value:"SFNode",enumerable:!0}});const u=c,d=o.A.add("SFNode",u)},5948(e,t,i){i.d(t,{A:()=>l});var n=i(797),s=i(1725),r=i(2696);function o(e={}){Object.assign(this,{alphaMode:s.A.OPAQUE,geometryType:3,hasFogCoords:!1,colorMaterial:!1,hasNormals:!1,hasTangents:!1,textureNode:null,localObjectsKeys:[],textureCoordinateMapping:new Map,textureCoordinateNode:null},e),this.updateGeometryKey()}Object.assign(o.prototype,{getTextureCoordinateMapping(){return this.textureCoordinateMapping},getTextureCoordinate(){return this.textureCoordinateNode},updateGeometryKey:n.A.prototype.updateGeometryKey});const a=o,l=r.A.add("GeometryContext",a)},6007(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(5717),r=i(3999),o=i(2244),a=i(4632),l=i(5053),h=i(2696);const c=Symbol();function u(e){a.A.call(this,e),this.addType(l.A.X3DProtoDeclaration),this[c]=new o.A(e,this),this[c].setLive(!1),this.setLive(!1)}Object.assign(Object.setPrototypeOf(u.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this),this[c].setup()},getProtoDeclaration(){return this},getBody(){return this[c]},getCloneCount(){return a.A.prototype.collectCloneCount.call(this)},collectCloneCount:()=>1,toVRMLStream(e){e.Indent(),e.string+="PROTO",e.Space(),e.string+=this.getName(),e.TidySpace(),e.string+="[";const t=this.getUserDefinedFields();if(0===t.length)e.TidySpace();else{let i=0,n=0;for(const s of t)i=Math.max(i,s.getTypeName().length),n=Math.max(n,e.AccessType(s.getAccessType()).length);e.TidyBreak(),e.IncIndent();const s=t.at(-1);for(const r of t)this.toVRMLStreamUserDefinedField(e,r,i,n),r===s?e.TidyBreak():e.Break();e.DecIndent(),e.Indent()}e.string+="]",e.TidyBreak(),e.Indent(),e.string+="{",e.TidyBreak(),e.IncIndent(),this[c].toVRMLStream(e),e.DecIndent(),e.Indent(),e.string+="}"},toVRMLStreamUserDefinedField(e,t,i,n){e.Indent(),e.string+=e.AccessType(t.getAccessType()).padEnd(n,e.TidySpace()),e.Space(),e.string+=t.getTypeName().padEnd(i,e.TidySpace()),e.Space(),e.string+=t.getName(),t.isInitializable()&&(e.Space(),t.toVRMLStream(e))},toXMLStream(e){e.openTag("ProtoDeclare"),e.attribute("name",this.getName()),this.getAppInfo()&&e.attribute("appinfo",this.getAppInfo()),this.getDocumentation()&&e.attribute("documentation",this.getDocumentation()),e.endTag();const t=this.getUserDefinedFields();if(0!==t.length){e.IncIndent(),e.openingTag("ProtoInterface"),e.TidyBreak(),e.IncIndent();for(const i of t)if(e.openTag("field"),e.attribute("accessType",e.AccessType(i.getAccessType())),e.attribute("type",i.getTypeName()),e.attribute("name",i.getName()),i.isDefaultValue()||!i.isInitializable())i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.closeTag("field"),e.TidyBreak();else switch(i.getType()){case l.A.SFNode:case l.A.MFNode:i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.endTag(),e.IncIndent(),e.PushContainerField(null),i.toXMLStream(e),e.TidyBreak(),e.DecIndent(),e.closingTag("field"),e.TidyBreak(),e.PopContainerField();break;default:e.Space(),e.string+="value='",i.toXMLStream(e),e.string+="'",i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.closeTag("field"),e.TidyBreak()}e.DecIndent(),e.closingTag("ProtoInterface"),e.TidyBreak(),e.DecIndent()}e.IncIndent(),e.openingTag("ProtoBody"),e.TidyBreak(),e.IncIndent(),this[c].toXMLStream(e),e.DecIndent(),e.closingTag("ProtoBody"),e.TidyBreak(),e.DecIndent(),e.closingTag("ProtoDeclare")},toJSONStream(e){e.TidyBreak(),e.Indent(),e.beginObject("ProtoDeclare",!1,!0),e.stringProperty("@name",this.getName(),!1),this.getAppInfo()&&e.stringProperty("@appinfo",this.getAppInfo()),this.getDocumentation()&&e.stringProperty("@documentation",this.getDocumentation()),e.beginObject("ProtoInterface");const t=this.getUserDefinedFields();if(t.length){e.beginArray("field",!1);for(const i of t){if(e.beginObject("",i!==t[0]),e.stringProperty("@accessType",e.AccessType(i.getAccessType()),!1),e.stringProperty("@type",i.getTypeName()),e.stringProperty("@name",i.getName()),!i.isDefaultValue()&&i.isInitializable())switch(i.getType()){case l.A.SFNode:e.beginArray("-children"),e.TidyBreak(),e.Indent(),i.toJSONStream(e),e.endArray();break;case l.A.MFNode:e.beginValue("-children",!0),i.toJSONStream(e);break;default:e.beginValue("@value",!0),i.toJSONStream(e)}i.getAppInfo()&&e.stringProperty("@appinfo",i.getAppInfo()),i.getDocumentation()&&e.stringProperty("@documentation",i.getDocumentation()),e.endObject()}e.endArray()}e.endObject(),e.beginObject("ProtoBody"),e.beginArray("-children",!1),this[c].toJSONStream(e),e.endArray(),e.endObject(),e.endObject(),e.endObject()}});for(const e of Object.keys(u.prototype))Object.defineProperty(u.prototype,e,{enumerable:!1});Object.defineProperties(u.prototype,{isExternProto:{value:!1,enumerable:!0}}),Object.defineProperties(u,{typeName:{value:"X3DProtoDeclaration",enumerable:!0},fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode)]),enumerable:!0}}),l.A.addConstant(u.typeName);const d=u,p=h.A.add("X3DProtoDeclaration",d)},6061(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(6007),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.name,e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"ProtoDeclarationArray",enumerable:!0}});const a=o,l=r.A.add("ProtoDeclarationArray",a)},6138(e,t,i){i.d(t,{A:()=>c});var n=i(8001),s=i(2251),r=i(5053),o=i(2696);let a=0;function l(e){s.A.call(this,e),this.addType(r.A.X3DBindableNode),this.modificationCount=0}Object.assign(Object.setPrototypeOf(l.prototype,s.A.prototype),{initialize(){s.A.prototype.initialize.call(this),this._set_bind.addInterest("set_bind__",this)},isCameraObject:()=>!0,getModificationCount(){return this.modificationCount},transitionStart(){},set_bind__(){a===Number.MAX_SAFE_INTEGER&&(a=0),this.modificationCount=++a}}),Object.defineProperties(l,n.A.getStaticProperties("X3DBindableNode","Core",1)),Object.defineProperties(l,{getModificationCount:{value:()=>a,enumerable:!1}});const h=l,c=o.A.add("X3DBindableNode",h)},6366(e,t,i){i.d(t,{A:()=>u});var n=i(9721),s=i(4068),r=i(2696);const o=Symbol(),a=Symbol(),l=Symbol();function h(e,t,i){n.A.call(this),this[o]=e,this[a]=t,this[l]=i}Object.assign(Object.setPrototypeOf(h.prototype,n.A.prototype),{getExecutionContext(){return this[o]},getExportedName(){return this[a]},getLocalNode(){return this[l]},toVRMLStream(e){const t=e.Name(this.getLocalNode());e.Indent(),e.string+="EXPORT",e.Space(),e.string+=t,this[a]!==t&&(e.Space(),e.string+="AS",e.Space(),e.string+=this[a])},toXMLStream(e){const t=e.Name(this.getLocalNode());e.openTag("EXPORT"),e.attribute("localDEF",t),this[a]!==t&&e.attribute("AS",this[a]),e.closeTag("EXPORT")},toJSONStream(e){const t=e.Name(this.getLocalNode());e.TidyBreak(),e.Indent(),e.beginObject("EXPORT",!1,!0),e.stringProperty("@localDEF",t,!1),this[a]!==t&&e.stringProperty("@AS",this[a]),e.endObject(),e.endObject()}});for(const e of Object.keys(h.prototype))Object.defineProperty(h.prototype,e,{enumerable:!1});Object.defineProperties(h.prototype,{exportedName:{get(){return this[a]},enumerable:!0},localNode:{get(){return s.A.get(this[l])},enumerable:!0}}),Object.defineProperties(h,{typeName:{value:"X3DExportedNode",enumerable:!0}});const c=h,u=r.A.add("X3DExportedNode",c)},6529(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(6366),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.getExportedName(),e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"ExportedNodesArray",enumerable:!0}});const a=o,l=r.A.add("ExportedNodesArray",a)},6576(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(8067),l=i(5053),h=i(5185),c=i(2696);function u(e){a.A.call(this,e),this.addType(l.A.ScalarInterpolator)}Object.assign(Object.setPrototypeOf(u.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:0),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){this._value_changed=h.A.lerp(this._keyValue[e],this._keyValue[t],i)}}),Object.defineProperties(u,{...o.A.getStaticProperties("ScalarInterpolator","Interpolation",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOnly,"set_fraction",new n.A.SFFloat),new s.A(l.A.inputOutput,"key",new n.A.MFFloat),new s.A(l.A.inputOutput,"keyValue",new n.A.MFFloat),new s.A(l.A.outputOnly,"value_changed",new n.A.SFFloat)]),enumerable:!0}});const d=u,p=c.A.add("ScalarInterpolator",d)},6702(e,t,i){i.d(t,{A:()=>h});var n=i(7153),s=i(4839),r=i(2696),o=i(9340);function a(e){s.A.call(this,e),this.namespace="http://www.web3d.org/specifications/x3d-namespace"}Object.assign(Object.setPrototypeOf(a.prototype,s.A.prototype),{getEncoding:()=>"JSON",setInput(e){try{"string"==typeof e&&(e=JSON.parse(e)),this.input=e}catch{this.input=void 0}},isValid(){return this.input instanceof Object},parseIntoScene(e,t){const i=this.createElement("X3D");this.convertToDOM(this.input,"",i);const s=new n.A(this.getScene());s.setInput(i),s.parseIntoScene(e,t),this.getScene().setEncoding("JSON")},elementSetAttribute(e,t,i){switch(t){case"SON schema":case"ncoding":break;default:"function"==typeof e.setAttribute&&e.setAttribute(t,i)}},convertChildren(e,t,i){for(const n in t)"object"==typeof t[n]&&(isNaN(parseInt(n))?this.convertObject(n,t,i,e.substring(1)):this.convertToDOM(t[n],n,i,e.substring(1)))},createElement(e,t){let i;return void 0===this.namespace?i=document.createElement(e):(i=document.createElementNS(this.namespace,e),null==i&&(console.error("Trouble creating element for",e),i=document.createElement(e))),void 0!==t&&this.elementSetAttribute(i,"containerField",t),i},createCDATA(e,t,i){const n=o.parseXML("<xml></xml>","application/xml").createCDATASection(i);t.appendChild(n)},convertObject(e,t,i,n){if(null!==t&&"object"==typeof t[e])if("@"===e[0])this.convertToDOM(t[e],e,i);else if("-"===e[0])this.convertChildren(e,t[e],i);else if("#comment"===e)for(const n in t[e]){const s=document.createComment(this.commentStringToXML(t[e][n]));i.appendChild(s)}else if("#sourceCode"===e||"@sourceCode"===e||"#sourceText"===e)this.createCDATA(document,i,t[e].join("\n"));else if("connect"===e||"fieldValue"===e||"field"===e||"meta"===e||"component"===e||"unit"===e){for(const s in t[e])if("object"==typeof t[e][s]){const r=this.createElement(e,n);this.convertToDOM(t[e][s],s,r),i.appendChild(r),i.appendChild(document.createTextNode("\n"))}}else{const s=this.createElement(e,n);this.convertToDOM(t[e],e,s),i.appendChild(s),i.appendChild(document.createTextNode("\n"))}},commentStringToXML:e=>e.replace(/\\\\/g,"\\"),SFStringToXML:e=>String(e).replace(/([\\"])/g,"\\$1"),JSONStringToXML:e=>e=(e=e.replace(/\\/g,"\\\\")).replace(/\n/g,"\\n"),convertToDOM(e,t,i,n){if(null===e){if(!isNaN(parseInt(t))){const e=this.createElement("NULL",n);i.appendChild(e)}else this.elementSetAttribute(i,"value",null);return i}let s=!1,r=[],o=!1;for(const t in e)if(s=!isNaN(parseInt(t)),s)switch(typeof e[t]){case"number":case"boolean":r.push(e[t]);break;case"string":r.push(e[t]),o=!0;break;case"object":this.convertToDOM(e[t],t,i);break;case"undefined":break;default:console.error("Unknown type found in array "+typeof e[t])}else switch(typeof e[t]){case"object":"X3D"===t?this.convertToDOM(e[t],t,i):this.convertObject(t,e,i,n);break;case"number":case"boolean":this.elementSetAttribute(i,t.substring(1),e[t]);break;case"string":if("#comment"!==t)this.elementSetAttribute(i,t.substring(1),this.JSONStringToXML(e[t]));else{const n=document.createComment(this.commentStringToXML(e[t]));i.appendChild(n)}break;case"undefined":break;default:console.error("Unknown type found in object "+typeof e[t]),console.error(e)}if(s){if("@"===t[0])if(o){o=!1;for(const[e,t]of r.entries())r[e]=this.SFStringToXML(t);this.elementSetAttribute(i,t.substring(1),'"'+r.join('" "')+'"')}else this.elementSetAttribute(i,t.substring(1),r.join(" "));s=!1}return i}});const l=a,h=r.A.add("JSONParser",l)},6732(e,t,i){i.d(t,{A:()=>r});var n=i(2696);const s=class extends Array{#P=0;constructor(e){super(),this.push(new e)}set(e){this[this.#P].assign(e)}get(){return this[this.#P]}push(e=this[this.#P]){const t=++this.#P;t<this.length?this[t].assign(e):this[t]=e.copy()}pop(){--this.#P}clear(){this.#P=0}size(){return this.#P+1}identity(){this[this.#P].identity()}inverse(){this[this.#P].inverse()}multRight(e){this[this.#P].multRight(e)}multLeft(e){this[this.#P].multLeft(e)}translate(e){this[this.#P].translate(e)}rotate(e){this[this.#P].rotate(e)}scale(e){this[this.#P].scale(e)}},r=n.A.add("MatrixStack",s)},6761(e,t,i){i.d(t,{A:()=>g});var n=i(9721),s=i(4068),r=i(1937),o=i(2696);const a=Symbol(),l=Symbol(),h=Symbol(),c=Symbol(),u=Symbol();function d(e,t,i,s){n.A.call(this),this[a]=e,this[l]=t,this[h]=i,this[c]=s,this[u]=e[u]??=new Map}Object.assign(Object.setPrototypeOf(d.prototype,n.A.prototype),{getExecutionContext(){return this[a]},getInlineNode(){return this[l]},getExportedName(){return this[h]},getExportedNode(e){const t=this[u].get(this[c]);return t?.setTypeHint(e),t??this.createExportedNode(e)},createExportedNode(e){const t=new r.A(this.getExecutionContext(),this[c],e);return this[u].set(this[c],t),t},updateExportedNode(){this[u].get(this[c])?.update()},getSharedNode(){const e=this.getInlineNode().getInternalScene().getExportedNodes().get(this[h]);if(e)return e.getLocalNode();throw new Error(`Exported node '${this[h]}' not found.`)},getImportedName(){return this[c]},[Symbol.for("X_ITE.X3DImportedNode.setImportName")](e){const t=this.getExportedNode(),i=this[u];i.delete(this[c]),i.set(e,t),this[c]=e,t.setName(e)},toVRMLStream(e){if(!e.ExistsNode(this.getInlineNode()))throw new Error("X3DImportedNode.toVRMLStream: Inline node does not exist.");e.AddRouteNode(this);const t=e.ImportedName(this);e.Indent(),e.string+="IMPORT",e.Space(),e.string+=e.Name(this.getInlineNode()),e.string+=".",e.string+=this.getExportedName(),t!==this.getExportedName()&&(e.Space(),e.string+="AS",e.Space(),e.string+=t)},toXMLStream(e){if(!e.ExistsNode(this.getInlineNode()))throw new Error("X3DImportedNode.toXMLStream: Inline node does not exist.");e.AddRouteNode(this);const t=e.ImportedName(this);e.openTag("IMPORT"),e.attribute("inlineDEF",e.Name(this.getInlineNode())),e.attribute("importedDEF",this.getExportedName()),t!==this.getExportedName()&&e.attribute("AS",t),e.closeTag("IMPORT")},toJSONStream(e){if(!e.ExistsNode(this.getInlineNode()))throw new Error("X3DImportedNode.toJSONStream: Inline node does not exist.");e.TidyBreak(),e.Indent(),e.AddRouteNode(this),e.beginObject("IMPORT",!1,!0),e.stringProperty("@inlineDEF",e.Name(this.getInlineNode()),!1),e.stringProperty("@importedDEF",this.getExportedName());const t=e.ImportedName(this);t!==this.getExportedName()&&e.stringProperty("@AS",t),e.endObject(),e.endObject()},dispose(){for(const e of Array.from(this[a].getRoutes()))e.getSourceNode()!==this&&e.getDestinationNode()!==this||this[a].deleteRoute(e);n.A.prototype.dispose.call(this)}});for(const e of Object.keys(d.prototype))Object.defineProperty(d.prototype,e,{enumerable:!1});Object.defineProperties(d.prototype,{inlineNode:{get(){return s.A.get(this[l])},enumerable:!0},exportedName:{get(){return this[h]},enumerable:!0},exportedNode:{get(){return s.A.get(this.getExportedNode())},enumerable:!0},importedName:{get(){return this[c]},enumerable:!0}}),Object.defineProperties(d,{typeName:{value:"X3DImportedNode",enumerable:!0}});const p=d,g=o.A.add("X3DImportedNode",p)},6855(e,t,i){i.d(t,{A:()=>g});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(6138),l=i(2857),h=i(5053),c=i(9582),u=i(2696);function d(e){a.A.call(this,e),l.A.call(this,e),this.addType(h.A.Fog),this.modelMatrix=new c.A}Object.assign(Object.setPrototypeOf(d.prototype,a.A.prototype),l.A.prototype,{initialize(){a.A.prototype.initialize.call(this),l.A.prototype.initialize.call(this)},getModelMatrix(){return this.modelMatrix},traverse(e,t){t.getLayer().getFogs().push(this),this.modelMatrix.assign(t.getModelViewMatrix().get())},dispose(){l.A.prototype.dispose.call(this),a.A.prototype.dispose.call(this)}}),Object.defineProperties(d,{...o.A.getStaticProperties("Fog","EnvironmentalEffects",2,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(h.A.inputOutput,"metadata",new n.A.SFNode),new s.A(h.A.inputOnly,"set_bind",new n.A.SFBool),new s.A(h.A.inputOutput,"fogType",new n.A.SFString("LINEAR")),new s.A(h.A.inputOutput,"color",new n.A.SFColor(1,1,1)),new s.A(h.A.inputOutput,"visibilityStart",new n.A.SFFloat),new s.A(h.A.inputOutput,"visibilityRange",new n.A.SFFloat),new s.A(h.A.outputOnly,"isBound",new n.A.SFBool),new s.A(h.A.outputOnly,"bindTime",new n.A.SFTime)]),enumerable:!0}});const p=d,g=u.A.add("Fog",p)},6973(e,t,i){i.d(t,{A:()=>l});var n=i(5185),s=i(2696);const r=Symbol();function o(e=0){this[r]=e>>>0}Object.assign(o.prototype,{*[Symbol.iterator](){let e=this[r],t=0;for(;e;)1&e&&(yield t),e>>>=1,++t},get(e){const t=1<<e;return!!(this[r]&t)},set(e,t){t?this.add(e):this.remove(e)},add(e,t=1){this[r]|=t<<e,this[r]>>>=0},remove(e,t=1){this[r]&=~(t<<e),this[r]>>>=0},clear(){this[r]=0},*entries(){for(const e of this)yield[e,e]},valueOf(){return this[r]},toString(e){return this[r].toString(e)}}),o.prototype.keys=o.prototype[Symbol.iterator],o.prototype.values=o.prototype[Symbol.iterator],Object.defineProperty(o.prototype,"size",{get(){return n.A.bitCount(this[r])}});const a=o,l=s.A.add("BitSet",a)},7153(e,t,i){i.d(t,{A:()=>S});var n=i(2804),s=i(5543),r=i(8001),o=i(8664),a=i(8015),l=i(4839),h=i(2681),c=i(9039),u=i(6761),d=i(2417),p=i(6007),g=i(5053),f=i(1262),m=i(2514),A=i(2696),_=i(9340);const y={initializeOnly:g.A.initializeOnly,inputOnly:g.A.inputOnly,outputOnly:g.A.outputOnly,inputOutput:g.A.inputOutput};function w(e){l.A.call(this,e),this.protoDeclarations=[],this.parents=[],this.parser=new h.A(e),this.url=new a.A.MFString,this.protoNames=new Map,this.protoFields=new WeakMap,this.parser.setUnits(!!e)}Object.assign(Object.setPrototypeOf(w.prototype,l.A.prototype),{getEncoding:()=>"XML",setInput(e){try{"string"==typeof e&&(e=_.parseXML(e)),this.input=e,this.xml=this.isXML(e),this.xml||Object.assign(this,x)}catch{this.input=void 0}},isValid(){return this.input instanceof XMLDocument||this.input instanceof HTMLElement||null===this.input},isXML:e=>!(e instanceof HTMLElement),parseIntoScene(e,t){const i=this.getBrowser(),n=this.getScene();this.resolve=e,this.reject=t,n.setEncoding("XML"),n.setProfile(i.getProfile("Full")),this.xmlElement(this.input)},xmlElement(e){const t=this.getBrowser(),i=this.getScene();if(null===e)return this.resolve?.(i);switch(e.nodeName){case"#document":{const n=_(e).children("X3D");if(n.length)for(const e of n)this.x3dElement(e);else this.resolve?t.loadComponents(i).then(()=>{this.childrenElements(e),this.setupNodes(),this.resolve(i)}).catch(this.reject):(this.childrenElements(e),this.setupNodes());break}case"X3D":this.x3dElement(e);break;case"Scene":case"SCENE":this.resolve?t.loadComponents(i).then(()=>{this.sceneElement(e),this.setupNodes(),this.resolve(i)}).catch(this.reject):(this.sceneElement(e),this.setupNodes());break;default:this.resolve?t.loadComponents(i).then(()=>{this.childrenElements(e),this.setupNodes(),this.resolve(i)}).catch(this.reject):(this.childrenElements(e),this.setupNodes())}},x3dElement(e){const t=this.getBrowser(),i=this.getScene();try{const n=e.getAttribute("profile"),s=t.getProfile(n||"Full");_.data(this.scene,"X3D",e),i.setProfile(s)}catch(e){console.error(e)}const n=e.getAttribute("version");n&&i.setSpecificationVersion(n);for(const t of e.childNodes)this.x3dElementChildHead(t);if(this.xml||this.headElement(e),this.resolve)t.loadComponents(i).then(()=>{for(const t of e.childNodes)this.x3dElementChildScene(t);this.setupNodes(),this.resolve(i)}).catch(this.reject);else{for(const t of e.childNodes)this.x3dElementChildScene(t);this.setupNodes()}},x3dElementChildHead(e){switch(e.nodeName){case"head":case"HEAD":return void this.headElement(e)}},x3dElementChildScene(e){switch(e.nodeName){case"Scene":case"SCENE":return void this.sceneElement(e)}},headElement(e){for(const t of e.childNodes)this.headElementChild(t)},headElementChild(e){switch(e.nodeName){case"component":case"COMPONENT":return void this.componentElement(e);case"unit":case"UNIT":return void this.unitElement(e);case"meta":case"META":return void this.metaElement(e)}},componentElement(e){try{const t=e.getAttribute("name"),i=e.getAttribute("level");if(null===t)return console.warn("XML Parser: Bad component statement. Expected name attribute.");if(null===i)return console.warn("XML Parser: Bad component statement. Expected level attribute.");const n=this.getBrowser().getComponent(t,parseInt(i));if(this.getScene().hasComponent(n))return;this.getScene().updateComponent(n)}catch(e){console.log(e.message)}},unitElement(e){const t=e.getAttribute("category"),i=e.getAttribute("name"),n=e.getAttribute("conversionFactor");return null===t?console.warn("XML Parser: Bad unit statement. Expected category attribute."):null===i?console.warn("XML Parser: Bad unit statement. Expected name attribute."):null===n?console.warn("XML Parser: Bad unit statement. Expected conversionFactor attribute."):void this.getScene().updateUnit(t,i,parseFloat(n))},metaElement(e){const t=e.getAttribute("name"),i=e.getAttribute("content");return null===t?console.warn("XML Parser: Bad meta statement. Expected name attribute."):null===i?console.warn("XML Parser: Bad meta statement. Expected content attribute."):void this.getScene().addMetaData(t,i)},sceneElement(e){_.data(e,"node",this.scene),this.childrenElements(e)},childrenElements(e){for(const t of e.childNodes)this.childElement(t)},childElement(e){switch(e.nodeName){case"#comment":case"#text":return;case"#cdata-section":return void this.cdataNode(e);case"ExternProtoDeclare":case"EXTERNPROTODECLARE":return void this.externProtoDeclareElement(e);case"ProtoDeclare":case"PROTODECLARE":return void this.protoDeclareElement(e);case"IS":return void this.isElement(e);case"ProtoInstance":case"PROTOINSTANCE":return void this.protoInstanceElement(e);case"fieldValue":case"FIELDVALUE":return void this.fieldValueElement(e);case"field":case"FIELD":return void this.fieldElement(e);case"ROUTE":return void this.routeElement(e);case"IMPORT":return void this.importElement(e);case"EXPORT":return void this.exportElement(e);default:return void this.nodeElement(e)}},externProtoDeclareElement(e){const t=e.getAttribute("name");if(this.id(t)){const i=e.getAttribute("url"),n=e.getAttribute("appinfo"),s=e.getAttribute("documentation");this.parser.setInput(i??""),this.parser.sfstringValues(this.url),this.url.length||console.warn("XML Parser: Bad ExternProtoDeclare statement. Expected url attribute with value.");const r=new d.A(this.getExecutionContext(),this.url);this.pushParent(r),this.protoInterfaceElement(e),this.popParent(),this.addProtoFieldNames(r),r.setAppInfo(n??""),r.setDocumentation(s??""),r.setup();try{const e=this.getExecutionContext().getExternProtoDeclaration(t);console.warn(`A extern proto named '${t}' is already defined and will be overridden.`),this.getExecutionContext().updateExternProtoDeclaration(this.getExecutionContext().getUniqueExternProtoName(t),e)}catch{}this.getExecutionContext().updateExternProtoDeclaration(t,r),this.addProtoName(t)}},protoDeclareElement(e){const t=e.getAttribute("name"),i=e.getAttribute("appinfo"),n=e.getAttribute("documentation");if(this.id(t)){const s=new p.A(this.getExecutionContext());for(const t of e.childNodes){switch(t.nodeName){case"ProtoInterface":case"PROTOINTERFACE":this.pushParent(s),this.protoInterfaceElement(t),this.popParent(),this.addProtoFieldNames(s);break;default:continue}break}for(const t of e.childNodes){switch(t.nodeName){case"ProtoBody":case"PROTOBODY":this.pushExecutionContext(s.getBody()),this.pushParent(s),this.protoBodyElement(t),this.popParent(),this.setupNodes(),this.popExecutionContext();break;default:continue}break}s.setAppInfo(i??""),s.setDocumentation(n??""),s.setup();try{const e=this.getExecutionContext().getProtoDeclaration(t);console.warn(`A proto named '${t}' is already defined and will be overridden.`),this.getExecutionContext().updateProtoDeclaration(this.getExecutionContext().getUniqueProtoName(t),e)}catch{}this.getExecutionContext().updateProtoDeclaration(t,s),this.addProtoName(t)}},protoInterfaceElement(e){for(const t of e.childNodes)this.protoInterfaceElementChild(t)},protoInterfaceElementChild(e){switch(e.nodeName){case"field":case"FIELD":return void this.fieldElement(e)}},fieldElement(e){try{if(0===this.getParents().length)return;const t=this.getParent();if(!(t instanceof s.A))return;if(!t.canUserDefinedFields())return;const i=y[e.getAttribute("accessType")]||g.A.initializeOnly,n=a.A[e.getAttribute("type")];if(!n)return;const r=e.getAttribute("name"),o=e.getAttribute("appinfo"),l=e.getAttribute("documentation");if(!this.id(r))return;const h=new n;h.setAppInfo(o??""),h.setDocumentation(l??""),i&g.A.initializeOnly&&(this.fieldValue(h,e.getAttribute("value")),this.pushParent(h),this.childrenElements(e),this.popParent()),t.addUserDefinedField(i,r,h)}catch(e){console.error(e)}},protoBodyElement(e){this.childrenElements(e)},isElement(e){if(this.isInsideProtoDeclaration())for(const t of e.childNodes)this.isElementChild(t)},isElementChild(e){switch(e.nodeName){case"connect":case"CONNECT":return void this.connectElement(e)}},connectElement(e){const t=e.getAttribute("nodeField"),i=e.getAttribute("protoField");if(null===t)return console.warn("XML Parser: Bad connect statement. Expected nodeField attribute.");if(null===i)return console.warn("XML Parser: Bad connect statement. Expected protoField attribute.");try{if(0===this.getParents().length)return;const e=this.getParent(),n=this.getOuterNode();if(!(e instanceof r.A))return;const s=e.getField(t),o=n.getField(i);if(s.getType()!==o.getType())throw new Error(`Field '${s.getName()}' and '${o.getName()}' in PROTO ${this.proto.getName()} have different types.`);if(!o.isReference(s.getAccessType()))throw new Error(`Field '${s.getName()}' and '${o.getName()}' in PROTO ${n.getName()} are incompatible as an IS mapping.`);s.addReference(o)}catch(e){console.warn(`XML Parser: Couldn't create IS reference. ${e.message}`)}},protoInstanceElement(e){try{if(this.useAttribute(e))return;const t=e.getAttribute("name");if(this.id(t)){const i=this.getExecutionContext().createProto(t,!1);if(!i)throw new Error(`Unknown proto or externproto type '${t}'.`);_.data(e,"node",i),this.defAttribute(e,i),this.addNode(e,i),this.pushParent(i),this.childrenElements(e),this.isInsideProtoDeclaration()||this.getNodes().push(i),this.popParent()}}catch(e){console.warn("XML Parser: ",e.message),m.A&&console.error(e)}},fieldValueElement(e){try{if(0===this.getParents().length)return;const t=this.getParent(),i=e.getAttribute("name");if(!(t instanceof o.A))return;if(!this.id(i))return;const n=t.getField(i);n.getAccessType()&g.A.initializeOnly&&(n.getType()===g.A.MFNode&&(n.length=0),this.fieldValue(n,e.getAttribute("value")),this.pushParent(n),this.childrenElements(e),this.popParent())}catch(e){console.warn(`XML Parser: Couldn't assign field value. ${e.message}`)}},nodeElement(e){try{if(this.useAttribute(e))return;const t=this.getExecutionContext().createNode(this.nodeNameToCamelCase(e.nodeName),!1)??this.getExecutionContext().createProto(this.protoNameToCamelCase(e.nodeName),!1);if(!t)throw new Error(`Unknown node type '${e.nodeName}'. You probably have insufficient component/profile statements and/or an inappropriate specification version.`);_.data(e,"node",t),"SCRIPT"===e.nodeName&&this.scriptElement(e),this.defAttribute(e,t),this.addNode(e,t),this.pushParent(t),this.nodeAttributes(e,t),this.childrenElements(e),this.isInsideProtoDeclaration()||this.getNodes().push(t),this.popParent()}catch(t){if("NULL"==e.nodeName)return void this.addNode(e,null);m.A?console.error(t):console.error(`XML Parser: ${t.message}`)}},scriptElement(e){const t=_.parseXML(e.outerHTML,"application/xml").children[0].childNodes;e.textContent="// Content moved into childNodes.";for(const i of t)1!==i.nodeType&&4!==i.nodeType||e.appendChild(i)},routeElement(e){try{const t=e.getAttribute("fromNode"),i=e.getAttribute("fromField"),n=e.getAttribute("toNode"),s=e.getAttribute("toField");if(null===t)throw new Error("Bad ROUTE statement: Expected fromNode attribute.");if(null===i)throw new Error("Bad ROUTE statement: Expected fromField attribute.");if(null===n)throw new Error("Bad ROUTE statement: Expected toNode attribute.");if(null===s)throw new Error("Bad ROUTE statement: Expected toField attribute.");const r=this.getExecutionContext(),o=r.getLocalNode(t),a=r.getLocalNode(n),l=r.addRoute(o,i,a,s);_.data(e,"node",l)}catch(e){console.warn(`XML Parser: ${e.message}`),m.A&&console.error(e)}},importElement(e){try{const t=e.getAttribute("inlineDEF"),i=e.getAttribute("importedDEF")||e.getAttribute("exportedDEF"),n=e.getAttribute("AS")||i;if(null===t)throw new Error("Bad IMPORT statement: Expected inlineDEF attribute.");if(null===i)throw new Error("Bad IMPORT statement: Expected importedDEF attribute.");const s=this.getExecutionContext().getNamedNode(t);this.renameExistingNode(n),this.getExecutionContext().addImportedNode(s,i,n),this.getImportedNodes().has(n)||this.getImportedNodes().set(n,this.getExecutionContext().getImportedNodes().get(n))}catch(e){console.warn(`XML Parser: ${e.message}`)}},exportElement(e){try{const t=e.getAttribute("localDEF"),i=e.getAttribute("AS")||t;if(null===t)throw new Error("Bad EXPORT statement: Expected localDEF attribute.");const n=this.getExecutionContext().getLocalNode(t);try{const e=this.getScene().getExportedNode(i);this.getScene().addExportedNode(this.getScene().getUniqueExportName(i),e)}catch{}this.getScene().updateExportedNode(i,n)}catch(e){console.warn(`XML Parser: ${e.message}`)}},cdataNode(e){if(0===this.getParents().length)return;const t=this.getParent();t instanceof r.A&&t.getSourceText()?.push(e.data)},useAttribute(e){const t=e.getAttribute("USE");if(this.id(t)){const i=this.getBrowser(),n=this.nodeNameToCamelCase(e.nodeName),s=_.try(()=>"ProtoInstance"===n?i.getAbstractNode("X3DPrototypeInstance"):i.getConcreteNode(n))??r.A,o=e.getAttribute("name");try{const i=this.getExecutionContext().getLocalNode(t),n=i instanceof u.A?i.getExportedNode(s):i.getValue();this.checkNodeType(n,t,s,o),this.addNode(e,n)}catch{const i=this.getPlaceholders().get(t);if(i)this.addNode(e,i);else{const i=new f.A(this,t,s,o);this.getPlaceholders().set(t,i),this.addNode(e,i)}}return!0}return!1},checkNodeType(e,t,i,n){i!==r.A&&(i===o.A?e.getType().includes(g.A.X3DPrototypeInstance)?n!==e.getTypeName()&&console.warn(`XML Parser: DEF/USE mismatch, '${t}', name ${n} != ${e.getTypeName()}.`):console.warn(`XML Parser: DEF/USE mismatch, '${t}', referenced node is not of type X3DPrototypeInstance.`):i!==e.constructor&&console.warn(`XML Parser: DEF/USE mismatch, '${t}', ${i.typeName} != ${e.getTypeName()}.`))},defAttribute(e,t){try{const i=e.getAttribute("DEF");i&&(this.getNamedNodes().has(i)||this.getNamedNodes().set(i,t),this.renameExistingNode(i),this.getExecutionContext().updateNamedNode(i,t))}catch(e){console.warn(`XML Parser: Invalid DEF name: ${e.message}`)}},nodeAttributes(e,t){for(const i of e.attributes)this.nodeAttribute(i,t)},nodeAttribute(e,t){try{const i=t.getPredefinedField(this.attributeToCamelCase(t,e.name));i.isInitializable()&&this.fieldValue(i,e.value)}catch(e){}},fieldValue(e,t){if(null===t)return!1;this.parser.pushExecutionContext(this.getExecutionContext()),this.parser.setInput(t);const i=this[e.getType()].call(this.parser,e,e.getUnit());return this.parser.popExecutionContext(),i},id:e=>null!==e&&0!==e.length,getParents(){return this.parents},getParent(){return this.parents.at(-1)},pushParent(e){return this.parents.push(e)},popParent(){this.parents.pop()},addNode(e,t){if(0===this.parents.length||this.getParent()instanceof p.A)return void this.getExecutionContext().rootNodes.push(t);const i=this.getParent();if(i instanceof n.A)switch(i.getType()){case g.A.SFNode:return void i.setValue(t);case g.A.MFNode:return void i.push(t)}else try{const n=e.getAttribute("containerField")||t?.getContainerField(this.getExecutionContext().getSpecificationVersion());if(!n)return void console.warn("XML Parser: Node must have a container field attribute.");const s=i.getField(n);switch(s.getType()){case g.A.SFNode:return void s.setValue(t);case g.A.MFNode:return void s.push(t)}}catch(i){t?.getType().includes(g.A.X3DMetadataObject)&&(e.setAttribute("containerField","metadata"),this.addNode(e,t))}},addProtoName(e){},addProtoFieldNames(e){},protoNameToCamelCase:e=>e,nodeNameToCamelCase:e=>e,attributeToCamelCase:(e,t)=>t}),Object.assign(w.prototype,{[g.A.SFBool]:h.A.prototype.sfboolValue,[g.A.SFColor]:h.A.prototype.sfcolorValue,[g.A.SFColorRGBA]:h.A.prototype.sfcolorrgbaValue,[g.A.SFDouble]:h.A.prototype.sfdoubleValue,[g.A.SFFloat]:h.A.prototype.sfdoubleValue,[g.A.SFImage]:h.A.prototype.sfimageValue,[g.A.SFInt32]:h.A.prototype.sfint32Value,[g.A.SFMatrix3f]:h.A.prototype.sfmatrix3Value,[g.A.SFMatrix3d]:h.A.prototype.sfmatrix3Value,[g.A.SFMatrix4f]:h.A.prototype.sfmatrix4Value,[g.A.SFMatrix4d]:h.A.prototype.sfmatrix4Value,[g.A.SFNode]:e=>(e.setValue(null),!0),[g.A.SFRotation]:h.A.prototype.sfrotationValue,[g.A.SFString](e){return e.setValue(a.A.SFString.unescape(this.input)),!0},[g.A.SFTime]:h.A.prototype.sfdoubleValue,[g.A.SFVec2d]:h.A.prototype.sfvec2Value,[g.A.SFVec2f]:h.A.prototype.sfvec2Value,[g.A.SFVec3d]:h.A.prototype.sfvec3Value,[g.A.SFVec3f]:h.A.prototype.sfvec3Value,[g.A.SFVec4d]:h.A.prototype.sfvec4Value,[g.A.SFVec4f]:h.A.prototype.sfvec4Value,[g.A.VrmlMatrix]:h.A.prototype.sfmatrix4Value,[g.A.MFBool]:h.A.prototype.sfboolValues,[g.A.MFColor]:h.A.prototype.sfcolorValues,[g.A.MFColorRGBA]:h.A.prototype.sfcolorValues,[g.A.MFDouble]:h.A.prototype.sfdoubleValues,[g.A.MFFloat]:h.A.prototype.sfdoubleValues,[g.A.MFImage]:h.A.prototype.sfimageValues,[g.A.MFInt32]:h.A.prototype.sfint32Values,[g.A.MFMatrix3d]:h.A.prototype.sfmatrixValues,[g.A.MFMatrix3f]:h.A.prototype.sfmatrixValues,[g.A.MFMatrix4d]:h.A.prototype.sfmatrixValues,[g.A.MFMatrix4f]:h.A.prototype.sfmatrixValues,[g.A.MFNode]:e=>(e.length=0,!0),[g.A.MFRotation]:h.A.prototype.sfrotationValues,[g.A.MFString]:h.A.prototype.sfstringValues,[g.A.MFTime]:h.A.prototype.sfdoubleValues,[g.A.MFVec2d]:h.A.prototype.sfvecValues,[g.A.MFVec2f]:h.A.prototype.sfvecValues,[g.A.MFVec3d]:h.A.prototype.sfvecValues,[g.A.MFVec3f]:h.A.prototype.sfvecValues,[g.A.MFVec4d]:h.A.prototype.sfvecValues,[g.A.MFVec4f]:h.A.prototype.sfvecValues});const x={addProtoName(e){this.protoNames.set(e,e),this.protoNames.set(e.toUpperCase(),e)},addProtoFieldNames:(()=>{const e=new Set;for(const t of["DEF","USE","containerField"])e.add(t).add(t.toLowerCase());return function(t){const i=new Map;this.protoFields.set(t,i);for(const{name:n}of t.getFieldDefinitions())e.has(n)||(i.set(n,n),i.set(n.toLowerCase(),n))}})(),protoNameToCamelCase(e){return this.protoNames.get(e)},nodeNameToCamelCase:e=>c.A.getNodeTypeName(e),attributeToCamelCase(e,t){return e instanceof o.A?this.protoFields.get(e.getProtoNode()).get(t):c.A.getFieldName(t)}};n.A.prototype.fromXMLString=function(e,t){const i=new w(t);if(!i.fieldValue(this,e))throw new Error(`Couldn't read value for field '${this.getName()}'.`);i.setupNodes()};const b=w,S=A.A.add("XMLParser",b)},7233(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(2894),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.category,e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"UnitInfoArray",enumerable:!0}});const a=o,l=r.A.add("UnitInfoArray",a)},7319(e,t,i){i.d(t,{A:()=>s});const n={NONE:0,VOLUME_SCATTER_BIT:1,TRANSMISSION_BIT:2,RENDER_KEY:0,VOLUME_SCATTER_KEY:1,TRANSMISSION_KEY:2},s=i(2696).A.add("RenderPass",n)},7854(e,t,i){i.d(t,{A:()=>a});var n=i(477),s=i(2696);function r(e=n.A.ZERO,t=n.A.Z_AXIS){this.point=new n.A,this.direction=new n.A,this.set(e,t)}Object.assign(r.prototype,{copy(){const e=Object.create(r.prototype);return e.point=this.point.copy(),e.direction=this.direction.copy(),e},assign(e){return this.point.assign(e.point),this.direction.assign(e.direction),this},equals(e){return this.point.equals(e.point)&&this.direction.equals(e.direction)},set(e=n.A.ZERO,t=n.A.Z_AXIS){return this.point.assign(e),this.direction.assign(t),this},setPoints(e,t){return this.point.assign(e),this.direction.assign(t).subtract(e).normalize(),this},multMatrixLine(e){return e.multMatrixVec(this.point),e.multMatrixDir(this.direction).normalize(),this},multLineMatrix(e){return e.multVecMatrix(this.point),e.multDirMatrix(this.direction).normalize(),this},getClosestPointToPoint(e,t=new n.A){const i=t.assign(e).subtract(this.point).dot(this.direction);return t.assign(this.direction).multiply(i).add(this.point)},getClosestPointToLine:(()=>{const e=new n.A;return function(t,i){const{point:n,direction:s}=this,{point:r,direction:o}=t;let a=s.dot(o);return!(Math.abs(a)>=1)&&(e.assign(r).subtract(n),a=(e.dot(s)-a*e.dot(o))/(1-a*a),i.assign(s).multiply(a).add(n),!0)}})(),getPerpendicularVectorToPoint:(()=>{const e=new n.A;return function(t,i=new n.A){return i.assign(this.point).subtract(t),i.subtract(e.assign(this.direction).multiply(i.dot(this.direction)))}})(),getPerpendicularVectorToLine:(()=>{const e=new n.A,t=new n.A,i=new n.A,s=new n.A;return function(r,o=new n.A){const{point:a,direction:l}=this,{point:h,direction:c}=r,u=l.dot(c);if(Math.abs(u)>=1)return e.assign(h).subtract(a),t.assign(l).multiply(e.dot(l)/l.dot(l)),t.subtract(e);i.assign(a).subtract(h);const d=i.dot(l),p=i.dot(c),g=l.dot(c),f=g*g,m=(d-p*g)/(1-f),A=-(p-d*g)/(1-f);return s.assign(l).multiply(m),o.assign(c).multiply(A),o.subtract(s).add(i)}})(),intersectsTriangle:(()=>{const e=new n.A,t=new n.A;return function(i,n,s,r){const o=n.subtract(i),a=s.subtract(i);e.assign(this.direction).cross(a);const l=o.dot(e);if(0===l)return!1;const h=1/l;t.assign(this.point).subtract(i);const c=t.dot(e)*h;if(c<0||c>1)return!1;const u=t.cross(o),d=this.direction.dot(u)*h;return!(d<0||c+d>1)&&(r.u=1-c-d,r.v=c,r.t=d,!0)}})(),toString(){return`${this.point}, ${this.direction}`}}),Object.assign(r,{Points(e,t){const i=Object.create(r.prototype);return i.point=e.copy(),i.direction=t.copy().subtract(e).normalize(),i}});const o=r,a=s.A.add("Line3",o)},8001(e,t,i){i.d(t,{A:()=>d});var n=i(8015),s=i(5543),r=i(5053),o=i(2804),a=i(4068),l=i(2696);const h=Symbol();function c(e){s.A.call(this,e),this.addType(r.A.X3DNode)}Object.assign(Object.setPrototypeOf(c.prototype,s.A.prototype),{getComponentInfo(){return this.constructor.componentInfo},getContainerField(){return this.constructor.containerField},getSpecificationRange(){return this.constructor.specificationRange},create(e=this.getExecutionContext()){return new this.constructor(e)},copy(e){if(e?.getType().includes(r.A.X3DExecutionContext)??1){const t=this.create(e);for(const e of this.getPredefinedFields())t.getPredefinedFields().get(e.getName()).assign(e);if(this.canUserDefinedFields())for(const e of this.getUserDefinedFields())t.addUserDefinedField(e.getAccessType(),e.getName(),e.copy());return t}{const t=e.getBody();if(this.getName().length){const e=t.getNamedNodes().get(this.getName());if(e)return e.getValue()}const i=this.create(t);this.getNeedsName()&&this.getExecutionContext().updateNamedNode(this.getExecutionContext().getUniqueName(),this),this.getName().length&&t.updateNamedNode(this.getName(),i);for(const t of this.getPredefinedFields())try{const n=i.getPredefinedField(t.getName());let s=!1;for(const e of t.getReferences())s||=e.isInitializable();if(t.isInitializable()&&!s)switch(t.getType()){case r.A.SFNode:case r.A.MFNode:n.assign(t.copy(e));break;default:n.assign(t)}if(t.getReferences().size)for(const i of t.getReferences())try{n.addReference(e.getField(i.getName()))}catch(e){console.error(e)}n.setModificationTime(t.getModificationTime())}catch(e){console.error(e)}for(const t of this.getUserDefinedFields()){let n=!1;for(const e of t.getReferences())n||=e.isInitializable();const s=n?t.create():t.copy(e);if(i.addUserDefinedField(t.getAccessType(),t.getName(),s),t.getReferences().size)for(const i of t.getReferences())try{s.addReference(e.getField(i.getName()))}catch(t){console.error(`No reference '${i.getName()}' inside execution context ${e.getTypeName()} '${e.getName()}'.`)}s.setModificationTime(t.getModificationTime())}return i}},getDisplayName(){return this.getName().replace(/_\d+$/,"")},getNeedsName(){if(this.getName().length)return!1;if(this.getCloneCount()>1)return!0;if(this.hasRoutes())return!0;const e=this.getExecutionContext();for(const t of e.getImportedNodes())if(t.getInlineNode()===this)return!0;if(e.isScene)for(const t of e.getExportedNodes())if(t.getLocalNode()===this)return!0;return!1},hasRoutes(){for(const e of this.getPredefinedFields())if(e.getInputRoutes().size||e.getOutputRoutes().size)return!0;for(const e of this.getUserDefinedFields())if(e.getInputRoutes().size||e.getOutputRoutes().size)return!0;for(const e of this.getExecutionContext().getRoutes())if(e.getSourceNode()===this||e.getDestinationNode()===this)return!0;return!1},getCloneCount(){return s.A.prototype.collectCloneCount.call(this)},collectCloneCount:()=>1,getSourceText:()=>null,traverse(){},hasMetaData(e){const t=e.split("/");if(t.length<2)return!1;const i=t.pop(),n=this.getMetadataSet(t),s=n?.getValue().getMetaValue(i);return!!s},getMetaData(e,t){const i=e.split("/");if(i.length<2)return;const n=i.pop(),s=this.getMetadataSet(i),a=s?.getValue().getMetaValue(n);if(t instanceof o.A){if(!a)return t;switch(t.getType()){case r.A.SFBool:case r.A.SFDouble:case r.A.SFFloat:case r.A.SFInt32:case r.A.SFString:case r.A.SFTime:t.setValue(a.value[0]);break;case r.A.SFColor:case r.A.SFColorRGBA:case r.A.SFMatrix3d:case r.A.SFMatrix3f:case r.A.SFMatrix4d:case r.A.SFMatrix4f:case r.A.SFRotation:case r.A.SFVec2d:case r.A.SFVec2f:case r.A.SFVec3d:case r.A.SFVec3f:case r.A.SFVec4d:case r.A.SFVec4f:{const e=a.value;let i=0;for(const n in t)t[n]=e[i++];break}case r.A.SFImage:{const e=a.value,i=t.array;t.width=e[0],t.height=e[1],t.comp=e[2];const n=i.length;for(let t=0;t<n;++t)i[t]=e[3+t];break}case r.A.SFNode:case r.A.MFNode:throw new Error("SFNode and MFNode are not supported as metadata value.");case r.A.MFBool:case r.A.MFDouble:case r.A.MFFloat:case r.A.MFInt32:case r.A.MFString:case r.A.MFTime:t.length=0;for(const e of a.value)t.push(e);break;case r.A.MFColor:case r.A.MFColorRGBA:case r.A.MFMatrix3d:case r.A.MFMatrix3f:case r.A.MFMatrix4d:case r.A.MFMatrix4f:case r.A.MFRotation:case r.A.MFVec2d:case r.A.MFVec2f:case r.A.MFVec3d:case r.A.MFVec3f:case r.A.MFVec4d:case r.A.MFVec4f:{const e=a.value,i=e.length;t.length=0;for(let n=0;n<i;){const i=t.length++,s=t[i];for(const t in s)s[t]=e[n++]}break}case r.A.MFImage:{const e=a.value,i=e.length;t.length=0;for(let n=0;n<i;){const i=t.length++,s=t[i],r=s.array;s.width=e[n++],s.height=e[n++],s.comp=e[n++];const o=r.length;for(let t=0;t<o;++t)r[t]=e[n++]}break}}return t}if(t){if(!a)return t;const e=a.value;let i=0;for(const n in t)t[n]=e[i++];return t}return a?Array.from(a.value):[]},setMetaData(e,t){const i=e.split("/");if(i.length<2)return;const n=i.pop(),s=this.getMetadataSet(i,!0);if(t instanceof o.A){const e=t;switch(t.getType()){case r.A.SFBool:case r.A.SFDouble:case r.A.SFFloat:case r.A.SFInt32:case r.A.SFString:case r.A.SFTime:t=[e.valueOf()];break;case r.A.SFNode:case r.A.MFNode:throw new Error("SFNode and MFNode are not supported as metadata value.");default:t=Array.from(e,e=>e instanceof o.A?Array.from(e):e).flat()}switch(e.getType()){case r.A.SFBool:case r.A.MFBool:t.type="boolean";break;case r.A.SFDouble:case r.A.SFMatrix3d:case r.A.SFMatrix4d:case r.A.SFRotation:case r.A.SFTime:case r.A.SFVec2d:case r.A.SFVec3d:case r.A.SFVec4d:case r.A.MFDouble:case r.A.MFMatrix3d:case r.A.MFMatrix4d:case r.A.MFRotation:case r.A.MFTime:case r.A.MFVec2d:case r.A.MFVec3d:case r.A.MFVec4d:t.type="double";break;case r.A.SFColor:case r.A.SFColorRGBA:case r.A.SFFloat:case r.A.SFMatrix3f:case r.A.SFMatrix4f:case r.A.SFVec2f:case r.A.SFVec3f:case r.A.SFVec4f:case r.A.MFColor:case r.A.MFColorRGBA:case r.A.MFFloat:case r.A.MFMatrix3f:case r.A.MFMatrix4f:case r.A.MFVec2f:case r.A.MFVec3f:case r.A.MFVec4f:t.type="float";break;case r.A.SFInt32:case r.A.SFImage:case r.A.MFInt32:case r.A.MFImage:t.type="integer";break;case r.A.SFString:case r.A.MFString:t.type="string"}}else!Array.isArray(t)&&t.valueOf()instanceof Object&&((t=Array.from(t)).type="double");s.getValue().setMetaValue(n,t),this.processMetaDataCallback(e)},removeMetaData(e){const t=e.split("/");t.length<2||function e(t,i){if(!t)return!1;const n=i.shift();return i.length&&!e(t.getValue().getMetadataObject("MetadataSet",n),i)||t.getValue().removeMetaValue(n),!t.value.length}(this.getMetadataSet([t.shift()]),t)&&(this._metadata=null)},getMetadataSet(e,t=!1){const i=e.shift();let n=this._metadata.valueOf();if("MetadataSet"!==n?.getNodeTypeName()||n?.name!==i){if(!t)return null;this._metadata=this.getExecutionContext().createNode("MetadataSet"),n=this._metadata.valueOf(),this.getExecutionContext().addNamedNode(this.getExecutionContext().getUniqueName(i),n),n.reference=this.getBrowser().getBrowserOption("MetadataReference"),n.name=i}for(const i of e)n=n.getValue().getMetadataObject("MetadataSet",i,t);return n},[h]:new Map,addMetaDataCallback(e,t,i){this.hasOwnProperty(h)||(this[h]=new Map);let n=this[h].get(t);n||this[h].set(t,n=new Map),n.set(e,i)},removeMetaDataCallback(e,t){const i=this[h].get(t);i&&(i.delete(e),0===i.size&&this[h].delete(t))},processMetaDataCallback(e){const t=this[h].get(e);if(t)for(const e of t.values())e()},toStream(e){e.string+=this.getTypeName(),e.TidySpace(),e.string+="{",e.TidySpace(),e.string+="}"},toVRMLStream(e){if(e.CheckSpace(),e.outputNames){const t=e.Name(this);if(t.length&&e.ExistsNode(this))return e.string+="USE",e.Space(),e.string+=t,void e.NeedsSpace();t.length&&(e.AddNode(this),e.string+="DEF",e.Space(),e.string+=t,e.Space())}e.string+=this.getTypeName(),e.TidySpace(),e.string+="{";const t=this.getChangedFields(),i=this.getUserDefinedFields();if(this.canUserDefinedFields()&&i.length){let n=0,s=0;for(const t of i)n=Math.max(n,t.getTypeName().length),s=Math.max(s,e.AccessType(t.getAccessType()).length);e.TidyBreak(),e.IncIndent();const r=i.at(-1);for(const t of i)this.toVRMLStreamUserDefinedField(e,t,n,s),t===r?e.TidyBreak():e.Break();e.DecIndent(),0!==t.length&&e.TidyBreak()}if(0===t.length)i.length?e.Indent():e.TidySpace();else{const n=t.at(-1);0===i.length&&e.TidyBreak(),e.IncIndent();for(const i of t)this.toVRMLStreamField(e,i),i===n?e.TidyBreak():e.Break();e.DecIndent(),e.Indent()}e.string+="}"},toVRMLStreamUserDefinedField(e,t,i,n){const s=e.IsSharedNode(this);if(0===t.getReferences().size||!e.ExecutionContext()||s)e.Indent(),e.string+=e.AccessType(t.getAccessType()).padEnd(n,e.TidySpace()),e.Space(),e.string+=t.getTypeName().padEnd(i,e.TidySpace()),e.Space(),e.string+=t.getName(),t.isInitializable()&&(e.Space(),t.toVRMLStream(e));else{let s=0,o=!1;for(const r of t.getReferences())o||=r.isInitializable(),e.Indent(),e.string+=e.AccessType(t.getAccessType()).padEnd(n,e.TidySpace()),e.Space(),e.string+=t.getTypeName().padEnd(i,e.TidySpace()),e.Space(),e.string+=t.getName(),e.Space(),e.string+="IS",e.Space(),e.string+=r.getName(),++s,s!==t.getReferences().size&&e.Break();t.getAccessType()!==r.A.inputOutput||o||t.isDefaultValue()||(e.Break(),e.Indent(),e.string+=e.AccessType(t.getAccessType()).padEnd(n,e.TidySpace()),e.Space(),e.string+=t.getTypeName().padEnd(i,e.TidySpace()),e.Space(),e.string+=t.getName(),t.isInitializable()&&(e.Space(),t.toVRMLStream(e)))}},toVRMLStreamField(e,t){const i=e.IsSharedNode(this);if(0===t.getReferences().size||!e.ExecutionContext()||i)t.isInitializable()&&(e.Indent(),e.string+=t.getName(),e.Space(),t.toVRMLStream(e));else{let i=0,n=!1;for(const s of t.getReferences())n||=s.isInitializable(),e.Indent(),e.string+=t.getName(),e.Space(),e.string+="IS",e.Space(),e.string+=s.getName(),++i,i!==t.getReferences().size&&e.Break();t.getAccessType()!==r.A.inputOutput||n||this.isDefaultValue(t)||(e.Break(),e.Indent(),e.string+=t.getName(),e.Space(),t.toVRMLStream(e))}},toXMLStream(e){const t=e.IsSharedNode(this),i=e.Name(this);if(i.length&&e.ExistsNode(this))return e.openTag(this.getTypeName()),e.html&&"Script"===this.getTypeName()&&e.attribute("type","model/x3d+xml"),e.attribute("USE",i),e.containerField(this.getContainerField()),void e.closeTag(this.getTypeName());e.openTag(this.getTypeName()),e.html&&"Script"===this.getTypeName()&&e.attribute("type","model/x3d+xml"),i.length&&(e.AddNode(this),e.attribute("DEF",i)),e.containerField(this.getContainerField());const n=this.getChangedFields(),s=this.getUserDefinedFields(),o=[],a=[];let l=this.getSourceText();(0===l?.length||e.html&&"Script"!==this.getTypeName())&&(l=null),l?.some(e=>e.match(/^\s*(?:data|ecmascript|javascript|vrmlscript)\:/s))||(l=null),e.IncIndent(),e.IncIndent();for(const i of n){let n=!1;if(e.ExecutionContext()&&i.getAccessType()===r.A.inputOutput&&0!==i.getReferences().size&&(Array.from(i.getReferences()).some(e=>e.isInitializable())||(n=!this.isDefaultValue(i))),0===i.getReferences().size||!e.ExecutionContext()||t||n){if(n&&o.push(i),i.isInitializable())switch(i.getType()){case r.A.SFNode:case r.A.MFNode:a.push(i);break;default:if(i===l)break;e.AttribBreak(),e.ListIndent(),e.string+=i.getName(),e.string+="='",i.toXMLStream(e,i===this.getSourceText()),e.string+="'"}}else o.push(i)}if(e.DecIndent(),e.DecIndent(),this.canUserDefinedFields()&&s.length||o.length&&!t||a.length||l){if(e.endTag(),e.IncIndent(),this.canUserDefinedFields())for(const i of s){e.openTag("field"),e.attribute("accessType",e.AccessType(i.getAccessType())),e.attribute("type",i.getTypeName()),e.attribute("name",i.getName());let n=!1;if(e.ExecutionContext()&&i.getAccessType()===r.A.inputOutput&&0!==i.getReferences().size&&(Array.from(i.getReferences()).some(e=>e.isInitializable())||(n=!0)),0===i.getReferences().size||!e.ExecutionContext()||t||n)if(n&&e.ExecutionContext()&&o.push(i),!i.isInitializable()||i.isDefaultValue())i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.closeTag("field"),e.TidyBreak();else switch(i.getType()){case r.A.SFNode:case r.A.MFNode:i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.endTag(),e.IncIndent(),e.PushContainerField(null),i.toXMLStream(e),e.TidyBreak(),e.DecIndent(),e.closingTag("field"),e.TidyBreak(),e.PopContainerField();break;default:e.Space(),e.string+="value='",i.toXMLStream(e),e.string+="'",i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.closeTag("field"),e.TidyBreak()}else e.ExecutionContext()&&o.push(i),i.getAppInfo()&&e.attribute("appinfo",i.getAppInfo()),i.getDocumentation()&&e.attribute("documentation",i.getDocumentation()),e.closeTag("field"),e.TidyBreak()}if(o.length&&!t){e.openingTag("IS"),e.TidyBreak(),e.IncIndent();for(const t of o){const i=t.getReferences();for(const n of i)e.openTag("connect"),e.attribute("nodeField",t.getName()),e.attribute("protoField",n.getName()),e.closeTag("connect"),e.TidyBreak()}e.DecIndent(),e.closingTag("IS"),e.TidyBreak()}for(const t of a)e.PushContainerField(t),t.toXMLStream(e),e.TidyBreak(),e.PopContainerField();for(const t of l??[])e.string+="<![CDATA[",e.string+=t,e.string+="]]>",e.Break();e.DecIndent(),e.closingTag(this.getTypeName())}else e.closeTag(this.getTypeName())},toJSONStream(e){const t=e.IsSharedNode(this),i=e.Name(this);if(e.beginObject(this.getTypeName(),!1,!0),i.length&&e.ExistsNode(this))return e.stringProperty("@USE",i,!1),e.endObject(),void e.endObject();let n=!1;i.length&&(e.AddNode(this),e.stringProperty("@DEF",i,!1),n=!0);const s=this.getChangedFields(),o=this.getUserDefinedFields(),a=[];let l=this.getSourceText();if(1!==l?.length&&(l=null),l?.some(e=>e.match(/^\s*(?:data|ecmascript|javascript|vrmlscript)\:/s))||(l=null),s.length){const i=[];for(const n of s){let s=!1;e.ExecutionContext()&&n.getAccessType()===r.A.inputOutput&&0!==n.getReferences().size&&(Array.from(n.getReferences()).some(e=>e.isInitializable())||(s=!this.isDefaultValue(n))),0===n.getReferences().size||!e.ExecutionContext()||t||s?(s&&a.push(n),n!==l&&n.isInitializable()&&i.push(n)):a.push(n)}for(const t of i)switch(t.getType()){case r.A.SFNode:case r.A.MFNode:e.beginValue(`-${t.getName()}`,n||t!==i[0]),t.toJSONStream(e);break;default:e.beginValue(`@${t.getName()}`,n||t!==i[0]),t.toJSONStream(e)}n||=!!i.length}if(this.canUserDefinedFields()&&o.length){e.beginArray("field",n);for(const i of o){e.beginObject("",i!==o[0]),e.stringProperty("@accessType",e.AccessType(i.getAccessType()),!1),e.stringProperty("@type",i.getTypeName()),e.stringProperty("@name",i.getName());let n=!1;if(e.ExecutionContext()&&i.getAccessType()===r.A.inputOutput&&0!==i.getReferences().size&&(Array.from(i.getReferences()).some(e=>e.isInitializable())||(n=!0)),0===i.getReferences().size||!e.ExecutionContext()||t||n){if(n&&e.ExecutionContext()&&a.push(i),i.isInitializable()&&!i.isDefaultValue())switch(i.getType()){case r.A.SFNode:e.beginArray("-children"),e.TidyBreak(),e.Indent(),i.toJSONStream(e),e.endArray();break;case r.A.MFNode:e.beginValue("-children"),i.toJSONStream(e);break;default:e.beginValue("@value"),i.toJSONStream(e)}}else e.ExecutionContext()&&a.push(i);i.getAppInfo()&&e.stringProperty("@appinfo",i.getAppInfo()),i.getDocumentation()&&e.stringProperty("@documentation",i.getDocumentation()),e.endObject()}e.endArray(),n=!0}if(l){e.beginArray("#sourceCode",n);const t=l[0].split("\n");for(const[i,n]of t.entries())0!==i&&(e.string+=","),e.TidyBreak(),e.ListIndent(),e.string+='"',e.string+=e.EncodeString(n),e.string+='"';e.endArray(),n=!0}if(a.length&&!t){e.beginObject("IS",n),e.beginArray("connect",!1);for(const t of a){const i=Array.from(t.getReferences());for(const n of i)e.beginObject("",t!==a[0]||n!==i[0]),e.stringProperty("@nodeField",t.getName(),!1),e.stringProperty("@protoField",n.getName()),e.endObject()}e.endArray(),e.endObject()}e.endObject(),e.endObject()},dispose(){const e=this.getExecutionContext();if(this.getName()&&e.removeNamedNode(this.getName()),e.isScene){for(const t of Array.from(e.getExportedNodes()))t.getLocalNode()===this&&e.removeExportedNode(t.getExportedName());const t=e.getExecutionContext();if(t)for(const e of t.getImportedNodes())e.getExportedNode().update()}for(const e of Array.from(this.getParents()))if(e instanceof n.A.SFNode)for(const t of Array.from(e.getParents()))t instanceof n.A.MFNode&&t.setValue(Array.from(t).filter(e=>e?.getValue()!==this));for(const e of Array.from(this.getParents()))e instanceof n.A.SFNode&&e.setValue(null);a.A.delete(this),s.A.prototype.dispose.call(this)}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});Object.defineProperties(c,{getStaticProperties:{value:(e,t,i,n,s,r="Infinity")=>({typeName:{value:e,enumerable:!0},componentInfo:{value:Object.freeze({name:t,level:i}),enumerable:!0},...n?{containerField:{value:n,enumerable:!0}}:{},...s&&r?{specificationRange:{value:Object.freeze({from:s,to:r}),enumerable:!0}}:{}})}}),Object.defineProperties(c,c.getStaticProperties("X3DNode","Core",1));const u=c,d=l.A.add("X3DNode",u)},8015(e,t,i){i.d(t,{A:()=>At});var n=i(2804),s=i(5053),r=i(2696);function o(e,t,i){const s=t?"DoubleFormat":"FloatFormat";return a(function(e){n.A.call(this,arguments.length?+e:i)},e,{isDefaultValue(){return this.getValue()===i},set(e){n.A.prototype.set.call(this,+e)},toStream(e){const t=this.getUnit();e.string+=e[s](e.ToUnit(t,this.getValue()))},toJSONStreamValue(e){const t=this.getUnit();e.string+=e.Number(e[s](e.ToUnit(t,this.getValue())))}})}function a(e,t,i={}){Object.defineProperties(e,{type:{value:s.A[t],enumerable:!0},typeName:{value:t,enumerable:!0}}),Object.assign(Object.setPrototypeOf(e.prototype,n.A.prototype),{copy(){return new e(this.getValue())},valueOf:n.A.prototype.getValue,toStream(e){e.string+=String(this.getValue())},toVRMLStream(e){this.toStream(e)},toXMLStream(e){this.toStream(e)},toJSONStream(e){this.toJSONStreamValue(e)},toJSONStreamValue(e){this.toStream(e)}},i);for(const t of Object.keys(e.prototype))Object.defineProperty(e.prototype,t,{enumerable:!1});return e}const l={SFBool:(h="SFBool",a(function(e){n.A.call(this,!!e)},h,{isDefaultValue(){return!1===this.getValue()},set(e){n.A.prototype.set.call(this,!!e)},toStream(e){e.string+=this.getValue()?"TRUE":"FALSE"},toXMLStream(e){e.string+=this.getValue()?"true":"false"},toJSONStreamValue(e){e.string+=this.getValue()?"true":"false"}})),SFDouble:o("SFDouble",!0,0),SFFloat:o("SFFloat",!1,0),SFInt32:function(e){return a(function(e){n.A.call(this,0|e)},e,{isDefaultValue(){return 0===this.getValue()},set(e){n.A.prototype.set.call(this,0|e)}})}("SFInt32"),SFString:function(e){function t(e){n.A.call(this,arguments.length?String(e):"")}return a(t,e,{*[Symbol.iterator](){yield*this.getValue()},isDefaultValue(){return""===this.getValue()},set(e){n.A.prototype.set.call(this,String(e))},toStream(e){e.string+='"',e.string+=t.escape(this.getValue()),e.string+='"'},toXMLStream(e,t=!1){e.string+=t?e.EncodeSourceText(this.getValue()):e.EncodeString(this.getValue())},toJSONStreamValue(e){e.string+='"',e.string+=e.EncodeString(this.getValue()),e.string+='"'}}),Object.defineProperty(t.prototype,"length",{get(){return this.getValue().length}}),Object.assign(t,{unescape:e=>e.replace(/\\([\\"])/g,"$1"),escape:e=>e.replace(/([\\"])/g,"\\$1")}),t}("SFString"),SFTime:o("SFTime",!0,-1)};var h;const c=l,u=r.A.add("SFScalar",c);var d=i(9401);function p(e,t,i){switch(arguments.length){case 0:n.A.call(this,new d.A);break;case 1:n.A.call(this,arguments[0]);break;case 3:n.A.call(this,new d.A(+e,+t,+i));break;default:throw new Error("Invalid arguments.")}}Object.assign(Object.setPrototypeOf(p.prototype,n.A.prototype),{*[Symbol.iterator](){yield*this.getValue()},copy(){return new p(this.getValue().copy())},equals(e){return this.getValue().equals(e.getValue())},isDefaultValue(){return this.getValue().equals(d.A.BLACK)},set(e){this.getValue().assign(e)},getHSV(){return this.getValue().getHSV([])},setHSV(e,t,i){this.getValue().setHSV(e,t,i),this.addEvent()},linearToSRGB(){return new p(this.getValue().linearToSRGB())},sRGBToLinear(){return new p(this.getValue().sRGBToLinear())},lerp:(()=>{const e=[],t=[],i=[];return function(n,s){const r=new p;return this.getValue().getHSV(e),n.getValue().getHSV(t),d.A.lerp(e,t,s,i),r.setHSV(i[0],i[1],i[2]),r}})(),toStream(e){const t=this.getValue(),i=t.length-1;for(let n=0;n<i;++n)e.string+=e.FloatFormat(t[n]),e.Space();e.string+=e.FloatFormat(t[i])},toVRMLStream(e){this.toStream(e)},toXMLStream(e){this.toStream(e)},toJSONStream(e){e.string+="[",e.TidySpace(),this.toJSONStreamValue(e),e.TidySpace(),e.string+="]"},toJSONStreamValue(e){const t=this.getValue(),i=t.length-1;for(let n=0;n<i;++n)e.string+=e.Number(e.FloatFormat(t[n])),e.string+=",",e.TidySpace();e.string+=e.Number(e.FloatFormat(t[i]))}});for(const e of Object.keys(p.prototype))Object.defineProperty(p.prototype,e,{enumerable:!1});const g={get(){return this.getValue().r},set(e){this.getValue().r=+e,this.addEvent()}},f={get(){return this.getValue().g},set(e){this.getValue().g=+e,this.addEvent()}},m={get(){return this.getValue().b},set(e){this.getValue().b=+e,this.addEvent()}};Object.defineProperties(p.prototype,{0:g,1:f,2:m,r:Object.assign({enumerable:!0},g),g:Object.assign({enumerable:!0},f),b:Object.assign({enumerable:!0},m)}),Object.defineProperties(p,{type:{value:s.A.SFColor,enumerable:!0},typeName:{value:"SFColor",enumerable:!0}});const A=p,_=r.A.add("SFColor",A);var y=i(2204);function w(e,t,i,s){switch(arguments.length){case 0:n.A.call(this,new y.A);break;case 1:n.A.call(this,arguments[0]);break;case 4:n.A.call(this,new y.A(+e,+t,+i,+s));break;default:throw new Error("Invalid arguments.")}}Object.assign(Object.setPrototypeOf(w.prototype,n.A.prototype),{*[Symbol.iterator](){yield*this.getValue()},copy(){return new w(this.getValue().copy())},equals:_.prototype.equals,isDefaultValue(){return this.getValue().equals(y.A.TRANSPARENT)},set:_.prototype.set,getHSVA(){return this.getValue().getHSVA([])},setHSVA(e,t,i,n){this.getValue().setHSVA(e,t,i,n),this.addEvent()},linearToSRGB(){return new w(this.getValue().linearToSRGB())},sRGBToLinear(){return new w(this.getValue().sRGBToLinear())},lerp:(()=>{const e=[],t=[],i=[];return function(n,s){const r=new w;return this.getValue().getHSVA(e),n.getValue().getHSVA(t),y.A.lerp(e,t,s,i),r.setHSVA(i[0],i[1],i[2],i[3]),r}})(),toStream:_.prototype.toStream,toVRMLStream:_.prototype.toVRMLStream,toXMLStream:_.prototype.toXMLStream,toJSONStream:_.prototype.toJSONStream,toJSONStreamValue:_.prototype.toJSONStreamValue});for(const e of Object.keys(w.prototype))Object.defineProperty(w.prototype,e,{enumerable:!1});const x={get(){return this.getValue().r},set(e){this.getValue().r=+e,this.addEvent()}},b={get(){return this.getValue().g},set(e){this.getValue().g=+e,this.addEvent()}},S={get(){return this.getValue().b},set(e){this.getValue().b=+e,this.addEvent()}},T={get(){return this.getValue().a},set(e){this.getValue().a=+e,this.addEvent()}};Object.defineProperties(w.prototype,{0:x,1:b,2:S,3:T,r:Object.assign({enumerable:!0},x),g:Object.assign({enumerable:!0},b),b:Object.assign({enumerable:!0},S),a:Object.assign({enumerable:!0},T)}),Object.defineProperties(w,{type:{value:s.A.SFColorRGBA,enumerable:!0},typeName:{value:"SFColorRGBA",enumerable:!0}});const v=w,O=r.A.add("SFColorRGBA",v);const E=function(e,t,i,r,o={}){const a=r?"DoubleFormat":"FloatFormat";Object.defineProperties(e,{type:{value:s.A[t],enumerable:!0},typeName:{value:t,enumerable:!0}}),Object.assign(Object.setPrototypeOf(e.prototype,n.A.prototype),{*[Symbol.iterator](){yield*this.getValue()},copy(){return new this.constructor(this.getValue().copy())},equals(e){return this.getValue().equals(e.getValue())},isDefaultValue(){return this.getValue().equals(i.IDENTITY)},set(e){this.getValue().assign(e)},setTransform:(()=>{const e=[];return function(t,i,n,s,r){e.push(t?.getValue(),i?.getValue(),n?.getValue(),s?.getValue(),r?.getValue());for(let t=e.length-1;t>-1&&!e[t];--t)e.pop();this.getValue().set(...e),e.length=0}})(),getTransform:(()=>{const e=[];return function(t,i,n,s,r){e.push(t?.getValue(),i?.getValue(),n?.getValue(),s?.getValue(),r?.getValue());for(let t=e.length-1;t>-1&&!e[t];--t)e.pop();this.getValue().get(...e),t?.addEvent(),i?.addEvent(),n?.addEvent(),s?.addEvent(),e.length=0}})(),determinant(){return this.getValue().determinant()},transpose(){return new this.constructor(this.getValue().copy().transpose())},inverse(){return new this.constructor(this.getValue().copy().inverse())},multLeft(e){return new this.constructor(this.getValue().copy().multLeft(e.getValue()))},multRight(e){return new this.constructor(this.getValue().copy().multRight(e.getValue()))},multVecMatrix(e){return new e.constructor(this.getValue().multVecMatrix(e.getValue().copy()))},multMatrixVec(e){return new e.constructor(this.getValue().multMatrixVec(e.getValue().copy()))},multDirMatrix(e){return new e.constructor(this.getValue().multDirMatrix(e.getValue().copy()))},multMatrixDir(e){return new e.constructor(this.getValue().multMatrixDir(e.getValue().copy()))},translate(e){return new this.constructor(this.getValue().copy().translate(e.getValue()))},rotate(e){return new this.constructor(this.getValue().copy().rotate(e.getValue()))},scale(e){return new this.constructor(this.getValue().copy().scale(e.getValue()))},toStream(e){const t=this.getValue(),i=t.length-1;for(let n=0;n<i;++n)e.string+=e[a](t[n]),e.Space();e.string+=e[a](t[i])},toVRMLStream(e){this.toStream(e)},toXMLStream(e){this.toStream(e)},toJSONStream(e){e.string+="[",e.TidySpace(),this.toJSONStreamValue(e),e.TidySpace(),e.string+="]"},toJSONStreamValue(e){const t=this.getValue(),i=t.length-1;for(let n=0;n<i;++n)e.string+=e.Number(e[a](t[n])),e.string+=",",e.TidySpace();e.string+=e.Number(e[a](t[i]))}},o);for(const t of Object.keys(e.prototype))Object.defineProperty(e.prototype,t,{enumerable:!1});function l(t){Object.defineProperty(e.prototype,t,{get(){return this.getValue()[t]},set(e){this.getValue()[t]=+e,this.addEvent()},enumerable:!0})}for(let e=0;e<i.prototype.length;++e)l(e);return e},N=r.A.add("SFMatrixPrototypeTemplate",E);var C=i(1256);function I(e,t){return N(function(e,t,i,s,r,o,a,l,h){switch(arguments.length){case 0:n.A.call(this,new C.A);break;case 1:n.A.call(this,arguments[0]);break;case 3:{const e=arguments[0],t=arguments[1],i=arguments[2];n.A.call(this,new C.A(e.x,e.y,e.z,t.x,t.y,t.z,i.x,i.y,i.z));break}case 9:n.A.call(this,new C.A(+e,+t,+i,+s,+r,+o,+a,+l,+h));break;default:throw new Error("Invalid arguments.")}},e,C.A,t,{setTransform:(()=>{const e=[];return function(t,i,n,s,r){e.push(t?.getValue(),i,n?.getValue(),s,r?.getValue());for(let t=e.length-1;t>-1&&!e[t];--t)e.pop();this.getValue().set(...e),e.length=0}})(),rotate(e){return new this.constructor(this.getValue().copy().rotate(e))},skewX(e){return new this.constructor(this.getValue().copy().skewX(e))},skewY(e){return new this.constructor(this.getValue().copy().skewY(e))}})}const F={SFMatrix3d:I("SFMatrix3d",!0),SFMatrix3f:I("SFMatrix3f",!1)},M=r.A.add("SFMatrix3",F);var R=i(9582);function P(e,t){return N(function(e,t,i,s,r,o,a,l,h,c,u,d,p,g,f,m){switch(arguments.length){case 0:n.A.call(this,new R.A);break;case 1:n.A.call(this,arguments[0]);break;case 4:{const e=arguments[0],t=arguments[1],i=arguments[2],s=arguments[3];n.A.call(this,new R.A(e.x,e.y,e.z,e.w,t.x,t.y,t.z,t.w,i.x,i.y,i.z,i.w,s.x,s.y,s.z,s.w));break}case 16:n.A.call(this,new R.A(+e,+t,+i,+s,+r,+o,+a,+l,+h,+c,+u,+d,+p,+g,+f,+m));break;default:throw new Error("Invalid arguments.")}},e,R.A,t)}const V={SFMatrix4d:P("SFMatrix4d",!0),SFMatrix4f:P("SFMatrix4f",!1),VrmlMatrix:P("VrmlMatrix",!1)},D=r.A.add("SFMatrix4",V);var L=i(5768);const B=function(e,t,i,r,o={}){const a=r?"DoubleFormat":"FloatFormat";Object.defineProperties(e,{type:{value:s.A[t],enumerable:!0},typeName:{value:t,enumerable:!0}}),Object.assign(Object.setPrototypeOf(e.prototype,n.A.prototype),{*[Symbol.iterator](){yield*this.getValue()},copy(){return new this.constructor(this.getValue().copy())},equals(e){return this.getValue().equals(e.getValue())},isDefaultValue(){return this.getValue().equals(i.ZERO)},set(e){this.getValue().assign(e)},abs(){return new this.constructor(this.getValue().copy().abs())},add(e){return new this.constructor(this.getValue().copy().add(e.getValue()))},clamp(e,t){return new this.constructor(this.getValue().copy().clamp(e.getValue(),t.getValue()))},distance(e){return this.getValue().distance(e.getValue())},divide(e){return new this.constructor(this.getValue().copy().divide(e))},divVec(e){return new this.constructor(this.getValue().copy().divVec(e.getValue()))},dot(e){return this.getValue().dot(e.getValue())},inverse(){return new this.constructor(this.getValue().copy().inverse())},length(){return this.getValue().norm()},lerp(e,t){return new this.constructor(this.getValue().copy().lerp(e,t))},max(e){return new this.constructor(this.getValue().copy().max(e.getValue()))},min(e){return new this.constructor(this.getValue().copy().min(e.getValue()))},multiply(e){return new this.constructor(this.getValue().copy().multiply(e))},multVec(e){return new this.constructor(this.getValue().copy().multVec(e.getValue()))},negate(){return new this.constructor(this.getValue().copy().negate())},normalize(e){return new this.constructor(this.getValue().copy().normalize())},subtract(e){return new this.constructor(this.getValue().copy().subtract(e.getValue()))},toStream(e){const t=this.getValue(),i=t.length-1,n=this.getUnit();for(let s=0;s<i;++s)e.string+=e[a](e.ToUnit(n,t[s])),e.Space();e.string+=e[a](e.ToUnit(n,t[i]))},toVRMLStream(e){this.toStream(e)},toXMLStream(e){this.toStream(e)},toJSONStream(e){e.string+="[",e.TidySpace(),this.toJSONStreamValue(e),e.TidySpace(),e.string+="]"},toJSONStreamValue(e){const t=this.getValue(),i=t.length-1,n=this.getUnit();for(let s=0;s<i;++s)e.string+=e.Number(e[a](e.ToUnit(n,t[s]))),e.string+=",",e.TidySpace();e.string+=e.Number(e[a](e.ToUnit(n,t[i])))}},o);for(const t of Object.keys(e.prototype))Object.defineProperty(e.prototype,t,{enumerable:!1});const l={get(){return this.getValue().x},set(e){this.getValue().x=+e,this.addEvent()}},h={get(){return this.getValue().y},set(e){this.getValue().y=+e,this.addEvent()}},c={get(){return this.getValue().z},set(e){this.getValue().z=+e,this.addEvent()}},u={get(){return this.getValue().w},set(e){this.getValue().w=+e,this.addEvent()}},d=[[0,l],[1,h],[2,c],[3,u]],p=[["x",Object.assign({enumerable:!0},l)],["y",Object.assign({enumerable:!0},h)],["z",Object.assign({enumerable:!0},c)],["w",Object.assign({enumerable:!0},u)]];return d.length=i.prototype.length,p.length=i.prototype.length,Object.defineProperties(e.prototype,Object.fromEntries(d.concat(p))),e},k=r.A.add("SFVecPrototypeTemplate",B);var j=i(477);function U(e,t){return k(function(e,t,i){switch(arguments.length){case 0:n.A.call(this,new j.A);break;case 1:n.A.call(this,arguments[0]);break;case 3:n.A.call(this,new j.A(+e,+t,+i));break;default:throw new Error("Invalid arguments.")}},e,j.A,t,{cross(e){return new this.constructor(this.getValue().copy().cross(e.getValue()))}})}const X={SFVec3d:U("SFVec3d",!0),SFVec3f:U("SFVec3f",!1)},z=r.A.add("SFVec3",X);var G=i(5319),H=i(3937);const $=z.SFVec3d,Y=z.SFVec3f,q=M.SFMatrix3d,W=M.SFMatrix3f;function K(e,t,i,s){switch(arguments.length){case 0:n.A.call(this,new G.A);break;case 1:if(arguments[0]instanceof q||arguments[0]instanceof W){n.A.call(this,(new G.A).setMatrix(arguments[0].getValue()));break}n.A.call(this,arguments[0]);break;case 2:if(arguments[1]instanceof $||arguments[1]instanceof Y){n.A.call(this,new G.A(arguments[0].getValue(),arguments[1].getValue()));break}n.A.call(this,new G.A(arguments[0].getValue(),+arguments[1]));break;case 4:n.A.call(this,new G.A(+e,+t,+i,+s));break;default:throw new Error("Invalid arguments.")}}Object.assign(Object.setPrototypeOf(K.prototype,n.A.prototype),{*[Symbol.iterator](){yield*this.getValue()},copy(){return new K(this.getValue().copy())},equals(e){return this.getValue().equals(e.getValue())},isDefaultValue(){return this.getValue().equals(G.A.IDENTITY)},set(e){this.getValue().assign(e)},setAxis(e){this.getValue().setAxis(e.getValue()),this.addEvent()},getAxis(){return new Y(this.getValue().getAxis())},setMatrix(e){this.getValue().setMatrix(e.getValue()),this.addEvent()},getMatrix(){return new W(this.getValue().getMatrix())},setQuaternion:(()=>{const e=new H.A;return function(t,i,n,s){this.getValue().setQuaternion(e.set(t,i,n,s)),this.addEvent()}})(),getQuaternion:(()=>{const e=new H.A;return function(){return[...this.getValue().getQuaternion(e)]}})(),inverse(){return new K(this.getValue().copy().inverse())},multiply(e){return new K(this.getValue().copy().multRight(e.getValue()))},multVec(e){return new e.constructor(this.getValue().multVecRot(e.getValue().copy()))},slerp(e,t){return new K(this.getValue().copy().slerp(e.getValue(),t))},straighten(e){return new K(this.getValue().copy().straighten(e?.getValue()))},toStream(e){const{x:t,y:i,z:n,angle:s}=this.getValue();e.string+=e.DoubleFormat(t),e.Space(),e.string+=e.DoubleFormat(i),e.Space(),e.string+=e.DoubleFormat(n),e.Space(),e.string+=e.DoubleFormat(e.ToUnit("angle",s))},toVRMLStream(e){this.toStream(e)},toXMLStream(e){this.toStream(e)},toJSONStream(e){e.string+="[",e.TidySpace(),this.toJSONStreamValue(e),e.TidySpace(),e.string+="]"},toJSONStreamValue(e){const{x:t,y:i,z:n,angle:s}=this.getValue();e.string+=e.Number(e.DoubleFormat(t)),e.string+=",",e.TidySpace(),e.string+=e.Number(e.DoubleFormat(i)),e.string+=",",e.TidySpace(),e.string+=e.Number(e.DoubleFormat(n)),e.string+=",",e.TidySpace(),e.string+=e.Number(e.DoubleFormat(e.ToUnit("angle",s)))}});for(const e of Object.keys(K.prototype))Object.defineProperty(K.prototype,e,{enumerable:!1});const Z={get(){return this.getValue().x},set(e){this.getValue().x=+e,this.addEvent()}},Q={get(){return this.getValue().y},set(e){this.getValue().y=+e,this.addEvent()}},J={get(){return this.getValue().z},set(e){this.getValue().z=+e,this.addEvent()}},ee={get(){return this.getValue().angle},set(e){this.getValue().angle=+e,this.addEvent()}};Object.defineProperties(K.prototype,{0:Z,1:Q,2:J,3:ee,x:Object.assign({enumerable:!0},Z),y:Object.assign({enumerable:!0},Q),z:Object.assign({enumerable:!0},J),angle:Object.assign({enumerable:!0},ee)}),Object.defineProperties(K,{type:{value:s.A.SFRotation,enumerable:!0},typeName:{value:"SFRotation",enumerable:!0}});const te=K,ie=r.A.add("SFRotation",te);var ne=i(1166);function se(e,t){return k(function(e,t){switch(arguments.length){case 0:n.A.call(this,new ne.A);break;case 1:n.A.call(this,arguments[0]);break;case 2:n.A.call(this,new ne.A(+e,+t));break;default:throw new Error("Invalid arguments.")}},e,ne.A,t)}const re={SFVec2d:se("SFVec2d",!0),SFVec2f:se("SFVec2f",!1)},oe=r.A.add("SFVec2",re);var ae=i(8392);function le(e,t){return k(function(e,t,i,s){switch(arguments.length){case 0:n.A.call(this,new ae.A(0,0,0,1));break;case 1:n.A.call(this,arguments[0]);break;case 4:n.A.call(this,new ae.A(+e,+t,+i,+s));break;default:throw new Error("Invalid arguments.")}},e,ae.A,t,{isDefaultValue(){return this.getValue().equals(ae.A.W_AXIS)}})}const he={SFVec4d:le("SFVec4d",!0),SFVec4f:le("SFVec4f",!1)},ce=r.A.add("SFVec4",he);var ue=i(5197);const de=Symbol(),pe=Symbol(),ge=Symbol(),fe=Symbol(),me={get(e,t){const i=e[t];if(void 0!==i)return i;if("string"==typeof t){const i=e.getValue(),n=+t;return Number.isInteger(n)?(n>=i.length&&e.resize(n+1),i[n].valueOf()):e[t]}},set(e,t,i){if(t in e)return e[t]=i,!0;const n=e.getValue(),s=+t;return s>=n.length&&e.resize(s+1),n[s].setValue(i),!0},has:(e,t)=>Number.isInteger(+t)?t<e.getValue().length:t in e,ownKeys:e=>Object.keys(e.getValue()),getOwnPropertyDescriptor(e,t){if("string"!=typeof t)return;const i=+t;return Number.isInteger(i)&&i<e.getValue().length?Object.getOwnPropertyDescriptor(e.getValue(),t):void 0}};function Ae(e){const t=new Proxy(this,me);ue.A.call(this,[]),this[de]=this,this[pe]=t;for(const t of e)this.push(t);return t}Object.assign(Object.setPrototypeOf(Ae.prototype,ue.A.prototype),{[de]:null,[pe]:null,*[Symbol.iterator](){const e=this[de].getValue();for(const t of e)yield t.valueOf()},getTarget(){return this[de]},copy(){const e=this[de],t=e.create();return t.assign(e),t},equals(e){const t=this[de].getValue(),i=e.getValue(),n=t.length;if(t===i)return!0;if(n!==i.length)return!1;for(let e=0;e<n;++e)if(!t[e].equals(i[e]))return!1;return!0},isDefaultValue(){return 0===this.length},set(e){const t=this[de],i=t.getValue(),s=e.length;t.resize(s,void 0,!0);for(let t=0;t<s;++t)i[t].set(e[t]instanceof n.A?e[t].getValue():e[t])},setValue(e){const t=this[de];t.set(e instanceof Ae?e.getValue():e),t.addEvent()},unshift(...e){const t=this[de],i=t.getValue();for(let n=e.length-1;n>=0;--n){const s=new(t.getSingleType());s.setValue(e[n]),t.addChildObject(s),i.unshift(s)}return t.addEvent(),i.length},shift(){const e=this[de],t=e.getValue();if(t.length){const i=t.shift(),n=i.valueOf();return e.removeChildObject(i),e.addEvent(),n}},push(...e){const t=this[de],i=t.getValue();for(const n of e){const e=new(t.getSingleType());e.setValue(n),t.addChildObject(e),i.push(e)}return t.addEvent(),i.length},pop(){const e=this[de],t=e.getValue();if(t.length){const i=t.pop(),n=i.valueOf();return e.removeChildObject(i),e.addEvent(),n}},splice(e,t,...i){const n=this[de],s=n.getValue().length;if(0===arguments.length)return new n.constructor;arguments.length<2&&(t=s);const r=n[fe](e,t);return i.length&&n[ge](e,i),r},[ge](e,t){const i=this[de],n=[];for(const e of t){const t=new(i.getSingleType());t.setValue(e),i.addChildObject(t),n.push(t)}i.getValue().splice(e,0,...n),i.addEvent()},[fe](e,t){const i=this[de],n=i.getValue().splice(e,t),s=new i.constructor;for(const e of n)s.push(e),i.removeChildObject(e);return i.addEvent(),s},resize(e,t,i){const n=this[de],s=n.getValue(),r=s.length;if(e<0)throw new RangeError("Invalid array length");if(e<r){for(let t=e;t<r;++t)n.removeChildObject(s[t]);s.length=e,i||n.addEvent()}else if(e>r){for(let i=r;i<e;++i){const e=new(n.getSingleType());void 0!==t&&e.setValue(t),n.addChildObject(e),s.push(e)}i||n.addEvent()}},addChildObject(e){e.addParent(this[pe])},removeChildObject(e){e.dispose()},shrinkToFit(){return this.getValue()},concat(...e){const t=this.copy(),i=t[de];for(const t of e)for(const e of t)i.push(e);return t},reverse(){const e=this[de];return e.getValue().reverse(),e.addEvent(),e[pe]},sort(e){const t=this[de];return Array.prototype.sort.call(this,e),t.addEvent(),t[pe]},valueOf(){return this[pe]},toStream(e){const t=this[de].getValue(),i=t.length;switch(i){case 0:e.string+="[",e.TidySpace(),e.string+="]";break;case 1:t[0].toStream(e);break;default:{const n=i-1;e.string+="[",e.ListStart(),e.IncIndent();for(let i=0;i<n;++i)e.ListIndent(),t[i].toStream(e),e.Comma(),e.ListBreak();e.ListIndent(),t.at(-1).toStream(e),e.ListEnd(),e.DecIndent(),e.ListIndent(),e.string+="]";break}}},toVRMLStream(e){this.toStream(e)},toXMLStream(e){const t=this[de],i=t.length;if(i){const n=t.getValue(),s=i-1;for(let t=0;t<s;++t)n[t].toXMLStream(e),e.Comma(),e.TidySpace();n.at(-1).toXMLStream(e)}},toJSONStream(e){const t=this[de],i=t.length;if(i){const n=t.getValue(),s=i-1;e.string+="[",e.ListBreak(),e.IncIndent();for(let t=0;t<s;++t)e.ListIndent(),n[t].toJSONStreamValue(e),e.string+=",",e.ListBreak();e.ListIndent(),n.at(-1).toJSONStreamValue(e),e.ListBreak(),e.DecIndent(),e.ListIndent(),e.string+="]"}else e.string+="[",e.TidySpace(),e.string+="]"}});for(const e of Object.keys(Ae.prototype))Object.defineProperty(Ae.prototype,e,{enumerable:!1});Object.defineProperty(Ae.prototype,"length",{get(){return this[de].getValue().length},set(e){this[de].resize(e)}});const _e=Ae,ye=r.A.add("X3DObjectArrayField",_e);var we=i(5185);const xe=Symbol(),be=Symbol(),Se=Symbol(),Te=Symbol(),ve=Symbol(),Oe=Symbol(),Ee=Symbol(),Ne=Symbol(),Ce=Symbol(),Ie={get(e,t){const i=e[t];if(void 0!==i)return i;if("string"==typeof t){const i=+t;if(Number.isInteger(i)){const t=e.getComponents(),n=e.getValueType(),s=i<e[ve]?e.getValue():e.resize(i+1,e.getSingleValue());return 1===t?n(s[i]):e[Se][i]??(e[Se][i]=Me(e,i,t,n))}return e[t]}},set(e,t,i){if(t in e)return e[t]=i,!0;const n=e.getComponents();let s=+t,r=e.getValue();if(s>=e[ve]&&(r=e.resize(s+1,e.getSingleValue())),1===n){const t=e.getValueType();r[s]=t(i)}else{s*=n;for(let e=0;e<n;++e,++s)r[s]=i[e]}return e.addEvent(),!0},has:(e,t)=>Number.isInteger(+t)?t<e[ve]:t in e,ownKeys(e){const t=[];for(let i=0,n=e[ve];i<n;++i)t.push(String(i));return t},getOwnPropertyDescriptor(e,t){if("string"!=typeof t)return;const i=+t;return Number.isInteger(i)&&i<e[ve]?Object.getOwnPropertyDescriptor(e.getValue(),t):void 0}};function Fe(e){const t=new Proxy(this,Ie);ue.A.call(this,new(this.getArrayType())(16)),this[xe]=this,this[be]=t,this.getComponents()>1&&(this[Se]=[],this[Te]=[]);for(const t of e)this.push(t);return t}Object.assign(Object.setPrototypeOf(Fe.prototype,ue.A.prototype),{[xe]:null,[Te]:null,[ve]:0,*[Symbol.iterator](){const e=this[xe],t=e.getValue(),i=e.getComponents(),n=e.getValueType(),s=e[ve];if(1===i)for(let e=0;e<s;++e)yield n(t[e]);else{const t=e[Se];for(let r=0;r<s;++r)yield t[r]??(t[r]=Me(e,r,i,n))}},getTarget(){return this[xe]},copy(){const e=this[xe],t=e.getValue(),i=e.create();return i.set(t,e[ve]),i},equals(e){const t=this[xe],i=e[xe],n=t[ve];if(t===i)return!0;if(n!==i[ve])return!1;const s=t.getValue(),r=i.getValue(),o=n*t.getComponents();for(let e=0;e<o;++e)if(s[e]!==r[e])return!1;return!0},assign(e){const t=this[xe];t.set(e.getValue(),e.length),t.addEvent()},set(e,t){const i=this[xe],n=i.getComponents(),s=i[ve];let r=i.getValue(),o=void 0!==t?t*n:e.length;const a=o%n;a&&(o-=a,console.warn(`Array length must be multiple of components size, which is ${n}.`)),o/=n,r.length<e.length?(r=i[Ne](e.length),r.set(e),a&&r.fill(0,o*n,o*n+a)):(r.set(e),o<s&&r.fill(0,o*n,s*n)),i[ve]=o},isDefaultValue(){return 0===this[ve]},setValue(e){const t=this[xe];e instanceof t.constructor?t.assign(e):(t.set(e),t.addEvent())},unshift(...e){const t=this[xe],i=t.getComponents(),n=t[ve],s=e.length,r=t[Ne]((n+s)*i);if(r.copyWithin(s*i,0,n*i),1===i){const i=t.getValueType();for(let t=0;t<s;++t)r[t]=i(e[t])}else for(let t=0,n=0;n<s;++n){const s=e[n];for(let e=0;e<i;++e,++t)r[t]=s[e]}return t[ve]+=s,t.addEvent(),t[ve]},shift(){const e=this[xe],t=e[ve];if(t){const i=e.getValue(),n=e.getComponents(),s=e.getValueType(),r=t-1;let o;if(1===n)o=s(i[0]);else{const t=e[Te];for(let e=0;e<n;++e)t[e]=i[e];o=new s(...t)}return i.copyWithin(0,n,t*n),i.fill(0,n*r,t*n),e[ve]=r,e.addEvent(),o}},push(...e){const t=this[xe],i=t.getComponents(),n=t[ve],s=e.length,r=t[Ne]((n+s)*i);if(1===i){const i=t.getValueType();for(let t=0,o=n;t<s;++t,++o)r[o]=i(e[t])}else for(let t=n*i,o=0;o<s;++o){const n=e[o];for(let e=0;e<i;++e,++t)r[t]=n[e]}return t[ve]+=s,t.addEvent(),t[ve]},pop(){const e=this[xe],t=e[ve];if(t){const i=e.getValue(),n=e.getComponents(),s=e.getValueType(),r=t-1;let o;if(1===n)o=s(i[t-1]);else{const t=e[Te];for(let e=0,s=r*n;e<n;++e,++s)t[e]=i[s];o=new s(...t)}return i.fill(0,r*n,t*n),e[ve]=r,e.addEvent(),o}},splice(e,t,...i){const n=this[xe],s=n[ve];if(0===arguments.length)return new n.constructor;(e|=0)<0&&(e+=s),e=we.A.clamp(e,0,s),arguments.length<2&&(t=s),e+(t|=0)>s&&(t=s-e),t=Math.max(t,0);const r=n[Ee](e,e+t);return i.length&&n[Oe](e,i),n.addEvent(),r},[Oe](e,t){const i=this[xe],n=i.getComponents(),s=i[ve],r=t.length,o=i[Ne]((s+r)*n);if(e*=n,o.copyWithin(e+r*n,e,s*n),1===n){const n=i.getValueType();for(let i=0,s=e;i<r;++i,++s)o[s]=n(t[i])}else for(let i=0,s=e;i<r;++i){const e=t[i];for(let t=0;t<n;++t,++s)o[s]=e[t]}i[ve]+=r},[Ee](e,t){const i=this[xe],n=i.getValue(),s=i.getComponents(),r=t-e,o=i[ve],a=o-r,l=i[be].slice(e,t);return e*=s,t*=s,n.copyWithin(e,t,o*s),n.fill(0,a*s,o*s),i[ve]=a,s>1&&(i[Se].length=a),i.addEvent(),l},resize(e,t,i){const n=this[xe],s=n[ve],r=n.getComponents();if(e<0)throw new RangeError("Invalid array length");let o=n.getValue();return n[ve]=e,e<s?(o.fill(0,e*r,s*r),r>1&&(n[Se].length=e),i||n.addEvent()):e>s&&(o=n[Ne](e*r),void 0!==t&&this[Ce](t,s,e),i||n.addEvent()),o},[Ne](e){const t=this[xe],i=t.getValue();if(e<=i.length)return i;const n=we.A.nextPowerOfTwo(e),s=new(t.getArrayType())(n);return s.set(i),ue.A.prototype.set.call(t,s),s},shrinkToFit(){const e=this[xe],t=e.getValue(),i=e[ve]*e.getComponents();if(t.length===i)return t;const n=t.subarray(0,i);return ue.A.prototype.set.call(e,n),n},concat(...e){const t=this.copy(),i=t[xe],n=i.getComponents(),s=i[ve]+e.reduce((e,t)=>e+t.length,0),r=i[Ne](s*n);let o=i[ve]*n;for(const t of e)r.set(t.shrinkToFit(),o),o+=t.length*n;return i[ve]=s,t},flat(){const e=this[xe],t=e.shrinkToFit(),i=e.getComponents(),n=e.getValueType();return 1===i?Array.from(t,e=>n(e)):Array.from(t)},flatMap(...e){return this.map(...e).flat()},[Ce](e,t=0,i=this.length){const n=this[xe],s=n[ve],r=n.getValue(),o=n.getComponents();if(-s<=t&&t<0&&(t+=s),t<-s&&(t=0),!(t>=s||(-s<=i&&i<0&&(i+=s),i<-s&&(i=0),i>=s&&(i=s),t>=i))){if(1===o){const s=n.getValueType();r.fill(s(e),t*o,i*o)}else{const n=t*o,s=i*o;for(let t=n,i=0;i<o;++t,++i)r[t]=e[i];let a=n+o,l=o;for(;a<s;){const e=a+l>s?s-a:l;r.copyWithin(a,n,n+e),a+=l,l<<=1}}return n[be]}},fill(e,t=0,i=this.length){const n=this[xe];return this[Ce](e,t,i),n.addEvent(),n[be]},reverse(){const e=this[xe],t=e.getValue(),i=e.getComponents(),n=e[ve]*i,s=Math.floor(e[ve]/2)*i;if(1===i)for(let e=0;e<s;++e){const i=n-e-1,s=t[e];t[e]=t[i],t[i]=s}else for(let e=0;e<s;e+=i)for(let s=0;s<i;++s){const r=e+s,o=n-e-1-(i-s-1),a=t[r];t[r]=t[o],t[o]=a}return e.addEvent(),e[be]},sort(e){const t=this[xe],i=t.getValue(),n=t.getComponents(),s=t[ve];if(1===n){const n=t.getValueType(),r=e?(t,i)=>e(n(t),n(i)):we.A.cmp;t.set(i.subarray(0,s).sort(r))}else{const r=Array.from(t[be],e=>e.copy()).sort(e??((e,t)=>{for(let i=0;i<n;++i){if(e[i]<t[i])return-1;if(t[i]<e[i])return 1}return 0}));for(let e=0;e<s;++e){const t=r[e];for(let s=0,r=e*n;s<n;++s,++r)i[r]=t[s]}}return t.addEvent(),t[be]},valueOf(){return this[be]},toStream(e){const t=this[xe],i=t.getValue(),n=t[ve],s=t.getComponents(),r=new(t.getSingleType());switch(r.setUnit(t.getUnit()),n){case 0:e.string+="[",e.TidySpace(),e.string+="]";break;case 1:if(1===s)r.set(i[0]),r.toStream(e);else{for(let e=0,t=0;e<s;++e,++t)r[e]=i[t];r.toStream(e)}break;default:{const t=n-1;if(e.string+="[",e.ListStart(),e.IncIndent(),1===s){for(let n=0;n<t;++n)e.ListIndent(),r.set(i[n*s]),r.toStream(e),e.Comma(),e.ListBreak();e.ListIndent(),r.set(i[t*s]),r.toStream(e)}else{for(let n=0;n<t;++n){e.ListIndent();for(let e=0,t=n*s;e<s;++e,++t)r[e]=i[t];r.toStream(e),e.Comma(),e.ListBreak()}e.ListIndent();for(let e=0,n=t*s;e<s;++e,++n)r[e]=i[n];r.toStream(e)}e.ListEnd(),e.DecIndent(),e.ListIndent(),e.string+="]";break}}},toVRMLStream(e){this.toStream(e)},toXMLStream(e){const t=this[xe],i=t[ve];if(i){const n=t.getValue(),s=t.getComponents(),r=new(t.getSingleType()),o=i-1;if(r.setUnit(t.getUnit()),1===s){for(let t=0;t<o;++t)r.set(n[t*s]),r.toXMLStream(e),e.Comma(),e.TidySpace();r.set(n[o*s]),r.toXMLStream(e)}else{for(let t=0;t<o;++t){for(let e=0,i=t*s;e<s;++e,++i)r[e]=n[i];r.toXMLStream(e),e.Comma(),e.TidySpace()}for(let e=0,t=o*s;e<s;++e,++t)r[e]=n[t];r.toXMLStream(e)}}},toJSONStream(e){const t=this[xe],i=t.length;if(i){const n=t.getValue(),s=t.getComponents(),r=new(t.getSingleType()),o=i-1;if(r.setUnit(t.getUnit()),e.string+="[",e.ListBreak(),e.IncIndent(),1===s){for(let t=0;t<o;++t)e.ListIndent(),r.set(n[t*s]),r.toJSONStreamValue(e),e.string+=",",e.ListBreak();e.ListIndent(),r.set(n[o*s]),r.toJSONStreamValue(e)}else{for(let t=0;t<o;++t){e.ListIndent();for(let e=0,i=t*s;e<s;++e,++i)r[e]=n[i];r.toJSONStreamValue(e),e.string+=",",e.ListBreak()}e.ListIndent();for(let e=0,t=o*s;e<s;++e,++t)r[e]=n[t];r.toJSONStreamValue(e)}e.ListBreak(),e.DecIndent(),e.ListIndent(),e.string+="]"}else e.string+="[",e.TidySpace(),e.string+="]"},dispose(){ue.A.prototype.dispose.call(this[xe])}});for(const e of Object.keys(Fe.prototype))Object.defineProperty(Fe.prototype,e,{enumerable:!1});function Me(e,t,i,n){const s=new n,r=s.getValue(),o=t*i;return Object.defineProperties(s,{addEvent:{value:Pe.bind(e,o,i,r),configurable:!0},getValue:{value:Re.bind(e,o,i,r),configurable:!0}}),s}function Re(e,t,i){const n=this.getValue();for(let s=0;s<t;++s,++e)i[s]=n[e];return i}function Pe(e,t,i){const n=this.getValue();for(let s=0;s<t;++s,++e)n[e]=i[s];this.addEvent()}Object.defineProperty(Fe.prototype,"length",{get(){return this[ve]},set(e){const t=this[xe];t.resize(e,t.getSingleValue())}});const Ve=Fe,De=r.A.add("X3DTypedArrayField",Ve),{SFBool:Le,SFDouble:Be,SFFloat:ke,SFInt32:je,SFString:Ue,SFTime:Xe}=u,{SFMatrix3d:ze,SFMatrix3f:Ge}=M,{SFMatrix4d:He,SFMatrix4f:$e}=D,{SFVec2d:Ye,SFVec2f:qe}=oe,{SFVec3d:We,SFVec3f:Ke}=z,{SFVec4d:Ze,SFVec4f:Qe}=ce;function Je(...e){return ye.call(this,e)}Object.assign(Object.setPrototypeOf(Je.prototype,ye.prototype),{getSingleType:()=>L.A,copy(e){if(e){const t=new Je;for(const i of this.getValue())t.push(i.copy(e));return t}return ye.prototype.copy.call(this)},toStream(e){const t=this.getTarget().getValue(),i=t.length;switch(i){case 0:e.string+="[",e.TidySpace(),e.string+="]";break;case 1:t[0].toStream(e);break;default:e.string+="[",e.TidyBreak(),e.IncIndent();for(let n=0;n<i;++n)e.Indent(),t[n].toStream(e),e.TidyBreak();e.DecIndent(),e.Indent(),e.string+="]"}},toVRMLStream(e){const t=this.getTarget().getValue();switch(t.length){case 0:e.string+="[",e.TidySpace(),e.string+="]";break;case 1:t[0].toVRMLStream(e);break;default:e.string+="[",e.TidyBreak(),e.IncIndent();for(const i of t)e.Indent(),i.toVRMLStream(e),e.TidyBreak();e.DecIndent(),e.Indent(),e.string+="]"}},toXMLStream(e){const t=this.getTarget(),i=t.length;if(i){const n=t.getValue(),s=i-1;for(let t=0;t<s;++t){const i=n[t].getValue();i?i.toXMLStream(e):(e.openTag("NULL"),e.containerField(),e.closeTag("NULL")),e.TidyBreak()}const r=n.at(-1).getValue();r?r.toXMLStream(e):(e.openTag("NULL"),e.containerField(),e.closeTag("NULL"))}},toJSONStream(e){const t=this.getTarget(),i=t.length;if(i){const n=t.getValue(),s=i-1;e.string+="[",e.TidyBreak(),e.IncIndent();for(let t=0;t<s;++t)e.Indent(),n[t]?n[t].toJSONStreamValue(e):e.string+="null",e.string+=",",e.TidyBreak();e.Indent(),n.at(-1)?n.at(-1).toJSONStreamValue(e):e.string+="null",e.TidyBreak(),e.DecIndent(),e.Indent(),e.string+="]"}else e.string+="[",e.TidySpace(),e.string+="]"},dispose(){const e=this.getTarget();e.resize(0,void 0,!0),e.processInterests(),ye.prototype.dispose.call(e)}});for(const e of Object.keys(Je.prototype))Object.defineProperty(Je.prototype,e,{enumerable:!1});function et(...e){return ye.call(this,e)}Object.defineProperties(Je,{type:{value:s.A.MFNode,enumerable:!0},typeName:{value:"MFNode",enumerable:!0}}),Object.assign(Object.setPrototypeOf(et.prototype,ye.prototype),{getSingleType:()=>Ue,toXMLStream(e,t=!1){const i=this.getTarget(),n=i.length;if(n){const s=i.getValue();for(let i=0,r=n-1;i<r;++i)e.string+='"',s[i].toXMLStream(e,t),e.string+='"',e.Comma(),e.TidySpace();e.string+='"',s.at(-1).toXMLStream(e,t),e.string+='"'}}});for(const e of Object.keys(et.prototype))Object.defineProperty(et.prototype,e,{enumerable:!1});function tt(...e){return ye.call(this,e)}Object.defineProperties(et,{type:{value:s.A.MFString,enumerable:!0},typeName:{value:"MFString",enumerable:!0}}),Object.assign(Object.setPrototypeOf(tt.prototype,ye.prototype),{getSingleType:()=>ft});for(const e of Object.keys(tt.prototype))Object.defineProperty(tt.prototype,e,{enumerable:!1});function it(e,t,i,n,r,o){function a(...e){return De.call(this,e)}Object.assign(Object.setPrototypeOf(a.prototype,De.prototype),{getSingleValue:()=>o,getSingleType:()=>t,getValueType:()=>i,getArrayType:()=>n,getComponents:()=>r});for(const e of Object.keys(a.prototype))Object.defineProperty(a.prototype,e,{enumerable:!1});return Object.defineProperties(a,{type:{value:s.A[e],enumerable:!0},typeName:{value:e,enumerable:!0}}),a}Object.defineProperties(tt,{type:{value:s.A.MFImage,enumerable:!0},typeName:{value:"MFImage",enumerable:!0}});const nt=e=>e,st={MFBool:it("MFBool",Le,Boolean,Uint8Array,1),MFColor:it("MFColor",_,_,Float32Array,3),MFColorRGBA:it("MFColorRGBA",O,O,Float32Array,4),MFDouble:it("MFDouble",Be,nt,Float64Array,1),MFFloat:it("MFFloat",ke,nt,Float32Array,1),MFImage:tt,MFInt32:it("MFInt32",je,nt,Int32Array,1),MFMatrix3d:it("MFMatrix3d",ze,ze,Float64Array,9,C.A.IDENTITY),MFMatrix3f:it("MFMatrix3f",Ge,Ge,Float32Array,9,C.A.IDENTITY),MFMatrix4d:it("MFMatrix4d",He,He,Float64Array,16,R.A.IDENTITY),MFMatrix4f:it("MFMatrix4f",$e,$e,Float32Array,16,R.A.IDENTITY),MFNode:Je,MFRotation:it("MFRotation",ie,ie,Float64Array,4,G.A.IDENTITY),MFString:et,MFTime:it("MFTime",Xe,nt,Float64Array,1,-1),MFVec2d:it("MFVec2d",Ye,Ye,Float64Array,2),MFVec2f:it("MFVec2f",qe,qe,Float32Array,2),MFVec3d:it("MFVec3d",We,We,Float64Array,3),MFVec3f:it("MFVec3f",Ke,Ke,Float32Array,3),MFVec4d:it("MFVec4d",Ze,Ze,Float64Array,4,ae.A.W_AXIS),MFVec4f:it("MFVec4f",Qe,Qe,Float32Array,4,ae.A.W_AXIS)},rt=r.A.add("ArrayFields",st),ot=rt.MFInt32;function at(e,t,i,n){this.width=Math.max(0|e,0),this.height=Math.max(0|t,0),this.comp=we.A.clamp(0|i,0,4),this.array=new ot,this.array.setValue(n),this.array.length=this.width*this.height}Object.assign(at.prototype,{copy(){return new at(this.width,this.height,this.comp,this.array)},equals(e){return this.width===e.width&&this.height===e.height&&this.comp===e.comp&&this.array.equals(e.array)},assign(e){this.width=e.width,this.height=e.height,this.comp=e.comp,this.array.assign(e.array)},set(e,t,i,n){this.width=0|e,this.height=0|t,this.comp=0|i,this.array.assign(n)},setWidth(e){this.width=Math.max(0|e,0),this.array.length=this.width*this.height},getWidth(){return this.width},setHeight(e){this.height=Math.max(0|e,0),this.array.length=this.width*this.height},getHeight(){return this.height},setComp(e){this.comp=we.A.clamp(0|e,0,4)},getComp(){return this.comp},setArray(e){this.array.setValue(e),this.array.length=this.width*this.height},getArray(){return this.array}});const lt=Symbol();function ht(e,t,i,s){switch(arguments.length){case 0:n.A.call(this,new at(0,0,0,new ot));break;case 1:n.A.call(this,arguments[0]);break;case 3:n.A.call(this,new at(e,t,i,new ot));break;case 4:n.A.call(this,new at(e,t,i,s));break;default:throw new Error("Invalid arguments.")}this.getValue().getArray().addParent(this),this.addInterest(lt,this)}Object.assign(Object.setPrototypeOf(ht.prototype,n.A.prototype),{[lt](){this.getValue().getArray().length=this.width*this.height},*[Symbol.iterator](){yield this.width,yield this.height,yield this.comp,yield*this.array},copy(){return new ht(this.getValue().copy())},equals(e){return this.getValue().equals(e.getValue())},isDefaultValue(){return 0===this.width&&0===this.height&&0===this.comp},set(e){this.getValue().assign(e)},toStream(e){const t=this.width,i=this.height,n=new Uint32Array(this.array.getValue().buffer);e.string+=t,e.Space(),e.string+=i,e.Space(),e.string+=this.comp,e.AttribBreak(),e.IncIndent();for(let s=0;s<i;++s){e.ListIndent();const r=s*t;for(let i=0;i<t;++i)e.string+="0x",e.string+=n[i+r].toString(16),i!==t-1&&e.Space();s!==i-1&&e.AttribBreak()}e.DecIndent()},toVRMLStream(e){this.toStream(e)},toXMLStream(e){this.toStream(e)},toJSONStream(e){e.string+="[",e.ListBreak(),e.IncIndent(),e.ListIndent(),this.toJSONStreamValue(e),e.DecIndent(),e.ListBreak(),e.ListIndent(),e.string+="]"},toJSONStreamValue(e){const t=this.width,i=this.height,n=new Uint32Array(this.array.getValue().buffer),s=this.array.length;if(e.string+=t,e.string+=",",e.TidySpace(),e.string+=i,e.string+=",",e.TidySpace(),e.string+=this.comp,e.string+=",",t&&i){e.ListBreak(),e.IncIndent();for(let r=0;r<i;++r){e.ListIndent();const o=r*t;for(let i=0;i<t;++i)e.string+=n[i+o],i+o!==s-1&&(e.string+=","),i!==t-1&&e.TidySpace();r!==i-1&&e.ListBreak()}e.DecIndent()}}});for(const e of Object.keys(ht.prototype))Object.defineProperty(ht.prototype,e,{enumerable:!1});const ct={get(){return this.getValue().getWidth()},set(e){this.getValue().setWidth(e),this.addEvent()}},ut={get(){return this.getValue().getHeight()},set(e){this.getValue().setHeight(e),this.addEvent()}},dt={get(){return this.getValue().getComp()},set(e){this.getValue().setComp(e),this.addEvent()}},pt={get(){return this.getValue().getArray()},set(e){this.getValue().setArray(e),this.addEvent()}};Object.defineProperties(ht.prototype,{x:ct,y:ut,width:Object.assign({enumerable:!0},ct),height:Object.assign({enumerable:!0},ut),comp:Object.assign({enumerable:!0},dt),array:Object.assign({enumerable:!0},pt)}),Object.defineProperties(ht,{type:{value:s.A.SFImage,enumerable:!0},typeName:{value:"SFImage",enumerable:!0}});const gt=ht,ft=r.A.add("SFImage",gt),mt={SFColor:_,SFColorRGBA:O,SFImage:ft,SFNode:L.A,SFRotation:ie,...u,...M,...D,...oe,...z,...ce,...rt},At=r.A.add("Fields",mt)},8067(e,t,i){i.d(t,{A:()=>c});var n=i(8001),s=i(2251),r=i(5053),o=i(5185),a=i(2696);function l(e){s.A.call(this,e),this.addType(r.A.X3DInterpolatorNode)}Object.assign(Object.setPrototypeOf(l.prototype,s.A.prototype),{setup(){this.set_key__(),this.set_fraction__(),s.A.prototype.setup.call(this)},initialize(){s.A.prototype.initialize.call(this),this._set_fraction.addInterest("set_fraction__",this),this._key.addInterest("set_key__",this)},set_fraction__(){const e=this._key,t=e.length,i=this._set_fraction.getValue();switch(t){case 0:return;case 1:return this.interpolate(0,0,0);default:{if(i<=e[0])return this.interpolate(0,1,0);const n=o.A.upperBound(e,0,t,i);if(n!==t){const t=n-1,s=(i-e[t])/(e[n]-e[t]);this.interpolate(t,n,o.A.clamp(s,0,1))}else this.interpolate(t-2,t-1,1)}}},set_key__(){this.set_keyValue__()}}),Object.defineProperties(l,n.A.getStaticProperties("X3DInterpolatorNode","Interpolation",1));const h=l,c=a.A.add("X3DInterpolatorNode",h)},8187(e,t,i){i.d(t,{A:()=>g});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(1794),l=i(3278),h=i(8219),c=i(5053),u=i(2696);function d(e){a.A.call(this,e,new l.A(e),new h.A(e)),this.addType(c.A.Layer)}Object.assign(Object.setPrototypeOf(d.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this);const e=this.getGroups()._children[0].getValue();this._addChildren.addFieldInterest(e._addChildren),this._removeChildren.addFieldInterest(e._removeChildren),this._children.addFieldInterest(e._children),e._children=this._children,e.setPrivate(!0),e.setup(),this.getGroups().setup()}}),Object.defineProperties(d,{...o.A.getStaticProperties("Layer","Layering",1,"layers","3.2"),fieldDefinitions:{value:new r.A([new s.A(c.A.inputOutput,"metadata",new n.A.SFNode),new s.A(c.A.inputOutput,"pickable",new n.A.SFBool(!0)),new s.A(c.A.inputOutput,"objectType",new n.A.MFString("ALL")),new s.A(c.A.inputOutput,"pointerEvents",new n.A.SFBool(!0)),new s.A(c.A.inputOutput,"visible",new n.A.SFBool(!0)),new s.A(c.A.inputOutput,"viewport",new n.A.SFNode),new s.A(c.A.inputOnly,"addChildren",new n.A.MFNode),new s.A(c.A.inputOnly,"removeChildren",new n.A.MFNode),new s.A(c.A.inputOutput,"children",new n.A.MFNode)]),enumerable:!0}});const p=d,g=u.A.add("Layer",p)},8188(e,t,i){i.d(t,{A:()=>d});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(8067),l=i(5053),h=i(2696);function c(e){a.A.call(this,e),this.addType(l.A.EaseInEaseOut)}Object.assign(Object.setPrototypeOf(c.prototype,a.A.prototype),{initialize(){a.A.prototype.initialize.call(this),this._easeInEaseOut.addInterest("set_keyValue__",this)},set_keyValue__(){this._easeInEaseOut.length<this._key.length&&this._easeInEaseOut.resize(this._key.length,this._easeInEaseOut.length?this._easeInEaseOut[this._easeInEaseOut.length-1]:new n.A.SFVec2f),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){let n=this._easeInEaseOut[e].y,s=this._easeInEaseOut[t].x;const r=n+s;if(r<0)this._modifiedFraction_changed=i;else{r>1&&(s/=r,n/=r);const e=1/(2-n-s);if(i<n)this._modifiedFraction_changed=e/n*i*i;else if(i<=1-s)this._modifiedFraction_changed=e*(2*i-n);else{const t=1-i;this._modifiedFraction_changed=1-e*t*t/s}}}}),Object.defineProperties(c,{...o.A.getStaticProperties("EaseInEaseOut","Interpolation",4,"children","3.2"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOnly,"set_fraction",new n.A.SFFloat),new s.A(l.A.inputOutput,"key",new n.A.MFFloat),new s.A(l.A.inputOutput,"easeInEaseOut",new n.A.MFVec2f),new s.A(l.A.outputOnly,"modifiedFraction_changed",new n.A.SFFloat)]),enumerable:!0}});const u=c,d=h.A.add("EaseInEaseOut",u)},8219(e,t,i){i.d(t,{A:()=>d});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(1766),l=i(5053),h=i(2696);function c(e){a.A.call(this,e),this.addType(l.A.Group)}Object.setPrototypeOf(c.prototype,a.A.prototype),Object.defineProperties(c,{...o.A.getStaticProperties("Group","Grouping",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(l.A.inputOutput,"metadata",new n.A.SFNode),new s.A(l.A.inputOutput,"visible",new n.A.SFBool(!0)),new s.A(l.A.inputOutput,"bboxDisplay",new n.A.SFBool),new s.A(l.A.initializeOnly,"bboxSize",new n.A.SFVec3f(-1,-1,-1)),new s.A(l.A.initializeOnly,"bboxCenter",new n.A.SFVec3f),new s.A(l.A.inputOnly,"addChildren",new n.A.MFNode),new s.A(l.A.inputOnly,"removeChildren",new n.A.MFNode),new s.A(l.A.inputOutput,"children",new n.A.MFNode)]),enumerable:!0}});const u=c,d=h.A.add("Group",u)},8381(e,t,i){i.d(t,{A:()=>p});var n=i(9721),s=i(991),r=i(2696);const o=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),c=[];function u(){n.A.call(this)}Object.assign(Object.setPrototypeOf(u.prototype,n.A.prototype),{[o]:-1,[a]:!1,[l]:null,[h]:!1,isInitializable:()=>!0,isInput:()=>!1,isOutput:()=>!1,setModificationTime(e){this[o]=e},getModificationTime(){return this[o]},setTainted(e){this[a]=e},isTainted(){return this[a]},addEvent(){for(const e of this[l]??c)e.addEvent(this)},addEventObject(e,t){for(const e of this[l]??c)e.addEventObject(this,t)},processEvent(){this.setTainted(!1),this.processInterests()},isPrivate(){return this[h]},setPrivate(e){this[h]=e},collectCloneCount(){let e=0;for(const t of this[l]??c)t[h]||(e+=t.collectCloneCount());return e},addParent(e){this.getParents().add(e),this.parentsChanged()},removeParent(e){this[l]?.delete(e),this.parentsChanged()},getParents(){return this[l]??=new s.A},parentsChanged(){},dispose(){this[l]?.clear(),n.A.prototype.dispose.call(this)}});for(const e of Object.keys(u.prototype))Object.defineProperty(u.prototype,e,{enumerable:!1});const d=u,p=r.A.add("X3DChildObject",d)},8392(e,t,i){i.d(t,{A:()=>a});var n=i(5185),s=i(2696);function r(e=0,t=e,i=t,n=i){this.x=e,this.y=t,this.z=i,this.w=n}Object.assign(r.prototype,{*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w},copy(){const e=Object.create(r.prototype);return e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w,e},assign({x:e,y:t,z:i,w:n}){return this.x=e,this.y=t,this.z=i,this.w=n,this},set(e=0,t=e,i=t,n=i){return this.x=e,this.y=t,this.z=i,this.w=n,this},equals({x:e,y:t,z:i,w:n}){return this.x===e&&this.y===t&&this.z===i&&this.w===n},negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},inverse(){return this.x=1/this.x,this.y=1/this.y,this.z=1/this.z,this.w=1/this.w,this},add({x:e,y:t,z:i,w:n}){return this.x+=e,this.y+=t,this.z+=i,this.w+=n,this},subtract({x:e,y:t,z:i,w:n}){return this.x-=e,this.y-=t,this.z-=i,this.w-=n,this},multiply(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},multVec({x:e,y:t,z:i,w:n}){return this.x*=e,this.y*=t,this.z*=i,this.w*=n,this},divide(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this},divVec({x:e,y:t,z:i,w:n}){return this.x/=e,this.y/=t,this.z/=i,this.w/=n,this},normalize(){const e=Math.hypot(this.x,this.y,this.z,this.w);return e&&(this.x/=e,this.y/=e,this.z/=e,this.w/=e),this},dot({x:e,y:t,z:i,w:n}){return this.x*e+this.y*t+this.z*i+this.w*n},squaredNorm(){const{x:e,y:t,z:i,w:n}=this;return e*e+t*t+i*i+n*n},norm(){return Math.hypot(this.x,this.y,this.z,this.w)},distance({x:e,y:t,z:i,w:n}){return Math.hypot(this.x-e,this.y-t,this.z-i,this.w-n)},lerp({x:e,y:t,z:i,w:n},s){const{x:r,y:o,z:a,w:l}=this;return this.x=r+s*(e-r),this.y=o+s*(t-o),this.z=a+s*(i-a),this.w=l+s*(n-l),this},abs(){const{x:e,y:t,z:i,w:n}=this;return this.x=Math.abs(e),this.y=Math.abs(t),this.z=Math.abs(i),this.w=Math.abs(n),this},min(e){let{x:t,y:i,z:n,w:s}=this;for(const{x:e,y:r,z:o,w:a}of arguments)t=Math.min(t,e),i=Math.min(i,r),n=Math.min(n,o),s=Math.min(s,a);return this.x=t,this.y=i,this.z=n,this.w=s,this},max(e){let{x:t,y:i,z:n,w:s}=this;for(const{x:e,y:r,z:o,w:a}of arguments)t=Math.max(t,e),i=Math.max(i,r),n=Math.max(n,o),s=Math.max(s,a);return this.x=t,this.y=i,this.z=n,this.w=s,this},clamp({x:e,y:t,z:i,w:s},{x:r,y:o,z:a,w:l}){return this.x=n.A.clamp(this.x,e,r),this.y=n.A.clamp(this.y,t,o),this.z=n.A.clamp(this.z,i,a),this.w=n.A.clamp(this.w,s,l),this},toString(){return this.x+" "+this.y+" "+this.z+" "+this.w}});for(const e of Object.keys(r.prototype))Object.defineProperty(r.prototype,e,{enumerable:!1});Object.defineProperties(r.prototype,{length:{value:4},0:{get(){return this.x},set(e){this.x=e}},1:{get(){return this.y},set(e){this.y=e}},2:{get(){return this.z},set(e){this.z=e}},3:{get(){return this.w},set(e){this.w=e}}}),Object.assign(r,{ZERO:Object.freeze(new r),ONE:Object.freeze(new r(1)),X_AXIS:Object.freeze(new r(1,0,0,0)),Y_AXIS:Object.freeze(new r(0,1,0,0)),Z_AXIS:Object.freeze(new r(0,0,1,0)),W_AXIS:Object.freeze(new r(0,0,0,1)),NEGATIVE_ONE:Object.freeze(new r(-1)),NEGATIVE_X_AXIS:Object.freeze(new r(-1,0,0,0)),NEGATIVE_Y_AXIS:Object.freeze(new r(0,-1,0,0)),NEGATIVE_Z_AXIS:Object.freeze(new r(0,0,-1,0)),NEGATIVE_W_AXIS:Object.freeze(new r(0,0,0,-1))});const o=r,a=s.A.add("Vector4",o)},8442(e,t,i){i.d(t,{A:()=>g});var n=i(8015),s=i(5717),r=i(3999),o=i(8001),a=i(2895),l=i(3967),h=i(5053),c=i(5185),u=i(2696);function d(e){a.A.call(this,e),l.A.call(this,e),this.addType(h.A.TimeSensor),this.addChildObjects(h.A.inputOutput,"range",new n.A.MFFloat(0,0,1)),this.cycle=0,this.interval=0,this.fraction=0,this.first=0,this.last=1,this.scale=1}Object.assign(Object.setPrototypeOf(d.prototype,a.A.prototype),l.A.prototype,{initialize(){a.A.prototype.initialize.call(this),l.A.prototype.initialize.call(this),this._cycleInterval.addInterest("set_cycleInterval__",this),this._range.addInterest("set_range__",this)},setRange(e,t,i,n){const s=this.getBrowser().getCurrentTime(),r=this._startTime.getValue(),o=this._cycleInterval.getValue();this.first=c.A.clamp(t,0,1),this.last=c.A.clamp(i,0,1),this.scale=this.last-this.first,this.interval=o*this.scale,this.offset=n&&this.interval?(s-r)/this.interval:0,this.fraction=c.A.fract(e+this.offset),this.cycle=s-(this.fraction-this.first)*o},set_cycleInterval__(){this._isActive.getValue()&&this.setRange(this.fraction,this._range[1],this._range[2],!1)},set_range__(){this._isActive.getValue()&&(this.setRange(this._range[0],this._range[1],this._range[2],!1),this._isPaused.getValue()||this.set_fraction(this.getBrowser().getCurrentTime()))},set_start(){this.setRange(this._range[0],this._range[1],this._range[2],!0);const e=this.getBrowser().getCurrentTime();this._time=e,this._cycleTime=e,this._fraction_changed=this.fraction},set_resume(e){this.setRange(this.fraction,this._range[1],this._range[2],!1)},set_fraction(e){const t=this.first+(this.interval?c.A.fract((e-this.cycle)/this.interval):0)*this.scale;this.fraction=t,this._fraction_changed=t},set_time(){const e=this.getBrowser().getCurrentTime();this._time=e,e-this.cycle>=this.interval?this._loop.getValue()?this.interval&&(this.cycle+=this.interval*Math.floor((e-this.cycle)/this.interval),this._elapsedTime=this.getElapsedTime(),this._cycleTime=e,this.set_fraction(e)):(this._elapsedTime=this.getElapsedTime(),this._fraction_changed=this.fraction=this.last,this.stop()):(this._elapsedTime=this.getElapsedTime(),this.set_fraction(e))},dispose(){l.A.prototype.dispose.call(this),a.A.prototype.dispose.call(this)}}),Object.defineProperties(d,{...o.A.getStaticProperties("TimeSensor","Time",1,"children","2.0"),fieldDefinitions:{value:new r.A([new s.A(h.A.inputOutput,"metadata",new n.A.SFNode),new s.A(h.A.inputOutput,"description",new n.A.SFString),new s.A(h.A.inputOutput,"enabled",new n.A.SFBool(!0)),new s.A(h.A.inputOutput,"cycleInterval",new n.A.SFTime(1)),new s.A(h.A.inputOutput,"loop",new n.A.SFBool),new s.A(h.A.inputOutput,"startTime",new n.A.SFTime(0)),new s.A(h.A.inputOutput,"resumeTime",new n.A.SFTime(0)),new s.A(h.A.inputOutput,"pauseTime",new n.A.SFTime(0)),new s.A(h.A.inputOutput,"stopTime",new n.A.SFTime(0)),new s.A(h.A.outputOnly,"isPaused",new n.A.SFBool),new s.A(h.A.outputOnly,"isActive",new n.A.SFBool),new s.A(h.A.outputOnly,"cycleTime",new n.A.SFTime),new s.A(h.A.outputOnly,"elapsedTime",new n.A.SFTime),new s.A(h.A.outputOnly,"fraction_changed",new n.A.SFFloat),new s.A(h.A.outputOnly,"time",new n.A.SFTime)]),enumerable:!0}});const p=d,g=u.A.add("TimeSensor",p)},8588(e,t,i){i.d(t,{A:()=>w});var n=i(9721),s=i(5053),r=i(4068),o=i(8001),a=i(6761),l=i(2696),h=i(9340);const c=Symbol(),u=Symbol(),d=Symbol(),p=Symbol(),g=Symbol(),f=Symbol(),m=Symbol(),A=Symbol();function _(e,t,i,s,r){n.A.call(this,e),this[c]=e,this[u]=t,this[d]=i,this[g]=s,this[f]=r,t instanceof a.A&&t.getInlineNode()._loadState.addInterest("reconnect",this),s instanceof a.A&&s.getInlineNode()._loadState.addInterest("reconnect",this),this.reconnect()}Object.assign(Object.setPrototypeOf(_.prototype,n.A.prototype),{getExecutionContext(){return this[c]},getRouteId(){return _.getRouteId(this[u],this[d],this[g],this[f])},getSourceNode(){return this[u]instanceof a.A?this[u].getExportedNode():this[u]},getSourceField(){return this[p]?this[p].getAccessType()===s.A.inputOutput?this[p].getName()+"_changed":this[p].getName():this[d]},getDestinationNode(){return this[g]instanceof a.A?this[g].getExportedNode():this[g]},getDestinationField(){return this[m]?this[m].getAccessType()===s.A.inputOutput?"set_"+this[m].getName():this[m].getName():this[f]},reconnect(){try{this.disconnect(),this.connect()}catch(e){(this[u]instanceof o.A||this[u].getInlineNode().checkLoadState()===s.A.COMPLETE_STATE)&&(this[g]instanceof o.A||this[g].getInlineNode().checkLoadState()===s.A.COMPLETE_STATE)&&console.warn(e)}},connect(){if(this[A])return;let e,t;try{const e=this[u]instanceof o.A?this[u]:this[u].getExportedNode();this[p]=e.getField(this[d])}catch(t){e=t}try{const e=this[g]instanceof o.A?this[g]:this[g].getExportedNode();this[m]=e.getField(this[f])}catch(e){t=e}if(!this[p]||!this[m])throw e??t;if(this[p].getType()!==this[m].getType())throw new Error(`Bad ROUTE statement: Source field type must match destination field type of fields named "${this[p].getName()}" and "${this[m].getName()}".`);if(!this[p].isOutput())throw new Error(`Bad ROUTE statement: Source field "${this[p].getName()}" must be an output.`);if(!this[m].isInput())throw new Error(`Bad ROUTE statement: Destination field "${this[m].getName()}" must be an input.`);this[p].addOutputRoute(this),this[m].addInputRoute(this),this[p].addFieldInterest(this[m])},disconnect(){this[p]?.removeOutputRoute(this),this[m]?.removeInputRoute(this),this[p]&&this[m]&&this[p].removeFieldInterest(this[m]),this[p]=null,this[m]=null},toVRMLStream(e){if(!e.ExistsRouteNode(this[u]))throw new Error("Source node does not exist in scene graph.");if(!e.ExistsRouteNode(this[g]))throw new Error("Destination node does not exist in scene graph.");const t=this[u]instanceof o.A?e.Name(this[u]):e.ImportedName(this[u]),i=this[g]instanceof o.A?e.Name(this[g]):e.ImportedName(this[g]);e.Indent(),e.string+="ROUTE",e.Space(),e.string+=t,e.string+=".",e.string+=this.getSourceField(),e.Space(),e.string+="TO",e.Space(),e.string+=i,e.string+=".",e.string+=this.getDestinationField()},toXMLStream(e){if(!e.ExistsRouteNode(this[u]))throw new Error("Source node does not exist in scene graph.");if(!e.ExistsRouteNode(this[g]))throw new Error("Destination node does not exist in scene graph.");const t=this[u]instanceof o.A?e.Name(this[u]):e.ImportedName(this[u]),i=this[g]instanceof o.A?e.Name(this[g]):e.ImportedName(this[g]);e.openTag("ROUTE"),e.attribute("fromNode",t),e.attribute("fromField",this.getSourceField()),e.attribute("toNode",i),e.attribute("toField",this.getDestinationField()),e.closeTag("ROUTE")},toJSONStream(e){if(!e.ExistsRouteNode(this[u]))throw new Error("Source node does not exist in scene graph.");if(!e.ExistsRouteNode(this[g]))throw new Error("Destination node does not exist in scene graph.");const t=this[u]instanceof o.A?e.Name(this[u]):e.ImportedName(this[u]),i=this[g]instanceof o.A?e.Name(this[g]):e.ImportedName(this[g]);e.TidyBreak(),e.Indent(),e.beginObject("ROUTE",!1,!0),e.stringProperty("@fromNode",t,!1),e.stringProperty("@fromField",this.getSourceField()),e.stringProperty("@toNode",i),e.stringProperty("@toField",this.getDestinationField()),e.endObject(),e.endObject()},dispose(){this[A]||(this[A]=!0,this.disconnect(),this[u]instanceof a.A&&this[u].getInlineNode()._loadState.removeInterest("reconnect",this),this[g]instanceof a.A&&this[g].getInlineNode()._loadState.removeInterest("reconnect",this),this[c].deleteRoute(this),n.A.prototype.dispose.call(this))}});for(const e of Object.keys(_.prototype))Object.defineProperty(_.prototype,e,{enumerable:!1});Object.defineProperties(_.prototype,{sourceNode:{get(){return r.A.get(this.getSourceNode())},enumerable:!0},sourceField:{get:_.prototype.getSourceField,enumerable:!0},destinationNode:{get(){return r.A.get(this.getDestinationNode())},enumerable:!0},destinationField:{get:_.prototype.getDestinationField,enumerable:!0}}),Object.defineProperties(_,{typeName:{value:"X3DRoute",enumerable:!0}}),Object.assign(_,{getRouteId(e,t,i,n){const r=e instanceof o.A?e.getField(t):h.try(()=>e.getExportedNode().getField(t)),a=i instanceof o.A?i.getField(n):h.try(()=>i.getExportedNode().getField(n));return r&&(t=r.getName(),r.getAccessType()===s.A.inputOutput&&(t+="_changed")),a&&(n=a.getName(),a.getAccessType()===s.A.inputOutput&&(n="set_"+n)),`${e.getId()}.${t}.${i.getId()}.${n}`}});const y=_,w=l.A.add("X3DRoute",y)},8625(e,t,i){i.d(t,{A:()=>N});var n=i(8015),s=i(2244),r=i(2695),o=i(9949),a=i(3880),l=i(2894),h=i(7233),c=i(6366),u=i(6529),d=i(937),p=i(5053),g=i(4068),f=i(9351),m=i(2696);const A=Symbol(),_=Symbol(),y=Symbol(),w=Symbol(),x=Symbol(),b=Symbol(),S=Symbol(),T=Symbol(),v=Symbol();function O(e){s.A.call(this,null,null,e),this.addType(p.A.X3DScene),this.addChildObjects(p.A.outputOnly,"profile_changed",new n.A.SFTime,p.A.outputOnly,"metadata_changed",new n.A.SFTime,p.A.outputOnly,"loadCount",new n.A.SFInt32),this.getRootNodes().setAccessType(p.A.inputOutput),this.setLive(!1),this[A]=f.A,this[_]="SCRIPTED",this[y]=null,this[w]=new a.A([]),this[x]=location.toString(),this[b]=new h.A,this[b].add("angle",new l.A("angle","radian",1)),this[b].add("force",new l.A("force","newton",1)),this[b].add("length",new l.A("length","metre",1)),this[b].add("mass",new l.A("mass","kilogram",1)),this[S]=[],this[T]=new u.A,this[v]=new Set,this[w].addParent(this),this[b].addParent(this),this[T].addParent(this)}Object.assign(Object.setPrototypeOf(O.prototype,s.A.prototype),{getLocalScene(){return this},setSpecificationVersion(e){this[A]=String(e)},getSpecificationVersion(){return this[A]},setEncoding(e){this[_]=String(e)},getEncoding(){return this[_]},setWorldURL(e){this[x]=String(e)},getWorldURL(){return this[x]},getBaseURL(){return this[x].match(/^(?:data|blob):/)?this.getExecutionContext()?.getBaseURL()??this.getBrowser().getBaseURL():this[x]},setProfile(e){this[y]=e,this._profile_changed=Date.now()/1e3},getProfile(){return this[y]},hasComponent(e,t=0){if(e instanceof o.A)var{name:e,level:t}=e;const i=this.getBrowser();return[(this[y]??i.getProfile("Full")).components.get(e),this[w].get(e)].some(e=>e&&t<=e.level)},addComponent(e){this[w].add(e.name,e),this._components_changed=Date.now()/1e3},updateComponent(e){this[w].update(e.name,e.name,e),this._components_changed=Date.now()/1e3},removeComponent(e){this[w].remove(e),this._components_changed=Date.now()/1e3},getComponents(){return this[w]},updateUnit(e,t,i){this[b].has(e)&&(this[b].update(e,e,new l.A(e,String(t),Number(i))),this._units_changed=Date.now()/1e3)},getUnit(e){return this[b].get(e)},getUnits(){return this[b]},fromUnit(e,t){switch(e){case"angle":case"force":case"length":case"mass":return t*this.getUnits().get(e).conversionFactor;case"acceleration:":case"speed":return t*this.getUnits().get("length").conversionFactor;case"angularRate":return t*this.getUnits().get("angle").conversionFactor;case"area":return t*this.getUnits().get("length").conversionFactor**2;case"volume":return t*this.getUnits().get("length").conversionFactor**3}return t},toUnit(e,t){switch(e){case"angle":case"force":case"length":case"mass":return t/this.getUnits().get(e).conversionFactor;case"acceleration:":case"speed":return t/this.getUnits().get("length").conversionFactor;case"angularRate":return t/this.getUnits().get("angle").conversionFactor;case"area":return t/this.getUnits().get("length").conversionFactor**2;case"volume":return t/this.getUnits().get("length").conversionFactor**3}return t},setMetaData(e,t){if(e=String(e),t=Array.isArray(t)?t.map(String):[String(t)],!e.length)throw new Error("Couldn't add metadata: name is empty.");let i=this[S].findIndex(t=>t[0]===e);this.removeMetaData(e),-1===i&&(i=this[S].length);for(const[n,s]of t.entries())this[S].splice(i+n,0,[e,s]);this._metadata_changed=Date.now()/1e3},addMetaData(e,t){if(e=String(e),t=Array.isArray(t)?t.map(String):[String(t)],!e.length)throw new Error("Couldn't add metadata: name is empty.");for(const i of t)this[S].push([e,i]);this._metadata_changed=Date.now()/1e3},removeMetaData(e){e=String(e),this[S]=this[S].filter(t=>t[0]!==e),this._metadata_changed=Date.now()/1e3},getMetaData(e){e=String(e);const t=this[S].filter(t=>t[0]===e).map(e=>e[1]);if(t.length)return t},getMetaDatas(){return this[S].map(e=>e.slice())},addExportedNode(e,t){if(e=String(e),this[T].has(e))throw new Error(`Couldn't add exported node: exported name '${e}' already in use.`);this.updateExportedNode(e,t),this._sceneGraph_changed=Date.now()/1e3},updateExportedNode(e,t){if(e=String(e),t=(0,d.A)(p.A.X3DNode,t,!1),0===e.length)throw new Error("Couldn't update exported node: node exported name is empty.");if(!t)throw new Error("Couldn't update exported node: node must be of type X3DNode.");const i=new c.A(this,e,t);this[T].update(e,e,i),this._sceneGraph_changed=Date.now()/1e3},removeExportedNode(e){e=String(e),this[T].remove(e),this._sceneGraph_changed=Date.now()/1e3},getExportedNode(e){e=String(e);const t=this[T].get(e);if(t)return t.localNode;throw new Error(`Exported node '${e}' not found.`)},getExportedNodes(){return this[T]},getUniqueExportName(e){return(0,r.l)(this[T],e)},addRootNode(e){e=g.A.get((0,d.A)(p.A.X3DNode,e,!1));const t=this.getRootNodes();t.includes(e)||t.push(e)},removeRootNode(e){e=g.A.get((0,d.A)(p.A.X3DNode,e,!1));const t=this.getRootNodes();t.assign(t.filter(t=>t!==e))},setRootNodes(e){this.getRootNodes().assign(e)},toVRMLStream(e){e.Indent(),e.string+="#X3D V",e.string+=f.A,e.Space(),e.string+="utf8",e.Space(),e.string+=this.getBrowser().name,e.Space(),e.string+="V",e.string+=this.getBrowser().version,e.string+="\n",e.string+="\n";const t=this.getProfile();t&&(t.toVRMLStream(e),e.Break(),e.TidyBreak());const i=this.getComponents();i.length&&(i.toVRMLStream(e),e.TidyBreak());const r=this.getUnits().filter(e=>1!==e.conversionFactor);if(r.length){for(const t of r)t.toVRMLStream(e),e.Break();e.TidyBreak()}const o=this.getMetaDatas();if(o.length){for(const[t,i]of o)e.Indent(),e.string+="META",e.Space(),e.string+=new n.A.SFString(t).toString(),e.Space(),e.string+=new n.A.SFString(i).toString(),e.Break();e.TidyBreak()}const a=this.getExportedNodes();e.PushExecutionContext(this),e.ExportedNodes(a),s.A.prototype.toVRMLStream.call(this,e),a.length&&(e.TidyBreak(),a.toVRMLStream(e)),e.PopExecutionContext()},toXMLStream(e){e.html||(e.Indent(),e.string+='<?xml version="1.0" encoding="UTF-8"?>',e.TidyBreak(),e.Indent(),e.string+='<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D ',e.string+=f.A,e.string+='//EN" "https://www.web3d.org/specifications/x3d-',e.string+=f.A,e.string+='.dtd">',e.TidyBreak()),e.openTag("X3D"),e.attribute("profile",this.getProfile()?.name??"Full"),e.attribute("version",f.A),e.attribute("xmlns:xsd","http://www.w3.org/2001/XMLSchema-instance"),e.attribute("xsd:noNamespaceSchemaLocation",`https://www.web3d.org/specifications/x3d-${f.A}.xsd`),e.endTag(),e.IncIndent();const t=this.getMetaDatas();if(this.getComponents().length||this.getUnits().some(e=>1!==e.conversionFactor)||t.length){e.openingTag("head"),e.TidyBreak(),e.IncIndent(),this.getComponents().toXMLStream(e);for(const t of this.getUnits())1!==t.conversionFactor&&(t.toXMLStream(e),e.TidyBreak());for(const[i,n]of t)e.openTag("meta"),e.attribute("name",i),e.attribute("content",n),e.closeTag("meta"),e.TidyBreak();e.DecIndent(),e.closingTag("head"),e.TidyBreak()}if(this.getExternProtoDeclarations().length||this.getProtoDeclarations().length||this.getRootNodes().length){e.openingTag("Scene"),e.TidyBreak(),e.IncIndent();const t=this.getExportedNodes();e.PushExecutionContext(this),e.ExportedNodes(t),s.A.prototype.toXMLStream.call(this,e),t.toXMLStream(e),e.PopExecutionContext(),e.DecIndent(),e.closingTag("Scene")}else e.openTag("Scene"),e.closeTag("Scene");e.TidyBreak(),e.DecIndent(),e.closingTag("X3D"),e.TidyBreak()},toJSONStream(e){e.beginObject("X3D",!1,!0),e.stringProperty("encoding","UTF-8",!1),e.stringProperty("@profile",this.getProfile()?.name??"Full"),e.stringProperty("@version",f.A),e.stringProperty("@xsd:noNamespaceSchemaLocation",`https://www.web3d.org/specifications/x3d-${f.A}.xsd`),e.stringProperty("JSON schema",`https://www.web3d.org/specifications/x3d-${f.A}-JSONSchema.json`);const t=this.getUnits().some(e=>1!==e.conversionFactor),i=this.getMetaDatas();if(this.getComponents().length||t||i.length){let n=!1;if(e.beginObject("head"),i.length){e.beginArray("meta",n);for(const[t,[n,s]]of i.entries())e.beginObject("",0!==t),e.stringProperty("@name",n,!1),e.stringProperty("@content",s),e.endObject();e.endArray(),n=!0}this.getComponents().length&&(e.beginArray("component",n),this.getComponents().toJSONStream(e),e.endArray(),n=!0),t&&(e.beginArray("unit",n),this.getUnits().toJSONStream(e),e.endArray(),n=!0),e.endObject()}e.beginObject("Scene"),e.beginArray("-children",!1);const n=this.getExportedNodes();e.PushExecutionContext(this),e.ExportedNodes(n);const r=s.A.prototype.toJSONStream.call(this,e);this.getExportedNodes().toJSONStream(e,r),e.PopExecutionContext(),e.endArray(),e.endObject(),e.endObject(),e.endObject(),e.TidyBreak()},dispose(){this.exportedNodes.clear(),s.A.prototype.dispose.call(this)}},{setExecutionContext(e){{const e=this.getScene();if(e)for(const t of this[v])e.removeLoadingObject(t)}s.A.prototype.setExecutionContext.call(this,e);{const e=this.getScene();if(e)for(const t of this[v])e.addLoadingObject(t)}},getLoadingObjects(){return this[v]},addLoadingObject(e){this[v].add(e),this._loadCount=this[v].size;(this.getScene()??this.getBrowser()).addLoadingObject(e)},removeLoadingObject(e){this[v].delete(e),this._loadCount=this[v].size;(this.getScene()??this.getBrowser()).removeLoadingObject(e)}});for(const e of Object.keys(O.prototype))Object.defineProperty(O.prototype,e,{enumerable:!1});Object.defineProperties(O.prototype,{isScene:{value:!0,enumerable:!0},specificationVersion:{get:O.prototype.getSpecificationVersion,enumerable:!0},encoding:{get:O.prototype.getEncoding,enumerable:!0},profile:{get:O.prototype.getProfile,enumerable:!0},profile_changed:{get(){return this._profile_changed},enumerable:!1},components:{get:O.prototype.getComponents,enumerable:!0},worldURL:{get:O.prototype.getWorldURL,enumerable:!0},baseURL:{get:O.prototype.getBaseURL,enumerable:!0},units:{get:O.prototype.getUnits,enumerable:!0},metadata_changed:{get(){return this._metadata_changed},enumerable:!1},rootNodes:{get:O.prototype.getRootNodes,set:O.prototype.setRootNodes,enumerable:!0},exportedNodes:{get:O.prototype.getExportedNodes,enumerable:!0},sceneGraph_changed:{get(){return this._sceneGraph_changed},enumerable:!1}}),Object.defineProperties(O,{typeName:{value:"X3DScene",enumerable:!0}}),p.A.addConstant(O.typeName);const E=O,N=m.A.add("X3DScene",E)},8664(e,t,i){i.d(t,{A:()=>g});var n=i(8381),s=i(8001),r=i(2244),o=i(5053),a=i(2696);const l=Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions"),h=Symbol(),c=Symbol(),u=Symbol();function d(e,t){this[h]=t,this[l]=t.getFieldDefinitions(),this[u]=null,s.A.call(this,e),this.addType(o.A.X3DPrototypeInstance),this.setProtoNode(t,!0)}Object.assign(Object.setPrototypeOf(d.prototype,s.A.prototype),{create(e){return new d(e,this[h])},getTypeName(){return this[h].getName()},getAppInfo(){return this[h].getAppInfo()},getDocumentation(){return this[h].getDocumentation()},initialize(){s.A.prototype.initialize.call(this),this.realize()},realize(){const e=this[h],t=e.getProtoDeclaration();e.isExternProto&&e.checkLoadState()!==o.A.COMPLETE_STATE||(this[u]=new r.A(t.getExecutionContext(),this),this.importExternProtos(t.getBody().externprotos),this.importProtos(t.getBody().protos),this.copyRootNodes(t.getBody().rootNodes),this.importImportedNodes(t.getBody().importedNodes),this.copyRoutes(t.getBody().routes),this[u].setup(),n.A.prototype.addEvent.call(this))},construct(){const e=this[h],t=e.getProtoDeclaration();if(this[u]?.dispose(),e.isExternProto){if(e.checkLoadState()!==o.A.COMPLETE_STATE)return this[u]=null,this.isInitialized()&&n.A.prototype.addEvent.call(this),e._updateInstances.addInterest("construct",this),void e.requestImmediateLoad().catch(Function.prototype);for(const e of t.getUserDefinedFields())try{const t=this.getField(e.getName());if(t.getAccessType()!==e.getAccessType())continue;if(t.getType()!==e.getType())continue;if(!t.isInitializable())continue;if(t.getModificationTime()>=0)continue;if(t.getReferences().size)continue;if(t.equals(e))continue;t.assign(e)}catch{this.addPredefinedField(t.getFieldDefinitions().get(e.getName()))}}this.isInitialized()&&this.realize(),e._updateInstances.removeInterest("construct",this),e._updateInstances.addInterest("update",this)},update(){const e=this[c],t=Array.from(this.getPredefinedFields());for(const e of t)this.removePredefinedField(e.getName());this[c]=Array.from(this[h].getUserDefinedFields());for(const e of this[h].getFieldDefinitions())this.addPredefinedField(e);for(const i of this[c]){const n=e.find(e=>e===i)?.getName()??i.getName();if(!n)continue;const s=this.getPredefinedFields().get(i.getName()),r=t.find(e=>e.getName()===n);if(!r)continue;if(r.getType()!==s.getType())continue;r.isInitializable()&&r.getModificationTime()<0&&(r.assign(s),r.setModificationTime(-1)),r.addParent(this),r.setAccessType(s.getAccessType()),r.setName(s.getName()),this.getPredefinedFields().update(s.getName(),s.getName(),r);const o=Array.from(r.getReferences());for(const e of r.getFieldInterests())r.removeFieldInterest(e);for(const e of o)r.removeReference(e),r.addReference(e);for(const e of Array.from(r.getInputRoutes()))try{const{sourceNode:t,sourceField:i}=e;e.getExecutionContext().deleteRoute(e),e.getExecutionContext().addRoute(t,i,this,r.getName())}catch{}for(const e of Array.from(r.getOutputRoutes()))try{const{destinationNode:t,destinationField:i}=e;e.getExecutionContext().deleteRoute(e),e.getExecutionContext().addRoute(this,r.getName(),t,i)}catch{}t.splice(t.indexOf(r),1),s.dispose()}for(const e of t)e.dispose();this.construct()},getExtendedEventHandling:()=>!1,getProtoNode(){return this[h]},setProtoNode(e,t=!1){const i=this[h];i._name_changed.removeFieldInterest(this._typeName_changed),i._updateInstances.removeInterest("construct",this),i._updateInstances.removeInterest("update",this),this[h]=e,this[l]=e.getFieldDefinitions(),this[c]=Array.from(e.getUserDefinedFields()),e._name_changed.addFieldInterest(this._typeName_changed),t?this.construct():this.update()},getBody(){return this[u]},getInnerNode(){if(this[u]){const e=this[u].getRootNodes();if(e.length){const t=e[0];if(t)return t.getValue().getInnerNode()}}throw new Error("Root node not available.")},isDefaultValue(e){const t=this[h];return t.isExternProto&&t.checkLoadState()!==o.A.COMPLETE_STATE?e.getModificationTime()<0:s.A.prototype.isDefaultValue.call(this,e)},importExternProtos(e){const t=this[u].externprotos;for(const i of e)t.add(i.getName(),i)},importProtos(e){const t=this[u].protos;for(const i of e)t.add(i.getName(),i)},copyRootNodes(e){const t=this[u].getRootNodes();for(const i of e.getValue())t.push(i.copy(this))},importImportedNodes(e){for(const t of e)try{const e=this[u].getNamedNode(t.getInlineNode().getName());this[u].addImportedNode(e,t.getExportedName(),t.getImportedName())}catch(e){console.error(e)}},copyRoutes(e){for(const t of e)try{const e=t.getSourceNode()instanceof s.A?this[u].getLocalNode(t.getSourceNode().getName()):this[u].getLocalNode(t.getSourceNode().getImportedName()),i=t.getDestinationNode()instanceof s.A?this[u].getLocalNode(t.getDestinationNode().getName()):this[u].getLocalNode(t.getDestinationNode().getImportedName());this[u].addRoute(e,t.sourceField,i,t.destinationField)}catch(e){console.error(e)}},toXMLStream(e){const t=e.IsSharedNode(this),i=e.Name(this);if(i.length&&e.ExistsNode(this))return e.openTag("ProtoInstance"),e.attribute("name",this.getTypeName()),e.attribute("USE",i),e.containerField(this.getContainerField()),void e.closeTag("ProtoInstance");e.openTag("ProtoInstance"),e.attribute("name",this.getTypeName()),i.length&&(e.AddNode(this),e.attribute("DEF",i)),e.containerField(this.getContainerField());const n=this.getChangedFields();if(0===n.length)e.closeTag("ProtoInstance");else{e.endTag(),e.IncIndent();const i=[];for(const s of n){let n=!1;if(e.ExecutionContext()&&s.getAccessType()===o.A.inputOutput&&0!==s.getReferences().size&&([...s.getReferences()].some(e=>e.isInitializable())||(n=!this.isDefaultValue(s))),0===s.getReferences().size||!e.ExecutionContext()||t||n)switch(n&&i.push(s),s.getType()){case o.A.MFNode:e.openTag("fieldValue"),e.attribute("name",s.getName()),0===s.length?(e.closeTag("fieldValue"),e.TidyBreak()):(e.endTag(),e.IncIndent(),e.PushContainerField(null),s.toXMLStream(e),e.TidyBreak(),e.DecIndent(),e.closingTag("fieldValue"),e.TidyBreak(),e.PopContainerField());break;case o.A.SFNode:e.openTag("fieldValue"),e.attribute("name",s.getName()),null===s.getValue()?(e.attribute("value","null"),e.closeTag("fieldValue"),e.TidyBreak()):(e.endTag(),e.IncIndent(),e.PushContainerField(null),s.toXMLStream(e),e.TidyBreak(),e.DecIndent(),e.closingTag("fieldValue"),e.TidyBreak()),e.PopContainerField();break;default:e.openTag("fieldValue"),e.attribute("name",s.getName()),e.Space(),e.string+="value='",s.toXMLStream(e),e.string+="'",e.closeTag("fieldValue"),e.TidyBreak()}else i.push(s)}if(i.length&&!t){e.openingTag("IS"),e.TidyBreak(),e.IncIndent();for(const t of i){const i=t.getReferences();for(const n of i)e.openTag("connect"),e.attribute("nodeField",t.getName()),e.attribute("protoField",n.getName()),e.closeTag("connect"),e.TidyBreak()}e.DecIndent(),e.closingTag("IS"),e.TidyBreak()}e.DecIndent(),e.closingTag("ProtoInstance")}},toJSONStream(e){const t=e.IsSharedNode(this);e.beginObject("ProtoInstance",!1,!0);const i=e.Name(this);if(i.length&&e.ExistsNode(this))return e.stringProperty("@name",this.getTypeName(),!1),e.stringProperty("@USE",i),e.endObject(),void e.endObject();i.length&&(e.AddNode(this),e.stringProperty("@DEF",i,!1)),e.stringProperty("@name",this.getTypeName(),i.length);const n=this.getChangedFields(),s=[];if(n.length){e.beginArray("fieldValue");const i=[];for(const r of n){let n=!1;e.ExecutionContext()&&r.getAccessType()===o.A.inputOutput&&0!==r.getReferences().size&&([...r.getReferences()].some(e=>e.isInitializable())||(n=!this.isDefaultValue(r))),0===r.getReferences().size||!e.ExecutionContext()||t||n?(n&&s.push(r),i.push(r)):s.push(r)}for(const t of i)switch(t.getType()){case o.A.SFNode:e.beginObject("",t!==i[0]),e.stringProperty("@name",t.getName(),!1),e.beginArray("-children"),e.TidyBreak(),e.Indent(),t.toJSONStream(e),e.endArray(),e.endObject();break;case o.A.MFNode:e.beginObject("",t!==i[0]),e.stringProperty("@name",t.getName(),!1),e.beginValue("-children"),t.toJSONStream(e),e.endObject();break;default:e.beginObject("",t!==i[0]),e.stringProperty("@name",t.getName(),!1),e.beginValue("@value"),t.toJSONStream(e),e.endObject()}if(e.endArray(),s.length&&!t){e.beginObject("IS"),e.beginArray("connect",!1);for(const t of s){const i=Array.from(t.getReferences());for(const n of i)e.beginObject("",t!==s[0]||n!==i[0]),e.stringProperty("@nodeField",t.getName(),!1),e.stringProperty("@protoField",n.getName()),e.endObject()}e.endArray(),e.endObject()}}e.endObject(),e.endObject()},dispose(){const e=this[h];e._name_changed.removeFieldInterest(this._typeName_changed),e._updateInstances.removeInterest("construct",this),e._updateInstances.removeInterest("update",this),this[u]?.dispose(),s.A.prototype.dispose.call(this)}}),Object.defineProperties(d,s.A.getStaticProperties("X3DPrototypeInstance","Core",2,"children","2.0"));const p=d,g=a.A.add("X3DPrototypeInstance",p)},8764(e,t,i){i.d(t,{A:()=>p});var n=i(8015),s=i(8001),r=i(5053),o=i(2696);const a=Symbol(),l=Symbol(),h=Symbol(),c=Symbol();function u(e){this.addType(r.A.X3DUrlObject),this.addChildObjects(r.A.outputOnly,"loadState",new n.A.SFInt32(r.A.NOT_STARTED_STATE),r.A.outputOnly,"loadData",new n.A.SFTime),this[a]=!0,this[l]=Date.now()}Object.assign(u.prototype,{initialize(){this.getLive().addInterest("set_live__",this),this._load.addInterest("set_load__",this),this._url.addInterest("set_url__",this),this._loadData.addInterest("loadData",this),this._autoRefresh.addInterest("set_autoRefresh__",this),this._autoRefreshTimeLimit.addInterest("set_autoRefresh__",this)},getAllowEmptyUrl:()=>!1,setLoadState(e,t=!0){switch(this._loadState=e,e){case r.A.COMPLETE_STATE:case r.A.FAILED_STATE:this[h]=Date.now(),this.setAutoRefreshTimer(Math.max(this._autoRefresh.getValue(),0))}if(t)switch(e){case r.A.NOT_STARTED_STATE:break;case r.A.IN_PROGRESS_STATE:this.getScene().addLoadingObject(this);break;case r.A.COMPLETE_STATE:case r.A.FAILED_STATE:this.getScene().removeLoadingObject(this)}},checkLoadState(){return this._loadState.getValue()},getLoadState(){return this._loadState},setCache(e){this[a]=e},getCache(){return this[a]&&this.getBrowser().getBrowserOption("Cache")},async requestImmediateLoad(e=!0){switch(this.checkLoadState()){case r.A.IN_PROGRESS_STATE:return void await this.loading();case r.A.COMPLETE_STATE:return;case r.A.FAILED_STATE:throw new Error(`Failed loading ${this.getTypeName()}.`)}const t=this.getBrowser();if(t.getBrowserOption("LoadUrlObjects")||this.getExecutionContext()===t.getPrivateScene()){if(!this._load.getValue())throw new Error(`${this.getTypeName()}.load is false.`);0!==this._url.length||this.getAllowEmptyUrl()?(this.setCache(e),this.setLoadState(r.A.IN_PROGRESS_STATE),this.isInitialized()?this._loadData=this.getBrowser().getCurrentTime():this.loadData(),await this.loading()):this.unloadData()}},loading(){return new Promise((e,t)=>{const i=Symbol();this._loadState.addFieldCallback(i,()=>{switch(this.checkLoadState()){case r.A.COMPLETE_STATE:this._loadState.removeFieldCallback(i),e();break;case r.A.FAILED_STATE:this._loadState.removeFieldCallback(i),t(new Error(`Failed loading ${this.getTypeName()}.`))}})})},loadNow(){return this.setLoadState(r.A.NOT_STARTED_STATE),this.requestImmediateLoad()},loadData(){},requestUnload(){const e=this.checkLoadState();e!==r.A.NOT_STARTED_STATE&&e!==r.A.FAILED_STATE&&(this.setLoadState(r.A.NOT_STARTED_STATE),this.unloadData())},unloadNow(){this.requestUnload()},unloadData(){},setAutoRefreshTimer(e){if(clearTimeout(this[c]),this._autoRefresh.getValue()<=0)return;const t=this._autoRefreshTimeLimit.getValue();t>0&&(Date.now()-this[l])/1e3>t-e||(this[c]=setTimeout(this.performAutoRefresh.bind(this),1e3*e))},performAutoRefresh(){this.setLoadState(r.A.NOT_STARTED_STATE),this.requestImmediateLoad(!1).catch(Function.prototype)},set_live__(){this.getLive().getValue()?this.set_autoRefresh__():clearTimeout(this[c])},set_load__(){this._load.getValue()?this.requestImmediateLoad().catch(Function.prototype):this.requestUnload()},set_url__(){this._load.getValue()&&(this.setLoadState(r.A.NOT_STARTED_STATE),this.requestImmediateLoad().catch(Function.prototype))},set_autoRefresh__(){if(this.checkLoadState()!==r.A.COMPLETE_STATE)return;const e=(Date.now()-this[h])/1e3,t=Math.max(this._autoRefresh.getValue(),0);let i=t-e;i<0&&(i=Math.ceil(e/t)*t-e),this.setAutoRefreshTimer(i)},dispose(){}}),Object.defineProperties(u,s.A.getStaticProperties("X3DUrlObject","Networking",1));const d=u,p=o.A.add("X3DUrlObject",d)},8894(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(6761),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.getImportedName(),e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"ImportedNodesArray",enumerable:!0}});const a=o,l=r.A.add("ImportedNodesArray",a)},8939(e,t,i){i.d(t,{default:()=>Fe});var n=i(9721),s=i(8015),r=i(4839),o=i(6702),a=i(2681),l=i(7153),h=i(477),c=i(5319),u=i(9582),d=i(5687),p=i(5053),g=i(2696);function f(){}Object.assign(f.prototype,{removeEmptyGroups:!1,combineGroupingNodes:!1,optimizeInterpolators:!1,optimizeSceneGraph(e){const t=[];e.setValue(this.optimizeNodes(null,e,!0,t)),t.filter(e=>0===e.getValue().getCloneCount()).forEach(e=>e.dispose())},optimizeNodes(e,t,i,n){return Array.from(t).flatMap(t=>this.optimizeNode(e,t,i,n))},optimizeNode(e,t,i,n){if(!t)return[];switch(this.optimizeInterpolators&&this.removeInterpolatorsWithOnlyOneValue(t,n),t.getNodeTypeName()){case"Transform":if(t.children=this.optimizeNodes(t,t.children,!0,n),this.removeEmptyGroups&&0===t.children.length)return[];break;case"Anchor":case"Group":return t.children=this.optimizeNodes(t,t.children,!0,n),this.removeIfNoChildren(t,n);case"Collision":case"LOD":case"Switch":return this.optimizeNodes(t,t.children,!1,n),this.removeIfNoChildren(t,n);case"HAnimJoint":case"HAnimSegment":case"HAnimSite":switch(t.children=this.optimizeNodes(t,t.children,!0,n),e?.getNodeTypeName()){case"HAnimHumanoid":case"HAnimJoint":case"HAnimSegment":case"HAnimSite":return t;default:return n.push(t),[]}case"HAnimHumanoid":return t.skeleton=this.optimizeNodes(t,t.skeleton,!0,n),t.skin=this.optimizeNodes(t,t.skin,!0,n),this.removeIfNoChildren(t,n);default:return t}if(!i)return t;if(!this.combineGroupingNodes)return t;if(t.getValue().hasRoutes())return t;if("Transform"===t.getNodeTypeName()){if(t=this.combineSingleChild(t,n),!t.translation?.getValue().equals(h.A.ZERO))return t;if(!t.rotation?.getValue().equals(c.A.IDENTITY))return t;if(!t.scale?.getValue().equals(h.A.ONE))return t}if(!t.children)return t;const s=Array.from(t.children);return n.push(this.removeChildren(t)),s},removeChildren(e){for(const t of e.getValue().getFields())switch(t.getType()){case p.A.SFNode:t.setValue(null);break;case p.A.MFNode:t.length=0}return e},removeIfNoChildren(e,t){if(!this.removeEmptyGroups)return e;if("HAnimHumanoid"===e.getNodeTypeName()){if(e.skeleton.length||e.skin.length)return e}else if(0!==e.children.length)return e;return t.push(e),[]},removeInterpolatorsWithOnlyOneValue(e,t){for(const i of e.getValue().getFields()){if(1!==i.getInputRoutes().size)continue;const n=Array.from(i.getInputRoutes())[0],s=n.sourceNode;s.getNodeType().includes(p.A.X3DInterpolatorNode)&&(1===s.key.length&&(e[n.destinationField]=s.keyValue[0],t.push(this.removeChildren(s)),n.dispose()))}},combineSingleChild(e,t){if(1!==e.children.length)return e;if(!e.visible)return e;const i=e.children[0];if(i.getValue().getCloneCount()>1)return e;if(i.getValue().hasRoutes())return e;switch(i.getNodeTypeName()){case"Transform":case"HAnimHumanoid":return this.combineTransform(e,i,t);case"DirectionalLight":case"PointLight":case"SpotLight":return this.combineLight(e,i,t);case"Viewpoint":case"OrthoViewpoint":return this.combineViewpoint(e,i,t);default:return e}},combineTransform(e,t,i){const n=new h.A,s=new c.A,r=new h.A(1),o=new c.A,a=new u.A,l=new u.A;if(a.set(e.translation.getValue(),e.rotation.getValue(),e.scale.getValue(),e.scaleOrientation.getValue(),e.center.getValue()),l.set(t.translation.getValue(),t.rotation.getValue(),t.scale.getValue(),t.scaleOrientation.getValue(),t.center.getValue()),a.multLeft(l),a.get(n,s,r,o,t.center.getValue()),t.translation=n,t.rotation=s,t.scale=r,t.scaleOrientation=o,!t.getNodeTypeName()&&e.getNodeTypeName()){const i=t.getExecutionContext();i.addNamedNode(i.getUniqueName(e.getNodeTypeName()),t)}return i.push(this.removeChildren(e)),t},combineLight(e,t,i){const n=new u.A;return n.set(e.translation.getValue(),e.rotation.getValue(),e.scale.getValue(),e.scaleOrientation.getValue(),e.center.getValue()),t.location&&(t.location=n.multVecMatrix(t.location.getValue())),t.direction&&(t.direction=n.multDirMatrix(t.direction.getValue()).normalize()),i.push(this.removeChildren(e)),t},combineViewpoint(e,t,i){const n=new u.A,s=new u.A,r=new h.A,o=new c.A;return n.set(e.translation.getValue(),e.rotation.getValue(),e.scale.getValue(),e.scaleOrientation.getValue(),e.center.getValue()),s.set(t.position.getValue(),t.orientation.getValue()),s.multRight(n).get(r,o),t.position=r,t.orientation=o,t.centerOfRotation=n.multVecMatrix(t.centerOfRotation.getValue()),i.push(this.removeChildren(e)),t},viewpointsCenterOfRotation(e){const t=e.getBBox(new d.A),i=new u.A,n=new Set;this.viewpointsCenterOfRotationNodes(e.rootNodes,t,i,n)},viewpointsCenterOfRotationNodes(e,t,i,n){for(const s of e)this.viewpointsCenterOfRotationNode(s?.getValue(),t,i,n)},viewpointsCenterOfRotationNode(e,t,i,n){if(e&&!n.has(e)){switch(n.add(e),e.getMatrix&&(i=i.copy().multLeft(e.getMatrix())),e.getType().at(-1)){case p.A.Viewpoint:case p.A.OrthoViewpoint:e._centerOfRotation=i.copy().inverse().multVecMatrix(t.center)}for(const s of e.getFields())switch(s.getType()){case p.A.SFNode:this.viewpointsCenterOfRotationNode(s.getValue(),t,i,n);break;case p.A.MFNode:this.viewpointsCenterOfRotationNodes(s,t,i,n)}}}});const m=f,A=g.A.add("X3DOptimizer",m);var _=i(3454),y=i(5185),w=i(1166),x=i(3937),b=i(9401),S=i(2204),T=i(9340);function v(e){r.A.call(this,e),A.call(this),this.removeEmptyGroups=!0,this.combineGroupingNodes=!0,this.optimizeInterpolators=!0,this.extensions=new Set,this.envLights=[],this.lights=[],this.materialVariants=[],this.materialVariantNodes=[],this.buffers=[],this.bufferViews=[],this.accessors=[],this.samplers=[],this.textureCache=new Map,this.materials=[],this.textureTransformNodes=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.humanoidIndex=new Map,this.joints=new Set,this.pointerAliases=new Map,this.animationScripts=[],this.physicsNodes=[]}Object.assign(Object.setPrototypeOf(v.prototype,r.A.prototype),A.prototype,{getEncoding:()=>"JSON",setInput(e){try{"string"==typeof e&&(e=JSON.parse(e)),this.input=e}catch{this.input=void 0}},isValid:(()=>{const e=new Set(["asset","extra","extensions","extensionsRequired","extensionsUsed","buffers","bufferViews","accessors","samplers","images","textures","materials","meshes","cameras","skins","nodes","scenes","scene","animations"]);return function(){if(!(this.input instanceof Object))return!1;if(!Object.keys(this.input).every(t=>e.has(t)))return!1;const t=this.input.asset;return t instanceof Object&&"2.0"===t.version}})(),setBuffers(e){this.buffers=e},parseIntoScene(e,t){this.rootObject(this.input).then(e).catch(t)},async rootObject(e){if(!(e instanceof Object))return;const t=this.getBrowser(),i=this.getScene();return i.setEncoding("GLTF"),i.setProfile(t.getProfile("Interchange")),e.skins&&i.addComponent(t.getComponent("HAnim")),this.assetObject(e.asset,e.extensions),this.extensionsArray(e.extensionsRequired,this.extensions),this.extensionsArray(e.extensionsUsed,this.extensions),this.extensionsObject(e.extensions),await t.loadComponents(i),await this.buffersArray(e.buffers),this.extensions.has("KHR_draco_mesh_compression")&&(this.draco=await this.createDraco()),this.bufferViewsArray(e.bufferViews),this.accessorsArray(e.accessors),this.samplersArray(e.samplers),await this.imagesArray(e.images),this.texturesArray(e.textures),this.materialsArray(e.materials),this.meshesArray(e.meshes),this.camerasArray(e.cameras),this.skinsArray(e.skins,e.nodes),this.nodesArray(e.nodes),this.scenesArray(e,e.scenes,e.scene),this.animationsArray(e.animations),this.viewpointsCenterOfRotation(i),this.optimizeSceneGraph(i.getRootNodes()),this.exportGroup("Viewpoints",this.cameras),this.exportGroup("EnvironmentLights",this.envLights),this.exportGroup("Lights",this.lights),this.exportGroup("Animations",e.animations),this.cleanupAnimationScripts(),this.materialVariantsSwitch(),i},assetObject(e,t){if(!(e instanceof Object))return;const i=this.getScene(),n=i.getWorldURL(),s=i.createNode("WorldInfo",!1);for(const[t,i]of Object.entries(e))"string"==typeof i&&s._info.push(`${t}: ${i}`);if(e.extras instanceof Object)for(const[t,i]of Object.entries(e.extras))"string"==typeof i&&("title"===t?s._title=i:s._info.push(`${t}: ${i}`));if(!s._title.getValue()){const e=new URL(n);"data:"===e.protocol?s._title="glTF Model":s._title=decodeURIComponent(e.pathname.split("/").at(-1)||n)}if(e.extensions?.KHR_xmp_json_ld instanceof Object){const i=e.extensions.KHR_xmp_json_ld.packet;this.khrXmpJsonLdObject(i,t?.KHR_xmp_json_ld,s)}s._info.sort(),s.setup(),i.getRootNodes().push(s)},extensionsArray(e,t){if(!(e instanceof Array))return;const i=this.getBrowser(),n=this.getScene(),s=[];for(const n of e)switch(t.add(n),n){case"EXT_lights_image_based":s.push(i.getComponent("CubeMapTexturing",3));break;case"EXT_mesh_gpu_instancing":case"KHR_materials_pbrSpecularGlossiness":case"KHR_materials_anisotropy":case"KHR_materials_clearcoat":case"KHR_materials_diffuse_transmission":case"KHR_materials_dispersion":case"KHR_materials_emissive_strength":case"KHR_materials_ior":case"KHR_materials_iridescence":case"KHR_materials_sheen":case"KHR_materials_specular":case"KHR_materials_transmission":case"KHR_materials_volume":case"KHR_materials_volume_scatter":s.push(i.getComponent("X_ITE",1));break;case"KHR_texture_transform":s.push(i.getComponent("Texturing3D",2));break;case"KHR_animation_pointer":s.push(i.getComponent("EventUtilities",1)),s.push(i.getComponent("Scripting",1))}for(const e of s)n.hasComponent(e)||n.updateComponent(e)},extensionsObject(e){if(e instanceof Object)for(const[t,i]of Object.entries(e))switch(t){case"EXT_lights_image_based":this.extLightsImageBasedObject(i);break;case"KHR_lights_punctual":this.khrLightsPunctualObject(i);break;case"KHR_materials_variants":this.khrMaterialsVariantsObjectVariants(i)}},extLightsImageBasedObject(e){e instanceof Object&&this.envLightsArray(e.lights)},envLightsArray(e){e instanceof Array&&(this.envLights=e)},envLightObject(e,t=this.envLights[e]){if(!(t instanceof Object))return null;if(t.node)return t.node;const i=this.getScene(),n=i.createNode("EnvironmentLight",!1),s=`EnvironmentLight${e+1}`,r=new x.A;if(i.addNamedNode(i.getUniqueName(s),n),i.addExportedNode(i.getUniqueExportName(s),n),n._global=!1,n._intensity=this.numberValue(t.intensity,1),this.vectorValue(n.rotation,r)?n._rotation=new c.A(0,0,1,Math.PI).multRight(new c.A(r)):n._rotation=new c.A(0,0,1,Math.PI),t.irradianceCoefficients instanceof Array)for(const e of t.irradianceCoefficients)e instanceof Array&&n._diffuseCoefficients.push(...e);if(t.specularImages instanceof Array){const e=i.createNode("ComposedCubeMapTexture",!1),s=t.specularImages[0];if(s instanceof Array){const t=["right","left","bottom","top","front","back"];for(const[n,r]of s.map(e=>this.images[e]).entries()){const s=i.createNode("ImageTexture",!1),o=this.sanitizeName(r?.name);o&&i.addNamedNode(i.getUniqueName(o),s),s._description=r?.name??"",s._url=r?[r.uri]:[],s.setup(),e[`_${t[n]}Texture`]=s}e.setup(),n._specularTexture=e}}return n.setup(),t.pointers=[n],t.node=n},khrLightsPunctualObject(e){e instanceof Object&&this.lightsArray(e.lights)},lightsArray(e){e instanceof Array&&(this.lights=e)},lightObject(e,t=this.lights[e]){if(!(t instanceof Object))return null;if(t.node)return t.node;const i=this.lightType(t);if(!i)return null;const n=this.getScene(),s=this.sanitizeName(t.name)||`Light${e+1}`,r=new b.A(1);return this.vectorValue(t.color,r)&&(i._color=r),i._global=!0,i._intensity=this.numberValue(t.intensity,1),i.setup(),n.addNamedNode(n.getUniqueName(s),i),n.addExportedNode(n.getUniqueExportName(s),i),t.pointers=[i],t.node=i},lightType(e){switch(e.type){case"directional":return this.directionalLight(e);case"spot":return this.spotLight(e);case"point":return this.pointLight(e)}},directionalLight(e){return this.getScene().createNode("DirectionalLight",!1)},spotLight(e){const t=this.getScene().createNode("SpotLight",!1);return t._radius=this.numberValue(e.range,0)||-1,t._cutOffAngle=this.numberValue(e.outerConeAngle,Math.PI/4),t._beamWidth=this.numberValue(e.innerConeAngle,0),this.addAnimationPointerAlias(t,"range","radius"),this.addAnimationPointerAlias(t,"outerConeAngle","cutOffAngle"),this.addAnimationPointerAlias(t,"innerConeAngle","beamWidth"),t},pointLight(e){const t=this.getScene().createNode("PointLight",!1);return t._radius=this.numberValue(e.range,0)||-1,this.addAnimationPointerAlias(t,"range","radius"),t},khrMaterialsVariantsObjectVariants(e){if(!(e instanceof Object))return;const t=e.variants;t instanceof Array&&(this.materialVariants=t)},khrXmpJsonLdObject(e,t,i){if(!(t instanceof Object))return;const n=t.packets[e];for(const[e,t]of Object.entries(n)){const n=e.match(/\w+:(.*)/);if(n){if(t instanceof Object){const e=t["@set"]??t["@list"];if(e instanceof Array){i._info.push(`${n[1]}: ${e.map(e=>e.toString()).join(", ")}`);continue}if(t["rdf:_1"]?.["@value"]){i._info.push(`${n[1]}: ${JSON.stringify(t["rdf:_1"]["@value"])}`);continue}}"string"==typeof t&&i._info.push(`${n[1]}: ${t}`)}}},async buffersArray(e){e instanceof Array&&(this.buffers=await Promise.all(e.map((e,t)=>this.bufferObject(e,t))))},async bufferObject(e,t){if(!(e instanceof Object))return;if(!e.uri)return this.buffers[t];const i=new URL(e.uri,this.getScene().getBaseURL()),n=await fetch(i),s=await n.blob(),r=await s.arrayBuffer();return T.ungzip(r)},bufferViewsArray(e){if(e instanceof Array){this.bufferViews=e;for(const t of e)t.buffer=this.bufferViewObject(t)}},bufferViewObject(e){if(!(e instanceof Object))return;const t=this.buffers[e.buffer];if(!t)return;const i=e.byteOffset||0,n=e.byteLength;return t.slice(i,i+n)},accessorsArray(e){if(e instanceof Array){this.accessors=e;for(const t of e)this.accessorObject(t)}},accessorObject:(()=>{const e=new Map([[5120,Int8Array],[5121,Uint8Array],[5122,Int16Array],[5123,Uint16Array],[5124,Int32Array],[5125,Uint32Array],[5126,Float32Array],[5130,Float64Array]]),t=new Map([["SCALAR",1],["VEC2",2],["VEC3",3],["VEC4",4],["MAT2",4],["MAT3",9],["MAT4",16]]);return function(i){i instanceof Object&&Object.defineProperty(i,"array",{get:()=>{const n=e.get(i.componentType),s=this.bufferViews[i.bufferView||0],r=i.byteOffset||0,o=s.byteStride||0,a=t.get(i.type),l=i.count||0,h=o?o/n.BYTES_PER_ELEMENT:a,c=Math.min(h*l,(s.byteLength-r)/n.BYTES_PER_ELEMENT),u=new n(s.buffer,r,c);let d;return d=this.denseArray(n,a,l,h,u),d=this.sparseObject(i,a,d),d=this.normalizedArray(i,d),Object.defineProperty(i,"array",{value:d}),d},configurable:!0})}})(),denseArray(e,t,i,n,s){if(n===t)return s;const r=i*t,o=new e(r);for(let e=0,i=0;e<r;i+=n)for(let n=0;n<t;++n,++e)o[e]=s[i+n];return o},sparseObject:(()=>{const e=new Map([[5121,Uint8Array],[5123,Uint16Array],[5125,Uint32Array]]);return function({sparse:t},i,n){if(!(t instanceof Object))return n;if(!(t.indices instanceof Object))return n;if(!(t.values instanceof Object))return n;const s=e.get(t.indices.componentType),r=this.bufferViews[t.indices.bufferView],o=t.indices.byteOffset,a=new s(r.buffer,o,t.count),l=n.constructor,h=this.bufferViews[t.values.bufferView],c=t.values.byteOffset,u=new l(h.buffer,c,t.count*i);n=n.slice();let d=0;for(const e of a)for(let t=0;t<i;++t,++d)n[e*i+t]=u[d];return n}})(),normalizedArray({normalized:e,componentType:t},i){if(!e)return i;switch(t){case 5120:return Float32Array.from(i,e=>Math.max(e/127,-1));case 5121:return Float32Array.from(i,e=>e/255);case 5122:return Float32Array.from(i,e=>Math.max(e/32767,-1));case 5123:return Float32Array.from(i,e=>e/65535);case 5124:return Float32Array.from(i,e=>Math.max(e/2147483647,-1));case 5125:return Float32Array.from(i,e=>e/4294967295);case 5126:case 5130:return i}},samplersArray(e){if(e instanceof Array){this.samplers=e;for(const t of e)this.samplerObject(t)}},samplerObject:(()=>{const e=new Map([[9728,["NEAREST_PIXEL",!1]],[9729,["AVG_PIXEL",!1]],[9984,["NEAREST_PIXEL_NEAREST_MIPMAP",!0]],[9985,["AVG_PIXEL_NEAREST_MIPMAP",!0]],[9986,["NEAREST_PIXEL_AVG_MIPMAP",!0]],[9987,["AVG_PIXEL_AVG_MIPMAP",!0]]]),t=new Map([[9728,"NEAREST_PIXEL"],[9729,"AVG_PIXEL"]]),i=new Map([[33071,"CLAMP_TO_EDGE"],[33648,"MIRRORED_REPEAT"],[10497,"REPEAT"]]);return function(n){n instanceof Object&&Object.defineProperty(n,"texturePropertiesNode",{get:()=>{const s=this.getScene(),r=s.createNode("TextureProperties",!1),o=this.sanitizeName(n.name);o&&s.addNamedNode(s.getUniqueName(o),r);const a=e.get(n.minFilter)??["AVG_PIXEL_AVG_MIPMAP",!0];return r._minificationFilter=a[0],r._generateMipMaps=a[1],r._magnificationFilter=t.get(n.magFilter)??"AVG_PIXEL",r._boundaryModeS=i.get(n.wrapS)??"REPEAT",r._boundaryModeT=i.get(n.wrapT)??"REPEAT",r._anisotropicDegree=this.getBrowser().getRenderingProperty("MaxAnisotropicDegree"),r.setup(),Object.defineProperty(n,"texturePropertiesNode",{value:r}),r},configurable:!0})}})(),async imagesArray(e){e instanceof Array&&(this.images=await Promise.all(e.map((e,t)=>this.imageObject(e,t))))},async imageObject(e,t){if(!(e instanceof Object))return;if(e.index=t,e.uri)return e;const i=this.bufferViews[e.bufferView];if(!i)return e;const n=i.buffer,s=new Blob([new Uint8Array(n)],{type:e.mimeType}),r=await this.blobToDataUrl(s);return e.uri=r,e},blobToDataUrl:e=>new Promise((t,i)=>{const n=new FileReader;n.onload=t,n.onerror=i,n.readAsDataURL(e)}).then(e=>e.target.result),texturesArray(e){e instanceof Array&&(this.textures=e)},textureObject(e){if(!(e instanceof Object))return;if(e.textureNode)return e.textureNode;const t=this.textureImageObject(e);if(!t.length)return null;const i=`${t.map(e=>e.index).join(",")}:${e.sampler}`,n=this.textureCache.get(i);if(n)return e.textureNode=n;const s=this.getScene(),r=s.createNode("ImageTexture",!1),o=this.sanitizeName(e.name||t[0].name);o&&s.addNamedNode(s.getUniqueName(o),r),r._url=t.map(e=>e.uri),r._colorSpaceConversion=!1;const a=this.samplers[e.sampler];return a instanceof Object&&(r._textureProperties=a.texturePropertiesNode),r.setup(),this.textureCache.set(i,r),e.textureNode=r},textureImageObject(e){const t=[this.images[e.source]];return this.extensions.has("KHR_texture_basisu")&&t.unshift(this.images[e.extensions?.KHR_texture_basisu?.source]),this.extensions.has("EXT_texture_webp")&&t.unshift(this.images[e.extensions?.EXT_texture_webp?.source]),t.filter(e=>e)},materialsArray(e){e instanceof Array&&(this.materials=e)},materialObject({material:e}){if(!(e instanceof Object))return this.getDefaultAppearance();if(e.appearanceNode)return e.appearanceNode;const t=this.getTexCoordIndices("",e);this.texCoordIndex=Array.from(t).reduce((e,t)=>Math.max(e,t),-1),this.textureTransformNodes=[],this.texCoordMappings=new Map,this.texCoordOfNode=new Map,this.texCoordExtensionOfNode=new Map,e.texCoordMappings=this.texCoordMappings;const i=this.getScene(),n=i.createNode("Appearance",!1),s=this.createMaterial(e),r=this.sanitizeName(e.name),o=new b.A;this.vectorValue(e.emissiveFactor,o)&&(s._emissiveColor=o),s._emissiveTexture=this.textureInfo(e.emissiveTexture),s._emissiveTextureMapping=this.textureMapping(e.emissiveTexture),this.occlusionTextureInfo(e.occlusionTexture,s),this.normalTextureInfo(e.normalTexture,s),this.materialExtensions(e.extensions,s),s.setup();for(const e of t){const t=`TEXCOORD_${e}`;if(this.textureTransformNodes.length&&this.textureTransformNodes.every(e=>e._mapping!==t)){const e=i.createNode("TextureTransform",!1);e._mapping=t,e._translation.y=-1,e._scale.y=-1,e.setup(),this.textureTransformNodes.push(e)}this.texCoordMappings.set(t,e)}return r&&i.addNamedNode(i.getUniqueName(r),n),n._alphaMode=this.stringValue(e.alphaMode,"OPAQUE"),n._alphaCutoff=this.numberValue(e.alphaCutoff,.5),n._material=this.khrMaterialsUnlitObject(e.extensions?.KHR_materials_unlit,s),n._textureTransform=this.createMultiTextureTransform(n._material.getValue()),n.setup(),e.pointers=[n,s],e.appearanceNode=n},getTexCoordIndices(e,t,i=new Set){if(!(t instanceof Object))return i;e.endsWith("Texture")&&!t?.extensions?.KHR_texture_transform&&i.add(t.texCoord||0);for(const[e,n]of Object.entries(t))this.getTexCoordIndices(e,n,i);return i},createMaterial(e){const t=[this.pbrMetallicRoughnessObject.bind(this,e.pbrMetallicRoughness),this.pbrSpecularGlossinessObject.bind(this,e.extensions?.KHR_materials_pbrSpecularGlossiness),this.pbrMetallicRoughnessObject.bind(this,{})];for(const e of t){const t=e();if(t)return t}},pbrMetallicRoughnessObject(e){if(!(e instanceof Object))return null;const t=this.getScene().createNode("PhysicalMaterial",!1),i=new S.A,n=new b.A;return this.vectorValue(e.baseColorFactor,i)&&(t._baseColor=n.set(...i),t._transparency=1-i.a),t._metallic=this.numberValue(e.metallicFactor,1),t._roughness=this.numberValue(e.roughnessFactor,1),t._baseTexture=this.textureInfo(e.baseColorTexture),t._baseTextureMapping=this.textureMapping(e.baseColorTexture),t._metallicRoughnessTexture=this.textureInfo(e.metallicRoughnessTexture),t._metallicRoughnessTextureMapping=this.textureMapping(e.metallicRoughnessTexture),e.pointers=[t],t},pbrSpecularGlossinessObject(e){if(!(e instanceof Object))return null;const t=this.getScene().createNode("SpecularGlossinessMaterial",!1),i=new S.A,n=new b.A,s=new b.A;return this.vectorValue(e.diffuseFactor,i)&&(t._diffuseColor=n.set(...i),t._transparency=1-i.a),t._diffuseTexture=this.textureInfo(e.diffuseTexture),t._diffuseTextureMapping=this.textureMapping(e.diffuseTexture),this.vectorValue(e.specularFactor,s)?t._specularColor=s:t._specularColor=b.A.WHITE,t._glossiness=this.numberValue(e.glossinessFactor,1),t._specularGlossinessTexture=this.textureInfo(e.specularGlossinessTexture),t._specularGlossinessTextureMapping=this.textureMapping(e.specularGlossinessTexture),e.pointers=[t],t},occlusionTextureInfo(e,t){if(!(e instanceof Object))return null;t._occlusionStrength=this.numberValue(e.strength,1),t._occlusionTexture=this.textureInfo(e),t._occlusionTextureMapping=this.textureMapping(e)},normalTextureInfo(e,t){if(!(e instanceof Object))return null;t._normalScale=this.numberValue(e.scale,1),t._normalTexture=this.textureInfo(e),t._normalTextureMapping=this.textureMapping(e)},textureInfo(e){return e instanceof Object?(e.extensions instanceof Object?e.mapping=this.textureTransformObject(e.extensions.KHR_texture_transform,e.texCoord||0):e.mapping=`TEXCOORD_${e.texCoord||0}`,this.textureObject(this.textures[e.index])):null},textureMapping:e=>e instanceof Object?e.mapping:"",materialExtensions(e,t){if(e instanceof Object&&t.getType().includes(p.A.PhysicalMaterial))for(const[i,n]of Object.entries(e))switch(i){case"KHR_materials_anisotropy":this.khrMaterialsAnisotropyObject(n,t);break;case"KHR_materials_clearcoat":this.khrMaterialsClearcoatObject(n,t);break;case"KHR_materials_diffuse_transmission":this.khrMaterialsDiffuseTransmissionObject(n,t);break;case"KHR_materials_dispersion":this.khrMaterialsDispersionObject(n,t);break;case"KHR_materials_emissive_strength":this.khrMaterialsEmissiveStrengthObject(n,t);break;case"KHR_materials_ior":this.khrMaterialsIorStrengthObject(n,t);break;case"KHR_materials_iridescence":this.khrMaterialsIridescenceObject(n,t);break;case"KHR_materials_sheen":this.khrMaterialsSheenObject(n,t);break;case"KHR_materials_specular":this.khrMaterialsSpecularObject(n,t);break;case"KHR_materials_transmission":this.khrMaterialsTransmission(n,t);break;case"KHR_materials_volume":this.khrMaterialsVolumeObject(n,t);break;case"KHR_materials_volume_scatter":this.khrMaterialsVolumeScatterObject(n,t)}},khrMaterialsAnisotropyObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("AnisotropyMaterialExtension",!1);i._anisotropyStrength=this.numberValue(e.anisotropyStrength,0),i._anisotropyRotation=this.numberValue(e.anisotropyRotation,0),i._anisotropyTexture=this.textureInfo(e.anisotropyTexture),i._anisotropyTextureMapping=this.textureMapping(e.anisotropyTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsClearcoatObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("ClearcoatMaterialExtension",!1);i._clearcoat=this.numberValue(e.clearcoatFactor,0),i._clearcoatTexture=this.textureInfo(e.clearcoatTexture),i._clearcoatTextureMapping=this.textureMapping(e.clearcoatTexture),i._clearcoatRoughness=this.numberValue(e.clearcoatRoughnessFactor,0),i._clearcoatRoughnessTexture=this.textureInfo(e.clearcoatRoughnessTexture),i._clearcoatRoughnessTextureMapping=this.textureMapping(e.clearcoatRoughnessTexture),i._clearcoatNormalTexture=this.textureInfo(e.clearcoatNormalTexture),i._clearcoatNormalTextureMapping=this.textureMapping(e.clearcoatNormalTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsDiffuseTransmissionObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("DiffuseTransmissionMaterialExtension",!1);i._diffuseTransmission=this.numberValue(e.diffuseTransmissionFactor,0),i._diffuseTransmissionTexture=this.textureInfo(e.diffuseTransmissionTexture),i._diffuseTransmissionTextureMapping=this.textureMapping(e.diffuseTransmissionTexture);const n=new b.A;this.vectorValue(e.diffuseTransmissionColorFactor,n)&&(i._diffuseTransmissionColor=n),i._diffuseTransmissionColorTexture=this.textureInfo(e.diffuseTransmissionColorTexture),i._diffuseTransmissionColorTextureMapping=this.textureMapping(e.diffuseTransmissionColorTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsDispersionObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("DispersionMaterialExtension",!1);i._dispersion=this.numberValue(e.dispersion,0),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsEmissiveStrengthObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("EmissiveStrengthMaterialExtension",!1);i._emissiveStrength=this.numberValue(e.emissiveStrength,1),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsIorStrengthObject(e,t){const i=this.getScene().createNode("IORMaterialExtension",!1);i._indexOfRefraction=this.numberValue(e.ior,1.5),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsIridescenceObject(e,t){const i=this.getScene().createNode("IridescenceMaterialExtension",!1);i._iridescence=this.numberValue(e.iridescenceFactor,0),i._iridescenceTexture=this.textureInfo(e.iridescenceTexture),i._iridescenceTextureMapping=this.textureMapping(e.iridescenceTexture),i._iridescenceIndexOfRefraction=this.numberValue(e.iridescenceIor,1.3),i._iridescenceThicknessMinimum=this.numberValue(e.iridescenceThicknessMinimum,100),i._iridescenceThicknessMaximum=this.numberValue(e.iridescenceThicknessMaximum,400),i._iridescenceThicknessTexture=this.textureInfo(e.iridescenceThicknessTexture),i._iridescenceThicknessTextureMapping=this.textureMapping(e.iridescenceThicknessTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsSheenObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("SheenMaterialExtension",!1),n=new b.A;this.vectorValue(e.sheenColorFactor,n)&&(i._sheenColor=n),i._sheenColorTexture=this.textureInfo(e.sheenColorTexture),i._sheenColorTextureMapping=this.textureMapping(e.sheenColorTexture),i._sheenRoughness=this.numberValue(e.sheenRoughnessFactor,0),i._sheenRoughnessTexture=this.textureInfo(e.sheenRoughnessTexture),i._sheenRoughnessTextureMapping=this.textureMapping(e.sheenRoughnessTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsSpecularObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("SpecularMaterialExtension",!1);i._specular=this.numberValue(e.specularFactor,1),i._specularTexture=this.textureInfo(e.specularTexture),i._specularTextureMapping=this.textureMapping(e.specularTexture);const n=new b.A;this.vectorValue(e.specularColorFactor,n)&&(i._specularColor=n),i._specularColorTexture=this.textureInfo(e.specularColorTexture),i._specularColorTextureMapping=this.textureMapping(e.specularColorTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsTransmission(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("TransmissionMaterialExtension",!1);i._transmission=this.numberValue(e.transmissionFactor,0),i._transmissionTexture=this.textureInfo(e.transmissionTexture),i._transmissionTextureMapping=this.textureMapping(e.transmissionTexture),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsVolumeObject(e,t){const i=this.getScene().createNode("VolumeMaterialExtension",!1);i._thickness=this.numberValue(e.thicknessFactor,0),i._thicknessTexture=this.textureInfo(e.thicknessTexture),i._thicknessTextureMapping=this.textureMapping(e.thicknessTexture),i._attenuationDistance=this.numberValue(e.attenuationDistance,1e6);const n=new b.A;this.vectorValue(e.attenuationColor,n)&&(i._attenuationColor=n),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsVolumeScatterObject(e,t){if(!(e instanceof Object))return;const i=this.getScene().createNode("VolumeScatterMaterialExtension",!1),n=new b.A;this.vectorValue(e.multiscatterColor,n)&&(i._multiscatterColor=n),i._scatterAnisotropy=this.numberValue(e.scatterAnisotropy,0),i.setup(),e.pointers=[i],t._extensions.push(i)},khrMaterialsUnlitObject(e,t){if(!e)return t;const i=this.getScene().createNode("UnlitMaterial",!1);return i._emissiveColor=t._baseColor,i._emissiveTextureMapping=t._baseTextureMapping,i._emissiveTexture=t._baseTexture,i._normalScale=t._normalScale,i._normalTextureMapping=t._normalTextureMapping,i._normalTexture=t._normalTexture,i._transparency=t._transparency,i.setup(),this.addAnimationPointerAlias(i,"baseColor","emissiveColor"),t.dispose(),i},textureTransformObject:(()=>{const e=new u.A,t=new h.A,i=new c.A;return function(n,r){if(!(n instanceof Object))return;if(!this.extensions.has("KHR_texture_transform"))return;r=n.texCoord??r;const o=new w.A,a=new w.A(1);e.set(),e.scale(t.set(1,-1,1)),e.translate(t.set(0,-1,0)),this.vectorValue(n.offset,o)&&e.translate(t.set(...o,0));const l=this.numberValue(n.rotation,0);e.rotate(i.set(0,0,-1,l)),this.vectorValue(n.scale,a)&&e.scale(t.set(...a,1));const h=this.textureTransformNodes.find(t=>this.texCoordOfNode.get(t)===r&&t._matrix.getValue().equals(e));if(h)return Object.defineProperty(n,"pointers",{get:()=>this.texCoordExtensionOfNode.get(h),configurable:!0}),h._mapping.getValue();const c=this.getScene(),u=c.createNode("TextureTransformMatrix3D",!1),d=`TEXCOORD_${this.texCoordIndex+this.textureTransformNodes.length+1}`;return u._mapping=d,u._matrix=e,u.setup(),this.textureTransformNodes.push(u),this.texCoordMappings.set(d,r),this.texCoordOfNode.set(u,r),this.texCoordExtensionOfNode.set(u,n),Object.defineProperty(n,"pointers",{get:()=>{const e=c.createNode("Script",!1);return e.addUserDefinedField(p.A.inputOutput,"translation",new s.A.SFVec2f(...o)),e.addUserDefinedField(p.A.inputOutput,"rotation",new s.A.SFFloat(l)),e.addUserDefinedField(p.A.inputOutput,"scale",new s.A.SFVec2f(...a)),e.addUserDefinedField(p.A.outputOnly,"value_changed",new s.A.SFMatrix4f),e._url=["ecmascript:\n\nconst m = new SFMatrix3f ();\n\nfunction eventsProcessed ()\n{\n m .setTransform (translation, -rotation, scale);\n\n // m' = m * flipY\n\n value_changed [0] = m [0];\n value_changed [1] = -m [1] + m [2];\n value_changed [4] = m [3];\n value_changed [5] = -m [4] + m [5];\n value_changed [12] = m [6];\n value_changed [13] = -m [7] + m [8];\n}\n"],e.setup(),c.addNamedNode(c.getUniqueName("CombineTextureMatrixScript"),e),c.addRoute(e,"value_changed",u,"set_matrix"),this.addAnimationPointerAlias(e,"offset","translation"),this.animationScripts.push(e),Object.defineProperty(n,"pointers",{value:[e]}),[e]},configurable:!0}),d}})(),meshesArray(e){e instanceof Array&&(this.meshes=e)},meshObject(e,t,i){if(!(e instanceof Object))return;if(e.shapeNodes){const i=e.primitives;if(!(i instanceof Array))return e.shapeNodes;for(const e of i)this.attributesJointsArray(t,e.attributes?.JOINTS,e.attributes?.WEIGHTS);return e.shapeNodes}const n=this.primitivesArray(e,t,i),s=this.getScene(),r=this.sanitizeName(e.name);if(r)for(const e of n)s.addNamedNode(s.getUniqueName(r),e);return e.shapeNodes=n},primitivesArray({primitives:e,weights:t},i,n){if(!(e instanceof Array))return[];const s=[];for(const r of e)this.primitiveObject(r,t,i,n,s);return s},primitiveObject(e,t,i,n,s){if(!(e instanceof Object))return;this.attributesObject(e.attributes),this.targetsArray(e.targets),e.indices=this.accessors[e.indices],e.material=this.materials[e.material],this.primitiveExtensionsObject(e.extensions,e);const r=this.createShape(e,t,i,n),o=this.khrMaterialsVariantsExtension(e.extensions,r);s.push(e.shapeNode=o??r)},attributesObject(e){if(e instanceof Object){for(const t in e)e[t]=this.accessors[e[t]];e.TEXCOORD=[],e.COLOR=[],e.JOINTS=[],e.WEIGHTS=[];for(let t=0;e["TEXCOORD_"+t];++t)e.TEXCOORD.push(e["TEXCOORD_"+t]);for(let t=0;e["COLOR_"+t];++t)e.COLOR.push(e["COLOR_"+t]);for(let t=0;e["JOINTS_"+t];++t)e.JOINTS.push(e["JOINTS_"+t]);for(let t=0;e["WEIGHTS_"+t];++t)e.WEIGHTS.push(e["WEIGHTS_"+t])}},targetsArray(e){},primitiveExtensionsObject(e,t){if(e instanceof Object)for(const[i,n]of Object.entries(e))if("KHR_draco_mesh_compression"===i)this.khrDracoMeshCompressionObject(n,t)},khrDracoMeshCompressionObject(e,t){if(!(e instanceof Object))return;if(!this.draco)return;const i=t.attributes,n=new Uint8Array(this.bufferViews[e.bufferView].buffer);this.dracoDecodeMesh(this.draco,n,e.attributes,function(e){Object.defineProperty(t.indices,"array",{value:e})},function(e,t){i[e]&&Object.defineProperty(i[e],"array",{value:t})})},dracoDecodeMesh(e,t,i,n,s){const r=new e.DecoderBuffer,o=new e.Decoder;let a,l;r.Init(t,t.byteLength);try{const t=o.GetEncodedGeometryType(r);switch(t){case e.TRIANGULAR_MESH:a=new e.Mesh,l=o.DecodeBufferToMesh(r,a);break;case e.POINT_CLOUD:a=new e.PointCloud,l=o.DecodeBufferToPointCloud(r,a);break;default:throw new Error(`Invalid geometry type ${t}.`)}if(!l.ok()||!a.ptr)throw new Error(l.error_msg());if(t===e.TRIANGULAR_MESH){const t=3*a.num_faces(),i=4*t,s=e._malloc(i);try{const r=new Uint32Array(t);o.GetTrianglesUInt32Array(a,i,s),r.set(new Uint32Array(e.HEAPF32.buffer,s,t)),n(r)}finally{e._free(s)}}for(const[t,n]of Object.entries(i)){const i=o.GetAttributeByUniqueId(a,n),r=i.num_components(),l=a.num_points()*r,h=l*Float32Array.BYTES_PER_ELEMENT,c=e._malloc(h);try{const n=new Float32Array(l);o.GetAttributeDataArrayForAllPoints(a,i,e.DT_FLOAT32,h,c),n.set(new Float32Array(e.HEAPF32.buffer,c,l)),s(t,n)}finally{e._free(c)}}}finally{a&&e.destroy(a),e.destroy(o),e.destroy(r)}},async createDraco(){if(this.constructor.draco)return this.constructor.draco;{const e=await fetch(_.A.getLibraryURL("draco_decoder_gltf.js")),t=await e.text(),i=await new Function(t)()();return this.constructor.draco=i}},khrMaterialsVariantsExtension(e,t){if(e instanceof Object)return this.khrMaterialsVariantsObjectMappings(e.KHR_materials_variants,t)},khrMaterialsVariantsObjectMappings(e,t){if(!(e instanceof Object))return;const i=e.mappings;if(!(i instanceof Array))return;if(!i.length)return;const n=this.getScene().createNode("Switch",!1);for(const e of i)this.khrMaterialsVariantsObjectMapping(e,t,n);if(n._whichChoice=this.materialVariants.length,n._children.length){n._children[this.materialVariants.length]=t;for(const e of n._children.keys())n._children[e]||(n._children[e]=t);return n.setup(),this.materialVariantNodes.push(n),n}},khrMaterialsVariantsObjectMapping(e,t,i){if(!(e instanceof Object))return;if(e.material=this.materials[e.material],!e.material)return;const n=this.getScene(),s=this.getScene().createNode("Shape",!1),r=this.materialObject(e),o=e.variants?.[0]??0,a=this.sanitizeName(this.materialVariants[o]?.name??"");a&&n.addNamedNode(n.getUniqueName(a),s),s._appearance=r,s._geometry=t._geometry,s.setup(),i._children[o]=s},camerasArray(e){e instanceof Array&&(this.cameras=e)},cameraObject(e,t){if(!(t instanceof Object))return null;if(void 0!==t.node)return t.node;const i=this.cameraType(t);if(!i)return t.node=null;const n=this.getScene(),s=this.sanitizeName(t.name);return s&&(n.addNamedNode(n.getUniqueName(s),i),n.addExportedNode(n.getUniqueExportName(s),i)),i._description=this.description(t.name||`Viewpoint ${e+1}`),i._position=h.A.ZERO,t.node=i},cameraType(e){switch(e.type){case"orthographic":return this.orthographicCamera(e.orthographic);case"perspective":return this.perspectiveCamera(e.perspective);default:return null}},orthographicCamera(e){if(!(e instanceof Object))return null;const t=this.getScene(),i=t.createNode("OrthoViewpoint",!1),n="number"==typeof e.xmag?e.xmag:1,r="number"==typeof e.ymag?e.ymag:1;return i._fieldOfView[0]=-n,i._fieldOfView[1]=-r,i._fieldOfView[2]=n,i._fieldOfView[3]=r,"number"==typeof e.znear&&(i._nearDistance=e.znear),"number"==typeof e.zfar&&(i._farDistance=e.zfar),i.setup(),this.addAnimationPointerAlias(i,"znear","nearDistance"),this.addAnimationPointerAlias(i,"zfar","farDistance"),Object.defineProperty(e,"pointers",{get:()=>{const o=t.createNode("Script",!1);return o.addUserDefinedField(p.A.inputOutput,"xmag",new s.A.SFFloat(n)),o.addUserDefinedField(p.A.inputOutput,"ymag",new s.A.SFFloat(r)),o.addUserDefinedField(p.A.outputOnly,"value_changed",new s.A.MFFloat),o._url=["ecmascript:\n\nfunction eventsProcessed ()\n{\n value_changed [0] = -xmag;\n value_changed [1] = -ymag;\n value_changed [2] = xmag;\n value_changed [3] = ymag;\n}\n"],o.setup(),t.addNamedNode(t.getUniqueName("CombineFieldOfViewScript"),o),t.addRoute(o,"value_changed",i,"set_fieldOfView"),this.animationScripts.push(o),Object.defineProperty(e,"pointers",{value:[i,o]}),[i,o]},configurable:!0}),i},perspectiveCamera(e){if(!(e instanceof Object))return null;const t=this.getScene().createNode("Viewpoint",!1);return"number"==typeof e.yfov&&(t._fieldOfView=e.yfov),"number"==typeof e.znear&&(t._nearDistance=e.znear),"number"==typeof e.zfar&&(t._farDistance=e.zfar),t.setup(),this.addAnimationPointerAlias(t,"yfov","fieldOfView"),this.addAnimationPointerAlias(t,"znear","nearDistance"),this.addAnimationPointerAlias(t,"zfar","farDistance"),e.pointers=[t],t},nodesArray(e){e instanceof Array&&(this.nodes=e.map((e,t)=>this.nodeObject(e,t)),this.nodes.forEach((e,t)=>this.nodeSkeleton(e,t)),this.nodes.forEach((e,t)=>this.nodeChildren(e,t)))},nodeObject(e,t){if(!(e instanceof Object))return{};if(e.transformNode)return e;const i=this.getScene(),n=this.joints.has(t)?"HAnimJoint":"Transform",s=i.createNode(n,!1);e.transformNode=s;const r=this.skins[e.skin];return r&&(r.humanoidNode||(r.humanoidNode=i.createNode("HAnimHumanoid",!1),r.joints.map(e=>this.humanoidIndex.set(e,r.humanoidNode))),e.humanoidNode=r.humanoidNode),e.childNode=e.humanoidNode??e.transformNode,e.pointers=[e.childNode],e},nodeSkeleton(e,t){const i=this.skins[e.skin];if(!i)return;const n=i.skeleton.map(e=>this.nodes[e]).filter(e=>e),s=i.humanoidNode;for(const e of n)e.humanoidNode=s,e.childNode=s},nodeChildren:(()=>{const e=new h.A,t=new c.A,i=new h.A(1),n=new c.A,s=new x.A,r=new u.A;return function(o,a){const l=this.getScene(),h=o.transformNode,c=this.sanitizeName(o.name);c&&(l.addNamedNode(l.getUniqueName(c),h),h.getType().at(-1)===p.A.HAnimJoint&&(h._name=o.name)),this.vectorValue(o.matrix,r)?(r.get(e,t,i,n),h._translation=e,h._rotation=t,h._scale=i,h._scaleOrientation=n):(this.vectorValue(o.translation,e)&&(h._translation=e),this.vectorValue(o.rotation,s)&&(h._rotation=t.setQuaternion(s)),this.vectorValue(o.scale,i)&&(h._scale=i));const d=this.skins[o.skin],g=o.extensions?.EXT_mesh_gpu_instancing,f=this.meshObject(this.meshes[o.mesh],d,g),m=this.cameraObject(o.camera,this.cameras[o.camera]);m&&h._children.push(m),this.nodeExtensions(o);let A=this.nodeChildrenArray(o.children);if(h.getType().at(-1)===p.A.HAnimJoint&&(A=A.map(e=>{if(e.getType().at(-1)===p.A.HAnimHumanoid){const t=l.createNode("HAnimSegment",!1);t._children.push(e),t.setup();const i=this.humanoidIndex.get(a);return i?._segments.push(t),t}return e})),h._children.push(...A),f&&h._children.push(...f),h.setup(),!d)return;const _=d.humanoidNode;if(!_.isInitialized()){const n=this.sanitizeName(d.name)||h.getName();n&&l.addNamedNode(l.getUniqueName(n),_),_._name=d.name??o.name??"",_._version="2.0",_._skeletalConfiguration="GLTF",_._skeleton.push(...d.skeleton.map(e=>this.nodes[e]?.transformNode).filter(e=>e));for(const[n,s]of d.joints.entries()){const r=this.nodes[s]?.transformNode,o=d.inverseBindMatrices[n]??u.A.IDENTITY;r&&(o.get(e,t,i),_._joints.push(r),_._jointBindingPositions.push(e),_._jointBindingRotations.push(t),_._jointBindingScales.push(i))}_.setup()}f?.length&&(_._skinNormal=f[0]._geometry.normal,_._skinCoord=f[0]._geometry.coord),_._skin.push(h)}})(),nodeExtensions(e){if(e.extensions instanceof Object)for(const[t,i]of Object.entries(e.extensions))if(i instanceof Object)switch(t){case"KHR_lights_punctual":{const t=this.lightObject(i.light);if(!t)break;e.transformNode._children.push(t);break}case"KHR_node_visibility":i.pointers=[e.childNode],e.childNode._visible=i.visible??!0}},nodeChildrenArray(e){if(!(e instanceof Array))return[];return Array.from(new Set(e.map(e=>this.nodes[e]?.childNode).filter(e=>e).filter(e=>e.getType().at(-1)!==p.A.HAnimHumanoid||!e.getCloneCount())))},skinsArray(e,t){if(e instanceof Array&&t instanceof Array){this.skins=e;for(const[i,n]of e.entries())this.skinObject(i,n,t)}},skinObject(e,t,i){if(!(t instanceof Object))return;const n=this.getScene(),s=t.skeleton;t.joints=this.jointsArray(t.joints,i.some(t=>t.skin===e)),t.skeleton=void 0!==s?[s]:this.skeleton(t.joints,i),t.inverseBindMatrices=this.inverseBindMatricesAccessors(this.accessors[t.inverseBindMatrices]),void 0===s||t.joints.includes(s)||(this.joints.add(s),t.joints.push(s)),t.textureCoordinateNode=n.createNode("TextureCoordinate",!1),t.multiTextureCoordinateNode=n.createNode("MultiTextureCoordinate",!1),t.normalNode=n.createNode("Normal",!1),t.coordinateNode=n.createNode("Coordinate",!1),t.textureCoordinateNode._mapping="TEXCOORD_0",t.textureCoordinateNode.setup(),t.multiTextureCoordinateNode.setup(),t.normalNode.setup(),t.coordinateNode.setup()},jointsArray(e,t){return e instanceof Array?(t&&e.forEach(e=>this.joints.add(e)),e):[]},skeleton(e,t){const i=new Set(e.map(e=>t[e]).filter(e=>e instanceof Object).filter(e=>e.children instanceof Array).flatMap(e=>e.children));return e.filter(e=>!i.has(e))},inverseBindMatricesAccessors(e){if(!e)return[];const t=e.array,i=t.length,n=[];for(let e=0;e<i;e+=16)n.push(new u.A(...t.subarray(e,e+16)));return n},scenesArray(e,t,i=0){if(!(t instanceof Array))return;const n=this.getScene(),s=t.map(e=>this.sceneObject(e)).filter(e=>e);switch(s.length){case 0:return;case 1:if(0===i)return void n.getRootNodes().push(s[0]);default:{const t=n.createNode("Switch",!1);return n.addNamedNode(n.getUniqueName("Scenes"),t),n.addExportedNode(n.getUniqueExportName("Scenes"),t),t._whichChoice=i,t._children=s,t.setup(),this.addAnimationPointerAlias(t,"scene","whichChoice"),e.pointers=[t],void n.getRootNodes().push(t)}}},sceneObject(e){if(!(e instanceof Object))return null;const t=this.envLightObject(e.extensions?.EXT_lights_image_based?.light),i=this.sceneNodesArray(e.nodes);switch(t&&i.unshift(t),i.length){case 0:return null;case 1:return i[0];default:{const e=this.getScene(),t=e.createNode("Group",!1),n=this.sanitizeName(e.name);return n&&e.addNamedNode(e.getUniqueName(n),t),t._children=i,t.setup(),t}}},sceneNodesArray(e){return this.nodeChildrenArray(e)},exportGroup(e,t){if(!(t instanceof Array))return;const i=t.map(e=>e.node).filter(e=>e);if(!i.length)return;const n=this.getScene(),s=n.createNode("Group",!1);n.addNamedNode(n.getUniqueName(e),s),n.addExportedNode(n.getUniqueExportName(e),s),s._visible=!1,s._children=i,s.setup(),n.getRootNodes().push(s)},materialVariantsSwitch(){if(!this.materialVariantNodes.length)return;const e=this.getScene(),t=e.createNode("Switch",!1),i=this.materialVariants.map(e=>e.name);e.addNamedNode(e.getUniqueName("MaterialVariants"),t),e.addExportedNode(e.getUniqueExportName("MaterialVariants"),t),t._whichChoice=0,t._visible=!1,t.setup(),t.setMetaData("MaterialVariants/names",new s.A.MFString(...i));for(const i of this.materialVariantNodes)e.addRoute(t,"whichChoice",i,"whichChoice");e.getRootNodes().push(t)},animationsArray(e){if(e instanceof Array)for(const[t,i]of e.entries())this.animationObject(t,i)},animationObject(e,t){if(!(t instanceof Object))return null;const i=this.getScene(),n=i.createNode("TimeSensor",!1),s=this.animationChannelsArray(t.channels,t.samplers,n);if(!s.length)return;const r=i.createNode("Group",!1),o=this.sanitizeName(t.name);i.addNamedNode(i.getUniqueName(o||`Animation${e+1}`),r),i.addNamedNode(i.getUniqueName(`Timer${e+1}`),n),i.addExportedNode(i.getUniqueExportName(o||`Animation${e+1}`),r),i.addExportedNode(i.getUniqueExportName(`Timer${e+1}`),n),n._description=this.description(t.name)||`Animation ${e+1}`,r._children.push(n,...s),n.setup(),r.setup(),t.node=r},animationChannelsArray(e,t,i){if(!(e instanceof Array))return[];if(!(t instanceof Array))return[];const n=t.map(e=>this.accessors[e.input]).filter(e=>e?.array.length).reduce((e,t)=>Math.max(e,t.array.at(-1)),0);i._cycleInterval=n,e=e.flatMap(e=>this.animationChannelObject(e,t,i));for(const t of this.animationScripts){const i=e.findLastIndex(e=>e.getFields().some(e=>Array.from(e.getOutputRoutes()).some(e=>e.getDestinationNode()===t)));e.splice(i+1,0,t)}return this.animationScripts.length=0,e},animationChannelObject(e,t,i){if(!(e instanceof Object))return[];const n=e.target;if(!(n instanceof Object))return[];const s=this.nodes[n.node]?.transformNode;if(!s&&"pointer"!==n.path)return[];const r=t[e.sampler];if(!r)return[];const o=this.accessors[r.input];if(!o)return[];if(!o.array.length)return[];const a=this.accessors[r.output];return a&&a.array.length?this.createInterpolator(i,s,n,r.interpolation,o.array,a,i._cycleInterval.getValue()):[]},cleanupAnimationScripts(){const e=this.getScene(),t=Array.from(e.getNamedNodes(),e=>e.getValue()).filter(e=>e.getType().at(-1)===p.A.Script);for(const e of t)(e.getFields().every(e=>!e.getInputRoutes().size)||e.getFields().every(e=>!e.getOutputRoutes().size))&&e.dispose()},createShape(e,t,i,n){const s=this.getScene(),r=this.meshInstancing(n)??s.createNode("Shape",!1),o=this.materialObject(e),a=this.createGeometry(e,t,i);return r._appearance=o,r._geometry=a,r.setup(),r},meshInstancing(e){if(!(e instanceof Object))return null;let t=e.attributes,i=this.accessors[t?.TRANSLATION],n=this.accessors[t?.ROTATION],s=this.accessors[t?.SCALE];if(!Math.max(i?.count??0,n?.count??0,s?.count??0))return null;"VEC3"!==i?.type&&(i=null),"VEC4"!==n?.type&&(n=null),"VEC3"!==s?.type&&(s=null);const r=this.getScene().createNode("InstancedShape",!1),o=i?.array,a=n?.array,l=s?.array;if(o&&(r._translations=o),a){const e=4*n.count;for(let t=0;t<e;t+=4)r._rotations.push(new c.A(new x.A(a[t+0],a[t+1],a[t+2],a[t+3])))}return l&&(r._scales=l),r.setup(),r},getDefaultAppearance(){if(this.defaultAppearance)return this.defaultAppearance;const e=this.getScene(),t=e.createNode("Appearance",!1),i=e.createNode("PhysicalMaterial",!1);return t._alphaMode="OPAQUE",t._material=i,i._metallic=0,i.setup(),t.setup(),this.defaultAppearance=t},hasTextures:e=>!!+e.getTextureBits()||!!e._extensions?.some(e=>+e.getValue().getTextureBits()),createMultiTextureTransform(e){if(!this.hasTextures(e))return null;const t=this.textureTransformNodes.sort((e,t)=>y.A.cmp(e._mapping.getValue(),t._mapping.getValue()));switch(t.length){case 0:return this.textureTransformNode??=(()=>{const e=this.getScene().createNode("TextureTransform",!1);return e._translation.y=-1,e._scale.y=-1,e.setup(),e})();case 1:return t[0];default:{const e=this.getScene().createNode("MultiTextureTransform",!1);return e._textureTransform=t,e.setup(),e}}},createGeometry(e,t,i){switch(e.mode){case 0:return this.createPointSet(e,t,i);case 1:return e.indices?this.createIndexedLineSet(e,t,i,1):this.createLineSet(e,t,i);case 2:return this.createIndexedLineSet(e,t,i,2);case 3:return this.createIndexedLineSet(e,t,i,3);default:case 4:return e.indices?this.createIndexedTriangleSet(e,t,i):this.createTriangleSet(e,t,i);case 5:return e.indices?this.createIndexedTriangleStripSet(e,t,i):this.createTriangleStripSet(e,t,i);case 6:return e.indices?this.createIndexedTriangleFanSet(e,t,i):this.createTriangleFanSet(e,t,i)}},createPointSet({attributes:e,material:t,targets:i},n,s){const r=this.getScene().createNode("PointSet",!1);return r._color=this.createColor(e.COLOR[0],t),r._normal=this.createNormal(e.NORMAL,i,n),r._tangent=this.createTangent(e.TANGENT,e.NORMAL),r._coord=this.createCoordinate(e.POSITION,i,n),this.attributesJointsArray(s,e.JOINTS,e.WEIGHTS),this.skinGeometry(s,r),r.setup(),r},createIndexedLineSet({attributes:e,indices:t,material:i,targets:n},s,r,o){const a=this.getScene().createNode("IndexedLineSet",!1);switch(a._color=this.createColor(e.COLOR[0],i),a._normal=this.createNormal(e.NORMAL,n,s),a._tangent=this.createTangent(e.TANGENT,e.NORMAL),a._coord=this.createCoordinate(e.POSITION,n,s),o){case 1:{const e=a._coordIndex,i=t.array,n=i.length;for(let t=0;t<n;t+=2)e.push(i[t],i[t+1],-1);break}case 2:{const e=a._coordIndex;if(t){for(const i of t.array)e.push(i);e.length&&e.push(e[0],-1)}else{const t=a._coord;if(t?.point.length){for(const i of t.point.keys())e.push(i);e.push(0,-1)}}break}case 3:{const e=a._coordIndex;if(t){for(const i of t.array)e.push(i);e.length&&e.push(-1)}else{const t=a._coord;if(t?.point.length){for(const i of t.point.keys())e.push(i);e.push(-1)}}break}}return this.attributesJointsArray(r,e.JOINTS,e.WEIGHTS),this.skinGeometry(r,a),a.setup(),a},createLineSet({attributes:e,material:t,targets:i},n,s){const r=this.getScene().createNode("LineSet",!1);return r._color=this.createColor(e.COLOR[0],t),r._normal=this.createNormal(e.NORMAL,i,n),r._tangent=this.createTangent(e.TANGENT,e.NORMAL),r._coord=this.createCoordinate(e.POSITION,i,n),this.attributesJointsArray(s,e.JOINTS,e.WEIGHTS),this.skinGeometry(s,r),r.setup(),r},createIndexedTriangleSet({attributes:e,indices:t,material:i,targets:n},s,r){const o=this.getScene().createNode("IndexedTriangleSet",!1);return o._solid=!i?.doubleSided,o._index=t.array,o._color=this.createColor(e.COLOR[0],i),o._texCoord=this.createMultiTextureCoordinate(e.TEXCOORD,i),o._normal=this.createNormal(e.NORMAL,n,s),o._tangent=this.createTangent(e.TANGENT,e.NORMAL),o._coord=this.createCoordinate(e.POSITION,n,s),o._normalPerVertex=!!o._normal.getValue(),this.attributesJointsArray(r,e.JOINTS,e.WEIGHTS),this.skinGeometry(r,o),o.setup(),o},createTriangleSet({attributes:e,material:t,targets:i},n,s){const r=this.getScene().createNode("TriangleSet",!1);return r._solid=!t?.doubleSided,r._color=this.createColor(e.COLOR[0],t),r._texCoord=this.createMultiTextureCoordinate(e.TEXCOORD,t),r._normal=this.createNormal(e.NORMAL,i,n),r._tangent=this.createTangent(e.TANGENT,e.NORMAL),r._coord=this.createCoordinate(e.POSITION,i,n),r._normalPerVertex=!!r._normal.getValue(),this.attributesJointsArray(s,e.JOINTS,e.WEIGHTS),this.skinGeometry(s,r),r.setup(),r},createIndexedTriangleStripSet({attributes:e,indices:t,material:i,targets:n},s,r){const o=this.getScene().createNode("IndexedTriangleStripSet",!1);return o._solid=!i?.doubleSided,o._index=t.array,o._color=this.createColor(e.COLOR[0],i),o._texCoord=this.createMultiTextureCoordinate(e.TEXCOORD,i),o._normal=this.createNormal(e.NORMAL,n,s),o._tangent=this.createTangent(e.TANGENT,e.NORMAL),o._coord=this.createCoordinate(e.POSITION,n,s),o._normalPerVertex=!!o._normal.getValue(),this.attributesJointsArray(r,e.JOINTS,e.WEIGHTS),this.skinGeometry(r,o),o.setup(),o},createTriangleStripSet({attributes:e,material:t,targets:i},n,s){const r=this.getScene().createNode("TriangleStripSet",!1);r._solid=!t?.doubleSided,r._color=this.createColor(e.COLOR[0],t),r._texCoord=this.createMultiTextureCoordinate(e.TEXCOORD,t),r._normal=this.createNormal(e.NORMAL,i,n),r._tangent=this.createTangent(e.TANGENT,e.NORMAL),r._coord=this.createCoordinate(e.POSITION,i,n),r._normalPerVertex=!!r._normal.getValue();const o=r._coord;return o&&o.point.length&&(r._stripCount=[o.point.length]),this.attributesJointsArray(s,e.JOINTS,e.WEIGHTS),this.skinGeometry(s,r),r.setup(),r},createIndexedTriangleFanSet({attributes:e,indices:t,material:i,targets:n},s,r){const o=this.getScene().createNode("IndexedTriangleFanSet",!1);return o._solid=!i?.doubleSided,o._index=t.array,o._color=this.createColor(e.COLOR[0],i),o._texCoord=this.createMultiTextureCoordinate(e.TEXCOORD,i),o._normal=this.createNormal(e.NORMAL,n,s),o._tangent=this.createTangent(e.TANGENT,e.NORMAL),o._coord=this.createCoordinate(e.POSITION,n,s),o._normalPerVertex=!!o._normal.getValue(),this.attributesJointsArray(r,e.JOINTS,e.WEIGHTS),this.skinGeometry(r,o),o.setup(),o},createTriangleFanSet({attributes:e,material:t,targets:i},n,s){const r=this.getScene().createNode("TriangleFanSet",!1);r._solid=!t?.doubleSided,r._color=this.createColor(e.COLOR[0],t),r._texCoord=this.createMultiTextureCoordinate(e.TEXCOORD,t),r._normal=this.createNormal(e.NORMAL,i,n),r._tangent=this.createTangent(e.TANGENT,e.NORMAL),r._coord=this.createCoordinate(e.POSITION,i,n),r._normalPerVertex=!!r._normal.getValue();const o=r._coord;return o&&o.point.length&&(r._fanCount=[o.point.length]),this.attributesJointsArray(s,e.JOINTS,e.WEIGHTS),this.skinGeometry(s,r),r.setup(),r},createColor:(()=>{const e=new Map([["VEC3","Color"],["VEC4","ColorRGBA"]]);return function(t,i){if(!(t instanceof Object))return null;const n=e.get(t.type);if(!n)return null;if(t.colorNode)return t.colorNode;const s=this.getScene(),r="OPAQUE"===this.materialObject({material:i})._alphaMode.getValue(),o=s.createNode(r?"Color":n,!1);return o._color=r&&"Color"!==n?t.array.filter((e,t)=>(t+1)%4):t.array,o.setup(),t.colorNode=o}})(),createMultiTextureCoordinate(e,t){const i=this.materialObject({material:t})._material.getValue();if(!this.hasTextures(i))return null;if(e.textureCoordinateNode)return e.textureCoordinateNode;switch(1===e.length?1:t.texCoordMappings.size){case 0:return null;case 1:return e.textureCoordinateNode=Array.from(t.texCoordMappings.entries(),([t,i])=>this.createTextureCoordinate(e[i],t))[0];default:{const i=Array.from(t.texCoordMappings.entries()).sort((e,t)=>y.A.cmp(e[0],t[0])).sort((e,t)=>e[1]-t[1]).map(([t,i])=>this.createTextureCoordinate(e[i],t));if(!i.length)return null;const n=this.getScene().createNode("MultiTextureCoordinate",!1);return n._texCoord=i,n.setup(),e.textureCoordinateNode=n}}},createTextureCoordinate(e,t){if("VEC2"!==e?.type)return null;if(e[t])return e[t];const i=this.getScene().createNode("TextureCoordinate",!1);return i._mapping=t,i._point=e.array,i.setup(),e[t]=i},createNormal(e,t,i){if("VEC3"!==e?.type)return null;if(e.normalNode)return e.normalNode;const n=this.getScene().createNode("Normal",!1);if(n._vector=e.array,t instanceof Array&&i instanceof Array){e.field=n._vector.copy();const s=this.applyMorphTargets(n._vector,t,"NORMAL",i);n._vector.length=0;for(const e of s)n._vector.push(e)}else e.field=n._vector;return n.setup(),e.normalNode=n},createTangent(e,t){if("VEC3"!==t?.type)return null;if("VEC4"!==e?.type)return null;if(e.tangentNode)return e.tangentNode;const i=this.getScene().createNode("Tangent",!1);return i._vector=e.array,i.setup(),e.tangentNode=i},createCoordinate(e,t,i){if("VEC3"!==e?.type)return null;if(e.coordinateNode)return e.coordinateNode;const n=this.getScene().createNode("Coordinate",!1);if(n._point=e.array,t instanceof Array&&i instanceof Array){e.field=n._point.copy();const s=this.applyMorphTargets(n._point,t,"POSITION",i);n._point.length=0;for(const e of s)n._point.push(e)}else e.field=n._point;return n.setup(),e.coordinateNode=n},attributesJointsArray(e,t,i){if(e instanceof Object&&t instanceof Array&&i instanceof Array)for(let n=0,s=t.length;n<s;++n)this.attributesJointsObject(e,t[n],i[n])},attributesJointsObject(e,t,i){if("VEC4"!==t?.type)return;if("VEC4"!==i?.type)return;const n=e.coordinateNode._point.length,s=t.array,r=i.array,o=s.length/4;for(let t=0;t<o;++t)for(let i=0;i<4;++i){const o=r[4*t+i];if(0===o)continue;const a=e.joints[s[4*t+i]],l=this.nodes[a]?.transformNode;l?.getType().at(-1)===p.A.HAnimJoint&&(l._skinCoordIndex.push(t+n),l._skinCoordWeight.push(o))}},skinGeometry(e,t){if(!(e instanceof Object))return;const i=e.coordinateNode,n=i._point.length,s=t._texCoord?.getValue(),r=t._normal?.getValue(),o=t._coord?.getValue();if(t._coordIndex&&(t._coordIndex=t._coordIndex.map(e=>e<0?-1:e+n)),t._index&&(t._index=t._index.map(e=>e<0?-1:e+n)),s)switch(s.getType().at(-1)){case p.A.TextureCoordinate:{const i=e.textureCoordinateNode,r=i._point;s._point.forEach((e,t)=>r[t+n]=e),t._texCoord=i;break}case p.A.MultiTextureCoordinate:{const i=e.multiTextureCoordinateNode;for(const t of s._texCoord){let s=i._texCoord.find(e=>e.mapping===t.mapping)?.getValue();s||("TEXCOORD_0"===t.mapping?s=e.textureCoordinateNode:(s=this.getScene().createNode("TextureCoordinate",!1),s._mapping=t.mapping,s.setup()),i._texCoord.push(s));const r=s._point;t.point.forEach((e,t)=>r[t+n]=e)}t._texCoord=i;break}}if(r){const i=e.normalNode,s=i._vector;r._vector.forEach((e,t)=>s[t+n]=e),t._normal=i}if(o){const e=i._point;o._point.forEach((t,i)=>e[i+n]=t),t._coord=i}},createInterpolator(e,t,i,n,s,r,o){const a=this.getScene();switch(i.path){case"pointer":{const[t,a]=this.getAnimationPointer(i.extensions?.KHR_animation_pointer?.pointer);return this.createAnimationPointerInterpolator(e,t,a,n,s,r,o)}case"translation":case"rotation":case"scale":{const a=t.getField(i.path);return this.createAnimationPointerInterpolator(e,t,a,n,s,r,o)}case"weights":{const t=this.nodes[i.node],l=this.meshes[t.mesh],h=l?.primitives,c=[];if(!(h instanceof Array))return null;for(const{shapeNode:t,targets:i,attributes:l}of h){const h=t._geometry.getValue();if(!h||!h._coord.getValue())continue;if(l.POSITION?.field.length!==h._coord.point.length)continue;const u=this.createArrayInterpolator("CoordinateInterpolator",n,s,r.array,o,i,l,"POSITION");u&&(u._key.length<2||u._keyValue.length/u._key.length===h._coord.point.length&&(c.push(u),a.addRoute(e,"fraction_changed",u,"set_fraction"),a.addRoute(u,"value_changed",h._coord,"point")))}for(const{shapeNode:t,targets:i,attributes:l}of h){const h=t._geometry.getValue();if(!h||!h._normal.getValue())continue;if(l.NORMAL?.field.length!==h._normal.vector.length)continue;const u=this.createArrayInterpolator("NormalInterpolator",n,s,r.array,o,i,l,"NORMAL");u&&(u._key.length<2||u._keyValue.length/u._key.length===h._normal.vector.length&&(c.push(u),a.addRoute(e,"fraction_changed",u,"set_fraction"),a.addRoute(u,"value_changed",h._normal,"vector")))}return c}default:return[]}},createAnimationPointerInterpolator:(()=>{const e=new Map([[p.A.SFBool,{typeName:"BooleanSequencer"}],[p.A.SFInt32,{typeName:"IntegerSequencer"}],[p.A.SFFloat,{typeName:"ScalarInterpolator",components:1}],[p.A.SFVec2f,{typeName:"PositionInterpolator2D",components:2}],[p.A.SFVec3f,{typeName:"PositionInterpolator",components:3}]]);return function(t,i,n,r,o,a,l){if(!i||!n)return[];const h=this.getScene();switch(n.getType()){case p.A.SFColor:{const e=[];let s,c;if(a.array.length/o.length%3==0)s=a.array;else s=a.array.filter((e,t)=>t%4<3),c=a.array.filter((e,t)=>t%4==3),c=c.every(e=>e>=1)?void 0:c.map(e=>1-e);const u=this.createNamedInterpolator("ColorInterpolator",3,r,o,s,l);if(h.addNamedNode(h.getUniqueName(`${T.toUpperCaseFirst(n.getName())}Interpolator`),u),h.addRoute(t,"fraction_changed",u,"set_fraction"),h.addRoute(u,"value_changed",i,n.getName()),e.push(u),n.getName().match(/^(?:baseColor|emissiveColor)$/)&&c){const n=this.createNamedInterpolator("ScalarInterpolator",1,r,o,c,l);h.addNamedNode(h.getUniqueName("TransparencyInterpolator"),n),h.addRoute(t,"fraction_changed",n,"set_fraction"),h.addRoute(n,"value_changed",i,"transparency"),e.push(n)}return e}case p.A.SFColorRGBA:{const e=[];let c=a.array.filter((e,t)=>t%4<3),u=a.array.filter((e,t)=>t%4==3);u=u.every(e=>e>=1)?void 0:u.map(e=>1-e);const d=h.createNode("Script",!1);d.addUserDefinedField(p.A.inputOutput,"color",new s.A.SFColor(1,1,1)),d.addUserDefinedField(p.A.inputOutput,"alpha",new s.A.SFFloat(1)),d.addUserDefinedField(p.A.outputOnly,"value_changed",new s.A.SFColorRGBA),d._url=["ecmascript:\n\nfunction eventsProcessed ()\n{\n value_changed [0] = color [0];\n value_changed [1] = color [1];\n value_changed [2] = color [2];\n value_changed [3] = alpha;\n}\n "],d.setup(),h.addNamedNode(h.getUniqueName("CombineColorRGBAScript"),d),h.addRoute(d,"value_changed",i,n.getName());const g=this.createNamedInterpolator("ColorInterpolator",3,r,o,c,l);if(h.addNamedNode(h.getUniqueName(`${T.toUpperCaseFirst(n.getName())}Interpolator`),g),h.addRoute(t,"fraction_changed",g,"set_fraction"),h.addRoute(g,"value_changed",d,"color"),e.push(g),u){const i=this.createNamedInterpolator("ScalarInterpolator",1,r,o,u,l);h.addNamedNode(h.getUniqueName("AlphaInterpolator"),i),h.addRoute(t,"fraction_changed",i,"set_fraction"),h.addRoute(i,"value_changed",d,"alpha"),e.push(i)}return e.push(d),e}case p.A.SFRotation:{const e=this.createOrientationInterpolator(r,o,a.array,l);return h.addNamedNode(h.getUniqueName(`${T.toUpperCaseFirst(n.getName())}Interpolator`),e),h.addRoute(t,"fraction_changed",e,"set_fraction"),h.addRoute(e,"value_changed",i,n.getName()),e}case p.A.SFBool:case p.A.SFInt32:case p.A.SFFloat:case p.A.SFVec2f:case p.A.SFVec3f:{const{typeName:s,components:c}=e.get(n.getType()),u=s.replace(/^.*?(Sequencer|Interpolator).*?$/,"$1"),d=this.createNamedInterpolator(s,c,c?r:"LINEAR",o,a.array,l);return h.addNamedNode(h.getUniqueName(T.toUpperCaseFirst(n.getName())+u),d),h.addRoute(t,"fraction_changed",d,"set_fraction"),h.addRoute(d,"value_changed",i,n.getName()),d}default:return[]}}})(),getAnimationPointer(e=""){const t=e.split("/").filter(e=>e),i=t.pop().replace(/(?:Factor$)/,"");let n=this.input;for(const e of t)n=n?.[e];return n?.pointers?.map(e=>[e,T.try(()=>e?.getField(this.getAnimationPointerAlias(e,i)??i))])?.find(([e,t])=>t)??[]},addAnimationPointerAlias(e,t,i){const n=`${e.getTypeName()}.${t}`;this.pointerAliases.set(n,i)},getAnimationPointerAlias(e,t){const i=`${e.getTypeName()}.${t}`;return this.pointerAliases.get(i)},createNamedInterpolator(e,t,i,n,s,r){const o=this.getScene().createNode(e,!1);switch(i){case"STEP":{const e=[],i=[];e.push(n[0]/r);for(let t=1,i=n.length;t<i;++t)e.push(n[t]/r,n[t]/r);const a=2*t;for(let e=0;e<t;++e)i.push(s[e]);for(let e=0,n=s.length-t;e<n;e+=t)for(let t=0;t<a;++t)i.push(s[e+t]);return o._key=e,o._keyValue=i,o.setup(),o}default:case"LINEAR":return o._key=n.map(e=>e/r),o._keyValue=s,o.setup(),o;case"CUBICSPLINE":{const e=[],i=[],a=[],l=[w.A,w.A,h.A][t-1];for(let e=0,i=s.length;e<i;e+=t)a.push(new l(...s.subarray(e,e+t)));const c=Math.floor(30*n.at(-1)),u=Array.from({length:c},(e,t)=>t/(c-1)*n.at(-1));for(const t of u)e.push(t/r),i.push(...this.cubicSplineVector(t,n,a));return o._key=e,o._keyValue=1===t?i.filter((e,t)=>t%2<1):i,o.setup(),o}}},createOrientationInterpolator(e,t,i,n){const s=this.getScene().createNode("OrientationInterpolator",!1);switch(e){case"STEP":s._key.push(t[0]/n);for(let e=1,i=t.length;e<i;++e)s._key.push(t[e]/n,t[e]/n);s._keyValue.push(new c.A(new x.A(i[0],i[1],i[2],i[3])));for(let e=0,t=i.length-4;e<t;e+=4)s._keyValue.push(new c.A(new x.A(i[e+0],i[e+1],i[e+2],i[e+3])),new c.A(new x.A(i[e+4],i[e+5],i[e+6],i[e+7])));return s.setup(),s;default:case"LINEAR":s._key=t.map(e=>e/n);for(let e=0,t=i.length;e<t;e+=4)s._keyValue.push(new c.A(new x.A(i[e+0],i[e+1],i[e+2],i[e+3])));return s.setup(),s;case"CUBICSPLINE":{const e=[];for(let t=0,n=i.length;t<n;t+=4)e.push(new x.A(i[t+0],i[t+1],i[t+2],i[t+3]));const r=Math.floor(30*t.at(-1)),o=Array.from({length:r},(e,i)=>i/(r-1)*t.at(-1));for(const i of o){const r=this.cubicSplineVector(i,t,e).normalize();s._key.push(i/n),s._keyValue.push(new c.A(r))}return s.setup(),s}}},createArrayInterpolator(e,t,i,n,s,r,o,a){const l=o[a];if(!l)return null;const h=this.getScene().createNode(e,!1);switch(t){case"STEP":{h._key.push(i[0]/s);for(let e=1,t=i.length;e<t;++e)h._key.push(i[e]/s,i[e]/s);const e=Array.from(r.keys(),e=>n[e]);for(const t of this.applyMorphTargets(l.field,r,a,e))h._keyValue.push(t);for(let e=1,t=i.length;e<t;++e){const t=Array.from(r.keys(),t=>n[e*r.length+t]),i=this.applyMorphTargets(l.field,r,a,t);for(const e of i)h._keyValue.push(e);for(const e of i)h._keyValue.push(e)}return h.setup(),h}default:case"LINEAR":h._key=i.map(e=>e/s);for(const e of i.keys()){const t=Array.from(r.keys(),t=>n[e*r.length+t]);for(const e of this.applyMorphTargets(l.field,r,a,t))h._keyValue.push(e)}return h.setup(),h;case"CUBICSPLINE":{const e=Math.floor(30*i.at(-1)),t=Array.from({length:e},(t,n)=>n/(e-1)*i.at(-1));for(const e of t){h._key.push(e/s);const t=Array.from(r.keys(),t=>this.cubicSplineScalarArray(e,i,n,r.length,t));for(const e of this.applyMorphTargets(l.field,r,a,t))h._keyValue.push(e)}return h.setup(),h}}},applyMorphTargets:(()=>{const e=new h.A;return function(t,i,n,s){const r=Array.from(t,e=>e.getValue().copy());for(const[t,o]of i.entries()){const i=s[t];if(!i)continue;const a=this.accessors[o[n]];if("VEC3"!==a?.type)continue;const l=a.array,h=l.length;for(let t=0,n=0;t<h;t+=3,++n)r[n].add(e.set(l[t],l[t+1],l[t+2]).multiply(i))}return r}})(),cubicSplineVector(e,t,i){const n=y.A.clamp(y.A.upperBound(t,0,t.length,e),1,t.length-1),s=n-1,r=t[n]-t[s],o=(e-t[s])/r,a=o*o,l=a*o,h=i[3*s+1].copy(),c=i[3*s+2].copy(),u=i[3*n+1].copy(),d=i[3*n+0].copy();return h.multiply(2*l-3*a+1),c.multiply(r*(l-2*a+o)),u.multiply(-2*l+3*a),d.multiply(r*(l-a)),h.add(c).add(u).add(d)},cubicSplineScalarArray(e,t,i,n,s){const r=y.A.clamp(y.A.upperBound(t,0,t.length,e),1,t.length-1),o=r-1,a=t[r]-t[o],l=(e-t[o])/a,h=l*l,c=h*l;let u=i[(o+1)*n+s],d=i[(o+2)*n+s],p=i[(r+1)*n+s],g=i[(r+0)*n+s];return u*=2*c-3*h+1,d*=a*(c-2*h+l),p*=-2*c+3*h,g*=a*(c-h),u+d+p+g},vectorValue:(e,t)=>e instanceof Array&&(e.length===t.length&&(t.set(...e),!0)),numberValue:(e,t)=>"number"!=typeof e?t:e,stringValue:(e,t)=>"string"!=typeof e?t:e,description:e=>e?.replace(/_+/g," ").trim()??""});const O=v,E=g.A.add("GLTF2Parser",O);var N=i(9340);function C(e){r.A.call(this,e),this.json=[],this.buffers=[]}Object.assign(Object.setPrototypeOf(C.prototype,r.A.prototype),{getEncoding:()=>"ARRAY_BUFFER",setInput(e){this.arrayBuffer=e,this.dataView=new DataView(e)},isValid(){return this.arrayBuffer instanceof ArrayBuffer&&(!(this.dataView.byteLength<12)&&(1179937895===this.dataView.getUint32(0,!0)&&(2===this.dataView.getUint32(4,!0)&&this.dataView.getUint32(8,!0)===this.dataView.byteLength)))},parseIntoScene(e,t){this.glb().then(e).catch(t)},async glb(){this.chunks();const e=new E(this.getScene());e.setBuffers(this.buffers);for(const t of this.json)e.setInput(t),e.isValid()&&await e.rootObject(e.input);return this.getScene()},chunks(){for(let e=12;e<this.dataView.byteLength;){const t=this.dataView.getUint32(e,!0),i=this.dataView.getUint32(e+4,!0);switch(e+=8,i){case 1313821514:this.json.push(N.decodeText(this.arrayBuffer.slice(e,e+t)));break;case 5130562:this.buffers.push(this.arrayBuffer.slice(e,e+t))}e+=t}return this.getScene()}});const I=C,F=g.A.add("GLB2Parser",I);var M=i(1264),R=i(2514),P=i(9340);const V=(0,M.A)({whitespaces:/[\x20\n\t\r,]+/gy,whitespacesNoLineTerminator:/[\x20\t]+/gy,comment:/#.*?(?=[\n\r]|$)/gy,untilEndOfLine:/[^\r\n]+/gy,mtllib:/\bmtllib\b/gy,usemtl:/\busemtl\b/gy,newmtl:/\bnewmtl\b/gy,Ka:/\bKa\b/gy,Kd:/\bKd\b/gy,Ks:/\bKs\b/gy,Ns:/\bNs\b/gy,d:/\bd\b/gy,Tr:/\bTr\b/gy,illum:/\billum\b/gy,map_Kd:/\bmap_Kd\b/gy,o:/\bo\b/gy,v:/\bv\b/gy,vt:/\bvt\b/gy,vn:/\bvn\b/gy,g:/\bg\b/gy,s:/\bs\b/gy,off:/\boff\b/gy,f:/\bf\b/gy,slash:/\//gy,int32:/(?:0[xX][\da-fA-F]+)|(?:[+-]?\d+)/gy,double:/[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?)/gy,constants:/([+-])((?:NAN|INF|INFINITY))/giy});function D(e){r.A.call(this,e),A.call(this),this.removeEmptyGroups=!0,this.combineGroupingNodes=!1,this.geometryIndices=new Map,this.smoothingGroup=0,this.smoothingGroups=new Map,this.groups=new Map,this.materials=new Map,this.textures=new Map,this.lastIndex=0}function L(e,t){this.executionContext=e,this.input=t,this.material=e.createNode("Material"),this.materials=new Map,this.textures=new Map,this.color3=new b.A,this.id=""}Object.assign(Object.setPrototypeOf(D.prototype,r.A.prototype),A.prototype,{CONSTANTS:new Map([["NAN",NaN],["INF",1/0],["INFINITY",1/0]]),getEncoding:()=>"STRING",setInput(e){this.input=e},isValid(){return"string"==typeof this.input&&!!this.input.match(/^(?:[\x20\n\t\r]+|#.*?[\r\n])*\b(?:mtllib|usemtl|o|g|s|vt|vn|v|f)\b/)},parseIntoScene(e,t){this.obj().then(e).catch(t)},async obj(){const e=this.getBrowser(),t=this.getScene();t.setEncoding("OBJ"),t.setProfile(e.getProfile("Interchange")),await e.loadComponents(t),this.object=t.createNode("Transform"),this.group=t.createNode("Group"),this.defaultMaterial=t.createNode("Material"),this.texCoord=t.createNode("TextureCoordinate"),this.normal=t.createNode("Normal"),this.coord=t.createNode("Coordinate"),this.texCoords=[],this.normals=[],this.vertices=[],this.object.children.push(this.group),t.getRootNodes().push(this.object),await this.statements();for(const[e,t]of this.geometryIndices)e.texCoordIndex=t.texCoordIndex,e.normalIndex=t.normalIndex,e.coordIndex=t.coordIndex;return this.texCoord.point=this.texCoords,this.normal.vector=this.normals,this.coord.point=this.vertices,this.optimizeSceneGraph(t.getRootNodes()),this.getScene()},comments(){for(;this.comment(););},comment(){return this.whitespaces(),!!V.comment.parse(this)},whitespaces(){V.whitespaces.parse(this)},whitespacesNoLineTerminator(){V.whitespacesNoLineTerminator.parse(this)},async statements(){for(;await this.statement(););},async statement(){return!!await this.mtllibs()||(!!this.usemtl()||(!!this.o()||(!!this.g()||(!!this.s()||(!!this.vts()||(!!this.vns()||(!!this.vs()||(!!this.fs()||!!V.untilEndOfLine.parse(this)))))))))},async mtllibs(){if(this.comments(),V.mtllib.parse(this)){if(this.whitespacesNoLineTerminator(),V.untilEndOfLine.parse(this)){const e=this.result[0].trim().split(/\s+/);await Promise.all(e.map(e=>this.mtllib(e)))}return!0}return!1},async mtllib(e){try{const t=this.getExecutionContext(),i=new URL(e,t.getBaseURL()),n=await fetch(i),s=await n.arrayBuffer(),r=new L(t,P.decodeText(P.ungzip(s)));r.parse();for(const[e,i]of r.materials){const n=this.sanitizeName(e);n&&(t.addNamedNode(t.getUniqueName(n),i),t.addExportedNode(t.getUniqueExportName(n),i)),this.materials.set(e,i)}for(const[e,i]of r.textures){const n=this.sanitizeName(e);n&&(t.addNamedNode(t.getUniqueName(n),i),t.addExportedNode(t.getUniqueExportName(n),i)),this.textures.set(e,i)}}catch(e){console.warn(e)}},usemtl(){if(this.comments(),V.usemtl.parse(this)){if(this.whitespacesNoLineTerminator(),V.untilEndOfLine.parse(this)){const e=this.result[0];this.material=this.materials.get(e)||this.defaultMaterial,this.texture=this.textures.get(e);const t=this.smoothingGroups.get(this.group.getNodeName());t&&t.delete(this.smoothingGroup)}return!0}return!1},o(){if(this.comments(),V.o.parse(this)){if(this.whitespacesNoLineTerminator(),V.untilEndOfLine.parse(this)){const e=this.getExecutionContext(),t=this.sanitizeName(this.result[0]);this.group.children.length&&(this.object=e.createNode("Transform"),this.group=e.createNode("Group"),this.object.children.push(this.group),e.getRootNodes().push(this.object)),t&&!this.object.getValue().getName()&&(e.addNamedNode(e.getUniqueName(t),this.object),e.addExportedNode(e.getUniqueExportName(t),this.object))}return!0}return!1},g(){if(this.comments(),V.g.parse(this)){if(this.whitespacesNoLineTerminator(),V.untilEndOfLine.parse(this)){const e=this.getExecutionContext(),t=this.result[0],i=this.sanitizeName(t),n=this.groups.get(t);n?this.group=n:this.group.children.length&&(this.group=e.createNode("Group"),this.object.children.push(this.group)),this.groups.set(t,this.group),i&&!this.group.getValue().getName()&&(e.addNamedNode(e.getUniqueName(i),this.group),e.addExportedNode(e.getUniqueExportName(i),this.group)),this.smoothingGroup=0}return!0}return!1},s(){return this.comments(),!!V.s.parse(this)&&(this.whitespacesNoLineTerminator(),V.off.parse(this)?(this.smoothingGroup=0,!0):!this.int32()||(this.smoothingGroup=this.value,!0))},vts(){const e=this.texCoords;let t=!1;for(;this.vt(e);)t=!0;return t},vt(e){if(this.comments(),V.vt.parse(this)){if(this.vec2(e))return!0;throw new Error("Expected a texture coordinate.")}return!1},vns(){const e=this.normals;let t=!1;for(;this.vn(e);)t=!0;return t},vn(e){if(this.comments(),V.vn.parse(this)){if(this.vec3(e))return!0;throw new Error("Expected a normal vector.")}return!1},vs(){const e=this.vertices;let t=!1;for(;this.v(e);)t=!0;return t},v(e){if(this.comments(),V.v.parse(this)){if(this.vec3(e))return!0;throw new Error("Expected a vertex coordinate.")}return!1},fs(){if(this.comments(),V.f.lookahead(this)){try{this.shape=this.smoothingGroups.get(this.group.getNodeName()).get(this.smoothingGroup),this.geometry=this.shape.geometry;const e=this.geometryIndices.get(this.geometry);this.texCoordIndex=e.texCoordIndex,this.normalIndex=e.normalIndex,this.coordIndex=e.coordIndex}catch{const e=this.getExecutionContext(),t=e.createNode("Appearance");this.shape=e.createNode("Shape"),this.geometry=e.createNode("IndexedFaceSet"),this.texCoordIndex=[],this.normalIndex=[],this.coordIndex=[],this.geometryIndices.set(this.geometry,{texCoordIndex:this.texCoordIndex,normalIndex:this.normalIndex,coordIndex:this.coordIndex}),t.material=this.material,t.texture=this.texture,this.geometry.creaseAngle=this.smoothingGroup?Math.PI:0,this.shape.appearance=t,this.shape.geometry=this.geometry,this.group.children.push(this.shape),this.smoothingGroups.has(this.group.getNodeName())||this.smoothingGroups.set(this.group.getNodeName(),new Map),this.smoothingGroups.get(this.group.getNodeName()).set(this.smoothingGroup,this.shape)}for(;this.f(););return this.texCoordIndex.length&&(this.geometry.texCoord=this.texCoord),this.normalIndex.length&&(this.geometry.normal=this.normal),this.geometry.coord=this.coord,!0}return!1},f(){if(this.comments(),V.f.parse(this)){const e=this.texCoordIndex,t=this.normalIndex,i=this.coordIndex,n=e.length,s=t.length,r=this.texCoords.length,o=this.normals.length,a=this.vertices.length;for(;this.indices(e,t,i,r,o,a););return e.length!==n&&e.push(-1),t.length!==s&&t.push(-1),i.push(-1),!0}return!1},indices(e,t,i,n,s,r){return!!this.int32()&&(i.push(this.index(this.value,r)),V.slash.parse(this)&&(this.int32()&&e.push(this.index(this.value,n)),V.slash.parse(this)&&this.int32()&&t.push(this.index(this.value,s))),!0)},index(e,t){if(0===e)throw new Error("Invalid index.");return e<0?t+e:e-1},int32(){return this.whitespaces(),!!V.int32.parse(this)&&(this.value=parseInt(this.result[0]),!0)},double(){return this.whitespaces(),V.double.parse(this)?(this.value=parseFloat(this.result[0]),!0):!!V.constants.parse(this)&&(this.value=this.CONSTANTS.get(this.result[2].toUpperCase()),"-"===this.result[1]&&(this.value=-this.value),!0)},vec2(e){if(this.double()){const t=this.value;if(this.double()){const i=this.value;return e.push(t,i),!0}}return!1},vec3(e){if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;return e.push(t,i,n),!0}}}return!1}}),Object.assign(L.prototype,{CONSTANTS:new Map([["NAN",NaN],["INF",1/0],["INFINITY",1/0]]),parse(){try{this.statements()}catch(e){R.A&&console.log(e)}},comments(){for(;this.comment(););},comment(){return this.whitespaces(),!!V.comment.parse(this)},whitespaces(){V.whitespaces.parse(this)},whitespacesNoLineTerminator(){V.whitespacesNoLineTerminator.parse(this)},statements(){for(;this.statement(););},statement(){return!!this.newmtl()||(!!this.Ka()||(!!this.Kd()||(!!this.Ks()||(!!this.Ns()||(!!this.d()||(!!this.Tr()||(!!this.illum()||(!!this.map_Kd()||!!V.untilEndOfLine.parse(this)))))))))},newmtl(){return this.comments(),!!V.newmtl.parse(this)&&(this.whitespacesNoLineTerminator(),this.id="",V.untilEndOfLine.parse(this)?(this.id=this.result[0],this.material=this.executionContext.createNode("Material"),this.materials.set(this.id,this.material),!0):(V.untilEndOfLine.parse(this),!0))},Ka(){if(this.comments(),V.Ka.parse(this)){if(this.col3()){const e=this.color3.getHSV([]);return this.material.ambientIntensity=e[2],!0}return V.untilEndOfLine.parse(this),!0}return!1},Kd(){return this.comments(),!!V.Kd.parse(this)&&(this.col3()?(this.material.diffuseColor=this.color3,!0):(V.untilEndOfLine.parse(this),!0))},Ks(){return this.comments(),!!V.Ks.parse(this)&&(this.col3()?(this.material.specularColor=this.color3,!0):(V.untilEndOfLine.parse(this),!0))},Ns(){return this.comments(),!!V.Ns.parse(this)&&(this.double()?(this.material.shininess=this.value/1e3,!0):(V.untilEndOfLine.parse(this),!0))},d(){return this.comments(),!!V.d.parse(this)&&(this.double()?(this.material.transparency=1-this.value,!0):(V.untilEndOfLine.parse(this),!0))},Tr(){return this.comments(),!!V.Tr.parse(this)&&(this.double()?(this.material.transparency=this.value,!0):(V.untilEndOfLine.parse(this),!0))},illum(){return this.comments(),!!V.illum.parse(this)&&(this.int32()||V.untilEndOfLine.parse(this),!0)},map_Kd(){if(this.comments(),V.map_Kd.parse(this)){if(this.whitespacesNoLineTerminator(),V.untilEndOfLine.parse(this)){const e=this.result[0];if(e.length&&this.id.length){const t=e.trim().split(/\s+/);if(t.length){const e=this.executionContext.createNode("ImageTexture"),i=t.at(-1).replace(/\\/g,"/");e.url=[i],this.textures.set(this.id,e)}}return!0}return V.untilEndOfLine.parse(this),!0}return!1},int32(){return this.whitespaces(),!!V.int32.parse(this)&&(this.value=parseInt(this.result[0]),!0)},double(){return this.whitespaces(),V.double.parse(this)?(this.value=parseFloat(this.result[0]),!0):!!V.constants.parse(this)&&(this.value=this.CONSTANTS.get(this.result[2].toUpperCase()),"-"===this.result[1]&&(this.value=-this.value),!0)},col3(){return!!(this.double()&&(this.color3.r=this.value,this.double()&&(this.color3.g=this.value,this.double())))&&(this.color3.b=this.value,!0)}});const B=D,k=g.A.add("OBJParser",B),j=(0,M.A)({whitespaces:/[\x20\n\t\r,]+/gy,whitespacesNoLineTerminator:/[\x20\t]+/gy,comment:/;.*?(?=[\n\r]|$)/gy,untilEndOfLine:/[^\r\n]+/gy,solid:/solid/gy,facet:/facet/gy,normal:/normal/gy,outer:/outer/gy,loop:/loop/gy,vertex:/vertex/gy,endloop:/endloop/gy,endfacet:/endfacet/gy,endsolid:/endsolid/gy,name:/\w+/gy,double:/[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?)/gy,constants:/([+-])((?:NAN|INF|INFINITY))/giy});function U(e){r.A.call(this,e)}Object.assign(Object.setPrototypeOf(U.prototype,r.A.prototype),{CONSTANTS:new Map([["NAN",NaN],["INF",1/0],["INFINITY",1/0]]),getEncoding:()=>"STRING",setInput(e){this.input=e},isValid(){return"string"==typeof this.input&&!!this.input.match(/^(?:[\x20\n\t\r]+|;.*?[\r\n])*\b(?:solid)\b/)},parseIntoScene(e,t){this.stl().then(e).catch(t)},async stl(){const e=this.getBrowser(),t=this.getScene();return t.setEncoding("STL"),t.setProfile(e.getProfile("Interchange")),await e.loadComponents(t),this.material=t.createNode("Material"),this.appearance=t.createNode("Appearance"),this.material.diffuseColor=b.A.WHITE,this.appearance.material=this.material,this.statements(),this.getScene()},comments(){for(;this.comment(););},comment(){return this.whitespaces(),!!j.comment.parse(this)},whitespaces(){j.whitespaces.parse(this)},whitespacesNoLineTerminator(){j.whitespacesNoLineTerminator.parse(this)},statements(){for(;this.solid(););},solid(){if(this.comments(),j.solid.parse(this)){this.whitespacesNoLineTerminator();const e=this.getExecutionContext(),t=e.createNode("Shape"),i=e.createNode("TriangleSet"),n=e.createNode("Normal"),s=e.createNode("Coordinate"),r=this.sanitizeName(j.name.parse(this)?this.result[0]:"");if(j.untilEndOfLine.parse(this),this.facets(),t.appearance=this.appearance,t.geometry=i,i.normalPerVertex=!1,i.normal=n,i.coord=s,n.vector=this.normals,s.point=this.vertices,r&&(e.addNamedNode(e.getUniqueName(r),t),e.addExportedNode(e.getUniqueExportName(r),t)),e.getRootNodes().push(t),this.comments(),j.endsolid.parse(this))return!0;throw new Error("Expected 'endsolid' statement.")}return!1},facets(){for(this.normals=[],this.vertices=[];this.facet(this.normals,this.vertices););},facet(e,t){if(this.comments(),j.facet.parse(this)&&this.normal(e)&&this.loop(t)){if(this.comments(),j.endfacet.parse(this))return!0;throw new Error("Expected 'endfacet' statement.")}return!1},normal(e){if(this.whitespacesNoLineTerminator(),j.normal.parse(this)){if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;return e.push(t,i,n),!0}throw new Error("Expected a double.")}throw new Error("Expected a double.")}throw new Error("Expected a double.")}throw new Error("Expected 'normal' statement.")},loop(e){if(this.comments(),j.outer.parse(this)){if(this.whitespacesNoLineTerminator(),j.loop.parse(this)&&this.vertex(e)&&this.vertex(e)&&this.vertex(e)){if(this.comments(),j.endloop.parse(this))return!0;throw new Error("Expected 'endloop' statement.")}throw new Error("Expected 'loop' statement.")}throw new Error("Expected 'outer' statement.")},vertex(e){if(this.comments(),j.vertex.parse(this)){if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;return e.push(t,i,n),!0}throw new Error("Expected a double.")}throw new Error("Expected a double.")}throw new Error("Expected a double.")}throw new Error("Expected 'vertex' statement.")},double(){return this.whitespacesNoLineTerminator(),j.double.parse(this)?(this.value=parseFloat(this.result[0]),!0):!!j.constants.parse(this)&&(this.value=this.CONSTANTS.get(this.result[2].toUpperCase()),"-"===this.result[1]&&(this.value=-this.value),!0)}});const X=U,z=g.A.add("STLAParser",X);function G(e){r.A.call(this,e)}Object.assign(Object.setPrototypeOf(G.prototype,r.A.prototype),{getEncoding:()=>"ARRAY_BUFFER",setInput(e){this.arrayBuffer=e,this.dataView=new DataView(e)},isValid(){if(!(this.arrayBuffer instanceof ArrayBuffer))return!1;if(this.dataView.byteLength<84)return!1;return 50*this.dataView.getUint32(80,!0)+84===this.dataView.byteLength},parseIntoScene(e,t){this.stl().then(e).catch(t)},async stl(){const e=this.getBrowser(),t=this.getScene();return t.setEncoding("STL"),t.setProfile(e.getProfile("Interchange")),await e.loadComponents(t),this.material=t.createNode("Material"),this.appearance=t.createNode("Appearance"),this.material.diffuseColor=b.A.WHITE,this.appearance.material=this.material,this.shape(),this.getScene()},shape(){const e=this.getExecutionContext(),t=e.createNode("Shape"),i=e.createNode("TriangleSet"),n=e.createNode("Normal"),s=e.createNode("Coordinate"),r=this.dataView,o=this.dataView.byteLength,a=[],l=[];for(let e=84;e<o;e+=50){for(let t=0;t<3;++t)a.push(r.getFloat32(e+4*t,!0));for(let t=3;t<12;++t)l.push(r.getFloat32(e+4*t,!0))}t.appearance=this.appearance,t.geometry=i,i.normalPerVertex=!1,i.normal=n,i.coord=s,n.vector=a,s.point=l,e.getRootNodes().push(t)}});const H=G,$=g.A.add("STLBParser",H),Y=(0,M.A)({whitespaces:/[\x20\n\t\r,]+/gy,whitespacesNoLineTerminator:/[\x20\t]+/gy,untilEndOfLine:/[^\r\n]+/gy,line:/.*?\r?\n/gy,ply:/ply/gy,format:/format ascii 1.0/gy,comment:/\bcomment\b/gy,element:/\belement\b/gy,elementName:/\b\S+\b/gy,property:/\bproperty\b/gy,propertyList:/\blist\b/gy,propertyType:/\b(?:char|uchar|short|ushort|int|uint|float|double|int8|uint8|int16|uint16|int32|uint32|float32|float64)\b/gy,propertyName:/\b\S+\b/gy,endHeader:/\bend_header\b/gy,double:/[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?)/gy,int32:/(?:0[xX][\da-fA-F]+)|(?:[+-]?\d+)/gy});function q(e){r.A.call(this,e),this.comments=[],this.typeMapping=new Map([["char",this.int32],["uchar",this.int32],["short",this.int32],["ushort",this.int32],["int",this.int32],["uint",this.int32],["float",this.double],["double",this.double],["int8",this.int32],["uint8",this.int32],["int16",this.int32],["uint16",this.int32],["int32",this.int32],["uint32",this.int32],["float32",this.double],["float64",this.double]])}Object.assign(Object.setPrototypeOf(q.prototype,r.A.prototype),{getEncoding:()=>"STRING",setInput(e){this.input=e},isValid(){return this.input.match(/^ply\r?\nformat ascii 1.0/)},parseIntoScene(e,t){this.ply().then(e).catch(t)},async ply(){const e=this.getBrowser(),t=this.getScene();return t.setEncoding("PLY"),t.setProfile(e.getProfile("Interchange")),await e.loadComponents(t),this.processElements(this.header([])),this.getScene()},whitespacesOrComments(){for(;this.whitespaces()||this.comment(););},whitespaces(){return Y.whitespaces.parse(this)},whitespacesNoLineTerminator(){Y.whitespacesNoLineTerminator.parse(this)},comment(){return!(!Y.comment.parse(this)||!Y.untilEndOfLine.parse(this))&&(this.comments.push(this.result[0].trim()),!0)},double(){return this.whitespacesNoLineTerminator(),!!Y.double.parse(this)&&(this.value=parseFloat(this.result[0]),!0)},int32(){return this.whitespacesNoLineTerminator(),!!Y.int32.parse(this)&&(this.value=parseInt(this.result[0]),!0)},convertColor(e,t){switch(t){case"uchar":case"uint8":return e/255;case"ushort":case"uint16":return e/1048575;case"uint":case"uint32":return e/4294967295;case"float":case"float32":case"double":case"float64":return e}},convertFDC:e=>.5+.28209479177387814*e,header(e){Y.ply.parse(this),Y.whitespaces.parse(this),Y.format.parse(this),this.headings(e);const t=this.getScene(),i=t.createNode("WorldInfo"),n=new URL(t.worldURL);return i.title="data:"===n.protocol?"PLY Model":n.pathname.split("/").at(-1),i.info=this.comments,t.rootNodes.push(i),e},headings(e){for(;this.head(e););},head(e){return!!this.element(e)||!Y.endHeader.parse(this)&&!!Y.untilEndOfLine.parse(this)},element(e){if(this.whitespacesOrComments(),Y.element.parse(this)&&(this.whitespacesNoLineTerminator(),Y.elementName.parse(this))){const t=this.result[0];if(this.int32()){const i={name:t,count:this.value,properties:[]};return this.properties(i.properties),e.push(i),!0}}return!1},properties(e){for(;this.property(e););},property(e){if(this.whitespacesOrComments(),Y.property.parse(this)){if(this.whitespacesNoLineTerminator(),Y.propertyType.parse(this)){const t=this.result[0],i=this.typeMapping.get(t);if(this.whitespacesNoLineTerminator(),Y.propertyName.parse(this)){const n=this.result[0];return e.push({type:t,value:i,name:n}),!0}}if(Y.propertyList.parse(this)&&(this.whitespacesNoLineTerminator(),Y.propertyType.parse(this))){const t=this.typeMapping.get(this.result[0]);if(this.whitespacesNoLineTerminator(),Y.propertyType.parse(this)){const i=this.result[0],n=this.typeMapping.get(i);if(this.whitespacesNoLineTerminator(),Y.propertyName.parse(this)){const s=this.result[0];return e.push({count:t,type:i,value:n,name:s}),!0}}}}return!1},processElements(e){for(const t of e)this.processElement(t);if(!this.points?.length)return;const t=this.getScene();if(this.coordIndex){const e=this.normals?.some(e=>0!==e),i=t.createNode("Shape"),n=t.createNode("Appearance"),s=t.createNode("Material"),r=t.createNode("IndexedFaceSet"),o=t.createNode("Coordinate");if(r.solid=!1,r.coordIndex=this.coordIndex,this.colors?.length){const e=this.alpha&&this.colors.some((e,t)=>t%4==3&&e<1),i=t.createNode(e?"ColorRGBA":"Color");i.color=e||!this.alpha?this.colors:this.colors.filter((e,t)=>t%4!=3),r.color=i}if(this.texCoords?.length){const e=t.createNode("TextureTransform");e.translation.y=-1,e.scale.y=-1,n.textureTransform=e;const i=t.createNode("TextureCoordinate");i.point=this.texCoords,r.texCoord=i,this.texCoordIndex?.length&&(r.texCoordIndex=this.texCoordIndex)}if(e){const e=t.createNode("Normal");e.vector=this.normals,r.normal=e}o.point=this.points,r.coord=o,n.material=s,i.appearance=n,i.geometry=r,t.rootNodes.push(i)}else{const e=this.normals?.some(e=>0!==e),i=t.createNode("Shape"),n=t.createNode("Appearance"),s=t.createNode(e?"Material":"UnlitMaterial"),r=t.createNode("PointSet"),o=t.createNode("Coordinate");if(this.colors?.length){const e=this.alpha&&this.colors.some((e,t)=>t%4==3&&e<1),i=t.createNode(e?"ColorRGBA":"Color");i.color=e||!this.alpha?this.colors:this.colors.filter((e,t)=>t%4!=3),r.color=i}if(e){const e=t.createNode("Normal");e.vector=this.normals,r.normal=e}o.point=this.points,r.coord=o,n.material=s,i.appearance=n,i.geometry=r,t.rootNodes.push(i)}},processElement(e){switch(e.name){case"vertex":this.parseVertices(e);break;case"face":this.parseFaces(e);break;case"multi_texture_vertex":this.parseMultiTextureVertices(e);break;case"multi_texture_face":this.parseMultiTextureFaces(e);break;default:this.parseUnknown(e)}},parseVertices({count:e,properties:t}){const i=[],n=[],s=[],r=[],o=[],a=[];for(let l=0;l<e;++l){this.whitespaces();for(const{value:e,name:l,type:h}of t){if(!e.call(this))throw new Error(`Couldn't parse value for property ${l}.`);switch(l){case"scale_0":case"scale_1":case"scale_2":i.push(this.value);break;case"rot_0":case"rot_1":case"rot_2":case"rot_3":n.push(this.value);break;case"red":case"green":case"blue":case"alpha":case"r":case"g":case"b":case"a":s.push(this.convertColor(this.value,h));break;case"f_dc_0":case"f_dc_1":case"f_dc_2":s.push(this.convertFDC(this.convertColor(this.value,h)));break;case"opacity":s.push(1/(1+Math.exp(-this.value)));break;case"s":case"t":case"u":case"v":r.push(this.value);break;case"nx":case"ny":case"nz":o.push(this.value);break;case"x":case"y":case"z":a.push(this.value)}}}this.rotations=n,this.scales=i,this.alpha=t.some(e=>e.name.match(/^(?:alpha|a|opacity)$/)),this.colors=s,this.texCoords=r,this.normals=o,this.points=a},parseFaces({count:e,properties:t}){const i=[];for(let n=0;n<e;++n){this.whitespaces();for(const{count:e,value:n,name:s}of t){if(!e.call(this))throw new Error(`Couldn't parse property count for ${s}.`);const t=this.value;for(let e=0;e<t;++e){if(!n.call(this))throw new Error(`Couldn't parse a property value for ${s}.`);i.push(this.value)}i.push(-1)}}this.coordIndex=i},parseMultiTextureVertices({count:e,properties:t}){const i=[];for(let n=0;n<e;++n){this.whitespaces();for(const{value:e,name:n}of t){if(!e.call(this))throw new Error(`Couldn't parse value for property ${n}.`);switch(n){case"s":case"t":case"u":case"v":i.push(this.value)}}}this.texCoords=i},parseMultiTextureFaces({count:e,properties:t}){const i=[];for(let n=0;n<e;++n)for(const{count:e,value:n,name:s}of t)if(e){if(!e.call(this))throw new Error(`Couldn't parse property count for ${s}.`);const t=this.value;for(let e=0;e<t;++e){if(!n.call(this))throw new Error(`Couldn't parse value for property ${s}.`);i.push(this.value)}i.push(-1)}else if(!n.call(this))throw new Error(`Couldn't parse value for property ${s}.`);this.texCoordIndex=i},parseUnknown({count:e}){this.whitespaces();for(let t=0;t<e;++t)Y.line.parse(this)}});const W=q,K=g.A.add("PLYAParser",W);function Z(e){K.call(this,e),this.typeMapping=new Map([["char",this.binaryInt8],["uchar",this.binaryUint8],["short",this.binaryInt16],["ushort",this.binaryUint16],["int",this.binaryInt32],["uint",this.binaryUint32],["float",this.binaryFloat32],["double",this.binaryFloat64],["int8",this.binaryInt8],["uint8",this.binaryUint8],["int16",this.binaryInt16],["uint16",this.binaryUint16],["int32",this.binaryInt32],["uint32",this.binaryUint32],["float32",this.binaryFloat32],["float64",this.binaryFloat64]]),this.binaryInt8.bytes=1,this.binaryUint8.bytes=1,this.binaryInt16.bytes=2,this.binaryUint16.bytes=2,this.binaryInt32.bytes=4,this.binaryUint32.bytes=4,this.binaryFloat32.bytes=4,this.binaryFloat64.bytes=8}Object.assign(Object.setPrototypeOf(Z.prototype,K.prototype),{getEncoding:()=>["ARRAY_BUFFER","STRING"],setInput(e){this.arrayBuffer=e[0],this.dataView=new DataView(this.arrayBuffer),this.input=e[1],this.magic=this.input.match(/^ply\r?\nformat (binary_(?:little|big)_endian) 1.0.*?end_header\r?\n/s),this.byteOffset=this.magic?.[0].length,this.littleEndian="binary_little_endian"===this.magic?.[1]},isValid(){return this.arrayBuffer instanceof ArrayBuffer&&!!this.magic},binaryInt8(){return this.value=this.dataView.getInt8(this.byteOffset,this.littleEndian),this.byteOffset+=1,!0},binaryUint8(){return this.value=this.dataView.getUint8(this.byteOffset,this.littleEndian),this.byteOffset+=1,!0},binaryInt16(){return this.value=this.dataView.getInt16(this.byteOffset,this.littleEndian),this.byteOffset+=2,!0},binaryUint16(){return this.value=this.dataView.getUint16(this.byteOffset,this.littleEndian),this.byteOffset+=2,!0},binaryInt32(){return this.value=this.dataView.getInt32(this.byteOffset,this.littleEndian),this.byteOffset+=4,!0},binaryUint32(){return this.value=this.dataView.getUint32(this.byteOffset,this.littleEndian),this.byteOffset+=4,!0},binaryFloat32(){return this.value=this.dataView.getFloat32(this.byteOffset,this.littleEndian),this.byteOffset+=4,!0},binaryFloat64(){return this.value=this.dataView.getFloat64(this.byteOffset,this.littleEndian),this.byteOffset+=8,!0},processElements(e){return this.whitespaces=Function.prototype,K.prototype.processElements.call(this,e)},parseUnknown({count:e,properties:t}){for(let i=0;i<e;++i)for(const{count:e,type:i}of t)e?(e.call(this),this.byteOffset+=this.value*this.typeMapping.get(i).bytes):this.byteOffset+=this.typeMapping.get(i).bytes}});const Q=Z,J=g.A.add("PLYBParser",Q);var ee=i(8392),te=i(1256),ie=i(4705);function ne(...e){this.matrix=new te.A,this.set(...e)}Object.assign(ne.prototype,{copy(){const e=Object.create(ne.prototype);return e.matrix=this.matrix.copy(),e},assign(e){return this.matrix.assign(e.matrix),this},equals(e){return this.matrix.equals(e.matrix)},set(e,t){switch(arguments.length){case 0:return this.matrix.set(0,0,0,0,0,0,0,0,0),this;case 2:return this.matrix.set(e.x/2,0,0,0,e.y/2,0,t.x,t.y,1),this}},setExtents(e,t){const i=(t.x-e.x)/2,n=(t.y-e.y)/2,s=(t.x+e.x)/2,r=(t.y+e.y)/2;return this.matrix.set(i,0,0,0,n,0,s,r,1),this},isEmpty(){return 0===this.matrix[8]},add:(()=>{const e=new w.A,t=new w.A,i=new w.A,n=new w.A;return function(s){return this.isEmpty()?this.assign(s):s.isEmpty()?this:(this.getExtents(e,t),s.getExtents(i,n),this.setExtents(e.min(i),t.max(n)))}})(),multLeft(e){return this.matrix.multLeft(e),this},multRight(e){return this.matrix.multRight(e),this},getExtents(e,t){this.getAbsoluteExtents(e,t),e.add(this.center),t.add(this.center)},getAbsoluteExtents:(()=>{const e=new w.A;return function(t,i){const n=this.matrix,s=n.xAxis,r=n.yAxis;e.assign(s).add(r);const o=r.subtract(s);t.assign(e).min(o),i.assign(e).max(o),e.negate(),o.negate(),t.min(e,o),i.max(e,o)}})(),containsPoint:(()=>{const e=new w.A,t=new w.A;return function(i){return this.getExtents(e,t),e.x<=i.x&&t.x>=i.x&&e.y<=i.y&&t.y>=i.y}})(),toString(){return`${this.size}, ${this.center}`}}),Object.assign(ne,{Extents:(e,t)=>(new ne).setExtents(e,t),Points(e){const t=new w.A(Number.POSITIVE_INFINITY),i=new w.A(Number.NEGATIVE_INFINITY);for(const n of e)t.min(n),i.max(n);return(new ne).setExtents(t,i)}}),Object.defineProperties(ne.prototype,{size:{get:(()=>{const e=new w.A,t=new w.A;return function(){return this.getAbsoluteExtents(e,t),t.subtract(e)}})(),enumerable:!0},center:{get(){return this.matrix.origin},enumerable:!0}});const se=ne,re=g.A.add("Box2",se),{interval:oe}=y.A,ae={quadric:(()=>{const e=new te.A(1,0,0,-2,2,0,1,-2,1),t=new te.A;return function(i,n,s,r,o,a,l,c,u,d,p){t.set(i,n,s,r,o,a,l,c,u).multLeft(e);for(let e=0,i=d-1;e<d;++e){const n=e/i;p.push(t.multVecMatrix(new h.A(1,n,n*n)))}}})(),cubic:(()=>{const e=new ee.A,t=new u.A(1,0,0,0,-3,3,0,0,3,-6,3,0,-1,3,-3,1),i=new u.A;return function(n,s,r,o,a,l,c,u,d,p,g,f,m,A){i.set(n,s,r,0,o,a,l,0,c,u,d,0,p,g,f,0).multLeft(t);for(let t=0,n=m-1;t<m;++t){const s=t/n;i.multVecMatrix(e.set(1,s,s*s,s*s*s)),A.push(new h.A(e.x,e.y,e.z))}}})(),arc(e,t,i,n,s,r,o,a,l,c,u){if(e===a&&t===l)return void u.push(new h.A(a,l,0));if(i=Math.abs(i),n=Math.abs(n),0===i||0===n)return void u.push(new h.A(e,t,0),new h.A(a,l,0));const d=i*i,p=n*n;s=oe(s,0,2*Math.PI);const g=Math.sin(s),f=Math.cos(s),m=new w.A(e-a,t-l).divide(2),A=new w.A(f*m.x+g*m.y,-g*m.x+f*m.y),_=A.copy().multVec(A),y=_.x/d+_.y/p;y>1&&(i=Math.sqrt(y)*i,n=Math.sqrt(y)*n);let x=(d*p-d*_.y-p*_.x)/(d*_.y+p*_.x);x=Math.max(0,x);const b=(r!==o?1:-1)*Math.sqrt(x),S=new w.A(b*i*A.y/n,-b*n*A.x/i),T=new w.A(f*S.x-g*S.y+(e+a)/2,g*S.x+f*S.y+(t+l)/2),v=new w.A((A.x-S.x)/i,(A.y-S.y)/n),O=new w.A((-A.x-S.x)/i,(-A.y-S.y)/n),E=e=>e>0?e:2*Math.PI+e,N=E(Math.atan2(v.y,v.x));let C=E(Math.atan2(O.y,O.x))-N;r?C<0&&(C+=2*Math.PI):C>0&&(C-=2*Math.PI),o&&C<0?C+=2*Math.PI:!o&&C>0&&(C-=2*Math.PI);const I=Math.max(4,Math.abs(C)*c/(2*Math.PI))-1;u.push(new h.A(e,t,0));for(let e=1;e<I;++e){const t=N+C*(e/I),s=i*Math.cos(t),r=n*Math.sin(t);u.push(new h.A(f*s-g*r+T.x,g*s+f*r+T.y,0))}u.push(new h.A(a,l,0))}},le=ae,he=g.A.add("Bezier",le);var ce=i(6732),ue=i(9340),de=i(5704);const pe=(0,M.A)({whitespaces:/[\x20\n\t\r]+/gy,comma:/,/gy,openParenthesis:/\(/gy,closeParenthesis:/\)/gy,length:/em|ex|px|in|cm|mm|pt|pc|%/gy,percent:/%/gy,int32:/(?:0[xX][\da-fA-F]+)|(?:[+-]?\d+)/gy,double:/[+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?)/gy,constants:/([+-])((?:NAN|INF|INFINITY))/giy,matrix:/matrix/gy,translate:/translate/gy,rotate:/rotate/gy,scale:/scale/gy,skewX:/skewX/gy,skewY:/skewY/gy,color:/[a-zA-Z]+|#[\da-fA-F]+|rgba?\(.*?\)/gy,url:/url\("?(.*?)"?\)/gy,path:/[mMlLhHvVqQtTcCsSaAzZ]/gy}),ge=.0254,fe=ge/6,me=ge/90,Ae=16;function _e(e){r.A.call(this,e),A.call(this),this.removeEmptyGroups=!0,this.combineGroupingNodes=!0,this.solid=!1,this.viewBox=new ee.A(0,0,100,100),this.modelMatrix=new ce.A(u.A),this.fillGeometries=new Map,this.strokeGeometries=new Map,this.lineProperties=new Map,this.tessy=this.createTesselator(),this.context=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),this.numSwitchNodes=0,this.styles=[{display:"inline",fillType:"COLOR",fillColor:S.A.BLACK,fillURL:"",fillOpacity:1,fillRule:"nonzero",strokeType:"none",strokeColor:S.A.BLACK,strokeURL:"",strokeOpacity:1,strokeWidth:1,opacity:1,stopColor:S.A.BLACK,stopOpacity:1,vectorEffect:"none"}];const t=e.getBrowser();switch(t.getBrowserOption("PrimitiveQuality")){case"LOW":this.BEZIER_STEPS=9,this.CIRCLE_STEPS=20;break;case"HIGH":this.BEZIER_STEPS=15,this.CIRCLE_STEPS=64;break;default:this.BEZIER_STEPS=12,this.CIRCLE_STEPS=32}switch(t.getBrowserOption("TextureQuality")){case"LOW":this.GRADIENT_SIZE=128;break;case"HIGH":this.GRADIENT_SIZE=512;break;default:this.GRADIENT_SIZE=256}this.context.canvas.width=this.GRADIENT_SIZE,this.context.canvas.height=this.GRADIENT_SIZE}Object.assign(Object.setPrototypeOf(_e.prototype,r.A.prototype),A.prototype,{CONSTANTS:new Map([["NAN",NaN],["INF",1/0],["INFINITY",1/0]]),getEncoding:()=>"XML",setInput(e){try{"string"==typeof e&&(e=ue.parseXML(e)),this.input=e}catch{this.input=void 0}},isValid(){return this.input instanceof XMLDocument&&(!!ue(this.input).children("svg").length||"svg"===this.input.nodeName)},parseIntoScene(e,t){this.xmlElement(this.input).then(e).catch(t)},async xmlElement(e){switch(e.nodeName){case"#document":{const t=ue(e).children("svg");for(const e of t)await this.svgElement(e);break}case"svg":await this.svgElement(e)}return this.getScene()},async svgElement(e){const t=this.getBrowser(),i=this.getScene();i.setEncoding("SVG"),i.setProfile(t.getProfile("Interchange")),i.addComponent(t.getComponent("Geometry2D",2)),await t.loadComponents(i),this.document=this.input,this.rootTransform=i.createNode("Transform"),this.groupNodes=[this.rootTransform],this.texturePropertiesNode=this.createTextureProperties();const n=i.createNode("Background");n.skyColor=[1,1,1],i.getRootNodes().push(n);const s=i.createNode("NavigationInfo");s.type=["PLANE","PLANE_create3000.github.io","EXAMINE","ANY"];const r=this.lengthAttribute(e.getAttribute("width"),300,"width"),o=this.lengthAttribute(e.getAttribute("height"),150,"height"),a=this.viewBox.set(0,0,r,o),l=this.viewBoxAttribute(e.getAttribute("viewBox"),a),c=this.lengthAttribute(e.getAttribute("width"),l[2],"width"),u=this.lengthAttribute(e.getAttribute("height"),l[3],"height");{const e=c/u;l[2]/l[3]>e?l[3]+=l[2]/e-l[3]:l[2]+=l[3]*e-l[2]}const d=i.createNode("OrthoViewpoint"),p=(l.x+c/2)*me,g=-(l.y+u/2)*me;d.navigationInfo=s,d.position=new h.A(p,g,10),d.centerOfRotation=new h.A(p,g,0),d.fieldOfView=[-c/2*me,-u/2*me,c/2*me,u/2*me],i.getRootNodes().push(d);const f=new h.A(c*me/l[2],-u*me/l[3],1);this.rootTransform.scale=f,this.elements(e),i.addNamedNode(i.getUniqueName("ViewBox"),this.rootTransform),i.addExportedNode(i.getUniqueExportName("ViewBox"),this.rootTransform),i.getRootNodes().push(this.rootTransform),this.optimizeSceneGraph(i.getRootNodes())},elements(e){for(const t of e.childNodes)this.element(t)},element(e){switch(e.nodeName){case"use":return this.useElement(e);case"g":return this.gElement(e);case"switch":return this.switchElement(e);case"a":return this.aElement(e);case"rect":return this.rectElement(e);case"circle":return this.circleElement(e);case"ellipse":return this.ellipseElement(e);case"text":return this.textElement(e);case"image":return this.imageElement(e);case"polyline":return this.polylineElement(e);case"polygon":return this.polygonElement(e);case"path":return this.pathElement(e)}},useElement(e){const t=this.hrefAttribute(e.getAttribute("href")||e.getAttribute("xlink:href"));if(!t)return;if(!this.styleAttributes(e))return;const i=this.lengthAttribute(e.getAttribute("x"),0,"width"),n=this.lengthAttribute(e.getAttribute("y"),0,"height"),s=this.createTransform(e,new w.A(i,n));this.groupNodes.push(s),this.element(t),this.popAll()},gElement(e){if(!this.styleAttributes(e))return;const t=this.createTransform(e);this.groupNodes.push(t),this.elements(e),this.popAll()},switchElement(e){if(!this.styleAttributes(e))return;const t=this.getExecutionContext(),i=this.createTransform(e),n=t.createNode("Switch");i.children.push(n),n.whichChoice=0,t.addExportedNode(t.getUniqueExportName("Switch"+ ++this.numSwitchNodes),node),this.groupNodes.push(n),this.elements(e),this.popAll()},aElement(e){if(!this.styleAttributes(e))return;const t=e.getAttribute("href")||e.getAttribute("xlink:href"),i=e.getAttribute("title")||e.getAttribute("xlink:title"),n=e.getAttribute("target"),s=this.getExecutionContext(),r=this.createTransform(e),o=s.createNode("Anchor");r.children.push(o),o.description=i,o.url=[t],n&&(o.parameter=[`target=${n}`]),this.groupNodes.push(o),this.elements(e),this.popAll()},rectElement(e){const t=this.lengthAttribute(e.getAttribute("x"),0,"width"),i=this.lengthAttribute(e.getAttribute("y"),0,"height"),n=this.lengthAttribute(e.getAttribute("width"),0,"width"),s=this.lengthAttribute(e.getAttribute("height"),0,"height");let r=Math.max(0,this.lengthAttribute(e.getAttribute("rx"),0,"width")),o=Math.max(0,this.lengthAttribute(e.getAttribute("ry"),0,"height"));if(0===r&&0===o){if(!this.styleAttributes(e))return;const r=this.getExecutionContext(),o=new w.A(n,s),a=new w.A(t+n/2,i+s/2),l=new re(o,a),h=this.createTransform(e,a);if(this.groupNodes.push(h),"none"!==this.style.fillType){const t=r.createNode("Shape"),i=this.fillGeometries.get(e);if(h.children.push(t),t.appearance=this.createFillAppearance(l),i)t.geometry=i;else{const i=r.createNode("Rectangle2D");this.fillGeometries.set(e,i),t.geometry=i,i.solid=this.solid,i.size=o}}if("none"!==this.style.strokeType){const t=r.createNode("Shape"),i=this.strokeGeometries.get(e);if(h.children.push(t),t.appearance=this.createStrokeAppearance(),i)t.geometry=i;else{const i=r.createNode("Polyline2D"),o=n/2,a=s/2;this.strokeGeometries.set(e,i),t.geometry=i,i.lineSegments=[o,a,-o,a,-o,-a,o,-a,o,a]}}this.popAll()}else{r&&!o&&(o=r),o&&!r&&(r=o),r=Math.min(r,n/2),o=Math.min(o,s/2);const a=[t+n-r,t+r,t+r,t+n-r],l=[i+s-o,i+s-o,i+o,i+o],c=Object.assign([],{closed:!0});for(let e=0;e<4;++e){const t=e*Math.PI/2;for(let i=0,n=this.CIRCLE_STEPS/4;i<n;++i){const s=ie.A.Polar(1,t+Math.PI/2*i/(n-1));c.push(new h.A(a[e]+s.real*r,l[e]+s.imag*o,0))}}c.pop(),this.pathLikeElement(e,[c])}},circleElement(e){if(!this.styleAttributes(e))return;const t=this.lengthAttribute(e.getAttribute("cx"),0,"width"),i=this.lengthAttribute(e.getAttribute("cy"),0,"height"),n=this.lengthAttribute(e.getAttribute("r"),0),s=this.getExecutionContext(),r=new re(new w.A(2*n,2*n),new w.A(t,i)),o=this.createTransform(e,new w.A(t,i));if(this.groupNodes.push(o),"none"!==this.style.fillType){const t=s.createNode("Shape"),i=this.fillGeometries.get(e);if(o.children.push(t),t.appearance=this.createFillAppearance(r),i)t.geometry=i;else{const i=s.createNode("Disk2D");this.fillGeometries.set(e,i),t.geometry=i,i.solid=this.solid,i.outerRadius=n}}if("none"!==this.style.strokeType){const t=s.createNode("Shape"),i=this.strokeGeometries.get(e);if(o.children.push(t),t.appearance=this.createStrokeAppearance(),i)t.geometry=i;else{const i=s.createNode("Circle2D");this.strokeGeometries.set(e,i),t.geometry=i,i.radius=n}}this.popAll()},ellipseElement(e){if(!this.styleAttributes(e))return;const t=this.lengthAttribute(e.getAttribute("cx"),0,"width"),i=this.lengthAttribute(e.getAttribute("cy"),0,"height"),n=this.lengthAttribute(e.getAttribute("rx"),0,"width"),s=this.lengthAttribute(e.getAttribute("ry"),0,"height"),r=this.getExecutionContext(),o=Math.min(n,s),a=new re(new w.A(2*n,2*s),new w.A(t,i)),l=this.createTransform(e,new w.A(t,i),new w.A(n/o,s/o));if(this.groupNodes.push(l),"none"!==this.style.fillType){const t=r.createNode("Shape"),i=this.fillGeometries.get(e);if(l.children.push(t),t.appearance=this.createFillAppearance(a),i)t.geometry=i;else{const i=r.createNode("Disk2D");this.fillGeometries.set(e,i),t.geometry=i,i.solid=this.solid,i.outerRadius=o}}if("none"!==this.style.strokeType){const t=r.createNode("Shape"),i=this.strokeGeometries.get(e);if(l.children.push(t),t.appearance=this.createStrokeAppearance(),i)t.geometry=i;else{const i=r.createNode("Circle2D");this.strokeGeometries.set(e,i),t.geometry=i,i.radius=o}}this.popAll()},textElement(e){},imageElement(e){const t=this.fillGeometries.get(e);if(t)this.groupNodes.at(-1).children.push(t);else{if(!this.styleAttributes(e))return;const t=this.lengthAttribute(e.getAttribute("x"),0,"width"),i=this.lengthAttribute(e.getAttribute("y"),0,"height"),n=this.lengthAttribute(e.getAttribute("width"),0,"width"),s=this.lengthAttribute(e.getAttribute("height"),0,"height"),r=e.getAttribute("href")||e.getAttribute("xlink:href"),o=this.getExecutionContext(),a=this.createTransform(e,new w.A(t+n/2,i+s/2),new w.A(1,-1));this.fillGeometries.set(e,a),this.groupNodes.push(a);const l=o.createNode("Shape"),h=o.createNode("Appearance"),c=o.createNode("ImageTexture"),u=o.createNode("Rectangle2D");l.appearance=h,l.geometry=u,h.texture=c,c.url=[r],c.textureProperties=this.texturePropertiesNode,u.solid=this.solid,u.size=new w.A(n,s),a.children.push(l),this.popAll()}},polylineElement(e){const t=[];this.pointsAttribute(e.getAttribute("points"),t)&&this.pathLikeElement(e,[t])},polygonElement(e){const t=Object.assign([],{closed:!0});this.pointsAttribute(e.getAttribute("points"),t)&&this.pathLikeElement(e,[t])},pathElement(e){const t=[];this.dAttribute(e.getAttribute("d"),t)&&this.pathLikeElement(e,t)},pathLikeElement(e,t){if(!this.styleAttributes(e))return;t=t.map(e=>e.closed?Object.assign(e.filter((e,t,i)=>e.distance(i[(t+1)%i.length])>1e-9),{closed:!0}):e.filter((e,t,i)=>!t||e.distance(i[t-1])>1e-9)).filter(e=>e.length>2),t.forEach((e,t,i)=>e.index=t?i[t-1].index+i[t-1].length:0);const i=this.getExecutionContext(),n=this.createTransform(e),s=new re;for(const e of t)s.add(re.Points(e));this.groupNodes.push(n);const r=i.createNode("Coordinate"),o=r.point;for(const e of t)for(const t of e)o.push(t);if("none"!==this.style.fillType){const o=i.createNode("Shape"),a=this.fillGeometries.get(e);if(n.children.push(o),o.appearance=this.createFillAppearance(s),a)o.geometry=a;else{const n=i.createNode("IndexedTriangleSet");this.fillGeometries.set(e,n),o.geometry=n,n.solid=this.solid,n.index=this.triangulatePolygon(t,r),n.texCoord=this.createTextureCoordinate(r,s,o.appearance),n.coord=r}}if("none"!==this.style.strokeType){const s=i.createNode("Shape"),o=this.strokeGeometries.get(e);if(n.children.push(s),s.appearance=this.createStrokeAppearance(),o)s.geometry=o;else{const n=i.createNode("IndexedLineSet");this.strokeGeometries.set(e,n),s.geometry=n,n.coord=r;const o=[];for(const e of t){for(const t of e.keys())o.push(e.index+t);e.closed&&o.push(e.index),o.push(-1)}n.coordIndex=o}}this.popAll()},linearGradientElementUrl(e,t){const i=this.linearGradientElement(e,t,{stops:[]}),n=this.context.createLinearGradient(i.x1,i.y1,i.x2,i.y2);return this.drawGradient(n,i,t)},linearGradientElement(e,t,i){if("linearGradient"!==e.nodeName)return;const n=this.hrefAttribute(e.getAttribute("href")||e.getAttribute("xlink:href"));n&&this.gradientElement(n,t,i),i.x1=this.lengthAttribute(e.getAttribute("x1"),i.x1||0,"width"),i.y1=this.lengthAttribute(e.getAttribute("y1"),i.y1||0,"height"),i.x2=this.lengthAttribute(e.getAttribute("x2"),i.x2||1,"width"),i.y2=this.lengthAttribute(e.getAttribute("y2"),i.y2||0,"height"),i.units=e.getAttribute("gradientUnits")||"objectBoundingBox",i.transform=this.transformAttribute(e.getAttribute("gradientTransform"));const s=new te.A,r=new w.A(i.x1,i.y1);s.translate(r),s.scale(new w.A(Ae,Ae)),s.translate(r.negate()),i.spreadMatrix=s;for(const t of e.childNodes)this.gradientChild(t,i);return i},radialGradientElementUrl(e,t){const i=this.radialGradientElement(e,t,{stops:[]}),n=this.context.createRadialGradient(i.fx,i.fy,i.fr,i.cx,i.cy,i.r);return this.drawGradient(n,i,t)},radialGradientElement(e,t,i){const n=this.hrefAttribute(e.getAttribute("href")||e.getAttribute("xlink:href"));n&&this.gradientElement(n,t,i),i.cx=this.lengthAttribute(e.getAttribute("cx"),i.cx||.5,"width"),i.cy=this.lengthAttribute(e.getAttribute("cy"),i.cy||.5,"height"),i.r=this.lengthAttribute(e.getAttribute("r"),i.r||.5),i.fx=this.lengthAttribute(e.getAttribute("fx"),i.fx||i.cx,"width"),i.fy=this.lengthAttribute(e.getAttribute("fy"),i.fy||i.cy,"height"),i.fr=this.lengthAttribute(e.getAttribute("fr"),i.fr||0),i.units=e.getAttribute("gradientUnits")||"objectBoundingBox",i.spreadMethod=e.getAttribute("spreadMethod"),i.transform=this.transformAttribute(e.getAttribute("gradientTransform"));const s=new te.A,r=new w.A(i.fx,i.fy);s.translate(r),s.scale(new w.A(Ae)),s.translate(r.negate()),i.spreadMatrix=s;for(const t of e.childNodes)this.gradientChild(t,i);return i},gradientElement(e,t,i){if(e)switch(e.nodeName){case"linearGradient":return this.linearGradientElement(e,t,i);case"radialGradient":return this.radialGradientElement(e,t,i)}},gradientChild(e,t){if("stop"===e.nodeName)return this.stopElement(e,t)},stopElement(e,t){if(!this.styleAttributes(e))return;const i=this.percentAttribute(e.getAttribute("offset"),0);if(i<0||i>1)return;const{stopColor:n,stopOpacity:s}=this.style;t.stops.push([i,n,s]),this.styles.pop()},drawGradient(e,t,i){switch(t.spreadMethod){default:t.spreadMatrix.identity();for(const[i,n,s]of t.stops)e.addColorStop(i,this.cssColor(n,s));break;case"repeat":for(let i=0;i<Ae;++i){const n=i/Ae;for(const[i,s,r]of t.stops)e.addColorStop(n+i/Ae,this.cssColor(s,r))}break;case"reflect":for(let i=0;i<Ae;++i){const n=i/Ae;for(const[s,r,o]of t.stops)e.addColorStop(n+(i%2?1-s:s)/Ae,this.cssColor(r,o))}}const n=new te.A;n.scale(new w.A(this.GRADIENT_SIZE/2)),n.translate(w.A.ONE),n.scale(new w.A(1,-1)),"userSpaceOnUse"===t.units?n.multLeft(i.matrix.copy().inverse()):n.multLeft(new te.A(2,0,0,0,2,0,-1,-1,1)),n.multLeft(t.transform),n.multLeft(t.spreadMatrix);const s=this.context;return s.fillStyle=e,s.save(),s.clearRect(0,0,this.GRADIENT_SIZE,this.GRADIENT_SIZE),s.rect(0,0,this.GRADIENT_SIZE,this.GRADIENT_SIZE),s.transform(n[0],n[1],n[3],n[4],n[6],n[7]),s.fill(),s.restore(),this.context.canvas.toDataURL("image/png")},patternUrl(e){},idAttribute(e,t){if(null===e)return;const i=this.getExecutionContext(),n=this.sanitizeName(e);n&&(i.addNamedNode(i.getUniqueName(n),t),i.addExportedNode(i.getUniqueExportName(n),t))},viewBoxAttribute(e,t){if(null===e)return t;if(this.parseValue(e),this.double()){const e=this.value;if(this.double()){const t=this.value;if(this.double()){const i=this.value;if(this.double()){const n=this.value;return new ee.A(e,t,i,n)}}}}return t},hrefAttribute(e){if(!e)return;const t=this.getExecutionContext(),i=new URL(e,t.getBaseURL()).hash.slice(1);return this.document.getElementById(i)},lengthAttribute(e,t,i){if(null===e)return t;if(this.parseValue(e),this.double()){let e=this.value;if(pe.length.parse(this))switch(this.result[0]){case"em":e*=16;break;case"ex":case"px":break;case"in":e*=90;break;case"cm":e*=.01/me;break;case"mm":e*=.001/me;break;case"pt":e*=1.25;break;case"pc":e*=fe/me;break;case"%":switch(i){case"width":e*=this.viewBox[2]/100;break;case"height":e*=this.viewBox[3]/100;break;default:e*=Math.hypot(this.viewBox[2],this.viewBox[3])/100}}return e}return t},percentAttribute(e,t){if(this.parseValue(e),this.double()){let e=this.value;return pe.percent.parse(this)&&(e/=100),y.A.clamp(e,0,1)}return t},pointsAttribute(e,t){if(null===e)return!1;for(this.parseValue(e);;){if(this.double()){const e=this.value;if(this.comma()&&this.double()){const i=this.value;if(t.push(new h.A(e,i,0)),this.comma())continue}}break}return!!t.length},dAttribute(e,t){if(null===e)return!1;this.parseValue(e);let i=[],n="",s="",r=!1,o=0,a=0,l=0,c=0;for(;this.whitespaces(),pe.path.parse(this);){switch(n=s,s=this.result[0],r=s===s.toLowerCase(),s){case"m":case"M":for(i.length>2&&t.push(Object.assign(i,{closed:!1})),i=[];;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t=this.value;r&&(e+=o,t+=a),i.push(new h.A(e,t,0)),o=e,a=t,this.comma();continue}}break}continue;case"l":case"L":for(;;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t=this.value;r&&(e+=o,t+=a),i.push(new h.A(e,t,0)),o=e,a=t,this.comma();continue}}break}continue;case"h":case"H":for(;;){if(this.double()){let e=this.value;r&&(e+=o),i.push(new h.A(e,a,0)),o=e,this.comma();continue}break}continue;case"v":case"V":for(;this;){if(this.double()){let e=this.value;r&&(e+=a),i.push(new h.A(o,e,0)),a=e,this.comma();continue}break}continue;case"q":case"Q":for(;;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t=this.value;if(this.comma(),this.double()){let n=this.value;if(this.comma(),this.double()){let s=this.value;r&&(e+=o,t+=a,n+=o,s+=a),he.quadric(o,a,0,e,t,0,n,s,0,this.BEZIER_STEPS,i),o=n,a=s,l=e,c=t,this.comma();continue}}}}break}continue;case"t":case"T":for(;;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t,s,h=this.value;switch(r&&(e+=o,h+=a),n){case"Q":case"q":case"T":case"t":t=o+(o-l),s=a+(a-c);break;default:t=o,s=a}he.quadric(o,a,0,t,s,0,e,h,0,this.BEZIER_STEPS,i),o=e,a=h,this.comma();continue}}break}continue;case"c":case"C":for(;;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t=this.value;if(this.comma(),this.double()){let n=this.value;if(this.comma(),this.double()){let s=this.value;if(this.comma(),this.double()){let h=this.value;if(this.comma(),this.double()){let u=this.value;r&&(e+=o,t+=a,n+=o,s+=a,h+=o,u+=a),he.cubic(o,a,0,e,t,0,n,s,0,h,u,0,this.BEZIER_STEPS,i),o=h,a=u,l=n,c=s,this.comma();continue}}}}}}break}continue;case"s":case"S":for(;;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t=this.value;if(this.comma(),this.double()){let s=this.value;if(this.comma(),this.double()){let h,u,d=this.value;switch(r&&(e+=o,t+=a,s+=o,d+=a),n){case"C":case"c":case"S":case"s":h=o+(o-l),u=a+(a-c);break;default:h=o,u=a}he.cubic(o,a,0,h,u,0,e,t,0,s,d,0,this.BEZIER_STEPS,i),o=s,a=d,l=e,c=t,this.comma();continue}}}}break}continue;case"a":case"A":for(;;){if(this.double()){let e=this.value;if(this.comma(),this.double()){let t=this.value;if(this.comma(),this.double()){let n=y.A.radians(this.value);if(this.comma(),this.int32()){let s=this.value;if(this.comma(),this.int32()){let l=this.value;if(this.comma(),this.double()){let h=this.value;if(this.comma(),this.double()){let c=this.value;r&&(h+=o,c+=a),he.arc(o,a,e,t,n,s,l,h,c,this.CIRCLE_STEPS,i),o=h,a=c,this.comma();continue}}}}}}}break}continue;case"z":case"Z":i.length>2&&(o=i[0].x,a=i[0].y,t.push(Object.assign(i,{closed:!0}))),i=[],this.comma();continue}break}return i.length>2&&t.push(Object.assign(i,{closed:!1})),!!t.length},transformAttribute(e){const t=new te.A;if(null===e)return t;for(this.parseValue(e);;){if(this.comma(),this.whitespaces(),pe.matrix.parse(this)){if(this.whitespaces(),pe.openParenthesis.parse(this)&&this.double()){const e=this.value;if(this.comma()&&this.double()){const i=this.value;if(this.comma()&&this.double()){const n=this.value;if(this.comma()&&this.double()){const s=this.value;if(this.comma()&&this.double()){const r=this.value;if(this.comma()&&this.double()){const o=this.value;if(this.whitespaces(),pe.closeParenthesis.parse(this)){t.multLeft(new te.A(e,i,0,n,s,0,r,o,1));continue}}}}}}}}else if(pe.translate.parse(this)){if(this.whitespaces(),pe.openParenthesis.parse(this)&&this.double()){const e=this.value;let i;if(this.comma()?this.double()&&(i=this.value):i=0,this.whitespaces(),pe.closeParenthesis.parse(this)){t.translate(new w.A(e,i));continue}}}else if(pe.rotate.parse(this)){if(this.whitespaces(),pe.openParenthesis.parse(this)&&this.double()){const e=this.value;if(this.whitespaces(),pe.closeParenthesis.parse(this)){t.rotate(y.A.radians(e));continue}if(this.comma()&&this.double()){const i=this.value;if(this.comma()&&this.double()){const n=this.value;if(this.whitespaces(),pe.closeParenthesis.parse(this)){t.translate(new w.A(i,n)),t.rotate(y.A.radians(e)),t.translate(new w.A(-i,-n));continue}}}}}else if(pe.scale.parse(this)){if(this.whitespaces(),pe.openParenthesis.parse(this)&&this.double()){const e=this.value;let i;if(this.comma()?this.double()&&(i=this.value):i=e,this.whitespaces(),pe.closeParenthesis.parse(this)){t.scale(new w.A(e,i));continue}}}else if(pe.skewX.parse(this)){if(this.whitespaces(),pe.openParenthesis.parse(this)&&this.double()){const e=this.value;if(this.whitespaces(),pe.closeParenthesis.parse(this)){t.skewX(y.A.radians(e));continue}}}else if(pe.skewY.parse(this)&&(this.whitespaces(),pe.openParenthesis.parse(this)&&this.double())){const e=this.value;if(this.whitespaces(),pe.closeParenthesis.parse(this)){t.skewY(y.A.radians(e));continue}}break}return t},styleAttributes(e){const t=Object.assign({},this.styles.at(-1));if("none"===this.style.display)return!1;this.styles.push(t);for(const t of e.attributes)this.parseStyle(t.name,t.value);return this.styleAttribute(e.getAttribute("style")),!0},styleAttribute(e){if(null===e)return;const t=e.split(";");for(const e of t){const t=e.split(":");2===t.length&&this.parseStyle(t[0].trim(),t[1].trim())}},parseStyle(e,t){if("inherit"!==t&&"unset"!=t)switch(this.parseValue(t),e){case"display":this.displayStyle(t);break;case"fill":this.fillStyle(t);break;case"fill-opacity":this.fillOpacityStyle(t);break;case"fill-rule":this.fillRuleStyle(t);break;case"stroke":this.strokeStyle(t);break;case"stroke-opacity":this.strokeOpacityStyle(t);break;case"stroke-width":this.strokeWidthStyle(t);break;case"opacity":this.opacityStyle(t);break;case"stop-color":this.stopColorStyle(t);break;case"stop-opacity":this.stopOpacityStyle(t);break;case"vector-effect":this.vectorEffectStyle(t)}},displayStyle(e){this.style.display="default"!==e?e:"inline"},fillStyle(e){if("default"===e)return this.style.fillType=this.styles[0].fillType,this.style.fillColor=this.styles[0].fillColor,void(this.style.fillURL=this.styles[0].fillURL);if("transparent"!==e){if("none"!==e)return this.urlValue()?(this.style.fillType="URL",void(this.style.fillURL=this.result[1].trim())):this.colorValue(this.styles.at(-1).fillColor)?(this.style.fillType="COLOR",void(this.style.fillColor=this.value.copy())):void 0;this.style.fillType="none"}else this.style.fillType="none"},fillOpacityStyle(e){"default"!==e?"transparent"!==e?this.double()&&(this.style.fillOpacity=y.A.clamp(this.value,0,1)):this.style.fillOpacity=0:this.style.fillOpacity=this.styles[0].fillOpacity},fillRuleStyle(e){this.style.fillRule="default"!==e?e:this.styles[0].fillRule},strokeStyle(e){if("default"===e)return this.style.strokeType=this.styles[0].strokeType,this.style.strokeColor=this.styles[0].strokeColor,void(this.style.strokeURL=this.styles[0].strokeURL);if("transparent"!==e){if("none"!==e)return this.urlValue()?(this.style.strokeType="URL",void(this.style.strokeURL=this.result[1].trim())):this.colorValue(this.styles.at(-1).strokeColor)?(this.style.strokeType="COLOR",void(this.style.strokeColor=this.value.copy())):void 0;this.style.strokeType="none"}else this.style.strokeType="none"},strokeOpacityStyle(e){"default"!==e?"transparent"!==e?this.double()&&(this.style.strokeOpacity=y.A.clamp(this.value,0,1)):this.style.strokeOpacity=0:this.style.strokeOpacity=this.styles[0].strokeOpacity},strokeWidthStyle(e){"default"!==e?"none"!==e?this.double()&&(this.style.strokeWidth=this.lengthAttribute(this.value,1)):this.style.strokeWidth=0:this.style.strokeWidth=this.styles[0].strokeWidth},opacityStyle(e){"default"!==e?"transparent"!==e?this.double()&&(this.style.opacity=y.A.clamp(this.value,0,1)*this.styles.at(-1).opacity):this.style.opacity=0:this.style.opacity=this.styles[0].opacity},stopColorStyle(e){"default"!==e?this.colorValue(S.A.BLACK)&&(this.style.stopColor=this.value.copy()):this.style.stopColor=this.styles[0].stopColor},stopOpacityStyle(e){"default"!==e?"transparent"!==e?this.double()&&(this.style.stopOpacity=y.A.clamp(this.value,0,1)):this.style.stopOpacity=0:this.style.stopOpacity=this.styles[0].stopOpacity},vectorEffectStyle(e){this.style.vectorEffect="default"!==e?e:this.styles[0].vectorEffect},parseValue(e){this.input=e,this.lastIndex=0,this.value=void 0},whitespaces(){return pe.whitespaces.parse(this)},comma(){return!!(this.whitespaces()|pe.comma.parse(this))},int32(){return this.whitespaces(),!!pe.int32.parse(this)&&(this.value=parseInt(this.result[0]),!0)},double(){return this.whitespaces(),pe.double.parse(this)?(this.value=parseFloat(this.result[0]),!0):!!pe.constants.parse(this)&&(this.value=this.CONSTANTS.get(this.result[2].toUpperCase()),"-"===this.result[1]&&(this.value=-this.value),!0)},colorValue:(()=>{const e=new S.A;return function(t){if(!pe.color.parse(this))return!1;const i=this.cssColor(t);return this.value=e.set(...this.convertColor(this.result[0],i)),!0}})(),urlValue(){return pe.url.parse(this)},cssColor:(e,t=e.a)=>`rgba(${255*e.r},${255*e.g},${255*e.b},${t})`,createTransform(e,t=w.A.ZERO,i=w.A.ONE){const n=this.getExecutionContext(),s=this.transformAttribute(e.getAttribute("transform"));this.modelMatrix.push(),this.modelMatrix.multLeft(u.A.Matrix3(s)),s.translate(t),s.scale(i);const r=n.createNode("Transform"),o=u.A.Matrix3(s),a=new h.A,l=new c.A,d=new h.A(1),p=new c.A;return o.get(a,l,d,p),r.translation=a,r.rotation=l,r.scale=d,r.scaleOrientation=p,this.idAttribute(e.getAttribute("id"),r),this.groupNodes.at(-1).children.push(r),r},popAll(){this.groupNodes.pop(),this.modelMatrix.pop(),this.styles.pop()},createFillAppearance(e){const t=this.getExecutionContext(),i=t.createNode("Appearance");switch(this.style.fillType){case"none":return null;case"COLOR":{const e=t.createNode("UnlitMaterial");i.material=e,e.emissiveColor=new b.A(...this.style.fillColor),e.transparency=1-this.style.fillOpacity*this.style.opacity;break}case"URL":{const t=this.getExecutionContext().createNode("ImageTexture"),n=this.getFillUrl(this.style.fillURL,e);if(!n)return null;t.url=[n],t.textureProperties=this.texturePropertiesNode,i.texture=t;break}}return i},getFillUrl(e,t){const i=this.hrefAttribute(e);if(i)switch(i.nodeName){case"linearGradient":return this.linearGradientElementUrl(i,t);case"radialGradient":return this.radialGradientElementUrl(i,t);case"pattern":return this.patternUrl(i)}},createStrokeAppearance(){const e=this.getExecutionContext(),t=e.createNode("Appearance"),i=e.createNode("UnlitMaterial");t.material=i,i.emissiveColor=new b.A(...this.style.strokeColor),i.transparency=1-this.style.strokeOpacity*this.style.opacity;const n="non-scaling-stroke"===this.vectorEffect?this.style.strokeWidth:this.getStokeWidth();return n>1&&(t.lineProperties=this.getLineProperties(n)),t},getStokeWidth(){const e=this.modelMatrix.get().multDirMatrix(new h.A(this.style.strokeWidth,this.style.strokeWidth,0));return(e.x+e.y)/2},getLineProperties(e){const t=this.lineProperties.get(e);if(t)return t;{const t=this.getExecutionContext().createNode("LineProperties");return t.linewidthScaleFactor=e,this.lineProperties.set(e,t),t}},createTextureProperties(){const e=this.getExecutionContext().createNode("TextureProperties");return e.generateMipMaps=!0,e.minificationFilter="NICEST",e.magnificationFilter="NICEST",e.boundaryModeS="CLAMP_TO_EDGE",e.boundaryModeT="CLAMP_TO_EDGE",e.boundaryModeR="CLAMP_TO_EDGE",e.textureCompression="DEFAULT",e},createTextureCoordinate(e,t,i){if(!i||!i.texture)return null;const n=this.getExecutionContext().createNode("TextureCoordinate"),s=t.matrix.copy().inverse();for(const t of e.point)n.point.push(s.multVecMatrix(new w.A(t.x,t.y)).add(w.A.ONE).divide(2));return n},createTesselator(){const e=new de.GluTesselator;return e.gluTessCallback(de.gluEnum.GLU_TESS_VERTEX_DATA,function(e,t){t.push(e)}),e.gluTessNormal(0,0,1),e},triangulatePolygon(e,t){const i=t.point;const n=this.tessy,s="evenodd"===this.style.fillRule?"GLU_TESS_WINDING_ODD":"GLU_TESS_WINDING_NONZERO",r=[];n.gluTessProperty(de.gluEnum.GLU_TESS_WINDING_RULE,de.windingRule[s]),n.gluTessCallback(de.gluEnum.GLU_TESS_COMBINE,function(e,t,n){const s=i.length;return i.push(new h.A(...e)),s}),n.gluTessBeginPolygon(r);for(const t of e){n.gluTessBeginContour();for(const[e,i]of t.entries())n.gluTessVertex(i,t.index+e);n.gluTessEndContour()}return n.gluTessEndPolygon(),r}}),Object.defineProperty(_e.prototype,"style",{get(){return this.styles.at(-1)}});const ye=_e,we=g.A.add("SVGParser",ye);var xe=i(9340);class be extends r.A{#V=new Map;static#D=[we,l.A,E,F,o.A,a.A,k,z,$,K,J];static addParsers(...e){this.#D.push(...e)}static removeParsers(...e){this.#D=this.#D.filter(t=>!e.includes(t))}static getParsers(){return this.#D.slice()}static get Parser(){return this.#D}parseIntoScene(e,t,i){for(const n of be.#D)try{const s=new n(this.getScene()),r=this.getInput(s.getEncoding(),e);if(Array.isArray(r)?r.some(e=>void 0===e):void 0===r)continue;if(s.setInput(r),!s.isValid())continue;return s.pushExecutionContext(this.getExecutionContext()),void s.parseIntoScene(t,i)}catch(e){if(!i)throw e;return void i(e)}throw this.getScene().worldURL.startsWith("data:")?new Error("Couldn't parse X3D. No suitable file handler found for 'data:' URL."):new Error(`Couldn't parse X3D. No suitable file handler found for '${this.getScene().worldURL}'.`)}getInput(e,t){if(Array.isArray(e))return e.map(e=>this.getInput(e));{if(this.#V.has(e))return this.#V.get(e);const i=this.createInput(e,t);return this.#V.set(e,i),i}}createInput(e,t){try{switch(e){case"STRING":return xe.decodeText(t);case"XML":return xe.parseXML(this.getInput("STRING",t));case"JSON":return JSON.parse(this.getInput("STRING",t));case"ARRAY_BUFFER":return t instanceof ArrayBuffer?t:void 0}}catch{return}}}const Se=be,Te=g.A.add("GoldenGate",Se);var ve=i(1461),Oe=i(8625),Ee=i(9340);const Ne=new Set(["text/html","application/xhtml+xml"]);function Ce(e){n.A.call(this),this.node=e,this.browser=e.getBrowser(),this.executionContext=e.getExecutionContext(),this.target="",this.url=[],this.URL=new URL(this.getBaseURL()),this.controller=new AbortController}Object.assign(Object.setPrototypeOf(Ce.prototype,n.A.prototype),{abort(){this.url.length=0,this.controller.abort()},getURL(){return this.URL},getBaseURL(){return this.node instanceof ve.A?this.browser.getBaseURL():this.executionContext.getBaseURL()},getTarget(e){for(const t of e){const e=t.split("=");if(2===e.length&&"target"===e[0])return e[1]}return""},createX3DFromString(e,t="",i,n){try{const s=new Oe.A(this.browser);return this.node instanceof ve.A||s.setExecutionContext(this.executionContext),s.setWorldURL(new URL(e,this.getBaseURL())),s.setup(),i&&(i=this.setScene.bind(this,s,i,n)),new Te(s).parseIntoScene(t,i,n),s}catch(e){if(!n)throw e;n(e)}},setScene(e,t,i){e._loadCount.addInterest("set_loadCount__",this,e,t,i),e._loadCount.addEvent()},async set_loadCount__(e,t,i){try{if(e._loadCount.getValue())return;e._loadCount.removeInterest("set_loadCount__",this),await this.browser.nextFrame(),t(e)}catch(e){if(!i)throw e;i(e)}R.A&&"data:"!==this.URL.protocol&&console.info(`Done loading scene '${decodeURI(this.URL)}'.`)},createX3DFromURL(e,t,i,n,r){return this.bindViewpoint=n,this.foreign=r,this.target=this.getTarget(t||new s.A.MFString),this.loadDocument(e,this.createX3DFromURLAsync.bind(this,i))},createX3DFromURLAsync(e,t){null===t?e(null):this.createX3DFromString(this.URL,t,e,this.loadDocumentError.bind(this))},loadDocument(e,t){if(this.url=e.slice(),this.callback=t,0===e.length)return this.loadDocumentError(new Error("No URL given."));this.loadDocumentAsync(String(this.url.shift())).catch(this.loadDocumentError.bind(this))},async loadDocumentAsync(e){if(0===e.length)return void this.loadDocumentError(new Error("URL is empty."));{const t=e.match(/^\s*(?:ecmascript|javascript|vrmlscript)\:/s);if(t)return void await this.callback(e.substring(t[0].length))}this.URL=new URL(e,this.getBaseURL());{const t=e.match(/^\s*data:(.*?)(?:;charset=(.*?))?(?:;(base64))?,/s);if(t&&"base64"!==t[3]){let i=e.substring(t[0].length);return i=Ee.try(()=>decodeURIComponent(i))??i,i=i.replace(/^/,""),void await this.callback(i)}}if("data:"!==this.URL.protocol&&this.bindViewpoint){const e=new URL(this.getBaseURL());if(this.URL.protocol===e.protocol&&this.URL.hostname===e.hostname&&this.URL.port===e.port&&this.URL.pathname===e.pathname&&this.URL.hash)return void this.bindViewpoint(decodeURIComponent(this.URL.hash.substring(1)))}if(this.foreign){if(this.target.length&&"_self"!==this.target)return this.foreign(this.URL.href,this.target);if("data:"!==this.URL.protocol&&this.URL.href.match(/\.(?:html|htm|xhtml)$/))return this.foreign(this.URL.href,this.target)}const t={cache:this.node.getCache()?"default":"reload",signal:this.controller.signal},i=this.checkResponse(await fetch(this.URL,t)),n=i.headers.get("content-type")?.replace(/;.*$/,"");if(this.foreign&&Ne.has(n))return this.foreign(this.URL.href,this.target);await this.callback(Ee.ungzip(await i.arrayBuffer()),this.URL)},checkResponse(e){if(e.ok)return e;throw Error(e.statusText||e.status)},loadDocumentError(e){this.printError(e),this.url.length?this.loadDocumentAsync(String(this.url.shift())).catch(this.loadDocumentError.bind(this)):this.callback(null)},printError(e){const t=this.node instanceof ve.A?"":` of ${this.node.getTypeName()}`;"data:"===this.URL.protocol?console.error(`Couldn't load data URL${t}.`,e):console.error(`Couldn't load URL '${Ee.try(()=>decodeURI(this.URL))??this.URL}'${t}.`,e)}});for(const e of Object.keys(Ce.prototype))Object.defineProperty(Ce.prototype,e,{enumerable:!1});const Ie=Ce,Fe=g.A.add("FileLoader",Ie)},8944(e,t,i){i.d(t,{A:()=>o});var n=i(2696);const s=Object.assign([],{create(e){const t=this.pop()??new Set;return t.field=e,t.clear(),t},copy(e){const t=this.create(e.field);for(const i of e)t.add(i);return t},from(e){const t=this.create(e);return t.add(e),t}});for(const e of Object.keys(s))Object.defineProperty(s,e,{enumerable:!1});const r=s,o=n.A.add("Events",r)},9039(e,t,i){i.d(t,{A:()=>h});var n=i(5053),s=i(2696);const r=new Map,o=new Map,a={addConcreteNode({typeName:e,fieldDefinitions:t}){if(!r.has(e)){this.addNodeTypeName(e);for(const{name:e,accessType:i}of t)i&n.A.initializeOnly&&this.addFieldName(e)}},addNodeTypeName(e){r.set(e,e),r.set(e.toUpperCase(),e)},getNodeTypeName:e=>r.get(e),addFieldName(e){o.set(e,e),o.set(e.toLowerCase(),e)},getFieldName:e=>o.get(e)};a.addNodeTypeName("ProtoInstance");const l=a,h=s.A.add("HTMLSupport",l)},9101(e,t,i){i.d(t,{A:()=>l});var n=i(3097),s=i(5768),r=i(2696);function o(e=[]){return n.A.call(this,Array.from(e,e=>[e.getNodeName(),e]),s.A)}Object.setPrototypeOf(o.prototype,n.A.prototype);for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"NamedNodesArray",enumerable:!0}});const a=o,l=r.A.add("NamedNodesArray",a)},9340(e,t){var i,n,s;n="undefined"!=typeof window?window:this,s=function(n,s){var r=[],o=Object.getPrototypeOf,a=r.slice,l=r.flat?function(e){return r.flat.call(e)}:function(e){return r.concat.apply([],e)},h=r.push,c=r.indexOf,u={},d=u.toString,p=u.hasOwnProperty,g=p.toString,f=g.call(Object),m={},A=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},_=function(e){return null!=e&&e===e.window},y=n.document,w={type:!0,src:!0,nonce:!0,noModule:!0};function x(e,t,i){var n,s,r=(i=i||y).createElement("script");if(r.text=e,t)for(n in w)(s=t[n]||t.getAttribute&&t.getAttribute(n))&&r.setAttribute(n,s);i.head.appendChild(r).parentNode.removeChild(r)}function b(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?u[d.call(e)]||"object":typeof e}var S="3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween",T=/HTML$/i,v=function(e,t){return new v.fn.init(e,t)};function O(e){var t=!!e&&"length"in e&&e.length,i=b(e);return!A(e)&&!_(e)&&("array"===i||0===t||"number"==typeof t&&t>0&&t-1 in e)}function E(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}v.fn=v.prototype={jquery:S,constructor:v,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=v.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return v.each(this,e)},map:function(e){return this.pushStack(v.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(v.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(v.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,i=+e+(e<0?t:0);return this.pushStack(i>=0&&i<t?[this[i]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:r.sort,splice:r.splice},v.extend=v.fn.extend=function(){var e,t,i,n,s,r,o=arguments[0]||{},a=1,l=arguments.length,h=!1;for("boolean"==typeof o&&(h=o,o=arguments[a]||{},a++),"object"==typeof o||A(o)||(o={}),a===l&&(o=this,a--);a<l;a++)if(null!=(e=arguments[a]))for(t in e)n=e[t],"__proto__"!==t&&o!==n&&(h&&n&&(v.isPlainObject(n)||(s=Array.isArray(n)))?(i=o[t],r=s&&!Array.isArray(i)?[]:s||v.isPlainObject(i)?i:{},s=!1,o[t]=v.extend(h,r,n)):void 0!==n&&(o[t]=n));return o},v.extend({expando:"jQuery"+(S+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,i;return!(!e||"[object Object]"!==d.call(e)||(t=o(e))&&("function"!=typeof(i=p.call(t,"constructor")&&t.constructor)||g.call(i)!==f))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,i){x(e,{nonce:t&&t.nonce},i)},each:function(e,t){var i,n=0;if(O(e))for(i=e.length;n<i&&!1!==t.call(e[n],n,e[n]);n++);else for(n in e)if(!1===t.call(e[n],n,e[n]))break;return e},text:function(e){var t,i="",n=0,s=e.nodeType;if(!s)for(;t=e[n++];)i+=v.text(t);return 1===s||11===s?e.textContent:9===s?e.documentElement.textContent:3===s||4===s?e.nodeValue:i},makeArray:function(e,t){var i=t||[];return null!=e&&(O(Object(e))?v.merge(i,"string"==typeof e?[e]:e):h.call(i,e)),i},inArray:function(e,t,i){return null==t?-1:c.call(t,e,i)},isXMLDoc:function(e){var t=e&&e.namespaceURI,i=e&&(e.ownerDocument||e).documentElement;return!T.test(t||i&&i.nodeName||"HTML")},merge:function(e,t){for(var i=+t.length,n=0,s=e.length;n<i;n++)e[s++]=t[n];return e.length=s,e},grep:function(e,t,i){for(var n=[],s=0,r=e.length,o=!i;s<r;s++)!t(e[s],s)!==o&&n.push(e[s]);return n},map:function(e,t,i){var n,s,r=0,o=[];if(O(e))for(n=e.length;r<n;r++)null!=(s=t(e[r],r,i))&&o.push(s);else for(r in e)null!=(s=t(e[r],r,i))&&o.push(s);return l(o)},guid:1,support:m}),"function"==typeof Symbol&&(v.fn[Symbol.iterator]=r[Symbol.iterator]),v.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){u["[object "+t+"]"]=t.toLowerCase()});var N=r.pop,C=r.sort,I=r.splice,F="[\\x20\\t\\r\\n\\f]",M=new RegExp("^"+F+"+|((?:^|[^\\\\])(?:\\\\.)*)"+F+"+$","g");v.contains=function(e,t){var i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(e.contains?e.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))};var R=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function P(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}v.escapeSelector=function(e){return(e+"").replace(R,P)};var V=y,D=h;!function(){var e,t,i,s,o,l,h,u,d,g,f=D,A=v.expando,_=0,y=0,w=ee(),x=ee(),b=ee(),S=ee(),T=function(e,t){return e===t&&(o=!0),0},O="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",R="(?:\\\\[\\da-fA-F]{1,6}"+F+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",P="\\["+F+"*("+R+")(?:"+F+"*([*^$|!~]?=)"+F+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+F+"*\\]",L=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",B=new RegExp(F+"+","g"),k=new RegExp("^"+F+"*,"+F+"*"),j=new RegExp("^"+F+"*([>+~]|"+F+")"+F+"*"),U=new RegExp(F+"|>"),X=new RegExp(L),z=new RegExp("^"+R+"$"),G={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+L),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+O+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},H=/^(?:input|select|textarea|button)$/i,$=/^h\d$/i,Y=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,q=/[+~]/,W=new RegExp("\\\\[\\da-fA-F]{1,6}"+F+"?|\\\\([^\\r\\n\\f])","g"),K=function(e,t){var i="0x"+e.slice(1)-65536;return t||(i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320))},Z=function(){le()},Q=de(function(e){return!0===e.disabled&&E(e,"fieldset")},{dir:"parentNode",next:"legend"});try{f.apply(r=a.call(V.childNodes),V.childNodes),r[V.childNodes.length].nodeType}catch(e){f={apply:function(e,t){D.apply(e,a.call(t))},call:function(e){D.apply(e,a.call(arguments,1))}}}function J(e,t,i,n){var s,r,o,a,h,c,p,g=t&&t.ownerDocument,_=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==_&&9!==_&&11!==_)return i;if(!n&&(le(t),t=t||l,u)){if(11!==_&&(h=Y.exec(e)))if(s=h[1]){if(9===_){if(!(o=t.getElementById(s)))return i;if(o.id===s)return f.call(i,o),i}else if(g&&(o=g.getElementById(s))&&J.contains(t,o)&&o.id===s)return f.call(i,o),i}else{if(h[2])return f.apply(i,t.getElementsByTagName(e)),i;if((s=h[3])&&t.getElementsByClassName)return f.apply(i,t.getElementsByClassName(s)),i}if(!(S[e+" "]||d&&d.test(e))){if(p=e,g=t,1===_&&(U.test(e)||j.test(e))){for((g=q.test(e)&&ae(t.parentNode)||t)==t&&m.scope||((a=t.getAttribute("id"))?a=v.escapeSelector(a):t.setAttribute("id",a=A)),r=(c=ce(e)).length;r--;)c[r]=(a?"#"+a:":scope")+" "+ue(c[r]);p=c.join(",")}try{return f.apply(i,g.querySelectorAll(p)),i}catch(t){S(e,!0)}finally{a===A&&t.removeAttribute("id")}}}return _e(e.replace(M,"$1"),t,i,n)}function ee(){var e=[];return function i(n,s){return e.push(n+" ")>t.cacheLength&&delete i[e.shift()],i[n+" "]=s}}function te(e){return e[A]=!0,e}function ie(e){var t=l.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ne(e){return function(t){return E(t,"input")&&t.type===e}}function se(e){return function(t){return(E(t,"input")||E(t,"button"))&&t.type===e}}function re(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Q(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function oe(e){return te(function(t){return t=+t,te(function(i,n){for(var s,r=e([],i.length,t),o=r.length;o--;)i[s=r[o]]&&(i[s]=!(n[s]=i[s]))})})}function ae(e){return e&&void 0!==e.getElementsByTagName&&e}function le(e){var i,n=e?e.ownerDocument||e:V;return n!=l&&9===n.nodeType&&n.documentElement?(h=(l=n).documentElement,u=!v.isXMLDoc(l),g=h.matches||h.webkitMatchesSelector||h.msMatchesSelector,h.msMatchesSelector&&V!=l&&(i=l.defaultView)&&i.top!==i&&i.addEventListener("unload",Z),m.getById=ie(function(e){return h.appendChild(e).id=v.expando,!l.getElementsByName||!l.getElementsByName(v.expando).length}),m.disconnectedMatch=ie(function(e){return g.call(e,"*")}),m.scope=ie(function(){return l.querySelectorAll(":scope")}),m.cssHas=ie(function(){try{return l.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),m.getById?(t.filter.ID=function(e){var t=e.replace(W,K);return function(e){return e.getAttribute("id")===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&u){var i=t.getElementById(e);return i?[i]:[]}}):(t.filter.ID=function(e){var t=e.replace(W,K);return function(e){var i=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return i&&i.value===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&u){var i,n,s,r=t.getElementById(e);if(r){if((i=r.getAttributeNode("id"))&&i.value===e)return[r];for(s=t.getElementsByName(e),n=0;r=s[n++];)if((i=r.getAttributeNode("id"))&&i.value===e)return[r]}return[]}}),t.find.TAG=function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},t.find.CLASS=function(e,t){if(void 0!==t.getElementsByClassName&&u)return t.getElementsByClassName(e)},d=[],ie(function(e){var t;h.appendChild(e).innerHTML="<a id='"+A+"' href='' disabled='disabled'></a><select id='"+A+"-\r\\' disabled='disabled'><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+F+"*(?:value|"+O+")"),e.querySelectorAll("[id~="+A+"-]").length||d.push("~="),e.querySelectorAll("a#"+A+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=l.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=l.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+F+"*name"+F+"*="+F+"*(?:''|\"\")")}),m.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),T=function(e,t){if(e===t)return o=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i||(1&(i=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!m.sortDetached&&t.compareDocumentPosition(e)===i?e===l||e.ownerDocument==V&&J.contains(V,e)?-1:t===l||t.ownerDocument==V&&J.contains(V,t)?1:s?c.call(s,e)-c.call(s,t):0:4&i?-1:1)},l):l}for(e in J.matches=function(e,t){return J(e,null,null,t)},J.matchesSelector=function(e,t){if(le(e),u&&!S[t+" "]&&(!d||!d.test(t)))try{var i=g.call(e,t);if(i||m.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){S(t,!0)}return J(t,l,null,[e]).length>0},J.contains=function(e,t){return(e.ownerDocument||e)!=l&&le(e),v.contains(e,t)},J.attr=function(e,i){(e.ownerDocument||e)!=l&&le(e);var n=t.attrHandle[i.toLowerCase()],s=n&&p.call(t.attrHandle,i.toLowerCase())?n(e,i,!u):void 0;return void 0!==s?s:e.getAttribute(i)},J.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},v.uniqueSort=function(e){var t,i=[],n=0,r=0;if(o=!m.sortStable,s=!m.sortStable&&a.call(e,0),C.call(e,T),o){for(;t=e[r++];)t===e[r]&&(n=i.push(r));for(;n--;)I.call(e,i[n],1)}return s=null,e},v.fn.uniqueSort=function(){return this.pushStack(v.uniqueSort(a.apply(this)))},t=v.expr={cacheLength:50,createPseudo:te,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(W,K),e[3]=(e[3]||e[4]||e[5]||"").replace(W,K),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||J.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&J.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&X.test(i)&&(t=ce(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(W,K).toLowerCase();return"*"===e?function(){return!0}:function(e){return E(e,t)}},CLASS:function(e){var t=w[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&w(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,i){return function(n){var s=J.attr(n,e);return null==s?"!="===t:!t||(s+="","="===t?s===i:"!="===t?s!==i:"^="===t?i&&0===s.indexOf(i):"*="===t?i&&s.indexOf(i)>-1:"$="===t?i&&s.slice(-i.length)===i:"~="===t?(" "+s.replace(B," ")+" ").indexOf(i)>-1:"|="===t&&(s===i||s.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,i,n,s){var r="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===n&&0===s?function(e){return!!e.parentNode}:function(t,i,l){var h,c,u,d,p,g=r!==o?"nextSibling":"previousSibling",f=t.parentNode,m=a&&t.nodeName.toLowerCase(),y=!l&&!a,w=!1;if(f){if(r){for(;g;){for(u=t;u=u[g];)if(a?E(u,m):1===u.nodeType)return!1;p=g="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?f.firstChild:f.lastChild],o&&y){for(w=(d=(h=(c=f[A]||(f[A]={}))[e]||[])[0]===_&&h[1])&&h[2],u=d&&f.childNodes[d];u=++d&&u&&u[g]||(w=d=0)||p.pop();)if(1===u.nodeType&&++w&&u===t){c[e]=[_,d,w];break}}else if(y&&(w=d=(h=(c=t[A]||(t[A]={}))[e]||[])[0]===_&&h[1]),!1===w)for(;(u=++d&&u&&u[g]||(w=d=0)||p.pop())&&(!(a?E(u,m):1===u.nodeType)||!++w||(y&&((c=u[A]||(u[A]={}))[e]=[_,w]),u!==t)););return(w-=s)===n||w%n===0&&w/n>=0}}},PSEUDO:function(e,i){var n,s=t.pseudos[e]||t.setFilters[e.toLowerCase()]||J.error("unsupported pseudo: "+e);return s[A]?s(i):s.length>1?(n=[e,e,"",i],t.setFilters.hasOwnProperty(e.toLowerCase())?te(function(e,t){for(var n,r=s(e,i),o=r.length;o--;)e[n=c.call(e,r[o])]=!(t[n]=r[o])}):function(e){return s(e,0,n)}):s}},pseudos:{not:te(function(e){var t=[],i=[],n=Ae(e.replace(M,"$1"));return n[A]?te(function(e,t,i,s){for(var r,o=n(e,null,s,[]),a=e.length;a--;)(r=o[a])&&(e[a]=!(t[a]=r))}):function(e,s,r){return t[0]=e,n(t,null,r,i),t[0]=null,!i.pop()}}),has:te(function(e){return function(t){return J(e,t).length>0}}),contains:te(function(e){return e=e.replace(W,K),function(t){return(t.textContent||v.text(t)).indexOf(e)>-1}}),lang:te(function(e){return z.test(e||"")||J.error("unsupported lang: "+e),e=e.replace(W,K).toLowerCase(),function(t){var i;do{if(i=u?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(i=i.toLowerCase())===e||0===i.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===h},focus:function(e){return e===function(){try{return l.activeElement}catch(e){}}()&&l.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:re(!1),disabled:re(!0),checked:function(e){return E(e,"input")&&!!e.checked||E(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!t.pseudos.empty(e)},header:function(e){return $.test(e.nodeName)},input:function(e){return H.test(e.nodeName)},button:function(e){return E(e,"input")&&"button"===e.type||E(e,"button")},text:function(e){var t;return E(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:oe(function(){return[0]}),last:oe(function(e,t){return[t-1]}),eq:oe(function(e,t,i){return[i<0?i+t:i]}),even:oe(function(e,t){for(var i=0;i<t;i+=2)e.push(i);return e}),odd:oe(function(e,t){for(var i=1;i<t;i+=2)e.push(i);return e}),lt:oe(function(e,t,i){var n;for(n=i<0?i+t:i>t?t:i;--n>=0;)e.push(n);return e}),gt:oe(function(e,t,i){for(var n=i<0?i+t:i;++n<t;)e.push(n);return e})}},t.pseudos.nth=t.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})t.pseudos[e]=ne(e);for(e in{submit:!0,reset:!0})t.pseudos[e]=se(e);function he(){}function ce(e,i){var n,s,r,o,a,l,h,c=x[e+" "];if(c)return i?0:c.slice(0);for(a=e,l=[],h=t.preFilter;a;){for(o in n&&!(s=k.exec(a))||(s&&(a=a.slice(s[0].length)||a),l.push(r=[])),n=!1,(s=j.exec(a))&&(n=s.shift(),r.push({value:n,type:s[0].replace(M," ")}),a=a.slice(n.length)),t.filter)!(s=G[o].exec(a))||h[o]&&!(s=h[o](s))||(n=s.shift(),r.push({value:n,type:o,matches:s}),a=a.slice(n.length));if(!n)break}return i?a.length:a?J.error(e):x(e,l).slice(0)}function ue(e){for(var t=0,i=e.length,n="";t<i;t++)n+=e[t].value;return n}function de(e,t,i){var n=t.dir,s=t.next,r=s||n,o=i&&"parentNode"===r,a=y++;return t.first?function(t,i,s){for(;t=t[n];)if(1===t.nodeType||o)return e(t,i,s);return!1}:function(t,i,l){var h,c,u=[_,a];if(l){for(;t=t[n];)if((1===t.nodeType||o)&&e(t,i,l))return!0}else for(;t=t[n];)if(1===t.nodeType||o)if(c=t[A]||(t[A]={}),s&&E(t,s))t=t[n]||t;else{if((h=c[r])&&h[0]===_&&h[1]===a)return u[2]=h[2];if(c[r]=u,u[2]=e(t,i,l))return!0}return!1}}function pe(e){return e.length>1?function(t,i,n){for(var s=e.length;s--;)if(!e[s](t,i,n))return!1;return!0}:e[0]}function ge(e,t,i,n,s){for(var r,o=[],a=0,l=e.length,h=null!=t;a<l;a++)(r=e[a])&&(i&&!i(r,n,s)||(o.push(r),h&&t.push(a)));return o}function fe(e,t,i,n,s,r){return n&&!n[A]&&(n=fe(n)),s&&!s[A]&&(s=fe(s,r)),te(function(r,o,a,l){var h,u,d,p,g=[],m=[],A=o.length,_=r||function(e,t,i){for(var n=0,s=t.length;n<s;n++)J(e,t[n],i);return i}(t||"*",a.nodeType?[a]:a,[]),y=!e||!r&&t?_:ge(_,g,e,a,l);if(i?i(y,p=s||(r?e:A||n)?[]:o,a,l):p=y,n)for(h=ge(p,m),n(h,[],a,l),u=h.length;u--;)(d=h[u])&&(p[m[u]]=!(y[m[u]]=d));if(r){if(s||e){if(s){for(h=[],u=p.length;u--;)(d=p[u])&&h.push(y[u]=d);s(null,p=[],h,l)}for(u=p.length;u--;)(d=p[u])&&(h=s?c.call(r,d):g[u])>-1&&(r[h]=!(o[h]=d))}}else p=ge(p===o?p.splice(A,p.length):p),s?s(null,o,p,l):f.apply(o,p)})}function me(e){for(var n,s,r,o=e.length,a=t.relative[e[0].type],l=a||t.relative[" "],h=a?1:0,u=de(function(e){return e===n},l,!0),d=de(function(e){return c.call(n,e)>-1},l,!0),p=[function(e,t,s){var r=!a&&(s||t!=i)||((n=t).nodeType?u(e,t,s):d(e,t,s));return n=null,r}];h<o;h++)if(s=t.relative[e[h].type])p=[de(pe(p),s)];else{if((s=t.filter[e[h].type].apply(null,e[h].matches))[A]){for(r=++h;r<o&&!t.relative[e[r].type];r++);return fe(h>1&&pe(p),h>1&&ue(e.slice(0,h-1).concat({value:" "===e[h-2].type?"*":""})).replace(M,"$1"),s,h<r&&me(e.slice(h,r)),r<o&&me(e=e.slice(r)),r<o&&ue(e))}p.push(s)}return pe(p)}function Ae(e,n){var s,r=[],o=[],a=b[e+" "];if(!a){for(n||(n=ce(e)),s=n.length;s--;)(a=me(n[s]))[A]?r.push(a):o.push(a);a=b(e,function(e,n){var s=n.length>0,r=e.length>0,o=function(o,a,h,c,d){var p,g,m,A=0,y="0",w=o&&[],x=[],b=i,S=o||r&&t.find.TAG("*",d),T=_+=null==b?1:Math.random()||.1,O=S.length;for(d&&(i=a==l||a||d);y!==O&&null!=(p=S[y]);y++){if(r&&p){for(g=0,a||p.ownerDocument==l||(le(p),h=!u);m=e[g++];)if(m(p,a||l,h)){f.call(c,p);break}d&&(_=T)}s&&((p=!m&&p)&&A--,o&&w.push(p))}if(A+=y,s&&y!==A){for(g=0;m=n[g++];)m(w,x,a,h);if(o){if(A>0)for(;y--;)w[y]||x[y]||(x[y]=N.call(c));x=ge(x)}f.apply(c,x),d&&!o&&x.length>0&&A+n.length>1&&v.uniqueSort(c)}return d&&(_=T,i=b),w};return s?te(o):o}(o,r)),a.selector=e}return a}function _e(e,i,n,s){var r,o,a,l,h,c="function"==typeof e&&e,d=!s&&ce(e=c.selector||e);if(n=n||[],1===d.length){if((o=d[0]=d[0].slice(0)).length>2&&"ID"===(a=o[0]).type&&9===i.nodeType&&u&&t.relative[o[1].type]){if(!(i=(t.find.ID(a.matches[0].replace(W,K),i)||[])[0]))return n;c&&(i=i.parentNode),e=e.slice(o.shift().value.length)}for(r=G.needsContext.test(e)?0:o.length;r--&&(a=o[r],!t.relative[l=a.type]);)if((h=t.find[l])&&(s=h(a.matches[0].replace(W,K),q.test(o[0].type)&&ae(i.parentNode)||i))){if(o.splice(r,1),!(e=s.length&&ue(o)))return f.apply(n,s),n;break}}return(c||Ae(e,d))(s,i,!u,n,!i||q.test(e)&&ae(i.parentNode)||i),n}he.prototype=t.filters=t.pseudos,t.setFilters=new he,m.sortStable=A.split("").sort(T).join("")===A,le(),m.sortDetached=ie(function(e){return 1&e.compareDocumentPosition(l.createElement("fieldset"))}),v.find=J,v.expr[":"]=v.expr.pseudos,v.unique=v.uniqueSort,J.compile=Ae,J.select=_e,J.setDocument=le,J.tokenize=ce,J.escape=v.escapeSelector,J.getText=v.text,J.isXML=v.isXMLDoc,J.selectors=v.expr,J.support=v.support,J.uniqueSort=v.uniqueSort}();var L=function(e,t,i){for(var n=[],s=void 0!==i;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(s&&v(e).is(i))break;n.push(e)}return n},B=function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i},k=v.expr.match.needsContext,j=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function U(e,t,i){return A(t)?v.grep(e,function(e,n){return!!t.call(e,n,e)!==i}):t.nodeType?v.grep(e,function(e){return e===t!==i}):"string"!=typeof t?v.grep(e,function(e){return c.call(t,e)>-1!==i}):v.filter(t,e,i)}v.filter=function(e,t,i){var n=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?v.find.matchesSelector(n,e)?[n]:[]:v.find.matches(e,v.grep(t,function(e){return 1===e.nodeType}))},v.fn.extend({find:function(e){var t,i,n=this.length,s=this;if("string"!=typeof e)return this.pushStack(v(e).filter(function(){for(t=0;t<n;t++)if(v.contains(s[t],this))return!0}));for(i=this.pushStack([]),t=0;t<n;t++)v.find(e,s[t],i);return n>1?v.uniqueSort(i):i},filter:function(e){return this.pushStack(U(this,e||[],!1))},not:function(e){return this.pushStack(U(this,e||[],!0))},is:function(e){return!!U(this,"string"==typeof e&&k.test(e)?v(e):e||[],!1).length}});var X,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(v.fn.init=function(e,t,i){var n,s;if(!e)return this;if(i=i||X,"string"==typeof e){if(!(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:z.exec(e))||!n[1]&&t)return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof v?t[0]:t,v.merge(this,v.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:y,!0)),j.test(n[1])&&v.isPlainObject(t))for(n in t)A(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(s=y.getElementById(n[2]))&&(this[0]=s,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):A(e)?void 0!==i.ready?i.ready(e):e(v):v.makeArray(e,this)}).prototype=v.fn,X=v(y);var G=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function $(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}v.fn.extend({has:function(e){var t=v(e,this),i=t.length;return this.filter(function(){for(var e=0;e<i;e++)if(v.contains(this,t[e]))return!0})},closest:function(e,t){var i,n=0,s=this.length,r=[],o="string"!=typeof e&&v(e);if(!k.test(e))for(;n<s;n++)for(i=this[n];i&&i!==t;i=i.parentNode)if(i.nodeType<11&&(o?o.index(i)>-1:1===i.nodeType&&v.find.matchesSelector(i,e))){r.push(i);break}return this.pushStack(r.length>1?v.uniqueSort(r):r)},index:function(e){return e?"string"==typeof e?c.call(v(e),this[0]):c.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(v.uniqueSort(v.merge(this.get(),v(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),v.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return L(e,"parentNode")},parentsUntil:function(e,t,i){return L(e,"parentNode",i)},next:function(e){return $(e,"nextSibling")},prev:function(e){return $(e,"previousSibling")},nextAll:function(e){return L(e,"nextSibling")},prevAll:function(e){return L(e,"previousSibling")},nextUntil:function(e,t,i){return L(e,"nextSibling",i)},prevUntil:function(e,t,i){return L(e,"previousSibling",i)},siblings:function(e){return B((e.parentNode||{}).firstChild,e)},children:function(e){return B(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(E(e,"template")&&(e=e.content||e),v.merge([],e.childNodes))}},function(e,t){v.fn[e]=function(i,n){var s=v.map(this,t,i);return"Until"!==e.slice(-5)&&(n=i),n&&"string"==typeof n&&(s=v.filter(n,s)),this.length>1&&(H[e]||v.uniqueSort(s),G.test(e)&&s.reverse()),this.pushStack(s)}});var Y=/[^\x20\t\r\n\f]+/g;function q(e){return e}function W(e){throw e}function K(e,t,i,n){var s;try{e&&A(s=e.promise)?s.call(e).done(t).fail(i):e&&A(s=e.then)?s.call(e,t,i):t.apply(void 0,[e].slice(n))}catch(e){i.apply(void 0,[e])}}v.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return v.each(e.match(Y)||[],function(e,i){t[i]=!0}),t}(e):v.extend({},e);var t,i,n,s,r=[],o=[],a=-1,l=function(){for(s=s||e.once,n=t=!0;o.length;a=-1)for(i=o.shift();++a<r.length;)!1===r[a].apply(i[0],i[1])&&e.stopOnFalse&&(a=r.length,i=!1);e.memory||(i=!1),t=!1,s&&(r=i?[]:"")},h={add:function(){return r&&(i&&!t&&(a=r.length-1,o.push(i)),function t(i){v.each(i,function(i,n){A(n)?e.unique&&h.has(n)||r.push(n):n&&n.length&&"string"!==b(n)&&t(n)})}(arguments),i&&!t&&l()),this},remove:function(){return v.each(arguments,function(e,t){for(var i;(i=v.inArray(t,r,i))>-1;)r.splice(i,1),i<=a&&a--}),this},has:function(e){return e?v.inArray(e,r)>-1:r.length>0},empty:function(){return r&&(r=[]),this},disable:function(){return s=o=[],r=i="",this},disabled:function(){return!r},lock:function(){return s=o=[],i||t||(r=i=""),this},locked:function(){return!!s},fireWith:function(e,i){return s||(i=[e,(i=i||[]).slice?i.slice():i],o.push(i),t||l()),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!n}};return h},v.extend({Deferred:function(e){var t=[["notify","progress",v.Callbacks("memory"),v.Callbacks("memory"),2],["resolve","done",v.Callbacks("once memory"),v.Callbacks("once memory"),0,"resolved"],["reject","fail",v.Callbacks("once memory"),v.Callbacks("once memory"),1,"rejected"]],i="pending",s={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},catch:function(e){return s.then(null,e)},pipe:function(){var e=arguments;return v.Deferred(function(i){v.each(t,function(t,n){var s=A(e[n[4]])&&e[n[4]];r[n[1]](function(){var e=s&&s.apply(this,arguments);e&&A(e.promise)?e.promise().progress(i.notify).done(i.resolve).fail(i.reject):i[n[0]+"With"](this,s?[e]:arguments)})}),e=null}).promise()},then:function(e,i,s){var r=0;function o(e,t,i,s){return function(){var a=this,l=arguments,h=function(){var n,h;if(!(e<r)){if((n=i.apply(a,l))===t.promise())throw new TypeError("Thenable self-resolution");h=n&&("object"==typeof n||"function"==typeof n)&&n.then,A(h)?s?h.call(n,o(r,t,q,s),o(r,t,W,s)):(r++,h.call(n,o(r,t,q,s),o(r,t,W,s),o(r,t,q,t.notifyWith))):(i!==q&&(a=void 0,l=[n]),(s||t.resolveWith)(a,l))}},c=s?h:function(){try{h()}catch(n){v.Deferred.exceptionHook&&v.Deferred.exceptionHook(n,c.error),e+1>=r&&(i!==W&&(a=void 0,l=[n]),t.rejectWith(a,l))}};e?c():(v.Deferred.getErrorHook?c.error=v.Deferred.getErrorHook():v.Deferred.getStackHook&&(c.error=v.Deferred.getStackHook()),n.setTimeout(c))}}return v.Deferred(function(n){t[0][3].add(o(0,n,A(s)?s:q,n.notifyWith)),t[1][3].add(o(0,n,A(e)?e:q)),t[2][3].add(o(0,n,A(i)?i:W))}).promise()},promise:function(e){return null!=e?v.extend(e,s):s}},r={};return v.each(t,function(e,n){var o=n[2],a=n[5];s[n[1]]=o.add,a&&o.add(function(){i=a},t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(n[3].fire),r[n[0]]=function(){return r[n[0]+"With"](this===r?void 0:this,arguments),this},r[n[0]+"With"]=o.fireWith}),s.promise(r),e&&e.call(r,r),r},when:function(e){var t=arguments.length,i=t,n=Array(i),s=a.call(arguments),r=v.Deferred(),o=function(e){return function(i){n[e]=this,s[e]=arguments.length>1?a.call(arguments):i,--t||r.resolveWith(n,s)}};if(t<=1&&(K(e,r.done(o(i)).resolve,r.reject,!t),"pending"===r.state()||A(s[i]&&s[i].then)))return r.then();for(;i--;)K(s[i],o(i),r.reject);return r.promise()}});var Z=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;v.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&Z.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},v.readyException=function(e){n.setTimeout(function(){throw e})};var Q=v.Deferred();function J(){y.removeEventListener("DOMContentLoaded",J),n.removeEventListener("load",J),v.ready()}v.fn.ready=function(e){return Q.then(e).catch(function(e){v.readyException(e)}),this},v.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--v.readyWait:v.isReady)||(v.isReady=!0,!0!==e&&--v.readyWait>0||Q.resolveWith(y,[v]))}}),v.ready.then=Q.then,"complete"===y.readyState||"loading"!==y.readyState&&!y.documentElement.doScroll?n.setTimeout(v.ready):(y.addEventListener("DOMContentLoaded",J),n.addEventListener("load",J));var ee=function(e,t,i,n,s,r,o){var a=0,l=e.length,h=null==i;if("object"===b(i))for(a in s=!0,i)ee(e,t,a,i[a],!0,r,o);else if(void 0!==n&&(s=!0,A(n)||(o=!0),h&&(o?(t.call(e,n),t=null):(h=t,t=function(e,t,i){return h.call(v(e),i)})),t))for(;a<l;a++)t(e[a],i,o?n:n.call(e[a],a,t(e[a],i)));return s?e:h?t.call(e):l?t(e[0],i):r},te=/^-ms-/,ie=/-([a-z])/g;function ne(e,t){return t.toUpperCase()}function se(e){return e.replace(te,"ms-").replace(ie,ne)}var re=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function oe(){this.expando=v.expando+oe.uid++}oe.uid=1,oe.prototype={cache:function(e){var t=e[this.expando];return t||(t={},re(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,i){var n,s=this.cache(e);if("string"==typeof t)s[se(t)]=i;else for(n in t)s[se(n)]=t[n];return s},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][se(t)]},access:function(e,t,i){return void 0===t||t&&"string"==typeof t&&void 0===i?this.get(e,t):(this.set(e,t,i),void 0!==i?i:t)},remove:function(e,t){var i,n=e[this.expando];if(void 0!==n){if(void 0!==t){i=(t=Array.isArray(t)?t.map(se):(t=se(t))in n?[t]:t.match(Y)||[]).length;for(;i--;)delete n[t[i]]}(void 0===t||v.isEmptyObject(n))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!v.isEmptyObject(t)}};var ae=new oe,le=new oe,he=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ce=/[A-Z]/g;function ue(e,t,i){var n;if(void 0===i&&1===e.nodeType)if(n="data-"+t.replace(ce,"-$&").toLowerCase(),"string"==typeof(i=e.getAttribute(n))){try{i=function(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:he.test(e)?JSON.parse(e):e)}(i)}catch(e){}le.set(e,t,i)}else i=void 0;return i}v.extend({hasData:function(e){return le.hasData(e)||ae.hasData(e)},data:function(e,t,i){return le.access(e,t,i)},removeData:function(e,t){le.remove(e,t)},_data:function(e,t,i){return ae.access(e,t,i)},_removeData:function(e,t){ae.remove(e,t)}}),v.fn.extend({data:function(e,t){var i,n,s,r=this[0],o=r&&r.attributes;if(void 0===e){if(this.length&&(s=le.get(r),1===r.nodeType&&!ae.get(r,"hasDataAttrs"))){for(i=o.length;i--;)o[i]&&0===(n=o[i].name).indexOf("data-")&&(n=se(n.slice(5)),ue(r,n,s[n]));ae.set(r,"hasDataAttrs",!0)}return s}return"object"==typeof e?this.each(function(){le.set(this,e)}):ee(this,function(t){var i;if(r&&void 0===t)return void 0!==(i=le.get(r,e))||void 0!==(i=ue(r,e))?i:void 0;this.each(function(){le.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){le.remove(this,e)})}}),v.extend({queue:function(e,t,i){var n;if(e)return t=(t||"fx")+"queue",n=ae.get(e,t),i&&(!n||Array.isArray(i)?n=ae.access(e,t,v.makeArray(i)):n.push(i)),n||[]},dequeue:function(e,t){t=t||"fx";var i=v.queue(e,t),n=i.length,s=i.shift(),r=v._queueHooks(e,t);"inprogress"===s&&(s=i.shift(),n--),s&&("fx"===t&&i.unshift("inprogress"),delete r.stop,s.call(e,function(){v.dequeue(e,t)},r)),!n&&r&&r.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return ae.get(e,i)||ae.access(e,i,{empty:v.Callbacks("once memory").add(function(){ae.remove(e,[t+"queue",i])})})}}),v.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length<i?v.queue(this[0],e):void 0===t?this:this.each(function(){var i=v.queue(this,e,t);v._queueHooks(this,e),"fx"===e&&"inprogress"!==i[0]&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var i,n=1,s=v.Deferred(),r=this,o=this.length,a=function(){--n||s.resolveWith(r,[r])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";o--;)(i=ae.get(r[o],e+"queueHooks"))&&i.empty&&(n++,i.empty.add(a));return a(),s.promise(t)}});var de=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,pe=new RegExp("^(?:([+-])=|)("+de+")([a-z%]*)$","i"),ge=["Top","Right","Bottom","Left"],fe=y.documentElement,me=function(e){return v.contains(e.ownerDocument,e)},Ae={composed:!0};fe.getRootNode&&(me=function(e){return v.contains(e.ownerDocument,e)||e.getRootNode(Ae)===e.ownerDocument});var _e=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&me(e)&&"none"===v.css(e,"display")},ye={};function we(e){var t,i=e.ownerDocument,n=e.nodeName,s=ye[n];return s||(t=i.body.appendChild(i.createElement(n)),s=v.css(t,"display"),t.parentNode.removeChild(t),"none"===s&&(s="block"),ye[n]=s,s)}function xe(e,t){for(var i,n,s=[],r=0,o=e.length;r<o;r++)(n=e[r]).style&&(i=n.style.display,t?("none"===i&&(s[r]=ae.get(n,"display")||null,s[r]||(n.style.display="")),""===n.style.display&&_e(n)&&(s[r]=we(n))):"none"!==i&&(s[r]="none",ae.set(n,"display",i)));for(r=0;r<o;r++)null!=s[r]&&(e[r].style.display=s[r]);return e}v.fn.extend({show:function(){return xe(this,!0)},hide:function(){return xe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){_e(this)?v(this).show():v(this).hide()})}});var be,Se,Te=/^(?:checkbox|radio)$/i,ve=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Oe=/^$|^module$|\/(?:java|ecma)script/i;be=y.createDocumentFragment().appendChild(y.createElement("div")),(Se=y.createElement("input")).setAttribute("type","radio"),Se.setAttribute("checked","checked"),Se.setAttribute("name","t"),be.appendChild(Se),m.checkClone=be.cloneNode(!0).cloneNode(!0).lastChild.checked,be.innerHTML="<textarea>x</textarea>",m.noCloneChecked=!!be.cloneNode(!0).lastChild.defaultValue,be.innerHTML="<option></option>",m.option=!!be.lastChild;var Ee={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Ne(e,t){var i;return i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?v.merge([e],i):i}function Ce(e,t){for(var i=0,n=e.length;i<n;i++)ae.set(e[i],"globalEval",!t||ae.get(t[i],"globalEval"))}Ee.tbody=Ee.tfoot=Ee.colgroup=Ee.caption=Ee.thead,Ee.th=Ee.td,m.option||(Ee.optgroup=Ee.option=[1,"<select multiple='multiple'>","</select>"]);var Ie=/<|&#?\w+;/;function Fe(e,t,i,n,s){for(var r,o,a,l,h,c,u=t.createDocumentFragment(),d=[],p=0,g=e.length;p<g;p++)if((r=e[p])||0===r)if("object"===b(r))v.merge(d,r.nodeType?[r]:r);else if(Ie.test(r)){for(o=o||u.appendChild(t.createElement("div")),a=(ve.exec(r)||["",""])[1].toLowerCase(),l=Ee[a]||Ee._default,o.innerHTML=l[1]+v.htmlPrefilter(r)+l[2],c=l[0];c--;)o=o.lastChild;v.merge(d,o.childNodes),(o=u.firstChild).textContent=""}else d.push(t.createTextNode(r));for(u.textContent="",p=0;r=d[p++];)if(n&&v.inArray(r,n)>-1)s&&s.push(r);else if(h=me(r),o=Ne(u.appendChild(r),"script"),h&&Ce(o),i)for(c=0;r=o[c++];)Oe.test(r.type||"")&&i.push(r);return u}var Me=/^([^.]*)(?:\.(.+)|)/;function Re(){return!0}function Pe(){return!1}function Ve(e,t,i,n,s,r){var o,a;if("object"==typeof t){for(a in"string"!=typeof i&&(n=n||i,i=void 0),t)Ve(e,a,i,n,t[a],r);return e}if(null==n&&null==s?(s=i,n=i=void 0):null==s&&("string"==typeof i?(s=n,n=void 0):(s=n,n=i,i=void 0)),!1===s)s=Pe;else if(!s)return e;return 1===r&&(o=s,s=function(e){return v().off(e),o.apply(this,arguments)},s.guid=o.guid||(o.guid=v.guid++)),e.each(function(){v.event.add(this,t,s,n,i)})}function De(e,t,i){i?(ae.set(e,t,!1),v.event.add(e,t,{namespace:!1,handler:function(e){var i,n=ae.get(this,t);if(1&e.isTrigger&&this[t]){if(n)(v.event.special[t]||{}).delegateType&&e.stopPropagation();else if(n=a.call(arguments),ae.set(this,t,n),this[t](),i=ae.get(this,t),ae.set(this,t,!1),n!==i)return e.stopImmediatePropagation(),e.preventDefault(),i}else n&&(ae.set(this,t,v.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Re)}})):void 0===ae.get(e,t)&&v.event.add(e,t,Re)}v.event={global:{},add:function(e,t,i,n,s){var r,o,a,l,h,c,u,d,p,g,f,m=ae.get(e);if(re(e))for(i.handler&&(i=(r=i).handler,s=r.selector),s&&v.find.matchesSelector(fe,s),i.guid||(i.guid=v.guid++),(l=m.events)||(l=m.events=Object.create(null)),(o=m.handle)||(o=m.handle=function(t){return void 0!==v&&v.event.triggered!==t.type?v.event.dispatch.apply(e,arguments):void 0}),h=(t=(t||"").match(Y)||[""]).length;h--;)p=f=(a=Me.exec(t[h])||[])[1],g=(a[2]||"").split(".").sort(),p&&(u=v.event.special[p]||{},p=(s?u.delegateType:u.bindType)||p,u=v.event.special[p]||{},c=v.extend({type:p,origType:f,data:n,handler:i,guid:i.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:g.join(".")},r),(d=l[p])||((d=l[p]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,n,g,o)||e.addEventListener&&e.addEventListener(p,o)),u.add&&(u.add.call(e,c),c.handler.guid||(c.handler.guid=i.guid)),s?d.splice(d.delegateCount++,0,c):d.push(c),v.event.global[p]=!0)},remove:function(e,t,i,n,s){var r,o,a,l,h,c,u,d,p,g,f,m=ae.hasData(e)&&ae.get(e);if(m&&(l=m.events)){for(h=(t=(t||"").match(Y)||[""]).length;h--;)if(p=f=(a=Me.exec(t[h])||[])[1],g=(a[2]||"").split(".").sort(),p){for(u=v.event.special[p]||{},d=l[p=(n?u.delegateType:u.bindType)||p]||[],a=a[2]&&new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=r=d.length;r--;)c=d[r],!s&&f!==c.origType||i&&i.guid!==c.guid||a&&!a.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(d.splice(r,1),c.selector&&d.delegateCount--,u.remove&&u.remove.call(e,c));o&&!d.length&&(u.teardown&&!1!==u.teardown.call(e,g,m.handle)||v.removeEvent(e,p,m.handle),delete l[p])}else for(p in l)v.event.remove(e,p+t[h],i,n,!0);v.isEmptyObject(l)&&ae.remove(e,"handle events")}},dispatch:function(e){var t,i,n,s,r,o,a=new Array(arguments.length),l=v.event.fix(e),h=(ae.get(this,"events")||Object.create(null))[l.type]||[],c=v.event.special[l.type]||{};for(a[0]=l,t=1;t<arguments.length;t++)a[t]=arguments[t];if(l.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,l)){for(o=v.event.handlers.call(this,l,h),t=0;(s=o[t++])&&!l.isPropagationStopped();)for(l.currentTarget=s.elem,i=0;(r=s.handlers[i++])&&!l.isImmediatePropagationStopped();)l.rnamespace&&!1!==r.namespace&&!l.rnamespace.test(r.namespace)||(l.handleObj=r,l.data=r.data,void 0!==(n=((v.event.special[r.origType]||{}).handle||r.handler).apply(s.elem,a))&&!1===(l.result=n)&&(l.preventDefault(),l.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,l),l.result}},handlers:function(e,t){var i,n,s,r,o,a=[],l=t.delegateCount,h=e.target;if(l&&h.nodeType&&!("click"===e.type&&e.button>=1))for(;h!==this;h=h.parentNode||this)if(1===h.nodeType&&("click"!==e.type||!0!==h.disabled)){for(r=[],o={},i=0;i<l;i++)void 0===o[s=(n=t[i]).selector+" "]&&(o[s]=n.needsContext?v(s,this).index(h)>-1:v.find(s,this,null,[h]).length),o[s]&&r.push(n);r.length&&a.push({elem:h,handlers:r})}return h=this,l<t.length&&a.push({elem:h,handlers:t.slice(l)}),a},addProp:function(e,t){Object.defineProperty(v.Event.prototype,e,{enumerable:!0,configurable:!0,get:A(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[v.expando]?e:new v.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return Te.test(t.type)&&t.click&&E(t,"input")&&De(t,"click",!0),!1},trigger:function(e){var t=this||e;return Te.test(t.type)&&t.click&&E(t,"input")&&De(t,"click"),!0},_default:function(e){var t=e.target;return Te.test(t.type)&&t.click&&E(t,"input")&&ae.get(t,"click")||E(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},v.removeEvent=function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i)},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Re:Pe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[v.expando]=!0},v.Event.prototype={constructor:v.Event,isDefaultPrevented:Pe,isPropagationStopped:Pe,isImmediatePropagationStopped:Pe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Re,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Re,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Re,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},v.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},v.event.addProp),v.each({focus:"focusin",blur:"focusout"},function(e,t){function i(e){if(y.documentMode){var i=ae.get(this,"handle"),n=v.event.fix(e);n.type="focusin"===e.type?"focus":"blur",n.isSimulated=!0,i(e),n.target===n.currentTarget&&i(n)}else v.event.simulate(t,e.target,v.event.fix(e))}v.event.special[e]={setup:function(){var n;if(De(this,e,!0),!y.documentMode)return!1;(n=ae.get(this,t))||this.addEventListener(t,i),ae.set(this,t,(n||0)+1)},trigger:function(){return De(this,e),!0},teardown:function(){var e;if(!y.documentMode)return!1;(e=ae.get(this,t)-1)?ae.set(this,t,e):(this.removeEventListener(t,i),ae.remove(this,t))},_default:function(t){return ae.get(t.target,e)},delegateType:t},v.event.special[t]={setup:function(){var n=this.ownerDocument||this.document||this,s=y.documentMode?this:n,r=ae.get(s,t);r||(y.documentMode?this.addEventListener(t,i):n.addEventListener(e,i,!0)),ae.set(s,t,(r||0)+1)},teardown:function(){var n=this.ownerDocument||this.document||this,s=y.documentMode?this:n,r=ae.get(s,t)-1;r?ae.set(s,t,r):(y.documentMode?this.removeEventListener(t,i):n.removeEventListener(e,i,!0),ae.remove(s,t))}}}),v.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,n=e.relatedTarget,s=e.handleObj;return n&&(n===this||v.contains(this,n))||(e.type=s.origType,i=s.handler.apply(this,arguments),e.type=t),i}}}),v.fn.extend({on:function(e,t,i,n){return Ve(this,e,t,i,n)},one:function(e,t,i,n){return Ve(this,e,t,i,n,1)},off:function(e,t,i){var n,s;if(e&&e.preventDefault&&e.handleObj)return n=e.handleObj,v(e.delegateTarget).off(n.namespace?n.origType+"."+n.namespace:n.origType,n.selector,n.handler),this;if("object"==typeof e){for(s in e)this.off(s,t,e[s]);return this}return!1!==t&&"function"!=typeof t||(i=t,t=void 0),!1===i&&(i=Pe),this.each(function(){v.event.remove(this,e,i,t)})}});var Le=/<script|<style|<link/i,Be=/checked\s*(?:[^=]|=\s*.checked.)/i,ke=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function je(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&v(e).children("tbody")[0]||e}function Ue(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Xe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function ze(e,t){var i,n,s,r,o,a;if(1===t.nodeType){if(ae.hasData(e)&&(a=ae.get(e).events))for(s in ae.remove(t,"handle events"),a)for(i=0,n=a[s].length;i<n;i++)v.event.add(t,s,a[s][i]);le.hasData(e)&&(r=le.access(e),o=v.extend({},r),le.set(t,o))}}function Ge(e,t){var i=t.nodeName.toLowerCase();"input"===i&&Te.test(e.type)?t.checked=e.checked:"input"!==i&&"textarea"!==i||(t.defaultValue=e.defaultValue)}function He(e,t,i,n){t=l(t);var s,r,o,a,h,c,u=0,d=e.length,p=d-1,g=t[0],f=A(g);if(f||d>1&&"string"==typeof g&&!m.checkClone&&Be.test(g))return e.each(function(s){var r=e.eq(s);f&&(t[0]=g.call(this,s,r.html())),He(r,t,i,n)});if(d&&(r=(s=Fe(t,e[0].ownerDocument,!1,e,n)).firstChild,1===s.childNodes.length&&(s=r),r||n)){for(a=(o=v.map(Ne(s,"script"),Ue)).length;u<d;u++)h=s,u!==p&&(h=v.clone(h,!0,!0),a&&v.merge(o,Ne(h,"script"))),i.call(e[u],h,u);if(a)for(c=o[o.length-1].ownerDocument,v.map(o,Xe),u=0;u<a;u++)h=o[u],Oe.test(h.type||"")&&!ae.access(h,"globalEval")&&v.contains(c,h)&&(h.src&&"module"!==(h.type||"").toLowerCase()?v._evalUrl&&!h.noModule&&v._evalUrl(h.src,{nonce:h.nonce||h.getAttribute("nonce")},c):x(h.textContent.replace(ke,""),h,c))}return e}function $e(e,t,i){for(var n,s=t?v.filter(t,e):e,r=0;null!=(n=s[r]);r++)i||1!==n.nodeType||v.cleanData(Ne(n)),n.parentNode&&(i&&me(n)&&Ce(Ne(n,"script")),n.parentNode.removeChild(n));return e}v.extend({htmlPrefilter:function(e){return e},clone:function(e,t,i){var n,s,r,o,a=e.cloneNode(!0),l=me(e);if(!(m.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||v.isXMLDoc(e)))for(o=Ne(a),n=0,s=(r=Ne(e)).length;n<s;n++)Ge(r[n],o[n]);if(t)if(i)for(r=r||Ne(e),o=o||Ne(a),n=0,s=r.length;n<s;n++)ze(r[n],o[n]);else ze(e,a);return(o=Ne(a,"script")).length>0&&Ce(o,!l&&Ne(e,"script")),a},cleanData:function(e){for(var t,i,n,s=v.event.special,r=0;void 0!==(i=e[r]);r++)if(re(i)){if(t=i[ae.expando]){if(t.events)for(n in t.events)s[n]?v.event.remove(i,n):v.removeEvent(i,n,t.handle);i[ae.expando]=void 0}i[le.expando]&&(i[le.expando]=void 0)}}}),v.fn.extend({detach:function(e){return $e(this,e,!0)},remove:function(e){return $e(this,e)},text:function(e){return ee(this,function(e){return void 0===e?v.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return He(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||je(this,e).appendChild(e)})},prepend:function(){return He(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=je(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(v.cleanData(Ne(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return ee(this,function(e){var t=this[0]||{},i=0,n=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Le.test(e)&&!Ee[(ve.exec(e)||["",""])[1].toLowerCase()]){e=v.htmlPrefilter(e);try{for(;i<n;i++)1===(t=this[i]||{}).nodeType&&(v.cleanData(Ne(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return He(this,arguments,function(t){var i=this.parentNode;v.inArray(this,e)<0&&(v.cleanData(Ne(this)),i&&i.replaceChild(t,this))},e)}}),v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(e){for(var i,n=[],s=v(e),r=s.length-1,o=0;o<=r;o++)i=o===r?this:this.clone(!0),v(s[o])[t](i),h.apply(n,i.get());return this.pushStack(n)}});var Ye=new RegExp("^("+de+")(?!px)[a-z%]+$","i"),qe=/^--/,We=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=n),t.getComputedStyle(e)},Ke=function(e,t,i){var n,s,r={};for(s in t)r[s]=e.style[s],e.style[s]=t[s];for(s in n=i.call(e),t)e.style[s]=r[s];return n},Ze=new RegExp(ge.join("|"),"i");function Qe(e,t,i){var n,s,r,o,a=qe.test(t),l=e.style;return(i=i||We(e))&&(o=i.getPropertyValue(t)||i[t],a&&o&&(o=o.replace(M,"$1")||void 0),""!==o||me(e)||(o=v.style(e,t)),!m.pixelBoxStyles()&&Ye.test(o)&&Ze.test(t)&&(n=l.width,s=l.minWidth,r=l.maxWidth,l.minWidth=l.maxWidth=l.width=o,o=i.width,l.width=n,l.minWidth=s,l.maxWidth=r)),void 0!==o?o+"":o}function Je(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(c){h.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",fe.appendChild(h).appendChild(c);var e=n.getComputedStyle(c);i="1%"!==e.top,l=12===t(e.marginLeft),c.style.right="60%",o=36===t(e.right),s=36===t(e.width),c.style.position="absolute",r=12===t(c.offsetWidth/3),fe.removeChild(h),c=null}}function t(e){return Math.round(parseFloat(e))}var i,s,r,o,a,l,h=y.createElement("div"),c=y.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",m.clearCloneStyle="content-box"===c.style.backgroundClip,v.extend(m,{boxSizingReliable:function(){return e(),s},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),i},reliableMarginLeft:function(){return e(),l},scrollboxSize:function(){return e(),r},reliableTrDimensions:function(){var e,t,i,s;return null==a&&(e=y.createElement("table"),t=y.createElement("tr"),i=y.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="box-sizing:content-box;border:1px solid",t.style.height="1px",i.style.height="9px",i.style.display="block",fe.appendChild(e).appendChild(t).appendChild(i),s=n.getComputedStyle(t),a=parseInt(s.height,10)+parseInt(s.borderTopWidth,10)+parseInt(s.borderBottomWidth,10)===t.offsetHeight,fe.removeChild(e)),a}}))}();var et=["Webkit","Moz","ms"],tt=y.createElement("div").style,it={};function nt(e){var t=v.cssProps[e]||it[e];return t||(e in tt?e:it[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),i=et.length;i--;)if((e=et[i]+t)in tt)return e}(e)||e)}var st=/^(none|table(?!-c[ea]).+)/,rt={position:"absolute",visibility:"hidden",display:"block"},ot={letterSpacing:"0",fontWeight:"400"};function at(e,t,i){var n=pe.exec(t);return n?Math.max(0,n[2]-(i||0))+(n[3]||"px"):t}function lt(e,t,i,n,s,r){var o="width"===t?1:0,a=0,l=0,h=0;if(i===(n?"border":"content"))return 0;for(;o<4;o+=2)"margin"===i&&(h+=v.css(e,i+ge[o],!0,s)),n?("content"===i&&(l-=v.css(e,"padding"+ge[o],!0,s)),"margin"!==i&&(l-=v.css(e,"border"+ge[o]+"Width",!0,s))):(l+=v.css(e,"padding"+ge[o],!0,s),"padding"!==i?l+=v.css(e,"border"+ge[o]+"Width",!0,s):a+=v.css(e,"border"+ge[o]+"Width",!0,s));return!n&&r>=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-r-l-a-.5))||0),l+h}function ht(e,t,i){var n=We(e),s=(!m.boxSizingReliable()||i)&&"border-box"===v.css(e,"boxSizing",!1,n),r=s,o=Qe(e,t,n),a="offset"+t[0].toUpperCase()+t.slice(1);if(Ye.test(o)){if(!i)return o;o="auto"}return(!m.boxSizingReliable()&&s||!m.reliableTrDimensions()&&E(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===v.css(e,"display",!1,n))&&e.getClientRects().length&&(s="border-box"===v.css(e,"boxSizing",!1,n),(r=a in e)&&(o=e[a])),(o=parseFloat(o)||0)+lt(e,t,i||(s?"border":"content"),r,n,o)+"px"}v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=Qe(e,"opacity");return""===i?"1":i}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,i,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var s,r,o,a=se(t),l=qe.test(t),h=e.style;if(l||(t=nt(a)),o=v.cssHooks[t]||v.cssHooks[a],void 0===i)return o&&"get"in o&&void 0!==(s=o.get(e,!1,n))?s:h[t];"string"==(r=typeof i)&&(s=pe.exec(i))&&s[1]&&(i=function(e,t,i,n){var s,r,o=20,a=n?function(){return n.cur()}:function(){return v.css(e,t,"")},l=a(),h=i&&i[3]||(v.cssNumber[t]?"":"px"),c=e.nodeType&&(v.cssNumber[t]||"px"!==h&&+l)&&pe.exec(v.css(e,t));if(c&&c[3]!==h){for(l/=2,h=h||c[3],c=+l||1;o--;)v.style(e,t,c+h),(1-r)*(1-(r=a()/l||.5))<=0&&(o=0),c/=r;c*=2,v.style(e,t,c+h),i=i||[]}return i&&(c=+c||+l||0,s=i[1]?c+(i[1]+1)*i[2]:+i[2],n&&(n.unit=h,n.start=c,n.end=s)),s}(e,t,s),r="number"),null!=i&&i==i&&("number"!==r||l||(i+=s&&s[3]||(v.cssNumber[a]?"":"px")),m.clearCloneStyle||""!==i||0!==t.indexOf("background")||(h[t]="inherit"),o&&"set"in o&&void 0===(i=o.set(e,i,n))||(l?h.setProperty(t,i):h[t]=i))}},css:function(e,t,i,n){var s,r,o,a=se(t);return qe.test(t)||(t=nt(a)),(o=v.cssHooks[t]||v.cssHooks[a])&&"get"in o&&(s=o.get(e,!0,i)),void 0===s&&(s=Qe(e,t,n)),"normal"===s&&t in ot&&(s=ot[t]),""===i||i?(r=parseFloat(s),!0===i||isFinite(r)?r||0:s):s}}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,i,n){if(i)return!st.test(v.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ht(e,t,n):Ke(e,rt,function(){return ht(e,t,n)})},set:function(e,i,n){var s,r=We(e),o=!m.scrollboxSize()&&"absolute"===r.position,a=(o||n)&&"border-box"===v.css(e,"boxSizing",!1,r),l=n?lt(e,t,n,a,r):0;return a&&o&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(r[t])-lt(e,t,"border",!1,r)-.5)),l&&(s=pe.exec(i))&&"px"!==(s[3]||"px")&&(e.style[t]=i,i=v.css(e,t)),at(0,i,l)}}}),v.cssHooks.marginLeft=Je(m.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Qe(e,"marginLeft"))||e.getBoundingClientRect().left-Ke(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(i){for(var n=0,s={},r="string"==typeof i?i.split(" "):[i];n<4;n++)s[e+ge[n]+t]=r[n]||r[n-2]||r[0];return s}},"margin"!==e&&(v.cssHooks[e+t].set=at)}),v.fn.extend({css:function(e,t){return ee(this,function(e,t,i){var n,s,r={},o=0;if(Array.isArray(t)){for(n=We(e),s=t.length;o<s;o++)r[t[o]]=v.css(e,t[o],!1,n);return r}return void 0!==i?v.style(e,t,i):v.css(e,t)},e,t,arguments.length>1)}}),v.fn.delay=function(e,t){return e=v.fx&&v.fx.speeds[e]||e,t=t||"fx",this.queue(t,function(t,i){var s=n.setTimeout(t,e);i.stop=function(){n.clearTimeout(s)}})},function(){var e=y.createElement("input"),t=y.createElement("select").appendChild(y.createElement("option"));e.type="checkbox",m.checkOn=""!==e.value,m.optSelected=t.selected,(e=y.createElement("input")).value="t",e.type="radio",m.radioValue="t"===e.value}();var ct,ut=v.expr.attrHandle;v.fn.extend({attr:function(e,t){return ee(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})}}),v.extend({attr:function(e,t,i){var n,s,r=e.nodeType;if(3!==r&&8!==r&&2!==r)return void 0===e.getAttribute?v.prop(e,t,i):(1===r&&v.isXMLDoc(e)||(s=v.attrHooks[t.toLowerCase()]||(v.expr.match.bool.test(t)?ct:void 0)),void 0!==i?null===i?void v.removeAttr(e,t):s&&"set"in s&&void 0!==(n=s.set(e,i,t))?n:(e.setAttribute(t,i+""),i):s&&"get"in s&&null!==(n=s.get(e,t))?n:null==(n=v.find.attr(e,t))?void 0:n)},attrHooks:{type:{set:function(e,t){if(!m.radioValue&&"radio"===t&&E(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}},removeAttr:function(e,t){var i,n=0,s=t&&t.match(Y);if(s&&1===e.nodeType)for(;i=s[n++];)e.removeAttribute(i)}}),ct={set:function(e,t,i){return!1===t?v.removeAttr(e,i):e.setAttribute(i,i),i}},v.each(v.expr.match.bool.source.match(/\w+/g),function(e,t){var i=ut[t]||v.find.attr;ut[t]=function(e,t,n){var s,r,o=t.toLowerCase();return n||(r=ut[o],ut[o]=s,s=null!=i(e,t,n)?o:null,ut[o]=r),s}});var dt=/^(?:input|select|textarea|button)$/i,pt=/^(?:a|area)$/i;function gt(e){return(e.match(Y)||[]).join(" ")}function ft(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(Y)||[]}v.fn.extend({prop:function(e,t){return ee(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[v.propFix[e]||e]})}}),v.extend({prop:function(e,t,i){var n,s,r=e.nodeType;if(3!==r&&8!==r&&2!==r)return 1===r&&v.isXMLDoc(e)||(t=v.propFix[t]||t,s=v.propHooks[t]),void 0!==i?s&&"set"in s&&void 0!==(n=s.set(e,i,t))?n:e[t]=i:s&&"get"in s&&null!==(n=s.get(e,t))?n:e[t]},propHooks:{tabIndex:{get:function(e){var t=v.find.attr(e,"tabindex");return t?parseInt(t,10):dt.test(e.nodeName)||pt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),m.optSelected||(v.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),v.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){v.propFix[this.toLowerCase()]=this}),v.fn.extend({addClass:function(e){var t,i,n,s,r,o;return A(e)?this.each(function(t){v(this).addClass(e.call(this,t,ft(this)))}):(t=mt(e)).length?this.each(function(){if(n=ft(this),i=1===this.nodeType&&" "+gt(n)+" "){for(r=0;r<t.length;r++)s=t[r],i.indexOf(" "+s+" ")<0&&(i+=s+" ");o=gt(i),n!==o&&this.setAttribute("class",o)}}):this},removeClass:function(e){var t,i,n,s,r,o;return A(e)?this.each(function(t){v(this).removeClass(e.call(this,t,ft(this)))}):arguments.length?(t=mt(e)).length?this.each(function(){if(n=ft(this),i=1===this.nodeType&&" "+gt(n)+" "){for(r=0;r<t.length;r++)for(s=t[r];i.indexOf(" "+s+" ")>-1;)i=i.replace(" "+s+" "," ");o=gt(i),n!==o&&this.setAttribute("class",o)}}):this:this.attr("class","")},toggleClass:function(e,t){var i,n,s,r,o=typeof e,a="string"===o||Array.isArray(e);return A(e)?this.each(function(i){v(this).toggleClass(e.call(this,i,ft(this),t),t)}):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(i=mt(e),this.each(function(){if(a)for(r=v(this),s=0;s<i.length;s++)n=i[s],r.hasClass(n)?r.removeClass(n):r.addClass(n);else void 0!==e&&"boolean"!==o||((n=ft(this))&&ae.set(this,"__className__",n),this.setAttribute&&this.setAttribute("class",n||!1===e?"":ae.get(this,"__className__")||""))}))},hasClass:function(e){var t,i,n=0;for(t=" "+e+" ";i=this[n++];)if(1===i.nodeType&&(" "+gt(ft(i))+" ").indexOf(t)>-1)return!0;return!1}});var At=/\r/g;v.fn.extend({val:function(e){var t,i,n,s=this[0];return arguments.length?(n=A(e),this.each(function(i){var s;1===this.nodeType&&(null==(s=n?e.call(this,i,v(this).val()):e)?s="":"number"==typeof s?s+="":Array.isArray(s)&&(s=v.map(s,function(e){return null==e?"":e+""})),(t=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,s,"value")||(this.value=s))})):s?(t=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()])&&"get"in t&&void 0!==(i=t.get(s,"value"))?i:"string"==typeof(i=s.value)?i.replace(At,""):null==i?"":i:void 0}}),v.extend({valHooks:{option:{get:function(e){var t=v.find.attr(e,"value");return null!=t?t:gt(v.text(e))}},select:{get:function(e){var t,i,n,s=e.options,r=e.selectedIndex,o="select-one"===e.type,a=o?null:[],l=o?r+1:s.length;for(n=r<0?l:o?r:0;n<l;n++)if(((i=s[n]).selected||n===r)&&!i.disabled&&(!i.parentNode.disabled||!E(i.parentNode,"optgroup"))){if(t=v(i).val(),o)return t;a.push(t)}return a},set:function(e,t){for(var i,n,s=e.options,r=v.makeArray(t),o=s.length;o--;)((n=s[o]).selected=v.inArray(v.valHooks.option.get(n),r)>-1)&&(i=!0);return i||(e.selectedIndex=-1),r}}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=v.inArray(v(e).val(),t)>-1}},m.checkOn||(v.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),v.parseXML=function(e){var t,i;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){}return i=t&&t.getElementsByTagName("parsererror")[0],t&&!i||v.error("Invalid XML: "+(i?v.map(i.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var _t=/^(?:focusinfocus|focusoutblur)$/,yt=function(e){e.stopPropagation()};v.extend(v.event,{trigger:function(e,t,i,s){var r,o,a,l,h,c,u,d,g=[i||y],f=p.call(e,"type")?e.type:e,m=p.call(e,"namespace")?e.namespace.split("."):[];if(o=d=a=i=i||y,3!==i.nodeType&&8!==i.nodeType&&!_t.test(f+v.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),h=f.indexOf(":")<0&&"on"+f,(e=e[v.expando]?e:new v.Event(f,"object"==typeof e&&e)).isTrigger=s?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),t=null==t?[e]:v.makeArray(t,[e]),u=v.event.special[f]||{},s||!u.trigger||!1!==u.trigger.apply(i,t))){if(!s&&!u.noBubble&&!_(i)){for(l=u.delegateType||f,_t.test(l+f)||(o=o.parentNode);o;o=o.parentNode)g.push(o),a=o;a===(i.ownerDocument||y)&&g.push(a.defaultView||a.parentWindow||n)}for(r=0;(o=g[r++])&&!e.isPropagationStopped();)d=o,e.type=r>1?l:u.bindType||f,(c=(ae.get(o,"events")||Object.create(null))[e.type]&&ae.get(o,"handle"))&&c.apply(o,t),(c=h&&o[h])&&c.apply&&re(o)&&(e.result=c.apply(o,t),!1===e.result&&e.preventDefault());return e.type=f,s||e.isDefaultPrevented()||u._default&&!1!==u._default.apply(g.pop(),t)||!re(i)||h&&A(i[f])&&!_(i)&&((a=i[h])&&(i[h]=null),v.event.triggered=f,e.isPropagationStopped()&&d.addEventListener(f,yt),i[f](),e.isPropagationStopped()&&d.removeEventListener(f,yt),v.event.triggered=void 0,a&&(i[h]=a)),e.result}},simulate:function(e,t,i){var n=v.extend(new v.Event,i,{type:e,isSimulated:!0});v.event.trigger(n,null,t)}}),v.fn.extend({trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];if(i)return v.event.trigger(e,t,i,!0)}});var wt,xt=/\[\]$/,bt=/\r?\n/g,St=/^(?:submit|button|image|reset|file)$/i,Tt=/^(?:input|select|textarea|keygen)/i;function vt(e,t,i,n){var s;if(Array.isArray(t))v.each(t,function(t,s){i||xt.test(e)?n(e,s):vt(e+"["+("object"==typeof s&&null!=s?t:"")+"]",s,i,n)});else if(i||"object"!==b(t))n(e,t);else for(s in t)vt(e+"["+s+"]",t[s],i,n)}v.param=function(e,t){var i,n=[],s=function(e,t){var i=A(t)?t():t;n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==i?"":i)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(i in e)vt(i,e[i],t,s);return n.join("&")},v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=v.prop(this,"elements");return e?v.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!v(this).is(":disabled")&&Tt.test(this.nodeName)&&!St.test(e)&&(this.checked||!Te.test(e))}).map(function(e,t){var i=v(this).val();return null==i?null:Array.isArray(i)?v.map(i,function(e){return{name:t.name,value:e.replace(bt,"\r\n")}}):{name:t.name,value:i.replace(bt,"\r\n")}}).get()}}),v.fn.extend({wrapAll:function(e){var t;return this[0]&&(A(e)&&(e=e.call(this[0])),t=v(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return A(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=A(e);return this.each(function(i){v(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){v(this).replaceWith(this.childNodes)}),this}}),v.expr.pseudos.hidden=function(e){return!v.expr.pseudos.visible(e)},v.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},m.createHTMLDocument=((wt=y.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===wt.childNodes.length),v.parseHTML=function(e,t,i){return"string"!=typeof e?[]:("boolean"==typeof t&&(i=t,t=!1),t||(m.createHTMLDocument?((n=(t=y.implementation.createHTMLDocument("")).createElement("base")).href=y.location.href,t.head.appendChild(n)):t=y),r=!i&&[],(s=j.exec(e))?[t.createElement(s[1])]:(s=Fe([e],t,r),r&&r.length&&v(r).remove(),v.merge([],s.childNodes)));var n,s,r},v.offset={setOffset:function(e,t,i){var n,s,r,o,a,l,h=v.css(e,"position"),c=v(e),u={};"static"===h&&(e.style.position="relative"),a=c.offset(),r=v.css(e,"top"),l=v.css(e,"left"),("absolute"===h||"fixed"===h)&&(r+l).indexOf("auto")>-1?(o=(n=c.position()).top,s=n.left):(o=parseFloat(r)||0,s=parseFloat(l)||0),A(t)&&(t=t.call(e,i,v.extend({},a))),null!=t.top&&(u.top=t.top-a.top+o),null!=t.left&&(u.left=t.left-a.left+s),"using"in t?t.using.call(e,u):c.css(u)}},v.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){v.offset.setOffset(this,e,t)});var t,i,n=this[0];return n?n.getClientRects().length?(t=n.getBoundingClientRect(),i=n.ownerDocument.defaultView,{top:t.top+i.pageYOffset,left:t.left+i.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,i,n=this[0],s={top:0,left:0};if("fixed"===v.css(n,"position"))t=n.getBoundingClientRect();else{for(t=this.offset(),i=n.ownerDocument,e=n.offsetParent||i.documentElement;e&&(e===i.body||e===i.documentElement)&&"static"===v.css(e,"position");)e=e.parentNode;e&&e!==n&&1===e.nodeType&&((s=v(e).offset()).top+=v.css(e,"borderTopWidth",!0),s.left+=v.css(e,"borderLeftWidth",!0))}return{top:t.top-s.top-v.css(n,"marginTop",!0),left:t.left-s.left-v.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===v.css(e,"position");)e=e.offsetParent;return e||fe})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var i="pageYOffset"===t;v.fn[e]=function(n){return ee(this,function(e,n,s){var r;if(_(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===s)return r?r[t]:e[n];r?r.scrollTo(i?r.pageXOffset:s,i?s:r.pageYOffset):e[n]=s},e,n,arguments.length)}}),v.each(["top","left"],function(e,t){v.cssHooks[t]=Je(m.pixelPosition,function(e,i){if(i)return i=Qe(e,t),Ye.test(i)?v(e).position()[t]+"px":i})}),v.each({Height:"height",Width:"width"},function(e,t){v.each({padding:"inner"+e,content:t,"":"outer"+e},function(i,n){v.fn[n]=function(s,r){var o=arguments.length&&(i||"boolean"!=typeof s),a=i||(!0===s||!0===r?"margin":"border");return ee(this,function(t,i,s){var r;return _(t)?0===n.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(r=t.documentElement,Math.max(t.body["scroll"+e],r["scroll"+e],t.body["offset"+e],r["offset"+e],r["client"+e])):void 0===s?v.css(t,i,a):v.style(t,i,s,a)},t,o?s:void 0,o)}})}),v.fn.extend({bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,i,n){return this.on(t,e,i,n)},undelegate:function(e,t,i){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",i)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),v.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){v.fn[t]=function(e,i){return arguments.length>0?this.on(t,null,e,i):this.trigger(t)}});var Ot=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;v.proxy=function(e,t){var i,n,s;if("string"==typeof t&&(i=e[t],t=e,e=i),A(e))return n=a.call(arguments,2),s=function(){return e.apply(t||this,n.concat(a.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s},v.holdReady=function(e){e?v.readyWait++:v.ready(!0)},v.isArray=Array.isArray,v.parseJSON=JSON.parse,v.nodeName=E,v.isFunction=A,v.isWindow=_,v.camelCase=se,v.type=b,v.now=Date.now,v.isNumeric=function(e){var t=v.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},v.trim=function(e){return null==e?"":(e+"").replace(Ot,"$1")},void 0===(i=function(){return v}.apply(t,[]))||(e.exports=i);var Et=n.jQuery,Nt=n.$;return v.noConflict=function(e){return n.$===v&&(n.$=Nt),e&&n.jQuery===v&&(n.jQuery=Et),v},void 0===s&&(n.jQuery=n.$=v),v},"object"==typeof e.exports?e.exports=n.document?s(n,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return s(e)}:s(n)},9351(e,t,i){i.d(t,{A:()=>n});const n=i(2696).A.add("LATEST_VERSION","4.0")},9401(e,t,i){i.d(t,{A:()=>f});var n=i(5185),s=i(2696);const{interval:r,degrees:o}=n.A,a=Symbol.for("X_ITE.Color3.r"),l=Symbol.for("X_ITE.Color3.g"),h=Symbol.for("X_ITE.Color3.b");function c(e=0,t=e,i=t){this[a]=e,this[l]=t,this[h]=i}Object.assign(c.prototype,{*[Symbol.iterator](){yield this[a],yield this[l],yield this[h]},copy(){const e=Object.create(c.prototype);return e[a]=this[a],e[l]=this[l],e[h]=this[h],e},assign(e){return this[a]=e[a],this[l]=e[l],this[h]=e[h],this},set(e=0,t=e,i=t){return this[a]=e,this[l]=t,this[h]=i,this},equals(e){return this[a]===e[a]&&this[l]===e[l]&&this[h]===e[h]},getHSV(e=[]){let t,i,n;const s=this[a],r=this[l],o=this[h],c=Math.min(s,r,o),u=Math.max(s,r,o);n=u;const d=u-c;return 0!==u&&0!==d?(i=d/u,t=s===u?(r-o)/d:r===u?2+(o-s)/d:4+(s-r)/d,t*=Math.PI/3,t<0&&(t+=2*Math.PI)):i=t=0,e[0]=t,e[1]=i,e[2]=n,e},setHSV(e,t,i){if(t=Math.max(t,0),i=Math.max(i,0),0===t)this[a]=this[l]=this[h]=i;else{const n=o(r(e,0,2*Math.PI))/60,s=Math.floor(n),c=n-s,u=i*(1-t),d=i*(1-t*c),p=i*(1-t*(1-c));switch(s%6){case 0:this[a]=i,this[l]=p,this[h]=u;break;case 1:this[a]=d,this[l]=i,this[h]=u;break;case 2:this[a]=u,this[l]=i,this[h]=p;break;case 3:this[a]=u,this[l]=d,this[h]=i;break;case 4:this[a]=p,this[l]=u,this[h]=i;break;default:this[a]=i,this[l]=u,this[h]=d}}return this},linearToSRGB(e=new c){return e[a]=Math.pow(this[a],1/2.2),e[l]=Math.pow(this[l],1/2.2),e[h]=Math.pow(this[h],1/2.2),e},sRGBToLinear(e=new c){return e[a]=Math.pow(this[a],2.2),e[l]=Math.pow(this[l],2.2),e[h]=Math.pow(this[h],2.2),e},toString(){return this[a]+" "+this[l]+" "+this[h]}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});const u={get(){return this[a]},set(e){this[a]=e}},d={get(){return this[l]},set(e){this[l]=e}},p={get(){return this[h]},set(e){this[h]=e}};Object.defineProperties(c.prototype,{length:{value:3},0:u,1:d,2:p,r:Object.assign({enumerable:!0},u),g:Object.assign({enumerable:!0},d),b:Object.assign({enumerable:!0},p)}),Object.assign(c,{BLACK:Object.freeze(new c),WHITE:Object.freeze(new c(1)),HSV(e,t,i){const n=Object.create(this.prototype);return n.setHSV(e,t,i),n},lerp(e,t,i,n){let[s,r,o]=e,[a,l,h]=t;0===r&&(s=a),0===l&&(a=s);const c=Math.abs(a-s);if(c<=Math.PI)return n[0]=s+i*(a-s),n[1]=r+i*(l-r),n[2]=o+i*(h-o),n;const u=2*Math.PI,d=(u-c)*i;let p=s<a?s-d:s+d;return p<0?p+=u:p>u&&(p-=u),n[0]=p,n[1]=r+i*(l-r),n[2]=o+i*(h-o),n}});const g=c,f=s.A.add("Color3",g)},9582(e,t,i){i.d(t,{A:()=>g});var n=i(477),s=i(8392),r=i(3937),o=i(5319),a=i(1256),l=i(5575),h=i(2696);function c(...e){if(e.length)for(let t=0;t<16;++t)this[t]=e[t];else this.identity()}Object.assign(c.prototype,{*[Symbol.iterator](){for(let e=0;e<16;++e)yield this[e]},copy(){const e=Object.create(c.prototype);for(let t=0;t<16;++t)e[t]=this[t];return e},assign(e){for(let t=0;t<16;++t)this[t]=e[t];return this},equals(e){return this[0]===e[0]&&this[1]===e[1]&&this[2]===e[2]&&this[3]===e[3]&&this[4]===e[4]&&this[5]===e[5]&&this[6]===e[6]&&this[7]===e[7]&&this[8]===e[8]&&this[9]===e[9]&&this[10]===e[10]&&this[11]===e[11]&&this[12]===e[12]&&this[13]===e[13]&&this[14]===e[14]&&this[15]===e[15]},set1(e,t,i){return this[e*this.order+t]=i,this},get1(e,t){return this[e*this.order+t]},set:(()=>{const e=new o.A,t=new n.A;return function(i,s,r,a,l){switch(this.identity(),arguments.length){case 1:i&&!i.equals(n.A.ZERO)&&this.translate(i);break;case 2:i&&!i.equals(n.A.ZERO)&&this.translate(i),s&&!s.equals(o.A.IDENTITY)&&this.rotate(s);break;case 3:i&&!i.equals(n.A.ZERO)&&this.translate(i),s&&!s.equals(o.A.IDENTITY)&&this.rotate(s),r&&!r.equals(n.A.ONE)&&this.scale(r);break;case 4:i&&!i.equals(n.A.ZERO)&&this.translate(i),s&&!s.equals(o.A.IDENTITY)&&this.rotate(s),r&&!r.equals(n.A.ONE)&&(a&&!a.equals(o.A.IDENTITY)?(this.rotate(a),this.scale(r),this.rotate(e.assign(a).inverse())):this.scale(r));break;case 5:{i&&!i.equals(n.A.ZERO)&&this.translate(i);const h=l&&!l.equals(n.A.ZERO);h&&this.translate(l),s&&!s.equals(o.A.IDENTITY)&&this.rotate(s),r&&!r.equals(n.A.ONE)&&(a&&!a.equals(o.A.IDENTITY)?(this.rotate(a),this.scale(r),this.rotate(e.assign(a).inverse())):this.scale(r)),h&&this.translate(t.assign(l).negate());break}case 16:for(let e=0;e<16;++e)this[e]=arguments[e]}return this}})(),get:(()=>{const e=new n.A;return function(t,i,n,s,r){switch(arguments.length){case 1:t.set(this[12],this[13],this[14]);break;case 2:case 3:case 4:this.factor(t,i,n,s);break;case 5:r?(d.set(e.assign(r).negate()),d.multLeft(this),d.translate(r),d.get(t,i,n,s)):this.factor(t,i,n,s)}}})(),setRotation(e){return this.setQuaternion(e.getQuaternion(u))},setQuaternion(e){const{x:t,y:i,z:n,w:s}=e,r=i*i,o=n*n,a=t*i,l=n*s,h=n*t,c=i*s,u=t*t,d=i*n,p=t*s;return this[0]=1-2*(r+o),this[1]=2*(a+l),this[2]=2*(h-c),this[3]=0,this[4]=2*(a-l),this[5]=1-2*(o+u),this[6]=2*(d+p),this[7]=0,this[8]=2*(h+c),this[9]=2*(d-p),this[10]=1-2*(r+u),this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},factor:(()=>{const e=new n.A,t=new a.A,i=new a.A,s=new a.A,r={values:[],vectors:[[],[],[]]};return function(n,o,a,h){n?.set(this[12],this[13],this[14]);const c=this.submatrix,u=c.determinant()<0?-1:1;s.assign(c).transpose().multLeft(c);const d=(0,l.A)(s,r);i.set(d.vectors[0][0],d.vectors[1][0],d.vectors[2][0],d.vectors[0][1],d.vectors[1][1],d.vectors[2][1],d.vectors[0][2],d.vectors[1][2],d.vectors[2][2]),h?.setMatrix(i),e.set(u*Math.sqrt(d.values[0]),u*Math.sqrt(d.values[1]),u*Math.sqrt(d.values[2])),a?.assign(e),o&&(t[0]=1/e.x,t[4]=1/e.y,t[8]=1/e.z,o.setMatrix(c.multLeft(i).multLeft(t).multLeft(i.transpose())))}})(),determinant3(){const{0:e,1:t,2:i,4:n,5:s,6:r,8:o,9:a,10:l}=this;return e*(s*l-r*a)-t*(n*l-r*o)+i*(n*a-s*o)},determinant(){const{0:e,1:t,2:i,3:n,4:s,5:r,6:o,7:a,8:l,9:h,10:c,11:u,12:d,13:p,14:g,15:f}=this,m=c*f,A=g*u,_=o*f,y=g*a,w=o*u,x=c*a,b=i*f,S=g*n,T=i*u,v=c*n,O=i*a,E=o*n;return e*(m*r+y*h+w*p-A*r-_*h-x*p)+s*(A*t+b*h+v*p-m*t-S*h-T*p)+l*(_*t+S*r+O*p-y*t-b*r-E*p)+d*(x*t+T*r+E*h-w*t-v*r-O*h)},transpose(){let e;return e=this[1],this[1]=this[4],this[4]=e,e=this[2],this[2]=this[8],this[8]=e,e=this[3],this[3]=this[12],this[12]=e,e=this[6],this[6]=this[9],this[9]=e,e=this[7],this[7]=this[13],this[13]=e,e=this[11],this[11]=this[14],this[14]=e,this},inverse(){const{0:e,1:t,2:i,3:n,4:s,5:r,6:o,7:a,8:l,9:h,10:c,11:u,12:d,13:p,14:g,15:f}=this,m=c*f,A=g*u,_=o*f,y=g*a,w=o*u,x=c*a,b=i*f,S=g*n,T=i*u,v=c*n,O=i*a,E=o*n,N=l*p,C=d*h,I=s*p,F=d*r,M=s*h,R=l*r,P=e*p,V=d*t,D=e*h,L=l*t,B=e*r,k=s*t,j=m*r+y*h+w*p-(A*r+_*h+x*p),U=A*t+b*h+v*p-(m*t+S*h+T*p),X=_*t+S*r+O*p-(y*t+b*r+E*p),z=x*t+T*r+E*h-(w*t+v*r+O*h);let G=e*j+s*U+l*X+d*z;return G=1/G,this[0]=G*j,this[1]=G*U,this[2]=G*X,this[3]=G*z,this[4]=G*(A*s+_*l+x*d-m*s-y*l-w*d),this[5]=G*(m*e+S*l+T*d-A*e-b*l-v*d),this[6]=G*(y*e+b*s+E*d-_*e-S*s-O*d),this[7]=G*(w*e+v*s+O*l-x*e-T*s-E*l),this[8]=G*(N*a+F*u+M*f-C*a-I*u-R*f),this[9]=G*(C*n+P*u+L*f-N*n-V*u-D*f),this[10]=G*(I*n+V*a+B*f-F*n-P*a-k*f),this[11]=G*(R*n+D*a+k*u-M*n-L*a-B*u),this[12]=G*(I*c+R*g+C*o-M*g-N*o-F*c),this[13]=G*(D*g+N*i+V*c-P*c-L*g-C*i),this[14]=G*(P*o+k*g+F*i-B*g-I*i-V*o),this[15]=G*(B*c+M*i+L*o-D*o-k*c-R*i),this},multLeft(e){const{0:t,1:i,2:n,3:s,4:r,5:o,6:a,7:l,8:h,9:c,10:u,11:d,12:p,13:g,14:f,15:m}=this,{0:A,1:_,2:y,3:w,4:x,5:b,6:S,7:T,8:v,9:O,10:E,11:N,12:C,13:I,14:F,15:M}=e;return this[0]=t*A+r*_+h*y+p*w,this[1]=i*A+o*_+c*y+g*w,this[2]=n*A+a*_+u*y+f*w,this[3]=s*A+l*_+d*y+m*w,this[4]=t*x+r*b+h*S+p*T,this[5]=i*x+o*b+c*S+g*T,this[6]=n*x+a*b+u*S+f*T,this[7]=s*x+l*b+d*S+m*T,this[8]=t*v+r*O+h*E+p*N,this[9]=i*v+o*O+c*E+g*N,this[10]=n*v+a*O+u*E+f*N,this[11]=s*v+l*O+d*E+m*N,this[12]=t*C+r*I+h*F+p*M,this[13]=i*C+o*I+c*F+g*M,this[14]=n*C+a*I+u*F+f*M,this[15]=s*C+l*I+d*F+m*M,this},multRight(e){const{0:t,1:i,2:n,3:s,4:r,5:o,6:a,7:l,8:h,9:c,10:u,11:d,12:p,13:g,14:f,15:m}=this,{0:A,1:_,2:y,3:w,4:x,5:b,6:S,7:T,8:v,9:O,10:E,11:N,12:C,13:I,14:F,15:M}=e;return this[0]=t*A+i*x+n*v+s*C,this[1]=t*_+i*b+n*O+s*I,this[2]=t*y+i*S+n*E+s*F,this[3]=t*w+i*T+n*N+s*M,this[4]=r*A+o*x+a*v+l*C,this[5]=r*_+o*b+a*O+l*I,this[6]=r*y+o*S+a*E+l*F,this[7]=r*w+o*T+a*N+l*M,this[8]=h*A+c*x+u*v+d*C,this[9]=h*_+c*b+u*O+d*I,this[10]=h*y+c*S+u*E+d*F,this[11]=h*w+c*T+u*N+d*M,this[12]=p*A+g*x+f*v+m*C,this[13]=p*_+g*b+f*O+m*I,this[14]=p*y+g*S+f*E+m*F,this[15]=p*w+g*T+f*N+m*M,this},multVecMatrix(e){if(3===e.length){const{x:t,y:i,z:n}=e,s=1/(t*this[3]+i*this[7]+n*this[11]+this[15]);return e.x=(t*this[0]+i*this[4]+n*this[8]+this[12])*s,e.y=(t*this[1]+i*this[5]+n*this[9]+this[13])*s,e.z=(t*this[2]+i*this[6]+n*this[10]+this[14])*s,e}{const{x:t,y:i,z:n,w:s}=e;return e.x=t*this[0]+i*this[4]+n*this[8]+s*this[12],e.y=t*this[1]+i*this[5]+n*this[9]+s*this[13],e.z=t*this[2]+i*this[6]+n*this[10]+s*this[14],e.w=t*this[3]+i*this[7]+n*this[11]+s*this[15],e}},multMatrixVec(e){if(3===e.length){const{x:t,y:i,z:n}=e,s=1/(t*this[12]+i*this[13]+n*this[14]+this[15]);return e.x=(t*this[0]+i*this[1]+n*this[2]+this[3])*s,e.y=(t*this[4]+i*this[5]+n*this[6]+this[7])*s,e.z=(t*this[8]+i*this[9]+n*this[10]+this[11])*s,e}{const{x:t,y:i,z:n,w:s}=e;return e.x=t*this[0]+i*this[1]+n*this[2]+s*this[3],e.y=t*this[4]+i*this[5]+n*this[6]+s*this[7],e.z=t*this[8]+i*this[9]+n*this[10]+s*this[11],e.w=t*this[12]+i*this[13]+n*this[14]+s*this[15],e}},multDirMatrix(e){const{x:t,y:i,z:n}=e;return e.x=t*this[0]+i*this[4]+n*this[8],e.y=t*this[1]+i*this[5]+n*this[9],e.z=t*this[2]+i*this[6]+n*this[10],e},multMatrixDir(e){const{x:t,y:i,z:n}=e;return e.x=t*this[0]+i*this[1]+n*this[2],e.y=t*this[4]+i*this[5]+n*this[6],e.z=t*this[8]+i*this[9]+n*this[10],e},identity(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this},translate(e){const{x:t,y:i,z:n}=e;return this[12]+=this[0]*t+this[4]*i+this[8]*n,this[13]+=this[1]*t+this[5]*i+this[9]*n,this[14]+=this[2]*t+this[6]*i+this[10]*n,this},rotate(e){return this.multLeft(d.setQuaternion(e.getQuaternion(u)))},scale(e){const{x:t,y:i,z:n}=e;return this[0]*=t,this[4]*=i,this[8]*=n,this[1]*=t,this[5]*=i,this[9]*=n,this[2]*=t,this[6]*=i,this[10]*=n,this},toString(){return Array.prototype.join.call(this," ")}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});Object.defineProperties(c.prototype,{order:{value:4},length:{value:16},x:{get:(()=>{const e=new s.A;return function(){return e.set(this[0],this[1],this[2],this[3])}})()},y:{get:(()=>{const e=new s.A;return function(){return e.set(this[4],this[5],this[6],this[7])}})()},z:{get:(()=>{const e=new s.A;return function(){return e.set(this[8],this[9],this[10],this[11])}})()},w:{get:(()=>{const e=new s.A;return function(){return e.set(this[12],this[13],this[14],this[15])}})()},xAxis:{get:(()=>{const e=new n.A;return function(){return e.set(this[0],this[1],this[2])}})()},yAxis:{get:(()=>{const e=new n.A;return function(){return e.set(this[4],this[5],this[6])}})()},zAxis:{get:(()=>{const e=new n.A;return function(){return e.set(this[8],this[9],this[10])}})()},origin:{get:(()=>{const e=new n.A;return function(){return e.set(this[12],this[13],this[14])}})()},submatrix:{get:(()=>{const e=new a.A;return function(){return e[0]=this[0],e[1]=this[1],e[2]=this[2],e[3]=this[4],e[4]=this[5],e[5]=this[6],e[6]=this[8],e[7]=this[9],e[8]=this[10],e}})()}}),Object.assign(c,{IDENTITY:Object.freeze(new c),Rotation(e){return Object.create(this.prototype).setQuaternion(e.getQuaternion(u))},Quaternion(e){return Object.create(this.prototype).setQuaternion(e)},Matrix3:e=>new c(e[0],e[1],0,0,e[3],e[4],0,0,0,0,1,0,e[6],e[7],0,1),SubMatrix:e=>new c(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1)});const u=new r.A,d=new c,p=c,g=h.A.add("Matrix4",p)},9713(e,t,i){i.d(t,{A:()=>c});var n=i(8015),s=i(8001),r=i(2141),o=i(5053),a=i(2696);function l(e){r.A.call(this,e),this.addType(o.A.X3DTextureNode),this.addChildObjects(o.A.outputOnly,"transparent",new n.A.SFBool)}Object.assign(Object.setPrototypeOf(l.prototype,r.A.prototype),{setTransparent(e){!!e!==this._transparent.getValue()&&(this._transparent=e)},isTransparent(){return this._transparent.getValue()}}),Object.defineProperties(l,s.A.getStaticProperties("X3DTextureNode","Texturing",1));const h=l,c=a.A.add("X3DTextureNode",h)},9721(e,t,i){i.d(t,{A:()=>I});var n=i(5053),s=i(5185),r=i(2695),o=i(2696);function a({style:e="TIDY",indent:t="",indentChar:i=" ",precision:n=7,doublePrecision:r=15,names:o=!0}={}){this.string="",this.indent=t,this.listIndent=t,this.precision=s.A.clamp(n,1,21),this.doublePrecision=s.A.clamp(r,1,21),this.outputNames=o,this.floatFormat=this.createFloatFormat(this.precision),this.floatExponentialFormat=this.createFloatExponentialFormat(this.precision),this.doubleFormat=this.createFloatFormat(this.doublePrecision),this.doubleExponentialFormat=this.createFloatExponentialFormat(this.doublePrecision),this.Style(e,i),this.executionContextStack=[],this.executionContextIndex=new Set,this.importedNodesIndex=new Map,this.importedNames=new Map,this.exportedNodesIndex=new Map,this.nodes=new Map,this.names=new Map,this.namesByNode=new Map,this.routeNodes=new Map}Object.assign(a.prototype,{Style(e,t=" "){switch(e){case"CLEAN":this.listIndent="",this.comma=" ",this.break=" ",this.tidyBreak="",this.tidySpace="",this.indentChar="",this.listEnclosure="",this.listBreak="",this.listIndentChar="",this.attribBreak=" ";break;case"SMALL":this.listIndent="",this.comma=",",this.break="\n",this.tidyBreak="\n",this.tidySpace="",this.indentChar="",this.listEnclosure="",this.listBreak="",this.listIndentChar="",this.attribBreak=" ";break;case"COMPACT":this.listIndent="",this.comma=",",this.break="\n",this.tidyBreak="\n",this.tidySpace=" ",this.indentChar=t,this.listEnclosure=" ",this.listBreak=" ",this.listIndentChar="",this.attribBreak=" ";break;default:this.comma=",",this.break="\n",this.tidyBreak="\n",this.tidySpace=" ",this.indentChar=t,this.listEnclosure="\n",this.listBreak="\n",this.listIndentChar=this.indentChar,this.attribBreak="\n"}},Comma(){this.string+=this.comma},Break(){this.needsSpace=!1,this.string+=this.break},TidyBreak(){this.needsSpace&&=!this.tidyBreak,this.string+=this.tidyBreak},Space(){this.needsSpace=!1,this.string+=" "},TidySpace(){this.needsSpace&&=!this.tidySpace,this.string+=this.tidySpace},ListStart(){this.string+=this.listEnclosure},ListEnd(){this.string+=this.listEnclosure},ListBreak(){this.string+=this.listBreak},AttribBreak(){this.string+=this.attribBreak},Indent(){this.string+=this.indent},ListIndent(){this.string+=this.listIndent},IncIndent(){this.indent+=this.indentChar,this.listIndent+=this.listIndentChar},DecIndent(){this.indent=this.indent.slice(0,-this.indentChar.length),this.listIndent=this.listIndent.slice(0,-this.listIndentChar.length)},NeedsSpace(){this.needsSpace=!0},CheckSpace(){this.needsSpace&&(this.string+=" "),this.needsSpace=!1},createFloatFormat:e=>new Intl.NumberFormat("en",{notation:"standard",maximumSignificantDigits:e,useGrouping:!1}).format,createFloatExponentialFormat:e=>new Intl.NumberFormat("en",{notation:"scientific",maximumSignificantDigits:e,useGrouping:!1}).format,FloatFormat(e){if(Number.isFinite(e)){const t=Math.log10(Math.abs(e));return this.precision>t&&t>=-4||0===e?this.floatFormat(e):this.floatExponentialFormat(e).toLowerCase()}return String(e)},DoubleFormat(e){if(Number.isFinite(e)){const t=Math.log10(Math.abs(e));return this.doublePrecision>t&&t>=-4||0===e?this.doubleFormat(e):this.doubleExponentialFormat(e).toLowerCase()}return String(e)},PushExecutionContext(e){this.executionContextStack.push(e),this.executionContextIndex.has(e)||(this.executionContextIndex.add(e),this.importedNodesIndex.set(e,new Set),this.importedNames.set(e,new Map),this.exportedNodesIndex.set(e,new Set),this.nodes.set(e,new Set),this.names.set(e,new Set),this.namesByNode.set(e,new Map),this.routeNodes.set(e,new Set),this.needsSpace=!1)},PopExecutionContext(){const e=this.executionContextStack.pop();this.executionContextStack.at(-1)!==e&&(this.executionContextIndex.delete(e),this.importedNodesIndex.delete(e),this.importedNames.delete(e),this.exportedNodesIndex.delete(e),this.nodes.delete(e),this.names.delete(e),this.namesByNode.delete(e),this.routeNodes.delete(e))},ExecutionContext(){return this.executionContextStack.at(-1)},NamedNodes(e){const t=this.names.get(this.ExecutionContext()),i=this.namesByNode.get(this.ExecutionContext());for(const n of e)n.getNodeName().match(/^_\d+$/)||(t.add(n.getNodeName()),i.set(n.getValue(),n.getNodeName()))},ExportedNodes(e){const t=this.exportedNodesIndex.get(this.ExecutionContext());for(const i of e)t.add(i.getLocalNode())},ImportedNodes(e){const t=this.importedNodesIndex.get(this.ExecutionContext());for(const i of e)t.add(i.getInlineNode())},AddRouteNode(e){this.routeNodes.get(this.ExecutionContext()).add(e)},ExistsRouteNode(e){return this.routeNodes.get(this.ExecutionContext()).has(e)},IsSharedNode(e){return this.ExecutionContext()!==e.getExecutionContext()},AddNode(e){this.nodes.get(this.ExecutionContext()).add(e),this.AddRouteNode(e)},ExistsNode(e){return this.nodes.get(this.ExecutionContext()).has(e)},Name(e){const t=this.namesByNode.get(this.ExecutionContext()),i=t.get(e);if(void 0!==i)return i;{const i=this.names.get(this.ExecutionContext()),n=e.getName();if(n.match(/^(?:_\d+)?$/)&&!this.NeedsName(e))return"";const s=(0,r.l)(i,n);return i.add(s),t.set(e,s),s}},NeedsName(e){if(e.getCloneCount()>1)return!0;if(e.hasRoutes())return!0;const t=this.ExecutionContext();return!!this.importedNodesIndex.get(t).has(e)||!!this.exportedNodesIndex.get(t).has(e)},ImportedName(e){const t=this.importedNames.get(this.ExecutionContext());if(t.has(e))return t.get(e);const i=this.names.get(this.ExecutionContext()),n=(0,r.l)(i,e.getImportedName());return i.add(n),t.set(e,n),n},AccessType(e){switch(e){case n.A.initializeOnly:return"initializeOnly";case n.A.inputOnly:return"inputOnly";case n.A.outputOnly:return"outputOnly";case n.A.inputOutput:return"inputOutput"}},ToUnit(e,t){return this.ExecutionContext()?.toUnit(e,t)??t}});for(const e of Object.keys(a.prototype))Object.defineProperty(a.prototype,e,{enumerable:!1});const l=a,h=o.A.add("X3DGenerator",l);function c(e){h.call(this,e)}Object.assign(Object.setPrototypeOf(c.prototype,h.prototype),{NULL(){this.CheckSpace(),this.string+="NULL",this.NeedsSpace()}});for(const e of Object.keys(c.prototype))Object.defineProperty(c.prototype,e,{enumerable:!1});const u=c,d=o.A.add("VRMLGenerator",u);function p(e={}){h.call(this,e);const{html:t=!1,closingTags:i=!1}=e;this.html=t,this.closingTags=t||i,this.containerFields=[]}Object.assign(Object.setPrototypeOf(p.prototype,h.prototype),{PushContainerField(e){this.containerFields.push(e)},PopContainerField(){this.containerFields.pop()},EncodeString:(()=>{const e={"\\":"\\\\","\r":"
","\n":"
","\t":"	",'"':'\\"',"'":"'","<":"<",">":">","&":"&"},t=/([\\\r\n\t"'<>&])/g;return function(i){return String(i).replace(t,t=>e[t])}})(),EncodeSourceText:(()=>{const e={"\\":"\\\\",'"':'\\"',"'":"'","<":"<",">":">","&":"&"},t=/([\\"'<>&])/g;return function(i){return i.replace(t,t=>e[t])}})(),openingTag(e){this.Indent(),this.string+="<",this.string+=e,this.string+=">"},closingTag(e){this.Indent(),this.string+="</",this.string+=e,this.string+=">"},openTag(e){this.Indent(),this.string+="<",this.string+=e},endTag(){this.string+=">",this.TidyBreak()},closeTag(e){this.closingTags?(this.string+="></",this.string+=e,this.string+=">"):this.string+="/>"},attribute(e,t){this.Space(),this.string+=e,this.string+="='",this.string+=this.EncodeString(t),this.string+="'"},containerField(e){const t=this.containerFields.at(-1);t&&t.getName()!==e&&this.attribute("containerField",t.getName())}});for(const e of Object.keys(p.prototype))Object.defineProperty(p.prototype,e,{enumerable:!1});const g=p,f=o.A.add("XMLGenerator",g);function m(e){h.call(this,e)}Object.assign(Object.setPrototypeOf(m.prototype,h.prototype),{EncodeString:(()=>{const e={"\\":"\\\\","\r":"\\r","\n":"\\n","\t":"\\t",'"':'\\"'},t=/([\\\t\n\r"])/g;return function(i){return String(i).replace(t,t=>e[t])}})(),Number(e){switch(e){case"NaN":case"Infinity":case"-Infinity":return'"'+e+'"';default:return e}},RemoveComma(){this.string=this.string.replace(/,\s*$/s,"")},stringProperty(e,t,i=!0){i&&(this.string+=","),this.TidyBreak(),this.Indent(),this.string+='"',this.string+=e,this.string+='"',this.string+=":",this.TidySpace(),this.string+='"',this.string+=this.EncodeString(t),this.string+='"'},numberProperty(e,t,i=!0){i&&(this.string+=","),this.TidyBreak(),this.Indent(),this.string+='"',this.string+=e,this.string+='"',this.string+=":",this.TidySpace(),this.string+=t},beginObject(e,t=!0,i=!1){t&&(this.string+=","),e?i?(this.string+="{",this.TidySpace(),this.string+='"',this.string+=e,this.string+='"',this.string+=":",this.TidyBreak(),this.IncIndent(),this.Indent(),this.string+="{",this.IncIndent()):(this.TidyBreak(),this.Indent(),this.string+='"',this.string+=e,this.string+='"',this.string+=":",this.TidySpace(),this.string+="{",this.IncIndent()):(this.TidyBreak(),this.Indent(),this.string+="{",this.IncIndent())},endObject(){this.TidyBreak(),this.DecIndent(),this.Indent(),this.string+="}"},beginArray(e,t=!0){this.beginValue(e,t),this.string+="[",this.IncIndent()},endArray(){this.TidyBreak(),this.DecIndent(),this.Indent(),this.string+="]"},beginValue(e,t=!0){t&&(this.string+=","),this.TidyBreak(),this.Indent(),this.string+='"',this.string+=e,this.string+='"',this.string+=":",this.TidySpace()}});for(const e of Object.keys(m.prototype))Object.defineProperty(m.prototype,e,{enumerable:!1});const A=m,_=o.A.add("JSONGenerator",A);var y=i(2462),w=i(9340);const x=Symbol(),b=Symbol(),S=Symbol(),T=Symbol(),v=Symbol(),O=Symbol(),E=Symbol();function N(){}Object.assign(N.prototype,{[x]:"",[b]:null,[S]:null,[T]:null,getId(){return N.getId(this)},getTypeName(){return this.constructor.typeName},setName(e){this[x]=e},getName(){return this[x]},getDisplayName(){return this[x]},hasInterest(e,t){return this[b]?.has(N.getInterestId(t[e],t))??!1},addInterest(e,t,...i){const n=new WeakRef(t),s=t[e],r=N.getInterestId(s,t);this[S]??=new FinalizationRegistry(e=>{for(const t of this[b].keys())t.endsWith(e)&&this[b].delete(t)}),this[b]=new Map(this[b]),this[S].register(t,r.replace(/^[^:]+/,""),t),this[b].set(r,{callback:s,weakRef:n,args:i})},removeInterest(e,t){this[b]?.delete(N.getInterestId(t[e],t))},getInterests(){return this[b]??=new Map},processInterests:(()=>{const e=[];return function(){for(const{callback:t,weakRef:i,args:n}of this[b]?.values()??e){const e=i.deref();e&&t.call(e,...n,this)}}})(),getUserData(e){return this[T]?.get(e)},setUserData(e,t){this[T]??=new Map,this[T].set(e,t)},removeUserData(e){this[T]?.delete(e)},toString(e){const t=!e||w.isEmptyObject(e)?N[v]??=new d:new d(e);return t.string="",t.PushExecutionContext(e?.scene??null),this.toStream(t),t.PopExecutionContext(),t.string},toVRMLString(e){const t=!e||w.isEmptyObject(e)?N[v]??=new d:new d(e);return t.string="",t.PushExecutionContext(e?.scene??null),this.toVRMLStream(t),t.PopExecutionContext(),t.string},toXMLString(e){const t=!e||w.isEmptyObject(e)?N[O]??=new f:new f(e);return t.string="",t.PushExecutionContext(e?.scene??null),this.toXMLStream(t),t.PopExecutionContext(),t.string},toJSONString(e){const t=!e||w.isEmptyObject(e)?N[E]??=new _:new _(e);return t.string="",t.PushExecutionContext(e?.scene??null),this.toJSONStream(t),t.PopExecutionContext(),t.string},toStream(e){e.string=Object.prototype.toString.call(this)},dispose(){this[b]?.clear(),this[T]?.clear()}});for(const e of Object.keys(N.prototype))Object.defineProperty(N.prototype,e,{enumerable:!1});Object.defineProperties(N.prototype,{[Symbol.toStringTag]:{get(){return this.getTypeName()}}}),Object.assign(N,{[v]:null,[O]:null,[E]:null,getId:y.A.FINALIZATION_REGISTRY?(()=>{const e=new WeakMap,t=[],i=new FinalizationRegistry(e=>t.push(e));let n=0;return function(s){const r=e.get(s);if(void 0!==r)return r;{const r=t.pop()??++n;return e.set(s,r),i.register(s,r),r}}})():(()=>{const e=new WeakMap;let t=0;return function(i){const n=e.get(i);return void 0!==n?n:(e.set(i,++t),t)}})(),getInterestId(e,t){return`${this.getId(e)}:${this.getId(t)}`}});const C=N,I=o.A.add("X3DObject",C)},9949(e,t,i){i.d(t,{A:()=>l});var n=i(9721),s=i(3454),r=i(2696);function o(e,t,i,n,r=!1,o=[]){Object.defineProperties(this,{name:{value:e,enumerable:!0},level:{value:t,enumerable:!0},title:{value:i,enumerable:!0},providerURL:{value:n||s.A.getProviderURL(r&&e),enumerable:!0},external:{value:r},dependencies:{value:o}})}Object.assign(Object.setPrototypeOf(o.prototype,n.A.prototype),{toVRMLStream(e){e.Indent(),e.string+="COMPONENT",e.Space(),e.string+=this.name,e.TidySpace(),e.string+=":",e.TidySpace(),e.string+=this.level},toXMLStream(e){e.openTag("component"),e.attribute("name",this.name),e.attribute("level",this.level),e.closeTag("component")},toJSONStream(e){e.beginObject("",!1),e.stringProperty("@name",this.name,!1),e.numberProperty("@level",this.level),e.endObject()}});for(const e of Object.keys(o.prototype))Object.defineProperty(o.prototype,e,{enumerable:!1});Object.defineProperties(o,{typeName:{value:"ComponentInfo",enumerable:!0}}),Object.defineProperties(o.prototype,{providerUrl:{get:function(){return this.providerURL}}});const a=o,l=r.A.add("ComponentInfo",a)}},i={};function n(e){var s=i[e];if(void 0!==s)return s.exports;var r=i[e]={exports:{}};return t[e].call(r.exports,r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s=n(2696),r=n(5543),o=n(5717),a=n(3999),l=n(2804),h=n(5197),c=n(8015),u=n(9340);const d={elements(e,t){e.length&&(console.warn("Use of <X3DCanvas> element is depreciated, please use <x3d-canvas> element instead. See https://create3000.github.io/x_ite/#embedding-x_ite-within-a-web-page."),u.map(e,e=>new t(e)))},properties(e,t){if("X3DCANVAS"!==e.getElement().prop("nodeName").toUpperCase())return t;for(const[i,n]of Object.entries(t)){const t=n.set;t&&(n.set=function(n){t(n),e.attributeChangedCallback(i,void 0,n)})}return t},browser(e){const t=e.getElement();"X3DCANVAS"===t.prop("nodeName").toUpperCase()&&(t.attr("tabindex",t.attr("tabindex")??0),e.connectedCallback())},error(e,t){console.error(t),e.children(".x_ite-private-browser").hide(),e.children(":not(.x_ite-private-browser)").show()}},p=d,g=s.A.add("Legacy",p);var f=n(3788),m=n(5053);const A={excludes:new Set(["WEBGL_debug_renderer_info","WEBGL_polygon_mode"]),create(e,t){const i=e.getContext("webgl2",{antialias:!1,preserveDrawingBuffer:t});if(!i)throw new Error("Couldn't create WebGL context.");i.getVersion=()=>2;for(const e of i.getSupportedExtensions().filter(e=>!this.excludes.has(e)))i.getExtension(e);return i}},_=s.A.add("Context",A);var y=n(1840);let w=0;const x={POINT:w++,LINE:w++,TRIANGLE:w++,QUAD:w++,SPRITE:w++,GEOMETRY:w++},b=Object.assign(new Map(Object.entries(x)),x),S=s.A.add("GeometryType",b),T=s.A.add("dictionary",[{en:"Less Properties",de:"Weniger Eigenschaften",fr:"Moins de Propriétés"},{en:"More Properties",de:"Mehr Eigenschaften",fr:"Plus de Propriétés"},{en:"Frame rate",de:"Bildrate",fr:"Fréquence d'Images"},{en:"fps",de:"BpS",fr:""},{en:"Speed",de:"Geschwindigkeit",fr:"Vélocité"},{en:"m/s",de:"",fr:""},{en:"km/h",de:"",fr:""},{en:"Browser",de:"",fr:"Navigateur"},{en:"ms",de:"",fr:""},{en:"X3D total",de:"X3D gesamt",fr:"X3D total"},{en:"Event Processing",de:"Ereignisverarbeitung",fr:"Traitement des Événements"},{en:"Pointer",de:"Zeigegerät",fr:"Pointeur"},{en:"Camera",de:"Kamera",fr:"Caméra"},{en:"Collision Detection",de:"Kollisionserkennung",fr:"Détection des Collisions"},{en:"Rendering",de:"Rendering",fr:"Rendement"},{en:"Number of Primitives",de:"Anzahl der Grundobjekte",fr:"Nombre d'Objets de Base"},{en:"Number of Shapes",de:"Anzahl der Formen",fr:"Nombre de Formes"},{en:"Number of Sensors",de:"Anzahl der Sensoren",fr:"Nombre de Senseurs"},{en:"Browser Timings",de:"Zeitberechnung",fr:"Calcul du Temps"},{en:"Viewpoints",de:"Ansichtspunkte",fr:"Points de Vue"},{en:"Available Viewers",de:"Verfügbare Betrachter",fr:"Visionneurs disponibles"},{en:"Straighten Horizon",de:"Horizont gerade richten",fr:"Redresser l'Horizon"},{en:"Primitive Quality",de:"Qualität der Grundobjekte",fr:"Qualité des Objets simples"},{en:"High",de:"Hoch",fr:"Haut"},{en:"high",de:"hoch",fr:"haut"},{en:"Medium",de:"Mittel",fr:"Moyenne"},{en:"medium",de:"mittel",fr:"moyenne"},{en:"Low",de:"Niedrig",fr:"Faible"},{en:"low",de:"niedrig",fr:"faible"},{en:"Texture Quality",de:"Textur Qualität",fr:"Qualité des Textures"},{en:"Display Rubberband",de:"Gummiband anzeigen",fr:"Présenter le Bande élastique"},{en:"Rubberband",de:"Gummiband",fr:"Bande élastique"},{en:"on",de:"an",fr:"marche"},{en:"off",de:"aus",fr:"arrêt"},{en:"Mute Browser",de:"Browser stumm schalten",fr:"Rendre Navigateur muet"},{en:"Browser muted",de:"Browser stumm geschalten",fr:"Navigateur muet"},{en:"Browser unmuted",de:"Browser Ton an",fr:"Son de Navigateur réactivé"},{en:"Leave Fullscreen",de:"Vollbild verlassen",fr:"Laisser le plein Écran"},{en:"Fullscreen",de:"Vollbild",fr:"Plein Écran"},{en:"About X_ITE",de:"Über X_ITE",fr:"À propos de X_ITE"},{en:"Examine Viewer",de:"Untersuchen",fr:"Examiner"},{en:"Walk Viewer",de:"Laufen",fr:"Aller"},{en:"Fly Viewer",de:"Fliegen",fr:"Voler"},{en:"Plane Viewer",de:"Ebenen Betrachter",fr:"Visionneur de la Plaine"},{en:"Look At Viewer",de:"Auf Objekte zielen",fr:"Regarder un Objet de près"},{en:"None Viewer",de:"Kein Betrachter",fr:"Pas de Visionneur"},{en:"Points",de:"Punkte",fr:""},{en:"Flat",de:"Flach",fr:"Plat"},{en:"Wireframe",de:"Drahtgittermodel",fr:"Image filaire"},{en:"Loading %1 file",de:"Lade %1 Datei",fr:"Télécharger %1 Fichier"},{en:"Loading %1 files",de:"Lade %1 Dateien",fr:"Télécharger %1 Fichiers"},{en:"Loading done",de:"Fertig mit Laden",fr:"Téléchargement fini"},{en:"Failed loading world.",de:"Laden der Dateien fehlgeschlagen.",fr:"Le chargement des Fichiers a échoué."},{en:"Show World Info",de:"World Info anzeigen",fr:"Afficher World Info"},{en:"Viewpoint is copied to clipboard.",de:"Ansichtspunkt wurde in die Zwischenablage kopiert.",fr:"Le point de Vue est copié dans le Presse-Papiers."},{en:"Animations",de:"Animationen",fr:""},{en:"All",de:"Alle",fr:"Toutes"},{en:"None",de:"Keine",fr:"Aucune"},{en:"Start WebXR session.",de:"Starte eine WebXR Session.",fr:"Démarrez une session WebXR."},{en:"Activate sound.",de:"Activiere den Ton.",fr:"Activez le son."},{en:"Points; Lines; Triangles",de:"Punkte; Linien; Dreiecke",fr:"Points; Lignes; Triangles"},{en:"Opaque Shapes + Transparent Shapes",de:"opaque Formen + transparente Formen",fr:"Formes opaques + Formes transparentes"}]),v=new Set(Object.keys(T[0]));const O=function(){for(const e of navigator.languages){const t=e.split("-")[0];if(v.has(t))return t}return(navigator.language||navigator.userLanguage).split("-")[0]}(),E=new Map(T.map(e=>[e.en,e[O]])),N=s.A.add("gettext",e=>E.get(e)||e);var C=n(9340);function I(e){r.A.call(this,e),this.localStorage=this.getBrowser().getLocalStorage().addNameSpace("BrowserTimings."),this.fps=new y.A,this.primitives={}}function F(e,t){const i=new Intl.NumberFormat(navigator.language||navigator.userLanguage,{notation:"standard",minimumFractionDigits:e,maximumFractionDigits:t}).format;return function(e){return i(Number.isFinite(e)?e:0)}}Object.assign(Object.setPrototypeOf(I.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.getBrowser().getBrowserOptions()._Timings.addInterest("set_enabled__",this),this.localStorage.setDefaultValues({type:"LESS"}),this.element=C("<div></div>").addClass(["x_ite-private-browser-timings","x_ite-private-hidden"]).appendTo(this.getBrowser().getSurface()),this.table=C("<table></table>").appendTo(this.element),this.header=C("<thead></thead>").append(C("<tr></tr>").append(C("<th colspan='2'></th>").text(N("Browser Timings")))).appendTo(this.table),this.body=C("<tbody></tbody>").appendTo(this.table),this.footer=C("<tfoot></tfoot>").append(C("<tr></tr>").append(C("<td colspan='2'></td>"))).appendTo(this.table),this.button=C("<button></button>").appendTo(this.footer.find("td")),this.frameRate=C("<td></td>"),this.speed=C("<td></td>"),this.frameRate=C("<td></td>"),this.speed=C("<td></td>"),this.browserTime=C("<td></td>"),this.x3dTotal=C("<td></td>"),this.eventProcessing=C("<td></td>"),this.pointerTime=C("<td></td>"),this.cameraTime=C("<td></td>"),this.pickingTime=C("<td></td>"),this.collisionTime=C("<td></td>"),this.renderTime=C("<td></td>"),this.numPrimitives=C("<td></td>").addClass("pointer").attr("title",N("Points; Lines; Triangles")),this.numShapes=C("<td></td>").addClass("pointer").attr("title",N("Opaque Shapes + Transparent Shapes")),this.sensors=C("<td></td>"),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Frame rate")+":")).append(this.frameRate)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Speed")+":")).append(this.speed).addClass("x_ite-private-more")),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Browser")+":")).append(this.browserTime)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("X3D total")+":")).append(this.x3dTotal)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Event Processing")+":")).append(this.eventProcessing)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Pointer")+":")).append(this.pointerTime)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Camera")+":")).append(this.cameraTime)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Picking")+":")).append(this.pickingTime)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Collision Detection")+":")).append(this.collisionTime)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Rendering")+":")).append(this.renderTime)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Number of Primitives")+":")).append(this.numPrimitives)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Number of Shapes")+":")).append(this.numShapes)),this.body.append(C("<tr></tr>").append(C("<td></td>").text(N("Number of Sensors")+":")).append(this.sensors)),this.button.on("click touchend",this.set_type__.bind(this)),this.localStorage.type="MORE"===this.localStorage.type?"LESS":"MORE",this.set_type__()},set_enabled__(){this.getBrowser().getBrowserOption("Timings")?(this.element.removeClass(["x_ite-private-fade-out-300","x_ite-private-hidden"]).addClass("x_ite-private-fade-in-300"),this.getBrowser().addBrowserCallback(this,m.A.INITIALIZED_EVENT,()=>this.reset()),this.getBrowser().prepareEvents().addInterest("update",this),this.reset()):(this.element.removeClass("x_ite-private-fade-in-300").addClass("x_ite-private-fade-out-300"),this.getBrowser().removeBrowserCallback(this,m.A.INITIALIZED_EVENT),this.getBrowser().prepareEvents().removeInterest("update",this))},set_type__(){"MORE"===this.localStorage.type?(this.localStorage.type="LESS",this.table.addClass("less"),this.table.removeClass("more")):(this.localStorage.type="MORE",this.table.addClass("more"),this.table.removeClass("less")),this.set_button__(),this.build()},set_button__(){"MORE"===this.localStorage.type?this.button.text(N("Less Properties")):this.button.text(N("More Properties"))},async reset(){await this.getBrowser().nextFrame(),this.fps.reset(),this.build()},update(){this.fps.stop(),this.fps.elapsedTime>1e3&&(this.build(),this.fps.reset()),this.fps.start()},build(){const e=this.getBrowser();if(this.fps.elapsedTime?(this.frameRate.text(`${R(1e3/this.fps.averageTime)} ${N("fps")}`),this.speed.text(`${R(this.getSpeed(e.currentSpeed))} ${this.getSpeedUnit(e.currentSpeed)}`)):(this.frameRate.text(`${R(0)} ${N("fps")}`),this.speed.text(`${R(this.getSpeed(0))} ${this.getSpeedUnit(0)}`)),"MORE"!==this.localStorage.type||!e.getWorld())return;const t=e.getWorld().getLayerSet().getLayers(),i=e.getActiveLayer(),n=i?.getCollisionTime().averageTime??0,s=e.getCollisionTime().averageTime+n,r=Math.max(0,e.getBrowserTime().averageTime-(e.getCameraTime().averageTime+e.getCollisionTime().averageTime+e.getDisplayTime().averageTime)),o=e.prepareEvents().getInterests().size-1,a=e.timeEvents().getInterests().size+e.sensorEvents().getInterests().size+e.getCollisionCount(),l=this.getPrimitives(t),h=this.getOpaqueShapes(t),c=this.getTransparentShapes(t);this.browserTime.text(`${R(e.getSystemTime().averageTime)} ${N("ms")}`),this.x3dTotal.text(`${R(e.getBrowserTime().averageTime)} ${N("ms")}`),this.eventProcessing.text(`${R(r)} ${N("ms")}`),this.pointerTime.text(`${R(e.getPointingTime().averageTime)} ${N("ms")}`),this.cameraTime.text(`${R(e.getCameraTime().averageTime)} ${N("ms")}`),this.pickingTime.text(`${R(e.getPickingTime().averageTime)} ${N("ms")}`),this.collisionTime.text(`${R(s)} ${N("ms")}`),this.renderTime.text(`${R(e.getDisplayTime().averageTime)} ${N("ms")}`),this.numPrimitives.text(`${M(l.points)}; ${M(l.lines)}; ${M(l.triangles)}`),this.numShapes.text(`${M(h)} + ${M(c)}`),this.sensors.text(M(o+a)),e.getSystemTime().reset(),e.getBrowserTime().reset(),e.getPointingTime().reset(),e.getCameraTime().reset(),e.getPickingTime().reset(),e.getCollisionTime().reset(),e.getDisplayTime().reset(),i?.getCollisionTime().reset()},getSpeed:e=>e<15?e:3.6*e,getSpeedUnit:e=>N(e<15?"m/s":"km/h"),getPrimitives(e){this.primitives.points=0,this.primitives.lines=0,this.primitives.triangles=0;for(const t of e){const e=t.getNumOpaqueShapes(),i=t.getNumTransparentShapes(),n=t.getOpaqueShapes(),s=t.getTransparentShapes();this.countPrimitives(n,e),this.countPrimitives(s,i)}return this.primitives},countPrimitives(e,t){for(let i=0;i<t;++i){const t=e[i].shapeNode,n=t.getNumInstances();if(t.getType().at(-1)===m.A.ParticleSystem)switch(t.getGeometryType()){case S.POINT:this.primitives.points+=n;continue;case S.LINE:this.primitives.lines+=n;continue;case S.TRIANGLE:case S.QUAD:case S.SPRITE:this.primitives.triangles+=2*n;continue;case S.GEOMETRY:}const s=t.getGeometry();if(!s)continue;if(!s.getExecutionContext().getCountPrimitives())continue;const r=s.getVertices().length/4*n;switch(s.getGeometryType()){case 0:this.primitives.points+=r;break;case 1:this.primitives.lines+=r/2;break;case 2:case 3:this.primitives.triangles+=r/3}}},getOpaqueShapes(e){return e.reduce((e,t)=>e+this.countShapes(t.getOpaqueShapes(),t.getNumOpaqueShapes()),0)},getTransparentShapes(e){return e.reduce((e,t)=>e+this.countShapes(t.getTransparentShapes(),t.getNumTransparentShapes()),0)},countShapes(e,t){let i=0;for(let n=0;n<t;++n)e[n].shapeNode.getExecutionContext().getCountPrimitives()&&++i;return i}}),Object.defineProperties(I,{typeName:{value:"BrowserTimings",enumerable:!0}});const M=F(0,0),R=F(2,2),P=I,V=s.A.add("BrowserTimings",P);let D=0;const L={LOW:D++,MEDIUM:D++,HIGH:D++},B=Object.assign(new Map(Object.entries(L)),L),k=s.A.add("PrimitiveQuality",B);let j=0;const U={POINT:j++,WIREFRAME:j++,FLAT:j++,GOURAUD:j++,PHONG:j++},X=Object.assign(new Map(Object.entries(U)),U),z=s.A.add("Shading",X),G=k,H=s.A.add("TextureQuality",G);let $=0;const Y={CHAR_SPACING:$++,SCALING:$++},q=s.A.add("TextCompression",Y);var W=n(5185),K=n(9340);function Z(e){r.A.call(this,e),this.addAlias("AntiAliased",this._Antialiased);const t=this.getBrowser();this.localStorage=t.getLocalStorage().addNameSpace("BrowserOptions."),this.textureQuality=H.MEDIUM,this.primitiveQuality=k.MEDIUM,this.shading=z.GOURAUD}Object.assign(Object.setPrototypeOf(Z.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.localStorage.setDefaultValues({Rubberband:this._Rubberband.getValue(),PrimitiveQuality:this._PrimitiveQuality.getValue(),TextureQuality:this._TextureQuality.getValue(),StraightenHorizon:this._StraightenHorizon.getValue(),Timings:this._Timings.getValue()}),this._Rubberband.addInterest("set_Rubberband__",this),this._Antialiased.addInterest("set_Antialiased__",this),this._PrimitiveQuality.addInterest("set_PrimitiveQuality__",this),this._TextureQuality.addInterest("set_TextureQuality__",this),this._Shading.addInterest("set_Shading__",this),this._StraightenHorizon.addInterest("set_StraightenHorizon__",this),this._AutoUpdate.addInterest("set_AutoUpdate__",this),this._ContentScale.addInterest("set_ContentScale__",this),this._Exposure.addInterest("set_Exposure__",this),this._LogarithmicDepthBuffer.addInterest("set_LogarithmicDepthBuffer__",this),this._Multisampling.addInterest("set_Multisampling__",this),this._Mute.addInterest("set_Mute__",this),this._OrderIndependentTransparency.addInterest("set_OrderIndependentTransparency__",this),this._Timings.addInterest("set_Timings__",this),this._XRSessionMode.addInterest("set_XRSessionMode__",this),this.set_Antialiased__(this._Antialiased),this.set_Shading__(this._Shading),this.set_AutoUpdate__(this._AutoUpdate),this.set_ContentScale__(this._ContentScale),this.set_Exposure__(this._Exposure),this.set_LogarithmicDepthBuffer__(this._LogarithmicDepthBuffer),this.set_Multisampling__(this._Multisampling),this.set_OrderIndependentTransparency__(this._OrderIndependentTransparency),this.set_XRSessionMode__(this._XRSessionMode),this.reset()},reset:(()=>{const e=new Set(["Antialiased","AutoUpdate","Cache","ColorSpace","ContentScale","ContextMenu","Debug","Exposure","LogarithmicDepthBuffer","MaximumFrameRate","Multisampling","Notifications","OrderIndependentTransparency","SplashScreen","TextCompression","ToneMapping","XRSessionMode"]),t=new Map([["AutoUpdate","update"],["XRSessionMode","xrSessionMode"]]),i=new Set(["PrimitiveQuality","Rubberband","StraightenHorizon","TextureQuality","Timings"]);return function(){const n=this.getBrowser(),s=this.localStorage;for(const r of this.getFieldDefinitions()){const o=r.getName(),a=r.getValue();if(e.has(o)){const e=t.get(o)??K.toLowerCaseFirst(o),i=n.getElement().attr(e);if(void 0!==i){n.attributeChangedCallback(e,null,i);continue}}if(i.has(o)){const e=s[o],t=this.getField(o);e!==t.getValue()&&t.setValue(e);continue}const l=this.getField(o);l.equals(a)||l.assign(a)}}})(),getPrimitiveQuality(){return this.primitiveQuality},getQualityWhenMoving(){const e=this._QualityWhenMoving.getValue().toUpperCase();return k.get(e)},getTextureQuality(){return this.textureQuality},getShading(){return this.shading},getTextCompression(){return"SCALING"===this._TextCompression.getValue().toUpperCase()?q.SCALING:q.CHAR_SPACING},set_Rubberband__(e){this.localStorage.Rubberband=e.getValue()},set_Antialiased__(){this.set_Multisampling__(this._Multisampling)},set_PrimitiveQuality__(e){const t=this.getBrowser(),i=e.getValue().toUpperCase();this.localStorage.PrimitiveQuality=i,this.primitiveQuality=k.get(i)??k.MEDIUM,t.setPrimitiveQuality2D?.(this.primitiveQuality),t.setPrimitiveQuality3D?.(this.primitiveQuality)},set_TextureQuality__(e){const t=this.getBrowser(),i=e.getValue().toUpperCase();this.localStorage.TextureQuality=i,this.textureQuality=H.get(i)??H.MEDIUM,t.setTextureQuality?.(this.textureQuality)},set_Shading__:(()=>{const e=new Map(Object.entries(z).map(e=>e.reverse()));return function(t){const i=this.getBrowser(),n=t.getValue().toUpperCase().replace("POINTSET","POINT");this.shading=z.get(n)??z.GOURAUD,i.getRenderingProperties()._Shading=e.get(this.shading),i.setShading(this.shading)}})(),set_StraightenHorizon__(e){this.localStorage.StraightenHorizon=e.getValue(),e.getValue()&&this.getBrowser().getActiveLayer()?.straightenView()},set_AutoUpdate__(e){const t=this.getBrowser().getElement()[0],i=["visibilitychange"].map(e=>`${e}.${this.getTypeName()}${this.getId()}`).join(" ");K(document).off(i),this.intersectionObserver?.disconnect(),e.getValue()&&(K(document).on(i,()=>this.checkUpdate()),this.intersectionObserver??=new IntersectionObserver(e=>{this.isIntersecting=e.some(e=>e.isIntersecting),this.checkUpdate()}),this.intersectionObserver.observe(t))},checkUpdate(){if(!this._AutoUpdate.getValue())return;const e=this.getBrowser();!document.hidden&&this.isIntersecting||e.getPose()?e.isLive()||e.beginUpdate():e.isLive()&&e.endUpdate()},set_ContentScale__(e){const t=this.getBrowser();this.removeUpdateContentScale&&this.removeUpdateContentScale(),-1===e.getValue()?this.updateContentScale():t.getRenderingProperties()._ContentScale=Math.max(e.getValue(),0)||1,t.reshape()},updateContentScale(){const e=this.getBrowser(),t=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),i=this.updateContentScale.bind(this);this.removeUpdateContentScale&&this.removeUpdateContentScale(),this.removeUpdateContentScale=function(){t.removeEventListener("change",i)},t.addEventListener("change",i),e.getRenderingProperties()._ContentScale=window.devicePixelRatio,e.reshape()},set_Exposure__(){const e=this.getBrowser(),t=e.getContext(),i=Math.max(this._Exposure.getValue(),0);for(const n of e.getShaders().values())t.useProgram(n.getProgram()),t.uniform1f(n.x3d_Exposure,i)},set_LogarithmicDepthBuffer__(e){this.getBrowser().getRenderingProperties()._LogarithmicDepthBuffer=e.getValue()},set_Multisampling__(e){const t=this.getBrowser(),i=W.A.clamp(e.getValue(),0,t.getMaxSamples());t.getRenderingProperties()._Multisampling=this._Antialiased.getValue()?i:0,t.getRenderingProperties()._Antialiased=i>0,t.reshape()},set_Mute__(e){const t=this.getBrowser(),i=t.getAudioContext();e.getValue()?t.stopAudioElement(i,"suspend"):t.startAudioElement(i,"resume")},set_OrderIndependentTransparency__(){this.getBrowser().reshape()},set_Timings__(e){this.localStorage.Timings=e.getValue()},set_XRSessionMode__(){this.getBrowser().xrUpdateButton()}}),Object.defineProperties(Z,{typeName:{value:"BrowserOptions",enumerable:!0},fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"SplashScreen",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"Dashboard",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"Rubberband",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"EnableInlineViewpoints",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"Antialiased",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"TextureQuality",new c.A.SFString("MEDIUM")),new o.A(m.A.inputOutput,"PrimitiveQuality",new c.A.SFString("MEDIUM")),new o.A(m.A.inputOutput,"QualityWhenMoving",new c.A.SFString("SAME")),new o.A(m.A.inputOutput,"Shading",new c.A.SFString("GOURAUD")),new o.A(m.A.inputOutput,"MotionBlur",new c.A.SFBool),new o.A(m.A.inputOutput,"AlwaysUpdateGeometries",new c.A.SFBool),new o.A(m.A.inputOutput,"AutoUpdate",new c.A.SFBool),new o.A(m.A.inputOutput,"Cache",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"ColorSpace",new c.A.SFString("LINEAR_WHEN_PHYSICAL_MATERIAL")),new o.A(m.A.inputOutput,"ContentScale",new c.A.SFDouble(1)),new o.A(m.A.inputOutput,"ContextMenu",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"Debug",new c.A.SFBool),new o.A(m.A.inputOutput,"Exposure",new c.A.SFDouble(1)),new o.A(m.A.inputOutput,"Gravity",new c.A.SFDouble(9.80665)),new o.A(m.A.inputOutput,"LoadUrlObjects",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"LogarithmicDepthBuffer",new c.A.SFBool),new o.A(m.A.inputOutput,"MaximumFrameRate",new c.A.SFDouble(80)),new o.A(m.A.inputOutput,"MetadataReference",new c.A.SFString),new o.A(m.A.inputOutput,"Multisampling",new c.A.SFInt32(4)),new o.A(m.A.inputOutput,"Mute",new c.A.SFBool),new o.A(m.A.inputOutput,"Notifications",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"OrderIndependentTransparency",new c.A.SFBool),new o.A(m.A.inputOutput,"StraightenHorizon",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"TextCompression",new c.A.SFString("CHAR_SPACING")),new o.A(m.A.inputOutput,"Timings",new c.A.SFBool),new o.A(m.A.inputOutput,"ToneMapping",new c.A.SFString("NONE")),new o.A(m.A.inputOutput,"WallFriction",new c.A.SFDouble),new o.A(m.A.inputOutput,"XRSessionMode",new c.A.SFString("IMMERSIVE_VR"))]),enumerable:!0}});const Q=Z,J=s.A.add("BrowserOptions",Q);function ee(e){r.A.call(this,e)}Object.setPrototypeOf(ee.prototype,r.A.prototype),Object.defineProperties(ee,{typeName:{value:"BrowserProperties",enumerable:!0},fieldDefinitions:{value:new a.A([new o.A(m.A.initializeOnly,"ABSTRACT_NODES",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"CONCRETE_NODES",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"EXTERNAL_INTERACTIONS",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"PROTOTYPE_CREATE",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"DOM_IMPORT",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"XML_ENCODING",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"CLASSIC_VRML_ENCODING",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"BINARY_ENCODING",new c.A.SFBool)]),enumerable:!0}});const te=ee,ie=s.A.add("BrowserProperties",te);var ne=n(9340);function se(e){r.A.call(this,e),this.addAlias("AntiAliased",this._Antialiased)}Object.assign(Object.setPrototypeOf(se.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this);const e=this.getBrowser();this._ContentScale.addInterest("set_contentScale__",this),this._MaxTextureSize=e.getMaxTextureSize(),this._TextureUnits=e.getMaxCombinedTextureUnits(),this._MaxLights=e.getMaxLights(),this._ColorDepth=e.getColorDepth(),this._TextureMemory=e.getTextureMemory(),this._MaxAnisotropicDegree=e.getMaxAnisotropicDegree(),this._MaxSamples=e.getMaxSamples(),this.set_contentScale__()},set_contentScale__(){const e=ne("<div></div>").hide().css("height","10in").appendTo(ne("body")),t=e.height()/720||1;e.remove(),this._PixelsPerPoint=t*this._ContentScale.getValue()}}),Object.defineProperties(se,{typeName:{value:"RenderingProperties",enumerable:!0},fieldDefinitions:{value:new a.A([new o.A(m.A.outputOnly,"Shading",new c.A.SFString),new o.A(m.A.outputOnly,"MaxTextureSize",new c.A.SFInt32),new o.A(m.A.outputOnly,"TextureUnits",new c.A.SFInt32),new o.A(m.A.outputOnly,"MaxLights",new c.A.SFInt32),new o.A(m.A.outputOnly,"Antialiased",new c.A.SFBool(!0)),new o.A(m.A.outputOnly,"ColorDepth",new c.A.SFInt32),new o.A(m.A.outputOnly,"TextureMemory",new c.A.SFDouble),new o.A(m.A.outputOnly,"ContentScale",new c.A.SFDouble(1)),new o.A(m.A.outputOnly,"LogarithmicDepthBuffer",new c.A.SFBool),new o.A(m.A.outputOnly,"MaxAnisotropicDegree",new c.A.SFFloat(1)),new o.A(m.A.outputOnly,"MaxSamples",new c.A.SFInt32(0)),new o.A(m.A.outputOnly,"Multisampling",new c.A.SFInt32(4)),new o.A(m.A.outputOnly,"PixelsPerPoint",new c.A.SFDouble(1)),new o.A(m.A.outputOnly,"XRSession",new c.A.SFBool)]),enumerable:!0}});const re=se,oe=s.A.add("RenderingProperties",re);var ae=n(9340);function le(e){r.A.call(this,e),this.addChildObjects(m.A.inputOutput,"string",new c.A.SFString)}ae.fn.textWidth=function(e){const t=ae(this),i=t.children(),n=t.html(),s=ae("<span></span>").html(n);t.html(s);const r=s.width();return t.empty().append(i),r},Object.assign(Object.setPrototypeOf(le.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.element=ae("<div></div>").css("visibility","hidden").addClass("x_ite-private-notification").appendTo(this.getBrowser().getSurface()).css("width",0),ae("<span></span>").appendTo(this.element),this._string.addInterest("set_string__",this)},set_string__(){this.getBrowser().getBrowserOption("Notifications")&&0!==this._string.length&&(clearTimeout(this.timeoutId),this.element.children().text(this._string.getValue()),this.element.css({visibility:"visible",width:this.element.textWidth(),transition:"width 300ms ease-in-out"}),this.timeoutId=setTimeout(()=>{this.element.css({visibility:"hidden",width:0,transition:"visibility 0s 300ms, width 300ms ease-in-out"})},5e3))}}),Object.defineProperties(le,{typeName:{value:"Notification",enumerable:!0}});const he=le,ce=s.A.add("Notification",he);var ue=n(9340);const de=Symbol(),pe=Symbol(),ge=Symbol();function fe(e){r.A.call(this,e),this[pe]=null}Object.assign(Object.setPrototypeOf(fe.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this);const e=this.getBrowser();this[de]={element:e.getElement(),appendTo:e.getShadow(),build:this.build.bind(this)},this[de].element.on("contextmenu.ContextMenu",e=>this.show(e))},getUserMenu(){return this[pe]},setUserMenu(e){this[pe]=e},createUserMenu(){const e={};if("function"==typeof this[pe]){const t=ue.try(()=>this[pe](this.getBrowser()),!0);if(ue.isPlainObject(t))for(const i in t)e[`user-${i}`]=t[i]}return e},hide(){this[ge]?.()},show(e){const t=this[de],i=t.build(e);if(this.hide(),!i)return;const n=ue("<div></div>").addClass(["context-menu-layer",i.className]).appendTo(t.appendTo);this[ge]=()=>(this[ge]=null,n.remove(),s.children().removeClass("x_ite-private-fade-in-300").addClass("x_ite-private-fade-out-300"),setTimeout(()=>s.remove(),1e3),!1);const s=ue("<ul></ul>").hide().addClass(["context-menu-root","context-menu-list",i.className]).offset({left:e.pageX,top:e.pageY}).appendTo(t.appendTo);ue("<div></div>").addClass("context-menu-background").appendTo(s);for(const e in i.items)s.append(this.createItem(i.items[e],"context-menu-root",e,2));return s.children().addClass("x_ite-private-hidden"),s.show(),s.children().removeClass("x_ite-private-hidden").addClass("x_ite-private-fade-in-300"),s.offset({left:e.pageX,top:e.pageY}),s.offset().left-ue(document).scrollLeft()+s.outerWidth()>ue(window).width()&&s.offset({left:ue(document).scrollLeft()+Math.max(0,ue(window).width()-s.outerWidth())}),s.offset().top-ue(document).scrollTop()+s.outerHeight()>ue(window).height()&&s.offset({top:ue(document).scrollTop()+Math.max(0,ue(window).height()-s.outerHeight())}),s.find("ul").each((e,t)=>{const i=(t=ue(t)).outerWidth()+s.outerWidth(),n=s.offset().left-ue(document).scrollLeft()+i>ue(window).width()?"right":"left";t.children(":first-child").css("height",t.innerHeight()),t.css("width",t.outerWidth()).css(n,t.parent().closest("ul").width()-12),t.outerHeight()>=ue(window).height()&&t.css({"max-height":"100vh","overflow-y":"scroll"})}),s.find("li").on("mouseenter touchstart",e=>{e.stopImmediatePropagation();const t=ue(e.target).closest("li").children("ul");if(!t.length)return;t.css("top","");const i=t.offset().top+t.outerHeight()-ue(window).scrollTop()-ue(window).height();i>0&&t.offset({top:t.offset().top-i})}),n.on("mousedown contextmenu",()=>this.hide()),s.on("contextmenu",()=>this.hide()),!1},createItem(e,t,i,n){const s=ue("<li></li>").addClass("context-menu-item");switch(typeof e){case"string":e.match(/^-+$/)&&s.addClass(["context-menu-separator","context-menu-not-selectable"]);break;case"object":switch(e.className&&s.addClass(e.className),e.type){case"radio":case"checkbox":{const i=ue("<label></label>").appendTo(s),n=ue("<input></input>").appendTo(i);n.attr("type",e.type).attr("name",`context-menu-input-${e.radio||t}`),ue("<span></span>").text(e.name).appendTo(i),e.selected&&n.attr("checked",""),s.addClass("context-menu-input"),this.addEvents(e,n,!1);break}default:e.name&&ue("<span></span>").text(e.name).appendTo(s),this.addEvents(e,s,!0)}}if("object"==typeof e.items&&n<3){const t=ue("<ul></ul>").addClass("context-menu-list").css("z-index",n).appendTo(s);ue("<div></div>").addClass("context-menu-background").appendTo(t);for(const s in e.items)t.append(this.createItem(e.items[s],i,s,n+1));s.addClass("context-menu-submenu")}return s},addEvents(e,t,i){if("function"==typeof e.callback&&(t.on("click",e.callback),i&&t.on("click",()=>this.hide())),"object"==typeof e.events)for(const i in e.events)"function"==typeof e.events[i]&&t.on(i,e.events[i])},build(e){const t=this.getBrowser(),i=t.getElement(),n=document.fullscreenElement===i[0];if(!t.getBrowserOption("ContextMenu"))return;const s={className:"x_ite-private-menu",items:{title:{name:`${t.getName()} Browser v${t.getVersion()}`,className:"context-menu-title context-menu-icon x_ite-private-icon-logo context-menu-not-selectable"},separator0:"--------",viewpoints:{name:N("Viewpoints"),className:"context-menu-icon x_ite-private-icon-viewpoint",items:this.getViewpoints()},"available-viewers":{name:N("Available Viewers"),className:"context-menu-icon x_ite-private-icon-viewer",items:this.getAvailableViewers()},"straighten-horizon":{name:N("Straighten Horizon"),type:"checkbox",selected:t.getBrowserOption("StraightenHorizon"),callback:e=>{const i=ue(e.target).is(":checked");t.setBrowserOption("StraightenHorizon",i),i?t.setDescription(N("Straighten Horizon")+": "+N("on")):t.setDescription(N("Straighten Horizon")+": "+N("off"))}},"display-rubberband":{name:N("Display Rubberband"),type:"checkbox",selected:t.getBrowserOption("Rubberband"),callback:e=>{const i=ue(e.target).is(":checked");t.setBrowserOption("Rubberband",i),i?t.setDescription(N("Rubberband")+": "+N("on")):t.setDescription(N("Rubberband")+": "+N("off"))}},separator1:"--------","primitive-quality":{name:N("Primitive Quality"),className:"context-menu-icon x_ite-private-icon-primitive-quality",items:{high:{name:N("High"),type:"radio",radio:"primitive-quality",selected:"HIGH"===t.getBrowserOption("PrimitiveQuality"),callback:()=>{t.setBrowserOption("PrimitiveQuality","HIGH"),t.setDescription(N("Primitive Quality")+": "+N("high"))}},medium:{name:N("Medium"),type:"radio",radio:"primitive-quality",selected:"MEDIUM"===t.getBrowserOption("PrimitiveQuality"),callback:()=>{t.setBrowserOption("PrimitiveQuality","MEDIUM"),t.setDescription(N("Primitive Quality")+": "+N("medium"))}},low:{name:N("Low"),type:"radio",radio:"primitive-quality",selected:"LOW"===t.getBrowserOption("PrimitiveQuality"),callback:()=>{t.setBrowserOption("PrimitiveQuality","LOW"),t.setDescription(N("Primitive Quality")+": "+N("low"))}}}},"texture-quality":{name:N("Texture Quality"),className:"context-menu-icon x_ite-private-icon-texture-quality",items:{high:{name:N("High"),type:"radio",radio:"texture-quality",selected:"HIGH"===t.getBrowserOption("TextureQuality"),callback:()=>{t.setBrowserOption("TextureQuality","HIGH"),t.setDescription(N("Texture Quality")+": "+N("high"))}},medium:{name:N("Medium"),type:"radio",radio:"texture-quality",selected:"MEDIUM"===t.getBrowserOption("TextureQuality"),callback:()=>{t.setBrowserOption("TextureQuality","MEDIUM"),t.setDescription(N("Texture Quality")+": "+N("medium"))}},low:{name:N("Low"),type:"radio",radio:"texture-quality",selected:"LOW"===t.getBrowserOption("TextureQuality"),callback:()=>{t.setBrowserOption("TextureQuality","LOW"),t.setDescription(N("Texture Quality")+": "+N("low"))}}}},shading:{name:N("Shading"),className:"context-menu-icon x_ite-private-icon-shading",items:{point:{name:N("Points"),type:"radio",radio:"shading",selected:"POINT"===t.getBrowserOption("Shading"),callback:()=>{t.setBrowserOption("Shading","POINT"),t.setDescription(N("Shading")+": "+N("Points"))}},wireframe:{name:N("Wireframe"),type:"radio",radio:"shading",selected:"WIREFRAME"===t.getBrowserOption("Shading"),callback:()=>{t.setBrowserOption("Shading","WIREFRAME"),t.setDescription(N("Shading")+": "+N("Wireframe"))}},flat:{name:N("Flat"),type:"radio",radio:"shading",selected:"FLAT"===t.getBrowserOption("Shading"),callback:()=>{t.setBrowserOption("Shading","FLAT"),t.setDescription(N("Shading")+": "+N("Flat"))}},gouraud:{name:N("Gouraud"),type:"radio",radio:"shading",selected:"GOURAUD"===t.getBrowserOption("Shading"),callback:()=>{t.setBrowserOption("Shading","GOURAUD"),t.setDescription(N("Shading")+": "+N("Gouraud"))}},phong:{name:N("Phong"),type:"radio",radio:"shading",selected:"PHONG"===t.getBrowserOption("Shading"),callback:()=>{t.setBrowserOption("Shading","PHONG"),t.setDescription(N("Shading")+": "+N("Phong"))}}}},separator2:"--------",...this.createUserMenu(),separator3:"--------",...this.createAnimationsMenu(),"browser-timings":{name:N("Browser Timings"),type:"checkbox",selected:t.getBrowserOption("Timings"),callback:e=>{t.setBrowserOption("Timings",ue(e.target).is(":checked")),t.getSurface().focus()}},fullscreen:{name:N(n?"Leave Fullscreen":"Fullscreen"),className:"context-menu-icon "+(n?"x_ite-private-icon-leave-fullscreen":"x_ite-private-icon-enter-fullscreen"),callback:()=>{n?document.exitFullscreen().catch(Function.prototype):i[0].requestFullscreen({navigationUI:"hide"}).catch(Function.prototype)}},separator4:"--------","world-info":{name:N("Show World Info"),className:"context-menu-icon x_ite-private-icon-world-info",callback(){t.getShadow().find(".x_ite-private-world-info").remove();const e=t.getShadow().find(".x_ite-private-browser"),i=ue("<div></div>").addClass("x_ite-private-world-info-overlay").appendTo(e),n=ue("<div></div>").hide().addClass(["x_ite-private-world-info","x_ite-private-hidden"]).appendTo(i),s=t.getExecutionContext().getWorldInfos()[0],r=s.title,o=s.info;ue("<div></div>").addClass("x_ite-private-world-info-top").text("World Info").appendTo(n),r.length&&ue("<div></div>").addClass("x_ite-private-world-info-title").text(r).appendTo(n);for(const e of o)ue("<div></div>").addClass("x_ite-private-world-info-info").text(e).appendTo(n);n.show().removeClass("x_ite-private-hidden").addClass("x_ite-private-fade-in-300"),i.on("click",()=>{n.addClass("x_ite-private-fade-out-300"),setTimeout(()=>i.remove(),300)})}},about:{name:N("About X_ITE"),className:"context-menu-icon x_ite-private-icon-info",callback(){window.open(t.getProviderURL())}}}};ue.isEmptyObject(s.items.viewpoints.items)&&delete s.items.viewpoints,Object.keys(s.items["available-viewers"].items).length<2&&delete s.items["available-viewers"],t.getCurrentViewer().match(/^(?:EXAMINE|FLY)$/)||delete s.items["straighten-horizon"],t.getCurrentViewer().match(/^(?:WALK|FLY)$/)||delete s.items["display-rubberband"],t.getBrowserOption("Debug")||delete s.items.shading;const r=t.getExecutionContext().getWorldInfos()[0];return(!r||0===r.title.length&&0===r.info.length)&&delete s.items["world-info"],s},getViewpoints(){const e=this.getBrowser(),t=e.getActiveLayer();if(!t)return{};const i=t.getUserViewpoints(),n=t.getViewpoint(),s={};for(const t of i)s[`Viewpoint-${t.getId()}`]={name:t.getDescriptions().join(" » "),type:"radio",radio:"viewpoints",selected:t===n,className:"x_ite-private-viewpoint",callback:()=>{e.bindViewpoint(e.getActiveLayer(),t),e.getSurface().focus()}};return s},getAvailableViewers(){const e=this.getBrowser(),t=e._viewer.getValue(),i=e._availableViewers,n={};for(const s of i)n[s]={name:N(this.getViewerName(s)),type:"radio",radio:"viewers",selected:s===t,className:`x_ite-private-${s.toLowerCase()}-viewer`,callback:()=>{e._viewer=s,e.setDescription(N(this.getViewerName(s))),e.getSurface().focus()}};return n},getViewerName(e){switch(e){case"EXAMINE":return N("Examine Viewer");case"WALK":return N("Walk Viewer");case"FLY":return N("Fly Viewer");case"PLANE":return N("Plane Viewer");case"LOOKAT":return N("Look At Viewer");case"NONE":return N("None Viewer")}},createAnimationsMenu(){const e=this.getBrowser().currentScene,t=ue.try(()=>e.getExportedNode("Animations"));if(!t)return{};const i=ue.try(()=>Array.from(t.children,e=>e.children[0])).filter(e=>e.getNodeType().includes(m.A.TimeSensor));return i?.length?{animations:{name:N("Animations"),className:"context-menu-icon x_ite-private-icon-animations",items:{...Object.fromEntries(i.map((e,t)=>[`animation-${t}`,{name:e.description,type:"checkbox",selected:e.isActive,callback(){e.isActive?e.stopTime=Date.now()/1e3:(e.loop=!0,e.startTime=Date.now()/1e3)}}])),separator2:"--------",all:{name:N("All"),className:"context-menu-icon x_ite-private-icon-play",callback(){for(const e of i)e.loop=!0,e.startTime=Date.now()/1e3}},none:{name:N("None"),className:"context-menu-icon x_ite-private-icon-stop",callback(){for(const e of i)e.stopTime=Date.now()/1e3}}}}}:{}}}),Object.defineProperties(fe.prototype,{userMenu:{get:fe.prototype.getUserMenu,set:fe.prototype.setUserMenu,enumerable:!0}}),Object.defineProperties(fe,{typeName:{value:"ContextMenu",enumerable:!0}});const me=fe,Ae=s.A.add("ContextMenu",me);var _e=n(3454),ye=n(8625);const we=new WeakMap,xe=new WeakMap,be=new WeakMap,Se={get(e,t){const i=e[t];if(void 0!==i)return i;const n=e.getStorage()[e.getNameSpace()+t];return String(n).match(/^(?:undefined|null)$/)?e.getDefaultValue(t):JSON.parse(n)},set:(e,t,i)=>(void 0===i?e.getStorage().removeItem(e.getNameSpace()+t):e.getStorage()[e.getNameSpace()+t]=JSON.stringify(i),!0)};function Te(e,t){return this.target=this,we.set(this,e),xe.set(this,t),be.set(this,{}),new Proxy(this,Se)}Object.assign(Te.prototype,{getStorage(){return we.get(this.target)},getNameSpace(){return xe.get(this.target)},addNameSpace(e){return new Te(this.getStorage(),this.getNameSpace()+e)},setDefaultValues(e){Object.assign(be.get(this.target),e)},getDefaultValue(e){const t=be.get(this.target)[e];return void 0===t?void 0:JSON.parse(JSON.stringify(t))},clear(){const e=this.getStorage(),t=this.getNameSpace();for(const i of Object.keys(e))i.startsWith(t)&&e.removeItem(i)}});const ve=Te,Oe=s.A.add("DataStorage",ve);var Ee=n(477),Ne=n(2462);function Ce(e,t,i){try{document.fonts.add(new FontFace("X_ITE PT Sans",`url(${_e.A.getFontsURL(e)})`,{style:i?"italic":"normal",weight:t?"700":"400",display:"block"}))}catch(e){console.error(e)}}Ce("PT_Sans/PTSans-Regular.woff2",!1,!1),Ce("PT_Sans/PTSans-Bold.woff2",!0,!1),Ce("PT_Sans/PTSans-Italic.woff2",!1,!0);var Ie=n(9340);const Fe=Symbol(),Me=Symbol(),Re=Symbol(),Pe=Symbol(),Ve=Symbol(),De=Symbol(),Le=Symbol(),Be=Symbol(),ke=Symbol(),je=Symbol(),Ue=Symbol(),Xe=Symbol(),ze=Symbol(),Ge=Symbol(),He=Symbol(),$e=Symbol(),Ye=Symbol(),qe=Symbol();let We=0;function Ke(e){this.addChildObjects(m.A.outputOnly,"controlKey",new c.A.SFBool,m.A.outputOnly,"shiftKey",new c.A.SFBool,m.A.outputOnly,"altKey",new c.A.SFBool,m.A.outputOnly,"commandKey",new c.A.SFBool,m.A.outputOnly,"altGrKey",new c.A.SFBool);const t=Ie("<div></div>",{class:"x_ite-private-browser",part:"browser",tabindex:0}),i=Ie("<div></div>",{class:"x_ite-private-surface",part:"surface"}),n=Ie("<div></div>",{class:"x_ite-private-splash-screen x_ite-private-hidden"}),s=Ie("<div></div>",{class:"x_ite-private-spinner"}),r=Ie("<div></div>",{class:"x_ite-private-progress"}),o=Ie("<div></div>",{class:"x_ite-private-buttons",part:"buttons"});if(i.appendTo(t),n.appendTo(t),s.appendTo(n),r.appendTo(n),o.appendTo(i),"x3d-canvas"===e.prop("nodeName").toLowerCase()){const i=Ie(e[0].attachShadow({mode:"open",delegatesFocus:!0})),n=new Promise(e=>{Ie("<link/>",{on:{load:e},integrity:"integrity-x_ite-css",crossorigin:"anonymous",rel:"stylesheet",href:new URL("x_ite.css",_e.A.getScriptURL())}).appendTo(i)});this[Pe]=i.append(t.hide()),n.then(()=>t.show())}else this[Pe]=e.prepend(t);Ie("<div></div>",{class:"x_ite-private-x_ite"}).html(`${this.getName()}<b>X3D</b>`).appendTo(r),Ie("<div></div>",{class:"x_ite-private-progressbar"}).appendTo(r).append(Ie("<div></div>")),Ie("<div></div>",{class:"x_ite-private-spinner-text"}).appendTo(r),this[Fe]=++We,this[ke]=new Oe(localStorage,`X_ITE.X3DBrowser(${this[Fe]}).`),this[Me]=e,this[Re]=new Map,this[Ve]=i,this[De]=Ie("<canvas></canvas>",{part:"canvas",class:"x_ite-private-canvas"}).prependTo(i),this[Le]=_.create(this[De][0],"true"===e.attr("preserveDrawingBuffer")),this[Be]=n,this[ze]=new oe(this.getPrivateScene()),this[Ue]=new J(this.getPrivateScene()),this[Xe]=new ie(this.getPrivateScene()),this[je]=new V(this.getPrivateScene()),this[Ge]=new ce(this.getPrivateScene()),this[He]=new Ae(this.getPrivateScene())}Object.assign(Ke.prototype,{initialize(){const e=this.getElement();this[ze].setup(),this[Ue].setup(),this[Xe].setup(),this[je].setup(),this[Ge].setup(),this[He].setup(),Object.defineProperties(e[0],{browser:{value:this,enumerable:!0},...g.properties(this,Object.fromEntries(["src","url"].map(t=>[t,{get:()=>this[Re].get(t.toLowerCase()),set:i=>{e.attr(t,i)},enumerable:!0}])))}),e.on("keydown.X3DCoreContext",this[Ye].bind(this)).on("keyup.X3DCoreContext",this[qe].bind(this))},getInstanceId(){return this[Fe]},getElement(){return this[Me]},getShadow(){return this[Pe]},getSurface(){return this[Ve]},getSplashScreen(){return this[Be]},getCanvas(){return this[De]},getContext(){return this[Le]},getLocalStorage(){return this[ke]},getBrowserTimings(){return this[je]},getBrowserOptions(){return this[Ue]},getBrowserProperties(){return this[Xe]},getRenderingProperties(){return this[ze]},getNotification(){return this[Ge]},getContextMenu(){return this[He]},getPrivateScene(){return this[$e]??=(()=>{const e=new ye.A(this);return e.checkLiveState=()=>!0,e.setLive(!0),e.setup(),e})()},connectedCallback(){for(const{name:e,value:t}of this.getElement()[0].attributes)this[Re].has(e.toLowerCase())||this.attributeChangedCallback(e,void 0,t);this.getBrowserOptions().checkUpdate()},disconnectedCallback(){this.getBrowserOptions().checkUpdate()},attributeChangedCallback(e,t,i){switch(e.toLowerCase()){case"antialiased":this.setBrowserOption("Antialiased",this.parseBooleanAttribute(i)??!0);break;case"baseurl":this.setBaseURL(i);break;case"cache":this.setBrowserOption("Cache",this.parseBooleanAttribute(i)??!0);break;case"colorspace":this.setBrowserOption("ColorSpace",i);break;case"contentscale":this.setBrowserOption("ContentScale","auto"===i?-1:parseFloat(i));break;case"contextmenu":this.setBrowserOption("ContextMenu",this.parseBooleanAttribute(i)??!0);break;case"debug":this.setBrowserOption("Debug",this.parseBooleanAttribute(i)??!1);break;case"exposure":this.setBrowserOption("Exposure",i);break;case"logarithmicdepthbuffer":this.setBrowserOption("LogarithmicDepthBuffer",this.parseBooleanAttribute(i)??!1);break;case"maximumframerate":this.setBrowserOption("MaximumFrameRate",i);break;case"multisampling":{const e=parseInt(i);this.setBrowserOption("Multisampling",isNaN(e)?4:e);break}case"notifications":this.setBrowserOption("Notifications",this.parseBooleanAttribute(i)??!0);break;case"oninitialized":case"onshutdown":try{this.getElement()[0][e]=new Function("event",i)}catch(e){console.error(e)}break;case"orderindependenttransparency":this.setBrowserOption("OrderIndependentTransparency",this.parseBooleanAttribute(i)??!1);break;case"splashscreen":this.setBrowserOption("SplashScreen",this.parseBooleanAttribute(i)??!0),this.getBrowserOption("SplashScreen")||(this.getCanvas().show(),this.getSplashScreen().removeClass("x_ite-private-fade-out-splash-screen").addClass("x_ite-private-hidden"));break;case"src":i&&this.loadURL(new c.A.MFString(i)).catch(e=>console.error(e));break;case"textcompression":this.setBrowserOption("TextCompression",i||"CHAR_SPACINGS");break;case"timings":this.setBrowserOption("Timings",this.parseBooleanAttribute(i)??!1);break;case"tonemapping":this.setBrowserOption("ToneMapping",i||"NONE");break;case"update":"auto"===i?this.setBrowserOption("AutoUpdate",!0):(this.setBrowserOption("AutoUpdate",!1),this.parseBooleanAttribute(i)??1?this.beginUpdate():this.endUpdate());break;case"url":i&&this.loadURL(i=this.parseUrlAttribute(i)).catch(e=>console.error(e));break;case"xrsessionmode":this.setBrowserOption("XRSessionMode",i||"IMMERSIVE_VR")}this[Re].set(e.toLowerCase(),i)},parseBooleanAttribute:e=>"true"===e||"false"!==e&&void 0,parseUrlAttribute(e){try{const t=new c.A.MFString;return/^\[.*?\]$/s.test(e)||(e=`[${e}]`),t.fromString(e,this.getExecutionContext()),t}catch(e){throw new Error("Couldn't parse url attribute.")}},callBrowserEventHandler:(()=>{const e=new Set(["error","load"]);return function(t){const i=this.getElement()[0];for(const n of t.split(" ")){const t=new CustomEvent(n);try{e.has(n)||i[`on${n}`]?.(t)}catch(e){console.error(e)}i.dispatchEvent(t)}}})(),getShiftKey(){return this._shiftKey.getValue()},getControlKey(){return this._controlKey.getValue()},getAltKey(){return this._altKey.getValue()},getCommandKey(){return this._commandKey.getValue()},getAltGrKey(){return this._altGrKey.getValue()},[Ye](e){switch(e.keyCode){case 16:this._shiftKey=!0;break;case 17:this._controlKey=!0;break;case 18:this._altKey=!0;break;case 49:this.getBrowserOption("Debug")&&this.getControlKey()&&(e.preventDefault(),this.setBrowserOption("Shading","POINT"),this.setDescription("Shading: Pointset"));break;case 50:this.getBrowserOption("Debug")&&this.getControlKey()&&(e.preventDefault(),this.setBrowserOption("Shading","WIREFRAME"),this.setDescription("Shading: Wireframe"));break;case 51:this.getBrowserOption("Debug")&&this.getControlKey()&&(e.preventDefault(),this.setBrowserOption("Shading","FLAT"),this.setDescription("Shading: Flat"));break;case 52:this.getBrowserOption("Debug")&&this.getControlKey()&&(e.preventDefault(),this.setBrowserOption("Shading","GOURAUD"),this.setDescription("Shading: Gouraud"));break;case 53:this.getBrowserOption("Debug")&&this.getControlKey()&&(e.preventDefault(),this.setBrowserOption("Shading","PHONG"),this.setDescription("Shading: Phong"));break;case 83:this.getBrowserOption("Debug")&&this.getControlKey()&&(e.preventDefault(),this.isLive()?this.endUpdate():this.beginUpdate(),this.setDescription(this.isLive()?"Begin Update":"End Update"));break;case 91:this._commandKey=!0;break;case 225:this._altGrKey=!0;break;case 171:case 187:this.getControlKey()&&(e.preventDefault(),this.setBrowserOption("Timings",!this.getBrowserOption("Timings")));break;case 36:e.preventDefault(),this.firstViewpoint();break;case 35:e.preventDefault(),this.lastViewpoint();break;case 33:e.preventDefault(),this.previousViewpoint();break;case 34:e.preventDefault(),this.nextViewpoint();break;case 119:if(this.getShiftKey()){e.preventDefault();const t=this.getActiveViewpoint();if(!t)break;const i=this.getExecutionContext(),n=i.createNode(t.getTypeName());switch(t.getTypeName()){case"Viewpoint":case"OrthoViewpoint":n.position=t.getUserPosition(),n.orientation=t.getUserOrientation(),n.centerOfRotation=t.getUserCenterOfRotation(),n.fieldOfView=t.getUserFieldOfView();break;case"GeoViewpoint":{const e=t._geoOrigin,s=new Ee.A;if(e.getValue()&&"GeoOrigin"===e.getNodeTypeName()){const t=i.createNode("GeoOrigin");n.geoOrigin=t,t.geoSystem=e.geoSystem,t.geoCoords=e.geoCoords,t.rotateYUp=e.rotateYUp}n.geoSystem=t._geoSystem,n.position=t.getGeoCoord(t.getUserPosition(),s),n.orientation=t.getUserOrientation(),n.centerOfRotation=t.getGeoCoord(t.getUserCenterOfRotation(),s),n.fieldOfView=t.getUserFieldOfView();break}}const s="NODE"===Ne.A.ENVIRONMENT?{}:{scene:i};let r;switch(i.getEncoding()){case"ASCII":case"VRML":r=n.toVRMLString(s);break;case"JSON":r=n.toJSONString(s);break;default:r=n.toXMLString(s)}r+="\n",this.copyToClipboard(r).then(()=>{this.setDescription(N("Viewpoint copied to clipboard.")),console.log("Viewpoint copied to clipboard."),console.debug(r)})}}},[qe](e){switch(e.which){case 16:this._shiftKey=!1;break;case 17:this._controlKey=!1;break;case 18:this._altKey=!1;break;case 91:this._commandKey=!1;break;case 225:this._altGrKey=!1}},async copyToClipboard(e){try{await navigator.clipboard.writeText(e)}catch{const t=Ie("<textarea></textarea>");this.getShadow().find(".x_ite-private-browser").prepend(t),t.text(e).trigger("select"),document.execCommand("copy"),t.remove()}},dispose(){this.getElement().off(".X3DCoreContext .ContextMenu"),this[Le].getExtension("WEBGL_lose_context")?.loseContext?.(),this[Pe].find("*").remove()}});const Ze=Ke,Qe=s.A.add("X3DCoreContext",Ze);var Je=n(8001);function et(e){Je.A.call(this,e),this.addType(m.A.TextureProperties),e.getSpecificationVersion()<=3.3&&(this._minificationFilter="FASTEST",this._magnificationFilter="FASTEST",this._textureCompression="FASTEST")}Object.assign(Object.setPrototypeOf(et.prototype,Je.A.prototype),{getBorderWidth(){return W.A.clamp(this._borderWidth.getValue(),0,1)},getBoundaryMode:(()=>{const e=new Map([["CLAMP","CLAMP_TO_EDGE"],["CLAMP_TO_EDGE","CLAMP_TO_EDGE"],["CLAMP_TO_BOUNDARY","CLAMP_TO_EDGE"],["MIRRORED_REPEAT","MIRRORED_REPEAT"],["REPEAT","REPEAT"]]);return function(t){return e.get(t)??"REPEAT"}})(),getBoundaryModeS(){return this.getBoundaryMode(this._boundaryModeS.getValue())},getBoundaryModeT(){return this.getBoundaryMode(this._boundaryModeT.getValue())},getBoundaryModeR(){return this.getBoundaryMode(this._boundaryModeR.getValue())},getMinificationFilter:(()=>{const e=new Map([["AVG_PIXEL_AVG_MIPMAP",["LINEAR","LINEAR_MIPMAP_LINEAR"]],["AVG_PIXEL",["LINEAR","LINEAR"]],["AVG_PIXEL_NEAREST_MIPMAP",["LINEAR","LINEAR_MIPMAP_NEAREST"]],["NEAREST_PIXEL_AVG_MIPMAP",["NEAREST","NEAREST_MIPMAP_LINEAR"]],["NEAREST_PIXEL_NEAREST_MIPMAP",["NEAREST","NEAREST_MIPMAP_NEAREST"]],["NEAREST_PIXEL",["NEAREST","NEAREST"]],["NICEST",["LINEAR","LINEAR_MIPMAP_LINEAR"]],["FASTEST",["NEAREST","NEAREST"]]]);return function(t=!0){const i=t&&this._generateMipMaps.getValue()?1:0;return e.get(this._minificationFilter.getValue())?.[i]??this.getBrowser().getDefaultTextureProperties().getMinificationFilter(t)}})(),getMagnificationFilter:(()=>{const e=new Map([["AVG_PIXEL","LINEAR"],["NEAREST_PIXEL","NEAREST"],["NICEST","LINEAR"],["FASTEST","NEAREST"]]);return function(){return e.get(this._magnificationFilter.getValue())??this.getBrowser().getDefaultTextureProperties().getMagnificationFilter()}})(),getTextureCompression:(()=>{const e=new Map([["DEFAULT","RGBA"],["NICEST","RGBA"],["FASTEST","RGBA"],["LOW","RGBA"],["MEDIUM","RGBA"],["HIGH","RGBA"]]);return function(){const t=this.getBrowser().getContext(),i=t.getExtension("WEBGL_compressed_texture_etc"),n=i?.[e.get(this._textureCompression.getValue())];return n??t.RGBA}})()}),Object.defineProperties(et,{...Je.A.getStaticProperties("TextureProperties","Texturing",2,"textureProperties","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"borderColor",new c.A.SFColorRGBA),new o.A(m.A.inputOutput,"borderWidth",new c.A.SFInt32),new o.A(m.A.inputOutput,"anisotropicDegree",new c.A.SFFloat(1)),new o.A(m.A.initializeOnly,"generateMipMaps",new c.A.SFBool),new o.A(m.A.inputOutput,"minificationFilter",new c.A.SFString("DEFAULT")),new o.A(m.A.inputOutput,"magnificationFilter",new c.A.SFString("DEFAULT")),new o.A(m.A.inputOutput,"boundaryModeS",new c.A.SFString("REPEAT")),new o.A(m.A.inputOutput,"boundaryModeT",new c.A.SFString("REPEAT")),new o.A(m.A.inputOutput,"boundaryModeR",new c.A.SFString("REPEAT")),new o.A(m.A.inputOutput,"textureCompression",new c.A.SFString("DEFAULT")),new o.A(m.A.inputOutput,"texturePriority",new c.A.SFFloat)]),enumerable:!0}});const tt=et,it=s.A.add("TextureProperties",tt),nt=Symbol();function st(){}Object.assign(st.prototype,{getBackgroundTextureProperties(){return this[nt]??=(()=>{const e=new it(this.getPrivateScene());return e._boundaryModeS="CLAMP_TO_EDGE",e._boundaryModeT="CLAMP_TO_EDGE",e._boundaryModeR="CLAMP_TO_EDGE",e._minificationFilter="NICEST",e._magnificationFilter="NICEST",e._textureCompression="DEFAULT",e.setup(),e})()}});const rt=st,ot=s.A.add("X3DEnvironmentalEffectsContext",rt);var at=n(797);function lt(e){at.A.call(this,e),this.addType(m.A.X3DComposedGeometryNode),this.polygons=[],this.triangles=[]}Object.assign(Object.setPrototypeOf(lt.prototype,at.A.prototype),{initialize(){at.A.prototype.initialize.call(this),this._attrib.addInterest("set_attrib__",this),this._fogCoord.addInterest("set_fogCoord__",this),this._color.addInterest("set_color__",this),this._texCoord.addInterest("set_texCoord__",this),this._normal.addInterest("set_normal__",this),this._tangent.addInterest("set_tangent__",this),this._coord.addInterest("set_coord__",this),this.set_attrib__(),this.set_fogCoord__(),this.set_color__(),this.set_texCoord__(),this.set_tangent__(),this.set_normal__(),this.set_coord__()},checkVertexCount:(e,t)=>e-e%t,getPolygonIndex:e=>e,getTriangleIndex:e=>e,createPolygons(e,t=[]){for(let i=0;i<e;++i)t.push(this.getPolygonIndex(i));return t},createTriangles(e,t=[]){for(let i=0;i<e;++i)t.push(this.getTriangleIndex(i));return t},build(e,t,i,n){if(!this.coordNode?.getSize())return;t=this.checkVertexCount(t,e),n=this.checkVertexCount(n,i);const s=this._colorPerVertex.getValue(),r=this._normalPerVertex.getValue(),o=this.getCoordIndices(),a=this.getAttrib(),l=a.length,h=this.getAttribs(),c=this.getFogCoord(),u=this.getColor(),d=this.getTexCoord(),p=this.getTangent(),g=this.getNormal(),f=this.getCoord(),m=this.getFogDepths(),A=this.getColors(),_=this.getMultiTexCoords(),y=this.getTangents(),w=this.getNormals(),x=this.getVertices(),b=this.createPolygons(t,this.polygons),S=this.createTriangles(n,this.triangles);d?.init(_);for(let e=0;e<n;++e){const t=Math.floor(e/i),n=b[S[e]];o.push(n);for(let e=0;e<l;++e)a[e].addValue(n,h[e]);c?.addDepth(n,m),u?.addColor(s?n:t,A),d?.addPoint(n,_),p?.addVector(r?n:t,y),g?.addVector(r?n:t,w),f.addPoint(n,x)}g||this.generateNormals(e,t,b,n,S),this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue()),b.length=0,S.length=0},generateNormals(e,t,i,n,s){const r=this.createNormals(e,t,i),o=this.getNormals();for(let e=0;e<n;++e){const{x:t,y:i,z:n}=r[s[e]];o.push(t,i,n)}},createNormals(e,t,i=this.createPolygons(t)){const n=this.createFaceNormals(e,t,i);if(!this._normalPerVertex.getValue())return n;const s=new Map;for(let e=0;e<t;++e){const t=i[e];let n=s.get(t);n||s.set(t,n=[]),n.push(e)}return this.refineNormals(s,n,Math.PI)},createFaceNormals(e,t,i=this.createPolygons(t)){const n=!this._ccw.getValue(),s=this.coordNode,r=[];for(let o=0;o<t;o+=e){let t;switch(e){case 3:t=s.getNormal(i[o],i[o+1],i[o+2]);break;case 4:t=s.getQuadNormal(i[o],i[o+1],i[o+2],i[o+3]);break;default:t=this.getPolygonNormal(o,e,i,s)}n&&t.negate();for(let i=0;i<e;++i)r.push(t)}return r},getPolygonNormal:(()=>{let e=new Ee.A,t=new Ee.A;return function(i,n,s,r){const o=new Ee.A;r.get1Point(s[i],t);for(let a=0;a<n;++a){const l=e;e=t,t=l,r.get1Point(s[i+(a+1)%n],t),o.x+=(e.y-t.y)*(e.z+t.z),o.y+=(e.z-t.z)*(e.x+t.x),o.z+=(e.x-t.x)*(e.y+t.y)}return o.normalize()}})()}),Object.defineProperties(lt,Je.A.getStaticProperties("X3DComposedGeometryNode","Rendering",1));const ht=lt,ct=s.A.add("X3DComposedGeometryNode",ht);var ut=n(2844);function dt(e){ct.call(this,e),this.addType(m.A.IndexedFaceSet),this._creaseAngle.setUnit("angle")}Object.assign(Object.setPrototypeOf(dt.prototype,ct.prototype),{initialize(){ct.prototype.initialize.call(this),this._set_colorIndex.addFieldInterest(this._colorIndex),this._set_texCoordIndex.addFieldInterest(this._texCoordIndex),this._set_normalIndex.addFieldInterest(this._normalIndex),this._set_coordIndex.addFieldInterest(this._coordIndex)},getTexCoordPerVertexIndex(e){return e<this._texCoordIndex.length?this._texCoordIndex[e]:this._coordIndex[e]},getColorPerVertexIndex(e){return e<this._colorIndex.length?this._colorIndex[e]:this._coordIndex[e]},getColorPerFaceIndex(e){return e<this._colorIndex.length?this._colorIndex[e]:e},getNormalPerVertexIndex(e){return e<this._normalIndex.length?this._normalIndex[e]:this._coordIndex[e]},getNormalPerFaceIndex(e){return e<this._normalIndex.length?this._normalIndex[e]:e},build(){const e=this.triangulate();if(0===e.length)return;const t=this._colorPerVertex.getValue(),i=this._normalPerVertex.getValue(),n=this._coordIndex.getValue(),s=this.getCoordIndices(),r=this.getAttrib(),o=r.length,a=this.getAttribs(),l=this.getFogCoord(),h=this.getColor(),c=this.getTexCoord(),u=this.getTangent(),d=this.getNormal(),p=this.getCoord(),g=this.getFogDepths(),f=this.getColors(),m=this.getMultiTexCoords(),A=this.getTangents(),_=this.getNormals(),y=this.getVertices();c?.init(m);for(const{triangles:w,face:x}of e)for(const e of w){const w=n[e];s.push(w);for(let e=0;e<o;++e)r[e].addValue(w,a[e]);l?.addDepth(w,g),h?.addColor(t?this.getColorPerVertexIndex(e):this.getColorPerFaceIndex(x),f),c?.addPoint(this.getTexCoordPerVertexIndex(e),m),u?.addVector(i?this.getNormalPerVertexIndex(e):this.getNormalPerFaceIndex(x),A),d?.addVector(i?this.getNormalPerVertexIndex(e):this.getNormalPerFaceIndex(x),_),p.addPoint(w,y)}d||this.generateNormals(e),this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())},triangulate(){const e=this._convex.getValue(),t=this._coordIndex.length,i=[];if(!this.getCoord())return i;if(t&&this._coordIndex.at(-1)>-1&&this._coordIndex.push(-1),t){const t=this._coordIndex.getValue(),n=this._coordIndex.length;for(let s=0,r=0,o=[];s<n;++s){if(t[s]>-1)o.push(s);else{switch(o.length){case 0:case 1:case 2:o.length=0;break;case 3:i.push({vertices:o,triangles:o,face:r}),o=[];break;default:{const t=[],n={vertices:o,triangles:t,face:r};e?ut.A.triangulateConvexPolygon(o,t):this.triangulatePolygon(o,t),t.length<3?o.length=0:(i.push(n),o=[]);break}}++r}}}return i},triangulatePolygon:(()=>{const e=[];return function(t,i){const n=this._coordIndex.getValue(),s=this.getCoord(),r=t.length;for(let t=e.length;t<r;++t)e.push(new Ee.A);for(let i=0;i<r;++i){const r=t[i],o=e[i];o.index=r,s.get1Point(n[r],o)}e.length=r,ut.A.triangulatePolygon(e,i)}})(),generateNormals(e){const t=this.createNormals(e),i=this.getNormals();for(const{triangles:n}of e)for(const e of n)i.push(...t[e])},createNormals(e){const t=!this._ccw.getValue(),i=this._coordIndex.getValue(),n=this.getCoord(),s=new Map,r=[];for(const{vertices:o}of e){let e;switch(o.length){case 3:e=n.getNormal(i[o[0]],i[o[1]],i[o[2]]);break;case 4:e=n.getQuadNormal(i[o[0]],i[o[1]],i[o[2]],i[o[3]]);break;default:e=this.getPolygonNormal(o,i,n)}t&&e.negate();for(const t of o){const n=i[t];let o=s.get(n);o||s.set(n,o=[]),o.push(t),r[t]=e}}return this._normalPerVertex.getValue()?this.refineNormals(s,r,this._creaseAngle.getValue()):r},getPolygonNormal:(()=>{let e=new Ee.A,t=new Ee.A;return function(i,n,s){const r=new Ee.A;s.get1Point(n[i[0]],t);for(let o=0,a=i.length;o<a;++o){const l=e;e=t,t=l,s.get1Point(n[i[(o+1)%a]],t),r.x+=(e.y-t.y)*(e.z+t.z),r.y+=(e.z-t.z)*(e.x+t.x),r.z+=(e.x-t.x)*(e.y+t.y)}return r.normalize()}})()}),Object.defineProperties(dt,{...Je.A.getStaticProperties("IndexedFaceSet","Geometry3D",2,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_colorIndex",new c.A.MFInt32),new o.A(m.A.inputOnly,"set_texCoordIndex",new c.A.MFInt32),new o.A(m.A.inputOnly,"set_normalIndex",new c.A.MFInt32),new o.A(m.A.inputOnly,"set_coordIndex",new c.A.MFInt32),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"convex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"creaseAngle",new c.A.SFFloat),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorIndex",new c.A.MFInt32),new o.A(m.A.initializeOnly,"texCoordIndex",new c.A.MFInt32),new o.A(m.A.initializeOnly,"normalIndex",new c.A.MFInt32),new o.A(m.A.initializeOnly,"coordIndex",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const pt=dt,gt=s.A.add("IndexedFaceSet",pt);function ft(e){Je.A.call(this,e),this.addType(m.A.X3DGeometricPropertyNode)}Object.setPrototypeOf(ft.prototype,Je.A.prototype),Object.defineProperties(ft,Je.A.getStaticProperties("X3DGeometricPropertyNode","Rendering",1));const mt=ft,At=s.A.add("X3DGeometricPropertyNode",mt);function _t(e){At.call(this,e),this.addType(m.A.X3DCoordinateNode),this.length=0}Object.assign(Object.setPrototypeOf(_t.prototype,At.prototype),{initialize(){At.prototype.initialize.call(this),this._point.addInterest("set_point__",this),this.set_point__()},set_point__(){this.point=this._point.getValue(),this.length=this._point.length},getSize(){return this.length},set1Point(e,t){this._point[e]=t},get1Point(e,t){if(e<this.length){const i=this.point;return e*=3,t.set(i[e],i[e+1],i[e+2])}return t.set(0)},addPoint(e,t){if(e<this.length){const i=this.point;e*=3,t.push(i[e],i[e+1],i[e+2],1)}else t.push(0,0,0,1)},addPoints(e,t=this.length){const i=this.point,n=3*this.length;for(let t=0;t<n;t+=3)e.push(i[t],i[t+1],i[t+2],1);if(t*=3,n)for(let s=n;s<t;s+=3)e.push(i[n-3],i[n-2],i[n-1],1);else for(let i=n;i<t;i+=3)e.push(0,0,0,1);return e},getNormal:(()=>{const e=new Ee.A,t=new Ee.A,i=new Ee.A;return function(n,s,r){const o=this.length;return n<o&&s<o&&r<o?ut.A.normal(this.get1Point(n,e),this.get1Point(s,t),this.get1Point(r,i),new Ee.A):new Ee.A}})(),getQuadNormal:(()=>{const e=new Ee.A,t=new Ee.A,i=new Ee.A,n=new Ee.A;return function(s,r,o,a){const l=this.length;return s<l&&r<l&&o<l&&a<l?ut.A.quadNormal(this.get1Point(s,e),this.get1Point(r,t),this.get1Point(o,i),this.get1Point(a,n),new Ee.A):new Ee.A}})()}),Object.defineProperties(_t,Je.A.getStaticProperties("X3DCoordinateNode","Rendering",1));const yt=_t,wt=s.A.add("X3DCoordinateNode",yt);function xt(e){wt.call(this,e),this.addType(m.A.Coordinate),this._point.setUnit("length")}Object.setPrototypeOf(xt.prototype,wt.prototype),Object.defineProperties(xt,{...Je.A.getStaticProperties("Coordinate","Rendering",1,"coord","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"point",new c.A.MFVec3f)]),enumerable:!0}});const bt=xt,St=s.A.add("Coordinate",bt);function Tt(e){At.call(this,e),this.addType(m.A.X3DTextureCoordinateNode)}Object.setPrototypeOf(Tt.prototype,At.prototype),Object.defineProperties(Tt,Je.A.getStaticProperties("X3DTextureCoordinateNode","Texturing",1));const vt=Tt,Ot=s.A.add("X3DTextureCoordinateNode",vt);function Et(e){Ot.call(this,e),this.addType(m.A.X3DSingleTextureCoordinateNode)}Object.assign(Object.setPrototypeOf(Et.prototype,Ot.prototype),{getCount:()=>1,init(e){e.push(at.A.createArray())},addPoint(e,t){this.addPointToChannel(e,t[0])},getTextureCoordinateMapping(e,t=0){e.set(this._mapping.getValue()||t,t)},setShaderUniforms(e,t,i=0){e.uniform1i(t.x3d_TextureCoordinateGenerator[i].mode,0)}}),Object.defineProperties(Et,Je.A.getStaticProperties("X3DSingleTextureCoordinateNode","Texturing",1));const Nt=Et,Ct=s.A.add("X3DSingleTextureCoordinateNode",Nt);var It=n(1166);function Ft(e){Ct.call(this,e),this.addType(m.A.TextureCoordinate)}Object.assign(Object.setPrototypeOf(Ft.prototype,Ct.prototype),{initialize(){Ct.prototype.initialize.call(this),this._point.addInterest("set_point__",this),this.set_point__()},set_point__(){this.point=this._point.getValue(),this.length=this._point.length},getSize(){return this.length},get1Point(e,t){if(e<this.length){const i=this.point;return e*=2,t.set(i[e],i[e+1],0,1)}return t.set(0,0,0,1)},set1Point:(()=>{const e=new It.A;return function(t,{x:i,y:n,w:s}){this._point[t]=e.set(i,n).divide(s)}})(),addPointToChannel(e,t){if(e>=0&&this.length){const i=this.point,n=e%this.length*2;t.push(i[n],i[n+1],0,1)}else t.push(0,0,0,1)},addPoints(e){const t=this.point,i=this.length;for(let n=0,s=0;n<i;++n,s+=2)e.push(t[s],t[s+1],0,1);return e}}),Object.defineProperties(Ft,{...Je.A.getStaticProperties("TextureCoordinate","Texturing",1,"texCoord","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"mapping",new c.A.SFString),new o.A(m.A.inputOutput,"point",new c.A.MFVec2f)]),enumerable:!0}});const Mt=Ft,Rt=s.A.add("TextureCoordinate",Mt);function Pt(e){r.A.call(this,e)}Object.assign(Object.setPrototypeOf(Pt.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this)},getGeometry(){if(this.geometry)return this.geometry;this.geometry=new gt(this.getExecutionContext()),this.geometry._texCoord=new Rt(this.getExecutionContext()),this.geometry._coord=new St(this.getExecutionContext());const e=this.geometry,t=this.geometry._texCoord.getValue(),i=this.geometry._coord.getValue();return e._texCoordIndex=[0,1,2,3,-1,0,1,2,3,-1,0,1,2,3,-1,0,1,2,3,-1,0,1,2,3,-1,0,1,2,3,-1],e._coordIndex=[0,1,2,3,-1,5,4,7,6,-1,1,5,6,2,-1,4,0,3,7,-1,4,5,1,0,-1,3,2,6,7,-1],t._point=[1,1,0,1,0,0,1,0],i._point=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],t.setup(),i.setup(),e.setup(),this.geometry}}),Object.defineProperties(Pt,{typeName:{value:"BoxOptions",enumerable:!0}});const Vt=Pt,Dt=s.A.add("BoxOptions",Vt);function Lt(e){At.call(this,e),this.addType(m.A.X3DNormalNode)}Object.setPrototypeOf(Lt.prototype,At.prototype),Object.defineProperties(Lt,Je.A.getStaticProperties("X3DNormalNode","Rendering",2));const Bt=Lt,kt=s.A.add("X3DNormalNode",Bt);function jt(e){kt.call(this,e),this.addType(m.A.Normal)}Object.assign(Object.setPrototypeOf(jt.prototype,kt.prototype),{initialize(){kt.prototype.initialize.call(this),this._vector.addInterest("set_vector__",this),this.set_vector__()},set_vector__(){this.vector=this._vector.getValue(),this.length=this._vector.length},addVector(e,t){if(!(e>=0&&this.length))return t.push(0,0,0);{const i=this.vector,n=e%this.length*3;t.push(i[n],i[n+1],i[n+2])}},addVectors(e,t=this.length){const i=this.length;if(i){const n=this.vector;for(let s=0;s<t;++s){const t=s%i*3;e.push(n[t],n[t+1],n[t+2])}}else for(let i=0;i<t;++i)e.push(0,0,0);return e}}),Object.defineProperties(jt,{...Je.A.getStaticProperties("Normal","Rendering",2,"normal","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"vector",new c.A.MFVec3f)]),enumerable:!0}});const Ut=jt,Xt=s.A.add("Normal",Ut);var zt=n(4705);function Gt(e){r.A.call(this,e),this.addChildObjects(m.A.inputOutput,"dimension",new c.A.SFInt32(20))}Object.assign(Object.setPrototypeOf(Gt.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.addInterest("eventsProcessed",this)},getSideGeometry(){return this.sideGeometry||this.build(),this.sideGeometry},getBottomGeometry(){return this.bottomGeometry||this.build(),this.bottomGeometry},createTexCoordIndex(){const e=this._dimension.getValue(),t=this.sideGeometry._texCoordIndex,i=this.bottomGeometry._texCoordIndex;for(let i=0;i<e;++i)t.push(i,i+1,i+e+1,-1);for(let t=e-1;t>-1;--t)i.push(2*(e+1)+t);i.push(-1)},createTexCoord(){const e=this._dimension.getValue(),t=this.sideGeometry._texCoord.getValue()._point;for(let i=0;i<e+1;++i){const n=i/e;t.push(new It.A(n,0))}for(let i=0;i<e+1;++i){const n=(i+.5)/e;t.push(new It.A(n,1))}for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(-1,s);t.push(new It.A((r.imag+1)/2,(r.real+1)/2))}},createNormalIndex(){const e=this._dimension.getValue(),t=this.sideGeometry._normalIndex,i=this.bottomGeometry._normalIndex;for(let i=0;i<e;++i)t.push(i,(i+1)%e,i+e,-1);for(let t=0;t<e;++t)i.push(2*e);i.push(-1)},createNormal(){const e=this._dimension.getValue(),t=this.sideGeometry._normal.getValue()._vector,i=zt.A.Polar(1,-Math.PI/4);for(let n=0;n<e;++n){const s=n/e,r=2*Math.PI*s,o=zt.A.Polar(i.imag,r);t.push(new Ee.A(o.imag,i.real,o.real))}for(let n=0;n<e;++n){const s=(n+.5)/e,r=2*Math.PI*s,o=zt.A.Polar(i.imag,r);t.push(new Ee.A(o.imag,i.real,o.real))}t.push(new Ee.A(0,-1,0))},createCoordIndex(){const e=this._dimension.getValue(),t=this.sideGeometry._coordIndex,i=this.bottomGeometry._coordIndex;for(let i=0;i<e;++i)t.push(i,(i+1)%e,e,-1);for(let t=e-1;t>-1;--t)i.push(t);i.push(-1)},createPoints(){const e=this._dimension.getValue(),t=this.sideGeometry._coord.getValue()._point;for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(-1,s);t.push(new Ee.A(r.imag,-1,r.real))}t.push(new Ee.A(0,1,0))},build(){this.sideGeometry=new gt(this.getExecutionContext()),this.sideGeometry._texCoord=new Rt(this.getExecutionContext()),this.sideGeometry._normal=new Xt(this.getExecutionContext()),this.sideGeometry._coord=new St(this.getExecutionContext()),this.bottomGeometry=new gt(this.getExecutionContext()),this.bottomGeometry._texCoord=this.sideGeometry._texCoord,this.bottomGeometry._normal=this.sideGeometry._normal,this.bottomGeometry._coord=this.sideGeometry._coord,this.createTexCoordIndex(),this.createTexCoord(),this.createNormalIndex(),this.createNormal(),this.createCoordIndex(),this.createPoints();const e=this.sideGeometry,t=this.bottomGeometry,i=this.sideGeometry._texCoord.getValue(),n=this.sideGeometry._normal.getValue(),s=this.sideGeometry._coord.getValue();i.setup(),n.setup(),s.setup(),e.setup(),t.setup()},eventsProcessed(){this.sideGeometry=null,this.bottomGeometry=null}}),Object.defineProperties(Gt,{typeName:{value:"ConeOptions",enumerable:!0}});const Ht=Gt,$t=s.A.add("ConeOptions",Ht);function Yt(e){r.A.call(this,e),this.addChildObjects(m.A.inputOutput,"dimension",new c.A.SFInt32(20))}Object.assign(Object.setPrototypeOf(Yt.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.addInterest("eventsProcessed",this)},getSideGeometry(){return this.sideGeometry||this.build(),this.sideGeometry},getTopGeometry(){return this.topGeometry||this.build(),this.topGeometry},getBottomGeometry(){return this.bottomGeometry||this.build(),this.bottomGeometry},createTexCoordIndex(){const e=this._dimension.getValue(),t=this.sideGeometry._texCoordIndex,i=this.bottomGeometry._texCoordIndex,n=this.topGeometry._texCoordIndex;for(let i=0;i<e;++i)t.push(i,i+1,i+2+e,i+1+e,-1);for(let t=e-1;t>-1;--t)i.push(2*(e+1)+t);i.push(-1);for(let t=0;t<e;++t)n.push(2*(e+1)+e+t);n.push(-1)},createTexCoord(){const e=this._dimension.getValue(),t=this.sideGeometry._texCoord.getValue()._point;for(let i=0;i<e+1;++i){const n=i/e;t.push(new It.A(n,0))}for(let i=0;i<e+1;++i){const n=i/e;t.push(new It.A(n,1))}for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(-1,s);t.push(new It.A((r.imag+1)/2,(r.real+1)/2))}for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(1,s);t.push(new It.A(1-(r.imag+1)/2,(r.real+1)/2))}},createNormalIndex(){const e=this._dimension.getValue(),t=this.sideGeometry._normalIndex,i=this.bottomGeometry._normalIndex,n=this.topGeometry._normalIndex;for(let i=0;i<e;++i)t.push(i,(i+1)%e,(i+1)%e,i,-1);for(let t=0;t<e;++t)i.push(e);i.push(-1);for(let t=0;t<e;++t)n.push(e+1);n.push(-1)},createNormal(){const e=this._dimension.getValue(),t=this.sideGeometry._normal.getValue()._vector;for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(-1,s);t.push(new Ee.A(r.imag,0,r.real))}t.push(new Ee.A(0,-1,0)),t.push(new Ee.A(0,1,0))},createCoordIndex(){const e=this._dimension.getValue(),t=this.sideGeometry._coordIndex,i=this.bottomGeometry._coordIndex,n=this.topGeometry._coordIndex;for(let i=0;i<e;++i)t.push(i,(i+1)%e,(i+1)%e+e,i+e,-1);for(let t=e-1;t>-1;--t)i.push(t);i.push(-1);for(let t=0;t<e;++t)n.push(t+e);n.push(-1)},createPoints(){const e=this._dimension.getValue(),t=this.sideGeometry._coord.getValue()._point;for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(-1,s);t.push(new Ee.A(r.imag,-1,r.real))}for(let i=0;i<e;++i){const n=i/e,s=2*Math.PI*n,r=zt.A.Polar(-1,s);t.push(new Ee.A(r.imag,1,r.real))}},build(){this.sideGeometry=new gt(this.getExecutionContext()),this.sideGeometry._texCoord=new Rt(this.getExecutionContext()),this.sideGeometry._normal=new Xt(this.getExecutionContext()),this.sideGeometry._coord=new St(this.getExecutionContext()),this.bottomGeometry=new gt(this.getExecutionContext()),this.bottomGeometry._texCoord=this.sideGeometry._texCoord,this.bottomGeometry._normal=this.sideGeometry._normal,this.bottomGeometry._coord=this.sideGeometry._coord,this.topGeometry=new gt(this.getExecutionContext()),this.topGeometry._texCoord=this.sideGeometry._texCoord,this.topGeometry._normal=this.sideGeometry._normal,this.topGeometry._coord=this.sideGeometry._coord,this.createTexCoordIndex(),this.createTexCoord(),this.createNormalIndex(),this.createNormal(),this.createCoordIndex(),this.createPoints();const e=this.sideGeometry,t=this.bottomGeometry,i=this.topGeometry,n=this.sideGeometry._texCoord.getValue(),s=this.sideGeometry._normal.getValue(),r=this.sideGeometry._coord.getValue();n.setup(),s.setup(),r.setup(),e.setup(),t.setup(),i.setup()},eventsProcessed(){this.sideGeometry=null,this.bottomGeometry=null,this.topGeometry=null}}),Object.defineProperties(Yt,{typeName:{value:"CylinderOptions",enumerable:!0}});const qt=Yt,Wt=s.A.add("CylinderOptions",qt);function Kt(e){r.A.call(this,e),this.addChildObjects(m.A.inputOutput,"xDimension",new c.A.SFInt32(32),m.A.inputOutput,"yDimension",new c.A.SFInt32(15))}Object.assign(Object.setPrototypeOf(Kt.prototype,r.A.prototype),{initialize(){r.A.prototype.initialize.call(this),this.addInterest("eventsProcessed",this)},getGeometry(){return this.geometry||this.build(),this.geometry},createTexCoordIndex(){const e=this._xDimension.getValue()+1,t=this._yDimension.getValue(),i=this.geometry._texCoordIndex;for(let t=0,n=e-1;t<n;++t)i.push(t),i.push(t+e-1),i.push(t+e),i.push(-1);for(let n=e-1,s=0,r=t-3;s<r;++s,++n)for(let t=0,s=e-1;t<s;++t,++n)i.push(n),i.push(n+e),i.push(n+e+1),i.push(n+1),i.push(-1);let n=(t-2)*e-1;for(let t=0,s=e-1;t<s;++t,++n)i.push(n+e),i.push(n+1),i.push(n),i.push(-1)},createTexCoord(){const e=this._xDimension.getValue()+1,t=this._yDimension.getValue(),i=this.geometry._texCoord.getValue()._point,n=-.5/(e-1);for(let t=1;t<e;++t){const s=t/(e-1)+n;i.push(new It.A(s,1))}for(let n=1,s=t-1;n<s;++n){const s=1-n/(t-1);for(let t=0;t<e;++t){const n=t/(e-1);i.push(new It.A(n,s))}}for(let t=1;t<e;++t){const s=t/(e-1)+n;i.push(new It.A(s,0))}},createCoordIndex(){const e=this._xDimension.getValue()+1,t=this._yDimension.getValue(),i=this.geometry._coordIndex;let n=1;for(const t=e-1;n<t;++n)i.push(0),i.push(n),i.push(n+1),i.push(-1);i.push(0),i.push(n),i.push(1),i.push(-1);let s=1;for(let n=0,r=t-3;n<r;++n,++s){for(let t=0,n=e-2;t<n;++t,++s)i.push(s),i.push(s+e-1),i.push(s+e),i.push(s+1),i.push(-1);i.push(s),i.push(s+e-1),i.push(s+1),i.push(s-e+2),i.push(-1)}const r=s+e-1;for(let t=0,n=e-2;t<n;++t,++s)i.push(r),i.push(s+1),i.push(s),i.push(-1);i.push(r),i.push(r-e+1),i.push(s),i.push(-1)},createPoints(){const e=this._xDimension.getValue()+1,t=this._yDimension.getValue(),i=this.geometry._coord.getValue()._point;i.push(new Ee.A(0,1,0));for(let n=1,s=t-1;n<s;++n){const t=zt.A.Polar(1,-Math.PI*n/s);for(let n=0,s=e-1;n<s;++n){const e=zt.A.Polar(t.imag,2*Math.PI*n/s);i.push(new Ee.A(e.imag,t.real,e.real))}}i.push(new Ee.A(0,-1,0))},build(){this.geometry=new gt(this.getExecutionContext()),this.geometry._texCoord=new Rt(this.getExecutionContext()),this.geometry._coord=new St(this.getExecutionContext()),this.createTexCoordIndex(),this.createTexCoord(),this.createCoordIndex(),this.createPoints();const e=this.geometry,t=this.geometry._texCoord.getValue(),i=this.geometry._coord.getValue();e._creaseAngle=Math.PI,t.setup(),i.setup(),e.setup()},eventsProcessed(){this.geometry=null}}),Object.defineProperties(Kt,{typeName:{value:"QuadSphereOptions",enumerable:!0}});const Zt=Kt,Qt=s.A.add("QuadSphereOptions",Zt),Jt=Symbol(),ei=Symbol(),ti=Symbol(),ii=Symbol();function ni(){}function si(e,t){return this[e]??=(()=>{const e=new t(this.getPrivateScene());return e.setup(),e})()}Object.assign(ni.prototype,{initialize(){this.setPrimitiveQuality3D(this.getBrowserOptions().getPrimitiveQuality())},getBoxOptions(){return si.call(this,Jt,Dt)},getConeOptions(){return si.call(this,ei,$t)},getCylinderOptions(){return si.call(this,ti,Wt)},getSphereOptions(){return si.call(this,ii,Qt)},setPrimitiveQuality3D(e){const t=this.getConeOptions(),i=this.getCylinderOptions(),n=this.getSphereOptions();switch(e){case k.LOW:t._dimension=16,i._dimension=16,n._xDimension=20,n._yDimension=9;break;case k.MEDIUM:t._dimension=20,i._dimension=20,n._xDimension=32,n._yDimension=15;break;case k.HIGH:t._dimension=32,i._dimension=32,n._xDimension=64,n._yDimension=31}}});const ri=ni,oi=s.A.add("X3DGeometry3DContext",ri);var ai=n(2251),li=n(2919),hi=n(937),ci=n(608),ui=n(1725),di=n(7319),pi=n(5687);function gi(e){ai.A.call(this,e),li.A.call(this,e),this.addType(m.A.X3DShapeNode),this.setBoundedObject(!0),this.setPointingObject(!0),this.setCollisionObject(!0),this.setShadowObject(!0),this.setVisibleObject(!0),this.bbox=new pi.A,this.bboxSize=new Ee.A,this.bboxCenter=new Ee.A,this.renderPasses=di.A.NONE,this[di.A.RENDER_KEY]=this}Object.assign(Object.setPrototypeOf(gi.prototype,ai.A.prototype),li.A.prototype,{initialize(){ai.A.prototype.initialize.call(this),li.A.prototype.initialize.call(this),this._transformSensors.addInterest("set_pickableObject__",this),this._pointerEvents.addInterest("set_pointingObject__",this),this._castShadow.addInterest("set_shadowObject__",this),this._bboxSize.addInterest("set_boundedObject__",this),this._bboxSize.addInterest("set_bbox__",this),this._bboxCenter.addInterest("set_bbox__",this),this._appearance.addInterest("set_appearance__",this),this._geometry.addInterest("set_geometry__",this),this.set_appearance__(),this.set_geometry__()},getGeometryType:()=>S.GEOMETRY,getNumInstances:()=>1,isEnabled(){return this.getNumInstances()&&(this.geometryNode||this.getGeometryType()!==S.GEOMETRY)},getBBox(e,t){return t?this._castShadow.getValue()?e.assign(this.bbox):e.set():e.assign(this.bbox)},getBBoxSize(){return this.bboxSize},getBBoxCenter(){return this.bboxCenter},isTransparent(){return this.transparent},setTransparent(e){this.transparent=!!e},getAlphaMode(){return this.alphaMode},setAlphaMode(e){this.alphaMode=!!e},getRenderPasses(){return this.renderPasses},getAppearance(){return this.appearanceNode},getGeometry(){return this.geometryNode},getGeometryContext(){return this.getGeometry()},getShapes(e,t){return this.isVisibleObject()&&e.push({modelMatrix:t,shapeNode:this}),e},set_bbox__(){this.isDefaultBBoxSize()?this.getGeometry()?this.bbox.assign(this.getGeometry().getBBox()):this.bbox.set():this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue()),this.bboxSize.assign(this.bbox.size),this.bboxCenter.assign(this.bbox.center)},set_appearance__(){this.appearanceNode&&(this.appearanceNode._alphaMode.removeInterest("set_transparent__",this),this.appearanceNode._transparent.removeInterest("set_transparent__",this),this.appearanceNode._transmission.removeInterest("set_transmission__",this),this.appearanceNode._volumeScatter.removeInterest("set_volumeScatter__",this)),this.appearanceNode=(0,hi.A)(m.A.X3DAppearanceNode,this._appearance)??this.getBrowser().getDefaultAppearance(),this.appearanceNode._alphaMode.addInterest("set_transparent__",this),this.appearanceNode._transparent.addInterest("set_transparent__",this),this.appearanceNode._transmission.addInterest("set_transmission__",this),this.appearanceNode._volumeScatter.addInterest("set_volumeScatter__",this),this.set_transparent__(),this.set_transmission__(),this.set_volumeScatter__()},set_geometry__(){this.geometryNode&&(this.geometryNode._transparent.addInterest("set_transparent__",this),this.geometryNode._bbox_changed.addInterest("set_bbox__",this)),this.geometryNode=(0,hi.A)(m.A.X3DGeometryNode,this._geometry),this.geometryNode&&(this.geometryNode._transparent.addInterest("set_transparent__",this),this.geometryNode._bbox_changed.addInterest("set_bbox__",this)),this.set_bbox__(),this.set_transparent__(),this.set_objects__()},set_transparent__(){const e=this.appearanceNode.getAlphaMode();e===ui.A.AUTO?(this.transparent=!(!this.appearanceNode.isTransparent()&&!this.geometryNode?.isTransparent()),this.alphaMode=this.transparent?ui.A.BLEND:ui.A.OPAQUE):(this.transparent=e===ui.A.BLEND,this.alphaMode=e)},set_transmission__(){this.set_renderPass__(this.appearanceNode.isTransmission(),di.A.TRANSMISSION_BIT),this[di.A.TRANSMISSION_KEY]=this.appearanceNode.isTransmission()?null:this},set_volumeScatter__(){this.set_renderPass__(this.appearanceNode.isVolumeScatter(),di.A.VOLUME_SCATTER_BIT),this[di.A.VOLUME_SCATTER_KEY]=this.appearanceNode.isVolumeScatter()?this:null},set_renderPass__(e,t){e?this.renderPasses|=t:this.renderPasses&=~t},set_objects__(){this.set_boundedObject__(),this.set_pointingObject__(),this.set_pickableObject__(),this.set_collisionObject__(),this.set_shadowObject__(),this.set_visibleObject__()},set_boundedObject__(){this.setBoundedObject(this.isEnabled()||!this.isDefaultBBoxSize())},set_pointingObject__(){this.setPointingObject(this.isEnabled()&&this._pointerEvents.getValue())},set_pickableObject__(){this.setPickableObject(this.getTransformSensors().size)},set_collisionObject__(){this.setCollisionObject(this.isEnabled())},set_shadowObject__(){this.setShadowObject(this.isEnabled()&&this._castShadow.getValue())},set_visibleObject__(){this.setVisibleObject(this.isEnabled())},traverse(e,t){switch(e){case ci.A.POINTER:t.addPointingShape(this);break;case ci.A.PICKING:this.picking(t);break;case ci.A.COLLISION:t.addCollisionShape(this);break;case ci.A.SHADOW:t.addShadowShape(this);break;case ci.A.DISPLAY:t.addDisplayShape(this)&&this.appearanceNode.traverse(e,t)}this.geometryNode?.traverse(e,t)},picking(e){const t=e.getModelViewMatrix().get();for(const e of this.getTransformSensors())e.collect(t);if(!this.geometryNode)return;const i=this.getBrowser(),n=i.getPickSensors(),s=i.getPickingHierarchy();s.push(this);for(const e of n.at(-1))e.collect(this.geometryNode,t,s);s.pop()},dispose(){li.A.prototype.dispose.call(this),ai.A.prototype.dispose.call(this)}}),Object.defineProperties(gi,Je.A.getStaticProperties("X3DShapeNode","Shape",1));const fi=gi,mi=s.A.add("X3DShapeNode",fi);function Ai(e){mi.call(this,e),this.addType(m.A.Shape)}Object.assign(Object.setPrototypeOf(Ai.prototype,mi.prototype),{getShapeKey:()=>0,getNumInstances:()=>1,displaySimple(e,t,i){this.getGeometry().displaySimple(e,t,i)},display(e,t){this.getGeometry().display(e,t)}}),Object.defineProperties(Ai,{...Je.A.getStaticProperties("Shape","Shape",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"pointerEvents",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"castShadow",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOutput,"appearance",new c.A.SFNode),new o.A(m.A.inputOutput,"geometry",new c.A.SFNode)]),enumerable:!0}});const _i=Ai,yi=s.A.add("Shape",_i);var wi=n(3819),xi=n(1490),bi=n(8392),Si=n(9582);const Ti=Symbol(),vi=Symbol(),Oi=Symbol(),Ei=Symbol(),Ni=Symbol(),Ci=Symbol();function Ii(e){this.getExecutionContext()||at.A.call(this,e);const t=this.getBrowser().getContext();this.lineStipples=new Float32Array,this.lineStippleBuffer=t.createBuffer(),this.thickLinesVertexArrayObject=new wi.A(t),this.setGeometryType(1),this.setSolid(!1)}Object.assign(Object.setPrototypeOf(Ii.prototype,at.A.prototype),{intersectsLine:()=>!1,updateVertexArrays(){at.A.prototype.updateVertexArrays.call(this),this.thickLinesVertexArrayObject.update()},generateTexCoords(){const e=this.getVertices().length/8;if(this.lineStipples.length/6===e)return;const t=this.getBrowser().getContext();this.lineStipples=new Float32Array(6*e),t.bindBuffer(t.ARRAY_BUFFER,this.lineStippleBuffer),t.bufferData(t.ARRAY_BUFFER,this.lineStipples,t.DYNAMIC_DRAW)},updateLengthSoFar:(()=>{const e=new Si.A,t=new bi.A,i=new bi.A,n=new It.A,s=new It.A;return function(r,{viewport:o,renderObject:a,modelViewMatrix:l}){const h=a.getProjectionMatrix().get(),c=this.lineStipples,u=this.getVertices().getValue(),d=u.length;e.assign(l).multRight(h);let p=0;for(let r=0,a=0;r<d;r+=8,a+=6)t.set(u[r],u[r+1],u[r+2],u[r+3]),i.set(u[r+4],u[r+5],u[r+6],u[r+7]),xi.A.projectPointMatrix(t,e,o,n),xi.A.projectPointMatrix(i,e,o,s),c[a]=s.x,c[a+1]=s.y,c[a+3]=n.x,c[a+4]=n.y,c[a+5]=p,p+=s.subtract(n).norm();r.bindBuffer(r.ARRAY_BUFFER,this.lineStippleBuffer),r.bufferData(r.ARRAY_BUFFER,c,r.DYNAMIC_DRAW)}})(),displaySimple(e,t,i){this.displaySimpleThick(e,t,i)||(this.vertexArrayObject.enable(i.getProgram())&&(this.coordIndices.length&&i.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0),i.enableLineStippleAttribute(e,this.lineStippleBuffer,0,0),this.hasNormals&&i.enableNormalAttribute(e,this.normalBuffer,0,0),i.enableVertexAttribute(e,this.vertexBuffer,0,0)),e.drawArrays(e.LINES,0,this.vertexCount),e.lineWidth(1))},displaySimpleThick(e,t,i){const n=t.shapeNode.getAppearance().getStyleProperties(1);if(!n)return!1;if(!n.getTransformLines())return!1;const s=this.getVertices().length/8;if(this[Ti]!==s)return!0;if(this.hasNormals&&this[Oi]!==s)return!0;if(this.thickLinesVertexArrayObject.enable(i.getProgram())){if(this.hasNormals){const t=16*Float32Array.BYTES_PER_ELEMENT,n=13*Float32Array.BYTES_PER_ELEMENT;i.enableNormalAttribute(e,this.lineTrianglesBuffer2,t,n)}const t=13*Float32Array.BYTES_PER_ELEMENT,n=0,s=1*Float32Array.BYTES_PER_ELEMENT,r=9*Float32Array.BYTES_PER_ELEMENT;this.coordIndices.length&&i.enableCoordIndexAttribute(e,this[Ei],t,n),i.enableLineStippleAttribute(e,this[Ei],t,s),i.enableVertexAttribute(e,this[Ei],t,r)}return e.drawArrays(e.TRIANGLES,0,3*this.vertexCount),!0},displaySimpleInstanced(e,t,i){if(this.displaySimpleInstancedThick(e,t,i))return;const n=i.getInstances();if(n.vertexArrayObject.update(this.updateInstances).enable(t.getProgram())){const{instancesStride:s,matrixOffset:r,normalMatrixOffset:o}=i;t.enableInstanceMatrixAttribute(e,n,s,r,1),void 0!==o&&t.enableInstanceNormalMatrixAttribute(e,n,s,o,1),this.coordIndices.length&&t.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0),this.hasNormals&&t.enableNormalAttribute(e,this.normalBuffer,0,0),t.enableLineStippleAttribute(e,this.lineStippleBuffer,0,0),t.enableVertexAttribute(e,this.vertexBuffer,0,0),this.updateInstances=!1}e.drawArraysInstanced(e.LINES,0,this.vertexCount,i.getNumInstances())},displaySimpleInstancedThick(e,t,i){const n=i.getAppearance().getStyleProperties(1);if(!n)return!1;if(!n.getTransformLines())return!1;const s=this.getVertices().length/8*i.getNumInstances();if(i[Ti]!==s)return!0;if(this.hasNormals&&i[Oi]!==s)return!0;if(i.getInstances().thickLinesVertexArrayObject.update(this.updateInstances).enable(t.getProgram())){if(t.enableInstanceMatrixAttribute(e,i[Ni],0,0,0),this.hasNormals){const n=16*Float32Array.BYTES_PER_ELEMENT,s=0,r=13*Float32Array.BYTES_PER_ELEMENT;i.normalMatrixOffset&&t.enableInstanceNormalMatrixAttribute(e,i[Ci],n,s,0),t.enableNormalAttribute(e,i[Ci],n,r)}const n=13*Float32Array.BYTES_PER_ELEMENT,s=0,r=1*Float32Array.BYTES_PER_ELEMENT,o=9*Float32Array.BYTES_PER_ELEMENT;this.coordIndices.length&&t.enableCoordIndexAttribute(e,i[Ei],n,s),t.enableLineStippleAttribute(e,i[Ei],n,r),t.enableVertexAttribute(e,i[Ei],n,o),this.updateInstances=!1}return e.drawArrays(e.TRIANGLES,0,3*this.vertexCount*i.getNumInstances()),!0},display(e,t){if(this.displayThick(e,t))return;const{viewport:i,appearanceNode:n}=t,s=this.getBrowser(),r=s.getPrimitiveMode(e.LINES),o=n.getShader(this,t),a=n.getRenderModes();e.viewport(...i);for(const t of a)t.enable(e);if(o.enable(e),o.setUniforms(e,t,this),this.vertexArrayObject.enable(o.getProgram())){const t=this.getAttrib(),i=this.getAttribBuffers();this.coordIndices.length&&o.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0);for(let n=0,s=t.length;n<s;++n)t[n].enable(e,o,i[n]);o.enableLineStippleAttribute(e,this.lineStippleBuffer,0,0),this.hasFogCoords&&o.enableFogDepthAttribute(e,this.fogDepthBuffer,0,0),this.colorMaterial&&o.enableColorAttribute(e,this.colorBuffer,0,0),this.hasTangents&&o.enableTangentAttribute(e,this.tangentBuffer,0,0),this.hasNormals&&o.enableNormalAttribute(e,this.normalBuffer,0,0),o.enableVertexAttribute(e,this.vertexBuffer,0,0)}e.drawArrays(r,0,this.vertexCount);for(const t of a)t.disable(e);s.resetTextureUnits(),e.lineWidth(1)},displayThick:(()=>{const e=new Si.A,t=new Float32Array(16),i=new Float32Array(16);return function(n,s){const{renderObject:r,viewport:o,modelViewMatrix:a,appearanceNode:l}=s,h=l.getStyleProperties(1);if(!h)return!1;if(h.getApplied()&&1!==h.getLinetype()&&this.updateLengthSoFar(n,s),!h.getTransformLines())return!1;const c=this.getBrowser(),u=l.getShader(this,s),d=l.getRenderModes(),p=r.getProjectionMatrix().get(),g=c.getPrimitiveMode(n.TRIANGLES),f=c.getLineTransformShader();if(t.set(e.assign(a).multRight(p)),i.set(e.inverse()),f.enable(n),n.uniform4f(f.viewport,...o),n.uniformMatrix4fv(f.modelViewProjectionMatrix,!1,t),n.uniformMatrix4fv(f.invModelViewProjectionMatrix,!1,i),n.uniform1f(f.linewidthScaleFactor1_2,h.getLinewidthScaleFactor()/2),this.thickLinesVertexArrayObject.enable(f.getProgram())){const e=2*Float32Array.BYTES_PER_ELEMENT,t=0,i=1*Float32Array.BYTES_PER_ELEMENT,s=6*Float32Array.BYTES_PER_ELEMENT,r=5*Float32Array.BYTES_PER_ELEMENT,o=2*Float32Array.BYTES_PER_ELEMENT,a=0,l=1*Float32Array.BYTES_PER_ELEMENT,h=8*Float32Array.BYTES_PER_ELEMENT,c=0,u=4*Float32Array.BYTES_PER_ELEMENT,d=8*Float32Array.BYTES_PER_ELEMENT,p=0,g=4*Float32Array.BYTES_PER_ELEMENT;this.coordIndices.length&&(f.enableFloatAttrib(n,"x3d_CoordIndex0",this.coordIndexBuffer,1,e,t),f.enableFloatAttrib(n,"x3d_CoordIndex1",this.coordIndexBuffer,1,e,i)),f.enableFloatAttrib(n,"x3d_LengthSoFar",this.lineStippleBuffer,1,s,r),this.hasFogCoords&&(f.enableFloatAttrib(n,"x3d_FogDepth0",this.fogDepthBuffer,1,o,a),f.enableFloatAttrib(n,"x3d_FogDepth1",this.fogDepthBuffer,1,o,l)),this.colorMaterial&&(f.enableFloatAttrib(n,"x3d_Color0",this.colorBuffer,4,h,c),f.enableFloatAttrib(n,"x3d_Color1",this.colorBuffer,4,h,u)),f.enableFloatAttrib(n,"x3d_Vertex0",this.vertexBuffer,4,d,p),f.enableFloatAttrib(n,"x3d_Vertex1",this.vertexBuffer,4,d,g)}const m=this.getVertices().length/8;if(this[Ti]!==m&&(this[Ti]=m,this[Ei]??=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this[Ei]),n.bufferData(n.ARRAY_BUFFER,new Float32Array(96*m),n.DYNAMIC_DRAW)),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,c.getLineTransformFeedback()),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,this[Ei]),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArraysInstanced(n.POINTS,0,this.vertexCount/2,2),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null),this.hasNormals){const e=c.getLineTransformInstancedShader(2);if(e.enable(n),this.thickLinesVertexArrayObject.enable(e.getProgram())){if(this.hasTangents&&e.enableTangentAttribute(n,this.tangentBuffer,0,0),this.hasTangents){const t=8*Float32Array.BYTES_PER_ELEMENT,i=0,s=4*Float32Array.BYTES_PER_ELEMENT;e.enableFloatAttrib(n,"x3d_Tangent0",this.tangentBuffer,4,t,i),e.enableFloatAttrib(n,"x3d_Tangent1",this.tangentBuffer,4,t,s)}const t=6*Float32Array.BYTES_PER_ELEMENT,i=0,s=3*Float32Array.BYTES_PER_ELEMENT;e.enableFloatAttrib(n,"x3d_Normal0",this.normalBuffer,3,t,i),e.enableFloatAttrib(n,"x3d_Normal1",this.normalBuffer,3,t,s)}this[Oi]!==m&&(this[Oi]=m,this.lineTrianglesBuffer2??=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.lineTrianglesBuffer2),n.bufferData(n.ARRAY_BUFFER,new Float32Array(96*m),n.DYNAMIC_DRAW)),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,c.getLineTransformFeedback()),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,this.lineTrianglesBuffer2),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArraysInstanced(n.POINTS,0,this.vertexCount/2,2),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null)}n.viewport(...o);for(const e of d)e.enable(n);if(u.enable(n),u.setUniforms(n,s,this),this.thickLinesVertexArrayObject.enable(u.getProgram())){if(this.hasNormals){const e=16*Float32Array.BYTES_PER_ELEMENT,t=9*Float32Array.BYTES_PER_ELEMENT,i=13*Float32Array.BYTES_PER_ELEMENT;this.hasTangents&&u.enableTangentAttribute(n,this.lineTrianglesBuffer2,e,t),u.enableNormalAttribute(n,this.lineTrianglesBuffer2,e,i)}const e=13*Float32Array.BYTES_PER_ELEMENT,t=0,i=1*Float32Array.BYTES_PER_ELEMENT,s=4*Float32Array.BYTES_PER_ELEMENT,r=5*Float32Array.BYTES_PER_ELEMENT,o=9*Float32Array.BYTES_PER_ELEMENT;u.enableCoordIndexAttribute(n,this[Ei],e,t),u.enableLineStippleAttribute(n,this[Ei],e,i),this.hasFogCoords&&u.enableFogDepthAttribute(n,this[Ei],e,s),this.colorMaterial&&u.enableColorAttribute(n,this[Ei],e,r),u.enableVertexAttribute(n,this[Ei],e,o)}n.frontFace(n.CCW),n.enable(n.CULL_FACE),n.drawArrays(g,0,3*this.vertexCount);for(const e of d)e.disable(n);return c.resetTextureUnits(),!0}})(),displayInstanced(e,t,i){if(this.displayInstancedThick(e,t,i))return;const{viewport:n,appearanceNode:s}=t,r=this.getBrowser(),o=i.getGeometryContext(),a=s.getShader(o,t),l=s.getRenderModes(),h=r.getPrimitiveMode(e.LINES);e.viewport(...n);for(const t of l)t.enable(e);a.enable(e),a.setUniforms(e,t,this);const c=i.getInstances();if(c.vertexArrayObject.update(this.updateInstances).enable(a.getProgram())){const{instancesStride:t,particleOffset:n,velocityOffset:s,matrixOffset:r,normalMatrixOffset:l,colorOffset:h}=i,u=this.getAttrib(),d=this.getAttribBuffers();void 0!==n&&a.enableParticleAttribute(e,c,t,n,1),void 0!==s&&a.enableParticleVelocityAttribute(e,c,t,s,1),a.enableInstanceMatrixAttribute(e,c,t,r,1),void 0!==l&&a.enableInstanceNormalMatrixAttribute(e,c,t,l,1),this.coordIndices.length&&a.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0);for(let t=0,i=u.length;t<i;++t)u[t].enable(e,a,d[t]);this.hasFogCoords&&a.enableFogDepthAttribute(e,this.fogDepthBuffer,0,0),o.colorMaterial&&(o===this?a.enableColorAttribute(e,this.colorBuffer,0,0):a.enableColorAttribute(e,c,t,h,1)),this.hasTangents&&a.enableNormalAttribute(e,this.tangentBuffer,0,0),this.hasNormals&&a.enableNormalAttribute(e,this.normalBuffer,0,0),a.enableVertexAttribute(e,this.vertexBuffer,0,0),this.updateInstances=!1}e.drawArraysInstanced(h,0,this.vertexCount,i.getNumInstances());for(const t of l)t.disable(e);r.resetTextureUnits(),e.lineWidth(1)},displayInstancedThick:(()=>{const e=new Si.A,t=new Float32Array(16),i=new Float32Array(16);return function(n,s,r){const{renderObject:o,viewport:a,appearanceNode:l}=s,h=l.getStyleProperties(1);if(!h)return!1;if(h.getApplied()&&1!==h.getLinetype()&&this.updateLengthSoFar(n,s),!h.getTransformLines())return!1;const c=this.getBrowser(),u=r.getGeometryContext(),d=l.getShader(u,s),p=l.getRenderModes(),g=o.getProjectionMatrix().get(),f=c.getPrimitiveMode(n.TRIANGLES),m=c.getLineTransformInstancedShader(0);t.set(e.assign(s.modelViewMatrix).multRight(g)),i.set(e.inverse()),m.enable(n),n.uniform4f(m.viewport,...a),n.uniformMatrix4fv(m.modelViewProjectionMatrix,!1,t),n.uniformMatrix4fv(m.invModelViewProjectionMatrix,!1,i),n.uniform1f(m.linewidthScaleFactor1_2,h.getLinewidthScaleFactor()/2);const A=r.getInstances();if(A.thickLinesVertexArrayObject.update(this.updateInstances).enable(m.getProgram())){const{instancesStride:e,matrixOffset:t,colorOffset:i}=r;m.enableInstanceMatrixAttribute(n,A,e,t,2);const s=2*Float32Array.BYTES_PER_ELEMENT,o=0,a=1*Float32Array.BYTES_PER_ELEMENT,l=6*Float32Array.BYTES_PER_ELEMENT,h=5*Float32Array.BYTES_PER_ELEMENT,c=2*Float32Array.BYTES_PER_ELEMENT,d=0,p=1*Float32Array.BYTES_PER_ELEMENT,g=8*Float32Array.BYTES_PER_ELEMENT,f=0,_=4*Float32Array.BYTES_PER_ELEMENT,y=8*Float32Array.BYTES_PER_ELEMENT,w=0,x=4*Float32Array.BYTES_PER_ELEMENT;this.coordIndices.length&&(m.enableFloatAttrib(n,"x3d_CoordIndex0",this.coordIndexBuffer,1,s,o),m.enableFloatAttrib(n,"x3d_CoordIndex1",this.coordIndexBuffer,1,s,a)),m.enableFloatAttrib(n,"x3d_LengthSoFar",this.lineStippleBuffer,1,l,h),this.hasFogCoords&&(m.enableFloatAttrib(n,"x3d_FogDepth0",this.fogDepthBuffer,1,c,d),m.enableFloatAttrib(n,"x3d_FogDepth1",this.fogDepthBuffer,1,c,p)),u.colorMaterial&&(u===this?(m.enableFloatAttrib(n,"x3d_Color0",this.colorBuffer,4,g,f),m.enableFloatAttrib(n,"x3d_Color1",this.colorBuffer,4,g,_)):(m.enableFloatAttrib(n,"x3d_Color0",A,4,e,i,2),m.enableFloatAttrib(n,"x3d_Color1",A,4,e,i,2))),m.enableFloatAttrib(n,"x3d_Vertex0",this.vertexBuffer,4,y,w),m.enableFloatAttrib(n,"x3d_Vertex1",this.vertexBuffer,4,y,x)}const _=this.getVertices().length/8*r.getNumInstances();r[Ti]!==_&&(r[Ti]=_,r[Ei]??=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,r[Ei]),n.bufferData(n.ARRAY_BUFFER,new Float32Array(78*_),n.DYNAMIC_DRAW)),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,c.getLineTransformFeedback()),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,r[Ei]),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArraysInstanced(n.POINTS,0,this.vertexCount/2,2*r.getNumInstances()),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null);const y=c.getLineTransformInstancedShader(1);if(y.enable(n),A.thickLinesVertexArrayObject.update(this.updateInstances).enable(y.getProgram())){const{instancesStride:e,matrixOffset:t}=r;y.enableInstanceMatrixAttribute(n,A,e,t,1)}if(r[vi]!==_&&(r[vi]=_,r[Ni]??=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,r[Ni]),n.bufferData(n.ARRAY_BUFFER,new Float32Array(96*_),n.DYNAMIC_DRAW)),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,c.getLineTransformFeedback()),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,r[Ni]),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArraysInstanced(n.POINTS,0,this.vertexCount,r.getNumInstances()),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null),this.hasNormals){const e=c.getLineTransformInstancedShader(2);if(e.enable(n),A.thickLinesVertexArrayObject.update(this.updateInstances).enable(e.getProgram())){const{instancesStride:t,normalMatrixOffset:i}=r;if(e.enableInstanceNormalMatrixAttribute(n,A,t,i,2),this.hasTangents&&e.enableTangentAttribute(n,this.tangentBuffer,0,0),this.hasTangents){const t=8*Float32Array.BYTES_PER_ELEMENT,i=0,s=4*Float32Array.BYTES_PER_ELEMENT;e.enableFloatAttrib(n,"x3d_Tangent0",this.tangentBuffer,4,t,i),e.enableFloatAttrib(n,"x3d_Tangent1",this.tangentBuffer,4,t,s)}const s=6*Float32Array.BYTES_PER_ELEMENT,o=0,a=3*Float32Array.BYTES_PER_ELEMENT;e.enableFloatAttrib(n,"x3d_Normal0",this.normalBuffer,3,s,o),e.enableFloatAttrib(n,"x3d_Normal1",this.normalBuffer,3,s,a)}r[Oi]!==_&&(r[Oi]=_,r[Ci]??=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,r[Ci]),n.bufferData(n.ARRAY_BUFFER,new Float32Array(96*_),n.DYNAMIC_DRAW)),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,c.getLineTransformFeedback()),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,r[Ci]),n.enable(n.RASTERIZER_DISCARD),n.beginTransformFeedback(n.POINTS),n.drawArraysInstanced(n.POINTS,0,this.vertexCount/2,2*r.getNumInstances()),n.endTransformFeedback(),n.disable(n.RASTERIZER_DISCARD),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null)}n.viewport(...a);for(const e of p)e.enable(n);if(d.enable(n),d.setUniforms(n,s,u),A.thickLinesVertexArrayObject.update(this.updateInstances).enable(d.getProgram())){if(d.enableInstanceMatrixAttribute(n,r[Ni],0,0,0),this.hasNormals){const e=16*Float32Array.BYTES_PER_ELEMENT,t=0,i=9*Float32Array.BYTES_PER_ELEMENT,s=13*Float32Array.BYTES_PER_ELEMENT;r.normalMatrixOffset&&d.enableInstanceNormalMatrixAttribute(n,r[Ci],e,t,0),this.hasTangents&&d.enableTangentAttribute(n,r[Ci],e,i),d.enableNormalAttribute(n,r[Ci],e,s)}const e=13*Float32Array.BYTES_PER_ELEMENT,t=0,i=1*Float32Array.BYTES_PER_ELEMENT,s=4*Float32Array.BYTES_PER_ELEMENT,o=5*Float32Array.BYTES_PER_ELEMENT,a=9*Float32Array.BYTES_PER_ELEMENT;d.enableCoordIndexAttribute(n,r[Ei],e,t),d.enableLineStippleAttribute(n,r[Ei],e,i),this.hasFogCoords&&d.enableFogDepthAttribute(n,r[Ei],e,s),u.colorMaterial&&d.enableColorAttribute(n,r[Ei],e,o),d.enableVertexAttribute(n,r[Ei],e,a),this.updateInstances=!1}n.frontFace(n.CCW),n.enable(n.CULL_FACE),n.drawArrays(f,0,3*this.vertexCount*r.getNumInstances());for(const e of p)e.disable(n);return c.resetTextureUnits(),!0}})()}),Object.defineProperties(Ii,Je.A.getStaticProperties("X3DLineGeometryNode","Rendering",1));const Fi=Ii,Mi=s.A.add("X3DLineGeometryNode",Fi);function Ri(e){Mi.call(this,e),this.addType(m.A.IndexedLineSet)}Object.assign(Object.setPrototypeOf(Ri.prototype,Mi.prototype),{initialize(){Mi.prototype.initialize.call(this),this._set_colorIndex.addFieldInterest(this._colorIndex),this._set_coordIndex.addFieldInterest(this._coordIndex),this._attrib.addInterest("set_attrib__",this),this._fogCoord.addInterest("set_fogCoord__",this),this._color.addInterest("set_color__",this),this._tangent.addInterest("set_tangent__",this),this._normal.addInterest("set_normal__",this),this._coord.addInterest("set_coord__",this),this.set_attrib__(),this.set_fogCoord__(),this.set_color__(),this.set_tangent__(),this.set_normal__(),this.set_coord__()},getColorPerVertexIndex(e){return e<this._colorIndex.length?this._colorIndex[e]:this._coordIndex[e]},getColorIndex(e){return e<this._colorIndex.length?this._colorIndex[e]:e},getPolylineIndices(){const e=this._coordIndex,t=[];let i=[];if(e.length){for(let n=0,s=e.length;n<s;++n){e[n]>=0?i.push(n):(t.push(i),i=[])}e[e.length-1]>=0&&t.push(i)}return t},build(){if(!this.coordNode?.getSize())return;const e=this._coordIndex,t=this.getPolylineIndices(),i=this._colorPerVertex.getValue(),n=this.getCoordIndices(),s=this.getAttrib(),r=s.length,o=this.getAttribs(),a=this.getFogCoord(),l=this.getColor(),h=this.getTangent(),c=this.getNormal(),u=this.getCoord(),d=this.getFogDepths(),p=this.getColors(),g=this.getTangents(),f=this.getNormals(),m=this.getVertices();let A=0;for(const _ of t){if(_.length>1)for(let t=0,y=_.length-1;t<y;++t)for(let y=t,w=t+2;y<w;++y){const t=_[y],w=e[t];n.push(w);for(let e=0;e<r;++e)s[e].addValue(w,o[e]);a?.addDepth(w,d),l?.addColor(i?this.getColorPerVertexIndex(t):this.getColorIndex(A),p),h?.addVector(w,g),c?.addVector(w,f),u.addPoint(w,m)}++A}}}),Object.defineProperties(Ri,{...Je.A.getStaticProperties("IndexedLineSet","Rendering",1,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_colorIndex",new c.A.MFInt32),new o.A(m.A.inputOnly,"set_coordIndex",new c.A.MFInt32),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorIndex",new c.A.MFInt32),new o.A(m.A.initializeOnly,"coordIndex",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const Pi=Ri,Vi=s.A.add("IndexedLineSet",Pi),Di=Symbol();function Li(){}Object.assign(Li.prototype,{getBBoxShape(){return this[Di]??=(()=>{const e=new yi(this.getPrivateScene()),t=new Vi(this.getPrivateScene()),i=new St(this.getPrivateScene());return e._pointerEvents=!1,e._castShadow=!1,e._geometry=t,t._coordIndex=[0,1,2,3,0,-1,4,5,6,7,4,-1,0,4,-1,1,5,-1,2,6,-1,3,7,-1],t._coord=i,i._point=[.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5,.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5],i.setPrivate(!0),t.setPrivate(!0),e.setPrivate(!0),i.setup(),t.setup(),e.setup(),e})()}});const Bi=Li,ki=s.A.add("X3DGroupingContext",Bi);var ji=n(1766);function Ui(e){ji.A.call(this,e),this.addType(m.A.X3DViewportNode)}Object.setPrototypeOf(Ui.prototype,ji.A.prototype),Object.defineProperties(Ui,Je.A.getStaticProperties("X3DViewportNode","Layering",1));const Xi=Ui,zi=s.A.add("X3DViewportNode",Xi);function Gi(e){zi.call(this,e),this.addType(m.A.Viewport),this.viewVolume=new xi.A,this.rectangle=new bi.A}Object.assign(Object.setPrototypeOf(Gi.prototype,zi.prototype),{initialize(){zi.prototype.initialize.call(this),this._clipBoundary.addInterest("set_clipBoundary__",this),this.set_clipBoundary__()},set_clipBoundary__(){this.left=this._clipBoundary.length>0?W.A.clamp(this._clipBoundary[0],0,1):0,this.right=this._clipBoundary.length>1?W.A.clamp(this._clipBoundary[1],0,1):1,this.bottom=this._clipBoundary.length>2?W.A.clamp(this._clipBoundary[2],0,1):0,this.top=this._clipBoundary.length>3?W.A.clamp(this._clipBoundary[3],0,1):1},getRectangle(e=this.getBrowser().getViewport()){const t=Math.floor(e[0]+e[2]*this.left),i=Math.floor(e[0]+e[2]*this.right),n=Math.floor(e[1]+e[3]*this.bottom),s=Math.floor(e[1]+e[3]*this.top);return this.rectangle.set(t,n,Math.max(i-t,0),Math.max(s-n,0)),this.rectangle},traverse(e,t){try{if(this.push(t),e===ci.A.POINTER){const e=this.getBrowser();if(!e.getPointingLayer()&&!e.isPointerInRectangle(this.rectangle))return}zi.prototype.traverse.call(this,e,t)}finally{this.pop(t)}},push(e){const t=e.getViewVolumes(),i=this.viewVolume,n=this.getRectangle(t.at(-1)?.getViewport());i.set(e.getProjectionMatrix().get(),n),t.push(i)},pop(e){e.getViewVolumes().pop()}}),Object.defineProperties(Gi,{...Je.A.getStaticProperties("Viewport","Layering",1,"viewport","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"clipBoundary",new c.A.MFFloat(0,1,0,1)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const Hi=Gi,$i=s.A.add("Viewport",Hi),Yi=Symbol();function qi(){this[Yi]=new $i(this.getPrivateScene())}Object.assign(qi.prototype,{initialize(){this[Yi].setup()},getDefaultViewport(){return this[Yi]}});const Wi=qi,Ki=s.A.add("X3DLayeringContext",Wi);var Zi=n(5041),Qi=n(1815);const Ji=s.A.add("ToneMapping2.glsl",()=>"\nconst float GAMMA=2.2;const float INV_GAMMA=1./GAMMA;vec3 linearToSRGB(const in vec3 color){return pow(color,vec3(INV_GAMMA));}vec4 linearToSRGB(const in vec4 color){return vec4(linearToSRGB(color.rgb),color.a);}vec3 sRGBToLinear(const in vec3 color){return pow(color,vec3(GAMMA));}vec4 sRGBToLinear(const in vec4 color){return vec4(sRGBToLinear(color.rgb),color.a);}\n#if defined(X3D_TONEMAP_ACES_NARKOWICZ)\nvec3 toneMapACES_Narkowicz(const in vec3 color){const float A=2.51;const float B=.03;const float C=2.43;const float D=.59;const float E=.14;return clamp((color*(A*color+B))/(color*(C*color+D)+E),0.,1.);}\n#endif\n#if defined(X3D_TONEMAP_ACES_HILL)||defined(X3D_TONEMAP_ACES_HILL_EXPOSURE_BOOST)\nconst mat3 ACESInputMat=mat3(.59719,.07600,.02840,.35458,.90834,.13383,.04823,.01566,.83777);const mat3 ACESOutputMat=mat3(1.60475,-.10208,-.00327,-.53108,1.10813,-.07276,-.07367,-.00605,1.07602);vec3 RRTAndODTFit(const in vec3 color){vec3 a=color*(color+.0245786)-.000090537;vec3 b=color*(.983729*color+.4329510)+.238081;return a/b;}vec3 toneMapACES_Hill(in vec3 color){color=ACESInputMat*color;color=RRTAndODTFit(color);color=ACESOutputMat*color;color=clamp(color,0.,1.);return color;}\n#endif\n#if defined(X3D_TONEMAP_KHR_PBR_NEUTRAL)\nvec3 toneMap_KhronosPbrNeutral(in vec3 color){const float startCompression=.8-.04;const float desaturation=.15;float x=min(color.r,min(color.g,color.b));float offset=x<.08?x-6.25*x*x:.04;color-=offset;float peak=max(color.r,max(color.g,color.b));if(peak<startCompression)return color;const float d=1.-startCompression;float newPeak=1.-d*d/(peak+d-startCompression);color*=newPeak/peak;float g=1.-1./(desaturation*(peak-newPeak)+1.);return mix(color,newPeak*vec3(1),g);}\n#endif\nuniform float x3d_Exposure;vec3 toneMap(in vec3 color){color*=x3d_Exposure;\n#if defined(X3D_TONEMAP_ACES_NARKOWICZ)\ncolor=toneMapACES_Narkowicz(color);\n#endif\n#if defined(X3D_TONEMAP_ACES_HILL)\ncolor=toneMapACES_Hill(color);\n#endif\n#if defined(X3D_TONEMAP_ACES_HILL_EXPOSURE_BOOST)\ncolor/=.6;color=toneMapACES_Hill(color);\n#endif\n#if defined(X3D_TONEMAP_KHR_PBR_NEUTRAL)\ncolor=toneMap_KhronosPbrNeutral(color);\n#endif\n#if defined(X3D_COLORSPACE_LINEAR)\ncolor=linearToSRGB(color);\n#endif\nreturn color;}");let en=0;const tn={LAMBERTIAN:en++,GGX:en++,CHARLIE:en++},nn=s.A.add("Distribution",tn),sn=`#version 300 es\nprecision highp float;precision highp int;precision highp samplerCube;\n${Ji()}\n${Object.entries(nn).map(([e,t])=>`#define X3D_${e} ${t}`).join("\n")}\nconst float M_PI=3.1415926535897932384626433832795;uniform samplerCube x3d_TextureEXT;uniform int x3d_TextureSizeEXT;uniform bool x3d_TextureLinearEXT;uniform int x3d_CurrentFaceEXT;uniform int x3d_DistributionEXT;uniform int x3d_SampleCountEXT;uniform float x3d_RoughnessEXT;uniform float x3d_LodBiasEXT;uniform float x3d_IntensityEXT;in vec2 texCoord;out vec4 x3d_FragColor;mat3 generateTBN(const in vec3 normal){vec3 bitangent=vec3(0.,1.,0.);float NdotUp=dot(normal,vec3(0.,1.,0.));float epsilon=.0000001;if(1.-abs(NdotUp)<=epsilon){if(NdotUp>0.)bitangent=vec3(0.,0.,1.);else bitangent=vec3(0.,0.,-1.);}vec3 tangent=normalize(cross(bitangent,normal));bitangent=cross(normal,tangent);return mat3(tangent,bitangent,normal);}struct MicrofacetDistributionSample{float pdf;float cosTheta;float sinTheta;float phi;};float radicalInverse_VdC(in uint bits){bits=(bits<<16u)|(bits>>16u);bits=((bits&0x55555555u)<<1u)|((bits&0xAAAAAAAAu)>>1u);bits=((bits&0x33333333u)<<2u)|((bits&0xCCCCCCCCu)>>2u);bits=((bits&0x0F0F0F0Fu)<<4u)|((bits&0xF0F0F0F0u)>>4u);bits=((bits&0x00FF00FFu)<<8u)|((bits&0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10;}vec2 hammersley2d(const in int i,const in int N){return vec2(float(i)/float(N),radicalInverse_VdC(uint(i)));}MicrofacetDistributionSample Lambertian(const in vec2 xi,const in float roughness){MicrofacetDistributionSample lambertian;lambertian.cosTheta=sqrt(1.-xi.y);lambertian.sinTheta=sqrt(xi.y);lambertian.phi=2.*M_PI*xi.x;lambertian.pdf=lambertian.cosTheta/M_PI;return lambertian;}float saturate(const in float v){return clamp(v,0.,1.);}float D_GGX(const in float NdotH,const in float roughness){float a=NdotH*roughness;float k=roughness/(1.-NdotH*NdotH+a*a);return k*k*(1./M_PI);}MicrofacetDistributionSample GGX(const in vec2 xi,const in float roughness){MicrofacetDistributionSample ggx;float alpha=roughness*roughness;ggx.cosTheta=saturate(sqrt((1.-xi.y)/(1.+(alpha*alpha-1.)*xi.y)));ggx.sinTheta=sqrt(1.-ggx.cosTheta*ggx.cosTheta);ggx.phi=2.*M_PI*xi.x;ggx.pdf=D_GGX(ggx.cosTheta,alpha);ggx.pdf/=4.;return ggx;}float D_Charlie(in float sheenRoughness,const in float NdotH){sheenRoughness=max(sheenRoughness,.000001);float invR=1./sheenRoughness;float cos2h=NdotH*NdotH;float sin2h=1.-cos2h;return(2.+invR)*pow(sin2h,invR*.5)/(2.*M_PI);}MicrofacetDistributionSample Charlie(const in vec2 xi,const in float roughness){MicrofacetDistributionSample charlie;float alpha=roughness*roughness;charlie.sinTheta=pow(xi.y,alpha/(2.*alpha+1.));charlie.cosTheta=sqrt(1.-charlie.sinTheta*charlie.sinTheta);charlie.phi=2.*M_PI*xi.x;charlie.pdf=D_Charlie(alpha,charlie.cosTheta);charlie.pdf/=4.;return charlie;}vec4 getImportanceSample(const in int sampleIndex,const in vec3 N,const in float roughness){vec2 xi=hammersley2d(sampleIndex,x3d_SampleCountEXT);MicrofacetDistributionSample importanceSample;switch(x3d_DistributionEXT){case X3D_LAMBERTIAN:{importanceSample=Lambertian(xi,roughness);break;}case X3D_GGX:{importanceSample=GGX(xi,roughness);break;}case X3D_CHARLIE:{importanceSample=Charlie(xi,roughness);break;}}vec3 localSpaceDirection=normalize(vec3(importanceSample.sinTheta*cos(importanceSample.phi),importanceSample.sinTheta*sin(importanceSample.phi),importanceSample.cosTheta));mat3 TBN=generateTBN(N);vec3 direction=TBN*localSpaceDirection;return vec4(direction,importanceSample.pdf);}float computeLod(const in float pdf){float lod=.5*log2(6.*float(x3d_TextureSizeEXT)*float(x3d_TextureSizeEXT)/(float(x3d_SampleCountEXT)*pdf));return lod;}vec3 filterColor(const in vec3 N){vec3 color=vec3(0);float weight=0.;for(int i=0;i<x3d_SampleCountEXT;++i){vec4 importanceSample=getImportanceSample(i,N,x3d_RoughnessEXT);vec3 H=importanceSample.xyz;float pdf=importanceSample.w;float lod=computeLod(pdf);lod+=x3d_LodBiasEXT;switch(x3d_DistributionEXT){case X3D_LAMBERTIAN:{vec3 lambertian=textureLod(x3d_TextureEXT,H,lod).rgb;if(!x3d_TextureLinearEXT)lambertian=sRGBToLinear(lambertian);color+=lambertian;break;}case X3D_GGX:case X3D_CHARLIE:{vec3 V=N;vec3 L=normalize(reflect(-V,H));float NdotL=dot(N,L);if(NdotL>0.){if(x3d_RoughnessEXT==0.){lod=x3d_LodBiasEXT;}vec3 sampleColor=textureLod(x3d_TextureEXT,L,lod).rgb;if(!x3d_TextureLinearEXT)sampleColor=sRGBToLinear(sampleColor);color+=sampleColor*NdotL;weight+=NdotL;}break;}}}if(weight!=0.0f)color/=weight;else color/=float(x3d_SampleCountEXT);return color*x3d_IntensityEXT;}vec3 getNormal(const in int face,const in vec2 t){float x;float y;float z;switch(face){case 0:x=t.x;y=-t.y;z=1.;break;case 1:x=-t.x;y=-t.y;z=-1.;break;case 2:x=-1.;y=-t.y;z=t.x;break;case 3:x=1.;y=-t.y;z=-t.x;break;case 4:x=t.x;y=1.;z=t.y;break;case 5:x=t.x;y=-1.;z=-t.y;break;}return normalize(vec3(x,y,z));}void main(){vec3 normal=getNormal(x3d_CurrentFaceEXT,texCoord);x3d_FragColor=vec4(filterColor(normal),1.);}`,rn=s.A.add("Filter2.fs",sn),on=Symbol(),an=Symbol(),ln=Symbol(),hn=Symbol();function cn(){const e=this.getContext(),t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this[on]=t>8?8:2,this[an]=new Map,this[ln]=[]}Object.assign(cn.prototype,{getMaxEnvironmentLights:()=>1,getMaxLights(){return this[on]},getLibraryTexture(e){return this[an].get(e)??this.createLibraryTexture(e)},createLibraryTexture(e){const t=new Qi.A(this.getPrivateScene()),i=new it(this.getPrivateScene());return i._generateMipMaps=!1,i._minificationFilter="AVG_PIXEL",i._magnificationFilter="AVG_PIXEL",i._boundaryModeS="CLAMP_TO_BOUNDARY",i._boundaryModeT="CLAMP_TO_BOUNDARY",i._boundaryModeR="CLAMP_TO_BOUNDARY",i.setup(),t._url=[_e.A.getLibraryURL(e)],t._textureProperties=i,t.setup(),this[an].set(e,t),t},popShadowBuffer(e){try{const t=this[ln][e]??=[];return t.length?t.pop():new Zi.A({browser:this,width:e,height:e,float:!0})}catch(e){return console.error(e),null}},pushShadowBuffer(e){e&&this[ln][e.getWidth()].push(e)},getEnvironmentTextureShader(){return this[hn]??=this.createShader("EnvironmentTexture","FullScreen",`data:x-shader/x-fragment,${rn}`,[],["x3d_TextureEXT","x3d_TextureSizeEXT","x3d_TextureLinearEXT","x3d_CurrentFaceEXT","x3d_DistributionEXT","x3d_SampleCountEXT","x3d_RoughnessEXT","x3d_LodBiasEXT","x3d_IntensityEXT"])},filterEnvironmentTexture({name:e,texture:t,distribution:i,sampleCount:n,roughness:s}){const r=this.getContext(),o=r.getParameter(r.CURRENT_PROGRAM),a=this.getEnvironmentTextureShader(),l=r.createFramebuffer(),h=t.getSize(),c=t.getExecutionContext().createNode("ImageCubeMapTexture",!1);c.setName(e),c.setPrivate(!0),c.setup(),c.setSize(h),c.setLinear(!0);const u=new Uint8Array(h*h*4);r.bindTexture(c.getTarget(),c.getTexture());for(const e of c.getTargets())r.texImage2D(e,0,r.RGBA,h,h,0,r.RGBA,r.UNSIGNED_BYTE,u);s.length>1&&(r.generateMipmap(r.TEXTURE_CUBE_MAP),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_LINEAR),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,r.LINEAR)),r.bindFramebuffer(r.FRAMEBUFFER,l),r.disable(r.DEPTH_TEST),r.enable(r.CULL_FACE),r.frontFace(r.CCW),r.clearColor(0,0,0,0),r.bindVertexArray(this.getFullscreenVertexArrayObject()),r.useProgram(a.getProgram()),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_CUBE_MAP,t.getTexture()),r.uniform1i(a.x3d_TextureEXT,0),r.uniform1i(a.x3d_TextureSizeEXT,h),r.uniform1i(a.x3d_TextureLinearEXT,t.isLinear()),r.uniform1i(a.x3d_DistributionEXT,i),r.uniform1i(a.x3d_SampleCountEXT,n),r.uniform1f(a.x3d_LodBiasEXT,0),r.uniform1f(a.x3d_IntensityEXT,1);for(const[e,t]of s.entries()){const i=h>>e;r.uniform1f(a.x3d_RoughnessEXT,t),r.viewport(0,0,i,i),r.scissor(0,0,i,i);for(let t=0;t<6;++t)r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,c.getTargets()[t],c.getTexture(),e),r.clear(r.COLOR_BUFFER_BIT),r.uniform1i(a.x3d_CurrentFaceEXT,t),r.drawArrays(r.TRIANGLES,0,6)}return r.enable(r.DEPTH_TEST),r.deleteFramebuffer(l),r.useProgram(o),c}});const un=cn,dn=s.A.add("X3DLightingContext",un);var pn=n(1799),gn=n(6576),fn=n(2342);function mn(e){pn.A.call(this,e),this.addType(m.A.OrthoViewpoint),this.addChildObjects(m.A.inputOutput,"fieldOfViewOffset",new c.A.MFFloat(0,0,0,0)),this._position.setUnit("length"),this._centerOfRotation.setUnit("length"),this._fieldOfView.setUnit("length");const t=this.getBrowser().getPrivateScene();this.projectionMatrix=new Si.A,this.fieldOfViewOffsetInterpolator0=new gn.A(t),this.fieldOfViewOffsetInterpolator1=new gn.A(t),this.fieldOfViewOffsetInterpolator2=new gn.A(t),this.fieldOfViewOffsetInterpolator3=new gn.A(t)}Object.assign(Object.setPrototypeOf(mn.prototype,pn.A.prototype),{initialize(){pn.A.prototype.initialize.call(this),this.fieldOfViewOffsetInterpolator0._key=new c.A.MFFloat(0,1),this.fieldOfViewOffsetInterpolator1._key=new c.A.MFFloat(0,1),this.fieldOfViewOffsetInterpolator2._key=new c.A.MFFloat(0,1),this.fieldOfViewOffsetInterpolator3._key=new c.A.MFFloat(0,1),this.fieldOfViewOffsetInterpolator0.setup(),this.fieldOfViewOffsetInterpolator1.setup(),this.fieldOfViewOffsetInterpolator2.setup(),this.fieldOfViewOffsetInterpolator3.setup(),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.fieldOfViewOffsetInterpolator0._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.fieldOfViewOffsetInterpolator1._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.fieldOfViewOffsetInterpolator2._set_fraction),this.easeInEaseOut._modifiedFraction_changed.addFieldInterest(this.fieldOfViewOffsetInterpolator3._set_fraction),this.fieldOfViewOffsetInterpolator0._value_changed.addInterest("set_fieldOfViewOffset__",this),this.fieldOfViewOffsetInterpolator1._value_changed.addInterest("set_fieldOfViewOffset__",this),this.fieldOfViewOffsetInterpolator2._value_changed.addInterest("set_fieldOfViewOffset__",this),this.fieldOfViewOffsetInterpolator3._value_changed.addInterest("set_fieldOfViewOffset__",this)},set_fieldOfViewOffset__(){this._fieldOfViewOffset[0]=this.fieldOfViewOffsetInterpolator0._value_changed.getValue(),this._fieldOfViewOffset[1]=this.fieldOfViewOffsetInterpolator1._value_changed.getValue(),this._fieldOfViewOffset[2]=this.fieldOfViewOffsetInterpolator2._value_changed.getValue(),this._fieldOfViewOffset[3]=this.fieldOfViewOffsetInterpolator3._value_changed.getValue()},resetUserOffsets(){pn.A.prototype.resetUserOffsets.call(this),this._fieldOfViewOffset[0]=0,this._fieldOfViewOffset[1]=0,this._fieldOfViewOffset[2]=0,this._fieldOfViewOffset[3]=0},getRelativeTransformation(e){const t=pn.A.prototype.getRelativeTransformation.call(this,e);return e.constructor===this.constructor&&(t.userMinimumX=e.getUserMinimumX(),t.userMinimumY=e.getUserMinimumY(),t.userMaximumX=e.getUserMaximumX(),t.userMaximumY=e.getUserMaximumY()),t},setInterpolators(e,t){if(e.constructor===this.constructor){const e=t.userMinimumX-this.getMinimumX(),i=t.userMinimumY-this.getMinimumY(),n=t.userMaximumX-this.getMaximumX(),s=t.userMaximumY-this.getMaximumY();this.fieldOfViewOffsetInterpolator0._keyValue=new c.A.MFFloat(e,this._fieldOfViewOffset[0]),this.fieldOfViewOffsetInterpolator1._keyValue=new c.A.MFFloat(i,this._fieldOfViewOffset[1]),this.fieldOfViewOffsetInterpolator2._keyValue=new c.A.MFFloat(n,this._fieldOfViewOffset[2]),this.fieldOfViewOffsetInterpolator3._keyValue=new c.A.MFFloat(s,this._fieldOfViewOffset[3]),this.fieldOfViewScaleInterpolator._keyValue=new c.A.MFFloat(1,this._fieldOfViewScale.getValue()),this._fieldOfViewOffset[0]=t.offset0,this._fieldOfViewOffset[1]=t.offset1,this._fieldOfViewOffset[2]=t.offset2,this._fieldOfViewOffset[3]=t.offset3,this._fieldOfViewScale=1}else this.fieldOfViewOffsetInterpolator0._keyValue=new c.A.MFFloat(this._fieldOfViewOffset[0],this._fieldOfViewOffset[0]),this.fieldOfViewOffsetInterpolator1._keyValue=new c.A.MFFloat(this._fieldOfViewOffset[1],this._fieldOfViewOffset[1]),this.fieldOfViewOffsetInterpolator2._keyValue=new c.A.MFFloat(this._fieldOfViewOffset[2],this._fieldOfViewOffset[2]),this.fieldOfViewOffsetInterpolator3._keyValue=new c.A.MFFloat(this._fieldOfViewOffset[3],this._fieldOfViewOffset[3]),this.fieldOfViewScaleInterpolator._keyValue=new c.A.MFFloat(1,this._fieldOfViewOffset.getValue()),this._fieldOfViewOffset=this._fieldOfViewOffset.getValue(),this._fieldOfViewScale=1},getLogarithmicDepthBuffer:()=>!1,getFieldOfView(){return[this.getMinimumX(),this.getMinimumY(),this.getMaximumX(),this.getMaximumY()]},setFieldOfView(e){this._fieldOfView=e},getUserFieldOfView(){return[this.getUserMinimumX(),this.getUserMinimumY(),this.getUserMaximumX(),this.getUserMaximumY()]},getMinimumX(){return this._fieldOfView.length>0?this._fieldOfView[0]:-1},getUserMinimumX(){return(this.getMinimumX()+this._fieldOfViewOffset[0])*this._fieldOfViewScale.getValue()},getMinimumY(){return this._fieldOfView.length>1?this._fieldOfView[1]:-1},getUserMinimumY(){return(this.getMinimumY()+this._fieldOfViewOffset[1])*this._fieldOfViewScale.getValue()},getMaximumX(){return this._fieldOfView.length>2?this._fieldOfView[2]:1},getUserMaximumX(){return(this.getMaximumX()+this._fieldOfViewOffset[2])*this._fieldOfViewScale.getValue()},getMaximumY(){return this._fieldOfView.length>3?this._fieldOfView[3]:1},getUserMaximumY(){return(this.getMaximumY()+this._fieldOfViewOffset[3])*this._fieldOfViewScale.getValue()},getSizeX(){return this.getMaximumX()-this.getMinimumX()},getUserSizeX(){return this.getUserMaximumX()-this.getUserMinimumX()},getSizeY(){return this.getMaximumY()-this.getMinimumY()},getUserSizeY(){return this.getUserMaximumY()-this.getUserMinimumY()},getMaxFarValue:()=>1e4,getScreenScale(e,t,i){const n=t[2],s=t[3],r=this.getUserSizeX(),o=this.getUserSizeY();if(n/s>r/o){const e=o/s;return i.set(e,e,e)}{const e=r/n;return i.set(e,e,e)}},getViewportSize:(()=>{const e=new It.A;return function(t,i){const n=t[2],s=t[3],r=this.getUserSizeX(),o=this.getUserSizeY(),a=n/s;return a>r/o?e.set(o*a,o):e.set(r,r/a)}})(),getLookAtDistance:e=>e.size.norm()/2+10,getProjectionMatrixWithLimits(e,t,i){const n=i[2]/i[3],s=this.getUserSizeX(),r=this.getUserSizeY();if(n>s/r){const i=(this.getUserMinimumX()+this.getUserMaximumX())/2,s=r*n/2;return fn.A.ortho(i-s,i+s,this.getUserMinimumY(),this.getUserMaximumY(),e,t,this.projectionMatrix)}{const i=(this.getUserMinimumY()+this.getUserMaximumY())/2,r=s/n/2;return fn.A.ortho(this.getUserMinimumX(),this.getUserMaximumX(),i-r,i+r,e,t,this.projectionMatrix)}},viewAll(e){pn.A.prototype.viewAll.call(this,e);const t=e.size,i=t.x/this.getSizeX(),n=t.y/this.getSizeY(),s=1.1*Math.max(i,n);this._fieldOfViewOffset[0]=this.getMinimumX()*s-this.getMinimumX(),this._fieldOfViewOffset[1]=this.getMinimumY()*s-this.getMinimumY(),this._fieldOfViewOffset[2]=this.getMaximumX()*s-this.getMaximumX(),this._fieldOfViewOffset[3]=this.getMaximumY()*s-this.getMaximumY()}}),Object.defineProperties(mn,{...Je.A.getStaticProperties("OrthoViewpoint","Navigation",3,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_bind",new c.A.SFBool),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"position",new c.A.SFVec3f(0,0,10)),new o.A(m.A.inputOutput,"orientation",new c.A.SFRotation),new o.A(m.A.inputOutput,"centerOfRotation",new c.A.SFVec3f),new o.A(m.A.inputOutput,"fieldOfView",new c.A.MFFloat(-1,-1,1,1)),new o.A(m.A.inputOutput,"nearDistance",new c.A.SFFloat(-1)),new o.A(m.A.inputOutput,"farDistance",new c.A.SFFloat(-1)),new o.A(m.A.inputOutput,"viewAll",new c.A.SFBool),new o.A(m.A.inputOutput,"jump",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"retainUserOffsets",new c.A.SFBool),new o.A(m.A.outputOnly,"isBound",new c.A.SFBool),new o.A(m.A.outputOnly,"bindTime",new c.A.SFTime),new o.A(m.A.inputOutput,"navigationInfo",new c.A.SFNode)]),enumerable:!0}});const An=mn,_n=s.A.add("OrthoViewpoint",An);function yn(e,t){r.A.call(this,e),this.addChildObjects(m.A.outputOnly,"isActive",new c.A.SFBool),this.navigationInfoNode=t}Object.assign(Object.setPrototypeOf(yn.prototype,r.A.prototype),{isCollidable:()=>!1,isActive(){return this._isActive.getValue()},getActiveLayer(){return this.getBrowser().getActiveLayer()},getViewport(){return this.getBrowser().getActiveLayer().getViewport().getRectangle()},getNavigationInfo(){return this.navigationInfoNode},getActiveViewpoint(){return this.getBrowser().getActiveLayer().getViewpoint()},getStraightenHorizon(){const e=this.getBrowser();return e.getBrowserOption("StraightenHorizon")||!!e.getPose()},getButton(e){return 0===e&&this.getBrowser().getAltKey()?1:e},isPointerInRectangle:(()=>{const e=new It.A;return function(t,i){const n=this.getBrowser(),s=this.getViewport();return n.isPointerInRectangle(s,e.set(t,i))}})(),getPointOnCenterPlane:(()=>{const e=new Ee.A,t=new Ee.A;return function(i,n,s){const r=this.getNavigationInfo(),o=this.getActiveViewpoint(),a=this.getViewport(),l=o.getNearDistance(r),h=o.getFarDistance(r),c=o.getProjectionMatrixWithLimits(l,h,a);if(xi.A.unProjectPoint(i,n,.9,Si.A.IDENTITY,c,a,t),o instanceof _n)return s.set(t.x,t.y,-this.getDistanceToCenter(e).norm());const u=t.normalize();return s.assign(u).multiply(this.getDistanceToCenter(e).norm()/u.dot(Ee.A.NEGATIVE_Z_AXIS))}})(),getDistanceToCenter(e,t){const i=this.getActiveViewpoint();return e.assign(i.getPosition()).add(t||i._positionOffset.getValue()).subtract(i.getUserCenterOfRotation())},trackballProjectToSphere(e,t,i){const n=this.getViewport();return e=(e-n[0])/n[2]-.5,t=(t-n[1])/n[3]-.5,i.set(e,t,function(e,t,i){const n=Math.hypot(t,i);if(n<e*Math.SQRT1_2)return Math.sqrt(e*e-n*n);const s=e/Math.SQRT2;return s*s/n}(.5,e,t))},lookAtPoint(e,t,i){if(!this.touch(e,t))return;const n=this.getActiveViewpoint(),s=this.getBrowser().getHit();n.lookAtPoint(this.getActiveLayer(),s.point,1,.381966,i)},lookAtBBox(e,t,i){if(!this.touch(e,t))return;const n=this.getActiveViewpoint(),s=this.getBrowser().getHit(),r=s.shapeNode.getBBox(new pi.A).multRight(s.modelViewMatrix).multRight(n.getCameraSpaceMatrix());n.lookAtBBox(this.getActiveLayer(),r,1,.381966,i)},touch(e,t){return this.getBrowser().touch(e,t)},disconnect(){}});const wn=yn,xn=s.A.add("X3DViewer",wn);function bn(e){ai.A.call(this,e),this.addType(m.A.X3DFollowerNode),this.buffer=[],this.a=this.getVector(),this.vector=this.getVector()}Object.assign(Object.setPrototypeOf(bn.prototype,ai.A.prototype),{initialize(){ai.A.prototype.initialize.call(this),this.getLive().addInterest("set_live__",this)},getBuffer(){return this.buffer},getValue(){return this._set_value.getValue()},getDestination(){return this._set_destination.getValue()},getInitialValue(){return this._initialValue.getValue()},getInitialDestination(){return this._initialDestination.getValue()},setValue(e){this._value_changed=e},setDestination(e){this.destination.assign(e)},duplicate:e=>e.copy(),assign(e,t,i){e[t].assign(i)},equals(e,t,i){return this.a.assign(e).subtract(t).norm()<i},interpolate(e,t,i){return this.vector.assign(e).lerp(t,i)},set_live__(){this.getLive().getValue()&&this._isActive.getValue()?(this.getBrowser().prepareEvents().addInterest("prepareEvents",this),this.getBrowser().addBrowserEvent()):this.getBrowser().prepareEvents().removeInterest("prepareEvents",this)},set_active__(e){e!==this._isActive.getValue()&&(this._isActive=e,this.set_live__())}}),Object.defineProperties(bn,Je.A.getStaticProperties("X3DFollowerNode","Followers",1));const Sn=bn,Tn=s.A.add("X3DFollowerNode",Sn);function vn(e){Tn.call(this,e),this.addType(m.A.X3DChaserNode),this.destination=null,this.previousValue=null,this.bufferEndTime=0,this.stepTime=0,this.deltaOut=this.getVector()}Object.assign(Object.setPrototypeOf(vn.prototype,Tn.prototype),{initialize(){Tn.prototype.initialize.call(this),this._set_value.addInterest("set_value__",this),this._set_destination.addInterest("set_destination__",this),this._duration.addInterest("set_duration__",this),this.set_duration__();const e=this.getBuffer(),t=this.getInitialValue(),i=this.getInitialDestination(),n=this.getNumBuffers();this.bufferEndTime=this.getBrowser().getCurrentTime(),this.previousValue=this.duplicate(t),e[0]=this.duplicate(i);for(let i=1;i<n;++i)e[i]=this.duplicate(t);this.destination=this.duplicate(i),this.equals(i,t,this.getTolerance())?this.setValue(i):this.set_active__(!0)},getNumBuffers:()=>60,getTolerance:()=>1e-8,getArray(){return this.getVector()},setPreviousValue(e){this.previousValue.assign(e)},step(e,t,i){this.output.add(this.deltaOut.assign(e).subtract(t).multiply(i))},stepResponse(e){if(e<=0)return 0;const t=this._duration.getValue();return e>=t?1:.5-.5*Math.cos(e/t*Math.PI)},set_value__(){this._isActive.getValue()||(this.bufferEndTime=this.getBrowser().getCurrentTime());const e=this.getBuffer(),t=this.getValue();for(let i=0,n=e.length;i<n;++i)this.assign(e,i,t);this.setPreviousValue(t),this.setValue(t),this.set_active__(!0)},set_destination__(){this.setDestination(this.getDestination()),this._isActive.getValue()||(this.bufferEndTime=this.getBrowser().getCurrentTime()),this.set_active__(!0)},set_duration__(){this.stepTime=this._duration.getValue()/this.getNumBuffers()},prepareEvents(){const e=this.getBuffer(),t=e.length,i=this.updateBuffer();this.output=this.interpolate(this.previousValue,e[t-1],this.stepResponse((t-1+i)*this.stepTime));for(let n=t-2;n>=0;--n)this.step(e[n],e[n+1],this.stepResponse((n+i)*this.stepTime));this.setValue(this.output),this.equals(this.output,this.destination,this.getTolerance())&&this.set_active__(!1)},updateBuffer(){const e=this.getBuffer(),t=e.length;let i=(this.getBrowser().getCurrentTime()-this.bufferEndTime)/this.stepTime;if(i>=1){const n=Math.floor(i);if(i-=n,n<t){this.setPreviousValue(e[t-n]);for(let i=t-1;i>=n;--i)this.assign(e,i,e[i-n]);for(let t=0;t<n;++t){const i=t/n;this.assign(e,t,this.interpolate(this.destination,e[n],i))}}else{this.setPreviousValue(n==t?e[0]:this.destination);for(let i=0;i<t;++i)this.assign(e,i,this.destination)}this.bufferEndTime+=n*this.stepTime}return i}}),Object.defineProperties(vn,Je.A.getStaticProperties("X3DChaserNode","Followers",1));const On=vn,En=s.A.add("X3DChaserNode",On);function Nn(e){En.call(this,e),this.addType(m.A.PositionChaser)}Object.assign(Object.setPrototypeOf(Nn.prototype,En.prototype),{getVector:()=>new Ee.A}),Object.defineProperties(Nn,{...Je.A.getStaticProperties("PositionChaser","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFVec3f),new o.A(m.A.inputOnly,"set_destination",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec3f)]),enumerable:!0}});const Cn=Nn,In=s.A.add("PositionChaser",Cn);var Fn=n(5319);const Mn=new Fn.A,Rn=new Fn.A;function Pn(e){En.call(this,e),this.addType(m.A.OrientationChaser),this._set_value.setUnit("angle"),this._set_destination.setUnit("angle"),this._initialValue.setUnit("angle"),this._initialDestination.setUnit("angle"),this._value_changed.setUnit("angle")}Object.assign(Object.setPrototypeOf(Pn.prototype,En.prototype),{getVector:()=>new Fn.A,equals:(e,t,i)=>(Mn.assign(e).inverse().multRight(t),Math.abs(Mn.angle)<i),interpolate:(e,t,i)=>Rn.assign(e).slerp(t,i),step(e,t,i){this.deltaOut.assign(t).inverse().multRight(e).multLeft(this.output),this.output.slerp(this.deltaOut,i)}}),Object.defineProperties(Pn,{...Je.A.getStaticProperties("OrientationChaser","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFRotation),new o.A(m.A.inputOnly,"set_destination",new c.A.SFRotation),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFRotation(0,1,0,0)),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFRotation(0,1,0,0)),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFRotation)]),enumerable:!0}});const Vn=Pn,Dn=s.A.add("OrientationChaser",Vn);var Ln=n(8442),Bn=(n(3979),n(9340));const kn=/Mac OS X/i.test(navigator.userAgent),jn=W.A.radians(2),Un=kn?1/120:.05,Xn=W.A.radians(15),zn=W.A.radians(.1);function Gn(e,t){xn.call(this,e,t),this.button=-1,this.orientationOffset=new Fn.A,this.fromVector=new Ee.A,this.toVector=new Ee.A,this.fromPointer=new It.A,this.fromPoint=new Ee.A,this.toPoint=new Ee.A,this.startOrientation=new Fn.A,this.roll=new Fn.A,this.rotation=new Fn.A,this.deltaRotation=new Fn.A,this.direction=new Ee.A,this.axis=new Ee.A,this.touchMode=0,this.touch1=new It.A,this.touch2=new It.A,this.tapStart=0,this.dblTapInterval=.4,this.initialPositionOffset=new Ee.A,this.initialOrientationOffset=new Fn.A,this.positionChaser=new In(e),this.centerOfRotationChaser=new In(e),this.rotationChaser=new Dn(e),this.timeSensor=new Ln.A(e)}Object.assign(Object.setPrototypeOf(Gn.prototype,xn.prototype),{initialize(){xn.prototype.initialize.call(this);const e=this.getBrowser(),t=e.getSurface();this.getNavigationInfo()._transitionStart.addInterest("disconnect",this),e.getBrowserOptions()._StraightenHorizon.addInterest("disconnect",this),e._activeViewpoint.addInterest("set_activeViewpoint__",this),t.on("mousedown.ExamineViewer",this.mousedown.bind(this)),t.on("mouseup.ExamineViewer",this.mouseup.bind(this)),t.on("dblclick.ExamineViewer",this.dblclick.bind(this)),t.on("mousewheel.ExamineViewer",this.mousewheel.bind(this)),t.on("touchstart.ExamineViewer",this.touchstart.bind(this)),t.on("touchend.ExamineViewer",this.touchend.bind(this)),this.positionChaser._duration=.2,this.positionChaser.setup(),this.centerOfRotationChaser._duration=.2,this.centerOfRotationChaser.setup(),this.rotationChaser._duration=.2,this.rotationChaser.setup(),this.timeSensor._loop=!0,this.timeSensor._stopTime=Date.now()/1e3,this.timeSensor.setup(),this.timeSensor._fraction_changed.addInterest("spin",this),this.set_activeViewpoint__()},set_activeViewpoint__(){if(this.getStraightenHorizon()){const e=this.getActiveViewpoint();e&&(this.startOrientation.assign(e.getUserOrientation()),e._orientationOffset=this.getOrientationOffset(Fn.A.IDENTITY,Fn.A.IDENTITY,e._orientationOffset.getValue()))}this.disconnect()},mousedown(e){if(this.button>=0)return;const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(this.isPointerInRectangle(t,i))switch(this.getButton(e.button)){case 0:e.preventDefault(),this.button=e.button,Bn(document).on("mouseup.ExamineViewer"+this.getId(),this.mouseup.bind(this)),Bn(document).on("mousemove.ExamineViewer"+this.getId(),this.mousemove.bind(this)),Bn(document).on("touchend.ExamineViewer"+this.getId(),this.touchend.bind(this)),Bn(document).on("touchmove.ExamineViewer"+this.getId(),this.touchmove.bind(this)),this.disconnect(),this.getActiveViewpoint().transitionStop(),this.getBrowser().setCursor("MOVE"),this.startRotate(t,i,0),this.motionTime=Date.now(),this._isActive=!0;break;case 1:e.preventDefault(),this.button=e.button,Bn(document).on("mouseup.ExamineViewer"+this.getId(),this.mouseup.bind(this)),Bn(document).on("mousemove.ExamineViewer"+this.getId(),this.mousemove.bind(this)),Bn(document).on("touchend.ExamineViewer"+this.getId(),this.touchend.bind(this)),Bn(document).on("touchmove.ExamineViewer"+this.getId(),this.touchmove.bind(this)),this.disconnect(),this.getActiveViewpoint().transitionStop(),this.getBrowser().setCursor("MOVE"),this.startPan(t,i),this._isActive=!0}},mouseup(e){if(e.button===this.button)switch(this.button=-1,Bn(document).off(".ExamineViewer"+this.getId()),this.getButton(e.button)){case 0:e.preventDefault(),this.getBrowser().setCursor("DEFAULT"),Math.abs(this.deltaRotation.angle)>jn&&Date.now()-this.motionTime<20&&this.addSpinning(this.deltaRotation),this._isActive=!1;break;case 1:e.preventDefault(),this.getBrowser().setCursor("DEFAULT"),this._isActive=!1}},dblclick(e){e.preventDefault();const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);this.disconnect(),this.lookAtBBox(t,i,this.getStraightenHorizon())},mousemove(e){const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);switch(this.getButton(this.button)){case 0:e.preventDefault(),this.rotate(t,i),this.motionTime=Date.now();break;case 1:e.preventDefault(),this.pan(t,i)}},mousewheel(e){const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(!this.isPointerInRectangle(t,i))return;e.preventDefault();const n=this.getActiveViewpoint();this.removeSpinning(),n.transitionStop(),this.zoom(e.zoomFactor||Un,e.deltaY)},touchstart(e){const t=e.originalEvent.touches;switch(t.length){case 1:e.button=0,e.pageX=t[0].pageX,e.pageY=t[0].pageY,this.mousedown(e),this.touch1.set(t[0].pageX,t[0].pageY);break;case 2:this.touchend(e),e.button=1,e.pageX=(t[0].pageX+t[1].pageX)/2,e.pageY=(t[0].pageY+t[1].pageY)/2,this.mousedown(e),this.touch1.set(t[0].pageX,t[0].pageY),this.touch2.set(t[1].pageX,t[1].pageY);break;case 3:this.touchend(e)}},touchend(e){switch(this.button){case 0:e.button=0,e.pageX=this.touch1.x,e.pageY=this.touch1.y,this.mouseup(e),this.tapedTwice?this.dblclick(e):(this.tapedTwice=!0,setTimeout(()=>this.tapedTwice=!1,300));break;case 1:this.touchMode=0,e.button=1,this.mouseup(e)}},touchmove:(()=>{const e=new It.A,t=new It.A;return function(i){const n=i.originalEvent.touches;switch(n.length){case 1:i.pageX=n[0].pageX,i.pageY=n[0].pageY,this.mousemove(i);break;case 2:{e.set(n[0].pageX,n[0].pageY).subtract(this.touch1).normalize(),t.set(n[1].pageX,n[1].pageY).subtract(this.touch2).normalize();const s=e.dot(t)>.7,r=e.dot(t)<-.7;switch(this.touchMode||(s?1:r?2:0)){case 1:this.touchMode=1,i.pageX=(n[0].pageX+n[1].pageX)/2,i.pageY=(n[0].pageY+n[1].pageY)/2,this.mousemove(i);break;case 2:{this.touchMode=2;const e=this.touch1.distance(this.touch2);this.touch1.set(n[0].pageX,n[0].pageY),this.touch2.set(n[1].pageX,n[1].pageY);const t=this.touch1.distance(this.touch2)-e;i.deltaY=t,i.zoomFactor=Math.abs(t)/Bn(window).width(),i.pageX=(n[0].pageX+n[1].pageX)/2,i.pageY=(n[0].pageY+n[1].pageY)/2,this.mousewheel(i);break}}this.touch1.set(n[0].pageX,n[0].pageY),this.touch2.set(n[1].pageX,n[1].pageY);break}}}})(),startRotate(e,t,i){if(this.getStraightenHorizon()){const n=this.getActiveViewpoint();this.fromPointer.set(e,t),this.startOrientation.assign(n.getUserOrientation()),this.lastRoll=0,this.negate=i}else this.trackballProjectToSphere(e,t,this.fromVector)},rotate:(()=>{const e=new It.A,t=new Ee.A;return function(i,n){if(this.getStraightenHorizon()){const s=this.getActiveViewpoint().getUpVector(!0);e.set(i,n).subtract(this.fromPointer);const r=2*this.getViewport()[2],o=2*this.getViewport()[3],a=Math.acos(W.A.clamp(this.startOrientation.multVecRot(t.assign(Ee.A.Z_AXIS)).dot(s),-1,1)),l=2*Math.PI*+e.y/o,h=W.A.clamp(a+l,zn,Math.PI-zn)-a;this.lastRoll-Math.abs(l)>0&&(this.fromPointer.y+=(l-h)/(2*Math.PI)*o),this.lastRoll=Math.abs(l),this.negate||(Math.PI/2-Math.abs(a-Math.PI/2)<Xn?n-this.getViewport()[1]>this.getViewport()[3]/2?this.negate=a<Math.PI/4?-1:1:this.negate=a>Math.PI/4?-1:1:this.negate=1),this.deltaRotation.assign(this.rotation),this.roll.set(1,0,0,h),this.rotation.setAxisAngle(s,2*Math.PI*-e.x/r*this.negate),this.deltaRotation.inverse().multRight(this.rotation)}else{const e=this.trackballProjectToSphere(i,n,this.toVector);this.deltaRotation.assign(this.rotation),this.roll.assign(Fn.A.IDENTITY),this.rotation.setFromToVec(e,this.fromVector),this.deltaRotation.inverse().multRight(this.rotation)}this.addRotate(this.roll,this.rotation,this.deltaRotation)}})(),addRotate(e,t,i){const n=this.getActiveViewpoint();this.rotationChaser._value_changed.hasInterest("set_rotation__",this)?(this.getOrientationOffset(e,t,this.initialOrientationOffset),this.rotationChaser._set_destination=t):(this.rotationChaser._value_changed.addInterest("set_rotation__",this),this.initialOrientationOffset.assign(n._orientationOffset.getValue()),this.initialPositionOffset.assign(n._positionOffset.getValue()),this.getOrientationOffset(e,t,this.initialOrientationOffset),this.rotationChaser._set_value=Fn.A.IDENTITY,this.rotationChaser._set_destination=t)},addSpinning(e){if(this.disconnect(),this.getStraightenHorizon()){const t=this.getActiveViewpoint(),i=t.getUpVector(!0),n=t.getUserPosition(),s=t.getUserCenterOfRotation(),r=n.copy().subtract(s),o=Math.min(Math.abs(e.angle),Math.PI/4);this.axis.assign(i),Math.sign(e.getAxis().dot(i))!==Math.sign(e.angle)&&this.axis.negate(),this.timeSensor._cycleInterval=Math.PI/(.3*o*25),this.timeSensor._startTime=Date.now()/1e3;const a=t.getLookAtRotation(n,s);this.direction.assign(r),this.orientationOffset.assign(t.getUserOrientation()).multRight(a.inverse())}else this.getBrowser().prepareEvents().addInterest("spin",this),this.rotation.assign(e)},removeSpinning(){const e=this.getBrowser();this.timeSensor._stopTime=Date.now()/1e3,e.prepareEvents().removeInterest("spin",this)},spin:(()=>{const e=new Ee.A,t=new Ee.A,i=new Fn.A,n=new Fn.A;return function(){const s=this.getActiveViewpoint();if(this.getStraightenHorizon()){const n=s.getUserCenterOfRotation(),r=this.timeSensor._fraction_changed.getValue(),o=new Fn.A(this.axis,2*Math.PI*r).multVecRot(e.assign(this.direction)).add(n),a=s.getLookAtRotation(o,s.getUserCenterOfRotation());t.assign(o).subtract(s.getPosition()),i.assign(s.getOrientation()).inverse().multRight(this.orientationOffset).multRight(a),s._positionOffset=t,s._orientationOffset=i}else n.assign(Fn.A.IDENTITY).slerp(this.rotation,18/this.getBrowser().getCurrentFrameRate()),this.orientationOffset.assign(s._orientationOffset.getValue()),s._orientationOffset=this.getOrientationOffset(Fn.A.IDENTITY,n,this.orientationOffset),s._positionOffset=this.getPositionOffset(s._positionOffset.getValue(),this.orientationOffset,s._orientationOffset.getValue())}})(),startPan(e,t){this.getPointOnCenterPlane(e,t,this.fromPoint)},pan:(()=>{const e=new Ee.A;return function(t,i){const n=this.getActiveViewpoint(),s=this.getPointOnCenterPlane(t,i,this.toPoint),r=n.getUserOrientation().multVecRot(e.assign(this.fromPoint).subtract(s));this.addMove(r,r),this.fromPoint.assign(s)}})(),zoom:(()=>{const e=new Ee.A,t=new Ee.A;return function(i,n){const s=this.getActiveViewpoint();this.getDistanceToCenter(e).multiply(i),s.getUserOrientation().multVecRot(t.set(0,0,e.norm())),n>0?this.addMove(t.negate(),Ee.A.ZERO):n<0&&this.addMove(t,Ee.A.ZERO)}})(),addMove:(()=>{const e=new Ee.A,t=new Ee.A;return function(i,n){const s=this.getActiveViewpoint();this.positionChaser._value_changed.hasInterest("set_positionOffset__",this)?(e.assign(this.positionChaser._set_destination.getValue()).add(i),this.positionChaser._set_destination=e):(this.positionChaser._value_changed.addInterest("set_positionOffset__",this),e.assign(s._positionOffset.getValue()).add(i),this.positionChaser._set_value=s._positionOffset,this.positionChaser._set_destination=e),this.centerOfRotationChaser._value_changed.hasInterest("set_centerOfRotationOffset__",this)?(t.assign(this.centerOfRotationChaser._set_destination.getValue()).add(n),this.centerOfRotationChaser._set_destination=t):(this.centerOfRotationChaser._value_changed.addInterest("set_centerOfRotationOffset__",this),t.assign(s._centerOfRotationOffset.getValue()).add(n),this.centerOfRotationChaser._set_value=s._centerOfRotationOffset,this.centerOfRotationChaser._set_destination=t)}})(),getPositionOffset:(()=>{const e=new Ee.A,t=new Ee.A,i=new Fn.A;return function(n,s,r){return this.getDistanceToCenter(e,n),i.assign(s).inverse().multRight(r).multVecRot(t.assign(e)).subtract(e).add(n)}})(),getOrientationOffset:(()=>{const e=new Fn.A,t=new Fn.A;return function(i,n,s){const r=this.getActiveViewpoint();this.getStraightenHorizon()?(e.assign(i).multRight(this.startOrientation).multRight(n),r.straightenHorizon(e)):e.assign(n).multRight(r.getOrientation()).multRight(s);return t.assign(r.getOrientation()).inverse().multRight(e)}})(),getHorizonRotation:(()=>{const e=new Ee.A,t=new Ee.A,i=new Ee.A,n=new Fn.A;return function(s){return s.multVecRot(e.assign(Ee.A.Z_AXIS)),t.assign(Ee.A.Y_AXIS).cross(e),i.assign(t).cross(Ee.A.Y_AXIS),n.setFromToVec(Ee.A.Z_AXIS,i),n}})(),set_positionOffset__(e){this.getActiveViewpoint()._positionOffset=e},set_centerOfRotationOffset__(e){this.getActiveViewpoint()._centerOfRotationOffset=e},set_rotation__(e){const t=this.getActiveViewpoint();t._orientationOffset=this.getOrientationOffset(this.roll,e.getValue(),this.initialOrientationOffset),t._positionOffset=this.getPositionOffset(this.initialPositionOffset,this.initialOrientationOffset,t._orientationOffset.getValue())},disconnect(){this.positionChaser._value_changed.removeInterest("set_positionOffset__",this),this.centerOfRotationChaser._value_changed.removeInterest("set_centerOfRotationOffset__",this),this.rotationChaser._value_changed.removeInterest("set_rotation__",this),this.removeSpinning()},dispose(){const e=this.getBrowser();this.disconnect(),this.getNavigationInfo()._transitionStart.removeInterest("disconnect",this),e.getBrowserOptions()._StraightenHorizon.removeInterest("disconnect",this),e._activeViewpoint.removeInterest("set_activeViewpoint__",this),e.getSurface().off(".ExamineViewer"),Bn(document).off(".ExamineViewer"+this.getId())}}),Object.defineProperties(Gn,{typeName:{value:"ExamineViewer",enumerable:!0}});const Hn=Gn,$n=s.A.add("ExamineViewer",Hn);var Yn=n(5948),qn=n(8187),Wn=n(9401);function Kn(e,t,i,n){const s=e.getContext();this.browser=e,this.indexBuffer=s.createBuffer(),this.colorBuffer=s.createBuffer(),this.vertexBuffer=s.createBuffer(),this.vertexArrayObject=new wi.A(s),this.colorArray=new Float32Array([0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0]),this.vertexArray=new Float32Array(48).fill(1),this.geometryContext=new Yn.A({renderObject:new qn.A(e.getPrivateScene()),alphaMode:ui.A.BLEND,geometryType:3,colorMaterial:!0}),this.geometryContext.renderObject.setup(),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,this.indexBuffer),s.bufferData(s.ELEMENT_ARRAY_BUFFER,new Uint8Array([0,1,3,0,3,2,2,3,5,2,5,4,6,7,9,6,9,8,8,9,11,8,11,10]),s.STATIC_DRAW),this.setColor(Wn.A.WHITE);const r=new Ee.A,o=new Ee.A(1,0,0),a=new Ee.A,l=new Ee.A,h=new Ee.A,c=new Ee.A,u=new Ee.A,d=this.vertexArray;a.assign(r).lerp(o,n),l.assign(o).subtract(r).normalize().multiply(.5).set(-l.y,l.x,0),h.assign(l).multiply(t+1),c.assign(l).multiply(i+1),d.set(u.assign(r).add(h),0),d.set(u.assign(r).subtract(h),4),d.set(u.assign(a).add(c),8),d.set(u.assign(a).subtract(c),12),d.set(u.assign(o).add(c),16),d.set(u.assign(o).subtract(c),20),h.assign(l).multiply(t),c.assign(l).multiply(i),d.set(u.assign(r).add(h),24),d.set(u.assign(r).subtract(h),28),d.set(u.assign(a).add(c),32),d.set(u.assign(a).subtract(c),36),d.set(u.assign(o).add(c),40),d.set(u.assign(o).subtract(c),44),s.bindBuffer(s.ARRAY_BUFFER,this.vertexBuffer),s.bufferData(s.ARRAY_BUFFER,d,s.STATIC_DRAW)}Object.assign(Kn.prototype,{setColor(e){const t=this.browser.getContext(),i=this.colorArray;for(let t=0;t<6;++t)i.set(e,24+4*t);return t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW),this},display:(()=>{const e=new Ee.A,t=new Ee.A,i=new Si.A,n=new Float32Array(Si.A.IDENTITY),s=new Float32Array(Si.A.IDENTITY),r=new Float32Array(Si.A.IDENTITY),o=[];return function(a,l,h){const c=this.browser,u=c.getContext(),d=c.getViewport(),p=d[2],g=d[3],f=c.getRenderingProperty("ContentScale");h.bind(),u.viewport(...d),u.scissor(...d),u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),n.set(fn.A.ortho(0,p,0,g,-1,1,i)),e.assign(l).subtract(a),t.set(-e.y,e.x,0).normalize().multiply(f),s.set(e,0),s.set(t,4),s.set(a,12);const m=c.getDefaultMaterial().getShader(this.geometryContext);m.enable(u),m.setClipPlanes(u,o),u.uniformMatrix4fv(m.x3d_ProjectionMatrix,!1,n),u.uniformMatrix4fv(m.x3d_ModelViewMatrix,!1,s),u.uniformMatrix4fv(m.x3d_EyeMatrix,!1,r),u.uniform1f(m.x3d_Transparency,0),this.vertexArrayObject.enable(m.getProgram())&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,this.indexBuffer),m.enableColorAttribute(u,this.colorBuffer,0,0),m.enableVertexAttribute(u,this.vertexBuffer,0,0)),u.depthMask(!1),u.disable(u.DEPTH_TEST),u.enable(u.BLEND),u.enable(u.CULL_FACE),u.frontFace(u.CCW),u.drawElements(u.TRIANGLES,24,u.UNSIGNED_BYTE,0),u.depthMask(!0),u.enable(u.DEPTH_TEST),u.disable(u.BLEND)}})(),dispose(){const e=this.browser.getContext();e.deleteBuffer(this.vertexBuffer),this.vertexArrayObject.dispose(e)}});const Zn=Kn,Qn=s.A.add("ScreenLine",Zn);n(3979);var Jn=n(9340);const es=/Mac OS X/i.test(navigator.userAgent),ts=.007,is=ts,ns=es?Math.PI/512:Math.PI/32;function ss(e,t){xn.call(this,e,t);const i=this.getBrowser();this.button=-1,this.fromVector=new Ee.A,this.toVector=new Ee.A,this.direction=new Ee.A,this.startTime=0,this.event=null,this.lookAround=!1,this.orientationChaser=new Dn(e),this.rubberBand=new Qn(i,1,1,.4)}Object.assign(Object.setPrototypeOf(ss.prototype,xn.prototype),{initialize(){xn.prototype.initialize.call(this);const e=this.getBrowser(),t=e.getSurface();t.on("mousedown.X3DFlyViewer",this.mousedown.bind(this)),t.on("mouseup.X3DFlyViewer",this.mouseup.bind(this)),t.on("mousewheel.X3DFlyViewer",this.mousewheel.bind(this)),t.on("touchstart.X3DFlyViewer",this.touchstart.bind(this)),t.on("touchend.X3DFlyViewer",this.touchend.bind(this)),e._controlKey.addInterest("set_controlKey__",this),this.orientationChaser._duration=.3,this.orientationChaser.setup()},set_controlKey__(){this.event&&0===this.event.button&&(this.button=-1,this.mousedown(this.event))},mousedown(e){if(this.button>=0)return;this.event=e;const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(this.isPointerInRectangle(t,i))switch(this.getButton(e.button)){case 0:e.preventDefault(),this.button=e.button,Jn(document).on("mouseup.X3DFlyViewer"+this.getId(),this.mouseup.bind(this)),Jn(document).on("mousemove.X3DFlyViewer"+this.getId(),this.mousemove.bind(this)),Jn(document).on("touchend.X3DFlyViewer"+this.getId(),this.touchend.bind(this)),Jn(document).on("touchmove.X3DFlyViewer"+this.getId(),this.touchmove.bind(this)),this.disconnect(),this.getActiveViewpoint().transitionStop(),this.getBrowser().setCursor("MOVE"),this.getBrowser().getControlKey()||this.getBrowser().getCommandKey()||this.lookAround?this.trackballProjectToSphere(t,i,this.fromVector):(this.fromVector.set(t,0,-i),this.toVector.assign(this.fromVector),this.getFlyDirection(this.fromVector,this.toVector,this.direction),this.addFly(),this.getBrowser().getBrowserOption("Rubberband")&&this.getBrowser().finishedEvents().addInterest("display",this,0)),this._isActive=!0;break;case 1:e.preventDefault(),this.button=e.button,Jn(document).on("mouseup.X3DFlyViewer"+this.getId(),this.mouseup.bind(this)),Jn(document).on("mousemove.X3DFlyViewer"+this.getId(),this.mousemove.bind(this)),this.disconnect(),this.getActiveViewpoint().transitionStop(),this.getBrowser().setCursor("MOVE"),this.fromVector.set(t,i,0),this.toVector.assign(this.fromVector),this.direction.set(0),this.addPan(),this.getBrowser().getBrowserOption("Rubberband")&&this.getBrowser().finishedEvents().addInterest("display",this,1),this._isActive=!0}},mouseup(e){e.button===this.button&&(e.preventDefault(),this.event=null,this.button=-1,this.direction.set(0),Jn(document).off(".X3DFlyViewer"+this.getId()),this.disconnect(),this.getBrowser().setCursor("DEFAULT"),this._isActive=!1)},mousemove(e){const t=this.getBrowser();t.addBrowserEvent(),this.event=e;const{x:i,y:n}=this.getBrowser().getPointerFromEvent(e);switch(this.getButton(this.button)){case 0:if(e.preventDefault(),t.getControlKey()||t.getCommandKey()||this.lookAround){const e=this.trackballProjectToSphere(i,n,this.toVector);this.addRotation(this.fromVector,e),this.fromVector.assign(e);break}this.toVector.set(i,0,-n),this.getFlyDirection(this.fromVector,this.toVector,this.direction),this.direction.divide(t.getRenderingProperty("ContentScale"));break;case 1:e.preventDefault(),this.toVector.set(i,n,0),this.direction.assign(this.toVector).subtract(this.fromVector),this.direction.divide(t.getRenderingProperty("ContentScale"))}},mousewheel(e){const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(!this.isPointerInRectangle(t,i))return;e.preventDefault();this.getActiveViewpoint().transitionStop(),e.deltaY>0?this.addRoll(-ns):e.deltaY<0&&this.addRoll(ns)},touchstart(e){const t=e.originalEvent.touches;switch(t.length){case 1:e.button=0,e.pageX=t[0].pageX,e.pageY=t[0].pageY,this.mousedown(e);break;case 2:this.touchend(e),this.lookAround=!0,e.button=0,e.pageX=(t[0].pageX+t[1].pageX)/2,e.pageY=(t[0].pageY+t[1].pageY)/2,this.mousedown(e);break;case 3:this.touchend(e)}},touchend(e){if(0===this.button)this.lookAround=!1,e.button=0,this.mouseup(e)},touchmove(e){const t=e.originalEvent.touches;switch(t.length){case 1:e.button=0,e.pageX=t[0].pageX,e.pageY=t[0].pageY,this.mousemove(e);break;case 2:e.button=0,e.pageX=(t[0].pageX+t[1].pageX)/2,e.pageY=(t[0].pageY+t[1].pageY)/2,this.mousemove(e)}},fly:(()=>{const e=new Ee.A,t=new Ee.A,i=new Ee.A,n=new Fn.A,s=new Fn.A,r=new Fn.A;return function(){const o=this.getNavigationInfo(),a=this.getActiveViewpoint(),l=Date.now(),h=(l-this.startTime)/1e3;e.assign(a.getUpVector()),this.direction.z>0?r.setFromToVec(this.direction,i.set(0,0,1)):r.setFromToVec(i.set(0,0,-1),this.direction);const c=this.direction.norm();let u=1-r.angle/(Math.PI/2);u*=o._speed.getValue(),u*=a.getSpeedFactor(),u*=this.getBrowser().getShiftKey()?.028:ts,u*=h;const d=this.getTranslationOffset(t.assign(this.direction).multiply(u)),p=this.getActiveLayer().constrainTranslation(d);a._positionOffset=p.add(a._positionOffset.getValue());const g=1.4*h*(c/(c+40))**2;n.assign(Fn.A.IDENTITY).slerp(r,g).multRight(a.getUserOrientation()),this.getStraightenHorizon()&&a.straightenHorizon(n),s.assign(a.getOrientation()).inverse().multRight(n),a._orientationOffset=s,this.startTime=l}})(),pan:(()=>{const e=new Ee.A,t=new Ee.A;return function(){const i=this.getNavigationInfo(),n=this.getActiveViewpoint(),s=Date.now(),r=(s-this.startTime)/1e3,o=n.getUpVector();this.constrainPanDirection(e.assign(this.direction));let a=1;a*=i._speed.getValue(),a*=n.getSpeedFactor(),a*=this.getBrowser().getShiftKey()?.0098:is,a*=r;const l=n.getUserOrientation().multRight(new Fn.A(n.getUserOrientation().multVecRot(t.assign(Ee.A.Y_AXIS)),o)).multVecRot(e.multiply(a)),h=this.getActiveLayer().constrainTranslation(l);n._positionOffset=h.add(n._positionOffset.getValue()),this.startTime=s}})(),set_orientationOffset__(e){this.getActiveViewpoint()._orientationOffset=e},addFly(){this.startTime||(this.getBrowser().prepareEvents().addInterest("fly",this),this.getBrowser().addBrowserEvent(),this.startTime=Date.now())},addPan(){this.startTime||(this.disconnect(),this.getBrowser().prepareEvents().addInterest("pan",this),this.getBrowser().addBrowserEvent(),this.startTime=Date.now())},addRoll:(()=>{const e=new Fn.A,t=new Fn.A;return function(i){const n=this.getActiveViewpoint();this.orientationChaser._isActive.getValue()&&this.orientationChaser._value_changed.hasInterest("set_orientationOffset__",this)?(e.assign(n.getOrientation()).inverse().multRight(t.set(1,0,0,i)).multRight(n.getOrientation()).multRight(this.orientationChaser._set_destination.getValue()),this.orientationChaser._set_destination=e):(e.assign(n.getOrientation()).inverse().multRight(t.set(1,0,0,i)).multRight(n.getUserOrientation()),this.orientationChaser._set_value=n._orientationOffset,this.orientationChaser._set_destination=e),this.disconnect(),this.orientationChaser._value_changed.addInterest("set_orientationOffset__",this)}})(),addRotation:(()=>{const e=new Fn.A,t=new Fn.A;return function(i,n){const s=this.getActiveViewpoint();this.orientationChaser._isActive.getValue()&&this.orientationChaser._value_changed.hasInterest("set_orientationOffset__",this)?(e.setFromToVec(n,i).multRight(s.getOrientation()).multRight(this.orientationChaser._set_destination.getValue()),this.getStraightenHorizon()&&s.straightenHorizon(e),t.assign(s.getOrientation()).inverse().multRight(e),this.orientationChaser._set_destination=t):(e.setFromToVec(n,i).multRight(s.getUserOrientation()),this.getStraightenHorizon()&&s.straightenHorizon(e),t.assign(s.getOrientation()).inverse().multRight(e),this.orientationChaser._set_value=s._orientationOffset,this.orientationChaser._set_destination=t),this.disconnect(),this.orientationChaser._value_changed.addInterest("set_orientationOffset__",this)}})(),display:(()=>{const e=new Ee.A,t=new Ee.A;return function(i){const n=this.getBrowser();switch(i){case 0:e.set(this.fromVector.x,-this.fromVector.z,0),t.set(this.toVector.x,-this.toVector.z,0);break;case 1:e.set(this.fromVector.x,this.fromVector.y,0),t.set(this.toVector.x,this.toVector.y,0)}for(const i of n.getFramebuffers())this.rubberBand.display(e,t,i)}})(),disconnect(){const e=this.getBrowser();e.addBrowserEvent(),e.prepareEvents().removeInterest("fly",this),e.prepareEvents().removeInterest("pan",this),e.finishedEvents().removeInterest("display",this),this.orientationChaser._value_changed.removeInterest("set_orientationOffset__",this),this.startTime=0},dispose(){this.rubberBand.dispose(),this.disconnect(),this.getBrowser()._controlKey.removeInterest("set_controlKey__",this),this.getBrowser().getSurface().off(".X3DFlyViewer"),Jn(document).off(".X3DFlyViewer"+this.getId())}});const rs=ss,os=s.A.add("X3DFlyViewer",rs);function as(e,t){os.call(this,e,t)}Object.assign(Object.setPrototypeOf(as.prototype,os.prototype),{isCollidable:()=>!0,getStraightenHorizon:()=>!0,getFlyDirection:(e,t,i)=>i.assign(t).subtract(e),getTranslationOffset:(()=>{const e=new Ee.A,t=new Fn.A,i=new Fn.A;return function(n){const s=this.getActiveViewpoint(),r=s.getUpVector();t.assign(s.getUserOrientation()),t.multVecRot(e.assign(Ee.A.Y_AXIS)),i.setFromToVec(e,r);return t.multRight(i).multVecRot(n)}})(),constrainPanDirection:e=>(e.y<0&&(e.y=0),e)}),Object.defineProperties(as,{typeName:{value:"WalkViewer",enumerable:!0}});const ls=as,hs=s.A.add("WalkViewer",ls);function cs(e,t){os.call(this,e,t)}Object.assign(Object.setPrototypeOf(cs.prototype,os.prototype),{isCollidable(){return this.isActive()},getFlyDirection:(e,t,i)=>i.assign(t).subtract(e),getTranslationOffset(e){return this.getActiveViewpoint().getUserOrientation().multVecRot(e)},constrainPanDirection:e=>e}),Object.defineProperties(cs,{typeName:{value:"FlyViewer",enumerable:!0}});const us=cs,ds=s.A.add("FlyViewer",us);n(3979);var ps=n(9340);const gs=/Mac OS X/i.test(navigator.userAgent)?1/160:.05,fs=new Ee.A,ms=new Ee.A,As=new Ee.A;function _s(e,t){xn.call(this,e,t),this.button=-1,this.fromPoint=new Ee.A,this.toPoint=new Ee.A}Object.assign(Object.setPrototypeOf(_s.prototype,xn.prototype),{initialize(){xn.prototype.initialize.call(this);const e=this.getBrowser().getSurface();e.on("mousedown.PlaneViewer",this.mousedown.bind(this)),e.on("mouseup.PlaneViewer",this.mouseup.bind(this)),e.on("mousemove.PlaneViewer",this.mousemove.bind(this)),e.on("mousewheel.PlaneViewer",this.mousewheel.bind(this))},mousedown(e){if(this.button>=0)return;const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(this.isPointerInRectangle(t,i)&&1===this.getButton(e.button))e.preventDefault(),this.button=e.button,this.getBrowser().getSurface().off("mousemove.PlaneViewer"),ps(document).on("mouseup.PlaneViewer"+this.getId(),this.mouseup.bind(this)),ps(document).on("mousemove.PlaneViewer"+this.getId(),this.mousemove.bind(this)),this.getActiveViewpoint().transitionStop(),this.getBrowser().setCursor("MOVE"),this.getPointOnCenterPlane(t,i,this.fromPoint),this._isActive=!0},mouseup(e){e.button===this.button&&(e.preventDefault(),this.button=-1,ps(document).off(".PlaneViewer"+this.getId()),this.getBrowser().getSurface().on("mousemove.PlaneViewer",this.mousemove.bind(this)),this.getBrowser().setCursor("DEFAULT"),this._isActive=!1)},mousemove(e){const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);switch(this.getButton(this.button)){case 1:{e.preventDefault();const n=this.getActiveViewpoint(),s=this.getPointOnCenterPlane(t,i,this.toPoint),r=n.getUserOrientation().multVecRot(this.fromPoint.subtract(s));n._positionOffset=ms.assign(n._positionOffset.getValue()).add(r),n._centerOfRotationOffset=As.assign(n._centerOfRotationOffset.getValue()).add(r),this.fromPoint.assign(s);break}}},mousewheel(e){const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(!this.isPointerInRectangle(t,i))return;e.preventDefault();const n=this.getActiveViewpoint(),s=this.getPointOnCenterPlane(t,i,this.fromPoint);n.transitionStop(),e.deltaY>0?n._fieldOfViewScale=Math.max(1e-5,n._fieldOfViewScale.getValue()*(1-gs)):e.deltaY<0&&(n._fieldOfViewScale=n._fieldOfViewScale.getValue()*(1+gs),this.constrainFieldOfViewScale());const r=this.getPointOnCenterPlane(t,i,this.toPoint),o=n.getUserOrientation().multVecRot(fs.assign(s).subtract(r));n._positionOffset=ms.assign(n._positionOffset.getValue()).add(o),n._centerOfRotationOffset=As.assign(n._centerOfRotationOffset.getValue()).add(o)},constrainFieldOfViewScale(){const e=this.getActiveViewpoint();e.getTypeName().match(/^(?:Viewpoint|GeoViewpoint)$/)&&e._fieldOfView.getValue()*e._fieldOfViewScale.getValue()>=Math.PI&&(e._fieldOfViewScale=(Math.PI-.001)/e._fieldOfView.getValue())},dispose(){this.getBrowser().getSurface().off(".PlaneViewer"),ps(document).off(".PlaneViewer"+this.getId())}}),Object.defineProperties(_s,{typeName:{value:"PlaneViewer",enumerable:!0}});const ys=_s,ws=s.A.add("PlaneViewer",ys);function xs(e,t){xn.call(this,e,t)}Object.setPrototypeOf(xs.prototype,xn.prototype),Object.defineProperties(xs,{typeName:{value:"NoneViewer",enumerable:!0}});const bs=xs,Ss=s.A.add("NoneViewer",bs);n(3979);var Ts=n(9340);const vs=/Mac OS X/i.test(navigator.userAgent)?1/120:.05;function Os(e,t){xn.call(this,e,t),this.button=-1,this.fromVector=new Ee.A,this.toVector=new Ee.A,this.touch1=new It.A,this.touch2=new It.A,this.tapStart=0,this.dblTapInterval=.4,this.positionChaser=new In(e),this.centerOfRotationChaser=new In(e),this.orientationChaser=new Dn(e)}Object.assign(Object.setPrototypeOf(Os.prototype,xn.prototype),{initialize(){xn.prototype.initialize.call(this);const e=this.getBrowser().getSurface();e.on("mousedown.LookAtViewer",this.mousedown.bind(this)),e.on("mouseup.LookAtViewer",this.mouseup.bind(this)),e.on("dblclick.LookAtViewer",this.dblclick.bind(this)),e.on("mousewheel.LookAtViewer",this.mousewheel.bind(this)),e.on("touchstart.LookAtViewer",this.touchstart.bind(this)),e.on("touchend.LookAtViewer",this.touchend.bind(this)),this.positionChaser._duration=.3,this.positionChaser.setup(),this.centerOfRotationChaser._duration=.3,this.centerOfRotationChaser.setup(),this.orientationChaser._duration=.3,this.orientationChaser.setup()},mousedown(e){if(this.button>=0)return;const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);if(this.isPointerInRectangle(t,i)&&0===e.button)e.preventDefault(),this.button=e.button,Ts(document).on("mouseup.LookAtViewer"+this.getId(),this.mouseup.bind(this)),Ts(document).on("mousemove.LookAtViewer"+this.getId(),this.mousemove.bind(this)),Ts(document).on("touchend.LookAtViewer"+this.getId(),this.mouseup.bind(this)),Ts(document).on("touchmove.LookAtViewer"+this.getId(),this.touchmove.bind(this)),this.getActiveViewpoint().transitionStop(),this.trackballProjectToSphere(t,i,this.fromVector),this._isActive=!0},mouseup(e){if(e.button===this.button&&(this.button=-1,Ts(document).off(".LookAtViewer"+this.getId()),0===e.button))e.preventDefault(),this._isActive=!1},dblclick(e){e.preventDefault();const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);this.disconnect(),this.lookAtPoint(t,i,this.getStraightenHorizon())},mousemove(e){this.getBrowser().addBrowserEvent(),this.event=e;const{x:t,y:i}=this.getBrowser().getPointerFromEvent(e);switch(this.button){case 0:{e.preventDefault();const n=this.trackballProjectToSphere(t,i,this.toVector);this.addRotation(this.fromVector,n),this.fromVector.assign(n);break}}},mousewheel:(()=>{const e=new Ee.A,t=new Ee.A;return function(i){const{x:n,y:s}=this.getBrowser().getPointerFromEvent(i);if(!this.isPointerInRectangle(n,s))return;i.preventDefault();const r=this.getActiveViewpoint();r.transitionStop(),this.getDistanceToCenter(e).multiply(i.zoomFactor||vs),r.getUserOrientation().multVecRot(t.set(0,0,e.norm())),i.deltaY>0?this.addMove(t.negate(),Ee.A.ZERO):i.deltaY<0&&this.addMove(t,Ee.A.ZERO)}})(),touchstart(e){const t=e.originalEvent.touches;switch(t.length){case 1:this.touch1.set(t[0].pageX,t[0].pageY);break;case 2:this.touchend(e),e.button=0,e.pageX=(t[0].pageX+t[1].pageX)/2,e.pageY=(t[0].pageY+t[1].pageY)/2,this.mousedown(e),this.touch1.set(t[0].pageX,t[0].pageY),this.touch2.set(t[1].pageX,t[1].pageY);break;case 3:this.touchend(e)}},touchend(e){if(0===this.button)this.mouseup(e);Date.now()-this.tapStart<this.dblTapInterval&&(e.button=1,e.pageX=this.touch1.x,e.pageY=this.touch1.y,this.dblclick(e)),this.tapStart=Date.now()},touchmove:(()=>{const e=new It.A,t=new It.A;return function(i){const n=i.originalEvent.touches;switch(n.length){case 1:break;case 2:{e.set(n[0].pageX,n[0].pageY).subtract(this.touch1).normalize(),t.set(n[1].pageX,n[1].pageY).subtract(this.touch2).normalize();const s=e.dot(t)>.7,r=e.dot(t)<-.7;if(s)i.button=0,i.pageX=(n[0].pageX+n[1].pageX)/2,i.pageY=(n[0].pageY+n[1].pageY)/2,this.mousemove(i);else if(r){const e=this.touch1.distance(this.touch2);this.touch1.set(n[0].pageX,n[0].pageY),this.touch2.set(n[1].pageX,n[1].pageY);const t=this.touch1.distance(this.touch2)-e;i.deltaY=t,i.zoomFactor=Math.abs(t)/Ts(window).width(),i.pageX=(n[0].pageX+n[1].pageX)/2,i.pageY=(n[0].pageY+n[1].pageY)/2,this.mousewheel(i)}this.touch1.set(n[0].pageX,n[0].pageY),this.touch2.set(n[1].pageX,n[1].pageY);break}}}})(),set_positionOffset__(e){this.getActiveViewpoint()._positionOffset=e},set_centerOfRotationOffset__(e){this.getActiveViewpoint()._centerOfRotationOffset=e},set_orientationOffset__(e){this.getActiveViewpoint()._orientationOffset=e},addMove:(()=>{const e=new Ee.A,t=new Ee.A;return function(i,n){const s=this.getActiveViewpoint();this.positionChaser._isActive.getValue()&&this.positionChaser._value_changed.hasInterest("set_positionOffset__",this)?(e.assign(this.positionChaser._set_destination.getValue()).add(i),this.positionChaser._set_destination=e):(e.assign(s._positionOffset.getValue()).add(i),this.positionChaser._set_value=s._positionOffset,this.positionChaser._set_destination=e),this.centerOfRotationChaser._isActive.getValue()&&this.centerOfRotationChaser._value_changed.hasInterest("set_centerOfRotationOffset__",this)?(t.assign(this.centerOfRotationChaser._set_destination.getValue()).add(n),this.centerOfRotationChaser._set_destination=t):(t.assign(s._centerOfRotationOffset.getValue()).add(n),this.centerOfRotationChaser._set_value=s._centerOfRotationOffset,this.centerOfRotationChaser._set_destination=t),this.disconnect(),this.positionChaser._value_changed.addInterest("set_positionOffset__",this),this.centerOfRotationChaser._value_changed.addInterest("set_centerOfRotationOffset__",this)}})(),addRotation:(()=>{const e=new Fn.A,t=new Fn.A;return function(i,n){const s=this.getActiveViewpoint();this.orientationChaser._isActive.getValue()&&this.orientationChaser._value_changed.hasInterest("set_orientationOffset__",this)?(e.setFromToVec(n,i).multRight(s.getOrientation()).multRight(this.orientationChaser._set_destination.getValue()),s.straightenHorizon(e),t.assign(s.getOrientation()).inverse().multRight(e),this.orientationChaser._set_destination=t):(e.setFromToVec(n,i).multRight(s.getUserOrientation()),s.straightenHorizon(e),t.assign(s.getOrientation()).inverse().multRight(e),this.orientationChaser._set_value=s._orientationOffset,this.orientationChaser._set_destination=t),this.disconnect(),this.orientationChaser._value_changed.addInterest("set_orientationOffset__",this)}})(),disconnect(){this.orientationChaser._value_changed.removeInterest("set_orientationOffset__",this),this.positionChaser._value_changed.removeInterest("set_positionOffset__",this),this.centerOfRotationChaser._value_changed.removeInterest("set_centerOfRotationOffset__",this)},dispose(){this.getBrowser().getSurface().off(".LookAtViewer"),Ts(document).off(".LookAtViewer"+this.getId())}}),Object.defineProperties(Os,{typeName:{value:"LookAtViewer",enumerable:!0}});const Es=Os,Ns=s.A.add("LookAtViewer",Es);function Cs(e){ai.A.call(this,e),this.addType(m.A.X3DLightNode),this.enabled=!0}Object.assign(Object.setPrototypeOf(Cs.prototype,ai.A.prototype),{initialize(){ai.A.prototype.initialize.call(this),this._global.addInterest("set_global__",this),this._on.addInterest("set_on__",this),this._intensity.addInterest("set_on__",this),this.set_global__(),this.set_on__()},set_global__(){this.setVisibleObject(this._global.getValue())},set_on__(){this._on.getValue()&&this.getIntensity()>0&&this.enabled?(delete this.push,delete this.pop):(this.push=Function.prototype,this.pop=Function.prototype)},getLightKey:()=>1,getEnabled(){return this.enabled},setEnabled(e){this.enabled=e},getGlobal(){return this._global.getValue()},getColor(){return this._color.getValue()},getIntensity(){return Math.max(this._intensity.getValue(),0)},getAmbientIntensity(){return W.A.clamp(this._ambientIntensity.getValue(),0,1)},getDirection(){return this._direction.getValue()},getShadows(){return this._shadows.getValue()},getShadowColor(){return this._shadowColor.getValue()},getShadowIntensity(){return this.getShadows()?W.A.clamp(this._shadowIntensity.getValue(),0,1):0},getShadowBias(){return W.A.clamp(this._shadowBias.getValue(),0,1)},getShadowMapSize(){return Math.min(this._shadowMapSize.getValue(),this.getBrowser().getMaxTextureSize())},getBiasMatrix:(()=>{const e=new Si.A(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1);return function(){return e}})(),push(e,t){if(e.isIndependent()){const i=this.getLights().pop();this._global.getValue()?(i.set(this,e.getLayer().getGroups(),e.getModelViewMatrix().get()),e.getGlobalLights().push(i),e.getLights().push(i),e.pushGlobalShadows(!!this.getShadowIntensity()),e.getGlobalLightsKeys().push(this.getLightKey())):(i.set(this,t,e.getModelViewMatrix().get()),e.getLocalObjects().push(i),e.getLights().push(i),e.pushLocalShadows(!!this.getShadowIntensity()),e.getLocalObjectsKeys().push(this.getLightKey()))}else{const t=e.getLightContainer();t.modelViewMatrix.push(e.getModelViewMatrix().get()),this._global.getValue()?(e.getGlobalLights().push(t),e.getLights().push(t),e.pushGlobalShadows(!!this.getShadowIntensity()),e.getGlobalLightsKeys().push(this.getLightKey())):(e.getLocalObjects().push(t),e.getLights().push(t),e.pushLocalShadows(!!this.getShadowIntensity()),e.getLocalObjectsKeys().push(this.getLightKey()))}},pop(e){if(this._global.getValue())return;const t=e.getLocalObjects().pop();e.isIndependent()&&this.getBrowser().getLocalObjects().push(t),e.popLocalShadows(),e.getLocalObjectsKeys().pop()}}),Object.defineProperties(Cs,Je.A.getStaticProperties("X3DLightNode","Lighting",1));const Is=Cs,Fs=s.A.add("X3DLightNode",Is);var Ms=n(6732),Rs=n(3281);const Ps=(0,Rs.A)(Vs);function Vs(){this.direction=new Ee.A,this.shadowBuffer=null,this.bbox=new pi.A,this.viewVolume=new xi.A,this.viewport=new bi.A,this.projectionMatrix=new Si.A,this.modelViewMatrix=new Ms.A(Si.A),this.modelMatrix=new Si.A,this.invLightSpaceMatrix=new Si.A,this.invLightSpaceProjectionMatrix=new Si.A,this.shadowMatrix=new Si.A,this.shadowMatrixArray=new Float32Array(16),this.rotation=new Fn.A,this.textureUnit=void 0}function Ds(e){Fs.call(this,e),this.addType(m.A.DirectionalLight),e.getSpecificationVersion()<=3&&(this._global=!0)}Object.assign(Vs.prototype,{set(e,t,i){const n=e.getShadowMapSize();this.browser=e.getBrowser(),this.lightNode=e,this.groupNode=t,this.global=e.getGlobal(),this.modelViewMatrix.push(i),e.getShadowIntensity()>0&&n>0&&(this.shadowBuffer=this.browser.popShadowBuffer(n),this.shadowBuffer||console.warn("Couldn't create shadow buffer."))},renderShadowMap(e){if(!this.shadowBuffer)return;const t=this.lightNode,i=e.getCameraSpaceMatrix().get(),n=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),s=this.invLightSpaceMatrix.assign(this.global?n:Si.A.IDENTITY);s.rotate(this.rotation.setFromToVec(Ee.A.Z_AXIS,this.direction.assign(t.getDirection()).negate())),s.inverse();const r=this.groupNode.getSubBBox(this.bbox,!0).multRight(s),o=t.getShadowMapSize(),a=this.viewport.set(0,0,o,o),l=fn.A.orthoBox(r,this.projectionMatrix);this.shadowBuffer.bind(),e.getViewVolumes().push(this.viewVolume.set(l,a,a)),e.getProjectionMatrix().push(l),e.getModelViewMatrix().push(s),e.render(ci.A.SHADOW,ji.A.prototype.traverse,this.groupNode),e.getModelViewMatrix().pop(),e.getProjectionMatrix().pop(),e.getViewVolumes().pop(),this.global||s.multLeft(n.inverse()),this.invLightSpaceProjectionMatrix.assign(s).multRight(l).multRight(t.getBiasMatrix())},setGlobalVariables(e){this.modelViewMatrix.get().multDirMatrix(this.direction.assign(this.lightNode.getDirection())).normalize(),this.shadowBuffer&&(this.shadowMatrix.assign(e.getView()?.inverse??Si.A.IDENTITY).multRight(e.getCameraSpaceMatrixArray()).multRight(this.invLightSpaceProjectionMatrix),this.shadowMatrixArray.set(this.shadowMatrix))},setShaderUniforms(e,t){const i=t.numLights++,n=t.x3d_Light[i];if(!n)return;if(this.shadowBuffer){const t=this.global?this.textureUnit??=this.browser.popGlobalTextureUnit():this.browser.popTextureUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.shadowBuffer.getDepthTexture()),e.uniform1i(n.shadowMap,t)}if(t.hasLight(i,this))return;const{lightNode:s,direction:r}=this;e.uniform1i(n.type,1),e.uniform3f(n.color,...s.getColor()),e.uniform1f(n.intensity,s.getIntensity()),e.uniform1f(n.ambientIntensity,s.getAmbientIntensity()),e.uniform3f(n.direction,...r),e.uniform1f(n.radius,-1),this.shadowBuffer?(e.uniform3f(n.shadowColor,...s.getShadowColor()),e.uniform1f(n.shadowIntensity,s.getShadowIntensity()),e.uniform1f(n.shadowBias,s.getShadowBias()),e.uniformMatrix4fv(n.shadowMatrix,!1,this.shadowMatrixArray),e.uniform1i(n.shadowMapSize,s.getShadowMapSize())):e.uniform1f(n.shadowIntensity,0)},dispose(){const{shadowBuffer:e}=this;if(e){const{browser:t,global:i}=this;t.pushShadowBuffer(e),this.shadowBuffer=null,i&&(this.textureUnit=void 0)}this.modelViewMatrix.clear(),Ps.push(this)}}),Object.assign(Object.setPrototypeOf(Ds.prototype,Fs.prototype),{getLights:()=>Ps}),Object.defineProperties(Ds,{...Je.A.getStaticProperties("DirectionalLight","Lighting",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"global",new c.A.SFBool),new o.A(m.A.inputOutput,"on",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"color",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"intensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"ambientIntensity",new c.A.SFFloat),new o.A(m.A.inputOutput,"direction",new c.A.SFVec3f(0,0,-1)),new o.A(m.A.inputOutput,"shadows",new c.A.SFBool),new o.A(m.A.inputOutput,"shadowColor",new c.A.SFColor),new o.A(m.A.inputOutput,"shadowIntensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"shadowBias",new c.A.SFFloat(.005)),new o.A(m.A.initializeOnly,"shadowMapSize",new c.A.SFInt32(1024))]),enumerable:!0}});const Ls=Ds,Bs=s.A.add("DirectionalLight",Ls),ks=Symbol(),js=Symbol(),Us=Symbol();function Xs(){this.addChildObjects(m.A.outputOnly,"availableViewers",new c.A.MFString,m.A.outputOnly,"viewer",new c.A.SFString("EXAMINE")),this[ks]=new Set,this[js]=new Ss(this.getPrivateScene())}Object.assign(Xs.prototype,{initialize(){this._viewer.addInterest("set_viewer__",this),this.shutdown().addInterest("remove_world__",this),this.initialized().addInterest("set_world__",this),this[Us]=this.createHeadlight(),this[js].setup()},createHeadlight(){const e=new Bs(this.getPrivateScene());e.setup();const t=e.getLights().pop();return t.set(e,null,Si.A.IDENTITY),t.dispose=Function.prototype,t},getHeadlight(){return this[Us]},getActiveLayer(){return this._activeLayer.getValue()},getActiveNavigationInfo(){return this._activeNavigationInfo.getValue()},getActiveViewpoint(){return this._activeViewpoint.getValue()},getCurrentViewer(){return this._viewer.getValue()},getViewer(){return this[js]},addCollision(e){this[ks].add(e)},removeCollision(e){this[ks].delete(e)},getCollisionCount(){return this[ks].size},remove_world__(){this[js]?.disconnect(),this.getWorld()._activeLayer.removeInterest("set_activeLayer__",this)},set_world__(){this.getWorld()._activeLayer.addInterest("set_activeLayer__",this),this.set_activeLayer__()},set_activeLayer__(){{const e=this._activeLayer.getValue();e&&(e.getNavigationInfoStack().removeInterest("set_activeNavigationInfo__",this),e.getViewpointStack().removeInterest("set_activeViewpoint__",this))}{const e=this._activeLayer=this.getWorld().getActiveLayer();e&&(e.getNavigationInfoStack().addInterest("set_activeNavigationInfo__",this),e.getViewpointStack().addInterest("set_activeViewpoint__",this))}this.set_activeNavigationInfo__(),this.set_activeViewpoint__()},set_activeNavigationInfo__(){this._activeNavigationInfo.getValue()?._viewer.removeFieldInterest(this._viewer);const e=this._activeLayer.getValue()?.getNavigationInfo();this._activeNavigationInfo=e,e?._viewer.addFieldInterest(this._viewer),this._viewer=e?._viewer??"NONE"},set_activeViewpoint__(){this._activeViewpoint=this._activeLayer.getValue()?.getViewpoint()},set_viewer__(e){const t=this._activeNavigationInfo.getValue();switch(this._availableViewers=t?._availableViewers??[],this[js]?.dispose(),e.getValue()){case"EXAMINE":default:this[js]=new $n(this.getPrivateScene(),t);break;case"WALK":this[js]=new hs(this.getPrivateScene(),t);break;case"FLY":this[js]=new ds(this.getPrivateScene(),t);break;case"PLANE":this[js]=new ws(this.getPrivateScene(),t);break;case"NONE":this[js]=new Ss(this.getPrivateScene(),t);break;case"LOOKAT":this[js]=new Ns(this.getPrivateScene(),t)}this[js].setup()},dispose(){this[js]?.dispose()}});const zs=Xs,Gs=s.A.add("X3DNavigationContext",zs),Hs=Symbol(),$s=Symbol(),Ys=Symbol(),qs=Symbol(),Ws=Symbol(),Ks=Symbol(),Zs=Symbol();function Qs(e){const t=e.prop("baseURI");return t.startsWith("about:")?document.baseURI:t}function Js(){this.addChildObjects(m.A.outputOnly,"loadCount",new c.A.SFInt32),this[Hs]=Qs(this.getElement()),this[$s]=0,this[Ys]=0,this[qs]=new Set,this[Ws]=!1}Object.assign(Js.prototype,{initialize(){this._loadCount.addInterest(Ks,this)},getProviderURL:()=>_e.A.getProviderURL(),getBaseURL(){return this[Hs]},setBaseURL(e){const t=Qs(this.getElement()),i=new URL(e,t);this[Hs]=i.protocol.match(/^(?:data|blob):$/)?t:i.href},getBrowserLoading(){return this[Ws]},setBrowserLoading(e){this[Ws]=e,e?(this[qs].has(this)||this.resetLoadCount(),this.getShadow().find(".x_ite-private-world-info").remove(),this.getBrowserOption("SplashScreen")&&(this.getContextMenu().hide(),this.getCanvas().hide(),this.getSplashScreen().removeClass(["x_ite-private-fade-out-splash-screen","x_ite-private-hidden"]))):this.getBrowserOption("SplashScreen")&&(this.getCanvas().show(),setTimeout(()=>{this[Ws]||this.getSplashScreen().addClass("x_ite-private-fade-out-splash-screen")}))},getLoadingObjects(){return this[qs]},addLoadingObject(e){this[qs].has(e)||++this[Ys],this[qs].add(e),this._loadCount=this[qs].size},removeLoadingObject(e){this[qs].delete(e),this._loadCount=this[qs].size},getDisplayLoadCount(){return Array.from(this[qs]).reduce((e,t)=>e+!(t.isPrivate?.()??1),0)},resetLoadCount(){this._loadCount=0,this[$s]=0,this[Ys]=0,this[qs].clear();for(const e of this.getPrivateScene().getLoadingObjects())this.addLoadingObject(e)},[Ks](){const e=this.getDisplayLoadCount();let t;t=this._loadCount.getValue()||this[Ws]?N(1===(e||1)?"Loading %1 file":"Loading %1 files").replace("%1",e||1):N("Loading done"),this.updateCursor(),this[Ws]?(this.getSplashScreen().find(".x_ite-private-spinner-text").text(t),this.getSplashScreen().find(".x_ite-private-progressbar div").css("width",100-100*this._loadCount.getValue()/this[Ys]+"%")):e!==this[$s]&&this.setDescription(t),this[$s]=e},getDefaultScene(){return this[Zs]??=(()=>{const e=new ye.A(this);return e.setup(),e.setLive(this.isLive()),e})()}});const er=Js,tr=s.A.add("X3DNetworkingContext",er),ir=Symbol(),nr=Symbol(),sr=Symbol(),rr=Symbol(),or=Symbol();function ar(){this[ir]=new Set,this[nr]=[new Set],this[sr]=[],this[rr]=[!1],this[or]=new y.A}Object.assign(ar.prototype,{addTransformSensor(e){this[ir].add(e),this.enablePicking()},removeTransformSensor(e){this[ir].delete(e),this.enablePicking()},addPickSensor(e){this[nr][0].add(e),this.enablePicking()},removePickSensor(e){this[nr][0].delete(e),this.enablePicking()},getPickSensors(){return this[nr]},getPickingHierarchy(){return this[sr]},getPickable(){return this[rr]},enablePicking(){this[ir].size||this[nr][0].size?this._sensorEvents.addInterest("picking",this):this._sensorEvents.removeInterest("picking",this)},picking(){this[or].start(),this.getWorld().traverse(ci.A.PICKING);for(const e of this[ir])e.process();for(const e of this[nr][0])e.process();this[or].stop()},getPickingTime(){return this[or]}});const lr=ar,hr=s.A.add("X3DPickingContext",lr);n(3979);var cr=n(9340);function ur(e){r.A.call(this,e),this.over=!1,this.grabbing=!1}Object.assign(Object.setPrototypeOf(ur.prototype,r.A.prototype),{initialize(){const e=this.getBrowser().getSurface();e.on("mousedown.PointingDevice"+this.getId(),this.mousedown.bind(this)),e.on("mouseup.PointingDevice"+this.getId(),this.mouseup.bind(this)),e.on("dblclick.PointingDevice"+this.getId(),this.dblclick.bind(this)),e.on("mousemove.PointingDevice"+this.getId(),this.mousemove.bind(this)),e.on("mouseout.PointingDevice"+this.getId(),this.onmouseout.bind(this)),e.on("touchstart.PointingDevice"+this.getId(),this.touchstart.bind(this)),e.on("touchend.PointingDevice"+this.getId(),this.touchend.bind(this))},mousewheel(e){},mousedown(e){const t=this.getBrowser(),i=t.getSurface();if(t.getElement().focus(),(!t.getShiftKey()||!t.getControlKey()&&!t.getCommandKey())&&0===e.button){const{x:n,y:s}=t.getPointerFromEvent(e);i.off("mousemove.PointingDevice"+this.getId()),cr(document).on("mouseup.PointingDevice"+this.getId(),this.mouseup.bind(this)).on("mousemove.PointingDevice"+this.getId(),this.mousemove.bind(this)).on("touchend.PointingDevice"+this.getId(),this.touchend.bind(this)).on("touchmove.PointingDevice"+this.getId(),this.touchmove.bind(this)),t.buttonPressEvent(n,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.grabbing=Array.from(t.getHit().sensors.keys()).some(e=>e.getType().includes(m.A.X3DDragSensorNode)),t.setCursor("POINTER"),this.onverifymotion(n,s))}},mouseup(e){if(0!==e.button)return;e.preventDefault();const t=this.getBrowser(),i=t.getSurface(),{x:n,y:s}=t.getPointerFromEvent(e);cr(document).off(".PointingDevice"+this.getId()),i.on("mousemove.PointingDevice"+this.getId(),this.mousemove.bind(this)),this.grabbing=!1,t.buttonReleaseEvent(),t.setCursor(this.over?"POINTER":"DEFAULT"),this.onverifymotion(n,s)},dblclick(e){const t=this.getBrowser();t.getShiftKey()&&(t.getControlKey()||t.getCommandKey())||this.over&&(e.preventDefault(),e.stopImmediatePropagation())},mousemove(e){e.preventDefault();const t=this.getBrowser(),{x:i,y:n}=t.getPointerFromEvent(e);this.onmotion(i,n,!0)},touchstart(e){const t=e.originalEvent.touches;switch(t.length){case 1:{e.button=0,e.pageX=t[0].pageX,e.pageY=t[0].pageY,this.mousedown(e);const i=this.getBrowser().getHit();0!==i.id&&0!==i.sensors.size||(this.touchX=e.pageX,this.touchY=e.pageY,this.touchTimeout=setTimeout(()=>this.showContextMenu(e),1200));break}case 2:this.touchend(e)}},touchend(e){e.button=0,this.mouseup(e),clearTimeout(this.touchTimeout)},touchmove(e){const t=e.originalEvent.touches;if(1===t.length)e.button=0,e.pageX=t[0].pageX,e.pageY=t[0].pageY,this.mousemove(e),Math.hypot(this.touchX-e.pageX,this.touchY-e.pageY)>7&&clearTimeout(this.touchTimeout)},onmotion(e,t,i=!1){const n=this.getBrowser();this.over=n.motionNotifyEvent(e,t),n.getViewer().isActive()||(this.over?n.setCursor(this.grabbing&&i?"GRABBING":"POINTER"):n.setCursor(this.grabbing&&i?"GRABBING":"DEFAULT"))},onmouseout(e){this.getBrowser().leaveNotifyEvent()},async onverifymotion(e,t){await this.getBrowser().nextFrame(),this.onmotion(e,t)},showContextMenu(e){this.getBrowser().getContextMenu().show(e)}}),Object.defineProperties(ur,{typeName:{value:"PointingDevice",enumerable:!0}});const dr=ur,pr=s.A.add("PointingDevice",dr);function gr({browser:e}){const t=e.getContext();this.context=t,this.array=new Float32Array(4);const i=t.getParameter(t.FRAMEBUFFER_BINDING);this.frameBuffer=t.createFramebuffer(),this.colorBuffers=[];for(let e=0;e<3;++e)this.colorBuffers[e]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,this.colorBuffers[e]),t.renderbufferStorage(t.RENDERBUFFER,t.RGBA32F,1,1),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,this.colorBuffers[e]);t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1,t.COLOR_ATTACHMENT2]),this.depthTexture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.depthTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.DEPTH_COMPONENT24,1,1,0,t.DEPTH_COMPONENT,t.UNSIGNED_INT,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,this.depthTexture,0);const n=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;if(t.bindFramebuffer(t.FRAMEBUFFER,i),!n)throw new Error("Couldn't create frame buffer.")}Object.assign(gr.prototype,{bind(){const e=this.context;e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},getHit(e){const{context:t,array:i}=this;t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.readBuffer(t.COLOR_ATTACHMENT0),t.readPixels(0,0,1,1,t.RGBA,t.FLOAT,i),e.id=i[3],e.point.set(i[0],i[1],i[2]),t.readBuffer(t.COLOR_ATTACHMENT1),t.readPixels(0,0,1,1,t.RGBA,t.FLOAT,i),e.normal.set(i[0],i[1],i[2]),t.readBuffer(t.COLOR_ATTACHMENT2),t.readPixels(0,0,1,1,t.RGBA,t.FLOAT,i),e.texCoord.set(i[0],i[1],i[2],i[3])},dispose(){const e=this.context;e.deleteFramebuffer(this.frameBuffer);for(const t of this.colorBuffers)e.deleteRenderbuffer(t);e.deleteRenderbuffer(this.depthBuffer),e.deleteTexture(this.depthTexture)}});const fr=gr,mr=s.A.add("PointingBuffer",fr);var Ar=n(7854);const _r=Symbol(),yr=Symbol(),wr=Symbol(),xr=Symbol(),br=Symbol(),Sr=Symbol(),Tr=Symbol(),vr=Symbol(),Or=Symbol(),Er=Symbol(),Nr=Symbol(),Cr=Symbol(),Ir=Symbol(),Fr=Symbol(),Mr=Symbol(),Rr=Symbol(),Pr=Symbol.for("X_ITE.X3DRoutingContext.processEvents");function Vr(){this[_r]=new pr(this.getPrivateScene()),this[yr]=new Set,this[br]=new It.A,this[Tr]=[],this[vr]=new Map,this[Or]=new Map,this[Nr]=new y.A,this[Cr]=new mr({browser:this}),this[Ir]=new Map,this[Rr]=[],this[Sr]={id:0,pointer:new It.A,ray:new Ar.A,sensors:new Map,viewMatrix:new Si.A,modelViewMatrix:new Si.A,point:new Ee.A,normal:new Ee.A,texCoord:new bi.A,layerNode:null,pointingLayerNode:null,shapeNode:null,copy(){return{id:this.id,pointer:this.pointer.copy(),ray:this.ray.copy(),sensors:new Map(this.sensors),viewMatrix:this.viewMatrix.copy(),modelViewMatrix:this.modelViewMatrix.copy(),point:this.point.copy(),normal:this.normal.copy(),texCoord:this.texCoord.copy(),layerNode:this.layerNode,pointingLayerNode:this.pointingLayerNode,shapeNode:this.shapeNode,copy:this.copy}}}}Object.assign(Vr.prototype,{initialize(){this.setCursor("DEFAULT"),this[_r].setup()},getPointingTime(){return this[Nr]},addPointingDeviceSensor(e){this[yr].add(e)},removePointingDeviceSensor(e){this[yr].delete(e)},setCursors(e){this[wr]=e,this.updateCursor()},setCursor(e){e!==this[xr]&&(this[xr]=e,this.updateCursor())},updateCursor(){const e=this.getDisplayLoadCount()?"WAIT":this[xr],t=this[wr]?.[e]??e.toLowerCase();this.getSurface().css("cursor",t)},getPointer(){return this[br]},getPointerFromEvent({pageX:e,pageY:t}){const i=this.getSurface().offset(),n=this.getSurface()[0].getBoundingClientRect(),s=this.getViewport(),r=(e-i.left)/n.width*s[2],o=(1-(t-i.top)/n.height)*s[3];return new It.A(r,o)},isPointerInRectangle(e,t=this[br]){return t.x>=e.x&&t.x<=e.x+e.z&&t.y>=e.y&&t.y<=e.y+e.w},getPointingInputSource(){return this[Fr]},getPointingLayer(){return this[Er]},getHit(){return this[Sr]},removeHit(e){e.id=0,e.sensors.clear(),this.buttonReleaseEvent(e),this.motion(e)},addSensor(e){this[Tr].push(e)},addPointingShape(e){const t=++this[Mr];return this[Rr][t]=e,t},buttonPressEvent(e,t,i=this[Sr]){if(!this[yr].size)return!1;if(this.advanceOnlyTime(),i===this[Sr]&&this.touch(e,t),!i.id)return!1;i.pointingLayerNode=i.layerNode;for(const[e,t]of i.sensors)this[Or].has(e)||(this[vr].set(e,t),this[Or].set(e,t),t.set_active__(!0,i));return this[Pr](),!!i.sensors.size},buttonReleaseEvent(e=this[Sr]){if(e.pointingLayerNode=null,this[yr].size){this.advanceOnlyTime();for(const[t,i]of this[Or])i.hit===e&&(this[Or].delete(t),i.set_active__(!1,e));this[Pr]()}},motionNotifyEvent(e,t,i=this[Sr]){return!!this[yr].size&&(this.advanceOnlyTime(),i===this[Sr]&&this.touch(e,t),this.motion(i),this[Pr](),!!i.sensors.size)},leaveNotifyEvent(){},touch(e,t,i=this[Sr],n=null){if(this.getViewer().isActive())return!1;if(Boolean(this.getPose())!==Boolean(n))return!1;if(this[Nr].start(),this[Fr]=n,this[Er]=i.pointingLayerNode,this[Mr]=0,this[br].assign(i.pointer.set(e,t)),this[Cr].bind(),this.getWorld().traverse(ci.A.POINTER),this[Cr].getHit(i),i.sensors.clear(),Number.isInteger(i.id)&&i.id>0&&i.id<=this[Mr]){const{renderObject:e,sensors:t,modelViewMatrix:n,shapeNode:s}=this[Rr][i.id],r=s.getGeometryContext();i.ray.assign(e.getHitRay());for(const e of t)e.hit=i,i.sensors.set(e.node,e);i.layerNode=e,i.shapeNode=s,i.viewMatrix.assign(e.getViewpoint().getViewMatrix()),i.modelViewMatrix.assign(n),r.hasNormals?i.modelViewMatrix.submatrix.inverse().multMatrixVec(i.normal):i.normal.assign(Ee.A.Z_AXIS)}else i.id=0,i.pointingLayerNode&&i.ray.assign(i.pointingLayerNode.getHitRay()),i.layerNode=null,i.shapeNode=null,i.viewMatrix.assign(Si.A.IDENTITY),i.modelViewMatrix.assign(Si.A.IDENTITY);for(const e of this[Tr])e.hit||e.dispose();return this[Tr].length=0,this.addBrowserEvent(),this[Nr].stop(),!!i.id},motion(e=this[Sr]){for(const[t,i]of this[vr])i.hit===e&&(e.id&&e.sensors.has(t)||(this[vr].delete(t),i.set_over__(!1,e)));for(const[t,i]of e.sensors){const n=this[vr].get(t);n&&n.hit!==e||(this[vr].set(t,i),i.set_over__(!0,e))}for(const t of this[Or].values())t.hit===e&&t.set_motion__(e)},getPointingShader(e,t,i){const{geometryType:n,hasNormals:s}=t.getGeometryContext();let r="";if(r+=e,r+=i?.getHAnimKey()??"[]",r+=t.getShapeKey(),r+=n,r+=s?1:0,n>=2)r+="0.0.0";else{const e=t.getAppearance();r+=e.getStyleProperties(n)?1:0,r+=".",r+=e.getTextureBits().toString(16),r+=".",r+=e.getMaterial().getTextureBits().toString(16)}return this[Ir].get(r)??this.createPointingShader(r,e,t,i)},createPointingShader(e,t,i,n){const s=i.getAppearance(),r=i.getGeometryContext(),o=[];switch(o.push("X3D_DEPTH_SHADER"),r.hasNormals&&o.push("X3D_NORMALS"),t&&(o.push("X3D_CLIP_PLANES"),o.push("X3D_NUM_CLIP_PLANES "+t)),i.getShapeKey()){case 1:case 2:o.push("X3D_INSTANCING");break;case 3:o.push("X3D_INSTANCING","X3D_INSTANCE_NORMAL")}o.push(`X3D_GEOMETRY_${r.geometryType}D`),s.getStyleProperties(r.geometryType)&&o.push("X3D_STYLE_PROPERTIES"),+s.getMaterial().getTextureBits()&&o.push("X3D_MATERIAL_TEXTURES"),+s.getTextureBits()&&o.push("X3D_TEXTURE"),n?.getShaderOptions(o);const a=this.createShader("Pointing","Pointing","Pointing",o);return this[Ir].set(e,a),a}});const Dr=Vr,Lr=s.A.add("X3DPointingDeviceSensorContext",Dr);function Br({browser:e,x:t,y:i,width:n,height:s,samples:r,oit:o}){const a=e.getContext();if(this.browser=e,this.context=a,this.x=t,this.y=i,this.width=n,this.height=s,this.samples=r,this.oit=o,this.frameBuffer=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,this.frameBuffer),this.colorBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this.colorBuffer),r?a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.RGBA8,n,s):a.renderbufferStorage(a.RENDERBUFFER,a.RGBA8,n,s),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,this.colorBuffer),this.depthBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this.depthBuffer),r?a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.DEPTH_COMPONENT24,n,s):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT24,n,s),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,this.depthBuffer),a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Couldn't create frame buffer.");if((t||i)&&(this.auxBuffer=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,this.auxBuffer),this.auxColorBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this.auxColorBuffer),a.renderbufferStorage(a.RENDERBUFFER,a.RGBA8,n,s),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,this.auxColorBuffer),a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE))throw new Error("Couldn't create frame buffer.");if(!o)return;if(this.oitFramebuffer=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,this.oitFramebuffer),a.drawBuffers([a.COLOR_ATTACHMENT0,a.COLOR_ATTACHMENT1]),r?(this.accumRevealageBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this.accumRevealageBuffer),a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.RGBA16F,n,s),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,this.accumRevealageBuffer),this.alphaBuffer=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,this.alphaBuffer),a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.RGBA16F,n,s),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT1,a.RENDERBUFFER,this.alphaBuffer),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,this.depthBuffer),this.accumRevealageTextureBuffer=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,this.accumRevealageTextureBuffer),this.accumRevealageTexture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.accumRevealageTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA16F,n,s,0,a.RGBA,a.FLOAT,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.accumRevealageTexture,0),this.alphaTextureBuffer=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,this.alphaTextureBuffer),this.alphaTexture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.alphaTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA16F,n,s,0,a.RGBA,a.FLOAT,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.alphaTexture,0)):(this.accumRevealageTexture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.accumRevealageTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA16F,n,s,0,a.RGBA,a.FLOAT,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.accumRevealageTexture,0),this.alphaTexture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.alphaTexture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,a.RGBA16F,n,s,0,a.RGBA,a.FLOAT,null),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT1,a.TEXTURE_2D,this.alphaTexture,0),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,this.depthBuffer)),a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Couldn't create frame buffer.");this.shaderNode=e.getOITComposeShader(),this.program=this.shaderNode.getProgram(),a.useProgram(this.program);const l=a.getUniformLocation(this.program,"x3d_AccumRevealageTexture"),h=a.getUniformLocation(this.program,"x3d_AlphaTexture");a.uniform1i(l,0),a.uniform1i(h,1)}Object.assign(Br.prototype,{getX(){return this.x},getY(){return this.y},getWidth(){return this.width},getHeight(){return this.height},getSamples(){return this.samples},getOIT(){return this.oit},bind(){const{context:e,frameBuffer:t}=this;e.bindFramebuffer(e.FRAMEBUFFER,t)},clear(){const{context:e,frameBuffer:t,width:i,height:n}=this;e.bindFramebuffer(e.FRAMEBUFFER,t),e.viewport(0,0,i,n),e.scissor(0,0,i,n),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},bindTransparency(){const{context:e,oitFramebuffer:t}=this;e.bindFramebuffer(e.FRAMEBUFFER,t),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),e.blendFuncSeparate(e.ONE,e.ONE,e.ZERO,e.ONE_MINUS_SRC_ALPHA)},compose(){const{context:e,browser:t,width:i,height:n,samples:s,program:r}=this;e.viewport(0,0,i,n),e.scissor(0,0,i,n),s&&(e.bindFramebuffer(e.READ_FRAMEBUFFER,this.oitFramebuffer),e.readBuffer(e.COLOR_ATTACHMENT0),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.accumRevealageTextureBuffer),e.blitFramebuffer(0,0,i,n,0,0,i,n,e.COLOR_BUFFER_BIT,e.LINEAR),e.readBuffer(e.COLOR_ATTACHMENT1),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.alphaTextureBuffer),e.blitFramebuffer(0,0,i,n,0,0,i,n,e.COLOR_BUFFER_BIT,e.LINEAR)),e.useProgram(r),e.activeTexture(e.TEXTURE0+0),e.bindTexture(e.TEXTURE_2D,this.accumRevealageTexture),e.activeTexture(e.TEXTURE0+1),e.bindTexture(e.TEXTURE_2D,this.alphaTexture),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.disable(e.DEPTH_TEST),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.enable(e.CULL_FACE),e.frontFace(e.CCW),e.bindVertexArray(t.getFullscreenVertexArrayObject()),e.drawArrays(e.TRIANGLES,0,6),e.disable(e.BLEND),e.enable(e.DEPTH_TEST)},blit(){const{browser:e,context:t,x:i,y:n,width:s,height:r,samples:o,frameBuffer:a,auxBuffer:l}=this;t.viewport(0,0,i+s,n+r),t.scissor(0,0,i+s,n+r),t.bindFramebuffer(t.READ_FRAMEBUFFER,a),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,l??e.getDefaultFramebuffer()),t.blitFramebuffer(0,0,s,r,0,0,s,r,t.COLOR_BUFFER_BIT,o?t.LINEAR:t.NEAREST),l&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,l),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e.getDefaultFramebuffer()),t.blitFramebuffer(0,0,s,r,i,n,i+s,n+r,t.COLOR_BUFFER_BIT,t.NEAREST))},dispose(){const e=this.context;e.deleteFramebuffer(this.frameBuffer),e.deleteRenderbuffer(this.colorBuffer),e.deleteRenderbuffer(this.depthBuffer),e.deleteFramebuffer(this.auxFramebuffer),e.deleteRenderbuffer(this.auxColorBuffer),e.deleteFramebuffer(this.oitFramebuffer),e.deleteFramebuffer(this.accumRevealageTextureBuffer),e.deleteFramebuffer(this.alphaTextureBuffer),e.deleteRenderbuffer(this.accumRevealageBuffer),e.deleteRenderbuffer(this.alphaBuffer),e.deleteTexture(this.accumRevealageTexture),e.deleteTexture(this.alphaTexture)}});const kr=Br,jr=s.A.add("MultiSampleFramebuffer",kr);class Ur{static#L=new Map;static acquire(e,t){this.#L.has(e)||this.#L.set(e,[]);const i=this.#L.get(e),n=i.slice(),s=new Promise(async(e,i)=>{try{await Promise.allSettled(n),e(await t())}catch(e){i(e)}}).finally(()=>{i.splice(i.indexOf(s),1),i.length||this.#L.delete(e)});return i.push(s),s}}const Xr=Ur,zr=s.A.add("Lock",Xr);var Gr=n(9340);const Hr=Symbol(),$r=Symbol(),Yr=Symbol(),qr=Symbol(),Wr=Symbol(),Kr=Symbol(),Zr=Symbol(),Qr=Symbol(),Jr=Symbol(),eo=Symbol(),to=Symbol(),io=Symbol();function no(){this.addChildObjects(m.A.outputOnly,"viewport",new c.A.SFVec4f(0,0,300,150)),this[$r]=[],this[qr]=[],this[eo]=new Map,this[Kr]=[],this[Hr]=window,this[Yr]=null,this[io]=Symbol()}Object.assign(no.prototype,{initialize(){const e=this.getContext();e.enable(e.SCISSOR_TEST),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clearDepth(1),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),Gr(window).on(`orientationchange.X3DRenderingContext-${this.getInstanceId()}`,()=>this.reshape()),this[Wr]=new ResizeObserver(()=>{this.reshape(),"undefined"==typeof jest&&this[Symbol.for("X_ITE.X3DBrowserContext.traverse")](performance.now())}),this[Wr].observe(this.getSurface()[0]),this.reshape(),Gr(document).on(["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(e=>`${e}.X3DRenderingContext-${this.getInstanceId()}`).join(" "),()=>this.onfullscreen()),navigator.xr?.addEventListener("devicechange",()=>this.xrUpdateButton()),this.xrUpdateButton()},getRenderer(){const e=this.getContext();if(!navigator.userAgent.match(/Firefox/)){const t=e.getExtension("WEBGL_debug_renderer_info");if(t)return e.getParameter(t.UNMASKED_RENDERER_WEBGL)}return e.getParameter(e.RENDERER)},getVendor(){const e=this.getContext();if(!navigator.userAgent.match(/Firefox/)){const t=e.getExtension("WEBGL_debug_renderer_info");if(t)return e.getParameter(t.UNMASKED_VENDOR_WEBGL)}return e.getParameter(e.VENDOR)},getWebGLVersion(){const e=this.getContext();return e.getParameter(e.VERSION)},getMaxSamples(){const e=this.getContext();return e.getParameter(e.MAX_SAMPLES)},getMaxClipPlanes:()=>6,getDepthSize(){const e=this.getContext();return e.getParameter(e.DEPTH_BITS)},getColorDepth(){const e=this.getContext();return e.getParameter(e.RED_BITS)+e.getParameter(e.BLUE_BITS)+e.getParameter(e.GREEN_BITS)+e.getParameter(e.ALPHA_BITS)},getViewport(){return this._viewport},getLocalObjects(){return this[Kr]},getFramebuffers(){return this[$r]},getDefaultFramebuffer(){return this[Yr]},setDefaultFramebuffer(e){this[Yr]=e;for(const e of this[$r])e.dispose();this[$r]=[],this.reshape()},addTextureBuffer(e){this[qr].push(e)},getFullscreenVertexArrayObject(){return this[Zr]??=(()=>{const e=this.getContext(),t=e.createVertexArray(),i=e.createBuffer();return this[Qr]=i,e.bindVertexArray(t),e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,1,-1,-1,1,-1,-1,1,1,-1,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),t})()},getOITComposeShader(){return this[Jr]??=this.createShader("OITCompose","FullScreen","OITCompose")},getDepthShader(e,t,i,n){const s=i.getGeometryContext();let r="";if(r+=e?1:0,r+=t,r+=n?.getHAnimKey()??"[]",r+=i.getShapeKey(),r+=s.geometryType,s.geometryType>=2)r+="0.0.0";else{const e=i.getAppearance();r+=e.getStyleProperties(s.geometryType)?1:0,r+=".",r+=e.getTextureBits().toString(16),r+=".",r+=e.getMaterial().getTextureBits().toString(16)}return this[eo].get(r)??this.createDepthShader(r,e,t,i,n)},createDepthShader(e,t,i,n,s){const r=n.getAppearance(),o=n.getGeometryContext(),a=[];switch(t&&(a.push("X3D_NORMAL_BUFFER"),o.hasNormals&&a.push("X3D_NORMALS")),i&&(a.push("X3D_CLIP_PLANES"),a.push("X3D_NUM_CLIP_PLANES "+i)),n.getShapeKey()){case 1:case 2:a.push("X3D_INSTANCING");break;case 3:a.push("X3D_INSTANCING","X3D_INSTANCE_NORMAL")}a.push(`X3D_GEOMETRY_${o.geometryType}D`),r.getStyleProperties(o.geometryType)&&a.push("X3D_STYLE_PROPERTIES"),s?.getShaderOptions(a);const l=this.createShader("Depth","Depth","Depth",a);return this[eo].set(e,l),l},resize(e,t){return new Promise(i=>{const n=this.getRenderingProperty("ContentScale"),s=0|Math.max(e*n,1),r=0|Math.max(t*n,1),o=Symbol(),a=()=>{this._viewport[2]===s&&this._viewport[3]===r&&(this._viewport.removeFieldCallback(o),i())};this.getElement().css({width:`${e}px`,height:`${t}px`}),this._viewport.addFieldCallback(o,a),a()})},reshape(){if(this.getSession()!==window)return;const e=this.getCanvas(),t=this.getRenderingProperty("ContentScale"),i=0|Math.max(e.parent().width()*t,1),n=0|Math.max(e.parent().height()*t,1);e.prop("width",i).prop("height",n),this.reshapeFramebuffer(0,0,0,i,n),this.addBrowserEvent()},reshapeFramebuffer(e,t,i,n,s){const r=this.getRenderingProperty("Multisampling"),o=this.getBrowserOption("OrderIndependentTransparency"),a=this[$r][e];if(!a||t!==a.getX()||i!==a.getY()||n!==a.getWidth()||s!==a.getHeight()||r!==a.getSamples()||o!==a.getOIT()){this._viewport[2]=n,this._viewport[3]=s,a?.dispose(),this[$r][e]=new jr({browser:this,x:t,y:i,width:n,height:s,samples:r,oit:o});for(const e of this[qr])this.reshapeTextureBuffer(e,n,s)}},reshapeTextureBuffer(e,t,i){const n=this[e];n&&(t===n.getWidth()&&i===n.getHeight()||(n.dispose(),this[e]=void 0))},resetShapeId(){this[to]=0},getShapeId(){return++this[to]},onfullscreen(){const e=this.getElement();document.fullscreenElement===e[0]?e.addClass("x_ite-fullscreen"):e.removeClass("x_ite-fullscreen")},async xrCheckSupport(){if(!("xr"in navigator))return!1;const e=this.getBrowserOption("XRSessionMode").toLowerCase().replaceAll("_","-");try{return await navigator.xr.isSessionSupported(e)}catch{return!1}},xrUpdateButton(){return zr.acquire(this[io],async()=>{this.getSurface().find(".x_ite-private-xr-button").remove(),await this.xrCheckSupport()&&(await this.loadComponents(this.getComponent("WebXR"),this.getComponent("Geometry2D")),this.xrAddButton())})},xrFrame(){},getSession(){return this[Hr]},setSession(e){this[Hr]=e},getPose:()=>null,dispose(){this[Hr]=window,this[Wr].disconnect(),Gr(window).off(`.X3DRenderingContext-${this.getInstanceId()}`),Gr(document).off(`.X3DRenderingContext-${this.getInstanceId()}`)}});const so=no,ro=s.A.add("X3DRenderingContext",so);function oo(){}Object.assign(oo.prototype,{isExternal(){return!this.getScriptNode()},getScriptNode:()=>null});const ao=oo,lo=s.A.add("X3DScriptingContext",ao),ho=s.A.add("ClipPlanes2.glsl",()=>"\n#if defined(X3D_CLIP_PLANES)\nuniform vec4 x3d_ClipPlane[X3D_NUM_CLIP_PLANES];void clip(){for(int i=0;i<X3D_NUM_CLIP_PLANES;++i){if(dot(vertex,x3d_ClipPlane[i].xyz)-x3d_ClipPlane[i].w<0.)discard;}}\n#endif\n"),co=s.A.add("Fog2.glsl",()=>"\n#if defined(X3D_FOG)\nuniform x3d_FogParameters x3d_Fog;float getFogInterpolant(){\n#if defined(X3D_FOG_COORDS)\nreturn clamp(1.-fogDepth,0.,1.);\n#else\nfloat visibilityStart=x3d_Fog.visibilityStart;float visibilityRange=x3d_Fog.visibilityRange-visibilityStart;float dV=max(length(x3d_Fog.matrix*vertex)-visibilityStart,0.);\n#if defined(X3D_FOG_LINEAR)\nreturn max(visibilityRange-dV,0.)/visibilityRange;\n#elif defined(X3D_FOG_EXPONENTIAL)\nreturn exp(-dV/max(visibilityRange-dV,.001));\n#endif\n#endif\n}vec3 getFogColor(const in vec3 color){return mix(x3d_Fog.color,color,getFogInterpolant());}\n#endif\n"),uo=s.A.add("Fragment2.glsl",()=>`\n#if defined(X3D_ALPHA_MODE_MASK)\nuniform float x3d_AlphaCutoff;\n#endif\n#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS)\nin float fogDepth;\n#endif\n#if defined(X3D_COLOR_MATERIAL)\nin vec4 color;\n#endif\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\nin vec4 texCoord${t};\n#endif\n`).join("\n")}\n#endif\n#else\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\nvec4 texCoord${t} = vec4 (0.0, 0.0, 0.0, 1.0);\n#endif\n`).join("\n")}\n#endif\n#endif\n#if defined(X3D_NORMALS)\nin vec3 normal;\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nin vec3 localNormal;\n#endif\n#if defined(X3D_TANGENTS)\nin mat3 TBN;\n#endif\n#else\nvec3 normal=vec3(0.,0.,1.);\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nvec3 localNormal=vec3(0.,0.,1.);\n#endif\n#endif\nin vec3 vertex;\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nin vec3 localVertex;\n#endif\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\nuniform float x3d_LogarithmicFarFactor1_2;in float depth;\n#endif\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nlayout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1;\n#else\nlayout(location=0)out vec4 x3d_FragColor;\n#endif\nbool frontFacing;\n#pragma X3D include "../pbr/ToneMapping.glsl"\n#pragma X3D include "Texture.glsl"\n#pragma X3D include "Normal.glsl"\n#pragma X3D include "ClipPlanes.glsl"\n#pragma X3D include "Point.glsl"\n#pragma X3D include "Stipple.glsl"\n#pragma X3D include "Hatch.glsl"\n#pragma X3D include "Fog.glsl"\nvec4 getMaterialColor(const in vec4 fragCoord);\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nfloat weight(const in float z,const in float a){return clamp(pow(min(1.,a*10.)+.01,3.)*1e8*pow(1.-z*.9,3.),1e-2,3e3);}\n#endif\nvoid main(){frontFacing=gl_FrontFacing;\n#if!defined(X3D_NORMALS)&&(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))\ngenerateFlatNormals();\n#endif\n#if defined(X3D_CLIP_PLANES)\nclip();\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nstipple(gl_FragCoord);\n#endif\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\nsetPointTexCoords(gl_PointCoord);\n#elif defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nsetTexCoords();\n#endif\nvec4 finalColor=getMaterialColor(gl_FragCoord);\n#if defined(X3D_ALPHA_MODE_OPAQUE)\nfinalColor.a=1.;\n#elif defined(X3D_ALPHA_MODE_MASK)\nif(finalColor.a<x3d_AlphaCutoff)discard;finalColor.a=1.;\n#endif\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\nfinalColor=getPointColor(finalColor,gl_PointCoord);\n#endif\n#if(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))&&defined(X3D_STYLE_PROPERTIES)\nfinalColor=getHatchColor(finalColor,gl_FragCoord);\n#endif\n#if defined(X3D_FOG)\nfinalColor.rgb=getFogColor(finalColor.rgb);\n#endif\n#if!defined(X3D_LINEAR_OUTPUT)\nfinalColor.rgb=toneMap(finalColor.rgb);\n#endif\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nfloat a=finalColor.a;float w=weight(gl_FragCoord.z,a);finalColor.rgb*=a;finalColor*=w;x3d_FragData0=vec4(finalColor.rgb,a);x3d_FragData1=vec4(finalColor.a);\n#else\nx3d_FragColor=finalColor;\n#endif\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\ngl_FragDepth=log2(depth)*x3d_LogarithmicFarFactor1_2;\n#endif\n}`),po=s.A.add("Hatch2.glsl",()=>"\n#if(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))&&defined(X3D_STYLE_PROPERTIES)\nuniform x3d_FillPropertiesParameters x3d_FillProperties;vec4 getHatchColor(const in vec4 color,const in vec4 fragCoord){vec4 finalColor=x3d_FillProperties.filled?color:vec4(0);\n#if defined(X3D_STYLE_PROPERTIES_TEXTURE)\nvec2 t=fragCoord.xy/(32.*x3d_FillProperties.scale);vec4 hatch=texture(x3d_FillProperties.texture,vec2(t.x,1.-t.y));hatch.rgb*=x3d_FillProperties.hatchColor;finalColor=mix(finalColor,hatch,hatch.a);\n#endif\nreturn finalColor;}\n#endif\n"),go=s.A.add("Instancing2.glsl",()=>"\n#if defined(X3D_INSTANCING)\n#if defined(X3D_TEX_COORD_RAMP)\nuniform sampler2D x3d_TexCoordRamp;in vec4 x3d_Particle;vec4 getInstanceTexCoord(const in vec4 texCoord,const in int vertexId){const int map[6]=int[6](0,1,2,0,2,3);int index0=int(x3d_Particle[3]);return texelFetch(x3d_TexCoordRamp,index0+map[vertexId],0);}\n#else\n#define getInstanceTexCoord(texCoord,vertexId)(texCoord)\n#endif\n#if defined(X3D_INSTANCE_NORMAL)\nin mat3 x3d_InstanceNormalMatrix;vec3 getInstanceNormal(const in vec3 normal){return x3d_InstanceNormalMatrix*normal;}\n#else\n#define getInstanceNormal(normal)(normal)\n#endif\nin mat4 x3d_InstanceMatrix;vec4 getInstanceVertex(const in vec4 vertex){return x3d_InstanceMatrix*vertex;}float getInstancePointSize(const in float pointSize){return pointSize*x3d_InstanceMatrix[0].x;}\n#else\n#define getInstanceVertex(vertex)(vertex)\n#define getInstanceNormal(normal)(normal)\n#define getInstanceTexCoord(texCoord,vertexId)(texCoord)\n#define getInstancePointSize(pointSize)(pointSize)\n#endif\n"),fo=s.A.add("Lighting2.glsl",()=>"\n#if defined(X3D_LIGHTING)\nfloat getAttenuation(const in vec3 attenuation,const in float distanceToLight){return 1./max(dot(attenuation,vec3(1.,distanceToLight,distanceToLight*distanceToLight)),1.);}float getSpotFactor(const in vec3 pointToLight,const in vec3 direction,const in float cutOffAngle,const in float beamWidth){float spotAngle=acos(clamp(dot(-pointToLight,direction),-1.,1.));if(spotAngle>=cutOffAngle)return 0.;else if(spotAngle<=beamWidth)return 1.;return(spotAngle-cutOffAngle)/(beamWidth-cutOffAngle);}\n#endif\n"),mo=s.A.add("Line22.glsl",()=>"\nstruct Line2{vec2 point;vec2 direction;};Line2 line2(const in vec2 point1,const in vec2 point2){return Line2(point1,normalize(point2-point1));}vec2 closest_point(const in Line2 line,const in vec2 point){vec2 r=point-line.point;float d=dot(r,line.direction);return line.direction*d+line.point;}"),Ao={names:["x3d_AmbientTexture","x3d_DiffuseTexture","x3d_SpecularTexture","x3d_EmissiveTexture","x3d_ShininessTexture","x3d_BaseTexture","x3d_MetallicRoughnessTexture","x3d_OcclusionTexture","x3d_NormalTexture"],add(e){this.names.push(e)},texture(e,t="rgba",i=""){const n=!!e.match(/EXT$/);e=e.replace(/EXT$/,"");const s=["","float","vec2","vec3","vec4"][t.length],r=e.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase(),o=n?"EXT":"",a=n?"_EXT":"";return`\n#if defined(${r}${a})\nuniform ${e}Parameters${o}\n${e}${o};\n${s}\nget${e.replace(/^x3d_/g,"")}${o} (){vec3 texCoord=getTexCoord(${e}${o} .textureTransformMapping,${e}${o} .textureCoordinateMapping);\n#if defined(${r}${a}_FLIP_Y)\ntexCoord.y=1.-texCoord.y;\n#endif\n#if defined(${r}${a}_2D)\nvec4 textureColor=texture(${e}${o} .texture2D,texCoord.st);\n#elif defined(${r}${a}_3D)\nvec4 textureColor=texture(${e}${o} .texture3D,texCoord);\n#elif defined(${r}${a}_CUBE)\nvec4 textureColor=texture(${e}${o} .textureCube,texCoord);\n#endif\n${s}\ntextureColorComponents=textureColor.${t};\n#if defined(X3D_COLORSPACE_SRGB)\n#if defined(${r}${a}_LINEAR)\n#if ${"sRGB"===i||"linear"===i?1:0}\ntextureColorComponents=linearToSRGB(textureColorComponents);\n#endif\n#endif\n#elif defined(X3D_COLORSPACE_LINEAR)\n#if!defined(${r}${a}_LINEAR)\n#if ${"sRGB"===i||"linear"===i?1:0}\ntextureColorComponents=sRGBToLinear(textureColorComponents);\n#endif\n#endif\n#endif\nreturn textureColorComponents;}\n#endif\n`},structs(){return this.names.map(e=>{const t=e.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase();return`\n#if defined(${t})\nstruct ${e.replace(/(EXT)?$/,"Parameters$1")}\n{mediump int textureTransformMapping;mediump int textureCoordinateMapping;\n#if defined(${t}_2D)\nmediump sampler2D texture2D;\n#endif\n#if defined(${t}_3D)\nmediump sampler3D texture3D;\n#endif\n#if defined(${t}_CUBE)\nmediump samplerCube textureCube;\n#endif\n};\n#endif\n`}).join("\n")}},_o=s.A.add("MaterialTextures",Ao),yo=s.A.add("Material2.glsl",()=>`\n#pragma X3D include "Fragment.glsl"\nuniform x3d_MaterialParameters x3d_Material;\n#if defined(X3D_LIGHTING)\n${_o.texture("x3d_AmbientTexture","rgb","sRGB")}\nvec3 getAmbientColor(const in vec3 diffuseColor){vec3 ambientColor=x3d_Material.ambientIntensity*diffuseColor;\n#if defined(X3D_AMBIENT_TEXTURE)\nambientColor*=getAmbientTexture();\n#endif\nreturn ambientColor;}\n#endif\n${_o.texture("x3d_DiffuseTexture","rgba","sRGB")}\nvec4 getDiffuseColor(){float alpha=1.-x3d_Material.transparency;\n#if defined(X3D_COLOR_MATERIAL)\nvec4 diffuseColor=vec4(color.rgb,color.a*alpha);\n#else\nvec4 diffuseColor=vec4(x3d_Material.diffuseColor,alpha);\n#endif\n#if defined(X3D_DIFFUSE_TEXTURE)\ndiffuseColor*=getDiffuseTexture();\n#elif defined(X3D_TEXTURE)\ndiffuseColor=getTextureColor(diffuseColor,vec4(x3d_Material.specularColor,alpha));\n#endif\nreturn diffuseColor;}\n#if defined(X3D_LIGHTING)\n${_o.texture("x3d_SpecularTexture","rgb","sRGB")}\nvec3 getSpecularColor(){vec3 specularColor=x3d_Material.specularColor;\n#if defined(X3D_SPECULAR_TEXTURE)\nspecularColor*=getSpecularTexture();\n#endif\nreturn specularColor;}\n#endif\n${_o.texture("x3d_EmissiveTexture","rgb","sRGB")}\nvec3 getEmissiveColor(){vec3 emissiveColor=x3d_Material.emissiveColor;\n#if defined(X3D_EMISSIVE_TEXTURE)\nemissiveColor*=getEmissiveTexture();\n#endif\nreturn emissiveColor;}\n#if defined(X3D_LIGHTING)\n${_o.texture("x3d_ShininessTexture","a")}\nfloat getShininessFactor(){float shininess=x3d_Material.shininess;\n#if defined(X3D_SHININESS_TEXTURE)\nshininess*=getShininessTexture();\n#endif\nreturn shininess;}\n#endif\n${_o.texture("x3d_OcclusionTexture","r")}\nfloat getOcclusionFactor(){\n#if defined(X3D_OCCLUSION_TEXTURE)\nreturn getOcclusionTexture();\n#else\nreturn 1.;\n#endif\n}\n#if defined(X3D_LIGHTING)\n#pragma X3D include "Lighting.glsl"\n#pragma X3D include "Shadow.glsl"\nuniform x3d_LightSourceParameters x3d_LightSource[X3D_NUM_LIGHTS];vec3 getMaterialColor(const in vec3 vertex,const in vec3 N,const in vec3 ambientColor,const in vec3 diffuseColor,const in vec3 specularColor,const in float shininess){vec3 V=normalize(-vertex);vec3 finalColor=vec3(0);for(int i=0;i<X3D_NUM_LIGHTS;++i){x3d_LightSourceParameters light=x3d_LightSource[i];vec3 vL=light.location-vertex;float dL=length(light.matrix*vL);if(dL<=light.radius||light.radius<0.){bool di=light.type==x3d_DirectionalLight;vec3 d=light.direction;vec3 c=light.attenuation;vec3 L=di?-d:normalize(vL);vec3 H=normalize(L+V);float lightAngle=max(dot(N,L),0.);vec3 diffuseTerm=diffuseColor*lightAngle;float specularFactor=shininess>0.?pow(max(dot(N,H),0.),shininess*128.):1.;vec3 specularTerm=specularColor*specularFactor;float attenuationFactor=di?1.:getAttenuation(c,dL);float spotFactor=light.type==x3d_SpotLight?getSpotFactor(L,d,light.cutOffAngle,light.beamWidth):1.;float attenuationSpotFactor=attenuationFactor*spotFactor;vec3 ambientTerm=light.ambientIntensity*ambientColor;vec3 diffuseSpecularTerm=light.intensity*(diffuseTerm+specularTerm);\n#if defined(X3D_SHADOWS)\nif(lightAngle>0.)diffuseSpecularTerm=mix(diffuseSpecularTerm,light.shadowColor,getShadowIntensity(i,light));\n#endif\nfinalColor+=attenuationSpotFactor*light.color*(ambientTerm+diffuseSpecularTerm);}}return finalColor;}\n#endif\n#if defined(X3D_GOURAUD_MATERIAL)\nvec4 getMaterialColor(const in vec4 fragCoord){float alpha=1.-x3d_Material.transparency;\n#if defined(X3D_COLOR_MATERIAL)\nvec3 diffuseColor=color.rgb;alpha*=color.a;\n#else\nvec3 diffuseColor=x3d_Material.diffuseColor;\n#endif\n#if defined(X3D_LIGHTING)\nvec3 ambientColor=getAmbientColor(diffuseColor);vec3 specularColor=getSpecularColor();float shininess=getShininessFactor();float normalScale=x3d_Material.normalScale;vec4 finalColor=vec4(getMaterialColor(vertex,getNormalVector(normalScale),ambientColor,diffuseColor,specularColor,shininess),alpha);\n#else\nvec4 finalColor=vec4(vec3(0),alpha);\n#endif\n#if defined(X3D_OCCLUSION_TEXTURE)\nfinalColor=mix(finalColor,finalColor*getOcclusionFactor(),x3d_Material.occlusionStrength);\n#endif\nfinalColor.rgb+=getEmissiveColor();\n#if defined(X3D_DIFFUSE_TEXTURE)\nfinalColor*=getDiffuseTexture();\n#elif defined(X3D_TEXTURE)\nfinalColor=getTextureColor(finalColor,vec4(x3d_Material.specularColor,alpha));\n#endif\n#if defined(X3D_TEXTURE_PROJECTION)\ndiffuseColor*=getTextureProjectorColor();\n#endif\nreturn finalColor;}\n#endif\n#if defined(X3D_PHONG_MATERIAL)\nvec4 getMaterialColor(const in vec4 fragCoord){vec4 diffuseColorAlpha=getDiffuseColor();float alpha=diffuseColorAlpha.a;vec3 diffuseColor=diffuseColorAlpha.rgb;\n#if defined(X3D_TEXTURE_PROJECTION)\ndiffuseColor*=getTextureProjectorColor();\n#endif\n#if defined(X3D_LIGHTING)\nvec3 ambientColor=getAmbientColor(diffuseColor);vec3 specularColor=getSpecularColor();float shininess=getShininessFactor();float normalScale=x3d_Material.normalScale;vec3 finalColor=getMaterialColor(vertex,getNormalVector(normalScale),ambientColor,diffuseColor,specularColor,shininess);\n#else\nvec3 finalColor=vec3(0);\n#endif\n#if defined(X3D_OCCLUSION_TEXTURE)\nfinalColor=mix(finalColor,finalColor*getOcclusionFactor(),x3d_Material.occlusionStrength);\n#endif\nfinalColor+=getEmissiveColor();return vec4(finalColor,alpha);}\n#endif\n`),wo=s.A.add("Normal2.glsl",()=>"\n#if!defined(X3D_NORMALS)&&(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))\nvec3 generateFlatNormal(const in vec3 vertex){vec3 dFdxPos=dFdx(vertex);vec3 dFdyPos=dFdy(vertex);return normalize(cross(dFdxPos,dFdyPos));}void generateFlatNormals(){normal=generateFlatNormal(vertex);\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nlocalNormal=generateFlatNormal(localVertex);\n#endif\n}\n#endif\n#if defined(X3D_LIGHTING)||defined(X3D_USE_IBL)||defined(X3D_ANISOTROPY_MATERIAL_EXT)||defined(X3D_CLEARCOAT_MATERIAL_EXT)\nstruct NormalInfo{vec3 ng;vec3 ntex;vec3 n;vec3 t;vec3 b;};\n#if defined(X3D_NORMAL_TEXTURE)\nuniform x3d_NormalTextureParameters x3d_NormalTexture;\n#endif\nNormalInfo getNormalInfo(const in float normalScale){\n#if defined(X3D_NORMAL_TEXTURE)\nvec3 UV=getTexCoord(x3d_NormalTexture.textureTransformMapping,x3d_NormalTexture.textureCoordinateMapping);\n#if defined(X3D_NORMAL_TEXTURE_FLIP_Y)\nUV.y=1.-UV.y;\n#endif\n#else\nvec3 UV=vertex;\n#endif\nvec3 n,t,b,ng;\n#if defined(X3D_NORMALS)&&defined(X3D_TANGENTS)\nt=normalize(TBN[0]);b=normalize(TBN[1]);ng=normalize(TBN[2]);\n#else\nvec2 uv_dx=dFdx(UV.st);vec2 uv_dy=dFdy(UV.st);if(length(uv_dx)<=1e-2)uv_dx=vec2(1.,0.);if(length(uv_dy)<=1e-2)uv_dy=vec2(0.,1.);vec3 t_=(uv_dy.t*dFdx(vertex)-uv_dx.t*dFdy(vertex))/(uv_dx.s*uv_dy.t-uv_dy.s*uv_dx.t);ng=normalize(normal);t=normalize(t_-ng*dot(ng,t_));b=cross(ng,t);\n#endif\n#if defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D)\nif(frontFacing==false){t=-t;b=-b;ng=-ng;}\n#endif\nNormalInfo info;info.ng=ng;\n#if defined(X3D_NORMAL_TEXTURE)\n#if defined(X3D_NORMAL_TEXTURE_2D)\nvec3 ntex=texture(x3d_NormalTexture.texture2D,UV.st).rgb;\n#elif defined(X3D_NORMAL_TEXTURE_3D)\nvec3 ntex=texture(x3d_NormalTexture.texture3D,UV).rgb;\n#elif defined(X3D_NORMAL_TEXTURE_CUBE)\nvec3 ntex=texture(x3d_NormalTexture.textureCube,UV).rgb;\n#endif\nntex=ntex*2.-vec3(1);ntex*=vec3(vec2(normalScale),1.);ntex=normalize(ntex);info.ntex=ntex;info.n=normalize(mat3(t,b,ng)*ntex);\n#else\ninfo.n=ng;\n#endif\ninfo.t=t;info.b=b;return info;}\n#endif\n#if defined(X3D_LIGHTING)\nvec3 getNormalVector(const in float normalScale){return getNormalInfo(normalScale).n;}\n#endif\n"),xo=s.A.add("Perlin2.glsl",()=>"\nfloat rand(const in vec2 co){return fract(sin(dot(co.xy,vec2(12.9898,78.233)))*43758.5453);}float rand(const in vec2 co,const in float l){return rand(vec2(rand(co),l));}float rand(const in vec2 co,const in float l,const in float t){return rand(vec2(rand(co,l),t));}float perlin(const in vec2 p,const in float dim,const in float time){const float M_PI=3.14159265358979323846;vec2 pos=floor(p*dim);vec2 posx=pos+vec2(1.,0.);vec2 posy=pos+vec2(0.,1.);vec2 posxy=pos+vec2(1);float c=rand(pos,dim,time);float cx=rand(posx,dim,time);float cy=rand(posy,dim,time);float cxy=rand(posxy,dim,time);vec2 d=fract(p*dim);d=-.5*cos(d*M_PI)+.5;float ccx=mix(c,cx,d.x);float cycxy=mix(cy,cxy,d.x);float center=mix(ccx,cycxy,d.y);return center*2.-1.;}vec3 perlin(const in vec3 p){return vec3(perlin(p.xy,1.,0.),perlin(p.yz,1.,0.),perlin(p.zx,1.,0.));}"),bo=s.A.add("Point2.glsl",()=>`\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n#if!defined(X3D_DEPTH_SHADER)\nvoid setPointTexCoords(const in vec2 pointCoord){vec4 texCoord=vec4(pointCoord.x,1.-pointCoord.y,0.,1.);\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\ntexCoords [${t}] = texCoord;\n#endif\n`).join("\n")}\n}\n#endif\n#define getPointColor(color,pointCoord)(color)\n#else\nin float pointSize;\n#define setPointTexCoords(pointCoord)\nvec4 getPointColor(in vec4 color,const in vec2 pointCoord){if(pointSize>1.)color.a*=clamp(pointSize*(.5-distance(vec2(.5),pointCoord)),0.,1.);else color.a*=pointSize;return color;}\n#endif\n#endif\n`),So=s.A.add("PointSize2.glsl",()=>"\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\nuniform x3d_PointPropertiesParameters x3d_PointProperties;out float pointSize;float getPointSize(const in vec3 vertex){float pointSizeMinValue=x3d_PointProperties.pointSizeMinValue;float pointSizeMaxValue=x3d_PointProperties.pointSizeMaxValue;vec3 attenuation=x3d_PointProperties.attenuation;float dL=length(vertex);float pointSize=0.;pointSize=x3d_PointProperties.pointSizeScaleFactor;pointSize/=dot(attenuation,vec3(1.,dL,dL*dL));pointSize=clamp(pointSize,pointSizeMinValue,pointSizeMaxValue);\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURE)\nreturn pointSize;\n#else\nreturn pointSize+1.-step(pointSize,1.);\n#endif\n}\n#endif\n"),To=s.A.add("Shadow2.glsl",()=>`\n#if defined(X3D_SHADOWS)\nuniform sampler2D x3d_ShadowMap[X3D_NUM_LIGHTS];float getShadowDepth(const in int index,const in vec2 shadowCoord){switch(index){\n${Array.from({length:8},(e,t)=>`\n#if X3D_NUM_LIGHTS > ${t}\ncase ${t}:\nreturn texture (x3d_ShadowMap [${t}], shadowCoord) .r;\n#endif\n`).join("\n")}\n}return 0.;}float texture2DCompare(const in int index,const in vec2 texCoord,const in float compare){float shadowDepth=getShadowDepth(index,texCoord);return(1.-step(1.,shadowDepth))*step(shadowDepth,compare);}float texture2DShadowLerp(const in int index,const in vec2 texelSize,const in float shadowMapSize,const in vec2 texCoord,const in float compare){const vec2 offset=vec2(0.,1.);vec2 centroidTexCoord=floor(texCoord*shadowMapSize+.5)/shadowMapSize;float lb=texture2DCompare(index,centroidTexCoord+texelSize*offset.xx,compare);float lt=texture2DCompare(index,centroidTexCoord+texelSize*offset.xy,compare);float rb=texture2DCompare(index,centroidTexCoord+texelSize*offset.yx,compare);float rt=texture2DCompare(index,centroidTexCoord+texelSize*offset.yy,compare);vec2 f=fract(texCoord*shadowMapSize+.5);float a=mix(lb,lt,f.y);float b=mix(rb,rt,f.y);float c=mix(a,b,f.x);return c;}vec2 cubeToUVCompact(in vec3 v,const float texelSizeY){vec3 absV=abs(v);float scaleToCube=1./max(absV.x,max(absV.y,absV.z));absV*=scaleToCube;v*=scaleToCube*(1.-2.*texelSizeY);vec2 planar=v.xy;float almostATexel=1.5*texelSizeY;float almostOne=1.-almostATexel;if(absV.z>=almostOne){if(v.z>0.)planar.x=4.-v.x;}else if(absV.x>=almostOne){float signX=sign(v.x);planar.x=v.z*signX+2.*signX;}else if(absV.y>=almostOne){float signY=sign(v.y);planar.x=(v.x+.5+signY)*2.;planar.y=v.z*signY-2.;}return vec2(.125,.25)*planar+vec2(.375,.75);}mat4 getPointLightRotations(const in vec3 vector){const mat4 rotations[6]=mat4[6](mat4(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1),mat4(0,0,-1,0,0,1,0,0,1,0,0,0,0,0,0,1),mat4(-1,0,0,0,0,1,0,0,0,0,-1,0,0,0,0,1),mat4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),mat4(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),mat4(1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1));vec3 a=abs(vector.xyz);if(a.x>a.y){if(a.x>a.z)return vector.x>0.?rotations[1]:rotations[0];else return vector.z>0.?rotations[2]:rotations[3];}else{if(a.y>a.z)return vector.y>0.?rotations[5]:rotations[4];else return vector.z>0.?rotations[2]:rotations[3];}return rotations[3];}float getShadowIntensity(const in int index,const in x3d_LightSourceParameters light){if(light.type==x3d_PointLight){const mat4 biasMatrix=mat4(.5,0.,0.,0.,0.,.5,0.,0.,0.,0.,.5,0.,.5,.5,.5,1.);const mat4 projectionMatrix=mat4(1.,0.,0.,0.,0.,.5,0.,0.,0.,0.,-1.000025000312504,-1.,0,0.,-.25000312503906297,0.);vec2 texelSize=vec2(1)/(float(light.shadowMapSize)*vec2(4.,2.));vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.);vec3 lightToPosition=shadowCoord.xyz;shadowCoord=biasMatrix*(projectionMatrix*(getPointLightRotations(lightToPosition)*shadowCoord));shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;\n#if defined(X3D_PCF_FILTERING)||defined(X3D_PCF_SOFT_FILTERING)\nvec2 offset=vec2(-1,1)*(texelSize.y*42.);float value=(texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xyy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yyy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xyx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yyx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xxy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yxy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xxx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yxx,texelSize.y),shadowCoord.z))*(1./9.);return light.shadowIntensity*value;\n#else\nfloat value=texture2DCompare(index,cubeToUVCompact(lightToPosition,texelSize.y),shadowCoord.z);return light.shadowIntensity*value;\n#endif\n}else{\n#if defined(X3D_PCF_FILTERING)\nvec2 texelSize=vec2(1)/vec2(light.shadowMapSize);vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-.5),vec2(.5))))return 0.;vec2 d0=-texelSize;vec2 d1=texelSize;float value=(texture2DCompare(index,shadowCoord.xy+d0,shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(0.,d0.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d1.x,d0.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d0.x,0.),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy,shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d1.x,0.),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d0.x,d1.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(0.,d1.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+d1,shadowCoord.z))*(1./9.);return light.shadowIntensity*value;\n#elif defined(X3D_PCF_SOFT_FILTERING)\nvec2 texelSize=vec2(1)/vec2(light.shadowMapSize);vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-.5),vec2(.5))))return 0.;vec2 d0=-texelSize;vec2 d1=texelSize;float value=(texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+d0,shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(0.,d0.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d1.x,d0.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d0.x,0.),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy,shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d1.x,0.),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d0.x,d1.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(0.,d1.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+d1,shadowCoord.z))*(1./9.);return light.shadowIntensity*value;\n#else\nvec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-.5),vec2(.5))))return 0.;float value=texture2DCompare(index,shadowCoord.xy,shadowCoord.z);return light.shadowIntensity*value;\n#endif\n}return 0.;}\n#endif\n`),vo=s.A.add("Stipple2.glsl",()=>'\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\n#pragma X3D include "Line2.glsl"\nuniform x3d_LinePropertiesParameters x3d_LineProperties;flat in float lengthSoFar;flat in vec2 startPoint;in vec2 midPoint;void stipple(const in vec4 fragCoord){vec2 point=closest_point(line2(startPoint,midPoint),fragCoord.xy);float s=(lengthSoFar+length(point-startPoint))*x3d_LineProperties.lineStippleScale;\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n#if X3D_NUM_TEXTURE_COORDINATES>0\ntexCoord0=vec4(s,0.,0.,1.);\n#endif\n#if X3D_NUM_TEXTURE_COORDINATES>1\ntexCoord1=vec4(s,0.,0.,1.);\n#endif\n#endif\n#if defined(X3D_STYLE_PROPERTIES_TEXTURE)\nif(x3d_LineProperties.linetype==16)return;int linetype=x3d_LineProperties.linetype;int height=textureSize(x3d_LineProperties.texture,0).y;float t=1.-float(linetype*2+1)/float(height*2);float alpha=texture(x3d_LineProperties.texture,vec2(s,1.-t)).a;if(alpha!=1.)discard;\n#endif\n}\n#endif\n'),Oo=s.A.add("Texture2.glsl",()=>`\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n#pragma X3D include "Perlin.glsl"\nvec4 texCoords[X3D_NUM_TEXTURE_COORDINATES];void setTexCoords(){\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\ntexCoords [${t}] = texCoord${t};\n#endif\n`).join("\n")}\n}uniform mat4 x3d_TextureMatrix[X3D_NUM_TEXTURE_TRANSFORMS];uniform x3d_TextureCoordinateGeneratorParameters x3d_TextureCoordinateGenerator[X3D_NUM_TEXTURE_COORDINATES];vec4 getTexCoord(const in int textureCoordinateMapping){x3d_TextureCoordinateGeneratorParameters textureCoordinateGenerator=x3d_TextureCoordinateGenerator[textureCoordinateMapping];switch(textureCoordinateGenerator.mode){case x3d_Sphere:{\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec2 N=normalize(normal).xy;\n#else\nvec2 N=normalize(frontFacing?normal:-normal).xy;\n#endif\nreturn vec4(N*.5+.5,0.,1.);}case x3d_CameraSpaceNormal:{\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec3 N=normalize(normal);\n#else\nvec3 N=normalize(frontFacing?normal:-normal);\n#endif\nreturn vec4(N,1.);}case x3d_CameraSpacePosition:{return vec4(vertex,1.);}case x3d_CameraSpaceReflectionVector:{\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec3 N=normalize(normal);\n#else\nvec3 N=normalize(frontFacing?normal:-normal);\n#endif\nreturn vec4(reflect(normalize(vertex),-N),1.);}case x3d_SphereLocal:{\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec2 N=normalize(localNormal).xy;\n#else\nvec2 N=normalize(frontFacing?localNormal:-localNormal).xy;\n#endif\nreturn vec4(N*.5+.5,0.,1.);}case x3d_Coord:{return vec4(localVertex,1.);}case x3d_CoordEye:{return vec4(vertex,1.);}case x3d_Noise:{vec3 scale=vec3(textureCoordinateGenerator.parameter[0],textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2]);vec3 translation=vec3(textureCoordinateGenerator.parameter[3],textureCoordinateGenerator.parameter[4],textureCoordinateGenerator.parameter[5]);return vec4(perlin(localVertex*scale+translation),1.);}case x3d_NoiseEye:{vec3 scale=vec3(textureCoordinateGenerator.parameter[0],textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2]);vec3 translation=vec3(textureCoordinateGenerator.parameter[3],textureCoordinateGenerator.parameter[4],textureCoordinateGenerator.parameter[5]);return vec4(perlin(vertex*scale+translation),1.);}case x3d_SphereReflect:{\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec3 N=normalize(normal);\n#else\nvec3 N=normalize(frontFacing?normal:-normal);\n#endif\nfloat eta=textureCoordinateGenerator.parameter[0];return vec4(refract(normalize(vertex),-N,eta),1.);}case x3d_SphereReflectLocal:{\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec3 N=normalize(localNormal);\n#else\nvec3 N=normalize(frontFacing?localNormal:-localNormal);\n#endif\nfloat eta=textureCoordinateGenerator.parameter[0];vec3 eye=vec3(textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2],textureCoordinateGenerator.parameter[3]);return vec4(refract(normalize(localVertex-eye),-N,eta),1.);}default:{return texCoords[textureCoordinateMapping];}}}vec3 getTexCoord(const in int textureTransformMapping,const in int textureCoordinateMapping){vec4 texCoord=getTexCoord(textureCoordinateMapping);\n#if defined(X3D_GEOMETRY_2D)\nif(frontFacing==false)texCoord.x=1.-texCoord.x;\n#endif\ntexCoord=x3d_TextureMatrix[textureTransformMapping]*texCoord;texCoord.stp/=texCoord.q;return texCoord.stp;}\n#endif\n#if defined(X3D_TEXTURE)\nuniform sampler2D x3d_Texture2D[X3D_NUM_TEXTURES];uniform sampler3D x3d_Texture3D[X3D_NUM_TEXTURES];uniform samplerCube x3d_TextureCube[X3D_NUM_TEXTURES];vec4 getTexture(const in int i,const in int textureTransformMapping,const in int textureCoordinateMapping){vec4 textureColor=vec4(1);switch(i){\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURES > ${t}\ncase ${t}:\n{\nvec3 texCoord = getTexCoord (textureTransformMapping, textureCoordinateMapping);\n#if defined (X3D_TEXTURE_${t}_FLIP_Y)\n// Flip Y if needed. Must be done after.\ntexCoord .y = 1.0 - texCoord .y;\n#endif\n#if defined (X3D_TEXTURE_${t}_2D)\ntextureColor = texture (x3d_Texture2D [${t}], texCoord .st);\n#elif defined (X3D_TEXTURE_${t}_3D)\ntextureColor = texture (x3d_Texture3D [${t}], texCoord .stp);\n#elif defined (X3D_TEXTURE_${t}_CUBE)\ntextureColor = texture (x3d_TextureCube [${t}], texCoord .stp);\n#endif\n#if defined (X3D_COLORSPACE_SRGB)\n#if defined (X3D_TEXTURE_${t}_LINEAR)\ntextureColor = linearToSRGB (textureColor);\n#endif\n#elif defined (X3D_COLORSPACE_LINEAR)\n#if !defined (X3D_TEXTURE_${t}_LINEAR)\ntextureColor = sRGBToLinear (textureColor);\n#endif\n#endif\nbreak;\n}\n#endif\n`).join("\n")}\n}return textureColor;}\n#if defined(X3D_MULTI_TEXTURING)\nuniform vec4 x3d_MultiTextureColor;uniform x3d_MultiTextureParameters x3d_MultiTexture[X3D_NUM_TEXTURES];\n#endif\nvec4 getTextureColor(const in vec4 diffuseColor,const in vec4 specularColor){\n#if defined(X3D_MULTI_TEXTURING)\nvec4 currentColor=diffuseColor;for(int i=0;i<X3D_NUM_TEXTURES;++i){vec4 textureColor=getTexture(i,min(i,X3D_NUM_TEXTURE_TRANSFORMS-1),min(i,X3D_NUM_TEXTURE_COORDINATES-1));x3d_MultiTextureParameters multiTexture=x3d_MultiTexture[i];vec4 arg1=textureColor;vec4 arg2=currentColor;int source=multiTexture.source;switch(source){case x3d_Diffuse:{arg1=diffuseColor;break;}case x3d_Specular:{arg1=specularColor;break;}case x3d_Factor:{arg1=x3d_MultiTextureColor;break;}}int function=multiTexture.function;switch(function){case x3d_Complement:{arg1=1.-arg1;break;}case x3d_AlphaReplicate:{arg1.a=arg2.a;break;}}int mode=multiTexture.mode;int alphaMode=multiTexture.alphaMode;switch(mode){case x3d_Replace:{currentColor.rgb=arg1.rgb;break;}case x3d_Modulate:{currentColor.rgb=arg1.rgb*arg2.rgb;break;}case x3d_Modulate2X:{currentColor.rgb=(arg1.rgb*arg2.rgb)*2.;break;}case x3d_Modulate4X:{currentColor.rgb=(arg1.rgb*arg2.rgb)*4.;break;}case x3d_Add:{currentColor.rgb=arg1.rgb+arg2.rgb;break;}case x3d_AddSigned:{currentColor.rgb=arg1.rgb+arg2.rgb-.5;break;}case x3d_AddSigned2X:{currentColor.rgb=(arg1.rgb+arg2.rgb-.5)*2.;break;}case x3d_AddSmooth:{currentColor.rgb=arg1.rgb+(1.-arg1.rgb)*arg2.rgb;break;}case x3d_Subtract:{currentColor.rgb=arg1.rgb-arg2.rgb;break;}case x3d_BlendDiffuseAlpha:{currentColor.rgb=arg1.rgb*diffuseColor.a+arg2.rgb*(1.-diffuseColor.a);break;}case x3d_BlendTextureAlpha:{currentColor.rgb=arg1.rgb*arg1.a+arg2.rgb*(1.-arg1.a);break;}case x3d_BlendFactorAlpha:{currentColor.rgb=arg1.rgb*x3d_MultiTextureColor.a+arg2.rgb*(1.-x3d_MultiTextureColor.a);break;}case x3d_BlendCurrentAlpha:{currentColor.rgb=arg1.rgb*arg2.a+arg2.rgb*(1.-arg2.a);break;}case x3d_ModulateAlphaAddColor:{currentColor.rgb=arg1.rgb+arg1.a*arg2.rgb;break;}case x3d_ModulateInvAlphaAddColor:{currentColor.rgb=(1.-arg1.a)*arg2.rgb+arg1.rgb;break;}case x3d_ModulateInvColorAddAlpha:{currentColor.rgb=(1.-arg1.rgb)*arg2.rgb+arg1.a;break;}case x3d_DotProduct3:{currentColor.rgb=vec3(dot(arg1.rgb*2.-1.,arg2.rgb*2.-1.));break;}case x3d_SelectArg1:{currentColor.rgb=arg1.rgb;break;}case x3d_SelectArg2:{currentColor.rgb=arg2.rgb;break;}case x3d_Off:{break;}}switch(alphaMode){case x3d_Replace:{currentColor.a=arg1.a;break;}case x3d_Modulate:{currentColor.a=arg1.a*arg2.a;break;}case x3d_Modulate2X:{currentColor.a=(arg1.a*arg2.a)*2.;break;}case x3d_Modulate4X:{currentColor.a=(arg1.a*arg2.a)*4.;break;}case x3d_Add:{currentColor.a=arg1.a+arg2.a;break;}case x3d_AddSigned:{currentColor.a=arg1.a+arg2.a-.5;break;}case x3d_AddSigned2X:{currentColor.a=(arg1.a+arg2.a-.5)*2.;break;}case x3d_AddSmooth:{currentColor.a=arg1.a+(1.-arg1.a)*arg2.a;break;}case x3d_Subtract:{currentColor.a=arg1.a-arg2.a;break;}case x3d_BlendDiffuseAlpha:{currentColor.a=arg1.a*diffuseColor.a+arg2.a*(1.-diffuseColor.a);break;}case x3d_BlendTextureAlpha:{currentColor.a=arg1.a*arg1.a+arg2.a*(1.-arg1.a);break;}case x3d_BlendFactorAlpha:{currentColor.a=arg1.a*x3d_MultiTextureColor.a+arg2.a*(1.-x3d_MultiTextureColor.a);break;}case x3d_BlendCurrentAlpha:{currentColor.a=arg1.a*arg2.a+arg2.a*(1.-arg2.a);break;}case x3d_ModulateAlphaAddColor:{currentColor.a=arg1.a+arg1.a*arg2.a;break;}case x3d_ModulateInvAlphaAddColor:{currentColor.a=(1.-arg1.a)*arg2.a+arg1.a;break;}case x3d_ModulateInvColorAddAlpha:{currentColor.a=(1.-arg1.a)*arg2.a+arg1.a;break;}case x3d_DotProduct3:{currentColor.a=dot(arg1.rgb*2.-1.,arg2.rgb*2.-1.);break;}case x3d_SelectArg1:{currentColor.a=arg1.a;break;}case x3d_SelectArg2:{currentColor.a=arg2.a;break;}case x3d_Off:{break;}}}return currentColor;\n#else\nreturn diffuseColor*getTexture(0,0,0);\n#endif\n}\n#endif\n#if defined(X3D_TEXTURE_PROJECTION)\nuniform x3d_TextureProjectorParameters x3d_TextureProjector[X3D_NUM_TEXTURE_PROJECTORS];uniform sampler2D x3d_TextureProjectorTexture[X3D_NUM_TEXTURE_PROJECTORS];vec4 getTextureProjectorTexture(const in int i,const in vec2 texCoord){vec4 textureColor=vec4(1);switch(i){\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_PROJECTORS > ${t}\ncase ${t}:\ntextureColor = texture (x3d_TextureProjectorTexture [${t}], texCoord);\n#if defined (X3D_COLORSPACE_SRGB)\n#if defined (X3D_TEXTURE_PROJECTOR_${t}_LINEAR)\ntextureColor = linearToSRGB (textureColor);\n#endif\n#elif defined (X3D_COLORSPACE_LINEAR)\n#if !defined (X3D_TEXTURE_PROJECTOR_${t}_LINEAR)\ntextureColor = sRGBToLinear (textureColor);\n#endif\n#endif\nbreak;\n#endif\n`).join("\n")}\n}return textureColor;}vec3 getTextureProjectorColor(){vec3 currentColor=vec3(1);\n#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D)\nvec3 N=normal;\n#else\nvec3 N=frontFacing?normal:-normal;\n#endif\nfor(int i=0;i<X3D_NUM_TEXTURE_PROJECTORS;++i){x3d_TextureProjectorParameters textureProjector=x3d_TextureProjector[i];vec4 texCoord=textureProjector.matrix*vec4(vertex,1.);texCoord.stp/=texCoord.q;texCoord.p=clamp(texCoord.p,textureProjector.params.x,textureProjector.params.y);if(any(greaterThan(abs(texCoord.stp-.5),vec3(.5))))continue;vec3 p=textureProjector.location-vertex;if(dot(N,p)<0.)continue;vec4 T=getTextureProjectorTexture(i,texCoord.st);currentColor*=mix(vec3(1),T.rgb*textureProjector.color,T.a*textureProjector.intensity);}return currentColor;}\n#endif\n`),Eo=s.A.add("Unlit2.glsl",()=>`\n#pragma X3D include "Fragment.glsl"\nuniform x3d_UnlitMaterialParameters x3d_Material;\n${_o.texture("x3d_EmissiveTexture","rgba","sRGB")}\nvec4 getEmissiveColor(){float alpha=1.-x3d_Material.transparency;\n#if defined(X3D_COLOR_MATERIAL)\nvec4 emissiveColor=vec4(color.rgb,color.a*alpha);\n#else\nvec4 emissiveColor=vec4(x3d_Material.emissiveColor,alpha);\n#endif\n#if defined(X3D_EMISSIVE_TEXTURE)\nemissiveColor*=getEmissiveTexture();\n#elif defined(X3D_TEXTURE)\nemissiveColor=getTextureColor(emissiveColor,vec4(vec3(1),alpha));\n#endif\nreturn emissiveColor;}vec4 getMaterialColor(const in vec4 fragCoord){vec4 finalColor=getEmissiveColor();\n#if defined(X3D_TEXTURE_PROJECTION)\nfinalColor.rgb*=getTextureProjectorColor();\n#endif\nreturn finalColor;}`),No=s.A.add("Utils2.glsl",()=>"\n#if defined(X3D_SKINNING)||defined(X3D_INSTANCING)\nvec4 texelFetch(const in sampler2D _sampler,const in int index,const in int lod){int x=textureSize(_sampler,lod).x;ivec2 p=ivec2(index % x,index/x);vec4 t=texelFetch(_sampler,p,lod);return t;}\n#endif\n#if!defined(X3D_SKINNING)\n#define getSkinVertex(vertex,normal,tangent)(vertex)\n#define getSkinNormal(normal)(normal)\n#define getSkinTangent(tangent)(tangent)\n#endif\n"),Co=s.A.add("Vertex2.glsl",()=>`\nuniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;\n#if defined(X3D_XR_SESSION)\nuniform mat4 x3d_EyeMatrix;\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nin vec3 x3d_LineStipple;\n#endif\n#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS)\nin float x3d_FogDepth;\n#endif\n#if defined(X3D_COLOR_MATERIAL)\nin vec4 x3d_Color;\n#endif\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\nin vec4 x3d_TexCoord${t};\n#endif\n`).join("\n")}\n#endif\n#endif\nin vec4 x3d_Vertex;\n#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS)\nout float fogDepth;\n#endif\n#if defined(X3D_COLOR_MATERIAL)\nout vec4 color;\n#endif\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\nout vec4 texCoord${t};\n#endif\n`).join("\n")}\n#endif\n#endif\n#if defined(X3D_NORMALS)\nuniform mat3 x3d_NormalMatrix;in vec3 x3d_Normal;out vec3 normal;\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nout vec3 localNormal;\n#endif\n#if defined(X3D_TANGENTS)\nin vec4 x3d_Tangent;out mat3 TBN;\n#else\nvec4 x3d_Tangent;\n#endif\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nflat out float lengthSoFar;flat out vec2 startPoint;out vec2 midPoint;\n#endif\nout vec3 vertex;\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nout vec3 localVertex;\n#endif\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\nout float depth;\n#endif\n#pragma X3D include "Utils.glsl"\n#pragma X3D include "Skin.glsl"\n#pragma X3D include "Instancing.glsl"\n#pragma X3D include "PointSize.glsl"\nvoid main(){\n#if defined(X3D_NORMALS)\nvec4 x3d_TransformedVertex=getInstanceVertex(getSkinVertex(x3d_Vertex,x3d_Normal,x3d_Tangent.xyz));vec3 x3d_TransformedNormal=getInstanceNormal(getSkinNormal(x3d_Normal));\n#if defined(X3D_TANGENTS)\nvec3 x3d_TransformedTangent=getInstanceNormal(getSkinTangent(x3d_Tangent.xyz));\n#endif\n#else\nvec4 x3d_TransformedVertex=getInstanceVertex(getSkinVertex(x3d_Vertex,vec3(0),vec3(0)));\n#endif\nvec4 position=x3d_ModelViewMatrix*x3d_TransformedVertex;\n#if defined(X3D_XR_SESSION)\nposition=x3d_EyeMatrix*position;\n#endif\nvertex=position.xyz;\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\ngl_PointSize=pointSize=getInstancePointSize(getPointSize(vertex));\n#else\ngl_PointSize=1.;\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nlengthSoFar=x3d_LineStipple.z;startPoint=x3d_LineStipple.xy;midPoint=x3d_LineStipple.xy;\n#endif\n#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS)\nfogDepth=x3d_FogDepth;\n#endif\n#if defined(X3D_COLOR_MATERIAL)\ncolor=x3d_Color;\n#endif\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\n${Array.from({length:4},(e,t)=>`\n#if X3D_NUM_TEXTURE_COORDINATES > ${t}\ntexCoord${t} = getInstanceTexCoord (x3d_TexCoord${t}, gl_VertexID % 6);\n#endif\n`).join("\n")}\n#endif\n#endif\n#if defined(X3D_NORMALS)\nnormal=x3d_NormalMatrix*x3d_TransformedNormal;\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nlocalNormal=x3d_TransformedNormal;\n#endif\n#if defined(X3D_TANGENTS)\nvec3 tangent=x3d_NormalMatrix*x3d_TransformedTangent;vec3 bitangent=cross(normal,tangent)*x3d_Tangent.w;TBN=mat3(tangent,bitangent,normal);\n#endif\n#endif\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nlocalVertex=x3d_TransformedVertex.xyz;\n#endif\ngl_Position=x3d_ProjectionMatrix*position;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\ndepth=1.+gl_Position.w;\n#endif\n}`),Io=s.A.add("BRDF2.glsl",()=>"\nconst float M_PI=3.1415926535897932384626433832795;float max3(const in vec3 value){return max(max(value.x,value.y),value.z);}vec3 rgb_mix(const in vec3 base,const in vec3 layer,const in vec3 rgb_alpha){float rgb_alpha_max=max(rgb_alpha.r,max(rgb_alpha.g,rgb_alpha.b));return(1.-rgb_alpha_max)*base+rgb_alpha*layer;}vec3 F_Schlick(const in vec3 f0,const in vec3 f90,const in float VdotH){return f0+(f90-f0)*pow(clamp(1.-VdotH,0.,1.),5.);}float F_Schlick(const in float f0,const in float f90,const in float VdotH){float x=clamp(1.-VdotH,0.,1.);float x2=x*x;float x5=x*x2*x2;return f0+(f90-f0)*x5;}float F_Schlick(const in float f0,const in float VdotH){float f90=1.;return F_Schlick(f0,f90,VdotH);}vec3 F_Schlick(const in vec3 f0,const in float f90,const in float VdotH){float x=clamp(1.-VdotH,0.,1.);float x2=x*x;float x5=x*x2*x2;return f0+(f90-f0)*x5;}vec3 F_Schlick(const in vec3 f0,const in float VdotH){float f90=1.;return F_Schlick(f0,f90,VdotH);}vec3 Schlick_to_F0(const in vec3 f,const in vec3 f90,const in float VdotH){float x=clamp(1.-VdotH,0.,1.);float x2=x*x;float x5=clamp(x*x2*x2,0.,.9999);return(f-f90*x5)/(1.-x5);}float Schlick_to_F0(const in float f,const in float f90,const in float VdotH){float x=clamp(1.-VdotH,0.,1.);float x2=x*x;float x5=clamp(x*x2*x2,0.,.9999);return(f-f90*x5)/(1.-x5);}vec3 Schlick_to_F0(const in vec3 f,const in float VdotH){return Schlick_to_F0(f,vec3(1),VdotH);}float Schlick_to_F0(const in float f,const in float VdotH){return Schlick_to_F0(f,1.,VdotH);}float V_GGX(const in float NdotL,const in float NdotV,const in float alphaRoughness){float alphaRoughnessSq=alphaRoughness*alphaRoughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.-alphaRoughnessSq)+alphaRoughnessSq);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.-alphaRoughnessSq)+alphaRoughnessSq);float GGX=GGXV+GGXL;if(GGX>0.){return.5/GGX;}return 0.;}float D_GGX(const in float NdotH,const in float alphaRoughness){float alphaRoughnessSq=alphaRoughness*alphaRoughness;float f=(NdotH*NdotH)*(alphaRoughnessSq-1.)+1.;return alphaRoughnessSq/(M_PI*f*f);}\n#if defined(X3D_LIGHTING)\nvec3 BRDF_lambertian(const in vec3 diffuseColor){return diffuseColor/M_PI;}vec3 BRDF_specularGGX(const in float alphaRoughness,const in float NdotL,const in float NdotV,const in float NdotH){float Vis=V_GGX(NdotL,NdotV,alphaRoughness);float D=D_GGX(NdotH,alphaRoughness);return vec3(Vis*D);}\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\nvec3 BRDF_lambertianIridescence(const in vec3 f0,const in vec3 f90,const in vec3 iridescenceFresnel,const in float iridescenceFactor,const in vec3 diffuseColor,const in float specularWeight,const in float VdotH){vec3 iridescenceFresnelMax=vec3(max(max(iridescenceFresnel.r,iridescenceFresnel.g),iridescenceFresnel.b));vec3 schlickFresnel=F_Schlick(f0,f90,VdotH);vec3 F=mix(schlickFresnel,iridescenceFresnelMax,iridescenceFactor);return(1.-specularWeight*F)*(diffuseColor/M_PI);}vec3 BRDF_specularGGXIridescence(const in vec3 f0,const in vec3 f90,const in vec3 iridescenceFresnel,const in float alphaRoughness,const in float iridescenceFactor,const in float specularWeight,const in float VdotH,const in float NdotL,const in float NdotV,const in float NdotH){vec3 F=mix(F_Schlick(f0,f90,VdotH),iridescenceFresnel,iridescenceFactor);float Vis=V_GGX(NdotL,NdotV,alphaRoughness);float D=D_GGX(NdotH,alphaRoughness);return specularWeight*F*Vis*D;}\n#endif\n#if defined(X3D_ANISOTROPY_MATERIAL_EXT)\nfloat D_GGX_anisotropic(const in float NdotH,const in float TdotH,const in float BdotH,const in float anisotropy,const in float at,const in float ab){float a2=at*ab;vec3 f=vec3(ab*TdotH,at*BdotH,a2*NdotH);float w2=a2/dot(f,f);return a2*w2*w2/M_PI;}float V_GGX_anisotropic(const in float NdotL,const in float NdotV,const in float BdotV,const in float TdotV,const in float TdotL,const in float BdotL,const in float at,const in float ab){float GGXV=NdotL*length(vec3(at*TdotV,ab*BdotV,NdotV));float GGXL=NdotV*length(vec3(at*TdotL,ab*BdotL,NdotL));float v=.5/(GGXV+GGXL);return clamp(v,0.,1.);}vec3 BRDF_specularGGXAnisotropy(const in float alphaRoughness,const in float anisotropy,const in vec3 n,const in vec3 v,const in vec3 l,const in vec3 h,const in vec3 t,const in vec3 b){float at=mix(alphaRoughness,1.,anisotropy*anisotropy);float ab=clamp(alphaRoughness,.001,1.);float NdotL=clamp(dot(n,l),0.,1.);float NdotH=clamp(dot(n,h),.001,1.);float NdotV=dot(n,v);float V=V_GGX_anisotropic(NdotL,NdotV,dot(b,v),dot(t,v),dot(t,l),dot(b,l),at,ab);float D=D_GGX_anisotropic(NdotH,dot(t,h),dot(b,h),anisotropy,at,ab);return vec3(V*D);}\n#endif\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nfloat lambdaSheenNumericHelper(const in float x,const in float alphaG){float oneMinusAlphaSq=(1.-alphaG)*(1.-alphaG);float a=mix(21.5473,25.3245,oneMinusAlphaSq);float b=mix(3.82987,3.32435,oneMinusAlphaSq);float c=mix(.19823,.16801,oneMinusAlphaSq);float d=mix(-1.97760,-1.27393,oneMinusAlphaSq);float e=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.+b*pow(x,c))+d*x+e;}float lambdaSheen(const in float cosTheta,const in float alphaG){if(abs(cosTheta)<.5)return exp(lambdaSheenNumericHelper(cosTheta,alphaG));else return exp(2.*lambdaSheenNumericHelper(.5,alphaG)-lambdaSheenNumericHelper(1.-cosTheta,alphaG));}float V_Sheen(const in float NdotL,const in float NdotV,in float sheenRoughness){sheenRoughness=max(sheenRoughness,.000001);float alphaG=sheenRoughness*sheenRoughness;return clamp(1./((1.+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG))*(4.*NdotV*NdotL)),0.,1.);}float D_Charlie(in float sheenRoughness,const in float NdotH){sheenRoughness=max(sheenRoughness,.000001);float alphaG=sheenRoughness*sheenRoughness;float invR=1./alphaG;float cos2h=NdotH*NdotH;float sin2h=1.-cos2h;return(2.+invR)*pow(sin2h,invR*.5)/(2.*M_PI);}vec3 BRDF_specularSheen(const in vec3 sheenColor,const in float sheenRoughness,const in float NdotL,const in float NdotV,const in float NdotH){float sheenDistribution=D_Charlie(sheenRoughness,NdotH);float sheenVisibility=V_Sheen(NdotL,NdotV,sheenRoughness);return sheenColor*sheenDistribution*sheenVisibility;}\n#endif\n#endif\n"),Fo=s.A.add("IBL2.glsl",()=>"\n#if defined(X3D_USE_IBL)\nuniform x3d_EnvironmentLightSourceParameters x3d_EnvironmentLightSource;vec3 getDiffuseLight(const in vec3 n){vec3 texCoord=x3d_EnvironmentLightSource.rotation*n*vec3(-1.,1.,1.);vec3 textureColor=texture(x3d_EnvironmentLightSource.diffuseTexture,texCoord).rgb;\n#if defined(X3D_COLORSPACE_SRGB)\n#if defined(X3D_ENVIRONMENT_DIFFUSE_TEXTURE_LINEAR)\ntextureColor=linearToSRGB(textureColor);\n#endif\n#else\n#if!defined(X3D_ENVIRONMENT_DIFFUSE_TEXTURE_LINEAR)\ntextureColor=sRGBToLinear(textureColor);\n#endif\n#endif\nreturn textureColor*x3d_EnvironmentLightSource.color*x3d_EnvironmentLightSource.intensity;}vec3 getSpecularLight(const in vec3 reflection,const in float lod){vec3 texCoord=x3d_EnvironmentLightSource.rotation*reflection*vec3(-1.,1.,1.);vec3 textureColor=textureLod(x3d_EnvironmentLightSource.specularTexture,texCoord,lod).rgb;\n#if defined(X3D_COLORSPACE_SRGB)\n#if defined(X3D_ENVIRONMENT_SPECULAR_TEXTURE_LINEAR)\ntextureColor=linearToSRGB(textureColor);\n#endif\n#else\n#if!defined(X3D_ENVIRONMENT_SPECULAR_TEXTURE_LINEAR)\ntextureColor=sRGBToLinear(textureColor);\n#endif\n#endif\nreturn textureColor*x3d_EnvironmentLightSource.color*x3d_EnvironmentLightSource.intensity;}\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nvec3 getSheenLight(const in vec3 reflection,const in float lod){vec3 texCoord=x3d_EnvironmentLightSource.rotation*reflection*vec3(-1.,1.,1.);vec3 textureColor=textureLod(x3d_EnvironmentLightSource.sheenTexture,texCoord,lod).rgb;\n#if defined(X3D_COLORSPACE_SRGB)\n#if defined(X3D_ENVIRONMENT_SHEEN_TEXTURE_LINEAR)\ntextureColor=linearToSRGB(textureColor);\n#endif\n#else\n#if!defined(X3D_ENVIRONMENT_SHEEN_TEXTURE_LINEAR)\ntextureColor=sRGBToLinear(textureColor);\n#endif\n#endif\nreturn textureColor*x3d_EnvironmentLightSource.color*x3d_EnvironmentLightSource.intensity;}\n#endif\nvec3 getIBLGGXFresnel(const in vec3 n,const in vec3 v,const in float roughness,const in vec3 F0,const in float specularWeight){float NdotV=clamp(dot(n,v),0.,1.);vec2 brdfSamplePoint=clamp(vec2(NdotV,roughness),vec2(0),vec2(1));vec2 f_ab=texture(x3d_EnvironmentLightSource.ggxLUTTexture,brdfSamplePoint).rg;vec3 Fr=max(vec3(1.-roughness),F0)-F0;vec3 k_S=F0+Fr*pow(1.-NdotV,5.);vec3 FssEss=specularWeight*(k_S*f_ab.x+f_ab.y);float Ems=(1.-(f_ab.x+f_ab.y));vec3 F_avg=specularWeight*(F0+(1.-F0)/21.);vec3 FmsEms=Ems*FssEss*F_avg/(1.-F_avg*Ems);return FssEss+FmsEms;}vec3 getIBLRadianceGGX(const in vec3 n,const in vec3 v,const in float roughness){float NdotV=clamp(dot(n,v),0.,1.);float lod=roughness*float(x3d_EnvironmentLightSource.specularTextureLevels);vec3 reflection=normalize(reflect(-v,n));vec3 specularLight=getSpecularLight(reflection,lod);return specularLight;}\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)\nuniform sampler2D x3d_TransmissionSamplerEXT;vec3 getTransmissionSample(const in vec2 fragCoord,const in float roughness,const in float ior){int framebufferSize=max(x3d_Viewport.z,x3d_Viewport.w);float framebufferLod=log2(float(framebufferSize))*applyIorToRoughness(roughness,ior);vec3 transmittedLight=textureLod(x3d_TransmissionSamplerEXT,fragCoord,framebufferLod).rgb;return transmittedLight;}vec3 getIBLVolumeRefraction(const in vec3 n,const in vec3 v,const in float perceptualRoughness,const in vec3 baseColor,const in vec3 position,const in mat4 modelMatrix,const in mat4 projMatrix,const in float ior,const in float thickness,const in vec3 attenuationColor,const in float attenuationDistance,const in float dispersion){\n#if defined(X3D_DISPERSION_MATERIAL_EXT)\nfloat halfSpread=(ior-1.)*.025*dispersion;vec3 iors=vec3(ior-halfSpread,ior,ior+halfSpread);vec3 transmittedLight;float transmissionRayLength;for(int i=0;i<3;i++){vec3 transmissionRay=getVolumeTransmissionRay(n,v,thickness,iors[i],modelMatrix);transmissionRayLength=length(transmissionRay);vec3 refractedRayExit=position+transmissionRay;vec4 ndcPos=projMatrix*vec4(refractedRayExit,1.);vec2 refractionCoords=ndcPos.xy/ndcPos.w;refractionCoords+=1.;refractionCoords/=2.;transmittedLight[i]=getTransmissionSample(refractionCoords,perceptualRoughness,iors[i])[i];}\n#else\nvec3 transmissionRay=getVolumeTransmissionRay(n,v,thickness,ior,modelMatrix);float transmissionRayLength=length(transmissionRay);vec3 refractedRayExit=position+transmissionRay;vec4 ndcPos=projMatrix*vec4(refractedRayExit,1.);vec2 refractionCoords=ndcPos.xy/ndcPos.w;refractionCoords+=1.;refractionCoords/=2.;vec3 transmittedLight=getTransmissionSample(refractionCoords,perceptualRoughness,ior);\n#endif\nvec3 attenuatedColor=applyVolumeAttenuation(transmittedLight,transmissionRayLength,attenuationColor,attenuationDistance);return attenuatedColor*baseColor;}\n#endif\n#if defined(X3D_ANISOTROPY_MATERIAL_EXT)\nvec3 getIBLRadianceAnisotropy(const in vec3 n,const in vec3 v,const in float roughness,const in float anisotropy,const in vec3 anisotropyDirection){float NdotV=clamp(dot(n,v),0.,1.);float tangentRoughness=mix(roughness,1.,anisotropy*anisotropy);vec3 anisotropicTangent=cross(anisotropyDirection,v);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);float bendFactor=1.-anisotropy*(1.-roughness);float bendFactorPow4=bendFactor*bendFactor*bendFactor*bendFactor;vec3 bentNormal=normalize(mix(anisotropicNormal,n,bendFactorPow4));float lod=roughness*float(x3d_EnvironmentLightSource.specularTextureLevels);vec3 reflection=normalize(reflect(-v,bentNormal));vec3 specularLight=getSpecularLight(reflection,lod);return specularLight;}\n#endif\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nvec3 getIBLRadianceCharlie(const in vec3 n,const in vec3 v,const in float sheenRoughness,const in vec3 sheenColor){float NdotV=clamp(dot(n,v),0.,1.);float lod=sheenRoughness*float(x3d_EnvironmentLightSource.sheenTextureLevels);vec3 reflection=normalize(reflect(-v,n));vec2 brdfSamplePoint=clamp(vec2(NdotV,sheenRoughness),vec2(0),vec2(1));float brdf=texture(x3d_EnvironmentLightSource.charlieLUTTexture,brdfSamplePoint).b;vec3 sheenLight=getSheenLight(reflection,lod);return sheenLight*sheenColor*brdf;}\n#endif\n#endif\n"),Mo=s.A.add("MaterialInfo2.glsl",()=>`\nstruct MaterialInfo{float ior;float perceptualRoughness;vec3 f0_dielectric;float alphaRoughness;float fresnel_w;vec3 f90;vec3 f90_dielectric;float metallic;vec3 baseColor;float sheenRoughnessFactor;vec3 sheenColorFactor;vec3 clearcoatF0;vec3 clearcoatF90;float clearcoatFactor;vec3 clearcoatNormal;float clearcoatRoughness;float specularWeight;float transmissionFactor;float thickness;vec3 attenuationColor;float attenuationDistance;float iridescenceFactor;float iridescenceIor;float iridescenceThickness;float diffuseTransmissionFactor;vec3 diffuseTransmissionColorFactor;vec3 anisotropicT;vec3 anisotropicB;float anisotropyStrength;float dispersion;};\n#if defined(X3D_MATERIAL_METALLIC_ROUGHNESS)\n${_o.texture("x3d_BaseTexture","rgba","linear")}\nvec4 getBaseColor(){float alpha=1.-x3d_Material.transparency;vec4 baseColor=vec4(x3d_Material.baseColor,alpha);\n#if defined(X3D_COLOR_MATERIAL)\nbaseColor*=color;\n#endif\n#if defined(X3D_BASE_TEXTURE)\nbaseColor*=getBaseTexture();\n#elif defined(X3D_TEXTURE)\nbaseColor=getTextureColor(baseColor,vec4(vec3(1),alpha));\n#endif\nreturn baseColor;}\n${_o.texture("x3d_MetallicRoughnessTexture")}\nMaterialInfo getMetallicRoughnessInfo(in MaterialInfo info){info.metallic=x3d_Material.metallic;info.perceptualRoughness=x3d_Material.roughness;\n#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE)\nvec4 mrSample=getMetallicRoughnessTexture();info.metallic*=mrSample.b;info.perceptualRoughness*=mrSample.g;\n#endif\nreturn info;}\n#endif\n${_o.texture("x3d_EmissiveTexture","rgb","linear")}\n#if defined(X3D_EMISSIVE_STRENGTH_MATERIAL_EXT)\nuniform float x3d_EmissiveStrengthEXT;\n#endif\nvec3 getEmissiveColor(){vec3 emissiveColor=x3d_Material.emissiveColor;\n#if defined(X3D_EMISSIVE_STRENGTH_MATERIAL_EXT)\nemissiveColor*=x3d_EmissiveStrengthEXT;\n#endif\n#if defined(X3D_EMISSIVE_TEXTURE)\nemissiveColor*=getEmissiveTexture();\n#endif\nreturn emissiveColor;}\n${_o.texture("x3d_OcclusionTexture","r")}\nfloat getOcclusionFactor(){\n#if defined(X3D_OCCLUSION_TEXTURE)\nreturn getOcclusionTexture();\n#else\nreturn 1.;\n#endif\n}\n#if defined(X3D_IOR_MATERIAL_EXT)\nuniform float x3d_IorEXT;MaterialInfo getIorInfo(in MaterialInfo info){info.f0_dielectric=vec3(pow((x3d_IorEXT-1.)/(x3d_IorEXT+1.),2.));info.ior=x3d_IorEXT;return info;}\n#endif\n#if defined(X3D_SHEEN_MATERIAL_EXT)\n${_o.texture("x3d_SheenColorTextureEXT","rgb","linear")}\n${_o.texture("x3d_SheenRoughnessTextureEXT","a")}\nuniform vec3 x3d_SheenColorEXT;uniform float x3d_SheenRoughnessEXT;MaterialInfo getSheenInfo(in MaterialInfo info){info.sheenColorFactor=x3d_SheenColorEXT;info.sheenRoughnessFactor=x3d_SheenRoughnessEXT;\n#if defined(X3D_SHEEN_COLOR_TEXTURE_EXT)\ninfo.sheenColorFactor*=getSheenColorTextureEXT();\n#endif\n#if defined(X3D_SHEEN_ROUGHNESS_TEXTURE_EXT)\ninfo.sheenRoughnessFactor*=getSheenRoughnessTextureEXT();\n#endif\nreturn info;}uniform sampler2D x3d_SheenELUTTextureEXT;float albedoSheenScalingLUT(const in float NdotV,const in float sheenRoughnessFactor){return texture(x3d_SheenELUTTextureEXT,vec2(NdotV,sheenRoughnessFactor)).r;}\n#endif\n#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\n${_o.texture("x3d_DiffuseTransmissionTextureEXT","a")}\n${_o.texture("x3d_DiffuseTransmissionColorTextureEXT","rgb","linear")}\nuniform float x3d_DiffuseTransmissionEXT;uniform vec3 x3d_DiffuseTransmissionColorEXT;MaterialInfo getDiffuseTransmissionInfo(in MaterialInfo info){info.diffuseTransmissionFactor=x3d_DiffuseTransmissionEXT;info.diffuseTransmissionColorFactor=x3d_DiffuseTransmissionColorEXT;\n#if defined(X3D_DIFFUSE_TRANSMISSION_TEXTURE_EXT)\ninfo.diffuseTransmissionFactor*=getDiffuseTransmissionTextureEXT();\n#endif\n#if defined(X3D_DIFFUSE_TRANSMISSION_COLOR_TEXTURE_EXT)\ninfo.diffuseTransmissionColorFactor*=getDiffuseTransmissionColorTextureEXT();\n#endif\nreturn info;}\n#endif\n#if defined(X3D_CLEARCOAT_MATERIAL_EXT)\n${_o.texture("x3d_ClearcoatTextureEXT","r")}\n${_o.texture("x3d_ClearcoatRoughnessTextureEXT","g")}\n${_o.texture("x3d_ClearcoatNormalTextureEXT","rgb")}\n#if defined(X3D_CLEARCOAT_NORMAL_TEXTURE_EXT)\nconst float x3d_ClearcoatNormalScaleEXT=1.;\n#endif\nvec3 getClearcoatNormalEXT(const in NormalInfo normalInfo){\n#if defined(X3D_CLEARCOAT_NORMAL_TEXTURE_EXT)\nvec3 color=getClearcoatNormalTextureEXT();vec3 n=color*2.-vec3(1);n*=vec3(vec2(x3d_ClearcoatNormalScaleEXT),1.);n=mat3(normalInfo.t,normalInfo.b,normalInfo.ng)*normalize(n);return n;\n#else\nreturn normalInfo.ng;\n#endif\n}uniform float x3d_ClearcoatEXT;uniform float x3d_ClearcoatRoughnessEXT;MaterialInfo getClearCoatInfo(in MaterialInfo info,const in NormalInfo normalInfo){info.clearcoatFactor=x3d_ClearcoatEXT;info.clearcoatRoughness=x3d_ClearcoatRoughnessEXT;info.clearcoatF0=vec3(pow((info.ior-1.)/(info.ior+1.),2.));info.clearcoatF90=vec3(1);\n#if defined(X3D_CLEARCOAT_TEXTURE_EXT)\ninfo.clearcoatFactor*=getClearcoatTextureEXT();\n#endif\n#if defined(X3D_CLEARCOAT_ROUGHNESS_TEXTURE_EXT)\ninfo.clearcoatRoughness*=getClearcoatRoughnessTextureEXT();\n#endif\ninfo.clearcoatNormal=getClearcoatNormalEXT(normalInfo);info.clearcoatRoughness=clamp(info.clearcoatRoughness,0.,1.);return info;}\n#endif\n#if defined(X3D_SPECULAR_MATERIAL_EXT)\n${_o.texture("x3d_SpecularTextureEXT","a")}\n${_o.texture("x3d_SpecularColorTextureEXT","rgb","linear")}\nuniform float x3d_SpecularEXT;uniform vec3 x3d_SpecularColorEXT;MaterialInfo getSpecularInfo(in MaterialInfo info){vec4 specularTexture=vec4(1);\n#if defined(X3D_SPECULAR_TEXTURE_EXT)\nspecularTexture.a=getSpecularTextureEXT();\n#endif\n#if defined(X3D_SPECULAR_COLOR_TEXTURE_EXT)\nspecularTexture.rgb=getSpecularColorTextureEXT();\n#endif\ninfo.f0_dielectric=min(info.f0_dielectric*x3d_SpecularColorEXT*specularTexture.rgb,vec3(1));info.specularWeight=x3d_SpecularEXT*specularTexture.a;info.f90_dielectric=vec3(info.specularWeight);return info;}\n#endif\n#if defined(X3D_VOLUME_MATERIAL_EXT)\n${_o.texture("x3d_ThicknessTextureEXT","g")}\nuniform float x3d_ThicknessEXT;uniform float x3d_AttenuationDistanceEXT;uniform vec3 x3d_AttenuationColorEXT;MaterialInfo getVolumeInfo(in MaterialInfo info){info.thickness=x3d_ThicknessEXT;info.attenuationDistance=x3d_AttenuationDistanceEXT;info.attenuationColor=x3d_AttenuationColorEXT;\n#if defined(X3D_THICKNESS_TEXTURE_EXT)\ninfo.thickness*=getThicknessTextureEXT();\n#endif\nreturn info;}\n#endif\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\n${_o.texture("x3d_IridescenceTextureEXT","r")}\n${_o.texture("x3d_IridescenceThicknessTextureEXT","g")}\nuniform float x3d_IridescenceEXT;uniform float x3d_IridescenceIndexOfRefractionEXT;uniform float x3d_IridescenceThicknessMinimumEXT;uniform float x3d_IridescenceThicknessMaximumEXT;MaterialInfo getIridescenceInfo(in MaterialInfo info){info.iridescenceFactor=x3d_IridescenceEXT;info.iridescenceIor=x3d_IridescenceIndexOfRefractionEXT;info.iridescenceThickness=x3d_IridescenceThicknessMaximumEXT;\n#if defined(X3D_IRIDESCENCE_TEXTURE_EXT)\ninfo.iridescenceFactor*=getIridescenceTextureEXT();\n#endif\n#if defined(X3D_IRIDESCENCE_THICKNESS_TEXTURE_EXT)\nfloat thicknessSampled=getIridescenceThicknessTextureEXT();float thickness=mix(x3d_IridescenceThicknessMinimumEXT,x3d_IridescenceThicknessMaximumEXT,thicknessSampled);info.iridescenceThickness=thickness;\n#endif\nreturn info;}\n#endif\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)\n${_o.texture("x3d_TransmissionTextureEXT","r")}\nuniform float x3d_TransmissionEXT;\n#if defined(X3D_DISPERSION_MATERIAL_EXT)\nuniform float x3d_DispersionEXT;\n#endif\nMaterialInfo getTransmissionInfo(in MaterialInfo info){info.transmissionFactor=x3d_TransmissionEXT;\n#if defined(X3D_TRANSMISSION_TEXTURE_EXT)\ninfo.transmissionFactor*=getTransmissionTextureEXT();\n#endif\n#if defined(X3D_DISPERSION_MATERIAL_EXT)\ninfo.dispersion=x3d_DispersionEXT;\n#else\ninfo.dispersion=0.;\n#endif\nreturn info;}\n#endif\n#if defined(X3D_ANISOTROPY_MATERIAL_EXT)\n${_o.texture("x3d_AnisotropyTextureEXT","rgb")}\nuniform vec3 x3d_AnisotropyEXT;MaterialInfo getAnisotropyInfo(in MaterialInfo info,const in NormalInfo normalInfo){vec2 direction=vec2(1.,0.);float strengthFactor=1.;\n#if defined(X3D_ANISOTROPY_TEXTURE_EXT)\nvec3 anisotropySample=getAnisotropyTextureEXT();direction=anisotropySample.xy*2.-vec2(1);strengthFactor=anisotropySample.z;\n#endif\nvec2 directionRotation=x3d_AnisotropyEXT.xy;mat2 rotationMatrix=mat2(directionRotation.xy,-directionRotation.y,directionRotation.x);direction=rotationMatrix*direction;info.anisotropicT=mat3(normalInfo.t,normalInfo.b,normalInfo.n)*normalize(vec3(direction,0.));info.anisotropicB=cross(normalInfo.ng,info.anisotropicT);info.anisotropyStrength=clamp(x3d_AnisotropyEXT.z*strengthFactor,0.,1.);return info;}\n#endif\n`),Ro=s.A.add("PBR2.glsl",()=>'\n#pragma X3D include "../common/Fragment.glsl"\n#pragma X3D include "../common/Shadow.glsl"\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)||defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)\nuniform ivec4 x3d_Viewport;\n#endif\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)||defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)||defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)\nuniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;\n#endif\n#if defined(X3D_XR_SESSION)\nuniform mat4 x3d_EyeMatrix;mat4 eye(const in mat4 modelViewMatrix){return x3d_EyeMatrix*modelViewMatrix;}\n#else\n#define eye(x)(x)\n#endif\n#if defined(X3D_LIGHTING)\nuniform x3d_LightSourceParameters x3d_LightSource[X3D_NUM_LIGHTS];\n#endif\nuniform x3d_PhysicalMaterialParameters x3d_Material;\n#pragma X3D include "BRDF.glsl"\n#pragma X3D include "MaterialInfo.glsl"\n#pragma X3D include "Punctual.glsl"\n#pragma X3D include "IBL.glsl"\n#pragma X3D include "Iridescence.glsl"\n#if defined(X3D_VOLUME_SCATTER_PASS)\n#pragma X3D include "Scatter.glsl"\n#else\nvec4 getMaterialColor(const in vec4 fragCoord){\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)\nmat4 modelViewMatrix=eye(x3d_ModelViewMatrix);\n#endif\nvec4 baseColor=getBaseColor();\n#if defined(X3D_TEXTURE_PROJECTION)\nbaseColor.rgb*=getTextureProjectorColor();\n#endif\nvec3 color=vec3(0);vec3 v=normalize(-vertex);\n#if defined(X3D_USE_IBL)||defined(X3D_LIGHTING)\nNormalInfo normalInfo=getNormalInfo(x3d_Material.normalScale);vec3 n=normalInfo.n;float NdotV=clamp(dot(n,v),0.,1.);\n#endif\nMaterialInfo materialInfo;materialInfo.baseColor=baseColor.rgb;materialInfo.ior=1.5;materialInfo.f0_dielectric=vec3(.04);materialInfo.specularWeight=1.;materialInfo.f90=vec3(1);materialInfo.f90_dielectric=materialInfo.f90;\n#if defined(X3D_IOR_MATERIAL_EXT)\nmaterialInfo=getIorInfo(materialInfo);\n#endif\n#if defined(X3D_MATERIAL_METALLIC_ROUGHNESS)\nmaterialInfo=getMetallicRoughnessInfo(materialInfo);\n#endif\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nmaterialInfo=getSheenInfo(materialInfo);\n#endif\n#if defined(X3D_CLEARCOAT_MATERIAL_EXT)\nmaterialInfo=getClearCoatInfo(materialInfo,normalInfo);\n#endif\n#if defined(X3D_SPECULAR_MATERIAL_EXT)\nmaterialInfo=getSpecularInfo(materialInfo);\n#endif\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)\nmaterialInfo=getTransmissionInfo(materialInfo);\n#endif\n#if defined(X3D_VOLUME_MATERIAL_EXT)\nmaterialInfo=getVolumeInfo(materialInfo);\n#endif\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\nmaterialInfo=getIridescenceInfo(materialInfo);\n#endif\n#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\nmaterialInfo=getDiffuseTransmissionInfo(materialInfo);\n#endif\n#if defined(X3D_ANISOTROPY_MATERIAL_EXT)\nmaterialInfo=getAnisotropyInfo(materialInfo,normalInfo);\n#endif\nmaterialInfo.perceptualRoughness=clamp(materialInfo.perceptualRoughness,0.,1.);materialInfo.metallic=clamp(materialInfo.metallic,0.,1.);materialInfo.alphaRoughness=materialInfo.perceptualRoughness*materialInfo.perceptualRoughness;vec3 f_specular_dielectric=vec3(0);vec3 f_specular_metal=vec3(0);vec3 f_diffuse=vec3(0);vec3 f_dielectric_brdf_ibl=vec3(0);vec3 f_metal_brdf_ibl=vec3(0);vec3 f_emissive=vec3(0);vec3 clearcoat_brdf=vec3(0);vec3 f_sheen=vec3(0);vec3 f_specular_transmission=vec3(0);vec3 f_diffuse_transmission=vec3(0);float clearcoatFactor=0.;vec3 clearcoatFresnel=vec3(0);float albedoSheenScaling=1.;float diffuseTransmissionThickness=1.;vec3 diffuseTransmissionIBL=vec3(0);\n#if defined(X3D_USE_IBL)||defined(X3D_LIGHTING)\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\nvec3 iridescenceFresnel_dielectric=evalIridescence(1.,materialInfo.iridescenceIor,NdotV,materialInfo.iridescenceThickness,materialInfo.f0_dielectric);vec3 iridescenceFresnel_metallic=evalIridescence(1.,materialInfo.iridescenceIor,NdotV,materialInfo.iridescenceThickness,baseColor.rgb);if(materialInfo.iridescenceThickness==0.)materialInfo.iridescenceFactor=0.;\n#endif\n#endif\n#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\n#if defined(X3D_VOLUME_MATERIAL_EXT)\ndiffuseTransmissionThickness=materialInfo.thickness*(length(x3d_ModelViewMatrix[0].xyz)+length(x3d_ModelViewMatrix[1].xyz)+length(x3d_ModelViewMatrix[2].xyz))/3.;\n#endif\n#endif\n#if defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)\nvec3 singleScatter=multiToSingleScatter();\n#endif\n#if defined(X3D_CLEARCOAT_MATERIAL_EXT)\nclearcoatFactor=materialInfo.clearcoatFactor;clearcoatFresnel=F_Schlick(materialInfo.clearcoatF0,materialInfo.clearcoatF90,clamp(dot(materialInfo.clearcoatNormal,v),0.,1.));\n#endif\n#if defined(X3D_USE_IBL)\nf_diffuse=getDiffuseLight(n)*baseColor.rgb;\n#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\ndiffuseTransmissionIBL=getDiffuseLight(-n)*materialInfo.diffuseTransmissionColorFactor;\n#if defined(X3D_VOLUME_MATERIAL_EXT)\ndiffuseTransmissionIBL=applyVolumeAttenuation(diffuseTransmissionIBL,diffuseTransmissionThickness,materialInfo.attenuationColor,materialInfo.attenuationDistance);\n#endif\n#if defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)\ndiffuseTransmissionIBL*=(1.-singleScatter);\n#endif\nf_diffuse=mix(f_diffuse,diffuseTransmissionIBL,materialInfo.diffuseTransmissionFactor);\n#endif\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)\nf_specular_transmission+=getIBLVolumeRefraction(n,v,materialInfo.perceptualRoughness,baseColor.rgb,vertex,modelViewMatrix,x3d_ProjectionMatrix,materialInfo.ior,materialInfo.thickness,materialInfo.attenuationColor,materialInfo.attenuationDistance,materialInfo.dispersion);f_diffuse=mix(f_diffuse,f_specular_transmission,materialInfo.transmissionFactor);\n#endif\n#if defined(X3D_ANISOTROPY_MATERIAL_EXT)\nf_specular_metal=getIBLRadianceAnisotropy(n,v,materialInfo.perceptualRoughness,materialInfo.anisotropyStrength,materialInfo.anisotropicB);f_specular_dielectric=f_specular_metal;\n#else\nf_specular_metal=getIBLRadianceGGX(n,v,materialInfo.perceptualRoughness);f_specular_dielectric=f_specular_metal;\n#endif\nvec3 f_metal_fresnel_ibl=getIBLGGXFresnel(n,v,materialInfo.perceptualRoughness,baseColor.rgb,1.);f_metal_brdf_ibl=f_metal_fresnel_ibl*f_specular_metal;vec3 f_dielectric_fresnel_ibl=getIBLGGXFresnel(n,v,materialInfo.perceptualRoughness,materialInfo.f0_dielectric,materialInfo.specularWeight);f_dielectric_brdf_ibl=mix(f_diffuse,f_specular_dielectric,f_dielectric_fresnel_ibl);\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\nf_metal_brdf_ibl=mix(f_metal_brdf_ibl,f_specular_metal*iridescenceFresnel_metallic,materialInfo.iridescenceFactor);f_dielectric_brdf_ibl=mix(f_dielectric_brdf_ibl,rgb_mix(f_diffuse,f_specular_dielectric,iridescenceFresnel_dielectric),materialInfo.iridescenceFactor);\n#endif\n#if defined(X3D_CLEARCOAT_MATERIAL_EXT)\nclearcoat_brdf=getIBLRadianceGGX(materialInfo.clearcoatNormal,v,materialInfo.clearcoatRoughness);\n#endif\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nf_sheen=getIBLRadianceCharlie(n,v,materialInfo.sheenRoughnessFactor,materialInfo.sheenColorFactor);albedoSheenScaling=1.-max3(materialInfo.sheenColorFactor)*albedoSheenScalingLUT(NdotV,materialInfo.sheenRoughnessFactor);\n#endif\ncolor=mix(f_dielectric_brdf_ibl,f_metal_brdf_ibl,materialInfo.metallic);color=f_sheen+color*albedoSheenScaling;color=mix(color,clearcoat_brdf,clearcoatFactor*clearcoatFresnel);\n#endif\n#if defined(X3D_OCCLUSION_TEXTURE)\nfloat ao=getOcclusionFactor();color*=1.+x3d_Material.occlusionStrength*(ao-1.);\n#endif\nf_diffuse=vec3(0);f_specular_dielectric=vec3(0);f_specular_metal=vec3(0);vec3 f_dielectric_brdf=vec3(0);vec3 f_metal_brdf=vec3(0);\n#if defined(X3D_LIGHTING)\nfor(int i=0;i<X3D_NUM_LIGHTS;++i){x3d_LightSourceParameters light=x3d_LightSource[i];vec3 pointToLight;float distanceToLight;if(light.type!=x3d_DirectionalLight){pointToLight=light.location-vertex;distanceToLight=length(light.matrix*pointToLight);}else{pointToLight=-light.direction;distanceToLight=-1.;}if(distanceToLight<=light.radius||light.radius<0.){vec3 l=normalize(pointToLight);vec3 h=normalize(l+v);float NdotL=clamp(dot(n,l),0.,1.);float NdotH=clamp(dot(n,h),0.,1.);float VdotH=clamp(dot(v,h),0.,1.);vec3 dielectric_fresnel=F_Schlick(materialInfo.f0_dielectric*materialInfo.specularWeight,materialInfo.f90_dielectric,abs(VdotH));vec3 metal_fresnel=F_Schlick(baseColor.rgb,vec3(1),abs(VdotH));vec3 lightIntensity=getLightIntensity(light,l,distanceToLight);\n#if defined(X3D_SHADOWS)\nlightIntensity=mix(lightIntensity,light.shadowColor,getShadowIntensity(i,light));\n#endif\nvec3 l_diffuse=lightIntensity*NdotL*BRDF_lambertian(baseColor.rgb);vec3 l_specular_dielectric=vec3(0);vec3 l_specular_metal=vec3(0);vec3 l_dielectric_brdf=vec3(0);vec3 l_metal_brdf=vec3(0);vec3 l_clearcoat_brdf=vec3(0);vec3 l_sheen=vec3(0);float l_albedoSheenScaling=1.;vec3 l_diffuse_btdf=vec3(0);\n#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\nl_diffuse*=1.-materialInfo.diffuseTransmissionFactor;if(dot(n,l)<0.){float diffuseNdotL=clamp(dot(-n,l),0.,1.);l_diffuse_btdf=lightIntensity*diffuseNdotL*BRDF_lambertian(materialInfo.diffuseTransmissionColorFactor);vec3 l_mirror=normalize(reflect(l,n));float diffuseVdotH=clamp(dot(v,normalize(l_mirror+v)),0.,1.);dielectric_fresnel=F_Schlick(materialInfo.f0_dielectric*materialInfo.specularWeight,materialInfo.f90_dielectric,abs(diffuseVdotH));\n#if defined(X3D_VOLUME_MATERIAL_EXT)\nl_diffuse_btdf=applyVolumeAttenuation(l_diffuse_btdf,diffuseTransmissionThickness,materialInfo.attenuationColor,materialInfo.attenuationDistance);\n#endif\n#if defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)\nl_diffuse_btdf*=(1.-singleScatter);\n#endif\nl_diffuse+=l_diffuse_btdf*materialInfo.diffuseTransmissionFactor;}\n#endif\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)\nvec3 transmissionRay=getVolumeTransmissionRay(n,v,materialInfo.thickness,materialInfo.ior,modelViewMatrix);pointToLight-=transmissionRay;l=normalize(pointToLight);vec3 transmittedLight=lightIntensity*getPunctualRadianceTransmission(n,v,l,materialInfo.alphaRoughness,baseColor.rgb,materialInfo.ior);\n#if defined(X3D_VOLUME_MATERIAL_EXT)\ntransmittedLight=applyVolumeAttenuation(transmittedLight,length(transmissionRay),materialInfo.attenuationColor,materialInfo.attenuationDistance);\n#endif\nl_diffuse=mix(l_diffuse,transmittedLight,materialInfo.transmissionFactor);\n#endif\nvec3 intensity=getLightIntensity(light,l,length(light.matrix*pointToLight));\n#if defined(X3D_ANISOTROPY_MATERIAL_EXT)\nl_specular_metal=intensity*NdotL*BRDF_specularGGXAnisotropy(materialInfo.alphaRoughness,materialInfo.anisotropyStrength,n,v,l,h,materialInfo.anisotropicT,materialInfo.anisotropicB);l_specular_dielectric=l_specular_metal;\n#else\nl_specular_metal=intensity*NdotL*BRDF_specularGGX(materialInfo.alphaRoughness,NdotL,NdotV,NdotH);l_specular_dielectric=l_specular_metal;\n#endif\nl_metal_brdf=metal_fresnel*l_specular_metal;l_dielectric_brdf=mix(l_diffuse,l_specular_dielectric,dielectric_fresnel);\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\nl_metal_brdf=mix(l_metal_brdf,l_specular_metal*iridescenceFresnel_metallic,materialInfo.iridescenceFactor);l_dielectric_brdf=mix(l_dielectric_brdf,rgb_mix(l_diffuse,l_specular_dielectric,iridescenceFresnel_dielectric),materialInfo.iridescenceFactor);\n#endif\n#if defined(X3D_CLEARCOAT_MATERIAL_EXT)\nl_clearcoat_brdf=intensity*getPunctualRadianceClearCoat(materialInfo.clearcoatNormal,v,l,h,VdotH,materialInfo.clearcoatF0,materialInfo.clearcoatF90,materialInfo.clearcoatRoughness);\n#endif\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nl_sheen=intensity*getPunctualRadianceSheen(materialInfo.sheenColorFactor,materialInfo.sheenRoughnessFactor,NdotL,NdotV,NdotH);l_albedoSheenScaling=min(1.-max3(materialInfo.sheenColorFactor)*albedoSheenScalingLUT(NdotV,materialInfo.sheenRoughnessFactor),1.-max3(materialInfo.sheenColorFactor)*albedoSheenScalingLUT(NdotL,materialInfo.sheenRoughnessFactor));\n#endif\nvec3 l_color=mix(l_dielectric_brdf,l_metal_brdf,materialInfo.metallic);l_color=l_sheen+l_color*l_albedoSheenScaling;l_color=mix(l_color,l_clearcoat_brdf,clearcoatFactor*clearcoatFresnel);color+=l_color;}}\n#endif\n#if defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)\nvec3 l_color=getSubsurfaceScattering(vertex,x3d_ProjectionMatrix,materialInfo.attenuationDistance,materialInfo.diffuseTransmissionColorFactor,fragCoord);color+=l_color*(1.-materialInfo.metallic)*(1.-clearcoatFactor*clearcoatFresnel)*(1.-materialInfo.iridescenceFactor)*(1.-materialInfo.transmissionFactor);\n#endif\nf_emissive=getEmissiveColor();\n#if defined(X3D_UNLIT_MATERIAL_EXT)\ncolor=baseColor.rgb;\n#elif(defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D))&&!defined(X3D_NORMALS)\ncolor=f_emissive+baseColor.rgb;\n#else\ncolor=f_emissive*(1.-clearcoatFactor*clearcoatFresnel)+color;\n#endif\nreturn vec4(color,baseColor.a);}\n#endif\n'),Po=s.A.add("Punctual2.glsl",()=>'\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)||defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\nfloat applyIorToRoughness(const in float roughness,const in float ior){return roughness*clamp(ior*2.-2.,0.,1.);}\n#endif\n#if defined(X3D_LIGHTING)\n#pragma X3D include "../common/Lighting.glsl"\nfloat getRangeAttenuation(const in float radius,const in float distanceToLight){if(radius<=0.){return 1./pow(distanceToLight,2.);}return max(min(1.-pow(distanceToLight/radius,4.),1.),0.)/pow(distanceToLight,2.);}float getSpotAttenuation(const in vec3 pointToLight,const in vec3 spotDirection,const in float outerConeCos,const in float innerConeCos){float actualCos=dot(normalize(spotDirection),normalize(-pointToLight));if(actualCos>outerConeCos){if(actualCos<innerConeCos){float angularAttenuation=(actualCos-outerConeCos)/(innerConeCos-outerConeCos);return angularAttenuation*angularAttenuation;}return 1.;}return 0.;}vec3 getLightIntensity(const in x3d_LightSourceParameters light,const in vec3 pointToLight,const in float distanceToLight){float intensity=light.intensity;if(light.type!=x3d_DirectionalLight){intensity*=getAttenuation(light.attenuation,distanceToLight);intensity*=getRangeAttenuation(light.radius,distanceToLight);}if(light.type==x3d_SpotLight){intensity*=getSpotAttenuation(pointToLight,light.direction,cos(light.cutOffAngle),cos(light.beamWidth));}return intensity*light.color;}\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nvec3 getPunctualRadianceSheen(const in vec3 sheenColor,const in float sheenRoughness,const in float NdotL,const in float NdotV,const in float NdotH){return NdotL*BRDF_specularSheen(sheenColor,sheenRoughness,NdotL,NdotV,NdotH);}\n#endif\n#if defined(X3D_CLEARCOAT_MATERIAL_EXT)\nvec3 getPunctualRadianceClearCoat(const in vec3 clearcoatNormal,const in vec3 v,const in vec3 l,const in vec3 h,const in float VdotH,const in vec3 f0,const in vec3 f90,const in float clearcoatRoughness){float NdotL=clamp(dot(clearcoatNormal,l),0.,1.);float NdotV=clamp(dot(clearcoatNormal,v),0.,1.);float NdotH=clamp(dot(clearcoatNormal,h),0.,1.);return NdotL*BRDF_specularGGX(clearcoatRoughness*clearcoatRoughness,NdotL,NdotV,NdotH);}\n#endif\n#endif\n#if defined(X3D_TRANSMISSION_MATERIAL_EXT)||defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)\nvec3 getPunctualRadianceTransmission(const in vec3 normal,const in vec3 view,const in vec3 pointToLight,const in float alphaRoughness,const in vec3 baseColor,const in float ior){float transmissionRoughness=applyIorToRoughness(alphaRoughness,ior);vec3 n=normalize(normal);vec3 v=normalize(view);vec3 l=normalize(pointToLight);vec3 l_mirror=normalize(l+2.*n*dot(-l,n));vec3 h=normalize(l_mirror+v);float D=D_GGX(clamp(dot(n,h),0.,1.),transmissionRoughness);float Vis=V_GGX(clamp(dot(n,l_mirror),0.,1.),clamp(dot(n,v),0.,1.),transmissionRoughness);return baseColor*D*Vis;}vec3 applyVolumeAttenuation(const in vec3 radiance,const in float transmissionDistance,const in vec3 attenuationColor,const in float attenuationDistance){if(attenuationDistance==0.){return radiance;}else{vec3 attenuationCoefficient=log(attenuationColor)/attenuationDistance;vec3 transmittance=exp(attenuationCoefficient*transmissionDistance);return transmittance*radiance;}}vec3 getVolumeTransmissionRay(const in vec3 n,const in vec3 v,const in float thickness,const in float ior,in mat4 modelMatrix){vec3 refractionVector=refract(-v,normalize(n),1./ior);vec3 modelScale;modelScale.x=length(modelMatrix[0].xyz);modelScale.y=length(modelMatrix[1].xyz);modelScale.z=length(modelMatrix[2].xyz);return normalize(refractionVector)*thickness*modelScale;}\n#endif\n#pragma X3D include "SubsurfaceScattering.glsl"\n'),Vo=s.A.add("Default2.vs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube;\n#pragma X3D include "common/Vertex.glsl"\n'),Do=s.A.add("Depth2.fs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;uniform int x3d_Id;layout(location=0)out vec4 x3d_FragData0;\n#if defined(X3D_CLIP_PLANES)\nin vec3 vertex;\n#endif\n#if defined(X3D_NORMAL_BUFFER)\n#if defined(X3D_NORMALS)\nin vec3 normal;\n#else\nconst vec3 normal=vec3(0.,0.,1.);\n#endif\nlayout(location=1)out vec4 x3d_FragData1;\n#endif\n#pragma X3D include "common/ClipPlanes.glsl"\n#pragma X3D include "common/Point.glsl"\nvoid main(){\n#if defined(X3D_CLIP_PLANES)\nclip();\n#endif\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\n#if!(defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES))\nif(getPointColor(vec4(1),gl_PointCoord).a<.5)discard;\n#endif\n#endif\n#if defined(X3D_NORMAL_BUFFER)\nx3d_FragData0=vec4(gl_FragCoord.z,vec3(x3d_Id));x3d_FragData1=vec4(normal,float(gl_FrontFacing));\n#else\nx3d_FragData0=vec4(gl_FragCoord.z);\n#endif\n}'),Lo=s.A.add("Depth2.vs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;in vec4 x3d_Vertex;\n#if defined(X3D_CLIP_PLANES)\nout vec3 vertex;\n#endif\n#if defined(X3D_NORMAL_BUFFER)\n#if defined(X3D_NORMALS)\nin vec3 x3d_Normal;\n#endif\nout vec3 normal;\n#endif\n#pragma X3D include "common/Utils.glsl"\n#pragma X3D include "common/Skin.glsl"\n#pragma X3D include "common/Instancing.glsl"\n#pragma X3D include "common/PointSize.glsl"\nvoid main(){\n#if defined(X3D_NORMALS)\nvec4 x3d_TransformedVertex=getInstanceVertex(getSkinVertex(x3d_Vertex,x3d_Normal,vec3(0)));vec3 x3d_TransformedNormal=getInstanceNormal(getSkinNormal(x3d_Normal));\n#else\nvec4 x3d_TransformedVertex=getInstanceVertex(getSkinVertex(x3d_Vertex,vec3(0),vec3(0)));\n#endif\nvec4 position=x3d_ModelViewMatrix*x3d_TransformedVertex;\n#if defined(X3D_CLIP_PLANES)\nvertex=position.xyz;\n#endif\n#if defined(X3D_NORMALS)\nnormal=x3d_TransformedNormal;\n#endif\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\ngl_PointSize=pointSize=getPointSize(position.xyz);\n#else\ngl_PointSize=1.;\n#endif\ngl_Position=x3d_ProjectionMatrix*position;}'),Bo=s.A.add("FullScreen2.vs",()=>"#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;in vec2 x3d_Vertex;out vec2 texCoord;void main(){texCoord=x3d_Vertex;gl_Position=vec4(x3d_Vertex,0.,1.);}"),ko=s.A.add("LineTransform2.fs",()=>"#version 300 es\nprecision highp float;void main(){}"),jo=s.A.add("LineTransform2.vs",()=>"#version 300 es\nprecision highp float;\n#if defined(X3D_PASS_0)\nuniform vec4 viewport;uniform mat4 modelViewProjectionMatrix;uniform mat4 invModelViewProjectionMatrix;uniform float linewidthScaleFactor1_2;\n#if defined(X3D_INSTANCING)\nin mat4 x3d_InstanceMatrix;\n#endif\nin float x3d_LengthSoFar;in float x3d_CoordIndex0;in float x3d_FogDepth0;in vec4 x3d_Color0;in vec4 x3d_Vertex0;in float x3d_CoordIndex1;in float x3d_FogDepth1;in vec4 x3d_Color1;in vec4 x3d_Vertex1;out float coordIndex0;out vec3 lineStipple0;out float fogDepth0;out vec4 color0;out vec4 vertex0;out float coordIndex1;out vec3 lineStipple1;out float fogDepth1;out vec4 color1;out vec4 vertex1;out float coordIndex2;out vec3 lineStipple2;out float fogDepth2;out vec4 color2;out vec4 vertex2;vec3 projectPoint(const in vec4 point,const in mat4 modelViewProjectionMatrix,const in vec4 viewport){vec4 vin=modelViewProjectionMatrix*point;vin.xyz=vin.xyz/(2.*vin.w)+.5;return vec3(vin.xy*viewport.zw+viewport.xy,vin.z);}vec4 unProjectPoint(const in vec3 win,const in mat4 invModelViewProjection,const in vec4 viewport){vec4 vin=vec4((win.xy-viewport.xy)/viewport.zw,win.z,1.);vin.xyz=vin.xyz*2.-1.;vin=invModelViewProjection*vin;return vec4(vin.xyz/vin.w,1.);}void main(){vec4 inVertex0=x3d_Vertex0;vec4 inVertex1=x3d_Vertex1;\n#if defined(X3D_INSTANCING)\ninVertex0=x3d_InstanceMatrix*inVertex0;inVertex1=x3d_InstanceMatrix*inVertex1;\n#endif\nvec3 projected0=projectPoint(inVertex0,modelViewProjectionMatrix,viewport);vec3 projected1=projectPoint(inVertex1,modelViewProjectionMatrix,viewport);float neg0=projected0.z>1.?-1.:1.;float neg1=projected1.z>1.?-1.:1.;vec2 direction=normalize(projected1.xy-projected0.xy);vec2 offset=vec2(-direction.y,direction.x)*linewidthScaleFactor1_2;vec3 l0=vec3(projected1.xy,x3d_LengthSoFar);vec3 l1=vec3(projected0.xy,x3d_LengthSoFar);mat4 unProjectMatrix=invModelViewProjectionMatrix;\n#if defined(X3D_INSTANCING)\nunProjectMatrix=inverse(x3d_InstanceMatrix)*unProjectMatrix;\n#endif\nif(gl_InstanceID % 2==0){vec2 pq0=projected0.xy+offset*neg1;vec2 pq1=projected0.xy-offset*neg1;vec2 pq2=projected1.xy-offset*neg1;vec4 p0=unProjectPoint(vec3(pq0.xy,projected0.z),unProjectMatrix,viewport);vec4 p1=unProjectPoint(vec3(pq1.xy,projected0.z),unProjectMatrix,viewport);vec4 p2=unProjectPoint(vec3(pq2.xy,projected1.z),unProjectMatrix,viewport);coordIndex0=x3d_CoordIndex0;lineStipple0=l0;fogDepth0=x3d_FogDepth0;color0=x3d_Color0;vertex0=p0;coordIndex1=x3d_CoordIndex0;lineStipple1=l0;fogDepth1=x3d_FogDepth0;color1=x3d_Color0;vertex1=p1;coordIndex2=x3d_CoordIndex1;lineStipple2=l1;fogDepth2=x3d_FogDepth1;color2=x3d_Color1;vertex2=p2;}else{vec2 pq0=projected0.xy+offset*neg0;vec2 pq2=projected1.xy-offset*neg0;vec2 pq3=projected1.xy+offset*neg0;vec4 p0=unProjectPoint(vec3(pq0.xy,projected0.z),unProjectMatrix,viewport);vec4 p2=unProjectPoint(vec3(pq2.xy,projected1.z),unProjectMatrix,viewport);vec4 p3=unProjectPoint(vec3(pq3.xy,projected1.z),unProjectMatrix,viewport);coordIndex0=x3d_CoordIndex0;lineStipple0=l0;fogDepth0=x3d_FogDepth0;color0=x3d_Color0;vertex0=p0;coordIndex1=x3d_CoordIndex1;lineStipple1=l1;fogDepth1=x3d_FogDepth1;color1=x3d_Color1;vertex1=p2;coordIndex2=x3d_CoordIndex1;lineStipple2=l1;fogDepth2=x3d_FogDepth1;color2=x3d_Color1;vertex2=p3;}}\n#endif\n#if defined(X3D_PASS_1)\n#if defined(X3D_INSTANCING)\nin mat4 x3d_InstanceMatrix;\n#endif\nout mat4 instanceMatrix0;out mat4 instanceMatrix1;out mat4 instanceMatrix2;void main(){instanceMatrix0=x3d_InstanceMatrix;instanceMatrix1=x3d_InstanceMatrix;instanceMatrix2=x3d_InstanceMatrix;}\n#endif\n#if defined(X3D_PASS_2)\n#if defined(X3D_INSTANCING)\nin mat3 x3d_InstanceNormalMatrix;in vec3 x3d_Normal0;in vec3 x3d_Normal1;in vec4 x3d_Tangent0;in vec4 x3d_Tangent1;\n#endif\nout mat3 instanceNormalMatrix0;out vec4 tangent0;out vec3 normal0;out mat3 instanceNormalMatrix1;out vec4 tangent1;out vec3 normal1;out mat3 instanceNormalMatrix2;out vec4 tangent2;out vec3 normal2;void main(){if(gl_InstanceID % 2==0){instanceNormalMatrix0=x3d_InstanceNormalMatrix;tangent0=x3d_Tangent0;normal0=x3d_Normal0;instanceNormalMatrix1=x3d_InstanceNormalMatrix;tangent1=x3d_Tangent0;normal1=x3d_Normal0;instanceNormalMatrix2=x3d_InstanceNormalMatrix;tangent2=x3d_Tangent1;normal2=x3d_Normal1;}else{instanceNormalMatrix0=x3d_InstanceNormalMatrix;tangent0=x3d_Tangent0;normal0=x3d_Normal0;instanceNormalMatrix1=x3d_InstanceNormalMatrix;tangent1=x3d_Tangent1;normal1=x3d_Normal1;instanceNormalMatrix2=x3d_InstanceNormalMatrix;tangent2=x3d_Tangent1;normal2=x3d_Normal1;}}\n#endif\n"),Uo=s.A.add("Material2.fs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube;\n#pragma X3D include "common/Material.glsl"\n'),Xo=s.A.add("OITCompose2.fs",()=>"#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;uniform sampler2D x3d_AccumRevealageTexture;uniform sampler2D x3d_AlphaTexture;out vec4 x3d_FragColor;void main(){ivec2 fragCoord=ivec2(gl_FragCoord.xy);vec4 accum=texelFetch(x3d_AccumRevealageTexture,fragCoord,0);if(accum.a>=1.)discard;float alpha=texelFetch(x3d_AlphaTexture,fragCoord,0).r;float revealage=1.-accum.a;x3d_FragColor=vec4(revealage*accum.rgb/clamp(alpha,.001,50000.),revealage);}"),zo=s.A.add("Physical2.fs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube;\n#pragma X3D include "pbr/PBR.glsl"\n'),Go=s.A.add("Pointing2.fs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;in vec3 vertex;in vec3 normal;in vec4 texCoord;\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\nin vec4 texCoord0;\n#else\nvec4 texCoord0=vec4(0.,0.,0.,1.);\n#endif\nlayout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1;layout(location=2)out vec4 x3d_FragData2;\n#pragma X3D include "common/ClipPlanes.glsl"\n#pragma X3D include "common/Point.glsl"\n#pragma X3D include "Stipple.glsl"\nuniform float x3d_Id;void main(){\n#if defined(X3D_CLIP_PLANES)\nclip();\n#endif\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\nif(getPointColor(vec4(1),gl_PointCoord).a<.5)discard;texCoord0=vec4(gl_PointCoord.x,1.-gl_PointCoord.y,0.,1.);\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nstipple(gl_FragCoord);\n#endif\nx3d_FragData0=vec4(vertex,x3d_Id);x3d_FragData1=vec4(normal,0.);x3d_FragData2=texCoord0;}'),Ho={includes:{2:{ClipPlanes:ho,Fog:co,Fragment:uo,Hatch:po,Instancing:go,Lighting:fo,Line2:mo,Material:yo,Normal:wo,Perlin:xo,Point:bo,PointSize:So,Shadow:To,Stipple:vo,Texture:Oo,Unlit:Eo,Utils:No,Vertex:Co,BRDF:Io,IBL:Fo,MaterialInfo:Mo,PBR:Ro,Punctual:Po,ToneMapping:Ji}},vertex:{2:{Default:Vo,Depth:Lo,FullScreen:Bo,LineTransform:jo,Pointing:s.A.add("Pointing2.vs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;in vec4 x3d_Vertex;\n#if defined(X3D_NORMALS)\nin vec3 x3d_Normal;\n#else\nconst vec3 x3d_Normal=vec3(0.,0.,1.);\n#endif\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\nin vec4 x3d_TexCoord0;\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nin vec3 x3d_LineStipple;\n#endif\nout vec3 vertex;out vec3 normal;\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\nout vec4 texCoord0;\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nflat out float lengthSoFar;flat out vec2 startPoint;out vec2 midPoint;\n#endif\n#pragma X3D include "common/Utils.glsl"\n#pragma X3D include "common/Skin.glsl"\n#pragma X3D include "common/Instancing.glsl"\n#pragma X3D include "common/PointSize.glsl"\nvoid main(){\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nlengthSoFar=x3d_LineStipple.z;startPoint=x3d_LineStipple.xy;midPoint=x3d_LineStipple.xy;\n#endif\nvec4 x3d_TransformedVertex=getInstanceVertex(getSkinVertex(x3d_Vertex,x3d_Normal,vec3(0)));vec4 position=x3d_ModelViewMatrix*x3d_TransformedVertex;vertex=position.xyz;normal=getInstanceNormal(getSkinNormal(x3d_Normal));\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\ngl_PointSize=pointSize=max(getPointSize(vertex),2.);\n#else\ngl_PointSize=2.;\n#endif\n#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D)\ntexCoord0=x3d_TexCoord0;\n#endif\ngl_Position=x3d_ProjectionMatrix*position;}')}},fragment:{2:{Depth:Do,LineTransform:ko,Material:Uo,OITCompose:Xo,Physical:zo,Pointing:Go,Unlit:s.A.add("Unlit2.fs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube;\n#pragma X3D include "common/Unlit.glsl"\n')}},addInclude:function(e,t){this.includes[2][e]=t},addFragment:function(e,t){this.fragment[2][e]=t}},$o=s.A.add("ShaderRegistry",Ho);var Yo=n(2141);function qo(e){Yo.A.call(this,e),this.addType(m.A.X3DShaderNode),this.valid=!1,this.selected=0}Object.assign(Object.setPrototypeOf(qo.prototype,Yo.A.prototype),{setValid(e){this._isValid=this.valid=e},isValid(){return this.valid},select(){++this.selected,this._isSelected.getValue()||(this._isSelected=!0)},deselect(){--this.selected,0===this.selected&&this._isSelected.getValue()&&(this._isSelected=!1)}}),Object.defineProperties(qo,Je.A.getStaticProperties("X3DShaderNode","Shaders",1));const Wo=qo,Ko=s.A.add("X3DShaderNode",Wo);var Zo=n(1256),Qo=n(9340);const Jo=Symbol.for("X_ITE.X3DField.uniformLocation");function ea(e){this.addType(m.A.X3DProgrammableShaderObject),this.uniformNames=[],this.environmentLightNodes=[],this.lightNodes=[],this.textureProjectorNodes=[],this.textures=new Set,this.x3d_ClipPlane=[],this.x3d_EnvironmentLight=[],this.x3d_Light=[],this.x3d_MultiTexture=[],this.x3d_TexCoord=[],this.x3d_Texture=[],this.x3d_TextureCoordinateGenerator=[],this.x3d_TextureMatrix=[],this.x3d_TextureProjector=[]}Object.assign(ea.prototype,{initialize(){},canUserDefinedFields:()=>!0,getUniformNames(){return this.uniformNames},setUniformNames(e){this.uniformNames=e},getDefaultUniformsAndAttributes(){const e=this.getProgram(),t=this.getBrowser(),i=t.getContext(),n=t.getMaxClipPlanes(),s=t.getMaxEnvironmentLights(),r=t.getMaxLights(),o=t.getMaxTextures(),a=t.getMaxTextureTransforms(),l=t.getMaxTexCoords();i.useProgram(e);for(const t of this.uniformNames)this[t]=i.getUniformLocation(e,t);for(let t=0;t<n;++t)this.x3d_ClipPlane[t]=i.getUniformLocation(e,`x3d_ClipPlane[${t}]`);this.x3d_FogColor=this.getUniformLocation(i,e,"x3d_Fog.color","x3d_FogColor"),this.x3d_FogVisibilityStart=this.getUniformLocation(i,e,"x3d_Fog.visibilityStart","x3d_FogVisibilityStart"),this.x3d_FogVisibilityRange=this.getUniformLocation(i,e,"x3d_Fog.visibilityRange","x3d_FogVisibilityRange"),this.x3d_FogMatrix=this.getUniformLocation(i,e,"x3d_Fog.matrix","x3d_FogMatrix"),this.x3d_PointPropertiesPointSizeScaleFactor=i.getUniformLocation(e,"x3d_PointProperties.pointSizeScaleFactor"),this.x3d_PointPropertiesPointSizeMinValue=i.getUniformLocation(e,"x3d_PointProperties.pointSizeMinValue"),this.x3d_PointPropertiesPointSizeMaxValue=i.getUniformLocation(e,"x3d_PointProperties.pointSizeMaxValue"),this.x3d_PointPropertiesAttenuation=i.getUniformLocation(e,"x3d_PointProperties.attenuation"),this.x3d_LinePropertiesLinetype=i.getUniformLocation(e,"x3d_LineProperties.linetype"),this.x3d_LineStippleScale=i.getUniformLocation(e,"x3d_LineProperties.lineStippleScale"),this.x3d_LinePropertiesTexture=i.getUniformLocation(e,"x3d_LineProperties.texture"),this.x3d_FillPropertiesFilled=i.getUniformLocation(e,"x3d_FillProperties.filled"),this.x3d_FillPropertiesHatched=i.getUniformLocation(e,"x3d_FillProperties.hatched"),this.x3d_FillPropertiesHatchColor=i.getUniformLocation(e,"x3d_FillProperties.hatchColor"),this.x3d_FillPropertiesTexture=i.getUniformLocation(e,"x3d_FillProperties.texture"),this.x3d_FillPropertiesScale=i.getUniformLocation(e,"x3d_FillProperties.scale");for(let t=0;t<s;++t)this.x3d_EnvironmentLight[t]={color:i.getUniformLocation(e,"x3d_EnvironmentLightSource.color"),intensity:i.getUniformLocation(e,"x3d_EnvironmentLightSource.intensity"),ambientIntensity:i.getUniformLocation(e,"x3d_EnvironmentLightSource.ambientIntensity"),rotation:i.getUniformLocation(e,"x3d_EnvironmentLightSource.rotation"),diffuseTexture:i.getUniformLocation(e,"x3d_EnvironmentLightSource.diffuseTexture"),diffuseTextureLevels:i.getUniformLocation(e,"x3d_EnvironmentLightSource.diffuseTextureLevels"),specularTexture:i.getUniformLocation(e,"x3d_EnvironmentLightSource.specularTexture"),specularTextureLevels:i.getUniformLocation(e,"x3d_EnvironmentLightSource.specularTextureLevels"),sheenTexture:i.getUniformLocation(e,"x3d_EnvironmentLightSource.sheenTexture"),sheenTextureLevels:i.getUniformLocation(e,"x3d_EnvironmentLightSource.sheenTextureLevels"),ggxLUTTexture:i.getUniformLocation(e,"x3d_EnvironmentLightSource.ggxLUTTexture"),charlieLUTTexture:i.getUniformLocation(e,"x3d_EnvironmentLightSource.charlieLUTTexture")};for(let t=0;t<r;++t)this.x3d_Light[t]={type:this.getUniformLocation(i,e,`x3d_LightSource[${t}].type`,`x3d_LightType[${t}]`),color:this.getUniformLocation(i,e,`x3d_LightSource[${t}].color`,`x3d_LightColor[${t}]`),ambientIntensity:this.getUniformLocation(i,e,`x3d_LightSource[${t}].ambientIntensity`,`x3d_LightAmbientIntensity[${t}]`),intensity:this.getUniformLocation(i,e,`x3d_LightSource[${t}].intensity`,`x3d_LightIntensity[${t}]`),attenuation:this.getUniformLocation(i,e,`x3d_LightSource[${t}].attenuation`,`x3d_LightAttenuation[${t}]`),location:this.getUniformLocation(i,e,`x3d_LightSource[${t}].location`,`x3d_LightLocation[${t}]`),direction:this.getUniformLocation(i,e,`x3d_LightSource[${t}].direction`,`x3d_LightDirection[${t}]`),beamWidth:this.getUniformLocation(i,e,`x3d_LightSource[${t}].beamWidth`,`x3d_LightBeamWidth[${t}]`),cutOffAngle:this.getUniformLocation(i,e,`x3d_LightSource[${t}].cutOffAngle`,`x3d_LightCutOffAngle[${t}]`),radius:this.getUniformLocation(i,e,`x3d_LightSource[${t}].radius`,`x3d_LightRadius[${t}]`),matrix:this.getUniformLocation(i,e,`x3d_LightSource[${t}].matrix`,`x3d_LightMatrix[${t}]`),shadowIntensity:i.getUniformLocation(e,`x3d_LightSource[${t}].shadowIntensity`),shadowColor:i.getUniformLocation(e,`x3d_LightSource[${t}].shadowColor`),shadowBias:i.getUniformLocation(e,`x3d_LightSource[${t}].shadowBias`),shadowMatrix:i.getUniformLocation(e,`x3d_LightSource[${t}].shadowMatrix`),shadowMapSize:i.getUniformLocation(e,`x3d_LightSource[${t}].shadowMapSize`),shadowMap:i.getUniformLocation(e,`x3d_ShadowMap[${t}]`)};this.x3d_AmbientIntensity=this.getUniformLocation(i,e,"x3d_Material.ambientIntensity","x3d_FrontMaterial.ambientIntensity"),this.x3d_DiffuseColor=this.getUniformLocation(i,e,"x3d_Material.diffuseColor","x3d_FrontMaterial.diffuseColor"),this.x3d_SpecularColor=this.getUniformLocation(i,e,"x3d_Material.specularColor","x3d_FrontMaterial.specularColor"),this.x3d_EmissiveColor=this.getUniformLocation(i,e,"x3d_Material.emissiveColor","x3d_FrontMaterial.emissiveColor"),this.x3d_Shininess=this.getUniformLocation(i,e,"x3d_Material.shininess","x3d_FrontMaterial.shininess"),this.x3d_BaseColor=i.getUniformLocation(e,"x3d_Material.baseColor"),this.x3d_Metallic=i.getUniformLocation(e,"x3d_Material.metallic"),this.x3d_Roughness=i.getUniformLocation(e,"x3d_Material.roughness"),this.x3d_Glossiness=i.getUniformLocation(e,"x3d_Material.glossiness"),this.x3d_OcclusionStrength=i.getUniformLocation(e,"x3d_Material.occlusionStrength"),this.x3d_NormalScale=i.getUniformLocation(e,"x3d_Material.normalScale"),this.x3d_Transparency=this.getUniformLocation(i,e,"x3d_Material.transparency","x3d_FrontMaterial.transparency");const h=["x3d_Viewport","x3d_ProjectionMatrix","x3d_ModelViewMatrix","x3d_EyeMatrix","x3d_NormalMatrix","x3d_ViewMatrix","x3d_CameraSpaceMatrix","x3d_TexCoordRamp","x3d_JointsTexture","x3d_DisplacementsTexture","x3d_DisplacementWeightsTexture","x3d_JointMatricesTexture","x3d_Id","x3d_AlphaCutoff","x3d_Exposure","x3d_LogarithmicFarFactor1_2","x3d_MultiTextureColor"];for(const t of h)this[t]=i.getUniformLocation(e,t);for(const t of _o.names)this[t]={textureTransformMapping:i.getUniformLocation(e,t+".textureTransformMapping"),textureCoordinateMapping:i.getUniformLocation(e,t+".textureCoordinateMapping"),texture2D:i.getUniformLocation(e,t+".texture2D"),texture3D:i.getUniformLocation(e,t+".texture3D"),textureCube:i.getUniformLocation(e,t+".textureCube")};for(let t=0;t<o;++t)this.x3d_Texture[t]={texture2D:i.getUniformLocation(e,`x3d_Texture2D[${t}]`),texture3D:i.getUniformLocation(e,`x3d_Texture3D[${t}]`),textureCube:this.getUniformLocation(i,e,`x3d_TextureCube[${t}]`,`x3d_CubeMapTexture[${t}]`)},this.x3d_MultiTexture[t]={mode:i.getUniformLocation(e,`x3d_MultiTexture[${t}].mode`),alphaMode:i.getUniformLocation(e,`x3d_MultiTexture[${t}].alphaMode`),source:i.getUniformLocation(e,`x3d_MultiTexture[${t}].source`),function:i.getUniformLocation(e,`x3d_MultiTexture[${t}].function`)},this.x3d_TextureProjector[t]={color:i.getUniformLocation(e,`x3d_TextureProjector[${t}].color`),intensity:i.getUniformLocation(e,`x3d_TextureProjector[${t}].intensity`),location:i.getUniformLocation(e,`x3d_TextureProjector[${t}].location`),params:i.getUniformLocation(e,`x3d_TextureProjector[${t}].params`),matrix:i.getUniformLocation(e,`x3d_TextureProjector[${t}].matrix`),texture:i.getUniformLocation(e,`x3d_TextureProjectorTexture[${t}]`)};for(let t=0;t<a;++t)this.x3d_TextureMatrix[t]=i.getUniformLocation(e,`x3d_TextureMatrix[${t}]`);this.x3d_TexCoord.length=0;for(let t=0;t<l;++t){this.x3d_TextureCoordinateGenerator[t]={mode:i.getUniformLocation(e,`x3d_TextureCoordinateGenerator[${t}].mode`),parameter:i.getUniformLocation(e,`x3d_TextureCoordinateGenerator[${t}].parameter`)};const n=this.getAttribLocation(i,e,`x3d_TexCoord${t}`,t?"":"x3d_TexCoord");-1!==n&&this.x3d_TexCoord.push([t,n])}const c=["CoordIndex","LineStipple","FogDepth","Color","Normal","Tangent","Vertex","Particle","ParticleVelocity","ParticleMatrix","ParticleNormalMatrix","InstanceMatrix","InstanceNormalMatrix"],u={InstanceMatrix:["ParticleMatrix"],InstanceNormalMatrix:["ParticleNormalMatrix"]};for(const t of c){let n=i.getAttribLocation(e,`x3d_${t}`);for(const s of u[t]??[]){if(-1!==n)break;n=i.getAttribLocation(e,`x3d_${s}`)}this[`x3d_${t}`]=n,n<0?(this[`enable${t}Attribute`]=Function.prototype,this[`${Qo.toLowerCaseFirst(t)}AttributeDivisor`]=Function.prototype):(delete this[`enable${t}Attribute`],delete this[`${Qo.toLowerCaseFirst(t)}AttributeDivisor`])}this.x3d_TexCoord.length?(delete this.enableTexCoordAttribute,delete this.texCoordAttributeDivisor):(this.enableTexCoordAttribute=Function.prototype,this.texCoordAttributeDivisor=Function.prototype),i.uniform1f(this.x3d_Exposure,Math.max(t.getBrowserOption("Exposure"),0));const d=t.getDefaultTexture2DUnit(),p=t.getDefaultTexture3DUnit(),g=t.getDefaultTextureCubeUnit();for(const e of this.x3d_Light)i.uniform1i(e.shadowMap,d);for(const e of this.x3d_Texture)i.uniform1i(e.texture2D,d),i.uniform1i(e.texture3D,p),i.uniform1i(e.textureCube,g)},getUniformLocation(e,t,i,n){const s=e.getUniformLocation(t,i);if(s)return s;{const s=e.getUniformLocation(t,n);return s&&console.warn(this.getTypeName(),this.getName(),`Using uniform location name '${n}' is depreciated, use '${i}'. See https://create3000.github.io/x_ite/custom-shaders.`),s}},getAttribLocation(e,t,i,n){const s=e.getAttribLocation(t,i);if(s>=0)return s;{const s=e.getAttribLocation(t,n);return s>=0&&console.warn(this.getTypeName(),this.getName(),`Using attribute location name '${n}' is depreciated, use '${i}'. See https://create3000.github.io/x_ite/custom-shaders.`),s}},addShaderFields(){const e=this.getBrowser().getContext(),t=this.getProgram();e.useProgram(t),this.textures.clear();for(const i of this.getUserDefinedFields()){if(i.getAccessType()===m.A.outputOnly)continue;const n=e.getUniformLocation(t,i.getName());if(n){switch(i.getType()){case m.A.SFBool:case m.A.SFInt32:n.uniform=e.uniform1i;break;case m.A.SFDouble:case m.A.SFFloat:case m.A.SFTime:n.uniform=e.uniform1f;break;case m.A.SFImage:n.array=new Int32Array(3+i.array.length),n.uniform=e.uniform1iv;break;case m.A.SFMatrix3d:case m.A.SFMatrix3f:case m.A.SFRotation:n.array=new Float32Array(9),n.uniform=e.uniformMatrix3fv;break;case m.A.SFMatrix4d:case m.A.SFMatrix4f:n.array=new Float32Array(16),n.uniform=e.uniformMatrix4fv;break;case m.A.SFNode:break;case m.A.SFVec2d:case m.A.SFVec2f:n.uniform=e.uniform2f;break;case m.A.SFColor:case m.A.SFVec3d:case m.A.SFVec3f:case m.A.SFColor:case m.A.SFVec3d:case m.A.SFVec3f:n.uniform=e.uniform3f;break;case m.A.SFColorRGBA:case m.A.SFVec4d:case m.A.SFVec4f:n.uniform=e.uniform4f;break;case m.A.MFBool:case m.A.MFInt32:n.array=new Int32Array(this.getLocationLength(e,t,i)),n.uniform=e.uniform1iv;break;case m.A.MFFloat:case m.A.MFDouble:case m.A.MFTime:n.array=new Float32Array(this.getLocationLength(e,t,i)),n.uniform=e.uniform1fv;break;case m.A.MFImage:n.array=new Int32Array(this.getImagesLength(i)),n.uniform=e.uniform1iv;break;case m.A.MFMatrix3d:case m.A.MFMatrix3f:case m.A.MFRotation:n.array=new Float32Array(9*this.getLocationLength(e,t,i)),n.uniform=e.uniformMatrix3fv;break;case m.A.MFMatrix4d:case m.A.MFMatrix4f:n.array=new Float32Array(16*this.getLocationLength(e,t,i)),n.uniform=e.uniformMatrix4fv;break;case m.A.MFNode:{const s=n.locations=[];for(let n=0;;++n){const r=e.getUniformLocation(t,`${i.getName()}[${n}]`);if(!r)break;s.push(r)}break}case m.A.MFVec2d:case m.A.MFVec2f:n.array=new Float32Array(2*this.getLocationLength(e,t,i)),n.uniform=e.uniform2fv;break;case m.A.MFColor:case m.A.MFVec3d:case m.A.MFVec3f:n.array=new Float32Array(3*this.getLocationLength(e,t,i)),n.uniform=e.uniform3fv;break;case m.A.MFColorRGBA:case m.A.MFVec4d:case m.A.MFVec4f:n.array=new Float32Array(4*this.getLocationLength(e,t,i)),n.uniform=e.uniform4fv}n.array?i[Jo]=n.array.length?n:null:i[Jo]=n,i[Jo]&&(i.addInterest("set_field__",this),this.set_field__(i))}}},removeShaderFields(){for(const e of this.getUserDefinedFields())e.removeInterest("set_field__",this)},set_field__:(()=>{const e=new Float32Array(9);return function(t){const i=this.getBrowser().getContext(),n=this.getProgram(),s=t[Jo];switch(i.useProgram(n),t.getType()){case m.A.SFBool:case m.A.SFInt32:case m.A.SFDouble:case m.A.SFFloat:case m.A.SFTime:return void s.uniform.call(i,s,t.getValue());case m.A.SFImage:{const{array:e,uniform:n}=s;let r=0;e[r++]=t.width,e[r++]=t.height,e[r++]=t.comp;for(const i of t.array)e[r++]=i;return void n.call(i,s,e)}case m.A.SFMatrix3d:case m.A.SFMatrix3f:case m.A.SFMatrix4d:case m.A.SFMatrix4f:return s.array.set(t.getValue()),void s.uniform.call(i,s,!1,s.array);case m.A.SFNode:{const e=(0,hi.A)(m.A.X3DTextureNode,t);return void(e?(s.name=t.getName(),s.texture=e,this.textures.add(s)):this.textures.delete(s))}case m.A.SFRotation:return t.getValue().getMatrix(s.array),void s.uniform.call(i,s,!1,s.array);case m.A.SFString:return;case m.A.SFVec2d:case m.A.SFVec2f:case m.A.SFColor:case m.A.SFVec3d:case m.A.SFVec3f:case m.A.SFColorRGBA:case m.A.SFVec4d:case m.A.SFVec4f:return void s.uniform.call(i,s,...t.getValue());case m.A.MFBool:case m.A.MFInt32:case m.A.MFDouble:case m.A.MFFloat:case m.A.MFTime:{const{array:e,uniform:n}=s;let r=0;for(const i of t)e[r++]=i;return e.fill(0,r),void n.call(i,s,e)}case m.A.MFImage:{const{array:e,uniform:n}=s;let r=0;for(const i of t){e[r++]=i.width,e[r++]=i.height,e[r++]=i.comp;for(const t of i.array)e[r++]=t}return e.fill(0,r),void n.call(i,s,e)}case m.A.MFMatrix3d:case m.A.MFMatrix3f:case m.A.MFMatrix4d:case m.A.MFMatrix4f:{const{array:e,uniform:n}=s;let r=0;for(const i of t)for(const t of i)e[r++]=t;return e.fill(0,r),void n.call(i,s,!1,e)}case m.A.MFNode:{const e=s.locations,i=t.length;for(let n=0;n<i;++n){const i=(0,hi.A)(m.A.X3DTextureNode,t[n]);i?(e[n].name=t.getName(),e[n].texture=i,this.textures.add(e[n])):this.textures.delete(e[n])}return}case m.A.MFRotation:{const{array:n,uniform:r}=s;let o=0;for(const i of t){i.getValue().getMatrix(e);for(const t of e)n[o++]=t}return n.fill(0,o),void r.call(i,s,!1,n)}case m.A.MFString:return;case m.A.MFVec2d:case m.A.MFVec2f:case m.A.MFColor:case m.A.MFVec3d:case m.A.MFVec3f:case m.A.MFColorRGBA:case m.A.MFVec4d:case m.A.MFVec4f:{const{array:e,uniform:n}=s;let r=0;for(const i of t)for(const t of i)e[r++]=t;return e.fill(0,r),void n.call(i,s,e)}}}})(),getImagesLength(e){const t=e.getValue();let i=3*t.length;for(const e of t)i+=e.array.length;return i},getLocationLength(e,t,i){const n=i.getName();for(let i=0;;++i){if(!e.getUniformLocation(t,`${n}[${i}]`))return i}},hasFog(e){return this.fogNode===e||(this.fogNode=e,!1)},hasEnvironmentLight(e,t){return this.environmentLightNodes[e]===t||(this.environmentLightNodes[e]=t,!1)},hasLight(e,t){return this.lightNodes[e]===t||(this.lightNodes[e]=t,!1)},hasTextureProjector(e,t){return this.textureProjectorNodes[e]===t||(this.textureProjectorNodes[e]=t,!1)},setClipPlanes(e,t,i){this.numClipPlanes=0;for(const n of t)n.setShaderUniforms(e,this,i)},setUniforms:(()=>{const e=new Float32Array(9);return function(t,i,n,s=!0){const{renderObject:r,fogNode:o,appearanceNode:a,hAnimNode:l,modelViewMatrix:h,textureNode:c,localObjects:u}=i,d=a.getStyleProperties(n.geometryType),p=s?a.getMaterial():a.getBackMaterial(),g=c??a.getTexture(),f=r.getRenderCount();if(this.renderCount!==f){this.renderCount=f,t.uniform4iv(this.x3d_Viewport,r.getViewportArray()),t.uniformMatrix4fv(this.x3d_ProjectionMatrix,!1,r.getProjectionMatrixArray()),t.uniformMatrix4fv(this.x3d_EyeMatrix,!1,r.getEyeMatrixArray()),t.uniformMatrix4fv(this.x3d_ViewMatrix,!1,r.getViewMatrixArray()),t.uniformMatrix4fv(this.x3d_CameraSpaceMatrix,!1,r.getCameraSpaceMatrixArray()),this.fogNode=null,this.numEnvironmentLights=0,this.numLights=0,this.numTextureProjectors=0,this.environmentLightNodes.length=0,this.lightNodes.length=0,this.textureProjectorNodes.length=0;for(const e of r.getGlobalLights())e.setShaderUniforms(t,this,r);if(this.numGlobalEnvironmentLights=this.numEnvironmentLights,this.numGlobalLights=this.numLights,this.numGlobalTextureProjectors=this.numTextureProjectors,r.getLogarithmicDepthBuffer()){const e=r.getNavigationInfo(),i=r.getViewpoint();t.uniform1f(this.x3d_LogarithmicFarFactor1_2,1/Math.log2(i.getFarDistance(e)+1))}}t.uniformMatrix4fv(this.x3d_ModelViewMatrix,!1,h),n.hasNormals&&(e[0]=h[0],e[3]=h[1],e[6]=h[2],e[1]=h[4],e[4]=h[5],e[7]=h[6],e[2]=h[8],e[5]=h[9],e[8]=h[10],Zo.A.prototype.inverse.call(e),t.uniformMatrix3fv(this.x3d_NormalMatrix,!1,e)),o?.setShaderUniforms(t,this),this.numClipPlanes=0,this.numEnvironmentLights=this.numGlobalEnvironmentLights,this.numLights=this.numGlobalLights,this.numTextureProjectors=this.numGlobalTextureProjectors;for(const e of u)e.setShaderUniforms(t,this,r);t.uniform1f(this.x3d_AlphaCutoff,a.getAlphaCutoff()),d?.setShaderUniforms(t,this),p.setShaderUniforms(t,this,a.getTextureTransformMapping(),n.getTextureCoordinateMapping(),s),g?.setShaderUniforms(t,this.x3d_Texture[0],this),a.getTextureTransform().setShaderUniforms(t,this),n.getTextureCoordinate().setShaderUniforms(t,this),l?.setShaderUniforms(t,this)}})(),enable(e){e.useProgram(this.getProgram());for(const t of this.textures){const i=t.texture,n=this.getBrowser().popTextureUnit();if(void 0===n){console.warn(`Not enough combined texture units for uniform variable '${t.name}' available.`);break}e.activeTexture(e.TEXTURE0+n),e.bindTexture(i.getTarget(),i.getTexture()),e.uniform1i(t,n)}},enableFloatAttrib(e,t,i,n,s,r,o=0){const a=e.getAttribLocation(this.getProgram(),t);-1!==a&&(e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(a),e.vertexAttribPointer(a,n,e.FLOAT,!1,s,r),e.vertexAttribDivisor(a,o))},enableMatrix3Attrib(e,t,i,n,s){const r=e.getAttribLocation(this.getProgram(),t);if(-1!==r){n||=36,e.bindBuffer(e.ARRAY_BUFFER,i);for(let t=0;t<3;++t){const i=r+t;e.enableVertexAttribArray(i),e.vertexAttribPointer(i,3,e.FLOAT,!1,n,s+12*t)}}},enableMatrix4Attrib(e,t,i,n,s){const r=e.getAttribLocation(this.getProgram(),t);if(-1!==r){n||=64,e.bindBuffer(e.ARRAY_BUFFER,i);for(let t=0;t<4;++t){const i=r+t;e.enableVertexAttribArray(i),e.vertexAttribPointer(i,4,e.FLOAT,!1,n,s+16*t)}}},enableCoordIndexAttribute(e,t,i,n){const s=this.x3d_CoordIndex;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(s),e.vertexAttribPointer(s,1,e.FLOAT,!1,i,n)},enableLineStippleAttribute(e,t,i,n){const s=this.x3d_LineStipple;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(s),e.vertexAttribPointer(s,3,e.FLOAT,!1,i,n)},enableFogDepthAttribute(e,t,i,n){const s=this.x3d_FogDepth;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(s),e.vertexAttribPointer(s,1,e.FLOAT,!1,i,n)},enableColorAttribute(e,t,i,n,s=0){const r=this.x3d_Color;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,4,e.FLOAT,!1,i,n),e.vertexAttribDivisor(r,s)},colorAttributeDivisor(e,t){e.vertexAttribDivisor(this.x3d_Color,t)},enableTexCoordAttribute(e,t,i,n){for(const[s,r]of this.x3d_TexCoord)e.bindBuffer(e.ARRAY_BUFFER,t[s]),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,4,e.FLOAT,!1,i,n)},texCoordAttributeDivisor(e,t){for(const[i,n]of this.x3d_TexCoord)e.vertexAttribDivisor(n,t)},enableNormalAttribute(e,t,i,n){const s=this.x3d_Normal;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(s),e.vertexAttribPointer(s,3,e.FLOAT,!1,i,n)},normalAttributeDivisor(e,t){e.vertexAttribDivisor(this.x3d_Normal,t)},enableTangentAttribute(e,t,i,n){const s=this.x3d_Tangent;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(s),e.vertexAttribPointer(s,4,e.FLOAT,!1,i,n)},tangentAttributeDivisor(e,t){e.vertexAttribDivisor(this.x3d_Tangent,t)},enableVertexAttribute(e,t,i,n){const s=this.x3d_Vertex;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(s),e.vertexAttribPointer(s,4,e.FLOAT,!1,i,n)},enableParticleAttribute(e,t,i,n,s){const r=this.x3d_Particle;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,4,e.FLOAT,!1,i,n),e.vertexAttribDivisor(r,s)},enableParticleVelocityAttribute(e,t,i,n,s){const r=this.x3d_ParticleVelocity;e.bindBuffer(e.ARRAY_BUFFER,t),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,3,e.FLOAT,!1,i,n),e.vertexAttribDivisor(r,s)},enableInstanceMatrixAttribute(e,t,i,n,s){const r=this.x3d_InstanceMatrix;i||=64,e.bindBuffer(e.ARRAY_BUFFER,t);for(let t=0;t<4;++t){const o=r+t;e.enableVertexAttribArray(o),e.vertexAttribPointer(o,4,e.FLOAT,!1,i,n+16*t),e.vertexAttribDivisor(o,s)}},enableInstanceNormalMatrixAttribute(e,t,i,n,s){const r=this.x3d_InstanceNormalMatrix;i||=36,e.bindBuffer(e.ARRAY_BUFFER,t);for(let t=0;t<3;++t){const o=r+t;e.enableVertexAttribArray(o),e.vertexAttribPointer(o,3,e.FLOAT,!1,i,n+12*t),e.vertexAttribDivisor(o,s)}},dispose(){}}),Object.defineProperties(ea,Je.A.getStaticProperties("X3DProgrammableShaderObject","Shaders",1));const ta=ea,ia=s.A.add("X3DProgrammableShaderObject",ta);var na=n(2895);function sa(e){na.A.call(this,e),this.addType(m.A.X3DNetworkSensorNode)}Object.setPrototypeOf(sa.prototype,na.A.prototype),Object.defineProperties(sa,Je.A.getStaticProperties("X3DNetworkSensorNode","Networking",1));const ra=sa,oa=s.A.add("X3DNetworkSensorNode",ra);function aa(e){oa.call(this,e),this.addType(m.A.LoadSensor),e.getSpecificationVersion()<=3.3&&this.addAlias("watchList",this._children),this.urlObjects=[],this.aborted=!1,this.timeOutId=void 0}Object.assign(Object.setPrototypeOf(aa.prototype,oa.prototype),{initialize(){oa.prototype.initialize.call(this),this._enabled.addInterest("set_enabled__",this),this._timeOut.addInterest("set_timeOut__",this),this._children.addInterest("set_children__",this),this.set_children__()},set_enabled__(){this._enabled.getValue()?this.reset():(this.abort(),this.remove())},set_timeOut__(){this._isActive.getValue()&&(this.clearTimeout(),this.aborted=!1,this._timeOut.getValue()>0&&(this.timeOutId=setTimeout(this.abort.bind(this),1e3*this._timeOut.getValue())))},set_children__(){this.reset()},set_loadState__(e){switch(e.checkLoadState()){case m.A.NOT_STARTED_STATE:break;case m.A.IN_PROGRESS_STATE:case m.A.COMPLETE_STATE:case m.A.FAILED_STATE:this.count()}},count(){const e=this.urlObjects;if(e.length){let t=0,i=0;for(const n of e)t+=n.checkLoadState()===m.A.COMPLETE_STATE,i+=n.checkLoadState()===m.A.FAILED_STATE;const n=t===e.length,s=t/e.length;this.aborted||i||n?(this.clearTimeout(),this._isActive=!1,this._isLoaded=n,this._progress=s,n&&(this._loadTime=this.getBrowser().getCurrentTime())):this._isActive.getValue()?this._progress=s:(this._isActive=!0,this._progress=s,this.set_timeOut__())}else this._isActive=!1,this._isLoaded=!1,this._progress=0},abort(){this.clearTimeout(),this.aborted=!0,this._enabled.getValue()&&this.count()},reset(){if(this.remove(),!this._enabled.getValue())return;const e=this.urlObjects;for(const t of this._children){const i=(0,hi.A)(m.A.X3DUrlObject,t);i&&e.push(i)}for(const t of e)t._loadState.addInterest("set_loadState__",this,t);this.count()},remove(){this.clearTimeout();const e=this.urlObjects;for(const t of e)t._loadState.removeInterest("set_loadState__",this);e.length=0},clearTimeout(){clearTimeout(this.timeOutId),this.timeOutId=void 0}}),Object.defineProperties(aa,{...Je.A.getStaticProperties("LoadSensor","Networking",3,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"timeOut",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"isLoaded",new c.A.SFBool),new o.A(m.A.outputOnly,"progress",new c.A.SFFloat),new o.A(m.A.outputOnly,"loadTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const la=aa,ha=s.A.add("LoadSensor",la);function ca(e){Ko.call(this,e),ia.call(this,e),this.addType(m.A.ComposedShader),this.loadSensor=new ha(e),this.transformFeedbackVaryings=[]}Object.assign(Object.setPrototypeOf(ca.prototype,Ko.prototype),ia.prototype,{initialize(){Ko.prototype.initialize.call(this),ia.prototype.initialize.call(this),this._activate.addInterest("set_activate__",this),this._language.addInterest("set_loaded__",this),this._parts.addFieldInterest(this.loadSensor._children),this.loadSensor._isLoaded.addInterest("connectLoaded",this),this.loadSensor._children=this._parts,this.loadSensor.setPrivate(!0),this.loadSensor.setup(),this.loadSensor._isLoaded.getValue()?this.set_loaded__():this.connectLoaded()},connectLoaded(){this.loadSensor._isLoaded.removeInterest("connectLoaded",this),this.loadSensor._isLoaded.addInterest("set_loaded__",this)},addUserDefinedField(e,t,i){const n=this.isInitialized()&&this.isValid();n&&this.removeShaderFields(),Ko.prototype.addUserDefinedField.call(this,e,t,i),n&&this.addShaderFields()},removeUserDefinedField(e){const t=this.isInitialized()&&this.isValid();t&&this.removeShaderFields(),Ko.prototype.removeUserDefinedField.call(this,e),t&&this.addShaderFields()},setTransformFeedbackVaryings(e){this.transformFeedbackVaryings=e},getProgram(){return this.program},set_activate__(){this._activate.getValue()&&this.set_loaded__()},set_loaded__(){if(this.loadSensor._isLoaded.getValue()&&"GLSL"===this._language.getValue()){const e=this.getBrowser().getContext(),t=e.createProgram();this.isValid()&&this.removeShaderFields(),e.deleteProgram(this.program),this.program=t;for(const i of this._parts){const n=(0,hi.A)(m.A.ShaderPart,i);n?.getShader()&&e.attachShader(t,n.getShader())}this.transformFeedbackVaryings.length&&e.transformFeedbackVaryings(t,this.transformFeedbackVaryings,e.INTERLEAVED_ATTRIBS),e.linkProgram(t),e.getProgramParameter(t,e.LINK_STATUS)?(this.setValid(!0),this.getDefaultUniformsAndAttributes(),this.addShaderFields()):(this.setValid(!1),this._parts.length&&console.warn(`Couldn't initialize ${this.getTypeName()} '${this.getName()}': ${e.getProgramInfoLog(t)}`))}else this.setValid(!1)},dispose(){ia.prototype.dispose.call(this),Ko.prototype.dispose.call(this)}}),Object.defineProperties(ca,{...Je.A.getStaticProperties("ComposedShader","Shaders",1,"shaders","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"activate",new c.A.SFBool),new o.A(m.A.outputOnly,"isSelected",new c.A.SFBool),new o.A(m.A.outputOnly,"isValid",new c.A.SFBool),new o.A(m.A.initializeOnly,"language",new c.A.SFString),new o.A(m.A.inputOutput,"parts",new c.A.MFNode)]),enumerable:!0}});const ua=ca,da=s.A.add("ComposedShader",ua);let pa=0;const ga={REPLACE:pa++,MODULATE:pa++,MODULATE2X:pa++,MODULATE4X:pa++,ADD:pa++,ADDSIGNED:pa++,ADDSIGNED2X:pa++,ADDSMOOTH:pa++,SUBTRACT:pa++,BLENDDIFFUSEALPHA:pa++,BLENDTEXTUREALPHA:pa++,BLENDFACTORALPHA:pa++,BLENDCURRENTALPHA:pa++,MODULATEALPHA_ADDCOLOR:pa++,MODULATEINVALPHA_ADDCOLOR:pa++,MODULATEINVCOLOR_ADDALPHA:pa++,DOTPRODUCT3:pa++,SELECTARG1:pa++,SELECTARG2:pa++,OFF:pa++},fa=s.A.add("ModeType",ga);let ma=0;const Aa={DEFAULT:ma++,DIFFUSE:ma++,SPECULAR:ma++,FACTOR:ma++},_a=s.A.add("SourceType",Aa);let ya=0;const wa={DEFAULT:ya++,COMPLEMENT:ya++,ALPHAREPLICATE:ya++},xa=s.A.add("FunctionType",wa);let ba=0;const Sa={NONE:ba++,SPHERE:ba++,CAMERASPACENORMAL:ba++,CAMERASPACEPOSITION:ba++,CAMERASPACEREFLECTIONVECTOR:ba++,SPHERE_LOCAL:ba++,COORD:ba++,COORD_EYE:ba++,NOISE:ba++,NOISE_EYE:ba++,SPHERE_REFLECT:ba++,SPHERE_REFLECT_LOCAL:ba++},Ta=s.A.add("TextureCoordinateGeneratorModeType",Sa),va=s.A.add("Types.glsl",()=>`\n#define X_ITE\n#define x3d_None 0\n#define x3d_Points 0\n#define x3d_Lines 1\n#define x3d_Geometry2D 2\n#define x3d_Geometry3D 3\n#define x3d_MaxClipPlanes 6\n#define x3d_LinearFog 1\n#define x3d_ExponentialFog 2\n#define x3d_Exponential2Fog 3\n#define x3d_DirectionalLight 1\n#define x3d_PointLight 2\n#define x3d_SpotLight 3\n#define x3d_MaxTextures 4\n#define x3d_TextureType2D 2\n#define x3d_TextureType3D 3\n#define x3d_TextureTypeCube 4\n#define x3d_Replace ${fa.REPLACE}\n#define x3d_Modulate ${fa.MODULATE}\n#define x3d_Modulate2X ${fa.MODULATE2X}\n#define x3d_Modulate4X ${fa.MODULATE4X}\n#define x3d_Add ${fa.ADD}\n#define x3d_AddSigned ${fa.ADDSIGNED}\n#define x3d_AddSigned2X ${fa.ADDSIGNED2X}\n#define x3d_AddSmooth ${fa.ADDSMOOTH}\n#define x3d_Subtract ${fa.SUBTRACT}\n#define x3d_BlendDiffuseAlpha ${fa.BLENDDIFFUSEALPHA}\n#define x3d_BlendTextureAlpha ${fa.BLENDTEXTUREALPHA}\n#define x3d_BlendFactorAlpha ${fa.BLENDFACTORALPHA}\n#define x3d_BlendCurrentAlpha ${fa.BLENDCURRENTALPHA}\n#define x3d_ModulateAlphaAddColor ${fa.MODULATEALPHA_ADDCOLOR}\n#define x3d_ModulateInvAlphaAddColor ${fa.MODULATEINVALPHA_ADDCOLOR}\n#define x3d_ModulateInvColorAddAlpha ${fa.MODULATEINVCOLOR_ADDALPHA}\n#define x3d_DotProduct3 ${fa.DOTPRODUCT3}\n#define x3d_SelectArg1 ${fa.SELECTARG1}\n#define x3d_SelectArg2 ${fa.SELECTARG2}\n#define x3d_Off ${fa.OFF}\n#define x3d_Diffuse ${_a.DIFFUSE}\n#define x3d_Specular ${_a.SPECULAR}\n#define x3d_Factor ${_a.FACTOR}\n#define x3d_Complement ${xa.COMPLEMENT}\n#define x3d_AlphaReplicate ${xa.ALPHAREPLICATE}\n#define x3d_Sphere ${Ta.SPHERE}\n#define x3d_CameraSpaceNormal ${Ta.CAMERASPACENORMAL}\n#define x3d_CameraSpacePosition ${Ta.CAMERASPACEPOSITION}\n#define x3d_CameraSpaceReflectionVector ${Ta.CAMERASPACEREFLECTIONVECTOR}\n#define x3d_SphereLocal ${Ta.SPHERE_LOCAL}\n#define x3d_Coord ${Ta.COORD}\n#define x3d_CoordEye ${Ta.COORD_EYE}\n#define x3d_Noise ${Ta.NOISE}\n#define x3d_NoiseEye ${Ta.NOISE_EYE}\n#define x3d_SphereReflect ${Ta.SPHERE_REFLECT}\n#define x3d_SphereReflectLocal ${Ta.SPHERE_REFLECT_LOCAL}\n#define x3d_GeometryPoints 0\n#define x3d_GeometryLines 1\n#define x3d_NoneClipPlane vec4(88.,51.,68.,33.)\n#define x3d_NoneFog 0\n#define x3d_NoneLight 0\n#define x3d_NoneTexture 0\n#if defined(X3D_FOG)\nstruct x3d_FogParameters{mediump int type;mediump vec3 color;mediump float visibilityStart;mediump float visibilityRange;mediump mat3 matrix;};\n#endif\n#if defined(X3D_LIGHTING)\nstruct x3d_LightSourceParameters{mediump int type;mediump vec3 color;mediump float intensity;mediump float ambientIntensity;mediump vec3 attenuation;mediump vec3 location;mediump vec3 direction;mediump float radius;mediump float beamWidth;mediump float cutOffAngle;mediump mat3 matrix;\n#if defined(X3D_SHADOWS)\nmediump vec3 shadowColor;mediump float shadowIntensity;mediump float shadowBias;mediump mat4 shadowMatrix;mediump int shadowMapSize;\n#endif\n};\n#endif\n#if defined(X3D_USE_IBL)\nstruct x3d_EnvironmentLightSourceParameters{mediump vec3 color;mediump float intensity;mediump float ambientIntensity;mediump mat3 rotation;mediump samplerCube diffuseTexture;bool diffuseTextureLinear;mediump int diffuseTextureLevels;mediump samplerCube specularTexture;bool specularTextureLinear;mediump int specularTextureLevels;mediump sampler2D ggxLUTTexture;\n#if defined(X3D_SHEEN_MATERIAL_EXT)\nmediump samplerCube sheenTexture;bool sheenTextureLinear;mediump int sheenTextureLevels;mediump sampler2D charlieLUTTexture;\n#endif\n};\n#endif\n#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES)\nstruct x3d_PointPropertiesParameters{mediump float pointSizeScaleFactor;mediump float pointSizeMinValue;mediump float pointSizeMaxValue;mediump vec3 attenuation;};\n#endif\n#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES)\nstruct x3d_LinePropertiesParameters{mediump int linetype;mediump float lineStippleScale;\n#if defined(X3D_STYLE_PROPERTIES_TEXTURE)\nsampler2D texture;\n#endif\n};\n#endif\n#if(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))&&defined(X3D_STYLE_PROPERTIES)\nstruct x3d_FillPropertiesParameters{bool filled;bool hatched;mediump vec3 hatchColor;mediump float scale;\n#if defined(X3D_STYLE_PROPERTIES_TEXTURE)\nsampler2D texture;\n#endif\n};\n#endif\n#if defined(X3D_UNLIT_MATERIAL)\nstruct x3d_UnlitMaterialParameters{mediump vec3 emissiveColor;mediump float normalScale;mediump float transparency;};\n#endif\n#if defined(X3D_GOURAUD_MATERIAL)||defined(X3D_PHONG_MATERIAL)\nstruct x3d_MaterialParameters{mediump float ambientIntensity;mediump vec3 diffuseColor;mediump vec3 specularColor;mediump vec3 emissiveColor;mediump float shininess;mediump float occlusionStrength;mediump float normalScale;mediump float transparency;};\n#endif\n#if defined(X3D_PHYSICAL_MATERIAL)\nstruct x3d_PhysicalMaterialParameters{\n#if defined(X3D_MATERIAL_SPECULAR_GLOSSINESS)\nmediump vec3 diffuseColor;mediump vec3 specularColor;mediump float glossiness;\n#elif defined(X3D_MATERIAL_METALLIC_ROUGHNESS)\nmediump vec3 baseColor;mediump float metallic;mediump float roughness;\n#endif\nmediump vec3 emissiveColor;mediump float occlusionStrength;mediump float normalScale;mediump float transparency;};\n#endif\n${_o.structs()}\n#if defined(X3D_MULTI_TEXTURING)\nstruct x3d_MultiTextureParameters{mediump int mode;mediump int alphaMode;mediump int source;mediump int function;};\n#endif\n#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES)\nstruct x3d_TextureCoordinateGeneratorParameters{mediump int mode;mediump float parameter[6];};\n#endif\n#if defined(X3D_TEXTURE_PROJECTION)\nstruct x3d_TextureProjectorParameters{mediump vec3 color;mediump float intensity;mediump vec3 location;mediump vec2 params;mediump mat4 matrix;};\n#endif\n`),Oa={getSource(e,t,i,n){const s="\\s+|/\\*[\\s\\S]*?\\*/|//.*?\\n",r="#line\\s+.*?\\n|#if\\s+.*?\\n|#elif\\s+.*?\\n|#ifdef\\s+.*?\\n|#ifndef\\s+.*?\\n|#else.*?\\n|#endif.*?\\n|#define\\s+(?:[^\\n\\\\]|\\\\[^\\r\\n]|\\\\\\r?\\n)*\\n|#undef\\s+.*?\\n|#pragma\\s+.*?\\n",o=new RegExp(`^((?:${s}|${r})*(?:#version\\s+.*?\\n)?(?:${s}|${r}|#extension\\s+.*?\\n)*)`,"s"),a=i.match(o);if(!a)return i;const l=`\n${n.map(e=>`#define ${e}`).join("\n")}\n#define x3d_MaxLights ${t.getMaxLights()}\n`,h=i.match(/\s*precision\s+(lowp|mediump|highp)\s+float\s*;/),c=i.match(/\s*precision\s+(lowp|mediump|highp)\s+int\s*;/),u=h?.[1]??"mediump",d=c?.[1]??"mediump",p=va().replace(/mediump\s+(float|vec2|vec3|mat3|mat4)/g,`${u} $1`).replace(/mediump\s+(int)/g,`${d} $1`),g=(a[1].match(/\n/g)?.length??0)+1;return`${a[1]}${l}${p}#line ${g+1} -1\n${i.substring(a[0].length)}`}},Ea=s.A.add("ShaderSource",Oa),Na=/^\s*#pragma\s+X3D\s+include\s+".*?([^\/]+)\.glsl"\s*$/;function Ca(e){this.includes=$o.includes[e.getVersion()],this.sourceFileNumbers={};for(const[e,t]of Object.getOwnPropertyNames(this.includes).entries())this.sourceFileNumbers[t]=e+1}Object.assign(Ca.prototype,{getSourceFileName(e){return Object.getOwnPropertyNames(this.includes)[e-1]},process(e,t=0){const i=e.split("\n");e="";for(const[n,s]of i.entries()){const i=s.match(Na);i?(e+=`#line 1 ${this.sourceFileNumbers[i[1]]??0}\n`,e+=this.process(this.includes[i[1]]?.()??"",this.sourceFileNumbers[i[1]]??0),e+="\n",e+=`#line ${n+2} ${t}\n`):(e+=s,e+="\n")}return e}});const Ia=Ca,Fa=s.A.add("ShaderCompiler",Ia);var Ma=n(8764),Ra=n(8939),Pa=n(9340);const Va=["X3D_GEOMETRY_0D","X3D_GEOMETRY_1D","X3D_GEOMETRY_2D","X3D_GEOMETRY_3D","X3D_FOG","X3D_STYLE_PROPERTIES","X3D_UNLIT_MATERIAL","X3D_PHONG_MATERIAL","X3D_LIGHTING","X3D_TEXTURE","X3D_MULTI_TEXTURING"];function Da(e){Je.A.call(this,e),Ma.A.call(this,e),this.addType(m.A.ShaderPart)}Object.assign(Object.setPrototypeOf(Da.prototype,Je.A.prototype),Ma.A.prototype,{initialize(){Je.A.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),this.options??=Va.slice(),this._type.addInterest("set_type__",this),this.requestImmediateLoad().catch(Function.prototype)},set_type__(){this.setLoadState(m.A.NOT_STARTED_STATE),this.requestImmediateLoad().catch(Function.prototype)},getSourceText(){return this._url},getOptions(){return this.options},setOptions(e){this.options=e},getShader(){return this.shader},getShaderType:(()=>{const e=new Map([["VERTEX","VERTEX_SHADER"],["TESS_CONTROL","TESS_CONTROL_SHADER"],["TESS_EVALUATION","TESS_EVALUATION_SHADER"],["GEOMETRY","GEOMETRY_SHADER"],["FRAGMENT","FRAGMENT_SHADER"],["COMPUTE","COMPUTE_SHADER"]]);return function(){return e.get(this._type.getValue())||"VERTEX_SHADER"}})(),unloadData(){this.valid=!1},loadData(){new Ra.default(this).loadDocument(this._url,function(e,t){if(null===e)this.setLoadState(m.A.FAILED_STATE);else{const i=this.getBrowser(),n=i.getContext(),s=this.getShaderType(),r=["X3D_"+s].concat(this.options),o=new Fa(n),a=Ea.getSource(n,i,o.process(Pa.decodeText(e)),r),l=n.createShader(n[s]);if(n.deleteShader(this.shader),this.shader=l,n.shaderSource(l,a),n.compileShader(l),!n.getShaderParameter(l,n.COMPILE_STATUS)){const e=this.getTypeName(),i=this.getName(),s=n.getShaderInfoLog(l),r=s?.match(/(\d+):(\d+)/);if(r){const n=o.getSourceFileName(r[1])||t||this.getExecutionContext().getWorldURL();throw new Error("Error in "+e+" '"+i+"' in URL '"+n+"', line "+r[2]+", "+s)}{const n=t||this.getExecutionContext().getWorldURL();throw new Error("Error in "+e+" '"+i+"' in URL '"+n+"', "+s)}}this.setLoadState(m.A.COMPLETE_STATE)}}.bind(this))},dispose(){Ma.A.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Da,{...Je.A.getStaticProperties("ShaderPart","Shaders",1,"parts","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.initializeOnly,"type",new c.A.SFString("VERTEX")),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600))]),enumerable:!0}});const La=Da,Ba=s.A.add("ShaderPart",La);var ka=n(2514);const ja=Symbol(),Ua=Symbol(),Xa=Symbol();function za(){this[ja]=new Map,this[Ua]=new Map}Object.assign(za.prototype,{initialize(){this.setShading(this.getBrowserOptions().getShading())},getShadingLanguageVersion(){const e=this.getContext();return e.getParameter(e.SHADING_LANGUAGE_VERSION)},getMaxVertexUniformVectors(){const e=this.getContext();return e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)},getMaxFragmentUniformVectors(){const e=this.getContext();return e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)},getMaxVertexAttribs(){const e=this.getContext();return e.getParameter(e.MAX_VERTEX_ATTRIBS)},getMaxVaryingVectors(){const e=this.getContext();return e.getParameter(e.MAX_VARYING_VECTORS)},getPrimitiveMode(e){return this[ja].get(e)},getShaders(){return this[Ua]},setShading(e){const t=this.getContext(),i=this[ja];if(this[Xa]){this[Xa]=!1;const e=t.getExtension("WEBGL_polygon_mode");e?.polygonModeWEBGL(t.FRONT_AND_BACK,e.FILL_WEBGL)}switch(e){case z.POINT:i.set(t.POINTS,t.POINTS).set(t.LINES,t.POINTS).set(t.TRIANGLES,t.POINTS);break;case z.WIREFRAME:{this[Xa]=!0;const e=t.getExtension("WEBGL_polygon_mode");e?.polygonModeWEBGL(t.FRONT_AND_BACK,e.LINE_WEBGL),i.set(t.POINTS,t.POINTS).set(t.LINES,t.LINES).set(t.TRIANGLES,t.TRIANGLES);break}default:i.set(t.POINTS,t.POINTS).set(t.LINES,t.LINES).set(t.TRIANGLES,t.TRIANGLES)}},getWireframe(){return this[Xa]},createShader(e,t,i=t,n=[],s=[],r=[]){ka.A&&console.info(`Initializing ${e}Shader.`);const o=this.getContext().getVersion(),a=new Ba(this.getPrivateScene());a._url.push(encodeURI(t.startsWith("data:")?t:`data:x-shader/x-vertex,${$o.vertex[o][t]()}`)),a.setName(`${e}VertexShader`),a.setOptions(n),a.setup();const l=new Ba(this.getPrivateScene());l._type="FRAGMENT",l._url.push(encodeURI(i.startsWith("data:")?i:`data:x-shader/x-fragment,${$o.fragment[o][i]()}`)),l.setName(`${e}FragmentShader`),l.setOptions(n),l.setup();const h=new da(this.getPrivateScene());return h._language="GLSL",h._parts.push(a),h._parts.push(l),h.setName(`${e}Shader`),h.setUniformNames(s),h.setTransformFeedbackVaryings(r),h.setup(),h}});const Ga=za,Ha=s.A.add("X3DShadersContext",Ga);function $a(e){Je.A.call(this,e),this.addType(m.A.X3DAppearanceNode),this.addChildObjects(m.A.outputOnly,"transparent",new c.A.SFBool,m.A.outputOnly,"transmission",new c.A.SFBool,m.A.outputOnly,"volumeScatter",new c.A.SFBool)}Object.assign(Object.setPrototypeOf($a.prototype,Je.A.prototype),{setTransparent(e){!!e!==this._transparent.getValue()&&(this._transparent=e)},isTransparent(){return this._transparent.getValue()},setTransmission(e){!!e!==this._transmission.getValue()&&(this._transmission=e)},isTransmission(){return this._transmission.getValue()},setVolumeScatter(e){!!e!==this._volumeScatter.getValue()&&(this._volumeScatter=e)},isVolumeScatter(){return this._volumeScatter.getValue()}}),Object.defineProperties($a,Je.A.getStaticProperties("X3DAppearanceNode","Shape",1));const Ya=$a,qa=s.A.add("X3DAppearanceNode",Ya);var Wa=n(6973);function Ka(e){qa.call(this,e),this.addType(m.A.Appearance),this.stylePropertiesNode=[],this.textureTransformMapping=new Map,this.textureBits=new Wa.A,this.shaderNodes=[],this.renderModeNodes=[]}Object.assign(Object.setPrototypeOf(Ka.prototype,qa.prototype),{initialize(){qa.prototype.initialize.call(this);this.getBrowser().getRenderingProperties()._ContentScale.addInterest("set_contentScale__",this),this._alphaMode.addInterest("set_alphaMode__",this),this._alphaCutoff.addInterest("set_alphaCutoff__",this),this._pointProperties.addInterest("set_pointProperties__",this),this._lineProperties.addInterest("set_lineProperties__",this),this._fillProperties.addInterest("set_fillProperties__",this),this._material.addInterest("set_material__",this),this._backMaterial.addInterest("set_backMaterial__",this),this._texture.addInterest("set_texture__",this),this._textureTransform.addInterest("set_textureTransform__",this),this._shaders.addInterest("set_shaders__",this),this._blendMode.addInterest("set_renderModes__",this),this._depthMode.addInterest("set_renderModes__",this),this._alphaMode.addInterest("set_transparent__",this),this._fillProperties.addInterest("set_transparent__",this),this._material.addInterest("set_transparent__",this),this._texture.addInterest("set_transparent__",this),this._blendMode.addInterest("set_transparent__",this),this.set_alphaMode__(),this.set_pointProperties__(),this.set_lineProperties__(),this.set_fillProperties__(),this.set_material__(),this.set_backMaterial__(),this.set_texture__(),this.set_textureTransform__(),this.set_shaders__(),this.set_renderModes__(),this.set_transparent__()},getAlphaMode(){return this.alphaMode},getAlphaCutoff(){return this.alphaCutoff},getStyleProperties(e){return this.stylePropertiesNode[e]},getMaterial(){return this.materialNode},getBackMaterial(){return this.backMaterialNode},getTexture(){return this.textureNode},getTextureBits(){return this.textureBits},updateTextureBits(){this.textureBits.clear(),this.textureNode.updateTextureBits(this.textureBits)},getTextureTransform(){return this.textureTransformNode},getTextureTransformMapping(){return this.textureTransformMapping},getShader(e,t){return this.materialNode.getShader(e,t)},getBackShader(e,t){return this.backMaterialNode.getShader(e,t)},getRenderModes(){return this.renderModeNodes},getDepthMode(){return this.depthModeNode},set_contentScale__(){this.set_pointProperties__(),this.set_applied__()},set_alphaMode__(){this.alphaMode=ui.A.get(this._alphaMode.getValue())??ui.A.AUTO,this.set_alphaCutoff__()},set_alphaCutoff__(){this.alphaCutoff=this.alphaMode===ui.A.MASK?this._alphaCutoff.getValue():0},set_pointProperties__(){if(this.stylePropertiesNode[0]=(0,hi.A)(m.A.PointProperties,this._pointProperties),this.stylePropertiesNode[0])return;const e=this.getBrowser();1!==e.getRenderingProperty("ContentScale")&&(this.stylePropertiesNode[0]=e.getDefaultPointProperties())},set_lineProperties__(){this.linePropertiesNode?._applied.removeInterest("set_applied__",this),this.linePropertiesNode=(0,hi.A)(m.A.LineProperties,this._lineProperties),this.linePropertiesNode?._applied.addInterest("set_applied__",this),this.set_applied__()},set_applied__(){if(this.linePropertiesNode?._applied.getValue())this.stylePropertiesNode[1]=this.linePropertiesNode;else{const e=this.getBrowser();1!==e.getRenderingProperty("ContentScale")?this.stylePropertiesNode[1]=e.getDefaultLineProperties():this.stylePropertiesNode[1]=null}},set_fillProperties__(){this.stylePropertiesNode[2]?._transparent.removeInterest("set_transparent__",this),this.stylePropertiesNode[2]=(0,hi.A)(m.A.FillProperties,this._fillProperties),this.stylePropertiesNode[2]?._transparent.addInterest("set_transparent__",this),this.stylePropertiesNode[3]=this.stylePropertiesNode[2]},set_material__(){this.materialNode&&(this.materialNode._transparent.removeInterest("set_transparent__",this),this.materialNode._transmission.removeInterest("set_transmission__",this),this.materialNode._volumeScatter.removeInterest("set_volumeScatter__",this)),this.materialNode=(0,hi.A)(m.A.X3DMaterialNode,this._material)??this.getBrowser().getDefaultMaterial(),this.materialNode._transparent.addInterest("set_transparent__",this),this.materialNode._transmission.addInterest("set_transmission__",this),this.materialNode._volumeScatter.addInterest("set_volumeScatter__",this),this.set_transmission__(),this.set_volumeScatter__(),this.set_transmission__(),(0,hi.A)(m.A.TwoSidedMaterial,this.materialNode)&&this.set_backMaterial__()},set_backMaterial__(){this.backMaterialNode?._transparent.removeInterest("set_transparent__",this),this.backMaterialNode=(0,hi.A)(m.A.X3DOneSidedMaterialNode,this._backMaterial),this.backMaterialNode?._transparent.addInterest("set_transparent__",this),!this.backMaterialNode&&(0,hi.A)(m.A.TwoSidedMaterial,this.materialNode)&&(this.backMaterialNode=this.materialNode)},set_texture__(){this.textureNode&&(this.textureNode.removeInterest("updateTextureBits",this),this.textureNode._transparent.removeInterest("set_transparent__",this)),this.textureNode=(0,hi.A)(m.A.X3DTextureNode,this._texture),this.textureNode?(this.textureNode.addInterest("updateTextureBits",this),this.textureNode._transparent.addInterest("set_transparent__",this),this.updateTextureBits()):this.textureBits.clear()},set_textureTransform__(){this.textureTransformNode?.removeInterest("updateTextureTransformMapping",this),this.textureTransformNode=(0,hi.A)(m.A.X3DTextureTransformNode,this._textureTransform)??this.getBrowser().getDefaultTextureTransform(),this.textureTransformNode.addInterest("updateTextureTransformMapping",this),this.updateTextureTransformMapping()},updateTextureTransformMapping(){this.textureTransformMapping.clear(),this.textureTransformNode.getTextureTransformMapping(this.textureTransformMapping)},set_shaders__(){const e=this.shaderNodes;for(const t of e)t._isValid.removeInterest("set_shader__",this);e.length=0;for(const t of this._shaders){const i=(0,hi.A)(m.A.X3DShaderNode,t);i&&e.push(i)}for(const t of e)t._isValid.addInterest("set_shader__",this);this.set_shader__()},set_shader__:(()=>{function e(){return this.shaderNode}return function(){const t=this.shaderNodes;this.shaderNode&&this.shaderNode.deselect(),this.shaderNode=null;for(const e of t)if(e._isValid.getValue()){this.shaderNode=e;break}this.shaderNode?(this.shaderNode.select(),this.getShader=e,this.getBackShader=e):(delete this.getShader,delete this.getBackShader)}})(),set_renderModes__(){this.renderModeNodes.length=0,this.blendModeNode=(0,hi.A)(m.A.BlendMode,this._blendMode),this.depthModeNode=(0,hi.A)(m.A.DepthMode,this._depthMode),this.blendModeNode&&this.renderModeNodes.push(this.blendModeNode),this.depthModeNode&&this.renderModeNodes.push(this.depthModeNode)},set_transparent__(){this.setTransparent(this.stylePropertiesNode[3]?.isTransparent()||this.materialNode?.isTransparent()||this.backMaterialNode?.isTransparent()||this.textureNode?.isTransparent()||this.blendModeNode)},set_transmission__(){this.setTransmission(this.materialNode?.isTransmission()||this.backMaterialNode?.isTransmission())},set_volumeScatter__(){this.setVolumeScatter(this.materialNode?.isVolumeScatter()||this.backMaterialNode?.isVolumeScatter())},traverse(e,t){this.textureNode?.traverse(e,t)}}),Object.defineProperties(Ka,{...Je.A.getStaticProperties("Appearance","Shape",1,"appearance","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"alphaMode",new c.A.SFString("AUTO")),new o.A(m.A.inputOutput,"alphaCutoff",new c.A.SFFloat(.5)),new o.A(m.A.inputOutput,"acousticProperties",new c.A.SFNode),new o.A(m.A.inputOutput,"pointProperties",new c.A.SFNode),new o.A(m.A.inputOutput,"lineProperties",new c.A.SFNode),new o.A(m.A.inputOutput,"fillProperties",new c.A.SFNode),new o.A(m.A.inputOutput,"material",new c.A.SFNode),new o.A(m.A.inputOutput,"backMaterial",new c.A.SFNode),new o.A(m.A.inputOutput,"texture",new c.A.SFNode),new o.A(m.A.inputOutput,"textureTransform",new c.A.SFNode),new o.A(m.A.inputOutput,"shaders",new c.A.MFNode),new o.A(m.A.inputOutput,"blendMode",new c.A.SFNode),new o.A(m.A.inputOutput,"depthMode",new c.A.SFNode)]),enumerable:!0}});const Za=Ka,Qa=s.A.add("Appearance",Za);function Ja(e){Yo.A.call(this,e),this.addType(m.A.PointProperties),this.attenuation=new Float32Array(3)}Object.assign(Object.setPrototypeOf(Ja.prototype,Yo.A.prototype),{initialize(){Yo.A.prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();this.pointSizeRange=t.getParameter(t.ALIASED_POINT_SIZE_RANGE),e.getRenderingProperties()._ContentScale.addInterest("set_contentScale__",this),this._pointSizeScaleFactor.addInterest("set_pointSizeScaleFactor__",this),this._pointSizeMinValue.addInterest("set_pointSizeMinValue__",this),this._pointSizeMaxValue.addInterest("set_pointSizeMaxValue__",this),this._attenuation.addInterest("set_attenuation__",this),this.set_pointSizeScaleFactor__(),this.set_pointSizeMinValue__(),this.set_pointSizeMaxValue__(),this.set_attenuation__()},getStyleKey:()=>1,set_contentScale__(){this.set_pointSizeScaleFactor__(),this.set_pointSizeMinValue__(),this.set_pointSizeMaxValue__()},set_pointSizeScaleFactor__(){const e=this.getBrowser().getRenderingProperty("ContentScale");this.pointSizeScaleFactor=Math.max(this._pointSizeScaleFactor.getValue(),0)*e},set_pointSizeMinValue__(){const e=this.getBrowser().getRenderingProperty("ContentScale");this.pointSizeMinValue=W.A.clamp(this._pointSizeMinValue.getValue(),0,this.pointSizeRange[1])*e},set_pointSizeMaxValue__(){const e=this.getBrowser().getRenderingProperty("ContentScale");this.pointSizeMaxValue=W.A.clamp(this._pointSizeMaxValue.getValue(),0,this.pointSizeRange[1])*e},set_attenuation__(){this.attenuation[0]=Math.max(0,this._attenuation[0]),this.attenuation[1]=Math.max(0,this._attenuation[1]),this.attenuation[2]=Math.max(0,this._attenuation[2])},setShaderUniforms(e,t){e.uniform1f(t.x3d_PointPropertiesPointSizeScaleFactor,this.pointSizeScaleFactor),e.uniform1f(t.x3d_PointPropertiesPointSizeMinValue,this.pointSizeMinValue),e.uniform1f(t.x3d_PointPropertiesPointSizeMaxValue,this.pointSizeMaxValue),e.uniform3fv(t.x3d_PointPropertiesAttenuation,this.attenuation)}}),Object.defineProperties(Ja,{...Je.A.getStaticProperties("PointProperties","Shape",5,"pointProperties","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"pointSizeScaleFactor",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"pointSizeMinValue",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"pointSizeMaxValue",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"attenuation",new c.A.SFVec3f(1,0,0))]),enumerable:!0}});const el=Ja,tl=s.A.add("PointProperties",el);function il(e){Yo.A.call(this,e),this.addType(m.A.LineProperties)}Object.assign(Object.setPrototypeOf(il.prototype,Yo.A.prototype),{initialize(){Yo.A.prototype.initialize.call(this);const e=this.getBrowser();e.getRenderingProperties()._ContentScale.addInterest("set_linewidthScaleFactor__",this),this._applied.addInterest("set_applied__",this),this._linetype.addInterest("set_linetype__",this),this._linewidthScaleFactor.addInterest("set_linewidthScaleFactor__",this),this.set_applied__(),this.set_linetype__(),this.set_linewidthScaleFactor__(),e.getLinetypeTexture()},getStyleKey(){return this.applied?2:1},getApplied(){return this.applied},getLinetype(){return this.linetype},getLinewidthScaleFactor(){return this.linewidthScaleFactor},getTransformLines(){return this.transformLines},set_applied__(){this.applied=this._applied.getValue()},set_linetype__(){let e=this._linetype.getValue();(e<1||e>16)&&(e=1),this.linetype=e},set_linewidthScaleFactor__(){const e=this.getBrowser(),t=e.getContext(),i=e.getRenderingProperty("ContentScale"),n=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE);this.linewidthScaleFactor=Math.max(1,this._linewidthScaleFactor.getValue())*i,this.transformLines=this.linewidthScaleFactor>1&&this.linewidthScaleFactor>n[1]},setShaderUniforms(e,t){const i=this.getBrowser();if(this.applied){const n=i.popTextureUnit();this.transformLines||e.lineWidth(this.linewidthScaleFactor),e.uniform1i(t.x3d_LinePropertiesLinetype,this.linetype),e.uniform1f(t.x3d_LineStippleScale,i.getLineStippleScale()),e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,i.getLinetypeTexture().getTexture()),e.uniform1i(t.x3d_LinePropertiesTexture,n)}else this.transformLines||e.lineWidth(i.getRenderingProperty("ContentScale")),e.uniform1i(t.x3d_LinePropertiesLinetype,16),e.uniform1f(t.x3d_LineStippleScale,1)}}),Object.defineProperties(il,{...Je.A.getStaticProperties("LineProperties","Shape",2,"lineProperties","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"applied",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"linetype",new c.A.SFInt32(1)),new o.A(m.A.inputOutput,"linewidthScaleFactor",new c.A.SFFloat)]),enumerable:!0}});const nl=il,sl=s.A.add("LineProperties",nl);function rl(e){Yo.A.call(this,e),this.addType(m.A.X3DMaterialNode),this.addChildObjects(m.A.outputOnly,"transparent",new c.A.SFBool,m.A.outputOnly,"transmission",new c.A.SFBool,m.A.outputOnly,"volumeScatter",new c.A.SFBool),this.textureBits=new Wa.A,this.shaderNodes=this.getBrowser().getShaders()}Object.assign(Object.setPrototypeOf(rl.prototype,Yo.A.prototype),{isPhysical:()=>!1,setTransparent(e){!!e!==this._transparent.getValue()&&(this._transparent=e)},isTransparent(){return this._transparent.getValue()},setTransmission(e){!!e!==this._transmission.getValue()&&(this._transmission=e)},isTransmission(){return this._transmission.getValue()},setVolumeScatter(e){!!e!==this._volumeScatter.getValue()&&(this._volumeScatter=e)},isVolumeScatter(){return this._volumeScatter.getValue()},setTexture(e,t){e*=4,this.textureBits.remove(e,15),this.textureBits.add(e,t?.getTextureBits()??0)},getTextureBits(){return this.textureBits},getShader(e,t){let i="";if(i+=this.textureBits.toString(16),i+=".",i+=this.getMaterialKey(),i+=e.geometryKey,t){const{renderObject:n,shadows:s,fogNode:r,shapeNode:o,appearanceNode:a,textureNode:l,hAnimNode:h,localObjectsKeys:c}=t;i+=o.getAlphaMode(),i+=n.getRenderKey(),i+=s||n.getGlobalShadow()?1:0,i+=r?.getFogType()??0,i+=o.getShapeKey(),i+=a.getStyleProperties(e.geometryType)?.getStyleKey()??0,i+=a.getTextureTransformMapping().size||1,i+=e.textureCoordinateMapping.size||1,i+=h?.getHAnimKey()??"[]",i+=c.join(""),i+=".",i+=l?2:a.getTextureBits().toString(16)}else{const{renderObject:t,alphaMode:n,textureNode:s,localObjectsKeys:r}=e;i+=n,i+=t.getRenderKey(),i+="000011[]",i+=r.join(""),i+=".",i+=s?.getTextureBits().toString(16)??0}return this.shaderNodes.get(i)??this.createShader(i,e,t)},getShaderOptions(e,t){const i=this.getBrowser(),n=[];switch(i.getRenderingProperty("XRSession")&&n.push("X3D_XR_SESSION"),i.getBrowserOption("ColorSpace").toUpperCase()){case"SRGB":n.push("X3D_COLORSPACE_SRGB");break;case"LINEAR":n.push("X3D_COLORSPACE_LINEAR");break;default:n.push(this.isPhysical()?"X3D_COLORSPACE_LINEAR":"X3D_COLORSPACE_SRGB")}switch(i.getBrowserOption("ToneMapping").toUpperCase()){default:break;case"ACES_NARKOWICZ":case"ACES_HILL":case"ACES_HILL_EXPOSURE_BOOST":case"KHR_PBR_NEUTRAL":n.push(`X3D_TONEMAP_${i.getBrowserOption("ToneMapping").toUpperCase()}`)}n.push(`X3D_GEOMETRY_${e.geometryType}D`),e.hasFogCoords&&n.push("X3D_FOG_COORDS"),e.colorMaterial&&n.push("X3D_COLOR_MATERIAL");const s="FLAT"===i.getRenderingProperty("Shading");if(e.hasNormals&&!s&&n.push("X3D_NORMALS"),e.hasTangents&&n.push("X3D_TANGENTS"),t){const{renderObject:s,fogNode:r,shapeNode:o,appearanceNode:a,hAnimNode:l,localObjectsKeys:h,textureNode:c}=t;switch(this.addRenderOptions(n,s,o.getAlphaMode()),(t.shadows||s.getGlobalShadows().at(-1))&&n.push("X3D_SHADOWS","X3D_PCF_FILTERING"),r?.getFogType()){case 1:n.push("X3D_FOG","X3D_FOG_LINEAR");break;case 2:n.push("X3D_FOG","X3D_FOG_EXPONENTIAL")}l?.getShaderOptions(n);const u=s.getGlobalLights().concat(t.localObjects),d=s.getGlobalLightsKeys().concat(h),p=d.reduce((e,t)=>e+(0===t),0),g=d.reduce((e,t)=>e+(1===t),0),f=d.reduce((e,t)=>e+t.toString().startsWith("[2."),0),A=d.reduce((e,t)=>e+t.toString().startsWith("[3."),0);if(p&&(n.push("X3D_CLIP_PLANES"),n.push(`X3D_NUM_CLIP_PLANES ${Math.min(p,i.getMaxClipPlanes())}`)),g&&e.hasNormals&&(n.push("X3D_LIGHTING"),n.push(`X3D_NUM_LIGHTS ${Math.min(g,i.getMaxLights())}`)),f&&e.hasNormals){const e=u.find(e=>e.lightNode.getLightKey().toString().startsWith("[2.")).lightNode;n.push("X3D_USE_IBL"),n.push(`X3D_NUM_ENVIRONMENT_LIGHTS ${Math.min(f,i.getMaxEnvironmentLights())}`),e.getDiffuseTexture()?.isLinear()&&n.push("X3D_ENVIRONMENT_DIFFUSE_TEXTURE_LINEAR"),e.getSpecularTexture()?.isLinear()&&n.push("X3D_ENVIRONMENT_SPECULAR_TEXTURE_LINEAR"),e.getSheenTexture()?.isLinear()&&n.push("X3D_ENVIRONMENT_SHEEN_TEXTURE_LINEAR")}if(A){const e=u.filter(e=>e.lightNode.getLightKey().toString().startsWith("[3."));n.push("X3D_TEXTURE_PROJECTION"),n.push(`X3D_NUM_TEXTURE_PROJECTORS ${Math.min(A,i.getMaxTextures())}`);for(const[t,i]of e.entries())i.lightNode.getTexture().isLinear()&&n.push(`X3D_TEXTURE_PROJECTOR_${t}_LINEAR`)}if(a.getStyleProperties(e.geometryType)&&(n.push("X3D_STYLE_PROPERTIES"),a.getStyleProperties(e.geometryType).getStyleKey()>1&&n.push("X3D_STYLE_PROPERTIES_TEXTURE")),+this.textureBits&&n.push("X3D_MATERIAL_TEXTURES"),c)n.push("X3D_TEXTURE","X3D_NUM_TEXTURES 1","X3D_NUM_TEXTURE_TRANSFORMS 1","X3D_NUM_TEXTURE_COORDINATES 1"),c.getShaderOptions(n,0);else{if(+a.getTextureBits()&&!this.getBaseTexture()){const e=a.getTexture();n.push("X3D_TEXTURE"),n.push(`X3D_NUM_TEXTURES ${e.getCount()}`),e.getType().includes(m.A.MultiTexture)&&n.push("X3D_MULTI_TEXTURING"),e.getShaderOptions(n)}n.push(`X3D_NUM_TEXTURE_TRANSFORMS ${a.getTextureTransformMapping().size||1}`),n.push(`X3D_NUM_TEXTURE_COORDINATES ${e.textureCoordinateMapping.size||1}`)}switch(o.getShapeKey()){case 1:n.push("X3D_INSTANCING");break;case 2:n.push("X3D_INSTANCING","X3D_TEX_COORD_RAMP");break;case 3:n.push("X3D_INSTANCING","X3D_INSTANCE_NORMAL")}}else{const{renderObject:t,alphaMode:s,localObjectsKeys:r,textureNode:o}=e;this.addRenderOptions(n,t,s);const a=r.reduce((e,t)=>e+(0===t),0);a&&(n.push("X3D_CLIP_PLANES"),n.push(`X3D_NUM_CLIP_PLANES ${Math.min(a,i.getMaxClipPlanes())}`)),o&&(n.push("X3D_TEXTURE","X3D_NUM_TEXTURES 1","X3D_NUM_TEXTURE_TRANSFORMS 1","X3D_NUM_TEXTURE_COORDINATES 1"),o.getShaderOptions(n,0))}return n},addRenderOptions(e,t,i){switch(t.getRenderPass()){case di.A.VOLUME_SCATTER_KEY:e.push("X3D_VOLUME_SCATTER_PASS","X3D_LINEAR_OUTPUT");break;case di.A.TRANSMISSION_KEY:e.push("X3D_TRANSMISSION_PASS","X3D_LINEAR_OUTPUT")}switch(t.getLogarithmicDepthBuffer()&&e.push("X3D_LOGARITHMIC_DEPTH_BUFFER"),i){case ui.A.OPAQUE:e.push("X3D_ALPHA_MODE_OPAQUE");break;case ui.A.MASK:e.push("X3D_ALPHA_MODE_MASK");break;case ui.A.BLEND:e.push("X3D_ALPHA_MODE_BLEND"),t.getRenderPass()===di.A.RENDER_KEY&&t.getOrderIndependentTransparency()&&e.push("X3D_ORDER_INDEPENDENT_TRANSPARENCY")}}}),Object.defineProperties(rl,Je.A.getStaticProperties("X3DMaterialNode","Shape",1));const ol=rl,al=s.A.add("X3DMaterialNode",ol);function ll(e){al.call(this,e),this.addType(m.A.X3DOneSidedMaterialNode),this.emissiveColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(ll.prototype,al.prototype),{initialize(){al.prototype.initialize.call(this),this._emissiveColor.addInterest("set_emissiveColor__",this),this._emissiveTexture.addInterest("set_emissiveTexture__",this),this._normalScale.addInterest("set_normalScale__",this),this._normalTexture.addInterest("set_normalTexture__",this),this._transparency.addInterest("set_transparency__",this),this._transparency.addInterest("set_transparent__",this),this.set_emissiveColor__(),this.set_emissiveTexture__(),this.set_normalScale__(),this.set_normalTexture__(),this.set_transparency__()},set_emissiveColor__(){this.emissiveColorArray.set(this._emissiveColor.getValue())},set_emissiveTexture__(){const e=this.getTextureIndices().EMISSIVE_TEXTURE;this.emissiveTextureNode?._linear.removeInterest(`setTexture${e}`,this),this.emissiveTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._emissiveTexture),this.emissiveTextureNode?._linear.addInterest(`setTexture${e}`,this,e,this.emissiveTextureNode),this.setTexture(e,this.emissiveTextureNode)},set_normalScale__(){this.normalScale=Math.max(this._normalScale.getValue(),0)},set_normalTexture__(){this.normalTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._normalTexture),this.setTexture(this.getTextureIndices().NORMAL_TEXTURE,this.normalTextureNode)},set_transparency__(){this.transparency=W.A.clamp(this._transparency.getValue(),0,1)},set_transparent__(){this.setTransparent(this.transparency||this.getBaseTexture()?.isTransparent())},getBaseTexture(){return this.emissiveTextureNode},getShaderOptions(e,t){const i=al.prototype.getShaderOptions.call(this,e,t);return+this.getTextureBits()&&(this.emissiveTextureNode?.getShaderOptions(i,"EMISSIVE"),this.normalTextureNode?.getShaderOptions(i,"NORMAL")),i},setShaderUniforms(e,t,i,n){e.uniform3fv(t.x3d_EmissiveColor,this.emissiveColorArray),e.uniform1f(t.x3d_Transparency,this.transparency),+this.getTextureBits()&&(this.emissiveTextureNode?.setNamedShaderUniforms(e,t.x3d_EmissiveTexture,this._emissiveTextureMapping.getValue(),i,n),this.normalTextureNode&&e.uniform1f(t.x3d_NormalScale,this.normalScale),this.normalTextureNode?.setNamedShaderUniforms(e,t.x3d_NormalTexture,this._normalTextureMapping.getValue(),i,n))}}),Object.defineProperties(ll,Je.A.getStaticProperties("X3DOneSidedMaterialNode","Shape",4));const hl=ll,cl=s.A.add("X3DOneSidedMaterialNode",hl);function ul(e){cl.call(this,e),this.addType(m.A.UnlitMaterial)}Object.assign(Object.setPrototypeOf(ul.prototype,cl.prototype),{initialize(){cl.prototype.initialize.call(this),this._emissiveTexture.addInterest("set_transparent__",this),this.set_transparent__()},getMaterialKey:()=>0,getTextureIndices:(()=>{let e=0;const t={EMISSIVE_TEXTURE:e++,NORMAL_TEXTURE:e++};return function(){return t}})(),set_emissiveTexture__(){this.getBaseTexture()?._transparent.removeInterest("set_transparent__",this),cl.prototype.set_emissiveTexture__.call(this),this.getBaseTexture()?._transparent.addInterest("set_transparent__",this)},createShader(e,t,i){const n=this.getBrowser(),s=this.getShaderOptions(t,i);s.push("X3D_UNLIT_MATERIAL");const r=n.createShader("Unlit","Default","Unlit",s);return n.getShaders().set(e,r),r}}),Object.defineProperties(ul,{...Je.A.getStaticProperties("UnlitMaterial","Shape",1,"material","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"emissiveColor",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"emissiveTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"emissiveTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"normalScale",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"normalTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"normalTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"transparency",new c.A.SFFloat)]),enumerable:!0}});for(const e of Object.values(ul.prototype.getTextureIndices()))ul.prototype[`setTexture${e}`]=function(e,t){this.setTexture(e,t)};const dl=ul,pl=s.A.add("UnlitMaterial",dl),gl=Symbol(),fl=Symbol(),ml=Symbol(),Al=Symbol(),_l=Symbol(),yl=Symbol(),wl=Symbol(),xl=Symbol(),bl=Symbol(),Sl=Symbol();function Tl(){this[bl]=[],this[fl]=[]}Object.assign(Tl.prototype,{getDefaultAppearance(){return this[ml]??=(()=>{const e=new Qa(this.getPrivateScene());return e.setup(),e})()},getLineStippleScale(){return 1/(32*this.getRenderingProperty("PixelsPerPoint"))},getDefaultPointProperties(){return this[Al]??=(()=>{const e=new tl(this.getPrivateScene());return e.setup(),e})()},getDefaultLineProperties(){return this[_l]??=(()=>{const e=new sl(this.getPrivateScene());return e._applied=!1,e.setup(),e})()},getDefaultMaterial(){return this[yl]??=(()=>{const e=new pl(this.getPrivateScene());return e.setup(),e})()},getLinetypeTexture(){return this[gl]??=(()=>{const e=new Qi.A(this.getPrivateScene());return e._url[0]=_e.A.getLinetypeURL(),e._textureProperties=this.getLineFillTextureProperties(),e.setup(),e})()},getHatchStyleTexture(e){return this[fl][e]??=(()=>{const t=new Qi.A(this.getPrivateScene());return t._url[0]=_e.A.getHatchingURL(e),t._textureProperties=this.getLineFillTextureProperties(),t.setup(),t})()},getLineFillTextureProperties(){return this[wl]??=(()=>{const e=new it(this.getPrivateScene());return e._minificationFilter="NEAREST_PIXEL",e._magnificationFilter="NEAREST_PIXEL",e._textureCompression="DEFAULT",e.setup(),e})()},getLineTransformShader(){return this[xl]??=this.createLineTransformShader(0,!1)},getLineTransformInstancedShader(e){return this[bl][e]??=this.createLineTransformShader(e,!0)},createLineTransformShader(e,t){const i=[`X3D_PASS_${e}`];t&&i.push("X3D_INSTANCING");const n=[["viewport","modelViewProjectionMatrix","invModelViewProjectionMatrix","linewidthScaleFactor1_2"],[],[]][e],s=[["coordIndex0","lineStipple0","fogDepth0","color0","vertex0","coordIndex1","lineStipple1","fogDepth1","color1","vertex1","coordIndex2","lineStipple2","fogDepth2","color2","vertex2"],["instanceMatrix0","instanceMatrix1","instanceMatrix2"],["instanceNormalMatrix0","tangent0","normal0","instanceNormalMatrix1","tangent1","normal1","instanceNormalMatrix2","tangent2","normal2"]][e];return this.createShader("LineTransform"+(t?"Instanced":""),"LineTransform","LineTransform",i,n,s)},getLineTransformFeedback(){return this[Sl]??=(()=>this.getContext().createTransformFeedback())()}});const vl=Tl,Ol=s.A.add("X3DShapeContext",vl);function El(e){ai.A.call(this,e),this.addType(m.A.X3DSoundNode)}Object.setPrototypeOf(El.prototype,ai.A.prototype),Object.defineProperties(El,Je.A.getStaticProperties("X3DSoundNode","Sound",1));const Nl=El,Cl=s.A.add("X3DSoundNode",Nl);function Il(e){Cl.call(this,e),this.addType(m.A.PeriodicWave),this.real=new Float32Array(2),this.imag=new Float32Array(2)}Object.assign(Object.setPrototypeOf(Il.prototype,Cl.prototype),{createPeriodicWave(){const e=this.getBrowser().getAudioContext(),t=this._optionsReal.shrinkToFit(),i=this._optionsImag.shrinkToFit(),n=Math.max(t.length,i.length,2);return this.real.length!==n&&(this.real=new Float32Array(n),this.imag=new Float32Array(n)),this.real.set(t),this.imag.set(i),e.createPeriodicWave(this.real,this.imag)}}),Object.defineProperties(Il,{...Je.A.getStaticProperties("PeriodicWave","Sound",2,"periodicWave","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"type",new c.A.SFString("SQUARE")),new o.A(m.A.inputOutput,"optionsReal",new c.A.MFFloat),new o.A(m.A.inputOutput,"optionsImag",new c.A.MFFloat)]),enumerable:!0}});const Fl=Il,Ml=s.A.add("PeriodicWave",Fl);var Rl=n(9340);const Pl=Symbol(),Vl=Symbol(),Dl=Symbol(),Ll=Symbol(),Bl=Symbol();function kl(){this[Pl]=new Map}Object.assign(kl.prototype,{initialize(){const e=`X3DSoundContext-${this.getId()}`,t=["blur","click","contextmenu","dblclick","focus","keydown","keyup","mousedown","mouseup","mousewheel","pointerup","touchend","touchmove","touchstart"].map(t=>`${t}.${e}`);this.getCanvas().on(t.join(" "),()=>this.startAudioElements())},getAudioContext(){return this[Vl]??=(()=>{const e=new AudioContext;return this.startAudioElement(e,"resume"),e})()},getDefaultPeriodicWave(){return this[Dl]??=(()=>{const e=new Ml(this.getPrivateScene());return e.setup(),e})()},startAudioElement(e,t="play",i=!0){e&&(this[Pl].set(e,t),this.startAudioElements())},startAudioElements(){for(const[e,t]of this[Pl])e[t]().then(()=>this[Pl].delete(e)).catch(Function.prototype).finally(()=>this.toggleNoSoundButton())},stopAudioElement(e,t="pause"){e&&(this[Pl].delete(e),e[t](),this.toggleNoSoundButton())},toggleNoSoundButton(){clearTimeout(this[Bl]),this[Bl]=setTimeout(async()=>{this[Ll]??=Rl("<div></div>").attr("part","no-sound-button").attr("title",N("Activate sound.")).addClass(["x_ite-private-no-sound-button","x_ite-private-button"]).on("mouseup touchend",()=>this.startAudioElements()).appendTo(this.getSurface().find(".x_ite-private-buttons"));const e=!!this[Pl].size,t=e?"x_ite-private-fade-in-300":"x_ite-private-fade-out-300";e&&this[Ll].show(),this[Ll].addClass(t),await Rl.sleep(400),this[Ll].removeClass(t),e===!!this[Pl].size&&(e||this[Ll].hide())},200)}});const jl=kl,Ul=s.A.add("X3DSoundContext",jl);function Xl(e){Yo.A.call(this,e),this.addType(m.A.X3DTextureTransformNode)}Object.setPrototypeOf(Xl.prototype,Yo.A.prototype),Object.defineProperties(Xl,Je.A.getStaticProperties("X3DTextureTransformNode","Texturing",1));const zl=Xl,Gl=s.A.add("X3DTextureTransformNode",zl);function Hl(e){Gl.call(this,e),this.addType(m.A.X3DSingleTextureTransformNode),this.matrixArray=new Float32Array(Si.A.IDENTITY)}Object.assign(Object.setPrototypeOf(Hl.prototype,Gl.prototype),{getCount:()=>1,getMatrix(){return this.matrixArray},setMatrix(e){this.matrixArray.set(e)},getTextureTransformMapping(e,t=0){e.set(this._mapping.getValue()||t,t)},setShaderUniforms(e,t,i=0){e.uniformMatrix4fv(t.x3d_TextureMatrix[i],!1,this.matrixArray)},transformPoint(e){return Si.A.prototype.multVecMatrix.call(this.matrixArray,e)}}),Object.defineProperties(Hl,Je.A.getStaticProperties("X3DSingleTextureTransformNode","Texturing",1));const $l=Hl,Yl=s.A.add("X3DSingleTextureTransformNode",$l);function ql(e){Yl.call(this,e),this.addType(m.A.TextureTransform),this._rotation.setUnit("angle"),this.matrix=new Si.A}Object.assign(Object.setPrototypeOf(ql.prototype,Yl.prototype),{initialize(){Yl.prototype.initialize.call(this),this.addInterest("eventsProcessed",this),this.eventsProcessed()},eventsProcessed:(()=>{const e=new It.A,t=new Zo.A;return function(){const i=this._translation.getValue(),n=this._rotation.getValue(),s=this._scale.getValue(),r=this._center.getValue(),o=this.matrix;t.identity(),r.equals(It.A.ZERO)||t.translate(e.assign(r).negate()),s.equals(It.A.ONE)||t.scale(s),0!==n&&t.rotate(n),r.equals(It.A.ZERO)||t.translate(r),i.equals(It.A.ZERO)||t.translate(i),o[0]=t[0],o[1]=t[1],o[4]=t[3],o[5]=t[4],o[12]=t[6],o[13]=t[7],this.setMatrix(o)}})()}),Object.defineProperties(ql,{...Je.A.getStaticProperties("TextureTransform","Texturing",1,"textureTransform","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"mapping",new c.A.SFString),new o.A(m.A.inputOutput,"translation",new c.A.SFVec2f),new o.A(m.A.inputOutput,"rotation",new c.A.SFFloat),new o.A(m.A.inputOutput,"scale",new c.A.SFVec2f(1,1)),new o.A(m.A.inputOutput,"center",new c.A.SFVec2f)]),enumerable:!0}});const Wl=ql,Kl=s.A.add("TextureTransform",Wl);var Zl=n(9340);const Ql=s.A.add("KTXDecoder",class{constructor(e,t,i){this.gl=e,this.libktx=null,this.initialized=this.init(e,t,i)}async init(e,t,i){this.libktx=await t({preinitializedWebGLContext:e},i),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(null,{majorVersion:e.getVersion()}))}transcode(e){if(!e.needsTranscoding)return;const{gl:t,libktx:i}=this,n=!!t.getExtension("WEBGL_compressed_texture_astc"),s=!!t.getExtension("WEBGL_compressed_texture_etc1"),r=!!t.getExtension("WEBGL_compressed_texture_s3tc"),o=!!t.getExtension("EXT_texture_compression_bptc"),a=!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");let l;l=n?i.TranscodeTarget.ASTC_4x4_RGBA:o?i.TranscodeTarget.BC7_RGBA:r?i.TranscodeTarget.BC1_OR_3:a?i.TranscodeTarget.PVRTC1_4_RGBA:s?i.TranscodeTarget.ETC:i.TranscodeTarget.RGBA4444,e.transcodeBasis(l,0)!==i.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}async loadKTXFromURL(e,t=!0){const i=await fetch(e,{cache:t?"default":"reload"});if(!i.ok)throw new Error("Couldn't fetch KTX image.");return this.loadKTXFromBuffer(await i.arrayBuffer())}async loadKTXFromBuffer(e){await this.initialized;const t=new Uint8Array(Zl.ungzip(e)),i=new this.libktx.ktxTexture(t);this.transcode(i);const n=this.gl,s=i.glUpload(),r=s.object;if(s.error!==n.NO_ERROR||!r)throw new Error("Could not load KTX data.");return r.baseWidth=i.baseWidth,r.baseHeight=i.baseHeight,r.baseDepth=i.baseDepth??1,r.numComponents=i.numComponents,r.target=s.target,i.delete(),r}}),Jl=Symbol(),eh=Symbol(),th=Symbol(),ih=Symbol(),nh=Symbol(),sh=Symbol(),rh=Symbol(),oh=Symbol(),ah=Symbol(),lh=Symbol(),hh=Symbol(),ch=Symbol(),uh=Symbol(),dh=Symbol();function ph(){const e=this.getContext(),t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this[Jl]=t>8?4:2}Object.assign(ph.prototype,{initialize(){const e=this.getContext();e.pixelStorei(e.UNPACK_ALIGNMENT,1);let t=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);this[nh]=--t,this[sh]=--t,this[rh]=--t,this[eh]=t;const i=new Uint8Array([255,255,255,255]);this[oh]=e.createTexture(),e.activeTexture(e.TEXTURE0+this[nh]),e.bindTexture(e.TEXTURE_2D,this[oh]),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i),this[ah]=e.createTexture(),e.activeTexture(e.TEXTURE0+this[sh]),e.bindTexture(e.TEXTURE_3D,this[ah]),e.texImage3D(e.TEXTURE_3D,0,e.RGBA,1,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i),this[lh]=e.createTexture(),e.activeTexture(e.TEXTURE0+this[rh]),e.bindTexture(e.TEXTURE_CUBE_MAP,this[lh]);const n=[e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y];for(const t of n)e.texImage2D(t,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i);e.activeTexture(e.TEXTURE0),this.resetGlobalTextureUnits(),this.setTextureQuality(this.getBrowserOptions().getTextureQuality())},getTextureMemory:()=>NaN,getMaxTextures(){return this[Jl]},getMaxTextureTransforms:()=>4,getMaxTexCoords:()=>4,getMinTextureSize:()=>16,getMaxTextureSize(){const e=this.getContext();return e.getParameter(e.MAX_TEXTURE_SIZE)},getAnisotropicExtension:(()=>{const e=["EXT_texture_filter_anisotropic","MOZ_EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"];return function(){const t=this.getContext();for(const i of e){const e=t.getExtension(i);if(e)return e}}})(),getMaxAnisotropicDegree(){const e=this.getContext(),t=this.getAnisotropicExtension();return t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},getMaxCombinedTextureUnits(){const e=this.getContext();return e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)},popGlobalTextureUnit(){return this[ih]=--this[th]},resetGlobalTextureUnits(){this[ih]=this[th]=this[eh]},popTextureUnit(){return--this[ih]},resetTextureUnits(){this[ih]=this[th]},getDefaultTexture2DUnit(){return this[nh]},getDefaultTexture3DUnit(){return this[sh]},getDefaultTextureCubeUnit(){return this[rh]},getDefaultTexture2D(){return this[oh]},getDefaultTexture3D(){return this[ah]},getDefaultTextureCube(){return this[lh]},getDefaultTextureProperties(){return this[hh]??=(()=>{const e=new it(this.getPrivateScene());return e._generateMipMaps=!0,e._minificationFilter="NICEST",e._magnificationFilter="NICEST",e.setup(),e})()},getDefaultTextureTransform(){return this[ch]??=(()=>{const e=new Kl(this.getPrivateScene());return e.setup(),e})()},getDefaultTextureCoordinate(){return this[uh]??=(()=>{const e=new Rt(this.getPrivateScene());return e.setup(),e})()},setTextureQuality(e){const t=this.getContext(),i=this.getDefaultTextureProperties();switch(e){case H.LOW:i._magnificationFilter="AVG_PIXEL",i._minificationFilter="AVG_PIXEL",i._textureCompression="FASTEST",i._generateMipMaps=!0,t.hint(t.GENERATE_MIPMAP_HINT,t.FASTEST);break;case H.MEDIUM:i._magnificationFilter="NICEST",i._minificationFilter="NEAREST_PIXEL_AVG_MIPMAP",i._textureCompression="NICEST",i._generateMipMaps=!0,t.hint(t.GENERATE_MIPMAP_HINT,t.FASTEST);break;case H.HIGH:i._magnificationFilter="NICEST",i._minificationFilter="NICEST",i._textureCompression="NICEST",i._generateMipMaps=!0,t.hint(t.GENERATE_MIPMAP_HINT,t.NICEST)}},async getKTXDecoder(){return this[dh]??=await(async()=>{const e=await fetch(_e.A.getLibraryURL("libktx.js")),t=await e.text(),i=new Function(t)();return new Ql(this.getContext(),i,_e.A.getLibraryURL("libktx.js"))})()}});const gh=ph,fh=s.A.add("X3DTexturingContext",gh),mh=Symbol(),Ah=Symbol(),_h=Symbol(),yh=Symbol(),wh=Symbol();function xh(){this[Ah]=Date.now()/1e3,this[_h]=60,this[yh]=new Ee.A,this[wh]=0}Object.assign(xh.prototype,{getCurrentTime(){return this[Ah]},getCurrentFrameRate(){return this[_h]},getCurrentSpeed(){return this[wh]},advanceOnlyTime(){this[Ah]=Date.now()/1e3},advanceTime:(()=>{const e=new Ee.A;return function(){const t=Date.now()/1e3,i=t-this[mh],n=this.getActiveViewpoint();if(i<=1/Math.max(this.getBrowserOption("MaximumFrameRate"),1))return!1;if(this[mh]=t,this[Ah]=t,this[_h]=1/i,n){const t=n.getCameraSpaceMatrix();e.assign(this[yh]),this[yh].set(t[12],t[13],t[14]),this[wh]=e.distance(this[yh])*this[_h]}else this[wh]=0;return this[wh]>0&&this.addBrowserEvent(),!0}})()});const bh=xh,Sh=s.A.add("X3DTimeContext",bh),Th=Symbol(),vh=Symbol(),Oh=Symbol(),Eh=Symbol(),Nh=Symbol();function Ch(){this[Th]=[],this[vh]=[],this[Oh]=[],this[Eh]=[],this[Nh]=!1}Object.assign(Ch.prototype,{initialize(){},addTaintedField(e,t){this[Th].push(e,t)},addTaintedNode(e){this[Oh].push(e)},[Symbol.for("X_ITE.X3DRoutingContext.processEvents")](){if(!this[Nh]){this[Nh]=!0;do{do{const e=this[Th];this[Th]=this[vh],this[Th].length=0;for(let t=0,i=e.length;t<i;t+=2)e[t].processEvent(e[t+1]);this[vh]=e}while(this[Th].length);do{const e=this[Oh];this[Oh]=this[Eh],this[Oh].length=0;for(const t of e)t.processEvent();this[Eh]=e}while(!this[Th].length&&this[Oh].length)}while(this[Th].length);this[Nh]=!1}},dispose(){}});const Ih=Ch,Fh=s.A.add("X3DRoutingContext",Ih);var Mh=n(3097);function Rh(e=[]){return Mh.A.call(this,Array.from(e,e=>[e.typeName,e]),Function)}Object.assign(Object.setPrototypeOf(Rh.prototype,Mh.A.prototype),{add(e,t){m.A.addConstant(t.typeName),Mh.A.prototype.add.call(this,e,t)}});for(const e of Object.keys(Rh.prototype))Object.defineProperty(Rh.prototype,e,{enumerable:!1});Object.defineProperties(Rh,{typeName:{value:"AbstractNodesArray",enumerable:!0}});const Ph=Rh,Vh=s.A.add("AbstractNodesArray",Ph),Dh=new Vh,Lh=s.A.add("AbstractNodes",Dh);var Bh=n(9039);function kh(e=[]){return Mh.A.call(this,Array.from(e,e=>[e.typeName,e]),Function)}Object.assign(Object.setPrototypeOf(kh.prototype,Mh.A.prototype),{add(e,t){m.A.addConstant(t.typeName),Bh.A.addConcreteNode(t),Mh.A.prototype.add.call(this,e,t)},update(e,t,i){m.A.addConstant(i.typeName),Bh.A.addConcreteNode(i),Mh.A.prototype.update.call(this,e,t,i)}});for(const e of Object.keys(kh.prototype))Object.defineProperty(kh.prototype,e,{enumerable:!1});Object.defineProperties(kh,{typeName:{value:"ConcreteNodesArray",enumerable:!0}});const jh=kh,Uh=s.A.add("ConcreteNodesArray",jh),Xh=new Uh,zh=s.A.add("ConcreteNodes",Xh);var Gh=n(1461);const Hh=Symbol(),$h=Symbol(),Yh=Symbol.for("X_ITE.X3DBrowserContext.traverse"),qh=Symbol(),Wh=Symbol(),Kh=Symbol(),Zh=Symbol(),Qh=Symbol(),Jh=Symbol(),ec=Symbol(),tc=Symbol(),ic=Symbol.for("X_ITE.X3DRoutingContext.processEvents"),nc=new Set,sc=[Fh,lo,Qe,tr,fh,Ha,ro,Ol,ki,oi,Lr,Gs,Ki,ot,dn,hr,Ul,Sh];function rc(e){nc.add(this),r.A.call(this,this);for(const t of sc)t.call(this,e);this.addChildObjects(m.A.outputOnly,"initialized",new c.A.SFTime,m.A.outputOnly,"shutdown",new c.A.SFTime,m.A.outputOnly,"prepareEvents",new c.A.SFTime,m.A.outputOnly,"timeEvents",new c.A.SFTime,m.A.outputOnly,"cameraEvents",new c.A.SFTime,m.A.outputOnly,"sensorEvents",new c.A.SFTime,m.A.outputOnly,"displayEvents",new c.A.SFTime,m.A.outputOnly,"finishedEvents",new c.A.SFTime,m.A.outputOnly,"endEvents",new c.A.SFTime),this[$h]=!1,this[Kh]=0,this[qh]=this[Yh].bind(this),this[Zh]=new y.A,this[Qh]=new y.A,this[Jh]=new y.A,this[ec]=new y.A,this[tc]=new y.A}Object.assign(Object.setPrototypeOf(rc.prototype,r.A.prototype),...sc.map(e=>e.prototype),{initialize(){r.A.prototype.initialize.call(this);for(const e of sc)e.prototype.initialize?.call(this)},initialized(){return this._initialized},shutdown(){return this._shutdown},prepareEvents(){return this._prepareEvents},timeEvents(){return this._timeEvents},cameraEvents(){return this._cameraEvents},sensorEvents(){return this._sensorEvents},displayEvents(){return this._displayEvents},finishedEvents(){return this._finishedEvents},endEvents(){return this._endEvents},getBrowser(){return this},getWorld(){return this[Hh]},getExecutionContext(){return this[Hh].getExecutionContext()},setExecutionContext(e){this.getDefaultScene().setExecutionContext(e),this[Hh]=new Gh.A(e),this[Hh].setup(),this[Hh].bindBindables()},setSession(e){this.getSession().cancelAnimationFrame(this[Wh]),ro.prototype.setSession.call(this,e),this[$h]=!1,this.addBrowserEvent()},addBrowserEvent(){this[$h]||(this[$h]=!0,this[Wh]=this.getSession().requestAnimationFrame(this[qh]))},nextFrame(){return new Promise(e=>{const t=Symbol();this.addBrowserEvent(),this._endEvents.addFieldCallback(t,()=>{this._endEvents.removeFieldCallback(t),e()})})},[Yh](e,t){if(this[$h]=!1,this.advanceTime()){this[Zh].stop(),this[Qh].start(),this.xrFrame(t),this.addTaintedField(this._prepareEvents),this[ic](),this.addTaintedField(this._timeEvents),this[ic](),this[Jh].start(),this[Hh].traverse(ci.A.CAMERA),this[Jh].stop(),this.addTaintedField(this._cameraEvents),this[ic](),this[ec].start(),(this.getCollisionCount()||this.getViewer().isCollidable())&&this[Hh].traverse(ci.A.COLLISION),this[ec].stop(),this.addTaintedField(this._sensorEvents),this[ic](),this[tc].start(),this.addTaintedField(this._displayEvents),this[ic]();for(const e of this.getFramebuffers())e.clear();this[Hh].traverse(ci.A.DISPLAY),this.addTaintedField(this._finishedEvents),this[ic]();for(const e of this.getFramebuffers())e.blit();this[tc].stop(),this.addTaintedField(this._endEvents),this[ic](),this[Qh].stop(),this[Zh].start()}else this.addBrowserEvent()},getSystemTime(){return this[Zh]},getBrowserTime(){return this[Qh]},getCameraTime(){return this[Jh]},getCollisionTime(){return this[ec]},getDisplayTime(){return this[tc]},dispose(){nc.delete(this),this[$h]=!0,this.getSession().cancelAnimationFrame(this[Wh]);for(const e of sc.slice().reverse())e.prototype.dispose?.call(this);r.A.prototype.dispose.call(this)}});for(const e of Object.keys(rc.prototype))Object.defineProperty(rc.prototype,e,{enumerable:!1});Object.assign(rc,{addComponent({name:e,concreteNodes:t,abstractNodes:i,browserContext:n,external:s}){if(t)for(const e of t)zh.add(e.typeName,e);if(i)for(const e of i)Lh.add(e.typeName,e);if(n){sc.push(n);const e=Object.keys(n.prototype).filter(e=>!e.match(/^(?:initialize|dispose)$/)).concat(Object.getOwnPropertySymbols(n.prototype));for(const t of e)Object.defineProperty(rc.prototype,t,{value:n.prototype[t],writable:!0})}for(const e of nc){if(t)for(const i of t)e.addConcreteNode(i);if(i)for(const t of i)e.addAbstractNode(t);n&&(n.call(e),n.prototype.initialize?.call(e),e[ic]())}s&&ka.A&&console.info(`Done loading external component '${e}'.`)}});const oc=rc,ac=s.A.add("X3DBrowserContext",oc);var lc=n(7153),hc=n(4068),cc=n(9340);const uc=class{constructor(e){this.browser=e,this.rootElement=void 0,this.canvasObserver=new MutationObserver(()=>this.processCanvasMutation(e)),this.canvasObserver.observe(e.getElement()[0],{childList:!0}),this.processCanvasMutation(e)}processCanvasMutation(e){this.processRootElement(e,e.getElement().children("X3D").get(-1))}async processRootElement(e,t){try{if(t===this.rootElement)return;if(this.rootElement=t,t){e.setBrowserLoading(!0),e.addLoadingObject(this);const i=new ye.A(e);this.parser=new lc.A(i),this.parser.setInput(t),await new Promise(this.parser.parseIntoScene.bind(this.parser)),e.replaceWorld(i),this.observer=new MutationObserver(e=>{for(const t of e)this.processMutation(t)}),this.observer.observe(t,{attributes:!0,childList:!0,characterData:!1,subtree:!0,attributeOldValue:!0}),this.processInlineElements(t),this.addEventDispatchersAll(t),e.removeLoadingObject(this)}else e.replaceWorld(null)}catch(e){console.error("Error importing document:",e)}}processMutation(e){switch(e.type){case"attributes":this.processAttribute(e,e.target);break;case"childList":for(const t of e.addedNodes)this.processAddedNode(t);for(const t of e.removedNodes)this.processRemovedNode(t)}}processAttribute(e,t){const i=this.parser,n=cc.data(t,"node");if(n){const s=e.attributeName,r=t.attributes.getNamedItem(s);i.nodeAttribute(r,n),i.setupNodes()}else{const e=t.parentNode,n=cc.data(e,"node");n&&(i.pushExecutionContext(n.getExecutionContext()),i.pushParent(n),i.childElement(t),i.popParent(),i.setupNodes(),i.popExecutionContext())}}processAddedNode(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if("X3D"===e.nodeName)return;if(cc.data(e,"node"))return;const t=e.parentNode,i=this.parser;if(t.nodeName.match(/^(?:Scene|SCENE)$/)){const n=cc.data(t,"node");i.pushExecutionContext(n),i.childElement(e),i.setupNodes(),i.popExecutionContext()}else if(cc.data(t,"node")){const n=cc.data(t,"node"),s=n.getExecutionContext();i.pushExecutionContext(s),i.pushParent(n),i.childElement(e),i.popParent(),i.setupNodes(),i.popExecutionContext()}else{const t=this.browser.currentScene;i.pushExecutionContext(t),i.childElement(e),i.setupNodes(),i.popExecutionContext()}this.processInlineElements(e),this.addEventDispatchers(e),this.addEventDispatchersAll(e)}processRemovedNode(e){const t=cc.data(e,"node");t&&(t.dispose(),cc.data(e,"node",null))}processInlineElements(e){e.nodeName.match(/^(?:Inline|INLINE)$/)&&this.processInlineElement(e);for(const t of e.querySelectorAll("Inline"))this.processInlineElement(t)}processInlineElement(e){const t=cc.data(e,"node");t&&(t._loadState.addInterest("appendInlineChildElement",this,e),this.appendInlineChildElement(e))}appendInlineChildElement(e){const t=cc.data(e,"node");switch(t.checkLoadState()){case m.A.NOT_STARTED_STATE:case m.A.FAILED_STATE:for(;e.firstChild;)e.removeChild(e.lastChild);break;case m.A.COMPLETE_STATE:{for(;e.firstChild;)e.removeChild(e.lastChild);const i=cc.data(t.getInternalScene(),"X3D");if(!i)break;e.appendChild(i),this.processInlineElements(i),this.addEventDispatchersAll(i);break}}switch(t.checkLoadState()){case m.A.COMPLETE_STATE:{const i=new CustomEvent("load",{detail:{node:hc.A.get(t)}});e.dispatchEvent(i);break}case m.A.FAILED_STATE:{const i=new CustomEvent("error",{detail:{node:hc.A.get(t)}});e.dispatchEvent(i);break}}}addEventDispatchersAll(e){const t=e.querySelectorAll("*");for(const e of t)this.addEventDispatchers(e)}addEventDispatchers(e){if("ROUTE"===e.nodeName)return;const t=cc.data(e,"node");if(t){for(const i of t.getPredefinedFields())this.bindFieldCallback(i,e);for(const i of t.getUserDefinedFields())this.bindFieldCallback(i,e)}}bindFieldCallback(e,t){e.isOutput()&&e.addInterest("fieldCallback",this,t)}fieldCallback(e,t){const i=cc.data(e,"node");if(!i)return;const n=new CustomEvent(t.getName(),{detail:{node:hc.A.get(i),value:t.valueOf()}});e.dispatchEvent(n)}dispose(){this.canvasObserver.disconnect()}},dc=s.A.add("DOMIntegration",uc);var pc=n(9721);function gc(e,t,i,n){Object.defineProperties(this,{name:{value:e,enumerable:!0},title:{value:t,enumerable:!0},providerURL:{value:i||_e.A.getProviderURL(),enumerable:!0},components:{value:n,enumerable:!0}})}Object.assign(Object.setPrototypeOf(gc.prototype,pc.A.prototype),{toVRMLStream(e){e.Indent(),e.string+="PROFILE",e.Space(),e.string+=this.name},toXMLStream(e){e.string+=this.name},toJSONStream(e){e.string+=this.name}});for(const e of Object.keys(gc.prototype))Object.defineProperty(gc.prototype,e,{enumerable:!1});Object.defineProperties(gc,{typeName:{value:"ProfileInfo",enumerable:!0}}),Object.defineProperties(gc.prototype,{providerUrl:{get:function(){return this.providerURL}}});const fc=gc,mc=s.A.add("ProfileInfo",fc);var Ac=n(9949),_c=n(3880);function yc(e=[]){return Mh.A.call(this,Array.from(e,e=>[e.name,e]),mc)}Object.assign(Object.setPrototypeOf(yc.prototype,Mh.A.prototype),{add(e,{title:t,providerURL:i,components:n}){Mh.A.prototype.add.call(this,e,new mc(e,t,i,new _c.A(n)))}});for(const e of Object.keys(yc.prototype))Object.defineProperty(yc.prototype,e,{enumerable:!1});Object.defineProperties(yc,{typeName:{value:"ProfileInfoArray",enumerable:!0}});const wc=yc,xc=s.A.add("ProfileInfoArray",wc),bc=new _c.A([]);bc.add("CADGeometry",{title:"CAD geometry",level:2,external:!0}),bc.add("Core",{title:"Core",level:2}),bc.add("CubeMapTexturing",{title:"Cube map environmental texturing",level:3,external:!0}),bc.add("DIS",{title:"Distributed interactive simulation",level:2,external:!0}),bc.add("EnvironmentalEffects",{title:"Environmental effects",level:4}),bc.add("EnvironmentalSensor",{title:"Environmental sensor",level:3}),bc.add("EventUtilities",{title:"Event utilities",level:1,external:!0}),bc.add("Followers",{title:"Followers",level:1}),bc.add("Geometry2D",{title:"Geometry2D",level:2,external:!0}),bc.add("Geometry3D",{title:"Geometry3D",level:4}),bc.add("Geospatial",{title:"Geospatial",level:2,external:!0}),bc.add("Grouping",{title:"Grouping",level:3}),bc.add("HAnim",{title:"Humanoid animation (HAnim)",level:3,external:!0}),bc.alias("H-Anim",bc.get("HAnim")),bc.add("Interpolation",{title:"Interpolation",level:5}),bc.add("KeyDeviceSensor",{title:"Key device sensor",level:2,external:!0}),bc.add("Layering",{title:"Layering",level:1}),bc.add("Layout",{title:"Layout",level:2,external:!0,dependencies:["Text"]}),bc.add("Lighting",{title:"Lighting",level:3}),bc.add("Navigation",{title:"Navigation",level:3}),bc.add("Networking",{title:"Networking",level:4}),bc.add("NURBS",{title:"NURBS",level:4,external:!0}),bc.add("ParticleSystems",{title:"Particle systems",level:3,external:!0}),bc.add("Picking",{title:"Picking",level:3,external:!0,dependencies:["RigidBodyPhysics"]}),bc.add("PointingDeviceSensor",{title:"Pointing device sensor",level:1}),bc.add("Shaders",{title:"Programmable shaders",level:1}),bc.add("TextureProjection",{title:"Texture Projection",level:2,external:!0}),bc.alias("TextureProjector",bc.get("TextureProjection")),bc.alias("ProjectiveTextureMapping",bc.get("TextureProjection")),bc.add("Rendering",{title:"Rendering",level:5}),bc.add("RigidBodyPhysics",{title:"Rigid body physics",level:2,external:!0}),bc.add("Scripting",{title:"Scripting",level:1,external:!0}),bc.add("Shape",{title:"Shape",level:4}),bc.add("Sound",{title:"Sound",level:3}),bc.add("Text",{title:"Text",level:1,external:!0}),bc.add("Texturing",{title:"Texturing",level:4}),bc.add("Texturing3D",{title:"Texturing3D",level:2,external:!0}),bc.add("Time",{title:"Time",level:2}),bc.add("VolumeRendering",{title:"Volume rendering",level:4,external:!0,dependencies:["CADGeometry","Texturing3D"]}),bc.add("WebXR",{title:"WebXR",level:1,external:!0}),bc.add("X_ITE",{title:"X_ITE",level:1,external:!0});const Sc=bc,Tc=s.A.add("SupportedComponents",Sc);function vc(e,t=0){const i=Tc.get(e);if(ka.A&&(t<1||t>i.level))throw new Error(`Component ${e} level ${t} exceeds maximum level ${i.level}.`);return new Ac.A(i.name,t,i.title,i.providerURL,i.external,i.dependencies)}const Oc=new xc;Oc.add("CADInterchange",{title:"Computer-Aided Design (CAD) interchange",components:[vc("CADGeometry",2),vc("Core",1),vc("Grouping",1),vc("Lighting",1),vc("Navigation",3),vc("Networking",2),vc("Rendering",4),vc("Shaders",1),vc("Shape",2),vc("Texturing",2)]}),Oc.add("Core",{title:"Core",components:[vc("Core",1)]}),Oc.add("Full",{title:"Full",components:[vc("CADGeometry",2),vc("Core",2),vc("CubeMapTexturing",3),vc("DIS",2),vc("EnvironmentalEffects",4),vc("EnvironmentalSensor",3),vc("EventUtilities",1),vc("Followers",1),vc("Geometry2D",2),vc("Geometry3D",4),vc("Geospatial",2),vc("Grouping",3),vc("HAnim",3),vc("Interpolation",5),vc("KeyDeviceSensor",2),vc("Layering",1),vc("Layout",2),vc("Lighting",3),vc("Navigation",3),vc("Networking",4),vc("NURBS",4),vc("ParticleSystems",3),vc("Picking",3),vc("PointingDeviceSensor",1),vc("Rendering",5),vc("RigidBodyPhysics",2),vc("Scripting",1),vc("Shaders",1),vc("Shape",4),vc("Sound",3),vc("Text",1),vc("TextureProjection",2),vc("Texturing",4),vc("Texturing3D",2),vc("Time",2),vc("VolumeRendering",4)]}),Oc.add("Immersive",{title:"Immersive",components:[vc("Core",2),vc("EnvironmentalEffects",2),vc("EnvironmentalSensor",2),vc("EventUtilities",1),vc("Geometry2D",2),vc("Geometry3D",4),vc("Grouping",2),vc("Interpolation",2),vc("KeyDeviceSensor",2),vc("Lighting",2),vc("Navigation",2),vc("Networking",3),vc("PointingDeviceSensor",1),vc("Rendering",3),vc("Scripting",1),vc("Shape",2),vc("Sound",1),vc("Text",1),vc("Texturing",3),vc("Time",1)]}),Oc.add("Interactive",{title:"Interactive",components:[vc("Core",1),vc("EnvironmentalEffects",1),vc("EnvironmentalSensor",1),vc("EventUtilities",1),vc("Geometry3D",3),vc("Grouping",2),vc("Interpolation",2),vc("KeyDeviceSensor",1),vc("Lighting",2),vc("Navigation",1),vc("Networking",2),vc("PointingDeviceSensor",1),vc("Rendering",3),vc("Shape",1),vc("Texturing",2),vc("Time",1)]}),Oc.add("Interchange",{title:"Interchange",components:[vc("Core",1),vc("EnvironmentalEffects",1),vc("Geometry3D",2),vc("Grouping",1),vc("Interpolation",2),vc("Lighting",1),vc("Navigation",1),vc("Networking",1),vc("Rendering",3),vc("Shape",1),vc("Texturing",2),vc("Time",1)]}),Oc.add("MedicalInterchange",{title:"Medical interchange",components:[vc("Core",1),vc("EnvironmentalEffects",1),vc("EventUtilities",1),vc("Geometry2D",2),vc("Geometry3D",3),vc("Grouping",3),vc("Interpolation",2),vc("Lighting",1),vc("Navigation",3),vc("Networking",2),vc("Rendering",5),vc("Shape",3),vc("Text",1),vc("Texturing",2),vc("Texturing3D",2),vc("Time",1),vc("VolumeRendering",4)]}),Oc.add("MPEG-4",{title:"MPEG-4 interactive",components:[vc("Core",1),vc("EnvironmentalEffects",1),vc("EnvironmentalSensor",1),vc("Geometry3D",3),vc("Grouping",2),vc("Interpolation",2),vc("Lighting",2),vc("Navigation",1),vc("Networking",2),vc("PointingDeviceSensor",1),vc("Rendering",1),vc("Shape",1),vc("Texturing",1),vc("Time",1)]});const Ec=Oc,Nc=s.A.add("SupportedProfiles",Ec);function Cc(e=[]){return Mh.A.call(this,Array.from(e,e=>[e.typeName,e]),Function)}Object.setPrototypeOf(Cc.prototype,Mh.A.prototype);for(const e of Object.keys(Cc.prototype))Object.defineProperty(Cc.prototype,e,{enumerable:!1});Object.defineProperties(Cc,{typeName:{value:"FieldTypesArray",enumerable:!0}});const Ic=Cc,Fc=new(s.A.add("FieldTypesArray",Ic))(Object.values(c.A)),Mc=s.A.add("FieldTypes",Fc);var Rc=n(6702);function Pc(e){this.addType(m.A.X3DMetadataObject)}Object.assign(Pc.prototype,{initialize(){},dispose(){}}),Object.defineProperties(Pc,Je.A.getStaticProperties("X3DMetadataObject","Core",1));const Vc=Pc,Dc=s.A.add("X3DMetadataObject",Vc);var Lc=n(9351);function Bc(e){Je.A.call(this,e),Dc.call(this,e),this.addType(m.A.MetadataBoolean)}Object.assign(Object.setPrototypeOf(Bc.prototype,Je.A.prototype),Dc.prototype,{initialize(){Je.A.prototype.initialize.call(this),Dc.prototype.initialize.call(this)},getContainerField(e=Lc.A){return e<=3.3?"metadata":Je.A.prototype.getContainerField.call(this)},dispose(){Dc.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Bc,{...Je.A.getStaticProperties("MetadataBoolean","Core",1,"value","3.3"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"name",new c.A.SFString),new o.A(m.A.inputOutput,"reference",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFBool)]),enumerable:!0}});const kc=Bc,jc=s.A.add("MetadataBoolean",kc);function Uc(e){Je.A.call(this,e),Dc.call(this,e),this.addType(m.A.MetadataDouble)}Object.assign(Object.setPrototypeOf(Uc.prototype,Je.A.prototype),Dc.prototype,{initialize(){Je.A.prototype.initialize.call(this),Dc.prototype.initialize.call(this)},getContainerField(e=Lc.A){return e<=3.3?"metadata":Je.A.prototype.getContainerField.call(this)},dispose(){Dc.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Uc,{...Je.A.getStaticProperties("MetadataDouble","Core",1,"value","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"name",new c.A.SFString),new o.A(m.A.inputOutput,"reference",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFDouble)]),enumerable:!0}});const Xc=Uc,zc=s.A.add("MetadataDouble",Xc);function Gc(e){Je.A.call(this,e),Dc.call(this,e),this.addType(m.A.MetadataFloat)}Object.assign(Object.setPrototypeOf(Gc.prototype,Je.A.prototype),Dc.prototype,{initialize(){Je.A.prototype.initialize.call(this),Dc.prototype.initialize.call(this)},getContainerField(e=Lc.A){return e<=3.3?"metadata":Je.A.prototype.getContainerField.call(this)},dispose(){Dc.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Gc,{...Je.A.getStaticProperties("MetadataFloat","Core",1,"value","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"name",new c.A.SFString),new o.A(m.A.inputOutput,"reference",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFFloat)]),enumerable:!0}});const Hc=Gc,$c=s.A.add("MetadataFloat",Hc);function Yc(e){Je.A.call(this,e),Dc.call(this,e),this.addType(m.A.MetadataInteger)}Object.assign(Object.setPrototypeOf(Yc.prototype,Je.A.prototype),Dc.prototype,{initialize(){Je.A.prototype.initialize.call(this),Dc.prototype.initialize.call(this)},getContainerField(e=Lc.A){return e<=3.3?"metadata":Je.A.prototype.getContainerField.call(this)},dispose(){Dc.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Yc,{...Je.A.getStaticProperties("MetadataInteger","Core",1,"value","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"name",new c.A.SFString),new o.A(m.A.inputOutput,"reference",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFInt32)]),enumerable:!0}});const qc=Yc,Wc=s.A.add("MetadataInteger",qc);function Kc(e){Je.A.call(this,e),Dc.call(this,e),this.addType(m.A.MetadataSet)}Object.assign(Object.setPrototypeOf(Kc.prototype,Je.A.prototype),Dc.prototype,{initialize(){Je.A.prototype.initialize.call(this),Dc.prototype.initialize.call(this)},getContainerField(e=Lc.A){return e<=3.3?"metadata":Je.A.prototype.getContainerField.call(this)},getMetaValue(e){return this._value.find(t=>t.name===e)},setMetaValue(e,t){switch(Array.isArray(t)||(t=[t.valueOf()]),t.type??typeof t[0]){case"boolean":return void(this.getMetadataObject("MetadataBoolean",e,!0).value=t);case"number":case"double":this.getMetadataObject("MetadataDouble",e,!0).value=t;break;case"float":this.getMetadataObject("MetadataFloat",e,!0).value=t;break;case"integer":this.getMetadataObject("MetadataInteger",e,!0).value=t;break;case"string":return void(this.getMetadataObject("MetadataString",e,!0).value=t)}},removeMetaValue(e){const t=this._value.findIndex(t=>t.name===e);t<0||this._value.splice(t,1)},getMetadataObject(e,t,i=!1){let n=this.getMetaValue(t);return n?.getNodeTypeName()===e?n:i?(n&&this.removeMetaValue(t),n=this.getExecutionContext().createNode(e),this.getExecutionContext().addNamedNode(this.getExecutionContext().getUniqueName(t),n),n.reference=this.getBrowser().getBrowserOption("MetadataReference"),n.name=t,this._value.push(n),n):null},dispose(){Dc.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Kc,{...Je.A.getStaticProperties("MetadataSet","Core",1,"value","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"name",new c.A.SFString),new o.A(m.A.inputOutput,"reference",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFNode)]),enumerable:!0}});const Zc=Kc,Qc=s.A.add("MetadataSet",Zc);function Jc(e){Je.A.call(this,e),Dc.call(this,e),this.addType(m.A.MetadataString)}Object.assign(Object.setPrototypeOf(Jc.prototype,Je.A.prototype),Dc.prototype,{initialize(){Je.A.prototype.initialize.call(this),Dc.prototype.initialize.call(this)},getContainerField(e=Lc.A){return e<=3.3?"metadata":Je.A.prototype.getContainerField.call(this)},dispose(){Dc.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(Jc,{...Je.A.getStaticProperties("MetadataString","Core",1,"value","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"name",new c.A.SFString),new o.A(m.A.inputOutput,"reference",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFString)]),enumerable:!0}});const eu=Jc,tu=s.A.add("MetadataString",eu);function iu(e){ai.A.call(this,e),this.addType(m.A.X3DInfoNode)}Object.setPrototypeOf(iu.prototype,ai.A.prototype),Object.defineProperties(iu,Je.A.getStaticProperties("X3DInfoNode","Core",1));const nu=iu,su=s.A.add("X3DInfoNode",nu);function ru(e){su.call(this,e),this.addType(m.A.WorldInfo)}Object.assign(Object.setPrototypeOf(ru.prototype,su.prototype),{initialize(){su.prototype.initialize.call(this),this.isLive()&&this.getExecutionContext().addWorldInfo(this)},setLive(e){!!e.valueOf()!==this.isLive()&&(su.prototype.setLive.call(this,e),this.isLive()?this.getExecutionContext().addWorldInfo(this):this.getExecutionContext().removeWorldInfo(this))}}),Object.defineProperties(ru,{...Je.A.getStaticProperties("WorldInfo","Core",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"title",new c.A.SFString),new o.A(m.A.inputOutput,"info",new c.A.MFString)]),enumerable:!0}});const ou=ru,au=s.A.add("WorldInfo",ou);var lu=n(6138),hu=n(1937),cu=n(8664);const uu={name:"Core",concreteNodes:[jc,zc,$c,Wc,Qc,tu,au],abstractNodes:[lu.A,ai.A,hu.A,su,Dc,Je.A,cu.A,na.A]},du=s.A.add("CoreComponent",uu);var pu=n(1467),gu=n(6855);function fu(e){At.call(this,e),this.addType(m.A.FogCoordinate),this._depth.setUnit("length")}Object.assign(Object.setPrototypeOf(fu.prototype,At.prototype),{initialize(){At.prototype.initialize.call(this),this._depth.addInterest("set_depth__",this),this.set_depth__()},set_depth__(){this.depth=this._depth.getValue(),this.length=this._depth.length},getSize(){return this.length},addDepth(e,t){if(e>=0&&this.length)return t.push(this.depth[e%this.length]);t.push(0)},addDepths(e,t=this.length){const i=this.length;if(i){const n=this.depth;for(let s=0;s<t;++s)e.push(n[s%i])}else for(let i=0;i<t;++i)e.push(0);return e}}),Object.defineProperties(fu,{...Je.A.getStaticProperties("FogCoordinate","EnvironmentalEffects",4,"fogCoord","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"depth",new c.A.MFFloat)]),enumerable:!0}});const mu=fu,Au=s.A.add("FogCoordinate",mu);var _u=n(2857);function yu(e){ai.A.call(this,e),_u.A.call(this,e),this.addType(m.A.LocalFog)}Object.assign(Object.setPrototypeOf(yu.prototype,ai.A.prototype),_u.A.prototype,{initialize(){ai.A.prototype.initialize.call(this),_u.A.prototype.initialize.call(this)},push(e){if(this._enabled.getValue()&&this.getFogType()){const t=this.getFogs().pop();t.set(this,e.getModelViewMatrix().get()),e.getLocalFogs().push(t)}},pop(e){this._enabled.getValue()&&this.getFogType()&&this.getBrowser().getLocalObjects().push(e.getLocalFogs().pop())},dispose(){_u.A.prototype.dispose.call(this),ai.A.prototype.dispose.call(this)}}),Object.defineProperties(yu,{...Je.A.getStaticProperties("LocalFog","EnvironmentalEffects",4,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"fogType",new c.A.SFString("LINEAR")),new o.A(m.A.inputOutput,"color",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"visibilityStart",new c.A.SFFloat),new o.A(m.A.inputOutput,"visibilityRange",new c.A.SFFloat)]),enumerable:!0}});const wu=yu,xu=s.A.add("LocalFog",wu);var bu=n(5464);function Su(e){bu.A.call(this,e),this.addType(m.A.TextureBackground)}Object.assign(Object.setPrototypeOf(Su.prototype,bu.A.prototype),{initialize(){bu.A.prototype.initialize.call(this),this._frontTexture.addInterest("set_texture__",this,0),this._backTexture.addInterest("set_texture__",this,1),this._leftTexture.addInterest("set_texture__",this,2),this._rightTexture.addInterest("set_texture__",this,3),this._topTexture.addInterest("set_texture__",this,4),this._bottomTexture.addInterest("set_texture__",this,5),this.set_texture__(0,this._frontTexture),this.set_texture__(1,this._backTexture),this.set_texture__(2,this._leftTexture),this.set_texture__(3,this._rightTexture),this.set_texture__(4,this._topTexture),this.set_texture__(5,this._bottomTexture)},set_texture__(e,t){bu.A.prototype.set_texture__.call(this,e,(0,hi.A)(m.A.X3DTextureNode,t))}}),Object.defineProperties(Su,{...Je.A.getStaticProperties("TextureBackground","EnvironmentalEffects",3,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_bind",new c.A.SFBool),new o.A(m.A.inputOutput,"skyAngle",new c.A.MFFloat),new o.A(m.A.inputOutput,"skyColor",new c.A.MFColor(new Wn.A)),new o.A(m.A.inputOutput,"groundAngle",new c.A.MFFloat),new o.A(m.A.inputOutput,"groundColor",new c.A.MFColor),new o.A(m.A.inputOutput,"transparency",new c.A.SFFloat),new o.A(m.A.outputOnly,"isBound",new c.A.SFBool),new o.A(m.A.outputOnly,"bindTime",new c.A.SFTime),new o.A(m.A.inputOutput,"frontTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"backTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"leftTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"rightTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"topTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"bottomTexture",new c.A.SFNode)]),enumerable:!0}});const Tu=Su,vu=s.A.add("TextureBackground",Tu),Ou={name:"EnvironmentalEffects",concreteNodes:[pu.A,gu.A,Au,xu,vu],abstractNodes:[bu.A,_u.A]},Eu=s.A.add("EnvironmentalEffectsComponent",Ou);function Nu(e){na.A.call(this,e),this.addType(m.A.X3DEnvironmentalSensorNode),this.addChildObjects(m.A.outputOnly,"traversed",new c.A.SFBool(!0)),this._size.setUnit("length"),this._center.setUnit("length"),this.zeroTest=!1,this.currentTraversed=!0}Object.assign(Object.setPrototypeOf(Nu.prototype,na.A.prototype),{initialize(){na.A.prototype.initialize.call(this),this.getLive().addInterest("set_live__",this),this._enabled.addInterest("set_live__",this),this._size.addInterest("set_live__",this),this._traversed.addInterest("set_live__",this),this.set_live__()},set_live__(){!(this._traversed.getValue()&&this.getLive().getValue()&&this._enabled.getValue())||this.zeroTest&&this._size.getValue().equals(Ee.A.ZERO)?(this.getBrowser().sensorEvents().removeInterest("update",this),this._isActive.getValue()&&(this._isActive=!1,this._exitTime=this.getBrowser().getCurrentTime())):this.getBrowser().sensorEvents().addInterest("update",this)},setZeroTest(e){this.zeroTest=e},getZeroTest(){return this.zeroTest},setTraversed(e){e?!1===this._traversed.getValue()&&(this._traversed=!0):this.currentTraversed!==this._traversed.getValue()&&(this._traversed=this.currentTraversed),this.currentTraversed=e},getTraversed(){return this.currentTraversed},update(){}}),Object.defineProperties(Nu,Je.A.getStaticProperties("X3DEnvironmentalSensorNode","EnvironmentalSensor",1));const Cu=Nu,Iu=s.A.add("X3DEnvironmentalSensorNode",Cu);function Fu(e){Iu.call(this,e),this.addType(m.A.ProximitySensor),this.setCameraObject(!0),this.setZeroTest(!0),this._centerOfRotation_changed.setUnit("length"),this._position_changed.setUnit("length"),this.min=new Ee.A,this.max=new Ee.A,this.layerNode=null,this.modelMatrix=new Si.A,this.inside=!1}Object.assign(Object.setPrototypeOf(Fu.prototype,Iu.prototype),{initialize(){Iu.prototype.initialize.call(this),this._size.addInterest("set_extents__",this),this._center.addInterest("set_extents__",this),this._enabled.addFieldInterest(this._isVisibleObject),this._traversed.addFieldInterest(this._isCameraObject),this.setVisibleObject(this._enabled.getValue()),this.set_extents__()},set_extents__(){const e=this._size.getValue(),t=this._center.getValue(),i=e.x/2,n=e.y/2,s=e.z/2,r=t.x,o=t.y,a=t.z;this.min.set(r-i,o-n,a-s),this.max.set(r+i,o+n,a+s)},update:(()=>{const e=new Ee.A,t=new Fn.A,i=new Ee.A,n=new Si.A;return function(){if(this.inside&&this.getTraversed()){if(this.layerNode){const s=this.getBrowser(),r=this.layerNode.getViewpoint(),o=this.modelMatrix.inverse();if(n.assign(r.getModelMatrix()).translate(r.getUserCenterOfRotation()).multRight(o).get(i),o.multLeft(r.getCameraSpaceMatrix()),this.layerNode===s.getActiveLayer()){const e=s.getPose();e&&o.multLeft(e.cameraSpaceMatrix)}o.get(e,t),this._isActive.getValue()?(this._position_changed.getValue().equals(e)||(this._position_changed=e),this._orientation_changed.getValue().equals(t)||(this._orientation_changed=t),this._centerOfRotation_changed.getValue().equals(i)||(this._centerOfRotation_changed=i)):(this._isActive=!0,this._enterTime=s.getCurrentTime(),this._position_changed=e,this._orientation_changed=t,this._centerOfRotation_changed=i)}}else this._isActive.getValue()&&(this._isActive=!1,this._exitTime=this.getBrowser().getCurrentTime());this.inside=!1,this.layerNode=null,this.setTraversed(!1)}})(),traverse:(()=>{const e=new Si.A,t=new Ee.A(-1);return function(i,n){switch(i){case ci.A.CAMERA:return this.layerNode=n.getLayer(),void this.modelMatrix.assign(n.getModelViewMatrix().get());case ci.A.DISPLAY:if(this.setTraversed(!0),this.inside)return;return void(this._size.getValue().equals(t)?this.inside=!0:(e.assign(n.getModelViewMatrix().get()).inverse(),this.inside=this.containsPoint(e.origin)))}}})(),containsPoint({x:e,y:t,z:i}){const n=this.min,s=this.max;return n.x<=e&&s.x>=e&&n.y<=t&&s.y>=t&&n.z<=i&&s.z>=i}}),Object.defineProperties(Fu,{...Je.A.getStaticProperties("ProximitySensor","EnvironmentalSensor",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"size",new c.A.SFVec3f),new o.A(m.A.inputOutput,"center",new c.A.SFVec3f),new o.A(m.A.outputOnly,"enterTime",new c.A.SFTime),new o.A(m.A.outputOnly,"exitTime",new c.A.SFTime),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"position_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"orientation_changed",new c.A.SFRotation),new o.A(m.A.outputOnly,"centerOfRotation_changed",new c.A.SFVec3f)]),enumerable:!0}});const Mu=Fu,Ru=s.A.add("ProximitySensor",Mu),Pu=(0,Rs.A)(Si.A),Vu=(0,Rs.A)(Si.A);function Du(e){Iu.call(this,e),this.addType(m.A.TransformSensor),this.setZeroTest(!0),this._position_changed.setUnit("length"),this.min=new Ee.A,this.max=new Ee.A,this.modelMatrices=[],this.targetMatrices=[]}Object.assign(Object.setPrototypeOf(Du.prototype,Iu.prototype),{initialize(){Iu.prototype.initialize.call(this),this.getLive().addInterest("set_enabled__",this),this._enabled.addInterest("set_enabled__",this),this._size.addInterest("set_enabled__",this),this._size.addInterest("set_extents__",this),this._center.addInterest("set_extents__",this),this._targetObject.addInterest("set_targetObject__",this),this.set_extents__(),this.set_targetObject__()},set_live__(){},set_enabled__(){this.getLive().getValue()&&this.targetObjectNode&&this._enabled.getValue()&&!this._size.getValue().equals(Ee.A.ZERO)?(this.setPickableObject(!0),this.getBrowser().addTransformSensor(this),this.targetObjectNode.addTransformSensor(this)):(this.setPickableObject(!1),this.getBrowser().removeTransformSensor(this),this.targetObjectNode?.removeTransformSensor(this),this._isActive.getValue()&&(this._isActive=!1,this._exitTime=this.getBrowser().getCurrentTime()))},set_extents__(){const e=this._size.getValue(),t=this._center.getValue(),i=e.x/2,n=e.y/2,s=e.z/2,r=t.x,o=t.y,a=t.z;this.min.set(r-i,o-n,a-s),this.max.set(r+i,o+n,a+s)},set_targetObject__(){this.targetObjectNode=null;try{const e=this._targetObject.getValue().getInnerNode(),t=e.getType();for(let i=t.length-1;i>=0;--i){switch(t[i]){case m.A.X3DGroupingNode:case m.A.X3DShapeNode:this.targetObjectNode=e;break;default:continue}break}}catch{}this.set_enabled__()},traverse(e,t){this.modelMatrices.push(Pu.pop().assign(t.getModelViewMatrix().get()))},collect(e){this.targetMatrices.push(Vu.pop().assign(e))},process:(()=>{const e=new Ee.A,t=new Fn.A;return function(){const i=this.modelMatrices,n=this.targetMatrices,s=this.intersects();s?(s.get(e,t),this._isActive.getValue()?(this._position_changed.getValue().equals(e)||(this._position_changed=e),this._orientation_changed.getValue().equals(t)||(this._orientation_changed=t)):(this._isActive=!0,this._enterTime=this.getBrowser().getCurrentTime(),this._position_changed=e,this._orientation_changed=t)):this._isActive.getValue()&&(this._isActive=!1,this._exitTime=this.getBrowser().getCurrentTime());for(const e of i)Pu.push(e);for(const e of n)Vu.push(e);i.length=0,n.length=0}})(),intersects:(()=>{const e=new Ee.A(-1);return function(){const t=this.modelMatrices,i=this.targetMatrices,n=this._size.getValue().equals(e);for(const e of t){const t=e.inverse();for(const e of i){const i=e.multRight(t);if(n||this.containsPoint(i.origin))return i}}return null}})(),containsPoint(e){const t=this.min,i=this.max;return t.x<=e.x&&i.x>=e.x&&t.y<=e.y&&i.y>=e.y&&t.z<=e.z&&i.z>=e.z}}),Object.defineProperties(Du,{...Je.A.getStaticProperties("TransformSensor","EnvironmentalSensor",3,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"size",new c.A.SFVec3f),new o.A(m.A.inputOutput,"center",new c.A.SFVec3f),new o.A(m.A.outputOnly,"enterTime",new c.A.SFTime),new o.A(m.A.outputOnly,"exitTime",new c.A.SFTime),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"position_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"orientation_changed",new c.A.SFRotation),new o.A(m.A.inputOutput,"targetObject",new c.A.SFNode)]),enumerable:!0}});const Lu=Du,Bu=s.A.add("TransformSensor",Lu);function ku(e){Iu.call(this,e),this.addType(m.A.VisibilitySensor),this.setZeroTest(!1),this.visible=!1}Object.assign(Object.setPrototypeOf(ku.prototype,Iu.prototype),{initialize(){Iu.prototype.initialize.call(this),this._enabled.addFieldInterest(this._isVisibleObject),this.setVisibleObject(this._enabled.getValue())},update(){this.visible&&this.getTraversed()?(this._isActive.getValue()||(this._isActive=!0,this._enterTime=this.getBrowser().getCurrentTime()),this.visible=!1):this._isActive.getValue()&&(this._isActive=!1,this._exitTime=this.getBrowser().getCurrentTime()),this.setTraversed(!1)},traverse:(()=>{const e=new pi.A,t=new Ee.A(-1);return function(i,n){this.setTraversed(!0),this.visible||(this._size.getValue().equals(t)?this.visible=!0:(e.set(this._size.getValue(),this._center.getValue()).multRight(n.getModelViewMatrix().get()),this.visible=n.getViewVolume().intersectsBox(e)))}})()}),Object.defineProperties(ku,{...Je.A.getStaticProperties("VisibilitySensor","EnvironmentalSensor",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"size",new c.A.SFVec3f),new o.A(m.A.inputOutput,"center",new c.A.SFVec3f),new o.A(m.A.outputOnly,"enterTime",new c.A.SFTime),new o.A(m.A.outputOnly,"exitTime",new c.A.SFTime),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool)]),enumerable:!0}});const ju=ku,Uu=s.A.add("VisibilitySensor",ju),Xu={name:"EnvironmentalSensor",concreteNodes:[Ru,Bu,Uu],abstractNodes:[Iu]},zu=s.A.add("EnvironmentalSensorComponent",Xu),Gu=new Ee.A,Hu=new Ee.A,$u=new Ee.A,Yu=new Ee.A;function qu(e){En.call(this,e),this.addType(m.A.ColorChaser)}Object.assign(Object.setPrototypeOf(qu.prototype,En.prototype),{getVector:()=>new Ee.A,getValue(){return this._set_value.getValue().getHSV(Yu)},getDestination(){return this._set_destination.getValue().getHSV(Yu)},getInitialValue(){return this._initialValue.getValue().getHSV(Gu)},getInitialDestination(){return this._initialDestination.getValue().getHSV(Hu)},setValue(e){this._value_changed.setHSV(e.x,e.y,e.z)},interpolate:(e,t,i)=>Wn.A.lerp(e,t,i,Yu),step(e,t,i){$u.assign(this.output).add(e).subtract(t),Wn.A.lerp(this.output,$u,i,this.output)}}),Object.defineProperties(qu,{...Je.A.getStaticProperties("ColorChaser","Followers",1,"children","3.3"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFColor),new o.A(m.A.inputOnly,"set_destination",new c.A.SFColor),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFColor)]),enumerable:!0}});const Wu=qu,Ku=s.A.add("ColorChaser",Wu);function Zu(e){Tn.call(this,e),this.addType(m.A.X3DDamperNode)}Object.assign(Object.setPrototypeOf(Zu.prototype,Tn.prototype),{initialize(){Tn.prototype.initialize.call(this),this._order.addInterest("set_order__",this),this._set_value.addInterest("set_value__",this),this._set_destination.addInterest("set_destination__",this);const e=this.getBuffer(),t=this.getInitialValue(),i=this.getInitialDestination();e[0]=this.duplicate(i);for(let i=1,n=this.getOrder()+1;i<n;++i)e[i]=this.duplicate(t);this.equals(i,t,this.getTolerance())?this.setValue(i):this.set_active__(!0)},getOrder(){return W.A.clamp(this._order.getValue(),0,5)},getTolerance(){return this._tolerance.getValue()<0?1e-4:this._tolerance.getValue()},prepareEvents(){const e=this.getBuffer();let t=e.length-1;if(this._tau.getValue()){const i=1/this.getBrowser().currentFrameRate,n=Math.exp(-i/this._tau.getValue());for(let i=0;i<t;++i)this.assign(e,i+1,this.interpolate(e[i],e[i+1],n));if(this.setValue(e[t]),!this.equals(e[t],e[0],this.getTolerance()))return}else this.setValue(e[0]),t=0;for(let i=1,n=e.length;i<n;++i)this.assign(e,i,e[t]);this.set_active__(!1)},set_value__(){const e=this.getBuffer(),t=this.getValue();for(let i=1,n=e.length;i<n;++i)this.assign(e,i,t);this.setValue(t),this.set_active__(!0)},set_destination__(){this.assign(this.getBuffer(),0,this.getDestination()),this.set_active__(!0)},set_order__(){const e=this.getBuffer(),t=e[e.length-1];for(let i=e.length,n=this.getOrder()+1;i<n;++i)e[i]=this.duplicate(t);e.length=length}}),Object.defineProperties(Zu,Je.A.getStaticProperties("X3DDamperNode","Followers",1));const Qu=Zu,Ju=s.A.add("X3DDamperNode",Qu),ed=new Ee.A,td=new Ee.A,id=new Ee.A,nd=new Ee.A;function sd(e){Ju.call(this,e),this.addType(m.A.ColorDamper)}Object.assign(Object.setPrototypeOf(sd.prototype,Ju.prototype),{getVector:()=>new Ee.A,getValue(){return this._set_value.getValue().getHSV(nd)},getDestination(){return this._set_destination.getValue().getHSV(nd)},getInitialValue(){return this._initialValue.getValue().getHSV(td)},getInitialDestination(){return this._initialDestination.getValue().getHSV(id)},setValue(e){this._value_changed.setHSV(e.x,e.y,e.z)},equals:(e,t,i)=>ed.assign(e).subtract(t).norm()<i,interpolate:(e,t,i)=>Wn.A.lerp(e,t,i,nd)}),Object.defineProperties(sd,{...Je.A.getStaticProperties("ColorDamper","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFColor),new o.A(m.A.inputOnly,"set_destination",new c.A.SFColor),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFColor)]),enumerable:!0}});const rd=sd,od=s.A.add("ColorDamper",rd);const ad=function(e){function t(){this.array=this.getArray(),this.zero=this.getVector()}return Object.assign(t.prototype,{getArray(){const e=[];return e.assign=function(e){const t=Math.min(this.length,e.length),i=e.length;if(Array.isArray(e)){for(let i=0;i<t;++i)this[i].assign(e[i]);for(let n=t;n<i;++n)this[n]=e[n].copy();this.length=i}else{for(let i=0;i<t;++i)this[i].assign(e[i].getValue());for(let n=t;n<i;++n)this[n]=e[n].getValue().copy();this.length=i}},e},getValue(){return this._set_value},getDestination(){return this._set_destination},getInitialValue(){return this._initialValue},getInitialDestination(){return this._initialDestination},setValue(e){if(Array.isArray(e)){const t=this._value_changed,i=e.length;for(let n=0;n<i;++n)t[n]=e[n];t.length=i}else this._value_changed=e},duplicate(e){const t=this.getArray();return t.assign(e),t},equals(e,t,i){if(e.length!==t.length)return!1;const n=this.a;let s=0;for(let i=0,r=e.length;i<r;++i)s=Math.max(n.assign(e[i]).subtract(t[i]).norm(),s);return s<i},interpolate(e,t,i){const n=this.array;n.assign(e);for(let e=0,s=n.length;e<s;++e)n[e].lerp(t[e]||this.zero,i);return n},set_destination__(){const t=this.getBuffer(),i=this._set_destination.length;for(let e=0,n=t.length;e<n;++e){const n=t[e];for(let e=n.length;e<i;++e)n[e]=this.getVector();n.length=i}e.prototype.set_destination__.call(this)}}),t},ld=s.A.add("X3DArrayFollowerTemplate",ad);const hd=function(e){const t=ld(e);function i(){t.call(this),this.array=this.getArray()}return Object.assign(i.prototype,t.prototype,{step(e,t,i){const n=this.output,s=this.deltaOut;for(let r=0,o=n.length;r<o;++r)n[r].add(s.assign(e[r]||this.zero).subtract(t[r]||this.zero).multiply(i))}}),i},cd=s.A.add("X3DArrayChaserTemplate",hd),ud=cd(En);function dd(e){En.call(this,e),ud.call(this,e),this.addType(m.A.CoordinateChaser)}Object.assign(Object.setPrototypeOf(dd.prototype,En.prototype),ud.prototype,{getVector:()=>new Ee.A}),Object.defineProperties(dd,{...Je.A.getStaticProperties("CoordinateChaser","Followers",1,"children","3.3"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.MFVec3f),new o.A(m.A.inputOnly,"set_destination",new c.A.MFVec3f),new o.A(m.A.initializeOnly,"initialValue",new c.A.MFVec3f(new Ee.A)),new o.A(m.A.initializeOnly,"initialDestination",new c.A.MFVec3f(new Ee.A)),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec3f)]),enumerable:!0}});const pd=dd,gd=s.A.add("CoordinateChaser",pd),fd=ld(Ju);function md(e){Ju.call(this,e),fd.call(this,e),this.addType(m.A.CoordinateDamper)}Object.assign(Object.setPrototypeOf(md.prototype,Ju.prototype),fd.prototype,{getVector:()=>new Ee.A}),Object.defineProperties(md,{...Je.A.getStaticProperties("CoordinateDamper","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.MFVec3f),new o.A(m.A.inputOnly,"set_destination",new c.A.MFVec3f),new o.A(m.A.initializeOnly,"initialValue",new c.A.MFVec3f(new Ee.A)),new o.A(m.A.initializeOnly,"initialDestination",new c.A.MFVec3f(new Ee.A)),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec3f)]),enumerable:!0}});const Ad=md,_d=s.A.add("CoordinateDamper",Ad),yd=new Fn.A,wd=new Fn.A;function xd(e){Ju.call(this,e),this.addType(m.A.OrientationDamper),this._set_value.setUnit("angle"),this._set_destination.setUnit("angle"),this._initialValue.setUnit("angle"),this._initialDestination.setUnit("angle"),this._value_changed.setUnit("angle")}Object.assign(Object.setPrototypeOf(xd.prototype,Ju.prototype),{getVector:()=>new Fn.A,equals:(e,t,i)=>(yd.assign(e).inverse().multRight(t),Math.abs(yd.angle)<i),interpolate:(e,t,i)=>wd.assign(e).slerp(t,i)}),Object.defineProperties(xd,{...Je.A.getStaticProperties("OrientationDamper","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFRotation),new o.A(m.A.inputOnly,"set_destination",new c.A.SFRotation),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFRotation(0,1,0,0)),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFRotation(0,1,0,0)),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFRotation)]),enumerable:!0}});const bd=xd,Sd=s.A.add("OrientationDamper",bd);function Td(e){En.call(this,e),this.addType(m.A.PositionChaser2D)}Object.assign(Object.setPrototypeOf(Td.prototype,En.prototype),{getVector:()=>new It.A}),Object.defineProperties(Td,{...Je.A.getStaticProperties("PositionChaser2D","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFVec2f),new o.A(m.A.inputOnly,"set_destination",new c.A.SFVec2f),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFVec2f),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFVec2f),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec2f)]),enumerable:!0}});const vd=Td,Od=s.A.add("PositionChaser2D",vd);function Ed(e){Ju.call(this,e),this.addType(m.A.PositionDamper)}Object.assign(Object.setPrototypeOf(Ed.prototype,Ju.prototype),{getVector:()=>new Ee.A}),Object.defineProperties(Ed,{...Je.A.getStaticProperties("PositionDamper","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFVec3f),new o.A(m.A.inputOnly,"set_destination",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool)]),enumerable:!0}});const Nd=Ed,Cd=s.A.add("PositionDamper",Nd);function Id(e){Ju.call(this,e),this.addType(m.A.PositionDamper2D)}Object.assign(Object.setPrototypeOf(Id.prototype,Ju.prototype),{getVector:()=>new It.A}),Object.defineProperties(Id,{...Je.A.getStaticProperties("PositionDamper2D","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFVec2f),new o.A(m.A.inputOnly,"set_destination",new c.A.SFVec2f),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFVec2f),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFVec2f),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec2f)]),enumerable:!0}});const Fd=Id,Md=s.A.add("PositionDamper2D",Fd);function Rd(e){En.call(this,e),this.addType(m.A.ScalarChaser)}Object.assign(Object.setPrototypeOf(Rd.prototype,En.prototype),{getVector:()=>0,setPreviousValue(e){this.previousValue=e},setDestination(e){this.destination=e},duplicate:e=>e,assign(e,t,i){e[t]=i},equals:(e,t,i)=>Math.abs(e-t)<i,interpolate:(e,t,i)=>W.A.lerp(e,t,i),step(e,t,i){this.output+=(e-t)*i}}),Object.defineProperties(Rd,{...Je.A.getStaticProperties("ScalarChaser","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFFloat),new o.A(m.A.inputOnly,"set_destination",new c.A.SFFloat),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFFloat),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFFloat),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFFloat)]),enumerable:!0}});const Pd=Rd,Vd=s.A.add("ScalarChaser",Pd);function Dd(e){Ju.call(this,e),this.addType(m.A.ScalarDamper)}Object.assign(Object.setPrototypeOf(Dd.prototype,Ju.prototype),{getVector:()=>0,duplicate:e=>e,assign(e,t,i){e[t]=i},equals:(e,t,i)=>Math.abs(e-t)<i,interpolate:(e,t,i)=>W.A.lerp(e,t,i)}),Object.defineProperties(Dd,{...Je.A.getStaticProperties("ScalarDamper","Followers",1,"children","3.3"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.SFFloat),new o.A(m.A.inputOnly,"set_destination",new c.A.SFFloat),new o.A(m.A.initializeOnly,"initialValue",new c.A.SFFloat),new o.A(m.A.initializeOnly,"initialDestination",new c.A.SFFloat),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFFloat)]),enumerable:!0}});const Ld=Dd,Bd=s.A.add("ScalarDamper",Ld),kd=cd(En);function jd(e){En.call(this,e),kd.call(this,e),this.addType(m.A.TexCoordChaser2D)}Object.assign(Object.setPrototypeOf(jd.prototype,En.prototype),kd.prototype,{getVector:()=>new It.A}),Object.defineProperties(jd,{...Je.A.getStaticProperties("TexCoordChaser2D","Followers",1,"children","3.3"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.MFVec2f),new o.A(m.A.inputOnly,"set_destination",new c.A.MFVec2f),new o.A(m.A.initializeOnly,"initialValue",new c.A.MFVec2f),new o.A(m.A.initializeOnly,"initialDestination",new c.A.MFVec2f),new o.A(m.A.initializeOnly,"duration",new c.A.SFTime(1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec2f)]),enumerable:!0}});const Ud=jd,Xd=s.A.add("TexCoordChaser2D",Ud),zd=ld(Ju);function Gd(e){Ju.call(this,e),zd.call(this,e),this.addType(m.A.TexCoordDamper2D)}Object.assign(Object.setPrototypeOf(Gd.prototype,Ju.prototype),zd.prototype,{getVector:()=>new It.A}),Object.defineProperties(Gd,{...Je.A.getStaticProperties("TexCoordDamper2D","Followers",1,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_value",new c.A.MFVec2f),new o.A(m.A.inputOnly,"set_destination",new c.A.MFVec2f),new o.A(m.A.initializeOnly,"initialValue",new c.A.MFVec2f),new o.A(m.A.initializeOnly,"initialDestination",new c.A.MFVec2f),new o.A(m.A.initializeOnly,"order",new c.A.SFInt32(3)),new o.A(m.A.inputOutput,"tau",new c.A.SFTime(.3)),new o.A(m.A.inputOutput,"tolerance",new c.A.SFFloat(-1)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec2f)]),enumerable:!0}});const Hd=Gd,$d=s.A.add("TexCoordDamper2D",Hd),Yd={name:"Followers",concreteNodes:[Ku,od,gd,_d,Dn,Sd,In,Od,Cd,Md,Vd,Bd,Xd,$d],abstractNodes:[En,Ju,Tn]},qd=s.A.add("FollowersComponent",Yd);function Wd(e){at.A.call(this,e),this.addType(m.A.Box),this._size.setUnit("length")}Object.assign(Object.setPrototypeOf(Wd.prototype,at.A.prototype),{build:(()=>{const e=new Ee.A(2);return function(){const t=this.getBrowser().getBoxOptions().getGeometry(),i=this._size.getValue(),n=this.getVertices();if(this.getMultiTexCoords().push(...t.getMultiTexCoords()),this.getTangents().assign(t.getTangents()),this.getNormals().assign(t.getNormals()),i.equals(e))n.assign(t.getVertices()),this.getMin().assign(t.getMin()),this.getMax().assign(t.getMax());else{const e=Math.abs(i.x/2),s=Math.abs(i.y/2),r=Math.abs(i.z/2),o=t.getVertices();for(let t=0,i=o.length;t<i;t+=4)n.push(e*o[t],s*o[t+1],r*o[t+2],1);this.getMin().set(-e,-s,-r),this.getMax().set(e,s,r)}this.setSolid(this._solid.getValue())}})()}),Object.defineProperties(Wd,{...Je.A.getStaticProperties("Box","Geometry3D",1,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"size",new c.A.SFVec3f(2,2,2)),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0))]),enumerable:!0}});const Kd=Wd,Zd=s.A.add("Box",Kd);function Qd(e){at.A.call(this,e),this.addType(m.A.Cone),this._height.setUnit("length"),this._bottomRadius.setUnit("length")}Object.assign(Object.setPrototypeOf(Qd.prototype,at.A.prototype),{set_live__(){this.connectOptions(this.getBrowser().getConeOptions())},build(){const e=this.getBrowser().getConeOptions(),t=Math.abs(this._height.getValue()),i=t/2,n=Math.abs(this._bottomRadius.getValue()),s=this.getTexCoords(),r=this.getNormals(),o=this.getVertices();if(this.getMultiTexCoords().push(s),this._side.getValue()){const a=e.getSideGeometry(),l=a.getNormals(),h=a.getVertices(),c=new Ee.A,u=new Fn.A(1,0,0,-Math.atan(n/t)),d=new Fn.A;for(const e of a.getMultiTexCoords()[0])s.push(e);for(let e=0,t=l.length;e<t;e+=3)c.set(l[e],0,l[e+2]),d.setFromToVec(Ee.A.Z_AXIS,c).multLeft(u).multVecRot(c.set(0,0,1)),r.push(...c);for(let e=0,t=h.length;e<t;e+=4)o.push(n*h[e],i*h[e+1],n*h[e+2],1)}if(this._bottom.getValue()){const t=e.getBottomGeometry(),a=t.getVertices();for(const e of t.getMultiTexCoords()[0])s.push(e);for(const e of t.getNormals())r.push(e);for(let e=0,t=a.length;e<t;e+=4)o.push(n*a[e],i*a[e+1],n*a[e+2],1)}this.setSolid(this._solid.getValue()),this.setExtents()},setExtents(){const e=this._bottomRadius.getValue(),t=this._height.getValue()/2,i=-t;this._side.getValue()||this._bottom.getValue()?this._side.getValue()?(this.getMin().set(-e,i,-e),this.getMax().set(e,t,e)):(this.getMin().set(-e,i,-e),this.getMax().set(e,i,e)):(this.getMin().set(0),this.getMax().set(0))}}),Object.defineProperties(Qd,{...Je.A.getStaticProperties("Cone","Geometry3D",1,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"side",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bottom",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"height",new c.A.SFFloat(2)),new o.A(m.A.initializeOnly,"bottomRadius",new c.A.SFFloat(1)),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0))]),enumerable:!0}});const Jd=Qd,ep=s.A.add("Cone",Jd);function tp(e){at.A.call(this,e),this.addType(m.A.Cylinder),this._height.setUnit("length"),this._radius.setUnit("length")}Object.assign(Object.setPrototypeOf(tp.prototype,at.A.prototype),{set_live__(){this.connectOptions(this.getBrowser().getCylinderOptions())},build(){const e=this.getBrowser().getCylinderOptions(),t=Math.abs(this._height.getValue())/2,i=Math.abs(this._radius.getValue()),n=this.getTexCoords(),s=this.getTangents(),r=this.getNormals(),o=this.getVertices();if(this.getMultiTexCoords().push(n),this._side.getValue()){const a=e.getSideGeometry(),l=a.getVertices();for(const e of a.getMultiTexCoords()[0])n.push(e);for(const e of a.getTangents())s.push(e);for(const e of a.getNormals())r.push(e);for(let e=0,n=l.length;e<n;e+=4)o.push(i*l[e],t*l[e+1],i*l[e+2],1)}if(this._top.getValue()){const a=e.getTopGeometry(),l=a.getVertices();for(const e of a.getMultiTexCoords()[0])n.push(e);for(const e of a.getTangents())s.push(e);for(const e of a.getNormals())r.push(e);for(let e=0,n=l.length;e<n;e+=4)o.push(i*l[e],t*l[e+1],i*l[e+2],1)}if(this._bottom.getValue()){const a=e.getBottomGeometry(),l=a.getVertices();for(const e of a.getMultiTexCoords()[0])n.push(e);for(const e of a.getTangents())s.push(e);for(const e of a.getNormals())r.push(e);for(let e=0,n=l.length;e<n;e+=4)o.push(i*l[e],t*l[e+1],i*l[e+2],1)}this.setSolid(this._solid.getValue()),this.setExtents()},setExtents(){const e=this._radius.getValue(),t=this._height.getValue()/2,i=-t;this._top.getValue()||this._side.getValue()||this._bottom.getValue()?this._top.getValue()||this._side.getValue()?this._bottom.getValue()||this._side.getValue()?(this.getMin().set(-e,i,-e),this.getMax().set(e,t,e)):(this.getMin().set(-e,t,-e),this.getMax().set(e,t,e)):(this.getMin().set(-e,i,-e),this.getMax().set(e,i,e)):(this.getMin().set(0),this.getMax().set(0))}}),Object.defineProperties(tp,{...Je.A.getStaticProperties("Cylinder","Geometry3D",1,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"top",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"side",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bottom",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"height",new c.A.SFFloat(2)),new o.A(m.A.initializeOnly,"radius",new c.A.SFFloat(1)),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0))]),enumerable:!0}});const ip=tp,np=s.A.add("Cylinder",ip);function sp(e){at.A.call(this,e),this.addType(m.A.ElevationGrid),this._set_height.setUnit("length"),this._xSpacing.setUnit("length"),this._zSpacing.setUnit("length"),this._creaseAngle.setUnit("angle"),this._height.setUnit("length")}Object.assign(Object.setPrototypeOf(sp.prototype,at.A.prototype),{initialize(){at.A.prototype.initialize.call(this),this._set_height.addFieldInterest(this._height),this._attrib.addInterest("set_attrib__",this),this._fogCoord.addInterest("set_fogCoord__",this),this._color.addInterest("set_color__",this),this._texCoord.addInterest("set_texCoord__",this),this._tangent.addInterest("set_tangent__",this),this._normal.addInterest("set_normal__",this),this.set_attrib__(),this.set_fogCoord__(),this.set_color__(),this.set_texCoord__(),this.set_tangent__(),this.set_normal__()},getHeight(e){return e<this._height.length?this._height[e]:0},createTexCoords(){const e=[],t=this._xDimension.getValue(),i=this._zDimension.getValue(),n=t-1,s=i-1;for(let r=0;r<i;++r)for(let i=0;i<t;++i)e.push(new It.A(i/n,r/s));return e},createNormals(e,t,i){const n=!this._ccw.getValue(),s=new Map,r=[];for(let t=0,i=e.length;t<i;++t)s.set(t,[]);for(let i=0,o=t.length;i<o;i+=3){const o=t[i],a=t[i+1],l=t[i+2];s.get(o).push(r.length),s.get(a).push(r.length+1),s.get(l).push(r.length+2);const h=ut.A.normal(e[o],e[a],e[l],new Ee.A);n&&h.negate(),r.push(h),r.push(h),r.push(h)}return this._normalPerVertex.getValue()?this.refineNormals(s,r,i??this._creaseAngle.getValue()):r},createCoordIndex(){const e=[],t=this._xDimension.getValue(),i=t-1,n=this._zDimension.getValue()-1;for(let s=0;s<n;++s)for(let n=0;n<i;++n){const i=s*t+n,r=(s+1)*t+n,o=(s+1)*t+(n+1),a=s*t+(n+1);e.push(i),e.push(r),e.push(o),e.push(i),e.push(o),e.push(a)}return e},createPoints(){const e=[],t=this._xDimension.getValue(),i=this._zDimension.getValue(),n=this._xSpacing.getValue(),s=this._zSpacing.getValue();for(let r=0;r<i;++r)for(let i=0;i<t;++i)e.push(new Ee.A(n*i,this.getHeight(i+r*t),s*r));return e},build(){if(this._xDimension.getValue()<2||this._zDimension.getValue()<2)return;const e=this._colorPerVertex.getValue(),t=this._normalPerVertex.getValue(),i=this.createCoordIndex(),n=this.getCoordIndices(),s=this.getAttrib(),r=s.length,o=this.getAttribs(),a=this.getFogCoord(),l=this.getColor(),h=this.getTexCoord(),c=this.getTangent(),u=this.getNormal(),d=this.createPoints(),p=this.getFogDepths(),g=this.getColors(),f=this.getMultiTexCoords(),m=this.getTangents(),A=this.getNormals(),_=this.getVertices(),y=i.length;let w,x;h?h.init(f):(w=this.createTexCoords(),x=this.getTexCoords(),f.push(x));let b=0;for(let S=0;S<y;++b)for(let y=0;y<6;++y,++S){const y=i[S],{x:T,y:v,z:O}=d[y];n.push(y);for(let e=0;e<r;++e)s[e].addValue(y,o[e]);if(a?.addDepth(y,p),l?.addColor(e?y:b,g),h)h.addPoint(y,f);else{const{x:e,y:t}=w[y];x.push(e,t,0,1)}c?.addVector(t?y:b,m),u?.addVector(t?y:b,A),_.push(T,v,O,1)}if(!u){const e=this.createNormals(d,i);for(const{x:t,y:i,z:n}of e)A.push(t,i,n)}this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())}}),Object.defineProperties(sp,{...Je.A.getStaticProperties("ElevationGrid","Geometry3D",3,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_height",new c.A.MFFloat),new o.A(m.A.initializeOnly,"xDimension",new c.A.SFInt32),new o.A(m.A.initializeOnly,"zDimension",new c.A.SFInt32),new o.A(m.A.initializeOnly,"xSpacing",new c.A.SFFloat(1)),new o.A(m.A.initializeOnly,"zSpacing",new c.A.SFFloat(1)),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"creaseAngle",new c.A.SFFloat),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.initializeOnly,"height",new c.A.MFFloat)]),enumerable:!0}});const rp=sp,op=s.A.add("ElevationGrid",rp);function ap(e){at.A.call(this,e),this.addType(m.A.Extrusion),this._creaseAngle.setUnit("angle"),this._crossSection.setUnit("length"),this._spine.setUnit("length")}Object.assign(Object.setPrototypeOf(ap.prototype,at.A.prototype),{initialize(){at.A.prototype.initialize.call(this),this._set_crossSection.addFieldInterest(this._crossSection),this._set_orientation.addFieldInterest(this._orientation),this._set_scale.addFieldInterest(this._scale),this._set_spine.addFieldInterest(this._spine)},getClosed(e){if(!e.length)return!0;const t=e.at(0).getValue(),i=e.at(-1).getValue();return t.equals(i)},createPoints:(()=>{const e=new Ee.A(1);return function(){const t=this._crossSection,i=this._orientation,n=this._scale,s=this._spine,r=t.length,o=i.length,a=n.length,l=s.length,h=[],c=this.createRotations();for(let s=0;s<l;++s){const l=c[s];if(o&&l.rotate(i[Math.min(s,o-1)].getValue()),a){const t=n[Math.min(s,a-1)].getValue();l.scale(e.set(t.x,1,t.y))}for(let e=0;e<r;++e){const i=t[e].getValue();h.push(l.multVecMatrix(new Ee.A(i.x,0,i.y)))}}return h}})(),createRotations:(()=>{const e=[],t=new Ee.A,i=new Ee.A,n=new Ee.A,s=new Ee.A,r=new Ee.A,o=new Ee.A,a=new Fn.A;return function(){const l=this._spine,h=l.length,c=this.getClosed(l);for(let t=e.length;t<h;++t)e[t]=new Si.A;if(e.length=h,t.set(0),i.set(0),n.set(0),c){const e=l.at(0).getValue();for(let t=1,n=h-2;t<n&&(i.assign(l[t].getValue()).subtract(e).normalize().subtract(o.assign(l[n].getValue()).subtract(e).normalize()).normalize(),i.equals(Ee.A.ZERO));++t);for(let e=0,t=h-2;e<t&&(n.assign(l[e+1].getValue()).subtract(l[e].getValue()).cross(o.assign(l[t].getValue()).subtract(l[e].getValue())).normalize(),n.equals(Ee.A.ZERO));++e);}else{for(let e=0,t=h-1;e<t&&(i.assign(l[e+1].getValue()).subtract(l[e].getValue()).normalize(),i.equals(Ee.A.ZERO));++e);for(let e=1,t=h-1;e<t&&(n.assign(l[e+1].getValue()).subtract(l[e].getValue()).cross(o.assign(l[e-1].getValue()).subtract(l[e].getValue())).normalize(),n.equals(Ee.A.ZERO));++e);}i.equals(Ee.A.ZERO)&&i.set(0,1,0),n.equals(Ee.A.ZERO)&&a.setFromToVec(Ee.A.Y_AXIS,i).multVecRot(n.assign(Ee.A.Z_AXIS)),t.assign(i).cross(n);const u=l.at(0).getValue();e[0].set(...t,0,...i,0,...n,0,...u,1),s.assign(i),r.assign(n);for(let a=1,c=h-1;a<c;++a){const h=l[a].getValue();i.assign(l[a+1].getValue()).subtract(h).normalize().subtract(o.assign(l[a-1].getValue()).subtract(h).normalize()).normalize(),n.assign(l[a+1].getValue()).subtract(h).cross(o.assign(l[a-1].getValue()).subtract(h)).normalize(),s.dot(i)<0&&i.negate(),r.dot(n)<0&&n.negate(),i.equals(Ee.A.ZERO)?i.assign(s):s.assign(i),n.equals(Ee.A.ZERO)?n.assign(r):r.assign(n),t.assign(i).cross(n),e[a].set(...t,0,...i,0,...n,0,...h,1)}if(c)e[h-1].assign(e[0]);else{const a=l.at(-1).getValue();i.assign(a).subtract(l.at(-2).getValue()).normalize(),h>2&&n.assign(a).subtract(l.at(-2).getValue()).cross(o.assign(l.at(-3).getValue()).subtract(l.at(-2).getValue())).normalize(),s.dot(i)<0&&i.negate(),r.dot(n)<0&&n.negate(),i.equals(Ee.A.ZERO)&&i.assign(s),n.equals(Ee.A.ZERO)&&n.assign(r),t.assign(i).cross(n),e[h-1].set(...t,0,...i,0,...n,0,...a,1)}return e}})(),build:(()=>{const e=new It.A,t=new It.A,i=new It.A;return function(){const n=!this._ccw.getValue(),s=this._crossSection,r=this._spine,o=s.length,a=r.length,l=this.getCoordIndices(),h=this.getTexCoords();if(a<2||o<2)return;this.getMultiTexCoords().push(h);const c=(e,t)=>e*o+t,u=this.getClosed(r)&&this.getClosed(this._orientation)&&this.getClosed(this._scale),d=this.getClosed(s);e.assign(s[0].getValue()),t.assign(s[0].getValue());for(let i=1;i<o;++i)e.min(s[i].getValue()),t.max(s[i].getValue());const p=i.assign(t).subtract(e),g=Math.max(p.x,p.y),f=d?o-1:o,m=new Map,A=[],_=this.createPoints(),y=_.length;for(let e=0;e<y;++e)m.set(e,[]);const w=this.getNormals(),x=this.getVertices(),b=o-1,S=a-1;let T=c(0,0),v=c(0,d?0:b);for(let e=0;e<S;++e)for(let t=0;t<b;++t){const i=u&&e===a-2?0:e+1,s=d&&t===o-2?0:t+1;let r=c(e,t),p=c(e,s),g=c(i,s),f=c(i,t),y=_[r],w=_[p],O=_[g],E=_[f],N=w.distance(O)>=1e-7,C=E.distance(y)>=1e-7;const I=ut.A.normal(y,w,O,new Ee.A),F=ut.A.normal(y,O,E,new Ee.A);if(n&&(I.negate(),F.negate()),0===t&&(C?T=r:(r=T,y=_[r])),t===o-2&&(N?v=p:(g=v,O=_[g])),N){if(l.push(r,p,g),C)h.push(t/b,e/S,0,1);else{const i=(e/S+(e+1)/S)/2;h.push(t/b,i,0,1)}m.get(r).push(A.length),A.push(I),x.push(...y,1),h.push((t+1)/b,e/S,0,1),m.get(p).push(A.length),A.push(I),x.push(...w,1),h.push((t+1)/b,(e+1)/S,0,1),m.get(g).push(A.length),A.push(I),x.push(...O,1)}if(C){if(l.push(r,g,f),h.push(t/b,e/S,0,1),m.get(r).push(A.length),A.push(F),x.push(...y,1),N)h.push((t+1)/b,(e+1)/S,0,1);else{const i=((e+1)/S+e/S)/2;h.push((t+1)/b,i,0,1)}m.get(g).push(A.length),A.push(F),x.push(...O,1),h.push(t/b,(e+1)/S,0,1),m.get(f).push(A.length),A.push(F),x.push(...E,1)}}const O=this.refineNormals(m,A,this._creaseAngle.getValue());for(const{x:e,y:t,z:i}of O)w.push(e,t,i);if(g&&f>2){if(this._beginCap.getValue()){const t=0,i=this._convex.getValue(),r={},o=[],a=[];for(let n=0;n<f;++n){const a=c(t,f-1-n),l=_[a].copy();l.index=a,r[a]=s[f-1-n].getValue().copy().subtract(e).divide(g),o.push(i?a:l)}if(i?ut.A.triangulateConvexPolygon(o,a):ut.A.triangulatePolygon(o,a),a.length>=3){const e=ut.A.normal(_[a[0]],_[a[1]],_[a[2]],new Ee.A);n&&e.negate(),this.addCap(h,r,e,_,a)}}if(this._endCap.getValue()){const t=a-1,i=this._convex.getValue(),r={},o=[],l=[];for(let n=0;n<f;++n){const a=c(t,n),l=_[a].copy();l.index=a,r[a]=s[n].getValue().copy().subtract(e).divide(g),o.push(i?a:l)}if(i?ut.A.triangulateConvexPolygon(o,l):ut.A.triangulatePolygon(o,l),l.length>=3){const e=ut.A.normal(_[l[0]],_[l[1]],_[l[2]],new Ee.A);n&&e.negate(),this.addCap(h,r,e,_,l)}}}this.setSolid(this._solid.getValue()),this.setCCW(this._ccw.getValue())}})(),addCap(e,t,i,n,s){const r=this.getCoordIndices(),o=this.getNormals(),a=this.getVertices(),l=s.length;for(let h=0;h<l;h+=3){const l=s[h],c=s[h+1],u=s[h+2],d=n[l],p=n[c],g=n[u],f=t[l],m=t[c],A=t[u];r.push(l,c,u),e.push(...f,0,1,...m,0,1,...A,0,1),o.push(...i,...i,...i),a.push(...d,1,...p,1,...g,1)}}}),Object.defineProperties(ap,{...Je.A.getStaticProperties("Extrusion","Geometry3D",4,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_crossSection",new c.A.MFVec2f),new o.A(m.A.inputOnly,"set_orientation",new c.A.MFRotation),new o.A(m.A.inputOnly,"set_scale",new c.A.MFVec2f),new o.A(m.A.inputOnly,"set_spine",new c.A.MFVec3f),new o.A(m.A.initializeOnly,"beginCap",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"endCap",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"convex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"creaseAngle",new c.A.SFFloat),new o.A(m.A.initializeOnly,"crossSection",new c.A.MFVec2f(new It.A(1),new It.A(1,-1),new It.A(-1,-1),new It.A(-1,1),new It.A(1))),new o.A(m.A.initializeOnly,"orientation",new c.A.MFRotation(new Fn.A)),new o.A(m.A.initializeOnly,"scale",new c.A.MFVec2f(new It.A(1))),new o.A(m.A.initializeOnly,"spine",new c.A.MFVec3f(new Ee.A,new Ee.A(0,1,0)))]),enumerable:!0}});const lp=ap,hp=s.A.add("Extrusion",lp);function cp(e){at.A.call(this,e),this.addType(m.A.Sphere),this._radius.setUnit("length")}Object.assign(Object.setPrototypeOf(cp.prototype,at.A.prototype),{set_live__(){this.connectOptions(this.getBrowser().getSphereOptions())},build(){const e=this.getBrowser().getSphereOptions().getGeometry(),t=Math.abs(this._radius.getValue()),i=this.getVertices();if(this.getMultiTexCoords().push(...e.getMultiTexCoords()),this.getTangents().assign(e.getTangents()),this.getNormals().assign(e.getNormals()),1===t)i.assign(e.getVertices());else{const n=e.getVertices();for(let e=0,s=n.length;e<s;e+=4)i.push(t*n[e],t*n[e+1],t*n[e+2],1)}this.getMin().set(-t,-t,-t),this.getMax().set(t,t,t),this.setSolid(this._solid.getValue())}}),Object.defineProperties(cp,{...Je.A.getStaticProperties("Sphere","Geometry3D",1,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"radius",new c.A.SFFloat(1)),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0))]),enumerable:!0}});const up=cp,dp=s.A.add("Sphere",up),pp={name:"Geometry3D",concreteNodes:[Zd,ep,np,op,hp,gt,dp],abstractNodes:[]},gp=s.A.add("Geometry3DComponent",pp);var fp=n(8219);function mp(e){ji.A.call(this,e),this.addType(m.A.X3DTransformMatrix3DNode),this.matrix=new Si.A}Object.assign(Object.setPrototypeOf(mp.prototype,ji.A.prototype),{getBBox(e,t){return this.isDefaultBBoxSize()?this.getSubBBox(e,t).multRight(this.matrix):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getShapes(e,t){const i=t.copy().multLeft(this.matrix);return ji.A.prototype.getShapes.call(this,e,i)},getMatrix(){return this.matrix},setMatrix(e){e.equals(Si.A.IDENTITY)?(this.matrix.identity(),this.isDefaultBBoxSize()?this.getBBox=this.getSubBBox:delete this.getBBox,this.traverse=this.groupTraverse):(this.matrix.assign(e),delete this.getBBox,delete this.traverse)},setTransform(e,t,i,n,s){e.equals(Ee.A.ZERO)&&t.equals(Fn.A.IDENTITY)&&i.equals(Ee.A.ONE)?(this.matrix.identity(),this.isDefaultBBoxSize()?this.getBBox=this.getSubBBox:delete this.getBBox,this.traverse=this.groupTraverse):(this.matrix.set(e,t,i,n,s),delete this.getBBox,delete this.traverse)},traverse(e,t){const i=t.getModelViewMatrix();i.push(),i.multLeft(this.matrix),ji.A.prototype.traverse.call(this,e,t),i.pop()},groupTraverse:ji.A.prototype.traverse}),Object.defineProperties(mp,Je.A.getStaticProperties("X3DTransformMatrix3DNode","Grouping",1));const Ap=mp,_p=s.A.add("X3DTransformMatrix3DNode",Ap);function yp(e){_p.call(this,e),this.addType(m.A.X3DTransformNode),this._translation.setUnit("length"),this._center.setUnit("length")}Object.assign(Object.setPrototypeOf(yp.prototype,_p.prototype),{initialize(){_p.prototype.initialize.call(this),this.addInterest("eventsProcessed",this),this.eventsProcessed()},eventsProcessed(){this.setTransform(this._translation.getValue(),this._rotation.getValue(),this._scale.getValue(),this._scaleOrientation.getValue(),this._center.getValue())}}),Object.defineProperties(yp,Je.A.getStaticProperties("X3DTransformNode","Grouping",1));const wp=yp,xp=s.A.add("X3DTransformNode",wp);function bp(e){xp.call(this,e),this.addType(m.A.Transform)}Object.setPrototypeOf(bp.prototype,xp.prototype),Object.defineProperties(bp,{...Je.A.getStaticProperties("Transform","Grouping",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"translation",new c.A.SFVec3f),new o.A(m.A.inputOutput,"rotation",new c.A.SFRotation),new o.A(m.A.inputOutput,"scale",new c.A.SFVec3f(1,1,1)),new o.A(m.A.inputOutput,"scaleOrientation",new c.A.SFRotation),new o.A(m.A.inputOutput,"center",new c.A.SFVec3f),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const Sp=bp,Tp=s.A.add("Transform",Sp);function vp(e){at.A.call(this,e),this.setGeometryType(0),this.setSolid(!1)}Object.assign(Object.setPrototypeOf(vp.prototype,at.A.prototype),{intersectsLine:()=>!1,generateTexCoords(){},displaySimple(e,t,i){this.vertexArrayObject.enable(i.getProgram())&&(this.coordIndices.length&&i.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0),this.multiTexCoords.length&&i.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),this.hasNormals&&i.enableNormalAttribute(e,this.normalBuffer,0,0),i.enableVertexAttribute(e,this.vertexBuffer,0,0)),e.drawArrays(e.POINTS,0,this.vertexCount)},display(e,t){const{viewport:i,appearanceNode:n,transparent:s}=t,r=this.getBrowser(),o=n.getShader(this,t),a=n.getRenderModes();s||(e.enable(e.SAMPLE_ALPHA_TO_COVERAGE),e.colorMask(!0,!0,!0,!1)),e.viewport(...i);for(const t of a)t.enable(e);if(o.enable(e),o.setUniforms(e,t,this),this.vertexArrayObject.enable(o.getProgram())){const t=this.getAttrib(),i=this.getAttribBuffers();this.coordIndices.length&&o.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0);for(let n=0,s=t.length;n<s;++n)t[n].enable(e,o,i[n]);this.hasFogCoords&&o.enableFogDepthAttribute(e,this.fogDepthBuffer,0,0),this.colorMaterial&&o.enableColorAttribute(e,this.colorBuffer,0,0),this.hasTangents&&o.enableTangentAttribute(e,this.tangentBuffer,0,0),this.hasNormals&&o.enableNormalAttribute(e,this.normalBuffer,0,0),o.enableVertexAttribute(e,this.vertexBuffer,0,0)}e.drawArrays(e.POINTS,0,this.vertexCount);for(const t of a)t.disable(e);r.resetTextureUnits(),s||(e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.colorMask(!0,!0,!0,!0))},displaySimpleInstanced(e,t,i){const n=i.getInstances();if(n.vertexArrayObject.update(this.updateInstances).enable(t.getProgram())){const{instancesStride:s,particleOffset:r,matrixOffset:o,normalMatrixOffset:a}=i;void 0!==r&&t.enableParticleAttribute(e,n,s,r,1),t.enableInstanceMatrixAttribute(e,n,s,o,1),void 0!==a&&t.enableInstanceNormalMatrixAttribute(e,n,s,a,1),this.coordIndices.length&&t.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0),t.enableTexCoordAttribute(e,this.texCoordBuffers,0,0),t.enableNormalAttribute(e,this.normalBuffer,0,0),t.enableVertexAttribute(e,this.vertexBuffer,0,0),this.updateInstances=!1}e.drawArraysInstanced(e.POINTS,0,this.vertexCount,i.getNumInstances())},displayInstanced(e,t,i){const{viewport:n,appearanceNode:s,transparent:r}=t,o=this.getBrowser(),a=s.getShader(this,t),l=s.getRenderModes();r||(e.enable(e.SAMPLE_ALPHA_TO_COVERAGE),e.colorMask(!0,!0,!0,!1)),e.viewport(...n);for(const t of l)t.enable(e);a.enable(e),a.setUniforms(e,t,this);const h=i.getInstances();if(h.vertexArrayObject.update(this.updateInstances).enable(a.getProgram())){const{instancesStride:t,particleOffset:n,velocityOffset:s,matrixOffset:r,normalMatrixOffset:o}=i,l=this.getAttrib(),c=this.getAttribBuffers();void 0!==n&&a.enableParticleAttribute(e,h,t,n,1),void 0!==s&&a.enableParticleVelocityAttribute(e,h,t,s,1),a.enableInstanceMatrixAttribute(e,h,t,r,1),void 0!==o&&a.enableInstanceNormalMatrixAttribute(e,h,t,o,1),this.coordIndices.length&&a.enableCoordIndexAttribute(e,this.coordIndexBuffer,0,0);for(let t=0,i=l.length;t<i;++t)l[t].enable(e,a,c[t]);this.hasFogCoords&&a.enableFogDepthAttribute(e,this.fogDepthBuffer,0,0),this.colorMaterial&&a.enableColorAttribute(e,this.colorBuffer,0,0),this.hasTangents&&a.enableTangentAttribute(e,this.tangentBuffer,0,0),this.hasNormals&&a.enableNormalAttribute(e,this.normalBuffer,0,0),a.enableVertexAttribute(e,this.vertexBuffer,0,0),this.updateInstances=!1}e.drawArraysInstanced(e.POINTS,0,this.vertexCount,i.getNumInstances());for(const t of l)t.disable(e);o.resetTextureUnits(),r||(e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.colorMask(!0,!0,!0,!0))}}),Object.defineProperties(vp,Je.A.getStaticProperties("X3DPointGeometryNode","Rendering",1));const Op=vp,Ep=s.A.add("X3DPointGeometryNode",Op);function Np(e){Ep.call(this,e),this.addType(m.A.PointSet)}Object.assign(Object.setPrototypeOf(Np.prototype,Ep.prototype),{initialize(){Ep.prototype.initialize.call(this),this._attrib.addInterest("set_attrib__",this),this._fogCoord.addInterest("set_fogCoord__",this),this._color.addInterest("set_color__",this),this._tangent.addInterest("set_tangent__",this),this._normal.addInterest("set_normal__",this),this._coord.addInterest("set_coord__",this),this.set_attrib__(),this.set_fogCoord__(),this.set_color__(),this.set_tangent__(),this.set_normal__(),this.set_coord__()},build(){if(!this.coordNode?.getSize())return;const e=this.getCoordIndices(),t=this.getAttrib(),i=t.length,n=this.getAttribs(),s=this.getFogCoord(),r=this.getFogDepths(),o=this.getColor(),a=this.getColors(),l=this.getTangent(),h=this.getNormal(),c=this.getCoord(),u=this.getTangents(),d=this.getNormals(),p=this.getVertices(),g=c._point.length;for(let t=0;t<g;++t)e.push(t);for(let e=0;e<i;++e)for(let i=0;i<g;++i)t[e].addValue(i,n[e]);s?.addDepths(r,g),o?.addColors(a,g),l?.addVectors(u,g),h?.addVectors(d,g),c.addPoints(p)}}),Object.defineProperties(Np,{...Je.A.getStaticProperties("PointSet","Rendering",1,"geometry","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const Cp=Np,Ip=s.A.add("PointSet",Cp);function Fp(e){Mi.call(this,e),this.addType(m.A.LineSet)}Object.assign(Object.setPrototypeOf(Fp.prototype,Mi.prototype),{initialize(){Mi.prototype.initialize.call(this),this._attrib.addInterest("set_attrib__",this),this._fogCoord.addInterest("set_fogCoord__",this),this._color.addInterest("set_color__",this),this._tangent.addInterest("set_tangent__",this),this._normal.addInterest("set_normal__",this),this._coord.addInterest("set_coord__",this),this.set_attrib__(),this.set_fogCoord__(),this.set_color__(),this.set_tangent__(),this.set_normal__(),this.set_coord__()},build(){if(!this.coordNode?.getSize())return;const e=this._vertexCount,t=this.getCoordIndices(),i=this.getAttrib(),n=i.length,s=this.getAttribs(),r=this.getFogCoord(),o=this.getColor(),a=this.getTangent(),l=this.getNormal(),h=this.getCoord(),c=this.getFogDepths(),u=this.getColors(),d=this.getTangents(),p=this.getNormals(),g=this.getVertices(),f=h.getSize();let m=0;for(let A of e){if(m+A>f)break;if(A>1){A=2*A-2;for(let e=0;e<A;++e,m+=1&e){t.push(m);for(let e=0;e<n;++e)i[e].addValue(m,s[e]);r?.addDepth(m,c),o?.addColor(m,u),a?.addVector(m,d),l?.addVector(m,p),h.addPoint(m,g)}++m}else m+=A}}}),Object.defineProperties(Fp,{...Je.A.getStaticProperties("LineSet","Rendering",1,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"vertexCount",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const Mp=Fp,Rp=s.A.add("LineSet",Mp);function Pp(e){ct.call(this,e),this.addType(m.A.TriangleSet)}Object.assign(Object.setPrototypeOf(Pp.prototype,ct.prototype),{getVerticesPerPolygon:()=>3,getNumVertices(){return this.checkVertexCount(this.getCoord()?.getSize()??0,3)},build(){const e=this.getNumVertices();ct.prototype.build.call(this,3,e,3,e)},createNormals(e,t,i){return this.createFaceNormals(e,t,i)}}),Object.defineProperties(Pp,{...Je.A.getStaticProperties("TriangleSet","Rendering",3,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const Vp=Pp,Dp=s.A.add("TriangleSet",Vp);function Lp(e){At.call(this,e),this.addType(m.A.X3DTangentNode)}Object.setPrototypeOf(Lp.prototype,At.prototype),Object.defineProperties(Lp,Je.A.getStaticProperties("X3DTangentNode","Rendering",5));const Bp=Lp,kp=s.A.add("X3DTangentNode",Bp);function jp(e){kp.call(this,e),this.addType(m.A.Tangent)}Object.assign(Object.setPrototypeOf(jp.prototype,kp.prototype),{initialize(){kp.prototype.initialize.call(this),this._vector.addInterest("set_vector__",this),this.set_vector__()},set_vector__(){this.vector=this._vector.getValue(),this.length=this._vector.length},addVector(e,t){if(!(e>=0&&this.length))return t.push(1,0,0,1);{const i=this.vector,n=e%this.length*4;t.push(i[n],i[n+1],i[n+2],i[n+3])}},addVectors(e,t=this.length){const i=this.length;if(i){const n=this.vector;for(let s=0;s<t;++s){const t=s%i*4;e.push(n[t],n[t+1],n[t+2],n[t+3])}}else for(let i=0;i<t;++i)e.push(1,0,0,1);return e}}),Object.defineProperties(jp,{...Je.A.getStaticProperties("Tangent","Rendering",5,"tangent","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"vector",new c.A.MFVec4f)]),enumerable:!0}});const Up=jp,Xp=s.A.add("Tangent",Up);function zp(e){At.call(this,e),this.addType(m.A.X3DColorNode),this.addChildObjects(m.A.outputOnly,"transparent",new c.A.SFBool)}Object.assign(Object.setPrototypeOf(zp.prototype,At.prototype),{setTransparent(e){!!e!==this._transparent.getValue()&&(this._transparent=e)},isTransparent(){return this._transparent.getValue()}}),Object.defineProperties(zp,Je.A.getStaticProperties("X3DColorNode","Rendering",1));const Gp=zp,Hp=s.A.add("X3DColorNode",Gp);function $p(e){Hp.call(this,e),this.addType(m.A.Color)}Object.assign(Object.setPrototypeOf($p.prototype,Hp.prototype),{initialize(){Hp.prototype.initialize.call(this),this._color.addInterest("set_color__",this),this.set_color__()},set_color__(){this.color=this._color.getValue(),this.length=this._color.length},addColor(e,t){if(e>=0&&this.length){const i=this.color,n=e%this.length*3;return t.push(i[n],i[n+1],i[n+2],1)}t.push(1,1,1,1)},addColors(e,t=this.length){const i=this.length;if(i){const n=this.color;for(let s=0;s<t;++s){const t=s%i*3;e.push(n[t],n[t+1],n[t+2],1)}}else for(let i=0;i<t;++i)e.push(1,1,1,1);return e}}),Object.defineProperties($p,{...Je.A.getStaticProperties("Color","Rendering",1,"color","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.MFColor)]),enumerable:!0}});const Yp=$p,qp=s.A.add("Color",Yp);function Wp(e){Hp.call(this,e),this.addType(m.A.ColorRGBA),this.setTransparent(!0)}Object.assign(Object.setPrototypeOf(Wp.prototype,Hp.prototype),{initialize(){Hp.prototype.initialize.call(this),this._color.addInterest("set_color__",this),this.set_color__()},set_color__(){this.color=this._color.getValue(),this.length=this._color.length},addColor(e,t){if(e>=0&&this.length){const i=this.color,n=e%this.length*4;return t.push(i[n],i[n+1],i[n+2],i[n+3])}t.push(1,1,1,1)},addColors(e,t=this.length){const i=this.length;if(i){const n=this.color;for(let s=0;s<t;++s){const t=s%i*4;e.push(n[t],n[t+1],n[t+2],n[t+3])}}else for(let i=0;i<t;++i)e.push(1,1,1,1);return e}}),Object.defineProperties(Wp,{...Je.A.getStaticProperties("ColorRGBA","Rendering",1,"color","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.MFColorRGBA)]),enumerable:!0}});const Kp=Wp,Zp=s.A.add("ColorRGBA",Kp);function Qp(e){Ot.call(this,e),this.addType(m.A.MultiTextureCoordinate);const t=this.getBrowser();this.maxTexCoords=t.getMaxTexCoords(),this.textureCoordinateNodes=[]}Object.assign(Object.setPrototypeOf(Qp.prototype,Ot.prototype),{initialize(){Ot.prototype.initialize.call(this),this._texCoord.addInterest("set_texCoord__",this),this.set_texCoord__()},set_texCoord__(){const e=this.textureCoordinateNodes;for(const t of e)t.removeInterest("addNodeEvent",this);e.length=0;for(const t of this._texCoord){const i=(0,hi.A)(m.A.X3DSingleTextureCoordinateNode,t);i&&e.push(i)}for(const t of e)t.addInterest("addNodeEvent",this)},getCount(){return Math.min(this.maxTexCoords,this.textureCoordinateNodes.length)},init(e){const t=this.textureCoordinateNodes,i=Math.min(this.maxTexCoords,t.length);for(let n=0;n<i;++n)t[n].init(e)},addPoint(e,t){const i=this.textureCoordinateNodes,n=Math.min(this.maxTexCoords,i.length);for(let s=0;s<n;++s)i[s].addPointToChannel(e,t[s])},addPoints(e){for(const t of this.textureCoordinateNodes)return t.addPoints(e);return e},getTextureCoordinates(){return this.textureCoordinateNodes},getTextureCoordinateMapping(e){const t=this.textureCoordinateNodes,i=Math.min(this.maxTexCoords,t.length);for(let n=0;n<i;++n)t[n].getTextureCoordinateMapping(e,n)},setShaderUniforms(e,t){const i=this.textureCoordinateNodes,n=Math.min(this.maxTexCoords,i.length);if(n)for(let s=0;s<n;++s)i[s].setShaderUniforms(e,t,s);else this.getBrowser().getDefaultTextureCoordinate().setShaderUniforms(e,t,0)}}),Object.defineProperties(Qp,{...Je.A.getStaticProperties("MultiTextureCoordinate","Texturing",2,"texCoord","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.MFNode)]),enumerable:!0}});const Jp=Qp,eg=s.A.add("MultiTextureCoordinate",Jp);function tg(e){Ct.call(this,e),this.addType(m.A.TextureCoordinateGenerator),this.mode=Ta.SPHERE,this.parameter=new Float32Array(6)}Object.assign(Object.setPrototypeOf(tg.prototype,Ct.prototype),{initialize(){Ct.prototype.initialize.call(this),this._mode.addInterest("set_mode__",this),this._parameter.addInterest("set_parameter__",this),this.set_mode__(),this.set_parameter__()},set_mode__:(()=>{const e=new Map([["SPHERE",Ta.SPHERE],["CAMERASPACENORMAL",Ta.CAMERASPACENORMAL],["CAMERASPACEPOSITION",Ta.CAMERASPACEPOSITION],["CAMERASPACEREFLECTIONVECTOR",Ta.CAMERASPACEREFLECTIONVECTOR],["SPHERE-LOCAL",Ta.SPHERE_LOCAL],["COORD",Ta.COORD],["COORD-EYE",Ta.COORD_EYE],["NOISE",Ta.NOISE],["NOISE-EYE",Ta.NOISE_EYE],["SPHERE-REFLECT",Ta.SPHERE_REFLECT],["SPHERE-REFLECT-LOCAL",Ta.SPHERE_REFLECT_LOCAL]]);return function(){this.mode=e.get(this._mode.getValue()),void 0===this.mode&&(this.mode=Ta.SPHERE)}})(),set_parameter__(){const e=Math.min(this.parameter.length,this._parameter.length);for(let t=0;t<e;++t)this.parameter[t]=this._parameter[t];this.parameter.fill(0,e)},addPointToChannel(e,t){t.push(0,0,0,1)},addPoints:e=>e,setShaderUniforms(e,t,i=0){const n=t.x3d_TextureCoordinateGenerator[i];e.uniform1i(n.mode,this.mode),e.uniform1fv(n.parameter,this.parameter)}}),Object.defineProperties(tg,{...Je.A.getStaticProperties("TextureCoordinateGenerator","Texturing",2,"texCoord","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"mapping",new c.A.SFString),new o.A(m.A.inputOutput,"mode",new c.A.SFString("SPHERE")),new o.A(m.A.inputOutput,"parameter",new c.A.MFFloat)]),enumerable:!0}});const ig=tg,ng=s.A.add("TextureCoordinateGenerator",ig);var sg=n(2204);function rg(e){ai.A.call(this,e),li.A.call(this,e),this.addType(m.A.StaticGroup),this.groupNode=new fp.A(this.getExecutionContext()),this.bbox=new pi.A,this.shadowBBox=new pi.A}Object.assign(Object.setPrototypeOf(rg.prototype,ai.A.prototype),li.A.prototype,{initialize(){ai.A.prototype.initialize.call(this),li.A.prototype.initialize.call(this),this._children.addFieldInterest(this.groupNode._children),this.groupNode._children=this._children,this.groupNode.setPrivate(!0),this.groupNode.setup(),this.groupNode._children.addInterest("set_children__",this),this.set_children__()},getBBox(e,t){return this.isDefaultBBoxSize()?this.optimizedGroup?e.assign(t?this.shadowBBox:this.bbox):this.groupNode.getBBox(e,t):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getShapes(e,t){return this.groupNode.getShapes(e,t)},set_children__(){this.optimizedGroup&&this.disconnectChildNode(this.optimizedGroup),this.connectChildNode(this.groupNode,[ci.A.CAMERA]),this.optimizedGroup=null},traverse(e,t){this.optimizedGroup||this.createStaticShapes(),this.optimizedGroup.traverse(e,t)},async createStaticShapes(){this.optimizedGroup=this.groupNode;const e=this.getScene();e._loadCount.getValue()?e._loadCount.addFieldCallback(this,()=>{e._loadCount.getValue()||(e._loadCount.removeFieldCallback(this),this.set_children__())}):(this.optimizedGroup=await this.optimizeGroups(this.createGroups()),this.disconnectChildNode(this.groupNode),this.connectChildNode(this.optimizedGroup,[ci.A.CAMERA]),this.optimizedGroup.getBBox(this.bbox),this.optimizedGroup.getBBox(this.shadowBBox,!0))},createGroups:(()=>{const e={style:"CLEAN",names:!1};return function(){const t=this.getBrowser();t.getBrowserOption("Debug")&&console.info(`Rebuilding StaticGroup "${this.getName()||"unnamed"}".`);const i=this.groupNode.getShapes([],Si.A.IDENTITY),n=new Map(i.map(({shapeNode:e})=>[e,[]])),s={},r={};for(const t of i){const i=t.shapeNode,o=i.getAppearance(),a=i.getGeometry();if(i.getType().includes(m.A.ParticleSystem)){if("GEOMETRY"===i._geometryType.getValue()&&!a?.getVertices().length)continue;if(!i._isActive.getValue())continue;if(!i._createParticles.getValue())continue}else if(!a?.getVertices().length)continue;if(i.getShapeKey()>0||this.hasTextureCoordinateGenerator(a)){(r[t.modelMatrix]??=[]).push(t);continue}let l="";l+=a.getGeometryType(),l+=a.isSolid()?1:0,l+=a.getFogDepths().length?1:0,l+=i.isTransparent()?1:0,l+=i._pointerEvents.getValue()?1:0,l+=i._castShadow.getValue()?1:0,l+=i._bboxDisplay.getValue()?1:0,l+=".",l+=o.toVRMLString(e);const h=n.get(i),c=s[l]??=[];h.push(t),c.push(t)}for(const[e,t]of n.entries())t.length<2&&n.delete(e);const o=Array.from(n.values()),a=Object.values(s).map(e=>e.filter(({shapeNode:e})=>!n.has(e))).filter(e=>e.length),l=Object.values(r);return t.getBrowserOption("Debug")&&console.info(`StaticGroup will create ${o.length+a.length+l.length} static nodes from the previous ${i.length} nodes.`),{clonesGroups:o,combineGroups:a,singlesGroups:l}}})(),hasTextureCoordinateGenerator(e){const t=e._texCoord?.getValue();return t instanceof ng||!!(t instanceof eg&&t._texCoord.some(e=>e.getValue()instanceof ng))},async optimizeGroups({clonesGroups:e,combineGroups:t,singlesGroups:i}){e.length&&await this.getBrowser().loadComponents("X_ITE"),ka.A&&console.time("StaticGroup");const n=[];e.forEach(e=>this.combineClones(e,n)),t.forEach(e=>this.combineShapes(e,n)),i.forEach(e=>this.normalizeSingleShapes(e,n));const s=new fp.A(this.getExecutionContext());return s._children=n,s.setPrivate(!0),s.setup(),ka.A&&console.timeEnd("StaticGroup"),s},combineClones:(()=>{const e=new Ee.A,t=new Fn.A,i=new Ee.A,n=new Fn.A;return function(s,r){const o=this.getBrowser(),a=this.getExecutionContext(),l=new(o.getConcreteNodes().get("InstancedShape"))(a),h=s[0].shapeNode;for(const{modelMatrix:r}of s)r.get(e,t,i,n),l._translations.push(e),l._rotations.push(t),l._scales.push(i),l._scaleOrientations.push(n);l._pointerEvents=h._pointerEvents,l._castShadow=h._castShadow,l._bboxDisplay=h._bboxDisplay,l._appearance=h._appearance,l._geometry=h._geometry,l.setPrivate(!0),l.setup(),r.push(l)}})(),combineShapes(e,t){const i=this.getExecutionContext(),n=e[0].shapeNode.copy(i);let s=null,r=0;for(const{modelMatrix:t,shapeNode:n}of e){const e=this.normalizeGeometry(t,n);if(!s){s=e,r=e._coord.point.length;continue}if(1===s.getGeometryType()){const t=s._vertexCount;t.assign(t.concat(e._vertexCount))}const o=s._attrib;for(const t of e._attrib){const e=t.getValue(),n=e._name.getValue();let s=o.find(e=>e.name===n)?.getValue();s||(s=e.create(i),o.push(s)),s._name=e._name,s._numComponents=e._numComponents;const a=s._value,l=e._numComponents?.getValue()??1;a.length<r*l&&a.resize(r*l),a.assign(a.concat(e._value))}const a=e._fogCoord.getValue();if(a?._depth.length){s._fogCoord.getValue()||(s._fogCoord=new Au(i));const e=s._fogCoord.depth;e.length<r&&e.resize(r),e.assign(e.concat(a._depth))}const l=e._color.getValue();if(l?._color.length){s._color.getValue()||(s._color=l.create(i));const e=s._color.color;e.length<r&&e.resize(r,sg.A.WHITE),e.assign(e.concat(l._color))}if(s._texCoord){const t=e._texCoord.getValue();s._texCoord.getValue()||(s._texCoord=new eg(i));const n=s._texCoord.texCoord;for(const e of t._texCoord){const t=e.getValue(),s=t._mapping.getValue();let o=n.find(e=>e.mapping===s)?.getValue();o||(o=t.create(i),n.push(o)),o._mapping=t._mapping;const a=o._point;a.length<r&&a.resize(r),a.assign(a.concat(t._point))}}const h=e._tangent.getValue();if(h?._vector.length){s._tangent.getValue()||(s._tangent=new Xp(i));const e=s._tangent.vector;e.length<r&&e.resize(r),e.assign(e.concat(h._vector))}const c=e._normal.getValue();if(c?._vector.length){s._normal.getValue()||(s._normal=new Xt(i));const e=s._normal.vector;e.length<r&&e.resize(r),e.assign(e.concat(c._vector))}const u=e._coord.getValue();if(u?._point.length){s._coord.getValue()||(s._coord=new St(i));const e=s._coord.point;e.assign(e.concat(u._point)),r=e.length}}s._attrib.forEach(e=>e.getValue().setup()),s._fogCoord.getValue()?.setup(),s._color.getValue()?.setup(),s._texCoord?.texCoord.forEach(e=>e.getValue().setup()),s._texCoord?.getValue()?.setup(),s._tangent.getValue()?.setup(),s._normal.getValue()?.setup(),s._coord.getValue()?.setup(),s.setup(),n._geometry=s,n.setPrivate(!0),n.setup(),t.push(n)},normalizeGeometry:(()=>{const e=[Ip,Rp,Dp,Dp],t=[c.A.MFFloat,c.A.MFVec2f,c.A.MFVec3f,c.A.MFVec4f],i=new bi.A,n=new Ee.A,s=new bi.A,r=new Ee.A;return function(o,a){const l=this.getBrowser(),h=this.getExecutionContext(),c=a.getGeometry(),u=new(0,e[c.getGeometryType()])(h),d=c.getAttribs(),p=c.getAttrib(),g=d.map((e,t)=>{const i=p[t],n=i.create(h);return n._name=i._name,n._numComponents=i._numComponents,n._value=e.getValue(),n});u._attrib=g;const f=c.getFogDepths().getValue();if(f.length){const e=new Au(h);e._depth=f,u._fogCoord=e}const m=c.getColors().getValue();let A;if(m.length&&(a.isTransparent()?(A=new Zp(h),A._color=m):(A=new qp(h),A._color=m.filter((e,t)=>t%4<3)),u._color=A),u._texCoord){const e=c.getTextureCoordinate(),t=c.getMultiTexCoords().map((t,i)=>{const n=e instanceof eg?e.getTextureCoordinates()[i]??this.getBrowser().getDefaultTextureCoordinate():e;if(n instanceof ng)return n.copy(h);const s=t.getValue(),r=l.getConcreteNodes().get("TextureCoordinate4D"),o=new(r??Rt)(h);return o._mapping=n._mapping,o._point=r?s:s.filter((e,t)=>t%4<2),o}),i=new eg(h);i._texCoord=t,u._texCoord=i}const _=o.submatrix.inverse().transpose(),y=c.getTangents().getValue();if(y.length){const e=y.length,t=new Xp(h),s=new Float32Array(e);for(let t=0;t<e;t+=4)n.set(y[t],y[t+1],y[t+2]),_.multVecMatrix(n),s.set(i.set(n.x,n.y,n.z,y[t+3]),t);t._vector=s,u._tangent=t}const w=c.getNormals().getValue();if(w.length){const e=w.length,t=new Xt(h),i=new Float32Array(e);for(let t=0;t<e;t+=3)n.set(w[t],w[t+1],w[t+2]),_.multVecMatrix(n),i.set(n,t);t._vector=i,u._normal=t}const x=c.getVertices().getValue(),b=x.length,S=new St(h),T=new Float32Array(b/4*3);for(let e=0,t=0;e<b;e+=4,t+=3)s.set(x[e],x[e+1],x[e+2],x[e+3]),o.multVecMatrix(s),T.set(r.assign(s).divide(s.w),t);switch(S._point=T,u._coord=S,c.getGeometryType()){case 1:u._vertexCount=new Array(b/8).fill(2);break;case 2:case 3:if(u.setGeometryType(c.getGeometryType()),u._solid=c.isSolid(),!(c._ccw?.getValue()??1)){for(const e of u._attrib){const i=W.A.clamp(e.numComponents,1,4);if(1===i)e.value.reverse();else{const n=new t[i-1];n.setValue(e.value.shrinkToFit()),n.reverse(),e.value=n.shrinkToFit()}}u._fogCoord.getValue()?._depth.reverse(),u._color.getValue()?._color.reverse(),u._texCoord.getValue()?._texCoord.forEach(e=>e.point.reverse()),u._tangent.getValue()?._vector.reverse(),u._normal.getValue()?._vector.reverse(),u._coord.getValue()?._point.reverse()}}return u}})(),normalizeSingleShapes:(()=>{const e=new Ee.A,t=new Fn.A,i=new Ee.A,n=new Fn.A;return function(s,r){const o=this.getExecutionContext(),a=new Tp(o);s[0].modelMatrix.get(e,t,i,n),a._translation=e,a._rotation=t,a._scale=i,a._scaleOrientation=n;for(const{shapeNode:e}of s)a._children.push(e);a.setPrivate(!0),a.setup(),r.push(a)}})(),dispose(){li.A.prototype.dispose.call(this),ai.A.prototype.dispose.call(this)}}),Object.defineProperties(rg,{...Je.A.getStaticProperties("StaticGroup","Grouping",3,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"children",new c.A.MFNode)]),enumerable:!0}});const og=rg,ag=s.A.add("StaticGroup",og);function lg(e){ji.A.call(this,e),this.addType(m.A.Switch),2==e.getSpecificationVersion()&&this.addAlias("choice",this._children)}Object.assign(Object.setPrototypeOf(lg.prototype,ji.A.prototype),{initialize(){ji.A.prototype.initialize.call(this),this._whichChoice.addInterest("requestRebuild",this)},addChildren(){},removeChildren(){},set_addChildren__(){ji.A.prototype.set_addChildren__.call(this),this.set_children__()},set_removeChildren__(){ji.A.prototype.set_removeChildren__.call(this),this.set_children__()},set_children__(){this.clearChildren();const e=this._whichChoice.getValue();e>=0&&e<this._children.length&&this.addChild(this._children[e]),this.set_objects__()}}),Object.defineProperties(lg,{...Je.A.getStaticProperties("Switch","Grouping",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"whichChoice",new c.A.SFInt32(-1)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const hg=lg,cg=s.A.add("Switch",hg),ug={name:"Grouping",concreteNodes:[fp.A,ag,cg,Tp],abstractNodes:[li.A,ji.A,_p,xp]},dg=s.A.add("GroupingComponent",ug);var pg=n(8067);function gg(e){pg.A.call(this,e),this.addType(m.A.ColorInterpolator),this.hsv=[]}Object.assign(Object.setPrototypeOf(gg.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){const e=this._keyValue;e.length<this._key.length&&this._keyValue.resize(this._key.length,e.length?e[this._keyValue.length-1]:new c.A.SFColor),this.hsv.length=0;for(const t of e)this.hsv.push(t.getHSV());this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate:(()=>{const e=[];return function(t,i,n){Wn.A.lerp(this.hsv[t],this.hsv[i],n,e),this._value_changed.setHSV(e[0],e[1],e[2])}})()}),Object.defineProperties(gg,{...Je.A.getStaticProperties("ColorInterpolator","Interpolation",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFColor),new o.A(m.A.outputOnly,"value_changed",new c.A.SFColor)]),enumerable:!0}});const fg=gg,mg=s.A.add("ColorInterpolator",fg);function Ag(e){pg.A.call(this,e),this.addType(m.A.CoordinateInterpolator)}Object.assign(Object.setPrototypeOf(Ag.prototype,pg.A.prototype),{set_keyValue__(){this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){const n=this._keyValue.getValue();let s=this._key.length?Math.floor(this._keyValue.length/this._key.length):0;this._value_changed.length=s;const r=this._value_changed.getValue();t=(e*=s)+(this._key.length>1?s:0),e*=3,t*=3,s*=3;for(let o=0;o<s;o+=3){const s=o+1,a=o+2;r[o]=W.A.lerp(n[e+o],n[t+o],i),r[s]=W.A.lerp(n[e+s],n[t+s],i),r[a]=W.A.lerp(n[e+a],n[t+a],i)}this._value_changed.addEvent()}}),Object.defineProperties(Ag,{...Je.A.getStaticProperties("CoordinateInterpolator","Interpolation",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFVec3f),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec3f)]),enumerable:!0}});const _g=Ag,yg=s.A.add("CoordinateInterpolator",_g);function wg(e){pg.A.call(this,e),this.addType(m.A.CoordinateInterpolator2D)}Object.assign(Object.setPrototypeOf(wg.prototype,pg.A.prototype),{set_keyValue__(){this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){const n=this._keyValue.getValue();let s=this._key.length?Math.floor(this._keyValue.length/this._key.length):0;this._value_changed.length=s;const r=this._value_changed.getValue();t=(e*=s)+(this._key.length>1?s:0),e*=2,t*=2,s*=2;for(let o=0;o<s;o+=2){const s=o+1;r[o]=W.A.lerp(n[e+o],n[t+o],i),r[s]=W.A.lerp(n[e+s],n[t+s],i)}this._value_changed.addEvent()}}),Object.defineProperties(wg,{...Je.A.getStaticProperties("CoordinateInterpolator2D","Interpolation",3,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFVec2f),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec2f)]),enumerable:!0}});const xg=wg,bg=s.A.add("CoordinateInterpolator2D",xg);var Sg=n(8188);function Tg(e){pg.A.call(this,e),this.addType(m.A.NormalInterpolator)}Object.assign(Object.setPrototypeOf(Tg.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate:(()=>{const e=new Ee.A,t=new Ee.A;return function(i,n,s){const r=this._keyValue.getValue();let o=this._key.length?Math.floor(this._keyValue.length/this._key.length):0;this._value_changed.length=o;const a=this._value_changed.getValue();n=(i*=o)+(this._key.length>1?o:0),i*=3,n*=3,o*=3;for(let l=0;l<o;l+=3){const o=l+1,h=l+2;e.set(r[i+l],r[i+o],r[i+h]),t.set(r[n+l],r[n+o],r[n+h]);const c=W.A.simpleSlerp(e,t,s);a[l]=c[0],a[o]=c[1],a[h]=c[2]}this._value_changed.addEvent()}})()}),Object.defineProperties(Tg,{...Je.A.getStaticProperties("NormalInterpolator","Interpolation",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFVec3f),new o.A(m.A.outputOnly,"value_changed",new c.A.MFVec3f)]),enumerable:!0}});const vg=Tg,Og=s.A.add("NormalInterpolator",vg);var Eg=n(1730),Ng=n(4275);function Cg(e){pg.A.call(this,e),this.addType(m.A.PositionInterpolator2D)}Object.assign(Object.setPrototypeOf(Cg.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new c.A.SFVec2f),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate:(()=>{const e=new It.A;return function(t,i,n){this._value_changed=e.assign(this._keyValue[t].getValue()).lerp(this._keyValue[i].getValue(),n)}})()}),Object.defineProperties(Cg,{...Je.A.getStaticProperties("PositionInterpolator2D","Interpolation",3,"children","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFVec2f),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec2f)]),enumerable:!0}});const Ig=Cg,Fg=s.A.add("PositionInterpolator2D",Ig);function Mg(){this.T0=[],this.T1=[]}Object.assign(Mg.prototype,{generate:(()=>{const e=[],t=[],i=[];return function(n,s,r,o,a){const l=this.T0,h=this.T1;if(l.length=0,h.length=0,e.length=0,t.length=0,i.length=0,s.length>1){if(0===o.length){n?e.push(this.divide(this.subtract(r[1],r[r.length-2]),2)):e.push(this.create());for(let t=1,i=r.length-1;t<i;++t)e.push(this.divide(this.subtract(r[t+1],r[t-1]),2));e.push(this.copy(e[0]))}else{for(let t=0,i=o.length;t<i;++t)e.push(this.copy(o[t]));if(a){let t=0;for(let e=0,i=r.length-1;e<i;++e)t+=this.distance(r[e],r[e+1]);for(let i=0,n=e.length-1;i<n;++i){const n=this.magnitude(e[i]);n&&(e[i]=this.multiply(e[i],t/n))}}}if(n){const e=s.length-1,n=s.length-2,r=s[1]-s[0]+s[e]-s[n];i.push(2*(s[1]-s[0])/r),t.push(2*(s[e]-s[n])/r)}else i.push(1),t.push(1);for(let e=1,n=s.length-1;e<n;++e){const n=s[e+1]-s[e-1];i.push(2*(s[e+1]-s[e])/n),t.push(2*(s[e]-s[e-1])/n)}i.push(i[0]),t.push(t[0]);for(let n=0,s=e.length;n<s;++n)l.push(this.multiply(e[n],t[n])),h.push(this.multiply(e[n],i[n]))}else l.push(this.create()),h.push(this.create())}})(),interpolate:(()=>{const e=new bi.A,t=new Si.A(2,-2,1,1,-3,3,-2,-1,0,0,1,0,1,0,0,0);return function(i,n,s,r){return e.set(s**3,s**2,s,1),this.dot(t.multVecMatrix(e),r[i],r[n],this.T0[i],this.T1[n])}})()});const Rg=Mg,Pg=s.A.add("CatmullRomSplineInterpolator",Rg);const Vg=function(e){function t(){this.T0=[],this.T1=[]}return Object.assign(Object.setPrototypeOf(t.prototype,Pg.prototype),{create:()=>new e,copy:e=>e.copy(),subtract:(e,t)=>e.copy().subtract(t),multiply:(e,t)=>e.copy().multiply(t),divide:(e,t)=>e.copy().divide(t),magnitude:e=>e.norm(),distance:(e,t)=>e.distance(t),dot:(()=>{const t=new e,i=new e,n=new e,s=new e;return function(e,r,o,a,l){return t.assign(r).multiply(e[0]),i.assign(o).multiply(e[1]),n.assign(a).multiply(e[2]),s.assign(l).multiply(e[3]),t.add(i).add(n).add(s)}})()}),t},Dg=s.A.add("CatmullRomSplineInterpolatorTemplate",Vg),Lg=Dg(Ee.A),Bg=s.A.add("CatmullRomSplineInterpolator3",Lg);function kg(e){pg.A.call(this,e),this.addType(m.A.SplinePositionInterpolator),this.spline=new Bg}Object.assign(Object.setPrototypeOf(kg.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this),this._keyVelocity.addInterest("set_keyVelocity__",this),this._normalizeVelocity.addInterest("set_normalizeVelocity__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new c.A.SFVec3f),this.set_keyVelocity__()},set_keyVelocity__(){this._keyVelocity.length&&this._keyVelocity.length<this._key.length&&this._keyVelocity.resize(this._key.length,new c.A.SFVec3f),this.set_normalizeVelocity__()},set_normalizeVelocity__(){this.spline.generate(this._closed.getValue(),this._key,this._keyValue,this._keyVelocity,this._normalizeVelocity.getValue()),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){this._value_changed=this.spline.interpolate(e,t,i,this._keyValue)}}),Object.defineProperties(kg,{...Je.A.getStaticProperties("SplinePositionInterpolator","Interpolation",4,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"closed",new c.A.SFBool),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFVec3f),new o.A(m.A.inputOutput,"keyVelocity",new c.A.MFVec3f),new o.A(m.A.inputOutput,"normalizeVelocity",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec3f)]),enumerable:!0}});const jg=kg,Ug=s.A.add("SplinePositionInterpolator",jg),Xg=Dg(It.A),zg=s.A.add("CatmullRomSplineInterpolator2",Xg);function Gg(e){pg.A.call(this,e),this.addType(m.A.SplinePositionInterpolator2D),this.spline=new zg}Object.assign(Object.setPrototypeOf(Gg.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this),this._keyVelocity.addInterest("set_keyVelocity__",this),this._normalizeVelocity.addInterest("set_normalizeVelocity__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new c.A.SFVec2f),this.set_keyVelocity__()},set_keyVelocity__(){this._keyVelocity.length&&this._keyVelocity.length<this._key.length&&this._keyVelocity.resize(this._key.length,new c.A.SFVec2f),this.set_normalizeVelocity__()},set_normalizeVelocity__(){this.spline.generate(this._closed.getValue(),this._key,this._keyValue,this._keyVelocity,this._normalizeVelocity.getValue()),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){this._value_changed=this.spline.interpolate(e,t,i,this._keyValue)}}),Object.defineProperties(Gg,{...Je.A.getStaticProperties("SplinePositionInterpolator2D","Interpolation",4,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"closed",new c.A.SFBool),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFVec2f),new o.A(m.A.inputOutput,"keyVelocity",new c.A.MFVec2f),new o.A(m.A.inputOutput,"normalizeVelocity",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFVec2f)]),enumerable:!0}});const Hg=Gg,$g=s.A.add("SplinePositionInterpolator2D",Hg);function Yg(){Pg.call(this)}Object.assign(Object.setPrototypeOf(Yg.prototype,Pg.prototype),{create:()=>0,copy:e=>e,subtract:(e,t)=>e-t,multiply:(e,t)=>e*t,divide:(e,t)=>e/t,magnitude:e=>Math.abs(e),distance:(e,t)=>Math.abs(e-t),dot:(e,t,i,n,s)=>t*e[0]+i*e[1]+n*e[2]+s*e[3]});const qg=Yg,Wg=s.A.add("CatmullRomSplineInterpolator1",qg);function Kg(e){pg.A.call(this,e),this.addType(m.A.SplineScalarInterpolator),this.spline=new Wg}Object.assign(Object.setPrototypeOf(Kg.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this),this._keyVelocity.addInterest("set_keyVelocity__",this),this._normalizeVelocity.addInterest("set_normalizeVelocity__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new c.A.SFFloat),this.set_keyVelocity__()},set_keyVelocity__(){this._keyVelocity.length&&this._keyVelocity.length<this._key.length&&this._keyVelocity.resize(this._key.length,new c.A.SFFloat),this.set_normalizeVelocity__()},set_normalizeVelocity__(){this.spline.generate(this._closed.getValue(),this._key,this._keyValue,this._keyVelocity,this._normalizeVelocity.getValue()),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){this._value_changed=this.spline.interpolate(e,t,i,this._keyValue)}}),Object.defineProperties(Kg,{...Je.A.getStaticProperties("SplineScalarInterpolator","Interpolation",4,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"closed",new c.A.SFBool),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyVelocity",new c.A.MFFloat),new o.A(m.A.inputOutput,"normalizeVelocity",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFFloat)]),enumerable:!0}});const Zg=Kg,Qg=s.A.add("SplineScalarInterpolator",Zg);function Jg(){this.s=[]}Object.assign(Jg.prototype,{generate(e,t,i){const n=this.s;if(n.length=0,t.length>1){e?n.push(Fn.A.spline(i[t.length-2].getValue(),i[0].getValue(),i[1].getValue())):n.push(i[0].getValue());for(let e=1,s=t.length-1;e<s;++e)n.push(Fn.A.spline(i[e-1].getValue(),i[e].getValue(),i[e+1].getValue()));e?n.push(Fn.A.spline(i[t.length-2].getValue(),i[t.length-1].getValue(),i[1].getValue())):n.push(i[t.length-1].getValue())}else t.length>0&&n.push(i[0].getValue().copy())},interpolate:(()=>{const e=new Fn.A;return function(t,i,n,s){const r=this.s;return e.assign(s[t].getValue()).squad(r[t],r[i],s[i].getValue(),n)}})()});const ef=Jg,tf=s.A.add("SquadInterpolator",ef);function nf(e){pg.A.call(this,e),this.addType(m.A.SquadOrientationInterpolator),this._keyValue.setUnit("angle"),this._value_changed.setUnit("angle"),this.squad=new tf}Object.assign(Object.setPrototypeOf(nf.prototype,pg.A.prototype),{initialize(){pg.A.prototype.initialize.call(this),this._keyValue.addInterest("set_keyValue__",this)},set_keyValue__(){const e=this._key,t=this._keyValue;t.length<e.length&&t.resize(e.length,t.length?t[t.length-1]:new c.A.SFRotation),this.squad.generate(this._closed.getValue(),this._key,this._keyValue),this._set_fraction.getModificationTime()>=this.getBrowser().getCurrentTime()&&this.set_fraction__()},interpolate(e,t,i){this._value_changed=this.squad.interpolate(e,t,i,this._keyValue)}}),Object.defineProperties(nf,{...Je.A.getStaticProperties("SquadOrientationInterpolator","Interpolation",5,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_fraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"closed",new c.A.SFBool),new o.A(m.A.inputOutput,"key",new c.A.MFFloat),new o.A(m.A.inputOutput,"keyValue",new c.A.MFRotation),new o.A(m.A.inputOutput,"normalizeVelocity",new c.A.SFBool),new o.A(m.A.outputOnly,"value_changed",new c.A.SFRotation)]),enumerable:!0}});const sf=nf,rf=s.A.add("SquadOrientationInterpolator",sf),of={name:"Interpolation",concreteNodes:[mg,yg,bg,Sg.A,Og,Eg.A,Ng.A,Fg,gn.A,Ug,$g,Qg,rf],abstractNodes:[pg.A]},af=s.A.add("InterpolationComponent",of);var lf=n(5595),hf=n(1794);const cf={name:"Layering",concreteNodes:[qn.A,lf.A,$i],abstractNodes:[hf.A,zi]},uf=s.A.add("LayeringComponent",cf),df=(0,Rs.A)(pf);function pf(){this.modelViewMatrix=new Ms.A(Si.A),this.rotation=new Fn.A,this.rotationMatrix=new Float32Array(9)}function gf(e){Fs.call(this,e),this.addType(m.A.EnvironmentLight)}Object.assign(pf.prototype,{set(e,t,i){this.browser=e.getBrowser(),this.lightNode=e,this.global=e.getGlobal(),this.modelViewMatrix.push(i)},renderShadowMap(e){},setGlobalVariables(e){this.modelViewMatrix.get().get(null,this.rotation),this.rotation.multLeft(this.lightNode._rotation.getValue()).inverse().getMatrix(this.rotationMatrix)},setShaderUniforms(e,t){const i=t.numEnvironmentLights++,n=t.x3d_EnvironmentLight[i];if(!n)return;const{browser:s,lightNode:r,global:o}=this,a=r.getDiffuseTexture(),l=r.getSpecularTexture(),h=s.getLibraryTexture("lut_ggx.png"),c=o?this.diffuseTextureUnit??=s.popGlobalTextureUnit():s.popTextureUnit(),u=o?this.specularTextureUnit??=s.popGlobalTextureUnit():s.popTextureUnit(),d=o?this.ggxLUTTextureUnit??=s.popGlobalTextureUnit():s.popTextureUnit();if(e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_CUBE_MAP,a?.getTexture()??s.getDefaultTextureCube()),e.uniform1i(n.diffuseTexture,c),e.activeTexture(e.TEXTURE0+u),e.bindTexture(e.TEXTURE_CUBE_MAP,l?.getTexture()??s.getDefaultTextureCube()),e.uniform1i(n.specularTexture,u),e.activeTexture(e.TEXTURE0+d),e.bindTexture(e.TEXTURE_2D,h.getTexture()),e.uniform1i(n.ggxLUTTexture,d),n.sheenTexture){const t=r.getSheenTexture(),i=s.getLibraryTexture("lut_charlie.png"),a=o?this.sheenTextureUnit??=s.popGlobalTextureUnit():s.popTextureUnit(),l=o?this.charlieLUTTextureUnit??=s.popGlobalTextureUnit():s.popTextureUnit();e.activeTexture(e.TEXTURE0+a),e.bindTexture(e.TEXTURE_CUBE_MAP,t?.getTexture()??s.getDefaultTextureCube()),e.uniform1i(n.sheenTexture,a),e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,i.getTexture()),e.uniform1i(n.charlieLUTTexture,l)}if(!t.hasEnvironmentLight(i,this)&&(e.uniform3f(n.color,...r.getColor()),e.uniform1f(n.intensity,r.getIntensity()),e.uniformMatrix3fv(n.rotation,!1,this.rotationMatrix),e.uniform1i(n.diffuseTextureLevels,a?.getLevels()??0),e.uniform1i(n.specularTextureLevels,l?.getLevels()??0),n.sheenTexture)){const t=r.getSheenTexture();e.uniform1i(n.sheenTextureLevels,t?.getLevels()??0)}},dispose(){this.global&&(this.diffuseTextureUnit=void 0,this.specularTextureUnit=void 0,this.ggxLUTTextureUnit=void 0,this.sheenTextureUnit=void 0,this.charlieLUTTextureUnit=void 0),this.modelViewMatrix.clear(),df.push(this)}}),Object.assign(Object.setPrototypeOf(gf.prototype,Fs.prototype),{initialize(){Fs.prototype.initialize.call(this),this.getBrowser().getLibraryTexture("lut_ggx.png"),this._diffuseCoefficients.addInterest("requestGenerateTextures",this),this._diffuseTexture.addInterest("set_diffuseTexture__",this),this._specularTexture.addInterest("set_specularTexture__",this),this.set_diffuseTexture__(),this.set_specularTexture__()},getLightKey(){return this.lightKey??=(()=>`[2.${this.getDiffuseTexture()?.isLinear()?1:0}.${this.getSpecularTexture()?.isLinear()?1:0}${this.getSheenTexture()?.isLinear()?1:0}]`)()},getDiffuseTexture(){return this.diffuseTexture??(this.generatedDiffuseTexture??=(()=>{if(!this.specularTexture)return;const e=this.getBrowser();return e.getBrowserOption("Debug")&&this.specularTexture.getSize()>1&&console.info("Generating diffuse texture for EnvironmentLight."),e.filterEnvironmentTexture({name:"GeneratedDiffuseTexture",texture:this.specularTexture,distribution:nn.LAMBERTIAN,sampleCount:2048,roughness:[0]})})())},getSpecularTexture(){return this.generatedSpecularTexture??=(()=>{if(!this.specularTexture)return;const e=this.getBrowser();e.getBrowserOption("Debug")&&this.specularTexture.getSize()>1&&console.info("Generating specular texture for EnvironmentLight.");const t=this.specularTexture.getLevels(),i=Array.from({length:t+1},(e,i)=>i/(t||1));return e.filterEnvironmentTexture({name:"GeneratedSpecularTexture",texture:this.specularTexture,distribution:nn.GGX,sampleCount:1024,roughness:i})})()},getSheenTexture(){return this.generatedSheenTexture??=(()=>{if(!this.specularTexture)return;const e=this.getBrowser();e.getBrowserOption("Debug")&&this.specularTexture.getSize()>1&&console.info("Generating sheen texture for EnvironmentLight.");const t=this.specularTexture.getLevels(),i=Array.from({length:t+1},(e,i)=>Math.max(i/(t||1),2,1e-6));return e.filterEnvironmentTexture({name:"GeneratedSheenTexture",texture:this.specularTexture,distribution:nn.CHARLIE,sampleCount:64,roughness:i})})()},getLights:()=>df,set_diffuseTexture__(){this.diffuseTexture=(0,hi.A)(m.A.X3DEnvironmentTextureNode,this._diffuseTexture),this.requestGenerateTextures()},set_specularTexture__(){this.specularTexture?.removeInterest("requestGenerateTextures",this),this.specularTexture=(0,hi.A)(m.A.X3DEnvironmentTextureNode,this._specularTexture),this.specularTexture?.addInterest("requestGenerateTextures",this),this.requestGenerateTextures()},requestGenerateTextures(){this.lightKey=void 0,this.generatedDiffuseTexture=null,this.generatedSpecularTexture=null,this.generatedSheenTexture=null}}),Object.defineProperties(gf,{...Je.A.getStaticProperties("EnvironmentLight","Lighting",3,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"global",new c.A.SFBool),new o.A(m.A.inputOutput,"on",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"color",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"intensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"ambientIntensity",new c.A.SFFloat),new o.A(m.A.inputOutput,"rotation",new c.A.SFRotation),new o.A(m.A.inputOutput,"diffuseCoefficients",new c.A.MFFloat),new o.A(m.A.inputOutput,"diffuseTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"specularTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"shadows",new c.A.SFBool),new o.A(m.A.inputOutput,"shadowColor",new c.A.SFColor),new o.A(m.A.inputOutput,"shadowIntensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"shadowBias",new c.A.SFFloat(.005)),new o.A(m.A.initializeOnly,"shadowMapSize",new c.A.SFInt32(1024))]),enumerable:!0}});const ff=gf,mf=s.A.add("EnvironmentLight",ff),Af=[(new Si.A).setRotation(new Fn.A(Ee.A.X_AXIS,Ee.A.Z_AXIS)),(new Si.A).setRotation(new Fn.A(Ee.A.NEGATIVE_X_AXIS,Ee.A.Z_AXIS)),(new Si.A).setRotation(new Fn.A(Ee.A.NEGATIVE_Z_AXIS,Ee.A.Z_AXIS)),(new Si.A).setRotation(new Fn.A(Ee.A.Z_AXIS,Ee.A.Z_AXIS)),(new Si.A).setRotation(new Fn.A(Ee.A.Y_AXIS,Ee.A.Z_AXIS)),(new Si.A).setRotation(new Fn.A(Ee.A.NEGATIVE_Y_AXIS,Ee.A.Z_AXIS))],_f=[new bi.A(0,.5,.25,.5),new bi.A(.5,.5,.25,.5),new bi.A(.75,.5,.25,.5),new bi.A(.25,.5,.25,.5),new bi.A(0,0,.5,.5),new bi.A(.5,0,.5,.5)],yf=(0,Rs.A)(wf);function wf(){this.location=new Ee.A,this.matrixArray=new Float32Array(9),this.shadowBuffer=null,this.viewVolume=new xi.A,this.viewport=new bi.A,this.projectionMatrix=new Si.A,this.modelViewMatrix=new Ms.A(Si.A),this.modelMatrix=new Si.A,this.invLightSpaceMatrix=new Si.A,this.invLightSpaceProjectionMatrix=new Si.A,this.shadowMatrix=new Si.A,this.shadowMatrixArray=new Float32Array(16),this.rotation=new Fn.A,this.rotationMatrix=new Si.A,this.textureUnit=void 0}function xf(e){Fs.call(this,e),this.addType(m.A.PointLight),this._location.setUnit("length"),this._radius.setUnit("length"),this.attenuation=new Float32Array(3)}Object.assign(wf.prototype,{set(e,t,i){const n=e.getShadowMapSize();this.browser=e.getBrowser(),this.lightNode=e,this.groupNode=t,this.global=e.getGlobal(),this.matrixArray.set(i.submatrix.inverse()),this.modelViewMatrix.push(i),e.getShadowIntensity()>0&&n>0&&(this.shadowBuffer=this.browser.popShadowBuffer(n),this.shadowBuffer||console.warn("Couldn't create shadow buffer."))},renderShadowMap(e){if(!this.shadowBuffer)return;const t=this.lightNode,i=e.getCameraSpaceMatrix().get(),n=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),s=this.invLightSpaceMatrix.assign(this.global?n:Si.A.IDENTITY);s.translate(t.getLocation()),s.inverse();const r=t.getShadowMapSize();this.shadowBuffer.bind();for(let t=0;t<6;++t){const i=_f[t],n=this.viewport.set(i[0]*r,i[1]*r,i[2]*r,i[3]*r),o=fn.A.perspective2(W.A.radians(90),.125,1e4,n[2],n[3],this.projectionMatrix);e.getViewVolumes().push(this.viewVolume.set(o,n,n)),e.getProjectionMatrix().push(this.projectionMatrix),e.getModelViewMatrix().push(Af[t]),e.getModelViewMatrix().multLeft(s),e.render(ci.A.SHADOW,ji.A.prototype.traverse,this.groupNode),e.getModelViewMatrix().pop(),e.getProjectionMatrix().pop(),e.getViewVolumes().pop()}this.global||s.multLeft(n.inverse()),this.invLightSpaceProjectionMatrix.assign(s)},setGlobalVariables(e){this.modelViewMatrix.get().multVecMatrix(this.location.assign(this.lightNode._location.getValue())),this.shadowBuffer&&(this.shadowMatrix.assign(e.getView()?.inverse??Si.A.IDENTITY).multRight(e.getCameraSpaceMatrixArray()).multRight(this.invLightSpaceProjectionMatrix),this.shadowMatrixArray.set(this.shadowMatrix))},setShaderUniforms(e,t){const i=t.numLights++,n=t.x3d_Light[i];if(!n)return;if(this.shadowBuffer){const t=this.global?this.textureUnit??=this.browser.popGlobalTextureUnit():this.browser.popTextureUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.shadowBuffer.getDepthTexture()),e.uniform1i(n.shadowMap,t)}if(t.hasLight(i,this))return;const{lightNode:s,location:r}=this;e.uniform1i(n.type,2),e.uniform3f(n.color,...s.getColor()),e.uniform1f(n.intensity,s.getIntensity()),e.uniform1f(n.ambientIntensity,s.getAmbientIntensity()),e.uniform3fv(n.attenuation,s.getAttenuation()),e.uniform3f(n.location,...r),e.uniform1f(n.radius,s.getRadius()),e.uniformMatrix3fv(n.matrix,!1,this.matrixArray),this.shadowBuffer?(e.uniform3f(n.shadowColor,...s.getShadowColor()),e.uniform1f(n.shadowIntensity,s.getShadowIntensity()),e.uniform1f(n.shadowBias,s.getShadowBias()),e.uniformMatrix4fv(n.shadowMatrix,!1,this.shadowMatrixArray),e.uniform1i(n.shadowMapSize,s.getShadowMapSize())):e.uniform1f(n.shadowIntensity,0)},dispose(){const{shadowBuffer:e}=this;if(e){const{browser:t,global:i}=this;t.pushShadowBuffer(e),this.shadowBuffer=null,i&&(this.textureUnit=void 0)}this.modelViewMatrix.clear(),yf.push(this)}}),Object.assign(Object.setPrototypeOf(xf.prototype,Fs.prototype),{initialize(){Fs.prototype.initialize.call(this),this._attenuation.addInterest("set_attenuation__",this),this.set_attenuation__()},set_attenuation__(){const e=this._attenuation.getValue();this.attenuation[0]=Math.max(0,e.x),this.attenuation[1]=Math.max(0,e.y),this.attenuation[2]=Math.max(0,e.z)},getAttenuation(){return this.attenuation},getLocation(){return this._location.getValue()},getRadius(){return this._radius.getValue()},getLights:()=>yf}),Object.defineProperties(xf,{...Je.A.getStaticProperties("PointLight","Lighting",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"global",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"on",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"color",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"intensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"ambientIntensity",new c.A.SFFloat),new o.A(m.A.inputOutput,"attenuation",new c.A.SFVec3f(1,0,0)),new o.A(m.A.inputOutput,"location",new c.A.SFVec3f),new o.A(m.A.inputOutput,"radius",new c.A.SFFloat(100)),new o.A(m.A.inputOutput,"shadows",new c.A.SFBool),new o.A(m.A.inputOutput,"shadowColor",new c.A.SFColor),new o.A(m.A.inputOutput,"shadowIntensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"shadowBias",new c.A.SFFloat(.005)),new o.A(m.A.initializeOnly,"shadowMapSize",new c.A.SFInt32(1024))]),enumerable:!0}});const bf=xf,Sf=s.A.add("PointLight",bf),Tf=(0,Rs.A)(vf);function vf(){this.location=new Ee.A,this.direction=new Ee.A,this.matrixArray=new Float32Array(9),this.renderShadow=!0,this.shadowBuffer=null,this.bbox=new pi.A,this.viewVolume=new xi.A,this.viewport=new bi.A,this.projectionMatrix=new Si.A,this.modelViewMatrix=new Ms.A(Si.A),this.modelMatrix=new Si.A,this.invLightSpaceMatrix=new Si.A,this.invLightSpaceProjectionMatrix=new Si.A,this.shadowMatrix=new Si.A,this.shadowMatrixArray=new Float32Array(16),this.rotation=new Fn.A,this.lightBBoxMin=new Ee.A,this.lightBBoxMax=new Ee.A,this.textureUnit=void 0}function Of(e){Fs.call(this,e),this.addType(m.A.SpotLight),this._location.setUnit("length"),this._radius.setUnit("length"),this._beamWidth.setUnit("angle"),this._cutOffAngle.setUnit("angle"),3.3==e.getSpecificationVersion()?(this._beamWidth=.785398,this._cutOffAngle=1.5708):e.getSpecificationVersion()<=3.2&&(this._beamWidth=1.5708,this._cutOffAngle=.785398),this.attenuation=new Float32Array(3)}Object.assign(vf.prototype,{set(e,t,i){const n=e.getShadowMapSize();this.browser=e.getBrowser(),this.lightNode=e,this.groupNode=t,this.global=e.getGlobal(),this.matrixArray.set(i.submatrix.inverse()),this.modelViewMatrix.push(i),e.getShadowIntensity()>0&&n>0&&(this.shadowBuffer=this.browser.popShadowBuffer(n),this.shadowBuffer||console.warn("Couldn't create shadow buffer."))},renderShadowMap(e){if(!this.shadowBuffer)return;const t=this.lightNode,i=e.getCameraSpaceMatrix().get(),n=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),s=this.invLightSpaceMatrix.assign(this.global?n:Si.A.IDENTITY);s.translate(t.getLocation()),s.rotate(this.rotation.setFromToVec(Ee.A.Z_AXIS,this.direction.assign(t.getDirection()).negate())),s.inverse();this.groupNode.getSubBBox(this.bbox,!0).multRight(s).getExtents(this.lightBBoxMin,this.lightBBoxMax);const r=t.getShadowMapSize(),o=Math.min(t.getRadius(),-this.lightBBoxMin.z),a=this.viewport.set(0,0,r,r),l=fn.A.perspective(2*t.getCutOffAngle(),.125,Math.max(1e4,o),r,r,this.projectionMatrix);this.renderShadow=o>0,this.shadowBuffer.bind(),e.getViewVolumes().push(this.viewVolume.set(l,a,a)),e.getProjectionMatrix().push(l),e.getModelViewMatrix().push(s),e.render(ci.A.SHADOW,ji.A.prototype.traverse,this.groupNode),e.getModelViewMatrix().pop(),e.getProjectionMatrix().pop(),e.getViewVolumes().pop(),this.global||s.multLeft(n.inverse()),this.invLightSpaceProjectionMatrix.assign(s).multRight(l).multRight(t.getBiasMatrix())},setGlobalVariables(e){const t=this.lightNode,i=this.modelViewMatrix.get();i.multVecMatrix(this.location.assign(t._location.getValue())),i.multDirMatrix(this.direction.assign(t._direction.getValue())).normalize(),this.shadowBuffer&&(this.shadowMatrix.assign(e.getView()?.inverse??Si.A.IDENTITY).multRight(e.getCameraSpaceMatrixArray()).multRight(this.invLightSpaceProjectionMatrix),this.shadowMatrixArray.set(this.shadowMatrix))},setShaderUniforms(e,t){const i=t.numLights++,n=t.x3d_Light[i];if(!n)return;if(this.shadowBuffer){const t=this.global?this.textureUnit??=this.browser.popGlobalTextureUnit():this.browser.popTextureUnit();e.activeTexture(e.TEXTURE0+t),e.bindTexture(e.TEXTURE_2D,this.shadowBuffer.getDepthTexture()),e.uniform1i(n.shadowMap,t)}if(t.hasLight(i,this))return;const{lightNode:s,location:r,direction:o}=this;e.uniform1i(n.type,3),e.uniform3f(n.color,...s.getColor()),e.uniform1f(n.intensity,s.getIntensity()),e.uniform1f(n.ambientIntensity,s.getAmbientIntensity()),e.uniform3fv(n.attenuation,s.getAttenuation()),e.uniform3f(n.location,...r),e.uniform3f(n.direction,...o),e.uniform1f(n.radius,s.getRadius()),e.uniform1f(n.beamWidth,s.getBeamWidth()),e.uniform1f(n.cutOffAngle,s.getCutOffAngle()),e.uniformMatrix3fv(n.matrix,!1,this.matrixArray),this.renderShadow&&this.shadowBuffer?(e.uniform3f(n.shadowColor,...s.getShadowColor()),e.uniform1f(n.shadowIntensity,s.getShadowIntensity()),e.uniform1f(n.shadowBias,s.getShadowBias()),e.uniformMatrix4fv(n.shadowMatrix,!1,this.shadowMatrixArray),e.uniform1i(n.shadowMapSize,s.getShadowMapSize())):e.uniform1f(n.shadowIntensity,0)},dispose(){const{shadowBuffer:e}=this;if(e){const{browser:t,global:i}=this;t.pushShadowBuffer(e),this.shadowBuffer=null,i&&(this.textureUnit=void 0)}this.modelViewMatrix.clear(),Tf.push(this)}}),Object.assign(Object.setPrototypeOf(Of.prototype,Fs.prototype),{initialize(){Fs.prototype.initialize.call(this),this._attenuation.addInterest("set_attenuation__",this),this.set_attenuation__()},set_attenuation__(){const e=this._attenuation.getValue();this.attenuation[0]=Math.max(0,e.x),this.attenuation[1]=Math.max(0,e.y),this.attenuation[2]=Math.max(0,e.z)},getAttenuation(){return this.attenuation},getLocation(){return this._location.getValue()},getRadius(){return this._radius.getValue()},getBeamWidth(){const e=this._beamWidth.getValue(),t=this.getCutOffAngle();return e>t?t:W.A.clamp(e,0,Math.PI/2)},getCutOffAngle(){return W.A.clamp(this._cutOffAngle.getValue(),0,Math.PI/2)},getLights:()=>Tf}),Object.defineProperties(Of,{...Je.A.getStaticProperties("SpotLight","Lighting",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"global",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"on",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"color",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"intensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"ambientIntensity",new c.A.SFFloat),new o.A(m.A.inputOutput,"attenuation",new c.A.SFVec3f(1,0,0)),new o.A(m.A.inputOutput,"location",new c.A.SFVec3f),new o.A(m.A.inputOutput,"direction",new c.A.SFVec3f(0,0,-1)),new o.A(m.A.inputOutput,"radius",new c.A.SFFloat(100)),new o.A(m.A.inputOutput,"beamWidth",new c.A.SFFloat(.589049)),new o.A(m.A.inputOutput,"cutOffAngle",new c.A.SFFloat(1.570796)),new o.A(m.A.inputOutput,"shadows",new c.A.SFBool),new o.A(m.A.inputOutput,"shadowColor",new c.A.SFColor),new o.A(m.A.inputOutput,"shadowIntensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"shadowBias",new c.A.SFFloat(.005)),new o.A(m.A.initializeOnly,"shadowMapSize",new c.A.SFInt32(1024))]),enumerable:!0}});const Ef=Of,Nf=s.A.add("SpotLight",Ef),Cf={name:"Lighting",concreteNodes:[Bs,mf,Sf,Nf],abstractNodes:[Fs]},If=s.A.add("LightingComponent",Cf);function Ff(e){ji.A.call(this,e),this.addType(m.A.Billboard),this.matrix=new Si.A}Object.assign(Object.setPrototypeOf(Ff.prototype,ji.A.prototype),{getBBox(e,t){return this.isDefaultBBoxSize()?this.getSubBBox(e,t).multRight(this.matrix):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getMatrix(){return this.matrix},rotate:(()=>{const e=new Si.A,t=new Ee.A,i=new Ee.A,n=new Ee.A,s=new Ee.A,r=new Fn.A;return function(o){e.assign(o).inverse();const a=e.origin.normalize();if(this._axisOfRotation.getValue().equals(Ee.A.ZERO)){e.multDirMatrix(t.assign(Ee.A.Y_AXIS)).normalize();const n=a,s=t.cross(a);i.assign(a).cross(s),s.normalize(),i.normalize(),this.matrix.set(...s,0,...i,0,...n,0,0,0,0,1)}else n.assign(this._axisOfRotation.getValue()).cross(a),s.assign(this._axisOfRotation.getValue()).cross(Ee.A.Z_AXIS),this.matrix.setRotation(r.setFromToVec(s,n));return this.matrix}})(),traverse(e,t){const i=t.getModelViewMatrix();switch(i.push(),e){case ci.A.CAMERA:case ci.A.PICKING:case ci.A.SHADOW:i.multLeft(this.matrix);break;default:i.multLeft(this.rotate(i.get()))}ji.A.prototype.traverse.call(this,e,t),i.pop()}}),Object.defineProperties(Ff,{...Je.A.getStaticProperties("Billboard","Navigation",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"axisOfRotation",new c.A.SFVec3f(0,1,0)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const Mf=Ff,Rf=s.A.add("Billboard",Mf);function Pf(e){ji.A.call(this,e),na.A.call(this,e),this.addType(m.A.Collision),2==e.getSpecificationVersion()&&this.addAlias("collide",this._enabled)}Object.assign(Object.setPrototypeOf(Pf.prototype,ji.A.prototype),na.A.prototype,{initialize(){ji.A.prototype.initialize.call(this),this.getLive().addInterest("set_live__",this),this._enabled.addInterest("set_enabled__",this),this._proxy.addInterest("set_children__",this),this.set_live__()},set_live__(){this.getLive().getValue()&&this._enabled.getValue()?this.getBrowser().addCollision(this):this.getBrowser().removeCollision(this)},set_enabled__(){this._enabled.getValue()||this.set_active__(!1),this.set_live__(),this.set_children__()},set_active__(e){this._isActive.getValue()!==e&&(this._isActive=e,e&&(this._collideTime=this.getBrowser().getCurrentTime()))},set_collisionObjects__(){const e=(0,hi.A)(m.A.X3DChildNode,this._proxy);this._enabled.getValue()?e&&(this.collisionObjects.clear(),this.collisionObjects.add(e)):this.collisionObjects.clear(),ji.A.prototype.set_collisionObjects__.call(this)},traverse(e,t){if(e===ci.A.COLLISION){const i=t.getCollisions();return i.push(this),ji.A.prototype.traverse.call(this,e,t),void i.pop()}ji.A.prototype.traverse.call(this,e,t)},dispose(){ji.A.prototype.dispose.call(this)}}),Object.defineProperties(Pf,{...Je.A.getStaticProperties("Collision","Navigation",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"collideTime",new c.A.SFTime),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"proxy",new c.A.SFNode),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const Vf=Pf,Df=s.A.add("Collision",Vf);function Lf(e){ji.A.call(this,e),this.addType(m.A.LOD),this.setVisibleObject(!0),this._center.setUnit("length"),this._range.setUnit("length"),2==e.getSpecificationVersion()&&this.addAlias("level",this._children),this.frameRate=60}Object.assign(Object.setPrototypeOf(Lf.prototype,ji.A.prototype),{addChildren(){},removeChildren(){},set_addChildren__(){ji.A.prototype.set_addChildren__.call(this),this.set_children__()},set_removeChildren__(){ji.A.prototype.set_removeChildren__.call(this),this.set_children__()},set_children__(){this.clearChildren();const e=Math.min(this._level_changed.getValue(),this._children.length-1);e>=0&&e<this._children.length&&this.addChild(this._children[e]),this.set_objects__()},set_visibleObjects__(){},getLevel:function(e){if(0===this._range.length){const e=this.getBrowser();this.frameRate=(179*this.frameRate+e.currentFrameRate)/180;const t=this._children.length;switch(t){case 0:return-1;case 1:return 0;case 2:return+(this.frameRate>55);default:{const e=1-W.A.clamp((this.frameRate-20)/35,0,1);return Math.min(Math.floor(e*t),t-1)}}}const t=e.translate(this._center.getValue()).origin.norm();return W.A.upperBound(this._range,0,this._range.length,t)},changeLevel:(()=>{const e=new Si.A;return function(t){const i=this._level_changed.getValue();let n=this.getLevel(e.assign(t.getModelViewMatrix().get()));this._forceTransitions.getValue()&&(n>i?n=i+1:n<i&&(n=i-1)),n!==i&&(this._level_changed=n,this.set_children__())}})(),traverse(e,t){e===ci.A.DISPLAY&&this.changeLevel(t),ji.A.prototype.traverse.call(this,e,t)}}),Object.defineProperties(Lf,{...Je.A.getStaticProperties("LOD","Navigation",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"forceTransitions",new c.A.SFBool),new o.A(m.A.initializeOnly,"center",new c.A.SFVec3f),new o.A(m.A.initializeOnly,"range",new c.A.MFFloat),new o.A(m.A.outputOnly,"level_changed",new c.A.SFInt32(-1)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const Bf=Lf,kf=s.A.add("LOD",Bf);var jf=n(1997),Uf=n(3278);function Xf(e){ai.A.call(this,e),this.addType(m.A.ViewpointGroup),this.setCameraObject(!0),this.setVisibleObject(!0),this._size.setUnit("length"),this._center.setUnit("length"),this.proximitySensor=new Ru(e),this.cameraObjects=[],this.viewpointGroups=[]}Object.assign(Object.setPrototypeOf(Xf.prototype,ai.A.prototype),{initialize(){ai.A.prototype.initialize.call(this),this._size.addInterest("set_size__",this),this._children.addInterest("set_children__",this),this._size.addFieldInterest(this.proximitySensor._size),this._center.addFieldInterest(this.proximitySensor._center),this.proximitySensor._isActive.addInterest("set_active__",this),this.proximitySensor._size=this._size,this.proximitySensor._center=this._center,this.proximitySensor.setup(),this.set_size__(),this.set_children__()},getDisplayed(){return this.displayed},set_size__(){this.proximitySensor._enabled=!this._size.getValue().equals(Ee.A.ZERO),this.set_active__()},set_active__(){const e=this.proximitySensor;this.active=e._isActive.getValue()||!e._enabled.getValue(),this.displayed=this._displayed.getValue()&&this.active},set_children__(){this.cameraObjects.length=0,this.viewpointGroups.length=0;for(const e of this._children){const t=(0,hi.A)(m.A.X3DChildNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DViewpointNode:this.cameraObjects.push(t);break;case m.A.ViewpointGroup:this.cameraObjects.push(t),this.viewpointGroups.push(t);break;default:continue}break}}this.setCameraObject(this.cameraObjects.length),this.setVisibleObject(this.cameraObjects.length)},traverse(e,t){switch(this.proximitySensor.traverse(e,t),e){case ci.A.CAMERA:t.getViewpointGroups().push(this);for(const i of this.cameraObjects)i.traverse(e,t);return void t.getViewpointGroups().pop();case ci.A.DISPLAY:if(this.active)for(const i of this.viewpointGroups)i.traverse(e,t);return}}}),Object.defineProperties(Xf,{...Je.A.getStaticProperties("ViewpointGroup","Navigation",3,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"displayed",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"retainUserOffsets",new c.A.SFBool),new o.A(m.A.inputOutput,"size",new c.A.SFVec3f),new o.A(m.A.inputOutput,"center",new c.A.SFVec3f),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const zf=Xf,Gf=s.A.add("ViewpointGroup",zf),Hf={name:"Navigation",concreteNodes:[Rf,Df,kf,jf.A,_n,Uf.A,Gf],abstractNodes:[pn.A]},$f=s.A.add("NavigationComponent",Hf),Yf=(0,Rs.A)(qf);function qf(){this.node=null,this.hit=null,this.modelViewMatrix=new Si.A,this.projectionMatrix=new Si.A,this.viewport=new bi.A}function Wf(e){na.A.call(this,e),this.addType(m.A.X3DPointingDeviceSensorNode)}Object.assign(qf.prototype,{set(e,t,i,n){this.node=e,this.modelViewMatrix.assign(t),this.projectionMatrix.assign(i),this.viewport.assign(n)},set_over__(e,t){this.node.set_over__(e,t,this.modelViewMatrix,this.projectionMatrix,this.viewport)},set_active__(e,t){this.node.set_active__(e,t,this.modelViewMatrix,this.projectionMatrix,this.viewport)},set_motion__(e){this.node.set_motion__(e,this.modelViewMatrix,this.projectionMatrix,this.viewport)},dispose(){this.hit=null,Yf.push(this)}}),Object.assign(Object.setPrototypeOf(Wf.prototype,na.A.prototype),{initialize(){na.A.prototype.initialize.call(this),this.getLive().addInterest("set_live__",this),this._enabled.addInterest("set_live__",this),this.set_live__()},set_live__(){this.getLive().getValue()&&this._enabled.getValue()?(this.getBrowser().addPointingDeviceSensor(this),delete this.push):(this.getBrowser().removePointingDeviceSensor(this),this._isActive.getValue()&&(this._isActive=!1),this._isOver.getValue()&&(this._isOver=!1),this.push=Function.prototype)},set_over__(e,t){e!==this._isOver.getValue()&&(this._isOver=e,e&&this.getBrowser().setDescription(this._description))},set_active__(e,t){e!==this._isActive.getValue()&&(this._isActive=e)},set_motion__(e){},push(e,t){const i=Yf.pop();i.set(this,e.getModelViewMatrix().get(),e.getProjectionMatrix().get(),e.getViewVolume().getViewport()),this.getBrowser().addSensor(i),t.push(i)}}),Object.defineProperties(Wf,Je.A.getStaticProperties("X3DPointingDeviceSensorNode","PointingDeviceSensor",1));const Kf=Wf,Zf=s.A.add("X3DPointingDeviceSensorNode",Kf);function Qf(e){Zf.call(this,e),this.addType(m.A.X3DTouchSensorNode)}Object.assign(Object.setPrototypeOf(Qf.prototype,Zf.prototype),{set_active__(e,t){Zf.prototype.set_active__.call(this,e,t),this._enabled.getValue()&&this._isOver.getValue()&&!e&&(this._touchTime=this.getBrowser().getCurrentTime())},set_over__:(()=>{const e=new Si.A,t=new It.A,i=new Ee.A,n=new Ee.A;return function(s,r,o,a,l){Zf.prototype.set_over__.call(this,s,r,o,a,l),this._isOver.getValue()&&(e.assign(o).inverse(),t.assign(r.texCoord).divide(r.texCoord.w),i.assign(r.normal),n.assign(r.point),this._hitTexCoord_changed=t,this._hitNormal_changed=o.multMatrixDir(i).normalize(),this._hitPoint_changed=e.multVecMatrix(n))}})()}),Object.defineProperties(Qf,Je.A.getStaticProperties("X3DTouchSensorNode","PointingDeviceSensor",1));const Jf=Qf,em=s.A.add("X3DTouchSensorNode",Jf);function tm(e){em.call(this,e),this.addType(m.A.TouchSensor),this._hitPoint_changed.setUnit("length")}Object.setPrototypeOf(tm.prototype,em.prototype),Object.defineProperties(tm,{...Je.A.getStaticProperties("TouchSensor","PointingDeviceSensor",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.outputOnly,"hitTexCoord_changed",new c.A.SFVec2f),new o.A(m.A.outputOnly,"hitNormal_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"hitPoint_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"isOver",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"touchTime",new c.A.SFTime)]),enumerable:!0}});const im=tm,nm=s.A.add("TouchSensor",im);function sm(e){ji.A.call(this,e),Ma.A.call(this,e),this.addType(m.A.Anchor),this.touchSensorNode=new nm(e),this.anchorSensors=[]}Object.assign(Object.setPrototypeOf(sm.prototype,ji.A.prototype),Ma.A.prototype,{initialize(){ji.A.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),this._description.addFieldInterest(this.touchSensorNode._description),this._load.addFieldInterest(this.touchSensorNode._enabled),this.touchSensorNode._description=this._description,this.touchSensorNode._enabled=this._load,this.touchSensorNode.setup(),this.touchSensorNode.set_active__=(e,t)=>{nm.prototype.set_active__.call(this.touchSensorNode,e,t),this.touchSensorNode._isOver.getValue()&&!e&&this.requestImmediateLoad().catch(Function.prototype)}},set_load__(){},set_url__(){},requestImmediateLoad(e=!0){return this.setCache(e),this.setLoadState(m.A.IN_PROGRESS_STATE,!1),new Promise((e,t)=>{new Ra.default(this).createX3DFromURL(this._url,this._parameter,i=>{i?(this.getBrowser().replaceWorld(i),this.setLoadState(m.A.COMPLETE_STATE,!1),e()):(this.setLoadState(m.A.FAILED_STATE,!1),t())},t=>{this.getBrowser().changeViewpoint(t),this.setLoadState(m.A.COMPLETE_STATE,!1),e()},(t,i)=>{i?window.open(t,i):location=t,this.setLoadState(m.A.COMPLETE_STATE,!1),e()})})},requestUnload(){},traverse(e,t){if(e===ci.A.POINTER){const i=this.anchorSensors;i.length=0,this.touchSensorNode.push(t,i),i.length?(t.getSensors().push(i),ji.A.prototype.traverse.call(this,e,t),t.getSensors().pop()):ji.A.prototype.traverse.call(this,e,t)}else ji.A.prototype.traverse.call(this,e,t)},dispose(){Ma.A.prototype.dispose.call(this),ji.A.prototype.dispose.call(this)}}),Object.defineProperties(sm,{...Je.A.getStaticProperties("Anchor","Networking",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"parameter",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f),new o.A(m.A.inputOnly,"addChildren",new c.A.MFNode),new o.A(m.A.inputOnly,"removeChildren",new c.A.MFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const rm=sm,om=s.A.add("Anchor",rm);function am(e){ai.A.call(this,e),Ma.A.call(this,e),li.A.call(this,e),this.addType(m.A.Inline),e.getSpecificationVersion()<=3.3&&(this._global=!0),this.scene=this.getBrowser().getDefaultScene(),this.groupNode=new fp.A(e),this.localLights=[],this.localShadows=!1}Object.assign(Object.setPrototypeOf(am.prototype,ai.A.prototype),Ma.A.prototype,li.A.prototype,{initialize(){ai.A.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),li.A.prototype.initialize.call(this),this.groupNode.setPrivate(!0),this.groupNode.setup(),this.connectChildNode(this.groupNode),this.requestImmediateLoad().catch(Function.prototype)},getBBox(e,t){return this.isDefaultBBoxSize()?this.groupNode.getBBox(e,t):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getShapes(e,t){return this.groupNode.getShapes(e,t)},unloadData(){this.abortLoading(),this.setInternalScene(this.getBrowser().getDefaultScene())},loadData(){this.abortLoading(),this.fileLoader=new Ra.default(this).createX3DFromURL(this._url,null,this.setInternalSceneAsync.bind(this))},abortLoading(){this.scene._loadCount.removeInterest("checkLoadCount",this),this.fileLoader&&this.fileLoader.abort()},setInternalSceneAsync(e){e?(e._loadCount.addInterest("checkLoadCount",this),this.setInternalScene(e),this.checkLoadCount(e._loadCount)):(this.setInternalScene(this.getBrowser().getDefaultScene()),this.setLoadState(m.A.FAILED_STATE))},checkLoadCount(e){e.getValue()||(e.removeInterest("checkLoadCount",this),this.setLoadState(m.A.COMPLETE_STATE))},setInternalScene(e){this.scene!==this.getBrowser().getDefaultScene()&&this.scene.dispose(),this.scene=e,this.scene!==this.getBrowser().getDefaultScene()?(this.scene.setExecutionContext(this.getExecutionContext()),this.scene.setLive(!0),this.scene.rootNodes.addFieldInterest(this.groupNode._children),this.groupNode._children=this.scene.rootNodes):this.groupNode._children.length=0,this.getBrowser().addBrowserEvent()},getInternalScene(){return this.scene},traverse(e,t){switch(e){case ci.A.PICKING:{const i=this.getBrowser().getPickingHierarchy();return i.push(this),this.groupNode.traverse(e,t),void i.pop()}case ci.A.DISPLAY:if(this._global.getValue())this.groupNode.traverse(e,t);else{const i=t.getGlobalLights(),n=t.getGlobalShadows(),s=i.length,r=n.length,o=this.localLights,a=o.length,l=o.map(e=>e.lightNode.getLightKey());if(a&&(t.getLocalObjects().push(...o),t.pushLocalShadows(this.localShadows),t.getLocalObjectsKeys().push(...l)),this.groupNode.traverse(e,t),a){if(t.isIndependent()){const e=this.getBrowser();for(let i=0;i<a;++i)e.getLocalObjects().push(t.getLocalObjects().pop())}else for(let e=0;e<a;++e)t.getLocalObjects().pop();t.popLocalShadows(),t.getLocalObjectsKeys().length-=l.length}const h=i.length-s;for(let e=0;e<h;++e){const t=i[s+e];t.groupNode=this.groupNode,t.global=!1,o[e]=t}o.length=h,this.localShadows=n.at(-1),i.length=s,n.length=r}return;default:return void this.groupNode.traverse(e,t)}},dispose(){const e=this.getExecutionContext();for(const t of Array.from(e.getImportedNodes()))t.getInlineNode()===this&&e.removeImportedNode(t.getImportedName());li.A.prototype.dispose.call(this),Ma.A.prototype.dispose.call(this),ai.A.prototype.dispose.call(this)}}),Object.defineProperties(am,{...Je.A.getStaticProperties("Inline","Networking",2,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"global",new c.A.SFBool),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600)),new o.A(m.A.inputOutput,"visible",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"bboxDisplay",new c.A.SFBool),new o.A(m.A.initializeOnly,"bboxSize",new c.A.SFVec3f(-1,-1,-1)),new o.A(m.A.initializeOnly,"bboxCenter",new c.A.SFVec3f)]),enumerable:!0}});const lm=am,hm={name:"Networking",concreteNodes:[om,s.A.add("Inline",lm),ha],abstractNodes:[oa,Ma.A]},cm=s.A.add("NetworkingComponent",hm);function um(e){Zf.call(this,e),this.addType(m.A.X3DDragSensorNode),this._trackPoint_changed.setUnit("length")}Object.setPrototypeOf(um.prototype,Zf.prototype),Object.defineProperties(um,Je.A.getStaticProperties("X3DDragSensorNode","PointingDeviceSensor",1));const dm=um,pm=s.A.add("X3DDragSensorNode",dm);var gm=n(1522);function fm(e=new Ar.A,t=1){this.axis=new Ar.A,this.set(e,t)}Object.assign(fm.prototype,{copy(){const e=Object.create(fm.prototype);return e.radius=this.radius,e.axis=this.axis.copy(),e},assign(e){return this.radius=e.radius,this.axis.assign(e.axis),this},equals(e){return this.radius===e.radius&&this.axis.equals(e.axis)},set(e=new Ar.A,t=1){this.axis.assign(e),this.radius=t},intersectsLine(e,t,i){const n=new Fn.A(this.axis.direction,new Ee.A(0,1,0)),s=Si.A.Rotation(n),r=1/this.radius,o=new Si.A;o.scale(new Ee.A(r)),o.multLeft(s);const a=e.point.copy().subtract(this.axis.point),l=new Ar.A(a,e.direction).multLineMatrix(o);if(!this.unitCylinderIntersectsLine(l,t,i))return!1;const h=o.inverse();return h.multVecMatrix(t),t.add(this.axis.point),h.multVecMatrix(i),i.add(this.axis.point),!0},unitCylinderIntersectsLine(e,t,i){let n,s;const r=e.point,o=e.direction,a=o[0]*o[0]+o[2]*o[2],l=2*(r[0]*o[0]+r[2]*o[2]),h=r[0]*r[0]+r[2]*r[2]-1,c=l*l-4*a*h;if(c<0)return!1;const u=Math.sqrt(c);return l>0?(n=-2*h/(u+l),s=-(u+l)/(2*a)):(n=2*h/(u-l),s=(u-l)/(2*a)),t.assign(o).multiply(n).add(r),i.assign(o).multiply(s).add(r),!0},toString(){return`${this.axis}, ${this.radius}`}});const mm=fm,Am=s.A.add("Cylinder3",mm);function _m(e){pm.call(this,e),this.addType(m.A.CylinderSensor),this._diskAngle.setUnit("angle"),this._minAngle.setUnit("angle"),this._maxAngle.setUnit("angle"),this._offset.setUnit("angle")}Object.assign(Object.setPrototypeOf(_m.prototype,pm.prototype),{initialize(){pm.prototype.initialize.call(this),this._axisRotation.addInterest("set_fields__",this),this._diskAngle.addInterest("set_fields__",this),this.modelViewMatrix=new Si.A,this.invModelViewMatrix=new Si.A,this.cylinder=new Am(new Ar.A,0),this.disk=!1,this.yPlane=null,this.zPlane=null,this.sxPlane=null,this.szNormal=null,this.behind=!1,this.fromVector=new Ee.A,this.startOffset=new Fn.A},isBehind(e,t){const i=new Ee.A,n=new Ee.A;return this.cylinder.intersectsLine(e,i,n),t.distance(i)>t.distance(n)},getTrackPoint(e,t){const i=new Ee.A;this.zPlane.intersectsLine(e,i);const n=i.copy().add(this.cylinder.axis.getPerpendicularVectorToPoint(i,new Ee.A)),s=this.sxPlane.getDistanceToPoint(i)/this.cylinder.radius,r=Math.floor((s+1)/2),o=W.A.interval(s,-1,1),a=(0===r?Math.asin(o):o*Math.PI/2)+r*Math.PI;new Fn.A(this.cylinder.axis.direction,a).multVecRot(t.assign(this.szNormal).multiply(this.cylinder.radius)),t.add(n)},getAngle(e){return e.getAxis(new Ee.A).dot(this.cylinder.axis.direction)>0?e.angle:-e.angle},set_fields__(){this._isActive.getValue()&&(this.activate(this.activateHit),this.set_motion__(this.motionHit??this.activateHit))},set_active__(e,t,i,n,s){pm.prototype.set_active__.call(this,e,t,i,n,s),this._isActive.getValue()?(this.activateHit=t.copy(),this.motionHit=null,this.modelViewMatrix.assign(i),this.invModelViewMatrix.assign(i).inverse(),this.activate(t)):this._autoOffset.getValue()&&(this._offset=this.getAngle(this._rotation_changed.getValue()))},activate(e){const t=e.ray.copy().multLineMatrix(this.invModelViewMatrix),i=this.invModelViewMatrix.multVecMatrix(e.point.copy()),n=this._axisRotation.getValue().multVecRot(new Ee.A(0,1,0)),s=this.invModelViewMatrix.multDirMatrix(new Ee.A(0,0,1)).normalize(),r=new Ar.A(Ee.A.ZERO,n),o=r.getPerpendicularVectorToPoint(i,new Ee.A).norm();this.cylinder=new Am(r,o),this.disk=Math.abs(s.dot(n))>Math.cos(this._diskAngle.getValue()),this.behind=this.isBehind(t,i),this.yPlane=new gm.A(i,n),this.zPlane=new gm.A(i,s);const a=this.invModelViewMatrix.origin,l=n.copy().cross(a).normalize();this.sxPlane=new gm.A(Ee.A.ZERO,l),this.szNormal=l.copy().cross(n).normalize();const h=new Ee.A;this.disk?this.yPlane.intersectsLine(t,h):this.getTrackPoint(t,h),this.fromVector=this.cylinder.axis.getPerpendicularVectorToPoint(h,new Ee.A).negate(),this.startOffset=new Fn.A(n,this._offset.getValue()),this._trackPoint_changed=h,this._rotation_changed=this.startOffset,this.angle=this._offset.getValue(),this.startVector=this._rotation_changed.getValue().multVecRot(this._axisRotation.getValue().multVecRot(new Ee.A(0,0,1)))},set_motion__(e){this.motionHit=e.copy();const t=e.ray.copy().multLineMatrix(this.invModelViewMatrix),i=new Ee.A;this.disk?this.yPlane.intersectsLine(t,i):this.getTrackPoint(t,i),this._trackPoint_changed=i;const n=this.cylinder.axis.getPerpendicularVectorToPoint(i,new Ee.A).negate(),s=new Fn.A(this.fromVector,n);if(this.disk){this.modelViewMatrix.multVecMatrix(i.copy()).z>0&&s.multRight(new Fn.A(this.yPlane.normal,Math.PI))}else this.behind&&s.inverse();if(s.multLeft(this.startOffset),this._minAngle.getValue()>this._maxAngle.getValue())this._rotation_changed=s;else{const e=s.multVecRot(this._axisRotation.getValue().multVecRot(new Ee.A(0,0,1))),t=new Fn.A(this.startVector,e),i=this._axisRotation.getValue().multVecRot(new Ee.A(0,1,0)).dot(t.getAxis(new Ee.A))>0?1:-1,n=this._minAngle.getValue(),r=this._maxAngle.getValue();this.angle+=i*t.angle,this.startVector.assign(e),this.angle<n?s.setAxisAngle(this.cylinder.axis.direction,n):this.angle>r?s.setAxisAngle(this.cylinder.axis.direction,r):s.setAxisAngle(this.cylinder.axis.direction,this.angle),this._rotation_changed.getValue().equals(s)||(this._rotation_changed=s)}}}),Object.defineProperties(_m,{...Je.A.getStaticProperties("CylinderSensor","PointingDeviceSensor",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"axisRotation",new c.A.SFRotation(0,0,1,0)),new o.A(m.A.inputOutput,"diskAngle",new c.A.SFFloat(.26179167)),new o.A(m.A.inputOutput,"minAngle",new c.A.SFFloat),new o.A(m.A.inputOutput,"maxAngle",new c.A.SFFloat(-1)),new o.A(m.A.inputOutput,"offset",new c.A.SFFloat),new o.A(m.A.inputOutput,"autoOffset",new c.A.SFBool(!0)),new o.A(m.A.outputOnly,"trackPoint_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"rotation_changed",new c.A.SFRotation),new o.A(m.A.outputOnly,"isOver",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool)]),enumerable:!0}});const ym=_m,wm=s.A.add("CylinderSensor",ym);function xm(e=It.A.ZERO,t=It.A.Y_AXIS){this.point=new It.A,this.direction=new It.A,this.set(e,t)}Object.assign(xm.prototype,{copy(){const e=Object.create(xm.prototype);return e.point=this.point.copy(),e.direction=this.direction.copy(),e},assign(e){return this.point.assign(e.point),this.direction.assign(e.direction),this},equals(e){return this.point.equals(e.point)&&this.direction.equals(e.direction)},set(e=It.A.ZERO,t=It.A.Y_AXIS){return this.point.assign(e),this.direction.assign(t),this},setPoints(e,t){return this.point.assign(e),this.direction.assign(t).subtract(e).normalize(),this},multMatrixLine(e){return e.multMatrixVec(this.point),e.multMatrixDir(this.direction).normalize(),this},multLineMatrix(e){return e.multVecMatrix(this.point),e.multDirMatrix(this.direction).normalize(),this},getClosestPointToPoint(e,t=new It.A){const i=t.assign(e).subtract(this.point).dot(this.direction);return t.assign(this.direction).multiply(i).add(this.point)},getPerpendicularVectorToPoint:(()=>{const e=new It.A;return function(t,i=new It.A){return i.assign(this.point).subtract(t),i.subtract(e.assign(this.direction).multiply(i.dot(this.direction)))}})(),intersectsLine:(()=>{const e=new It.A;return function(t,i){const{point:n,direction:s}=this,{point:r,direction:o}=t,a=s.dot(o);if(Math.abs(a)>=1)return!1;e.assign(r).subtract(n);const l=(e.dot(s)-a*e.dot(o))/(1-a*a);return i.assign(s).multiply(l).add(n),!0}})(),toString(){return`${this.point}, ${this.direction}`}}),Object.assign(xm,{Points(e,t){const i=Object.create(xm.prototype);return i.point=e.copy(),i.direction=t.copy().subtract(e).normalize(),i}});const bm=xm,Sm=new(s.A.add("Line2",bm)),Tm=new It.A,vm=new Ar.A;function Om(e){pm.call(this,e),this.addType(m.A.PlaneSensor),this._offset.setUnit("length"),this._minPosition.setUnit("length"),this._maxPosition.setUnit("length"),this._translation_changed.setUnit("length")}Object.assign(Object.setPrototypeOf(Om.prototype,pm.prototype),{initialize(){pm.prototype.initialize.call(this),this._axisRotation.addInterest("set_fields__",this),this._minPosition.addInterest("set_fields__",this),this._maxPosition.addInterest("set_fields__",this),this.modelViewMatrix=new Si.A,this.invModelViewMatrix=new Si.A,this.projectionMatrix=new Si.A,this.viewport=new bi.A,this.planeSensor=!0,this.plane=null,this.line=null,this.startOffset=new Ee.A,this.startPoint=new Ee.A},getLineTrackPoint(e,t,i){return xi.A.projectLine(t,this.modelViewMatrix,this.projectionMatrix,this.viewport,Sm),Sm.getClosestPointToPoint(e,Tm),xi.A.unProjectRay(Tm.x,Tm.y,this.modelViewMatrix,this.projectionMatrix,this.viewport,vm),t.getClosestPointToLine(vm,i)},set_fields__(){this._isActive.getValue()&&(this.activate(this.activateHit),this.set_motion__(this.motionHit??this.activateHit))},set_active__(e,t,i,n,s){pm.prototype.set_active__.call(this,e,t,i,n,s),this._isActive.getValue()?(this.activateHit=t.copy(),this.motionHit=null,this.modelViewMatrix.assign(i),this.projectionMatrix.assign(n),this.viewport.assign(s),this.invModelViewMatrix.assign(i).inverse(),this.activate(t)):this._autoOffset.getValue()&&(this._offset=this._translation_changed)},activate(e){const t=e.ray.copy().multLineMatrix(this.invModelViewMatrix),i=this.invModelViewMatrix.multVecMatrix(e.point.copy()),n=this._axisRotation.getValue();if(this._minPosition.x===this._maxPosition.x){this.planeSensor=!1;const e=n.multVecRot(new Ee.A(0,Math.abs(this._maxPosition.y-this._minPosition.y),0));this.line=new Ar.A(i,e.normalize())}else if(this._minPosition.y===this._maxPosition.y){this.planeSensor=!1;const e=n.multVecRot(new Ee.A(Math.abs(this._maxPosition.x-this._minPosition.x),0,0));this.line=new Ar.A(i,e.normalize())}else this.planeSensor=!0,this.plane=new gm.A(i,n.multVecRot(new Ee.A(0,0,1)));if(this.planeSensor)this.plane.intersectsLine(t,this.startPoint)&&this.trackStart(this.startPoint);else if(this.getLineTrackPoint(e.pointer,this.line,this.startPoint)){const t=new Ee.A;try{this.getLineTrackPoint(e.pointer,new Ar.A(this.line.direction,this.line.direction),t)}catch{t.assign(this.startPoint)}this.trackStart(t)}},trackStart(e){this.startOffset.assign(this._offset.getValue()),this._trackPoint_changed=e,this._translation_changed=this._offset.getValue()},set_motion__(e){try{if(this.motionHit=e.copy(),this.planeSensor){const t=e.ray.copy().multLineMatrix(this.invModelViewMatrix),i=new Ee.A;if(!this.plane.intersectsLine(t,i))throw new Error("Plane and line are parallel.");this.track(i,i.copy())}else{const t=new Ee.A,i=new Ee.A;if(!this.getLineTrackPoint(e.pointer,this.line,t))throw new Error("Lines are parallel.");try{this.getLineTrackPoint(e.pointer,new Ar.A(Ee.A.ZERO,this.line.direction),i)}catch{i.assign(t)}this.track(t,i)}}catch{this._trackPoint_changed.addEvent(),this._translation_changed.addEvent()}},track(e,t){const i=this._axisRotation.getValue(),n=i.copy().inverse().multVecRot(e.add(this.startOffset).subtract(this.startPoint));this._minPosition.x>this._maxPosition.x||(n.x=W.A.clamp(n.x,this._minPosition.x,this._maxPosition.x)),this._minPosition.y>this._maxPosition.y||(n.y=W.A.clamp(n.y,this._minPosition.y,this._maxPosition.y)),i.multVecRot(n),this._trackPoint_changed.getValue().equals(t)||(this._trackPoint_changed=t),this._translation_changed.getValue().equals(n)||(this._translation_changed=n)}}),Object.defineProperties(Om,{...Je.A.getStaticProperties("PlaneSensor","PointingDeviceSensor",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"axisRotation",new c.A.SFRotation),new o.A(m.A.inputOutput,"autoOffset",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"offset",new c.A.SFVec3f),new o.A(m.A.inputOutput,"minPosition",new c.A.SFVec2f),new o.A(m.A.inputOutput,"maxPosition",new c.A.SFVec2f(-1,-1)),new o.A(m.A.outputOnly,"trackPoint_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"translation_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"isOver",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool)]),enumerable:!0}});const Em=Om,Nm=s.A.add("PlaneSensor",Em);function Cm(e=1,t=Ee.A.ZERO){this.center=new Ee.A,this.set(e,t)}Object.assign(Cm.prototype,{copy(){const e=Object.create(Cm.prototype);return e.radius=this.radius,e.center=this.center.copy(),e},assign(e){return this.radius=e.radius,this.center.assign(e.center),this},equals(e){return this.radius===e.radius&&this.center.equals(e.center)},set(e=1,t=Ee.A.ZERO){return this.radius=e,this.center.assign(t),this},intersectsLine(e,t,i){const{point:n,direction:s}=e,{center:r,radius:o}=this,a=2*(n.dot(s)-r.dot(s)),l=a*a-4*(n.x*n.x+n.y*n.y+n.z*n.z+(r.x*r.x+r.y*r.y+r.z*r.z)-2*n.dot(r)-o*o);if(l>=0){let e=(-a+Math.sqrt(l))/2,r=(-a-Math.sqrt(l))/2;if(e>r){const t=e;e=r,r=t}return t.assign(s).multiply(e).add(n),i.assign(s).multiply(r).add(n),!0}return!1},toString(){return`${this.radius} ${this.center}`}});const Im=Cm,Fm=s.A.add("Sphere3",Im);function Mm(e){pm.call(this,e),this.addType(m.A.SphereSensor)}Object.assign(Object.setPrototypeOf(Mm.prototype,pm.prototype),{initialize(){pm.prototype.initialize.call(this),this.modelViewMatrix=new Si.A,this.invModelViewMatrix=new Si.A,this.sphere=null,this.zPlane=null,this.behind=!1,this.fromVector=new Ee.A,this.startPoint=new Ee.A,this.startOffset=new Fn.A},getTrackPoint(e,t,i){const n=new Ee.A;return!!this.sphere.intersectsLine(e,t,n)&&((e.point.distance(n)<e.point.distance(t))-i&&t.assign(n),!0)},set_active__(e,t,i,n,s){if(pm.prototype.set_active__.call(this,e,t,i,n,s),this._isActive.getValue()){this.modelViewMatrix.assign(i),this.invModelViewMatrix.assign(i).inverse();const e=this.invModelViewMatrix.multVecMatrix(t.point.copy()),n=new Ee.A;this.zPlane=new gm.A(n,this.invModelViewMatrix.multDirMatrix(new Ee.A(0,0,1)).normalize()),this.sphere=new Fm(e.norm(),n),this.behind=this.zPlane.getDistanceToPoint(e)<0,this.fromVector.assign(e),this.startPoint.assign(e),this.startOffset.assign(this._offset.getValue()),this._trackPoint_changed=e,this._rotation_changed=this._offset.getValue()}else this._autoOffset.getValue()&&(this._offset=this._rotation_changed)},set_motion__(e){const t=e.ray.copy().multLineMatrix(this.invModelViewMatrix),i=new Ee.A;if(this.getTrackPoint(t,i,this.behind)){const e=this.invModelViewMatrix.multDirMatrix(new Ee.A(0,0,1)).normalize();this.zPlane=new gm.A(i,e)}else{const e=new Ee.A;this.zPlane.intersectsLine(t,e),t.set(e,this.sphere.center.copy().subtract(e).normalize()),this.getTrackPoint(t,i,!1);const n=ut.A.normal(this.sphere.center,i,this.startPoint,new Ee.A),s=i.copy().subtract(this.sphere.center).normalize(),r=n.copy().cross(s).normalize(),o=i.copy().subtract(r.multiply(e.copy().subtract(i).norm()));t.set(o,this.sphere.center.copy().subtract(o).normalize()),this.getTrackPoint(t,i,!1)}this._trackPoint_changed=i;const n=i.copy().subtract(this.sphere.center),s=new Fn.A(this.fromVector,n);this.behind&&s.inverse(),this._rotation_changed=this.startOffset.copy().multRight(s)}}),Object.defineProperties(Mm,{...Je.A.getStaticProperties("SphereSensor","PointingDeviceSensor",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"autoOffset",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"offset",new c.A.SFRotation(0,1,0,0)),new o.A(m.A.outputOnly,"trackPoint_changed",new c.A.SFVec3f),new o.A(m.A.outputOnly,"rotation_changed",new c.A.SFRotation),new o.A(m.A.outputOnly,"isOver",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool)]),enumerable:!0}});const Rm=Mm,Pm={name:"PointingDeviceSensor",concreteNodes:[wm,Nm,s.A.add("SphereSensor",Rm),nm],abstractNodes:[pm,Zf,em]},Vm=s.A.add("PointingDeviceSensorComponent",Pm),Dm=(0,Rs.A)(Lm);function Lm(){this.plane=new gm.A,this.planeView=new gm.A}function Bm(e){ai.A.call(this,e),this.addType(m.A.ClipPlane),this.enabled=!1,this.plane=new bi.A}Object.assign(Lm.prototype,{isClipPlane:!0,set(e,t){const i=this.plane,n=e.plane;i.normal.assign(n),i.distanceFromOrigin=-n.w,i.multRight(t)},setShaderUniforms(e,t,i){const n=i?.getView(),s=n?this.planeView.assign(this.plane).multRight(n.matrix):this.plane;e.uniform4f(t.x3d_ClipPlane[t.numClipPlanes++],...s.normal,s.distanceFromOrigin)},dispose(){Dm.push(this)}}),Object.assign(Object.setPrototypeOf(Bm.prototype,ai.A.prototype),{getClipPlaneKey:()=>0,initialize(){ai.A.prototype.initialize.call(this),this._enabled.addInterest("set_enabled__",this),this._plane.addInterest("set_enabled__",this),this.set_enabled__()},set_enabled__(){this.plane.assign(this._plane.getValue()),this.enabled=this._enabled.getValue()&&!this.plane.equals(bi.A.ZERO)},push(e){if(this.enabled){const t=Dm.pop();t.set(this,e.getModelViewMatrix().get()),e.getLocalObjects().push(t),e.getLocalObjectsKeys().push(this.getClipPlaneKey())}},pop(e){this.enabled&&(this.getBrowser().getLocalObjects().push(e.getLocalObjects().pop()),e.getLocalObjectsKeys().pop())}}),Object.defineProperties(Bm,{...Je.A.getStaticProperties("ClipPlane","Rendering",5,"children","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"plane",new c.A.SFVec4f(0,1,0,0))]),enumerable:!0}});const km=Bm,jm=s.A.add("ClipPlane",km);function Um(e){wt.call(this,e),this.addType(m.A.CoordinateDouble)}Object.setPrototypeOf(Um.prototype,wt.prototype),Object.defineProperties(Um,{...Je.A.getStaticProperties("CoordinateDouble","Rendering",1,"coord","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"point",new c.A.MFVec3d)]),enumerable:!0}});const Xm=Um,zm=s.A.add("CoordinateDouble",Xm);function Gm(e){ct.call(this,e),this.addType(m.A.IndexedTriangleFanSet),this.triangleIndex=[]}Object.assign(Object.setPrototypeOf(Gm.prototype,ct.prototype),{initialize(){ct.prototype.initialize.call(this),this._set_index.addFieldInterest(this._index),this._index.addInterest("set_index__",this),this.set_index__()},set_index__(){const e=this._index,t=this.triangleIndex,i=e.length;t.length=0;for(let n=0;n<i;++n){const s=e[n];if(!(s<0)&&++n<i){let r=e[n];if(r<0)continue;for(++n;n<i;++n){const i=e[n];if(i<0)break;t.push(s,r,i),r=i}}}},getPolygonIndex(e){return this.triangleIndex[e]},getVerticesPerPolygon:()=>3,getNumVertices(){return this.checkVertexCount(this.triangleIndex.length,3)},build(){ct.prototype.build.call(this,3,this.triangleIndex.length,3,this.triangleIndex.length)}}),Object.defineProperties(Gm,{...Je.A.getStaticProperties("IndexedTriangleFanSet","Rendering",3,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_index",new c.A.MFInt32),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"index",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const Hm=Gm,$m=s.A.add("IndexedTriangleFanSet",Hm);function Ym(e){ct.call(this,e),this.addType(m.A.IndexedTriangleSet)}Object.assign(Object.setPrototypeOf(Ym.prototype,ct.prototype),{getPolygonIndex(e){return this._index[e]},getVerticesPerPolygon:()=>3,getNumVertices(){return this.checkVertexCount(this._index.length,3)},initialize(){ct.prototype.initialize.call(this),this._set_index.addFieldInterest(this._index)},build(){ct.prototype.build.call(this,3,this._index.length,3,this._index.length)}}),Object.defineProperties(Ym,{...Je.A.getStaticProperties("IndexedTriangleSet","Rendering",3,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_index",new c.A.MFInt32),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"index",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const qm=Ym,Wm=s.A.add("IndexedTriangleSet",qm);function Km(e){ct.call(this,e),this.addType(m.A.IndexedTriangleStripSet),this.triangleIndex=[]}Object.assign(Object.setPrototypeOf(Km.prototype,ct.prototype),{initialize(){ct.prototype.initialize.call(this),this._set_index.addFieldInterest(this._index),this._index.addInterest("set_index__",this),this.set_index__()},set_index__(){const e=this._index,t=this.triangleIndex,i=e.length;t.length=0;for(let n=0;n<i;++n){let s=e[n];if(!(s<0)&&++n<i){let r=e[n];if(r<0)continue;++n;for(let o=0;n<i;++n,++o){const i=e[n];if(i<0)break;t.push(s,r,i),1&o?r=i:s=i}}}},getPolygonIndex(e){return this.triangleIndex[e]},getVerticesPerPolygon:()=>3,getNumVertices(){return this.checkVertexCount(this.triangleIndex.length,3)},build(){ct.prototype.build.call(this,3,this.triangleIndex.length,3,this.triangleIndex.length)}}),Object.defineProperties(Km,{...Je.A.getStaticProperties("IndexedTriangleStripSet","Rendering",3,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"set_index",new c.A.MFInt32),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"index",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const Zm=Km,Qm=s.A.add("IndexedTriangleStripSet",Zm);function Jm(e){ct.call(this,e),this.addType(m.A.TriangleFanSet),this.triangleIndex=[]}Object.assign(Object.setPrototypeOf(Jm.prototype,ct.prototype),{initialize(){ct.prototype.initialize.call(this),this._fanCount.addInterest("set_fanCount__",this),this.set_fanCount__()},set_fanCount__(){const e=this._fanCount,t=this.triangleIndex;t.length=0;let i=0;for(const n of e){const e=n-1;for(let n=1;n<e;++n)t.push(i,i+n,i+n+1);i+=n}},getPolygonIndex(e){return this.triangleIndex[e]},getVerticesPerPolygon:()=>3,getNumVertices(){return this.checkVertexCount(this.triangleIndex.length,3)},build(){ct.prototype.build.call(this,3,this.triangleIndex.length,3,this.triangleIndex.length)}}),Object.defineProperties(Jm,{...Je.A.getStaticProperties("TriangleFanSet","Rendering",3,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"fanCount",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const eA=Jm,tA=s.A.add("TriangleFanSet",eA);function iA(e){ct.call(this,e),this.addType(m.A.TriangleStripSet),this.triangleIndex=[]}Object.assign(Object.setPrototypeOf(iA.prototype,ct.prototype),{initialize(){ct.prototype.initialize.call(this),this._stripCount.addInterest("set_stripCount__",this),this.set_stripCount__()},set_stripCount__(){const e=this._stripCount,t=this.triangleIndex;t.length=0;let i=0;for(const n of e){const e=n-2;for(let n=0;n<e;++n){const e=1&n;t.push(i+(e?n+1:n),i+(e?n:n+1),i+(n+2))}i+=n}},getPolygonIndex(e){return this.triangleIndex[e]},getVerticesPerPolygon:()=>3,getNumVertices(){return this.checkVertexCount(this.triangleIndex.length,3)},build(){ct.prototype.build.call(this,3,this.triangleIndex.length,3,this.triangleIndex.length)}}),Object.defineProperties(iA,{...Je.A.getStaticProperties("TriangleStripSet","Rendering",3,"geometry","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"solid",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"ccw",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"colorPerVertex",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"normalPerVertex",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"stripCount",new c.A.MFInt32),new o.A(m.A.inputOutput,"attrib",new c.A.MFNode),new o.A(m.A.inputOutput,"fogCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"color",new c.A.SFNode),new o.A(m.A.inputOutput,"texCoord",new c.A.SFNode),new o.A(m.A.inputOutput,"tangent",new c.A.SFNode),new o.A(m.A.inputOutput,"normal",new c.A.SFNode),new o.A(m.A.inputOutput,"coord",new c.A.SFNode)]),enumerable:!0}});const nA=iA,sA=s.A.add("TriangleStripSet",nA),rA={name:"Rendering",concreteNodes:[jm,qp,Zp,St,zm,Vi,$m,Wm,Qm,Rp,Xt,Ip,Xp,tA,Dp,sA],abstractNodes:[Hp,ct,wt,At,at.A,kt,kp]},oA=s.A.add("RenderingComponent",rA);function aA(e){At.call(this,e),this.addType(m.A.X3DVertexAttributeNode),this.addChildObjects(m.A.outputOnly,"attribute_changed",new c.A.SFTime)}Object.assign(Object.setPrototypeOf(aA.prototype,At.prototype),{initialize(){At.prototype.initialize.call(this),this._name.addInterest("set_attribute__",this)},set_attribute__(){this._attribute_changed=this.getBrowser().getCurrentTime()}}),Object.defineProperties(aA,Je.A.getStaticProperties("X3DVertexAttributeNode","Shaders",1));const lA=aA,hA=s.A.add("X3DVertexAttributeNode",lA);function cA(e){hA.call(this,e),this.addType(m.A.FloatVertexAttribute)}Object.assign(Object.setPrototypeOf(cA.prototype,hA.prototype),{initialize(){hA.prototype.initialize.call(this),this._numComponents.addInterest("set_numComponents__",this),this._numComponents.addInterest("set_attribute__",this),this._value.addInterest("set_value__",this),this.set_numComponents__(),this.set_value__()},set_numComponents__(){this.numComponents=W.A.clamp(this._numComponents.getValue(),1,4)},set_value__(){this.value=this._value.getValue(),this.length=this._value.length},addValue(e,t){const i=this.value;let n=e*this.numComponents,s=n+this.numComponents;if(s<=this.length)for(;n<s;++n)t.push(i[n]);else if(this.numComponents<=this.length)for(s=i.length,n=s-this.numComponents;n<s;++n)t.push(i[n]);else for(;n<s;++n)t.push(0)},enable(e,t,i){t.enableFloatAttrib(e,this._name.getValue(),i,this.numComponents,0,0)}}),Object.defineProperties(cA,{...Je.A.getStaticProperties("FloatVertexAttribute","Shaders",1,"attrib","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"name",new c.A.SFString),new o.A(m.A.initializeOnly,"numComponents",new c.A.SFInt32(4)),new o.A(m.A.inputOutput,"value",new c.A.MFFloat)]),enumerable:!0}});const uA=cA,dA=s.A.add("FloatVertexAttribute",uA);function pA(e){hA.call(this,e),this.addType(m.A.Matrix3VertexAttribute)}Object.assign(Object.setPrototypeOf(pA.prototype,hA.prototype),{initialize(){hA.prototype.initialize.call(this),this._value.addInterest("set_value__",this),this.set_value__()},set_value__(){this.value=this._value.getValue(),this.length=this._value.length},addValue(e,t){if(e<this.length){const i=this.value;for(let n=9*e,s=n+9;n<s;++n)t.push(i[n])}else if(this.length){const i=this.value;for(let n=9*(e=this.length-1),s=n+9;n<s;++n)t.push(i[n])}else{const e=Zo.A.IDENTITY;for(let i=0;i<9;++i)t.push(e[i])}},enable(e,t,i){t.enableMatrix3Attrib(e,this._name.getValue(),i,0,0)}}),Object.defineProperties(pA,{...Je.A.getStaticProperties("Matrix3VertexAttribute","Shaders",1,"attrib","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"name",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFMatrix3f)]),enumerable:!0}});const gA=pA,fA=s.A.add("Matrix3VertexAttribute",gA);function mA(e){hA.call(this,e),this.addType(m.A.Matrix4VertexAttribute)}Object.assign(Object.setPrototypeOf(mA.prototype,hA.prototype),{initialize(){hA.prototype.initialize.call(this),this._value.addInterest("set_value__",this),this.set_value__()},set_value__(){this.value=this._value.getValue(),this.length=this._value.length},addValue(e,t){if(e<this.length){const i=this.value;for(let n=16*e,s=n+16;n<s;++n)t.push(i[n])}else if(this.length){const i=this.value;for(let n=16*(e=this.length-1),s=n+16;n<s;++n)t.push(i[n])}else{const e=Matrix4.IDENTITY;for(let i=0;i<16;++i)t.push(e[i])}},enable(e,t,i){t.enableMatrix4Attrib(e,this._name.getValue(),i,0,0)}}),Object.defineProperties(mA,{...Je.A.getStaticProperties("Matrix4VertexAttribute","Shaders",1,"attrib","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.initializeOnly,"name",new c.A.SFString),new o.A(m.A.inputOutput,"value",new c.A.MFMatrix4f)]),enumerable:!0}});const AA=mA,_A=s.A.add("Matrix4VertexAttribute",AA);function yA(e){Ko.call(this,e),Ma.A.call(this,e),ia.call(this,e),this.addType(m.A.PackagedShader)}Object.assign(Object.setPrototypeOf(yA.prototype,Ko.prototype),Ma.A.prototype,ia.prototype,{getSourceText(){return this._url},requestImmediateLoad(e=!0){},initialize(){Ko.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),ia.prototype.initialize.call(this)},dispose(){ia.prototype.dispose.call(this),Ma.A.prototype.dispose.call(this),Ko.prototype.dispose.call(this)}}),Object.defineProperties(yA,{...Je.A.getStaticProperties("PackagedShader","Shaders",1,"shaders","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOnly,"activate",new c.A.SFBool),new o.A(m.A.outputOnly,"isSelected",new c.A.SFBool),new o.A(m.A.outputOnly,"isValid",new c.A.SFBool),new o.A(m.A.initializeOnly,"language",new c.A.SFString),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600))]),enumerable:!0}});const wA=yA,xA=s.A.add("PackagedShader",wA);function bA(e){Ko.call(this,e),this.addType(m.A.ProgramShader)}Object.setPrototypeOf(bA.prototype,Ko.prototype),Object.defineProperties(bA,{...Je.A.getStaticProperties("ProgramShader","Shaders",1,"shaders","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOnly,"activate",new c.A.SFBool),new o.A(m.A.outputOnly,"isSelected",new c.A.SFBool),new o.A(m.A.outputOnly,"isValid",new c.A.SFBool),new o.A(m.A.initializeOnly,"language",new c.A.SFString),new o.A(m.A.inputOutput,"programs",new c.A.MFNode)]),enumerable:!0}});const SA=bA,TA=s.A.add("ProgramShader",SA);function vA(e){Je.A.call(this,e),Ma.A.call(this,e),ia.call(this,e),this.addType(m.A.ShaderProgram)}Object.assign(Object.setPrototypeOf(vA.prototype,Je.A.prototype),Ma.A.prototype,ia.prototype,{getSourceText(){return this._url},requestImmediateLoad(e=!0){},initialize(){Je.A.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),ia.prototype.initialize.call(this)},dispose(){ia.prototype.dispose.call(this),Ma.A.prototype.dispose.call(this),Je.A.prototype.dispose.call(this)}}),Object.defineProperties(vA,{...Je.A.getStaticProperties("ShaderProgram","Shaders",1,"programs","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.initializeOnly,"type",new c.A.SFString("VERTEX")),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600))]),enumerable:!0}});const OA=vA,EA=s.A.add("ShaderProgram",OA),NA={name:"Shaders",concreteNodes:[da,dA,fA,_A,xA,TA,Ba,EA],abstractNodes:[ia,Ko,hA]},CA=s.A.add("ShadersComponent",NA);function IA(e){Yo.A.call(this,e),this.addType(m.A.AcousticProperties)}Object.setPrototypeOf(IA.prototype,Yo.A.prototype),Object.defineProperties(IA,{...Je.A.getStaticProperties("AcousticProperties","Shape",5,"acousticProperties","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"diffuse",new c.A.SFFloat),new o.A(m.A.inputOutput,"specular",new c.A.SFFloat),new o.A(m.A.inputOutput,"refraction",new c.A.SFFloat),new o.A(m.A.inputOutput,"absorption",new c.A.SFFloat)]),enumerable:!0}});const FA=IA,MA=s.A.add("AcousticProperties",FA);function RA(e){Yo.A.call(this,e),this.addType(m.A.FillProperties),this.addChildObjects(m.A.outputOnly,"transparent",new c.A.SFBool),this.hatchColor=new Float32Array(3)}Object.assign(Object.setPrototypeOf(RA.prototype,Yo.A.prototype),{initialize(){Yo.A.prototype.initialize.call(this),this._filled.addInterest("set_filled__",this),this._hatched.addInterest("set_hatched__",this),this._hatchColor.addInterest("set_hatchColor__",this),this._hatchStyle.addInterest("set_hatchStyle__",this),this.set_filled__(),this.set_hatched__(),this.set_hatchColor__(),this.set_hatchStyle__(),this.getBrowser().getHatchStyleTexture(this.hatchStyle)},getStyleKey(){return this.hatched?2:1},set_filled__(){this.filled=this._filled.getValue(),this.setTransparent(!this.filled)},set_hatched__(){this.hatched=this._hatched.getValue()},set_hatchColor__(){this.hatchColor[0]=this._hatchColor[0],this.hatchColor[1]=this._hatchColor[1],this.hatchColor[2]=this._hatchColor[2]},set_hatchStyle__(){let e=this._hatchStyle.getValue();(e<1||e>19)&&(e=1),this.hatchStyle=e},setTransparent(e){!!e!==this._transparent.getValue()&&(this._transparent=e)},isTransparent(){return this._transparent.getValue()},setShaderUniforms(e,t){const i=this.hatched;if(e.uniform1i(t.x3d_FillPropertiesFilled,this.filled),e.uniform1i(t.x3d_FillPropertiesHatched,i),i){const i=this.getBrowser(),n=i.getHatchStyleTexture(this.hatchStyle),s=i.popTextureUnit();e.uniform3fv(t.x3d_FillPropertiesHatchColor,this.hatchColor),e.uniform1f(t.x3d_FillPropertiesScale,i.getRenderingProperty("ContentScale")),e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,n.getTexture()),e.uniform1i(t.x3d_FillPropertiesTexture,s)}}}),Object.defineProperties(RA,{...Je.A.getStaticProperties("FillProperties","Shape",3,"fillProperties","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"filled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"hatched",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"hatchStyle",new c.A.SFInt32(1)),new o.A(m.A.inputOutput,"hatchColor",new c.A.SFColor(1,1,1))]),enumerable:!0}});const PA=RA,VA=s.A.add("FillProperties",PA);function DA(e){cl.call(this,e),this.addType(m.A.Material),e.getSpecificationVersion()<=3.3&&(this.getMaterialKey=LA),this.diffuseColorArray=new Float32Array(3),this.specularColorArray=new Float32Array(3)}function LA(){return this.getBrowser().getBrowserOptions().getShading()===z.PHONG?2:1}Object.assign(Object.setPrototypeOf(DA.prototype,cl.prototype),{initialize(){cl.prototype.initialize.call(this),this._ambientIntensity.addInterest("set_ambientIntensity__",this),this._ambientTexture.addInterest("set_ambientTexture__",this),this._diffuseColor.addInterest("set_diffuseColor__",this),this._diffuseTexture.addInterest("set_diffuseTexture__",this),this._diffuseTexture.addInterest("set_transparent__",this),this._specularColor.addInterest("set_specularColor__",this),this._specularTexture.addInterest("set_specularTexture__",this),this._shininess.addInterest("set_shininess__",this),this._shininessTexture.addInterest("set_shininessTexture__",this),this._occlusionStrength.addInterest("set_occlusionStrength__",this),this._occlusionTexture.addInterest("set_occlusionTexture__",this),this.set_ambientIntensity__(),this.set_ambientTexture__(),this.set_diffuseColor__(),this.set_diffuseTexture__(),this.set_specularColor__(),this.set_specularTexture__(),this.set_shininess__(),this.set_shininessTexture__(),this.set_occlusionStrength__(),this.set_occlusionTexture__(),this.set_transparent__()},getMaterialKey:()=>2,getTextureIndices:(()=>{let e=0;const t={AMBIENT_TEXTURE:e++,DIFFUSE_TEXTURE:e++,SPECULAR_TEXTURE:e++,EMISSIVE_TEXTURE:e++,SHININESS_TEXTURE:e++,OCCLUSION_TEXTURE:e++,NORMAL_TEXTURE:e++};return function(){return t}})(),getBaseTexture(){return this.diffuseTextureNode},set_ambientIntensity__(){this.ambientIntensity=W.A.clamp(this._ambientIntensity.getValue(),0,1)},set_ambientTexture__(){const e=this.getTextureIndices().AMBIENT_TEXTURE;this.ambientTextureNode?._linear.removeInterest(`setTexture${e}`,this),this.ambientTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._ambientTexture),this.ambientTextureNode?._linear.addInterest(`setTexture${e}`,this,e,this.ambientTextureNode),this.setTexture(e,this.ambientTextureNode)},set_diffuseColor__(){this.diffuseColorArray.set(this._diffuseColor.getValue())},set_diffuseTexture__(){const e=this.getTextureIndices().DIFFUSE_TEXTURE;this.diffuseTextureNode&&(this.diffuseTextureNode._transparent.removeInterest("set_transparent__",this),this.diffuseTextureNode._linear.removeInterest(`setTexture${e}`,this)),this.diffuseTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._diffuseTexture),this.diffuseTextureNode&&(this.diffuseTextureNode._transparent.addInterest("set_transparent__",this),this.diffuseTextureNode._linear.addInterest(`setTexture${e}`,this,e,this.diffuseTextureNode)),this.setTexture(e,this.diffuseTextureNode)},set_specularColor__(){this.specularColorArray.set(this._specularColor.getValue())},set_specularTexture__(){const e=this.getTextureIndices().SPECULAR_TEXTURE;this.specularTextureNode?._linear.removeInterest(`setTexture${e}`,this),this.specularTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._specularTexture),this.specularTextureNode?._linear.addInterest(`setTexture${e}`,this,e,this.specularTextureNode),this.setTexture(e,this.specularTextureNode)},set_shininess__(){this.shininess=W.A.clamp(this._shininess.getValue(),0,1)},set_shininessTexture__(){this.shininessTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._shininessTexture),this.setTexture(this.getTextureIndices().SHININESS_TEXTURE,this.shininessTextureNode)},set_occlusionStrength__(){this.occlusionStrength=W.A.clamp(this._occlusionStrength.getValue(),0,1)},set_occlusionTexture__(){this.occlusionTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._occlusionTexture),this.setTexture(this.getTextureIndices().OCCLUSION_TEXTURE,this.occlusionTextureNode)},createShader(e,t,i){const n=this.getBrowser(),s=this.getShaderOptions(t,i);let r;if(t.hasNormals)switch(+this.getTextureBits()&&(this.ambientTextureNode?.getShaderOptions(s,"AMBIENT"),this.diffuseTextureNode?.getShaderOptions(s,"DIFFUSE"),this.specularTextureNode?.getShaderOptions(s,"SPECULAR"),this.shininessTextureNode?.getShaderOptions(s,"SHININESS"),this.occlusionTextureNode?.getShaderOptions(s,"OCCLUSION")),this.getMaterialKey()){case 1:s.push("X3D_GOURAUD_MATERIAL"),r=n.createShader("Gouraud","Default","Material",s);break;case 2:s.push("X3D_PHONG_MATERIAL"),r=n.createShader("Phong","Default","Material",s)}else s.push("X3D_UNLIT_MATERIAL"),r=n.createShader("Unlit","Default","Unlit",s);return n.getShaders().set(e,r),r},setShaderUniforms(e,t,i,n){cl.prototype.setShaderUniforms.call(this,e,t,i,n),e.uniform1f(t.x3d_AmbientIntensity,this.ambientIntensity),e.uniform3fv(t.x3d_DiffuseColor,this.diffuseColorArray),e.uniform3fv(t.x3d_SpecularColor,this.specularColorArray),e.uniform1f(t.x3d_Shininess,this.shininess),+this.getTextureBits()&&(this.ambientTextureNode?.setNamedShaderUniforms(e,t.x3d_AmbientTexture,this._ambientTextureMapping.getValue(),i,n),this.diffuseTextureNode?.setNamedShaderUniforms(e,t.x3d_DiffuseTexture,this._diffuseTextureMapping.getValue(),i,n),this.specularTextureNode?.setNamedShaderUniforms(e,t.x3d_SpecularTexture,this._specularTextureMapping.getValue(),i,n),this.shininessTextureNode?.setNamedShaderUniforms(e,t.x3d_ShininessTexture,this._shininessTextureMapping.getValue(),i,n),this.occlusionTextureNode&&(e.uniform1f(t.x3d_OcclusionStrength,this.occlusionStrength),this.occlusionTextureNode.setNamedShaderUniforms(e,t.x3d_OcclusionTexture,this._occlusionTextureMapping.getValue(),i,n)))}}),Object.defineProperties(DA,{...Je.A.getStaticProperties("Material","Shape",1,"material","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"ambientIntensity",new c.A.SFFloat(.2)),new o.A(m.A.inputOutput,"ambientTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"ambientTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"diffuseColor",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.inputOutput,"diffuseTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"diffuseTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"specularColor",new c.A.SFColor),new o.A(m.A.inputOutput,"specularTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"specularTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"emissiveColor",new c.A.SFColor),new o.A(m.A.inputOutput,"emissiveTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"emissiveTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"shininess",new c.A.SFFloat(.2)),new o.A(m.A.inputOutput,"shininessTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"shininessTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"occlusionStrength",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"occlusionTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"occlusionTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"normalScale",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"normalTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"normalTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"transparency",new c.A.SFFloat)]),enumerable:!0}});for(const e of Object.values(DA.prototype.getTextureIndices()))DA.prototype[`setTexture${e}`]=function(e,t){this.setTexture(e,t)};const BA=DA,kA=s.A.add("Material",BA);function jA(e){cl.call(this,e),this.addType(m.A.PhysicalMaterial),this.baseColorArray=new Float32Array(3),this.extensionNodes=[]}Object.assign(Object.setPrototypeOf(jA.prototype,cl.prototype),{initialize(){cl.prototype.initialize.call(this),this._baseColor.addInterest("set_baseColor__",this),this._baseTexture.addInterest("set_baseTexture__",this),this._baseTexture.addInterest("set_transparent__",this),this._metallic.addInterest("set_metallic__",this),this._roughness.addInterest("set_roughness__",this),this._metallicRoughnessTexture.addInterest("set_metallicRoughnessTexture__",this),this._occlusionStrength.addInterest("set_occlusionStrength__",this),this._occlusionTexture.addInterest("set_occlusionTexture__",this),this._extensions.addInterest("set_extensions__",this),this.set_baseColor__(),this.set_baseTexture__(),this.set_metallic__(),this.set_roughness__(),this.set_metallicRoughnessTexture__(),this.set_occlusionStrength__(),this.set_occlusionTexture__(),this.set_extensions__(),this.set_transparent__()},isPhysical:()=>!0,getMaterialKey(){return this.materialKey},getTextureIndices:(()=>{let e=0;const t={BASE_TEXTURE:e++,EMISSIVE_TEXTURE:e++,METALLIC_ROUGHNESS_TEXTURE:e++,OCCLUSION_TEXTURE:e++,NORMAL_TEXTURE:e++};return function(){return t}})(),getBaseTexture(){return this.baseTextureNode},set_baseColor__(){this.baseColorArray.set(this._baseColor.getValue())},set_baseTexture__(){const e=this.getTextureIndices().BASE_TEXTURE;this.baseTextureNode&&(this.baseTextureNode._transparent.removeInterest("set_transparent__",this),this.baseTextureNode._linear.removeInterest(`setTexture${e}`,this)),this.baseTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._baseTexture),this.baseTextureNode&&(this.baseTextureNode._transparent.addInterest("set_transparent__",this),this.baseTextureNode._linear.addInterest(`setTexture${e}`,this,e,this.baseTextureNode)),this.setTexture(e,this.baseTextureNode)},set_metallic__(){this.metallic=W.A.clamp(this._metallic.getValue(),0,1)},set_roughness__(){this.roughness=W.A.clamp(this._roughness.getValue(),0,1)},set_metallicRoughnessTexture__(){this.metallicRoughnessTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._metallicRoughnessTexture),this.setTexture(this.getTextureIndices().METALLIC_ROUGHNESS_TEXTURE,this.metallicRoughnessTextureNode)},set_occlusionStrength__(){this.occlusionStrength=W.A.clamp(this._occlusionStrength.getValue(),0,1)},set_occlusionTexture__(){this.occlusionTextureNode=(0,hi.A)(m.A.X3DSingleTextureNode,this._occlusionTexture),this.setTexture(this.getTextureIndices().OCCLUSION_TEXTURE,this.occlusionTextureNode)},set_extensions__(){const e=this.extensionNodes;for(const t of e)t.removeInterest("set_extensionsKey__",this);e.length=0;for(const t of this._extensions){const i=(0,hi.A)(m.A.X3DMaterialExtensionNode,t);i&&e.push(i)}e.sort((e,t)=>e.getExtensionKey()-t.getExtensionKey());for(const t of e)t.addInterest("set_extensionsKey__",this);this.setTransmission(e.some(e=>e.getType().includes(m.A.TransmissionMaterialExtension))),this.setVolumeScatter(e.some(e=>e.getType().includes(m.A.VolumeScatterMaterialExtension))&&e.some(e=>e.getType().includes(m.A.VolumeMaterialExtension))),this.set_extensionsKey__()},set_extensionsKey__(){const e=this.extensionNodes.map(e=>`${e.getExtensionKey().toString(16)}${e.getTextureBits().toString(16)}`).join("");this.materialKey=`[3.${e}]`},createShader(e,t,i){const n=this.getBrowser(),s=this.getShaderOptions(t,i),r=[];for(const e of this.extensionNodes)e.getShaderOptions(s);s.push("X3D_PHYSICAL_MATERIAL","X3D_MATERIAL_METALLIC_ROUGHNESS"),+this.getTextureBits()&&(this.baseTextureNode?.getShaderOptions(s,"BASE"),this.metallicRoughnessTextureNode?.getShaderOptions(s,"METALLIC_ROUGHNESS"),this.occlusionTextureNode?.getShaderOptions(s,"OCCLUSION"));for(const e of this.extensionNodes)e.getShaderUniforms(r);const o=n.createShader("Physical","Default","Physical",s,r);return n.getShaders().set(e,o),o.volumeScatterPass=s.includes("X3D_VOLUME_SCATTER_PASS"),o.transmissionBackfacesPass=s.includes("X3D_TRANSMISSION_BACKFACES_PASS"),o},setShaderUniforms(e,t,i,n){cl.prototype.setShaderUniforms.call(this,e,t,i,n);for(const s of this.extensionNodes)s.setShaderUniforms(e,t,i,n);e.uniform3fv(t.x3d_BaseColor,this.baseColorArray),e.uniform1f(t.x3d_Metallic,this.metallic),e.uniform1f(t.x3d_Roughness,this.roughness),+this.getTextureBits()&&(this.baseTextureNode?.setNamedShaderUniforms(e,t.x3d_BaseTexture,this._baseTextureMapping.getValue(),i,n),this.metallicRoughnessTextureNode?.setNamedShaderUniforms(e,t.x3d_MetallicRoughnessTexture,this._metallicRoughnessTextureMapping.getValue(),i,n),this.occlusionTextureNode&&(e.uniform1f(t.x3d_OcclusionStrength,this.occlusionStrength),this.occlusionTextureNode.setNamedShaderUniforms(e,t.x3d_OcclusionTexture,this._occlusionTextureMapping.getValue(),i,n)))}}),Object.defineProperties(jA,{...Je.A.getStaticProperties("PhysicalMaterial","Shape",2,"material","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"baseColor",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"baseTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"baseTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"emissiveColor",new c.A.SFColor),new o.A(m.A.inputOutput,"emissiveTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"emissiveTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"metallic",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"roughness",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"metallicRoughnessTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"metallicRoughnessTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"occlusionStrength",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"occlusionTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"occlusionTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"normalScale",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"normalTextureMapping",new c.A.SFString),new o.A(m.A.inputOutput,"normalTexture",new c.A.SFNode),new o.A(m.A.inputOutput,"transparency",new c.A.SFFloat),new o.A(m.A.inputOutput,"extensions",new c.A.MFNode)]),enumerable:!0}});for(const e of Object.values(jA.prototype.getTextureIndices()))jA.prototype[`setTexture${e}`]=function(e,t){this.setTexture(e,t)};const UA=jA,XA=s.A.add("PhysicalMaterial",UA);function zA(e){console.warn("TwoSidedMaterial is depreciated, please use Appearance backMaterial field instead."),al.call(this,e),this.addType(m.A.TwoSidedMaterial),this.diffuseColorArray=new Float32Array(3),this.specularColorArray=new Float32Array(3),this.emissiveColorArray=new Float32Array(3),this.backDiffuseColorArray=new Float32Array(3),this.backSpecularColorArray=new Float32Array(3),this.backEmissiveColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(zA.prototype,al.prototype),{initialize(){al.prototype.initialize.call(this),this._ambientIntensity.addInterest("set_ambientIntensity__",this),this._diffuseColor.addInterest("set_diffuseColor__",this),this._specularColor.addInterest("set_specularColor__",this),this._emissiveColor.addInterest("set_emissiveColor__",this),this._shininess.addInterest("set_shininess__",this),this._transparency.addInterest("set_transparency__",this),this._backAmbientIntensity.addInterest("set_backAmbientIntensity__",this),this._backDiffuseColor.addInterest("set_backDiffuseColor__",this),this._backSpecularColor.addInterest("set_backSpecularColor__",this),this._backEmissiveColor.addInterest("set_backEmissiveColor__",this),this._backShininess.addInterest("set_backShininess__",this),this._backTransparency.addInterest("set_backTransparency__",this),this._separateBackColor.addInterest("set_transparent__",this),this._transparency.addInterest("set_transparent__",this),this._backTransparency.addInterest("set_transparent__",this),this.set_ambientIntensity__(),this.set_diffuseColor__(),this.set_specularColor__(),this.set_emissiveColor__(),this.set_shininess__(),this.set_transparency__(),this.set_backAmbientIntensity__(),this.set_backDiffuseColor__(),this.set_backSpecularColor__(),this.set_backEmissiveColor__(),this.set_backShininess__(),this.set_backTransparency__(),this.set_transparent__()},set_ambientIntensity__(){this.ambientIntensity=Math.max(this._ambientIntensity.getValue(),0)},set_diffuseColor__(){this.diffuseColorArray.set(this._diffuseColor.getValue())},set_specularColor__(){this.specularColorArray.set(this._specularColor.getValue())},set_emissiveColor__(){this.emissiveColorArray.set(this._emissiveColor.getValue())},set_shininess__(){this.shininess=W.A.clamp(this._shininess.getValue(),0,1)},set_transparency__(){this.transparency=W.A.clamp(this._transparency.getValue(),0,1)},set_backAmbientIntensity__(){this.backAmbientIntensity=Math.max(this._backAmbientIntensity.getValue(),0)},set_backDiffuseColor__(){this.backDiffuseColorArray.set(this._backDiffuseColor.getValue())},set_backSpecularColor__(){this.backSpecularColorArray.set(this._backSpecularColor.getValue())},set_backEmissiveColor__(){this.backEmissiveColorArray.set(this._backEmissiveColor.getValue())},set_backShininess__(){this.backShininess=W.A.clamp(this._backShininess.getValue(),0,1)},set_backTransparency__(){this.backTransparency=W.A.clamp(this._backTransparency.getValue(),0,1)},set_transparent__(){this.setTransparent(this._transparency.getValue()||this._separateBackColor.getValue()&&this._backTransparency.getValue())},getMaterialKey:kA.prototype.getMaterialKey,getBaseTexture:kA.prototype.getBaseTexture,createShader:kA.prototype.createShader,setShaderUniforms(e,t,i,n,s){!s&&this._separateBackColor.getValue()?(e.uniform1f(t.x3d_AmbientIntensity,this.backAmbientIntensity),e.uniform3fv(t.x3d_DiffuseColor,this.backDiffuseColorArray),e.uniform3fv(t.x3d_SpecularColor,this.backSpecularColorArray),e.uniform3fv(t.x3d_EmissiveColor,this.backEmissiveColorArray),e.uniform1f(t.x3d_Shininess,this.backShininess),e.uniform1f(t.x3d_Transparency,this.backTransparency)):(e.uniform1f(t.x3d_AmbientIntensity,this.ambientIntensity),e.uniform3fv(t.x3d_DiffuseColor,this.diffuseColorArray),e.uniform3fv(t.x3d_SpecularColor,this.specularColorArray),e.uniform3fv(t.x3d_EmissiveColor,this.emissiveColorArray),e.uniform1f(t.x3d_Shininess,this.shininess),e.uniform1f(t.x3d_Transparency,this.transparency))}}),Object.defineProperties(zA,{...Je.A.getStaticProperties("TwoSidedMaterial","Shape",4,"material","3.2"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"separateBackColor",new c.A.SFBool),new o.A(m.A.inputOutput,"ambientIntensity",new c.A.SFFloat(.2)),new o.A(m.A.inputOutput,"diffuseColor",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.inputOutput,"specularColor",new c.A.SFColor),new o.A(m.A.inputOutput,"emissiveColor",new c.A.SFColor),new o.A(m.A.inputOutput,"shininess",new c.A.SFFloat(.2)),new o.A(m.A.inputOutput,"transparency",new c.A.SFFloat),new o.A(m.A.inputOutput,"backAmbientIntensity",new c.A.SFFloat(.2)),new o.A(m.A.inputOutput,"backDiffuseColor",new c.A.SFColor(.8,.8,.8)),new o.A(m.A.inputOutput,"backSpecularColor",new c.A.SFColor),new o.A(m.A.inputOutput,"backEmissiveColor",new c.A.SFColor),new o.A(m.A.inputOutput,"backShininess",new c.A.SFFloat(.2)),new o.A(m.A.inputOutput,"backTransparency",new c.A.SFFloat)]),enumerable:!0}});const GA=zA,HA=s.A.add("TwoSidedMaterial",GA),$A={name:"Shape",concreteNodes:[MA,Qa,VA,sl,kA,XA,tl,yi,HA,pl],abstractNodes:[Yo.A,qa,al,cl,mi]},YA=s.A.add("ShapeComponent",$A);var qA=n(3967);function WA(e){Cl.call(this,e),qA.A.call(this,e),this.addType(m.A.X3DSoundProcessingNode),this.addChildObjects(m.A.inputOutput,"loop",new c.A.SFBool);const t=this.getBrowser().getAudioContext();this.childNodes=[],this.audioDestination=new GainNode(t,{gain:0}),this.audioSource=new GainNode(t,{gain:1}),this.soundProcessor=this.audioSource}Object.assign(Object.setPrototypeOf(WA.prototype,Cl.prototype),qA.A.prototype,{initialize(){Cl.prototype.initialize.call(this),qA.A.prototype.initialize.call(this),this._gain.addInterest("set_gain__",this),this._channelCount.addInterest("set_channelCount__",this),this._channelCountMode.addInterest("set_channelCountMode__",this),this._channelInterpretation.addInterest("set_channelInterpretation__",this),this._children.addInterest("set_children__",this),this.set_enabled__(),this.set_gain__(),this.set_channelCount__(),this.set_channelCountMode__(),this.set_channelInterpretation__(),this.set_children__()},getAudioDestination(){return this.audioDestination},getAudioSource(){return this.audioSource},getSoundProcessor(){return this.soundProcessor},setSoundProcessor(e){this.soundProcessor=e??this.audioSource,this.set_enabled__()},set_enabled__(){qA.A.prototype.set_enabled__.call(this),this.audioDestination.disconnect(),this._enabled.getValue()?(this.set_gain__(),this.set_channelCountMode__(),this.set_channelInterpretation__(),this.audioDestination.connect(this.soundProcessor)):(this.audioDestination.gain.value=1,this.audioDestination.channelCountMode="max",this.audioDestination.channelInterpretation="speakers",this.audioDestination.connect(this.audioSource))},set_gain__(){this._enabled.getValue()&&(this.audioDestination.gain.value=this._gain.getValue())},set_channelCount__(){this.audioDestination.channelCount=W.A.clamp(this._channelCount.getValue(),1,32)},set_channelCountMode__:(()=>{const e=new Map([["MAX","max"],["CLAMPED-MAX","clamped-max"],["EXPLICIT","explicit"]]);return function(){this._enabled.getValue()&&(this.audioDestination.channelCountMode=e.get(this._channelCountMode.getValue())??"max")}})(),set_channelInterpretation__:(()=>{const e=new Map([["SPEAKERS","speakers"],["DISCRETE","discrete"]]);return function(){this._enabled.getValue()&&(this.audioDestination.channelInterpretation=e.get(this._channelInterpretation.getValue())??"speakers")}})(),set_children__(){for(const e of this.childNodes)e.getAudioSource().disconnect(this.audioDestination);this.childNodes.length=0;for(const e of this._children){const t=(0,hi.A)(m.A.X3DSoundNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DSoundChannelNode:case m.A.X3DSoundProcessingNode:case m.A.X3DSoundSourceNode:this.childNodes.push(t);break;default:continue}break}}for(const e of this.childNodes)e.getAudioSource().connect(this.audioDestination)},set_time(){this._elapsedTime=this.getElapsedTime()},dispose(){qA.A.prototype.dispose.call(this),Cl.prototype.dispose.call(this)}}),Object.defineProperties(WA,Je.A.getStaticProperties("X3DSoundProcessingNode","Sound",2));const KA=WA,ZA=s.A.add("X3DSoundProcessingNode",KA);function QA(e){ZA.call(this,e),this.addType(m.A.Analyser);const t=this.getBrowser().getAudioContext();this.analyserNode=new AnalyserNode(t),this.byteFrequencyData=new Uint8Array(this.analyserNode.frequencyBinCount),this.byteTimeDomainData=new Uint8Array(this.analyserNode.frequencyBinCount),this.analyserNode.connect(this.getAudioSource())}Object.assign(Object.setPrototypeOf(QA.prototype,ZA.prototype),{initialize(){ZA.prototype.initialize.call(this),this._fftSize.addInterest("set_fftSize__",this),this._minDecibels.addInterest("set_decibels__",this),this._maxDecibels.addInterest("set_decibels__",this),this._smoothingTimeConstant.addInterest("set_smoothingTimeConstant__",this),this.setSoundProcessor(this.analyserNode),this.set_fftSize__(),this.set_decibels__(),this.set_smoothingTimeConstant__()},set_fftSize__(){this.analyserNode.fftSize=W.A.clamp(W.A.nextPowerOfTwo(this._fftSize.getValue()),32,32768),this._frequencyBinCount=this.analyserNode.frequencyBinCount},set_decibels__(){const e=Math.min(this._minDecibels.getValue(),0),t=Math.min(this._maxDecibels.getValue(),0);this.analyserNode.minDecibels=Math.min(e,t),this.analyserNode.maxDecibels=Math.max(e,t)},set_smoothingTimeConstant__(){this.analyserNode.smoothingTimeConstant=W.A.clamp(this._smoothingTimeConstant.getValue(),0,1)},set_time(){ZA.prototype.set_time.call(this);const e=this.analyserNode,t=e.frequencyBinCount;this.byteFrequencyData.length!==t&&(this.byteFrequencyData=new Uint8Array(t),this.byteTimeDomainData=new Uint8Array(t)),this._byteFrequencyData.length=t,this._byteTimeDomainData.length=t,this._floatFrequencyData.length=t,this._floatTimeDomainData.length=t,e.getByteFrequencyData(this.byteFrequencyData),e.getByteTimeDomainData(this.byteTimeDomainData),this._byteFrequencyData.getValue().set(this.byteFrequencyData),this._byteTimeDomainData.getValue().set(this.byteTimeDomainData),e.getFloatFrequencyData(this._floatFrequencyData.shrinkToFit()),e.getFloatTimeDomainData(this._floatTimeDomainData.shrinkToFit()),this._byteFrequencyData.addEvent(),this._byteTimeDomainData.addEvent(),this._floatFrequencyData.addEvent(),this._floatTimeDomainData.addEvent()}}),Object.defineProperties(QA,{...Je.A.getStaticProperties("Analyser","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"fftSize",new c.A.SFInt32(2048)),new o.A(m.A.inputOutput,"minDecibels",new c.A.SFFloat(-100)),new o.A(m.A.inputOutput,"maxDecibels",new c.A.SFFloat(-30)),new o.A(m.A.inputOutput,"smoothingTimeConstant",new c.A.SFFloat(.8)),new o.A(m.A.outputOnly,"frequencyBinCount",new c.A.SFInt32),new o.A(m.A.outputOnly,"byteFrequencyData",new c.A.MFInt32),new o.A(m.A.outputOnly,"byteTimeDomainData",new c.A.MFInt32),new o.A(m.A.outputOnly,"floatFrequencyData",new c.A.MFFloat),new o.A(m.A.outputOnly,"floatTimeDomainData",new c.A.MFFloat),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const JA=QA,e_=s.A.add("Analyser",JA);function t_(e){Cl.call(this,e),qA.A.call(this,e),this.addType(m.A.X3DSoundSourceNode);const t=this.getBrowser().getAudioContext();this.audioSource=new GainNode(t,{gain:0}),this.mediaElement=null}Object.assign(Object.setPrototypeOf(t_.prototype,Cl.prototype),qA.A.prototype,{initialize(){Cl.prototype.initialize.call(this),qA.A.prototype.initialize.call(this),this._gain.addInterest("set_gain__",this),this.set_gain__()},getAudioSource(){return this.audioSource},getMediaElement(){return this.mediaElement},setMediaElement(e){this.getBrowser().stopAudioElement(this.mediaElement),this.mediaElement=e,e&&(this.set_loop(),this.resetElapsedTime(),this._isActive.getValue()?this._isPaused.getValue()?this.set_pause():this.getLive().getValue()?this.set_start():this.set_pause():this.set_stop())},set_gain__(){this.audioSource.gain.value=this._gain.getValue()},set_loop(){this.mediaElement&&(this.mediaElement.loop=this._loop.getValue())},set_start(){this.mediaElement&&(this.mediaElement.currentTime=0,this.getBrowser().startAudioElement(this.mediaElement))},set_pause(){this.getBrowser().stopAudioElement(this.mediaElement)},set_resume(){this.getBrowser().startAudioElement(this.mediaElement)},set_stop(){this.getBrowser().stopAudioElement(this.mediaElement)},set_end(){this._loop.getValue()||this.stop()},set_time(){this.mediaElement&&(this._elapsedTime=this.getElapsedTime(),this.mediaElement.currentTime<this.mediaElement.duration||this.set_end())},dispose(){qA.A.prototype.dispose.call(this),Cl.prototype.dispose.call(this)}}),Object.defineProperties(t_,Je.A.getStaticProperties("X3DSoundSourceNode","Sound",1));const i_=t_,n_=s.A.add("X3DSoundSourceNode",i_),s_={create(e,t,i){let n=new AudioBufferSourceNode(e),s=0,r=1,o=0,a=0,l=!1,h=0,c=0,u=!1;return Object.defineProperties({},{detune:{get:()=>s,set(e){s=e,n.detune.value=e}},playbackRate:{get:()=>r,set(e){r=e,n.playbackRate.value=e}},loopStart:{get:()=>o,set(e){o=e,n.loopStart=e}},loopEnd:{get:()=>a,set(e){a=e,n.loopEnd=e}},loop:{get:()=>l,set(t){t||(h=e.currentTime-this.currentTime),l=t,n.loop=t}},currentTime:{get(){return u?this.duration?this.loop?(e.currentTime-h)%this.duration:e.currentTime-h:0:c},set(t){c=t,h=e.currentTime-c,u&&(this.pause(),this.play())}},duration:{value:i?.duration??0},play:{value:()=>(u||(n=new AudioBufferSourceNode(e),n.buffer=i,n.loopStart=o,n.loopEnd=a,n.loop=l,n.playbackRate.value=r,n.connect(t),n.start(0,c),h=e.currentTime-c,u=!0),Promise.resolve())},pause:{value(){if(!u)return;n.stop(),n.disconnect(),c=this.currentTime,u=!1;const i=new AudioBufferSourceNode(e);i.connect(t),i.start(),i.stop(e.currentTime+1)}}})}},r_=s.A.add("AudioElement",s_);function o_(e){n_.call(this,e),Ma.A.call(this,e),this.addType(m.A.AudioClip)}Object.assign(Object.setPrototypeOf(o_.prototype,n_.prototype),Ma.A.prototype,{initialize(){n_.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),this._pitch.addInterest("set_pitch__",this),this.requestImmediateLoad().catch(Function.prototype)},set_live__(){n_.prototype.set_live__.call(this),Ma.A.prototype.set_live__.call(this)},set_pitch__(){const e=this.getMediaElement();e&&(e.playbackRate=Math.max(this._pitch.getValue(),0))},unloadData(){this.setMediaElement(null)},loadData(){this.unloadData(),new Ra.default(this).loadDocument(this._url,async(e,t)=>{null===e?(this.unloadData(),this.setLoadState(m.A.FAILED_STATE)):e instanceof ArrayBuffer&&(await this.setArrayBuffer(e),this.setLoadState(m.A.COMPLETE_STATE),ka.A&&"data:"!==t.protocol&&console.info(`Done loading audio '${decodeURI(t)}'.`))})},async setArrayBuffer(e){const t=this.getBrowser().getAudioContext(),i=await t.decodeAudioData(e),n=r_.create(t,this.getAudioSource(),i);this._duration_changed=n.duration,this.setMediaElement(n),this.set_pitch__()},dispose(){Ma.A.prototype.dispose.call(this),n_.prototype.dispose.call(this)}}),Object.defineProperties(o_,{...Je.A.getStaticProperties("AudioClip","Sound",1,"source","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"pitch",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"loop",new c.A.SFBool),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.outputOnly,"duration_changed",new c.A.SFTime)]),enumerable:!0}});const a_=o_,l_=s.A.add("AudioClip",a_);function h_(e){Cl.call(this,e),this.addType(m.A.X3DSoundDestinationNode);const t=this.getBrowser().getAudioContext();this.childNodes=[],this.audioDestination=new GainNode(t,{gain:0})}Object.assign(Object.setPrototypeOf(h_.prototype,Cl.prototype),{initialize(){Cl.prototype.initialize.call(this),this.getLive().addInterest("set_enabled__",this),this._enabled.addInterest("set_enabled__",this),this._gain.addInterest("set_gain__",this),this._channelCount.addInterest("set_channelCount__",this),this._channelCountMode.addInterest("set_channelCountMode__",this),this._channelInterpretation.addInterest("set_channelInterpretation__",this),this._children.addInterest("set_children__",this),this.set_enabled__(),this.set_gain__(),this.set_channelCount__(),this.set_channelCountMode__(),this.set_channelInterpretation__(),this.set_children__()},getAudioDestination(){return this.audioDestination},set_enabled__(){this._enabled.getValue()&&this.getLive().getValue()?this.audioDestination.connect(this.getSoundDestination()):this.audioDestination.disconnect(),this._isActive=this._enabled},set_gain__(){this.audioDestination.gain.value=this._gain.getValue()},set_channelCount__(){this.audioDestination.channelCount=W.A.clamp(this._channelCount.getValue(),1,32)},set_channelCountMode__:(()=>{const e=new Map([["MAX","max"],["CLAMPED-MAX","clamped-max"],["EXPLICIT","explicit"]]);return function(){this.audioDestination.channelCountMode=e.get(this._channelCountMode.getValue())??"max"}})(),set_channelInterpretation__:(()=>{const e=new Map([["SPEAKERS","speakers"],["DISCRETE","discrete"]]);return function(){this.audioDestination.channelInterpretation=e.get(this._channelInterpretation.getValue())??"speakers"}})(),set_children__(){for(const e of this.childNodes)e.getAudioSource().disconnect(this.audioDestination);this.childNodes.length=0;for(const e of this._children){const t=(0,hi.A)(m.A.X3DChildNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DSoundChannelNode:case m.A.X3DSoundProcessingNode:case m.A.X3DSoundSourceNode:this.childNodes.push(t);break;default:continue}break}}for(const e of this.childNodes)e.getAudioSource().connect(this.audioDestination)}}),Object.defineProperties(h_,Je.A.getStaticProperties("X3DSoundDestinationNode","Sound",2));const c_=h_,u_=s.A.add("X3DSoundDestinationNode",c_);function d_(e){u_.call(this,e),this.addType(m.A.AudioDestination);const t=this.getBrowser().getAudioContext();this.audioElement=new Audio,this.mediaStreamAudioDestinationNode=new MediaStreamAudioDestinationNode(t),this.audioElement.srcObject=this.mediaStreamAudioDestinationNode.stream}Object.assign(Object.setPrototypeOf(d_.prototype,u_.prototype),{initialize(){u_.prototype.initialize.call(this);const e=this.getBrowser().getAudioContext();this._mediaDeviceID.addInterest("set_mediaDeviceID__",this),this._maxChannelCount=e.destination.maxChannelCount,this.set_mediaDeviceID__()},getSoundDestination(){return this.mediaStreamAudioDestinationNode},set_enabled__(){const e=this.getBrowser();this._enabled.getValue()&&this.getLive().getValue()?e.startAudioElement(this.audioElement):e.stopAudioElement(this.audioElement),u_.prototype.set_enabled__.call(this)},set_mediaDeviceID__(){this.getBrowser().startAudioElement(this,"set_mediaDeviceID_impl__")},set_mediaDeviceID_impl__(){const e=this._mediaDeviceID.getValue()||"default";return this.audioElement.setSinkId?.(e)??Promise.resolve()}}),Object.defineProperties(d_,{...Je.A.getStaticProperties("AudioDestination","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"mediaDeviceID",new c.A.SFString),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"maxChannelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const p_=d_,g_=s.A.add("AudioDestination",p_);function f_(e){ZA.call(this,e),this.addType(m.A.BiquadFilter);const t=this.getBrowser().getAudioContext();this.biquadFilterNode=new BiquadFilterNode(t),this.biquadFilterNode.connect(this.getAudioSource())}Object.assign(Object.setPrototypeOf(f_.prototype,ZA.prototype),{initialize(){ZA.prototype.initialize.call(this),this._detune.addInterest("set_detune__",this),this._type.addInterest("set_type__",this),this._frequency.addInterest("set_frequency__",this),this._qualityFactor.addInterest("set_qualityFactor__",this),this.setSoundProcessor(this.biquadFilterNode),this.set_detune__(),this.set_type__(),this.set_frequency__(),this.set_qualityFactor__()},set_detune__(){this.biquadFilterNode.detune.value=this._detune.getValue()},set_type__:(()=>{const e=new Map([["LOWPASS","lowpass"],["HIGHPASS","highpass"],["BANDPASS","bandpass"],["LOWSHELF","lowshelf"],["HIGHSHELF","highshelf"],["PEAKING","peaking"],["NOTCH","notch"],["ALLPASS","allpass"]]);return function(){this.biquadFilterNode.type=e.get(this._type.getValue())??"lowpass"}})(),set_frequency__(){this.biquadFilterNode.frequency.value=Math.max(this._frequency.getValue(),0)},set_qualityFactor__(){this.biquadFilterNode.Q.value=W.A.clamp(this._qualityFactor.getValue(),1e-4,1e3)}}),Object.defineProperties(f_,{...Je.A.getStaticProperties("BiquadFilter","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"detune",new c.A.SFFloat),new o.A(m.A.inputOutput,"type",new c.A.SFString("LOWPASS")),new o.A(m.A.inputOutput,"frequency",new c.A.SFFloat(350)),new o.A(m.A.inputOutput,"qualityFactor",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const m_=f_,A_=s.A.add("BiquadFilter",m_);function __(e){n_.call(this,e),Ma.A.call(this,e),this.addType(m.A.BufferAudioSource)}Object.assign(Object.setPrototypeOf(__.prototype,n_.prototype),Ma.A.prototype,{initialize(){n_.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),this._numberOfChannels.addInterest("set_buffer__",this),this._sampleRate.addInterest("set_buffer__",this),this._bufferLength.addInterest("set_buffer__",this),this._buffer.addInterest("set_buffer__",this),this._detune.addInterest("set_detune__",this),this._playbackRate.addInterest("set_playbackRate__",this),this._loopStart.addInterest("set_loopStart__",this),this._loopEnd.addInterest("set_loopEnd__",this),this.set_buffer__(),this.requestImmediateLoad().catch(Function.prototype)},set_live__(){n_.prototype.set_live__.call(this),Ma.A.prototype.set_live__.call(this)},set_buffer__(){if(this._load.getValue())return;const e=this.getBrowser().getAudioContext(),t=W.A.clamp(this._numberOfChannels.getValue(),1,32),i=W.A.clamp(this._sampleRate.getValue(),3e3,768e3),n=Math.max(this._bufferLength.getValue(),0);if(n){const s=e.createBuffer(t,n,i),r=this._buffer.getValue();if(this._bufferDuration=n/i,this._buffer.length>=n*t)for(let e=0;e<t;++e){s.getChannelData(e).set(r.subarray(e*n,(e+1)*n))}this.setMediaElement(r_.create(e,this.getAudioSource(),s)),this.set_detune__(),this.set_playbackRate__(),this.set_loopStart__(),this.set_loopEnd__()}else this._bufferDuration=0,this.setMediaElement(null)},set_detune__(){const e=this.getMediaElement();e&&(e.detune=this._detune.getValue())},set_playbackRate__(){const e=this.getMediaElement();e&&(e.playbackRate=this._playbackRate.getValue())},set_loopStart__(){const e=this.getMediaElement();e&&(e.loopStart=Math.max(this._loopStart.getValue(),0))},set_loopEnd__(){const e=this.getMediaElement();e&&(e.loopEnd=Math.max(this._loopEnd.getValue(),0))},unloadData(){this.set_buffer__()},loadData(){this.setMediaElement(null),new Ra.default(this).loadDocument(this._url,async(e,t)=>{null===e?(this.setMediaElement(null),this.setLoadState(m.A.FAILED_STATE)):e instanceof ArrayBuffer&&(await this.setArrayBuffer(e),this.setLoadState(m.A.COMPLETE_STATE),ka.A&&"data:"!==t.protocol&&console.info(`Done loading audio '${decodeURI(t)}'.`))})},async setArrayBuffer(e){const t=this.getBrowser().getAudioContext(),i=await t.decodeAudioData(e),n=new Float32Array(i.length*i.numberOfChannels);for(let e=0;e<i.numberOfChannels;++e)n.set(i.getChannelData(e),e*i.length);this._numberOfChannels=i.numberOfChannels,this._sampleRate=i.sampleRate,this._bufferLength=i.length,this._buffer=n,this._bufferDuration=i.duration,this.setMediaElement(r_.create(t,this.getAudioSource(),i)),this.set_detune__(),this.set_playbackRate__(),this.set_loopStart__(),this.set_loopEnd__()},dispose(){Ma.A.prototype.dispose.call(this),n_.prototype.dispose.call(this)}}),Object.defineProperties(__,{...Je.A.getStaticProperties("BufferAudioSource","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600)),new o.A(m.A.inputOutput,"numberOfChannels",new c.A.SFInt32),new o.A(m.A.inputOutput,"sampleRate",new c.A.SFFloat),new o.A(m.A.inputOutput,"bufferLength",new c.A.SFInt32),new o.A(m.A.inputOutput,"buffer",new c.A.MFFloat),new o.A(m.A.outputOnly,"bufferDuration",new c.A.SFTime),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"detune",new c.A.SFFloat),new o.A(m.A.inputOutput,"playbackRate",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"loopStart",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"loopEnd",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"loop",new c.A.SFBool),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime)]),enumerable:!0}});const y_=__,w_=s.A.add("BufferAudioSource",y_);function x_(e){Cl.call(this,e),this.addType(m.A.X3DSoundChannelNode);const t=this.getBrowser().getAudioContext();this.childNodes=[],this.audioDestination=new GainNode(t,{gain:0}),this.audioSource=new GainNode(t,{gain:1}),this.soundProcessor=this.audioSource}Object.assign(Object.setPrototypeOf(x_.prototype,Cl.prototype),{initialize(){Cl.prototype.initialize.call(this),this._enabled.addInterest("set_enabled__",this),this._gain.addInterest("set_gain__",this),this._channelCount.addInterest("set_channelCount__",this),this._channelCountMode.addInterest("set_channelCountMode__",this),this._channelInterpretation.addInterest("set_channelInterpretation__",this),this._children.addInterest("set_children__",this),this.set_enabled__(),this.set_gain__(),this.set_channelCount__(),this.set_channelCountMode__(),this.set_channelInterpretation__(),this.set_children__()},getAudioDestination(){return this.audioDestination},getAudioSource(){return this.audioSource},getSoundProcessor(){return this.soundProcessor},setSoundProcessor(e){this.soundProcessor=e??this.audioSource,this.set_enabled__()},set_enabled__(){this.audioDestination.disconnect(),this._enabled.getValue()?(this.set_gain__(),this.set_channelCountMode__(),this.set_channelInterpretation__(),this.audioDestination.connect(this.soundProcessor)):(this.audioDestination.gain.value=1,this.audioDestination.channelCountMode="max",this.audioDestination.channelInterpretation="speakers",this.audioDestination.connect(this.audioSource))},set_gain__(){this._enabled.getValue()&&(this.audioDestination.gain.value=this._gain.getValue())},set_channelCount__(){this.audioDestination.channelCount=W.A.clamp(this._channelCount.getValue(),1,32)},set_channelCountMode__:(()=>{const e=new Map([["MAX","max"],["CLAMPED-MAX","clamped-max"],["EXPLICIT","explicit"]]);return function(){this._enabled.getValue()&&(this.audioDestination.channelCountMode=e.get(this._channelCountMode.getValue())??"max")}})(),set_channelInterpretation__:(()=>{const e=new Map([["SPEAKERS","speakers"],["DISCRETE","discrete"]]);return function(){this._enabled.getValue()&&(this.audioDestination.channelInterpretation=e.get(this._channelInterpretation.getValue())??"speakers")}})(),set_children__(){for(const[e,t]of this.childNodes.entries())this.disconnectChildNode(e,t);this.childNodes.length=0;for(const e of this._children){const t=(0,hi.A)(m.A.X3DChildNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DSoundChannelNode:case m.A.X3DSoundProcessingNode:case m.A.X3DSoundSourceNode:this.childNodes.push(t);break;default:continue}break}}this.setChildNodes(this.childNodes);for(const[e,t]of this.childNodes.entries())this.connectChildNode(e,t)},setChildNodes(e){},connectChildNode(e,t){t.getAudioSource().connect(this.audioDestination)},disconnectChildNode(e,t){t.getAudioSource().disconnect(this.audioDestination)}}),Object.defineProperties(x_,Je.A.getStaticProperties("X3DSoundChannelNode","Sound",2));const b_=x_,S_=s.A.add("X3DSoundChannelNode",b_);function T_(e){S_.call(this,e),this.addType(m.A.ChannelMerger)}Object.assign(Object.setPrototypeOf(T_.prototype,S_.prototype),{initialize(){S_.prototype.initialize.call(this),this._enabled.addInterest("set_children__",this)},setChildNodes(e){if(this.channelMergerNode?.disconnect(),this._enabled.getValue()){const t=this.getBrowser().getAudioContext(),i=W.A.clamp(e.length,1,32);this.channelMergerNode?.numberOfInputs!==i&&(this.channelMergerNode=new ChannelMergerNode(t,{numberOfInputs:i})),this.channelMergerNode.connect(this.getAudioDestination())}else this.channelMergerNode=null},connectChildNode(e,t){this.channelMergerNode?e<32&&t.getAudioSource().connect(this.channelMergerNode,0,e):t.getAudioSource().connect(this.getAudioDestination())},disconnectChildNode(e,t){this.channelMergerNode?e<32&&t.getAudioSource().disconnect(this.channelMergerNode,0,e):t.getAudioSource().disconnect(this.getAudioDestination())}}),Object.defineProperties(T_,{...Je.A.getStaticProperties("ChannelMerger","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const v_=T_,O_=s.A.add("ChannelMerger",v_);function E_(e){S_.call(this,e),this.addType(m.A.ChannelSelector)}Object.assign(Object.setPrototypeOf(E_.prototype,S_.prototype),{initialize(){S_.prototype.initialize.call(this),this._channelSelection.addInterest("set_channelSelection__",this),this.set_channelSelection__()},set_channelSelection__(){const e=this.getBrowser().getAudioContext(),t=W.A.clamp(this._channelSelection.getValue(),0,31),i=t+1;this.channelSplitterNode?.disconnect(),this.channelSplitterNode?.numberOfOutputs!==i&&(this.channelSplitterNode=new ChannelSplitterNode(e,{numberOfOutputs:i})),this.channelSplitterNode.connect(this.getAudioSource(),t),this.setSoundProcessor(this.channelSplitterNode)}}),Object.defineProperties(E_,{...Je.A.getStaticProperties("ChannelSelector","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"channelSelection",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const N_=E_,C_=s.A.add("ChannelSelector",N_);function I_(e){S_.call(this,e),this.addType(m.A.ChannelSplitter),this.outputNodes=[]}Object.assign(Object.setPrototypeOf(I_.prototype,S_.prototype),{initialize(){S_.prototype.initialize.call(this),this._enabled.addInterest("set_outputs__",this),this._outputs.addInterest("set_outputs__",this),this.set_outputs__()},set_outputs__(){if(this.channelSplitterNode)this.channelSplitterNode.disconnect();else for(const e of this.outputNodes)this.getAudioSource().disconnect(e.getAudioDestination());this.outputNodes.length=0;for(const e of this._outputs){const t=(0,hi.A)(m.A.X3DChildNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DSoundChannelNode:case m.A.X3DSoundProcessingNode:this.outputNodes.push(t);break;default:continue}break}}if(this.channelSplitterNode&&this.getAudioSource().disconnect(this.channelSplitterNode),this._enabled.getValue()){const e=this.getBrowser().getAudioContext(),t=W.A.clamp(this.outputNodes.length,1,32);this.channelSplitterNode?.numberOfOutputs!==t&&(this.channelSplitterNode=new ChannelSplitterNode(e,{numberOfOutputs:t})),this.getAudioSource().connect(this.channelSplitterNode)}else this.channelSplitterNode=null;if(this.channelSplitterNode){const e=Math.min(this.outputNodes.length,32);for(let t=0;t<e;++t)this.channelSplitterNode.connect(this.outputNodes[t].getAudioDestination(),t)}else for(const e of this.outputNodes)this.getAudioSource().connect(e.getAudioDestination())}}),Object.defineProperties(I_,{...Je.A.getStaticProperties("ChannelSplitter","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"children",new c.A.MFNode),new o.A(m.A.inputOutput,"outputs",new c.A.MFNode)]),enumerable:!0}});const F_=I_,M_=s.A.add("ChannelSplitter",F_);function R_(e){ZA.call(this,e),this.addType(m.A.Convolver);const t=this.getBrowser().getAudioContext();this.convolverNode=new ConvolverNode(t),this.convolverNode.connect(this.getAudioSource())}Object.assign(Object.setPrototypeOf(R_.prototype,ZA.prototype),{initialize(){ZA.prototype.initialize.call(this),this._numberOfChannels.addInterest("set_buffer__",this),this._buffer.addInterest("set_buffer__",this),this._normalize.addInterest("set_normalize__",this),this.setSoundProcessor(this.convolverNode),this.set_buffer__(),this.set_normalize__()},set_buffer__(){const e=this.getBrowser().getAudioContext(),t=W.A.clamp(this._numberOfChannels.getValue(),1,32),i=e.sampleRate,n=Math.max(Math.floor(this._buffer.length/t),1),s=e.createBuffer(t,n,i),r=this._buffer.getValue();if(this._buffer.length>=n*t)for(let e=0;e<t;++e){s.getChannelData(e).set(r.subarray(e*n,(e+1)*n))}this.convolverNode.buffer=s},set_normalize__(){this.convolverNode.normalize=this._normalize.getValue()}}),Object.defineProperties(R_,{...Je.A.getStaticProperties("Convolver","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"numberOfChannels",new c.A.SFInt32),new o.A(m.A.inputOutput,"buffer",new c.A.MFFloat),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"normalize",new c.A.SFBool),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const P_=R_,V_=s.A.add("Convolver",P_);function D_(e){ZA.call(this,e),this.addType(m.A.Delay)}Object.assign(Object.setPrototypeOf(D_.prototype,ZA.prototype),{initialize(){ZA.prototype.initialize.call(this),this._maxDelayTime.addInterest("set_maxDelayTime__",this),this._delayTime.addInterest("set_delayTime__",this),this.set_maxDelayTime__()},set_delayTime__(){const e=Math.max(this._maxDelayTime.getValue(),0),t=W.A.clamp(this._delayTime.getValue(),0,e);this.delayNode.delayTime.value=t},set_maxDelayTime__(){this.delayNode?.disconnect(),this.delayNode=this.createSoundProcessor(),this.delayNode.connect(this.getAudioSource()),this.setSoundProcessor(this.delayNode)},createSoundProcessor(){const e=this.getBrowser().getAudioContext(),t=Math.max(this._maxDelayTime.getValue(),0),i=W.A.clamp(this._delayTime.getValue(),0,t);return new DelayNode(e,{maxDelayTime:t,delayTime:i})}}),Object.defineProperties(D_,{...Je.A.getStaticProperties("Delay","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"maxDelayTime",new c.A.SFTime(1)),new o.A(m.A.inputOutput,"delayTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const L_=D_,B_=s.A.add("Delay",L_);function k_(e){ZA.call(this,e),this.addType(m.A.DynamicsCompressor);const t=this.getBrowser().getAudioContext();this.dynamicsCompressorNode=new DynamicsCompressorNode(t),this.dynamicsCompressorNode.connect(this.getAudioSource())}Object.assign(Object.setPrototypeOf(k_.prototype,ZA.prototype),{initialize(){ZA.prototype.initialize.call(this),this._attack.addInterest("set_attack__",this),this._knee.addInterest("set_knee__",this),this._ratio.addInterest("set_ratio__",this),this._release.addInterest("set_release__",this),this._threshold.addInterest("set_threshold__",this),this.setSoundProcessor(this.dynamicsCompressorNode),this.set_attack__(),this.set_knee__(),this.set_ratio__(),this.set_release__(),this.set_threshold__()},set_attack__(){this.dynamicsCompressorNode.attack.value=W.A.clamp(this._attack.getValue(),0,1)},set_knee__(){this.dynamicsCompressorNode.knee.value=W.A.clamp(this._knee.getValue(),0,40)},set_ratio__(){this.dynamicsCompressorNode.ratio.value=W.A.clamp(this._ratio.getValue(),1,20)},set_release__(){this.dynamicsCompressorNode.release.value=W.A.clamp(this._release.getValue(),0,1)},set_threshold__(){this.dynamicsCompressorNode.threshold.value=W.A.clamp(this._threshold.getValue(),-100,0)},set_time(){this._reduction=this.dynamicsCompressorNode.reduction,ZA.prototype.set_time.call(this)}}),Object.defineProperties(k_,{...Je.A.getStaticProperties("DynamicsCompressor","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"attack",new c.A.SFTime(.003)),new o.A(m.A.inputOutput,"knee",new c.A.SFFloat(30)),new o.A(m.A.inputOutput,"ratio",new c.A.SFFloat(12)),new o.A(m.A.inputOutput,"release",new c.A.SFTime(.25)),new o.A(m.A.inputOutput,"threshold",new c.A.SFFloat(-24)),new o.A(m.A.outputOnly,"reduction",new c.A.SFFloat),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const j_=k_,U_=s.A.add("DynamicsCompressor",j_);function X_(e){ZA.call(this,e),this.addType(m.A.Gain)}Object.setPrototypeOf(X_.prototype,ZA.prototype),Object.defineProperties(X_,{...Je.A.getStaticProperties("Gain","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const z_=X_,G_=s.A.add("Gain",z_);function H_(e){Cl.call(this,e),this.addType(m.A.ListenerPointSource),this.setVisibleObject(!0),this._position.setUnit("length"),this._interauralDistance.setUnit("length")}Object.assign(Object.setPrototypeOf(H_.prototype,Cl.prototype),{initialize(){Cl.prototype.initialize.call(this),this._enabled.addInterest("set_trackCurrentView__",this),this._trackCurrentView.addInterest("set_trackCurrentView__",this),this.set_trackCurrentView__()},set_trackCurrentView__(){if(!this._enabled.getValue())return;if(!this._trackCurrentView.getValue())return;const e=this.getBrowser().getAudioContext().listener;e.positionX.value=0,e.positionY.value=0,e.positionZ.value=0,e.forwardX.value=0,e.forwardY.value=0,e.forwardZ.value=-1,e.upX.value=0,e.upY.value=1,e.upZ.value=0},traverse:(()=>{const e=new Ee.A,t=new Fn.A,i=new Si.A,n=new Ee.A,s=new Ee.A;return function(r,o){if(!this._enabled.getValue())return;if(this._trackCurrentView.getValue())return;const a=this.getBrowser().getAudioContext().listener;i.assign(o.getModelViewMatrix().get()).translate(this._position.getValue()).rotate(this._orientation.getValue()).get(e,t),t.multVecRot(n.assign(Ee.A.Z_AXIS).negate()).normalize(),t.multVecRot(s.assign(Ee.A.Y_AXIS)).normalize(),a.positionX.value=e.x,a.positionY.value=e.y,a.positionZ.value=e.z,a.forwardX.value=n.x,a.forwardY.value=n.y,a.forwardZ.value=n.z,a.upX.value=s.x,a.upY.value=s.y,a.upZ.value=s.z}})()}),Object.defineProperties(H_,{...Je.A.getStaticProperties("ListenerPointSource","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"trackCurrentView",new c.A.SFBool),new o.A(m.A.inputOutput,"position",new c.A.SFVec3f),new o.A(m.A.inputOutput,"orientation",new c.A.SFRotation),new o.A(m.A.inputOutput,"interauralDistance",new c.A.SFFloat),new o.A(m.A.inputOutput,"dopplerEnabled",new c.A.SFBool)]),enumerable:!0}});const $_=H_,Y_=s.A.add("ListenerPointSource",$_);function q_(e){n_.call(this,e),this.addType(m.A.MicrophoneSource),this.addChildObjects(m.A.inputOutput,"loop",new c.A.SFBool)}Object.assign(Object.setPrototypeOf(q_.prototype,n_.prototype),{initialize(){n_.prototype.initialize.call(this),this._mediaDeviceID.addInterest("set_mediaDeviceID__",this)},set_mediaDeviceID__(){this.set_stop(),this._isActive.getValue()&&this.set_start()},set_start(){navigator.mediaDevices&&(this.restore=!1,navigator.mediaDevices.getUserMedia({audio:{deviceId:this._mediaDeviceID.getValue()}}).then(e=>{const t=this.getBrowser().getAudioContext();this.mediaStreamAudioSourceNode=new MediaStreamAudioSourceNode(t,{mediaStream:e}),this._isActive.getValue()?this._isPaused.getValue()||!this.getLive().getValue()?this.set_pause():this.set_resume():this.set_stop()}).catch(e=>{console.error(e.message)}))},set_pause(){if(this.mediaStreamAudioSourceNode)if(this.getLive().getValue()){this.mediaStreamAudioSourceNode.disconnect();for(const e of this.mediaStreamAudioSourceNode.mediaStream.getAudioTracks())e.enabled=!1;for(const e of this.mediaStreamAudioSourceNode.mediaStream.getVideoTracks())e.enabled=!1}else this.set_stop(!0)},set_resume(){if(this.restore)return this.set_start();if(this.mediaStreamAudioSourceNode){this.mediaStreamAudioSourceNode.connect(this.getAudioSource());for(const e of this.mediaStreamAudioSourceNode.mediaStream.getAudioTracks())e.enabled=!0;for(const e of this.mediaStreamAudioSourceNode.mediaStream.getVideoTracks())e.enabled=!0}},set_stop(e=!1){if(this.mediaStreamAudioSourceNode){this.mediaStreamAudioSourceNode.disconnect();for(const e of this.mediaStreamAudioSourceNode.mediaStream.getAudioTracks())e.stop();for(const e of this.mediaStreamAudioSourceNode.mediaStream.getVideoTracks())e.stop();this.mediaStreamAudioSourceNode=null,this.restore=e}}}),Object.defineProperties(q_,{...Je.A.getStaticProperties("MicrophoneSource","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"mediaDeviceID",new c.A.SFString),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime)]),enumerable:!0}});const W_=q_,K_=s.A.add("MicrophoneSource",W_);function Z_(e){n_.call(this,e),this.addType(m.A.OscillatorSource),this.addChildObjects(m.A.inputOutput,"loop",new c.A.SFBool)}Object.assign(Object.setPrototypeOf(Z_.prototype,n_.prototype),{initialize(){n_.prototype.initialize.call(this),this._detune.addInterest("set_detune__",this),this._frequency.addInterest("set_frequency__",this),this._periodicWave.addInterest("set_periodicWave__",this),this.set_periodicWave__()},set_detune__(){this.oscillatorNode&&(this.oscillatorNode.detune.value=Math.max(this._detune.getValue(),0))},set_frequency__(){this.oscillatorNode&&(this.oscillatorNode.frequency.value=Math.max(this._frequency.getValue(),0))},set_periodicWave__(){this.periodicWaveNode&&(this.periodicWaveNode._type.removeInterest("set_type__",this),this.periodicWaveNode._optionsReal.removeInterest("set_periodicWaveOptions__",this),this.periodicWaveNode._optionsImag.removeInterest("set_periodicWaveOptions__",this)),this.periodicWaveNode=(0,hi.A)(m.A.PeriodicWave,this._periodicWave)??this.getBrowser().getDefaultPeriodicWave(),this.periodicWaveNode._type.addInterest("set_type__",this),this.set_type__()},set_type__:(()=>{const e=new Map([["SINE","sine"],["SQUARE","square"],["SAWTOOTH","sawtooth"],["TRIANGLE","triangle"],["CUSTOM","custom"]]);return function(){if(!this.oscillatorNode)return;this.periodicWaveNode._optionsReal.removeInterest("set_periodicWaveOptions__",this),this.periodicWaveNode._optionsImag.removeInterest("set_periodicWaveOptions__",this);const t=e.get(this.periodicWaveNode._type.getValue())??"square";"custom"===t?(this.periodicWaveNode._optionsReal.addInterest("set_periodicWaveOptions__",this),this.periodicWaveNode._optionsImag.addInterest("set_periodicWaveOptions__",this),this.set_periodicWaveOptions__()):this.oscillatorNode.type=t}})(),set_periodicWaveOptions__(){this.oscillatorNode.setPeriodicWave(this.periodicWaveNode.createPeriodicWave())},set_start(){const e=this.getBrowser().getAudioContext();this.oscillatorNode=new OscillatorNode(e),this.set_detune__(),this.set_frequency__(),this.set_type__(),this.oscillatorNode.connect(this.getAudioSource()),this.oscillatorNode.start()},set_pause(){this.set_stop()},set_resume(){this.set_start()},set_stop(){this.oscillatorNode.stop(),this.oscillatorNode.disconnect()}}),Object.defineProperties(Z_,{...Je.A.getStaticProperties("OscillatorSource","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"detune",new c.A.SFFloat),new o.A(m.A.inputOutput,"frequency",new c.A.SFFloat(440)),new o.A(m.A.inputOutput,"periodicWave",new c.A.SFNode),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime)]),enumerable:!0}});const Q_=Z_,J_=s.A.add("OscillatorSource",Q_);function ey(e){Cl.call(this,e),this.addType(m.A.Sound),this.addChildObjects(m.A.outputOnly,"traversed",new c.A.SFBool(!0)),this.setVisibleObject(!0),this._location.setUnit("length"),this._minBack.setUnit("length"),this._minFront.setUnit("length"),this._maxBack.setUnit("length"),this._maxFront.setUnit("length"),this.childNodes=[],this.currentTraversed=!0}Object.assign(Object.setPrototypeOf(ey.prototype,Cl.prototype),{initialize(){Cl.prototype.initialize.call(this);const e=this.getBrowser().getAudioContext(),t=new GainNode(e,{gain:0}),i=new ChannelSplitterNode(e,{numberOfOutputs:2}),n=new ChannelMergerNode(e,{numberOfInputs:2}),s=new GainNode(e,{gain:0}),r=new GainNode(e,{gain:0}),o=new GainNode(e,{gain:0}),a=new GainNode(e,{gain:0});t.channelCount=2,t.channelCountMode="explicit",t.channelInterpretation="speakers",t.connect(i),i.connect(s,0),i.connect(r,1),i.connect(a,0),i.connect(o,1),s.connect(n,0,0),r.connect(n,0,1),o.connect(n,0,0),a.connect(n,0,1),n.connect(e.destination),this.gainNode=t,this.splitterNode=i,this.gainFrontLeftNode=s,this.gainFrontRightNode=r,this.gainBackLeftNode=o,this.gainBackRightNode=a,this.mergerNode=n,this.getLive().addInterest("set_live__",this),this._traversed.addInterest("set_live__",this),this._intensity.addInterest("set_intensity__",this),this._source.addInterest("set_children__",this),this._children.addInterest("set_children__",this),this.set_live__(),this.set_intensity__(),this.set_children__()},setTraversed(e){e?!1===this._traversed.getValue()&&(this._traversed=!0):this.currentTraversed!==this._traversed.getValue()&&(this._traversed=this.currentTraversed),this.currentTraversed=e},getTraversed(){return this.currentTraversed},setGain(e,t=.5,i=0){const n=1-t**2,s=1-(1-t)**2,r=1-i,o=i;this.gainFrontLeftNode.gain.value=e*r*n,this.gainFrontRightNode.gain.value=e*r*s,this.gainBackLeftNode.gain.value=e*o*n,this.gainBackRightNode.gain.value=e*o*s},set_live__(){if(this.mergerNode.disconnect(),this.getLive().getValue()&&this._traversed.getValue()){const e=this.getBrowser().getAudioContext();this.getBrowser().sensorEvents().addInterest("update",this),this.mergerNode.connect(e.destination)}else this.getBrowser().sensorEvents().removeInterest("update",this)},set_intensity__(){this.gainNode.gain.value=W.A.clamp(this._intensity.getValue(),0,1)},set_children__(){for(const e of this.childNodes)e.getAudioSource().disconnect(this.gainNode);this.childNodes.length=0;const e=(0,hi.A)(m.A.X3DSoundSourceNode,this._source);e&&this.childNodes.push(e);for(const e of this._children){const t=(0,hi.A)(m.A.X3DChildNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DSoundChannelNode:case m.A.X3DSoundProcessingNode:case m.A.X3DSoundSourceNode:this.childNodes.push(t);break;default:continue}break}}for(const e of this.childNodes)e.getAudioSource().connect(this.gainNode);this.setVisibleObject(this.childNodes.length)},update(){this.setTraversed(!1)},traverse:(()=>{const e={distance:0,intersection:new Ee.A},t={distance:0,intersection:new Ee.A};return function(i,n){this.setTraversed(!0);const s=n.getModelViewMatrix().get();if(this.getEllipsoidParameter(s,Math.max(this._maxBack.getValue(),0),Math.max(this._maxFront.getValue(),0),t),t.distance<1){this.getEllipsoidParameter(s,Math.max(this._minBack.getValue(),0),Math.max(this._minFront.getValue(),0),e);const{pan:i,rotation:n}=this.getPan(s);if(e.distance<1)this.setGain(1,i,n);else{const s=t.intersection.norm(),r=t.intersection.distance(e.intersection),o=Math.min(s/r,1);this.setGain(o,i,n)}}else this.setGain(0)}})(),getEllipsoidParameter:(()=>{const e=new Ee.A,t=new Si.A,i=new Si.A,n=new Fn.A,s=new Ee.A(1),r=new Fm(1,Ee.A.ZERO),o=new Ee.A,a=new Ar.A,l=new Ee.A,h=new Ee.A;return function(c,u,d,p){if(0==u||0==d)return t.multVecMatrix(p.intersection.assign(this._location.getValue())),void(p.distance=1);const g=(u+d)/2,f=g-u,m=Math.sqrt(g*g-f*f);e.set(0,0,f),s.set(m,m,g),n.setFromToVec(Ee.A.Z_AXIS,this._direction.getValue()),t.assign(c).translate(this._location.getValue()).rotate(n).translate(e).scale(s),i.assign(t).inverse();const A=i.origin;e.negate().divVec(s),o.assign(e).subtract(A).normalize(),a.set(A,o),r.intersectsLine(a,l,h),p.intersection.assign(t.multVecMatrix(l)),p.distance=A.norm()}})(),getPan:(()=>{const e=new Fn.A,t=new Ee.A,i=new Ee.A,n=new Ee.A,s={};return function(r){return this._spatialize.getValue()?(t.assign(this._location.getValue()),i.assign(this._direction.getValue()),e.setFromToVec(Ee.A.Z_AXIS,i).straighten(),e.multVecRot(n.assign(Ee.A.X_AXIS)),r.multVecMatrix(t).normalize(),r.multDirMatrix(n).normalize(),s.pan=1-Math.acos(W.A.clamp(t.dot(Ee.A.X_AXIS),-1,1))/Math.PI,s.rotation=Math.acos(W.A.clamp(n.dot(Ee.A.X_AXIS),-1,1))/Math.PI,s):(s.pan=.5,s.rotation=0,s)}})()}),Object.defineProperties(ey,{...Je.A.getStaticProperties("Sound","Sound",1,"children","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"spatialize",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"intensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"location",new c.A.SFVec3f),new o.A(m.A.inputOutput,"direction",new c.A.SFVec3f(0,0,1)),new o.A(m.A.inputOutput,"minBack",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"minFront",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"maxBack",new c.A.SFFloat(10)),new o.A(m.A.inputOutput,"maxFront",new c.A.SFFloat(10)),new o.A(m.A.inputOutput,"priority",new c.A.SFFloat),new o.A(m.A.inputOutput,"source",new c.A.SFNode),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const ty=ey,iy=s.A.add("Sound",ty);function ny(e){Cl.call(this,e),this.addType(m.A.SpatialSound),this.addChildObjects(m.A.outputOnly,"traversed",new c.A.SFBool(!0)),this.setVisibleObject(!0),this._location.setUnit("length"),this._coneInnerAngle.setUnit("angle"),this._coneOuterAngle.setUnit("angle"),this._maxDistance.setUnit("length"),this._referenceDistance.setUnit("length"),this.childNodes=[],this.currentTraversed=!0}Object.assign(Object.setPrototypeOf(ny.prototype,Cl.prototype),{initialize(){Cl.prototype.initialize.call(this);const e=this.getBrowser().getAudioContext(),t=new GainNode(e,{gain:0}),i=new PannerNode(e);t.channelCount=2,t.channelCountMode="explicit",t.channelInterpretation="speakers",t.connect(i),i.connect(e.destination),this.gainNode=t,this.pannerNode=i,this.getLive().addInterest("set_live__",this),this._traversed.addInterest("set_live__",this),this._spatialize.addInterest("set_spatialize__",this),this._intensity.addInterest("set_intensity__",this),this._gain.addInterest("set_intensity__",this),this._enableHRTF.addInterest("set_enableHRTF__",this),this._dopplerEnabled.addInterest("set_dopplerEnabled__",this),this._coneOuterGain.addInterest("set_coneOuterGain__",this),this._coneInnerAngle.addInterest("set_coneInnerAngle__",this),this._coneOuterAngle.addInterest("set_coneOuterAngle__",this),this._distanceModel.addInterest("set_distanceModel__",this),this._maxDistance.addInterest("set_maxDistance__",this),this._referenceDistance.addInterest("set_referenceDistance__",this),this._rolloffFactor.addInterest("set_distanceModel__",this),this._children.addInterest("set_children__",this),this.set_live__(),this.set_spatialize__(),this.set_intensity__(),this.set_coneOuterGain__(),this.set_coneInnerAngle__(),this.set_coneOuterAngle__(),this.set_distanceModel__(),this.set_maxDistance__(),this.set_referenceDistance__(),this.set_enableHRTF__(),this.set_dopplerEnabled__(),this.set_children__()},setTraversed(e){e?!1===this._traversed.getValue()&&(this._traversed=!0):this.currentTraversed!==this._traversed.getValue()&&(this._traversed=this.currentTraversed),this.currentTraversed=e},getTraversed(){return this.currentTraversed},set_live__(){if(this.pannerNode.disconnect(),this.getLive().getValue()&&this._traversed.getValue()){const e=this.getBrowser().getAudioContext();this.getBrowser().sensorEvents().addInterest("update",this),this.pannerNode.connect(e.destination)}else this.getBrowser().sensorEvents().removeInterest("update",this)},set_spatialize__(){const e=this.getBrowser().getAudioContext();this.gainNode.disconnect(),this._spatialize.getValue()?this.gainNode.connect(this.pannerNode):this.gainNode.connect(e.destination)},set_intensity__(){this.gainNode.gain.value=W.A.clamp(this._intensity.getValue(),0,1)*this._gain.getValue()},set_coneOuterGain__(){this.pannerNode.coneOuterGain=W.A.clamp(this._coneOuterGain.getValue(),0,1)},set_coneInnerAngle__(){this.pannerNode.coneInnerAngle=W.A.clamp(W.A.degrees(this._coneInnerAngle.getValue()),0,360)},set_coneOuterAngle__(){this.pannerNode.coneOuterAngle=W.A.clamp(W.A.degrees(this._coneOuterAngle.getValue()),0,360)},set_distanceModel__:(()=>{const e=new Map([["LINEAR","linear"],["INVERSE","inverse"],["EXPONENTIAL","exponential"]]);return function(){this.pannerNode.distanceModel=e.get(this._distanceModel.getValue())??"inverse";let t=Math.max(this._rolloffFactor.getValue(),0);"linear"===this.pannerNode.distanceModel&&(t=Math.min(t,1)),this.pannerNode.rolloffFactor=t}})(),set_maxDistance__(){this.pannerNode.maxDistance=Math.max(this._maxDistance.getValue(),0)},set_referenceDistance__(){this.pannerNode.refDistance=Math.max(this._referenceDistance.getValue(),0)},set_enableHRTF__(){this._enableHRTF.getValue()?this.pannerNode.panningModel="HRTF":this.pannerNode.panningModel="equalpower"},set_dopplerEnabled__(){},set_children__(){for(const e of this.childNodes)e.getAudioSource().disconnect(this.gainNode);this.childNodes.length=0;for(const e of this._children){const t=(0,hi.A)(m.A.X3DChildNode,e);if(!t)continue;const i=t.getType();for(let e=i.length-1;e>=0;--e){switch(i[e]){case m.A.X3DSoundChannelNode:case m.A.X3DSoundProcessingNode:case m.A.X3DSoundSourceNode:this.childNodes.push(t);break;default:continue}break}}for(const e of this.childNodes)e.getAudioSource().connect(this.gainNode)},update(){this.setTraversed(!1)},traverse:(()=>{const e=new Ee.A,t=new Ee.A;return function(i,n){this.setTraversed(!0);const s=n.getModelViewMatrix().get();s.multVecMatrix(e.assign(this._location.getValue())),s.multDirMatrix(t.assign(this._direction.getValue())).normalize(),this.pannerNode.positionX.value=e.x,this.pannerNode.positionY.value=e.y,this.pannerNode.positionZ.value=e.z,this.pannerNode.orientationX.value=t.x,this.pannerNode.orientationY.value=t.y,this.pannerNode.orientationZ.value=t.z}})()}),Object.defineProperties(ny,{...Je.A.getStaticProperties("SpatialSound","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"spatialize",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"intensity",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"location",new c.A.SFVec3f),new o.A(m.A.inputOutput,"direction",new c.A.SFVec3f(0,0,1)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"coneOuterGain",new c.A.SFFloat),new o.A(m.A.inputOutput,"coneInnerAngle",new c.A.SFFloat(6.2832)),new o.A(m.A.inputOutput,"coneOuterAngle",new c.A.SFFloat(6.2832)),new o.A(m.A.inputOutput,"distanceModel",new c.A.SFString("INVERSE")),new o.A(m.A.inputOutput,"maxDistance",new c.A.SFFloat(1e4)),new o.A(m.A.inputOutput,"referenceDistance",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"rolloffFactor",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"enableHRTF",new c.A.SFBool),new o.A(m.A.inputOutput,"dopplerEnabled",new c.A.SFBool),new o.A(m.A.inputOutput,"priority",new c.A.SFFloat),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const sy=ny,ry=s.A.add("SpatialSound",sy);function oy(e){u_.call(this,e),this.addType(m.A.StreamAudioDestination);const t=this.getBrowser().getAudioContext();this.mediaStreamAudioDestinationNode=new MediaStreamAudioDestinationNode(t)}Object.assign(Object.setPrototypeOf(oy.prototype,u_.prototype),{initialize(){u_.prototype.initialize.call(this),this._mediaDeviceID.addInterest("set_mediaDeviceID__",this),this.set_mediaDeviceID__()},getSoundDestination(){return this.mediaStreamAudioDestinationNode},set_enabled__(){},set_mediaDeviceID__(){}}),Object.defineProperties(oy,{...Je.A.getStaticProperties("StreamAudioDestination","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"mediaDeviceID",new c.A.SFString),new o.A(m.A.inputOutput,"streamIdentifier",new c.A.MFString),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const ay=oy,ly=s.A.add("StreamAudioDestination",ay);function hy(e){n_.call(this,e),this.addType(m.A.StreamAudioSource),this.addChildObjects(m.A.inputOutput,"loop",new c.A.SFBool)}Object.assign(Object.setPrototypeOf(hy.prototype,n_.prototype),{initialize(){n_.prototype.initialize.call(this)}}),Object.defineProperties(hy,{...Je.A.getStaticProperties("StreamAudioSource","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"streamIdentifier",new c.A.MFString),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime)]),enumerable:!0}});const cy=hy,uy=s.A.add("StreamAudioSource",cy);function dy(e){ZA.call(this,e),this.addType(m.A.WaveShaper);const t=this.getBrowser().getAudioContext();this.waveShaperNode=new WaveShaperNode(t),this.waveShaperNode.connect(this.getAudioSource())}Object.assign(Object.setPrototypeOf(dy.prototype,ZA.prototype),{initialize(){ZA.prototype.initialize.call(this),this._curve.addInterest("set_curve__",this),this._oversample.addInterest("set_oversample__",this),this.setSoundProcessor(this.waveShaperNode),this.set_curve__(),this.set_oversample__()},set_curve__(){this.waveShaperNode.curve=this._curve.length<2?new Float32Array(2):this._curve.shrinkToFit()},set_oversample__:(()=>{const e=new Map([["NONE","none"],["2X","2x"],["4X","4x"]]);return function(){this.waveShaperNode.oversample=e.get(this._oversample.getValue())??"none"}})()}),Object.defineProperties(dy,{...Je.A.getStaticProperties("WaveShaper","Sound",2,"children","4.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"tailTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"curve",new c.A.MFFloat),new o.A(m.A.inputOutput,"oversample",new c.A.SFString("NONE")),new o.A(m.A.inputOutput,"channelCount",new c.A.SFInt32),new o.A(m.A.inputOutput,"channelCountMode",new c.A.SFString("MAX")),new o.A(m.A.inputOutput,"channelInterpretation",new c.A.SFString("SPEAKERS")),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.inputOutput,"children",new c.A.MFNode)]),enumerable:!0}});const py=dy,gy=s.A.add("WaveShaper",py),fy={name:"Sound",concreteNodes:[e_,l_,g_,A_,w_,O_,C_,M_,V_,B_,U_,G_,Y_,K_,J_,Ml,iy,ry,ly,uy,gy],abstractNodes:[S_,u_,Cl,ZA,n_]},my=s.A.add("SoundComponent",fy);var Ay=n(2743);const _y=function(e,t){let i=1,n=0,s=!1;Object.defineProperties(e,{currentTime:{get(){return!s&&n<this.cycle?this.duration:t._elapsedTime*i%this.duration},set:Function.prototype},duration:{get(){return this.get_duration_ms()/1e3}},loop:{get:()=>s,set(e){n=this.cycle,s=e}},cycle:{get(){return Math.floor(t._elapsedTime/this.duration)}},currentFrame:{get(){const e=this.get_length(),t=Math.max(Math.ceil(this.currentTime/this.duration*e)-1,0);return this.get_frames()[t].data}},play:{value(){return n=this.cycle,Promise.resolve()}},playbackRate:{get:()=>i,set(e){i=e}}}),e.pause()},yy=s.A.add("GifMedia",_y);const wy=async function(e,t){const i=document.createElement("canvas"),n=i.getContext("2d"),s=await e.getPlayer(n);i.width=e.width,i.height=e.height,s.stop(),Object.defineProperties(e,{currentTime:{get(){return s.ended?this.duration:s.currentFrameNumber/e.frames.length*this.duration},set(){s.stop()}},duration:{get:()=>e.playTime/1e3},loop:{get:()=>0===e.numPlays,set(t){e.numPlays=t?0:1}},cycle:{get(){return Math.floor(t._elapsedTime/this.duration)}},currentFrame:{get:()=>i},play:{value:()=>(s.play(),Promise.resolve())},pause:{value(){s.pause()}},playbackRate:{get:()=>s.playbackRate,set(e){s.playbackRate=Math.max(e,0)}}})},xy=s.A.add("PNGMedia",wy);var by=n(9340),Sy=n(1526),Ty=n(620);function vy(e){Ay.A.call(this,e),n_.call(this,e),Ma.A.call(this,e),this.addType(m.A.MovieTexture);const t=this.getBrowser().getAudioContext();this.urlStack=new c.A.MFString,this.video=by("<video></video>"),this.sourceNode=t.createMediaElementSource(this.video[0]),this.mediaStreamDestination=t.createMediaStreamDestination(),this.sourceNode.connect(this.getAudioSource()).connect(this.mediaStreamDestination),this.getMatrix().set([1,0,0,0,0,-1,0,0,0,0,1,0,0,1,0,1])}Object.assign(Object.setPrototypeOf(vy.prototype,Ay.A.prototype),n_.prototype,Ma.A.prototype,{initialize(){Ay.A.prototype.initialize.call(this),n_.prototype.initialize.call(this),Ma.A.prototype.initialize.call(this),this._speed.addInterest("set_speed__",this),this._pitch.addInterest("set_speed__",this),this.video.attr("crossorigin","anonymous").attr("preload","auto").attr("playsinline",""),this.requestImmediateLoad().catch(Function.prototype)},set_live__(){n_.prototype.set_live__.call(this),Ma.A.prototype.set_live__.call(this)},getTextureType:()=>1,unloadData(){this.clearTexture(),this.setMediaElement(null)},loadData(){this.urlStack.assign(this._url),this.loadNext()},loadNext(){if(this.clearTimeout(),0===this.urlStack.length)return this.video.off("abort error suspend stalled loadeddata"),this._duration_changed=-1,this.setMediaElement(null),this.clearTexture(),void this.setLoadState(m.A.FAILED_STATE);if(this.URL=new URL(this.urlStack.shift(),this.getExecutionContext().getBaseURL()),"data:"!==this.URL.protocol&&(this.getCache()||this.URL.searchParams.set("_",Date.now())),this.URL.pathname.endsWith(".gif")){const e=by("<img></img>").appendTo(by("<div></div>")),t=new Sy({gif:e[0],on_error:e=>this.setError({type:e})});t.load_url(this.URL,()=>this.setGif(t))}else if(this.URL.pathname.endsWith(".png")){const e=ka.A?window["apng-js"].default:Ty.default;fetch(this.URL,{cache:this.getCache()?"default":"reload"}).then(e=>e.arrayBuffer()).then(t=>e(t)).then(e=>this.setAPNG(e)).catch(e=>this.setError({type:e.message}))}else this.video.on("abort error",this.setError.bind(this)).on("suspend stalled",this.setTimeout.bind(this)).on("loadeddata",this.setVideo.bind(this)).attr("src",this.URL).get(0).load()},setTimeout(e){this.clearTimeout(),this.timeoutId=setTimeout(()=>this.setError(e),3e4)},clearTimeout(){clearTimeout(this.timeoutId)},setError(e){"data:"!==this.URL.protocol&&console.warn(`Error loading movie '${decodeURI(this.URL)}':`,e.type),this.loadNext()},setVideo(){try{ka.A&&"data:"!==this.URL.protocol&&console.info(`Done loading movie '${decodeURI(this.URL)}'.`);const e=this.video[0],t=e.videoWidth,i=e.videoHeight;this.video.off("abort error suspend stalled loadeddata"),this.clearTimeout(),this._duration_changed=e.duration,e.currentFrame=e,this.setMediaElement(e),this.setTextureData(t,i,!0,!1,e),this.setLoadState(m.A.COMPLETE_STATE),this.set_speed__()}catch(e){this.setError({type:e.message})}},setGif(e){try{yy(e,this),this._duration_changed=e.duration,this.setMediaElement(e),this.setTextureData(e.get_canvas().width,e.get_canvas().height,!0,!1,e.get_frames()[0].data),this.setLoadState(m.A.COMPLETE_STATE),this.set_speed__()}catch(e){this.setError({type:e.message})}},async setAPNG(e){try{await xy(e,this),this._duration_changed=e.duration,this.setMediaElement(e),this.setTextureData(e.width,e.height,!0,!1,e.currentFrame),this.setLoadState(m.A.COMPLETE_STATE),this.set_speed__()}catch(e){this.setError({type:e.message})}},set_gain__(){n_.prototype.set_gain__.call(this),this.video.prop("muted",0===this._gain.getValue())},set_speed__(){const e=this.getMediaElement();if(e){try{e.playbackRate=this._speed.getValue()*Math.max(this._pitch.getValue(),0)}catch(t){console.error(t.message),e.playbackRate=1}e.preservesPitch=1===this._pitch.getValue()}},set_time(){n_.prototype.set_time.call(this);const e=this.getMediaElement();e&&this.updateTextureData(e.currentFrame)},traverse:Ay.A.prototype.traverse,dispose(){Ma.A.prototype.dispose.call(this),n_.prototype.dispose.call(this),Ay.A.prototype.dispose.call(this)}}),Object.defineProperties(vy,{...Je.A.getStaticProperties("MovieTexture","Texturing",3,"texture","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"enabled",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"load",new c.A.SFBool(!0)),new o.A(m.A.inputOutput,"url",new c.A.MFString),new o.A(m.A.inputOutput,"autoRefresh",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"autoRefreshTimeLimit",new c.A.SFTime(3600)),new o.A(m.A.inputOutput,"gain",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"pitch",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"speed",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"loop",new c.A.SFBool),new o.A(m.A.inputOutput,"startTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"resumeTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"pauseTime",new c.A.SFTime(0)),new o.A(m.A.inputOutput,"stopTime",new c.A.SFTime(0)),new o.A(m.A.outputOnly,"isPaused",new c.A.SFBool),new o.A(m.A.outputOnly,"isActive",new c.A.SFBool),new o.A(m.A.outputOnly,"elapsedTime",new c.A.SFTime),new o.A(m.A.outputOnly,"duration_changed",new c.A.SFTime),new o.A(m.A.initializeOnly,"repeatS",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"repeatT",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"textureProperties",new c.A.SFNode)]),enumerable:!0}});const Oy=vy,Ey=s.A.add("MovieTexture",Oy);var Ny=n(9713);function Cy(e){Ny.A.call(this,e),this.addType(m.A.MultiTexture);const t=this.getBrowser();this.maxTextures=t.getMaxTextures(),this.color=new Float32Array(4),this.modes=[],this.alphaModes=[],this.sources=[],this.functions=[],this.textureNodes=[]}Object.assign(Object.setPrototypeOf(Cy.prototype,Ny.A.prototype),{initialize(){Ny.A.prototype.initialize.call(this),this._color.addInterest("set_color__",this),this._alpha.addInterest("set_alpha__",this),this._mode.addInterest("set_mode__",this),this._source.addInterest("set_source__",this),this._function.addInterest("set_function__",this),this._texture.addInterest("set_texture__",this),this.set_color__(),this.set_alpha__(),this.set_mode__(),this.set_source__(),this.set_function__(),this.set_texture__()},getCount(){return Math.min(this.maxTextures,this.textureNodes.length)},getMode(e){return e<this.modes.length?this.modes[e]:fa.MODULATE},getAlphaMode(e){return e<this.alphaModes.length?this.alphaModes[e]:fa.MODULATE},getSource(e){return e<this.sources.length?this.sources[e]:_a.DEFAULT},getFunction(e){return e<this.functions.length?this.functions[e]:xa.DEFAULT},set_color__(){this.color[0]=this._color.r,this.color[1]=this._color.g,this.color[2]=this._color.b},set_alpha__(){this.color[3]=this._alpha},set_mode__:(()=>{const e=new Map([["REPLACE",fa.REPLACE],["MODULATE",fa.MODULATE],["MODULATE2X",fa.MODULATE2X],["MODULATE4X",fa.MODULATE4X],["ADD",fa.ADD],["ADDSIGNED",fa.ADDSIGNED],["ADDSIGNED2X",fa.ADDSIGNED2X],["ADDSMOOTH",fa.ADDSMOOTH],["SUBTRACT",fa.SUBTRACT],["BLENDDIFFUSEALPHA",fa.BLENDDIFFUSEALPHA],["BLENDTEXTUREALPHA",fa.BLENDTEXTUREALPHA],["BLENDFACTORALPHA",fa.BLENDFACTORALPHA],["BLENDCURRENTALPHA",fa.BLENDCURRENTALPHA],["MODULATEALPHA_ADDCOLOR",fa.MODULATEALPHA_ADDCOLOR],["MODULATEINVALPHA_ADDCOLOR",fa.MODULATEINVALPHA_ADDCOLOR],["MODULATEINVCOLOR_ADDALPHA",fa.MODULATEINVCOLOR_ADDALPHA],["DOTPRODUCT3",fa.DOTPRODUCT3],["SELECTARG1",fa.SELECTARG1],["SELECTARG2",fa.SELECTARG2],["OFF",fa.OFF]]);return function(){this.modes.length=0,this.alphaModes.length=0;for(const t of this._mode){const i=t.split(",");for(let e=0,t=i.length;e<t;++e)i[e]=i[e].trim();0===i.length&&i.push("MODULATE"),i.length<2&&i.push(i[0]);const n=e.get(i[0]);void 0!==n?this.modes.push(n):this.modes.push(fa.MODULATE);const s=e.get(i[1]);void 0!==s?this.alphaModes.push(s):this.alphaModes.push(fa.MODULATE)}}})(),set_source__:(()=>{const e=new Map([["DIFFUSE",_a.DIFFUSE],["SPECULAR",_a.SPECULAR],["FACTOR",_a.FACTOR]]);return function(){this.sources.length=0;for(const t of this._source){const i=e.get(t);void 0!==i?this.sources.push(i):this.sources.push(_a.DEFAULT)}}})(),set_function__:(()=>{const e=new Map([["COMPLEMENT",xa.COMPLEMENT],["ALPHAREPLICATE",xa.ALPHAREPLICATE]]);return function(){this.functions.length=0;for(const t of this._function){const i=e.get(t);void 0!==i?this.functions.push(i):this.functions.push(xa.DEFAULT)}}})(),set_texture__(){for(const e of this.textureNodes)e._linear.removeInterest("addNodeEvent",this);this.textureNodes.length=0;for(const e of this._texture){const t=(0,hi.A)(m.A.X3DSingleTextureNode,e);t&&this.textureNodes.push(t)}for(const e of this.textureNodes)e._linear.addInterest("addNodeEvent",this)},updateTextureBits(e){const t=this.maxTextures,i=this.textureNodes,n=Math.min(t,i.length);for(let t=0;t<n;++t)i[t].updateTextureBits(e,t);e.set(2*t,1)},getShaderOptions(e){const t=this.textureNodes,i=Math.min(this.maxTextures,t.length);for(let n=0;n<i;++n)t[n].getShaderOptions(e,n)},traverse(e,t){for(const i of this.textureNodes)i.traverse(e,t)},setShaderUniforms(e,t,i){const n=this.textureNodes,s=Math.min(this.maxTextures,n.length);e.uniform4fv(i.x3d_MultiTextureColor,this.color);for(let t=0;t<s;++t){const s=i.x3d_MultiTexture[t];n[t].setShaderUniforms(e,i.x3d_Texture[t]),e.uniform1i(s.mode,this.getMode(t)),e.uniform1i(s.alphaMode,this.getAlphaMode(t)),e.uniform1i(s.source,this.getSource(t)),e.uniform1i(s.function,this.getFunction(t))}}}),Object.defineProperties(Cy,{...Je.A.getStaticProperties("MultiTexture","Texturing",2,"texture","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"color",new c.A.SFColor(1,1,1)),new o.A(m.A.inputOutput,"alpha",new c.A.SFFloat(1)),new o.A(m.A.inputOutput,"mode",new c.A.MFString),new o.A(m.A.inputOutput,"source",new c.A.MFString),new o.A(m.A.inputOutput,"function",new c.A.MFString),new o.A(m.A.inputOutput,"texture",new c.A.MFNode)]),enumerable:!0}});const Iy=Cy,Fy=s.A.add("MultiTexture",Iy);function My(e){Gl.call(this,e),this.addType(m.A.MultiTextureTransform);const t=this.getBrowser();this.maxTextureTransforms=t.getMaxTextureTransforms(),this.textureTransformNodes=[]}Object.assign(Object.setPrototypeOf(My.prototype,Gl.prototype),{initialize(){Gl.prototype.initialize.call(this),this._textureTransform.addInterest("set_textureTransform__",this),this.set_textureTransform__()},set_textureTransform__(){const e=this.textureTransformNodes;e.length=0;for(const t of this._textureTransform){const i=(0,hi.A)(m.A.X3DSingleTextureTransformNode,t);i&&e.push(i)}e.length||e.push(this.getBrowser().getDefaultTextureTransform())},getCount(){return Math.min(this.maxTextureTransforms,this.textureTransformNodes.length)},getTextureTransformMapping(e){const t=this.textureTransformNodes,i=Math.min(this.maxTextureTransforms,t.length);for(let n=0;n<i;++n)t[n].getTextureTransformMapping(e,n)},setShaderUniforms(e,t){const i=this.textureTransformNodes,n=Math.min(this.maxTextureTransforms,i.length);for(let s=0;s<n;++s)i[s].setShaderUniforms(e,t,s)},transformPoint(e){return this.textureTransformNodes[0].transformPoint(e)}}),Object.defineProperties(My,{...Je.A.getStaticProperties("MultiTextureTransform","Texturing",2,"textureTransform","3.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"textureTransform",new c.A.MFNode)]),enumerable:!0}});const Ry=My,Py=s.A.add("MultiTextureTransform",Ry);function Vy(e){Ay.A.call(this,e),this.addType(m.A.PixelTexture),this.addChildObjects(m.A.outputOnly,"loadState",new c.A.SFInt32(m.A.NOT_STARTED_STATE))}Object.assign(Object.setPrototypeOf(Vy.prototype,Ay.A.prototype),{initialize(){Ay.A.prototype.initialize.call(this),this._image.addInterest("set_image__",this),this.set_image__()},getTextureType:()=>2,checkLoadState(){return this._loadState.getValue()},convert(e,t,i,n){switch(t){case 1:for(let t=0,s=0;t<n;++t,s+=4){const n=i[t];e[s]=e[s+1]=e[s+2]=255&n,e[s+3]=255}break;case 2:for(let t=0,s=0;t<n;++t,s+=4){const n=i[t];e[s]=e[s+1]=e[s+2]=n>>>8&255,e[s+3]=255&n}break;case 3:for(let t=0,s=0;t<n;++t,s+=4){const n=i[t];e[s]=n>>>16&255,e[s+1]=n>>>8&255,e[s+2]=255&n,e[s+3]=255}break;case 4:for(let t=0,s=0;t<n;++t,s+=4){const n=i[t];e[s]=n>>>24,e[s+1]=n>>>16&255,e[s+2]=n>>>8&255,e[s+3]=255&n}}},set_image__(){try{const e=this._image.comp,t=this._image.array,i=!(e%2),n=this._image.width,s=this._image.height;if(n<0||s<0||e<0||e>4)throw new Error(`At least one dimension (${n} × ${s} or components ${e}) is invalid.`);if(0===n||0===s||0===e)return this.clearTexture(),void(this._loadState=m.A.COMPLETE_STATE);const r=new Uint8Array(n*s*4);this.convert(r,e,t.getValue(),t.length),this.setTextureData(n,s,!0,i&&this.isImageTransparent(r),r),this._loadState=m.A.COMPLETE_STATE}catch(e){console.error(e),this.clearTexture(),this._loadState=m.A.FAILED_STATE}}}),Object.defineProperties(Vy,{...Je.A.getStaticProperties("PixelTexture","Texturing",1,"texture","2.0"),fieldDefinitions:{value:new a.A([new o.A(m.A.inputOutput,"metadata",new c.A.SFNode),new o.A(m.A.inputOutput,"description",new c.A.SFString),new o.A(m.A.inputOutput,"image",new c.A.SFImage),new o.A(m.A.initializeOnly,"repeatS",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"repeatT",new c.A.SFBool(!0)),new o.A(m.A.initializeOnly,"textureProperties",new c.A.SFNode)]),enumerable:!0}});const Dy=Vy,Ly=s.A.add("PixelTexture",Dy);var By=n(2361);const ky={name:"Texturing",concreteNodes:[Qi.A,Ey,Fy,eg,Py,Ly,Rt,ng,it,Kl],abstractNodes:[Ct,By.A,Yl,Ay.A,Ot,Ny.A,Gl]},jy=s.A.add("TexturingComponent",ky),Uy={name:"Time",concreteNodes:[Ln.A],abstractNodes:[qA.A]},Xy=s.A.add("TimeComponent",Uy);let zy=!1;const Gy={add({name:e,concreteNodes:t,abstractNodes:i,browserContext:n}){ac.addComponent({name:e,concreteNodes:t,abstractNodes:i,browserContext:n,external:zy})}};Gy.add(du),Gy.add(Eu),Gy.add(zu),Gy.add(qd),Gy.add(gp),Gy.add(dg),Gy.add(af),Gy.add(uf),Gy.add(If),Gy.add($f),Gy.add(cm),Gy.add(Vm),Gy.add(oA),Gy.add(CA),Gy.add(YA),Gy.add(my),Gy.add(jy),Gy.add(Xy),zy=!0;const Hy=Gy;s.A.add("Components",Hy);var $y=n(9340);const Yy=Symbol(),qy=Symbol(),Wy=Symbol(),Ky=Symbol(),Zy=Symbol(),Qy=Symbol(),Jy=Symbol(),ew=Symbol(),tw=Symbol(),iw=Symbol(),nw=Symbol.for("X_ITE.X3DRoutingContext.processEvents");function sw(e){if((e=$y(e)).prop("browser"))throw new Error("Couldn't create browser, element has already a browser.");ac.call(this,e),this.addType(m.A.X3DBrowser),this[qy]=Nc.copy(),this[Wy]=Tc.copy(),this[Ky]=zh.copy(),this[Zy]=Lh.copy(),this[Qy]=Mc.copy(),this[iw]=document.getElementsByClassName("x_ite-console"),this[tw]=new Map([[m.A.CONNECTION_ERROR,new Map],[m.A.BROWSER_EVENT,new Map],[m.A.INITIALIZED_EVENT,new Map],[m.A.SHUTDOWN_EVENT,new Map],[m.A.INITIALIZED_ERROR,new Map]]),this.setup()}Object.assign(Object.setPrototypeOf(sw.prototype,ac.prototype),{initialize(){ac.prototype.initialize.call(this);const e=new ye.A(this);e.setup(),this.replaceWorld(e).catch(ka.A?e=>console.error(e):Function.prototype),this[Yy]=new dc(this),g.browser(this),this[nw].call(this),this.getInstanceId()>1||this.getBrowserOption("Debug")&&this.print(this.getWelcomeMessage())},getWelcomeMessage(){return`Welcome to ${this.name} X3D Browser v${this.version}:\n Current Graphics Renderer\n Name: ${this.getVendor()} ${this.getRenderer()}\n WebGL version: ${this.getWebGLVersion()}\n Shading language: ${this.getShadingLanguageVersion()}\n WebXR: ${"xr"in navigator}\n Rendering Properties\n ContentScale: ${this.getRenderingProperty("ContentScale")}\n Antialiased: ${this.getRenderingProperty("Antialiased")}\n Max samples: ${this.getMaxSamples()}\n Depth size: ${this.getDepthSize()} bits\n Color depth: ${this.getColorDepth()} bits\n Max clip planes per shape: ${this.getMaxClipPlanes()}\n Max lights per shape: ${this.getMaxLights()}\n Max textures per shape: ${this.getMaxTextures()}\n Max texture size: ${this.getMaxTextureSize()} × ${this.getMaxTextureSize()} pixels\n Texture memory: ${this.getTextureMemory()||"n/a"}\n Texture units: ${this.getMaxCombinedTextureUnits()}\n Max vertex uniform vectors: ${this.getMaxVertexUniformVectors()}\n Max fragment uniform vectors: ${this.getMaxFragmentUniformVectors()}\n Max vertex attribs: ${this.getMaxVertexAttribs()}\n Max varying vectors: ${this.getMaxVaryingVectors()}\n`},getName:()=>"X_ITE",getVersion:()=>f.A,getDescription(){return this.getNotification()._string.getValue()},setDescription(e){this.getNotification()._string=e},getWorldURL(){return this.currentScene.worldURL},getProfile(e){const t=this[qy].get(String(e));if(t)return t;throw Error(`Profile '${e}' is not supported.`)},addSupportedProfile:function(e){this[qy].add(e.name,e)},updateSupportedProfile:function(e){this[qy].update(e.name,e.name,e)},removeSupportedProfile(e){return this[qy].remove(String(e))},getSupportedProfile(e){const t=this[qy].get(String(e));if(t)return t;throw new Error(`Supported profile '${e}' does not exists.`)},getSupportedProfiles(){return this[qy]},getComponent(e,t){e=String(e),t|=0;const i=this[Wy].get(e);if(i)return new Ac.A(i.name,W.A.clamp(t||i.level,1,i.level),i.title,i.providerURL,i.external,i.dependencies);throw Error(`Component '${e}' at level '${t}' is not supported.`)},addSupportedComponent(e){this[Wy].add(e.name,e)},updateSupportedComponent(e){this[Wy].update(e.name,e.name,e)},removeSupportedComponent(e){this[Wy].remove(String(e))},getSupportedComponent(e){const t=this[Wy].get(String(e));if(t)return t;throw new Error(`Supported component '${e}' does not exists.`)},getSupportedComponents(){return this[Wy]},loadComponents:(()=>{function e(e,i){return Promise.all(e.map(e=>t.call(this,e,i)))}async function t({name:t,providerURL:i,external:s,dependencies:r},o){if(!o.has(t)&&(o.add(t),await e.call(this,r.map(e=>this[Wy].get(e)),o),s))switch(Ne.A.ENVIRONMENT){case"NODE":n.g.require(n.g.require("url").fileURLToPath(i));break;case"BROWSER":case"MODULE":await import(i)}}return function(...t){const i=[];for(const e of t)e instanceof ye.A?i.push(...(e.profile??this.getProfile("Full")).components,...e.components):e instanceof mc?i.push(...e.components):e instanceof _c.A?i.push(...e):e instanceof Ac.A?i.push(e):"string"==typeof e&&i.push(this.getComponent(e));return e.call(this,i,new Set)}})(),addConcreteNode(e){this[Ky].add(e.typeName,e)},updateConcreteNode(e){this[Ky].update(e.typeName,e.typeName,e)},removeConcreteNode(e){this[Ky].remove(e.typeName)},getConcreteNode(e){const t=this[Ky].get(String(e));if(t)return t;throw new Error(`Concrete node '${e}' does not exists.`)},getConcreteNodes(){return this[Ky]},addAbstractNode(e){this[Zy].add(e.typeName,e)},updateAbstractNode(e){this[Zy].update(e.typeName,e.typeName,e)},removeAbstractNode(e){this[Zy].remove(e.typeName)},getAbstractNode(e){const t=this[Zy].get(String(e));if(t)return t;throw new Error(`Abstract node '${e}' does not exists.`)},getAbstractNodes(){return this[Zy]},getFieldType(e){const t=this[Qy].get(String(e));if(t)return t;throw new Error(`Field type '${e}' does not exists.`)},getFieldTypes(){return this[Qy]},async createScene(e,...t){const i=new ye.A(this);if(arguments.length){if(!(e instanceof mc))throw new Error("Couldn't create scene: profile must be of type ProfileInfo.");i.setProfile(e);for(const e of t){if(!(e instanceof Ac.A))throw new Error("Couldn't create scene: component must be of type ComponentInfo.");i.addComponent(e)}}return i.setup(),i.setLive(!0),await this.loadComponents(i),i},replaceWorld(e){return new Promise(async(t,i)=>{if(this[ew]?.abort(),this[Jy]?.("Replacing world aborted."),this[Jy]=i,this.setBrowserLoading(!0),this.getWorld()){if(await this.nextFrame(),this[Jy]!==i)return;if(this.getExecutionContext().setLive(!1),this.shutdown().processInterests(),this.callBrowserCallbacks(m.A.SHUTDOWN_EVENT),this.callBrowserEventHandler("shutdown"),this[Jy]!==i)return}if(e instanceof c.A.MFNode){const t=e;e=new ye.A(this);for(const i of t.filter(e=>e))e.getLive().addInterest("setLive",i.getValue().getExecutionContext());e.setRootNodes(t),e.setup()}e instanceof ye.A||(e=new ye.A(this)).setup(),e.setExecutionContext(null),e.setLive(!0),this.setExecutionContext(e),this.setDescription(""),this._loadCount.addInterest("checkLoadCount",this,t,i),this._loadCount.addEvent()})},checkLoadCount(e,t,i){this[Jy]===t&&(i.getValue()||(i.removeInterest("checkLoadCount",this),this.setBrowserLoading(!1),this.initialized().set(this.getCurrentTime()),this.initialized().processInterests(),this.callBrowserCallbacks(m.A.INITIALIZED_EVENT),this.callBrowserEventHandler("initialized load"),e()))},createVrmlFromString(e){const t=this.isExternal(),i=this.currentScene,n=t?this.getBaseURL():i.getWorldURL(),s=new Ra.default(this.getScriptNode()??this.getWorld()).createX3DFromString(n,`#VRML V2.0 utf8\n\n${e}`);return t||s.setExecutionContext(i),s.setLive(!0),s.rootNodes},async createX3DFromString(e){e=String(e);const t=this.isExternal(),i=this.currentScene,n=t?this.getBaseURL():i.getWorldURL(),s=new Ra.default(this.getScriptNode()??this.getWorld()),r=await new Promise((t,i)=>{s.createX3DFromString(n,e,t,i)});return t||r.setExecutionContext(i),r.setLive(!0),r},createVrmlFromURL(e,t,i){if(t=(0,hi.A)(m.A.X3DNode,t,!1),i=String(i),!(e instanceof c.A.MFString))throw new Error("Browser.createVrmlFromURL: url must be of type MFString.");if(!t)throw new Error("Browser.createVrmlFromURL: node must be of type X3DNode.");const n=t.getField(i);if(!n.isInput())throw new Error(`Browser.createVrmlFromURL: event named '${i}' must be a input field.`);if(n.getType()!==m.A.MFNode)throw new Error(`Browser.createVrmlFromURL: event named '${i}' must be of type MFNode.`);const s=this.currentScene,r=this.isExternal(),o=new Ra.default(this.getScriptNode()??this.getWorld());this.addLoadingObject(o),o.createX3DFromURL(e,null,e=>{this.removeLoadingObject(o),e&&(r||e.setExecutionContext(s),e.setLive(!0),n.setValue(e.rootNodes))})},createX3DFromURL(e,t,i){if(3===arguments.length)return this.createVrmlFromURL(e,t,i);if(!(e instanceof c.A.MFString))throw new Error("Browser.createX3DFromURL: url must be of type MFString.");return new Promise((t,i)=>{const n=this.currentScene,s=this.isExternal(),r=new Ra.default(this.getScriptNode()??this.getWorld());this.addLoadingObject(r),r.createX3DFromURL(e,null,e=>{this.removeLoadingObject(r),e?(s||e.setExecutionContext(n),e.setLive(!0),t(e)):i(new Error("Couldn't load X3D file."))})})},loadURL(e,t=new c.A.MFString){return new Promise((i,n)=>{if(!(e instanceof c.A.MFString))throw new Error("Browser.loadURL: url must be of type MFString.");if(!(t instanceof c.A.MFString))throw new Error("Browser.loadURL: parameter must be of type MFString.");const s=new Ra.default(this.getScriptNode()??this.getWorld());s.createX3DFromURL(e,t,e=>{s.ready=!0,this[ew]!==s?(this.removeLoadingObject(s),n(new Error("Loading of X3D file aborted."))):(this.getBrowserOption("SplashScreen")||this.getCanvas().show(),e?(this.addLoadingObject(this),this.replaceWorld(e).then(i).catch(n),this.removeLoadingObject(this),this.removeLoadingObject(s)):(this.callBrowserCallbacks(m.A.CONNECTION_ERROR),this.callBrowserEventHandler("error"),setTimeout(()=>{this.getSplashScreen().find(".x_ite-private-spinner-text").text(N("Failed loading world."))}),n(new Error("Couldn't load X3D file."))))},e=>{s.ready=!0,this.changeViewpoint(e),this.removeLoadingObject(s),i()},(e,t)=>{s.ready=!0,t?window.open(e,t):location=e,this.removeLoadingObject(s),i()}),s.ready||(this[ew]?.abort(),this.setBrowserLoading(!0),this.addLoadingObject(this[ew]=s))})},addBrowserListener(e,t){},removeBrowserListener(e){},addBrowserCallback(...e){switch(e.length){case 2:{const[t,i]=e;for(const[e,n]of this[tw])this[tw].set(e,new Map(n).set(t,i));break}case 3:{const[t,i,n]=e,s=new Map(this[tw].get(i));this[tw].set(i,s),s.set(t,n);break}}},removeBrowserCallback(...e){switch(e.length){case 1:{const[t]=e;for(const e of this[tw].values())e.delete(t);break}case 2:{const[t,i]=e;this[tw].get(i).delete(t);break}}},getBrowserCallbacks(e){return 1===arguments.length?this[tw].get(e):new Map([...this[tw]].flatMap(([e,t])=>[...t]))},callBrowserCallbacks(e){for(const t of this[tw].get(e).values())t(e)},async importDocument(e){const t=this.currentScene,i=new ye.A(this),n=this.isExternal(),s=new lc.A(i);return s.setInput(e),await new Promise(s.parseIntoScene.bind(s)),n||i.setExecutionContext(t),i.isLive(!0),i},async importJS(e){const t=this.currentScene,i=new ye.A(this),n=this.isExternal(),s=new Rc.A(i);return s.setInput(e),await new Promise(s.parseIntoScene.bind(s)),n||i.setExecutionContext(t),i.isLive(!0),i},getBrowserProperty(e){return this.getBrowserProperties().getField(e).getValue()},setBrowserOption(e,t){this.getBrowserOptions().getField(e).setValue(t)},getBrowserOption(e){return this.getBrowserOptions().getField(e).getValue()},getRenderingProperty(e){return this.getRenderingProperties().getField(e).getValue()},viewAll(e,t=1){1===arguments.length&&"number"==typeof e&&(t=e),e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer(),t=+t,e?.viewAll(t,1,this.getBrowserOption("StraightenHorizon"))},firstViewpoint(e){e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer();const t=e?.getUserViewpoints();t?.length&&this.bindViewpoint(e,t.at(0))},previousViewpoint(e){e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer();const t=e?.getUserViewpoints();if(!t?.length)return;const i=t.findIndex(e=>e._isBound.getValue());this.bindViewpoint(e,t.at(i>-1?i-1:-1))},nextViewpoint(e){e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer();const t=e?.getUserViewpoints();if(!t?.length)return;const i=t.findIndex(e=>e._isBound.getValue());this.bindViewpoint(e,t.at((i+1)%t.length))},lastViewpoint(e){e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer();const t=e?.getUserViewpoints();t?.length&&this.bindViewpoint(e,t.at(-1))},changeViewpoint(e,t){1===arguments.length&&(t=e,e=this.getActiveLayer()),e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer(),t=String(t);const i=e?.getViewpoints().get().find(e=>e.getName()===t);i&&this.bindViewpoint(e,i)},bindViewpoint(e,t){if(e=(0,hi.A)(m.A.X3DLayerNode,e),t=(0,hi.A)(m.A.X3DViewpointNode,t),!e)throw new Error("Browser.bindViewpoint: layerNode must be of type X3DLayerNode.");if(!t)throw new Error("Browser.bindViewpoint: viewpointNode must be of type X3DViewpointNode.");t.setVRMLTransition(!0),t._set_bind=!0},addRoute(e,t,i,n){this.currentScene.addRoute(e,t,i,n)},deleteRoute(e,t,i,n){this.currentScene.deleteRoute(e,t,i,n)},constrainTranslation(e,t){1===arguments.length&&(t=e,e=this.getActiveLayer()),e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer();const i=e?.constrainTranslation(t.getValue());return i?new c.A.SFVec3f(...i):null},getClosestObject(e,t){1===arguments.length&&(t=e,e=this.getActiveLayer()),e=(0,hi.A)(m.A.X3DLayerNode,e)??this.getActiveLayer();const i=e?.getClosestObject(t.getValue());return i?.node?{node:hc.A.get(i.node),distance:i.distance,normal:new c.A.SFVec3f(...i.normal)}:{node:null,distance:1/0,normal:null}},beginUpdate(){this.setLive(!0),this.advanceOnlyTime(),this.addBrowserEvent()},endUpdate(){this.getViewer().disconnect(),this.setLive(!1)},print(...e){const t=e.map(e=>String(e)).join(" ");console.log(t);for(const e of this[iw])e.append(document.createTextNode(t))},println(...e){const t=e.map(e=>String(e)).join(" ");console.log(t);for(const e of this[iw])e.append(document.createTextNode(`${t}\n`))},toVRMLStream(e){this.currentScene.toVRMLStream(e)},toXMLStream(e){this.currentScene.toXMLStream(e)},toJSONStream(e){this.currentScene.toJSONStream(e)},dispose(){this[Yy].dispose(),ac.prototype.dispose.call(this)}});for(const e of Object.keys(sw.prototype))Object.defineProperty(sw.prototype,e,{enumerable:!1});Object.defineProperties(sw.prototype,{name:{get:sw.prototype.getName,enumerable:!0},version:{value:f.A,enumerable:!0},providerURL:{get:sw.prototype.getProviderURL,enumerable:!0},providerUrl:{get:sw.prototype.getProviderURL,enumerable:!1},currentFrameRate:{get:sw.prototype.getCurrentFrameRate,enumerable:!0},currentSpeed:{get:sw.prototype.getCurrentSpeed,enumerable:!0},description:{get:sw.prototype.getDescription,set:sw.prototype.setDescription,enumerable:!0},baseURL:{get:sw.prototype.getBaseURL,set:sw.prototype.setBaseURL,enumerable:!0},supportedProfiles:{get:sw.prototype.getSupportedProfiles,enumerable:!0},supportedComponents:{get:sw.prototype.getSupportedComponents,enumerable:!0},concreteNodes:{get:sw.prototype.getConcreteNodes,enumerable:!0},abstractNodes:{get:sw.prototype.getAbstractNodes,enumerable:!0},fieldTypes:{get:sw.prototype.getFieldTypes,enumerable:!0},currentScene:{get(){return this.getScriptNode()?.getExecutionContext()??this.getExecutionContext()},enumerable:!0},activeLayer:{get(){return this.getActiveLayer()===this.getWorld().getLayer0()?null:this._activeLayer.valueOf()},enumerable:!0},activeNavigationInfo:{get(){return this.getActiveNavigationInfo()===this.getActiveLayer()?.getNavigationInfoStack().get()[0]?null:this._activeNavigationInfo.valueOf()},enumerable:!0},activeViewpoint:{get(){return this.getActiveViewpoint()===this.getActiveLayer()?.getViewpointStack().get()[0]?null:this._activeViewpoint.valueOf()},enumerable:!0},contextMenu:{get:sw.prototype.getContextMenu,enumerable:!0},element:{get(){return this.getElement()[0]},enumerable:!0}}),Object.defineProperties(sw,{fieldDefinitions:{value:new a.A([new o.A(m.A.outputOnly,"activeLayer",new c.A.SFNode),new o.A(m.A.outputOnly,"activeNavigationInfo",new c.A.SFNode),new o.A(m.A.outputOnly,"activeViewpoint",new c.A.SFNode)]),enumerable:!0},typeName:{value:"X3DBrowser",enumerable:!0}}),m.A.addConstant(sw.typeName);const rw=sw,ow=s.A.add("X3DBrowser",rw);var aw=n(2894),lw=n(7233),hw=n(2244),cw=n(9101),uw=n(8894),dw=n(6761),pw=n(6529),gw=n(6366),fw=n(611),mw=n(6061),Aw=n(2417),_w=n(6007),yw=n(4632),ww=n(5542),xw=n(8588),bw=n(9340);class Sw extends HTMLElement{browser;constructor(){try{super(),new ow(this)}catch(e){console.error(e),bw(this.shadowRoot).append(bw("<slot></slot>")).children(".x_ite-private-browser").remove()}}connectedCallback(){this.browser?.connectedCallback()}disconnectedCallback(){this.browser?.disconnectedCallback()}static get observedAttributes(){const e=["antialiased","baseURL","cache","colorSpace","contentScale","contextMenu","debug","exposure","logarithmicDepthBuffer","maximumFrameRate","multisampling","notifications","oninitialized","onshutdown","orderIndependentTransparency","splashScreen","src","textCompression","timings","toneMapping","update","url","xrSessionMode"];return e.concat(e.map(e=>e.toLowerCase()))}attributeChangedCallback(e,t,i){this.browser?.attributeChangedCallback(e,t,i)}captureStream(...e){return this.browser?.getCanvas()[0].captureStream(...e)}toBlob(...e){return this.browser?.getCanvas()[0].toBlob(...e)}toDataURL(...e){return this.browser?.getCanvas()[0].toDataURL(...e)}get[Symbol.toStringTag](){return"X3DCanvasElement"}}document.createElement("X3DCanvas");const Tw=Sw,vw=s.A.add("X3DCanvasElement",Tw);function Ow(e,t){this.array=e,t&&(this.compare=t)}Object.assign(Ow.prototype,{compare:(e,t)=>e<t,sort(e,t){t-e>1&&this.quicksort(e,t-1)},quicksort(e,t){let i=e,n=t;const{array:s,compare:r}=this,o=s[e+t>>>1];for(;;){for(;r(s[i],o);)++i;for(;r(o,s[n]);)--n;if(!(i<n)){i===n&&(++i,--n);break}{const e=s[i];s[i]=s[n],s[n]=e,i++,n--}}e<n&&this.quicksort(e,n),i<t&&this.quicksort(i,t)}});const Ew=Ow;s.A.add("QuickSort",Ew);var Nw=n(9340),Cw=n(1891);Object.assign(Nw,{decodeText:e=>"string"==typeof e?e:(new TextDecoder).decode(e),sleep:e=>new Promise(t=>setTimeout(t,e)),toLowerCaseFirst:e=>e[0].toLowerCase()+e.slice(1),toUpperCaseFirst:e=>e[0].toUpperCase()+e.slice(1),try(e,t=!1){try{return e()}catch(e){t&&console.error(e)}},ungzip(e){try{return Cw.ungzip(e,{to:"raw"}).buffer}catch(t){return e}}});const Iw=Nw;s.A.add("jquery",Iw);const Fw=n(5704);s.A.add("libtess",Fw);var Mw=n(9340);let Rw;const Pw=Object.assign(function(e,t){return Rw??=new Promise((e,t)=>{Mw(()=>{try{if(g.elements(Mw("X3DCanvas"),ow),!Array.from(Mw("x3d-canvas")).every(e=>e.browser))throw new Error("Couldn't create browser.");e()}catch(e){g.error(Mw("X3DCanvas"),e),t(e)}})}),Rw.then(e).catch(t)},s.A,s.A.Fields,{X3DConstants:m.A,X3DBrowser:ow,X3DExecutionContext:hw.A,X3DScene:ye.A,ComponentInfo:Ac.A,ComponentInfoArray:_c.A,ProfileInfo:mc,ProfileInfoArray:xc,ConcreteNodesArray:Uh,AbstractNodesArray:Vh,UnitInfo:aw.A,UnitInfoArray:lw.A,NamedNodesArray:cw.A,ImportedNodesArray:uw.A,X3DImportedNode:dw.A,ExportedNodesArray:pw.A,X3DExportedNode:gw.A,ExternProtoDeclarationArray:fw.A,ProtoDeclarationArray:mw.A,X3DExternProtoDeclaration:Aw.A,X3DProtoDeclaration:_w.A,X3DProtoDeclarationNode:yw.A,RouteArray:ww.A,X3DRoute:xw.A,X3DBaseNode:r.A,X3DFieldDefinition:o.A,FieldDefinitionArray:a.A,X3DField:l.A,X3DArrayField:h.A,...c.A},{require:e=>s.A[e.match(/([^\/]+)$/)?.[1]],noConflict:(()=>{const e=window.hasOwnProperty("X3D"),t=window.X3D;return function(){return window.X3D===Pw&&(e?window.X3D=t:delete window.X3D),Pw}})(),getBrowser:e=>Mw(e||"x3d-canvas, X3DCanvas").filter("x3d-canvas, X3DCanvas").prop("browser"),createBrowser(...e){const t=document.createElement("x3d-canvas");return e.length&&t.browser.loadURL(...e),t},toString(){return Object.prototype.toString.call(this)},[Symbol.toStringTag]:"X3D"}),Vw=Pw;window[Symbol.for("X_ITE.X3D-12.2.4")]=Vw,customElements.define("x3d-canvas",vw),Vw();const Dw=Vw;export{Dw as default};