@netless/slide 0.2.10 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Slide.js CHANGED
@@ -32,13 +32,13 @@ object-assign
32
32
  *
33
33
  * MIT License
34
34
  */
35
- function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){if(!this.ctx||!this.ctx.listener)return this;for(var e=this._howls.length-1;e>=0;e--)this._howls[e].stereo(t);return this},HowlerGlobal.prototype.pos=function(t,e,n){return this.ctx&&this.ctx.listener?(e="number"!=typeof e?this._pos[1]:e,n="number"!=typeof n?this._pos[2]:n,"number"!=typeof t?this._pos:(this._pos=[t,e,n],void 0!==this.ctx.listener.positionX?(this.ctx.listener.positionX.setTargetAtTime(this._pos[0],Howler.ctx.currentTime,.1),this.ctx.listener.positionY.setTargetAtTime(this._pos[1],Howler.ctx.currentTime,.1),this.ctx.listener.positionZ.setTargetAtTime(this._pos[2],Howler.ctx.currentTime,.1)):this.ctx.listener.setPosition(this._pos[0],this._pos[1],this._pos[2]),this)):this},HowlerGlobal.prototype.orientation=function(t,e,n,i,r,o){if(!this.ctx||!this.ctx.listener)return this;var s=this._orientation;return e="number"!=typeof e?s[1]:e,n="number"!=typeof n?s[2]:n,i="number"!=typeof i?s[3]:i,r="number"!=typeof r?s[4]:r,o="number"!=typeof o?s[5]:o,"number"!=typeof t?s:(this._orientation=[t,e,n,i,r,o],void 0!==this.ctx.listener.forwardX?(this.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),this.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),this.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),this.ctx.listener.upX.setTargetAtTime(i,Howler.ctx.currentTime,.1),this.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),this.ctx.listener.upZ.setTargetAtTime(o,Howler.ctx.currentTime,.1)):this.ctx.listener.setOrientation(t,e,n,i,r,o),this)},Howl.prototype.init=(t=Howl.prototype.init,function(e){return this._orientation=e.orientation||[1,0,0],this._stereo=e.stereo||null,this._pos=e.pos||null,this._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},this._onstereo=e.onstereo?[{fn:e.onstereo}]:[],this._onpos=e.onpos?[{fn:e.onpos}]:[],this._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,n){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"stereo",action:function(){i.stereo(t,n)}}),i;var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof t)return i._stereo;i._stereo=t,i._pos=[t,0,0]}for(var o=i._getSoundIds(n),s=0;s<o.length;s++){var a=i._soundById(o[s]);if(a){if("number"!=typeof t)return a._stereo;a._stereo=t,a._pos=[t,0,0],a._node&&(a._pannerAttr.panningModel="equalpower",a._panner&&a._panner.pan||e(a,r),"spatial"===r?void 0!==a._panner.positionX?(a._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),a._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),a._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):a._panner.setPosition(t,0,0):a._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),i._emit("stereo",a._id)}}return i},Howl.prototype.pos=function(t,n,i,r){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"pos",action:function(){o.pos(t,n,i,r)}}),o;if(n="number"!=typeof n?0:n,i="number"!=typeof i?-.5:i,void 0===r){if("number"!=typeof t)return o._pos;o._pos=[t,n,i]}for(var s=o._getSoundIds(r),a=0;a<s.length;a++){var l=o._soundById(s[a]);if(l){if("number"!=typeof t)return l._pos;l._pos=[t,n,i],l._node&&(l._panner&&!l._panner.pan||e(l,"spatial"),void 0!==l._panner.positionX?(l._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setPosition(t,n,i)),o._emit("pos",l._id)}}return o},Howl.prototype.orientation=function(t,n,i,r){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"orientation",action:function(){o.orientation(t,n,i,r)}}),o;if(n="number"!=typeof n?o._orientation[1]:n,i="number"!=typeof i?o._orientation[2]:i,void 0===r){if("number"!=typeof t)return o._orientation;o._orientation=[t,n,i]}for(var s=o._getSoundIds(r),a=0;a<s.length;a++){var l=o._soundById(s[a]);if(l){if("number"!=typeof t)return l._orientation;l._orientation=[t,n,i],l._node&&(l._panner||(l._pos||(l._pos=o._pos||[0,0,-.5]),e(l,"spatial")),void 0!==l._panner.orientationX?(l._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setOrientation(t,n,i)),o._emit("orientation",l._id)}}return o},Howl.prototype.pannerAttr=function(){var t,n,i,r=this,o=arguments;if(!r._webAudio)return r;if(0===o.length)return r._pannerAttr;if(1===o.length){if("object"!=typeof o[0])return(i=r._soundById(parseInt(o[0],10)))?i._pannerAttr:r._pannerAttr;t=o[0],void 0===n&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:r._panningModel})}else 2===o.length&&(t=o[0],n=parseInt(o[1],10));for(var s=r._getSoundIds(n),a=0;a<s.length;a++)if(i=r._soundById(s[a])){var l=i._pannerAttr;l={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:l.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:l.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:l.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:l.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:l.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:l.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:l.panningModel};var u=i._panner;u?(u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel):(i._pos||(i._pos=r._pos||[0,0,-.5]),e(i,"spatial"))}return r},Sound.prototype.init=function(t){return function(){var e=this._parent;this._orientation=e._orientation,this._stereo=e._stereo,this._pos=e._pos,this._pannerAttr=e._pannerAttr,t.call(this),this._stereo?e.stereo(this._stereo):this._pos&&e.pos(this._pos[0],this._pos[1],this._pos[2],this._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var e=this._parent;return this._orientation=e._orientation,this._stereo=e._stereo,this._pos=e._pos,this._pannerAttr=e._pannerAttr,this._stereo?e.stereo(this._stereo):this._pos?e.pos(this._pos[0],this._pos[1],this._pos[2],this._id):this._panner&&(this._panner.disconnect(0),this._panner=void 0,e._refreshBuffer(this)),t.call(this)}}(Sound.prototype.reset);var e=function(t,e){"spatial"===(e=e||"spatial")?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,void 0!==t._panner.positionX?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),void 0!==t._panner.orientationX?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}}()}).call(this,n(4))},function(t,e){t.exports="varying vec2 vTextureCoord;\nvarying vec2 vVertexPosition;\nvarying float vPercent;\nvarying float vDirection;\nvarying float vTransition;\nuniform sampler2D uSampler;\nvoid main() {\n\tvec4 outputColor;\n\tfloat percent = vPercent;\n\tfloat direction = vDirection;\n\tif (vTransition < 0.0) {\n\t\tpercent = 1.0 - percent;\n\t\tif ((vDirection > 1.5) && (vDirection < 2.5)) {\n\t\t\tdirection = 1.0;\n\t\t}\n\t\telse if ((vDirection > 0.5) && (vDirection < 1.5)) {\n\t\t\tdirection = 2.0;\n\t\t}\n\t\telse if ((vDirection > 2.5) && (vDirection < 3.5)) {\n\t\t\tdirection = 4.0;\n\t\t}\n\t\telse {\n\t\t\tdirection = 3.0;\n\t\t}\n\t}\n\tif ((direction > 1.5) && (direction < 2.5)) {\n\t\tif (vVertexPosition.y >= (1.0 - percent)) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.y >= (1.0 - percent)) && (vVertexPosition.y <= ((1.0 - percent) + 0.2))) {\n\t\t\toutputColor = outputColor * ((vVertexPosition.y - (1.0 - percent)) / 0.2);\n\t\t}\n\t}\n\telse if ((direction > 0.5) && (direction < 1.5)) {\n\t\tif (vVertexPosition.y <= percent) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.y <= percent) && (vVertexPosition.y >= (percent - 0.2))) {\n\t\t\toutputColor = outputColor * (1.0 - ((vVertexPosition.y - (percent - 0.2)) / 0.2));\n\t\t}\n\t}\n\telse if ((direction > 2.5) && (direction < 3.5)) {\n\t\tif (vVertexPosition.x <= percent) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.x <= percent) && (vVertexPosition.x >= (percent - 0.2))) {\n\t\t\toutputColor = outputColor * (1.0 - ((vVertexPosition.x - (percent - 0.2)) / 0.2));\n\t\t}\n\t}\n\telse {\n\t\tif (vVertexPosition.x >= (1.0 - percent)) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.x >= (1.0 - percent)) && (vVertexPosition.x <= ((1.0 - percent) + 0.2))) {\n\t\t\toutputColor = outputColor * ((vVertexPosition.x - (1.0 - percent)) / 0.2);\n\t\t}\n\t}\n\tgl_FragColor = outputColor;\n}\n"},function(t,e){t.exports="attribute vec2 aVertexPosition;\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\nvarying vec2 vVertexPosition;\nvarying float vPercent;\nvarying float vDirection;\nvarying float vTransition;\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\nuniform float percent;\nuniform float direction;\nuniform float transition;\nvec4 filterVertexPosition() {\n\tvec2 position = (aVertexPosition * max(outputFrame.zw, vec2(0.))) + outputFrame.xy;\n\treturn vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\nvec2 filterTextureCoord(vec2 aVertexPosition) {\n\treturn aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\nvoid main() {\n\tvTransition = transition;\n\tvDirection = direction;\n\tvPercent = percent;\n\tvVertexPosition = aVertexPosition;\n\tvec2 localVertexPosition = aVertexPosition;\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord(localVertexPosition);\n}\n"},function(t,e){t.exports="varying vec2 vTextureCoord;\nuniform float percent;\nuniform sampler2D uSampler;\nuniform float transition;\nvoid main() {\n\tfloat alpha = (transition * (percent - 0.5)) + 0.5;\n\tvec4 color1 = texture2D(uSampler, vTextureCoord);\n\tgl_FragColor = color1 * alpha;\n}\n"},function(t,e,n){var i;!function(r,o){"use strict";var s="model",a="name",l="type",u="vendor",h="version",c="mobile",d="tablet",p="smarttv",f=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},m=function(t,e){return"string"==typeof t&&-1!==g(e).indexOf(g(t))},g=function(t){return t.toLowerCase()},v=function(t,e){if("string"==typeof t)return t=t.replace(/^\s\s*/,"").replace(/\s\s*$/,""),void 0===e?t:t.substring(0,255)},_=function(t,e){for(var n,i,r,o,s,a,l=0;l<e.length&&!s;){var u=e[l],h=e[l+1];for(n=i=0;n<u.length&&!s;)if(s=u[n++].exec(t))for(r=0;r<h.length;r++)a=s[++i],"object"==typeof(o=h[r])&&o.length>0?2===o.length?"function"==typeof o[1]?this[o[0]]=o[1].call(this,a):this[o[0]]=o[1]:3===o.length?"function"!=typeof o[1]||o[1].exec&&o[1].test?this[o[0]]=a?a.replace(o[1],o[2]):void 0:this[o[0]]=a?o[1].call(this,a,o[2]):void 0:4===o.length&&(this[o[0]]=a?o[3].call(this,a.replace(o[1],o[2])):void 0):this[o]=a||void 0;l+=2}},y=function(t,e){for(var n in e)if("object"==typeof e[n]&&e[n].length>0){for(var i=0;i<e[n].length;i++)if(m(e[n][i],t))return"?"===n?void 0:n}else if(m(e[n],t))return"?"===n?void 0:n;return t},x={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},b={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[a,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[a,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[a,h],[/opios[\/ ]+([\w\.]+)/i],[h,[a,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[h,[a,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[a,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[a,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[h,[a,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[a,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[a,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[a,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[a,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[a,/(.+)/,"$1 Secure Browser"],h],[/\bfocus\/([\w\.]+)/i],[h,[a,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[h,[a,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[a,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[a,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[a,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[a,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[h,[a,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[a,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[a,/(.+)/,"$1 Browser"],h],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[a,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[a],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[a,"Facebook"],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[a,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[a,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[a,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[a,"Chrome WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[a,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[a,h],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[h,[a,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[h,a],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[a,[h,y,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[a,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[a,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[a,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[a,h]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",g]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[["architecture","arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/windows (ce|mobile); ppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[["architecture",/ower/,"",g]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[["architecture",g]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[s,[u,"Samsung"],[l,d]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[s,[u,"Samsung"],[l,c]],[/\((ip(?:hone|od)[\w ]*);/i],[s,[u,"Apple"],[l,c]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[s,[u,"Apple"],[l,d]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[s,[u,"Huawei"],[l,d]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[s,[u,"Huawei"],[l,c]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[s,/_/g," "],[u,"Xiaomi"],[l,c]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[s,/_/g," "],[u,"Xiaomi"],[l,d]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[s,[u,"OPPO"],[l,c]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[s,[u,"Vivo"],[l,c]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[s,[u,"Realme"],[l,c]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[s,[u,"Motorola"],[l,c]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[s,[u,"Motorola"],[l,d]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[s,[u,"LG"],[l,d]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[s,[u,"LG"],[l,c]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[s,[u,"Lenovo"],[l,d]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[s,/_/g," "],[u,"Nokia"],[l,c]],[/(pixel c)\b/i],[s,[u,"Google"],[l,d]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[s,[u,"Google"],[l,c]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[s,[u,"Sony"],[l,c]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[s,"Xperia Tablet"],[u,"Sony"],[l,d]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[s,[u,"OnePlus"],[l,c]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[s,[u,"Amazon"],[l,d]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[s,/(.+)/g,"Fire Phone $1"],[u,"Amazon"],[l,c]],[/(playbook);[-\w\),; ]+(rim)/i],[s,u,[l,d]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[s,[u,"BlackBerry"],[l,c]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[s,[u,"ASUS"],[l,d]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[s,[u,"ASUS"],[l,c]],[/(nexus 9)/i],[s,[u,"HTC"],[l,d]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[u,[s,/_/g," "],[l,c]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[s,[u,"Acer"],[l,d]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[s,[u,"Meizu"],[l,c]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[s,[u,"Sharp"],[l,c]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[u,s,[l,c]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[u,s,[l,d]],[/(surface duo)/i],[s,[u,"Microsoft"],[l,d]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[s,[u,"Fairphone"],[l,c]],[/(u304aa)/i],[s,[u,"AT&T"],[l,c]],[/\bsie-(\w*)/i],[s,[u,"Siemens"],[l,c]],[/\b(rct\w+) b/i],[s,[u,"RCA"],[l,d]],[/\b(venue[\d ]{2,7}) b/i],[s,[u,"Dell"],[l,d]],[/\b(q(?:mv|ta)\w+) b/i],[s,[u,"Verizon"],[l,d]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[s,[u,"Barnes & Noble"],[l,d]],[/\b(tm\d{3}\w+) b/i],[s,[u,"NuVision"],[l,d]],[/\b(k88) b/i],[s,[u,"ZTE"],[l,d]],[/\b(nx\d{3}j) b/i],[s,[u,"ZTE"],[l,c]],[/\b(gen\d{3}) b.+49h/i],[s,[u,"Swiss"],[l,c]],[/\b(zur\d{3}) b/i],[s,[u,"Swiss"],[l,d]],[/\b((zeki)?tb.*\b) b/i],[s,[u,"Zeki"],[l,d]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[u,"Dragon Touch"],s,[l,d]],[/\b(ns-?\w{0,9}) b/i],[s,[u,"Insignia"],[l,d]],[/\b((nxa|next)-?\w{0,9}) b/i],[s,[u,"NextBook"],[l,d]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[u,"Voice"],s,[l,c]],[/\b(lvtel\-)?(v1[12]) b/i],[[u,"LvTel"],s,[l,c]],[/\b(ph-1) /i],[s,[u,"Essential"],[l,c]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[s,[u,"Envizen"],[l,d]],[/\b(trio[-\w\. ]+) b/i],[s,[u,"MachSpeed"],[l,d]],[/\btu_(1491) b/i],[s,[u,"Rotor"],[l,d]],[/(shield[\w ]+) b/i],[s,[u,"Nvidia"],[l,d]],[/(sprint) (\w+)/i],[u,s,[l,c]],[/(kin\.[onetw]{3})/i],[[s,/\./g," "],[u,"Microsoft"],[l,c]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[s,[u,"Zebra"],[l,d]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[s,[u,"Zebra"],[l,c]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[u,s,[l,"console"]],[/droid.+; (shield) bui/i],[s,[u,"Nvidia"],[l,"console"]],[/(playstation [345portablevi]+)/i],[s,[u,"Sony"],[l,"console"]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[s,[u,"Microsoft"],[l,"console"]],[/smart-tv.+(samsung)/i],[u,[l,p]],[/hbbtv.+maple;(\d+)/i],[[s,/^/,"SmartTV"],[u,"Samsung"],[l,p]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[u,"LG"],[l,p]],[/(apple) ?tv/i],[u,[s,"Apple TV"],[l,p]],[/crkey/i],[[s,"Chromecast"],[u,"Google"],[l,p]],[/droid.+aft(\w)( bui|\))/i],[s,[u,"Amazon"],[l,p]],[/\(dtv[\);].+(aquos)/i],[s,[u,"Sharp"],[l,p]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[u,v],[s,v],[l,p]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,p]],[/((pebble))app/i],[u,s,[l,"wearable"]],[/droid.+; (glass) \d/i],[s,[u,"Google"],[l,"wearable"]],[/droid.+; (wt63?0{2,3})\)/i],[s,[u,"Zebra"],[l,"wearable"]],[/(quest( 2)?)/i],[s,[u,"Facebook"],[l,"wearable"]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[u,[l,"embedded"]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[s,[l,c]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[s,[l,d]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,d]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,c]],[/(android[-\w\. ]{0,9});.+buil/i],[s,[u,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[a,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[a,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[a,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,a]],os:[[/microsoft (windows) (vista|xp)/i],[a,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[a,[h,y,x]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[a,"Windows"],[h,y,x]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[a,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[a,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[h,a],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[a,h],[/\(bb(10);/i],[h,[a,"BlackBerry"]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[a,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[a,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[a,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[a,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[a,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[a,h],[/(sunos) ?([\w\.\d]*)/i],[[a,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[a,h]]},w=function(t,e){if("object"==typeof t&&(e=t,t=void 0),!(this instanceof w))return new w(t,e).getResult();var n=t||(void 0!==r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),i=e?function(t,e){var n={};for(var i in t)e[i]&&e[i].length%2==0?n[i]=e[i].concat(t[i]):n[i]=t[i];return n}(b,e):b;return this.getBrowser=function(){var t,e={};return e[a]=void 0,e[h]=void 0,_.call(e,n,i.browser),e.major="string"==typeof(t=e.version)?t.replace(/[^\d\.]/g,"").split(".")[0]:void 0,e},this.getCPU=function(){var t={architecture:void 0};return _.call(t,n,i.cpu),t},this.getDevice=function(){var t={vendor:void 0,model:void 0,type:void 0};return _.call(t,n,i.device),t},this.getEngine=function(){var t={name:void 0,version:void 0};return _.call(t,n,i.engine),t},this.getOS=function(){var t={name:void 0,version:void 0};return _.call(t,n,i.os),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(t){return n="string"==typeof t&&t.length>255?v(t,255):t,this},this.setUA(n),this};w.VERSION="1.0.2",w.BROWSER=f([a,h,"major"]),w.CPU=f(["architecture"]),w.DEVICE=f([s,u,l,"console",c,p,d,"wearable","embedded"]),w.ENGINE=w.OS=f([a,h]),void 0!==e?(void 0!==t&&t.exports&&(e=t.exports=w),e.UAParser=w):n(64)?void 0===(i=function(){return w}.call(e,n,e,t))||(t.exports=i):void 0!==r&&(r.UAParser=w);var T=void 0!==r&&(r.jQuery||r.Zepto);if(T&&!T.ua){var S=new w;T.ua=S.getResult(),T.ua.get=function(){return S.getUA()},T.ua.set=function(t){S.setUA(t);var e=S.getResult();for(var n in e)T.ua[n]=e[n]}}}("object"==typeof window?window:this)},function(t,e,n){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(56),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(4))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var i,r,o,s,a,l=1,u={},h=!1,c=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},i=function(t){o.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,i=function(t){var e=c.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):i=function(t){setTimeout(f,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&f(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),i=function(e){t.postMessage(s+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return u[l]=r,i(l),l++},d.clearImmediate=p}function p(t){delete u[t]}function f(t){if(h)setTimeout(f,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{p(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(4),n(57))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var l,u=[],h=!1,c=-1;function d(){h&&l&&(h=!1,l.length?u=l.concat(u):c=-1,u.length&&p())}function p(){if(!h){var t=a(d);h=!0;for(var e=u.length;e;){for(l=u,u=[];++c<e;)l&&l[c].run();c=-1,e=u.length}l=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function m(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new f(t,e)),1!==u.length||h||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){(function(t,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof i&&i;s.global!==s&&s.window!==s&&s.self;var a,l=2147483647,u=/^xn--/,h=/[^\x20-\x7E]/,c=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,f=String.fromCharCode;function m(t){throw new RangeError(d[t])}function g(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function v(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),i+g((t=t.replace(c,".")).split("."),e).join(".")}function _(t){for(var e,n,i=[],r=0,o=t.length;r<o;)(e=t.charCodeAt(r++))>=55296&&e<=56319&&r<o?56320==(64512&(n=t.charCodeAt(r++)))?i.push(((1023&e)<<10)+(1023&n)+65536):(i.push(e),r--):i.push(e);return i}function y(t){return g(t,(function(t){var e="";return t>65535&&(e+=f((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=f(t)})).join("")}function x(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function b(t,e,n){var i=0;for(t=n?p(t/700):t>>1,t+=p(t/e);t>455;i+=36)t=p(t/35);return p(i+36*t/(t+38))}function w(t){var e,n,i,r,o,s,a,u,h,c,d,f=[],g=t.length,v=0,_=128,x=72;for((n=t.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)t.charCodeAt(i)>=128&&m("not-basic"),f.push(t.charCodeAt(i));for(r=n>0?n+1:0;r<g;){for(o=v,s=1,a=36;r>=g&&m("invalid-input"),((u=(d=t.charCodeAt(r++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||u>p((l-v)/s))&&m("overflow"),v+=u*s,!(u<(h=a<=x?1:a>=x+26?26:a-x));a+=36)s>p(l/(c=36-h))&&m("overflow"),s*=c;x=b(v-o,e=f.length+1,0==o),p(v/e)>l-_&&m("overflow"),_+=p(v/e),v%=e,f.splice(v++,0,_)}return y(f)}function T(t){var e,n,i,r,o,s,a,u,h,c,d,g,v,y,w,T=[];for(g=(t=_(t)).length,e=128,n=0,o=72,s=0;s<g;++s)(d=t[s])<128&&T.push(f(d));for(i=r=T.length,r&&T.push("-");i<g;){for(a=l,s=0;s<g;++s)(d=t[s])>=e&&d<a&&(a=d);for(a-e>p((l-n)/(v=i+1))&&m("overflow"),n+=(a-e)*v,e=a,s=0;s<g;++s)if((d=t[s])<e&&++n>l&&m("overflow"),d==e){for(u=n,h=36;!(u<(c=h<=o?1:h>=o+26?26:h-o));h+=36)w=u-c,y=36-c,T.push(f(x(c+w%y,0))),u=p(w/y);T.push(f(x(u,0))),o=b(n,v,i==r),n=0,++i}++n,++e}return T.join("")}a={version:"1.4.1",ucs2:{decode:_,encode:y},decode:w,encode:T,toASCII:function(t){return v(t,(function(t){return h.test(t)?"xn--"+T(t):t}))},toUnicode:function(t){return v(t,(function(t){return u.test(t)?w(t.slice(4).toLowerCase()):t}))}},void 0===(r=function(){return a}.call(e,n,e,t))||(t.exports=r)}()}).call(this,n(8)(t),n(4))},function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,n){"use strict";e.decode=e.parse=n(61),e.encode=e.stringify=n(62)},function(t,e,n){"use strict";function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,o){e=e||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var h=0;h<u;++h){var c,d,p,f,m=t[h].replace(a,"%20"),g=m.indexOf(n);g>=0?(c=m.substr(0,g),d=m.substr(g+1)):(c=m,d=""),p=decodeURIComponent(c),f=decodeURIComponent(d),i(s,p)?r(s[p])?s[p].push(f):s[p]=[s[p],f]:s[p]=f}return s};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,a){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?o(s(t),(function(s){var a=encodeURIComponent(i(s))+n;return r(t[s])?o(t[s],(function(t){return a+encodeURIComponent(i(t))})).join(e):a+encodeURIComponent(i(t[s]))})).join(e):a?encodeURIComponent(i(a))+n+encodeURIComponent(i(t)):""};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var n=[],i=0;i<t.length;i++)n.push(e(t[i],i));return n}var s=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},function(t,e){var n=function(){};n.prototype={fit:function(t){var e,n,i,r,o=t.length,s=o>0?t[0].width:0,a=o>0?t[0].height:0;for(this.root={x:0,y:0,width:s,height:a},e=0;e<o;e++)i=t[e],(n=this.findNode(this.root,i.width,i.height))?(r=this.splitNode(n,i.width,i.height),i.x=r.x,i.y=r.y):(r=this.growNode(i.width,i.height),i.x=r.x,i.y=r.y)},findNode:function(t,e,n){return t.used?this.findNode(t.right,e,n)||this.findNode(t.down,e,n):e<=t.width&&n<=t.height?t:null},splitNode:function(t,e,n){return t.used=!0,t.down={x:t.x,y:t.y+n,width:t.width,height:t.height-n},t.right={x:t.x+e,y:t.y,width:t.width-e,height:n},t},growNode:function(t,e){var n=t<=this.root.width,i=e<=this.root.height,r=i&&this.root.height>=this.root.width+t,o=n&&this.root.width>=this.root.height+e;return r?this.growRight(t,e):o?this.growDown(t,e):i?this.growRight(t,e):n?this.growDown(t,e):null},growRight:function(t,e){var n;return this.root={used:!0,x:0,y:0,width:this.root.width+t,height:this.root.height,down:this.root,right:{x:this.root.width,y:0,width:t,height:this.root.height}},(n=this.findNode(this.root,t,e))?this.splitNode(n,t,e):null},growDown:function(t,e){var n;return this.root={used:!0,x:0,y:0,width:this.root.width,height:this.root.height+e,down:{x:0,y:this.root.height,width:this.root.width,height:e},right:this.root},(n=this.findNode(this.root,t,e))?this.splitNode(n,t,e):null}},t.exports=n},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";n.r(e),n.d(e,"delay",(function(){return JP})),n.d(e,"waitUntil",(function(){return KP})),n.d(e,"SLIDE_EVENTS",(function(){return $P})),n.d(e,"Slide",(function(){return eI}));var i={};n.r(i),n.d(i,"ACESFilmicToneMapping",(function(){return lt})),n.d(i,"AddEquation",(function(){return I})),n.d(i,"AddOperation",(function(){return it})),n.d(i,"AdditiveAnimationBlendMode",(function(){return $e})),n.d(i,"AdditiveBlending",(function(){return A})),n.d(i,"AlphaFormat",(function(){return zt})),n.d(i,"AlwaysDepth",(function(){return Y})),n.d(i,"AlwaysStencilFunc",(function(){return Pn})),n.d(i,"AmbientLight",(function(){return Uc})),n.d(i,"AmbientLightProbe",(function(){return sd})),n.d(i,"AnimationClip",(function(){return oc})),n.d(i,"AnimationLoader",(function(){return pc})),n.d(i,"AnimationMixer",(function(){return Fd})),n.d(i,"AnimationObjectGroup",(function(){return Nd})),n.d(i,"AnimationUtils",(function(){return Xh})),n.d(i,"ArcCurve",(function(){return Au})),n.d(i,"ArrayCamera",(function(){return $a})),n.d(i,"ArrowHelper",(function(){return Ep})),n.d(i,"Audio",(function(){return vd})),n.d(i,"AudioAnalyser",(function(){return Td})),n.d(i,"AudioContext",(function(){return id})),n.d(i,"AudioListener",(function(){return gd})),n.d(i,"AudioLoader",(function(){return rd})),n.d(i,"AxesHelper",(function(){return Mp})),n.d(i,"AxisHelper",(function(){return Mf})),n.d(i,"BackSide",(function(){return b})),n.d(i,"BasicDepthPacking",(function(){return cn})),n.d(i,"BasicShadowMap",(function(){return g})),n.d(i,"BinaryTextureLoader",(function(){return If})),n.d(i,"Bone",(function(){return Bl})),n.d(i,"BooleanKeyframeTrack",(function(){return $h})),n.d(i,"BoundingBoxHelper",(function(){return Af})),n.d(i,"Box2",(function(){return Xd})),n.d(i,"Box3",(function(){return gi})),n.d(i,"Box3Helper",(function(){return xp})),n.d(i,"BoxBufferGeometry",(function(){return Ao})),n.d(i,"BoxGeometry",(function(){return Ao})),n.d(i,"BoxHelper",(function(){return yp})),n.d(i,"BufferAttribute",(function(){return kr})),n.d(i,"BufferGeometry",(function(){return so})),n.d(i,"BufferGeometryLoader",(function(){return Xc})),n.d(i,"ByteType",(function(){return It})),n.d(i,"Cache",(function(){return ac})),n.d(i,"Camera",(function(){return Oo})),n.d(i,"CameraHelper",(function(){return gp})),n.d(i,"CanvasRenderer",(function(){return Lf})),n.d(i,"CanvasTexture",(function(){return pu})),n.d(i,"CatmullRomCurve3",(function(){return Lu})),n.d(i,"CineonToneMapping",(function(){return at})),n.d(i,"CircleBufferGeometry",(function(){return mu})),n.d(i,"CircleGeometry",(function(){return mu})),n.d(i,"ClampToEdgeWrapping",(function(){return _t})),n.d(i,"Clock",(function(){return hd})),n.d(i,"Color",(function(){return Dr})),n.d(i,"ColorKeyframeTrack",(function(){return Qh})),n.d(i,"CompressedTexture",(function(){return du})),n.d(i,"CompressedTextureLoader",(function(){return fc})),n.d(i,"ConeBufferGeometry",(function(){return vu})),n.d(i,"ConeGeometry",(function(){return vu})),n.d(i,"CubeCamera",(function(){return No})),n.d(i,"CubeReflectionMapping",(function(){return ct})),n.d(i,"CubeRefractionMapping",(function(){return dt})),n.d(i,"CubeTexture",(function(){return Do})),n.d(i,"CubeTextureLoader",(function(){return gc})),n.d(i,"CubeUVReflectionMapping",(function(){return mt})),n.d(i,"CubeUVRefractionMapping",(function(){return gt})),n.d(i,"CubicBezierCurve",(function(){return Bu})),n.d(i,"CubicBezierCurve3",(function(){return Uu})),n.d(i,"CubicInterpolant",(function(){return Yh})),n.d(i,"CullFaceBack",(function(){return p})),n.d(i,"CullFaceFront",(function(){return f})),n.d(i,"CullFaceFrontBack",(function(){return m})),n.d(i,"CullFaceNone",(function(){return d})),n.d(i,"Curve",(function(){return Eu})),n.d(i,"CurvePath",(function(){return yc})),n.d(i,"CustomBlending",(function(){return P})),n.d(i,"CustomToneMapping",(function(){return ut})),n.d(i,"CylinderBufferGeometry",(function(){return gu})),n.d(i,"CylinderGeometry",(function(){return gu})),n.d(i,"Cylindrical",(function(){return Vd})),n.d(i,"DataTexture",(function(){return Ul})),n.d(i,"DataTexture2DArray",(function(){return hs})),n.d(i,"DataTexture3D",(function(){return cs})),n.d(i,"DataTextureLoader",(function(){return vc})),n.d(i,"DataUtils",(function(){return Cp})),n.d(i,"DecrementStencilOp",(function(){return yn})),n.d(i,"DecrementWrapStencilOp",(function(){return bn})),n.d(i,"DefaultLoadingManager",(function(){return uc})),n.d(i,"DepthFormat",(function(){return Yt})),n.d(i,"DepthStencilFormat",(function(){return Zt})),n.d(i,"DepthTexture",(function(){return fu})),n.d(i,"DirectionalLight",(function(){return Bc})),n.d(i,"DirectionalLightHelper",(function(){return pp})),n.d(i,"DiscreteInterpolant",(function(){return Jh})),n.d(i,"DodecahedronBufferGeometry",(function(){return yu})),n.d(i,"DodecahedronGeometry",(function(){return yu})),n.d(i,"DoubleSide",(function(){return w})),n.d(i,"DstAlphaFactor",(function(){return z})),n.d(i,"DstColorFactor",(function(){return V})),n.d(i,"DynamicBufferAttribute",(function(){return gf})),n.d(i,"DynamicCopyUsage",(function(){return Un})),n.d(i,"DynamicDrawUsage",(function(){return On})),n.d(i,"DynamicReadUsage",(function(){return Dn})),n.d(i,"EdgesGeometry",(function(){return Su})),n.d(i,"EdgesHelper",(function(){return Rf})),n.d(i,"EllipseCurve",(function(){return Mu})),n.d(i,"EqualDepth",(function(){return K})),n.d(i,"EqualStencilFunc",(function(){return En})),n.d(i,"EquirectangularReflectionMapping",(function(){return pt})),n.d(i,"EquirectangularRefractionMapping",(function(){return ft})),n.d(i,"Euler",(function(){return tr})),n.d(i,"EventDispatcher",(function(){return zn})),n.d(i,"ExtrudeBufferGeometry",(function(){return yh})),n.d(i,"ExtrudeGeometry",(function(){return yh})),n.d(i,"FaceColors",(function(){return of})),n.d(i,"FileLoader",(function(){return dc})),n.d(i,"FlatShading",(function(){return T})),n.d(i,"Float16BufferAttribute",(function(){return qr})),n.d(i,"Float32Attribute",(function(){return Sf})),n.d(i,"Float32BufferAttribute",(function(){return Yr})),n.d(i,"Float64Attribute",(function(){return Ef})),n.d(i,"Float64BufferAttribute",(function(){return Zr})),n.d(i,"FloatType",(function(){return Ft})),n.d(i,"Fog",(function(){return al})),n.d(i,"FogExp2",(function(){return sl})),n.d(i,"Font",(function(){return Qc})),n.d(i,"FontLoader",(function(){return ed})),n.d(i,"FrontSide",(function(){return x})),n.d(i,"Frustum",(function(){return jo})),n.d(i,"GLBufferAttribute",(function(){return kd})),n.d(i,"GLSL1",(function(){return Gn})),n.d(i,"GLSL3",(function(){return Hn})),n.d(i,"GammaEncoding",(function(){return on})),n.d(i,"GreaterDepth",(function(){return Q})),n.d(i,"GreaterEqualDepth",(function(){return $})),n.d(i,"GreaterEqualStencilFunc",(function(){return Cn})),n.d(i,"GreaterStencilFunc",(function(){return An})),n.d(i,"GridHelper",(function(){return lp})),n.d(i,"Group",(function(){return Qa})),n.d(i,"HalfFloatType",(function(){return Bt})),n.d(i,"HemisphereLight",(function(){return Tc})),n.d(i,"HemisphereLightHelper",(function(){return ap})),n.d(i,"HemisphereLightProbe",(function(){return od})),n.d(i,"IcosahedronBufferGeometry",(function(){return bh})),n.d(i,"IcosahedronGeometry",(function(){return bh})),n.d(i,"ImageBitmapLoader",(function(){return Kc})),n.d(i,"ImageLoader",(function(){return mc})),n.d(i,"ImageUtils",(function(){return ri})),n.d(i,"ImmediateRenderObject",(function(){return Jd})),n.d(i,"IncrementStencilOp",(function(){return _n})),n.d(i,"IncrementWrapStencilOp",(function(){return xn})),n.d(i,"InstancedBufferAttribute",(function(){return Wc})),n.d(i,"InstancedBufferGeometry",(function(){return Vc})),n.d(i,"InstancedInterleavedBuffer",(function(){return Ud})),n.d(i,"InstancedMesh",(function(){return Xl})),n.d(i,"Int16Attribute",(function(){return xf})),n.d(i,"Int16BufferAttribute",(function(){return jr})),n.d(i,"Int32Attribute",(function(){return wf})),n.d(i,"Int32BufferAttribute",(function(){return Wr})),n.d(i,"Int8Attribute",(function(){return vf})),n.d(i,"Int8BufferAttribute",(function(){return Gr})),n.d(i,"IntType",(function(){return Nt})),n.d(i,"InterleavedBuffer",(function(){return ul})),n.d(i,"InterleavedBufferAttribute",(function(){return cl})),n.d(i,"Interpolant",(function(){return qh})),n.d(i,"InterpolateDiscrete",(function(){return We})),n.d(i,"InterpolateLinear",(function(){return Xe})),n.d(i,"InterpolateSmooth",(function(){return qe})),n.d(i,"InvertStencilOp",(function(){return wn})),n.d(i,"JSONLoader",(function(){return Nf})),n.d(i,"KeepStencilOp",(function(){return gn})),n.d(i,"KeyframeTrack",(function(){return Kh})),n.d(i,"LOD",(function(){return Pl})),n.d(i,"LatheBufferGeometry",(function(){return wh})),n.d(i,"LatheGeometry",(function(){return wh})),n.d(i,"Layers",(function(){return er})),n.d(i,"LensFlare",(function(){return Ff})),n.d(i,"LessDepth",(function(){return Z})),n.d(i,"LessEqualDepth",(function(){return J})),n.d(i,"LessEqualStencilFunc",(function(){return Mn})),n.d(i,"LessStencilFunc",(function(){return Sn})),n.d(i,"Light",(function(){return wc})),n.d(i,"LightProbe",(function(){return Hc})),n.d(i,"Line",(function(){return Ql})),n.d(i,"Line3",(function(){return Zd})),n.d(i,"LineBasicMaterial",(function(){return ql})),n.d(i,"LineCurve",(function(){return ku})),n.d(i,"LineCurve3",(function(){return Gu})),n.d(i,"LineDashedMaterial",(function(){return Vh})),n.d(i,"LineLoop",(function(){return iu})),n.d(i,"LinePieces",(function(){return nf})),n.d(i,"LineSegments",(function(){return nu})),n.d(i,"LineStrip",(function(){return ef})),n.d(i,"LinearEncoding",(function(){return nn})),n.d(i,"LinearFilter",(function(){return Et})),n.d(i,"LinearInterpolant",(function(){return Zh})),n.d(i,"LinearMipMapLinearFilter",(function(){return Ct})),n.d(i,"LinearMipMapNearestFilter",(function(){return At})),n.d(i,"LinearMipmapLinearFilter",(function(){return Rt})),n.d(i,"LinearMipmapNearestFilter",(function(){return Mt})),n.d(i,"LinearToneMapping",(function(){return ot})),n.d(i,"Loader",(function(){return hc})),n.d(i,"LoaderUtils",(function(){return jc})),n.d(i,"LoadingManager",(function(){return lc})),n.d(i,"LogLuvEncoding",(function(){return an})),n.d(i,"LoopOnce",(function(){return ze})),n.d(i,"LoopPingPong",(function(){return Ve})),n.d(i,"LoopRepeat",(function(){return je})),n.d(i,"LuminanceAlphaFormat",(function(){return Xt})),n.d(i,"LuminanceFormat",(function(){return Wt})),n.d(i,"MOUSE",(function(){return h})),n.d(i,"Material",(function(){return Rr})),n.d(i,"MaterialLoader",(function(){return zc})),n.d(i,"Math",(function(){return ti})),n.d(i,"MathUtils",(function(){return ti})),n.d(i,"Matrix3",(function(){return ni})),n.d(i,"Matrix4",(function(){return Vi})),n.d(i,"MaxEquation",(function(){return D})),n.d(i,"Mesh",(function(){return Eo})),n.d(i,"MeshBasicMaterial",(function(){return Fr})),n.d(i,"MeshDepthMaterial",(function(){return Xa})),n.d(i,"MeshDistanceMaterial",(function(){return qa})),n.d(i,"MeshFaceMaterial",(function(){return af})),n.d(i,"MeshLambertMaterial",(function(){return zh})),n.d(i,"MeshMatcapMaterial",(function(){return jh})),n.d(i,"MeshNormalMaterial",(function(){return Hh})),n.d(i,"MeshPhongMaterial",(function(){return kh})),n.d(i,"MeshPhysicalMaterial",(function(){return Uh})),n.d(i,"MeshStandardMaterial",(function(){return Bh})),n.d(i,"MeshToonMaterial",(function(){return Gh})),n.d(i,"MinEquation",(function(){return N})),n.d(i,"MirroredRepeatWrapping",(function(){return yt})),n.d(i,"MixOperation",(function(){return nt})),n.d(i,"MultiMaterial",(function(){return lf})),n.d(i,"MultiplyBlending",(function(){return C})),n.d(i,"MultiplyOperation",(function(){return et})),n.d(i,"NearestFilter",(function(){return xt})),n.d(i,"NearestMipMapLinearFilter",(function(){return St})),n.d(i,"NearestMipMapNearestFilter",(function(){return wt})),n.d(i,"NearestMipmapLinearFilter",(function(){return Tt})),n.d(i,"NearestMipmapNearestFilter",(function(){return bt})),n.d(i,"NeverDepth",(function(){return q})),n.d(i,"NeverStencilFunc",(function(){return Tn})),n.d(i,"NoBlending",(function(){return E})),n.d(i,"NoColors",(function(){return rf})),n.d(i,"NoToneMapping",(function(){return rt})),n.d(i,"NormalAnimationBlendMode",(function(){return Ke})),n.d(i,"NormalBlending",(function(){return M})),n.d(i,"NotEqualDepth",(function(){return tt})),n.d(i,"NotEqualStencilFunc",(function(){return Rn})),n.d(i,"NumberKeyframeTrack",(function(){return tc})),n.d(i,"Object3D",(function(){return mr})),n.d(i,"ObjectLoader",(function(){return qc})),n.d(i,"ObjectSpaceNormalMap",(function(){return fn})),n.d(i,"OctahedronBufferGeometry",(function(){return Th})),n.d(i,"OctahedronGeometry",(function(){return Th})),n.d(i,"OneFactor",(function(){return B})),n.d(i,"OneMinusDstAlphaFactor",(function(){return j})),n.d(i,"OneMinusDstColorFactor",(function(){return W})),n.d(i,"OneMinusSrcAlphaFactor",(function(){return H})),n.d(i,"OneMinusSrcColorFactor",(function(){return k})),n.d(i,"OrthographicCamera",(function(){return Dc})),n.d(i,"PCFShadowMap",(function(){return v})),n.d(i,"PCFSoftShadowMap",(function(){return _})),n.d(i,"PMREMGenerator",(function(){return Xp})),n.d(i,"ParametricBufferGeometry",(function(){return Sh})),n.d(i,"ParametricGeometry",(function(){return Sh})),n.d(i,"Particle",(function(){return hf})),n.d(i,"ParticleBasicMaterial",(function(){return pf})),n.d(i,"ParticleSystem",(function(){return cf})),n.d(i,"ParticleSystemMaterial",(function(){return ff})),n.d(i,"Path",(function(){return xc})),n.d(i,"PerspectiveCamera",(function(){return Lo})),n.d(i,"Plane",(function(){return Go})),n.d(i,"PlaneBufferGeometry",(function(){return Xo})),n.d(i,"PlaneGeometry",(function(){return Xo})),n.d(i,"PlaneHelper",(function(){return bp})),n.d(i,"PointCloud",(function(){return uf})),n.d(i,"PointCloudMaterial",(function(){return df})),n.d(i,"PointLight",(function(){return Nc})),n.d(i,"PointLightHelper",(function(){return ip})),n.d(i,"Points",(function(){return uu})),n.d(i,"PointsMaterial",(function(){return ru})),n.d(i,"PolarGridHelper",(function(){return up})),n.d(i,"PolyhedronBufferGeometry",(function(){return _u})),n.d(i,"PolyhedronGeometry",(function(){return _u})),n.d(i,"PositionalAudio",(function(){return wd})),n.d(i,"PropertyBinding",(function(){return Ld})),n.d(i,"PropertyMixer",(function(){return Sd})),n.d(i,"QuadraticBezierCurve",(function(){return Hu})),n.d(i,"QuadraticBezierCurve3",(function(){return zu})),n.d(i,"Quaternion",(function(){return di})),n.d(i,"QuaternionKeyframeTrack",(function(){return nc})),n.d(i,"QuaternionLinearInterpolant",(function(){return ec})),n.d(i,"REVISION",(function(){return u})),n.d(i,"RGBADepthPacking",(function(){return dn})),n.d(i,"RGBAFormat",(function(){return Vt})),n.d(i,"RGBAIntegerFormat",(function(){return ee})),n.d(i,"RGBA_ASTC_10x10_Format",(function(){return Se})),n.d(i,"RGBA_ASTC_10x5_Format",(function(){return be})),n.d(i,"RGBA_ASTC_10x6_Format",(function(){return we})),n.d(i,"RGBA_ASTC_10x8_Format",(function(){return Te})),n.d(i,"RGBA_ASTC_12x10_Format",(function(){return Ee})),n.d(i,"RGBA_ASTC_12x12_Format",(function(){return Me})),n.d(i,"RGBA_ASTC_4x4_Format",(function(){return pe})),n.d(i,"RGBA_ASTC_5x4_Format",(function(){return fe})),n.d(i,"RGBA_ASTC_5x5_Format",(function(){return me})),n.d(i,"RGBA_ASTC_6x5_Format",(function(){return ge})),n.d(i,"RGBA_ASTC_6x6_Format",(function(){return ve})),n.d(i,"RGBA_ASTC_8x5_Format",(function(){return _e})),n.d(i,"RGBA_ASTC_8x6_Format",(function(){return ye})),n.d(i,"RGBA_ASTC_8x8_Format",(function(){return xe})),n.d(i,"RGBA_BPTC_Format",(function(){return Ae})),n.d(i,"RGBA_ETC2_EAC_Format",(function(){return de})),n.d(i,"RGBA_PVRTC_2BPPV1_Format",(function(){return ue})),n.d(i,"RGBA_PVRTC_4BPPV1_Format",(function(){return le})),n.d(i,"RGBA_S3TC_DXT1_Format",(function(){return ie})),n.d(i,"RGBA_S3TC_DXT3_Format",(function(){return re})),n.d(i,"RGBA_S3TC_DXT5_Format",(function(){return oe})),n.d(i,"RGBDEncoding",(function(){return hn})),n.d(i,"RGBEEncoding",(function(){return sn})),n.d(i,"RGBEFormat",(function(){return qt})),n.d(i,"RGBFormat",(function(){return jt})),n.d(i,"RGBIntegerFormat",(function(){return te})),n.d(i,"RGBM16Encoding",(function(){return un})),n.d(i,"RGBM7Encoding",(function(){return ln})),n.d(i,"RGB_ETC1_Format",(function(){return he})),n.d(i,"RGB_ETC2_Format",(function(){return ce})),n.d(i,"RGB_PVRTC_2BPPV1_Format",(function(){return ae})),n.d(i,"RGB_PVRTC_4BPPV1_Format",(function(){return se})),n.d(i,"RGB_S3TC_DXT1_Format",(function(){return ne})),n.d(i,"RGFormat",(function(){return $t})),n.d(i,"RGIntegerFormat",(function(){return Qt})),n.d(i,"RawShaderMaterial",(function(){return Fh})),n.d(i,"Ray",(function(){return ji})),n.d(i,"Raycaster",(function(){return Gd})),n.d(i,"RectAreaLight",(function(){return kc})),n.d(i,"RedFormat",(function(){return Jt})),n.d(i,"RedIntegerFormat",(function(){return Kt})),n.d(i,"ReinhardToneMapping",(function(){return st})),n.d(i,"RepeatWrapping",(function(){return vt})),n.d(i,"ReplaceStencilOp",(function(){return vn})),n.d(i,"ReverseSubtractEquation",(function(){return L})),n.d(i,"RingBufferGeometry",(function(){return Eh})),n.d(i,"RingGeometry",(function(){return Eh})),n.d(i,"SRGB8_ALPHA8_ASTC_10x10_Format",(function(){return ke})),n.d(i,"SRGB8_ALPHA8_ASTC_10x5_Format",(function(){return Fe})),n.d(i,"SRGB8_ALPHA8_ASTC_10x6_Format",(function(){return Be})),n.d(i,"SRGB8_ALPHA8_ASTC_10x8_Format",(function(){return Ue})),n.d(i,"SRGB8_ALPHA8_ASTC_12x10_Format",(function(){return Ge})),n.d(i,"SRGB8_ALPHA8_ASTC_12x12_Format",(function(){return He})),n.d(i,"SRGB8_ALPHA8_ASTC_4x4_Format",(function(){return Re})),n.d(i,"SRGB8_ALPHA8_ASTC_5x4_Format",(function(){return Ce})),n.d(i,"SRGB8_ALPHA8_ASTC_5x5_Format",(function(){return Pe})),n.d(i,"SRGB8_ALPHA8_ASTC_6x5_Format",(function(){return Ie})),n.d(i,"SRGB8_ALPHA8_ASTC_6x6_Format",(function(){return Oe})),n.d(i,"SRGB8_ALPHA8_ASTC_8x5_Format",(function(){return Le})),n.d(i,"SRGB8_ALPHA8_ASTC_8x6_Format",(function(){return Ne})),n.d(i,"SRGB8_ALPHA8_ASTC_8x8_Format",(function(){return De})),n.d(i,"Scene",(function(){return ll})),n.d(i,"SceneUtils",(function(){return Df})),n.d(i,"ShaderChunk",(function(){return qo})),n.d(i,"ShaderLib",(function(){return Zo})),n.d(i,"ShaderMaterial",(function(){return Io})),n.d(i,"ShadowMaterial",(function(){return Dh})),n.d(i,"Shape",(function(){return bc})),n.d(i,"ShapeBufferGeometry",(function(){return Mh})),n.d(i,"ShapeGeometry",(function(){return Mh})),n.d(i,"ShapePath",(function(){return $c})),n.d(i,"ShapeUtils",(function(){return gh})),n.d(i,"ShortType",(function(){return Ot})),n.d(i,"Skeleton",(function(){return Hl})),n.d(i,"SkeletonHelper",(function(){return np})),n.d(i,"SkinnedMesh",(function(){return Fl})),n.d(i,"SmoothShading",(function(){return S})),n.d(i,"Sphere",(function(){return Di})),n.d(i,"SphereBufferGeometry",(function(){return Ah})),n.d(i,"SphereGeometry",(function(){return Ah})),n.d(i,"Spherical",(function(){return jd})),n.d(i,"SphericalHarmonics3",(function(){return Gc})),n.d(i,"SplineCurve",(function(){return ju})),n.d(i,"SpotLight",(function(){return Cc})),n.d(i,"SpotLightHelper",(function(){return $d})),n.d(i,"Sprite",(function(){return Ml})),n.d(i,"SpriteMaterial",(function(){return dl})),n.d(i,"SrcAlphaFactor",(function(){return G})),n.d(i,"SrcAlphaSaturateFactor",(function(){return X})),n.d(i,"SrcColorFactor",(function(){return U})),n.d(i,"StaticCopyUsage",(function(){return Bn})),n.d(i,"StaticDrawUsage",(function(){return In})),n.d(i,"StaticReadUsage",(function(){return Nn})),n.d(i,"StereoCamera",(function(){return ud})),n.d(i,"StreamCopyUsage",(function(){return kn})),n.d(i,"StreamDrawUsage",(function(){return Ln})),n.d(i,"StreamReadUsage",(function(){return Fn})),n.d(i,"StringKeyframeTrack",(function(){return ic})),n.d(i,"SubtractEquation",(function(){return O})),n.d(i,"SubtractiveBlending",(function(){return R})),n.d(i,"TOUCH",(function(){return c})),n.d(i,"TangentSpaceNormalMap",(function(){return pn})),n.d(i,"TetrahedronBufferGeometry",(function(){return Rh})),n.d(i,"TetrahedronGeometry",(function(){return Rh})),n.d(i,"TextBufferGeometry",(function(){return Ch})),n.d(i,"TextGeometry",(function(){return Ch})),n.d(i,"Texture",(function(){return si})),n.d(i,"TextureLoader",(function(){return _c})),n.d(i,"TorusBufferGeometry",(function(){return Ph})),n.d(i,"TorusGeometry",(function(){return Ph})),n.d(i,"TorusKnotBufferGeometry",(function(){return Ih})),n.d(i,"TorusKnotGeometry",(function(){return Ih})),n.d(i,"Triangle",(function(){return Mr})),n.d(i,"TriangleFanDrawMode",(function(){return en})),n.d(i,"TriangleStripDrawMode",(function(){return tn})),n.d(i,"TrianglesDrawMode",(function(){return Qe})),n.d(i,"TubeBufferGeometry",(function(){return Oh})),n.d(i,"TubeGeometry",(function(){return Oh})),n.d(i,"UVMapping",(function(){return ht})),n.d(i,"Uint16Attribute",(function(){return bf})),n.d(i,"Uint16BufferAttribute",(function(){return Vr})),n.d(i,"Uint32Attribute",(function(){return Tf})),n.d(i,"Uint32BufferAttribute",(function(){return Xr})),n.d(i,"Uint8Attribute",(function(){return _f})),n.d(i,"Uint8BufferAttribute",(function(){return Hr})),n.d(i,"Uint8ClampedAttribute",(function(){return yf})),n.d(i,"Uint8ClampedBufferAttribute",(function(){return zr})),n.d(i,"Uniform",(function(){return Bd})),n.d(i,"UniformsLib",(function(){return Yo})),n.d(i,"UniformsUtils",(function(){return Po})),n.d(i,"UnsignedByteType",(function(){return Pt})),n.d(i,"UnsignedInt248Type",(function(){return Ht})),n.d(i,"UnsignedIntType",(function(){return Dt})),n.d(i,"UnsignedShort4444Type",(function(){return Ut})),n.d(i,"UnsignedShort5551Type",(function(){return kt})),n.d(i,"UnsignedShort565Type",(function(){return Gt})),n.d(i,"UnsignedShortType",(function(){return Lt})),n.d(i,"VSMShadowMap",(function(){return y})),n.d(i,"Vector2",(function(){return ei})),n.d(i,"Vector3",(function(){return pi})),n.d(i,"Vector4",(function(){return li})),n.d(i,"VectorKeyframeTrack",(function(){return rc})),n.d(i,"Vertex",(function(){return mf})),n.d(i,"VertexColors",(function(){return sf})),n.d(i,"VideoTexture",(function(){return cu})),n.d(i,"WebGL1Renderer",(function(){return ol})),n.d(i,"WebGLCubeRenderTarget",(function(){return Fo})),n.d(i,"WebGLMultipleRenderTargets",(function(){return hi})),n.d(i,"WebGLMultisampleRenderTarget",(function(){return ci})),n.d(i,"WebGLRenderTarget",(function(){return ui})),n.d(i,"WebGLRenderTargetCube",(function(){return Of})),n.d(i,"WebGLRenderer",(function(){return rl})),n.d(i,"WebGLUtils",(function(){return Ka})),n.d(i,"WireframeGeometry",(function(){return Lh})),n.d(i,"WireframeHelper",(function(){return Cf})),n.d(i,"WrapAroundEnding",(function(){return Je})),n.d(i,"XHRLoader",(function(){return Pf})),n.d(i,"ZeroCurvatureEnding",(function(){return Ye})),n.d(i,"ZeroFactor",(function(){return F})),n.d(i,"ZeroSlopeEnding",(function(){return Ze})),n.d(i,"ZeroStencilOp",(function(){return mn})),n.d(i,"sRGBEncoding",(function(){return rn}));var r={};n.r(r),n.d(r,"isMobile",(function(){return Zg})),n.d(r,"EventEmitter",(function(){return vv.a})),n.d(r,"earcut",(function(){return yv.a})),n.d(r,"BaseTextureCache",(function(){return $v})),n.d(r,"CanvasRenderTarget",(function(){return e_})),n.d(r,"DATA_URI",(function(){return r_})),n.d(r,"ProgramCache",(function(){return Jv})),n.d(r,"TextureCache",(function(){return Kv})),n.d(r,"clearTextureCache",(function(){return t_})),n.d(r,"correctBlendMode",(function(){return Lv})),n.d(r,"createIndicesForQuads",(function(){return Bv})),n.d(r,"decomposeDataUri",(function(){return o_})),n.d(r,"deprecation",(function(){return Zv})),n.d(r,"destroyTextureCache",(function(){return Qv})),n.d(r,"determineCrossOrigin",(function(){return s_})),n.d(r,"getBufferType",(function(){return Uv})),n.d(r,"getResolutionOfUrl",(function(){return a_})),n.d(r,"hex2rgb",(function(){return Rv})),n.d(r,"hex2string",(function(){return Cv})),n.d(r,"interleaveTypedArrays",(function(){return Gv})),n.d(r,"isPow2",(function(){return zv})),n.d(r,"isWebGLSupported",(function(){return Mv})),n.d(r,"log2",(function(){return jv})),n.d(r,"nextPow2",(function(){return Hv})),n.d(r,"premultiplyBlendMode",(function(){return Ov})),n.d(r,"premultiplyRgba",(function(){return Nv})),n.d(r,"premultiplyTint",(function(){return Dv})),n.d(r,"premultiplyTintToRgba",(function(){return Fv})),n.d(r,"removeItems",(function(){return Vv})),n.d(r,"rgb2hex",(function(){return Iv})),n.d(r,"sayHello",(function(){return Ev})),n.d(r,"sign",(function(){return Wv})),n.d(r,"skipHello",(function(){return Sv})),n.d(r,"string2hex",(function(){return Pv})),n.d(r,"trimCanvas",(function(){return n_})),n.d(r,"uid",(function(){return qv})),n.d(r,"url",(function(){return bv}));var o=n(6),s=n(0),a=n.n(s),l=n(1);
35
+ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){if(!this.ctx||!this.ctx.listener)return this;for(var e=this._howls.length-1;e>=0;e--)this._howls[e].stereo(t);return this},HowlerGlobal.prototype.pos=function(t,e,n){return this.ctx&&this.ctx.listener?(e="number"!=typeof e?this._pos[1]:e,n="number"!=typeof n?this._pos[2]:n,"number"!=typeof t?this._pos:(this._pos=[t,e,n],void 0!==this.ctx.listener.positionX?(this.ctx.listener.positionX.setTargetAtTime(this._pos[0],Howler.ctx.currentTime,.1),this.ctx.listener.positionY.setTargetAtTime(this._pos[1],Howler.ctx.currentTime,.1),this.ctx.listener.positionZ.setTargetAtTime(this._pos[2],Howler.ctx.currentTime,.1)):this.ctx.listener.setPosition(this._pos[0],this._pos[1],this._pos[2]),this)):this},HowlerGlobal.prototype.orientation=function(t,e,n,i,r,o){if(!this.ctx||!this.ctx.listener)return this;var s=this._orientation;return e="number"!=typeof e?s[1]:e,n="number"!=typeof n?s[2]:n,i="number"!=typeof i?s[3]:i,r="number"!=typeof r?s[4]:r,o="number"!=typeof o?s[5]:o,"number"!=typeof t?s:(this._orientation=[t,e,n,i,r,o],void 0!==this.ctx.listener.forwardX?(this.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),this.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),this.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),this.ctx.listener.upX.setTargetAtTime(i,Howler.ctx.currentTime,.1),this.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),this.ctx.listener.upZ.setTargetAtTime(o,Howler.ctx.currentTime,.1)):this.ctx.listener.setOrientation(t,e,n,i,r,o),this)},Howl.prototype.init=(t=Howl.prototype.init,function(e){return this._orientation=e.orientation||[1,0,0],this._stereo=e.stereo||null,this._pos=e.pos||null,this._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},this._onstereo=e.onstereo?[{fn:e.onstereo}]:[],this._onpos=e.onpos?[{fn:e.onpos}]:[],this._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,n){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"stereo",action:function(){i.stereo(t,n)}}),i;var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof t)return i._stereo;i._stereo=t,i._pos=[t,0,0]}for(var o=i._getSoundIds(n),s=0;s<o.length;s++){var a=i._soundById(o[s]);if(a){if("number"!=typeof t)return a._stereo;a._stereo=t,a._pos=[t,0,0],a._node&&(a._pannerAttr.panningModel="equalpower",a._panner&&a._panner.pan||e(a,r),"spatial"===r?void 0!==a._panner.positionX?(a._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),a._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),a._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):a._panner.setPosition(t,0,0):a._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),i._emit("stereo",a._id)}}return i},Howl.prototype.pos=function(t,n,i,r){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"pos",action:function(){o.pos(t,n,i,r)}}),o;if(n="number"!=typeof n?0:n,i="number"!=typeof i?-.5:i,void 0===r){if("number"!=typeof t)return o._pos;o._pos=[t,n,i]}for(var s=o._getSoundIds(r),a=0;a<s.length;a++){var l=o._soundById(s[a]);if(l){if("number"!=typeof t)return l._pos;l._pos=[t,n,i],l._node&&(l._panner&&!l._panner.pan||e(l,"spatial"),void 0!==l._panner.positionX?(l._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setPosition(t,n,i)),o._emit("pos",l._id)}}return o},Howl.prototype.orientation=function(t,n,i,r){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"orientation",action:function(){o.orientation(t,n,i,r)}}),o;if(n="number"!=typeof n?o._orientation[1]:n,i="number"!=typeof i?o._orientation[2]:i,void 0===r){if("number"!=typeof t)return o._orientation;o._orientation=[t,n,i]}for(var s=o._getSoundIds(r),a=0;a<s.length;a++){var l=o._soundById(s[a]);if(l){if("number"!=typeof t)return l._orientation;l._orientation=[t,n,i],l._node&&(l._panner||(l._pos||(l._pos=o._pos||[0,0,-.5]),e(l,"spatial")),void 0!==l._panner.orientationX?(l._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):l._panner.setOrientation(t,n,i)),o._emit("orientation",l._id)}}return o},Howl.prototype.pannerAttr=function(){var t,n,i,r=this,o=arguments;if(!r._webAudio)return r;if(0===o.length)return r._pannerAttr;if(1===o.length){if("object"!=typeof o[0])return(i=r._soundById(parseInt(o[0],10)))?i._pannerAttr:r._pannerAttr;t=o[0],void 0===n&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:r._panningModel})}else 2===o.length&&(t=o[0],n=parseInt(o[1],10));for(var s=r._getSoundIds(n),a=0;a<s.length;a++)if(i=r._soundById(s[a])){var l=i._pannerAttr;l={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:l.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:l.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:l.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:l.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:l.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:l.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:l.panningModel};var u=i._panner;u?(u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel):(i._pos||(i._pos=r._pos||[0,0,-.5]),e(i,"spatial"))}return r},Sound.prototype.init=function(t){return function(){var e=this._parent;this._orientation=e._orientation,this._stereo=e._stereo,this._pos=e._pos,this._pannerAttr=e._pannerAttr,t.call(this),this._stereo?e.stereo(this._stereo):this._pos&&e.pos(this._pos[0],this._pos[1],this._pos[2],this._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var e=this._parent;return this._orientation=e._orientation,this._stereo=e._stereo,this._pos=e._pos,this._pannerAttr=e._pannerAttr,this._stereo?e.stereo(this._stereo):this._pos?e.pos(this._pos[0],this._pos[1],this._pos[2],this._id):this._panner&&(this._panner.disconnect(0),this._panner=void 0,e._refreshBuffer(this)),t.call(this)}}(Sound.prototype.reset);var e=function(t,e){"spatial"===(e=e||"spatial")?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,void 0!==t._panner.positionX?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),void 0!==t._panner.orientationX?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}}()}).call(this,n(4))},function(t,e){t.exports="varying vec2 vTextureCoord;\nvarying vec2 vVertexPosition;\nvarying float vPercent;\nvarying float vDirection;\nvarying float vTransition;\nuniform sampler2D uSampler;\nvoid main() {\n\tvec4 outputColor;\n\tfloat percent = vPercent;\n\tfloat direction = vDirection;\n\tif (vTransition < 0.0) {\n\t\tpercent = 1.0 - percent;\n\t\tif ((vDirection > 1.5) && (vDirection < 2.5)) {\n\t\t\tdirection = 1.0;\n\t\t}\n\t\telse if ((vDirection > 0.5) && (vDirection < 1.5)) {\n\t\t\tdirection = 2.0;\n\t\t}\n\t\telse if ((vDirection > 2.5) && (vDirection < 3.5)) {\n\t\t\tdirection = 4.0;\n\t\t}\n\t\telse {\n\t\t\tdirection = 3.0;\n\t\t}\n\t}\n\tif ((direction > 1.5) && (direction < 2.5)) {\n\t\tif (vVertexPosition.y >= (1.0 - percent)) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.y >= (1.0 - percent)) && (vVertexPosition.y <= ((1.0 - percent) + 0.2))) {\n\t\t\toutputColor = outputColor * ((vVertexPosition.y - (1.0 - percent)) / 0.2);\n\t\t}\n\t}\n\telse if ((direction > 0.5) && (direction < 1.5)) {\n\t\tif (vVertexPosition.y <= percent) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.y <= percent) && (vVertexPosition.y >= (percent - 0.2))) {\n\t\t\toutputColor = outputColor * (1.0 - ((vVertexPosition.y - (percent - 0.2)) / 0.2));\n\t\t}\n\t}\n\telse if ((direction > 2.5) && (direction < 3.5)) {\n\t\tif (vVertexPosition.x <= percent) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.x <= percent) && (vVertexPosition.x >= (percent - 0.2))) {\n\t\t\toutputColor = outputColor * (1.0 - ((vVertexPosition.x - (percent - 0.2)) / 0.2));\n\t\t}\n\t}\n\telse {\n\t\tif (vVertexPosition.x >= (1.0 - percent)) {\n\t\t\toutputColor = texture2D(uSampler, vTextureCoord);\n\t\t}\n\t\telse {\n\t\t\toutputColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t\t}\n\t\tif ((vVertexPosition.x >= (1.0 - percent)) && (vVertexPosition.x <= ((1.0 - percent) + 0.2))) {\n\t\t\toutputColor = outputColor * ((vVertexPosition.x - (1.0 - percent)) / 0.2);\n\t\t}\n\t}\n\tgl_FragColor = outputColor;\n}\n"},function(t,e){t.exports="attribute vec2 aVertexPosition;\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\nvarying vec2 vVertexPosition;\nvarying float vPercent;\nvarying float vDirection;\nvarying float vTransition;\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\nuniform float percent;\nuniform float direction;\nuniform float transition;\nvec4 filterVertexPosition() {\n\tvec2 position = (aVertexPosition * max(outputFrame.zw, vec2(0.))) + outputFrame.xy;\n\treturn vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\nvec2 filterTextureCoord(vec2 aVertexPosition) {\n\treturn aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\nvoid main() {\n\tvTransition = transition;\n\tvDirection = direction;\n\tvPercent = percent;\n\tvVertexPosition = aVertexPosition;\n\tvec2 localVertexPosition = aVertexPosition;\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord(localVertexPosition);\n}\n"},function(t,e){t.exports="varying vec2 vTextureCoord;\nuniform float percent;\nuniform sampler2D uSampler;\nuniform float transition;\nvoid main() {\n\tfloat alpha = (transition * (percent - 0.5)) + 0.5;\n\tvec4 color1 = texture2D(uSampler, vTextureCoord);\n\tgl_FragColor = color1 * alpha;\n}\n"},function(t,e,n){var i;!function(r,o){"use strict";var s="model",a="name",l="type",u="vendor",h="version",c="mobile",d="tablet",p="smarttv",f=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},m=function(t,e){return"string"==typeof t&&-1!==g(e).indexOf(g(t))},g=function(t){return t.toLowerCase()},v=function(t,e){if("string"==typeof t)return t=t.replace(/^\s\s*/,"").replace(/\s\s*$/,""),void 0===e?t:t.substring(0,255)},_=function(t,e){for(var n,i,r,o,s,a,l=0;l<e.length&&!s;){var u=e[l],h=e[l+1];for(n=i=0;n<u.length&&!s;)if(s=u[n++].exec(t))for(r=0;r<h.length;r++)a=s[++i],"object"==typeof(o=h[r])&&o.length>0?2===o.length?"function"==typeof o[1]?this[o[0]]=o[1].call(this,a):this[o[0]]=o[1]:3===o.length?"function"!=typeof o[1]||o[1].exec&&o[1].test?this[o[0]]=a?a.replace(o[1],o[2]):void 0:this[o[0]]=a?o[1].call(this,a,o[2]):void 0:4===o.length&&(this[o[0]]=a?o[3].call(this,a.replace(o[1],o[2])):void 0):this[o]=a||void 0;l+=2}},y=function(t,e){for(var n in e)if("object"==typeof e[n]&&e[n].length>0){for(var i=0;i<e[n].length;i++)if(m(e[n][i],t))return"?"===n?void 0:n}else if(m(e[n],t))return"?"===n?void 0:n;return t},x={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},b={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[a,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[a,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[a,h],[/opios[\/ ]+([\w\.]+)/i],[h,[a,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[h,[a,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[a,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[a,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[h,[a,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[a,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[a,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[a,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[a,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[a,/(.+)/,"$1 Secure Browser"],h],[/\bfocus\/([\w\.]+)/i],[h,[a,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[h,[a,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[a,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[a,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[a,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[a,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[h,[a,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[a,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[a,/(.+)/,"$1 Browser"],h],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[a,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[a],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[a,"Facebook"],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[a,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[a,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[a,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[a,"Chrome WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[a,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[a,h],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[h,[a,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[h,a],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[a,[h,y,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[a,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[a,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[a,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[a,h]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",g]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[["architecture","arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/windows (ce|mobile); ppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[["architecture",/ower/,"",g]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[["architecture",g]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[s,[u,"Samsung"],[l,d]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[s,[u,"Samsung"],[l,c]],[/\((ip(?:hone|od)[\w ]*);/i],[s,[u,"Apple"],[l,c]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[s,[u,"Apple"],[l,d]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[s,[u,"Huawei"],[l,d]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[s,[u,"Huawei"],[l,c]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[s,/_/g," "],[u,"Xiaomi"],[l,c]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[s,/_/g," "],[u,"Xiaomi"],[l,d]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[s,[u,"OPPO"],[l,c]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[s,[u,"Vivo"],[l,c]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[s,[u,"Realme"],[l,c]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[s,[u,"Motorola"],[l,c]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[s,[u,"Motorola"],[l,d]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[s,[u,"LG"],[l,d]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[s,[u,"LG"],[l,c]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[s,[u,"Lenovo"],[l,d]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[s,/_/g," "],[u,"Nokia"],[l,c]],[/(pixel c)\b/i],[s,[u,"Google"],[l,d]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[s,[u,"Google"],[l,c]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[s,[u,"Sony"],[l,c]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[s,"Xperia Tablet"],[u,"Sony"],[l,d]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[s,[u,"OnePlus"],[l,c]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[s,[u,"Amazon"],[l,d]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[s,/(.+)/g,"Fire Phone $1"],[u,"Amazon"],[l,c]],[/(playbook);[-\w\),; ]+(rim)/i],[s,u,[l,d]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[s,[u,"BlackBerry"],[l,c]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[s,[u,"ASUS"],[l,d]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[s,[u,"ASUS"],[l,c]],[/(nexus 9)/i],[s,[u,"HTC"],[l,d]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[u,[s,/_/g," "],[l,c]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[s,[u,"Acer"],[l,d]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[s,[u,"Meizu"],[l,c]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[s,[u,"Sharp"],[l,c]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[u,s,[l,c]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[u,s,[l,d]],[/(surface duo)/i],[s,[u,"Microsoft"],[l,d]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[s,[u,"Fairphone"],[l,c]],[/(u304aa)/i],[s,[u,"AT&T"],[l,c]],[/\bsie-(\w*)/i],[s,[u,"Siemens"],[l,c]],[/\b(rct\w+) b/i],[s,[u,"RCA"],[l,d]],[/\b(venue[\d ]{2,7}) b/i],[s,[u,"Dell"],[l,d]],[/\b(q(?:mv|ta)\w+) b/i],[s,[u,"Verizon"],[l,d]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[s,[u,"Barnes & Noble"],[l,d]],[/\b(tm\d{3}\w+) b/i],[s,[u,"NuVision"],[l,d]],[/\b(k88) b/i],[s,[u,"ZTE"],[l,d]],[/\b(nx\d{3}j) b/i],[s,[u,"ZTE"],[l,c]],[/\b(gen\d{3}) b.+49h/i],[s,[u,"Swiss"],[l,c]],[/\b(zur\d{3}) b/i],[s,[u,"Swiss"],[l,d]],[/\b((zeki)?tb.*\b) b/i],[s,[u,"Zeki"],[l,d]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[u,"Dragon Touch"],s,[l,d]],[/\b(ns-?\w{0,9}) b/i],[s,[u,"Insignia"],[l,d]],[/\b((nxa|next)-?\w{0,9}) b/i],[s,[u,"NextBook"],[l,d]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[u,"Voice"],s,[l,c]],[/\b(lvtel\-)?(v1[12]) b/i],[[u,"LvTel"],s,[l,c]],[/\b(ph-1) /i],[s,[u,"Essential"],[l,c]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[s,[u,"Envizen"],[l,d]],[/\b(trio[-\w\. ]+) b/i],[s,[u,"MachSpeed"],[l,d]],[/\btu_(1491) b/i],[s,[u,"Rotor"],[l,d]],[/(shield[\w ]+) b/i],[s,[u,"Nvidia"],[l,d]],[/(sprint) (\w+)/i],[u,s,[l,c]],[/(kin\.[onetw]{3})/i],[[s,/\./g," "],[u,"Microsoft"],[l,c]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[s,[u,"Zebra"],[l,d]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[s,[u,"Zebra"],[l,c]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[u,s,[l,"console"]],[/droid.+; (shield) bui/i],[s,[u,"Nvidia"],[l,"console"]],[/(playstation [345portablevi]+)/i],[s,[u,"Sony"],[l,"console"]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[s,[u,"Microsoft"],[l,"console"]],[/smart-tv.+(samsung)/i],[u,[l,p]],[/hbbtv.+maple;(\d+)/i],[[s,/^/,"SmartTV"],[u,"Samsung"],[l,p]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[u,"LG"],[l,p]],[/(apple) ?tv/i],[u,[s,"Apple TV"],[l,p]],[/crkey/i],[[s,"Chromecast"],[u,"Google"],[l,p]],[/droid.+aft(\w)( bui|\))/i],[s,[u,"Amazon"],[l,p]],[/\(dtv[\);].+(aquos)/i],[s,[u,"Sharp"],[l,p]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[u,v],[s,v],[l,p]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,p]],[/((pebble))app/i],[u,s,[l,"wearable"]],[/droid.+; (glass) \d/i],[s,[u,"Google"],[l,"wearable"]],[/droid.+; (wt63?0{2,3})\)/i],[s,[u,"Zebra"],[l,"wearable"]],[/(quest( 2)?)/i],[s,[u,"Facebook"],[l,"wearable"]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[u,[l,"embedded"]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[s,[l,c]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[s,[l,d]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,d]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,c]],[/(android[-\w\. ]{0,9});.+buil/i],[s,[u,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[a,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[a,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[a,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,a]],os:[[/microsoft (windows) (vista|xp)/i],[a,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[a,[h,y,x]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[a,"Windows"],[h,y,x]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[a,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[a,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[h,a],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[a,h],[/\(bb(10);/i],[h,[a,"BlackBerry"]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[a,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[a,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[a,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[a,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[a,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[a,h],[/(sunos) ?([\w\.\d]*)/i],[[a,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[a,h]]},w=function(t,e){if("object"==typeof t&&(e=t,t=void 0),!(this instanceof w))return new w(t,e).getResult();var n=t||(void 0!==r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),i=e?function(t,e){var n={};for(var i in t)e[i]&&e[i].length%2==0?n[i]=e[i].concat(t[i]):n[i]=t[i];return n}(b,e):b;return this.getBrowser=function(){var t,e={};return e[a]=void 0,e[h]=void 0,_.call(e,n,i.browser),e.major="string"==typeof(t=e.version)?t.replace(/[^\d\.]/g,"").split(".")[0]:void 0,e},this.getCPU=function(){var t={architecture:void 0};return _.call(t,n,i.cpu),t},this.getDevice=function(){var t={vendor:void 0,model:void 0,type:void 0};return _.call(t,n,i.device),t},this.getEngine=function(){var t={name:void 0,version:void 0};return _.call(t,n,i.engine),t},this.getOS=function(){var t={name:void 0,version:void 0};return _.call(t,n,i.os),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(t){return n="string"==typeof t&&t.length>255?v(t,255):t,this},this.setUA(n),this};w.VERSION="1.0.2",w.BROWSER=f([a,h,"major"]),w.CPU=f(["architecture"]),w.DEVICE=f([s,u,l,"console",c,p,d,"wearable","embedded"]),w.ENGINE=w.OS=f([a,h]),void 0!==e?(void 0!==t&&t.exports&&(e=t.exports=w),e.UAParser=w):n(64)?void 0===(i=function(){return w}.call(e,n,e,t))||(t.exports=i):void 0!==r&&(r.UAParser=w);var T=void 0!==r&&(r.jQuery||r.Zepto);if(T&&!T.ua){var S=new w;T.ua=S.getResult(),T.ua.get=function(){return S.getUA()},T.ua.set=function(t){S.setUA(t);var e=S.getResult();for(var n in e)T.ua[n]=e[n]}}}("object"==typeof window?window:this)},function(t,e,n){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(56),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(4))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var i,r,o,s,a,l=1,u={},h=!1,c=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},i=function(t){o.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,i=function(t){var e=c.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):i=function(t){setTimeout(f,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&f(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),i=function(e){t.postMessage(s+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return u[l]=r,i(l),l++},d.clearImmediate=p}function p(t){delete u[t]}function f(t){if(h)setTimeout(f,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{p(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(4),n(57))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var l,u=[],h=!1,c=-1;function d(){h&&l&&(h=!1,l.length?u=l.concat(u):c=-1,u.length&&p())}function p(){if(!h){var t=a(d);h=!0;for(var e=u.length;e;){for(l=u,u=[];++c<e;)l&&l[c].run();c=-1,e=u.length}l=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function m(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new f(t,e)),1!==u.length||h||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){(function(t,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof i&&i;s.global!==s&&s.window!==s&&s.self;var a,l=2147483647,u=/^xn--/,h=/[^\x20-\x7E]/,c=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,f=String.fromCharCode;function m(t){throw new RangeError(d[t])}function g(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function v(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),i+g((t=t.replace(c,".")).split("."),e).join(".")}function _(t){for(var e,n,i=[],r=0,o=t.length;r<o;)(e=t.charCodeAt(r++))>=55296&&e<=56319&&r<o?56320==(64512&(n=t.charCodeAt(r++)))?i.push(((1023&e)<<10)+(1023&n)+65536):(i.push(e),r--):i.push(e);return i}function y(t){return g(t,(function(t){var e="";return t>65535&&(e+=f((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=f(t)})).join("")}function x(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function b(t,e,n){var i=0;for(t=n?p(t/700):t>>1,t+=p(t/e);t>455;i+=36)t=p(t/35);return p(i+36*t/(t+38))}function w(t){var e,n,i,r,o,s,a,u,h,c,d,f=[],g=t.length,v=0,_=128,x=72;for((n=t.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)t.charCodeAt(i)>=128&&m("not-basic"),f.push(t.charCodeAt(i));for(r=n>0?n+1:0;r<g;){for(o=v,s=1,a=36;r>=g&&m("invalid-input"),((u=(d=t.charCodeAt(r++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||u>p((l-v)/s))&&m("overflow"),v+=u*s,!(u<(h=a<=x?1:a>=x+26?26:a-x));a+=36)s>p(l/(c=36-h))&&m("overflow"),s*=c;x=b(v-o,e=f.length+1,0==o),p(v/e)>l-_&&m("overflow"),_+=p(v/e),v%=e,f.splice(v++,0,_)}return y(f)}function T(t){var e,n,i,r,o,s,a,u,h,c,d,g,v,y,w,T=[];for(g=(t=_(t)).length,e=128,n=0,o=72,s=0;s<g;++s)(d=t[s])<128&&T.push(f(d));for(i=r=T.length,r&&T.push("-");i<g;){for(a=l,s=0;s<g;++s)(d=t[s])>=e&&d<a&&(a=d);for(a-e>p((l-n)/(v=i+1))&&m("overflow"),n+=(a-e)*v,e=a,s=0;s<g;++s)if((d=t[s])<e&&++n>l&&m("overflow"),d==e){for(u=n,h=36;!(u<(c=h<=o?1:h>=o+26?26:h-o));h+=36)w=u-c,y=36-c,T.push(f(x(c+w%y,0))),u=p(w/y);T.push(f(x(u,0))),o=b(n,v,i==r),n=0,++i}++n,++e}return T.join("")}a={version:"1.4.1",ucs2:{decode:_,encode:y},decode:w,encode:T,toASCII:function(t){return v(t,(function(t){return h.test(t)?"xn--"+T(t):t}))},toUnicode:function(t){return v(t,(function(t){return u.test(t)?w(t.slice(4).toLowerCase()):t}))}},void 0===(r=function(){return a}.call(e,n,e,t))||(t.exports=r)}()}).call(this,n(8)(t),n(4))},function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,n){"use strict";e.decode=e.parse=n(61),e.encode=e.stringify=n(62)},function(t,e,n){"use strict";function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,o){e=e||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var h=0;h<u;++h){var c,d,p,f,m=t[h].replace(a,"%20"),g=m.indexOf(n);g>=0?(c=m.substr(0,g),d=m.substr(g+1)):(c=m,d=""),p=decodeURIComponent(c),f=decodeURIComponent(d),i(s,p)?r(s[p])?s[p].push(f):s[p]=[s[p],f]:s[p]=f}return s};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,a){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?o(s(t),(function(s){var a=encodeURIComponent(i(s))+n;return r(t[s])?o(t[s],(function(t){return a+encodeURIComponent(i(t))})).join(e):a+encodeURIComponent(i(t[s]))})).join(e):a?encodeURIComponent(i(a))+n+encodeURIComponent(i(t)):""};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var n=[],i=0;i<t.length;i++)n.push(e(t[i],i));return n}var s=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},function(t,e){var n=function(){};n.prototype={fit:function(t){var e,n,i,r,o=t.length,s=o>0?t[0].width:0,a=o>0?t[0].height:0;for(this.root={x:0,y:0,width:s,height:a},e=0;e<o;e++)i=t[e],(n=this.findNode(this.root,i.width,i.height))?(r=this.splitNode(n,i.width,i.height),i.x=r.x,i.y=r.y):(r=this.growNode(i.width,i.height),i.x=r.x,i.y=r.y)},findNode:function(t,e,n){return t.used?this.findNode(t.right,e,n)||this.findNode(t.down,e,n):e<=t.width&&n<=t.height?t:null},splitNode:function(t,e,n){return t.used=!0,t.down={x:t.x,y:t.y+n,width:t.width,height:t.height-n},t.right={x:t.x+e,y:t.y,width:t.width-e,height:n},t},growNode:function(t,e){var n=t<=this.root.width,i=e<=this.root.height,r=i&&this.root.height>=this.root.width+t,o=n&&this.root.width>=this.root.height+e;return r?this.growRight(t,e):o?this.growDown(t,e):i?this.growRight(t,e):n?this.growDown(t,e):null},growRight:function(t,e){var n;return this.root={used:!0,x:0,y:0,width:this.root.width+t,height:this.root.height,down:this.root,right:{x:this.root.width,y:0,width:t,height:this.root.height}},(n=this.findNode(this.root,t,e))?this.splitNode(n,t,e):null},growDown:function(t,e){var n;return this.root={used:!0,x:0,y:0,width:this.root.width,height:this.root.height+e,down:{x:0,y:this.root.height,width:this.root.width,height:e},right:this.root},(n=this.findNode(this.root,t,e))?this.splitNode(n,t,e):null}},t.exports=n},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";n.r(e),n.d(e,"ErrorType",(function(){return JE})),n.d(e,"delay",(function(){return nI})),n.d(e,"waitUntil",(function(){return iI})),n.d(e,"SLIDE_EVENTS",(function(){return rI})),n.d(e,"Slide",(function(){return aI}));var i={};n.r(i),n.d(i,"ACESFilmicToneMapping",(function(){return lt})),n.d(i,"AddEquation",(function(){return I})),n.d(i,"AddOperation",(function(){return it})),n.d(i,"AdditiveAnimationBlendMode",(function(){return $e})),n.d(i,"AdditiveBlending",(function(){return A})),n.d(i,"AlphaFormat",(function(){return zt})),n.d(i,"AlwaysDepth",(function(){return Y})),n.d(i,"AlwaysStencilFunc",(function(){return Pn})),n.d(i,"AmbientLight",(function(){return Uc})),n.d(i,"AmbientLightProbe",(function(){return sd})),n.d(i,"AnimationClip",(function(){return oc})),n.d(i,"AnimationLoader",(function(){return pc})),n.d(i,"AnimationMixer",(function(){return Fd})),n.d(i,"AnimationObjectGroup",(function(){return Nd})),n.d(i,"AnimationUtils",(function(){return Xh})),n.d(i,"ArcCurve",(function(){return Au})),n.d(i,"ArrayCamera",(function(){return $a})),n.d(i,"ArrowHelper",(function(){return Ep})),n.d(i,"Audio",(function(){return vd})),n.d(i,"AudioAnalyser",(function(){return Td})),n.d(i,"AudioContext",(function(){return id})),n.d(i,"AudioListener",(function(){return gd})),n.d(i,"AudioLoader",(function(){return rd})),n.d(i,"AxesHelper",(function(){return Mp})),n.d(i,"AxisHelper",(function(){return Mf})),n.d(i,"BackSide",(function(){return b})),n.d(i,"BasicDepthPacking",(function(){return cn})),n.d(i,"BasicShadowMap",(function(){return g})),n.d(i,"BinaryTextureLoader",(function(){return If})),n.d(i,"Bone",(function(){return Bl})),n.d(i,"BooleanKeyframeTrack",(function(){return $h})),n.d(i,"BoundingBoxHelper",(function(){return Af})),n.d(i,"Box2",(function(){return Xd})),n.d(i,"Box3",(function(){return gi})),n.d(i,"Box3Helper",(function(){return xp})),n.d(i,"BoxBufferGeometry",(function(){return Ao})),n.d(i,"BoxGeometry",(function(){return Ao})),n.d(i,"BoxHelper",(function(){return yp})),n.d(i,"BufferAttribute",(function(){return kr})),n.d(i,"BufferGeometry",(function(){return so})),n.d(i,"BufferGeometryLoader",(function(){return Xc})),n.d(i,"ByteType",(function(){return It})),n.d(i,"Cache",(function(){return ac})),n.d(i,"Camera",(function(){return Oo})),n.d(i,"CameraHelper",(function(){return gp})),n.d(i,"CanvasRenderer",(function(){return Lf})),n.d(i,"CanvasTexture",(function(){return pu})),n.d(i,"CatmullRomCurve3",(function(){return Lu})),n.d(i,"CineonToneMapping",(function(){return at})),n.d(i,"CircleBufferGeometry",(function(){return mu})),n.d(i,"CircleGeometry",(function(){return mu})),n.d(i,"ClampToEdgeWrapping",(function(){return _t})),n.d(i,"Clock",(function(){return hd})),n.d(i,"Color",(function(){return Dr})),n.d(i,"ColorKeyframeTrack",(function(){return Qh})),n.d(i,"CompressedTexture",(function(){return du})),n.d(i,"CompressedTextureLoader",(function(){return fc})),n.d(i,"ConeBufferGeometry",(function(){return vu})),n.d(i,"ConeGeometry",(function(){return vu})),n.d(i,"CubeCamera",(function(){return No})),n.d(i,"CubeReflectionMapping",(function(){return ct})),n.d(i,"CubeRefractionMapping",(function(){return dt})),n.d(i,"CubeTexture",(function(){return Do})),n.d(i,"CubeTextureLoader",(function(){return gc})),n.d(i,"CubeUVReflectionMapping",(function(){return mt})),n.d(i,"CubeUVRefractionMapping",(function(){return gt})),n.d(i,"CubicBezierCurve",(function(){return Bu})),n.d(i,"CubicBezierCurve3",(function(){return Uu})),n.d(i,"CubicInterpolant",(function(){return Yh})),n.d(i,"CullFaceBack",(function(){return p})),n.d(i,"CullFaceFront",(function(){return f})),n.d(i,"CullFaceFrontBack",(function(){return m})),n.d(i,"CullFaceNone",(function(){return d})),n.d(i,"Curve",(function(){return Eu})),n.d(i,"CurvePath",(function(){return yc})),n.d(i,"CustomBlending",(function(){return P})),n.d(i,"CustomToneMapping",(function(){return ut})),n.d(i,"CylinderBufferGeometry",(function(){return gu})),n.d(i,"CylinderGeometry",(function(){return gu})),n.d(i,"Cylindrical",(function(){return Vd})),n.d(i,"DataTexture",(function(){return Ul})),n.d(i,"DataTexture2DArray",(function(){return hs})),n.d(i,"DataTexture3D",(function(){return cs})),n.d(i,"DataTextureLoader",(function(){return vc})),n.d(i,"DataUtils",(function(){return Cp})),n.d(i,"DecrementStencilOp",(function(){return yn})),n.d(i,"DecrementWrapStencilOp",(function(){return bn})),n.d(i,"DefaultLoadingManager",(function(){return uc})),n.d(i,"DepthFormat",(function(){return Yt})),n.d(i,"DepthStencilFormat",(function(){return Zt})),n.d(i,"DepthTexture",(function(){return fu})),n.d(i,"DirectionalLight",(function(){return Bc})),n.d(i,"DirectionalLightHelper",(function(){return pp})),n.d(i,"DiscreteInterpolant",(function(){return Jh})),n.d(i,"DodecahedronBufferGeometry",(function(){return yu})),n.d(i,"DodecahedronGeometry",(function(){return yu})),n.d(i,"DoubleSide",(function(){return w})),n.d(i,"DstAlphaFactor",(function(){return z})),n.d(i,"DstColorFactor",(function(){return V})),n.d(i,"DynamicBufferAttribute",(function(){return gf})),n.d(i,"DynamicCopyUsage",(function(){return Un})),n.d(i,"DynamicDrawUsage",(function(){return On})),n.d(i,"DynamicReadUsage",(function(){return Dn})),n.d(i,"EdgesGeometry",(function(){return Su})),n.d(i,"EdgesHelper",(function(){return Rf})),n.d(i,"EllipseCurve",(function(){return Mu})),n.d(i,"EqualDepth",(function(){return K})),n.d(i,"EqualStencilFunc",(function(){return En})),n.d(i,"EquirectangularReflectionMapping",(function(){return pt})),n.d(i,"EquirectangularRefractionMapping",(function(){return ft})),n.d(i,"Euler",(function(){return tr})),n.d(i,"EventDispatcher",(function(){return zn})),n.d(i,"ExtrudeBufferGeometry",(function(){return yh})),n.d(i,"ExtrudeGeometry",(function(){return yh})),n.d(i,"FaceColors",(function(){return of})),n.d(i,"FileLoader",(function(){return dc})),n.d(i,"FlatShading",(function(){return T})),n.d(i,"Float16BufferAttribute",(function(){return qr})),n.d(i,"Float32Attribute",(function(){return Sf})),n.d(i,"Float32BufferAttribute",(function(){return Yr})),n.d(i,"Float64Attribute",(function(){return Ef})),n.d(i,"Float64BufferAttribute",(function(){return Zr})),n.d(i,"FloatType",(function(){return Ft})),n.d(i,"Fog",(function(){return al})),n.d(i,"FogExp2",(function(){return sl})),n.d(i,"Font",(function(){return Qc})),n.d(i,"FontLoader",(function(){return ed})),n.d(i,"FrontSide",(function(){return x})),n.d(i,"Frustum",(function(){return jo})),n.d(i,"GLBufferAttribute",(function(){return kd})),n.d(i,"GLSL1",(function(){return Gn})),n.d(i,"GLSL3",(function(){return Hn})),n.d(i,"GammaEncoding",(function(){return on})),n.d(i,"GreaterDepth",(function(){return Q})),n.d(i,"GreaterEqualDepth",(function(){return $})),n.d(i,"GreaterEqualStencilFunc",(function(){return Cn})),n.d(i,"GreaterStencilFunc",(function(){return An})),n.d(i,"GridHelper",(function(){return lp})),n.d(i,"Group",(function(){return Qa})),n.d(i,"HalfFloatType",(function(){return Bt})),n.d(i,"HemisphereLight",(function(){return Tc})),n.d(i,"HemisphereLightHelper",(function(){return ap})),n.d(i,"HemisphereLightProbe",(function(){return od})),n.d(i,"IcosahedronBufferGeometry",(function(){return bh})),n.d(i,"IcosahedronGeometry",(function(){return bh})),n.d(i,"ImageBitmapLoader",(function(){return Kc})),n.d(i,"ImageLoader",(function(){return mc})),n.d(i,"ImageUtils",(function(){return ri})),n.d(i,"ImmediateRenderObject",(function(){return Jd})),n.d(i,"IncrementStencilOp",(function(){return _n})),n.d(i,"IncrementWrapStencilOp",(function(){return xn})),n.d(i,"InstancedBufferAttribute",(function(){return Wc})),n.d(i,"InstancedBufferGeometry",(function(){return Vc})),n.d(i,"InstancedInterleavedBuffer",(function(){return Ud})),n.d(i,"InstancedMesh",(function(){return Xl})),n.d(i,"Int16Attribute",(function(){return xf})),n.d(i,"Int16BufferAttribute",(function(){return jr})),n.d(i,"Int32Attribute",(function(){return wf})),n.d(i,"Int32BufferAttribute",(function(){return Wr})),n.d(i,"Int8Attribute",(function(){return vf})),n.d(i,"Int8BufferAttribute",(function(){return Gr})),n.d(i,"IntType",(function(){return Nt})),n.d(i,"InterleavedBuffer",(function(){return ul})),n.d(i,"InterleavedBufferAttribute",(function(){return cl})),n.d(i,"Interpolant",(function(){return qh})),n.d(i,"InterpolateDiscrete",(function(){return We})),n.d(i,"InterpolateLinear",(function(){return Xe})),n.d(i,"InterpolateSmooth",(function(){return qe})),n.d(i,"InvertStencilOp",(function(){return wn})),n.d(i,"JSONLoader",(function(){return Nf})),n.d(i,"KeepStencilOp",(function(){return gn})),n.d(i,"KeyframeTrack",(function(){return Kh})),n.d(i,"LOD",(function(){return Pl})),n.d(i,"LatheBufferGeometry",(function(){return wh})),n.d(i,"LatheGeometry",(function(){return wh})),n.d(i,"Layers",(function(){return er})),n.d(i,"LensFlare",(function(){return Ff})),n.d(i,"LessDepth",(function(){return Z})),n.d(i,"LessEqualDepth",(function(){return J})),n.d(i,"LessEqualStencilFunc",(function(){return Mn})),n.d(i,"LessStencilFunc",(function(){return Sn})),n.d(i,"Light",(function(){return wc})),n.d(i,"LightProbe",(function(){return Hc})),n.d(i,"Line",(function(){return Ql})),n.d(i,"Line3",(function(){return Zd})),n.d(i,"LineBasicMaterial",(function(){return ql})),n.d(i,"LineCurve",(function(){return ku})),n.d(i,"LineCurve3",(function(){return Gu})),n.d(i,"LineDashedMaterial",(function(){return Vh})),n.d(i,"LineLoop",(function(){return iu})),n.d(i,"LinePieces",(function(){return nf})),n.d(i,"LineSegments",(function(){return nu})),n.d(i,"LineStrip",(function(){return ef})),n.d(i,"LinearEncoding",(function(){return nn})),n.d(i,"LinearFilter",(function(){return Et})),n.d(i,"LinearInterpolant",(function(){return Zh})),n.d(i,"LinearMipMapLinearFilter",(function(){return Ct})),n.d(i,"LinearMipMapNearestFilter",(function(){return At})),n.d(i,"LinearMipmapLinearFilter",(function(){return Rt})),n.d(i,"LinearMipmapNearestFilter",(function(){return Mt})),n.d(i,"LinearToneMapping",(function(){return ot})),n.d(i,"Loader",(function(){return hc})),n.d(i,"LoaderUtils",(function(){return jc})),n.d(i,"LoadingManager",(function(){return lc})),n.d(i,"LogLuvEncoding",(function(){return an})),n.d(i,"LoopOnce",(function(){return ze})),n.d(i,"LoopPingPong",(function(){return Ve})),n.d(i,"LoopRepeat",(function(){return je})),n.d(i,"LuminanceAlphaFormat",(function(){return Xt})),n.d(i,"LuminanceFormat",(function(){return Wt})),n.d(i,"MOUSE",(function(){return h})),n.d(i,"Material",(function(){return Rr})),n.d(i,"MaterialLoader",(function(){return zc})),n.d(i,"Math",(function(){return ti})),n.d(i,"MathUtils",(function(){return ti})),n.d(i,"Matrix3",(function(){return ni})),n.d(i,"Matrix4",(function(){return Vi})),n.d(i,"MaxEquation",(function(){return D})),n.d(i,"Mesh",(function(){return Eo})),n.d(i,"MeshBasicMaterial",(function(){return Fr})),n.d(i,"MeshDepthMaterial",(function(){return Xa})),n.d(i,"MeshDistanceMaterial",(function(){return qa})),n.d(i,"MeshFaceMaterial",(function(){return af})),n.d(i,"MeshLambertMaterial",(function(){return zh})),n.d(i,"MeshMatcapMaterial",(function(){return jh})),n.d(i,"MeshNormalMaterial",(function(){return Hh})),n.d(i,"MeshPhongMaterial",(function(){return kh})),n.d(i,"MeshPhysicalMaterial",(function(){return Uh})),n.d(i,"MeshStandardMaterial",(function(){return Bh})),n.d(i,"MeshToonMaterial",(function(){return Gh})),n.d(i,"MinEquation",(function(){return N})),n.d(i,"MirroredRepeatWrapping",(function(){return yt})),n.d(i,"MixOperation",(function(){return nt})),n.d(i,"MultiMaterial",(function(){return lf})),n.d(i,"MultiplyBlending",(function(){return C})),n.d(i,"MultiplyOperation",(function(){return et})),n.d(i,"NearestFilter",(function(){return xt})),n.d(i,"NearestMipMapLinearFilter",(function(){return St})),n.d(i,"NearestMipMapNearestFilter",(function(){return wt})),n.d(i,"NearestMipmapLinearFilter",(function(){return Tt})),n.d(i,"NearestMipmapNearestFilter",(function(){return bt})),n.d(i,"NeverDepth",(function(){return q})),n.d(i,"NeverStencilFunc",(function(){return Tn})),n.d(i,"NoBlending",(function(){return E})),n.d(i,"NoColors",(function(){return rf})),n.d(i,"NoToneMapping",(function(){return rt})),n.d(i,"NormalAnimationBlendMode",(function(){return Ke})),n.d(i,"NormalBlending",(function(){return M})),n.d(i,"NotEqualDepth",(function(){return tt})),n.d(i,"NotEqualStencilFunc",(function(){return Rn})),n.d(i,"NumberKeyframeTrack",(function(){return tc})),n.d(i,"Object3D",(function(){return mr})),n.d(i,"ObjectLoader",(function(){return qc})),n.d(i,"ObjectSpaceNormalMap",(function(){return fn})),n.d(i,"OctahedronBufferGeometry",(function(){return Th})),n.d(i,"OctahedronGeometry",(function(){return Th})),n.d(i,"OneFactor",(function(){return B})),n.d(i,"OneMinusDstAlphaFactor",(function(){return j})),n.d(i,"OneMinusDstColorFactor",(function(){return W})),n.d(i,"OneMinusSrcAlphaFactor",(function(){return H})),n.d(i,"OneMinusSrcColorFactor",(function(){return k})),n.d(i,"OrthographicCamera",(function(){return Dc})),n.d(i,"PCFShadowMap",(function(){return v})),n.d(i,"PCFSoftShadowMap",(function(){return _})),n.d(i,"PMREMGenerator",(function(){return Xp})),n.d(i,"ParametricBufferGeometry",(function(){return Sh})),n.d(i,"ParametricGeometry",(function(){return Sh})),n.d(i,"Particle",(function(){return hf})),n.d(i,"ParticleBasicMaterial",(function(){return pf})),n.d(i,"ParticleSystem",(function(){return cf})),n.d(i,"ParticleSystemMaterial",(function(){return ff})),n.d(i,"Path",(function(){return xc})),n.d(i,"PerspectiveCamera",(function(){return Lo})),n.d(i,"Plane",(function(){return Go})),n.d(i,"PlaneBufferGeometry",(function(){return Xo})),n.d(i,"PlaneGeometry",(function(){return Xo})),n.d(i,"PlaneHelper",(function(){return bp})),n.d(i,"PointCloud",(function(){return uf})),n.d(i,"PointCloudMaterial",(function(){return df})),n.d(i,"PointLight",(function(){return Nc})),n.d(i,"PointLightHelper",(function(){return ip})),n.d(i,"Points",(function(){return uu})),n.d(i,"PointsMaterial",(function(){return ru})),n.d(i,"PolarGridHelper",(function(){return up})),n.d(i,"PolyhedronBufferGeometry",(function(){return _u})),n.d(i,"PolyhedronGeometry",(function(){return _u})),n.d(i,"PositionalAudio",(function(){return wd})),n.d(i,"PropertyBinding",(function(){return Ld})),n.d(i,"PropertyMixer",(function(){return Sd})),n.d(i,"QuadraticBezierCurve",(function(){return Hu})),n.d(i,"QuadraticBezierCurve3",(function(){return zu})),n.d(i,"Quaternion",(function(){return di})),n.d(i,"QuaternionKeyframeTrack",(function(){return nc})),n.d(i,"QuaternionLinearInterpolant",(function(){return ec})),n.d(i,"REVISION",(function(){return u})),n.d(i,"RGBADepthPacking",(function(){return dn})),n.d(i,"RGBAFormat",(function(){return Vt})),n.d(i,"RGBAIntegerFormat",(function(){return ee})),n.d(i,"RGBA_ASTC_10x10_Format",(function(){return Se})),n.d(i,"RGBA_ASTC_10x5_Format",(function(){return be})),n.d(i,"RGBA_ASTC_10x6_Format",(function(){return we})),n.d(i,"RGBA_ASTC_10x8_Format",(function(){return Te})),n.d(i,"RGBA_ASTC_12x10_Format",(function(){return Ee})),n.d(i,"RGBA_ASTC_12x12_Format",(function(){return Me})),n.d(i,"RGBA_ASTC_4x4_Format",(function(){return pe})),n.d(i,"RGBA_ASTC_5x4_Format",(function(){return fe})),n.d(i,"RGBA_ASTC_5x5_Format",(function(){return me})),n.d(i,"RGBA_ASTC_6x5_Format",(function(){return ge})),n.d(i,"RGBA_ASTC_6x6_Format",(function(){return ve})),n.d(i,"RGBA_ASTC_8x5_Format",(function(){return _e})),n.d(i,"RGBA_ASTC_8x6_Format",(function(){return ye})),n.d(i,"RGBA_ASTC_8x8_Format",(function(){return xe})),n.d(i,"RGBA_BPTC_Format",(function(){return Ae})),n.d(i,"RGBA_ETC2_EAC_Format",(function(){return de})),n.d(i,"RGBA_PVRTC_2BPPV1_Format",(function(){return ue})),n.d(i,"RGBA_PVRTC_4BPPV1_Format",(function(){return le})),n.d(i,"RGBA_S3TC_DXT1_Format",(function(){return ie})),n.d(i,"RGBA_S3TC_DXT3_Format",(function(){return re})),n.d(i,"RGBA_S3TC_DXT5_Format",(function(){return oe})),n.d(i,"RGBDEncoding",(function(){return hn})),n.d(i,"RGBEEncoding",(function(){return sn})),n.d(i,"RGBEFormat",(function(){return qt})),n.d(i,"RGBFormat",(function(){return jt})),n.d(i,"RGBIntegerFormat",(function(){return te})),n.d(i,"RGBM16Encoding",(function(){return un})),n.d(i,"RGBM7Encoding",(function(){return ln})),n.d(i,"RGB_ETC1_Format",(function(){return he})),n.d(i,"RGB_ETC2_Format",(function(){return ce})),n.d(i,"RGB_PVRTC_2BPPV1_Format",(function(){return ae})),n.d(i,"RGB_PVRTC_4BPPV1_Format",(function(){return se})),n.d(i,"RGB_S3TC_DXT1_Format",(function(){return ne})),n.d(i,"RGFormat",(function(){return $t})),n.d(i,"RGIntegerFormat",(function(){return Qt})),n.d(i,"RawShaderMaterial",(function(){return Fh})),n.d(i,"Ray",(function(){return ji})),n.d(i,"Raycaster",(function(){return Gd})),n.d(i,"RectAreaLight",(function(){return kc})),n.d(i,"RedFormat",(function(){return Jt})),n.d(i,"RedIntegerFormat",(function(){return Kt})),n.d(i,"ReinhardToneMapping",(function(){return st})),n.d(i,"RepeatWrapping",(function(){return vt})),n.d(i,"ReplaceStencilOp",(function(){return vn})),n.d(i,"ReverseSubtractEquation",(function(){return L})),n.d(i,"RingBufferGeometry",(function(){return Eh})),n.d(i,"RingGeometry",(function(){return Eh})),n.d(i,"SRGB8_ALPHA8_ASTC_10x10_Format",(function(){return ke})),n.d(i,"SRGB8_ALPHA8_ASTC_10x5_Format",(function(){return Fe})),n.d(i,"SRGB8_ALPHA8_ASTC_10x6_Format",(function(){return Be})),n.d(i,"SRGB8_ALPHA8_ASTC_10x8_Format",(function(){return Ue})),n.d(i,"SRGB8_ALPHA8_ASTC_12x10_Format",(function(){return Ge})),n.d(i,"SRGB8_ALPHA8_ASTC_12x12_Format",(function(){return He})),n.d(i,"SRGB8_ALPHA8_ASTC_4x4_Format",(function(){return Re})),n.d(i,"SRGB8_ALPHA8_ASTC_5x4_Format",(function(){return Ce})),n.d(i,"SRGB8_ALPHA8_ASTC_5x5_Format",(function(){return Pe})),n.d(i,"SRGB8_ALPHA8_ASTC_6x5_Format",(function(){return Ie})),n.d(i,"SRGB8_ALPHA8_ASTC_6x6_Format",(function(){return Oe})),n.d(i,"SRGB8_ALPHA8_ASTC_8x5_Format",(function(){return Le})),n.d(i,"SRGB8_ALPHA8_ASTC_8x6_Format",(function(){return Ne})),n.d(i,"SRGB8_ALPHA8_ASTC_8x8_Format",(function(){return De})),n.d(i,"Scene",(function(){return ll})),n.d(i,"SceneUtils",(function(){return Df})),n.d(i,"ShaderChunk",(function(){return qo})),n.d(i,"ShaderLib",(function(){return Zo})),n.d(i,"ShaderMaterial",(function(){return Io})),n.d(i,"ShadowMaterial",(function(){return Dh})),n.d(i,"Shape",(function(){return bc})),n.d(i,"ShapeBufferGeometry",(function(){return Mh})),n.d(i,"ShapeGeometry",(function(){return Mh})),n.d(i,"ShapePath",(function(){return $c})),n.d(i,"ShapeUtils",(function(){return gh})),n.d(i,"ShortType",(function(){return Ot})),n.d(i,"Skeleton",(function(){return Hl})),n.d(i,"SkeletonHelper",(function(){return np})),n.d(i,"SkinnedMesh",(function(){return Fl})),n.d(i,"SmoothShading",(function(){return S})),n.d(i,"Sphere",(function(){return Di})),n.d(i,"SphereBufferGeometry",(function(){return Ah})),n.d(i,"SphereGeometry",(function(){return Ah})),n.d(i,"Spherical",(function(){return jd})),n.d(i,"SphericalHarmonics3",(function(){return Gc})),n.d(i,"SplineCurve",(function(){return ju})),n.d(i,"SpotLight",(function(){return Cc})),n.d(i,"SpotLightHelper",(function(){return $d})),n.d(i,"Sprite",(function(){return Ml})),n.d(i,"SpriteMaterial",(function(){return dl})),n.d(i,"SrcAlphaFactor",(function(){return G})),n.d(i,"SrcAlphaSaturateFactor",(function(){return X})),n.d(i,"SrcColorFactor",(function(){return U})),n.d(i,"StaticCopyUsage",(function(){return Bn})),n.d(i,"StaticDrawUsage",(function(){return In})),n.d(i,"StaticReadUsage",(function(){return Nn})),n.d(i,"StereoCamera",(function(){return ud})),n.d(i,"StreamCopyUsage",(function(){return kn})),n.d(i,"StreamDrawUsage",(function(){return Ln})),n.d(i,"StreamReadUsage",(function(){return Fn})),n.d(i,"StringKeyframeTrack",(function(){return ic})),n.d(i,"SubtractEquation",(function(){return O})),n.d(i,"SubtractiveBlending",(function(){return R})),n.d(i,"TOUCH",(function(){return c})),n.d(i,"TangentSpaceNormalMap",(function(){return pn})),n.d(i,"TetrahedronBufferGeometry",(function(){return Rh})),n.d(i,"TetrahedronGeometry",(function(){return Rh})),n.d(i,"TextBufferGeometry",(function(){return Ch})),n.d(i,"TextGeometry",(function(){return Ch})),n.d(i,"Texture",(function(){return si})),n.d(i,"TextureLoader",(function(){return _c})),n.d(i,"TorusBufferGeometry",(function(){return Ph})),n.d(i,"TorusGeometry",(function(){return Ph})),n.d(i,"TorusKnotBufferGeometry",(function(){return Ih})),n.d(i,"TorusKnotGeometry",(function(){return Ih})),n.d(i,"Triangle",(function(){return Mr})),n.d(i,"TriangleFanDrawMode",(function(){return en})),n.d(i,"TriangleStripDrawMode",(function(){return tn})),n.d(i,"TrianglesDrawMode",(function(){return Qe})),n.d(i,"TubeBufferGeometry",(function(){return Oh})),n.d(i,"TubeGeometry",(function(){return Oh})),n.d(i,"UVMapping",(function(){return ht})),n.d(i,"Uint16Attribute",(function(){return bf})),n.d(i,"Uint16BufferAttribute",(function(){return Vr})),n.d(i,"Uint32Attribute",(function(){return Tf})),n.d(i,"Uint32BufferAttribute",(function(){return Xr})),n.d(i,"Uint8Attribute",(function(){return _f})),n.d(i,"Uint8BufferAttribute",(function(){return Hr})),n.d(i,"Uint8ClampedAttribute",(function(){return yf})),n.d(i,"Uint8ClampedBufferAttribute",(function(){return zr})),n.d(i,"Uniform",(function(){return Bd})),n.d(i,"UniformsLib",(function(){return Yo})),n.d(i,"UniformsUtils",(function(){return Po})),n.d(i,"UnsignedByteType",(function(){return Pt})),n.d(i,"UnsignedInt248Type",(function(){return Ht})),n.d(i,"UnsignedIntType",(function(){return Dt})),n.d(i,"UnsignedShort4444Type",(function(){return Ut})),n.d(i,"UnsignedShort5551Type",(function(){return kt})),n.d(i,"UnsignedShort565Type",(function(){return Gt})),n.d(i,"UnsignedShortType",(function(){return Lt})),n.d(i,"VSMShadowMap",(function(){return y})),n.d(i,"Vector2",(function(){return ei})),n.d(i,"Vector3",(function(){return pi})),n.d(i,"Vector4",(function(){return li})),n.d(i,"VectorKeyframeTrack",(function(){return rc})),n.d(i,"Vertex",(function(){return mf})),n.d(i,"VertexColors",(function(){return sf})),n.d(i,"VideoTexture",(function(){return cu})),n.d(i,"WebGL1Renderer",(function(){return ol})),n.d(i,"WebGLCubeRenderTarget",(function(){return Fo})),n.d(i,"WebGLMultipleRenderTargets",(function(){return hi})),n.d(i,"WebGLMultisampleRenderTarget",(function(){return ci})),n.d(i,"WebGLRenderTarget",(function(){return ui})),n.d(i,"WebGLRenderTargetCube",(function(){return Of})),n.d(i,"WebGLRenderer",(function(){return rl})),n.d(i,"WebGLUtils",(function(){return Ka})),n.d(i,"WireframeGeometry",(function(){return Lh})),n.d(i,"WireframeHelper",(function(){return Cf})),n.d(i,"WrapAroundEnding",(function(){return Je})),n.d(i,"XHRLoader",(function(){return Pf})),n.d(i,"ZeroCurvatureEnding",(function(){return Ye})),n.d(i,"ZeroFactor",(function(){return F})),n.d(i,"ZeroSlopeEnding",(function(){return Ze})),n.d(i,"ZeroStencilOp",(function(){return mn})),n.d(i,"sRGBEncoding",(function(){return rn}));var r={};n.r(r),n.d(r,"isMobile",(function(){return Zg})),n.d(r,"EventEmitter",(function(){return vv.a})),n.d(r,"earcut",(function(){return yv.a})),n.d(r,"BaseTextureCache",(function(){return $v})),n.d(r,"CanvasRenderTarget",(function(){return e_})),n.d(r,"DATA_URI",(function(){return r_})),n.d(r,"ProgramCache",(function(){return Jv})),n.d(r,"TextureCache",(function(){return Kv})),n.d(r,"clearTextureCache",(function(){return t_})),n.d(r,"correctBlendMode",(function(){return Lv})),n.d(r,"createIndicesForQuads",(function(){return Bv})),n.d(r,"decomposeDataUri",(function(){return o_})),n.d(r,"deprecation",(function(){return Zv})),n.d(r,"destroyTextureCache",(function(){return Qv})),n.d(r,"determineCrossOrigin",(function(){return s_})),n.d(r,"getBufferType",(function(){return Uv})),n.d(r,"getResolutionOfUrl",(function(){return a_})),n.d(r,"hex2rgb",(function(){return Rv})),n.d(r,"hex2string",(function(){return Cv})),n.d(r,"interleaveTypedArrays",(function(){return Gv})),n.d(r,"isPow2",(function(){return zv})),n.d(r,"isWebGLSupported",(function(){return Mv})),n.d(r,"log2",(function(){return jv})),n.d(r,"nextPow2",(function(){return Hv})),n.d(r,"premultiplyBlendMode",(function(){return Ov})),n.d(r,"premultiplyRgba",(function(){return Nv})),n.d(r,"premultiplyTint",(function(){return Dv})),n.d(r,"premultiplyTintToRgba",(function(){return Fv})),n.d(r,"removeItems",(function(){return Vv})),n.d(r,"rgb2hex",(function(){return Iv})),n.d(r,"sayHello",(function(){return Ev})),n.d(r,"sign",(function(){return Wv})),n.d(r,"skipHello",(function(){return Sv})),n.d(r,"string2hex",(function(){return Pv})),n.d(r,"trimCanvas",(function(){return n_})),n.d(r,"uid",(function(){return qv})),n.d(r,"url",(function(){return bv}));var o=n(6),s=n(0),a=n.n(s),l=n(1);
36
36
  /**
37
37
  * @license
38
38
  * Copyright 2010-2021 Three.js Authors
39
39
  * SPDX-License-Identifier: MIT
40
40
  */
41
- const u="130",h={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},c={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},d=0,p=1,f=2,m=3,g=0,v=1,_=2,y=3,x=0,b=1,w=2,T=1,S=2,E=0,M=1,A=2,R=3,C=4,P=5,I=100,O=101,L=102,N=103,D=104,F=200,B=201,U=202,k=203,G=204,H=205,z=206,j=207,V=208,W=209,X=210,q=0,Y=1,Z=2,J=3,K=4,$=5,Q=6,tt=7,et=0,nt=1,it=2,rt=0,ot=1,st=2,at=3,lt=4,ut=5,ht=300,ct=301,dt=302,pt=303,ft=304,mt=306,gt=307,vt=1e3,_t=1001,yt=1002,xt=1003,bt=1004,wt=1004,Tt=1005,St=1005,Et=1006,Mt=1007,At=1007,Rt=1008,Ct=1008,Pt=1009,It=1010,Ot=1011,Lt=1012,Nt=1013,Dt=1014,Ft=1015,Bt=1016,Ut=1017,kt=1018,Gt=1019,Ht=1020,zt=1021,jt=1022,Vt=1023,Wt=1024,Xt=1025,qt=Vt,Yt=1026,Zt=1027,Jt=1028,Kt=1029,$t=1030,Qt=1031,te=1032,ee=1033,ne=33776,ie=33777,re=33778,oe=33779,se=35840,ae=35841,le=35842,ue=35843,he=36196,ce=37492,de=37496,pe=37808,fe=37809,me=37810,ge=37811,ve=37812,_e=37813,ye=37814,xe=37815,be=37816,we=37817,Te=37818,Se=37819,Ee=37820,Me=37821,Ae=36492,Re=37840,Ce=37841,Pe=37842,Ie=37843,Oe=37844,Le=37845,Ne=37846,De=37847,Fe=37848,Be=37849,Ue=37850,ke=37851,Ge=37852,He=37853,ze=2200,je=2201,Ve=2202,We=2300,Xe=2301,qe=2302,Ye=2400,Ze=2401,Je=2402,Ke=2500,$e=2501,Qe=0,tn=1,en=2,nn=3e3,rn=3001,on=3007,sn=3002,an=3003,ln=3004,un=3005,hn=3006,cn=3200,dn=3201,pn=0,fn=1,mn=0,gn=7680,vn=7681,_n=7682,yn=7683,xn=34055,bn=34056,wn=5386,Tn=512,Sn=513,En=514,Mn=515,An=516,Rn=517,Cn=518,Pn=519,In=35044,On=35048,Ln=35040,Nn=35045,Dn=35049,Fn=35041,Bn=35046,Un=35050,kn=35042,Gn="100",Hn="300 es";class zn{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const jn=[];for(let t=0;t<256;t++)jn[t]=(t<16?"0":"")+t.toString(16);let Vn=1234567;const Wn=Math.PI/180,Xn=180/Math.PI;function qn(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(jn[255&t]+jn[t>>8&255]+jn[t>>16&255]+jn[t>>24&255]+"-"+jn[255&e]+jn[e>>8&255]+"-"+jn[e>>16&15|64]+jn[e>>24&255]+"-"+jn[63&n|128]+jn[n>>8&255]+"-"+jn[n>>16&255]+jn[n>>24&255]+jn[255&i]+jn[i>>8&255]+jn[i>>16&255]+jn[i>>24&255]).toUpperCase()}function Yn(t,e,n){return Math.max(e,Math.min(n,t))}function Zn(t,e){return(t%e+e)%e}function Jn(t,e,n){return(1-n)*t+n*e}function Kn(t){return 0==(t&t-1)&&0!==t}function $n(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Qn(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var ti=Object.freeze({__proto__:null,DEG2RAD:Wn,RAD2DEG:Xn,generateUUID:qn,clamp:Yn,euclideanModulo:Zn,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Jn,damp:function(t,e,n,i){return Jn(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(Zn(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Vn=t%2147483647),Vn=16807*Vn%2147483647,(Vn-1)/2147483646},degToRad:function(t){return t*Wn},radToDeg:function(t){return t*Xn},isPowerOfTwo:Kn,ceilPowerOfTwo:$n,floorPowerOfTwo:Qn,setQuaternionFromProperEuler:function(t,e,n,i,r){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),u=o((e+i)/2),h=s((e+i)/2),c=o((e-i)/2),d=s((e-i)/2),p=o((i-e)/2),f=s((i-e)/2);switch(r){case"XYX":t.set(a*h,l*c,l*d,a*u);break;case"YZY":t.set(l*d,a*h,l*c,a*u);break;case"ZXZ":t.set(l*c,l*d,a*h,a*u);break;case"XZX":t.set(a*h,l*f,l*p,a*u);break;case"YXY":t.set(l*p,a*h,l*f,a*u);break;case"ZYZ":t.set(l*f,l*p,a*h,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class ei{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}ei.prototype.isVector2=!0;class ni{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,l){const u=this.elements;return u[0]=t,u[1]=i,u[2]=s,u[3]=e,u[4]=r,u[5]=a,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],u=n[4],h=n[7],c=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],y=i[7],x=i[2],b=i[5],w=i[8];return r[0]=o*f+s*v+a*x,r[3]=o*m+s*_+a*b,r[6]=o*g+s*y+a*w,r[1]=l*f+u*v+h*x,r[4]=l*m+u*_+h*b,r[7]=l*g+u*y+h*w,r[2]=c*f+d*v+p*x,r[5]=c*m+d*_+p*b,r[8]=c*g+d*y+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8];return e*o*u-e*s*l-n*r*u+n*s*a+i*r*l-i*o*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],h=u*o-s*l,c=s*a-u*r,d=l*r-o*a,p=e*h+n*c+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-u*n)*f,t[2]=(s*n-i*o)*f,t[3]=c*f,t[4]=(u*e-i*a)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*a-l*e)*f,t[8]=(o*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*o+l*s)+o+t,-i*l,i*a,-i*(-l*o+a*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],s=i[6],a=i[1],l=i[4],u=i[7];return i[0]=e*r+n*a,i[3]=e*o+n*l,i[6]=e*s+n*u,i[1]=-n*r+e*a,i[4]=-n*o+e*l,i[7]=-n*s+e*u,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let ii;ni.prototype.isMatrix3=!0;class ri{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ii&&(ii=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),ii.width=t.width,ii.height=t.height;const n=ii.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ii}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let oi=0;class si extends zn{constructor(t=si.DEFAULT_IMAGE,e=si.DEFAULT_MAPPING,n=_t,i=_t,r=Et,o=Rt,s=Vt,a=Pt,l=1,u=nn){super(),Object.defineProperty(this,"id",{value:oi++}),this.uuid=qn(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new ei(0,0),this.repeat=new ei(1,1),this.center=new ei(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=qn()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(ai(i[t].image)):e.push(ai(i[t]))}else e=ai(i);t.images[i.uuid]={uuid:i.uuid,url:e}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ht)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case vt:t.x=t.x-Math.floor(t.x);break;case _t:t.x=t.x<0?0:1;break;case yt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case vt:t.y=t.y-Math.floor(t.y);break;case _t:t.y=t.y<0?0:1;break;case yt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function ai(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ri.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}si.DEFAULT_IMAGE=void 0,si.DEFAULT_MAPPING=ht,si.prototype.isTexture=!0;class li{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=t.elements,s=o[0],a=o[4],l=o[8],u=o[1],h=o[5],c=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(a-u)<.01&&Math.abs(l-d)<.01&&Math.abs(c-p)<.01){if(Math.abs(a+u)<.1&&Math.abs(l+d)<.1&&Math.abs(c+p)<.1&&Math.abs(s+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(h+1)/2,m=(f+1)/2,g=(a+u)/4,v=(l+d)/4,_=(c+p)/4;return t>o&&t>m?t<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=g/n,r=v/n):o>m?o<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=g/i,r=_/i):m<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=v/r,i=_/r),this.set(n,i,r,e),this}let m=Math.sqrt((p-c)*(p-c)+(l-d)*(l-d)+(u-a)*(u-a));return Math.abs(m)<.001&&(m=1),this.x=(p-c)/m,this.y=(l-d)/m,this.z=(u-a)/m,this.w=Math.acos((s+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}li.prototype.isVector4=!0;class ui extends zn{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new li(0,0,t,e),this.scissorTest=!1,this.viewport=new li(0,0,t,e),this.texture=new si(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Et,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}ui.prototype.isWebGLRenderTarget=!0;class hi extends ui{constructor(t,e,n){super(t,e);const i=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=i.clone()}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}hi.prototype.isWebGLMultipleRenderTargets=!0;class ci extends ui{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}ci.prototype.isWebGLMultisampleRenderTarget=!0;class di{constructor(t=0,e=0,n=0,i=1){this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,i)}static slerpFlat(t,e,n,i,r,o,s){let a=n[i+0],l=n[i+1],u=n[i+2],h=n[i+3];const c=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(0===s)return t[e+0]=a,t[e+1]=l,t[e+2]=u,void(t[e+3]=h);if(1===s)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||a!==c||l!==d||u!==p){let t=1-s;const e=a*c+l*d+u*p+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*n;if(a=a*t+c*r,l=l*t+d*r,u=u*t+p*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+u*u+h*h);a*=t,l*=t,u*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],l=n[i+2],u=n[i+3],h=r[o],c=r[o+1],d=r[o+2],p=r[o+3];return t[e]=s*p+u*h+a*d-l*c,t[e+1]=a*p+u*c+l*h-s*d,t[e+2]=l*p+u*d+s*c-a*h,t[e+3]=u*p-s*h-a*c-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(n/2),u=s(i/2),h=s(r/2),c=a(n/2),d=a(i/2),p=a(r/2);switch(o){case"XYZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"YXZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"ZXY":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"ZYX":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"YZX":this._x=c*u*h+l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h-c*d*p;break;case"XZY":this._x=c*u*h-l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],u=e[6],h=e[10],c=n+s+h;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(u-a)*t,this._y=(r-l)*t,this._z=(o-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(u-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+u)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(o-i)/t,this._x=(r+l)/t,this._y=(a+u)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Yn(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+o*s+i*l-r*a,this._y=i*u+o*a+r*s-n*l,this._z=r*u+o*l+n*a-i*s,this._w=o*u-n*s-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),u=Math.atan2(l,s),h=Math.sin((1-e)*u)/l,c=Math.sin(e*u)/l;return this._w=o*h+this._w*c,this._x=n*h+this._x*c,this._y=i*h+this._y*c,this._z=r*h+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}di.prototype.isQuaternion=!0;class pi{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(mi.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(mi.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*i-s*n,u=a*n+s*e-r*i,h=a*i+r*n-o*e,c=-r*e-o*n-s*i;return this.x=l*a+c*-r+u*-s-h*-o,this.y=u*a+c*-o+h*-r-l*-s,this.z=h*a+c*-s+l*-o-u*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return fi.copy(this).projectOnVector(t),this.sub(fi)}reflect(t){return this.sub(fi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Yn(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}pi.prototype.isVector3=!0;const fi=new pi,mi=new di;class gi{constructor(t=new pi(1/0,1/0,1/0),e=new pi(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],u=t[a+1],h=t[a+2];l<e&&(e=l),u<n&&(n=u),h<i&&(i=h),l>r&&(r=l),u>o&&(o=u),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),u=t.getY(a),h=t.getZ(a);l<e&&(e=l),u<n&&(n=u),h<i&&(i=h),l>r&&(r=l),u>o&&(o=u),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=_i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),yi.copy(e.boundingBox),yi.applyMatrix4(t.matrixWorld),this.union(yi));const n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,_i),_i.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Mi),Ai.subVectors(this.max,Mi),xi.subVectors(t.a,Mi),bi.subVectors(t.b,Mi),wi.subVectors(t.c,Mi),Ti.subVectors(bi,xi),Si.subVectors(wi,bi),Ei.subVectors(xi,wi);let e=[0,-Ti.z,Ti.y,0,-Si.z,Si.y,0,-Ei.z,Ei.y,Ti.z,0,-Ti.x,Si.z,0,-Si.x,Ei.z,0,-Ei.x,-Ti.y,Ti.x,0,-Si.y,Si.x,0,-Ei.y,Ei.x,0];return!!Pi(e,xi,bi,wi,Ai)&&(e=[1,0,0,0,1,0,0,0,1],!!Pi(e,xi,bi,wi,Ai)&&(Ri.crossVectors(Ti,Si),e=[Ri.x,Ri.y,Ri.z],Pi(e,xi,bi,wi,Ai)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return _i.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(_i).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(vi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),vi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),vi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),vi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),vi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),vi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),vi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),vi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(vi)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}gi.prototype.isBox3=!0;const vi=[new pi,new pi,new pi,new pi,new pi,new pi,new pi,new pi],_i=new pi,yi=new gi,xi=new pi,bi=new pi,wi=new pi,Ti=new pi,Si=new pi,Ei=new pi,Mi=new pi,Ai=new pi,Ri=new pi,Ci=new pi;function Pi(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){Ci.fromArray(t,o);const s=r.x*Math.abs(Ci.x)+r.y*Math.abs(Ci.y)+r.z*Math.abs(Ci.z),a=e.dot(Ci),l=n.dot(Ci),u=i.dot(Ci);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>s)return!1}return!0}const Ii=new gi,Oi=new pi,Li=new pi,Ni=new pi;class Di{constructor(t=new pi,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Ii.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Ni.subVectors(t,this.center);const e=Ni.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(Ni.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return Li.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Oi.copy(t.center).add(Li)),this.expandByPoint(Oi.copy(t.center).sub(Li)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Fi=new pi,Bi=new pi,Ui=new pi,ki=new pi,Gi=new pi,Hi=new pi,zi=new pi;class ji{constructor(t=new pi,e=new pi(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Fi)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Fi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Fi.copy(this.direction).multiplyScalar(e).add(this.origin),Fi.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Bi.copy(t).add(e).multiplyScalar(.5),Ui.copy(e).sub(t).normalize(),ki.copy(this.origin).sub(Bi);const r=.5*t.distanceTo(e),o=-this.direction.dot(Ui),s=ki.dot(this.direction),a=-ki.dot(Ui),l=ki.lengthSq(),u=Math.abs(1-o*o);let h,c,d,p;if(u>0)if(h=o*a-s,c=o*s-a,p=r*u,h>=0)if(c>=-p)if(c<=p){const t=1/u;h*=t,c*=t,d=h*(h+o*c+2*s)+c*(o*h+c+2*a)+l}else c=r,h=Math.max(0,-(o*c+s)),d=-h*h+c*(c+2*a)+l;else c=-r,h=Math.max(0,-(o*c+s)),d=-h*h+c*(c+2*a)+l;else c<=-p?(h=Math.max(0,-(-o*r+s)),c=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+c*(c+2*a)+l):c<=p?(h=0,c=Math.min(Math.max(-r,-a),r),d=c*(c+2*a)+l):(h=Math.max(0,-(o*r+s)),c=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+c*(c+2*a)+l);else c=o>0?-r:r,h=Math.max(0,-(o*c+s)),d=-h*h+c*(c+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Ui).multiplyScalar(c).add(Bi),d}intersectSphere(t,e){Fi.subVectors(t.center,this.origin);const n=Fi.dot(this.direction),i=Fi.dot(Fi)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,s,a;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,c=this.origin;return l>=0?(n=(t.min.x-c.x)*l,i=(t.max.x-c.x)*l):(n=(t.max.x-c.x)*l,i=(t.min.x-c.x)*l),u>=0?(r=(t.min.y-c.y)*u,o=(t.max.y-c.y)*u):(r=(t.max.y-c.y)*u,o=(t.min.y-c.y)*u),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),h>=0?(s=(t.min.z-c.z)*h,a=(t.max.z-c.z)*h):(s=(t.max.z-c.z)*h,a=(t.min.z-c.z)*h),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Fi)}intersectTriangle(t,e,n,i,r){Gi.subVectors(e,t),Hi.subVectors(n,t),zi.crossVectors(Gi,Hi);let o,s=this.direction.dot(zi);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}ki.subVectors(this.origin,t);const a=o*this.direction.dot(Hi.crossVectors(ki,Hi));if(a<0)return null;const l=o*this.direction.dot(Gi.cross(ki));if(l<0)return null;if(a+l>s)return null;const u=-o*ki.dot(zi);return u<0?null:this.at(u/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Vi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,l,u,h,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=u,g[10]=h,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Vi).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Wi.setFromMatrixColumn(t,0).length(),r=1/Wi.setFromMatrixColumn(t,1).length(),o=1/Wi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*u,n=o*h,i=s*u,r=s*h;e[0]=a*u,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*u,n=a*h,i=l*u,r=l*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*l,e[1]=o*h,e[5]=o*u,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*u,n=a*h,i=l*u,r=l*h;e[0]=t-r*s,e[4]=-o*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*u,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*u,n=o*h,i=s*u,r=s*h;e[0]=a*u,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*u,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*u,e[9]=-s*u,e[2]=-l*u,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*u,e[4]=-h,e[8]=l*u,e[1]=t*h+r,e[5]=o*u,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*u,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(qi,t,Yi)}lookAt(t,e,n){const i=this.elements;return Ki.subVectors(t,e),0===Ki.lengthSq()&&(Ki.z=1),Ki.normalize(),Zi.crossVectors(n,Ki),0===Zi.lengthSq()&&(1===Math.abs(n.z)?Ki.x+=1e-4:Ki.z+=1e-4,Ki.normalize(),Zi.crossVectors(n,Ki)),Zi.normalize(),Ji.crossVectors(Ki,Zi),i[0]=Zi.x,i[4]=Ji.x,i[8]=Ki.x,i[1]=Zi.y,i[5]=Ji.y,i[9]=Ki.y,i[2]=Zi.z,i[6]=Ji.z,i[10]=Ki.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],u=n[1],h=n[5],c=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],y=n[11],x=n[15],b=i[0],w=i[4],T=i[8],S=i[12],E=i[1],M=i[5],A=i[9],R=i[13],C=i[2],P=i[6],I=i[10],O=i[14],L=i[3],N=i[7],D=i[11],F=i[15];return r[0]=o*b+s*E+a*C+l*L,r[4]=o*w+s*M+a*P+l*N,r[8]=o*T+s*A+a*I+l*D,r[12]=o*S+s*R+a*O+l*F,r[1]=u*b+h*E+c*C+d*L,r[5]=u*w+h*M+c*P+d*N,r[9]=u*T+h*A+c*I+d*D,r[13]=u*S+h*R+c*O+d*F,r[2]=p*b+f*E+m*C+g*L,r[6]=p*w+f*M+m*P+g*N,r[10]=p*T+f*A+m*I+g*D,r[14]=p*S+f*R+m*O+g*F,r[3]=v*b+_*E+y*C+x*L,r[7]=v*w+_*M+y*P+x*N,r[11]=v*T+_*A+y*I+x*D,r[15]=v*S+_*R+y*O+x*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],u=t[2],h=t[6],c=t[10],d=t[14];return t[3]*(+r*a*h-i*l*h-r*s*c+n*l*c+i*s*d-n*a*d)+t[7]*(+e*a*d-e*l*c+r*o*c-i*o*d+i*l*u-r*a*u)+t[11]*(+e*l*h-e*s*d-r*o*h+n*o*d+r*s*u-n*l*u)+t[15]*(-i*s*u-e*a*h+e*s*c+i*o*h-n*o*c+n*a*u)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*c*l+f*a*d-s*m*d-h*a*g+s*c*g,_=p*c*l-u*m*l-p*a*d+o*m*d+u*a*g-o*c*g,y=u*f*l-p*h*l+p*s*d-o*f*d-u*s*g+o*h*g,x=p*h*a-u*f*a-p*s*c+o*f*c+u*s*m-o*h*m,b=e*v+n*_+i*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=v*w,t[1]=(f*c*r-h*m*r-f*i*d+n*m*d+h*i*g-n*c*g)*w,t[2]=(s*m*r-f*a*r+f*i*l-n*m*l-s*i*g+n*a*g)*w,t[3]=(h*a*r-s*c*r-h*i*l+n*c*l+s*i*d-n*a*d)*w,t[4]=_*w,t[5]=(u*m*r-p*c*r+p*i*d-e*m*d-u*i*g+e*c*g)*w,t[6]=(p*a*r-o*m*r-p*i*l+e*m*l+o*i*g-e*a*g)*w,t[7]=(o*c*r-u*a*r+u*i*l-e*c*l-o*i*d+e*a*d)*w,t[8]=y*w,t[9]=(p*h*r-u*f*r-p*n*d+e*f*d+u*n*g-e*h*g)*w,t[10]=(o*f*r-p*s*r+p*n*l-e*f*l-o*n*g+e*s*g)*w,t[11]=(u*s*r-o*h*r-u*n*l+e*h*l+o*n*d-e*s*d)*w,t[12]=x*w,t[13]=(u*f*i-p*h*i+p*n*c-e*f*c-u*n*m+e*h*m)*w,t[14]=(p*s*i-o*f*i-p*n*a+e*f*a+o*n*m-e*s*m)*w,t[15]=(o*h*i-u*s*i+u*n*a-e*h*a-o*n*c+e*s*c)*w,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,l=r*o,u=r*s;return this.set(l*o+n,l*s-i*a,l*a+i*s,0,l*s+i*a,u*s+n,u*a-i*o,0,l*a-i*s,u*a+i*o,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,o){return this.set(1,n,r,0,t,1,o,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,u=o+o,h=s+s,c=r*l,d=r*u,p=r*h,f=o*u,m=o*h,g=s*h,v=a*l,_=a*u,y=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+y)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(c+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+_)*w,i[9]=(m-v)*w,i[10]=(1-(c+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Wi.set(i[0],i[1],i[2]).length();const o=Wi.set(i[4],i[5],i[6]).length(),s=Wi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Xi.copy(this);const a=1/r,l=1/o,u=1/s;return Xi.elements[0]*=a,Xi.elements[1]*=a,Xi.elements[2]*=a,Xi.elements[4]*=l,Xi.elements[5]*=l,Xi.elements[6]*=l,Xi.elements[8]*=u,Xi.elements[9]*=u,Xi.elements[10]*=u,e.setFromRotationMatrix(Xi),n.x=r,n.y=o,n.z=s,this}makePerspective(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(n-i),u=(e+t)/(e-t),h=(n+i)/(n-i),c=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=c,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),l=1/(n-i),u=1/(o-r),h=(e+t)*a,c=(n+i)*l,d=(o+r)*u;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-c,s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}Vi.prototype.isMatrix4=!0;const Wi=new pi,Xi=new Vi,qi=new pi(0,0,0),Yi=new pi(1,1,1),Zi=new pi,Ji=new pi,Ki=new pi,$i=new Vi,Qi=new di;class tr{constructor(t=0,e=0,n=0,i=tr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],o=i[4],s=i[8],a=i[1],l=i[5],u=i[9],h=i[2],c=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Yn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Yn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-Yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return $i.makeRotationFromQuaternion(t),this.setFromRotationMatrix($i,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Qi.setFromEuler(this),this.setFromQuaternion(Qi,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new pi(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}tr.prototype.isEuler=!0,tr.DefaultOrder="XYZ",tr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class er{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let nr=0;const ir=new pi,rr=new di,or=new Vi,sr=new pi,ar=new pi,lr=new pi,ur=new di,hr=new pi(1,0,0),cr=new pi(0,1,0),dr=new pi(0,0,1),pr={type:"added"},fr={type:"removed"};class mr extends zn{constructor(){super(),Object.defineProperty(this,"id",{value:nr++}),this.uuid=qn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mr.DefaultUp.clone();const t=new pi,e=new tr,n=new di,i=new pi(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Vi},normalMatrix:{value:new ni}}),this.matrix=new Vi,this.matrixWorld=new Vi,this.matrixAutoUpdate=mr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new er,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return rr.setFromAxisAngle(t,e),this.quaternion.multiply(rr),this}rotateOnWorldAxis(t,e){return rr.setFromAxisAngle(t,e),this.quaternion.premultiply(rr),this}rotateX(t){return this.rotateOnAxis(hr,t)}rotateY(t){return this.rotateOnAxis(cr,t)}rotateZ(t){return this.rotateOnAxis(dr,t)}translateOnAxis(t,e){return ir.copy(t).applyQuaternion(this.quaternion),this.position.add(ir.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(hr,t)}translateY(t){return this.translateOnAxis(cr,t)}translateZ(t){return this.translateOnAxis(dr,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(or.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?sr.copy(t):sr.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ar.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?or.lookAt(ar,sr,this.up):or.lookAt(sr,ar,this.up),this.quaternion.setFromRotationMatrix(or),i&&(or.extractRotation(i.matrixWorld),rr.setFromRotationMatrix(or),this.quaternion.premultiply(rr.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(pr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(fr)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(fr)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),or.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),or.multiply(t.parent.matrixWorld)),t.applyMatrix4(or),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,t,lr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,ur,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=o(t.geometries),i=o(t.materials),r=o(t.textures),s=o(t.images),a=o(t.shapes),l=o(t.skeletons),u=o(t.animations);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}mr.DefaultUp=new pi(0,1,0),mr.DefaultMatrixAutoUpdate=!0,mr.prototype.isObject3D=!0;const gr=new pi,vr=new pi,_r=new pi,yr=new pi,xr=new pi,br=new pi,wr=new pi,Tr=new pi,Sr=new pi,Er=new pi;class Mr{constructor(t=new pi,e=new pi,n=new pi){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),gr.subVectors(t,e),i.cross(gr);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){gr.subVectors(i,e),vr.subVectors(n,e),_r.subVectors(t,e);const o=gr.dot(gr),s=gr.dot(vr),a=gr.dot(_r),l=vr.dot(vr),u=vr.dot(_r),h=o*l-s*s;if(0===h)return r.set(-2,-1,-1);const c=1/h,d=(l*a-s*u)*c,p=(o*u-s*a)*c;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,yr),yr.x>=0&&yr.y>=0&&yr.x+yr.y<=1}static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,yr),a.set(0,0),a.addScaledVector(r,yr.x),a.addScaledVector(o,yr.y),a.addScaledVector(s,yr.z),a}static isFrontFacing(t,e,n,i){return gr.subVectors(n,e),vr.subVectors(t,e),gr.cross(vr).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return gr.subVectors(this.c,this.b),vr.subVectors(this.a,this.b),.5*gr.cross(vr).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Mr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Mr.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return Mr.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Mr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Mr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let o,s;xr.subVectors(i,n),br.subVectors(r,n),Tr.subVectors(t,n);const a=xr.dot(Tr),l=br.dot(Tr);if(a<=0&&l<=0)return e.copy(n);Sr.subVectors(t,i);const u=xr.dot(Sr),h=br.dot(Sr);if(u>=0&&h<=u)return e.copy(i);const c=a*h-u*l;if(c<=0&&a>=0&&u<=0)return o=a/(a-u),e.copy(n).addScaledVector(xr,o);Er.subVectors(t,r);const d=xr.dot(Er),p=br.dot(Er);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(br,s);const m=u*p-d*h;if(m<=0&&h-u>=0&&d-p>=0)return wr.subVectors(r,i),s=(h-u)/(h-u+(d-p)),e.copy(i).addScaledVector(wr,s);const g=1/(m+f+c);return o=f*g,s=c*g,e.copy(n).addScaledVector(xr,o).addScaledVector(br,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ar=0;class Rr extends zn{constructor(){super(),Object.defineProperty(this,"id",{value:Ar++}),this.uuid=qn(),this.name="",this.type="Material",this.fog=!0,this.blending=M,this.side=x,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=G,this.blendDst=H,this.blendEquation=I,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=J,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Pn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gn,this.stencilZFail=gn,this.stencilZPass=gn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===T;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==M&&(n.blending=this.blending),this.side!==x&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}Rr.prototype.isMaterial=!0;const Cr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Pr={h:0,s:0,l:0},Ir={h:0,s:0,l:0};function Or(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Lr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Nr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Dr{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Zn(t,1),e=Yn(e,0,1),n=Yn(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=Or(r,i,t+1/3),this.g=Or(r,i,t),this.b=Or(r,i,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Cr[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Lr(t.r),this.g=Lr(t.g),this.b=Lr(t.b),this}copyLinearToSRGB(t){return this.r=Nr(t.r),this.g=Nr(t.g),this.b=Nr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),o=Math.min(e,n,i);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(n-i)/t+(n<i?6:0);break;case n:s=(i-e)/t+2;break;case i:s=(e-n)/t+4}s/=6}return t.h=s,t.s=a,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(Pr),Pr.h+=t,Pr.s+=e,Pr.l+=n,this.setHSL(Pr.h,Pr.s,Pr.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Pr),t.getHSL(Ir);const n=Jn(Pr.h,Ir.h,e),i=Jn(Pr.s,Ir.s,e),r=Jn(Pr.l,Ir.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Dr.NAMES=Cr,Dr.prototype.isColor=!0,Dr.prototype.r=1,Dr.prototype.g=1,Dr.prototype.b=1;class Fr extends Rr{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Dr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=et,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this}}Fr.prototype.isMeshBasicMaterial=!0;const Br=new pi,Ur=new ei;class kr{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=In,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new Dr),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new ei),e[n++]=r.x,e[n++]=r.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new pi),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new li),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ur.fromBufferAttribute(this,e),Ur.applyMatrix3(t),this.setXY(e,Ur.x,Ur.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Br.fromBufferAttribute(this,e),Br.applyMatrix3(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.applyMatrix4(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.applyNormalMatrix(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.transformDirection(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==In&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}kr.prototype.isBufferAttribute=!0;class Gr extends kr{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Hr extends kr{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class zr extends kr{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class jr extends kr{constructor(t,e,n){super(new Int16Array(t),e,n)}}class Vr extends kr{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Wr extends kr{constructor(t,e,n){super(new Int32Array(t),e,n)}}class Xr extends kr{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class qr extends kr{constructor(t,e,n){super(new Uint16Array(t),e,n)}}qr.prototype.isFloat16BufferAttribute=!0;class Yr extends kr{constructor(t,e,n){super(new Float32Array(t),e,n)}}class Zr extends kr{constructor(t,e,n){super(new Float64Array(t),e,n)}}function Jr(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}const Kr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $r(t,e){return new Kr[t](e)}let Qr=0;const to=new Vi,eo=new mr,no=new pi,io=new gi,ro=new gi,oo=new pi;class so extends zn{constructor(){super(),Object.defineProperty(this,"id",{value:Qr++}),this.uuid=qn(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Jr(t)>65535?Xr:Vr)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new ni).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return to.makeRotationFromQuaternion(t),this.applyMatrix4(to),this}rotateX(t){return to.makeRotationX(t),this.applyMatrix4(to),this}rotateY(t){return to.makeRotationY(t),this.applyMatrix4(to),this}rotateZ(t){return to.makeRotationZ(t),this.applyMatrix4(to),this}translate(t,e,n){return to.makeTranslation(t,e,n),this.applyMatrix4(to),this}scale(t,e,n){return to.makeScale(t,e,n),this.applyMatrix4(to),this}lookAt(t){return eo.lookAt(t),eo.updateMatrix(),this.applyMatrix4(eo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(no).negate(),this.translate(no.x,no.y,no.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Yr(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new gi);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new pi(-1/0,-1/0,-1/0),new pi(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];io.setFromBufferAttribute(n),this.morphTargetsRelative?(oo.addVectors(this.boundingBox.min,io.min),this.boundingBox.expandByPoint(oo),oo.addVectors(this.boundingBox.max,io.max),this.boundingBox.expandByPoint(oo)):(this.boundingBox.expandByPoint(io.min),this.boundingBox.expandByPoint(io.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Di);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new pi,1/0);if(t){const n=this.boundingSphere.center;if(io.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];ro.setFromBufferAttribute(n),this.morphTargetsRelative?(oo.addVectors(io.min,ro.min),io.expandByPoint(oo),oo.addVectors(io.max,ro.max),io.expandByPoint(oo)):(io.expandByPoint(ro.min),io.expandByPoint(ro.max))}io.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)oo.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(oo));if(e)for(let r=0,o=e.length;r<o;r++){const o=e[r],s=this.morphTargetsRelative;for(let e=0,r=o.count;e<r;e++)oo.fromBufferAttribute(o,e),s&&(no.fromBufferAttribute(t,e),oo.add(no)),i=Math.max(i,n.distanceToSquared(oo))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,o=e.uv.array,s=i.length/3;void 0===e.tangent&&this.setAttribute("tangent",new kr(new Float32Array(4*s),4));const a=e.tangent.array,l=[],u=[];for(let t=0;t<s;t++)l[t]=new pi,u[t]=new pi;const h=new pi,c=new pi,d=new pi,p=new ei,f=new ei,m=new ei,g=new pi,v=new pi;function _(t,e,n){h.fromArray(i,3*t),c.fromArray(i,3*e),d.fromArray(i,3*n),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),c.sub(h),d.sub(h),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(g.copy(c).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(r),v.copy(d).multiplyScalar(f.x).addScaledVector(c,-m.x).multiplyScalar(r),l[t].add(g),l[e].add(g),l[n].add(g),u[t].add(v),u[e].add(v),u[n].add(v))}let y=this.groups;0===y.length&&(y=[{start:0,count:n.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)_(n[t+0],n[t+1],n[t+2])}const x=new pi,b=new pi,w=new pi,T=new pi;function S(t){w.fromArray(r,3*t),T.copy(w);const e=l[t];x.copy(e),x.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(T,e);const n=b.dot(u[t])<0?-1:1;a[4*t]=x.x,a[4*t+1]=x.y,a[4*t+2]=x.z,a[4*t+3]=n}for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)S(n[t+0]),S(n[t+1]),S(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new kr(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new pi,r=new pi,o=new pi,s=new pi,a=new pi,l=new pi,u=new pi,h=new pi;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),s.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(u),a.add(u),l.add(u),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),n.setXYZ(t+0,u.x,u.y,u.z),n.setXYZ(t+1,u.x,u.y,u.z),n.setXYZ(t+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,o=t.attributes[i],s=o.array,a=o.itemSize*e,l=Math.min(s.length,r.length-a);for(let t=0,e=a;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)oo.fromBufferAttribute(t,e),oo.normalize(),t.setXYZ(e,oo.x,oo.y,oo.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,o=new n.constructor(e.length*i);let s=0,a=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)o[a++]=n[s++]}return new kr(o,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new so,n=this.index.array,i=this.attributes;for(const r in i){const o=t(i[r],n);e.setAttribute(r,o)}const r=this.morphAttributes;for(const i in r){const o=[],s=r[i];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);o.push(i)}e.morphAttributes[i]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,n=o.length;t<n;t++){const n=o[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];o.push(i.toJSON(t.data))}o.length>0&&(i[e]=o,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new so).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}so.prototype.isBufferGeometry=!0;const ao=new Vi,lo=new ji,uo=new Di,ho=new pi,co=new pi,po=new pi,fo=new pi,mo=new pi,go=new pi,vo=new pi,_o=new pi,yo=new pi,xo=new ei,bo=new ei,wo=new ei,To=new pi,So=new pi;class Eo extends mr{constructor(t=new so,e=new Fr){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),uo.copy(n.boundingSphere),uo.applyMatrix4(r),!1===t.ray.intersectsSphere(uo))return;if(ao.copy(r).invert(),lo.copy(t.ray).applyMatrix4(ao),null!==n.boundingBox&&!1===lo.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,u=n.attributes.uv,h=n.attributes.uv2,c=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=c.length;n<p;n++){const p=c[n],f=i[p.materialIndex];for(let n=Math.max(p.start,d.start),i=Math.min(p.start+p.count,d.start+d.count);n<i;n+=3){const i=r.getX(n),c=r.getX(n+1),d=r.getX(n+2);o=Mo(this,f,t,lo,s,a,l,u,h,i,c,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else{for(let n=Math.max(0,d.start),c=Math.min(r.count,d.start+d.count);n<c;n+=3){const c=r.getX(n),d=r.getX(n+1),p=r.getX(n+2);o=Mo(this,i,t,lo,s,a,l,u,h,c,d,p),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}}else if(void 0!==s)if(Array.isArray(i))for(let n=0,r=c.length;n<r;n++){const r=c[n],p=i[r.materialIndex];for(let n=Math.max(r.start,d.start),i=Math.min(r.start+r.count,d.start+d.count);n<i;n+=3){o=Mo(this,p,t,lo,s,a,l,u,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=r.materialIndex,e.push(o))}}else{for(let n=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);n<r;n+=3){o=Mo(this,i,t,lo,s,a,l,u,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Mo(t,e,n,i,r,o,s,a,l,u,h,c){ho.fromBufferAttribute(r,u),co.fromBufferAttribute(r,h),po.fromBufferAttribute(r,c);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){vo.set(0,0,0),_o.set(0,0,0),yo.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],n=o[t];0!==e&&(fo.fromBufferAttribute(n,u),mo.fromBufferAttribute(n,h),go.fromBufferAttribute(n,c),s?(vo.addScaledVector(fo,e),_o.addScaledVector(mo,e),yo.addScaledVector(go,e)):(vo.addScaledVector(fo.sub(ho),e),_o.addScaledVector(mo.sub(co),e),yo.addScaledVector(go.sub(po),e)))}ho.add(vo),co.add(_o),po.add(yo)}t.isSkinnedMesh&&(t.boneTransform(u,ho),t.boneTransform(h,co),t.boneTransform(c,po));const p=function(t,e,n,i,r,o,s,a){let l;if(l=e.side===b?i.intersectTriangle(s,o,r,!0,a):i.intersectTriangle(r,o,s,e.side!==w,a),null===l)return null;So.copy(a),So.applyMatrix4(t.matrixWorld);const u=n.ray.origin.distanceTo(So);return u<n.near||u>n.far?null:{distance:u,point:So.clone(),object:t}}(t,e,n,i,ho,co,po,To);if(p){a&&(xo.fromBufferAttribute(a,u),bo.fromBufferAttribute(a,h),wo.fromBufferAttribute(a,c),p.uv=Mr.getUV(To,ho,co,po,xo,bo,wo,new ei)),l&&(xo.fromBufferAttribute(l,u),bo.fromBufferAttribute(l,h),wo.fromBufferAttribute(l,c),p.uv2=Mr.getUV(To,ho,co,po,xo,bo,wo,new ei));const t={a:u,b:h,c:c,normal:new pi,materialIndex:0};Mr.getNormal(ho,co,po,t.normal),p.face=t}return p}Eo.prototype.isMesh=!0;class Ao extends so{constructor(t=1,e=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const s=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const a=[],l=[],u=[],h=[];let c=0,d=0;function p(t,e,n,i,r,o,p,f,m,g,v){const _=o/m,y=p/g,x=o/2,b=p/2,w=f/2,T=m+1,S=g+1;let E=0,M=0;const A=new pi;for(let o=0;o<S;o++){const s=o*y-b;for(let a=0;a<T;a++){const c=a*_-x;A[t]=c*i,A[e]=s*r,A[n]=w,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),h.push(a/m),h.push(1-o/g),E+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=c+e+T*t,i=c+e+T*(t+1),r=c+(e+1)+T*(t+1),o=c+(e+1)+T*t;a.push(n,i,o),a.push(i,r,o),M+=6}s.addGroup(d,M,v),d+=M,c+=E}p("z","y","x",-1,-1,n,e,t,o,r,0),p("z","y","x",1,-1,n,e,-t,o,r,1),p("x","z","y",1,1,t,n,e,i,o,2),p("x","z","y",1,-1,t,n,-e,i,o,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new Yr(l,3)),this.setAttribute("normal",new Yr(u,3)),this.setAttribute("uv",new Yr(h,2))}static fromJSON(t){return new Ao(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ro(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Co(t){const e={};for(let n=0;n<t.length;n++){const i=Ro(t[n]);for(const t in i)e[t]=i[t]}return e}const Po={clone:Ro,merge:Co};class Io extends Rr{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ro(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}Io.prototype.isShaderMaterial=!0;class Oo extends mr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Vi,this.projectionMatrix=new Vi,this.projectionMatrixInverse=new Vi}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Oo.prototype.isCamera=!0;class Lo extends Oo{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Xn*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Wn*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Xn*Math.atan(Math.tan(.5*Wn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Wn*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Lo.prototype.isPerspectiveCamera=!0;class No extends mr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new Lo(90,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new pi(1,0,0)),this.add(i);const r=new Lo(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new pi(-1,0,0)),this.add(r);const o=new Lo(90,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new pi(0,1,0)),this.add(o);const s=new Lo(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new pi(0,-1,0)),this.add(s);const a=new Lo(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new pi(0,0,1)),this.add(a);const l=new Lo(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new pi(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,o,s,a,l]=this.children,u=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const c=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=c,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=u}}class Do extends si{constructor(t,e,n,i,r,o,s,a,l,u){super(t=void 0!==t?t:[],e=void 0!==e?e:ct,n,i,r,o,s=void 0!==s?s:jt,a,l,u),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Do.prototype.isCubeTexture=!0;class Fo extends ui{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new Do(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Et,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Vt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Ao(5,5,5),r=new Io({name:"CubemapFromEquirect",uniforms:Ro(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:b,blending:E});r.uniforms.tEquirect.value=e;const o=new Eo(i,r),s=e.minFilter;e.minFilter===Rt&&(e.minFilter=Et);return new No(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}Fo.prototype.isWebGLCubeRenderTarget=!0;const Bo=new pi,Uo=new pi,ko=new ni;class Go{constructor(t=new pi(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Bo.subVectors(n,e).cross(Uo.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(Bo),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||ko.getNormalMatrix(t),i=this.coplanarPoint(Bo).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Go.prototype.isPlane=!0;const Ho=new Di,zo=new pi;class jo{constructor(t=new Go,e=new Go,n=new Go,i=new Go,r=new Go,o=new Go){this.planes=[t,e,n,i,r,o]}set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],l=n[5],u=n[6],h=n[7],c=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],_=n[15];return e[0].setComponents(s-i,h-a,f-c,_-m).normalize(),e[1].setComponents(s+i,h+a,f+c,_+m).normalize(),e[2].setComponents(s+r,h+l,f+d,_+g).normalize(),e[3].setComponents(s-r,h-l,f-d,_-g).normalize(),e[4].setComponents(s-o,h-u,f-p,_-v).normalize(),e[5].setComponents(s+o,h+u,f+p,_+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ho.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ho)}intersectsSprite(t){return Ho.center.set(0,0,0),Ho.radius=.7071067811865476,Ho.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ho)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(zo.x=i.normal.x>0?t.max.x:t.min.x,zo.y=i.normal.y>0?t.max.y:t.min.y,zo.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(zo)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Vo(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Wo(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=i.get(e);void 0===o?i.set(e,function(e,i){const r=e.array,o=e.usage,s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,r,o),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(a=5121),{buffer:s,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(!function(e,i,r){const o=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,o):(n?t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,e,r),o.version=e.version)}}}class Xo extends so{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,o=e/2,s=Math.floor(n),a=Math.floor(i),l=s+1,u=a+1,h=t/s,c=e/a,d=[],p=[],f=[],m=[];for(let t=0;t<u;t++){const e=t*c-o;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/s),m.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<s;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),o=e+1+l*t;d.push(n,i,o),d.push(i,r,o)}this.setIndex(d),this.setAttribute("position",new Yr(p,3)),this.setAttribute("normal",new Yr(f,3)),this.setAttribute("uv",new Yr(m,2))}static fromJSON(t){return new Xo(t.width,t.height,t.widthSegments,t.heightSegments)}}const qo={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <transmission_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Yo={common:{diffuse:{value:new Dr(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ni},uv2Transform:{value:new ni},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ei(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Dr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Dr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ni}},sprite:{diffuse:{value:new Dr(16777215)},opacity:{value:1},center:{value:new ei(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ni}}},Zo={basic:{uniforms:Co([Yo.common,Yo.specularmap,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.fog]),vertexShader:qo.meshbasic_vert,fragmentShader:qo.meshbasic_frag},lambert:{uniforms:Co([Yo.common,Yo.specularmap,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)}}]),vertexShader:qo.meshlambert_vert,fragmentShader:qo.meshlambert_frag},phong:{uniforms:Co([Yo.common,Yo.specularmap,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)},specular:{value:new Dr(1118481)},shininess:{value:30}}]),vertexShader:qo.meshphong_vert,fragmentShader:qo.meshphong_frag},standard:{uniforms:Co([Yo.common,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.roughnessmap,Yo.metalnessmap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qo.meshphysical_vert,fragmentShader:qo.meshphysical_frag},toon:{uniforms:Co([Yo.common,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.gradientmap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)}}]),vertexShader:qo.meshtoon_vert,fragmentShader:qo.meshtoon_frag},matcap:{uniforms:Co([Yo.common,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.fog,{matcap:{value:null}}]),vertexShader:qo.meshmatcap_vert,fragmentShader:qo.meshmatcap_frag},points:{uniforms:Co([Yo.points,Yo.fog]),vertexShader:qo.points_vert,fragmentShader:qo.points_frag},dashed:{uniforms:Co([Yo.common,Yo.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qo.linedashed_vert,fragmentShader:qo.linedashed_frag},depth:{uniforms:Co([Yo.common,Yo.displacementmap]),vertexShader:qo.depth_vert,fragmentShader:qo.depth_frag},normal:{uniforms:Co([Yo.common,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,{opacity:{value:1}}]),vertexShader:qo.normal_vert,fragmentShader:qo.normal_frag},sprite:{uniforms:Co([Yo.sprite,Yo.fog]),vertexShader:qo.sprite_vert,fragmentShader:qo.sprite_frag},background:{uniforms:{uvTransform:{value:new ni},t2D:{value:null}},vertexShader:qo.background_vert,fragmentShader:qo.background_frag},cube:{uniforms:Co([Yo.envmap,{opacity:{value:1}}]),vertexShader:qo.cube_vert,fragmentShader:qo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qo.equirect_vert,fragmentShader:qo.equirect_frag},distanceRGBA:{uniforms:Co([Yo.common,Yo.displacementmap,{referencePosition:{value:new pi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qo.distanceRGBA_vert,fragmentShader:qo.distanceRGBA_frag},shadow:{uniforms:Co([Yo.lights,Yo.fog,{color:{value:new Dr(0)},opacity:{value:1}}]),vertexShader:qo.shadow_vert,fragmentShader:qo.shadow_frag}};function Jo(t,e,n,i,r){const o=new Dr(0);let s,a,l=0,u=null,h=0,c=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(n,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?d(o,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===mt)?(void 0===a&&(a=new Eo(new Ao(1,1,1),new Io({name:"BackgroundCubeMaterial",uniforms:Ro(Zo.cube.uniforms),vertexShader:Zo.cube.vertexShader,fragmentShader:Zo.cube.fragmentShader,side:b,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(a)),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,u===f&&h===f.version&&c===t.toneMapping||(a.material.needsUpdate=!0,u=f,h=f.version,c=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Eo(new Xo(2,2),new Io({name:"BackgroundMaterial",uniforms:Ro(Zo.background.uniforms),vertexShader:Zo.background.vertexShader,fragmentShader:Zo.background.fragmentShader,side:x,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),u===f&&h===f.version&&c===t.toneMapping||(s.material.needsUpdate=!0,u=f,h=f.version,c=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function Ko(t,e,n,i){const r=t.getParameter(34921),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==o,a={},l=d(null);let u=l;function h(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function c(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function p(){const t=u.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,r){const o=u.newAttributes,s=u.enabledAttributes,a=u.attributeDivisors;if(o[n]=1,0===s[n]&&(t.enableVertexAttribArray(n),s[n]=1),a[n]!==r){(i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),a[n]=r}}function g(){const e=u.newAttributes,n=u.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function v(e,n,r,o,s,a){!0!==i.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,n,r,o,s,a):t.vertexAttribIPointer(e,n,r,s,a)}function _(){y(),u!==l&&(u=l,h(u.object))}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,c,_,y){let x=!1;if(s){const e=function(e,n,r){const s=!0===r.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let u=l[n.id];void 0===u&&(u={},l[n.id]=u);let h=u[s];void 0===h&&(h=d(i.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),u[s]=h);return h}(_,c,l);u!==e&&(u=e,h(u.object)),x=function(t,e){const n=u.attributes,i=t.attributes;let r=0;for(const t in i){const e=n[t],o=i[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;r++}return u.attributesNum!==r||u.index!==e}(_,y),x&&function(t,e){const n={},i=t.attributes;let r=0;for(const t in i){const e=i[t],o={};o.attribute=e,e.data&&(o.data=e.data),n[t]=o,r++}u.attributes=n,u.attributesNum=r,u.index=e}(_,y)}else{const t=!0===l.wireframe;u.geometry===_.id&&u.program===c.id&&u.wireframe===t||(u.geometry=_.id,u.program=c.id,u.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==y&&n.update(y,34963),x&&(!function(r,o,s,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,u=s.getAttributes(),h=o.defaultAttributeValues;for(const e in u){const i=u[e];if(i>=0){const o=l[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=n.get(o);if(void 0===s)continue;const l=s.buffer,u=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,c=o.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),t.bindBuffer(34962,l),v(i,r,u,e,s*h,c*h)}else o.isInstancedBufferAttribute?(m(i,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(i),t.bindBuffer(34962,l),v(i,r,u,e,0,0)}else if("instanceMatrix"===e){const e=n.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i+0,4,s,!1,64,0),t.vertexAttribPointer(i+1,4,s,!1,64,16),t.vertexAttribPointer(i+2,4,s,!1,64,32),t.vertexAttribPointer(i+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i,3,s,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i,n);break;case 3:t.vertexAttrib3fv(i,n);break;case 4:t.vertexAttrib4fv(i,n);break;default:t.vertexAttrib1fv(i,n)}}}}g()}(r,l,c,_),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:_,resetDefaultState:y,dispose:function(){_();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)c(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const n=e[t];for(const t in n)c(n[t].object),delete n[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)c(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function $o(t,e,n,i){const r=i.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,i){t.drawArrays(o,e,i),n.update(i,o,1)},this.renderInstances=function(i,s,a){if(0===a)return;let l,u;if(r)l=t,u="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),u="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](o,i,s,a),n.update(s,o,a)}}function Qo(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||e.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),c=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),_=c>0,y=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:_&&y,maxSamples:o?t.getParameter(36183):0}}function ts(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new Go,a=new ni,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const o=null!==t?t.length:0;let u=null;if(0!==o){if(u=l.value,!0!==r||null===u){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===u||u.length<e)&&(u=new Float32Array(e));for(let e=0,n=i;e!==o;++e,n+=4)s.copy(t[e]).applyMatrix4(r,a),s.normal.toArray(u,n),u[n+3]=s.constant}l.value=u,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const s=0!==t.length||e||0!==i||r;return r=e,n=h(t,o,0),i=t.length,s},this.beginShadows=function(){o=!0,h(null)},this.endShadows=function(){o=!1,u()},this.setState=function(e,s,a){const c=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===c||0===c.length||o&&!p)o?h(null):u();else{const t=o?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=h(c,s,e,a);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function es(t){let e=new WeakMap;function n(t,e){return e===pt?t.mapping=ct:e===ft&&(t.mapping=dt),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping;if(o===pt||o===ft){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const o=r.image;if(o&&o.height>0){const s=t.getRenderTarget(),a=new Fo(o.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),t.setRenderTarget(s),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function ns(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function is(t,e,n,i){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",s),delete r[a.id];const l=o.get(a);l&&(e.remove(l),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],o=t[e+2];n.push(i,r,r,o,o,i)}}else{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const a=new(Jr(n)>65535?Xr:Vr)(n,1);a.version=s;const l=o.get(t);l&&e.remove(l),o.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return o.get(t)}}}function rs(t,e,n,i){const r=i.isWebGL2;let o,s,a;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(o,i,s,e*a),n.update(i,o,1)},this.renderInstances=function(i,l,u){if(0===u)return;let h,c;if(r)h=t,c="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[c](o,l,s,i*a,u),n.update(l,o,u)}}function os(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,i){switch(e.calls++,n){case 4:e.triangles+=i*(t/3);break;case 1:e.lines+=i*(t/2);break;case 3:e.lines+=i*(t-1);break;case 2:e.lines+=i*t;break;case 0:e.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function ss(t,e){return t[0]-e[0]}function as(t,e){return Math.abs(e[1])-Math.abs(t[1])}function ls(t){const e={},n=new Float32Array(8),i=[];for(let t=0;t<8;t++)i[t]=[t,0];return{update:function(r,o,s,a){const l=r.morphTargetInfluences,u=void 0===l?0:l.length;let h=e[o.id];if(void 0===h||h.length!==u){h=[];for(let t=0;t<u;t++)h[t]=[t,0];e[o.id]=h}for(let t=0;t<u;t++){const e=h[t];e[0]=t,e[1]=l[t]}h.sort(as);for(let t=0;t<8;t++)t<u&&h[t][1]?(i[t][0]=h[t][0],i[t][1]=h[t][1]):(i[t][0]=Number.MAX_SAFE_INTEGER,i[t][1]=0);i.sort(ss);const c=s.morphTargets&&o.morphAttributes.position,d=s.morphNormals&&o.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=i[t],r=e[0],s=e[1];r!==Number.MAX_SAFE_INTEGER&&s?(c&&o.getAttribute("morphTarget"+t)!==c[r]&&o.setAttribute("morphTarget"+t,c[r]),d&&o.getAttribute("morphNormal"+t)!==d[r]&&o.setAttribute("morphNormal"+t,d[r]),n[t]=s,p+=s):(c&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),d&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),n[t]=0)}const f=o.morphTargetsRelative?1:1-p;a.getUniforms().setValue(t,"morphTargetBaseInfluence",f),a.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function us(t,e,n,i){let r=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const s=i.render.frame,a=t.geometry,l=e.get(t,a);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}Zo.physical={uniforms:Co([Zo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ei(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Dr(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ei},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Dr(0)}}]),vertexShader:qo.meshphysical_vert,fragmentShader:qo.meshphysical_frag};class hs extends si{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=_t,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}hs.prototype.isDataTexture2DArray=!0;class cs extends si{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=_t,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}cs.prototype.isDataTexture3D=!0;const ds=new si,ps=new hs,fs=new cs,ms=new Do,gs=[],vs=[],_s=new Float32Array(16),ys=new Float32Array(9),xs=new Float32Array(4);function bs(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let o=gs[r];if(void 0===o&&(o=new Float32Array(r),gs[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)}return o}function ws(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Ts(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Ss(t,e){let n=vs[e];void 0===n&&(n=new Int32Array(e),vs[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Es(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ms(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ws(n,e))return;t.uniform2fv(this.addr,e),Ts(n,e)}}function As(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ws(n,e))return;t.uniform3fv(this.addr,e),Ts(n,e)}}function Rs(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ws(n,e))return;t.uniform4fv(this.addr,e),Ts(n,e)}}function Cs(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ws(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ts(n,e)}else{if(ws(n,i))return;xs.set(i),t.uniformMatrix2fv(this.addr,!1,xs),Ts(n,i)}}function Ps(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ws(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ts(n,e)}else{if(ws(n,i))return;ys.set(i),t.uniformMatrix3fv(this.addr,!1,ys),Ts(n,i)}}function Is(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ws(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ts(n,e)}else{if(ws(n,i))return;_s.set(i),t.uniformMatrix4fv(this.addr,!1,_s),Ts(n,i)}}function Os(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Ls(t,e){const n=this.cache;ws(n,e)||(t.uniform2iv(this.addr,e),Ts(n,e))}function Ns(t,e){const n=this.cache;ws(n,e)||(t.uniform3iv(this.addr,e),Ts(n,e))}function Ds(t,e){const n=this.cache;ws(n,e)||(t.uniform4iv(this.addr,e),Ts(n,e))}function Fs(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Bs(t,e){const n=this.cache;ws(n,e)||(t.uniform2uiv(this.addr,e),Ts(n,e))}function Us(t,e){const n=this.cache;ws(n,e)||(t.uniform3uiv(this.addr,e),Ts(n,e))}function ks(t,e){const n=this.cache;ws(n,e)||(t.uniform4uiv(this.addr,e),Ts(n,e))}function Gs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||ds,r)}function Hs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||fs,r)}function zs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||ms,r)}function js(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||ps,r)}function Vs(t,e){t.uniform1fv(this.addr,e)}function Ws(t,e){const n=bs(e,this.size,2);t.uniform2fv(this.addr,n)}function Xs(t,e){const n=bs(e,this.size,3);t.uniform3fv(this.addr,n)}function qs(t,e){const n=bs(e,this.size,4);t.uniform4fv(this.addr,n)}function Ys(t,e){const n=bs(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Zs(t,e){const n=bs(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Js(t,e){const n=bs(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ks(t,e){t.uniform1iv(this.addr,e)}function $s(t,e){t.uniform2iv(this.addr,e)}function Qs(t,e){t.uniform3iv(this.addr,e)}function ta(t,e){t.uniform4iv(this.addr,e)}function ea(t,e){t.uniform1uiv(this.addr,e)}function na(t,e){t.uniform2uiv(this.addr,e)}function ia(t,e){t.uniform3uiv(this.addr,e)}function ra(t,e){t.uniform4uiv(this.addr,e)}function oa(t,e,n){const i=e.length,r=Ss(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTexture2D(e[t]||ds,r[t])}function sa(t,e,n){const i=e.length,r=Ss(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTextureCube(e[t]||ms,r[t])}function aa(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Es;case 35664:return Ms;case 35665:return As;case 35666:return Rs;case 35674:return Cs;case 35675:return Ps;case 35676:return Is;case 5124:case 35670:return Os;case 35667:case 35671:return Ls;case 35668:case 35672:return Ns;case 35669:case 35673:return Ds;case 5125:return Fs;case 36294:return Bs;case 36295:return Us;case 36296:return ks;case 35678:case 36198:case 36298:case 36306:case 35682:return Gs;case 35679:case 36299:case 36307:return Hs;case 35680:case 36300:case 36308:case 36293:return zs;case 36289:case 36303:case 36311:case 36292:return js}}(e.type)}function la(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Vs;case 35664:return Ws;case 35665:return Xs;case 35666:return qs;case 35674:return Ys;case 35675:return Zs;case 35676:return Js;case 5124:case 35670:return Ks;case 35667:case 35671:return $s;case 35668:case 35672:return Qs;case 35669:case 35673:return ta;case 5125:return ea;case 36294:return na;case 36295:return ia;case 36296:return ra;case 35678:case 36198:case 36298:case 36306:case 35682:return oa;case 35680:case 36300:case 36308:case 36293:return sa}}(e.type)}function ua(t){this.id=t,this.seq=[],this.map={}}la.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ts(e,t)},ua.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,o=i.length;r!==o;++r){const o=i[r];o.setValue(t,e[o.id],n)}};const ha=/(\w+)(\])?(\[|\.)?/g;function ca(t,e){t.seq.push(e),t.map[e.id]=e}function da(t,e,n){const i=t.name,r=i.length;for(ha.lastIndex=0;;){const o=ha.exec(i),s=ha.lastIndex;let a=o[1];const l="]"===o[2],u=o[3];if(l&&(a|=0),void 0===u||"["===u&&s+2===r){ca(n,void 0===u?new aa(a,t,e):new la(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new ua(a),ca(n,t)),n=t}}}function pa(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);da(n,t.getUniformLocation(e,n.name),this)}}function fa(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}pa.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},pa.prototype.setOptional=function(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)},pa.upload=function(t,e,n,i){for(let r=0,o=e.length;r!==o;++r){const o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}},pa.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n};let ma=0;function ga(t){switch(t){case nn:return["Linear","( value )"];case rn:return["sRGB","( value )"];case sn:return["RGBE","( value )"];case ln:return["RGBM","( value, 7.0 )"];case un:return["RGBM","( value, 16.0 )"];case hn:return["RGBD","( value, 256.0 )"];case on:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case an:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function va(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function _a(t,e){const n=ga(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function ya(t,e){const n=ga(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function xa(t,e){let n;switch(e){case ot:n="Linear";break;case st:n="Reinhard";break;case at:n="OptimizedCineon";break;case lt:n="ACESFilmic";break;case ut:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function ba(t){return""!==t}function wa(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ta(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Sa=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ea(t){return t.replace(Sa,Ma)}function Ma(t,e){const n=qo[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Ea(n)}const Aa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ra=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ca(t){return t.replace(Ra,Ia).replace(Aa,Pa)}function Pa(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ia(t,e,n,i)}function Ia(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Oa(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function La(t,e,n,i){const r=t.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===v?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===_?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===y&&(e="SHADOWMAP_TYPE_VSM"),e}(n),u=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ct:case dt:e="ENVMAP_TYPE_CUBE";break;case mt:case gt:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case dt:case gt:e="ENVMAP_MODE_REFRACTION"}return e}(n),c=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case et:e="ENVMAP_BLENDING_MULTIPLY";break;case nt:e="ENVMAP_BLENDING_MIX";break;case it:e="ENVMAP_BLENDING_ADD"}return e}(n),d=t.gammaFactor>0?t.gammaFactor:1,p=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission>0)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ba).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(o),m=r.createProgram();let g,x,b=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(ba).join("\n"),g.length>0&&(g+="\n"),x=[p,f].filter(ba).join("\n"),x.length>0&&(x+="\n")):(g=[Oa(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ba).join("\n"),x=[p,Oa(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==rt?"#define TONE_MAPPING":"",n.toneMapping!==rt?qo.tonemapping_pars_fragment:"",n.toneMapping!==rt?xa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",qo.encodings_pars_fragment,n.map?_a("mapTexelToLinear",n.mapEncoding):"",n.matcap?_a("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?_a("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?_a("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?_a("lightMapTexelToLinear",n.lightMapEncoding):"",ya("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ba).join("\n")),s=Ea(s),s=wa(s,n),s=Ta(s,n),a=Ea(a),a=wa(a,n),a=Ta(a,n),s=Ca(s),a=Ca(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Hn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Hn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+a,T=fa(r,35633,b+g+s),S=fa(r,35632,w);if(r.attachShader(m,T),r.attachShader(m,S),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(T).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=va(r,T,"vertex"),n=va(r,S,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let E,M;return r.deleteShader(T),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new pa(r,m)),E},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r).name;n[i]=t.getAttribLocation(e,i)}return n}(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=ma++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=T,this.fragmentShader=S,this}function Na(t,e,n,i,r,o){const s=[],a=i.isWebGL2,l=i.logarithmicDepthBuffer,u=i.floatVertexTextures,h=i.maxVertexUniforms,c=i.vertexTextures;let d=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];function m(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=nn,e}return{getParameters:function(r,s,f,g,v){const _=g.fog,y=r.isMeshStandardMaterial?g.environment:null,x=e.get(r.envMap||y),T=p[r.type],S=v.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(u)return 1024;{const t=h,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}}(v):0;let E,M;if(null!==r.precision&&(d=i.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.")),T){const t=Zo[T];E=t.vertexShader,M=t.fragmentShader}else E=r.vertexShader,M=r.fragmentShader;const A=t.getRenderTarget();return{isWebGL2:a,shaderID:T,shaderName:r.type,vertexShader:E,fragmentShader:M,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:c,outputEncoding:null!==A?m(A.texture):t.outputEncoding,map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(x.mapping===mt||x.mapping===gt),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===fn,tangentSpaceNormalMap:r.normalMapType===pn,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmission:!!r.transmission,transmissionMap:!!r.transmissionMap,thicknessMap:!!r.thicknessMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&v.geometry&&v.geometry.attributes.color&&4===v.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap||r.thicknessMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmission||r.transmissionMap||r.thicknessMap||!r.displacementMap),fog:!!_,useFog:r.fog,fogExp2:_&&_.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:l,skinning:!0===v.isSkinnedMesh&&S>0,maxBones:S,useVertexTexture:u,morphTargets:r.morphTargets,morphNormals:r.morphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:rt,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===w,flipSided:r.side===b,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<f.length;t++)n.push(e[f[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=p[t.type];let n;if(e){const t=Zo[e];n=Po.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new La(t,n,e,r),s.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function Da(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Fa(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ba(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Ua(t){const e=[];let n=0;const i=[],r=[],o=[],s={id:-1};function a(i,r,o,a,l,u){let h=e[n];const c=t.get(o);return void 0===h?(h={id:i.id,object:i,geometry:r,material:o,program:c.program||s,groupOrder:a,renderOrder:i.renderOrder,z:l,group:u},e[n]=h):(h.id=i.id,h.object=i,h.geometry=r,h.material=o,h.program=c.program||s,h.groupOrder=a,h.renderOrder=i.renderOrder,h.z=l,h.group=u),n++,h}return{opaque:i,transmissive:r,transparent:o,init:function(){n=0,i.length=0,r.length=0,o.length=0},push:function(t,e,n,s,l,u){const h=a(t,e,n,s,l,u);n.transmission>0?r.push(h):!0===n.transparent?o.push(h):i.push(h)},unshift:function(t,e,n,s,l,u){const h=a(t,e,n,s,l,u);n.transmission>0?r.unshift(h):!0===n.transparent?o.unshift(h):i.unshift(h)},finish:function(){for(let t=n,i=e.length;t<i;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Fa),r.length>1&&r.sort(e||Ba),o.length>1&&o.sort(e||Ba)}}}function ka(t){let e=new WeakMap;return{get:function(n,i){let r;return!1===e.has(n)?(r=new Ua(t),e.set(n,[r])):i>=e.get(n).length?(r=new Ua(t),e.get(n).push(r)):r=e.get(n)[i],r},dispose:function(){e=new WeakMap}}}function Ga(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new pi,color:new Dr};break;case"SpotLight":n={position:new pi,direction:new pi,color:new Dr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new pi,color:new Dr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new pi,skyColor:new Dr,groundColor:new Dr};break;case"RectAreaLight":n={color:new Dr,position:new pi,halfWidth:new pi,halfHeight:new pi}}return t[e.id]=n,n}}}let Ha=0;function za(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ja(t,e){const n=new Ga,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ei};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ei,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new pi);const o=new pi,s=new Vi,a=new Vi;return{setup:function(o){let s=0,a=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let u=0,h=0,c=0,d=0,p=0,f=0,m=0,g=0;o.sort(za);for(let t=0,e=o.length;t<e;t++){const e=o[t],v=e.color,_=e.intensity,y=e.distance,x=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=v.r*_,a+=v.g*_,l+=v.b*_;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[u]=n,r.directionalShadowMap[u]=x,r.directionalShadowMatrix[u]=e.shadow.matrix,f++}r.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(v).multiplyScalar(_),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[c]=n,r.spotShadowMap[c]=x,r.spotShadowMatrix[c]=e.shadow.matrix,g++}r.spot[c]=t,c++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(v).multiplyScalar(_),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[d]=t,d++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[h]=n,r.pointShadowMap[h]=x,r.pointShadowMatrix[h]=e.shadow.matrix,m++}r.point[h]=t,h++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(_),t.groundColor.copy(e.groundColor).multiplyScalar(_),r.hemi[p]=t,p++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Yo.LTC_FLOAT_1,r.rectAreaLTC2=Yo.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Yo.LTC_HALF_1,r.rectAreaLTC2=Yo.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=a,r.ambient[2]=l;const v=r.hash;v.directionalLength===u&&v.pointLength===h&&v.spotLength===c&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(r.directional.length=u,r.spot.length=c,r.rectArea.length=d,r.point.length=h,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=u,v.pointLength=h,v.spotLength=c,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=Ha++)},setupView:function(t,e){let n=0,i=0,l=0,u=0,h=0;const c=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),n++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),l++}else if(d.isRectAreaLight){const t=r.rectArea[u];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),a.identity(),s.copy(d.matrixWorld),s.premultiply(c),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),u++}else if(d.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),i++}else if(d.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(c),t.direction.normalize(),h++}}},state:r}}function Va(t,e){const n=new ja(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(){n.setup(i)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function Wa(t,e){let n=new WeakMap;return{get:function(i,r=0){let o;return!1===n.has(i)?(o=new Va(t,e),n.set(i,[o])):r>=n.get(i).length?(o=new Va(t,e),n.get(i).push(o)):o=n.get(i)[r],o},dispose:function(){n=new WeakMap}}}class Xa extends Rr{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=cn,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Xa.prototype.isMeshDepthMaterial=!0;class qa extends Rr{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new pi,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}qa.prototype.isMeshDistanceMaterial=!0;function Ya(t,e,n){let i=new jo;const r=new ei,o=new ei,s=new li,a=[],l=[],u={},h=n.maxTextureSize,c={0:b,1:x,2:w},d=new Io({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new ei},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new so;f.setAttribute("position",new kr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Eo(f,d),g=this;function _(n,i){const r=e.update(m);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,p,m,null)}function T(t){const e=t<<0;let n=a[e];return void 0===n&&(n=new Xa({depthPacking:dn,morphTargets:t}),a[e]=n),n}function S(t){const e=t<<0;let n=l[e];return void 0===n&&(n=new qa({morphTargets:t}),l[e]=n),n}function M(e,n,i,r,o,s,a){let l=null,h=T,d=e.customDepthMaterial;if(!0===r.isPointLight&&(h=S,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===i.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0),l=h(t)}else l=d;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const t=l.uuid,e=i.uuid;let n=u[t];void 0===n&&(n={},u[t]=n);let r=n[e];void 0===r&&(r=l.clone(),n[e]=r),l=r}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=a===y?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:c[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function A(n,r,o,s,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===y)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,u=e.length;l<u;l++){const u=e[l],h=r[u.materialIndex];if(h&&h.visible){const e=M(n,i,h,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,u)}}}else if(r.visible){const e=M(n,i,r,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)A(l[t],r,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=v,this.render=function(e,n,a){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),u=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(E),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,u=e.length;l<u;l++){const u=e[l],c=u.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",u,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;r.copy(c.mapSize);const p=c.getFrameExtents();if(r.multiply(p),o.copy(c.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(o.x=Math.floor(h/p.x),r.x=o.x*p.x,c.mapSize.x=o.x),r.y>h&&(o.y=Math.floor(h/p.y),r.y=o.y*p.y,c.mapSize.y=o.y)),null===c.map&&!c.isPointLightShadow&&this.type===y){const t={minFilter:Et,magFilter:Et,format:Vt};c.map=new ui(r.x,r.y,t),c.map.texture.name=u.name+".shadowMap",c.mapPass=new ui(r.x,r.y,t),c.camera.updateProjectionMatrix()}if(null===c.map){const t={minFilter:xt,magFilter:xt,format:Vt};c.map=new ui(r.x,r.y,t),c.map.texture.name=u.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const f=c.getViewportCount();for(let t=0;t<f;t++){const e=c.getViewport(t);s.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(s),c.updateMatrices(u,t),i=c.getFrustum(),A(n,a,c.camera,u,this.type)}c.isPointLightShadow||this.type!==y||_(c,a),c.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,u,c)}}function Za(t,e,n){const i=n.isWebGL2;const r=new function(){let e=!1;const n=new li;let i=null;const r=new li(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,s,a){!0===a&&(e*=s,i*=s,o*=s),n.set(e,i,o,s),!1===r.equals(n)&&(t.clearColor(e,i,o,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},o=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){t?_t(2929):yt(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case q:t.depthFunc(512);break;case Y:t.depthFunc(519);break;case Z:t.depthFunc(513);break;case J:t.depthFunc(515);break;case K:t.depthFunc(514);break;case $:t.depthFunc(518);break;case Q:t.depthFunc(516);break;case tt:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},s=new function(){let e=!1,n=null,i=null,r=null,o=null,s=null,a=null,l=null,u=null;return{setTest:function(t){e||(t?_t(2960):yt(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&o===s||(t.stencilFunc(e,n,s),i=e,r=n,o=s)},setOp:function(e,n,i){s===e&&a===n&&l===i||(t.stencilOp(e,n,i),s=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,s=null,a=null,l=null,u=null}}};let a={},l=null,u={},h=null,c=!1,m=null,g=null,v=null,_=null,y=null,x=null,T=null,S=!1,et=null,nt=null,it=null,rt=null,ot=null;const st=t.getParameter(35661);let at=!1,lt=0;const ut=t.getParameter(7938);-1!==ut.indexOf("WebGL")?(lt=parseFloat(/^WebGL (\d)/.exec(ut)[1]),at=lt>=1):-1!==ut.indexOf("OpenGL ES")&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(ut)[1]),at=lt>=2);let ht=null,ct={};const dt=t.getParameter(3088),pt=t.getParameter(2978),ft=(new li).fromArray(dt),mt=(new li).fromArray(pt);function gt(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<i;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,r);return o}const vt={};function _t(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function yt(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}vt[3553]=gt(3553,3553,1),vt[34067]=gt(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),s.setClear(0),_t(2929),o.setFunc(J),Tt(!1),St(p),_t(2884),wt(E);const xt={[I]:32774,[O]:32778,[L]:32779};if(i)xt[N]=32775,xt[D]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(xt[N]=t.MIN_EXT,xt[D]=t.MAX_EXT)}const bt={[F]:0,[B]:1,[U]:768,[G]:770,[X]:776,[V]:774,[z]:772,[k]:769,[H]:771,[W]:775,[j]:773};function wt(e,n,i,r,o,s,a,l){if(e!==E){if(!1===c&&(_t(3042),c=!0),e===P)o=o||n,s=s||i,a=a||r,n===g&&o===y||(t.blendEquationSeparate(xt[n],xt[o]),g=n,y=o),i===v&&r===_&&s===x&&a===T||(t.blendFuncSeparate(bt[i],bt[r],bt[s],bt[a]),v=i,_=r,x=s,T=a),m=e,S=null;else if(e!==m||l!==S){if(g===I&&y===I||(t.blendEquation(32774),g=I,y=I),l)switch(e){case M:t.blendFuncSeparate(1,771,1,771);break;case A:t.blendFunc(1,1);break;case R:t.blendFuncSeparate(0,0,769,771);break;case C:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case M:t.blendFuncSeparate(770,771,1,771);break;case A:t.blendFunc(770,1);break;case R:t.blendFunc(0,769);break;case C:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}v=null,_=null,x=null,T=null,m=e,S=l}}else!0===c&&(yt(3042),c=!1)}function Tt(e){et!==e&&(e?t.frontFace(2304):t.frontFace(2305),et=e)}function St(e){e!==d?(_t(2884),e!==nt&&(e===p?t.cullFace(1029):e===f?t.cullFace(1028):t.cullFace(1032))):yt(2884),nt=e}function Et(e,n,i){e?(_t(32823),rt===n&&ot===i||(t.polygonOffset(n,i),rt=n,ot=i)):yt(32823)}function Mt(e){void 0===e&&(e=33984+st-1),ht!==e&&(t.activeTexture(e),ht=e)}return{buffers:{color:r,depth:o,stencil:s},enable:_t,disable:yt,bindFramebuffer:function(e,n){return null===n&&null!==l&&(n=l),u[e]!==n&&(t.bindFramebuffer(e,n),u[e]=n,i&&(36009===e&&(u[36160]=n),36160===e&&(u[36009]=n)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:wt,setMaterial:function(t,e){t.side===w?yt(2884):_t(2884);let n=t.side===b;e&&(n=!n),Tt(n),t.blending===M&&!1===t.transparent?wt(E):wt(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),r.setMask(t.colorWrite);const i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Et(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?_t(32926):yt(32926)},setFlipSided:Tt,setCullFace:St,setLineWidth:function(e){e!==it&&(at&&t.lineWidth(e),it=e)},setPolygonOffset:Et,setScissorTest:function(t){t?_t(3089):yt(3089)},activeTexture:Mt,bindTexture:function(e,n){null===ht&&Mt();let i=ct[ht];void 0===i&&(i={type:void 0,texture:void 0},ct[ht]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||vt[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=ct[ht];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===ft.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ft.copy(e))},viewport:function(e){!1===mt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),mt.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===i&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},ht=null,ct={},l=null,u={},h=null,c=!1,m=null,g=null,v=null,_=null,y=null,x=null,T=null,S=!1,et=null,nt=null,it=null,rt=null,ot=null,ft.set(0,0,t.canvas.width,t.canvas.height),mt.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),s.reset()}}}function Ja(t,e,n,i,r,o,s){const a=r.isWebGL2,l=r.maxTextures,u=r.maxCubemapSize,h=r.maxTextureSize,c=r.maxSamples,d=new WeakMap;let p,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Qn:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===p&&(p=m(o,s));const a=n?m(o,s):p;a.width=o,a.height=s;return a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function v(t){return Kn(t.width)&&Kn(t.height)}function _(t,e){return t.generateMipmaps&&e&&t.minFilter!==xt&&t.minFilter!==Et}function y(e,n,r,o,s=1){t.generateMipmap(e);i.get(n).__maxMipLevel=Math.log2(Math.max(r,o,s))}function x(n,i,r){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function b(t){return t===xt||t===bt||t===Tt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),i.remove(e)}(n),n.isVideoTexture&&d.delete(n),s.memory.textures--}function T(e){const n=e.target;n.removeEventListener("dispose",T),function(e){const n=e.texture,r=i.get(e),o=i.get(n);if(!e)return;void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),i.remove(n[e])}i.remove(n),i.remove(e)}(n)}let S=0;function E(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void I(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function M(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;P(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=s||l?l?i.image[t].image:i.image[t]:g(i.image[t],!1,!0,u);const c=h[0],d=v(c)||a,p=o.convert(i.format),f=o.convert(i.type),m=x(i.internalFormat,p,f);let b;if(C(34067,i,d),s){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e<b.length;e++){const r=b[e];i.format!==Vt&&i.format!==jt?null!==p?n.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=b.length-1}else{b=i.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,m,h[t].width,h[t].height,0,p,f,h[t].data);for(let e=0;e<b.length;e++){const i=b[e].image[t].image;n.texImage2D(34069+t,e+1,m,i.width,i.height,0,p,f,i.data)}}else{n.texImage2D(34069+t,0,m,p,f,h[t]);for(let e=0;e<b.length;e++){const i=b[e];n.texImage2D(34069+t,e+1,m,p,f,i.image[t])}}e.__maxMipLevel=b.length}_(i,d)&&y(34067,i,c.width,c.height);e.__version=i.version,i.onUpdate&&i.onUpdate(i)}(s,e,r):(n.activeTexture(33984+r),n.bindTexture(34067,s.__webglTexture))}const A={[vt]:10497,[_t]:33071,[yt]:33648},R={[xt]:9728,[bt]:9984,[Tt]:9986,[Et]:9729,[Mt]:9985,[Rt]:9987};function C(n,o,s){if(s?(t.texParameteri(n,10242,A[o.wrapS]),t.texParameteri(n,10243,A[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,A[o.wrapR]),t.texParameteri(n,10240,R[o.magFilter]),t.texParameteri(n,10241,R[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===_t&&o.wrapT===_t||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,b(o.magFilter)),t.texParameteri(n,10241,b(o.minFilter)),o.minFilter!==xt&&o.minFilter!==Et&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(o.type===Ft&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&o.type===Bt&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function P(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),s.memory.textures++)}function I(e,i,r){let s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),P(e,i),n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==_t||t.wrapT!==_t||t.minFilter!==xt&&t.minFilter!==Et)}(i)&&!1===v(i.image),u=g(i.image,l,!1,h),c=v(u)||a,d=o.convert(i.format);let p,f=o.convert(i.type),m=x(i.internalFormat,d,f);C(s,i,c);const b=i.mipmaps;if(i.isDepthTexture)m=6402,a?m=i.type===Ft?36012:i.type===Dt?33190:i.type===Ht?35056:33189:i.type===Ft&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Yt&&6402===m&&i.type!==Lt&&i.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Lt,f=o.convert(i.type)),i.format===Zt&&6402===m&&(m=34041,i.type!==Ht&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ht,f=o.convert(i.type))),n.texImage2D(3553,0,m,u.width,u.height,0,d,f,null);else if(i.isDataTexture)if(b.length>0&&c){for(let t=0,e=b.length;t<e;t++)p=b[t],n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);i.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,u.width,u.height,0,d,f,u.data),e.__maxMipLevel=0;else if(i.isCompressedTexture){for(let t=0,e=b.length;t<e;t++)p=b[t],i.format!==Vt&&i.format!==jt?null!==d?n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=b.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,m,u.width,u.height,u.depth,0,d,f,u.data),e.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,m,u.width,u.height,u.depth,0,d,f,u.data),e.__maxMipLevel=0;else if(b.length>0&&c){for(let t=0,e=b.length;t<e;t++)p=b[t],n.texImage2D(3553,t,m,d,f,p);i.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,d,f,u),e.__maxMipLevel=0;_(i,c)&&y(s,i,u.width,u.height),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function O(e,r,s,a,l){const u=o.convert(s.format),h=o.convert(s.type),c=x(s.internalFormat,u,h);32879===l||35866===l?n.texImage3D(l,0,c,r.width,r.height,r.depth,0,u,h,null):n.texImage2D(l,0,c,r.width,r.height,0,u,h,null),n.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,l,i.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)}function L(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===Ft?r=36012:e.type===Dt&&(r=33190));const i=D(n);t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(i){const e=D(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,r=o.convert(e.format),s=o.convert(e.type),a=x(e.internalFormat,r,s);if(i){const e=D(n);t.renderbufferStorageMultisample(36161,e,a,n.width,n.height)}else t.renderbufferStorage(36161,a,n.width,n.height)}t.bindRenderbuffer(36161,null)}function N(e){const r=i.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),E(r.depthTexture,0);const o=i.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===Yt)t.framebufferTexture2D(36160,36096,3553,o,0);else{if(r.depthTexture.format!==Zt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,o,0)}}(r.__webglFramebuffer,e)}else if(o){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(36160,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),L(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),L(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function D(t){return a&&t.isWebGLMultisampleRenderTarget?Math.min(c,t.samples):0}let F=!1,B=!1;this.allocateTextureUnit=function(){const t=S;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=M,this.setupRenderTarget=function(e){const l=e.texture,u=i.get(e),h=i.get(l);e.addEventListener("dispose",T),!0!==e.isWebGLMultipleRenderTargets&&(h.__webglTexture=t.createTexture(),h.__version=l.version,s.memory.textures++);const c=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=v(e)||a;if(!a||l.format!==jt||l.type!==Ft&&l.type!==Bt||(l.format=Vt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){u.__webglFramebuffer=[];for(let e=0;e<6;e++)u.__webglFramebuffer[e]=t.createFramebuffer()}else if(u.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(a){u.__webglMultisampledFramebuffer=t.createFramebuffer(),u.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,u.__webglColorRenderbuffer);const i=o.convert(l.format),r=o.convert(l.type),s=x(l.internalFormat,i,r),a=D(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,u.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(u.__webglDepthRenderbuffer=t.createRenderbuffer(),L(u.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,h.__webglTexture),C(34067,l,m);for(let t=0;t<6;t++)O(u.__webglFramebuffer[t],e,l,36064,34069+t);_(l,m)&&y(34067,l,e.width,e.height),n.bindTexture(34067,null)}else if(d){const t=e.texture;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=i.get(o);n.bindTexture(3553,s.__webglTexture),C(3553,o,m),O(u.__webglFramebuffer,e,o,36064+r,3553),_(o,m)&&y(3553,o,e.width,e.height)}n.bindTexture(3553,null)}else{let t=3553;if(f)if(a){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(t,h.__webglTexture),C(t,l,m),O(u.__webglFramebuffer,e,l,36064,t),_(l,m)&&y(t,l,e.width,e.height,e.depth),n.bindTexture(t,null)}e.depthBuffer&&N(e)},this.updateRenderTargetMipmap=function(t){const e=v(t)||a,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,s=r.length;o<s;o++){const s=r[o];if(_(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=i.get(s).__webglTexture;n.bindTexture(e,r),y(e,s,t.width,t.height),n.bindTexture(e,null)}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const a=i.get(e);n.bindFramebuffer(36008,a.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,a.__webglFramebuffer),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,a.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),t=t.texture),M(t,e)}}function Ka(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===Pt)return 5121;if(t===Ut)return 32819;if(t===kt)return 32820;if(t===Gt)return 33635;if(t===It)return 5120;if(t===Ot)return 5122;if(t===Lt)return 5123;if(t===Nt)return 5124;if(t===Dt)return 5125;if(t===Ft)return 5126;if(t===Bt)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(t===zt)return 6406;if(t===jt)return 6407;if(t===Vt)return 6408;if(t===Wt)return 6409;if(t===Xt)return 6410;if(t===Yt)return 6402;if(t===Zt)return 34041;if(t===Jt)return 6403;if(t===Kt)return 36244;if(t===$t)return 33319;if(t===Qt)return 33320;if(t===te)return 36248;if(t===ee)return 36249;if(t===ne||t===ie||t===re||t===oe){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===ne)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===ie)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===re)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===oe)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===se||t===ae||t===le||t===ue){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===se)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ae)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===le)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ue)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===he)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ce||t===de)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===ce)return n.COMPRESSED_RGB8_ETC2;if(t===de)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===pe||t===fe||t===me||t===ge||t===ve||t===_e||t===ye||t===xe||t===be||t===we||t===Te||t===Se||t===Ee||t===Me||t===Re||t===Ce||t===Pe||t===Ie||t===Oe||t===Le||t===Ne||t===De||t===Fe||t===Be||t===Ue||t===ke||t===Ge||t===He?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):t===Ae?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===Ht?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class $a extends Lo{constructor(t=[]){super(),this.cameras=t}}$a.prototype.isArrayCamera=!0;class Qa extends mr{constructor(){super(),this.type="Group"}}Qa.prototype.isGroup=!0;const tl={type:"move"};class el{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Qa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Qa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new pi,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new pi),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Qa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new pi,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new pi),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(tl))),l&&t.hand){o=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new Qa;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),a=.02,u=.005;l.inputState.pinching&&s>a+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=a-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this}}class nl extends zn{constructor(t,e){super();const n=this,i=t.state;let r=null,o=1,s=null,a="local-floor",l=null,u=null,h=null,c=null;const d=[],p=new Map,f=new Lo;f.layers.enable(1),f.viewport=new li;const m=new Lo;m.layers.enable(2),m.viewport=new li;const g=[f,m],v=new $a;v.layers.enable(1),v.layers.enable(2);let _=null,y=null;function x(t){const e=p.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function b(){p.forEach((function(t,e){t.disconnect(e)})),p.clear(),_=null,y=null,i.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),A.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function w(t){const e=r.inputSources;for(let t=0;t<d.length;t++)p.set(e[t],d[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=p.get(n);i&&(i.dispatchEvent({type:"disconnected",data:n}),p.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],i=p.get(n);i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=d[t];return void 0===e&&(e=new el,d[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=d[t];return void 0===e&&(e=new el,d[t]=e),e.getGripSpace()},this.getHand=function(t){let e=d[t];return void 0===e&&(e=new el,d[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return r},this.setSession=async function(t){if(r=t,null!==r){r.addEventListener("select",x),r.addEventListener("selectstart",x),r.addEventListener("selectend",x),r.addEventListener("squeeze",x),r.addEventListener("squeezestart",x),r.addEventListener("squeezeend",x),r.addEventListener("end",b),r.addEventListener("inputsourceschange",w);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const n={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o},i=new XRWebGLLayer(r,e,n);r.updateRenderState({baseLayer:i})}else{let n=0;t.depth&&(n=t.stencil?34041:6402);const i={colorFormat:t.alpha?6408:6407,depthFormat:n,scaleFactor:o};u=new XRWebGLBinding(r,e),c=u.createProjectionLayer(i),h=e.createFramebuffer(),r.updateRenderState({layers:[c]})}s=await r.requestReferenceSpace(a),A.setContext(r),A.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const T=new pi,S=new pi;function E(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;v.near=m.near=f.near=t.near,v.far=m.far=f.far=t.far,_===v.near&&y===v.far||(r.updateRenderState({depthNear:v.near,depthFar:v.far}),_=v.near,y=v.far);const e=t.parent,n=v.cameras;E(v,e);for(let t=0;t<n.length;t++)E(n[t],e);v.matrixWorld.decompose(v.position,v.quaternion,v.scale),t.position.copy(v.position),t.quaternion.copy(v.quaternion),t.scale.copy(v.scale),t.matrix.copy(v.matrix),t.matrixWorld.copy(v.matrixWorld);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){T.setFromMatrixPosition(e.matrixWorld),S.setFromMatrixPosition(n.matrixWorld);const i=T.distanceTo(S),r=e.projectionMatrix.elements,o=n.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],h=(r[8]-1)/r[0],c=(o[8]+1)/o[0],d=s*h,p=s*c,f=i/(-h+c),m=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,v=a+f,_=d-m,y=p+(i-m),x=l*a/v*g,b=u*a/v*g;t.projectionMatrix.makePerspective(_,y,x,b,g,v)}(v,f,m):v.projectionMatrix.copy(f.projectionMatrix)},this.getCamera=function(){return v};let M=null;const A=new Vo;A.setAnimationLoop((function(t,n){if(l=n.getViewerPose(s),null!==l){const t=l.views,n=r.renderState.baseLayer;void 0===r.renderState.layers&&i.bindXRFramebuffer(n.framebuffer);let o=!1;t.length!==v.cameras.length&&(v.cameras.length=0,o=!0);for(let s=0;s<t.length;s++){const a=t[s];let l=null;if(void 0===r.renderState.layers)l=n.getViewport(a);else{const t=u.getViewSubImage(c,a);i.bindXRFramebuffer(h),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,36096,3553,t.depthStencilTexture,0),l=t.viewport}const d=g[s];d.matrix.fromArray(a.transform.matrix),d.projectionMatrix.fromArray(a.projectionMatrix),d.viewport.set(l.x,l.y,l.width,l.height),0===s&&v.matrix.copy(d.matrix),!0===o&&v.cameras.push(d)}}const o=r.inputSources;for(let t=0;t<d.length;t++){const e=d[t],i=o[t];e.update(i,n,s)}M&&M(t,n)})),this.setAnimationLoop=function(t){M=t},this.dispose=function(){}}}function il(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);const i=t.get(n).envMap;if(i){e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&i._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;const r=t.get(i).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,o;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(r=n.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===b&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===b&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,o,s){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e,i){n(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===b&&t.clearcoatNormalScale.value.negate());t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap);e.transmission>0&&(t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height));t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap);t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)}(t,i,s):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,o):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function rl(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=nn,this.physicallyCorrectLights=!1,this.toneMapping=rt,this.toneMappingExposure=1;const m=this;let g=!1,v=0,_=0,y=null,T=-1,S=null;const E=new li,M=new li;let A=null,R=e.width,C=e.height,P=1,I=null,O=null;const L=new li(0,0,R,C),N=new li(0,0,R,C);let D=!1;const F=[],B=new jo;let U=!1,k=!1,G=null;const H=new Vi,z=new pi,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function V(){return null===y?P:1}let W,X,q,Y,Z,J,K,$,Q,tt,et,nt,it,ot,st,at,lt,ut,ht,ct,dt,pt,ft=n;function mt(t,n){for(let i=0;i<t.length;i++){const r=t[i],o=e.getContext(r,n);if(null!==o)return o}return null}try{const t={alpha:i,depth:r,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",yt,!1),e.addEventListener("webglcontextrestored",bt,!1),null===ft){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),ft=mt(e,t),null===ft)throw mt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ft.getShaderPrecisionFormat&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function gt(){W=new ns(ft),X=new Qo(ft,W,t),W.init(X),dt=new Ka(ft,W,X),q=new Za(ft,W,X),F[0]=1029,Y=new os(ft),Z=new Da,J=new Ja(ft,W,q,Z,X,dt,Y),K=new es(m),$=new Wo(ft,X),pt=new Ko(ft,W,$,X),Q=new is(ft,$,Y,pt),tt=new us(ft,Q,$,Y),ut=new ls(ft),st=new ts(Z),et=new Na(m,K,W,X,pt,st),nt=new il(Z),it=new ka(Z),ot=new Wa(W,X),lt=new Jo(m,K,q,tt,a),at=new Ya(m,tt,X),ht=new $o(ft,W,Y,X),ct=new rs(ft,W,Y,X),Y.programs=et.programs,m.capabilities=X,m.extensions=W,m.properties=Z,m.renderLists=it,m.shadowMap=at,m.state=q,m.info=Y}gt();const vt=new nl(m,ft);function yt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function bt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=Y.autoReset,e=at.enabled,n=at.autoUpdate,i=at.needsUpdate,r=at.type;gt(),Y.autoReset=t,at.enabled=e,at.autoUpdate=n,at.needsUpdate=i,at.type=r}function wt(t){const e=t.target;e.removeEventListener("dispose",wt),function(t){(function(t){const e=Z.get(t).programs;void 0!==e&&e.forEach((function(t){et.releaseProgram(t)}))})(t),Z.remove(t)}(e)}this.xr=vt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){const t=W.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=W.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(R,C,!1))},this.getSize=function(t){return t.set(R,C)},this.setSize=function(t,n,i){vt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,C=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(R*P,C*P).floor()},this.setDrawingBufferSize=function(t,n,i){R=t,C=n,P=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(L)},this.setViewport=function(t,e,n,i){t.isVector4?L.set(t.x,t.y,t.z,t.w):L.set(t,e,n,i),q.viewport(E.copy(L).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(N)},this.setScissor=function(t,e,n,i){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,n,i),q.scissor(M.copy(N).multiplyScalar(P).floor())},this.getScissorTest=function(){return D},this.setScissorTest=function(t){q.setScissorTest(D=t)},this.setOpaqueSort=function(t){I=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(lt.getClearColor())},this.setClearColor=function(){lt.setClearColor.apply(lt,arguments)},this.getClearAlpha=function(){return lt.getClearAlpha()},this.setClearAlpha=function(){lt.setClearAlpha.apply(lt,arguments)},this.clear=function(t,e,n){let i=0;(void 0===t||t)&&(i|=16384),(void 0===e||e)&&(i|=256),(void 0===n||n)&&(i|=1024),ft.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",yt,!1),e.removeEventListener("webglcontextrestored",bt,!1),it.dispose(),ot.dispose(),Z.dispose(),K.dispose(),tt.dispose(),pt.dispose(),vt.dispose(),vt.removeEventListener("sessionstart",St),vt.removeEventListener("sessionend",Et),G&&(G.dispose(),G=null),Mt.stop()},this.renderBufferImmediate=function(t,e){pt.initAttributes();const n=Z.get(t);t.hasPositions&&!n.position&&(n.position=ft.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=ft.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=ft.createBuffer()),t.hasColors&&!n.color&&(n.color=ft.createBuffer());const i=e.getAttributes();t.hasPositions&&(ft.bindBuffer(34962,n.position),ft.bufferData(34962,t.positionArray,35048),pt.enableAttribute(i.position),ft.vertexAttribPointer(i.position,3,5126,!1,0,0)),t.hasNormals&&(ft.bindBuffer(34962,n.normal),ft.bufferData(34962,t.normalArray,35048),pt.enableAttribute(i.normal),ft.vertexAttribPointer(i.normal,3,5126,!1,0,0)),t.hasUvs&&(ft.bindBuffer(34962,n.uv),ft.bufferData(34962,t.uvArray,35048),pt.enableAttribute(i.uv),ft.vertexAttribPointer(i.uv,2,5126,!1,0,0)),t.hasColors&&(ft.bindBuffer(34962,n.color),ft.bufferData(34962,t.colorArray,35048),pt.enableAttribute(i.color),ft.vertexAttribPointer(i.color,3,5126,!1,0,0)),pt.disableUnusedAttributes(),ft.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,i,r,o){null===e&&(e=j);const s=r.isMesh&&r.matrixWorld.determinant()<0,a=Lt(t,e,i,r);q.setMaterial(i,s);let l=n.index;const u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;let h,c=1;!0===i.wireframe&&(l=Q.getWireframeAttribute(n),c=2),(i.morphTargets||i.morphNormals)&&ut.update(r,n,i,a),pt.setup(r,i,a,n,l);let d=ht;null!==l&&(h=$.get(l),d=ct,d.setIndex(h));const p=null!==l?l.count:u.count,f=n.drawRange.start*c,m=n.drawRange.count*c,g=null!==o?o.start*c:0,v=null!==o?o.count*c:1/0,_=Math.max(f,g),y=Math.min(p,f+m,g+v)-1,x=Math.max(0,y-_+1);if(0!==x){if(r.isMesh)!0===i.wireframe?(q.setLineWidth(i.wireframeLinewidth*V()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),q.setLineWidth(t*V()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(_,x,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(_,x,t)}else d.render(_,x)}},this.compile=function(t,e){d=ot.get(t),d.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++){It(n[i],t,e)}else It(n,t,e)}))};let Tt=null;function St(){Mt.stop()}function Et(){Mt.start()}const Mt=new Vo;function At(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=o.object,a=o.geometry,l=null===i?o.material:i,u=o.group;if(n.isArrayCamera){const t=n.cameras;for(let n=0,i=t.length;n<i;n++){const i=t[n];s.layers.test(i.layers)&&(q.viewport(E.copy(i.viewport)),d.setupLightsView(i),Ct(s,e,i,a,l,u))}}else Ct(s,e,n,a,l,u)}}function Ct(t,e,n,i,r,o){if(t.onBeforeRender(m,e,n,i,r,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const i=Lt(n,e,r,t);q.setMaterial(r),pt.reset(),function(t,e){t.render((function(t){m.renderBufferImmediate(t,e)}))}(t,i)}else!0===r.transparent&&r.side===w?(r.side=b,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,o),r.side=x,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,o),r.side=w):m.renderBufferDirect(n,e,i,r,t,o);t.onAfterRender(m,e,n,i,r,o)}function It(t,e,n){!0!==e.isScene&&(e=j);const i=Z.get(t),r=d.state.lights,o=d.state.shadowsArray,s=r.state.version,a=et.getParameters(t,r.state,o,e,n),l=et.getProgramCacheKey(a);let u=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=K.get(t.envMap||i.environment),void 0===u&&(t.addEventListener("dispose",wt),u=new Map,i.programs=u);let h=u.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===s)return Ot(t,a),h}else a.uniforms=et.getUniforms(t),t.onBuild(a,m),t.onBeforeCompile(a,m),h=et.acquireProgram(a,l),u.set(l,h),i.uniforms=a.uniforms;const c=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=st.uniform),Ot(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(c.ambientLightColor.value=r.state.ambient,c.lightProbe.value=r.state.probe,c.directionalLights.value=r.state.directional,c.directionalLightShadows.value=r.state.directionalShadow,c.spotLights.value=r.state.spot,c.spotLightShadows.value=r.state.spotShadow,c.rectAreaLights.value=r.state.rectArea,c.ltc_1.value=r.state.rectAreaLTC1,c.ltc_2.value=r.state.rectAreaLTC2,c.pointLights.value=r.state.point,c.pointLightShadows.value=r.state.pointShadow,c.hemisphereLights.value=r.state.hemi,c.directionalShadowMap.value=r.state.directionalShadowMap,c.directionalShadowMatrix.value=r.state.directionalShadowMatrix,c.spotShadowMap.value=r.state.spotShadowMap,c.spotShadowMatrix.value=r.state.spotShadowMatrix,c.pointShadowMap.value=r.state.pointShadowMap,c.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=h.getUniforms(),f=pa.seqWithValue(p.seq,c);return i.currentProgram=h,i.uniformsList=f,h}function Ot(t,e){const n=Z.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas}function Lt(t,e,n,i){!0!==e.isScene&&(e=j),J.resetTextureUnits();const r=e.fog,o=n.isMeshStandardMaterial?e.environment:null,s=null===y?m.outputEncoding:y.texture.encoding,a=K.get(n.envMap||o),l=!0===n.vertexColors&&i.geometry&&i.geometry.attributes.color&&4===i.geometry.attributes.color.itemSize,u=Z.get(n),h=d.state.lights;if(!0===U&&(!0===k||t!==S)){const e=t===S&&n.id===T;st.setState(n,t,e)}let c=!1;n.version===u.__version?u.needsLights&&u.lightsStateVersion!==h.state.version||u.outputEncoding!==s||i.isInstancedMesh&&!1===u.instancing?c=!0:i.isInstancedMesh||!0!==u.instancing?i.isSkinnedMesh&&!1===u.skinning?c=!0:i.isSkinnedMesh||!0!==u.skinning?u.envMap!==a||n.fog&&u.fog!==r?c=!0:void 0===u.numClippingPlanes||u.numClippingPlanes===st.numPlanes&&u.numIntersection===st.numIntersection?u.vertexAlphas!==l&&(c=!0):c=!0:c=!0:c=!0:(c=!0,u.__version=n.version);let p=u.currentProgram;!0===c&&(p=It(n,e,i));let f=!1,g=!1,v=!1;const _=p.getUniforms(),x=u.uniforms;if(q.useProgram(p.program)&&(f=!0,g=!0,v=!0),n.id!==T&&(T=n.id,g=!0),f||S!==t){if(_.setValue(ft,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&_.setValue(ft,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,g=!0,v=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=_.map.cameraPosition;void 0!==e&&e.setValue(ft,z.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(ft,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||i.isSkinnedMesh)&&_.setValue(ft,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){_.setOptional(ft,i,"bindMatrix"),_.setOptional(ft,i,"bindMatrixInverse");const t=i.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),_.setValue(ft,"boneTexture",t.boneTexture,J),_.setValue(ft,"boneTextureSize",t.boneTextureSize)):_.setOptional(ft,t,"boneMatrices"))}var b,w;return(g||u.receiveShadow!==i.receiveShadow)&&(u.receiveShadow=i.receiveShadow,_.setValue(ft,"receiveShadow",i.receiveShadow)),g&&(_.setValue(ft,"toneMappingExposure",m.toneMappingExposure),u.needsLights&&(w=v,(b=x).ambientLightColor.needsUpdate=w,b.lightProbe.needsUpdate=w,b.directionalLights.needsUpdate=w,b.directionalLightShadows.needsUpdate=w,b.pointLights.needsUpdate=w,b.pointLightShadows.needsUpdate=w,b.spotLights.needsUpdate=w,b.spotLightShadows.needsUpdate=w,b.rectAreaLights.needsUpdate=w,b.hemisphereLights.needsUpdate=w),r&&n.fog&&nt.refreshFogUniforms(x,r),nt.refreshMaterialUniforms(x,n,P,C,G),pa.upload(ft,u.uniformsList,x,J)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(pa.upload(ft,u.uniformsList,x,J),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(ft,"center",i.center),_.setValue(ft,"modelViewMatrix",i.modelViewMatrix),_.setValue(ft,"normalMatrix",i.normalMatrix),_.setValue(ft,"modelMatrix",i.matrixWorld),p}Mt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof window&&Mt.setContext(window),this.setAnimationLoop=function(t){Tt=t,vt.setAnimationLoop(t),null===t?Mt.stop():Mt.start()},vt.addEventListener("sessionstart",St),vt.addEventListener("sessionend",Et),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===vt.enabled&&!0===vt.isPresenting&&(!0===vt.cameraAutoUpdate&&vt.updateCamera(e),e=vt.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,y),d=ot.get(t,f.length),d.init(),f.push(d),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),B.setFromProjectionMatrix(H),k=this.localClippingEnabled,U=st.init(this.clippingPlanes,k,e),c=it.get(t,p.length),c.init(),p.push(c),function t(e,n,i,r){if(!1===e.visible)return;if(e.layers.test(n.layers))if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||B.intersectsSprite(e)){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=tt.update(e),n=e.material;n.visible&&c.push(e,t,n,i,z.z,null)}}else if(e.isImmediateRenderObject)r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H),c.push(e,null,e.material,i,z.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Y.render.frame&&(e.skeleton.update(),e.skeleton.frame=Y.render.frame),!e.frustumCulled||B.intersectsObject(e))){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=tt.update(e),n=e.material;if(Array.isArray(n)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=n[s.materialIndex];a&&a.visible&&c.push(e,t,a,i,z.z,s)}}else n.visible&&c.push(e,t,n,i,z.z,null)}const o=e.children;for(let e=0,s=o.length;e<s;e++)t(o[e],n,i,r)}(t,e,0,m.sortObjects),c.finish(),!0===m.sortObjects&&c.sort(I,O),!0===U&&st.beginShadows();const n=d.state.shadowsArray;at.render(n,t,e),d.setupLights(),d.setupLightsView(e),!0===U&&st.endShadows(),!0===this.info.autoReset&&this.info.reset(),lt.render(c,t);const i=c.opaque,r=c.transmissive,o=c.transparent;i.length>0&&At(i,t,e),r.length>0&&function(t,e,n,i){if(null===G){const t=!0===s&&!0===X.isWebGL2;G=new(t?ci:ui)(1024,1024,{generateMipmaps:!0,type:null!==dt.convert(Bt)?Bt:Pt,minFilter:Rt,magFilter:xt,wrapS:_t,wrapT:_t})}const r=m.getRenderTarget();m.setRenderTarget(G),m.clear();const o=m.toneMapping;m.toneMapping=rt,At(t,n,i),m.toneMapping=o,J.updateMultisampleRenderTarget(G),J.updateRenderTargetMipmap(G),m.setRenderTarget(r),At(e,n,i)}(i,r,t,e),o.length>0&&At(o,t,e),null!==y&&(J.updateMultisampleRenderTarget(y),J.updateRenderTargetMipmap(y)),!0===t.isScene&&t.onAfterRender(m,t,e),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),pt.resetDefaultState(),T=-1,S=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),c=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return y},this.setRenderTarget=function(t,e=0,n=0){y=t,v=e,_=n,t&&void 0===Z.get(t).__webglFramebuffer&&J.setupRenderTarget(t);let i=null,r=!1,o=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const s=Z.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=s[e],r=!0):i=t.isWebGLMultisampleRenderTarget?Z.get(t).__webglMultisampledFramebuffer:s,E.copy(t.viewport),M.copy(t.scissor),A=t.scissorTest}else E.copy(L).multiplyScalar(P).floor(),M.copy(N).multiplyScalar(P).floor(),A=D;if(q.bindFramebuffer(36160,i)&&X.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const n=t.texture;if(F.length!==n.length||36064!==F[0]){for(let t=0,e=n.length;t<e;t++)F[t]=36064+t;F.length=n.length,e=!0}}else 1===F.length&&36064===F[0]||(F[0]=36064,F.length=1,e=!0);else 1===F.length&&1029===F[0]||(F[0]=1029,F.length=1,e=!0);e&&(X.isWebGL2?ft.drawBuffers(F):W.get("WEBGL_draw_buffers").drawBuffersWEBGL(F))}if(q.viewport(E),q.scissor(M),q.setScissorTest(A),r){const i=Z.get(t.texture);ft.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(o){const i=Z.get(t.texture),r=e||0;ft.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){q.bindFramebuffer(36160,a);try{const s=t.texture,a=s.format,l=s.type;if(a!==Vt&&dt.convert(a)!==ft.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const u=l===Bt&&(W.has("EXT_color_buffer_half_float")||X.isWebGL2&&W.has("EXT_color_buffer_float"));if(!(l===Pt||dt.convert(l)===ft.getParameter(35738)||l===Ft&&(X.isWebGL2||W.has("OES_texture_float")||W.has("WEBGL_color_buffer_float"))||u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ft.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&ft.readPixels(e,n,i,r,dt.convert(a),dt.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==y?Z.get(y).__webglFramebuffer:null;q.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i);let s=dt.convert(e.format);X.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),J.setTexture2D(e,0),ft.copyTexImage2D(3553,n,s,t.x,t.y,r,o,0),q.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,o=e.image.height,s=dt.convert(n.format),a=dt.convert(n.type);J.setTexture2D(n,0),ft.pixelStorei(37440,n.flipY),ft.pixelStorei(37441,n.premultiplyAlpha),ft.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ft.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?ft.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):ft.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&&ft.generateMipmap(3553),q.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=dt.convert(i.format),u=dt.convert(i.type);let h;if(i.isDataTexture3D)J.setTexture3D(i,0),h=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");J.setTexture2DArray(i,0),h=35866}ft.pixelStorei(37440,i.flipY),ft.pixelStorei(37441,i.premultiplyAlpha),ft.pixelStorei(3317,i.unpackAlignment);const c=ft.getParameter(3314),d=ft.getParameter(32878),p=ft.getParameter(3316),f=ft.getParameter(3315),g=ft.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;ft.pixelStorei(3314,v.width),ft.pixelStorei(32878,v.height),ft.pixelStorei(3316,t.min.x),ft.pixelStorei(3315,t.min.y),ft.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?ft.texSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,u,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ft.compressedTexSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,v.data)):ft.texSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,u,v),ft.pixelStorei(3314,c),ft.pixelStorei(32878,d),ft.pixelStorei(3316,p),ft.pixelStorei(3315,f),ft.pixelStorei(32877,g),0===r&&i.generateMipmaps&&ft.generateMipmap(h),q.unbindTexture()},this.initTexture=function(t){J.setTexture2D(t,0),q.unbindTexture()},this.resetState=function(){v=0,_=0,y=null,q.reset(),pt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class ol extends rl{}ol.prototype.isWebGL1Renderer=!0;class sl{constructor(t,e=25e-5){this.name="",this.color=new Dr(t),this.density=e}clone(){return new sl(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}sl.prototype.isFogExp2=!0;class al{constructor(t,e=1,n=1e3){this.name="",this.color=new Dr(t),this.near=e,this.far=n}clone(){return new al(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}al.prototype.isFog=!0;class ll extends mr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}ll.prototype.isScene=!0;class ul{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=In,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=qn()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qn()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qn()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}ul.prototype.isInterleavedBuffer=!0;const hl=new pi;class cl{constructor(t,e,n,i=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)hl.x=this.getX(e),hl.y=this.getY(e),hl.z=this.getZ(e),hl.applyMatrix4(t),this.setXYZ(e,hl.x,hl.y,hl.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)hl.x=this.getX(e),hl.y=this.getY(e),hl.z=this.getZ(e),hl.applyNormalMatrix(t),this.setXYZ(e,hl.x,hl.y,hl.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)hl.x=this.getX(e),hl.y=this.getY(e),hl.z=this.getZ(e),hl.transformDirection(t),this.setXYZ(e,hl.x,hl.y,hl.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new kr(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new cl(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}cl.prototype.isInterleavedBufferAttribute=!0;class dl extends Rr{constructor(t){super(),this.type="SpriteMaterial",this.color=new Dr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let pl;dl.prototype.isSpriteMaterial=!0;const fl=new pi,ml=new pi,gl=new pi,vl=new ei,_l=new ei,yl=new Vi,xl=new pi,bl=new pi,wl=new pi,Tl=new ei,Sl=new ei,El=new ei;class Ml extends mr{constructor(t){if(super(),this.type="Sprite",void 0===pl){pl=new so;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new ul(t,5);pl.setIndex([0,1,2,0,2,3]),pl.setAttribute("position",new cl(e,3,0,!1)),pl.setAttribute("uv",new cl(e,2,3,!1))}this.geometry=pl,this.material=void 0!==t?t:new dl,this.center=new ei(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ml.setFromMatrixScale(this.matrixWorld),yl.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),gl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ml.multiplyScalar(-gl.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;Al(xl.set(-.5,-.5,0),gl,o,ml,i,r),Al(bl.set(.5,-.5,0),gl,o,ml,i,r),Al(wl.set(.5,.5,0),gl,o,ml,i,r),Tl.set(0,0),Sl.set(1,0),El.set(1,1);let s=t.ray.intersectTriangle(xl,bl,wl,!1,fl);if(null===s&&(Al(bl.set(-.5,.5,0),gl,o,ml,i,r),Sl.set(0,1),s=t.ray.intersectTriangle(xl,wl,bl,!1,fl),null===s))return;const a=t.ray.origin.distanceTo(fl);a<t.near||a>t.far||e.push({distance:a,point:fl.clone(),uv:Mr.getUV(fl,xl,bl,wl,Tl,Sl,El,new ei),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Al(t,e,n,i,r,o){vl.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(_l.x=o*vl.x-r*vl.y,_l.y=r*vl.x+o*vl.y):_l.copy(vl),t.copy(e),t.x+=_l.x,t.y+=_l.y,t.applyMatrix4(yl)}Ml.prototype.isSprite=!0;const Rl=new pi,Cl=new pi;class Pl extends mr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let i;for(i=0;i<n.length&&!(e<n[i].distance);i++);return n.splice(i,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Rl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Rl);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Rl.setFromMatrixPosition(t.matrixWorld),Cl.setFromMatrixPosition(this.matrixWorld);const n=Rl.distanceTo(Cl)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r&&n>=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance})}return e}}const Il=new pi,Ol=new li,Ll=new li,Nl=new pi,Dl=new Vi;class Fl extends Eo{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Vi,this.bindMatrixInverse=new Vi}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new li,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,i=this.geometry;Ol.fromBufferAttribute(i.attributes.skinIndex,t),Ll.fromBufferAttribute(i.attributes.skinWeight,t),Il.fromBufferAttribute(i.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=Ll.getComponent(t);if(0!==i){const r=Ol.getComponent(t);Dl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(Nl.copy(Il).applyMatrix4(Dl),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}Fl.prototype.isSkinnedMesh=!0;class Bl extends mr{constructor(){super(),this.type="Bone"}}Bl.prototype.isBone=!0;class Ul extends si{constructor(t=null,e=1,n=1,i,r,o,s,a,l=xt,u=xt,h,c){super(null,o,s,a,l,u,i,r,h,c),this.image={data:t,width:e,height:n},this.magFilter=l,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Ul.prototype.isDataTexture=!0;const kl=new Vi,Gl=new Vi;class Hl{constructor(t=[],e=[]){this.uuid=qn(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Vi)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Vi;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:Gl;kl.multiplyMatrices(r,e[i]),kl.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Hl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=$n(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Ul(e,t,t,Vt,Ft);return this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Bl),this.bones.push(r),this.boneInverses.push((new Vi).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}}const zl=new Vi,jl=new Vi,Vl=[],Wl=new Eo;class Xl extends Eo{constructor(t,e,n){super(t,e),this.instanceMatrix=new kr(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Wl.geometry=this.geometry,Wl.material=this.material,void 0!==Wl.material)for(let r=0;r<i;r++){this.getMatrixAt(r,zl),jl.multiplyMatrices(n,zl),Wl.matrixWorld=jl,Wl.raycast(t,Vl);for(let t=0,n=Vl.length;t<n;t++){const n=Vl[t];n.instanceId=r,n.object=this,e.push(n)}Vl.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new kr(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Xl.prototype.isInstancedMesh=!0;class ql extends Rr{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Dr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}ql.prototype.isLineBasicMaterial=!0;const Yl=new pi,Zl=new pi,Jl=new Vi,Kl=new ji,$l=new Di;class Ql extends mr{constructor(t=new so,e=new ql){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)Yl.fromBufferAttribute(e,t-1),Zl.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Yl.distanceTo(Zl);t.setAttribute("lineDistance",new Yr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),$l.copy(n.boundingSphere),$l.applyMatrix4(i),$l.radius+=r,!1===t.ray.intersectsSphere($l))return;Jl.copy(i).invert(),Kl.copy(t.ray).applyMatrix4(Jl);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=new pi,u=new pi,h=new pi,c=new pi,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i){for(let n=Math.max(0,o.start),s=Math.min(i.count,o.start+o.count)-1;n<s;n+=d){const o=i.getX(n),s=i.getX(n+1);l.fromBufferAttribute(r,o),u.fromBufferAttribute(r,s);if(Kl.distanceSqToSegment(l,u,c,h)>a)continue;c.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(c);d<t.near||d>t.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,o.start),i=Math.min(r.count,o.start+o.count)-1;n<i;n+=d){l.fromBufferAttribute(r,n),u.fromBufferAttribute(r,n+1);if(Kl.distanceSqToSegment(l,u,c,h)>a)continue;c.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(c);i<t.near||i>t.far||e.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ql.prototype.isLine=!0;const tu=new pi,eu=new pi;class nu extends Ql{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)tu.fromBufferAttribute(e,t),eu.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+tu.distanceTo(eu);t.setAttribute("lineDistance",new Yr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}nu.prototype.isLineSegments=!0;class iu extends Ql{constructor(t,e){super(t,e),this.type="LineLoop"}}iu.prototype.isLineLoop=!0;class ru extends Rr{constructor(t){super(),this.type="PointsMaterial",this.color=new Dr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}ru.prototype.isPointsMaterial=!0;const ou=new Vi,su=new ji,au=new Di,lu=new pi;class uu extends mr{constructor(t=new so,e=new ru){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),au.copy(n.boundingSphere),au.applyMatrix4(i),au.radius+=r,!1===t.ray.intersectsSphere(au))return;ou.copy(i).invert(),su.copy(t.ray).applyMatrix4(ou);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position;if(null!==r){for(let n=Math.max(0,o.start),l=Math.min(r.count,o.start+o.count);n<l;n++){const o=r.getX(n);lu.fromBufferAttribute(s,o),hu(lu,o,a,i,t,e,this)}}else{for(let n=Math.max(0,o.start),r=Math.min(s.count,o.start+o.count);n<r;n++)lu.fromBufferAttribute(s,n),hu(lu,n,a,i,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function hu(t,e,n,i,r,o,s){const a=su.distanceSqToPoint(t);if(a<n){const n=new pi;su.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:s})}}uu.prototype.isPoints=!0;class cu extends si{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.format=void 0!==s?s:jt,this.minFilter=void 0!==o?o:Et,this.magFilter=void 0!==r?r:Et,this.generateMipmaps=!1;const u=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){u.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}cu.prototype.isVideoTexture=!0;class du extends si{constructor(t,e,n,i,r,o,s,a,l,u,h,c){super(null,o,s,a,l,u,i,r,h,c),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}du.prototype.isCompressedTexture=!0;class pu extends si{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.needsUpdate=!0}}pu.prototype.isCanvasTexture=!0;class fu extends si{constructor(t,e,n,i,r,o,s,a,l,u){if((u=void 0!==u?u:Yt)!==Yt&&u!==Zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===Yt&&(n=Lt),void 0===n&&u===Zt&&(n=Ht),super(null,i,r,o,s,a,u,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:xt,this.minFilter=void 0!==a?a:xt,this.flipY=!1,this.generateMipmaps=!1}}fu.prototype.isDepthTexture=!0;class mu extends so{constructor(t=1,e=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],o=[],s=[],a=[],l=new pi,u=new ei;o.push(0,0,0),s.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const c=n+r/e*i;l.x=t*Math.cos(c),l.y=t*Math.sin(c),o.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(o[h]/t+1)/2,u.y=(o[h+1]/t+1)/2,a.push(u.x,u.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Yr(o,3)),this.setAttribute("normal",new Yr(s,3)),this.setAttribute("uv",new Yr(a,2))}static fromJSON(t){return new mu(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class gu extends so{constructor(t=1,e=1,n=1,i=8,r=1,o=!1,s=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],c=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const r=p,o=new ei,f=new pi;let v=0;const _=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,m*y,0),c.push(0,y,0),d.push(.5,.5),p++;const x=p;for(let t=0;t<=i;t++){const e=t/i*a+s,n=Math.cos(e),r=Math.sin(e);f.x=_*r,f.y=m*y,f.z=_*n,h.push(f.x,f.y,f.z),c.push(0,y,0),o.x=.5*n+.5,o.y=.5*r*y+.5,d.push(o.x,o.y),p++}for(let t=0;t<i;t++){const e=r+t,i=x+t;!0===n?u.push(i,i+1,e):u.push(i+1,i,e),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}!function(){const o=new pi,v=new pi;let _=0;const y=(e-t)/n;for(let l=0;l<=r;l++){const u=[],g=l/r,_=g*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+s,l=Math.sin(r),f=Math.cos(r);v.x=_*l,v.y=-g*n+m,v.z=_*f,h.push(v.x,v.y,v.z),o.set(l,y,f).normalize(),c.push(o.x,o.y,o.z),d.push(e,1-g),u.push(p++)}f.push(u)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=f[e][t],i=f[e+1][t],r=f[e+1][t+1],o=f[e][t+1];u.push(n,i,o),u.push(i,r,o),_+=6}l.addGroup(g,_,0),g+=_}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new Yr(h,3)),this.setAttribute("normal",new Yr(c,3)),this.setAttribute("uv",new Yr(d,2))}static fromJSON(t){return new gu(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class vu extends gu{constructor(t=1,e=1,n=8,i=1,r=!1,o=0,s=2*Math.PI){super(0,t,e,n,i,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}static fromJSON(t){return new vu(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class _u extends so{constructor(t,e,n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],o=[];function s(t,e,n,i){const r=i+1,o=[];for(let i=0;i<=r;i++){o[i]=[];const s=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)o[i][t]=0===t&&i===r?s:s.clone().lerp(a,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(a(o[t][n+1]),a(o[t+1][n]),a(o[t][n])):(a(o[t][n+1]),a(o[t+1][n+1]),a(o[t+1][n]))}}function a(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function u(t,e,n,i){i<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new pi,i=new pi,r=new pi;for(let o=0;o<e.length;o+=3)l(e[o+0],n),l(e[o+1],i),l(e[o+2],r),s(n,i,r,t)}(i),function(t){const e=new pi;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new pi;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,s=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);o.push(i,1-s)}var e;(function(){const t=new pi,e=new pi,n=new pi,i=new pi,s=new ei,a=new ei,l=new ei;for(let c=0,d=0;c<r.length;c+=9,d+=6){t.set(r[c+0],r[c+1],r[c+2]),e.set(r[c+3],r[c+4],r[c+5]),n.set(r[c+6],r[c+7],r[c+8]),s.set(o[d+0],o[d+1]),a.set(o[d+2],o[d+3]),l.set(o[d+4],o[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);u(s,d+0,t,p),u(a,d+2,e,p),u(l,d+4,n,p)}})(),function(){for(let t=0;t<o.length;t+=6){const e=o[t+0],n=o[t+2],i=o[t+4],r=Math.max(e,n,i),s=Math.min(e,n,i);r>.9&&s<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Yr(r,3)),this.setAttribute("normal",new Yr(r.slice(),3)),this.setAttribute("uv",new Yr(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new _u(t.vertices,t.indices,t.radius,t.details)}}class yu extends _u{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new yu(t.radius,t.detail)}}const xu=new pi,bu=new pi,wu=new pi,Tu=new Mr;class Su extends so{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),i=Math.cos(Wn*e),r=t.getIndex(),o=t.getAttribute("position"),s=r?r.count:o.count,a=[0,0,0],l=["a","b","c"],u=new Array(3),h={},c=[];for(let t=0;t<s;t+=3){r?(a[0]=r.getX(t),a[1]=r.getX(t+1),a[2]=r.getX(t+2)):(a[0]=t,a[1]=t+1,a[2]=t+2);const{a:e,b:s,c:d}=Tu;if(e.fromBufferAttribute(o,a[0]),s.fromBufferAttribute(o,a[1]),d.fromBufferAttribute(o,a[2]),Tu.getNormal(wu),u[0]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,u[1]=`${Math.round(s.x*n)},${Math.round(s.y*n)},${Math.round(s.z*n)}`,u[2]=`${Math.round(d.x*n)},${Math.round(d.y*n)},${Math.round(d.z*n)}`,u[0]!==u[1]&&u[1]!==u[2]&&u[2]!==u[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=u[t],r=u[e],o=Tu[l[t]],s=Tu[l[e]],d=`${n}_${r}`,p=`${r}_${n}`;p in h&&h[p]?(wu.dot(h[p].normal)<=i&&(c.push(o.x,o.y,o.z),c.push(s.x,s.y,s.z)),h[p]=null):d in h||(h[d]={index0:a[t],index1:a[e],normal:wu.clone()})}}for(const t in h)if(h[t]){const{index0:e,index1:n}=h[t];xu.fromBufferAttribute(o,e),bu.fromBufferAttribute(o,n),c.push(xu.x,xu.y,xu.z),c.push(bu.x,bu.y,bu.z)}this.setAttribute("position",new Yr(c,3))}}class Eu{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let s,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),s=n[i]-o,s<0)a=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===o)return i/(r-1);const u=n[i];return(i+(o-u)/(n[i+1]-u))/(r-1)}getTangent(t,e){let n=t-1e-4,i=t+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),o=this.getPoint(i),s=e||(r.isVector2?new ei:new pi);return s.copy(o).sub(r).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new pi,i=[],r=[],o=[],s=new pi,a=new Vi;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new pi),i[e].normalize()}r[0]=new pi,o[0]=new pi;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),c=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),c<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),o[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),o[e]=o[e-1].clone(),s.crossVectors(i[e-1],i[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(Yn(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(s,t))}o[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Yn(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Mu extends Eu{constructor(t=0,e=0,n=1,i=1,r=0,o=2*Math.PI,s=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a}getPoint(t,e){const n=e||new ei,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=o?0:i),!0!==this.aClockwise||o||(r===i?r=-i:r-=i);const s=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Mu.prototype.isEllipseCurve=!0;class Au extends Mu{constructor(t,e,n,i,r,o){super(t,e,n,n,i,r,o),this.type="ArcCurve"}}function Ru(){let t=0,e=0,n=0,i=0;function r(r,o,s,a){t=r,e=s,n=-3*r+3*o-2*s-a,i=2*r-2*o+s+a}return{initCatmullRom:function(t,e,n,i,o){r(e,n,o*(n-t),o*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,o,s,a){let l=(e-t)/o-(n-t)/(o+s)+(n-e)/s,u=(n-e)/s-(i-e)/(s+a)+(i-n)/a;l*=s,u*=s,r(e,n,l,u)},calc:function(r){const o=r*r;return t+e*r+n*o+i*(o*r)}}}Au.prototype.isArcCurve=!0;const Cu=new pi,Pu=new Ru,Iu=new Ru,Ou=new Ru;class Lu extends Eu{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new pi){const n=e,i=this.points,r=i.length,o=(r-(this.closed?0:1))*t;let s,a,l=Math.floor(o),u=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===u&&l===r-1&&(l=r-2,u=1),this.closed||l>0?s=i[(l-1)%r]:(Cu.subVectors(i[0],i[1]).add(i[0]),s=Cu);const h=i[l%r],c=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(Cu.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Cu),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(c),t),i=Math.pow(c.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Pu.initNonuniformCatmullRom(s.x,h.x,c.x,a.x,e,n,i),Iu.initNonuniformCatmullRom(s.y,h.y,c.y,a.y,e,n,i),Ou.initNonuniformCatmullRom(s.z,h.z,c.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Pu.initCatmullRom(s.x,h.x,c.x,a.x,this.tension),Iu.initCatmullRom(s.y,h.y,c.y,a.y,this.tension),Ou.initCatmullRom(s.z,h.z,c.z,a.z,this.tension));return n.set(Pu.calc(u),Iu.calc(u),Ou.calc(u)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new pi).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Nu(t,e,n,i,r){const o=.5*(i-e),s=.5*(r-n),a=t*t;return(2*n-2*i+o+s)*(t*a)+(-3*n+3*i-2*o-s)*a+o*t+n}function Du(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Fu(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}Lu.prototype.isCatmullRomCurve3=!0;class Bu extends Eu{constructor(t=new ei,e=new ei,n=new ei,i=new ei){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new ei){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Fu(t,i.x,r.x,o.x,s.x),Fu(t,i.y,r.y,o.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Bu.prototype.isCubicBezierCurve=!0;class Uu extends Eu{constructor(t=new pi,e=new pi,n=new pi,i=new pi){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new pi){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Fu(t,i.x,r.x,o.x,s.x),Fu(t,i.y,r.y,o.y,s.y),Fu(t,i.z,r.z,o.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Uu.prototype.isCubicBezierCurve3=!0;class ku extends Eu{constructor(t=new ei,e=new ei){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new ei){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new ei;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ku.prototype.isLineCurve=!0;class Gu extends Eu{constructor(t=new pi,e=new pi){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new pi){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Hu extends Eu{constructor(t=new ei,e=new ei,n=new ei){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new ei){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(Du(t,i.x,r.x,o.x),Du(t,i.y,r.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Hu.prototype.isQuadraticBezierCurve=!0;class zu extends Eu{constructor(t=new pi,e=new pi,n=new pi){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new pi){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(Du(t,i.x,r.x,o.x),Du(t,i.y,r.y,o.y),Du(t,i.z,r.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}zu.prototype.isQuadraticBezierCurve3=!0;class ju extends Eu{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new ei){const n=e,i=this.points,r=(i.length-1)*t,o=Math.floor(r),s=r-o,a=i[0===o?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Nu(s,a.x,l.x,u.x,h.x),Nu(s,a.y,l.y,u.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new ei).fromArray(n))}return this}}ju.prototype.isSplineCurve=!0;var Vu=Object.freeze({__proto__:null,ArcCurve:Au,CatmullRomCurve3:Lu,CubicBezierCurve:Bu,CubicBezierCurve3:Uu,EllipseCurve:Mu,LineCurve:ku,LineCurve3:Gu,QuadraticBezierCurve:Hu,QuadraticBezierCurve3:zu,SplineCurve:ju});const Wu=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let o=Xu(t,0,r,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,u,h,c,d,p;if(i&&(o=function(t,e,n,i){const r=[];let o,s,a,l,u;for(o=0,s=e.length;o<s;o++)a=e[o]*i,l=o<s-1?e[o+1]*i:t.length,u=Xu(t,a,l,i,!1),u===u.next&&(u.steiner=!0),r.push(ih(u));for(r.sort(Qu),o=0;o<r.length;o++)th(r[o],n),n=qu(n,n.next);return n}(t,e,o,n)),t.length>80*n){a=u=t[0],l=h=t[1];for(let e=n;e<r;e+=n)c=t[e],d=t[e+1],c<a&&(a=c),d<l&&(l=d),c>u&&(u=c),d>h&&(h=d);p=Math.max(u-a,h-l),p=0!==p?1/p:0}return Yu(o,s,n,a,l,p),s};function Xu(t,e,n,i,r){let o,s;if(r===function(t,e,n,i){let r=0;for(let o=e,s=n-i;o<n;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}(t,e,n,i)>0)for(o=e;o<n;o+=i)s=ph(o,t[o],t[o+1],s);else for(o=n-i;o>=e;o-=i)s=ph(o,t[o],t[o+1],s);return s&&ah(s,s.next)&&(fh(s),s=s.next),s}function qu(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!ah(i,i.next)&&0!==sh(i.prev,i,i.next))i=i.next;else{if(fh(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Yu(t,e,n,i,r,o,s){if(!t)return;!s&&o&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=nh(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,o,s,a,l,u=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,i=n,a=0,e=0;e<u&&(a++,i=i.nextZ,i);e++);for(l=u;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(s>1)}(r)}(t,i,r,o);let a,l,u=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Ju(t,i,r,o):Zu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),fh(t),t=l.next,u=l.next;else if((t=l)===u){s?1===s?Yu(t=Ku(qu(t),e,n),e,n,i,r,o,2):2===s&&$u(t,e,n,i,r,o):Yu(qu(t),e,n,i,r,o,1);break}}function Zu(t){const e=t.prev,n=t,i=t.next;if(sh(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(rh(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&sh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ju(t,e,n,i){const r=t.prev,o=t,s=t.next;if(sh(r,o,s)>=0)return!1;const a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,l=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,u=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,h=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,c=nh(a,l,e,n,i),d=nh(u,h,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&sh(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&sh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&sh(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&sh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ku(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!ah(r,o)&&lh(r,i,i.next,o)&&ch(r,o)&&ch(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),fh(i),fh(i.next),i=t=o),i=i.next}while(i!==t);return qu(i)}function $u(t,e,n,i,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&oh(s,t)){let a=dh(s,t);return s=qu(s,s.next),a=qu(a,a.next),Yu(s,e,n,i,r,o),void Yu(a,e,n,i,r,o)}t=t.next}s=s.next}while(s!==t)}function Qu(t,e){return t.x-e.x}function th(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let o,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(i===s)return o;const a=o,l=o.x,u=o.y;let h,c=1/0;n=o;do{i>=n.x&&n.x>=l&&i!==n.x&&rh(r<u?i:s,r,l,u,r<u?s:i,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(i-n.x),ch(n,t)&&(h<c||h===c&&(n.x>o.x||n.x===o.x&&eh(o,n)))&&(o=n,c=h)),n=n.next}while(n!==a);return o}(t,e)){const n=dh(e,t);qu(e,e.next),qu(n,n.next)}}function eh(t,e){return sh(t.prev,t,e.prev)<0&&sh(e.next,t,t.next)<0}function nh(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ih(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function rh(t,e,n,i,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(i-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(r-s)*(i-a)>=0}function oh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&lh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(ch(t,e)&&ch(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(sh(t.prev,t,e.prev)||sh(t,e.prev,e))||ah(t,e)&&sh(t.prev,t,t.next)>0&&sh(e.prev,e,e.next)>0)}function sh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ah(t,e){return t.x===e.x&&t.y===e.y}function lh(t,e,n,i){const r=hh(sh(t,e,n)),o=hh(sh(t,e,i)),s=hh(sh(n,i,t)),a=hh(sh(n,i,e));return r!==o&&s!==a||(!(0!==r||!uh(t,n,e))||(!(0!==o||!uh(t,i,e))||(!(0!==s||!uh(n,t,i))||!(0!==a||!uh(n,e,i)))))}function uh(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function hh(t){return t>0?1:t<0?-1:0}function ch(t,e){return sh(t.prev,t,t.next)<0?sh(t,e,t.next)>=0&&sh(t,t.prev,e)>=0:sh(t,e,t.prev)<0||sh(t,t.next,e)<0}function dh(t,e){const n=new mh(t.i,t.x,t.y),i=new mh(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function ph(t,e,n,i){const r=new mh(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function fh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function mh(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class gh{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return gh.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];vh(t),_h(n,t);let o=t.length;e.forEach(vh);for(let t=0;t<e.length;t++)i.push(o),o+=e[t].length,_h(n,e[t]);const s=Wu(n,i);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function vh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function _h(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class yh extends so{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++){o(t[e])}function o(t){const o=[],s=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,u=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:6,c=void 0!==e.bevelSize?e.bevelSize:h-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:xh;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,v,_,y,x,b=!1;f&&(g=f.getSpacedPoints(a),b=!0,u=!1,v=f.computeFrenetFrames(a,!1),_=new pi,y=new pi,x=new pi),u||(p=0,h=0,c=0,d=0);const w=t.extractPoints(s);let T=w.shape;const S=w.holes;if(!gh.isClockWise(T)){T=T.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];gh.isClockWise(e)&&(S[t]=e.reverse())}}const E=gh.triangulateShape(T,S),M=T;for(let t=0,e=S.length;t<e;t++){const e=S[t];T=T.concat(e)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const R=T.length,C=E.length;function P(t,e,n){let i,r,o;const s=t.x-e.x,a=t.y-e.y,l=n.x-t.x,u=n.y-t.y,h=s*s+a*a,c=s*u-a*l;if(Math.abs(c)>Number.EPSILON){const c=Math.sqrt(h),d=Math.sqrt(l*l+u*u),p=e.x-a/c,f=e.y+s/c,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-a*l);i=p+s*m-t.x,r=f+a*m-t.y;const g=i*i+r*r;if(g<=2)return new ei(i,r);o=Math.sqrt(g/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(u)&&(t=!0),t?(i=-a,r=s,o=Math.sqrt(h)):(i=s,r=a,o=Math.sqrt(h/2))}return new ei(i/o,r/o)}const I=[];for(let t=0,e=M.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),I[t]=P(M[t],M[n],M[i]);const O=[];let L,N=I.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];L=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),L[t]=P(e[t],e[i],e[r]);O.push(L),N=N.concat(L)}for(let t=0;t<p;t++){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=M.length;t<e;t++){const e=A(M[t],I[t],i);B(e.x,e.y,-n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];L=O[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],L[t],i);B(r.x,r.y,-n)}}}const D=c+d;for(let t=0;t<R;t++){const e=u?A(T[t],N[t],D):T[t];b?(y.copy(v.normals[0]).multiplyScalar(e.x),_.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(_),B(x.x,x.y,x.z)):B(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<R;e++){const n=u?A(T[e],N[e],D):T[e];b?(y.copy(v.normals[t]).multiplyScalar(n.x),_.copy(v.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(y).add(_),B(x.x,x.y,x.z)):B(n.x,n.y,l/a*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=M.length;t<e;t++){const e=A(M[t],I[t],i);B(e.x,e.y,l+n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];L=O[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],L[t],i);b?B(r.x,r.y+g[a-1].y,g[a-1].x+n):B(r.x,r.y,l+n)}}}function F(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=R*t,o=R*(t+1);k(e+i+n,e+r+n,e+r+o,e+i+o)}}}function B(t,e,n){o.push(t),o.push(e),o.push(n)}function U(t,e,r){G(t),G(e),G(r);const o=i.length/3,s=m.generateTopUV(n,i,o-3,o-2,o-1);H(s[0]),H(s[1]),H(s[2])}function k(t,e,r,o){G(t),G(e),G(o),G(e),G(r),G(o);const s=i.length/3,a=m.generateSideWallUV(n,i,s-6,s-3,s-2,s-1);H(a[0]),H(a[1]),H(a[3]),H(a[1]),H(a[2]),H(a[3])}function G(t){i.push(o[3*t+0]),i.push(o[3*t+1]),i.push(o[3*t+2])}function H(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(u){let t=0,e=R*t;for(let t=0;t<C;t++){const n=E[t];U(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=R*t;for(let t=0;t<C;t++){const n=E[t];U(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<C;t++){const e=E[t];U(e[2],e[1],e[0])}for(let t=0;t<C;t++){const e=E[t];U(e[0]+R*a,e[1]+R*a,e[2]+R*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;F(M,e),e+=M.length;for(let t=0,n=S.length;t<n;t++){const n=S[t];F(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Yr(i,3)),this.setAttribute("uv",new Yr(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Vu[i.type]).fromJSON(i)),new yh(n,t.options)}}const xh={generateTopUV:function(t,e,n,i,r){const o=e[3*n],s=e[3*n+1],a=e[3*i],l=e[3*i+1],u=e[3*r],h=e[3*r+1];return[new ei(o,s),new ei(a,l),new ei(u,h)]},generateSideWallUV:function(t,e,n,i,r,o){const s=e[3*n],a=e[3*n+1],l=e[3*n+2],u=e[3*i],h=e[3*i+1],c=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(a-h)<Math.abs(s-u)?[new ei(s,1-l),new ei(u,1-c),new ei(d,1-f),new ei(m,1-v)]:[new ei(a,1-l),new ei(h,1-c),new ei(p,1-f),new ei(g,1-v)]}};class bh extends _u{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new bh(t.radius,t.detail)}}class wh extends so{constructor(t,e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Yn(i,0,2*Math.PI);const r=[],o=[],s=[],a=1/e,l=new pi,u=new ei;for(let r=0;r<=e;r++){const h=n+r*a*i,c=Math.sin(h),d=Math.cos(h);for(let n=0;n<=t.length-1;n++)l.x=t[n].x*c,l.y=t[n].y,l.z=t[n].x*d,o.push(l.x,l.y,l.z),u.x=r/e,u.y=n/(t.length-1),s.push(u.x,u.y)}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,o=i,s=i+t.length,a=i+t.length+1,l=i+1;r.push(o,s,l),r.push(s,a,l)}if(this.setIndex(r),this.setAttribute("position",new Yr(o,3)),this.setAttribute("uv",new Yr(s,2)),this.computeVertexNormals(),i===2*Math.PI){const n=this.attributes.normal.array,i=new pi,r=new pi,o=new pi,s=e*t.length*3;for(let e=0,a=0;e<t.length;e++,a+=3)i.x=n[a+0],i.y=n[a+1],i.z=n[a+2],r.x=n[s+a+0],r.y=n[s+a+1],r.z=n[s+a+2],o.addVectors(i,r).normalize(),n[a+0]=n[s+a+0]=o.x,n[a+1]=n[s+a+1]=o.y,n[a+2]=n[s+a+2]=o.z}}static fromJSON(t){return new wh(t.points,t.segments,t.phiStart,t.phiLength)}}class Th extends _u{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Th(t.radius,t.detail)}}class Sh extends so{constructor(t,e,n){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};const i=[],r=[],o=[],s=[],a=1e-5,l=new pi,u=new pi,h=new pi,c=new pi,d=new pi;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=e+1;for(let i=0;i<=n;i++){const p=i/n;for(let n=0;n<=e;n++){const i=n/e;t(i,p,u),r.push(u.x,u.y,u.z),i-a>=0?(t(i-a,p,h),c.subVectors(u,h)):(t(i+a,p,h),c.subVectors(h,u)),p-a>=0?(t(i,p-a,h),d.subVectors(u,h)):(t(i,p+a,h),d.subVectors(h,u)),l.crossVectors(c,d).normalize(),o.push(l.x,l.y,l.z),s.push(i,p)}}for(let t=0;t<n;t++)for(let n=0;n<e;n++){const e=t*p+n,r=t*p+n+1,o=(t+1)*p+n+1,s=(t+1)*p+n;i.push(e,r,s),i.push(r,o,s)}this.setIndex(i),this.setAttribute("position",new Yr(r,3)),this.setAttribute("normal",new Yr(o,3)),this.setAttribute("uv",new Yr(s,2))}}class Eh extends so{constructor(t=.5,e=1,n=8,i=1,r=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n);const s=[],a=[],l=[],u=[];let h=t;const c=(e-t)/(i=Math.max(1,i)),d=new pi,p=new ei;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*o;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,u.push(p.x,p.y)}h+=c}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,o=i+n+1,a=i+n+2,l=i+1;s.push(r,o,l),s.push(o,a,l)}}this.setIndex(s),this.setAttribute("position",new Yr(a,3)),this.setAttribute("normal",new Yr(l,3)),this.setAttribute("uv",new Yr(u,2))}static fromJSON(t){return new Eh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Mh extends so{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],o=[];let s=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,a,e),s+=a,a=0;function l(t){const s=i.length/3,l=t.extractPoints(e);let u=l.shape;const h=l.holes;!1===gh.isClockWise(u)&&(u=u.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===gh.isClockWise(e)&&(h[t]=e.reverse())}const c=gh.triangulateShape(u,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];u=u.concat(e)}for(let t=0,e=u.length;t<e;t++){const e=u[t];i.push(e.x,e.y,0),r.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=c.length;t<e;t++){const e=c[t],i=e[0]+s,r=e[1]+s,o=e[2]+s;n.push(i,r,o),a+=3}}this.setIndex(n),this.setAttribute("position",new Yr(i,3)),this.setAttribute("normal",new Yr(r,3)),this.setAttribute("uv",new Yr(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Mh(n,t.curveSegments)}}class Ah extends so{constructor(t=1,e=8,n=6,i=0,r=2*Math.PI,o=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:s},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(o+s,Math.PI);let l=0;const u=[],h=new pi,c=new pi,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let _=0;0==d&&0==o?_=.5/e:d==n&&a==Math.PI&&(_=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(i+a*r)*Math.sin(o+v*s),h.y=t*Math.cos(o+v*s),h.z=t*Math.sin(i+a*r)*Math.sin(o+v*s),p.push(h.x,h.y,h.z),c.copy(h).normalize(),f.push(c.x,c.y,c.z),m.push(a+_,1-v),g.push(l++)}u.push(g)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=u[t][i+1],r=u[t][i],s=u[t+1][i],l=u[t+1][i+1];(0!==t||o>0)&&d.push(e,r,l),(t!==n-1||a<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new Yr(p,3)),this.setAttribute("normal",new Yr(f,3)),this.setAttribute("uv",new Yr(m,2))}static fromJSON(t){return new Ah(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Rh extends _u{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Rh(t.radius,t.detail)}}class Ch extends yh{constructor(t,e={}){const n=e.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new so;const i=n.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(i,e),this.type="TextGeometry"}}class Ph extends so{constructor(t=1,e=.4,n=8,i=6,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],s=[],a=[],l=[],u=new pi,h=new pi,c=new pi;for(let o=0;o<=n;o++)for(let d=0;d<=i;d++){const p=d/i*r,f=o/n*Math.PI*2;h.x=(t+e*Math.cos(f))*Math.cos(p),h.y=(t+e*Math.cos(f))*Math.sin(p),h.z=e*Math.sin(f),s.push(h.x,h.y,h.z),u.x=t*Math.cos(p),u.y=t*Math.sin(p),c.subVectors(h,u).normalize(),a.push(c.x,c.y,c.z),l.push(d/i),l.push(o/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,s=(i+1)*(t-1)+e,a=(i+1)*t+e;o.push(n,r,a),o.push(r,s,a)}this.setIndex(o),this.setAttribute("position",new Yr(s,3)),this.setAttribute("normal",new Yr(a,3)),this.setAttribute("uv",new Yr(l,2))}static fromJSON(t){return new Ph(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Ih extends so{constructor(t=1,e=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const s=[],a=[],l=[],u=[],h=new pi,c=new pi,d=new pi,p=new pi,f=new pi,m=new pi,g=new pi;for(let s=0;s<=n;++s){const _=s/n*r*Math.PI*2;v(_,r,o,t,d),v(_+.01,r,o,t,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,o=-e*Math.cos(r),p=e*Math.sin(r);h.x=d.x+(o*g.x+p*f.x),h.y=d.y+(o*g.y+p*f.y),h.z=d.z+(o*g.z+p*f.z),a.push(h.x,h.y,h.z),c.subVectors(h,d).normalize(),l.push(c.x,c.y,c.z),u.push(s/n),u.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),o=(i+1)*t+e,a=(i+1)*(t-1)+e;s.push(n,r,a),s.push(r,o,a)}function v(t,e,n,i,r){const o=Math.cos(t),s=Math.sin(t),a=n/e*t,l=Math.cos(a);r.x=i*(2+l)*.5*o,r.y=i*(2+l)*s*.5,r.z=i*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new Yr(a,3)),this.setAttribute("normal",new Yr(l,3)),this.setAttribute("uv",new Yr(u,2))}static fromJSON(t){return new Ih(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Oh extends so{constructor(t,e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const s=new pi,a=new pi,l=new ei;let u=new pi;const h=[],c=[],d=[],p=[];function f(r){u=t.getPointAt(r/e,u);const l=o.normals[r],d=o.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),o=-Math.cos(e);a.x=o*l.x+r*d.x,a.y=o*l.y+r*d.y,a.z=o*l.z+r*d.z,a.normalize(),c.push(a.x,a.y,a.z),s.x=u.x+n*a.x,s.y=u.y+n*a.y,s.z=u.z+n*a.z,h.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),o=(i+1)*t+e,s=(i+1)*(t-1)+e;p.push(n,r,s),p.push(r,o,s)}}()}(),this.setIndex(p),this.setAttribute("position",new Yr(h,3)),this.setAttribute("normal",new Yr(c,3)),this.setAttribute("uv",new Yr(d,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Oh((new Vu[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Lh extends so{constructor(t){if(super(),this.type="WireframeGeometry",!0===t.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const e=[],n=[0,0],i={},r=new pi;if(null!==t.index){const o=t.attributes.position,s=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let t=0,e=a.length;t<e;++t){const e=a[t],r=e.start;for(let t=r,o=r+e.count;t<o;t+=3)for(let e=0;e<3;e++){const r=s.getX(t+e),o=s.getX(t+(e+1)%3);n[0]=Math.min(r,o),n[1]=Math.max(r,o);const a=n[0]+","+n[1];void 0===i[a]&&(i[a]={index1:n[0],index2:n[1]})}}for(const t in i){const n=i[t];r.fromBufferAttribute(o,n.index1),e.push(r.x,r.y,r.z),r.fromBufferAttribute(o,n.index2),e.push(r.x,r.y,r.z)}}else{const n=t.attributes.position;for(let t=0,i=n.count/3;t<i;t++)for(let i=0;i<3;i++){const o=3*t+i;r.fromBufferAttribute(n,o),e.push(r.x,r.y,r.z);const s=3*t+(i+1)%3;r.fromBufferAttribute(n,s),e.push(r.x,r.y,r.z)}}this.setAttribute("position",new Yr(e,3))}}var Nh=Object.freeze({__proto__:null,BoxGeometry:Ao,BoxBufferGeometry:Ao,CircleGeometry:mu,CircleBufferGeometry:mu,ConeGeometry:vu,ConeBufferGeometry:vu,CylinderGeometry:gu,CylinderBufferGeometry:gu,DodecahedronGeometry:yu,DodecahedronBufferGeometry:yu,EdgesGeometry:Su,ExtrudeGeometry:yh,ExtrudeBufferGeometry:yh,IcosahedronGeometry:bh,IcosahedronBufferGeometry:bh,LatheGeometry:wh,LatheBufferGeometry:wh,OctahedronGeometry:Th,OctahedronBufferGeometry:Th,ParametricGeometry:Sh,ParametricBufferGeometry:Sh,PlaneGeometry:Xo,PlaneBufferGeometry:Xo,PolyhedronGeometry:_u,PolyhedronBufferGeometry:_u,RingGeometry:Eh,RingBufferGeometry:Eh,ShapeGeometry:Mh,ShapeBufferGeometry:Mh,SphereGeometry:Ah,SphereBufferGeometry:Ah,TetrahedronGeometry:Rh,TetrahedronBufferGeometry:Rh,TextGeometry:Ch,TextBufferGeometry:Ch,TorusGeometry:Ph,TorusBufferGeometry:Ph,TorusKnotGeometry:Ih,TorusKnotBufferGeometry:Ih,TubeGeometry:Oh,TubeBufferGeometry:Oh,WireframeGeometry:Lh});class Dh extends Rr{constructor(t){super(),this.type="ShadowMaterial",this.color=new Dr(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Dh.prototype.isShadowMaterial=!0;class Fh extends Io{constructor(t){super(t),this.type="RawShaderMaterial"}}Fh.prototype.isRawShaderMaterial=!0;class Bh extends Rr{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Dr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}Bh.prototype.isMeshStandardMaterial=!0;class Uh extends Bh{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ei(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=Yn(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Dr(1,1,1),this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Dr).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this}}Uh.prototype.isMeshPhysicalMaterial=!0;class kh extends Rr{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Dr(16777215),this.specular=new Dr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=et,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}kh.prototype.isMeshPhongMaterial=!0;class Gh extends Rr{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Dr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Gh.prototype.isMeshToonMaterial=!0;class Hh extends Rr{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Hh.prototype.isMeshNormalMaterial=!0;class zh extends Rr{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Dr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=et,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}zh.prototype.isMeshLambertMaterial=!0;class jh extends Rr{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Dr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}jh.prototype.isMeshMatcapMaterial=!0;class Vh extends ql{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Vh.prototype.isLineDashedMaterial=!0;var Wh=Object.freeze({__proto__:null,ShadowMaterial:Dh,SpriteMaterial:dl,RawShaderMaterial:Fh,ShaderMaterial:Io,PointsMaterial:ru,MeshPhysicalMaterial:Uh,MeshStandardMaterial:Bh,MeshPhongMaterial:kh,MeshToonMaterial:Gh,MeshNormalMaterial:Hh,MeshLambertMaterial:zh,MeshDepthMaterial:Xa,MeshDistanceMaterial:qa,MeshBasicMaterial:Fr,MeshMatcapMaterial:jh,LineDashedMaterial:Vh,LineBasicMaterial:ql,Material:Rr});const Xh={arraySlice:function(t,e,n){return Xh.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let o=0,s=0;s!==i;++o){const i=n[o]*e;for(let n=0;n!==e;++n)r[s++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,o=t[0];for(;void 0!==o&&void 0===o[i];)o=t[r++];if(void 0===o)return;let s=o[i];if(void 0!==s)if(Array.isArray(s))do{s=o[i],void 0!==s&&(e.push(o.time),n.push.apply(n,s)),o=t[r++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[i],void 0!==s&&(e.push(o.time),s.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{s=o[i],void 0!==s&&(e.push(o.time),n.push(s)),o=t[r++]}while(void 0!==o)},subclip:function(t,e,n,i,r=30){const o=t.clone();o.name=e;const s=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],a=e.getValueSize(),l=[],u=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*r;if(!(o<n||o>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)u.push(e.values[t*a+n])}}0!==l.length&&(e.times=Xh.convertArray(l,e.times.constructor),e.values=Xh.convertArray(u,e.values.constructor),s.push(e))}o.tracks=s;let a=1/0;for(let t=0;t<o.tracks.length;++t)a>o.tracks[t].times[0]&&(a=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,o=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===s)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let u=0;const h=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);const c=i.times.length-1;let d;if(o<=i.times[0]){const t=a,e=l-a;d=Xh.arraySlice(i.values,t,e)}else if(o>=i.times[c]){const t=c*l+a,e=t+l-a;d=Xh.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(o),d=Xh.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new di).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*h+u;if("quaternion"===r)di.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=h-2*u;for(let n=0;n<t;++n)s.values[e+n]-=d[n]}}}return t.blendMode=$e,t}};class qh{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let o;n:{i:if(!(t<i)){for(let o=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===o)break;if(r=i,i=e[++n],t<i)break e}o=e.length;break n}if(t>=r)break t;{const s=e[1];t<s&&(n=2,r=s);for(let o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===o)break;if(i=r,r=e[--n-1],t>=r)break e}o=n,n=0}}for(;n<o;){const i=n+o>>>1;t<e[i]?o=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}qh.prototype.beforeStart_=qh.prototype.copySampleValue_,qh.prototype.afterEnd_=qh.prototype.copySampleValue_;class Yh extends qh{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ye,endingEnd:Ye}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,o=t+1,s=i[r],a=i[o];if(void 0===s)switch(this.getSettings_().endingStart){case Ze:r=t,s=2*e-n;break;case Je:r=i.length-2,s=e+i[r]-i[r+1];break;default:r=t,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Ze:o=t,a=2*n-e;break;case Je:o=1,a=n+i[1]-i[0];break;default:o=t-1,a=e}const l=.5*(n-e),u=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(a-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,u=this._offsetPrev,h=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,v=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*o[u+t]+v*o[l+t]+_*o[a+t]+y*o[h+t];return r}}class Zh extends qh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,u=(n-e)/(i-e),h=1-u;for(let t=0;t!==s;++t)r[t]=o[l+t]*h+o[a+t]*u;return r}}class Jh extends qh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Kh{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xh.convertArray(e,this.TimeBufferType),this.values=Xh.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Xh.convertArray(t.times,Array),values:Xh.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Jh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Zh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Yh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case We:e=this.InterpolantFactoryMethodDiscrete;break;case Xe:e=this.InterpolantFactoryMethodLinear;break;case qe:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return We;case this.InterpolantFactoryMethodLinear:return Xe;case this.InterpolantFactoryMethodSmooth:return qe}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=Xh.arraySlice(n,r,o),this.values=Xh.arraySlice(this.values,r*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==o&&o>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,o),t=!1;break}o=i}if(void 0!==i&&Xh.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Xh.arraySlice(this.times),e=Xh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===qe,r=t.length-1;let o=1;for(let s=1;s<r;++s){let r=!1;const a=t[s];if(a!==t[s+1]&&(1!==s||a!==t[0]))if(i)r=!0;else{const t=s*n,i=t-n,o=t+n;for(let s=0;s!==n;++s){const n=e[t+s];if(n!==e[i+s]||n!==e[o+s]){r=!0;break}}}if(r){if(s!==o){t[o]=t[s];const i=s*n,r=o*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++o}}if(r>0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o}return o!==t.length?(this.times=Xh.arraySlice(t,0,o),this.values=Xh.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this}clone(){const t=Xh.arraySlice(this.times,0),e=Xh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Kh.prototype.TimeBufferType=Float32Array,Kh.prototype.ValueBufferType=Float32Array,Kh.prototype.DefaultInterpolation=Xe;class $h extends Kh{}$h.prototype.ValueTypeName="bool",$h.prototype.ValueBufferType=Array,$h.prototype.DefaultInterpolation=We,$h.prototype.InterpolantFactoryMethodLinear=void 0,$h.prototype.InterpolantFactoryMethodSmooth=void 0;class Qh extends Kh{}Qh.prototype.ValueTypeName="color";class tc extends Kh{}tc.prototype.ValueTypeName="number";class ec extends qh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)di.slerpFlat(r,0,o,l-s,o,l,a);return r}}class nc extends Kh{InterpolantFactoryMethodLinear(t){return new ec(this.times,this.values,this.getValueSize(),t)}}nc.prototype.ValueTypeName="quaternion",nc.prototype.DefaultInterpolation=Xe,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends Kh{}ic.prototype.ValueTypeName="string",ic.prototype.ValueBufferType=Array,ic.prototype.DefaultInterpolation=We,ic.prototype.InterpolantFactoryMethodLinear=void 0,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class rc extends Kh{}rc.prototype.ValueTypeName="vector";class oc{constructor(t,e=-1,n,i=Ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=qn(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(sc(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Kh.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,o=[];for(let t=0;t<r;t++){let s=[],a=[];s.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=Xh.getKeyframeOrder(s);s=Xh.sortedArray(s,1,l),a=Xh.sortedArray(a,1,l),i||0!==s[0]||(s.push(r),a.push(a[0])),o.push(new tc(".morphTargetInfluences["+e[t].name+"]",s,a).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name.match(r);if(o&&o.length>1){const t=o[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const o=[];for(const t in i)o.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],s=[];Xh.flattenJSON(n,o,s,i),0!==o.length&&r.push(new t(e,o,s))}},i=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],o=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),o.push(i.morphTarget===n?1:0)}i.push(new tc(".morphTargetInfluence["+n+"]",t,o))}a=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";n(rc,o+".position",r,"pos",i),n(nc,o+".quaternion",r,"rot",i),n(rc,o+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,a,i,s)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function sc(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return tc;case"vector":case"vector2":case"vector3":case"vector4":return rc;case"color":return Qh;case"quaternion":return nc;case"bool":case"boolean":return $h;case"string":return ic}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Xh.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const ac={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class lc{constructor(t,e,n){const i=this;let r=!1,o=0,s=0,a=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,s),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,s),o===s&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const uc=new lc;class hc{constructor(t){this.manager=void 0!==t?t:uc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const cc={};class dc extends hc{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=ac.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;if(void 0!==cc[t])return void cc[t].push({onLoad:e,onProgress:n,onError:i});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const n=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let i;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);i="blob"===o?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;i=e.parseFromString(a,n);break;case"json":i=JSON.parse(a);break;default:i=a}setTimeout((function(){e&&e(i),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{cc[t]=[],cc[t].push({onLoad:e,onProgress:n,onError:i}),a=new XMLHttpRequest,a.open("GET",t,!0),a.addEventListener("load",(function(e){const n=this.response,i=cc[t];if(delete cc[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ac.add(t,n);for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onLoad&&e.onLoad(n)}r.manager.itemEnd(t)}else{for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),a.addEventListener("progress",(function(e){const n=cc[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onProgress&&i.onProgress(e)}}),!1),a.addEventListener("error",(function(e){const n=cc[t];delete cc[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),a.addEventListener("abort",(function(e){const n=cc[t];delete cc[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class pc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=oc.parse(t[n]);e.push(i)}return e}}class fc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=[],s=new du,a=new dc(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function u(u){a.load(t[u],(function(t){const n=r.parse(t,!0);o[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(s.minFilter=Et),s.image=o,s.format=n.format,s.needsUpdate=!0,e&&e(s))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)u(e);else a.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){o[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)o[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),o[e].format=n.format,o[e].width=n.width,o[e].height=n.height}s.image=o}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=Et),s.format=n.format,s.needsUpdate=!0,e&&e(s)}),n,i);return s}}class mc extends hc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=ac.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),ac.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class gc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=new Do,o=new mc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(t[n],(function(t){r.images[n]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class vc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new Ul,s=new dc(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(t,(function(t){const n=r.parse(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:_t,o.wrapT=void 0!==n.wrapT?n.wrapT:_t,o.magFilter=void 0!==n.magFilter?n.magFilter:Et,o.minFilter=void 0!==n.minFilter?n.minFilter:Et,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=Rt),1===n.mipmapCount&&(o.minFilter=Et),void 0!==n.generateMipmaps&&(o.generateMipmaps=n.generateMipmaps),o.needsUpdate=!0,e&&e(o,n))}),n,i),o}}class _c extends hc{constructor(t){super(t)}load(t,e,n,i){const r=new si,o=new mc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(n){r.image=n;const i=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=i?jt:Vt,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class yc extends Eu{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new ku(e,t))}getPoint(t){const e=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=e){const t=n[i]-e,r=this.curves[i],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],s=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,a=o.getPoints(s);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Vu[n.type]).fromJSON(n))}return this}}class xc extends yc{constructor(t){super(),this.type="Path",this.currentPoint=new ei,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new ku(this.currentPoint.clone(),new ei(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Hu(this.currentPoint.clone(),new ei(t,e),new ei(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,o){const s=new Bu(this.currentPoint.clone(),new ei(t,e),new ei(n,i),new ei(r,o));return this.curves.push(s),this.currentPoint.set(r,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new ju(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+s,e+a,n,i,r,o),this}absarc(t,e,n,i,r,o){return this.absellipse(t,e,n,n,i,r,o),this}ellipse(t,e,n,i,r,o,s,a){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+l,e+u,n,i,r,o,s,a),this}absellipse(t,e,n,i,r,o,s,a){const l=new Mu(t,e,n,i,r,o,s,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class bc extends xc{constructor(t){super(t),this.uuid=qn(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new xc).fromJSON(n))}return this}}class wc extends mr{constructor(t,e=1){super(),this.type="Light",this.color=new Dr(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}wc.prototype.isLight=!0;class Tc extends wc{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.groundColor=new Dr(e)}copy(t){return wc.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Tc.prototype.isHemisphereLight=!0;const Sc=new Vi,Ec=new pi,Mc=new pi;class Ac{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new ei(512,512),this.map=null,this.mapPass=null,this.matrix=new Vi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new jo,this._frameExtents=new ei(1,1),this._viewportCount=1,this._viewports=[new li(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Ec.setFromMatrixPosition(t.matrixWorld),e.position.copy(Ec),Mc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Mc),e.updateMatrixWorld(),Sc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Rc extends Ac{constructor(){super(new Lo(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*Xn*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Rc.prototype.isSpotLightShadow=!0;class Cc extends wc{constructor(t,e,n=0,i=Math.PI/3,r=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.target=new mr,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.shadow=new Rc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Cc.prototype.isSpotLight=!0;const Pc=new Vi,Ic=new pi,Oc=new pi;class Lc extends Ac{constructor(){super(new Lo(90,1,.5,500)),this._frameExtents=new ei(4,2),this._viewportCount=6,this._viewports=[new li(2,1,1,1),new li(0,1,1,1),new li(3,1,1,1),new li(1,1,1,1),new li(3,0,1,1),new li(1,0,1,1)],this._cubeDirections=[new pi(1,0,0),new pi(-1,0,0),new pi(0,0,1),new pi(0,0,-1),new pi(0,1,0),new pi(0,-1,0)],this._cubeUps=[new pi(0,1,0),new pi(0,1,0),new pi(0,1,0),new pi(0,1,0),new pi(0,0,1),new pi(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ic.setFromMatrixPosition(t.matrixWorld),n.position.copy(Ic),Oc.copy(n.position),Oc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Oc),n.updateMatrixWorld(),i.makeTranslation(-Ic.x,-Ic.y,-Ic.z),Pc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pc)}}Lc.prototype.isPointLightShadow=!0;class Nc extends wc{constructor(t,e,n=0,i=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Lc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Nc.prototype.isPointLight=!0;class Dc extends Oo{constructor(t=-1,e=1,n=1,i=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,o=n+t,s=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,s-=e*this.view.offsetY,a=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Dc.prototype.isOrthographicCamera=!0;class Fc extends Ac{constructor(){super(new Dc(-5,5,5,-5,.5,500))}}Fc.prototype.isDirectionalLightShadow=!0;class Bc extends wc{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.target=new mr,this.shadow=new Fc}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Bc.prototype.isDirectionalLight=!0;class Uc extends wc{constructor(t,e){super(t,e),this.type="AmbientLight"}}Uc.prototype.isAmbientLight=!0;class kc extends wc{constructor(t,e,n=10,i=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=i}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}kc.prototype.isRectAreaLight=!0;class Gc{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new pi)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*i),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*i*1.092548),e.addScaledVector(o[5],i*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],n*r*1.092548),e.addScaledVector(o[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*i),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*i),e.addScaledVector(o[5],.858086*i*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*n*r),e.addScaledVector(o[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}Gc.prototype.isSphericalHarmonics3=!0;class Hc extends wc{constructor(t=new Gc,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}Hc.prototype.isLightProbe=!0;class zc extends hc{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,o=new dc(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=new Wh[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=(new Dr).setHex(t.sheen)),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),1!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(i.morphNormals=t.morphNormals),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.vertexTangents&&(i.vertexTangents=t.vertexTangents),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new Dr).setHex(r.value);break;case"v2":i.uniforms[e].value=(new ei).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new pi).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new li).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new ni).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Vi).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new ei).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new ei).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),i}setTextures(t){return this.textures=t,this}}class jc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class Vc extends so{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}Vc.prototype.isInstancedBufferGeometry=!0;class Wc extends kr{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}Wc.prototype.isInstancedBufferAttribute=!0;class Xc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],o=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),s=$r(r.type,o),a=new ul(s,r.stride);return a.uuid=r.uuid,e[i]=a,a}const r=t.isInstancedBufferGeometry?new Vc:new so,o=t.data.index;if(void 0!==o){const t=$r(o.type,o.array);r.setIndex(new kr(t,1))}const s=t.data.attributes;for(const e in s){const n=s[e];let o;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);o=new cl(e,n.itemSize,n.offset,n.normalized)}else{const t=$r(n.type,n.array);o=new(n.isInstancedBufferAttribute?Wc:kr)(t,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),void 0!==n.usage&&o.setUsage(n.usage),void 0!==n.updateRange&&(o.updateRange.offset=n.updateRange.offset,o.updateRange.count=n.updateRange.count),r.setAttribute(e,o)}const a=t.data.morphAttributes;if(a)for(const e in a){const n=a[e],o=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let s;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);s=new cl(e,r.itemSize,r.offset,r.normalized)}else{const t=$r(r.type,r.array);s=new kr(t,r.itemSize,r.normalized)}void 0!==r.name&&(s.name=r.name),o.push(s)}r.morphAttributes[e]=o}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];r.addGroup(e.start,e.count,e.materialIndex)}const u=t.data.boundingSphere;if(void 0!==u){const t=new pi;void 0!==u.center&&t.fromArray(u.center),r.boundingSphere=new Di(t,u.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class qc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=""===this.path?jc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||o;const s=new dc(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){let o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const s=o.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,i)}async loadAsync(t,e){const n=""===this.path?jc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new dc(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),o=JSON.parse(r),s=o.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),o=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),s=this.parseTextures(t.textures,o),a=this.parseMaterials(t.materials,s),l=this.parseObject(t.object,r,a,s,n),u=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,u),void 0!==e){let t=!1;for(const e in o)if(o[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),o=this.parseTextures(t.textures,r),s=this.parseMaterials(t.materials,o),a=this.parseObject(t.object,i,s,o,e),l=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,l),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new bc).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new Hl).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new Xc;for(let r=0,o=t.length;r<o;r++){let o;const s=t[r];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:s.type in Nh?o=Nh[s.type].fromJSON(s,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${s.type}"`)}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new zc;r.setTextures(e);for(let e=0,o=t.length;e<o;e++){const o=t[e];if("MultiMaterial"===o.type){const t=[];for(let e=0;e<o.materials.length;e++){const i=o.materials[e];void 0===n[i.uuid]&&(n[i.uuid]=r.parse(i)),t.push(n[i.uuid])}i[o.uuid]=t}else void 0===n[o.uuid]&&(n[o.uuid]=r.parse(o)),i[o.uuid]=n[o.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=oc.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function o(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:$r(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new lc(e);r=new mc(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){i[n.uuid]=[];for(let t=0,e=r.length;t<e;t++){const e=o(r[t]);null!==e&&(e instanceof HTMLImageElement?i[n.uuid].push(e):i[n.uuid].push(new Ul(e.data,e.width,e.height)))}}else{const t=o(n.url);null!==t&&(i[n.uuid]=t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:$r(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new mc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],o=i.url;if(Array.isArray(o)){n[i.uuid]=[];for(let t=0,e=o.length;t<e;t++){const e=o[t],s=await r(e);null!==s&&(s instanceof HTMLImageElement?n[i.uuid].push(s):n[i.uuid].push(new Ul(s.data,s.width,s.height)))}}else{const t=await r(i.url);null!==t&&(n[i.uuid]=t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,o=t.length;r<o;r++){const o=t[r];let s;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const a=e[o.image];Array.isArray(a)?(s=new Do(a),6===a.length&&(s.needsUpdate=!0)):(s=a&&a.data?new Ul(a.data,a.width,a.height):new si(a),a&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,Yc)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],Zc),s.wrapT=n(o.wrap[1],Zc)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,Jc)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,Jc)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),i[o.uuid]=s}return i}parseObject(t,e,n,i,r){let o,s,a;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function u(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function h(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":o=new ll,void 0!==t.background&&(Number.isInteger(t.background)?o.background=new Dr(t.background):o.background=h(t.background)),void 0!==t.environment&&(o.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new al(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new sl(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new Lo(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new Dc(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new Uc(t.color,t.intensity);break;case"DirectionalLight":o=new Bc(t.color,t.intensity);break;case"PointLight":o=new Nc(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new kc(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new Cc(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new Tc(t.color,t.groundColor,t.intensity);break;case"LightProbe":o=(new Hc).fromJSON(t);break;case"SkinnedMesh":s=l(t.geometry),a=u(t.material),o=new Fl(s,a),void 0!==t.bindMode&&(o.bindMode=t.bindMode),void 0!==t.bindMatrix&&o.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(o.skeleton=t.skeleton);break;case"Mesh":s=l(t.geometry),a=u(t.material),o=new Eo(s,a);break;case"InstancedMesh":s=l(t.geometry),a=u(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;o=new Xl(s,a,e),o.instanceMatrix=new kr(new Float32Array(n.array),16),void 0!==i&&(o.instanceColor=new kr(new Float32Array(i.array),i.itemSize));break;case"LOD":o=new Pl;break;case"Line":o=new Ql(l(t.geometry),u(t.material));break;case"LineLoop":o=new iu(l(t.geometry),u(t.material));break;case"LineSegments":o=new nu(l(t.geometry),u(t.material));break;case"PointCloud":case"Points":o=new uu(l(t.geometry),u(t.material));break;case"Sprite":o=new Ml(u(t.material));break;case"Group":o=new Qa;break;case"Bone":o=new Bl;break;default:o=new mr}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(o.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),void 0!==t.children){const s=t.children;for(let t=0;t<s.length;t++)o.add(this.parseObject(s[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];o.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(o.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=o.getObjectByProperty("uuid",n.object);void 0!==i&&o.addLevel(i,n.distance)}}return o}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const Yc={UVMapping:ht,CubeReflectionMapping:ct,CubeRefractionMapping:dt,EquirectangularReflectionMapping:pt,EquirectangularRefractionMapping:ft,CubeUVReflectionMapping:mt,CubeUVRefractionMapping:gt},Zc={RepeatWrapping:vt,ClampToEdgeWrapping:_t,MirroredRepeatWrapping:yt},Jc={NearestFilter:xt,NearestMipmapNearestFilter:bt,NearestMipmapLinearFilter:Tt,LinearFilter:Et,LinearMipmapNearestFilter:Mt,LinearMipmapLinearFilter:Rt};class Kc extends hc{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=ac.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){ac.add(t,n),e&&e(n),r.manager.itemEnd(t)})).catch((function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}Kc.prototype.isImageBitmapLoader=!0;class $c{constructor(){this.type="ShapePath",this.color=new Dr,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new xc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,o){return this.currentPath.bezierCurveTo(t,e,n,i,r,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new bc;r.curves=i.curves,e.push(r)}return e}function i(t,e){const n=e.length;let i=!1;for(let r=n-1,o=0;o<n;r=o++){let n=e[r],s=e[o],a=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[o],a=-a,s=e[r],l=-l),t.y<n.y||t.y>s.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(s.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=s.x)return!0}}return i}const r=gh.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let s,a,l;const u=[];if(1===o.length)return a=o[0],l=new bc,l.curves=a.curves,u.push(l),u;let h=!r(o[0].getPoints());h=t?!h:h;const c=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,n=o.length;e<n;e++)a=o[e],p=a.getPoints(),s=r(p),s=t?!s:s,s?(!h&&d[g]&&g++,d[g]={s:new bc,p:p},d[g].s.curves=a.curves,h&&g++,m[g]=[]):m[g].push({h:a,p:p[0]});if(!d[0])return n(o);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)c[t]=[];for(let n=0,r=d.length;n<r;n++){const r=m[n];for(let o=0;o<r.length;o++){const s=r[o];let a=!0;for(let r=0;r<d.length;r++)i(s.p,d[r].p)&&(n!==r&&e.push({froms:n,tos:r,hole:o}),a?(a=!1,c[r].push(s)):t=!0);a&&c[n].push(s)}}e.length>0&&(t||(m=c))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,u.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return u}}class Qc{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],i=function(t,e,n){const i=Array.from(t),r=e/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,s=[];let a=0,l=0;for(let t=0;t<i.length;t++){const e=i[t];if("\n"===e)a=0,l-=o;else{const t=td(e,r,a,l,n);a+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=i.length;t<e;t++)Array.prototype.push.apply(n,i[t].toShapes());return n}}function td(t,e,n,i,r){const o=r.glyphs[t]||r.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const s=new $c;let a,l,u,h,c,d,p,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let r=0,o=t.length;r<o;){switch(t[r++]){case"m":a=t[r++]*e+n,l=t[r++]*e+i,s.moveTo(a,l);break;case"l":a=t[r++]*e+n,l=t[r++]*e+i,s.lineTo(a,l);break;case"q":u=t[r++]*e+n,h=t[r++]*e+i,c=t[r++]*e+n,d=t[r++]*e+i,s.quadraticCurveTo(c,d,u,h);break;case"b":u=t[r++]*e+n,h=t[r++]*e+i,c=t[r++]*e+n,d=t[r++]*e+i,p=t[r++]*e+n,f=t[r++]*e+i,s.bezierCurveTo(c,d,p,f,u,h)}}}return{offsetX:o.ha*e,path:s}}Qc.prototype.isFont=!0;class ed extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){let n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const i=r.parse(n);e&&e(i)}),n,i)}parse(t){return new Qc(t)}}let nd;const id={getContext:function(){return void 0===nd&&(nd=new(window.AudioContext||window.webkitAudioContext)),nd},setContext:function(t){nd=t}};class rd extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{const t=n.slice(0);id.getContext().decodeAudioData(t,(function(t){e(t)}))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}}class od extends Hc{constructor(t,e,n=1){super(void 0,n);const i=(new Dr).set(t),r=(new Dr).set(e),o=new pi(i.r,i.g,i.b),s=new pi(r.r,r.g,r.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}}od.prototype.isHemisphereLightProbe=!0;class sd extends Hc{constructor(t,e=1){super(void 0,e);const n=(new Dr).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}sd.prototype.isAmbientLightProbe=!0;const ad=new Vi,ld=new Vi;class ud{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Lo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Lo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;const n=t.projectionMatrix.clone(),i=e.eyeSep/2,r=i*e.near/e.focus,o=e.near*Math.tan(Wn*e.fov*.5)/e.zoom;let s,a;ld.elements[12]=-i,ad.elements[12]=i,s=-o*e.aspect+r,a=o*e.aspect+r,n.elements[0]=2*e.near/(a-s),n.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(n),s=-o*e.aspect-r,a=o*e.aspect-r,n.elements[0]=2*e.near/(a-s),n.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(ld),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(ad)}}class hd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=cd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=cd();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function cd(){return("undefined"==typeof performance?Date:performance).now()}const dd=new pi,pd=new di,fd=new pi,md=new pi;class gd extends mr{constructor(){super(),this.type="AudioListener",this.context=id.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new hd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(dd,pd,fd),md.set(0,0,-1).applyQuaternion(pd),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(dd.x,t),e.positionY.linearRampToValueAtTime(dd.y,t),e.positionZ.linearRampToValueAtTime(dd.z,t),e.forwardX.linearRampToValueAtTime(md.x,t),e.forwardY.linearRampToValueAtTime(md.y,t),e.forwardZ.linearRampToValueAtTime(md.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(dd.x,dd.y,dd.z),e.setOrientation(md.x,md.y,md.z,n.x,n.y,n.z)}}class vd extends mr{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const _d=new pi,yd=new di,xd=new pi,bd=new pi;class wd extends vd{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(_d,yd,xd),bd.set(0,0,1).applyQuaternion(yd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(_d.x,t),e.positionY.linearRampToValueAtTime(_d.y,t),e.positionZ.linearRampToValueAtTime(_d.z,t),e.orientationX.linearRampToValueAtTime(bd.x,t),e.orientationY.linearRampToValueAtTime(bd.y,t),e.orientationZ.linearRampToValueAtTime(bd.z,t)}else e.setPosition(_d.x,_d.y,_d.z),e.setOrientation(bd.x,bd.y,bd.z)}}class Td{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Sd{constructor(t,e,n){let i,r,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==i;++t)n[r+t]=n[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){s.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){di.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const o=this._workIndex*r;di.multiplyQuaternionsFlat(t,o,t,e,t,n),di.slerpFlat(t,e,t,e,t,o,i)}_lerp(t,e,n,i,r){const o=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[n+s]*i}}_lerpAdditive(t,e,n,i,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[n+o]*i}}}const Ed=new RegExp("[\\[\\]\\.:\\/]","g"),Md="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Ad=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Rd=/(WCOD+)?/.source.replace("WCOD",Md),Cd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Pd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Id=new RegExp("^"+Ad+Rd+Cd+Pd+"$"),Od=["material","materials","bones"];class Ld{constructor(t,e,n){this.path=e,this.parsedPath=n||Ld.parseTrackName(e),this.node=Ld.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Ld.Composite(t,e,n):new Ld(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ed,"")}static parseTrackName(t){const e=Id.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Od.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const o=n(r.children);if(o)return o}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.node[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Ld.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const o=t[i];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ld.Composite=class{constructor(t,e,n){const i=n||Ld.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ld.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ld.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ld.prototype.GetterByBindingType=[Ld.prototype._getValue_direct,Ld.prototype._getValue_array,Ld.prototype._getValue_arrayElement,Ld.prototype._getValue_toArray],Ld.prototype.SetterByBindingTypeAndVersioning=[[Ld.prototype._setValue_direct,Ld.prototype._setValue_direct_setNeedsUpdate,Ld.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ld.prototype._setValue_array,Ld.prototype._setValue_array_setNeedsUpdate,Ld.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ld.prototype._setValue_arrayElement,Ld.prototype._setValue_arrayElement_setNeedsUpdate,Ld.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ld.prototype._setValue_fromArray,Ld.prototype._setValue_fromArray_setNeedsUpdate,Ld.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Nd{constructor(){this.uuid=qn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let s=void 0,a=t.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const h=arguments[u],c=h.uuid;let d=e[c];if(void 0===d){d=a++,e[c]=d,t.push(h);for(let t=0,e=o;t!==e;++t)r[t].push(new Ld(h,n[t],i[t]))}else if(d<l){s=t[d];const a=--l,u=t[a];e[u.uuid]=d,t[d]=u,e[c]=a,t[a]=h;for(let t=0,e=o;t!==e;++t){const e=r[t],o=e[a];let s=e[d];e[d]=o,void 0===s&&(s=new Ld(h,n[t],i[t])),e[a]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=e[a];if(void 0!==l&&l>=r){const o=r++,u=t[o];e[u.uuid]=l,t[l]=u,e[a]=o,t[o]=s;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[l];e[l]=i,e[o]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const s=--r,a=t[s],u=--o,h=t[u];e[a.uuid]=l,t[l]=a,e[h.uuid]=s,t[s]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[u];e[l]=i,e[s]=r,e.pop()}}else{const r=--o,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,u=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,o.push(t),s.push(e),r.push(h);for(let n=u,i=a.length;n!==i;++n){const i=a[n];h[n]=new Ld(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=n,o[n]=a,o.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}}Nd.prototype.isAnimationObjectGroup=!0;class Dd{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:Ye,endingEnd:Ye};for(let t=0;t!==o;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=je,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,o=n/i;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case $e:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulateAdditive(s);break;case Ke:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulate(i,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const o=n===Ve;if(0===t)return-1===r?i:o&&1==(1&r)?e-i:i;if(n===ze){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(o&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Ze,i.endingEnd=Ze):(i.endingStart=t?this.zeroSlopeAtStart?Ze:Ye:Je,i.endingEnd=e?this.zeroSlopeAtEnd?Ze:Ye:Je)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=n,this}}class Fd extends zn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,s=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let u=l[a];void 0===u&&(u={},l[a]=u);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=u[l];if(void 0!==h)o[t]=h;else{if(h=o[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new Sd(Ld.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),o[t]=h}s[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,o=this._actionsByClip,s=o[r],a=s.knownActions,l=a[a.length-1],u=t._byClipCacheIndex;l._byClipCacheIndex=u,a[u]=l,a.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete o[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[e];void 0===o&&(o={},i[e]=o),o[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,s=o[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete s[r],0===Object.keys(s).length&&delete o[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new Zh(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let o="string"==typeof t?oc.findByName(i,t):t;const s=null!==o?o.uuid:t,a=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:Ke),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const u=new Dd(this,o,e,n);return this._bindAction(u,l),this._addInactiveAction(u,s,r),u}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?oc.findByName(n,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let s=0;s!==n;++s){e[s]._update(i,t,r,o)}const s=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)s[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,o=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,o._cacheIndex=r,e[r]=o,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}Fd.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Bd{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Bd(void 0===this.value.clone?this.value:this.value.clone())}}class Ud extends ul{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}Ud.prototype.isInstancedInterleavedBuffer=!0;class kd{constructor(t,e,n,i,r){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}kd.prototype.isGLBufferAttribute=!0;class Gd{constructor(t,e,n=0,i=1/0){this.ray=new ji(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new er,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!1,n=[]){return zd(t,this,n,e),n.sort(Hd),n}intersectObjects(t,e=!1,n=[]){for(let i=0,r=t.length;i<r;i++)zd(t[i],this,n,e);return n.sort(Hd),n}}function Hd(t,e){return t.distance-e.distance}function zd(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)zd(i[t],e,n,!0)}}class jd{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Yn(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Vd{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}const Wd=new ei;class Xd{constructor(t=new ei(1/0,1/0),e=new ei(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Wd.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Wd.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Xd.prototype.isBox2=!0;const qd=new pi,Yd=new pi;class Zd{constructor(t=new pi,e=new pi){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){qd.subVectors(t,this.start),Yd.subVectors(this.end,this.start);const n=Yd.dot(Yd);let i=Yd.dot(qd)/n;return e&&(i=Yn(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Jd extends mr{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Jd.prototype.isImmediateRenderObject=!0;const Kd=new pi;class $d extends mr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new so,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,n=32;t<n;t++,e++){const r=t/n*Math.PI*2,o=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new Yr(i,3));const r=new ql({fog:!1,toneMapped:!1});this.cone=new nu(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Kd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Kd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Qd=new pi,tp=new Vi,ep=new Vi;class np extends nu{constructor(t){const e=function t(e){const n=[];e&&e.isBone&&n.push(e);for(let i=0;i<e.children.length;i++)n.push.apply(n,t(e.children[i]));return n}(t),n=new so,i=[],r=[],o=new Dr(0,0,1),s=new Dr(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(s.r,s.g,s.b))}n.setAttribute("position",new Yr(i,3)),n.setAttribute("color",new Yr(r,3));super(n,new ql({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");ep.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(tp.multiplyMatrices(ep,r.matrixWorld),Qd.setFromMatrixPosition(tp),i.setXYZ(n,Qd.x,Qd.y,Qd.z),tp.multiplyMatrices(ep,r.parent.matrixWorld),Qd.setFromMatrixPosition(tp),i.setXYZ(n+1,Qd.x,Qd.y,Qd.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}class ip extends Eo{constructor(t,e,n){super(new Ah(e,4,2),new Fr({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const rp=new pi,op=new Dr,sp=new Dr;class ap extends mr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Th(e);i.rotateY(.5*Math.PI),this.material=new Fr({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(3*r.count);i.setAttribute("color",new kr(o,3)),this.add(new Eo(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");op.copy(this.light.color),sp.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?op:sp;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(rp.setFromMatrixPosition(this.light.matrixWorld).negate())}}class lp extends nu{constructor(t=10,e=10,n=4473924,i=8947848){n=new Dr(n),i=new Dr(i);const r=e/2,o=t/e,s=t/2,a=[],l=[];for(let t=0,u=0,h=-s;t<=e;t++,h+=o){a.push(-s,0,h,s,0,h),a.push(h,0,-s,h,0,s);const e=t===r?n:i;e.toArray(l,u),u+=3,e.toArray(l,u),u+=3,e.toArray(l,u),u+=3,e.toArray(l,u),u+=3}const u=new so;u.setAttribute("position",new Yr(a,3)),u.setAttribute("color",new Yr(l,3));super(u,new ql({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class up extends nu{constructor(t=10,e=16,n=8,i=64,r=4473924,o=8947848){r=new Dr(r),o=new Dr(o);const s=[],a=[];for(let n=0;n<=e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,u=Math.cos(i)*t;s.push(0,0,0),s.push(l,0,u);const h=1&n?r:o;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let e=0;e<=n;e++){const l=1&e?r:o,u=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*u,r=Math.cos(e)*u;s.push(n,0,r),a.push(l.r,l.g,l.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*u,r=Math.cos(e)*u,s.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new so;l.setAttribute("position",new Yr(s,3)),l.setAttribute("color",new Yr(a,3));super(l,new ql({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const hp=new pi,cp=new pi,dp=new pi;class pp extends mr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new so;i.setAttribute("position",new Yr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ql({fog:!1,toneMapped:!1});this.lightPlane=new Ql(i,r),this.add(this.lightPlane),i=new so,i.setAttribute("position",new Yr([0,0,0,0,0,1],3)),this.targetLine=new Ql(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){hp.setFromMatrixPosition(this.light.matrixWorld),cp.setFromMatrixPosition(this.light.target.matrixWorld),dp.subVectors(cp,hp),this.lightPlane.lookAt(cp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(cp),this.targetLine.scale.z=dp.length()}}const fp=new pi,mp=new Oo;class gp extends nu{constructor(t){const e=new so,n=new ql({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={},s=new Dr(16755200),a=new Dr(16711680),l=new Dr(43775),u=new Dr(16777215),h=new Dr(3355443);function c(t,e,n){d(t,n),d(e,n)}function d(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(i.length/3-1)}c("n1","n2",s),c("n2","n4",s),c("n4","n3",s),c("n3","n1",s),c("f1","f2",s),c("f2","f4",s),c("f4","f3",s),c("f3","f1",s),c("n1","f1",s),c("n2","f2",s),c("n3","f3",s),c("n4","f4",s),c("p","n1",a),c("p","n2",a),c("p","n3",a),c("p","n4",a),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),c("c","t",u),c("p","c",h),c("cn1","cn2",h),c("cn3","cn4",h),c("cf1","cf2",h),c("cf3","cf4",h),e.setAttribute("position",new Yr(i,3)),e.setAttribute("color",new Yr(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const t=this.geometry,e=this.pointMap;mp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),vp("c",e,t,mp,0,0,-1),vp("t",e,t,mp,0,0,1),vp("n1",e,t,mp,-1,-1,-1),vp("n2",e,t,mp,1,-1,-1),vp("n3",e,t,mp,-1,1,-1),vp("n4",e,t,mp,1,1,-1),vp("f1",e,t,mp,-1,-1,1),vp("f2",e,t,mp,1,-1,1),vp("f3",e,t,mp,-1,1,1),vp("f4",e,t,mp,1,1,1),vp("u1",e,t,mp,.7,1.1,-1),vp("u2",e,t,mp,-.7,1.1,-1),vp("u3",e,t,mp,0,2,-1),vp("cf1",e,t,mp,-1,0,1),vp("cf2",e,t,mp,1,0,1),vp("cf3",e,t,mp,0,-1,1),vp("cf4",e,t,mp,0,1,1),vp("cn1",e,t,mp,-1,0,-1),vp("cn2",e,t,mp,1,0,-1),vp("cn3",e,t,mp,0,-1,-1),vp("cn4",e,t,mp,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function vp(t,e,n,i,r,o,s){fp.set(r,o,s).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],fp.x,fp.y,fp.z)}}const _p=new gi;class yp extends nu{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new so;r.setIndex(new kr(n,1)),r.setAttribute("position",new kr(i,3)),super(r,new ql({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&_p.setFromObject(this.object),_p.isEmpty())return;const e=_p.min,n=_p.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return nu.prototype.copy.call(this,t),this.object=t.object,this}}class xp extends nu{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new so;i.setIndex(new kr(n,1)),i.setAttribute("position",new Yr([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ql({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}class bp extends Ql{constructor(t,e=1,n=16776960){const i=n,r=new so;r.setAttribute("position",new Yr([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),super(r,new ql({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=new so;o.setAttribute("position",new Yr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new Eo(o,new Fr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?b:x,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}const wp=new pi;let Tp,Sp;class Ep extends mr{constructor(t=new pi(0,0,1),e=new pi(0,0,0),n=1,i=16776960,r=.2*n,o=.2*r){super(),this.type="ArrowHelper",void 0===Tp&&(Tp=new so,Tp.setAttribute("position",new Yr([0,0,0,0,1,0],3)),Sp=new gu(0,.5,1,5,1),Sp.translate(0,-.5,0)),this.position.copy(e),this.line=new Ql(Tp,new ql({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Eo(Sp,new Fr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{wp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(wp,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class Mp extends nu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new so;n.setAttribute("position",new Yr(e,3)),n.setAttribute("color",new Yr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new ql({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new Dr,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const Ap=new Float32Array(1),Rp=new Int32Array(Ap.buffer);class Cp{static toHalfFloat(t){Ap[0]=t;const e=Rp[0];let n=e>>16&32768,i=e>>12&2047;const r=e>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&e,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=1&i,n)}}const Pp=Math.pow(2,8),Ip=[.125,.215,.35,.446,.526,.582],Op=5+Ip.length,Lp={[nn]:0,[rn]:1,[sn]:2,[ln]:3,[un]:4,[hn]:5,[on]:6},Np=new Fr({side:b,depthWrite:!1,depthTest:!1}),Dp=new Eo(new Ao,Np),Fp=new Dc,{_lodPlanes:Bp,_sizeLods:Up,_sigmas:kp}=Yp(),Gp=new Dr;let Hp=null;const zp=(1+Math.sqrt(5))/2,jp=1/zp,Vp=[new pi(1,1,1),new pi(-1,1,1),new pi(1,1,-1),new pi(-1,1,-1),new pi(0,zp,jp),new pi(0,zp,-jp),new pi(jp,0,zp),new pi(-jp,0,zp),new pi(zp,jp,0),new pi(-zp,jp,0)];function Wp(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);t.multiplyScalar(Math.pow(2,-n));return(n+128)/255}class Xp{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),n=new pi(0,1,0);return new Fh({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Lp[nn]},outputEncoding:{value:Lp[nn]}},vertexShader:Qp(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${tf()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:E,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Hp=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=$p(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Kp(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Bp.length;t++)Bp[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Hp),t.scissorTest=!1,Jp(t,0,0,t.width,t.height)}_fromTexture(t){Hp=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:xt,minFilter:xt,generateMipmaps:!1,type:Pt,format:qt,encoding:qp(t)?t.encoding:sn,depthBuffer:!1},n=Zp(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Zp(e),n}_compileMaterial(t){const e=new Eo(Bp[0],t);this._renderer.compile(e,Fp)}_sceneToCubeUV(t,e,n,i){const r=new Lo(90,1,e,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,u=a.outputEncoding,h=a.toneMapping;a.getClearColor(Gp),a.toneMapping=rt,a.outputEncoding=nn,a.autoClear=!1;let c=!1;const d=t.background;if(d){if(d.isColor){Np.color.copy(d).convertSRGBToLinear(),t.background=null;const e=Wp(Np.color);Np.opacity=e,c=!0}}else{Np.color.copy(Gp).convertSRGBToLinear();const t=Wp(Np.color);Np.opacity=t,c=!0}for(let e=0;e<6;e++){const n=e%3;0==n?(r.up.set(0,o[e],0),r.lookAt(s[e],0,0)):1==n?(r.up.set(0,0,o[e]),r.lookAt(0,s[e],0)):(r.up.set(0,o[e],0),r.lookAt(0,0,s[e])),Jp(i,n*Pp,e>2?Pp:0,Pp,Pp),a.setRenderTarget(i),c&&a.render(Dp,r),a.render(t,r)}a.toneMapping=h,a.outputEncoding=u,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=$p()):null==this._equirectShader&&(this._equirectShader=Kp());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Eo(Bp[0],i),o=i.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=Lp[t.encoding],o.outputEncoding.value=Lp[e.texture.encoding],Jp(e,0,0,3*Pp,2*Pp),n.setRenderTarget(e),n.render(r,Fp)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<Op;e++){const n=Math.sqrt(kp[e]*kp[e]-kp[e-1]*kp[e-1]),i=Vp[(e-1)%Vp.length];this._blur(t,e-1,e,n,i)}e.autoClear=n}_blur(t,e,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,i,"latitudinal",r),this._halfBlur(o,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,o,s){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const u=new Eo(Bp[i],l),h=l.uniforms,c=Up[n]-1,d=isFinite(r)?Math.PI/(2*c):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===o,s&&(h.poleAxis.value=s),h.dTheta.value=d,h.mipInt.value=8-n,h.inputEncoding.value=Lp[t.texture.encoding],h.outputEncoding.value=Lp[t.texture.encoding];const v=Up[i];Jp(e,3*Math.max(0,Pp-2*v),(0===i?0:2*Pp)+2*v*(i>4?i-8+4:0),3*v,2*v),a.setRenderTarget(e),a.render(u,Fp)}}function qp(t){return void 0!==t&&t.type===Pt&&(t.encoding===nn||t.encoding===rn||t.encoding===on)}function Yp(){const t=[],e=[],n=[];let i=8;for(let r=0;r<Op;r++){const o=Math.pow(2,i);e.push(o);let s=1/o;r>4?s=Ip[r-8+4-1]:0==r&&(s=0),n.push(s);const a=1/(o-1),l=-a/2,u=1+a/2,h=[l,l,u,l,u,u,l,l,u,u,l,u],c=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*c),v=new Float32Array(f*d*c),_=new Float32Array(m*d*c);for(let t=0;t<c;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(i,p*d*t),v.set(h,f*d*t);const r=[t,t,t,t,t,t];_.set(r,m*d*t)}const y=new so;y.setAttribute("position",new kr(g,p)),y.setAttribute("uv",new kr(v,f)),y.setAttribute("faceIndex",new kr(_,m)),t.push(y),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Zp(t){const e=new ui(3*Pp,3*Pp,t);return e.texture.mapping=mt,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Jp(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Kp(){const t=new ei(1,1);return new Fh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Lp[nn]},outputEncoding:{value:Lp[nn]}},vertexShader:Qp(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${tf()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:E,depthTest:!1,depthWrite:!1})}function $p(){return new Fh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Lp[nn]},outputEncoding:{value:Lp[nn]}},vertexShader:Qp(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${tf()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:E,depthTest:!1,depthWrite:!1})}function Qp(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function tf(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}const ef=0,nf=1,rf=0,of=1,sf=2;function af(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function lf(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function uf(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new uu(t,e)}function hf(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ml(t)}function cf(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new uu(t,e)}function df(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ru(t)}function pf(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ru(t)}function ff(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ru(t)}function mf(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new pi(t,e,n)}function gf(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new kr(t,e).setUsage(On)}function vf(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Gr(t,e)}function _f(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Hr(t,e)}function yf(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new zr(t,e)}function xf(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new jr(t,e)}function bf(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Vr(t,e)}function wf(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Wr(t,e)}function Tf(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Xr(t,e)}function Sf(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Yr(t,e)}function Ef(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Zr(t,e)}function Mf(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Mp(t)}function Af(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new yp(t,e)}function Rf(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new nu(new Su(t.geometry),new ql({color:void 0!==e?e:16777215}))}function Cf(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new nu(new Lh(t.geometry),new ql({color:void 0!==e?e:16777215}))}function Pf(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new dc(t)}function If(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new vc(t)}function Of(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Fo(t,n)}function Lf(){console.error("THREE.CanvasRenderer has been removed")}function Nf(){console.error("THREE.JSONLoader has been removed.")}Eu.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Eu.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},xc.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},lp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},np.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hc.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),jc.extractUrlBase(t)},hc.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Xd.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Xd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Xd.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Xd.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},gi.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},gi.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},gi.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},gi.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},gi.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Di.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},jo.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Zd.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},ni.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},ni.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ni.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ni.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ni.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ni.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Vi.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Vi.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Vi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new pi).setFromMatrixColumn(this,3)},Vi.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Vi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Vi.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Vi.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Vi.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Vi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Vi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Vi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Vi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Vi.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Vi.prototype.makeFrustum=function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)},Vi.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Go.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},di.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},di.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ji.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ji.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},ji.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Mr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Mr.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Mr.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Mr.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Mr.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Mr.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Mr.getBarycoord(t,e,n,i,r)},Mr.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Mr.getNormal(t,e,n,i)},bc.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},bc.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new yh(this,t)},bc.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Mh(this,t)},ei.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},ei.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},ei.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},pi.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},pi.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},pi.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},pi.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},pi.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},pi.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},pi.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},pi.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},pi.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},li.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},li.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},mr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},mr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},mr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},mr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},mr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(mr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Eo.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Eo.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Qe},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Fl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Lo.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(wc.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(kr.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===On},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(On)}}}),kr.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?On:In),this},kr.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},kr.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},so.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},so.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new kr(arguments[1],arguments[2])))},so.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},so.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},so.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},so.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},so.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(so.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),ul.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?On:In),this},ul.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},yh.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},yh.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},yh.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ll.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Bd.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Rr.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Dr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===T}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Io.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),rl.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},rl.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},rl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},rl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},rl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},rl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},rl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},rl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},rl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},rl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},rl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},rl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},rl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},rl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},rl.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},rl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},rl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},rl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},rl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},rl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},rl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},rl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},rl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},rl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},rl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(rl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?rn:nn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ya.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(ui.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),vd.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new rd).load(t,(function(t){e.setBuffer(t)})),this},Td.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},No.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},No.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},ri.crossOrigin=void 0,ri.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new _c;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},ri.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new gc;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},ri.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ri.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Df={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Ff(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:u}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=u);class Bf{constructor(){this.camera=new Dc(10,10,10,10),this.camera.position.z=100,this.camera.position.x=0,this.camera.position.y=0}focus(t,e){t.position.z=50}updateAspect(t,e){this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix()}}class Uf{constructor(){this.camera=new Bf,this.mesh=new Eo,this.material=null,this.geometry=null}addObjects(t){this.mesh.position.z=50,t.add(this.mesh)}setTexture(t,e,n,i){this.camera.updateAspect(n,i),this.geometry=new Xo(n,i,1,1),this.material=new Io({fragmentShader:this.fragmentShader,vertexShader:"\nvarying vec2 vUv;\nvoid main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"}),this.material.uniforms={width:{value:n},height:{value:i},texturePrev:{value:t},textureNext:{value:e},timePercent:{value:0}},this.mesh.geometry=this.geometry,this.mesh.material=this.material}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var kf=n(11),Gf=n.n(kf),Hf=n(12),zf=n.n(Hf);var jf=n(13),Vf=n.n(jf);var Wf=n(14),Xf=n.n(Wf);var qf=n(15),Yf=n.n(qf);var Zf=n(16),Jf=n.n(Zf);var Kf=n(17),$f=n.n(Kf);var Qf=n(18),tm=n.n(Qf);var em=n(19),nm=n.n(em);var im=n(20),rm=n.n(im);var om=n(21),sm=n.n(om);var am=n(22),lm=n.n(am);var um=n(23),hm=n.n(um);var cm=n(24),dm=n.n(cm);class pm{constructor(){this.camera=new Lo(60,1,1,2e3),this.camera.position.z=1e3,this.camera.position.x=0,this.camera.position.y=0}updateAspect(t,e){this.camera.aspect=t/e,this.camera.updateProjectionMatrix()}focus(t,e){const n=.5*e/Math.tan(Math.PI/6);t.position.z=1e3-n}}class fm{constructor(){this.geometry=new so,this.material=null,this.camera=new pm,this.mesh=new Eo,this.textureWidth=0,this.textureHeight=0,this.prevTexture=new si,this.nextTexture=new si}horizontalSegments(){return Math.ceil(this.verticalSegments*this.textureWidth/this.textureHeight)}initMesh(t,e){const n=[],i=[],r=[],o=this.verticalSegments,s=this.horizontalSegments(),a=t/2,l=e/2,u=t/s,h=e/o,c=this.extraAttributes(),d=Object.keys(c),p=d.reduce((t,e)=>(t[e]=[],t),{});for(let t=0;t<o;t++){const e=t*h-l;for(let n=0;n<s;n++){const l=n*u-a;i.push(l,-e,0),r.push(1*n/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,n))),i.push(l+u,-e,0),r.push(1*(n+1)/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,n))),i.push(l,-e-h,0),r.push(1*n/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,n))),i.push(l+u,-e-h,0),r.push(1*(n+1)/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,n)))}}for(let t=0;t<o*s;t++){const e=4*t,i=e+1,r=e+2,o=e+3;n.push(i,e,o),n.push(e,r,o)}return this.geometry.setIndex(n),this.geometry.setAttribute("position",new Yr(i,3)),this.geometry.setAttribute("uv",new Yr(new Float32Array(r),2)),d.forEach(t=>{this.geometry.setAttribute(t,new Yr(new Float32Array(p[t]),c[t].itemSize))}),{verticalSegments:o,horizontalSegments:s,segmentWidth:u,segmentHeight:h}}initObject(){this.material=new Io({fragmentShader:this.fragmentShader,vertexShader:this.vertexShader,side:w})}setTexture(t,e,n,i){this.textureHeight=i,this.textureWidth=n,this.prevTexture=t,this.nextTexture=e,this.initObject();const{verticalSegments:r,horizontalSegments:o,segmentWidth:s,segmentHeight:a}=this.initMesh(n,i);this.material.uniforms={segmentWidth:{value:s},segmentHeight:{value:a},verticalSegments:{value:r},horizontalSegments:{value:o},timePercent:{value:0},texturePrev:{value:t},textureNext:{value:e}},this.mesh.geometry=this.geometry,this.camera.updateAspect(n,i),this.camera.focus(this.mesh,i),this.material.transparent=!0,this.mesh.material=this.material}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var mm=n(25),gm=n.n(mm),vm=n(26),_m=n.n(vm);var ym=n(27),xm=n.n(ym),bm=n(28),wm=n.n(bm);var Tm=n(29),Sm=n.n(Tm),Em=n(30),Mm=n.n(Em);var Am=n(31),Rm=n.n(Am),Cm=n(32),Pm=n.n(Cm);var Im=n(33),Om=n.n(Im),Lm=n(34),Nm=n.n(Lm);var Dm=n(35),Fm=n.n(Dm),Bm=n(36),Um=n.n(Bm);class km extends fm{constructor(){super(...arguments),this.duration=1250,this.fragmentShader=Um.a,this.vertexShader=Fm.a,this.verticalSegments=100}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}extraAttributes(){return{}}}var Gm=n(37),Hm=n.n(Gm),zm=n(38),jm=n.n(zm);var Vm=n(39),Wm=n.n(Vm);var Xm=n(40),qm=n.n(Xm);var Ym=n(41),Zm=n.n(Ym);var Jm=n(42),Km=n.n(Jm),$m=n(43),Qm=n.n($m);const tg=new pi(0,-0,0).multiplyScalar(.1);class eg{constructor(t,e,n,i,r){this.position=new pi,this.previous=new pi,this.original=new pi,this.a=new pi(0,0,0),this.mass=i,this.invMass=1/i,this.tmp=new pi,this.tmp2=new pi,r(t,e,this.position),r(t,e,this.previous),r(t,e,this.original)}addForce(t){this.a.add(this.tmp2.copy(t).multiplyScalar(this.invMass))}integrate(t,e,n){const i=.25*Math.PI,r=.25*-Math.PI,o=new ni,s=new ni;o.set(Math.cos(i),-Math.sin(i),0,Math.sin(i),Math.cos(i),0,0,0,1),s.set(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1);const a=this.tmp.subVectors(this.position,this.previous);a.multiplyScalar(.97).add(this.position),a.add(this.a.multiplyScalar(t)),this.tmp=this.previous,this.previous=this.position,this.position=a,this.a.set(0,0,0)}}class ng{constructor(t,e,n){this.width=t,this.height=e;const i=[],r=[];for(let r=0;r<=e;r++)for(let o=0;o<=t;o++)i.push(new eg(o/t,r/e,0,.1,n));for(let n=0;n<e;n++)for(let e=0;e<t;e++)r.push([i[o(e,n)],i[o(e,n+1)],25]),r.push([i[o(e,n)],i[o(e+1,n)],25]);for(let n=t,s=0;s<e;s++)r.push([i[o(n,s)],i[o(n,s+1)],25]);for(let n=e,s=0;s<t;s++)r.push([i[o(s,n)],i[o(s+1,n)],25]);function o(e,n){return e+n*(t+1)}this.particles=i,this.constraints=r,this.index=o}}const ig={RandomLines:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=zf.a}genRandomLines(){let t=[1];for(let e=20;e--;){let e=t.sort((t,e)=>e-t)[0],n=t.indexOf(e),i=Math.random(),r=e*i,o=e*(1-i);t.splice(n,1),t.push(r,o)}let e=t.length;for(;e;){let n=Math.floor(Math.random()*e--);[t[n],t[e]]=[t[e],t[n]]}return t}setTexture(t,e,n,i){super.setTexture(t,e,n,i),this.material.uniforms.lines={value:this.genRandomLines()},this.material.vertexShader=Gf.a}},Shape:class extends Uf{constructor(){super(...arguments),this.duration=800,this.fragmentShader=Vf.a}},Ripples:class extends Uf{constructor(){super(...arguments),this.duration=1400,this.fragmentShader=Xf.a}},Erase:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Yf.a}},Dissolve:class extends Uf{constructor(){super(...arguments),this.duration=1200,this.fragmentShader=Jf.a,this.dissolveIndices={}}random40(){return Math.ceil(40*Math.random())}setTexture(t,e,n,i){super.setTexture(t,e,n,i);for(let t=0;t<1600;t++){let t=this.random40(),e=this.random40();for(;void 0!==this.dissolveIndices[`${t}_${e}`];)t=this.random40(),e=this.random40();this.dissolveIndices[`${t}_${e}`]=0}this.material.uniforms.dissolveTexture={value:this.genDissolveToTexture()}}genDissolveToTexture(){var t=new Uint8Array(4800);for(let e=0;e<1600;e++){const n=e%40+1,i=Math.floor(e/40)+1,r=3*e;0===this.dissolveIndices[`${n}_${i}`]?(t[r]=0,t[r+1]=0,t[r+2]=0):(t[r]=255,t[r+1]=255,t[r+2]=255)}return new Ul(t,40,40,jt)}updateAnimation(t){const e=1600*t-Object.keys(this.dissolveIndices).filter(t=>1===this.dissolveIndices[t]).length;for(let t=0;t<e;t++){const t=Object.keys(this.dissolveIndices).filter(t=>0===this.dissolveIndices[t]),e=Math.ceil(Math.random()*t.length)-1;this.dissolveIndices[t[e]]=1}this.material.uniforms.dissolveTexture.value=this.genDissolveToTexture()}},Smooth:class extends Uf{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=$f.a}},FadeInOut:class extends Uf{constructor(){super(...arguments),this.duration=700,this.fragmentShader=tm.a}},Push:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=nm.a}},Separation:class extends Uf{constructor(){super(...arguments),this.duration=1500,this.fragmentShader=rm.a}},Display:class extends Uf{constructor(){super(...arguments),this.duration=3400,this.fragmentShader=sm.a}},Uncover:class extends Uf{constructor(){super(...arguments),this.duration=750,this.fragmentShader=lm.a}},Cover:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=hm.a}},Flash:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=dm.a}},Checkerboard:class extends fm{constructor(){super(...arguments),this.duration=2500,this.fragmentShader=_m.a,this.vertexShader=gm.a,this.vIndex="",this.delay=0,this.verticalSegments=5}extraAttributes(){return{times:{itemSize:1,generator:(t,e)=>(this.vIndex!==`${t}${e}`&&(this.delay=.3*Math.random(),this.vIndex=`${t}${e}`),[this.delay])},segment:{itemSize:2,generator:(t,e)=>[e,t]}}}},Vortex:class{constructor(){this.duration=4e3,this.geometry=new so,this.material=new Io({fragmentShader:wm.a,vertexShader:xm.a,side:w}),this.camera=new pm,this.mesh=new Eo}initData(t,e){const n=[],i=[],r=[],o=[],s=[],a=[],l=Math.ceil(124*t/e),u=t/2,h=e/2,c=t/l,d=e/124;for(let t=0;t<124;t++){const e=t*d-h;for(let n=0;n<l;n++){const h=n*c-u,p=Math.ceil((n+1)/((l+1)/12)),f=.4/p,m=(p-1)*f+Math.random()*f;i.push(h,-e,0),o.push(1*n/l,1-1*t/124),r.push(0,0,1),s.push(n,t),a.push(m),i.push(h+c,-e,0),o.push(1*(n+1)/l,1-1*t/124),r.push(0,0,1),s.push(n,t),a.push(m),i.push(h,-e-d,0),o.push(1*n/l,1-1*(t+1)/124),r.push(0,0,1),s.push(n,t),a.push(m),i.push(h+c,-e-d,0),o.push(1*(n+1)/l,1-1*(t+1)/124),r.push(0,0,1),s.push(n,t),a.push(m)}}for(let t=0;t<124*l;t++){const e=4*t,i=e+1,r=e+2,o=e+3;n.push(i,e,o),n.push(e,r,o)}return this.geometry.setIndex(n),this.geometry.setAttribute("position",new Yr(i,3)),this.geometry.setAttribute("normal",new Yr(r,3)),this.geometry.setAttribute("uv",new Yr(new Float32Array(o),2)),this.geometry.setAttribute("segment",new Yr(new Float32Array(s),2)),this.geometry.setAttribute("times",new Yr(new Float32Array(a),1)),{verticalSegments:124,horizontalSegments:l,segmentWidth:c,segmentHeight:d}}setTexture(t,e){const{width:n,height:r}=t.image,{verticalSegments:o,horizontalSegments:s,segmentWidth:a,segmentHeight:l}=this.initData(n,r);this.material.uniforms={duration:{value:this.duration},segmentWidth:{value:a},segmentHeight:{value:l},verticalSegments:{value:o},horizontalSegments:{value:s},timePercent:{value:0},texturePrev:{value:t},textureNext:{value:e}},this.camera.updateAspect(n,r),this.camera.focus(this.mesh,r),this.mesh.geometry=this.geometry;new kh({side:w,vertexColors:!0}).wireframe=!0,this.material.transparent=!0,this.mesh.material=this.material,console.log(i)}addObjects(t){t.add(this.mesh)}updateAnimation(t){let e=(t-.4)/.2;e<0?e=0:e>1&&(e=1),this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},WindowShades:class{constructor(){this.duration=1600,this.geometry=new so,this.material=new Io({fragmentShader:Mm.a,vertexShader:Sm.a,side:w}),this.horizontalSegments=16,this.meshToCameraDistance=0,this.camera=new pm,this.mesh=new Eo}initData(t,e){const n=[],i=[],r=[],o=[],s=[],a=[],l=t/2,u=e/2,h=t/this.horizontalSegments;for(let t=0;t<this.horizontalSegments;t++){const e=Math.abs(t-Math.ceil(this.horizontalSegments/2))*(.3/Math.ceil(this.horizontalSegments/2)),n=t*h-l;i.push(n,u,0),r.push(0),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n+h,u,0),r.push(0),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n,-1*u,0),r.push(0),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),i.push(n+h,-1*u,0),o.push((t+1)/this.horizontalSegments,0),r.push(0),s.push(t),a.push(e),i.push(n+h,u,0),r.push(1),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n+h,u,-1*h),r.push(1),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n+h,-1*u,0),r.push(1),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),i.push(n+h,-1*u,-1*h),o.push((t+1)/this.horizontalSegments,0),r.push(1),s.push(t),a.push(e)}for(let t=0;t<this.horizontalSegments;t++){const e=8*t,i=e+1,r=e+2,o=e+3,s=e+4,a=e+5,l=e+6,u=e+7;n.push(i,e,o),n.push(e,r,o),n.push(a,s,u),n.push(s,l,u)}this.geometry.setIndex(n),this.geometry.setAttribute("position",new Yr(i,3)),this.geometry.setAttribute("uv",new Yr(new Float32Array(o),2)),this.geometry.setAttribute("index",new Yr(new Float32Array(s),1)),this.geometry.setAttribute("type",new Yr(new Float32Array(r),1)),this.geometry.setAttribute("delay",new Yr(new Float32Array(a),1))}setTexture(t,e,n,i){this.initData(n,i),this.material.uniforms={segments:{value:this.horizontalSegments},segmentWidth:{value:n/this.horizontalSegments},timePercent:{value:0},texturePrev:{value:t},textureNext:{value:e}},this.meshToCameraDistance=.5*i/Math.tan(Math.PI/6),this.camera.updateAspect(n,i),this.camera.focus(this.mesh,i),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},Curtain:class extends fm{constructor(){super(...arguments),this.duration=6e3,this.fragmentShader=Pm.a,this.vertexShader=Rm.a,this.verticalSegments=100}extraAttributes(){return{isLeft:{itemSize:1,generator:(t,e)=>[e<this.horizontalSegments()/2?1:0]}}}addObjects(t){super.addObjects(t),this.mesh.position.z+=20,t.background=this.nextTexture}},Fall:class extends fm{constructor(){super(...arguments),this.zCurveLimit=100,this.duration=2e3,this.verticalSegments=100,this.fragmentShader=Nm.a,this.vertexShader=Om.a}extraAttributes(){return{}}setTexture(t,e,n,i){super.setTexture(t,e,n,i),this.material.uniforms.zCurveLimit={value:this.zCurveLimit},this.material.uniforms.aCoefficient={value:this.zCurveLimit/(this.textureHeight/2*(this.textureHeight/2))}}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}updateAnimation(t){this.material.uniforms.timePercent.value=t}},Suspension:class extends km{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=jm.a,this.vertexShader=Hm.a}addObjects(t){t.add(this.mesh),t.background=this.prevTexture}},Clock:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Wm.a}},Combing:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=qm.a}},Scale:class extends Uf{constructor(){super(...arguments),this.duration=900,this.fragmentShader=Zm.a}},PeelOff:km,Flip:class extends fm{constructor(){super(...arguments),this.duration=1250,this.fragmentShader=Qm.a,this.vertexShader=Km.a,this.verticalSegments=1}extraAttributes(){return{}}},Wind:class{constructor(){this.duration=2e3,this.camera=new pm,this.mesh=new Eo,this.geometry=null,this.material=new zh({side:w,alphaTest:.5}),this.tmpForce=new pi,this.windForce=new pi(0,0,0),this.cloth=null,this.nextTexture=null,this.diff=new pi,this.xSegs=10,this.ySegs=10,this.width=10,this.height=10,this.enablePins=!0,this.animate=t=>{this.simulate(t),this.render(),requestAnimationFrame(this.animate)}}setTexture(t,e,n,i){const r=n,o=i;this.xSegs=Math.ceil(r/25),this.ySegs=Math.ceil(o/25),this.width=25*this.xSegs,this.height=25*this.ySegs;const s=function(t,e){return function(n,i,r){const o=(n-.5)*t,s=(i+.5)*e;r.set(o,s,0)}}(25*this.xSegs,25*this.ySegs);this.cloth=new ng(this.xSegs,this.ySegs,s),this.nextTexture=e,this.camera.updateAspect(r,o),this.material.map=t,this.geometry=new Sh(s,this.cloth.width,this.cloth.height),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material,this.mesh.castShadow=!0,this.mesh.position.y-=o,this.mesh.customDepthMaterial=new Xa({depthPacking:dn,map:t,alphaTest:.5}),this.camera.focus(this.mesh,o)}addObjects(t){t.add(this.mesh),t.background=this.nextTexture,t.add(new Uc(6710886));const e=new Bc(14674943,1);e.position.set(0,0,100),e.position.multiplyScalar(1.3),e.castShadow=!0,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024;const n=300;e.shadow.camera.left=-n,e.shadow.camera.right=n,e.shadow.camera.top=n,e.shadow.camera.bottom=-n,e.shadow.camera.far=1e3,t.add(e),this.animate(0)}satisfyConstraints(t,e,n){this.diff.subVectors(e.position,t.position);const i=this.diff.length();if(0===i)return;const r=this.diff.multiplyScalar(1-n/i).multiplyScalar(.5);t.position.add(r),e.position.sub(r)}simulate(t){const e=20*Math.abs(Math.cos(t/70));this.windForce.set(Math.abs(Math.sin(t/300)),Math.abs(Math.cos(t/200)),Math.sin(t/1e3)),this.windForce.normalize(),this.windForce.x*=50*e,this.windForce.y*=50*e,this.windForce.z*=.2*e;const n=this.cloth.particles;let i;const r=new pi,o=this.geometry.index,s=this.geometry.attributes.normal;for(let t=0,e=o.count;t<e;t+=3)for(let e=0;e<3;e++)i=o.getX(t+e),r.fromBufferAttribute(s,i),this.tmpForce.copy(r).normalize().multiplyScalar(r.dot(this.windForce)),n[i].addForce(this.tmpForce);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.addForce(tg),e.integrate(144e-6,this.width,this.height)}const a=this.cloth.constraints,l=a.length;for(let t=0;t<l;t++){const e=a[t];this.satisfyConstraints(e[0],e[1],e[2])}for(let t=0,e=n.length;t<e;t++){const e=n[t].position;e.y<-250&&(e.y=-250)}if(this.enablePins){let t=new Array(this.xSegs+1).fill("").map((t,e)=>e);for(let e=0;e<this.ySegs+1;e++)t.push(e*(this.xSegs+1));for(let e=0,i=t.length;e<i;e++){const i=n[t[e]];i.position.copy(i.original),i.previous.copy(i.original)}}}render(){const t=this.cloth.particles;for(let e=0,n=t.length;e<n;e++){const n=t[e].position;this.geometry.attributes.position.setXYZ(e,n.x,n.y,n.z)}this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeVertexNormals()}updateAnimation(t){t>.5&&(this.enablePins=!1),t>.9999&&(this.mesh.visible=!1)}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}},rg={linear:(t,e,n,i)=>n*t/i+e,easeIn:(t,e,n,i)=>n*(t/=i)*t+e,strongEaseIn:(t,e,n,i)=>n*(t/=i)*t*t*t*t+e,strongEaseOut:(t,e,n,i)=>n*((t=t/i-1)*t*t*t*t+1)+e,sineaseIn:(t,e,n,i)=>n*(t/=i)*t*t+e,sineaseOut:(t,e,n,i)=>n*((t=t/i-1)*t*t+1)+e};class og{constructor(){this.startTime=0,this.lastTime=0,this.reverse=!1,this.scene=new ll,this.delay=0,this.easeFn=rg.linear,this.preset=null,this.onTransactionEnd=()=>{},this.onTransactionStart=()=>{},this.isTransactionStartApplied=!1,this.textureLoader=new _c,this.prevTexture=null,this.nextTexture=null,this.renderer=new rl({alpha:!0,premultipliedAlpha:!0}),this.isPlaying=!1,this.animate=(t=-1)=>{var e,n,i;this.renderer.clear(),t>this.delay&&0===this.lastTime&&(this.lastTime=t,this.startTime=t);let r=0;this.lastTime>0&&r<1&&(r=this.easeFn(t-this.startTime,0,1,null!==(n=null===(e=this.preset)||void 0===e?void 0:e.duration)&&void 0!==n?n:0)),r>1&&(r=1),null===(i=this.preset)||void 0===i||i.updateAnimation(this.reverse?1-r:r),this.rerender(),this.isTransactionStartApplied||(this.isTransactionStartApplied=!0,this.onTransactionStart()),r<1?window.requestAnimationFrame(this.animate):(this.dispose(),this.onTransactionEnd())}}play(t){var e,n,i;t.onTransactionEnd&&(this.onTransactionEnd=t.onTransactionEnd),t.onTransactionStart&&(this.onTransactionStart=t.onTransactionStart),this.init(t),this.isTransactionStartApplied=!1,this.renderer.setSize(t.stageWidth,t.stageHeight),this.preset=new ig[t.presetType],t.duration&&Number.isInteger(t.duration)&&(this.preset.duration=t.duration),this.prevTexture=this.textureLoader.load(t.prevTextureUrl),this.nextTexture=this.textureLoader.load(t.nextTextureUrl),this.reverse?null===(e=this.preset)||void 0===e||e.setTexture(this.nextTexture,this.prevTexture,t.textureWidth,t.textureHeight):null===(n=this.preset)||void 0===n||n.setTexture(this.prevTexture,this.nextTexture,t.textureWidth,t.textureHeight),null===(i=this.preset)||void 0===i||i.addObjects(this.scene),this.animate(),this.isPlaying=!0}init(t){this.reverse=t.reverse,t.delay&&Number.isInteger(t.delay)&&(this.delay=t.delay),t.easeFn&&(this.easeFn=rg[t.easeFn]),this.startTime=0,this.lastTime=0,this.scene.clear(),this.renderer.shadowMap.enabled=!0,this.renderer.autoClear=!1,this.renderer.setClearColor(t.clearColor||0)}rerender(){var t;this.renderer.clear(),(null===(t=this.preset)||void 0===t?void 0:t.camera.camera)&&this.renderer.render(this.scene,this.preset.camera.camera)}skip(){var t;null===(t=this.preset)||void 0===t||t.updateAnimation(this.reverse?0:1),this.rerender(),this.dispose(),this.onTransactionEnd()}dispose(){var t,e,n;this.renderer.clear(),this.isPlaying=!1,null===(t=this.preset)||void 0===t||t.dispose(),null===(e=this.prevTexture)||void 0===e||e.dispose(),null===(n=this.nextTexture)||void 0===n||n.dispose();for(let t=this.scene.children.length-1;t>=0;t--){const e=this.scene.children[t];this.scene.remove(e)}this.scene.background=null}destroy(){this.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose()}}var sg=n(44),ag=n(47),lg=n.n(ag);
41
+ const u="130",h={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},c={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},d=0,p=1,f=2,m=3,g=0,v=1,_=2,y=3,x=0,b=1,w=2,T=1,S=2,E=0,M=1,A=2,R=3,C=4,P=5,I=100,O=101,L=102,N=103,D=104,F=200,B=201,U=202,k=203,G=204,H=205,z=206,j=207,V=208,W=209,X=210,q=0,Y=1,Z=2,J=3,K=4,$=5,Q=6,tt=7,et=0,nt=1,it=2,rt=0,ot=1,st=2,at=3,lt=4,ut=5,ht=300,ct=301,dt=302,pt=303,ft=304,mt=306,gt=307,vt=1e3,_t=1001,yt=1002,xt=1003,bt=1004,wt=1004,Tt=1005,St=1005,Et=1006,Mt=1007,At=1007,Rt=1008,Ct=1008,Pt=1009,It=1010,Ot=1011,Lt=1012,Nt=1013,Dt=1014,Ft=1015,Bt=1016,Ut=1017,kt=1018,Gt=1019,Ht=1020,zt=1021,jt=1022,Vt=1023,Wt=1024,Xt=1025,qt=Vt,Yt=1026,Zt=1027,Jt=1028,Kt=1029,$t=1030,Qt=1031,te=1032,ee=1033,ne=33776,ie=33777,re=33778,oe=33779,se=35840,ae=35841,le=35842,ue=35843,he=36196,ce=37492,de=37496,pe=37808,fe=37809,me=37810,ge=37811,ve=37812,_e=37813,ye=37814,xe=37815,be=37816,we=37817,Te=37818,Se=37819,Ee=37820,Me=37821,Ae=36492,Re=37840,Ce=37841,Pe=37842,Ie=37843,Oe=37844,Le=37845,Ne=37846,De=37847,Fe=37848,Be=37849,Ue=37850,ke=37851,Ge=37852,He=37853,ze=2200,je=2201,Ve=2202,We=2300,Xe=2301,qe=2302,Ye=2400,Ze=2401,Je=2402,Ke=2500,$e=2501,Qe=0,tn=1,en=2,nn=3e3,rn=3001,on=3007,sn=3002,an=3003,ln=3004,un=3005,hn=3006,cn=3200,dn=3201,pn=0,fn=1,mn=0,gn=7680,vn=7681,_n=7682,yn=7683,xn=34055,bn=34056,wn=5386,Tn=512,Sn=513,En=514,Mn=515,An=516,Rn=517,Cn=518,Pn=519,In=35044,On=35048,Ln=35040,Nn=35045,Dn=35049,Fn=35041,Bn=35046,Un=35050,kn=35042,Gn="100",Hn="300 es";class zn{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const jn=[];for(let t=0;t<256;t++)jn[t]=(t<16?"0":"")+t.toString(16);let Vn=1234567;const Wn=Math.PI/180,Xn=180/Math.PI;function qn(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(jn[255&t]+jn[t>>8&255]+jn[t>>16&255]+jn[t>>24&255]+"-"+jn[255&e]+jn[e>>8&255]+"-"+jn[e>>16&15|64]+jn[e>>24&255]+"-"+jn[63&n|128]+jn[n>>8&255]+"-"+jn[n>>16&255]+jn[n>>24&255]+jn[255&i]+jn[i>>8&255]+jn[i>>16&255]+jn[i>>24&255]).toUpperCase()}function Yn(t,e,n){return Math.max(e,Math.min(n,t))}function Zn(t,e){return(t%e+e)%e}function Jn(t,e,n){return(1-n)*t+n*e}function Kn(t){return 0==(t&t-1)&&0!==t}function $n(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Qn(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var ti=Object.freeze({__proto__:null,DEG2RAD:Wn,RAD2DEG:Xn,generateUUID:qn,clamp:Yn,euclideanModulo:Zn,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Jn,damp:function(t,e,n,i){return Jn(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(Zn(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Vn=t%2147483647),Vn=16807*Vn%2147483647,(Vn-1)/2147483646},degToRad:function(t){return t*Wn},radToDeg:function(t){return t*Xn},isPowerOfTwo:Kn,ceilPowerOfTwo:$n,floorPowerOfTwo:Qn,setQuaternionFromProperEuler:function(t,e,n,i,r){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),u=o((e+i)/2),h=s((e+i)/2),c=o((e-i)/2),d=s((e-i)/2),p=o((i-e)/2),f=s((i-e)/2);switch(r){case"XYX":t.set(a*h,l*c,l*d,a*u);break;case"YZY":t.set(l*d,a*h,l*c,a*u);break;case"ZXZ":t.set(l*c,l*d,a*h,a*u);break;case"XZX":t.set(a*h,l*f,l*p,a*u);break;case"YXY":t.set(l*p,a*h,l*f,a*u);break;case"ZYZ":t.set(l*f,l*p,a*h,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class ei{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}ei.prototype.isVector2=!0;class ni{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,l){const u=this.elements;return u[0]=t,u[1]=i,u[2]=s,u[3]=e,u[4]=r,u[5]=a,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],u=n[4],h=n[7],c=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],y=i[7],x=i[2],b=i[5],w=i[8];return r[0]=o*f+s*v+a*x,r[3]=o*m+s*_+a*b,r[6]=o*g+s*y+a*w,r[1]=l*f+u*v+h*x,r[4]=l*m+u*_+h*b,r[7]=l*g+u*y+h*w,r[2]=c*f+d*v+p*x,r[5]=c*m+d*_+p*b,r[8]=c*g+d*y+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8];return e*o*u-e*s*l-n*r*u+n*s*a+i*r*l-i*o*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],h=u*o-s*l,c=s*a-u*r,d=l*r-o*a,p=e*h+n*c+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-u*n)*f,t[2]=(s*n-i*o)*f,t[3]=c*f,t[4]=(u*e-i*a)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*a-l*e)*f,t[8]=(o*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*o+l*s)+o+t,-i*l,i*a,-i*(-l*o+a*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],s=i[6],a=i[1],l=i[4],u=i[7];return i[0]=e*r+n*a,i[3]=e*o+n*l,i[6]=e*s+n*u,i[1]=-n*r+e*a,i[4]=-n*o+e*l,i[7]=-n*s+e*u,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let ii;ni.prototype.isMatrix3=!0;class ri{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ii&&(ii=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),ii.width=t.width,ii.height=t.height;const n=ii.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ii}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let oi=0;class si extends zn{constructor(t=si.DEFAULT_IMAGE,e=si.DEFAULT_MAPPING,n=_t,i=_t,r=Et,o=Rt,s=Vt,a=Pt,l=1,u=nn){super(),Object.defineProperty(this,"id",{value:oi++}),this.uuid=qn(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new ei(0,0),this.repeat=new ei(1,1),this.center=new ei(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=qn()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(ai(i[t].image)):e.push(ai(i[t]))}else e=ai(i);t.images[i.uuid]={uuid:i.uuid,url:e}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ht)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case vt:t.x=t.x-Math.floor(t.x);break;case _t:t.x=t.x<0?0:1;break;case yt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case vt:t.y=t.y-Math.floor(t.y);break;case _t:t.y=t.y<0?0:1;break;case yt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function ai(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ri.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}si.DEFAULT_IMAGE=void 0,si.DEFAULT_MAPPING=ht,si.prototype.isTexture=!0;class li{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=t.elements,s=o[0],a=o[4],l=o[8],u=o[1],h=o[5],c=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(a-u)<.01&&Math.abs(l-d)<.01&&Math.abs(c-p)<.01){if(Math.abs(a+u)<.1&&Math.abs(l+d)<.1&&Math.abs(c+p)<.1&&Math.abs(s+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,o=(h+1)/2,m=(f+1)/2,g=(a+u)/4,v=(l+d)/4,_=(c+p)/4;return t>o&&t>m?t<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=g/n,r=v/n):o>m?o<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=g/i,r=_/i):m<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=v/r,i=_/r),this.set(n,i,r,e),this}let m=Math.sqrt((p-c)*(p-c)+(l-d)*(l-d)+(u-a)*(u-a));return Math.abs(m)<.001&&(m=1),this.x=(p-c)/m,this.y=(l-d)/m,this.z=(u-a)/m,this.w=Math.acos((s+h+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}li.prototype.isVector4=!0;class ui extends zn{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new li(0,0,t,e),this.scissorTest=!1,this.viewport=new li(0,0,t,e),this.texture=new si(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Et,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}ui.prototype.isWebGLRenderTarget=!0;class hi extends ui{constructor(t,e,n){super(t,e);const i=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=i.clone()}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}hi.prototype.isWebGLMultipleRenderTargets=!0;class ci extends ui{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}ci.prototype.isWebGLMultisampleRenderTarget=!0;class di{constructor(t=0,e=0,n=0,i=1){this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,i)}static slerpFlat(t,e,n,i,r,o,s){let a=n[i+0],l=n[i+1],u=n[i+2],h=n[i+3];const c=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(0===s)return t[e+0]=a,t[e+1]=l,t[e+2]=u,void(t[e+3]=h);if(1===s)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||a!==c||l!==d||u!==p){let t=1-s;const e=a*c+l*d+u*p+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*n;if(a=a*t+c*r,l=l*t+d*r,u=u*t+p*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+u*u+h*h);a*=t,l*=t,u*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],l=n[i+2],u=n[i+3],h=r[o],c=r[o+1],d=r[o+2],p=r[o+3];return t[e]=s*p+u*h+a*d-l*c,t[e+1]=a*p+u*c+l*h-s*d,t[e+2]=l*p+u*d+s*c-a*h,t[e+3]=u*p-s*h-a*c-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(n/2),u=s(i/2),h=s(r/2),c=a(n/2),d=a(i/2),p=a(r/2);switch(o){case"XYZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"YXZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"ZXY":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"ZYX":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"YZX":this._x=c*u*h+l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h-c*d*p;break;case"XZY":this._x=c*u*h-l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],u=e[6],h=e[10],c=n+s+h;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(u-a)*t,this._y=(r-l)*t,this._z=(o-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(u-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+u)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(o-i)/t,this._x=(r+l)/t,this._y=(a+u)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Yn(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+o*s+i*l-r*a,this._y=i*u+o*a+r*s-n*l,this._z=r*u+o*l+n*a-i*s,this._w=o*u-n*s-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),u=Math.atan2(l,s),h=Math.sin((1-e)*u)/l,c=Math.sin(e*u)/l;return this._w=o*h+this._w*c,this._x=n*h+this._x*c,this._y=i*h+this._y*c,this._z=r*h+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}di.prototype.isQuaternion=!0;class pi{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(mi.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(mi.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*i-s*n,u=a*n+s*e-r*i,h=a*i+r*n-o*e,c=-r*e-o*n-s*i;return this.x=l*a+c*-r+u*-s-h*-o,this.y=u*a+c*-o+h*-r-l*-s,this.z=h*a+c*-s+l*-o-u*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return fi.copy(this).projectOnVector(t),this.sub(fi)}reflect(t){return this.sub(fi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Yn(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}pi.prototype.isVector3=!0;const fi=new pi,mi=new di;class gi{constructor(t=new pi(1/0,1/0,1/0),e=new pi(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],u=t[a+1],h=t[a+2];l<e&&(e=l),u<n&&(n=u),h<i&&(i=h),l>r&&(r=l),u>o&&(o=u),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),u=t.getY(a),h=t.getZ(a);l<e&&(e=l),u<n&&(n=u),h<i&&(i=h),l>r&&(r=l),u>o&&(o=u),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=_i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),yi.copy(e.boundingBox),yi.applyMatrix4(t.matrixWorld),this.union(yi));const n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,_i),_i.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Mi),Ai.subVectors(this.max,Mi),xi.subVectors(t.a,Mi),bi.subVectors(t.b,Mi),wi.subVectors(t.c,Mi),Ti.subVectors(bi,xi),Si.subVectors(wi,bi),Ei.subVectors(xi,wi);let e=[0,-Ti.z,Ti.y,0,-Si.z,Si.y,0,-Ei.z,Ei.y,Ti.z,0,-Ti.x,Si.z,0,-Si.x,Ei.z,0,-Ei.x,-Ti.y,Ti.x,0,-Si.y,Si.x,0,-Ei.y,Ei.x,0];return!!Pi(e,xi,bi,wi,Ai)&&(e=[1,0,0,0,1,0,0,0,1],!!Pi(e,xi,bi,wi,Ai)&&(Ri.crossVectors(Ti,Si),e=[Ri.x,Ri.y,Ri.z],Pi(e,xi,bi,wi,Ai)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return _i.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(_i).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(vi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),vi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),vi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),vi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),vi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),vi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),vi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),vi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(vi)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}gi.prototype.isBox3=!0;const vi=[new pi,new pi,new pi,new pi,new pi,new pi,new pi,new pi],_i=new pi,yi=new gi,xi=new pi,bi=new pi,wi=new pi,Ti=new pi,Si=new pi,Ei=new pi,Mi=new pi,Ai=new pi,Ri=new pi,Ci=new pi;function Pi(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){Ci.fromArray(t,o);const s=r.x*Math.abs(Ci.x)+r.y*Math.abs(Ci.y)+r.z*Math.abs(Ci.z),a=e.dot(Ci),l=n.dot(Ci),u=i.dot(Ci);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>s)return!1}return!0}const Ii=new gi,Oi=new pi,Li=new pi,Ni=new pi;class Di{constructor(t=new pi,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Ii.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Ni.subVectors(t,this.center);const e=Ni.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(Ni.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return Li.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Oi.copy(t.center).add(Li)),this.expandByPoint(Oi.copy(t.center).sub(Li)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Fi=new pi,Bi=new pi,Ui=new pi,ki=new pi,Gi=new pi,Hi=new pi,zi=new pi;class ji{constructor(t=new pi,e=new pi(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Fi)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Fi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Fi.copy(this.direction).multiplyScalar(e).add(this.origin),Fi.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Bi.copy(t).add(e).multiplyScalar(.5),Ui.copy(e).sub(t).normalize(),ki.copy(this.origin).sub(Bi);const r=.5*t.distanceTo(e),o=-this.direction.dot(Ui),s=ki.dot(this.direction),a=-ki.dot(Ui),l=ki.lengthSq(),u=Math.abs(1-o*o);let h,c,d,p;if(u>0)if(h=o*a-s,c=o*s-a,p=r*u,h>=0)if(c>=-p)if(c<=p){const t=1/u;h*=t,c*=t,d=h*(h+o*c+2*s)+c*(o*h+c+2*a)+l}else c=r,h=Math.max(0,-(o*c+s)),d=-h*h+c*(c+2*a)+l;else c=-r,h=Math.max(0,-(o*c+s)),d=-h*h+c*(c+2*a)+l;else c<=-p?(h=Math.max(0,-(-o*r+s)),c=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+c*(c+2*a)+l):c<=p?(h=0,c=Math.min(Math.max(-r,-a),r),d=c*(c+2*a)+l):(h=Math.max(0,-(o*r+s)),c=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+c*(c+2*a)+l);else c=o>0?-r:r,h=Math.max(0,-(o*c+s)),d=-h*h+c*(c+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Ui).multiplyScalar(c).add(Bi),d}intersectSphere(t,e){Fi.subVectors(t.center,this.origin);const n=Fi.dot(this.direction),i=Fi.dot(Fi)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,s,a;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,c=this.origin;return l>=0?(n=(t.min.x-c.x)*l,i=(t.max.x-c.x)*l):(n=(t.max.x-c.x)*l,i=(t.min.x-c.x)*l),u>=0?(r=(t.min.y-c.y)*u,o=(t.max.y-c.y)*u):(r=(t.max.y-c.y)*u,o=(t.min.y-c.y)*u),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),h>=0?(s=(t.min.z-c.z)*h,a=(t.max.z-c.z)*h):(s=(t.max.z-c.z)*h,a=(t.min.z-c.z)*h),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Fi)}intersectTriangle(t,e,n,i,r){Gi.subVectors(e,t),Hi.subVectors(n,t),zi.crossVectors(Gi,Hi);let o,s=this.direction.dot(zi);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}ki.subVectors(this.origin,t);const a=o*this.direction.dot(Hi.crossVectors(ki,Hi));if(a<0)return null;const l=o*this.direction.dot(Gi.cross(ki));if(l<0)return null;if(a+l>s)return null;const u=-o*ki.dot(zi);return u<0?null:this.at(u/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Vi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,l,u,h,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=u,g[10]=h,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Vi).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Wi.setFromMatrixColumn(t,0).length(),r=1/Wi.setFromMatrixColumn(t,1).length(),o=1/Wi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*u,n=o*h,i=s*u,r=s*h;e[0]=a*u,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*u,n=a*h,i=l*u,r=l*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*l,e[1]=o*h,e[5]=o*u,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*u,n=a*h,i=l*u,r=l*h;e[0]=t-r*s,e[4]=-o*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*u,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*u,n=o*h,i=s*u,r=s*h;e[0]=a*u,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*u,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*u,e[9]=-s*u,e[2]=-l*u,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*u,e[4]=-h,e[8]=l*u,e[1]=t*h+r,e[5]=o*u,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*u,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(qi,t,Yi)}lookAt(t,e,n){const i=this.elements;return Ki.subVectors(t,e),0===Ki.lengthSq()&&(Ki.z=1),Ki.normalize(),Zi.crossVectors(n,Ki),0===Zi.lengthSq()&&(1===Math.abs(n.z)?Ki.x+=1e-4:Ki.z+=1e-4,Ki.normalize(),Zi.crossVectors(n,Ki)),Zi.normalize(),Ji.crossVectors(Ki,Zi),i[0]=Zi.x,i[4]=Ji.x,i[8]=Ki.x,i[1]=Zi.y,i[5]=Ji.y,i[9]=Ki.y,i[2]=Zi.z,i[6]=Ji.z,i[10]=Ki.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],u=n[1],h=n[5],c=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],y=n[11],x=n[15],b=i[0],w=i[4],T=i[8],S=i[12],E=i[1],M=i[5],A=i[9],R=i[13],C=i[2],P=i[6],I=i[10],O=i[14],L=i[3],N=i[7],D=i[11],F=i[15];return r[0]=o*b+s*E+a*C+l*L,r[4]=o*w+s*M+a*P+l*N,r[8]=o*T+s*A+a*I+l*D,r[12]=o*S+s*R+a*O+l*F,r[1]=u*b+h*E+c*C+d*L,r[5]=u*w+h*M+c*P+d*N,r[9]=u*T+h*A+c*I+d*D,r[13]=u*S+h*R+c*O+d*F,r[2]=p*b+f*E+m*C+g*L,r[6]=p*w+f*M+m*P+g*N,r[10]=p*T+f*A+m*I+g*D,r[14]=p*S+f*R+m*O+g*F,r[3]=v*b+_*E+y*C+x*L,r[7]=v*w+_*M+y*P+x*N,r[11]=v*T+_*A+y*I+x*D,r[15]=v*S+_*R+y*O+x*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],u=t[2],h=t[6],c=t[10],d=t[14];return t[3]*(+r*a*h-i*l*h-r*s*c+n*l*c+i*s*d-n*a*d)+t[7]*(+e*a*d-e*l*c+r*o*c-i*o*d+i*l*u-r*a*u)+t[11]*(+e*l*h-e*s*d-r*o*h+n*o*d+r*s*u-n*l*u)+t[15]*(-i*s*u-e*a*h+e*s*c+i*o*h-n*o*c+n*a*u)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*c*l+f*a*d-s*m*d-h*a*g+s*c*g,_=p*c*l-u*m*l-p*a*d+o*m*d+u*a*g-o*c*g,y=u*f*l-p*h*l+p*s*d-o*f*d-u*s*g+o*h*g,x=p*h*a-u*f*a-p*s*c+o*f*c+u*s*m-o*h*m,b=e*v+n*_+i*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=v*w,t[1]=(f*c*r-h*m*r-f*i*d+n*m*d+h*i*g-n*c*g)*w,t[2]=(s*m*r-f*a*r+f*i*l-n*m*l-s*i*g+n*a*g)*w,t[3]=(h*a*r-s*c*r-h*i*l+n*c*l+s*i*d-n*a*d)*w,t[4]=_*w,t[5]=(u*m*r-p*c*r+p*i*d-e*m*d-u*i*g+e*c*g)*w,t[6]=(p*a*r-o*m*r-p*i*l+e*m*l+o*i*g-e*a*g)*w,t[7]=(o*c*r-u*a*r+u*i*l-e*c*l-o*i*d+e*a*d)*w,t[8]=y*w,t[9]=(p*h*r-u*f*r-p*n*d+e*f*d+u*n*g-e*h*g)*w,t[10]=(o*f*r-p*s*r+p*n*l-e*f*l-o*n*g+e*s*g)*w,t[11]=(u*s*r-o*h*r-u*n*l+e*h*l+o*n*d-e*s*d)*w,t[12]=x*w,t[13]=(u*f*i-p*h*i+p*n*c-e*f*c-u*n*m+e*h*m)*w,t[14]=(p*s*i-o*f*i-p*n*a+e*f*a+o*n*m-e*s*m)*w,t[15]=(o*h*i-u*s*i+u*n*a-e*h*a-o*n*c+e*s*c)*w,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,l=r*o,u=r*s;return this.set(l*o+n,l*s-i*a,l*a+i*s,0,l*s+i*a,u*s+n,u*a-i*o,0,l*a-i*s,u*a+i*o,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,o){return this.set(1,n,r,0,t,1,o,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,u=o+o,h=s+s,c=r*l,d=r*u,p=r*h,f=o*u,m=o*h,g=s*h,v=a*l,_=a*u,y=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+y)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(c+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+_)*w,i[9]=(m-v)*w,i[10]=(1-(c+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Wi.set(i[0],i[1],i[2]).length();const o=Wi.set(i[4],i[5],i[6]).length(),s=Wi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Xi.copy(this);const a=1/r,l=1/o,u=1/s;return Xi.elements[0]*=a,Xi.elements[1]*=a,Xi.elements[2]*=a,Xi.elements[4]*=l,Xi.elements[5]*=l,Xi.elements[6]*=l,Xi.elements[8]*=u,Xi.elements[9]*=u,Xi.elements[10]*=u,e.setFromRotationMatrix(Xi),n.x=r,n.y=o,n.z=s,this}makePerspective(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(n-i),u=(e+t)/(e-t),h=(n+i)/(n-i),c=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=c,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),l=1/(n-i),u=1/(o-r),h=(e+t)*a,c=(n+i)*l,d=(o+r)*u;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-c,s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}Vi.prototype.isMatrix4=!0;const Wi=new pi,Xi=new Vi,qi=new pi(0,0,0),Yi=new pi(1,1,1),Zi=new pi,Ji=new pi,Ki=new pi,$i=new Vi,Qi=new di;class tr{constructor(t=0,e=0,n=0,i=tr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],o=i[4],s=i[8],a=i[1],l=i[5],u=i[9],h=i[2],c=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Yn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Yn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-Yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return $i.makeRotationFromQuaternion(t),this.setFromRotationMatrix($i,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Qi.setFromEuler(this),this.setFromQuaternion(Qi,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new pi(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}tr.prototype.isEuler=!0,tr.DefaultOrder="XYZ",tr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class er{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let nr=0;const ir=new pi,rr=new di,or=new Vi,sr=new pi,ar=new pi,lr=new pi,ur=new di,hr=new pi(1,0,0),cr=new pi(0,1,0),dr=new pi(0,0,1),pr={type:"added"},fr={type:"removed"};class mr extends zn{constructor(){super(),Object.defineProperty(this,"id",{value:nr++}),this.uuid=qn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mr.DefaultUp.clone();const t=new pi,e=new tr,n=new di,i=new pi(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Vi},normalMatrix:{value:new ni}}),this.matrix=new Vi,this.matrixWorld=new Vi,this.matrixAutoUpdate=mr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new er,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return rr.setFromAxisAngle(t,e),this.quaternion.multiply(rr),this}rotateOnWorldAxis(t,e){return rr.setFromAxisAngle(t,e),this.quaternion.premultiply(rr),this}rotateX(t){return this.rotateOnAxis(hr,t)}rotateY(t){return this.rotateOnAxis(cr,t)}rotateZ(t){return this.rotateOnAxis(dr,t)}translateOnAxis(t,e){return ir.copy(t).applyQuaternion(this.quaternion),this.position.add(ir.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(hr,t)}translateY(t){return this.translateOnAxis(cr,t)}translateZ(t){return this.translateOnAxis(dr,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(or.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?sr.copy(t):sr.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ar.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?or.lookAt(ar,sr,this.up):or.lookAt(sr,ar,this.up),this.quaternion.setFromRotationMatrix(or),i&&(or.extractRotation(i.matrixWorld),rr.setFromRotationMatrix(or),this.quaternion.premultiply(rr.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(pr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(fr)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(fr)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),or.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),or.multiply(t.parent.matrixWorld)),t.applyMatrix4(or),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,t,lr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,ur,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=o(t.geometries),i=o(t.materials),r=o(t.textures),s=o(t.images),a=o(t.shapes),l=o(t.skeletons),u=o(t.animations);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}mr.DefaultUp=new pi(0,1,0),mr.DefaultMatrixAutoUpdate=!0,mr.prototype.isObject3D=!0;const gr=new pi,vr=new pi,_r=new pi,yr=new pi,xr=new pi,br=new pi,wr=new pi,Tr=new pi,Sr=new pi,Er=new pi;class Mr{constructor(t=new pi,e=new pi,n=new pi){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),gr.subVectors(t,e),i.cross(gr);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){gr.subVectors(i,e),vr.subVectors(n,e),_r.subVectors(t,e);const o=gr.dot(gr),s=gr.dot(vr),a=gr.dot(_r),l=vr.dot(vr),u=vr.dot(_r),h=o*l-s*s;if(0===h)return r.set(-2,-1,-1);const c=1/h,d=(l*a-s*u)*c,p=(o*u-s*a)*c;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,yr),yr.x>=0&&yr.y>=0&&yr.x+yr.y<=1}static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,yr),a.set(0,0),a.addScaledVector(r,yr.x),a.addScaledVector(o,yr.y),a.addScaledVector(s,yr.z),a}static isFrontFacing(t,e,n,i){return gr.subVectors(n,e),vr.subVectors(t,e),gr.cross(vr).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return gr.subVectors(this.c,this.b),vr.subVectors(this.a,this.b),.5*gr.cross(vr).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Mr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Mr.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return Mr.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Mr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Mr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let o,s;xr.subVectors(i,n),br.subVectors(r,n),Tr.subVectors(t,n);const a=xr.dot(Tr),l=br.dot(Tr);if(a<=0&&l<=0)return e.copy(n);Sr.subVectors(t,i);const u=xr.dot(Sr),h=br.dot(Sr);if(u>=0&&h<=u)return e.copy(i);const c=a*h-u*l;if(c<=0&&a>=0&&u<=0)return o=a/(a-u),e.copy(n).addScaledVector(xr,o);Er.subVectors(t,r);const d=xr.dot(Er),p=br.dot(Er);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(br,s);const m=u*p-d*h;if(m<=0&&h-u>=0&&d-p>=0)return wr.subVectors(r,i),s=(h-u)/(h-u+(d-p)),e.copy(i).addScaledVector(wr,s);const g=1/(m+f+c);return o=f*g,s=c*g,e.copy(n).addScaledVector(xr,o).addScaledVector(br,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ar=0;class Rr extends zn{constructor(){super(),Object.defineProperty(this,"id",{value:Ar++}),this.uuid=qn(),this.name="",this.type="Material",this.fog=!0,this.blending=M,this.side=x,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=G,this.blendDst=H,this.blendEquation=I,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=J,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Pn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gn,this.stencilZFail=gn,this.stencilZPass=gn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===T;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==M&&(n.blending=this.blending),this.side!==x&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}Rr.prototype.isMaterial=!0;const Cr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Pr={h:0,s:0,l:0},Ir={h:0,s:0,l:0};function Or(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Lr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Nr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Dr{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Zn(t,1),e=Yn(e,0,1),n=Yn(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=Or(r,i,t+1/3),this.g=Or(r,i,t),this.b=Or(r,i,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Cr[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Lr(t.r),this.g=Lr(t.g),this.b=Lr(t.b),this}copyLinearToSRGB(t){return this.r=Nr(t.r),this.g=Nr(t.g),this.b=Nr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),o=Math.min(e,n,i);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(n-i)/t+(n<i?6:0);break;case n:s=(i-e)/t+2;break;case i:s=(e-n)/t+4}s/=6}return t.h=s,t.s=a,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(Pr),Pr.h+=t,Pr.s+=e,Pr.l+=n,this.setHSL(Pr.h,Pr.s,Pr.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Pr),t.getHSL(Ir);const n=Jn(Pr.h,Ir.h,e),i=Jn(Pr.s,Ir.s,e),r=Jn(Pr.l,Ir.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Dr.NAMES=Cr,Dr.prototype.isColor=!0,Dr.prototype.r=1,Dr.prototype.g=1,Dr.prototype.b=1;class Fr extends Rr{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Dr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=et,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this}}Fr.prototype.isMeshBasicMaterial=!0;const Br=new pi,Ur=new ei;class kr{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=In,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new Dr),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new ei),e[n++]=r.x,e[n++]=r.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new pi),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new li),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ur.fromBufferAttribute(this,e),Ur.applyMatrix3(t),this.setXY(e,Ur.x,Ur.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Br.fromBufferAttribute(this,e),Br.applyMatrix3(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.applyMatrix4(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.applyNormalMatrix(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.transformDirection(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==In&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}kr.prototype.isBufferAttribute=!0;class Gr extends kr{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Hr extends kr{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class zr extends kr{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class jr extends kr{constructor(t,e,n){super(new Int16Array(t),e,n)}}class Vr extends kr{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Wr extends kr{constructor(t,e,n){super(new Int32Array(t),e,n)}}class Xr extends kr{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class qr extends kr{constructor(t,e,n){super(new Uint16Array(t),e,n)}}qr.prototype.isFloat16BufferAttribute=!0;class Yr extends kr{constructor(t,e,n){super(new Float32Array(t),e,n)}}class Zr extends kr{constructor(t,e,n){super(new Float64Array(t),e,n)}}function Jr(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}const Kr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $r(t,e){return new Kr[t](e)}let Qr=0;const to=new Vi,eo=new mr,no=new pi,io=new gi,ro=new gi,oo=new pi;class so extends zn{constructor(){super(),Object.defineProperty(this,"id",{value:Qr++}),this.uuid=qn(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Jr(t)>65535?Xr:Vr)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new ni).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return to.makeRotationFromQuaternion(t),this.applyMatrix4(to),this}rotateX(t){return to.makeRotationX(t),this.applyMatrix4(to),this}rotateY(t){return to.makeRotationY(t),this.applyMatrix4(to),this}rotateZ(t){return to.makeRotationZ(t),this.applyMatrix4(to),this}translate(t,e,n){return to.makeTranslation(t,e,n),this.applyMatrix4(to),this}scale(t,e,n){return to.makeScale(t,e,n),this.applyMatrix4(to),this}lookAt(t){return eo.lookAt(t),eo.updateMatrix(),this.applyMatrix4(eo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(no).negate(),this.translate(no.x,no.y,no.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Yr(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new gi);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new pi(-1/0,-1/0,-1/0),new pi(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];io.setFromBufferAttribute(n),this.morphTargetsRelative?(oo.addVectors(this.boundingBox.min,io.min),this.boundingBox.expandByPoint(oo),oo.addVectors(this.boundingBox.max,io.max),this.boundingBox.expandByPoint(oo)):(this.boundingBox.expandByPoint(io.min),this.boundingBox.expandByPoint(io.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Di);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new pi,1/0);if(t){const n=this.boundingSphere.center;if(io.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];ro.setFromBufferAttribute(n),this.morphTargetsRelative?(oo.addVectors(io.min,ro.min),io.expandByPoint(oo),oo.addVectors(io.max,ro.max),io.expandByPoint(oo)):(io.expandByPoint(ro.min),io.expandByPoint(ro.max))}io.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)oo.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(oo));if(e)for(let r=0,o=e.length;r<o;r++){const o=e[r],s=this.morphTargetsRelative;for(let e=0,r=o.count;e<r;e++)oo.fromBufferAttribute(o,e),s&&(no.fromBufferAttribute(t,e),oo.add(no)),i=Math.max(i,n.distanceToSquared(oo))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,o=e.uv.array,s=i.length/3;void 0===e.tangent&&this.setAttribute("tangent",new kr(new Float32Array(4*s),4));const a=e.tangent.array,l=[],u=[];for(let t=0;t<s;t++)l[t]=new pi,u[t]=new pi;const h=new pi,c=new pi,d=new pi,p=new ei,f=new ei,m=new ei,g=new pi,v=new pi;function _(t,e,n){h.fromArray(i,3*t),c.fromArray(i,3*e),d.fromArray(i,3*n),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),c.sub(h),d.sub(h),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(g.copy(c).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(r),v.copy(d).multiplyScalar(f.x).addScaledVector(c,-m.x).multiplyScalar(r),l[t].add(g),l[e].add(g),l[n].add(g),u[t].add(v),u[e].add(v),u[n].add(v))}let y=this.groups;0===y.length&&(y=[{start:0,count:n.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)_(n[t+0],n[t+1],n[t+2])}const x=new pi,b=new pi,w=new pi,T=new pi;function S(t){w.fromArray(r,3*t),T.copy(w);const e=l[t];x.copy(e),x.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(T,e);const n=b.dot(u[t])<0?-1:1;a[4*t]=x.x,a[4*t+1]=x.y,a[4*t+2]=x.z,a[4*t+3]=n}for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)S(n[t+0]),S(n[t+1]),S(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new kr(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new pi,r=new pi,o=new pi,s=new pi,a=new pi,l=new pi,u=new pi,h=new pi;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),s.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(u),a.add(u),l.add(u),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),n.setXYZ(t+0,u.x,u.y,u.z),n.setXYZ(t+1,u.x,u.y,u.z),n.setXYZ(t+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,o=t.attributes[i],s=o.array,a=o.itemSize*e,l=Math.min(s.length,r.length-a);for(let t=0,e=a;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)oo.fromBufferAttribute(t,e),oo.normalize(),t.setXYZ(e,oo.x,oo.y,oo.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,o=new n.constructor(e.length*i);let s=0,a=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)o[a++]=n[s++]}return new kr(o,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new so,n=this.index.array,i=this.attributes;for(const r in i){const o=t(i[r],n);e.setAttribute(r,o)}const r=this.morphAttributes;for(const i in r){const o=[],s=r[i];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);o.push(i)}e.morphAttributes[i]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,n=o.length;t<n;t++){const n=o[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];o.push(i.toJSON(t.data))}o.length>0&&(i[e]=o,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new so).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}so.prototype.isBufferGeometry=!0;const ao=new Vi,lo=new ji,uo=new Di,ho=new pi,co=new pi,po=new pi,fo=new pi,mo=new pi,go=new pi,vo=new pi,_o=new pi,yo=new pi,xo=new ei,bo=new ei,wo=new ei,To=new pi,So=new pi;class Eo extends mr{constructor(t=new so,e=new Fr){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),uo.copy(n.boundingSphere),uo.applyMatrix4(r),!1===t.ray.intersectsSphere(uo))return;if(ao.copy(r).invert(),lo.copy(t.ray).applyMatrix4(ao),null!==n.boundingBox&&!1===lo.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,u=n.attributes.uv,h=n.attributes.uv2,c=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=c.length;n<p;n++){const p=c[n],f=i[p.materialIndex];for(let n=Math.max(p.start,d.start),i=Math.min(p.start+p.count,d.start+d.count);n<i;n+=3){const i=r.getX(n),c=r.getX(n+1),d=r.getX(n+2);o=Mo(this,f,t,lo,s,a,l,u,h,i,c,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else{for(let n=Math.max(0,d.start),c=Math.min(r.count,d.start+d.count);n<c;n+=3){const c=r.getX(n),d=r.getX(n+1),p=r.getX(n+2);o=Mo(this,i,t,lo,s,a,l,u,h,c,d,p),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}}else if(void 0!==s)if(Array.isArray(i))for(let n=0,r=c.length;n<r;n++){const r=c[n],p=i[r.materialIndex];for(let n=Math.max(r.start,d.start),i=Math.min(r.start+r.count,d.start+d.count);n<i;n+=3){o=Mo(this,p,t,lo,s,a,l,u,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=r.materialIndex,e.push(o))}}else{for(let n=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);n<r;n+=3){o=Mo(this,i,t,lo,s,a,l,u,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Mo(t,e,n,i,r,o,s,a,l,u,h,c){ho.fromBufferAttribute(r,u),co.fromBufferAttribute(r,h),po.fromBufferAttribute(r,c);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){vo.set(0,0,0),_o.set(0,0,0),yo.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],n=o[t];0!==e&&(fo.fromBufferAttribute(n,u),mo.fromBufferAttribute(n,h),go.fromBufferAttribute(n,c),s?(vo.addScaledVector(fo,e),_o.addScaledVector(mo,e),yo.addScaledVector(go,e)):(vo.addScaledVector(fo.sub(ho),e),_o.addScaledVector(mo.sub(co),e),yo.addScaledVector(go.sub(po),e)))}ho.add(vo),co.add(_o),po.add(yo)}t.isSkinnedMesh&&(t.boneTransform(u,ho),t.boneTransform(h,co),t.boneTransform(c,po));const p=function(t,e,n,i,r,o,s,a){let l;if(l=e.side===b?i.intersectTriangle(s,o,r,!0,a):i.intersectTriangle(r,o,s,e.side!==w,a),null===l)return null;So.copy(a),So.applyMatrix4(t.matrixWorld);const u=n.ray.origin.distanceTo(So);return u<n.near||u>n.far?null:{distance:u,point:So.clone(),object:t}}(t,e,n,i,ho,co,po,To);if(p){a&&(xo.fromBufferAttribute(a,u),bo.fromBufferAttribute(a,h),wo.fromBufferAttribute(a,c),p.uv=Mr.getUV(To,ho,co,po,xo,bo,wo,new ei)),l&&(xo.fromBufferAttribute(l,u),bo.fromBufferAttribute(l,h),wo.fromBufferAttribute(l,c),p.uv2=Mr.getUV(To,ho,co,po,xo,bo,wo,new ei));const t={a:u,b:h,c:c,normal:new pi,materialIndex:0};Mr.getNormal(ho,co,po,t.normal),p.face=t}return p}Eo.prototype.isMesh=!0;class Ao extends so{constructor(t=1,e=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const s=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const a=[],l=[],u=[],h=[];let c=0,d=0;function p(t,e,n,i,r,o,p,f,m,g,v){const _=o/m,y=p/g,x=o/2,b=p/2,w=f/2,T=m+1,S=g+1;let E=0,M=0;const A=new pi;for(let o=0;o<S;o++){const s=o*y-b;for(let a=0;a<T;a++){const c=a*_-x;A[t]=c*i,A[e]=s*r,A[n]=w,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),h.push(a/m),h.push(1-o/g),E+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=c+e+T*t,i=c+e+T*(t+1),r=c+(e+1)+T*(t+1),o=c+(e+1)+T*t;a.push(n,i,o),a.push(i,r,o),M+=6}s.addGroup(d,M,v),d+=M,c+=E}p("z","y","x",-1,-1,n,e,t,o,r,0),p("z","y","x",1,-1,n,e,-t,o,r,1),p("x","z","y",1,1,t,n,e,i,o,2),p("x","z","y",1,-1,t,n,-e,i,o,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new Yr(l,3)),this.setAttribute("normal",new Yr(u,3)),this.setAttribute("uv",new Yr(h,2))}static fromJSON(t){return new Ao(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ro(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Co(t){const e={};for(let n=0;n<t.length;n++){const i=Ro(t[n]);for(const t in i)e[t]=i[t]}return e}const Po={clone:Ro,merge:Co};class Io extends Rr{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ro(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}Io.prototype.isShaderMaterial=!0;class Oo extends mr{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Vi,this.projectionMatrix=new Vi,this.projectionMatrixInverse=new Vi}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Oo.prototype.isCamera=!0;class Lo extends Oo{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Xn*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Wn*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Xn*Math.atan(Math.tan(.5*Wn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Wn*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Lo.prototype.isPerspectiveCamera=!0;class No extends mr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new Lo(90,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new pi(1,0,0)),this.add(i);const r=new Lo(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new pi(-1,0,0)),this.add(r);const o=new Lo(90,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new pi(0,1,0)),this.add(o);const s=new Lo(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new pi(0,-1,0)),this.add(s);const a=new Lo(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new pi(0,0,1)),this.add(a);const l=new Lo(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new pi(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,o,s,a,l]=this.children,u=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const c=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=c,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=u}}class Do extends si{constructor(t,e,n,i,r,o,s,a,l,u){super(t=void 0!==t?t:[],e=void 0!==e?e:ct,n,i,r,o,s=void 0!==s?s:jt,a,l,u),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Do.prototype.isCubeTexture=!0;class Fo extends ui{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new Do(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Et,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Vt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Ao(5,5,5),r=new Io({name:"CubemapFromEquirect",uniforms:Ro(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:b,blending:E});r.uniforms.tEquirect.value=e;const o=new Eo(i,r),s=e.minFilter;e.minFilter===Rt&&(e.minFilter=Et);return new No(1,10,this).update(t,o),e.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}Fo.prototype.isWebGLCubeRenderTarget=!0;const Bo=new pi,Uo=new pi,ko=new ni;class Go{constructor(t=new pi(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Bo.subVectors(n,e).cross(Uo.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(Bo),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||ko.getNormalMatrix(t),i=this.coplanarPoint(Bo).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Go.prototype.isPlane=!0;const Ho=new Di,zo=new pi;class jo{constructor(t=new Go,e=new Go,n=new Go,i=new Go,r=new Go,o=new Go){this.planes=[t,e,n,i,r,o]}set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],l=n[5],u=n[6],h=n[7],c=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],_=n[15];return e[0].setComponents(s-i,h-a,f-c,_-m).normalize(),e[1].setComponents(s+i,h+a,f+c,_+m).normalize(),e[2].setComponents(s+r,h+l,f+d,_+g).normalize(),e[3].setComponents(s-r,h-l,f-d,_-g).normalize(),e[4].setComponents(s-o,h-u,f-p,_-v).normalize(),e[5].setComponents(s+o,h+u,f+p,_+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ho.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ho)}intersectsSprite(t){return Ho.center.set(0,0,0),Ho.radius=.7071067811865476,Ho.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ho)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(zo.x=i.normal.x>0?t.max.x:t.min.x,zo.y=i.normal.y>0?t.max.y:t.min.y,zo.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(zo)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Vo(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Wo(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=i.get(e);void 0===o?i.set(e,function(e,i){const r=e.array,o=e.usage,s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,r,o),e.onUploadCallback();let a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(a=5121),{buffer:s,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(!function(e,i,r){const o=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,o):(n?t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,e,r),o.version=e.version)}}}class Xo extends so{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,o=e/2,s=Math.floor(n),a=Math.floor(i),l=s+1,u=a+1,h=t/s,c=e/a,d=[],p=[],f=[],m=[];for(let t=0;t<u;t++){const e=t*c-o;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/s),m.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<s;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),o=e+1+l*t;d.push(n,i,o),d.push(i,r,o)}this.setIndex(d),this.setAttribute("position",new Yr(p,3)),this.setAttribute("normal",new Yr(f,3)),this.setAttribute("uv",new Yr(m,2))}static fromJSON(t){return new Xo(t.width,t.height,t.widthSegments,t.heightSegments)}}const qo={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <transmission_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Yo={common:{diffuse:{value:new Dr(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ni},uv2Transform:{value:new ni},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ei(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Dr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Dr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ni}},sprite:{diffuse:{value:new Dr(16777215)},opacity:{value:1},center:{value:new ei(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ni}}},Zo={basic:{uniforms:Co([Yo.common,Yo.specularmap,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.fog]),vertexShader:qo.meshbasic_vert,fragmentShader:qo.meshbasic_frag},lambert:{uniforms:Co([Yo.common,Yo.specularmap,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)}}]),vertexShader:qo.meshlambert_vert,fragmentShader:qo.meshlambert_frag},phong:{uniforms:Co([Yo.common,Yo.specularmap,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)},specular:{value:new Dr(1118481)},shininess:{value:30}}]),vertexShader:qo.meshphong_vert,fragmentShader:qo.meshphong_frag},standard:{uniforms:Co([Yo.common,Yo.envmap,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.roughnessmap,Yo.metalnessmap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qo.meshphysical_vert,fragmentShader:qo.meshphysical_frag},toon:{uniforms:Co([Yo.common,Yo.aomap,Yo.lightmap,Yo.emissivemap,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.gradientmap,Yo.fog,Yo.lights,{emissive:{value:new Dr(0)}}]),vertexShader:qo.meshtoon_vert,fragmentShader:qo.meshtoon_frag},matcap:{uniforms:Co([Yo.common,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,Yo.fog,{matcap:{value:null}}]),vertexShader:qo.meshmatcap_vert,fragmentShader:qo.meshmatcap_frag},points:{uniforms:Co([Yo.points,Yo.fog]),vertexShader:qo.points_vert,fragmentShader:qo.points_frag},dashed:{uniforms:Co([Yo.common,Yo.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qo.linedashed_vert,fragmentShader:qo.linedashed_frag},depth:{uniforms:Co([Yo.common,Yo.displacementmap]),vertexShader:qo.depth_vert,fragmentShader:qo.depth_frag},normal:{uniforms:Co([Yo.common,Yo.bumpmap,Yo.normalmap,Yo.displacementmap,{opacity:{value:1}}]),vertexShader:qo.normal_vert,fragmentShader:qo.normal_frag},sprite:{uniforms:Co([Yo.sprite,Yo.fog]),vertexShader:qo.sprite_vert,fragmentShader:qo.sprite_frag},background:{uniforms:{uvTransform:{value:new ni},t2D:{value:null}},vertexShader:qo.background_vert,fragmentShader:qo.background_frag},cube:{uniforms:Co([Yo.envmap,{opacity:{value:1}}]),vertexShader:qo.cube_vert,fragmentShader:qo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qo.equirect_vert,fragmentShader:qo.equirect_frag},distanceRGBA:{uniforms:Co([Yo.common,Yo.displacementmap,{referencePosition:{value:new pi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qo.distanceRGBA_vert,fragmentShader:qo.distanceRGBA_frag},shadow:{uniforms:Co([Yo.lights,Yo.fog,{color:{value:new Dr(0)},opacity:{value:1}}]),vertexShader:qo.shadow_vert,fragmentShader:qo.shadow_frag}};function Jo(t,e,n,i,r){const o=new Dr(0);let s,a,l=0,u=null,h=0,c=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(n,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?d(o,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===mt)?(void 0===a&&(a=new Eo(new Ao(1,1,1),new Io({name:"BackgroundCubeMaterial",uniforms:Ro(Zo.cube.uniforms),vertexShader:Zo.cube.vertexShader,fragmentShader:Zo.cube.fragmentShader,side:b,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(a)),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,u===f&&h===f.version&&c===t.toneMapping||(a.material.needsUpdate=!0,u=f,h=f.version,c=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Eo(new Xo(2,2),new Io({name:"BackgroundMaterial",uniforms:Ro(Zo.background.uniforms),vertexShader:Zo.background.vertexShader,fragmentShader:Zo.background.fragmentShader,side:x,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),u===f&&h===f.version&&c===t.toneMapping||(s.material.needsUpdate=!0,u=f,h=f.version,c=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function Ko(t,e,n,i){const r=t.getParameter(34921),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==o,a={},l=d(null);let u=l;function h(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function c(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function p(){const t=u.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,r){const o=u.newAttributes,s=u.enabledAttributes,a=u.attributeDivisors;if(o[n]=1,0===s[n]&&(t.enableVertexAttribArray(n),s[n]=1),a[n]!==r){(i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),a[n]=r}}function g(){const e=u.newAttributes,n=u.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function v(e,n,r,o,s,a){!0!==i.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,n,r,o,s,a):t.vertexAttribIPointer(e,n,r,s,a)}function _(){y(),u!==l&&(u=l,h(u.object))}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,c,_,y){let x=!1;if(s){const e=function(e,n,r){const s=!0===r.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let u=l[n.id];void 0===u&&(u={},l[n.id]=u);let h=u[s];void 0===h&&(h=d(i.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),u[s]=h);return h}(_,c,l);u!==e&&(u=e,h(u.object)),x=function(t,e){const n=u.attributes,i=t.attributes;let r=0;for(const t in i){const e=n[t],o=i[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;r++}return u.attributesNum!==r||u.index!==e}(_,y),x&&function(t,e){const n={},i=t.attributes;let r=0;for(const t in i){const e=i[t],o={};o.attribute=e,e.data&&(o.data=e.data),n[t]=o,r++}u.attributes=n,u.attributesNum=r,u.index=e}(_,y)}else{const t=!0===l.wireframe;u.geometry===_.id&&u.program===c.id&&u.wireframe===t||(u.geometry=_.id,u.program=c.id,u.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==y&&n.update(y,34963),x&&(!function(r,o,s,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,u=s.getAttributes(),h=o.defaultAttributeValues;for(const e in u){const i=u[e];if(i>=0){const o=l[e];if(void 0!==o){const e=o.normalized,r=o.itemSize,s=n.get(o);if(void 0===s)continue;const l=s.buffer,u=s.type,h=s.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,s=n.stride,c=o.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),t.bindBuffer(34962,l),v(i,r,u,e,s*h,c*h)}else o.isInstancedBufferAttribute?(m(i,o.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)):f(i),t.bindBuffer(34962,l),v(i,r,u,e,0,0)}else if("instanceMatrix"===e){const e=n.get(r.instanceMatrix);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i+0,4,s,!1,64,0),t.vertexAttribPointer(i+1,4,s,!1,64,16),t.vertexAttribPointer(i+2,4,s,!1,64,32),t.vertexAttribPointer(i+3,4,s,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const o=e.buffer,s=e.type;m(i,1),t.bindBuffer(34962,o),t.vertexAttribPointer(i,3,s,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i,n);break;case 3:t.vertexAttrib3fv(i,n);break;case 4:t.vertexAttrib4fv(i,n);break;default:t.vertexAttrib1fv(i,n)}}}}g()}(r,l,c,_),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:_,resetDefaultState:y,dispose:function(){_();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)c(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const n=e[t];for(const t in n)c(n[t].object),delete n[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)c(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function $o(t,e,n,i){const r=i.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,i){t.drawArrays(o,e,i),n.update(i,o,1)},this.renderInstances=function(i,s,a){if(0===a)return;let l,u;if(r)l=t,u="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),u="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](o,i,s,a),n.update(s,o,a)}}function Qo(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||e.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),c=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),_=c>0,y=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:_&&y,maxSamples:o?t.getParameter(36183):0}}function ts(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new Go,a=new ni,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const o=null!==t?t.length:0;let u=null;if(0!==o){if(u=l.value,!0!==r||null===u){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===u||u.length<e)&&(u=new Float32Array(e));for(let e=0,n=i;e!==o;++e,n+=4)s.copy(t[e]).applyMatrix4(r,a),s.normal.toArray(u,n),u[n+3]=s.constant}l.value=u,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const s=0!==t.length||e||0!==i||r;return r=e,n=h(t,o,0),i=t.length,s},this.beginShadows=function(){o=!0,h(null)},this.endShadows=function(){o=!1,u()},this.setState=function(e,s,a){const c=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===c||0===c.length||o&&!p)o?h(null):u();else{const t=o?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=h(c,s,e,a);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function es(t){let e=new WeakMap;function n(t,e){return e===pt?t.mapping=ct:e===ft&&(t.mapping=dt),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping;if(o===pt||o===ft){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const o=r.image;if(o&&o.height>0){const s=t.getRenderTarget(),a=new Fo(o.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),t.setRenderTarget(s),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function ns(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function is(t,e,n,i){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",s),delete r[a.id];const l=o.get(a);l&&(e.remove(l),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],o=t[e+2];n.push(i,r,r,o,o,i)}}else{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const a=new(Jr(n)>65535?Xr:Vr)(n,1);a.version=s;const l=o.get(t);l&&e.remove(l),o.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return o.get(t)}}}function rs(t,e,n,i){const r=i.isWebGL2;let o,s,a;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(o,i,s,e*a),n.update(i,o,1)},this.renderInstances=function(i,l,u){if(0===u)return;let h,c;if(r)h=t,c="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[c](o,l,s,i*a,u),n.update(l,o,u)}}function os(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,i){switch(e.calls++,n){case 4:e.triangles+=i*(t/3);break;case 1:e.lines+=i*(t/2);break;case 3:e.lines+=i*(t-1);break;case 2:e.lines+=i*t;break;case 0:e.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function ss(t,e){return t[0]-e[0]}function as(t,e){return Math.abs(e[1])-Math.abs(t[1])}function ls(t){const e={},n=new Float32Array(8),i=[];for(let t=0;t<8;t++)i[t]=[t,0];return{update:function(r,o,s,a){const l=r.morphTargetInfluences,u=void 0===l?0:l.length;let h=e[o.id];if(void 0===h||h.length!==u){h=[];for(let t=0;t<u;t++)h[t]=[t,0];e[o.id]=h}for(let t=0;t<u;t++){const e=h[t];e[0]=t,e[1]=l[t]}h.sort(as);for(let t=0;t<8;t++)t<u&&h[t][1]?(i[t][0]=h[t][0],i[t][1]=h[t][1]):(i[t][0]=Number.MAX_SAFE_INTEGER,i[t][1]=0);i.sort(ss);const c=s.morphTargets&&o.morphAttributes.position,d=s.morphNormals&&o.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=i[t],r=e[0],s=e[1];r!==Number.MAX_SAFE_INTEGER&&s?(c&&o.getAttribute("morphTarget"+t)!==c[r]&&o.setAttribute("morphTarget"+t,c[r]),d&&o.getAttribute("morphNormal"+t)!==d[r]&&o.setAttribute("morphNormal"+t,d[r]),n[t]=s,p+=s):(c&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),d&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),n[t]=0)}const f=o.morphTargetsRelative?1:1-p;a.getUniforms().setValue(t,"morphTargetBaseInfluence",f),a.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function us(t,e,n,i){let r=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const s=i.render.frame,a=t.geometry,l=e.get(t,a);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}Zo.physical={uniforms:Co([Zo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ei(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Dr(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ei},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Dr(0)}}]),vertexShader:qo.meshphysical_vert,fragmentShader:qo.meshphysical_frag};class hs extends si{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=_t,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}hs.prototype.isDataTexture2DArray=!0;class cs extends si{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=xt,this.minFilter=xt,this.wrapR=_t,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}cs.prototype.isDataTexture3D=!0;const ds=new si,ps=new hs,fs=new cs,ms=new Do,gs=[],vs=[],_s=new Float32Array(16),ys=new Float32Array(9),xs=new Float32Array(4);function bs(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let o=gs[r];if(void 0===o&&(o=new Float32Array(r),gs[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)}return o}function ws(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Ts(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Ss(t,e){let n=vs[e];void 0===n&&(n=new Int32Array(e),vs[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Es(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ms(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ws(n,e))return;t.uniform2fv(this.addr,e),Ts(n,e)}}function As(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ws(n,e))return;t.uniform3fv(this.addr,e),Ts(n,e)}}function Rs(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ws(n,e))return;t.uniform4fv(this.addr,e),Ts(n,e)}}function Cs(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ws(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ts(n,e)}else{if(ws(n,i))return;xs.set(i),t.uniformMatrix2fv(this.addr,!1,xs),Ts(n,i)}}function Ps(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ws(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ts(n,e)}else{if(ws(n,i))return;ys.set(i),t.uniformMatrix3fv(this.addr,!1,ys),Ts(n,i)}}function Is(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ws(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ts(n,e)}else{if(ws(n,i))return;_s.set(i),t.uniformMatrix4fv(this.addr,!1,_s),Ts(n,i)}}function Os(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Ls(t,e){const n=this.cache;ws(n,e)||(t.uniform2iv(this.addr,e),Ts(n,e))}function Ns(t,e){const n=this.cache;ws(n,e)||(t.uniform3iv(this.addr,e),Ts(n,e))}function Ds(t,e){const n=this.cache;ws(n,e)||(t.uniform4iv(this.addr,e),Ts(n,e))}function Fs(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Bs(t,e){const n=this.cache;ws(n,e)||(t.uniform2uiv(this.addr,e),Ts(n,e))}function Us(t,e){const n=this.cache;ws(n,e)||(t.uniform3uiv(this.addr,e),Ts(n,e))}function ks(t,e){const n=this.cache;ws(n,e)||(t.uniform4uiv(this.addr,e),Ts(n,e))}function Gs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||ds,r)}function Hs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||fs,r)}function zs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||ms,r)}function js(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||ps,r)}function Vs(t,e){t.uniform1fv(this.addr,e)}function Ws(t,e){const n=bs(e,this.size,2);t.uniform2fv(this.addr,n)}function Xs(t,e){const n=bs(e,this.size,3);t.uniform3fv(this.addr,n)}function qs(t,e){const n=bs(e,this.size,4);t.uniform4fv(this.addr,n)}function Ys(t,e){const n=bs(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Zs(t,e){const n=bs(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Js(t,e){const n=bs(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ks(t,e){t.uniform1iv(this.addr,e)}function $s(t,e){t.uniform2iv(this.addr,e)}function Qs(t,e){t.uniform3iv(this.addr,e)}function ta(t,e){t.uniform4iv(this.addr,e)}function ea(t,e){t.uniform1uiv(this.addr,e)}function na(t,e){t.uniform2uiv(this.addr,e)}function ia(t,e){t.uniform3uiv(this.addr,e)}function ra(t,e){t.uniform4uiv(this.addr,e)}function oa(t,e,n){const i=e.length,r=Ss(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTexture2D(e[t]||ds,r[t])}function sa(t,e,n){const i=e.length,r=Ss(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTextureCube(e[t]||ms,r[t])}function aa(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Es;case 35664:return Ms;case 35665:return As;case 35666:return Rs;case 35674:return Cs;case 35675:return Ps;case 35676:return Is;case 5124:case 35670:return Os;case 35667:case 35671:return Ls;case 35668:case 35672:return Ns;case 35669:case 35673:return Ds;case 5125:return Fs;case 36294:return Bs;case 36295:return Us;case 36296:return ks;case 35678:case 36198:case 36298:case 36306:case 35682:return Gs;case 35679:case 36299:case 36307:return Hs;case 35680:case 36300:case 36308:case 36293:return zs;case 36289:case 36303:case 36311:case 36292:return js}}(e.type)}function la(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Vs;case 35664:return Ws;case 35665:return Xs;case 35666:return qs;case 35674:return Ys;case 35675:return Zs;case 35676:return Js;case 5124:case 35670:return Ks;case 35667:case 35671:return $s;case 35668:case 35672:return Qs;case 35669:case 35673:return ta;case 5125:return ea;case 36294:return na;case 36295:return ia;case 36296:return ra;case 35678:case 36198:case 36298:case 36306:case 35682:return oa;case 35680:case 36300:case 36308:case 36293:return sa}}(e.type)}function ua(t){this.id=t,this.seq=[],this.map={}}la.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ts(e,t)},ua.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,o=i.length;r!==o;++r){const o=i[r];o.setValue(t,e[o.id],n)}};const ha=/(\w+)(\])?(\[|\.)?/g;function ca(t,e){t.seq.push(e),t.map[e.id]=e}function da(t,e,n){const i=t.name,r=i.length;for(ha.lastIndex=0;;){const o=ha.exec(i),s=ha.lastIndex;let a=o[1];const l="]"===o[2],u=o[3];if(l&&(a|=0),void 0===u||"["===u&&s+2===r){ca(n,void 0===u?new aa(a,t,e):new la(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new ua(a),ca(n,t)),n=t}}}function pa(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);da(n,t.getUniformLocation(e,n.name),this)}}function fa(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}pa.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},pa.prototype.setOptional=function(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)},pa.upload=function(t,e,n,i){for(let r=0,o=e.length;r!==o;++r){const o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}},pa.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n};let ma=0;function ga(t){switch(t){case nn:return["Linear","( value )"];case rn:return["sRGB","( value )"];case sn:return["RGBE","( value )"];case ln:return["RGBM","( value, 7.0 )"];case un:return["RGBM","( value, 16.0 )"];case hn:return["RGBD","( value, 256.0 )"];case on:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case an:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function va(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function _a(t,e){const n=ga(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function ya(t,e){const n=ga(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function xa(t,e){let n;switch(e){case ot:n="Linear";break;case st:n="Reinhard";break;case at:n="OptimizedCineon";break;case lt:n="ACESFilmic";break;case ut:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function ba(t){return""!==t}function wa(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ta(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Sa=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ea(t){return t.replace(Sa,Ma)}function Ma(t,e){const n=qo[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Ea(n)}const Aa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ra=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ca(t){return t.replace(Ra,Ia).replace(Aa,Pa)}function Pa(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ia(t,e,n,i)}function Ia(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Oa(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function La(t,e,n,i){const r=t.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===v?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===_?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===y&&(e="SHADOWMAP_TYPE_VSM"),e}(n),u=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ct:case dt:e="ENVMAP_TYPE_CUBE";break;case mt:case gt:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case dt:case gt:e="ENVMAP_MODE_REFRACTION"}return e}(n),c=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case et:e="ENVMAP_BLENDING_MULTIPLY";break;case nt:e="ENVMAP_BLENDING_MIX";break;case it:e="ENVMAP_BLENDING_ADD"}return e}(n),d=t.gammaFactor>0?t.gammaFactor:1,p=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission>0)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ba).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(o),m=r.createProgram();let g,x,b=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(ba).join("\n"),g.length>0&&(g+="\n"),x=[p,f].filter(ba).join("\n"),x.length>0&&(x+="\n")):(g=[Oa(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ba).join("\n"),x=[p,Oa(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==rt?"#define TONE_MAPPING":"",n.toneMapping!==rt?qo.tonemapping_pars_fragment:"",n.toneMapping!==rt?xa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",qo.encodings_pars_fragment,n.map?_a("mapTexelToLinear",n.mapEncoding):"",n.matcap?_a("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?_a("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?_a("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?_a("lightMapTexelToLinear",n.lightMapEncoding):"",ya("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ba).join("\n")),s=Ea(s),s=wa(s,n),s=Ta(s,n),a=Ea(a),a=wa(a,n),a=Ta(a,n),s=Ca(s),a=Ca(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Hn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Hn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+a,T=fa(r,35633,b+g+s),S=fa(r,35632,w);if(r.attachShader(m,T),r.attachShader(m,S),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(T).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=va(r,T,"vertex"),n=va(r,S,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let E,M;return r.deleteShader(T),r.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new pa(r,m)),E},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r).name;n[i]=t.getAttribLocation(e,i)}return n}(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=ma++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=T,this.fragmentShader=S,this}function Na(t,e,n,i,r,o){const s=[],a=i.isWebGL2,l=i.logarithmicDepthBuffer,u=i.floatVertexTextures,h=i.maxVertexUniforms,c=i.vertexTextures;let d=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];function m(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=nn,e}return{getParameters:function(r,s,f,g,v){const _=g.fog,y=r.isMeshStandardMaterial?g.environment:null,x=e.get(r.envMap||y),T=p[r.type],S=v.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(u)return 1024;{const t=h,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}}(v):0;let E,M;if(null!==r.precision&&(d=i.getMaxPrecision(r.precision),d!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.")),T){const t=Zo[T];E=t.vertexShader,M=t.fragmentShader}else E=r.vertexShader,M=r.fragmentShader;const A=t.getRenderTarget();return{isWebGL2:a,shaderID:T,shaderName:r.type,vertexShader:E,fragmentShader:M,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:c,outputEncoding:null!==A?m(A.texture):t.outputEncoding,map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(x.mapping===mt||x.mapping===gt),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===fn,tangentSpaceNormalMap:r.normalMapType===pn,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmission:!!r.transmission,transmissionMap:!!r.transmissionMap,thicknessMap:!!r.thicknessMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&v.geometry&&v.geometry.attributes.color&&4===v.geometry.attributes.color.itemSize,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap||r.thicknessMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmission||r.transmissionMap||r.thicknessMap||!r.displacementMap),fog:!!_,useFog:r.fog,fogExp2:_&&_.isFogExp2,flatShading:!!r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:l,skinning:!0===v.isSkinnedMesh&&S>0,maxBones:S,useVertexTexture:u,morphTargets:r.morphTargets,morphNormals:r.morphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:rt,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===w,flipSided:r.side===b,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<f.length;t++)n.push(e[f[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=p[t.type];let n;if(e){const t=Zo[e];n=Po.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new La(t,n,e,r),s.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function Da(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Fa(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ba(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Ua(t){const e=[];let n=0;const i=[],r=[],o=[],s={id:-1};function a(i,r,o,a,l,u){let h=e[n];const c=t.get(o);return void 0===h?(h={id:i.id,object:i,geometry:r,material:o,program:c.program||s,groupOrder:a,renderOrder:i.renderOrder,z:l,group:u},e[n]=h):(h.id=i.id,h.object=i,h.geometry=r,h.material=o,h.program=c.program||s,h.groupOrder=a,h.renderOrder=i.renderOrder,h.z=l,h.group=u),n++,h}return{opaque:i,transmissive:r,transparent:o,init:function(){n=0,i.length=0,r.length=0,o.length=0},push:function(t,e,n,s,l,u){const h=a(t,e,n,s,l,u);n.transmission>0?r.push(h):!0===n.transparent?o.push(h):i.push(h)},unshift:function(t,e,n,s,l,u){const h=a(t,e,n,s,l,u);n.transmission>0?r.unshift(h):!0===n.transparent?o.unshift(h):i.unshift(h)},finish:function(){for(let t=n,i=e.length;t<i;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Fa),r.length>1&&r.sort(e||Ba),o.length>1&&o.sort(e||Ba)}}}function ka(t){let e=new WeakMap;return{get:function(n,i){let r;return!1===e.has(n)?(r=new Ua(t),e.set(n,[r])):i>=e.get(n).length?(r=new Ua(t),e.get(n).push(r)):r=e.get(n)[i],r},dispose:function(){e=new WeakMap}}}function Ga(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new pi,color:new Dr};break;case"SpotLight":n={position:new pi,direction:new pi,color:new Dr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new pi,color:new Dr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new pi,skyColor:new Dr,groundColor:new Dr};break;case"RectAreaLight":n={color:new Dr,position:new pi,halfWidth:new pi,halfHeight:new pi}}return t[e.id]=n,n}}}let Ha=0;function za(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ja(t,e){const n=new Ga,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ei};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ei,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new pi);const o=new pi,s=new Vi,a=new Vi;return{setup:function(o){let s=0,a=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let u=0,h=0,c=0,d=0,p=0,f=0,m=0,g=0;o.sort(za);for(let t=0,e=o.length;t<e;t++){const e=o[t],v=e.color,_=e.intensity,y=e.distance,x=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=v.r*_,a+=v.g*_,l+=v.b*_;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],_);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[u]=n,r.directionalShadowMap[u]=x,r.directionalShadowMatrix[u]=e.shadow.matrix,f++}r.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(v).multiplyScalar(_),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[c]=n,r.spotShadowMap[c]=x,r.spotShadowMatrix[c]=e.shadow.matrix,g++}r.spot[c]=t,c++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(v).multiplyScalar(_),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[d]=t,d++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[h]=n,r.pointShadowMap[h]=x,r.pointShadowMatrix[h]=e.shadow.matrix,m++}r.point[h]=t,h++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(_),t.groundColor.copy(e.groundColor).multiplyScalar(_),r.hemi[p]=t,p++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Yo.LTC_FLOAT_1,r.rectAreaLTC2=Yo.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Yo.LTC_HALF_1,r.rectAreaLTC2=Yo.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=a,r.ambient[2]=l;const v=r.hash;v.directionalLength===u&&v.pointLength===h&&v.spotLength===c&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(r.directional.length=u,r.spot.length=c,r.rectArea.length=d,r.point.length=h,r.hemi.length=p,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=u,v.pointLength=h,v.spotLength=c,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=Ha++)},setupView:function(t,e){let n=0,i=0,l=0,u=0,h=0;const c=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),n++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(c),l++}else if(d.isRectAreaLight){const t=r.rectArea[u];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),a.identity(),s.copy(d.matrixWorld),s.premultiply(c),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),u++}else if(d.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(c),i++}else if(d.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(c),t.direction.normalize(),h++}}},state:r}}function Va(t,e){const n=new ja(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(){n.setup(i)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function Wa(t,e){let n=new WeakMap;return{get:function(i,r=0){let o;return!1===n.has(i)?(o=new Va(t,e),n.set(i,[o])):r>=n.get(i).length?(o=new Va(t,e),n.get(i).push(o)):o=n.get(i)[r],o},dispose:function(){n=new WeakMap}}}class Xa extends Rr{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=cn,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Xa.prototype.isMeshDepthMaterial=!0;class qa extends Rr{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new pi,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}qa.prototype.isMeshDistanceMaterial=!0;function Ya(t,e,n){let i=new jo;const r=new ei,o=new ei,s=new li,a=[],l=[],u={},h=n.maxTextureSize,c={0:b,1:x,2:w},d=new Io({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new ei},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new so;f.setAttribute("position",new kr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Eo(f,d),g=this;function _(n,i){const r=e.update(m);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,p,m,null)}function T(t){const e=t<<0;let n=a[e];return void 0===n&&(n=new Xa({depthPacking:dn,morphTargets:t}),a[e]=n),n}function S(t){const e=t<<0;let n=l[e];return void 0===n&&(n=new qa({morphTargets:t}),l[e]=n),n}function M(e,n,i,r,o,s,a){let l=null,h=T,d=e.customDepthMaterial;if(!0===r.isPointLight&&(h=S,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===i.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0),l=h(t)}else l=d;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const t=l.uuid,e=i.uuid;let n=u[t];void 0===n&&(n={},u[t]=n);let r=n[e];void 0===r&&(r=l.clone(),n[e]=r),l=r}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=a===y?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:c[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=o,l.farDistance=s),l}function A(n,r,o,s,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===y)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,u=e.length;l<u;l++){const u=e[l],h=r[u.materialIndex];if(h&&h.visible){const e=M(n,i,h,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,u)}}}else if(r.visible){const e=M(n,i,r,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)A(l[t],r,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=v,this.render=function(e,n,a){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),u=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(E),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,u=e.length;l<u;l++){const u=e[l],c=u.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",u,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;r.copy(c.mapSize);const p=c.getFrameExtents();if(r.multiply(p),o.copy(c.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(o.x=Math.floor(h/p.x),r.x=o.x*p.x,c.mapSize.x=o.x),r.y>h&&(o.y=Math.floor(h/p.y),r.y=o.y*p.y,c.mapSize.y=o.y)),null===c.map&&!c.isPointLightShadow&&this.type===y){const t={minFilter:Et,magFilter:Et,format:Vt};c.map=new ui(r.x,r.y,t),c.map.texture.name=u.name+".shadowMap",c.mapPass=new ui(r.x,r.y,t),c.camera.updateProjectionMatrix()}if(null===c.map){const t={minFilter:xt,magFilter:xt,format:Vt};c.map=new ui(r.x,r.y,t),c.map.texture.name=u.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const f=c.getViewportCount();for(let t=0;t<f;t++){const e=c.getViewport(t);s.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(s),c.updateMatrices(u,t),i=c.getFrustum(),A(n,a,c.camera,u,this.type)}c.isPointLightShadow||this.type!==y||_(c,a),c.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,u,c)}}function Za(t,e,n){const i=n.isWebGL2;const r=new function(){let e=!1;const n=new li;let i=null;const r=new li(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,s,a){!0===a&&(e*=s,i*=s,o*=s),n.set(e,i,o,s),!1===r.equals(n)&&(t.clearColor(e,i,o,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},o=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){t?_t(2929):yt(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case q:t.depthFunc(512);break;case Y:t.depthFunc(519);break;case Z:t.depthFunc(513);break;case J:t.depthFunc(515);break;case K:t.depthFunc(514);break;case $:t.depthFunc(518);break;case Q:t.depthFunc(516);break;case tt:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},s=new function(){let e=!1,n=null,i=null,r=null,o=null,s=null,a=null,l=null,u=null;return{setTest:function(t){e||(t?_t(2960):yt(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&o===s||(t.stencilFunc(e,n,s),i=e,r=n,o=s)},setOp:function(e,n,i){s===e&&a===n&&l===i||(t.stencilOp(e,n,i),s=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,s=null,a=null,l=null,u=null}}};let a={},l=null,u={},h=null,c=!1,m=null,g=null,v=null,_=null,y=null,x=null,T=null,S=!1,et=null,nt=null,it=null,rt=null,ot=null;const st=t.getParameter(35661);let at=!1,lt=0;const ut=t.getParameter(7938);-1!==ut.indexOf("WebGL")?(lt=parseFloat(/^WebGL (\d)/.exec(ut)[1]),at=lt>=1):-1!==ut.indexOf("OpenGL ES")&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(ut)[1]),at=lt>=2);let ht=null,ct={};const dt=t.getParameter(3088),pt=t.getParameter(2978),ft=(new li).fromArray(dt),mt=(new li).fromArray(pt);function gt(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<i;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,r);return o}const vt={};function _t(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function yt(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}vt[3553]=gt(3553,3553,1),vt[34067]=gt(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),s.setClear(0),_t(2929),o.setFunc(J),Tt(!1),St(p),_t(2884),wt(E);const xt={[I]:32774,[O]:32778,[L]:32779};if(i)xt[N]=32775,xt[D]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(xt[N]=t.MIN_EXT,xt[D]=t.MAX_EXT)}const bt={[F]:0,[B]:1,[U]:768,[G]:770,[X]:776,[V]:774,[z]:772,[k]:769,[H]:771,[W]:775,[j]:773};function wt(e,n,i,r,o,s,a,l){if(e!==E){if(!1===c&&(_t(3042),c=!0),e===P)o=o||n,s=s||i,a=a||r,n===g&&o===y||(t.blendEquationSeparate(xt[n],xt[o]),g=n,y=o),i===v&&r===_&&s===x&&a===T||(t.blendFuncSeparate(bt[i],bt[r],bt[s],bt[a]),v=i,_=r,x=s,T=a),m=e,S=null;else if(e!==m||l!==S){if(g===I&&y===I||(t.blendEquation(32774),g=I,y=I),l)switch(e){case M:t.blendFuncSeparate(1,771,1,771);break;case A:t.blendFunc(1,1);break;case R:t.blendFuncSeparate(0,0,769,771);break;case C:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case M:t.blendFuncSeparate(770,771,1,771);break;case A:t.blendFunc(770,1);break;case R:t.blendFunc(0,769);break;case C:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}v=null,_=null,x=null,T=null,m=e,S=l}}else!0===c&&(yt(3042),c=!1)}function Tt(e){et!==e&&(e?t.frontFace(2304):t.frontFace(2305),et=e)}function St(e){e!==d?(_t(2884),e!==nt&&(e===p?t.cullFace(1029):e===f?t.cullFace(1028):t.cullFace(1032))):yt(2884),nt=e}function Et(e,n,i){e?(_t(32823),rt===n&&ot===i||(t.polygonOffset(n,i),rt=n,ot=i)):yt(32823)}function Mt(e){void 0===e&&(e=33984+st-1),ht!==e&&(t.activeTexture(e),ht=e)}return{buffers:{color:r,depth:o,stencil:s},enable:_t,disable:yt,bindFramebuffer:function(e,n){return null===n&&null!==l&&(n=l),u[e]!==n&&(t.bindFramebuffer(e,n),u[e]=n,i&&(36009===e&&(u[36160]=n),36160===e&&(u[36009]=n)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:wt,setMaterial:function(t,e){t.side===w?yt(2884):_t(2884);let n=t.side===b;e&&(n=!n),Tt(n),t.blending===M&&!1===t.transparent?wt(E):wt(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),r.setMask(t.colorWrite);const i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Et(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?_t(32926):yt(32926)},setFlipSided:Tt,setCullFace:St,setLineWidth:function(e){e!==it&&(at&&t.lineWidth(e),it=e)},setPolygonOffset:Et,setScissorTest:function(t){t?_t(3089):yt(3089)},activeTexture:Mt,bindTexture:function(e,n){null===ht&&Mt();let i=ct[ht];void 0===i&&(i={type:void 0,texture:void 0},ct[ht]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||vt[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=ct[ht];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===ft.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ft.copy(e))},viewport:function(e){!1===mt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),mt.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===i&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},ht=null,ct={},l=null,u={},h=null,c=!1,m=null,g=null,v=null,_=null,y=null,x=null,T=null,S=!1,et=null,nt=null,it=null,rt=null,ot=null,ft.set(0,0,t.canvas.width,t.canvas.height),mt.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),s.reset()}}}function Ja(t,e,n,i,r,o,s){const a=r.isWebGL2,l=r.maxTextures,u=r.maxCubemapSize,h=r.maxTextureSize,c=r.maxSamples,d=new WeakMap;let p,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Qn:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===p&&(p=m(o,s));const a=n?m(o,s):p;a.width=o,a.height=s;return a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function v(t){return Kn(t.width)&&Kn(t.height)}function _(t,e){return t.generateMipmaps&&e&&t.minFilter!==xt&&t.minFilter!==Et}function y(e,n,r,o,s=1){t.generateMipmap(e);i.get(n).__maxMipLevel=Math.log2(Math.max(r,o,s))}function x(n,i,r){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function b(t){return t===xt||t===bt||t===Tt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),i.remove(e)}(n),n.isVideoTexture&&d.delete(n),s.memory.textures--}function T(e){const n=e.target;n.removeEventListener("dispose",T),function(e){const n=e.texture,r=i.get(e),o=i.get(n);if(!e)return;void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),i.remove(n[e])}i.remove(n),i.remove(e)}(n)}let S=0;function E(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void I(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function M(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;P(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=s||l?l?i.image[t].image:i.image[t]:g(i.image[t],!1,!0,u);const c=h[0],d=v(c)||a,p=o.convert(i.format),f=o.convert(i.type),m=x(i.internalFormat,p,f);let b;if(C(34067,i,d),s){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e<b.length;e++){const r=b[e];i.format!==Vt&&i.format!==jt?null!==p?n.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=b.length-1}else{b=i.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,m,h[t].width,h[t].height,0,p,f,h[t].data);for(let e=0;e<b.length;e++){const i=b[e].image[t].image;n.texImage2D(34069+t,e+1,m,i.width,i.height,0,p,f,i.data)}}else{n.texImage2D(34069+t,0,m,p,f,h[t]);for(let e=0;e<b.length;e++){const i=b[e];n.texImage2D(34069+t,e+1,m,p,f,i.image[t])}}e.__maxMipLevel=b.length}_(i,d)&&y(34067,i,c.width,c.height);e.__version=i.version,i.onUpdate&&i.onUpdate(i)}(s,e,r):(n.activeTexture(33984+r),n.bindTexture(34067,s.__webglTexture))}const A={[vt]:10497,[_t]:33071,[yt]:33648},R={[xt]:9728,[bt]:9984,[Tt]:9986,[Et]:9729,[Mt]:9985,[Rt]:9987};function C(n,o,s){if(s?(t.texParameteri(n,10242,A[o.wrapS]),t.texParameteri(n,10243,A[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,A[o.wrapR]),t.texParameteri(n,10240,R[o.magFilter]),t.texParameteri(n,10241,R[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===_t&&o.wrapT===_t||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,b(o.magFilter)),t.texParameteri(n,10241,b(o.minFilter)),o.minFilter!==xt&&o.minFilter!==Et&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(o.type===Ft&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&o.type===Bt&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function P(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),s.memory.textures++)}function I(e,i,r){let s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),P(e,i),n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==_t||t.wrapT!==_t||t.minFilter!==xt&&t.minFilter!==Et)}(i)&&!1===v(i.image),u=g(i.image,l,!1,h),c=v(u)||a,d=o.convert(i.format);let p,f=o.convert(i.type),m=x(i.internalFormat,d,f);C(s,i,c);const b=i.mipmaps;if(i.isDepthTexture)m=6402,a?m=i.type===Ft?36012:i.type===Dt?33190:i.type===Ht?35056:33189:i.type===Ft&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Yt&&6402===m&&i.type!==Lt&&i.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Lt,f=o.convert(i.type)),i.format===Zt&&6402===m&&(m=34041,i.type!==Ht&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ht,f=o.convert(i.type))),n.texImage2D(3553,0,m,u.width,u.height,0,d,f,null);else if(i.isDataTexture)if(b.length>0&&c){for(let t=0,e=b.length;t<e;t++)p=b[t],n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);i.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,u.width,u.height,0,d,f,u.data),e.__maxMipLevel=0;else if(i.isCompressedTexture){for(let t=0,e=b.length;t<e;t++)p=b[t],i.format!==Vt&&i.format!==jt?null!==d?n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=b.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,m,u.width,u.height,u.depth,0,d,f,u.data),e.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,m,u.width,u.height,u.depth,0,d,f,u.data),e.__maxMipLevel=0;else if(b.length>0&&c){for(let t=0,e=b.length;t<e;t++)p=b[t],n.texImage2D(3553,t,m,d,f,p);i.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,d,f,u),e.__maxMipLevel=0;_(i,c)&&y(s,i,u.width,u.height),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function O(e,r,s,a,l){const u=o.convert(s.format),h=o.convert(s.type),c=x(s.internalFormat,u,h);32879===l||35866===l?n.texImage3D(l,0,c,r.width,r.height,r.depth,0,u,h,null):n.texImage2D(l,0,c,r.width,r.height,0,u,h,null),n.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,l,i.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)}function L(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===Ft?r=36012:e.type===Dt&&(r=33190));const i=D(n);t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(i){const e=D(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,r=o.convert(e.format),s=o.convert(e.type),a=x(e.internalFormat,r,s);if(i){const e=D(n);t.renderbufferStorageMultisample(36161,e,a,n.width,n.height)}else t.renderbufferStorage(36161,a,n.width,n.height)}t.bindRenderbuffer(36161,null)}function N(e){const r=i.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),E(r.depthTexture,0);const o=i.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===Yt)t.framebufferTexture2D(36160,36096,3553,o,0);else{if(r.depthTexture.format!==Zt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,o,0)}}(r.__webglFramebuffer,e)}else if(o){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(36160,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),L(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),L(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function D(t){return a&&t.isWebGLMultisampleRenderTarget?Math.min(c,t.samples):0}let F=!1,B=!1;this.allocateTextureUnit=function(){const t=S;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=M,this.setupRenderTarget=function(e){const l=e.texture,u=i.get(e),h=i.get(l);e.addEventListener("dispose",T),!0!==e.isWebGLMultipleRenderTargets&&(h.__webglTexture=t.createTexture(),h.__version=l.version,s.memory.textures++);const c=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=v(e)||a;if(!a||l.format!==jt||l.type!==Ft&&l.type!==Bt||(l.format=Vt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){u.__webglFramebuffer=[];for(let e=0;e<6;e++)u.__webglFramebuffer[e]=t.createFramebuffer()}else if(u.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(a){u.__webglMultisampledFramebuffer=t.createFramebuffer(),u.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,u.__webglColorRenderbuffer);const i=o.convert(l.format),r=o.convert(l.type),s=x(l.internalFormat,i,r),a=D(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,u.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(u.__webglDepthRenderbuffer=t.createRenderbuffer(),L(u.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,h.__webglTexture),C(34067,l,m);for(let t=0;t<6;t++)O(u.__webglFramebuffer[t],e,l,36064,34069+t);_(l,m)&&y(34067,l,e.width,e.height),n.bindTexture(34067,null)}else if(d){const t=e.texture;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=i.get(o);n.bindTexture(3553,s.__webglTexture),C(3553,o,m),O(u.__webglFramebuffer,e,o,36064+r,3553),_(o,m)&&y(3553,o,e.width,e.height)}n.bindTexture(3553,null)}else{let t=3553;if(f)if(a){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(t,h.__webglTexture),C(t,l,m),O(u.__webglFramebuffer,e,l,36064,t),_(l,m)&&y(t,l,e.width,e.height,e.depth),n.bindTexture(t,null)}e.depthBuffer&&N(e)},this.updateRenderTargetMipmap=function(t){const e=v(t)||a,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,s=r.length;o<s;o++){const s=r[o];if(_(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=i.get(s).__webglTexture;n.bindTexture(e,r),y(e,s,t.width,t.height),n.bindTexture(e,null)}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const r=e.width,o=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const a=i.get(e);n.bindFramebuffer(36008,a.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,a.__webglFramebuffer),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,a.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),t=t.texture),M(t,e)}}function Ka(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===Pt)return 5121;if(t===Ut)return 32819;if(t===kt)return 32820;if(t===Gt)return 33635;if(t===It)return 5120;if(t===Ot)return 5122;if(t===Lt)return 5123;if(t===Nt)return 5124;if(t===Dt)return 5125;if(t===Ft)return 5126;if(t===Bt)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(t===zt)return 6406;if(t===jt)return 6407;if(t===Vt)return 6408;if(t===Wt)return 6409;if(t===Xt)return 6410;if(t===Yt)return 6402;if(t===Zt)return 34041;if(t===Jt)return 6403;if(t===Kt)return 36244;if(t===$t)return 33319;if(t===Qt)return 33320;if(t===te)return 36248;if(t===ee)return 36249;if(t===ne||t===ie||t===re||t===oe){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===ne)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===ie)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===re)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===oe)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===se||t===ae||t===le||t===ue){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===se)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ae)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===le)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ue)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===he)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ce||t===de)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===ce)return n.COMPRESSED_RGB8_ETC2;if(t===de)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===pe||t===fe||t===me||t===ge||t===ve||t===_e||t===ye||t===xe||t===be||t===we||t===Te||t===Se||t===Ee||t===Me||t===Re||t===Ce||t===Pe||t===Ie||t===Oe||t===Le||t===Ne||t===De||t===Fe||t===Be||t===Ue||t===ke||t===Ge||t===He?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):t===Ae?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===Ht?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class $a extends Lo{constructor(t=[]){super(),this.cameras=t}}$a.prototype.isArrayCamera=!0;class Qa extends mr{constructor(){super(),this.type="Group"}}Qa.prototype.isGroup=!0;const tl={type:"move"};class el{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Qa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Qa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new pi,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new pi),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Qa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new pi,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new pi),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(tl))),l&&t.hand){o=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new Qa;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),a=.02,u=.005;l.inputState.pinching&&s>a+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=a-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this}}class nl extends zn{constructor(t,e){super();const n=this,i=t.state;let r=null,o=1,s=null,a="local-floor",l=null,u=null,h=null,c=null;const d=[],p=new Map,f=new Lo;f.layers.enable(1),f.viewport=new li;const m=new Lo;m.layers.enable(2),m.viewport=new li;const g=[f,m],v=new $a;v.layers.enable(1),v.layers.enable(2);let _=null,y=null;function x(t){const e=p.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function b(){p.forEach((function(t,e){t.disconnect(e)})),p.clear(),_=null,y=null,i.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),A.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function w(t){const e=r.inputSources;for(let t=0;t<d.length;t++)p.set(e[t],d[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=p.get(n);i&&(i.dispatchEvent({type:"disconnected",data:n}),p.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],i=p.get(n);i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=d[t];return void 0===e&&(e=new el,d[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=d[t];return void 0===e&&(e=new el,d[t]=e),e.getGripSpace()},this.getHand=function(t){let e=d[t];return void 0===e&&(e=new el,d[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return r},this.setSession=async function(t){if(r=t,null!==r){r.addEventListener("select",x),r.addEventListener("selectstart",x),r.addEventListener("selectend",x),r.addEventListener("squeeze",x),r.addEventListener("squeezestart",x),r.addEventListener("squeezeend",x),r.addEventListener("end",b),r.addEventListener("inputsourceschange",w);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const n={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o},i=new XRWebGLLayer(r,e,n);r.updateRenderState({baseLayer:i})}else{let n=0;t.depth&&(n=t.stencil?34041:6402);const i={colorFormat:t.alpha?6408:6407,depthFormat:n,scaleFactor:o};u=new XRWebGLBinding(r,e),c=u.createProjectionLayer(i),h=e.createFramebuffer(),r.updateRenderState({layers:[c]})}s=await r.requestReferenceSpace(a),A.setContext(r),A.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const T=new pi,S=new pi;function E(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;v.near=m.near=f.near=t.near,v.far=m.far=f.far=t.far,_===v.near&&y===v.far||(r.updateRenderState({depthNear:v.near,depthFar:v.far}),_=v.near,y=v.far);const e=t.parent,n=v.cameras;E(v,e);for(let t=0;t<n.length;t++)E(n[t],e);v.matrixWorld.decompose(v.position,v.quaternion,v.scale),t.position.copy(v.position),t.quaternion.copy(v.quaternion),t.scale.copy(v.scale),t.matrix.copy(v.matrix),t.matrixWorld.copy(v.matrixWorld);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){T.setFromMatrixPosition(e.matrixWorld),S.setFromMatrixPosition(n.matrixWorld);const i=T.distanceTo(S),r=e.projectionMatrix.elements,o=n.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],h=(r[8]-1)/r[0],c=(o[8]+1)/o[0],d=s*h,p=s*c,f=i/(-h+c),m=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,v=a+f,_=d-m,y=p+(i-m),x=l*a/v*g,b=u*a/v*g;t.projectionMatrix.makePerspective(_,y,x,b,g,v)}(v,f,m):v.projectionMatrix.copy(f.projectionMatrix)},this.getCamera=function(){return v};let M=null;const A=new Vo;A.setAnimationLoop((function(t,n){if(l=n.getViewerPose(s),null!==l){const t=l.views,n=r.renderState.baseLayer;void 0===r.renderState.layers&&i.bindXRFramebuffer(n.framebuffer);let o=!1;t.length!==v.cameras.length&&(v.cameras.length=0,o=!0);for(let s=0;s<t.length;s++){const a=t[s];let l=null;if(void 0===r.renderState.layers)l=n.getViewport(a);else{const t=u.getViewSubImage(c,a);i.bindXRFramebuffer(h),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,36096,3553,t.depthStencilTexture,0),l=t.viewport}const d=g[s];d.matrix.fromArray(a.transform.matrix),d.projectionMatrix.fromArray(a.projectionMatrix),d.viewport.set(l.x,l.y,l.width,l.height),0===s&&v.matrix.copy(d.matrix),!0===o&&v.cameras.push(d)}}const o=r.inputSources;for(let t=0;t<d.length;t++){const e=d[t],i=o[t];e.update(i,n,s)}M&&M(t,n)})),this.setAnimationLoop=function(t){M=t},this.dispose=function(){}}}function il(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);const i=t.get(n).envMap;if(i){e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&i._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;const r=t.get(i).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,o;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(r=n.clearcoatRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===b&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===b&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,o,s){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e,i){n(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap);e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===b&&t.clearcoatNormalScale.value.negate());t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap);e.transmission>0&&(t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height));t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap);t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)}(t,i,s):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===b&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===b&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,o):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function rl(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=nn,this.physicallyCorrectLights=!1,this.toneMapping=rt,this.toneMappingExposure=1;const m=this;let g=!1,v=0,_=0,y=null,T=-1,S=null;const E=new li,M=new li;let A=null,R=e.width,C=e.height,P=1,I=null,O=null;const L=new li(0,0,R,C),N=new li(0,0,R,C);let D=!1;const F=[],B=new jo;let U=!1,k=!1,G=null;const H=new Vi,z=new pi,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function V(){return null===y?P:1}let W,X,q,Y,Z,J,K,$,Q,tt,et,nt,it,ot,st,at,lt,ut,ht,ct,dt,pt,ft=n;function mt(t,n){for(let i=0;i<t.length;i++){const r=t[i],o=e.getContext(r,n);if(null!==o)return o}return null}try{const t={alpha:i,depth:r,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",yt,!1),e.addEventListener("webglcontextrestored",bt,!1),null===ft){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),ft=mt(e,t),null===ft)throw mt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ft.getShaderPrecisionFormat&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function gt(){W=new ns(ft),X=new Qo(ft,W,t),W.init(X),dt=new Ka(ft,W,X),q=new Za(ft,W,X),F[0]=1029,Y=new os(ft),Z=new Da,J=new Ja(ft,W,q,Z,X,dt,Y),K=new es(m),$=new Wo(ft,X),pt=new Ko(ft,W,$,X),Q=new is(ft,$,Y,pt),tt=new us(ft,Q,$,Y),ut=new ls(ft),st=new ts(Z),et=new Na(m,K,W,X,pt,st),nt=new il(Z),it=new ka(Z),ot=new Wa(W,X),lt=new Jo(m,K,q,tt,a),at=new Ya(m,tt,X),ht=new $o(ft,W,Y,X),ct=new rs(ft,W,Y,X),Y.programs=et.programs,m.capabilities=X,m.extensions=W,m.properties=Z,m.renderLists=it,m.shadowMap=at,m.state=q,m.info=Y}gt();const vt=new nl(m,ft);function yt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function bt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=Y.autoReset,e=at.enabled,n=at.autoUpdate,i=at.needsUpdate,r=at.type;gt(),Y.autoReset=t,at.enabled=e,at.autoUpdate=n,at.needsUpdate=i,at.type=r}function wt(t){const e=t.target;e.removeEventListener("dispose",wt),function(t){(function(t){const e=Z.get(t).programs;void 0!==e&&e.forEach((function(t){et.releaseProgram(t)}))})(t),Z.remove(t)}(e)}this.xr=vt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){const t=W.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=W.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(R,C,!1))},this.getSize=function(t){return t.set(R,C)},this.setSize=function(t,n,i){vt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,C=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(R*P,C*P).floor()},this.setDrawingBufferSize=function(t,n,i){R=t,C=n,P=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(L)},this.setViewport=function(t,e,n,i){t.isVector4?L.set(t.x,t.y,t.z,t.w):L.set(t,e,n,i),q.viewport(E.copy(L).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(N)},this.setScissor=function(t,e,n,i){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,n,i),q.scissor(M.copy(N).multiplyScalar(P).floor())},this.getScissorTest=function(){return D},this.setScissorTest=function(t){q.setScissorTest(D=t)},this.setOpaqueSort=function(t){I=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(lt.getClearColor())},this.setClearColor=function(){lt.setClearColor.apply(lt,arguments)},this.getClearAlpha=function(){return lt.getClearAlpha()},this.setClearAlpha=function(){lt.setClearAlpha.apply(lt,arguments)},this.clear=function(t,e,n){let i=0;(void 0===t||t)&&(i|=16384),(void 0===e||e)&&(i|=256),(void 0===n||n)&&(i|=1024),ft.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",yt,!1),e.removeEventListener("webglcontextrestored",bt,!1),it.dispose(),ot.dispose(),Z.dispose(),K.dispose(),tt.dispose(),pt.dispose(),vt.dispose(),vt.removeEventListener("sessionstart",St),vt.removeEventListener("sessionend",Et),G&&(G.dispose(),G=null),Mt.stop()},this.renderBufferImmediate=function(t,e){pt.initAttributes();const n=Z.get(t);t.hasPositions&&!n.position&&(n.position=ft.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=ft.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=ft.createBuffer()),t.hasColors&&!n.color&&(n.color=ft.createBuffer());const i=e.getAttributes();t.hasPositions&&(ft.bindBuffer(34962,n.position),ft.bufferData(34962,t.positionArray,35048),pt.enableAttribute(i.position),ft.vertexAttribPointer(i.position,3,5126,!1,0,0)),t.hasNormals&&(ft.bindBuffer(34962,n.normal),ft.bufferData(34962,t.normalArray,35048),pt.enableAttribute(i.normal),ft.vertexAttribPointer(i.normal,3,5126,!1,0,0)),t.hasUvs&&(ft.bindBuffer(34962,n.uv),ft.bufferData(34962,t.uvArray,35048),pt.enableAttribute(i.uv),ft.vertexAttribPointer(i.uv,2,5126,!1,0,0)),t.hasColors&&(ft.bindBuffer(34962,n.color),ft.bufferData(34962,t.colorArray,35048),pt.enableAttribute(i.color),ft.vertexAttribPointer(i.color,3,5126,!1,0,0)),pt.disableUnusedAttributes(),ft.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,i,r,o){null===e&&(e=j);const s=r.isMesh&&r.matrixWorld.determinant()<0,a=Lt(t,e,i,r);q.setMaterial(i,s);let l=n.index;const u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;let h,c=1;!0===i.wireframe&&(l=Q.getWireframeAttribute(n),c=2),(i.morphTargets||i.morphNormals)&&ut.update(r,n,i,a),pt.setup(r,i,a,n,l);let d=ht;null!==l&&(h=$.get(l),d=ct,d.setIndex(h));const p=null!==l?l.count:u.count,f=n.drawRange.start*c,m=n.drawRange.count*c,g=null!==o?o.start*c:0,v=null!==o?o.count*c:1/0,_=Math.max(f,g),y=Math.min(p,f+m,g+v)-1,x=Math.max(0,y-_+1);if(0!==x){if(r.isMesh)!0===i.wireframe?(q.setLineWidth(i.wireframeLinewidth*V()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),q.setLineWidth(t*V()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(_,x,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(_,x,t)}else d.render(_,x)}},this.compile=function(t,e){d=ot.get(t),d.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++){It(n[i],t,e)}else It(n,t,e)}))};let Tt=null;function St(){Mt.stop()}function Et(){Mt.start()}const Mt=new Vo;function At(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=o.object,a=o.geometry,l=null===i?o.material:i,u=o.group;if(n.isArrayCamera){const t=n.cameras;for(let n=0,i=t.length;n<i;n++){const i=t[n];s.layers.test(i.layers)&&(q.viewport(E.copy(i.viewport)),d.setupLightsView(i),Ct(s,e,i,a,l,u))}}else Ct(s,e,n,a,l,u)}}function Ct(t,e,n,i,r,o){if(t.onBeforeRender(m,e,n,i,r,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const i=Lt(n,e,r,t);q.setMaterial(r),pt.reset(),function(t,e){t.render((function(t){m.renderBufferImmediate(t,e)}))}(t,i)}else!0===r.transparent&&r.side===w?(r.side=b,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,o),r.side=x,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,o),r.side=w):m.renderBufferDirect(n,e,i,r,t,o);t.onAfterRender(m,e,n,i,r,o)}function It(t,e,n){!0!==e.isScene&&(e=j);const i=Z.get(t),r=d.state.lights,o=d.state.shadowsArray,s=r.state.version,a=et.getParameters(t,r.state,o,e,n),l=et.getProgramCacheKey(a);let u=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=K.get(t.envMap||i.environment),void 0===u&&(t.addEventListener("dispose",wt),u=new Map,i.programs=u);let h=u.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===s)return Ot(t,a),h}else a.uniforms=et.getUniforms(t),t.onBuild(a,m),t.onBeforeCompile(a,m),h=et.acquireProgram(a,l),u.set(l,h),i.uniforms=a.uniforms;const c=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=st.uniform),Ot(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(c.ambientLightColor.value=r.state.ambient,c.lightProbe.value=r.state.probe,c.directionalLights.value=r.state.directional,c.directionalLightShadows.value=r.state.directionalShadow,c.spotLights.value=r.state.spot,c.spotLightShadows.value=r.state.spotShadow,c.rectAreaLights.value=r.state.rectArea,c.ltc_1.value=r.state.rectAreaLTC1,c.ltc_2.value=r.state.rectAreaLTC2,c.pointLights.value=r.state.point,c.pointLightShadows.value=r.state.pointShadow,c.hemisphereLights.value=r.state.hemi,c.directionalShadowMap.value=r.state.directionalShadowMap,c.directionalShadowMatrix.value=r.state.directionalShadowMatrix,c.spotShadowMap.value=r.state.spotShadowMap,c.spotShadowMatrix.value=r.state.spotShadowMatrix,c.pointShadowMap.value=r.state.pointShadowMap,c.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=h.getUniforms(),f=pa.seqWithValue(p.seq,c);return i.currentProgram=h,i.uniformsList=f,h}function Ot(t,e){const n=Z.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas}function Lt(t,e,n,i){!0!==e.isScene&&(e=j),J.resetTextureUnits();const r=e.fog,o=n.isMeshStandardMaterial?e.environment:null,s=null===y?m.outputEncoding:y.texture.encoding,a=K.get(n.envMap||o),l=!0===n.vertexColors&&i.geometry&&i.geometry.attributes.color&&4===i.geometry.attributes.color.itemSize,u=Z.get(n),h=d.state.lights;if(!0===U&&(!0===k||t!==S)){const e=t===S&&n.id===T;st.setState(n,t,e)}let c=!1;n.version===u.__version?u.needsLights&&u.lightsStateVersion!==h.state.version||u.outputEncoding!==s||i.isInstancedMesh&&!1===u.instancing?c=!0:i.isInstancedMesh||!0!==u.instancing?i.isSkinnedMesh&&!1===u.skinning?c=!0:i.isSkinnedMesh||!0!==u.skinning?u.envMap!==a||n.fog&&u.fog!==r?c=!0:void 0===u.numClippingPlanes||u.numClippingPlanes===st.numPlanes&&u.numIntersection===st.numIntersection?u.vertexAlphas!==l&&(c=!0):c=!0:c=!0:c=!0:(c=!0,u.__version=n.version);let p=u.currentProgram;!0===c&&(p=It(n,e,i));let f=!1,g=!1,v=!1;const _=p.getUniforms(),x=u.uniforms;if(q.useProgram(p.program)&&(f=!0,g=!0,v=!0),n.id!==T&&(T=n.id,g=!0),f||S!==t){if(_.setValue(ft,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&_.setValue(ft,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,g=!0,v=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=_.map.cameraPosition;void 0!==e&&e.setValue(ft,z.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(ft,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||i.isSkinnedMesh)&&_.setValue(ft,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){_.setOptional(ft,i,"bindMatrix"),_.setOptional(ft,i,"bindMatrixInverse");const t=i.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),_.setValue(ft,"boneTexture",t.boneTexture,J),_.setValue(ft,"boneTextureSize",t.boneTextureSize)):_.setOptional(ft,t,"boneMatrices"))}var b,w;return(g||u.receiveShadow!==i.receiveShadow)&&(u.receiveShadow=i.receiveShadow,_.setValue(ft,"receiveShadow",i.receiveShadow)),g&&(_.setValue(ft,"toneMappingExposure",m.toneMappingExposure),u.needsLights&&(w=v,(b=x).ambientLightColor.needsUpdate=w,b.lightProbe.needsUpdate=w,b.directionalLights.needsUpdate=w,b.directionalLightShadows.needsUpdate=w,b.pointLights.needsUpdate=w,b.pointLightShadows.needsUpdate=w,b.spotLights.needsUpdate=w,b.spotLightShadows.needsUpdate=w,b.rectAreaLights.needsUpdate=w,b.hemisphereLights.needsUpdate=w),r&&n.fog&&nt.refreshFogUniforms(x,r),nt.refreshMaterialUniforms(x,n,P,C,G),pa.upload(ft,u.uniformsList,x,J)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(pa.upload(ft,u.uniformsList,x,J),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(ft,"center",i.center),_.setValue(ft,"modelViewMatrix",i.modelViewMatrix),_.setValue(ft,"normalMatrix",i.normalMatrix),_.setValue(ft,"modelMatrix",i.matrixWorld),p}Mt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof window&&Mt.setContext(window),this.setAnimationLoop=function(t){Tt=t,vt.setAnimationLoop(t),null===t?Mt.stop():Mt.start()},vt.addEventListener("sessionstart",St),vt.addEventListener("sessionend",Et),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===vt.enabled&&!0===vt.isPresenting&&(!0===vt.cameraAutoUpdate&&vt.updateCamera(e),e=vt.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,y),d=ot.get(t,f.length),d.init(),f.push(d),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),B.setFromProjectionMatrix(H),k=this.localClippingEnabled,U=st.init(this.clippingPlanes,k,e),c=it.get(t,p.length),c.init(),p.push(c),function t(e,n,i,r){if(!1===e.visible)return;if(e.layers.test(n.layers))if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||B.intersectsSprite(e)){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=tt.update(e),n=e.material;n.visible&&c.push(e,t,n,i,z.z,null)}}else if(e.isImmediateRenderObject)r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H),c.push(e,null,e.material,i,z.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==Y.render.frame&&(e.skeleton.update(),e.skeleton.frame=Y.render.frame),!e.frustumCulled||B.intersectsObject(e))){r&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=tt.update(e),n=e.material;if(Array.isArray(n)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=n[s.materialIndex];a&&a.visible&&c.push(e,t,a,i,z.z,s)}}else n.visible&&c.push(e,t,n,i,z.z,null)}const o=e.children;for(let e=0,s=o.length;e<s;e++)t(o[e],n,i,r)}(t,e,0,m.sortObjects),c.finish(),!0===m.sortObjects&&c.sort(I,O),!0===U&&st.beginShadows();const n=d.state.shadowsArray;at.render(n,t,e),d.setupLights(),d.setupLightsView(e),!0===U&&st.endShadows(),!0===this.info.autoReset&&this.info.reset(),lt.render(c,t);const i=c.opaque,r=c.transmissive,o=c.transparent;i.length>0&&At(i,t,e),r.length>0&&function(t,e,n,i){if(null===G){const t=!0===s&&!0===X.isWebGL2;G=new(t?ci:ui)(1024,1024,{generateMipmaps:!0,type:null!==dt.convert(Bt)?Bt:Pt,minFilter:Rt,magFilter:xt,wrapS:_t,wrapT:_t})}const r=m.getRenderTarget();m.setRenderTarget(G),m.clear();const o=m.toneMapping;m.toneMapping=rt,At(t,n,i),m.toneMapping=o,J.updateMultisampleRenderTarget(G),J.updateRenderTargetMipmap(G),m.setRenderTarget(r),At(e,n,i)}(i,r,t,e),o.length>0&&At(o,t,e),null!==y&&(J.updateMultisampleRenderTarget(y),J.updateRenderTargetMipmap(y)),!0===t.isScene&&t.onAfterRender(m,t,e),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),pt.resetDefaultState(),T=-1,S=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),c=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return y},this.setRenderTarget=function(t,e=0,n=0){y=t,v=e,_=n,t&&void 0===Z.get(t).__webglFramebuffer&&J.setupRenderTarget(t);let i=null,r=!1,o=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const s=Z.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=s[e],r=!0):i=t.isWebGLMultisampleRenderTarget?Z.get(t).__webglMultisampledFramebuffer:s,E.copy(t.viewport),M.copy(t.scissor),A=t.scissorTest}else E.copy(L).multiplyScalar(P).floor(),M.copy(N).multiplyScalar(P).floor(),A=D;if(q.bindFramebuffer(36160,i)&&X.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const n=t.texture;if(F.length!==n.length||36064!==F[0]){for(let t=0,e=n.length;t<e;t++)F[t]=36064+t;F.length=n.length,e=!0}}else 1===F.length&&36064===F[0]||(F[0]=36064,F.length=1,e=!0);else 1===F.length&&1029===F[0]||(F[0]=1029,F.length=1,e=!0);e&&(X.isWebGL2?ft.drawBuffers(F):W.get("WEBGL_draw_buffers").drawBuffersWEBGL(F))}if(q.viewport(E),q.scissor(M),q.setScissorTest(A),r){const i=Z.get(t.texture);ft.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(o){const i=Z.get(t.texture),r=e||0;ft.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){q.bindFramebuffer(36160,a);try{const s=t.texture,a=s.format,l=s.type;if(a!==Vt&&dt.convert(a)!==ft.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const u=l===Bt&&(W.has("EXT_color_buffer_half_float")||X.isWebGL2&&W.has("EXT_color_buffer_float"));if(!(l===Pt||dt.convert(l)===ft.getParameter(35738)||l===Ft&&(X.isWebGL2||W.has("OES_texture_float")||W.has("WEBGL_color_buffer_float"))||u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ft.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&ft.readPixels(e,n,i,r,dt.convert(a),dt.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==y?Z.get(y).__webglFramebuffer:null;q.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i);let s=dt.convert(e.format);X.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),J.setTexture2D(e,0),ft.copyTexImage2D(3553,n,s,t.x,t.y,r,o,0),q.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,o=e.image.height,s=dt.convert(n.format),a=dt.convert(n.type);J.setTexture2D(n,0),ft.pixelStorei(37440,n.flipY),ft.pixelStorei(37441,n.premultiplyAlpha),ft.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ft.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?ft.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):ft.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&&ft.generateMipmap(3553),q.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=dt.convert(i.format),u=dt.convert(i.type);let h;if(i.isDataTexture3D)J.setTexture3D(i,0),h=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");J.setTexture2DArray(i,0),h=35866}ft.pixelStorei(37440,i.flipY),ft.pixelStorei(37441,i.premultiplyAlpha),ft.pixelStorei(3317,i.unpackAlignment);const c=ft.getParameter(3314),d=ft.getParameter(32878),p=ft.getParameter(3316),f=ft.getParameter(3315),g=ft.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;ft.pixelStorei(3314,v.width),ft.pixelStorei(32878,v.height),ft.pixelStorei(3316,t.min.x),ft.pixelStorei(3315,t.min.y),ft.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?ft.texSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,u,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ft.compressedTexSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,v.data)):ft.texSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,u,v),ft.pixelStorei(3314,c),ft.pixelStorei(32878,d),ft.pixelStorei(3316,p),ft.pixelStorei(3315,f),ft.pixelStorei(32877,g),0===r&&i.generateMipmaps&&ft.generateMipmap(h),q.unbindTexture()},this.initTexture=function(t){J.setTexture2D(t,0),q.unbindTexture()},this.resetState=function(){v=0,_=0,y=null,q.reset(),pt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class ol extends rl{}ol.prototype.isWebGL1Renderer=!0;class sl{constructor(t,e=25e-5){this.name="",this.color=new Dr(t),this.density=e}clone(){return new sl(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}sl.prototype.isFogExp2=!0;class al{constructor(t,e=1,n=1e3){this.name="",this.color=new Dr(t),this.near=e,this.far=n}clone(){return new al(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}al.prototype.isFog=!0;class ll extends mr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}ll.prototype.isScene=!0;class ul{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=In,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=qn()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qn()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qn()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}ul.prototype.isInterleavedBuffer=!0;const hl=new pi;class cl{constructor(t,e,n,i=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)hl.x=this.getX(e),hl.y=this.getY(e),hl.z=this.getZ(e),hl.applyMatrix4(t),this.setXYZ(e,hl.x,hl.y,hl.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)hl.x=this.getX(e),hl.y=this.getY(e),hl.z=this.getZ(e),hl.applyNormalMatrix(t),this.setXYZ(e,hl.x,hl.y,hl.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)hl.x=this.getX(e),hl.y=this.getY(e),hl.z=this.getZ(e),hl.transformDirection(t),this.setXYZ(e,hl.x,hl.y,hl.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new kr(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new cl(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}cl.prototype.isInterleavedBufferAttribute=!0;class dl extends Rr{constructor(t){super(),this.type="SpriteMaterial",this.color=new Dr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let pl;dl.prototype.isSpriteMaterial=!0;const fl=new pi,ml=new pi,gl=new pi,vl=new ei,_l=new ei,yl=new Vi,xl=new pi,bl=new pi,wl=new pi,Tl=new ei,Sl=new ei,El=new ei;class Ml extends mr{constructor(t){if(super(),this.type="Sprite",void 0===pl){pl=new so;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new ul(t,5);pl.setIndex([0,1,2,0,2,3]),pl.setAttribute("position",new cl(e,3,0,!1)),pl.setAttribute("uv",new cl(e,2,3,!1))}this.geometry=pl,this.material=void 0!==t?t:new dl,this.center=new ei(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ml.setFromMatrixScale(this.matrixWorld),yl.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),gl.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ml.multiplyScalar(-gl.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;Al(xl.set(-.5,-.5,0),gl,o,ml,i,r),Al(bl.set(.5,-.5,0),gl,o,ml,i,r),Al(wl.set(.5,.5,0),gl,o,ml,i,r),Tl.set(0,0),Sl.set(1,0),El.set(1,1);let s=t.ray.intersectTriangle(xl,bl,wl,!1,fl);if(null===s&&(Al(bl.set(-.5,.5,0),gl,o,ml,i,r),Sl.set(0,1),s=t.ray.intersectTriangle(xl,wl,bl,!1,fl),null===s))return;const a=t.ray.origin.distanceTo(fl);a<t.near||a>t.far||e.push({distance:a,point:fl.clone(),uv:Mr.getUV(fl,xl,bl,wl,Tl,Sl,El,new ei),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Al(t,e,n,i,r,o){vl.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(_l.x=o*vl.x-r*vl.y,_l.y=r*vl.x+o*vl.y):_l.copy(vl),t.copy(e),t.x+=_l.x,t.y+=_l.y,t.applyMatrix4(yl)}Ml.prototype.isSprite=!0;const Rl=new pi,Cl=new pi;class Pl extends mr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let i;for(i=0;i<n.length&&!(e<n[i].distance);i++);return n.splice(i,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Rl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Rl);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Rl.setFromMatrixPosition(t.matrixWorld),Cl.setFromMatrixPosition(this.matrixWorld);const n=Rl.distanceTo(Cl)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r&&n>=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance})}return e}}const Il=new pi,Ol=new li,Ll=new li,Nl=new pi,Dl=new Vi;class Fl extends Eo{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Vi,this.bindMatrixInverse=new Vi}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new li,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,i=this.geometry;Ol.fromBufferAttribute(i.attributes.skinIndex,t),Ll.fromBufferAttribute(i.attributes.skinWeight,t),Il.fromBufferAttribute(i.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=Ll.getComponent(t);if(0!==i){const r=Ol.getComponent(t);Dl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(Nl.copy(Il).applyMatrix4(Dl),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}Fl.prototype.isSkinnedMesh=!0;class Bl extends mr{constructor(){super(),this.type="Bone"}}Bl.prototype.isBone=!0;class Ul extends si{constructor(t=null,e=1,n=1,i,r,o,s,a,l=xt,u=xt,h,c){super(null,o,s,a,l,u,i,r,h,c),this.image={data:t,width:e,height:n},this.magFilter=l,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Ul.prototype.isDataTexture=!0;const kl=new Vi,Gl=new Vi;class Hl{constructor(t=[],e=[]){this.uuid=qn(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Vi)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Vi;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:Gl;kl.multiplyMatrices(r,e[i]),kl.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Hl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=$n(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Ul(e,t,t,Vt,Ft);return this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Bl),this.bones.push(r),this.boneInverses.push((new Vi).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}}const zl=new Vi,jl=new Vi,Vl=[],Wl=new Eo;class Xl extends Eo{constructor(t,e,n){super(t,e),this.instanceMatrix=new kr(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Wl.geometry=this.geometry,Wl.material=this.material,void 0!==Wl.material)for(let r=0;r<i;r++){this.getMatrixAt(r,zl),jl.multiplyMatrices(n,zl),Wl.matrixWorld=jl,Wl.raycast(t,Vl);for(let t=0,n=Vl.length;t<n;t++){const n=Vl[t];n.instanceId=r,n.object=this,e.push(n)}Vl.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new kr(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Xl.prototype.isInstancedMesh=!0;class ql extends Rr{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Dr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}ql.prototype.isLineBasicMaterial=!0;const Yl=new pi,Zl=new pi,Jl=new Vi,Kl=new ji,$l=new Di;class Ql extends mr{constructor(t=new so,e=new ql){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)Yl.fromBufferAttribute(e,t-1),Zl.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Yl.distanceTo(Zl);t.setAttribute("lineDistance",new Yr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),$l.copy(n.boundingSphere),$l.applyMatrix4(i),$l.radius+=r,!1===t.ray.intersectsSphere($l))return;Jl.copy(i).invert(),Kl.copy(t.ray).applyMatrix4(Jl);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=new pi,u=new pi,h=new pi,c=new pi,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i){for(let n=Math.max(0,o.start),s=Math.min(i.count,o.start+o.count)-1;n<s;n+=d){const o=i.getX(n),s=i.getX(n+1);l.fromBufferAttribute(r,o),u.fromBufferAttribute(r,s);if(Kl.distanceSqToSegment(l,u,c,h)>a)continue;c.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(c);d<t.near||d>t.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,o.start),i=Math.min(r.count,o.start+o.count)-1;n<i;n+=d){l.fromBufferAttribute(r,n),u.fromBufferAttribute(r,n+1);if(Kl.distanceSqToSegment(l,u,c,h)>a)continue;c.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(c);i<t.near||i>t.far||e.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ql.prototype.isLine=!0;const tu=new pi,eu=new pi;class nu extends Ql{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)tu.fromBufferAttribute(e,t),eu.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+tu.distanceTo(eu);t.setAttribute("lineDistance",new Yr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}nu.prototype.isLineSegments=!0;class iu extends Ql{constructor(t,e){super(t,e),this.type="LineLoop"}}iu.prototype.isLineLoop=!0;class ru extends Rr{constructor(t){super(),this.type="PointsMaterial",this.color=new Dr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}ru.prototype.isPointsMaterial=!0;const ou=new Vi,su=new ji,au=new Di,lu=new pi;class uu extends mr{constructor(t=new so,e=new ru){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),au.copy(n.boundingSphere),au.applyMatrix4(i),au.radius+=r,!1===t.ray.intersectsSphere(au))return;ou.copy(i).invert(),su.copy(t.ray).applyMatrix4(ou);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position;if(null!==r){for(let n=Math.max(0,o.start),l=Math.min(r.count,o.start+o.count);n<l;n++){const o=r.getX(n);lu.fromBufferAttribute(s,o),hu(lu,o,a,i,t,e,this)}}else{for(let n=Math.max(0,o.start),r=Math.min(s.count,o.start+o.count);n<r;n++)lu.fromBufferAttribute(s,n),hu(lu,n,a,i,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function hu(t,e,n,i,r,o,s){const a=su.distanceSqToPoint(t);if(a<n){const n=new pi;su.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:s})}}uu.prototype.isPoints=!0;class cu extends si{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.format=void 0!==s?s:jt,this.minFilter=void 0!==o?o:Et,this.magFilter=void 0!==r?r:Et,this.generateMipmaps=!1;const u=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){u.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}cu.prototype.isVideoTexture=!0;class du extends si{constructor(t,e,n,i,r,o,s,a,l,u,h,c){super(null,o,s,a,l,u,i,r,h,c),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}du.prototype.isCompressedTexture=!0;class pu extends si{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.needsUpdate=!0}}pu.prototype.isCanvasTexture=!0;class fu extends si{constructor(t,e,n,i,r,o,s,a,l,u){if((u=void 0!==u?u:Yt)!==Yt&&u!==Zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===Yt&&(n=Lt),void 0===n&&u===Zt&&(n=Ht),super(null,i,r,o,s,a,u,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:xt,this.minFilter=void 0!==a?a:xt,this.flipY=!1,this.generateMipmaps=!1}}fu.prototype.isDepthTexture=!0;class mu extends so{constructor(t=1,e=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],o=[],s=[],a=[],l=new pi,u=new ei;o.push(0,0,0),s.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const c=n+r/e*i;l.x=t*Math.cos(c),l.y=t*Math.sin(c),o.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(o[h]/t+1)/2,u.y=(o[h+1]/t+1)/2,a.push(u.x,u.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Yr(o,3)),this.setAttribute("normal",new Yr(s,3)),this.setAttribute("uv",new Yr(a,2))}static fromJSON(t){return new mu(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class gu extends so{constructor(t=1,e=1,n=1,i=8,r=1,o=!1,s=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],c=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const r=p,o=new ei,f=new pi;let v=0;const _=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,m*y,0),c.push(0,y,0),d.push(.5,.5),p++;const x=p;for(let t=0;t<=i;t++){const e=t/i*a+s,n=Math.cos(e),r=Math.sin(e);f.x=_*r,f.y=m*y,f.z=_*n,h.push(f.x,f.y,f.z),c.push(0,y,0),o.x=.5*n+.5,o.y=.5*r*y+.5,d.push(o.x,o.y),p++}for(let t=0;t<i;t++){const e=r+t,i=x+t;!0===n?u.push(i,i+1,e):u.push(i+1,i,e),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}!function(){const o=new pi,v=new pi;let _=0;const y=(e-t)/n;for(let l=0;l<=r;l++){const u=[],g=l/r,_=g*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+s,l=Math.sin(r),f=Math.cos(r);v.x=_*l,v.y=-g*n+m,v.z=_*f,h.push(v.x,v.y,v.z),o.set(l,y,f).normalize(),c.push(o.x,o.y,o.z),d.push(e,1-g),u.push(p++)}f.push(u)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=f[e][t],i=f[e+1][t],r=f[e+1][t+1],o=f[e][t+1];u.push(n,i,o),u.push(i,r,o),_+=6}l.addGroup(g,_,0),g+=_}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new Yr(h,3)),this.setAttribute("normal",new Yr(c,3)),this.setAttribute("uv",new Yr(d,2))}static fromJSON(t){return new gu(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class vu extends gu{constructor(t=1,e=1,n=8,i=1,r=!1,o=0,s=2*Math.PI){super(0,t,e,n,i,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}static fromJSON(t){return new vu(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class _u extends so{constructor(t,e,n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],o=[];function s(t,e,n,i){const r=i+1,o=[];for(let i=0;i<=r;i++){o[i]=[];const s=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)o[i][t]=0===t&&i===r?s:s.clone().lerp(a,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(a(o[t][n+1]),a(o[t+1][n]),a(o[t][n])):(a(o[t][n+1]),a(o[t+1][n+1]),a(o[t+1][n]))}}function a(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function u(t,e,n,i){i<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new pi,i=new pi,r=new pi;for(let o=0;o<e.length;o+=3)l(e[o+0],n),l(e[o+1],i),l(e[o+2],r),s(n,i,r,t)}(i),function(t){const e=new pi;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new pi;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,s=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);o.push(i,1-s)}var e;(function(){const t=new pi,e=new pi,n=new pi,i=new pi,s=new ei,a=new ei,l=new ei;for(let c=0,d=0;c<r.length;c+=9,d+=6){t.set(r[c+0],r[c+1],r[c+2]),e.set(r[c+3],r[c+4],r[c+5]),n.set(r[c+6],r[c+7],r[c+8]),s.set(o[d+0],o[d+1]),a.set(o[d+2],o[d+3]),l.set(o[d+4],o[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);u(s,d+0,t,p),u(a,d+2,e,p),u(l,d+4,n,p)}})(),function(){for(let t=0;t<o.length;t+=6){const e=o[t+0],n=o[t+2],i=o[t+4],r=Math.max(e,n,i),s=Math.min(e,n,i);r>.9&&s<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Yr(r,3)),this.setAttribute("normal",new Yr(r.slice(),3)),this.setAttribute("uv",new Yr(o,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new _u(t.vertices,t.indices,t.radius,t.details)}}class yu extends _u{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new yu(t.radius,t.detail)}}const xu=new pi,bu=new pi,wu=new pi,Tu=new Mr;class Su extends so{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),i=Math.cos(Wn*e),r=t.getIndex(),o=t.getAttribute("position"),s=r?r.count:o.count,a=[0,0,0],l=["a","b","c"],u=new Array(3),h={},c=[];for(let t=0;t<s;t+=3){r?(a[0]=r.getX(t),a[1]=r.getX(t+1),a[2]=r.getX(t+2)):(a[0]=t,a[1]=t+1,a[2]=t+2);const{a:e,b:s,c:d}=Tu;if(e.fromBufferAttribute(o,a[0]),s.fromBufferAttribute(o,a[1]),d.fromBufferAttribute(o,a[2]),Tu.getNormal(wu),u[0]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,u[1]=`${Math.round(s.x*n)},${Math.round(s.y*n)},${Math.round(s.z*n)}`,u[2]=`${Math.round(d.x*n)},${Math.round(d.y*n)},${Math.round(d.z*n)}`,u[0]!==u[1]&&u[1]!==u[2]&&u[2]!==u[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=u[t],r=u[e],o=Tu[l[t]],s=Tu[l[e]],d=`${n}_${r}`,p=`${r}_${n}`;p in h&&h[p]?(wu.dot(h[p].normal)<=i&&(c.push(o.x,o.y,o.z),c.push(s.x,s.y,s.z)),h[p]=null):d in h||(h[d]={index0:a[t],index1:a[e],normal:wu.clone()})}}for(const t in h)if(h[t]){const{index0:e,index1:n}=h[t];xu.fromBufferAttribute(o,e),bu.fromBufferAttribute(o,n),c.push(xu.x,xu.y,xu.z),c.push(bu.x,bu.y,bu.z)}this.setAttribute("position",new Yr(c,3))}}class Eu{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let s,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),s=n[i]-o,s<0)a=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===o)return i/(r-1);const u=n[i];return(i+(o-u)/(n[i+1]-u))/(r-1)}getTangent(t,e){let n=t-1e-4,i=t+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),o=this.getPoint(i),s=e||(r.isVector2?new ei:new pi);return s.copy(o).sub(r).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new pi,i=[],r=[],o=[],s=new pi,a=new Vi;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new pi),i[e].normalize()}r[0]=new pi,o[0]=new pi;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),c=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),c<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),o[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),o[e]=o[e-1].clone(),s.crossVectors(i[e-1],i[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(Yn(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(s,t))}o[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Yn(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Mu extends Eu{constructor(t=0,e=0,n=1,i=1,r=0,o=2*Math.PI,s=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a}getPoint(t,e){const n=e||new ei,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=o?0:i),!0!==this.aClockwise||o||(r===i?r=-i:r-=i);const s=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Mu.prototype.isEllipseCurve=!0;class Au extends Mu{constructor(t,e,n,i,r,o){super(t,e,n,n,i,r,o),this.type="ArcCurve"}}function Ru(){let t=0,e=0,n=0,i=0;function r(r,o,s,a){t=r,e=s,n=-3*r+3*o-2*s-a,i=2*r-2*o+s+a}return{initCatmullRom:function(t,e,n,i,o){r(e,n,o*(n-t),o*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,o,s,a){let l=(e-t)/o-(n-t)/(o+s)+(n-e)/s,u=(n-e)/s-(i-e)/(s+a)+(i-n)/a;l*=s,u*=s,r(e,n,l,u)},calc:function(r){const o=r*r;return t+e*r+n*o+i*(o*r)}}}Au.prototype.isArcCurve=!0;const Cu=new pi,Pu=new Ru,Iu=new Ru,Ou=new Ru;class Lu extends Eu{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new pi){const n=e,i=this.points,r=i.length,o=(r-(this.closed?0:1))*t;let s,a,l=Math.floor(o),u=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===u&&l===r-1&&(l=r-2,u=1),this.closed||l>0?s=i[(l-1)%r]:(Cu.subVectors(i[0],i[1]).add(i[0]),s=Cu);const h=i[l%r],c=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(Cu.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Cu),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(c),t),i=Math.pow(c.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Pu.initNonuniformCatmullRom(s.x,h.x,c.x,a.x,e,n,i),Iu.initNonuniformCatmullRom(s.y,h.y,c.y,a.y,e,n,i),Ou.initNonuniformCatmullRom(s.z,h.z,c.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Pu.initCatmullRom(s.x,h.x,c.x,a.x,this.tension),Iu.initCatmullRom(s.y,h.y,c.y,a.y,this.tension),Ou.initCatmullRom(s.z,h.z,c.z,a.z,this.tension));return n.set(Pu.calc(u),Iu.calc(u),Ou.calc(u)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new pi).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Nu(t,e,n,i,r){const o=.5*(i-e),s=.5*(r-n),a=t*t;return(2*n-2*i+o+s)*(t*a)+(-3*n+3*i-2*o-s)*a+o*t+n}function Du(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Fu(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}Lu.prototype.isCatmullRomCurve3=!0;class Bu extends Eu{constructor(t=new ei,e=new ei,n=new ei,i=new ei){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new ei){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Fu(t,i.x,r.x,o.x,s.x),Fu(t,i.y,r.y,o.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Bu.prototype.isCubicBezierCurve=!0;class Uu extends Eu{constructor(t=new pi,e=new pi,n=new pi,i=new pi){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new pi){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Fu(t,i.x,r.x,o.x,s.x),Fu(t,i.y,r.y,o.y,s.y),Fu(t,i.z,r.z,o.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Uu.prototype.isCubicBezierCurve3=!0;class ku extends Eu{constructor(t=new ei,e=new ei){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new ei){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new ei;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ku.prototype.isLineCurve=!0;class Gu extends Eu{constructor(t=new pi,e=new pi){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new pi){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Hu extends Eu{constructor(t=new ei,e=new ei,n=new ei){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new ei){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(Du(t,i.x,r.x,o.x),Du(t,i.y,r.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Hu.prototype.isQuadraticBezierCurve=!0;class zu extends Eu{constructor(t=new pi,e=new pi,n=new pi){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new pi){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(Du(t,i.x,r.x,o.x),Du(t,i.y,r.y,o.y),Du(t,i.z,r.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}zu.prototype.isQuadraticBezierCurve3=!0;class ju extends Eu{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new ei){const n=e,i=this.points,r=(i.length-1)*t,o=Math.floor(r),s=r-o,a=i[0===o?o:o-1],l=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Nu(s,a.x,l.x,u.x,h.x),Nu(s,a.y,l.y,u.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new ei).fromArray(n))}return this}}ju.prototype.isSplineCurve=!0;var Vu=Object.freeze({__proto__:null,ArcCurve:Au,CatmullRomCurve3:Lu,CubicBezierCurve:Bu,CubicBezierCurve3:Uu,EllipseCurve:Mu,LineCurve:ku,LineCurve3:Gu,QuadraticBezierCurve:Hu,QuadraticBezierCurve3:zu,SplineCurve:ju});const Wu=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let o=Xu(t,0,r,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,u,h,c,d,p;if(i&&(o=function(t,e,n,i){const r=[];let o,s,a,l,u;for(o=0,s=e.length;o<s;o++)a=e[o]*i,l=o<s-1?e[o+1]*i:t.length,u=Xu(t,a,l,i,!1),u===u.next&&(u.steiner=!0),r.push(ih(u));for(r.sort(Qu),o=0;o<r.length;o++)th(r[o],n),n=qu(n,n.next);return n}(t,e,o,n)),t.length>80*n){a=u=t[0],l=h=t[1];for(let e=n;e<r;e+=n)c=t[e],d=t[e+1],c<a&&(a=c),d<l&&(l=d),c>u&&(u=c),d>h&&(h=d);p=Math.max(u-a,h-l),p=0!==p?1/p:0}return Yu(o,s,n,a,l,p),s};function Xu(t,e,n,i,r){let o,s;if(r===function(t,e,n,i){let r=0;for(let o=e,s=n-i;o<n;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}(t,e,n,i)>0)for(o=e;o<n;o+=i)s=ph(o,t[o],t[o+1],s);else for(o=n-i;o>=e;o-=i)s=ph(o,t[o],t[o+1],s);return s&&ah(s,s.next)&&(fh(s),s=s.next),s}function qu(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!ah(i,i.next)&&0!==sh(i.prev,i,i.next))i=i.next;else{if(fh(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Yu(t,e,n,i,r,o,s){if(!t)return;!s&&o&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=nh(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,o,s,a,l,u=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,i=n,a=0,e=0;e<u&&(a++,i=i.nextZ,i);e++);for(l=u;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(s>1)}(r)}(t,i,r,o);let a,l,u=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Ju(t,i,r,o):Zu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),fh(t),t=l.next,u=l.next;else if((t=l)===u){s?1===s?Yu(t=Ku(qu(t),e,n),e,n,i,r,o,2):2===s&&$u(t,e,n,i,r,o):Yu(qu(t),e,n,i,r,o,1);break}}function Zu(t){const e=t.prev,n=t,i=t.next;if(sh(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(rh(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&sh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ju(t,e,n,i){const r=t.prev,o=t,s=t.next;if(sh(r,o,s)>=0)return!1;const a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,l=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,u=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,h=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,c=nh(a,l,e,n,i),d=nh(u,h,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&sh(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&sh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&sh(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&rh(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&sh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ku(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!ah(r,o)&&lh(r,i,i.next,o)&&ch(r,o)&&ch(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),fh(i),fh(i.next),i=t=o),i=i.next}while(i!==t);return qu(i)}function $u(t,e,n,i,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&oh(s,t)){let a=dh(s,t);return s=qu(s,s.next),a=qu(a,a.next),Yu(s,e,n,i,r,o),void Yu(a,e,n,i,r,o)}t=t.next}s=s.next}while(s!==t)}function Qu(t,e){return t.x-e.x}function th(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let o,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(i===s)return o;const a=o,l=o.x,u=o.y;let h,c=1/0;n=o;do{i>=n.x&&n.x>=l&&i!==n.x&&rh(r<u?i:s,r,l,u,r<u?s:i,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(i-n.x),ch(n,t)&&(h<c||h===c&&(n.x>o.x||n.x===o.x&&eh(o,n)))&&(o=n,c=h)),n=n.next}while(n!==a);return o}(t,e)){const n=dh(e,t);qu(e,e.next),qu(n,n.next)}}function eh(t,e){return sh(t.prev,t,e.prev)<0&&sh(e.next,t,t.next)<0}function nh(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ih(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function rh(t,e,n,i,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(i-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(r-s)*(i-a)>=0}function oh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&lh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(ch(t,e)&&ch(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(sh(t.prev,t,e.prev)||sh(t,e.prev,e))||ah(t,e)&&sh(t.prev,t,t.next)>0&&sh(e.prev,e,e.next)>0)}function sh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ah(t,e){return t.x===e.x&&t.y===e.y}function lh(t,e,n,i){const r=hh(sh(t,e,n)),o=hh(sh(t,e,i)),s=hh(sh(n,i,t)),a=hh(sh(n,i,e));return r!==o&&s!==a||(!(0!==r||!uh(t,n,e))||(!(0!==o||!uh(t,i,e))||(!(0!==s||!uh(n,t,i))||!(0!==a||!uh(n,e,i)))))}function uh(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function hh(t){return t>0?1:t<0?-1:0}function ch(t,e){return sh(t.prev,t,t.next)<0?sh(t,e,t.next)>=0&&sh(t,t.prev,e)>=0:sh(t,e,t.prev)<0||sh(t,t.next,e)<0}function dh(t,e){const n=new mh(t.i,t.x,t.y),i=new mh(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function ph(t,e,n,i){const r=new mh(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function fh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function mh(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class gh{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return gh.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];vh(t),_h(n,t);let o=t.length;e.forEach(vh);for(let t=0;t<e.length;t++)i.push(o),o+=e[t].length,_h(n,e[t]);const s=Wu(n,i);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function vh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function _h(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class yh extends so{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++){o(t[e])}function o(t){const o=[],s=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,u=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:6,c=void 0!==e.bevelSize?e.bevelSize:h-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:xh;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,v,_,y,x,b=!1;f&&(g=f.getSpacedPoints(a),b=!0,u=!1,v=f.computeFrenetFrames(a,!1),_=new pi,y=new pi,x=new pi),u||(p=0,h=0,c=0,d=0);const w=t.extractPoints(s);let T=w.shape;const S=w.holes;if(!gh.isClockWise(T)){T=T.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];gh.isClockWise(e)&&(S[t]=e.reverse())}}const E=gh.triangulateShape(T,S),M=T;for(let t=0,e=S.length;t<e;t++){const e=S[t];T=T.concat(e)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const R=T.length,C=E.length;function P(t,e,n){let i,r,o;const s=t.x-e.x,a=t.y-e.y,l=n.x-t.x,u=n.y-t.y,h=s*s+a*a,c=s*u-a*l;if(Math.abs(c)>Number.EPSILON){const c=Math.sqrt(h),d=Math.sqrt(l*l+u*u),p=e.x-a/c,f=e.y+s/c,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-a*l);i=p+s*m-t.x,r=f+a*m-t.y;const g=i*i+r*r;if(g<=2)return new ei(i,r);o=Math.sqrt(g/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(u)&&(t=!0),t?(i=-a,r=s,o=Math.sqrt(h)):(i=s,r=a,o=Math.sqrt(h/2))}return new ei(i/o,r/o)}const I=[];for(let t=0,e=M.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),I[t]=P(M[t],M[n],M[i]);const O=[];let L,N=I.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];L=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),L[t]=P(e[t],e[i],e[r]);O.push(L),N=N.concat(L)}for(let t=0;t<p;t++){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=M.length;t<e;t++){const e=A(M[t],I[t],i);B(e.x,e.y,-n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];L=O[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],L[t],i);B(r.x,r.y,-n)}}}const D=c+d;for(let t=0;t<R;t++){const e=u?A(T[t],N[t],D):T[t];b?(y.copy(v.normals[0]).multiplyScalar(e.x),_.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(_),B(x.x,x.y,x.z)):B(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<R;e++){const n=u?A(T[e],N[e],D):T[e];b?(y.copy(v.normals[t]).multiplyScalar(n.x),_.copy(v.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(y).add(_),B(x.x,x.y,x.z)):B(n.x,n.y,l/a*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=c*Math.sin(e*Math.PI/2)+d;for(let t=0,e=M.length;t<e;t++){const e=A(M[t],I[t],i);B(e.x,e.y,l+n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];L=O[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],L[t],i);b?B(r.x,r.y+g[a-1].y,g[a-1].x+n):B(r.x,r.y,l+n)}}}function F(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=R*t,o=R*(t+1);k(e+i+n,e+r+n,e+r+o,e+i+o)}}}function B(t,e,n){o.push(t),o.push(e),o.push(n)}function U(t,e,r){G(t),G(e),G(r);const o=i.length/3,s=m.generateTopUV(n,i,o-3,o-2,o-1);H(s[0]),H(s[1]),H(s[2])}function k(t,e,r,o){G(t),G(e),G(o),G(e),G(r),G(o);const s=i.length/3,a=m.generateSideWallUV(n,i,s-6,s-3,s-2,s-1);H(a[0]),H(a[1]),H(a[3]),H(a[1]),H(a[2]),H(a[3])}function G(t){i.push(o[3*t+0]),i.push(o[3*t+1]),i.push(o[3*t+2])}function H(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(u){let t=0,e=R*t;for(let t=0;t<C;t++){const n=E[t];U(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=R*t;for(let t=0;t<C;t++){const n=E[t];U(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<C;t++){const e=E[t];U(e[2],e[1],e[0])}for(let t=0;t<C;t++){const e=E[t];U(e[0]+R*a,e[1]+R*a,e[2]+R*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;F(M,e),e+=M.length;for(let t=0,n=S.length;t<n;t++){const n=S[t];F(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Yr(i,3)),this.setAttribute("uv",new Yr(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Vu[i.type]).fromJSON(i)),new yh(n,t.options)}}const xh={generateTopUV:function(t,e,n,i,r){const o=e[3*n],s=e[3*n+1],a=e[3*i],l=e[3*i+1],u=e[3*r],h=e[3*r+1];return[new ei(o,s),new ei(a,l),new ei(u,h)]},generateSideWallUV:function(t,e,n,i,r,o){const s=e[3*n],a=e[3*n+1],l=e[3*n+2],u=e[3*i],h=e[3*i+1],c=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(a-h)<Math.abs(s-u)?[new ei(s,1-l),new ei(u,1-c),new ei(d,1-f),new ei(m,1-v)]:[new ei(a,1-l),new ei(h,1-c),new ei(p,1-f),new ei(g,1-v)]}};class bh extends _u{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new bh(t.radius,t.detail)}}class wh extends so{constructor(t,e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Yn(i,0,2*Math.PI);const r=[],o=[],s=[],a=1/e,l=new pi,u=new ei;for(let r=0;r<=e;r++){const h=n+r*a*i,c=Math.sin(h),d=Math.cos(h);for(let n=0;n<=t.length-1;n++)l.x=t[n].x*c,l.y=t[n].y,l.z=t[n].x*d,o.push(l.x,l.y,l.z),u.x=r/e,u.y=n/(t.length-1),s.push(u.x,u.y)}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,o=i,s=i+t.length,a=i+t.length+1,l=i+1;r.push(o,s,l),r.push(s,a,l)}if(this.setIndex(r),this.setAttribute("position",new Yr(o,3)),this.setAttribute("uv",new Yr(s,2)),this.computeVertexNormals(),i===2*Math.PI){const n=this.attributes.normal.array,i=new pi,r=new pi,o=new pi,s=e*t.length*3;for(let e=0,a=0;e<t.length;e++,a+=3)i.x=n[a+0],i.y=n[a+1],i.z=n[a+2],r.x=n[s+a+0],r.y=n[s+a+1],r.z=n[s+a+2],o.addVectors(i,r).normalize(),n[a+0]=n[s+a+0]=o.x,n[a+1]=n[s+a+1]=o.y,n[a+2]=n[s+a+2]=o.z}}static fromJSON(t){return new wh(t.points,t.segments,t.phiStart,t.phiLength)}}class Th extends _u{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Th(t.radius,t.detail)}}class Sh extends so{constructor(t,e,n){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};const i=[],r=[],o=[],s=[],a=1e-5,l=new pi,u=new pi,h=new pi,c=new pi,d=new pi;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=e+1;for(let i=0;i<=n;i++){const p=i/n;for(let n=0;n<=e;n++){const i=n/e;t(i,p,u),r.push(u.x,u.y,u.z),i-a>=0?(t(i-a,p,h),c.subVectors(u,h)):(t(i+a,p,h),c.subVectors(h,u)),p-a>=0?(t(i,p-a,h),d.subVectors(u,h)):(t(i,p+a,h),d.subVectors(h,u)),l.crossVectors(c,d).normalize(),o.push(l.x,l.y,l.z),s.push(i,p)}}for(let t=0;t<n;t++)for(let n=0;n<e;n++){const e=t*p+n,r=t*p+n+1,o=(t+1)*p+n+1,s=(t+1)*p+n;i.push(e,r,s),i.push(r,o,s)}this.setIndex(i),this.setAttribute("position",new Yr(r,3)),this.setAttribute("normal",new Yr(o,3)),this.setAttribute("uv",new Yr(s,2))}}class Eh extends so{constructor(t=.5,e=1,n=8,i=1,r=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n);const s=[],a=[],l=[],u=[];let h=t;const c=(e-t)/(i=Math.max(1,i)),d=new pi,p=new ei;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*o;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,u.push(p.x,p.y)}h+=c}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,o=i+n+1,a=i+n+2,l=i+1;s.push(r,o,l),s.push(o,a,l)}}this.setIndex(s),this.setAttribute("position",new Yr(a,3)),this.setAttribute("normal",new Yr(l,3)),this.setAttribute("uv",new Yr(u,2))}static fromJSON(t){return new Eh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Mh extends so{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],o=[];let s=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,a,e),s+=a,a=0;function l(t){const s=i.length/3,l=t.extractPoints(e);let u=l.shape;const h=l.holes;!1===gh.isClockWise(u)&&(u=u.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===gh.isClockWise(e)&&(h[t]=e.reverse())}const c=gh.triangulateShape(u,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];u=u.concat(e)}for(let t=0,e=u.length;t<e;t++){const e=u[t];i.push(e.x,e.y,0),r.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=c.length;t<e;t++){const e=c[t],i=e[0]+s,r=e[1]+s,o=e[2]+s;n.push(i,r,o),a+=3}}this.setIndex(n),this.setAttribute("position",new Yr(i,3)),this.setAttribute("normal",new Yr(r,3)),this.setAttribute("uv",new Yr(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Mh(n,t.curveSegments)}}class Ah extends so{constructor(t=1,e=8,n=6,i=0,r=2*Math.PI,o=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:s},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(o+s,Math.PI);let l=0;const u=[],h=new pi,c=new pi,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let _=0;0==d&&0==o?_=.5/e:d==n&&a==Math.PI&&(_=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(i+a*r)*Math.sin(o+v*s),h.y=t*Math.cos(o+v*s),h.z=t*Math.sin(i+a*r)*Math.sin(o+v*s),p.push(h.x,h.y,h.z),c.copy(h).normalize(),f.push(c.x,c.y,c.z),m.push(a+_,1-v),g.push(l++)}u.push(g)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=u[t][i+1],r=u[t][i],s=u[t+1][i],l=u[t+1][i+1];(0!==t||o>0)&&d.push(e,r,l),(t!==n-1||a<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new Yr(p,3)),this.setAttribute("normal",new Yr(f,3)),this.setAttribute("uv",new Yr(m,2))}static fromJSON(t){return new Ah(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Rh extends _u{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Rh(t.radius,t.detail)}}class Ch extends yh{constructor(t,e={}){const n=e.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new so;const i=n.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(i,e),this.type="TextGeometry"}}class Ph extends so{constructor(t=1,e=.4,n=8,i=6,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],s=[],a=[],l=[],u=new pi,h=new pi,c=new pi;for(let o=0;o<=n;o++)for(let d=0;d<=i;d++){const p=d/i*r,f=o/n*Math.PI*2;h.x=(t+e*Math.cos(f))*Math.cos(p),h.y=(t+e*Math.cos(f))*Math.sin(p),h.z=e*Math.sin(f),s.push(h.x,h.y,h.z),u.x=t*Math.cos(p),u.y=t*Math.sin(p),c.subVectors(h,u).normalize(),a.push(c.x,c.y,c.z),l.push(d/i),l.push(o/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,s=(i+1)*(t-1)+e,a=(i+1)*t+e;o.push(n,r,a),o.push(r,s,a)}this.setIndex(o),this.setAttribute("position",new Yr(s,3)),this.setAttribute("normal",new Yr(a,3)),this.setAttribute("uv",new Yr(l,2))}static fromJSON(t){return new Ph(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Ih extends so{constructor(t=1,e=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const s=[],a=[],l=[],u=[],h=new pi,c=new pi,d=new pi,p=new pi,f=new pi,m=new pi,g=new pi;for(let s=0;s<=n;++s){const _=s/n*r*Math.PI*2;v(_,r,o,t,d),v(_+.01,r,o,t,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,o=-e*Math.cos(r),p=e*Math.sin(r);h.x=d.x+(o*g.x+p*f.x),h.y=d.y+(o*g.y+p*f.y),h.z=d.z+(o*g.z+p*f.z),a.push(h.x,h.y,h.z),c.subVectors(h,d).normalize(),l.push(c.x,c.y,c.z),u.push(s/n),u.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),o=(i+1)*t+e,a=(i+1)*(t-1)+e;s.push(n,r,a),s.push(r,o,a)}function v(t,e,n,i,r){const o=Math.cos(t),s=Math.sin(t),a=n/e*t,l=Math.cos(a);r.x=i*(2+l)*.5*o,r.y=i*(2+l)*s*.5,r.z=i*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new Yr(a,3)),this.setAttribute("normal",new Yr(l,3)),this.setAttribute("uv",new Yr(u,2))}static fromJSON(t){return new Ih(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Oh extends so{constructor(t,e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const s=new pi,a=new pi,l=new ei;let u=new pi;const h=[],c=[],d=[],p=[];function f(r){u=t.getPointAt(r/e,u);const l=o.normals[r],d=o.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),o=-Math.cos(e);a.x=o*l.x+r*d.x,a.y=o*l.y+r*d.y,a.z=o*l.z+r*d.z,a.normalize(),c.push(a.x,a.y,a.z),s.x=u.x+n*a.x,s.y=u.y+n*a.y,s.z=u.z+n*a.z,h.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),o=(i+1)*t+e,s=(i+1)*(t-1)+e;p.push(n,r,s),p.push(r,o,s)}}()}(),this.setIndex(p),this.setAttribute("position",new Yr(h,3)),this.setAttribute("normal",new Yr(c,3)),this.setAttribute("uv",new Yr(d,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Oh((new Vu[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Lh extends so{constructor(t){if(super(),this.type="WireframeGeometry",!0===t.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const e=[],n=[0,0],i={},r=new pi;if(null!==t.index){const o=t.attributes.position,s=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let t=0,e=a.length;t<e;++t){const e=a[t],r=e.start;for(let t=r,o=r+e.count;t<o;t+=3)for(let e=0;e<3;e++){const r=s.getX(t+e),o=s.getX(t+(e+1)%3);n[0]=Math.min(r,o),n[1]=Math.max(r,o);const a=n[0]+","+n[1];void 0===i[a]&&(i[a]={index1:n[0],index2:n[1]})}}for(const t in i){const n=i[t];r.fromBufferAttribute(o,n.index1),e.push(r.x,r.y,r.z),r.fromBufferAttribute(o,n.index2),e.push(r.x,r.y,r.z)}}else{const n=t.attributes.position;for(let t=0,i=n.count/3;t<i;t++)for(let i=0;i<3;i++){const o=3*t+i;r.fromBufferAttribute(n,o),e.push(r.x,r.y,r.z);const s=3*t+(i+1)%3;r.fromBufferAttribute(n,s),e.push(r.x,r.y,r.z)}}this.setAttribute("position",new Yr(e,3))}}var Nh=Object.freeze({__proto__:null,BoxGeometry:Ao,BoxBufferGeometry:Ao,CircleGeometry:mu,CircleBufferGeometry:mu,ConeGeometry:vu,ConeBufferGeometry:vu,CylinderGeometry:gu,CylinderBufferGeometry:gu,DodecahedronGeometry:yu,DodecahedronBufferGeometry:yu,EdgesGeometry:Su,ExtrudeGeometry:yh,ExtrudeBufferGeometry:yh,IcosahedronGeometry:bh,IcosahedronBufferGeometry:bh,LatheGeometry:wh,LatheBufferGeometry:wh,OctahedronGeometry:Th,OctahedronBufferGeometry:Th,ParametricGeometry:Sh,ParametricBufferGeometry:Sh,PlaneGeometry:Xo,PlaneBufferGeometry:Xo,PolyhedronGeometry:_u,PolyhedronBufferGeometry:_u,RingGeometry:Eh,RingBufferGeometry:Eh,ShapeGeometry:Mh,ShapeBufferGeometry:Mh,SphereGeometry:Ah,SphereBufferGeometry:Ah,TetrahedronGeometry:Rh,TetrahedronBufferGeometry:Rh,TextGeometry:Ch,TextBufferGeometry:Ch,TorusGeometry:Ph,TorusBufferGeometry:Ph,TorusKnotGeometry:Ih,TorusKnotBufferGeometry:Ih,TubeGeometry:Oh,TubeBufferGeometry:Oh,WireframeGeometry:Lh});class Dh extends Rr{constructor(t){super(),this.type="ShadowMaterial",this.color=new Dr(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Dh.prototype.isShadowMaterial=!0;class Fh extends Io{constructor(t){super(t),this.type="RawShaderMaterial"}}Fh.prototype.isRawShaderMaterial=!0;class Bh extends Rr{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Dr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}Bh.prototype.isMeshStandardMaterial=!0;class Uh extends Bh{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ei(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=Yn(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Dr(1,1,1),this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new Dr).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this}}Uh.prototype.isMeshPhysicalMaterial=!0;class kh extends Rr{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Dr(16777215),this.specular=new Dr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=et,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}kh.prototype.isMeshPhongMaterial=!0;class Gh extends Rr{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Dr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Gh.prototype.isMeshToonMaterial=!0;class Hh extends Rr{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Hh.prototype.isMeshNormalMaterial=!0;class zh extends Rr{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Dr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Dr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=et,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}zh.prototype.isMeshLambertMaterial=!0;class jh extends Rr{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Dr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pn,this.normalScale=new ei(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}jh.prototype.isMeshMatcapMaterial=!0;class Vh extends ql{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Vh.prototype.isLineDashedMaterial=!0;var Wh=Object.freeze({__proto__:null,ShadowMaterial:Dh,SpriteMaterial:dl,RawShaderMaterial:Fh,ShaderMaterial:Io,PointsMaterial:ru,MeshPhysicalMaterial:Uh,MeshStandardMaterial:Bh,MeshPhongMaterial:kh,MeshToonMaterial:Gh,MeshNormalMaterial:Hh,MeshLambertMaterial:zh,MeshDepthMaterial:Xa,MeshDistanceMaterial:qa,MeshBasicMaterial:Fr,MeshMatcapMaterial:jh,LineDashedMaterial:Vh,LineBasicMaterial:ql,Material:Rr});const Xh={arraySlice:function(t,e,n){return Xh.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let o=0,s=0;s!==i;++o){const i=n[o]*e;for(let n=0;n!==e;++n)r[s++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,o=t[0];for(;void 0!==o&&void 0===o[i];)o=t[r++];if(void 0===o)return;let s=o[i];if(void 0!==s)if(Array.isArray(s))do{s=o[i],void 0!==s&&(e.push(o.time),n.push.apply(n,s)),o=t[r++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[i],void 0!==s&&(e.push(o.time),s.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{s=o[i],void 0!==s&&(e.push(o.time),n.push(s)),o=t[r++]}while(void 0!==o)},subclip:function(t,e,n,i,r=30){const o=t.clone();o.name=e;const s=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],a=e.getValueSize(),l=[],u=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*r;if(!(o<n||o>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)u.push(e.values[t*a+n])}}0!==l.length&&(e.times=Xh.convertArray(l,e.times.constructor),e.values=Xh.convertArray(u,e.values.constructor),s.push(e))}o.tracks=s;let a=1/0;for(let t=0;t<o.tracks.length;++t)a>o.tracks[t].times[0]&&(a=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,o=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===s)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let u=0;const h=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);const c=i.times.length-1;let d;if(o<=i.times[0]){const t=a,e=l-a;d=Xh.arraySlice(i.values,t,e)}else if(o>=i.times[c]){const t=c*l+a,e=t+l-a;d=Xh.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(o),d=Xh.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new di).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*h+u;if("quaternion"===r)di.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=h-2*u;for(let n=0;n<t;++n)s.values[e+n]-=d[n]}}}return t.blendMode=$e,t}};class qh{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let o;n:{i:if(!(t<i)){for(let o=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===o)break;if(r=i,i=e[++n],t<i)break e}o=e.length;break n}if(t>=r)break t;{const s=e[1];t<s&&(n=2,r=s);for(let o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===o)break;if(i=r,r=e[--n-1],t>=r)break e}o=n,n=0}}for(;n<o;){const i=n+o>>>1;t<e[i]?o=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}qh.prototype.beforeStart_=qh.prototype.copySampleValue_,qh.prototype.afterEnd_=qh.prototype.copySampleValue_;class Yh extends qh{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ye,endingEnd:Ye}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,o=t+1,s=i[r],a=i[o];if(void 0===s)switch(this.getSettings_().endingStart){case Ze:r=t,s=2*e-n;break;case Je:r=i.length-2,s=e+i[r]-i[r+1];break;default:r=t,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Ze:o=t,a=2*n-e;break;case Je:o=1,a=n+i[1]-i[0];break;default:o=t-1,a=e}const l=.5*(n-e),u=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(a-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,u=this._offsetPrev,h=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,v=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*o[u+t]+v*o[l+t]+_*o[a+t]+y*o[h+t];return r}}class Zh extends qh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,u=(n-e)/(i-e),h=1-u;for(let t=0;t!==s;++t)r[t]=o[l+t]*h+o[a+t]*u;return r}}class Jh extends qh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Kh{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xh.convertArray(e,this.TimeBufferType),this.values=Xh.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Xh.convertArray(t.times,Array),values:Xh.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Jh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Zh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Yh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case We:e=this.InterpolantFactoryMethodDiscrete;break;case Xe:e=this.InterpolantFactoryMethodLinear;break;case qe:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return We;case this.InterpolantFactoryMethodLinear:return Xe;case this.InterpolantFactoryMethodSmooth:return qe}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=Xh.arraySlice(n,r,o),this.values=Xh.arraySlice(this.values,r*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==o&&o>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,o),t=!1;break}o=i}if(void 0!==i&&Xh.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Xh.arraySlice(this.times),e=Xh.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===qe,r=t.length-1;let o=1;for(let s=1;s<r;++s){let r=!1;const a=t[s];if(a!==t[s+1]&&(1!==s||a!==t[0]))if(i)r=!0;else{const t=s*n,i=t-n,o=t+n;for(let s=0;s!==n;++s){const n=e[t+s];if(n!==e[i+s]||n!==e[o+s]){r=!0;break}}}if(r){if(s!==o){t[o]=t[s];const i=s*n,r=o*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++o}}if(r>0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o}return o!==t.length?(this.times=Xh.arraySlice(t,0,o),this.values=Xh.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this}clone(){const t=Xh.arraySlice(this.times,0),e=Xh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Kh.prototype.TimeBufferType=Float32Array,Kh.prototype.ValueBufferType=Float32Array,Kh.prototype.DefaultInterpolation=Xe;class $h extends Kh{}$h.prototype.ValueTypeName="bool",$h.prototype.ValueBufferType=Array,$h.prototype.DefaultInterpolation=We,$h.prototype.InterpolantFactoryMethodLinear=void 0,$h.prototype.InterpolantFactoryMethodSmooth=void 0;class Qh extends Kh{}Qh.prototype.ValueTypeName="color";class tc extends Kh{}tc.prototype.ValueTypeName="number";class ec extends qh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)di.slerpFlat(r,0,o,l-s,o,l,a);return r}}class nc extends Kh{InterpolantFactoryMethodLinear(t){return new ec(this.times,this.values,this.getValueSize(),t)}}nc.prototype.ValueTypeName="quaternion",nc.prototype.DefaultInterpolation=Xe,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends Kh{}ic.prototype.ValueTypeName="string",ic.prototype.ValueBufferType=Array,ic.prototype.DefaultInterpolation=We,ic.prototype.InterpolantFactoryMethodLinear=void 0,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class rc extends Kh{}rc.prototype.ValueTypeName="vector";class oc{constructor(t,e=-1,n,i=Ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=qn(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(sc(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Kh.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,o=[];for(let t=0;t<r;t++){let s=[],a=[];s.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=Xh.getKeyframeOrder(s);s=Xh.sortedArray(s,1,l),a=Xh.sortedArray(a,1,l),i||0!==s[0]||(s.push(r),a.push(a[0])),o.push(new tc(".morphTargetInfluences["+e[t].name+"]",s,a).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name.match(r);if(o&&o.length>1){const t=o[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const o=[];for(const t in i)o.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],s=[];Xh.flattenJSON(n,o,s,i),0!==o.length&&r.push(new t(e,o,s))}},i=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],o=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),o.push(i.morphTarget===n?1:0)}i.push(new tc(".morphTargetInfluence["+n+"]",t,o))}a=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";n(rc,o+".position",r,"pos",i),n(nc,o+".quaternion",r,"rot",i),n(rc,o+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,a,i,s)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function sc(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return tc;case"vector":case"vector2":case"vector3":case"vector4":return rc;case"color":return Qh;case"quaternion":return nc;case"bool":case"boolean":return $h;case"string":return ic}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Xh.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const ac={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class lc{constructor(t,e,n){const i=this;let r=!1,o=0,s=0,a=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,s),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,s),o===s&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const uc=new lc;class hc{constructor(t){this.manager=void 0!==t?t:uc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const cc={};class dc extends hc{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=ac.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;if(void 0!==cc[t])return void cc[t].push({onLoad:e,onProgress:n,onError:i});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(s){const n=s[1],o=!!s[2];let a=s[3];a=decodeURIComponent(a),o&&(a=atob(a));try{let i;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let e=0;e<a.length;e++)t[e]=a.charCodeAt(e);i="blob"===o?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;i=e.parseFromString(a,n);break;case"json":i=JSON.parse(a);break;default:i=a}setTimeout((function(){e&&e(i),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{cc[t]=[],cc[t].push({onLoad:e,onProgress:n,onError:i}),a=new XMLHttpRequest,a.open("GET",t,!0),a.addEventListener("load",(function(e){const n=this.response,i=cc[t];if(delete cc[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ac.add(t,n);for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onLoad&&e.onLoad(n)}r.manager.itemEnd(t)}else{for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),a.addEventListener("progress",(function(e){const n=cc[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onProgress&&i.onProgress(e)}}),!1),a.addEventListener("error",(function(e){const n=cc[t];delete cc[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),a.addEventListener("abort",(function(e){const n=cc[t];delete cc[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return r.manager.itemStart(t),a}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class pc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=oc.parse(t[n]);e.push(i)}return e}}class fc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=[],s=new du,a=new dc(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function u(u){a.load(t[u],(function(t){const n=r.parse(t,!0);o[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(s.minFilter=Et),s.image=o,s.format=n.format,s.needsUpdate=!0,e&&e(s))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)u(e);else a.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){o[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)o[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),o[e].format=n.format,o[e].width=n.width,o[e].height=n.height}s.image=o}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=Et),s.format=n.format,s.needsUpdate=!0,e&&e(s)}),n,i);return s}}class mc extends hc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=ac.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),ac.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class gc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=new Do,o=new mc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(t[n],(function(t){r.images[n]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class vc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new Ul,s=new dc(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(t,(function(t){const n=r.parse(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:_t,o.wrapT=void 0!==n.wrapT?n.wrapT:_t,o.magFilter=void 0!==n.magFilter?n.magFilter:Et,o.minFilter=void 0!==n.minFilter?n.minFilter:Et,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=Rt),1===n.mipmapCount&&(o.minFilter=Et),void 0!==n.generateMipmaps&&(o.generateMipmaps=n.generateMipmaps),o.needsUpdate=!0,e&&e(o,n))}),n,i),o}}class _c extends hc{constructor(t){super(t)}load(t,e,n,i){const r=new si,o=new mc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(n){r.image=n;const i=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=i?jt:Vt,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class yc extends Eu{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new ku(e,t))}getPoint(t){const e=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=e){const t=n[i]-e,r=this.curves[i],o=r.getLength(),s=0===o?0:1-t/o;return r.getPointAt(s)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],s=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,a=o.getPoints(s);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Vu[n.type]).fromJSON(n))}return this}}class xc extends yc{constructor(t){super(),this.type="Path",this.currentPoint=new ei,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new ku(this.currentPoint.clone(),new ei(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Hu(this.currentPoint.clone(),new ei(t,e),new ei(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,o){const s=new Bu(this.currentPoint.clone(),new ei(t,e),new ei(n,i),new ei(r,o));return this.curves.push(s),this.currentPoint.set(r,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new ju(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+s,e+a,n,i,r,o),this}absarc(t,e,n,i,r,o){return this.absellipse(t,e,n,n,i,r,o),this}ellipse(t,e,n,i,r,o,s,a){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+l,e+u,n,i,r,o,s,a),this}absellipse(t,e,n,i,r,o,s,a){const l=new Mu(t,e,n,i,r,o,s,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class bc extends xc{constructor(t){super(t),this.uuid=qn(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new xc).fromJSON(n))}return this}}class wc extends mr{constructor(t,e=1){super(),this.type="Light",this.color=new Dr(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}wc.prototype.isLight=!0;class Tc extends wc{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.groundColor=new Dr(e)}copy(t){return wc.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Tc.prototype.isHemisphereLight=!0;const Sc=new Vi,Ec=new pi,Mc=new pi;class Ac{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new ei(512,512),this.map=null,this.mapPass=null,this.matrix=new Vi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new jo,this._frameExtents=new ei(1,1),this._viewportCount=1,this._viewports=[new li(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Ec.setFromMatrixPosition(t.matrixWorld),e.position.copy(Ec),Mc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Mc),e.updateMatrixWorld(),Sc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Rc extends Ac{constructor(){super(new Lo(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*Xn*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Rc.prototype.isSpotLightShadow=!0;class Cc extends wc{constructor(t,e,n=0,i=Math.PI/3,r=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.target=new mr,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.shadow=new Rc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Cc.prototype.isSpotLight=!0;const Pc=new Vi,Ic=new pi,Oc=new pi;class Lc extends Ac{constructor(){super(new Lo(90,1,.5,500)),this._frameExtents=new ei(4,2),this._viewportCount=6,this._viewports=[new li(2,1,1,1),new li(0,1,1,1),new li(3,1,1,1),new li(1,1,1,1),new li(3,0,1,1),new li(1,0,1,1)],this._cubeDirections=[new pi(1,0,0),new pi(-1,0,0),new pi(0,0,1),new pi(0,0,-1),new pi(0,1,0),new pi(0,-1,0)],this._cubeUps=[new pi(0,1,0),new pi(0,1,0),new pi(0,1,0),new pi(0,1,0),new pi(0,0,1),new pi(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ic.setFromMatrixPosition(t.matrixWorld),n.position.copy(Ic),Oc.copy(n.position),Oc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Oc),n.updateMatrixWorld(),i.makeTranslation(-Ic.x,-Ic.y,-Ic.z),Pc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Pc)}}Lc.prototype.isPointLightShadow=!0;class Nc extends wc{constructor(t,e,n=0,i=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Lc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Nc.prototype.isPointLight=!0;class Dc extends Oo{constructor(t=-1,e=1,n=1,i=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,o=n+t,s=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,s-=e*this.view.offsetY,a=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Dc.prototype.isOrthographicCamera=!0;class Fc extends Ac{constructor(){super(new Dc(-5,5,5,-5,.5,500))}}Fc.prototype.isDirectionalLightShadow=!0;class Bc extends wc{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(mr.DefaultUp),this.updateMatrix(),this.target=new mr,this.shadow=new Fc}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Bc.prototype.isDirectionalLight=!0;class Uc extends wc{constructor(t,e){super(t,e),this.type="AmbientLight"}}Uc.prototype.isAmbientLight=!0;class kc extends wc{constructor(t,e,n=10,i=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=i}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}kc.prototype.isRectAreaLight=!0;class Gc{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new pi)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*i),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*i*1.092548),e.addScaledVector(o[5],i*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],n*r*1.092548),e.addScaledVector(o[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*i),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*i),e.addScaledVector(o[5],.858086*i*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*n*r),e.addScaledVector(o[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}Gc.prototype.isSphericalHarmonics3=!0;class Hc extends wc{constructor(t=new Gc,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}Hc.prototype.isLightProbe=!0;class zc extends hc{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,o=new dc(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=new Wh[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=(new Dr).setHex(t.sheen)),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),1!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(i.morphNormals=t.morphNormals),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.vertexTangents&&(i.vertexTangents=t.vertexTangents),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new Dr).setHex(r.value);break;case"v2":i.uniforms[e].value=(new ei).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new pi).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new li).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new ni).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Vi).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new ei).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new ei).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),i}setTextures(t){return this.textures=t,this}}class jc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class Vc extends so{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}Vc.prototype.isInstancedBufferGeometry=!0;class Wc extends kr{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}Wc.prototype.isInstancedBufferAttribute=!0;class Xc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],o=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),s=$r(r.type,o),a=new ul(s,r.stride);return a.uuid=r.uuid,e[i]=a,a}const r=t.isInstancedBufferGeometry?new Vc:new so,o=t.data.index;if(void 0!==o){const t=$r(o.type,o.array);r.setIndex(new kr(t,1))}const s=t.data.attributes;for(const e in s){const n=s[e];let o;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);o=new cl(e,n.itemSize,n.offset,n.normalized)}else{const t=$r(n.type,n.array);o=new(n.isInstancedBufferAttribute?Wc:kr)(t,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),void 0!==n.usage&&o.setUsage(n.usage),void 0!==n.updateRange&&(o.updateRange.offset=n.updateRange.offset,o.updateRange.count=n.updateRange.count),r.setAttribute(e,o)}const a=t.data.morphAttributes;if(a)for(const e in a){const n=a[e],o=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let s;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);s=new cl(e,r.itemSize,r.offset,r.normalized)}else{const t=$r(r.type,r.array);s=new kr(t,r.itemSize,r.normalized)}void 0!==r.name&&(s.name=r.name),o.push(s)}r.morphAttributes[e]=o}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];r.addGroup(e.start,e.count,e.materialIndex)}const u=t.data.boundingSphere;if(void 0!==u){const t=new pi;void 0!==u.center&&t.fromArray(u.center),r.boundingSphere=new Di(t,u.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class qc extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=""===this.path?jc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||o;const s=new dc(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){let o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const s=o.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,i)}async loadAsync(t,e){const n=""===this.path?jc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new dc(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),o=JSON.parse(r),s=o.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),o=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),s=this.parseTextures(t.textures,o),a=this.parseMaterials(t.materials,s),l=this.parseObject(t.object,r,a,s,n),u=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,u),void 0!==e){let t=!1;for(const e in o)if(o[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),o=this.parseTextures(t.textures,r),s=this.parseMaterials(t.materials,o),a=this.parseObject(t.object,i,s,o,e),l=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,l),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new bc).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new Hl).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new Xc;for(let r=0,o=t.length;r<o;r++){let o;const s=t[r];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:s.type in Nh?o=Nh[s.type].fromJSON(s,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${s.type}"`)}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new zc;r.setTextures(e);for(let e=0,o=t.length;e<o;e++){const o=t[e];if("MultiMaterial"===o.type){const t=[];for(let e=0;e<o.materials.length;e++){const i=o.materials[e];void 0===n[i.uuid]&&(n[i.uuid]=r.parse(i)),t.push(n[i.uuid])}i[o.uuid]=t}else void 0===n[o.uuid]&&(n[o.uuid]=r.parse(o)),i[o.uuid]=n[o.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=oc.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function o(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:$r(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new lc(e);r=new mc(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){i[n.uuid]=[];for(let t=0,e=r.length;t<e;t++){const e=o(r[t]);null!==e&&(e instanceof HTMLImageElement?i[n.uuid].push(e):i[n.uuid].push(new Ul(e.data,e.width,e.height)))}}else{const t=o(n.url);null!==t&&(i[n.uuid]=t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:$r(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new mc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],o=i.url;if(Array.isArray(o)){n[i.uuid]=[];for(let t=0,e=o.length;t<e;t++){const e=o[t],s=await r(e);null!==s&&(s instanceof HTMLImageElement?n[i.uuid].push(s):n[i.uuid].push(new Ul(s.data,s.width,s.height)))}}else{const t=await r(i.url);null!==t&&(n[i.uuid]=t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,o=t.length;r<o;r++){const o=t[r];let s;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const a=e[o.image];Array.isArray(a)?(s=new Do(a),6===a.length&&(s.needsUpdate=!0)):(s=a&&a.data?new Ul(a.data,a.width,a.height):new si(a),a&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,Yc)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],Zc),s.wrapT=n(o.wrap[1],Zc)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,Jc)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,Jc)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),i[o.uuid]=s}return i}parseObject(t,e,n,i,r){let o,s,a;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function u(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function h(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":o=new ll,void 0!==t.background&&(Number.isInteger(t.background)?o.background=new Dr(t.background):o.background=h(t.background)),void 0!==t.environment&&(o.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new al(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new sl(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new Lo(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new Dc(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"AmbientLight":o=new Uc(t.color,t.intensity);break;case"DirectionalLight":o=new Bc(t.color,t.intensity);break;case"PointLight":o=new Nc(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":o=new kc(t.color,t.intensity,t.width,t.height);break;case"SpotLight":o=new Cc(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new Tc(t.color,t.groundColor,t.intensity);break;case"LightProbe":o=(new Hc).fromJSON(t);break;case"SkinnedMesh":s=l(t.geometry),a=u(t.material),o=new Fl(s,a),void 0!==t.bindMode&&(o.bindMode=t.bindMode),void 0!==t.bindMatrix&&o.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(o.skeleton=t.skeleton);break;case"Mesh":s=l(t.geometry),a=u(t.material),o=new Eo(s,a);break;case"InstancedMesh":s=l(t.geometry),a=u(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;o=new Xl(s,a,e),o.instanceMatrix=new kr(new Float32Array(n.array),16),void 0!==i&&(o.instanceColor=new kr(new Float32Array(i.array),i.itemSize));break;case"LOD":o=new Pl;break;case"Line":o=new Ql(l(t.geometry),u(t.material));break;case"LineLoop":o=new iu(l(t.geometry),u(t.material));break;case"LineSegments":o=new nu(l(t.geometry),u(t.material));break;case"PointCloud":case"Points":o=new uu(l(t.geometry),u(t.material));break;case"Sprite":o=new Ml(u(t.material));break;case"Group":o=new Qa;break;case"Bone":o=new Bl;break;default:o=new mr}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(o.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(o.matrixAutoUpdate=t.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(o.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.frustumCulled&&(o.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(o.renderOrder=t.renderOrder),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.layers&&(o.layers.mask=t.layers),void 0!==t.children){const s=t.children;for(let t=0;t<s.length;t++)o.add(this.parseObject(s[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];o.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(o.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=o.getObjectByProperty("uuid",n.object);void 0!==i&&o.addLevel(i,n.distance)}}return o}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const Yc={UVMapping:ht,CubeReflectionMapping:ct,CubeRefractionMapping:dt,EquirectangularReflectionMapping:pt,EquirectangularRefractionMapping:ft,CubeUVReflectionMapping:mt,CubeUVRefractionMapping:gt},Zc={RepeatWrapping:vt,ClampToEdgeWrapping:_t,MirroredRepeatWrapping:yt},Jc={NearestFilter:xt,NearestMipmapNearestFilter:bt,NearestMipmapLinearFilter:Tt,LinearFilter:Et,LinearMipmapNearestFilter:Mt,LinearMipmapLinearFilter:Rt};class Kc extends hc{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=ac.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){ac.add(t,n),e&&e(n),r.manager.itemEnd(t)})).catch((function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}Kc.prototype.isImageBitmapLoader=!0;class $c{constructor(){this.type="ShapePath",this.color=new Dr,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new xc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,o){return this.currentPath.bezierCurveTo(t,e,n,i,r,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new bc;r.curves=i.curves,e.push(r)}return e}function i(t,e){const n=e.length;let i=!1;for(let r=n-1,o=0;o<n;r=o++){let n=e[r],s=e[o],a=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[o],a=-a,s=e[r],l=-l),t.y<n.y||t.y>s.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(s.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=s.x)return!0}}return i}const r=gh.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let s,a,l;const u=[];if(1===o.length)return a=o[0],l=new bc,l.curves=a.curves,u.push(l),u;let h=!r(o[0].getPoints());h=t?!h:h;const c=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,n=o.length;e<n;e++)a=o[e],p=a.getPoints(),s=r(p),s=t?!s:s,s?(!h&&d[g]&&g++,d[g]={s:new bc,p:p},d[g].s.curves=a.curves,h&&g++,m[g]=[]):m[g].push({h:a,p:p[0]});if(!d[0])return n(o);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)c[t]=[];for(let n=0,r=d.length;n<r;n++){const r=m[n];for(let o=0;o<r.length;o++){const s=r[o];let a=!0;for(let r=0;r<d.length;r++)i(s.p,d[r].p)&&(n!==r&&e.push({froms:n,tos:r,hole:o}),a?(a=!1,c[r].push(s)):t=!0);a&&c[n].push(s)}}e.length>0&&(t||(m=c))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,u.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return u}}class Qc{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],i=function(t,e,n){const i=Array.from(t),r=e/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,s=[];let a=0,l=0;for(let t=0;t<i.length;t++){const e=i[t];if("\n"===e)a=0,l-=o;else{const t=td(e,r,a,l,n);a+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=i.length;t<e;t++)Array.prototype.push.apply(n,i[t].toShapes());return n}}function td(t,e,n,i,r){const o=r.glyphs[t]||r.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const s=new $c;let a,l,u,h,c,d,p,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let r=0,o=t.length;r<o;){switch(t[r++]){case"m":a=t[r++]*e+n,l=t[r++]*e+i,s.moveTo(a,l);break;case"l":a=t[r++]*e+n,l=t[r++]*e+i,s.lineTo(a,l);break;case"q":u=t[r++]*e+n,h=t[r++]*e+i,c=t[r++]*e+n,d=t[r++]*e+i,s.quadraticCurveTo(c,d,u,h);break;case"b":u=t[r++]*e+n,h=t[r++]*e+i,c=t[r++]*e+n,d=t[r++]*e+i,p=t[r++]*e+n,f=t[r++]*e+i,s.bezierCurveTo(c,d,p,f,u,h)}}}return{offsetX:o.ha*e,path:s}}Qc.prototype.isFont=!0;class ed extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){let n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const i=r.parse(n);e&&e(i)}),n,i)}parse(t){return new Qc(t)}}let nd;const id={getContext:function(){return void 0===nd&&(nd=new(window.AudioContext||window.webkitAudioContext)),nd},setContext:function(t){nd=t}};class rd extends hc{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new dc(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{const t=n.slice(0);id.getContext().decodeAudioData(t,(function(t){e(t)}))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}}class od extends Hc{constructor(t,e,n=1){super(void 0,n);const i=(new Dr).set(t),r=(new Dr).set(e),o=new pi(i.r,i.g,i.b),s=new pi(r.r,r.g,r.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}}od.prototype.isHemisphereLightProbe=!0;class sd extends Hc{constructor(t,e=1){super(void 0,e);const n=(new Dr).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}sd.prototype.isAmbientLightProbe=!0;const ad=new Vi,ld=new Vi;class ud{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Lo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Lo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;const n=t.projectionMatrix.clone(),i=e.eyeSep/2,r=i*e.near/e.focus,o=e.near*Math.tan(Wn*e.fov*.5)/e.zoom;let s,a;ld.elements[12]=-i,ad.elements[12]=i,s=-o*e.aspect+r,a=o*e.aspect+r,n.elements[0]=2*e.near/(a-s),n.elements[8]=(a+s)/(a-s),this.cameraL.projectionMatrix.copy(n),s=-o*e.aspect-r,a=o*e.aspect-r,n.elements[0]=2*e.near/(a-s),n.elements[8]=(a+s)/(a-s),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(ld),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(ad)}}class hd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=cd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=cd();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function cd(){return("undefined"==typeof performance?Date:performance).now()}const dd=new pi,pd=new di,fd=new pi,md=new pi;class gd extends mr{constructor(){super(),this.type="AudioListener",this.context=id.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new hd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(dd,pd,fd),md.set(0,0,-1).applyQuaternion(pd),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(dd.x,t),e.positionY.linearRampToValueAtTime(dd.y,t),e.positionZ.linearRampToValueAtTime(dd.z,t),e.forwardX.linearRampToValueAtTime(md.x,t),e.forwardY.linearRampToValueAtTime(md.y,t),e.forwardZ.linearRampToValueAtTime(md.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(dd.x,dd.y,dd.z),e.setOrientation(md.x,md.y,md.z,n.x,n.y,n.z)}}class vd extends mr{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const _d=new pi,yd=new di,xd=new pi,bd=new pi;class wd extends vd{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(_d,yd,xd),bd.set(0,0,1).applyQuaternion(yd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(_d.x,t),e.positionY.linearRampToValueAtTime(_d.y,t),e.positionZ.linearRampToValueAtTime(_d.z,t),e.orientationX.linearRampToValueAtTime(bd.x,t),e.orientationY.linearRampToValueAtTime(bd.y,t),e.orientationZ.linearRampToValueAtTime(bd.z,t)}else e.setPosition(_d.x,_d.y,_d.z),e.setOrientation(bd.x,bd.y,bd.z)}}class Td{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Sd{constructor(t,e,n){let i,r,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==i;++t)n[r+t]=n[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){s.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){di.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const o=this._workIndex*r;di.multiplyQuaternionsFlat(t,o,t,e,t,n),di.slerpFlat(t,e,t,e,t,o,i)}_lerp(t,e,n,i,r){const o=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[n+s]*i}}_lerpAdditive(t,e,n,i,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[n+o]*i}}}const Ed=new RegExp("[\\[\\]\\.:\\/]","g"),Md="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Ad=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Rd=/(WCOD+)?/.source.replace("WCOD",Md),Cd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Pd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Id=new RegExp("^"+Ad+Rd+Cd+Pd+"$"),Od=["material","materials","bones"];class Ld{constructor(t,e,n){this.path=e,this.parsedPath=n||Ld.parseTrackName(e),this.node=Ld.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Ld.Composite(t,e,n):new Ld(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ed,"")}static parseTrackName(t){const e=Id.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Od.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const o=n(r.children);if(o)return o}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.node[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Ld.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const o=t[i];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ld.Composite=class{constructor(t,e,n){const i=n||Ld.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ld.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ld.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ld.prototype.GetterByBindingType=[Ld.prototype._getValue_direct,Ld.prototype._getValue_array,Ld.prototype._getValue_arrayElement,Ld.prototype._getValue_toArray],Ld.prototype.SetterByBindingTypeAndVersioning=[[Ld.prototype._setValue_direct,Ld.prototype._setValue_direct_setNeedsUpdate,Ld.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ld.prototype._setValue_array,Ld.prototype._setValue_array_setNeedsUpdate,Ld.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ld.prototype._setValue_arrayElement,Ld.prototype._setValue_arrayElement_setNeedsUpdate,Ld.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ld.prototype._setValue_fromArray,Ld.prototype._setValue_fromArray_setNeedsUpdate,Ld.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Nd{constructor(){this.uuid=qn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let s=void 0,a=t.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const h=arguments[u],c=h.uuid;let d=e[c];if(void 0===d){d=a++,e[c]=d,t.push(h);for(let t=0,e=o;t!==e;++t)r[t].push(new Ld(h,n[t],i[t]))}else if(d<l){s=t[d];const a=--l,u=t[a];e[u.uuid]=d,t[d]=u,e[c]=a,t[a]=h;for(let t=0,e=o;t!==e;++t){const e=r[t],o=e[a];let s=e[d];e[d]=o,void 0===s&&(s=new Ld(h,n[t],i[t])),e[a]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=e[a];if(void 0!==l&&l>=r){const o=r++,u=t[o];e[u.uuid]=l,t[l]=u,e[a]=o,t[o]=s;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[l];e[l]=i,e[o]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=t.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const s=--r,a=t[s],u=--o,h=t[u];e[a.uuid]=l,t[l]=a,e[h.uuid]=s,t[s]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[u];e[l]=i,e[s]=r,e.pop()}}else{const r=--o,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,u=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,o.push(t),s.push(e),r.push(h);for(let n=u,i=a.length;n!==i;++n){const i=a[n];h[n]=new Ld(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];e[t[s]]=n,o[n]=a,o.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}}Nd.prototype.isAnimationObjectGroup=!0;class Dd{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:Ye,endingEnd:Ye};for(let t=0;t!==o;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=je,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,o=n/i;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case $e:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulateAdditive(s);break;case Ke:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulate(i,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const o=n===Ve;if(0===t)return-1===r?i:o&&1==(1&r)?e-i:i;if(n===ze){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(o&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Ze,i.endingEnd=Ze):(i.endingStart=t?this.zeroSlopeAtStart?Ze:Ye:Je,i.endingEnd=e?this.zeroSlopeAtEnd?Ze:Ye:Je)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=n,this}}class Fd extends zn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,s=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let u=l[a];void 0===u&&(u={},l[a]=u);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=u[l];if(void 0!==h)o[t]=h;else{if(h=o[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new Sd(Ld.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),o[t]=h}s[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,o=this._actionsByClip,s=o[r],a=s.knownActions,l=a[a.length-1],u=t._byClipCacheIndex;l._byClipCacheIndex=u,a[u]=l,a.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete o[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[e];void 0===o&&(o={},i[e]=o),o[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,s=o[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete s[r],0===Object.keys(s).length&&delete o[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new Zh(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let o="string"==typeof t?oc.findByName(i,t):t;const s=null!==o?o.uuid:t,a=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:Ke),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const u=new Dd(this,o,e,n);return this._bindAction(u,l),this._addInactiveAction(u,s,r),u}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?oc.findByName(n,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let s=0;s!==n;++s){e[s]._update(i,t,r,o)}const s=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)s[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,o=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,o._cacheIndex=r,e[r]=o,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}Fd.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Bd{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new Bd(void 0===this.value.clone?this.value:this.value.clone())}}class Ud extends ul{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}Ud.prototype.isInstancedInterleavedBuffer=!0;class kd{constructor(t,e,n,i,r){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}kd.prototype.isGLBufferAttribute=!0;class Gd{constructor(t,e,n=0,i=1/0){this.ray=new ji(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new er,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!1,n=[]){return zd(t,this,n,e),n.sort(Hd),n}intersectObjects(t,e=!1,n=[]){for(let i=0,r=t.length;i<r;i++)zd(t[i],this,n,e);return n.sort(Hd),n}}function Hd(t,e){return t.distance-e.distance}function zd(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)zd(i[t],e,n,!0)}}class jd{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Yn(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Vd{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}const Wd=new ei;class Xd{constructor(t=new ei(1/0,1/0),e=new ei(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Wd.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Wd.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Xd.prototype.isBox2=!0;const qd=new pi,Yd=new pi;class Zd{constructor(t=new pi,e=new pi){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){qd.subVectors(t,this.start),Yd.subVectors(this.end,this.start);const n=Yd.dot(Yd);let i=Yd.dot(qd)/n;return e&&(i=Yn(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Jd extends mr{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Jd.prototype.isImmediateRenderObject=!0;const Kd=new pi;class $d extends mr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new so,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,n=32;t<n;t++,e++){const r=t/n*Math.PI*2,o=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new Yr(i,3));const r=new ql({fog:!1,toneMapped:!1});this.cone=new nu(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Kd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Kd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Qd=new pi,tp=new Vi,ep=new Vi;class np extends nu{constructor(t){const e=function t(e){const n=[];e&&e.isBone&&n.push(e);for(let i=0;i<e.children.length;i++)n.push.apply(n,t(e.children[i]));return n}(t),n=new so,i=[],r=[],o=new Dr(0,0,1),s=new Dr(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(s.r,s.g,s.b))}n.setAttribute("position",new Yr(i,3)),n.setAttribute("color",new Yr(r,3));super(n,new ql({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");ep.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(tp.multiplyMatrices(ep,r.matrixWorld),Qd.setFromMatrixPosition(tp),i.setXYZ(n,Qd.x,Qd.y,Qd.z),tp.multiplyMatrices(ep,r.parent.matrixWorld),Qd.setFromMatrixPosition(tp),i.setXYZ(n+1,Qd.x,Qd.y,Qd.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}class ip extends Eo{constructor(t,e,n){super(new Ah(e,4,2),new Fr({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const rp=new pi,op=new Dr,sp=new Dr;class ap extends mr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Th(e);i.rotateY(.5*Math.PI),this.material=new Fr({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(3*r.count);i.setAttribute("color",new kr(o,3)),this.add(new Eo(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");op.copy(this.light.color),sp.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?op:sp;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(rp.setFromMatrixPosition(this.light.matrixWorld).negate())}}class lp extends nu{constructor(t=10,e=10,n=4473924,i=8947848){n=new Dr(n),i=new Dr(i);const r=e/2,o=t/e,s=t/2,a=[],l=[];for(let t=0,u=0,h=-s;t<=e;t++,h+=o){a.push(-s,0,h,s,0,h),a.push(h,0,-s,h,0,s);const e=t===r?n:i;e.toArray(l,u),u+=3,e.toArray(l,u),u+=3,e.toArray(l,u),u+=3,e.toArray(l,u),u+=3}const u=new so;u.setAttribute("position",new Yr(a,3)),u.setAttribute("color",new Yr(l,3));super(u,new ql({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class up extends nu{constructor(t=10,e=16,n=8,i=64,r=4473924,o=8947848){r=new Dr(r),o=new Dr(o);const s=[],a=[];for(let n=0;n<=e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,u=Math.cos(i)*t;s.push(0,0,0),s.push(l,0,u);const h=1&n?r:o;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let e=0;e<=n;e++){const l=1&e?r:o,u=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*u,r=Math.cos(e)*u;s.push(n,0,r),a.push(l.r,l.g,l.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*u,r=Math.cos(e)*u,s.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new so;l.setAttribute("position",new Yr(s,3)),l.setAttribute("color",new Yr(a,3));super(l,new ql({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const hp=new pi,cp=new pi,dp=new pi;class pp extends mr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new so;i.setAttribute("position",new Yr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ql({fog:!1,toneMapped:!1});this.lightPlane=new Ql(i,r),this.add(this.lightPlane),i=new so,i.setAttribute("position",new Yr([0,0,0,0,0,1],3)),this.targetLine=new Ql(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){hp.setFromMatrixPosition(this.light.matrixWorld),cp.setFromMatrixPosition(this.light.target.matrixWorld),dp.subVectors(cp,hp),this.lightPlane.lookAt(cp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(cp),this.targetLine.scale.z=dp.length()}}const fp=new pi,mp=new Oo;class gp extends nu{constructor(t){const e=new so,n=new ql({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={},s=new Dr(16755200),a=new Dr(16711680),l=new Dr(43775),u=new Dr(16777215),h=new Dr(3355443);function c(t,e,n){d(t,n),d(e,n)}function d(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(i.length/3-1)}c("n1","n2",s),c("n2","n4",s),c("n4","n3",s),c("n3","n1",s),c("f1","f2",s),c("f2","f4",s),c("f4","f3",s),c("f3","f1",s),c("n1","f1",s),c("n2","f2",s),c("n3","f3",s),c("n4","f4",s),c("p","n1",a),c("p","n2",a),c("p","n3",a),c("p","n4",a),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),c("c","t",u),c("p","c",h),c("cn1","cn2",h),c("cn3","cn4",h),c("cf1","cf2",h),c("cf3","cf4",h),e.setAttribute("position",new Yr(i,3)),e.setAttribute("color",new Yr(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const t=this.geometry,e=this.pointMap;mp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),vp("c",e,t,mp,0,0,-1),vp("t",e,t,mp,0,0,1),vp("n1",e,t,mp,-1,-1,-1),vp("n2",e,t,mp,1,-1,-1),vp("n3",e,t,mp,-1,1,-1),vp("n4",e,t,mp,1,1,-1),vp("f1",e,t,mp,-1,-1,1),vp("f2",e,t,mp,1,-1,1),vp("f3",e,t,mp,-1,1,1),vp("f4",e,t,mp,1,1,1),vp("u1",e,t,mp,.7,1.1,-1),vp("u2",e,t,mp,-.7,1.1,-1),vp("u3",e,t,mp,0,2,-1),vp("cf1",e,t,mp,-1,0,1),vp("cf2",e,t,mp,1,0,1),vp("cf3",e,t,mp,0,-1,1),vp("cf4",e,t,mp,0,1,1),vp("cn1",e,t,mp,-1,0,-1),vp("cn2",e,t,mp,1,0,-1),vp("cn3",e,t,mp,0,-1,-1),vp("cn4",e,t,mp,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function vp(t,e,n,i,r,o,s){fp.set(r,o,s).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],fp.x,fp.y,fp.z)}}const _p=new gi;class yp extends nu{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new so;r.setIndex(new kr(n,1)),r.setAttribute("position",new kr(i,3)),super(r,new ql({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&_p.setFromObject(this.object),_p.isEmpty())return;const e=_p.min,n=_p.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return nu.prototype.copy.call(this,t),this.object=t.object,this}}class xp extends nu{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new so;i.setIndex(new kr(n,1)),i.setAttribute("position",new Yr([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ql({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}class bp extends Ql{constructor(t,e=1,n=16776960){const i=n,r=new so;r.setAttribute("position",new Yr([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),super(r,new ql({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=new so;o.setAttribute("position",new Yr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new Eo(o,new Fr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?b:x,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}const wp=new pi;let Tp,Sp;class Ep extends mr{constructor(t=new pi(0,0,1),e=new pi(0,0,0),n=1,i=16776960,r=.2*n,o=.2*r){super(),this.type="ArrowHelper",void 0===Tp&&(Tp=new so,Tp.setAttribute("position",new Yr([0,0,0,0,1,0],3)),Sp=new gu(0,.5,1,5,1),Sp.translate(0,-.5,0)),this.position.copy(e),this.line=new Ql(Tp,new ql({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Eo(Sp,new Fr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{wp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(wp,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class Mp extends nu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new so;n.setAttribute("position",new Yr(e,3)),n.setAttribute("color",new Yr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new ql({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new Dr,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const Ap=new Float32Array(1),Rp=new Int32Array(Ap.buffer);class Cp{static toHalfFloat(t){Ap[0]=t;const e=Rp[0];let n=e>>16&32768,i=e>>12&2047;const r=e>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&e,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=1&i,n)}}const Pp=Math.pow(2,8),Ip=[.125,.215,.35,.446,.526,.582],Op=5+Ip.length,Lp={[nn]:0,[rn]:1,[sn]:2,[ln]:3,[un]:4,[hn]:5,[on]:6},Np=new Fr({side:b,depthWrite:!1,depthTest:!1}),Dp=new Eo(new Ao,Np),Fp=new Dc,{_lodPlanes:Bp,_sizeLods:Up,_sigmas:kp}=Yp(),Gp=new Dr;let Hp=null;const zp=(1+Math.sqrt(5))/2,jp=1/zp,Vp=[new pi(1,1,1),new pi(-1,1,1),new pi(1,1,-1),new pi(-1,1,-1),new pi(0,zp,jp),new pi(0,zp,-jp),new pi(jp,0,zp),new pi(-jp,0,zp),new pi(zp,jp,0),new pi(-zp,jp,0)];function Wp(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);t.multiplyScalar(Math.pow(2,-n));return(n+128)/255}class Xp{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),n=new pi(0,1,0);return new Fh({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Lp[nn]},outputEncoding:{value:Lp[nn]}},vertexShader:Qp(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${tf()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:E,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Hp=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=$p(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Kp(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Bp.length;t++)Bp[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Hp),t.scissorTest=!1,Jp(t,0,0,t.width,t.height)}_fromTexture(t){Hp=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:xt,minFilter:xt,generateMipmaps:!1,type:Pt,format:qt,encoding:qp(t)?t.encoding:sn,depthBuffer:!1},n=Zp(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Zp(e),n}_compileMaterial(t){const e=new Eo(Bp[0],t);this._renderer.compile(e,Fp)}_sceneToCubeUV(t,e,n,i){const r=new Lo(90,1,e,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,u=a.outputEncoding,h=a.toneMapping;a.getClearColor(Gp),a.toneMapping=rt,a.outputEncoding=nn,a.autoClear=!1;let c=!1;const d=t.background;if(d){if(d.isColor){Np.color.copy(d).convertSRGBToLinear(),t.background=null;const e=Wp(Np.color);Np.opacity=e,c=!0}}else{Np.color.copy(Gp).convertSRGBToLinear();const t=Wp(Np.color);Np.opacity=t,c=!0}for(let e=0;e<6;e++){const n=e%3;0==n?(r.up.set(0,o[e],0),r.lookAt(s[e],0,0)):1==n?(r.up.set(0,0,o[e]),r.lookAt(0,s[e],0)):(r.up.set(0,o[e],0),r.lookAt(0,0,s[e])),Jp(i,n*Pp,e>2?Pp:0,Pp,Pp),a.setRenderTarget(i),c&&a.render(Dp,r),a.render(t,r)}a.toneMapping=h,a.outputEncoding=u,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=$p()):null==this._equirectShader&&(this._equirectShader=Kp());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Eo(Bp[0],i),o=i.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=Lp[t.encoding],o.outputEncoding.value=Lp[e.texture.encoding],Jp(e,0,0,3*Pp,2*Pp),n.setRenderTarget(e),n.render(r,Fp)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<Op;e++){const n=Math.sqrt(kp[e]*kp[e]-kp[e-1]*kp[e-1]),i=Vp[(e-1)%Vp.length];this._blur(t,e-1,e,n,i)}e.autoClear=n}_blur(t,e,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,i,"latitudinal",r),this._halfBlur(o,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,o,s){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const u=new Eo(Bp[i],l),h=l.uniforms,c=Up[n]-1,d=isFinite(r)?Math.PI/(2*c):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===o,s&&(h.poleAxis.value=s),h.dTheta.value=d,h.mipInt.value=8-n,h.inputEncoding.value=Lp[t.texture.encoding],h.outputEncoding.value=Lp[t.texture.encoding];const v=Up[i];Jp(e,3*Math.max(0,Pp-2*v),(0===i?0:2*Pp)+2*v*(i>4?i-8+4:0),3*v,2*v),a.setRenderTarget(e),a.render(u,Fp)}}function qp(t){return void 0!==t&&t.type===Pt&&(t.encoding===nn||t.encoding===rn||t.encoding===on)}function Yp(){const t=[],e=[],n=[];let i=8;for(let r=0;r<Op;r++){const o=Math.pow(2,i);e.push(o);let s=1/o;r>4?s=Ip[r-8+4-1]:0==r&&(s=0),n.push(s);const a=1/(o-1),l=-a/2,u=1+a/2,h=[l,l,u,l,u,u,l,l,u,u,l,u],c=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*c),v=new Float32Array(f*d*c),_=new Float32Array(m*d*c);for(let t=0;t<c;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(i,p*d*t),v.set(h,f*d*t);const r=[t,t,t,t,t,t];_.set(r,m*d*t)}const y=new so;y.setAttribute("position",new kr(g,p)),y.setAttribute("uv",new kr(v,f)),y.setAttribute("faceIndex",new kr(_,m)),t.push(y),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Zp(t){const e=new ui(3*Pp,3*Pp,t);return e.texture.mapping=mt,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Jp(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Kp(){const t=new ei(1,1);return new Fh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Lp[nn]},outputEncoding:{value:Lp[nn]}},vertexShader:Qp(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${tf()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:E,depthTest:!1,depthWrite:!1})}function $p(){return new Fh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Lp[nn]},outputEncoding:{value:Lp[nn]}},vertexShader:Qp(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${tf()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:E,depthTest:!1,depthWrite:!1})}function Qp(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function tf(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}const ef=0,nf=1,rf=0,of=1,sf=2;function af(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function lf(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function uf(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new uu(t,e)}function hf(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ml(t)}function cf(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new uu(t,e)}function df(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ru(t)}function pf(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ru(t)}function ff(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ru(t)}function mf(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new pi(t,e,n)}function gf(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new kr(t,e).setUsage(On)}function vf(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Gr(t,e)}function _f(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Hr(t,e)}function yf(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new zr(t,e)}function xf(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new jr(t,e)}function bf(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Vr(t,e)}function wf(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Wr(t,e)}function Tf(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Xr(t,e)}function Sf(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Yr(t,e)}function Ef(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Zr(t,e)}function Mf(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Mp(t)}function Af(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new yp(t,e)}function Rf(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new nu(new Su(t.geometry),new ql({color:void 0!==e?e:16777215}))}function Cf(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new nu(new Lh(t.geometry),new ql({color:void 0!==e?e:16777215}))}function Pf(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new dc(t)}function If(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new vc(t)}function Of(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Fo(t,n)}function Lf(){console.error("THREE.CanvasRenderer has been removed")}function Nf(){console.error("THREE.JSONLoader has been removed.")}Eu.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Eu.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},xc.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},lp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},np.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hc.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),jc.extractUrlBase(t)},hc.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Xd.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Xd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Xd.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Xd.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},gi.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},gi.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},gi.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},gi.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},gi.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Di.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},jo.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Zd.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},ni.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},ni.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ni.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ni.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ni.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ni.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Vi.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Vi.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Vi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new pi).setFromMatrixColumn(this,3)},Vi.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Vi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Vi.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Vi.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Vi.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Vi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Vi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Vi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Vi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Vi.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Vi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Vi.prototype.makeFrustum=function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)},Vi.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Go.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},di.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},di.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ji.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ji.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},ji.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Mr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Mr.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Mr.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Mr.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Mr.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Mr.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Mr.getBarycoord(t,e,n,i,r)},Mr.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Mr.getNormal(t,e,n,i)},bc.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},bc.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new yh(this,t)},bc.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Mh(this,t)},ei.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},ei.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},ei.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},pi.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},pi.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},pi.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},pi.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},pi.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},pi.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},pi.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},pi.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},pi.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},li.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},li.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},mr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},mr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},mr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},mr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},mr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(mr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Eo.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Eo.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Qe},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Fl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Lo.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(wc.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(kr.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===On},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(On)}}}),kr.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?On:In),this},kr.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},kr.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},so.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},so.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new kr(arguments[1],arguments[2])))},so.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},so.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},so.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},so.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},so.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(so.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),ul.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?On:In),this},ul.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},yh.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},yh.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},yh.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ll.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Bd.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Rr.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Dr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===T}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Io.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),rl.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},rl.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},rl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},rl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},rl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},rl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},rl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},rl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},rl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},rl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},rl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},rl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},rl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},rl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},rl.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},rl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},rl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},rl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},rl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},rl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},rl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},rl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},rl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},rl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},rl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(rl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?rn:nn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ya.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(ui.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),vd.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new rd).load(t,(function(t){e.setBuffer(t)})),this},Td.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},No.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},No.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},ri.crossOrigin=void 0,ri.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new _c;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},ri.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new gc;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},ri.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ri.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Df={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Ff(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:u}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=u);class Bf{constructor(){this.camera=new Dc(10,10,10,10),this.camera.position.z=100,this.camera.position.x=0,this.camera.position.y=0}focus(t,e){t.position.z=50}updateAspect(t,e){this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix()}}class Uf{constructor(){this.camera=new Bf,this.mesh=new Eo,this.material=null,this.geometry=null}addObjects(t){this.mesh.position.z=50,t.add(this.mesh)}setTexture(t,e,n,i){this.camera.updateAspect(n,i),this.geometry=new Xo(n,i,1,1),this.material=new Io({fragmentShader:this.fragmentShader,vertexShader:"\nvarying vec2 vUv;\nvoid main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"}),this.material.uniforms={width:{value:n},height:{value:i},texturePrev:{value:t},textureNext:{value:e},timePercent:{value:0}},this.mesh.geometry=this.geometry,this.mesh.material=this.material}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var kf=n(11),Gf=n.n(kf),Hf=n(12),zf=n.n(Hf);var jf=n(13),Vf=n.n(jf);var Wf=n(14),Xf=n.n(Wf);var qf=n(15),Yf=n.n(qf);var Zf=n(16),Jf=n.n(Zf);var Kf=n(17),$f=n.n(Kf);var Qf=n(18),tm=n.n(Qf);var em=n(19),nm=n.n(em);var im=n(20),rm=n.n(im);var om=n(21),sm=n.n(om);var am=n(22),lm=n.n(am);var um=n(23),hm=n.n(um);var cm=n(24),dm=n.n(cm);class pm{constructor(){this.camera=new Lo(60,1,1,2e3),this.camera.position.z=1e3,this.camera.position.x=0,this.camera.position.y=0}updateAspect(t,e){this.camera.aspect=t/e,this.camera.updateProjectionMatrix()}focus(t,e){const n=.5*e/Math.tan(Math.PI/6);t.position.z=1e3-n}}class fm{constructor(){this.geometry=new so,this.material=null,this.camera=new pm,this.mesh=new Eo,this.textureWidth=0,this.textureHeight=0,this.prevTexture=new si,this.nextTexture=new si}horizontalSegments(){return Math.ceil(this.verticalSegments*this.textureWidth/this.textureHeight)}initMesh(t,e){const n=[],i=[],r=[],o=this.verticalSegments,s=this.horizontalSegments(),a=t/2,l=e/2,u=t/s,h=e/o,c=this.extraAttributes(),d=Object.keys(c),p=d.reduce((t,e)=>(t[e]=[],t),{});for(let t=0;t<o;t++){const e=t*h-l;for(let n=0;n<s;n++){const l=n*u-a;i.push(l,-e,0),r.push(1*n/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,n))),i.push(l+u,-e,0),r.push(1*(n+1)/s,1-1*t/o),d.forEach(e=>p[e].push(...c[e].generator(t,n))),i.push(l,-e-h,0),r.push(1*n/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,n))),i.push(l+u,-e-h,0),r.push(1*(n+1)/s,1-1*(t+1)/o),d.forEach(e=>p[e].push(...c[e].generator(t,n)))}}for(let t=0;t<o*s;t++){const e=4*t,i=e+1,r=e+2,o=e+3;n.push(i,e,o),n.push(e,r,o)}return this.geometry.setIndex(n),this.geometry.setAttribute("position",new Yr(i,3)),this.geometry.setAttribute("uv",new Yr(new Float32Array(r),2)),d.forEach(t=>{this.geometry.setAttribute(t,new Yr(new Float32Array(p[t]),c[t].itemSize))}),{verticalSegments:o,horizontalSegments:s,segmentWidth:u,segmentHeight:h}}initObject(){this.material=new Io({fragmentShader:this.fragmentShader,vertexShader:this.vertexShader,side:w})}setTexture(t,e,n,i){this.textureHeight=i,this.textureWidth=n,this.prevTexture=t,this.nextTexture=e,this.initObject();const{verticalSegments:r,horizontalSegments:o,segmentWidth:s,segmentHeight:a}=this.initMesh(n,i);this.material.uniforms={segmentWidth:{value:s},segmentHeight:{value:a},verticalSegments:{value:r},horizontalSegments:{value:o},timePercent:{value:0},texturePrev:{value:t},textureNext:{value:e}},this.mesh.geometry=this.geometry,this.camera.updateAspect(n,i),this.camera.focus(this.mesh,i),this.material.transparent=!0,this.mesh.material=this.material}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}var mm=n(25),gm=n.n(mm),vm=n(26),_m=n.n(vm);var ym=n(27),xm=n.n(ym),bm=n(28),wm=n.n(bm);var Tm=n(29),Sm=n.n(Tm),Em=n(30),Mm=n.n(Em);var Am=n(31),Rm=n.n(Am),Cm=n(32),Pm=n.n(Cm);var Im=n(33),Om=n.n(Im),Lm=n(34),Nm=n.n(Lm);var Dm=n(35),Fm=n.n(Dm),Bm=n(36),Um=n.n(Bm);class km extends fm{constructor(){super(...arguments),this.duration=1250,this.fragmentShader=Um.a,this.vertexShader=Fm.a,this.verticalSegments=100}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}extraAttributes(){return{}}}var Gm=n(37),Hm=n.n(Gm),zm=n(38),jm=n.n(zm);var Vm=n(39),Wm=n.n(Vm);var Xm=n(40),qm=n.n(Xm);var Ym=n(41),Zm=n.n(Ym);var Jm=n(42),Km=n.n(Jm),$m=n(43),Qm=n.n($m);const tg=new pi(0,-0,0).multiplyScalar(.1);class eg{constructor(t,e,n,i,r){this.position=new pi,this.previous=new pi,this.original=new pi,this.a=new pi(0,0,0),this.mass=i,this.invMass=1/i,this.tmp=new pi,this.tmp2=new pi,r(t,e,this.position),r(t,e,this.previous),r(t,e,this.original)}addForce(t){this.a.add(this.tmp2.copy(t).multiplyScalar(this.invMass))}integrate(t,e,n){const i=.25*Math.PI,r=.25*-Math.PI,o=new ni,s=new ni;o.set(Math.cos(i),-Math.sin(i),0,Math.sin(i),Math.cos(i),0,0,0,1),s.set(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1);const a=this.tmp.subVectors(this.position,this.previous);a.multiplyScalar(.97).add(this.position),a.add(this.a.multiplyScalar(t)),this.tmp=this.previous,this.previous=this.position,this.position=a,this.a.set(0,0,0)}}class ng{constructor(t,e,n){this.width=t,this.height=e;const i=[],r=[];for(let r=0;r<=e;r++)for(let o=0;o<=t;o++)i.push(new eg(o/t,r/e,0,.1,n));for(let n=0;n<e;n++)for(let e=0;e<t;e++)r.push([i[o(e,n)],i[o(e,n+1)],25]),r.push([i[o(e,n)],i[o(e+1,n)],25]);for(let n=t,s=0;s<e;s++)r.push([i[o(n,s)],i[o(n,s+1)],25]);for(let n=e,s=0;s<t;s++)r.push([i[o(s,n)],i[o(s+1,n)],25]);function o(e,n){return e+n*(t+1)}this.particles=i,this.constraints=r,this.index=o}}const ig={RandomLines:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=zf.a}genRandomLines(){let t=[1];for(let e=20;e--;){let e=t.sort((t,e)=>e-t)[0],n=t.indexOf(e),i=Math.random(),r=e*i,o=e*(1-i);t.splice(n,1),t.push(r,o)}let e=t.length;for(;e;){let n=Math.floor(Math.random()*e--);[t[n],t[e]]=[t[e],t[n]]}return t}setTexture(t,e,n,i){super.setTexture(t,e,n,i),this.material.uniforms.lines={value:this.genRandomLines()},this.material.vertexShader=Gf.a}},Shape:class extends Uf{constructor(){super(...arguments),this.duration=800,this.fragmentShader=Vf.a}},Ripples:class extends Uf{constructor(){super(...arguments),this.duration=1400,this.fragmentShader=Xf.a}},Erase:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Yf.a}},Dissolve:class extends Uf{constructor(){super(...arguments),this.duration=1200,this.fragmentShader=Jf.a,this.dissolveIndices={}}random40(){return Math.ceil(40*Math.random())}setTexture(t,e,n,i){super.setTexture(t,e,n,i);for(let t=0;t<1600;t++){let t=this.random40(),e=this.random40();for(;void 0!==this.dissolveIndices[`${t}_${e}`];)t=this.random40(),e=this.random40();this.dissolveIndices[`${t}_${e}`]=0}this.material.uniforms.dissolveTexture={value:this.genDissolveToTexture()}}genDissolveToTexture(){var t=new Uint8Array(4800);for(let e=0;e<1600;e++){const n=e%40+1,i=Math.floor(e/40)+1,r=3*e;0===this.dissolveIndices[`${n}_${i}`]?(t[r]=0,t[r+1]=0,t[r+2]=0):(t[r]=255,t[r+1]=255,t[r+2]=255)}return new Ul(t,40,40,jt)}updateAnimation(t){const e=1600*t-Object.keys(this.dissolveIndices).filter(t=>1===this.dissolveIndices[t]).length;for(let t=0;t<e;t++){const t=Object.keys(this.dissolveIndices).filter(t=>0===this.dissolveIndices[t]),e=Math.ceil(Math.random()*t.length)-1;this.dissolveIndices[t[e]]=1}this.material.uniforms.dissolveTexture.value=this.genDissolveToTexture()}},Smooth:class extends Uf{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=$f.a}},FadeInOut:class extends Uf{constructor(){super(...arguments),this.duration=700,this.fragmentShader=tm.a}},Push:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=nm.a}},Separation:class extends Uf{constructor(){super(...arguments),this.duration=1500,this.fragmentShader=rm.a}},Display:class extends Uf{constructor(){super(...arguments),this.duration=3400,this.fragmentShader=sm.a}},Uncover:class extends Uf{constructor(){super(...arguments),this.duration=750,this.fragmentShader=lm.a}},Cover:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=hm.a}},Flash:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=dm.a}},Checkerboard:class extends fm{constructor(){super(...arguments),this.duration=2500,this.fragmentShader=_m.a,this.vertexShader=gm.a,this.vIndex="",this.delay=0,this.verticalSegments=5}extraAttributes(){return{times:{itemSize:1,generator:(t,e)=>(this.vIndex!==`${t}${e}`&&(this.delay=.3*Math.random(),this.vIndex=`${t}${e}`),[this.delay])},segment:{itemSize:2,generator:(t,e)=>[e,t]}}}},Vortex:class{constructor(){this.duration=4e3,this.geometry=new so,this.material=new Io({fragmentShader:wm.a,vertexShader:xm.a,side:w}),this.camera=new pm,this.mesh=new Eo}initData(t,e){const n=[],i=[],r=[],o=[],s=[],a=[],l=Math.ceil(124*t/e),u=t/2,h=e/2,c=t/l,d=e/124;for(let t=0;t<124;t++){const e=t*d-h;for(let n=0;n<l;n++){const h=n*c-u,p=Math.ceil((n+1)/((l+1)/12)),f=.4/p,m=(p-1)*f+Math.random()*f;i.push(h,-e,0),o.push(1*n/l,1-1*t/124),r.push(0,0,1),s.push(n,t),a.push(m),i.push(h+c,-e,0),o.push(1*(n+1)/l,1-1*t/124),r.push(0,0,1),s.push(n,t),a.push(m),i.push(h,-e-d,0),o.push(1*n/l,1-1*(t+1)/124),r.push(0,0,1),s.push(n,t),a.push(m),i.push(h+c,-e-d,0),o.push(1*(n+1)/l,1-1*(t+1)/124),r.push(0,0,1),s.push(n,t),a.push(m)}}for(let t=0;t<124*l;t++){const e=4*t,i=e+1,r=e+2,o=e+3;n.push(i,e,o),n.push(e,r,o)}return this.geometry.setIndex(n),this.geometry.setAttribute("position",new Yr(i,3)),this.geometry.setAttribute("normal",new Yr(r,3)),this.geometry.setAttribute("uv",new Yr(new Float32Array(o),2)),this.geometry.setAttribute("segment",new Yr(new Float32Array(s),2)),this.geometry.setAttribute("times",new Yr(new Float32Array(a),1)),{verticalSegments:124,horizontalSegments:l,segmentWidth:c,segmentHeight:d}}setTexture(t,e){const{width:n,height:r}=t.image,{verticalSegments:o,horizontalSegments:s,segmentWidth:a,segmentHeight:l}=this.initData(n,r);this.material.uniforms={duration:{value:this.duration},segmentWidth:{value:a},segmentHeight:{value:l},verticalSegments:{value:o},horizontalSegments:{value:s},timePercent:{value:0},texturePrev:{value:t},textureNext:{value:e}},this.camera.updateAspect(n,r),this.camera.focus(this.mesh,r),this.mesh.geometry=this.geometry;new kh({side:w,vertexColors:!0}).wireframe=!0,this.material.transparent=!0,this.mesh.material=this.material,console.log(i)}addObjects(t){t.add(this.mesh)}updateAnimation(t){let e=(t-.4)/.2;e<0?e=0:e>1&&(e=1),this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},WindowShades:class{constructor(){this.duration=1600,this.geometry=new so,this.material=new Io({fragmentShader:Mm.a,vertexShader:Sm.a,side:w}),this.horizontalSegments=16,this.meshToCameraDistance=0,this.camera=new pm,this.mesh=new Eo}initData(t,e){const n=[],i=[],r=[],o=[],s=[],a=[],l=t/2,u=e/2,h=t/this.horizontalSegments;for(let t=0;t<this.horizontalSegments;t++){const e=Math.abs(t-Math.ceil(this.horizontalSegments/2))*(.3/Math.ceil(this.horizontalSegments/2)),n=t*h-l;i.push(n,u,0),r.push(0),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n+h,u,0),r.push(0),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n,-1*u,0),r.push(0),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),i.push(n+h,-1*u,0),o.push((t+1)/this.horizontalSegments,0),r.push(0),s.push(t),a.push(e),i.push(n+h,u,0),r.push(1),o.push(t/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n+h,u,-1*h),r.push(1),o.push((t+1)/this.horizontalSegments,1),s.push(t),a.push(e),i.push(n+h,-1*u,0),r.push(1),o.push(t/this.horizontalSegments,0),s.push(t),a.push(e),i.push(n+h,-1*u,-1*h),o.push((t+1)/this.horizontalSegments,0),r.push(1),s.push(t),a.push(e)}for(let t=0;t<this.horizontalSegments;t++){const e=8*t,i=e+1,r=e+2,o=e+3,s=e+4,a=e+5,l=e+6,u=e+7;n.push(i,e,o),n.push(e,r,o),n.push(a,s,u),n.push(s,l,u)}this.geometry.setIndex(n),this.geometry.setAttribute("position",new Yr(i,3)),this.geometry.setAttribute("uv",new Yr(new Float32Array(o),2)),this.geometry.setAttribute("index",new Yr(new Float32Array(s),1)),this.geometry.setAttribute("type",new Yr(new Float32Array(r),1)),this.geometry.setAttribute("delay",new Yr(new Float32Array(a),1))}setTexture(t,e,n,i){this.initData(n,i),this.material.uniforms={segments:{value:this.horizontalSegments},segmentWidth:{value:n/this.horizontalSegments},timePercent:{value:0},texturePrev:{value:t},textureNext:{value:e}},this.meshToCameraDistance=.5*i/Math.tan(Math.PI/6),this.camera.updateAspect(n,i),this.camera.focus(this.mesh,i),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material}addObjects(t){t.add(this.mesh)}updateAnimation(t){this.material.uniforms.timePercent.value=t}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}},Curtain:class extends fm{constructor(){super(...arguments),this.duration=6e3,this.fragmentShader=Pm.a,this.vertexShader=Rm.a,this.verticalSegments=100}extraAttributes(){return{isLeft:{itemSize:1,generator:(t,e)=>[e<this.horizontalSegments()/2?1:0]}}}addObjects(t){super.addObjects(t),this.mesh.position.z+=20,t.background=this.nextTexture}},Fall:class extends fm{constructor(){super(...arguments),this.zCurveLimit=100,this.duration=2e3,this.verticalSegments=100,this.fragmentShader=Nm.a,this.vertexShader=Om.a}extraAttributes(){return{}}setTexture(t,e,n,i){super.setTexture(t,e,n,i),this.material.uniforms.zCurveLimit={value:this.zCurveLimit},this.material.uniforms.aCoefficient={value:this.zCurveLimit/(this.textureHeight/2*(this.textureHeight/2))}}addObjects(t){t.add(this.mesh),t.background=this.nextTexture}updateAnimation(t){this.material.uniforms.timePercent.value=t}},Suspension:class extends km{constructor(){super(...arguments),this.duration=2e3,this.fragmentShader=jm.a,this.vertexShader=Hm.a}addObjects(t){t.add(this.mesh),t.background=this.prevTexture}},Clock:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=Wm.a}},Combing:class extends Uf{constructor(){super(...arguments),this.duration=1e3,this.fragmentShader=qm.a}},Scale:class extends Uf{constructor(){super(...arguments),this.duration=900,this.fragmentShader=Zm.a}},PeelOff:km,Flip:class extends fm{constructor(){super(...arguments),this.duration=1250,this.fragmentShader=Qm.a,this.vertexShader=Km.a,this.verticalSegments=1}extraAttributes(){return{}}},Wind:class{constructor(){this.duration=2e3,this.camera=new pm,this.mesh=new Eo,this.geometry=null,this.material=new zh({side:w,alphaTest:.5}),this.tmpForce=new pi,this.windForce=new pi(0,0,0),this.cloth=null,this.nextTexture=null,this.diff=new pi,this.xSegs=10,this.ySegs=10,this.width=10,this.height=10,this.enablePins=!0,this.animate=t=>{this.simulate(t),this.render(),requestAnimationFrame(this.animate)}}setTexture(t,e,n,i){const r=n,o=i;this.xSegs=Math.ceil(r/25),this.ySegs=Math.ceil(o/25),this.width=25*this.xSegs,this.height=25*this.ySegs;const s=function(t,e){return function(n,i,r){const o=(n-.5)*t,s=(i+.5)*e;r.set(o,s,0)}}(25*this.xSegs,25*this.ySegs);this.cloth=new ng(this.xSegs,this.ySegs,s),this.nextTexture=e,this.camera.updateAspect(r,o),this.material.map=t,this.geometry=new Sh(s,this.cloth.width,this.cloth.height),this.mesh.geometry=this.geometry,this.material.transparent=!0,this.mesh.material=this.material,this.mesh.castShadow=!0,this.mesh.position.y-=o,this.mesh.customDepthMaterial=new Xa({depthPacking:dn,map:t,alphaTest:.5}),this.camera.focus(this.mesh,o)}addObjects(t){t.add(this.mesh),t.background=this.nextTexture,t.add(new Uc(6710886));const e=new Bc(14674943,1);e.position.set(0,0,100),e.position.multiplyScalar(1.3),e.castShadow=!0,e.shadow.mapSize.width=1024,e.shadow.mapSize.height=1024;const n=300;e.shadow.camera.left=-n,e.shadow.camera.right=n,e.shadow.camera.top=n,e.shadow.camera.bottom=-n,e.shadow.camera.far=1e3,t.add(e),this.animate(0)}satisfyConstraints(t,e,n){this.diff.subVectors(e.position,t.position);const i=this.diff.length();if(0===i)return;const r=this.diff.multiplyScalar(1-n/i).multiplyScalar(.5);t.position.add(r),e.position.sub(r)}simulate(t){const e=20*Math.abs(Math.cos(t/70));this.windForce.set(Math.abs(Math.sin(t/300)),Math.abs(Math.cos(t/200)),Math.sin(t/1e3)),this.windForce.normalize(),this.windForce.x*=50*e,this.windForce.y*=50*e,this.windForce.z*=.2*e;const n=this.cloth.particles;let i;const r=new pi,o=this.geometry.index,s=this.geometry.attributes.normal;for(let t=0,e=o.count;t<e;t+=3)for(let e=0;e<3;e++)i=o.getX(t+e),r.fromBufferAttribute(s,i),this.tmpForce.copy(r).normalize().multiplyScalar(r.dot(this.windForce)),n[i].addForce(this.tmpForce);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.addForce(tg),e.integrate(144e-6,this.width,this.height)}const a=this.cloth.constraints,l=a.length;for(let t=0;t<l;t++){const e=a[t];this.satisfyConstraints(e[0],e[1],e[2])}for(let t=0,e=n.length;t<e;t++){const e=n[t].position;e.y<-250&&(e.y=-250)}if(this.enablePins){let t=new Array(this.xSegs+1).fill("").map((t,e)=>e);for(let e=0;e<this.ySegs+1;e++)t.push(e*(this.xSegs+1));for(let e=0,i=t.length;e<i;e++){const i=n[t[e]];i.position.copy(i.original),i.previous.copy(i.original)}}}render(){const t=this.cloth.particles;for(let e=0,n=t.length;e<n;e++){const n=t[e].position;this.geometry.attributes.position.setXYZ(e,n.x,n.y,n.z)}this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeVertexNormals()}updateAnimation(t){t>.5&&(this.enablePins=!1),t>.9999&&(this.mesh.visible=!1)}dispose(){var t,e;null===(t=this.geometry)||void 0===t||t.dispose(),null===(e=this.material)||void 0===e||e.dispose()}}},rg={linear:(t,e,n,i)=>n*t/i+e,easeIn:(t,e,n,i)=>n*(t/=i)*t+e,strongEaseIn:(t,e,n,i)=>n*(t/=i)*t*t*t*t+e,strongEaseOut:(t,e,n,i)=>n*((t=t/i-1)*t*t*t*t+1)+e,sineaseIn:(t,e,n,i)=>n*(t/=i)*t*t+e,sineaseOut:(t,e,n,i)=>n*((t=t/i-1)*t*t+1)+e};class og{constructor(){this.startTime=0,this.lastTime=0,this.lastFPSTime=0,this.renderingDuration=16,this.reverse=!1,this.scene=new ll,this.delay=0,this.easeFn=rg.linear,this.preset=null,this.onTransactionEnd=()=>{},this.onTransactionStart=()=>{},this.isTransactionStartApplied=!1,this.textureLoader=new _c,this.prevTexture=null,this.nextTexture=null,this.renderer=new rl({alpha:!0,premultipliedAlpha:!0}),this.isPlaying=!1,this.animate=(t=-1)=>{var e,n,i;if(!this.fps(t))return void window.requestAnimationFrame(this.animate);this.renderer.clear(),t>this.delay&&0===this.lastTime&&(this.lastTime=t,this.startTime=t);let r=0;this.lastTime>0&&r<1&&(r=this.easeFn(t-this.startTime,0,1,null!==(n=null===(e=this.preset)||void 0===e?void 0:e.duration)&&void 0!==n?n:0)),r>1&&(r=1),null===(i=this.preset)||void 0===i||i.updateAnimation(this.reverse?1-r:r),this.rerender(),this.isTransactionStartApplied||(this.isTransactionStartApplied=!0,this.onTransactionStart()),r<1?window.requestAnimationFrame(this.animate):(this.dispose(),this.onTransactionEnd())}}play(t){var e,n,i;t.onTransactionEnd&&(this.onTransactionEnd=t.onTransactionEnd),t.onTransactionStart&&(this.onTransactionStart=t.onTransactionStart),this.init(t),this.isTransactionStartApplied=!1,this.renderer.setSize(t.stageWidth,t.stageHeight),this.preset=new ig[t.presetType],t.duration&&Number.isInteger(t.duration)&&(this.preset.duration=t.duration),this.prevTexture=this.textureLoader.load(t.prevTextureUrl),this.nextTexture=this.textureLoader.load(t.nextTextureUrl),this.reverse?null===(e=this.preset)||void 0===e||e.setTexture(this.nextTexture,this.prevTexture,t.textureWidth,t.textureHeight):null===(n=this.preset)||void 0===n||n.setTexture(this.prevTexture,this.nextTexture,t.textureWidth,t.textureHeight),null===(i=this.preset)||void 0===i||i.addObjects(this.scene),this.animate(),this.isPlaying=!0}init(t){this.reverse=t.reverse,t.delay&&Number.isInteger(t.delay)&&(this.delay=t.delay),t.easeFn&&(this.easeFn=rg[t.easeFn]),t.maxFPS&&Number.isInteger(t.maxFPS)&&t.maxFPS>0&&(this.renderingDuration=Math.ceil(1e3/t.maxFPS)),this.startTime=0,this.lastTime=0,this.scene.clear(),this.renderer.shadowMap.enabled=!0,this.renderer.autoClear=!1,this.renderer.setClearColor(t.clearColor||0)}rerender(){var t;this.renderer.clear(),(null===(t=this.preset)||void 0===t?void 0:t.camera.camera)&&this.renderer.render(this.scene,this.preset.camera.camera)}fps(t){if(t<=0)return!0;if(this.lastFPSTime<0)return this.lastFPSTime=t,!0;return t-this.lastFPSTime>=this.renderingDuration&&(this.lastFPSTime=t,!0)}skip(){var t;null===(t=this.preset)||void 0===t||t.updateAnimation(this.reverse?0:1),this.rerender(),this.dispose(),this.onTransactionEnd()}dispose(){var t,e,n;this.renderer.clear(),this.isPlaying=!1,null===(t=this.preset)||void 0===t||t.dispose(),null===(e=this.prevTexture)||void 0===e||e.dispose(),null===(n=this.nextTexture)||void 0===n||n.dispose();for(let t=this.scene.children.length-1;t>=0;t--){const e=this.scene.children[t];this.scene.remove(e)}this.scene.background=null}destroy(){this.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose()}}var sg=n(44),ag=n(47),lg=n.n(ag);
42
42
  /*!
43
43
  * @pixi/polyfill - v6.2.0
44
44
  * Compiled Mon, 01 Nov 2021 16:52:10 UTC
@@ -247,4 +247,4 @@ var BE=function(t,e){return(BE=Object.setPrototypeOf||{__proto__:[]}instanceof A
247
247
  *
248
248
  * pixi.js is licensed under the MIT License.
249
249
  * http://www.opensource.org/licenses/mit-license
250
- */vb.registerPlugin("accessibility",ny),vb.registerPlugin("extract",Fb),vb.registerPlugin("interaction",py),vb.registerPlugin("particle",Kw),vb.registerPlugin("prepare",iS),vb.registerPlugin("batch",Ab),vb.registerPlugin("tilingSprite",cS),$b.registerPlugin(NS),$b.registerPlugin(cw),$b.registerPlugin(Cw),$b.registerPlugin(Ww),$b.registerPlugin(oS),Lb.registerPlugin(oy),Lb.registerPlugin(Qb);var VE={AlphaFilter:FS,BlurFilter:aE,BlurFilterPass:sE,ColorMatrixFilter:uE,DisplacementFilter:cE,FXAAFilter:pE,NoiseFilter:NE},WE=n(2),XE=n.n(WE);class qE extends a.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}var YE=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const ZE=new class{constructor(){this.life=144e5,this.cache=XE.a.createInstance({name:"_slide_cache_life_",storeName:"_slide_cache_life_",driver:XE.a.INDEXEDDB,version:1}),this.clear().catch(()=>{})}clear(){return YE(this,void 0,void 0,(function*(){const t=yield this.cache.keys();for(const e of t){const t=(yield this.cache.getItem(e))||0;if(Date.now()-t>this.life){const[t,n]=e.split("@");yield XE.a.createInstance({name:t,storeName:n,driver:XE.a.INDEXEDDB,version:1}).dropInstance().then(()=>{this.cache.removeItem(e).catch(()=>{})}).catch(()=>{})}}}))}updateActiveTime(t,e){return this.cache.setItem(`${t}@${e}`,Date.now())}dispose(){return YE(this,void 0,void 0,(function*(){const t=yield this.cache.keys();for(const e of t){const[t,n]=e.split("@");yield XE.a.createInstance({name:t,storeName:n,driver:XE.a.INDEXEDDB,version:1}).dropInstance().then(()=>{this.cache.removeItem(e).catch(()=>{})}).catch(()=>{})}}))}};var JE=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class KE{constructor(t){this.useCache=!1,this.useCache=t}bindTask(t){if(this.taskId=t,this.useCache){const t="_slide_local_cache_",e=this.taskId;this.cache=WE.createInstance({name:t,storeName:e,driver:WE.INDEXEDDB,version:1}),ZE.updateActiveTime(t,e).catch(()=>{})}}fetchJson(t){var e,n;return JE(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);return i&&this.useCache||(i=yield(yield fetch(t)).json(),this.useCache&&(yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i))),i}))}fetchPng(t){var e,n;return JE(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);if(i&&this.useCache)return i;if(i=yield fetch(t).then(t=>t.blob()).then(e=>new Promise((n,i)=>{const r=new FileReader;r.onload=()=>{n(r.result)},r.onerror=()=>{i(new Error(`fetch ${t} failed`))},r.readAsDataURL(e)})),this.useCache&&(yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i)),!i)throw new Error(`fetch ${t} failed`);return i}))}destroy(){}}var $E=n(7),QE=n.n($E);function tM(t,e,n=5){return Math.abs(t-e)<=Math.pow(10,-n)}function eM(t){return Math.floor(1e6*t)/1e6}class nM{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const n=new nM;return n.point=t,n.slope=e,n}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return tM(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const n=nM.fromPointSlope(t,e),i=this.crossPoint(n);return i?Math.ceil(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))):0}crossPoint(t){if(tM(t.slope,this.slope))return null;let e=0,n=0;const i=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:l}=t.point;return tM(this.slope,Math.PI/2)?(e=this.point.x,n=i*(e-a)+l):tM(t.slope,Math.PI/2)?(e=t.point.x,n=r*(e-o)+s):tM(this.slope,Math.PI)||tM(this.slope,0)?(n=this.point.y,e=(n-l)/i+a):tM(t.slope,Math.PI)||tM(t.slope,0)?(n=t.point.y,e=(n-s)/r+o):(e=(i*a-l+s-r*o)/(i-r),n=r*(e-o)+s),{x:e,y:n}}}function iM(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}var rM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class oM{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(mv.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const n=this.callbackList[e];if(n&&!n.applied){if(!(n.triggerTime<=this.timestamp))break;n.running=!0,n.fn(),n.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const n=iM(),i=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:i,id:n,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),n}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return rM(this,void 0,void 0,(function*(){const n=this.timestamp;for(;!t()&&this.timestamp-n<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var sM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class aM{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,n){return sM(this,void 0,void 0,(function*(){const i=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${n}.json`),r=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${n}.png`),o=document.createElement("img");o.src=r,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()});const s=new Ty(o),a=new rS(s,i);yield new Promise(t=>{a.parse(()=>t(""))}),this.spriteSheets.push(a),Object.keys(a.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const n=e[1];this.gifs[n]||(this.gifs[n]=[]);const i=parseInt(e[2],10);this.gifs[n][i]=a.textures[t]}else this.frames[t]=i.frames[t],this.textures[t]=a.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var lM=n(3),uM=n.n(lM);function hM(t,e,n){let i,r;const o=Math.round(t)%360;if(o%180==0)i=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)i=0,r=Math.sin(o*(Math.PI/180))*n;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(o);i=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(i=-i),r=t*i}return{x:i,y:r}}function cM(t,e,n,i,r,o){const s=t,a=e;let l,u,h,c,d;if(0===Math.round(i))l=r,u=o,d=0;else if(Math.round(i)>=360)l=r,u=o,h=r+2*t*Math.abs(Math.cos(-n/180*Math.PI)),c=o+2*e*Math.sin(-n/180*Math.PI),d=1;else{const t=-n,e=-(n+i),{x:h,y:c}=hM(t,s,a),p=r-h,f=o+c,{x:m,y:g}=hM(e,s,a);l=m+p,u=f-g,d=i>=-360&&i<-180?1:i>=-180&&i<0||i>0&&i<180?0:1}return{radiusX:s,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:i>0?1:0,endX:l,endY:u,middleX:h,middleY:c}}class dM{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const pM=new class extends dM{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const fM=new class extends dM{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var mM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class gM{constructor(){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null)}render(t,e,n){return mM(this,void 0,void 0,(function*(){const{items:e,width:i,height:r}=t,o=fM.getObject(n),s=new Ty(o,{width:i,height:r,resolution:1}),a=pM.getObject(n);this.imgElements.push(o),this.svgElements.push(a),a.setAttribute("viewBox",`0 0 ${i} ${r}`),a.setAttribute("width",""+i),a.setAttribute("height",""+r);const u={},h={};e.forEach(t=>{const{item:e,x:n,y:i}=t,r=n+2,o=i+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([n,i])=>{e+=n+" ",e+=i.map(e=>(Object(l.isNumber)(e)||(e.x=e.x+t.offset.x+r,e.y=e.y+t.offset.y+o),e)).reduce((t,e)=>(Object(l.isNumber)(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),a.appendChild(t.pathElement)});const c=e.width-4-2*e.padding,d=e.height-4-2*e.padding;this.textures[e.hash]={texture:new ky(s,new d_(r+2,o+2,c,d)),pivot:e.pivot},u[e.hash]={x:r+2,y:o+2,w:c,h:d,pivot:e.pivot},h[e.hash]=this.hashToIdMap[e.hash]});const c=(d='<?xml version="1.0" encoding="utf-8"?>'+a.outerHTML,"data:image/svg+xml,"+encodeURIComponent(d).replace(/'/g,"%27").replace(/"/g,"%22"));var d;o.src=c,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,n,i,r,o,s,a,l,u,h){var c,d;if(!s&&!l)return t;const p=uM()(n+(null!==(d=null===(c=null==s?void 0:s.width)||void 0===c?void 0:c.toString())&&void 0!==d?d:0)+l+u+h);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:n,pathsData:a,pivot:c,padding:d}=function(t,e,n,i,r,o,s,a,l){var u;const h=[],c={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(u=null==i?void 0:i.width)&&void 0!==u?u:0;return s?(d=e,p=n,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=n+_,c.x+=.5*_,c.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&s?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!s&&(e.setAttribute("stroke-linecap",(null==i?void 0:i.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==i?void 0:i.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==i?void 0:i.dash)&&e.setAttribute("stroke-dasharray",i.dash));const{scale:n}=t,r=t.path.trim().split(" ");let o={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],i=r[t+1];if("M"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,s]=i.split(",").map(t=>Number(t)),a=r/Math.PI*180,u=s/Math.PI*180,h=cM(t,e,a,u,o.x,o.y);Math.round(u)>=360?(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.middleX/9525*n.x,y:h.middleY/9525*n.y}]]),l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]])):(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]]))}else if("L"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,s]=i.split(",").map(t=>Number(t));o={x:r,y:s},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:s}]])}else if("CB"===e){let[t,e,r,s,a,u]=i.split(",").map(t=>Number(t));o={x:a,y:u},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,a=a/9525*n.x,u=u/9525*n.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:s},{x:a,y:u}]])}else"C"===e&&l.cmds.push(["Z",[]])}h.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:c,padding:2,pathsData:h}}(e,r,o,s,i,0,l,u,h);this.graphics.push({hash:p,pathsData:a,pivot:c,width:t,height:n,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const n=[],i=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||n.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=i.length+1,o=2050,s=2050;const a=[];let l=null;for(;(o>2048||s>2048)&&i.length>0;)r-=1,l=QE()(i.slice(0,r)),o=l.width,s=l.height;return l&&a.push(l),n.forEach(t=>{const e=QE()([t]);a.push(e)}),r<i.length?a.concat(t(i.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>fM.collectObject(t)),this.svgElements.forEach(t=>pM.collectObject(t)),this.graphics=[]}}class vM{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,n){const i=`${e}_${t}`;if(this.runningTimeNodes[i])try{this.runningTimeNodes[i].dispose(!0)}catch(t){}this.runningTimeNodes[i]=n}}class _M{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,n={type:"el",index:0,id:""}){var i,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(i=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==i?i:null),"shape"===t.type&&t.bg&&0===n.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",n.id)),e&&o?o.getIterateEntry(n.type,n.index,n.id):(o||this.eventHub.emit("IterateTimeNodeEnd",n.id),o))}clearTargets(){this.targets=Object.create(null)}}class yM{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class xM{constructor(t){this.target=t}applyCommand(t,e){this.target.applyCommand(t,e)}}class bM{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class wM{constructor(t,e){this.hardHidden=!1,this.target=t,!0===e&&(this.hardHidden=!0)}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class TM{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("click",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}addProxy(t){this.proxy=t,this.hitArea=this.getOriginHitArea(),this.proxy.interactive=!0,this.actions.forEach(([t,e])=>{var n,i;"click"===e?null===(n=this.proxy)||void 0===n||n.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(i=this.proxy)||void 0===i||i.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var n;const i=t.data.global,r=this.object.getGlobalPosition(),o=i.x-r.x+this.object.pivot.x,s=i.y-r.y+this.object.pivot.y;(null===(n=this.hitArea)||void 0===n?void 0:n.contains(o,s))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new g_(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit(zR.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if(this.ctx.eventHub.emit(zR.userInput),"ppaction://hlinksldjump"===t.action){const n=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);n&&n[1]&&this.ctx.eventHub.emit(zR.requestGotoSlide,Number(n[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(zR.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(zR.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(zR.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(zR.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(zR.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit(zR.requestGotoSlide,-1)}}class SM{constructor(t,e,n){var i,r,o,s,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new d_(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new ty,this.ctx=e,this.style=new wM(this.container,t.hardHidden),this.designGlobalPosition={x:n.x+(null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0),y:n.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new TM(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,n,i,r,o,s,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,this.designY=null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0;const u=this.designWidth/2,h=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=u,this.container.pivot.y=h;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=c+u,this.container.y=d+h,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new AT;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return eM(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return eM((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return eM(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return eM(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}class EM{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,n,i,r]=RM(t);let o=0,s=0,a=0;const l=Math.max(e,n,i),u=Math.min(e,n,i),h=l-u;a=(l+u)/2,0===h?o=0:l===e?o=(n-i)/h%6*60:l===n?o=60*((i-e)/h+2):l===i&&(o=60*((e-n)/h+4)),s=0===h?0:h/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,n){const i=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;n.h=Math.max(Math.min(i,359),0),n.s=Math.max(Math.min(r,1),0),n.l=Math.max(Math.min(o,1),0),n.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:n,l:i}=this;if(e<360&&e>=0&&n<=1&&n>=0&&i<=1&&i>=0){let r,o,s;const a=(1-Math.abs(2*i-1))*n,l=a*(1-Math.abs(e/60%2-1)),u=i-a/2;[r,o,s]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+u,o+u,s+u,this.a]}return CM(t)}}class MM{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,n,i,r]=RM(t);this.r=e,this.g=n,this.b=i,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,n){n.r=t.r+(this.r-t.r)*e,n.g=t.g+(this.g-t.g)*e,n.b=t.b+(this.b-t.b)*e,n.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return CM([this.r,this.g,this.b,this.a])}}function AM(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function RM(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function CM(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function PM(t,e,n){const i=RM(t),r=RM(e),o=Math.round(255*(i[0]+(r[0]-i[0])*n)),s=Math.round(255*(i[1]+(r[1]-i[1])*n)),a=Math.round(255*(i[2]+(r[2]-i[2])*n)),l=Math.round(255*(i[3]+(r[3]-i[3])*n));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class IM extends Gx{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=RM(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const OM=new VE.ColorMatrixFilter;OM.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const LM=new VE.ColorMatrixFilter;LM.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const NM=new VE.ColorMatrixFilter;NM.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const DM=new VE.ColorMatrixFilter;DM.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const FM={darken:OM,darkenLess:LM,lightenLess:DM,lighten:NM};class BM extends SM{constructor(t,e,n){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,n),this.fillColorFilter=new IM,this.fill=new bM(this),this.json=t,this.ctx=e,this.parentGlobalPos=n,this.global={x:n.x+t.x,y:n.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,n;t?(null!==(n=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,n=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*n}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,n=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*n}get design_ppt_x(){return eM(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return eM(this.global.y/this.ctx.stageHeight)}}class UM{constructor(t,e,n,i,r,o,s,a,l,u,h){this.ctx=t,this.type=e,this.lineWidth=n,this.width=i,this.height=r,this.fillColor=o,this.isHorz=s,this.renderContainer=new ty,this.ghcTextureId=`${a}-text-p${l}-l${u}-u${h}-underLine`}createPaths(){if("ww"===this.type)return null;{console.log("line width",this.lineWidth);let t=`M 0,0 L ${9525*this.width},0`,[e,n]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,n]=[this.lineWidth,this.height]),{paths:[{id:iM(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:uM()(t)}],width:e,height:n}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:n,height:i}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},n,i,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new OT,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const kM=134217729;function GM(t,e,n,i,r){let o,s,a,l,u=e[0],h=i[0],c=0,d=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=i[++d]);let p=0;if(c<t&&d<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=i[++d]),o=s,0!==a&&(r[p++]=a);c<t&&d<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d]),o=s,0!==a&&(r[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(r[p++]=a);for(;d<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function HM(t,e){let n=e[0];for(let i=1;i<t;i++)n+=e[i];return n}function zM(t){return new Float64Array(t)}const jM=zM(4),VM=zM(8),WM=zM(12),XM=zM(16),qM=zM(4);function YM(t,e,n,i,r,o){const s=(e-o)*(n-r),a=(t-r)*(i-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*u?l:-function(t,e,n,i,r,o,s){let a,l,u,h,c,d,p,f,m,g,v,_,y,x,b,w,T,S;const E=t-r,M=n-r,A=e-o,R=i-o;x=E*R,d=kM*E,p=d-(d-E),f=E-p,d=kM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),w=A*M,d=kM*A,p=d-(d-A),f=A-p,d=kM*M,m=d-(d-M),g=M-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,jM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,jM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,jM[2]=_-(S-c)+(v-c),jM[3]=S;let C=HM(4,jM),P=22204460492503146e-32*s;if(C>=P||-C>=P)return C;if(c=t-E,a=t-(E+c)+(c-r),c=n-M,u=n-(M+c)+(c-r),c=e-A,l=e-(A+c)+(c-o),c=i-R,h=i-(R+c)+(c-o),0===a&&0===l&&0===u&&0===h)return C;if(P=11093356479670487e-47*s+33306690738754706e-32*Math.abs(C),C+=E*h+R*a-(A*u+M*l),C>=P||-C>=P)return C;x=a*R,d=kM*a,p=d-(d-a),f=a-p,d=kM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),w=l*M,d=kM*l,p=d-(d-l),f=l-p,d=kM*M,m=d-(d-M),g=M-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,qM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,qM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,qM[2]=_-(S-c)+(v-c),qM[3]=S;const I=GM(4,jM,4,qM,VM);x=E*h,d=kM*E,p=d-(d-E),f=E-p,d=kM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),w=A*u,d=kM*A,p=d-(d-A),f=A-p,d=kM*u,m=d-(d-u),g=u-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,qM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,qM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,qM[2]=_-(S-c)+(v-c),qM[3]=S;const O=GM(I,VM,4,qM,WM);x=a*h,d=kM*a,p=d-(d-a),f=a-p,d=kM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),w=l*u,d=kM*l,p=d-(d-l),f=l-p,d=kM*u,m=d-(d-u),g=u-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,qM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,qM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,qM[2]=_-(S-c)+(v-c),qM[3]=S;const L=GM(O,WM,4,qM,XM);return XM[L-1]}(t,e,n,i,r,o,u)}zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(8),zM(8),zM(8),zM(4),zM(8),zM(8),zM(8),zM(12);zM(192),zM(192);zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(8),zM(8),zM(8),zM(8),zM(8),zM(8),zM(8),zM(8),zM(8),zM(4),zM(4),zM(4),zM(8),zM(16),zM(16),zM(16),zM(32),zM(32),zM(48),zM(64);zM(1152),zM(1152);zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(4),zM(24),zM(24),zM(24),zM(24),zM(24),zM(24),zM(24),zM(24),zM(24),zM(24),zM(1152),zM(1152),zM(1152),zM(1152),zM(1152),zM(2304),zM(2304),zM(3456),zM(5760),zM(8),zM(8),zM(8),zM(16),zM(24),zM(48),zM(48),zM(96),zM(192),zM(384),zM(384),zM(384),zM(768);zM(96),zM(96),zM(96),zM(1152);const ZM=Math.pow(2,-52),JM=new Uint32Array(512);class KM{static from(t,e=iA,n=rA){const i=t.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=t[o];r[2*o]=e(i),r[2*o+1]=n(i)}return new KM(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,l=-1/0,u=-1/0;for(let e=0;e<o;e++){const n=t[2*e],i=t[2*e+1];n<s&&(s=n),i<a&&(a=i),n>l&&(l=n),i>u&&(u=i),this._ids[e]=e}const h=(s+l)/2,c=(a+u)/2;let d,p,f,m=1/0;for(let e=0;e<o;e++){const n=$M(h,c,t[2*e],t[2*e+1]);n<m&&(d=e,m=n)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const n=$M(g,v,t[2*e],t[2*e+1]);n<m&&n>0&&(p=e,m=n)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===p)continue;const n=tA(g,v,_,y,t[2*e],t[2*e+1]);n<x&&(f=e,x=n)}let b=t[2*f],w=t[2*f+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];eA(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,i=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>i&&(e[n++]=r,i=this._dists[r])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(YM(g,v,_,y,b,w)<0){const t=p,e=_,n=y;p=f,_=b,y=w,f=t,b=e,w=n}const T=function(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l);return{x:t+(u*h-a*c)*d,y:e+(s*c-l*h)*d}}(g,v,_,y,b,w);this._cx=T.x,this._cy=T.y;for(let e=0;e<o;e++)this._dists[e]=$M(t[2*e],t[2*e+1],T.x,T.y);eA(this._ids,this._dists,0,o-1),this._hullStart=d;let S=3;n[d]=e[f]=p,n[p]=e[d]=f,n[f]=e[p]=d,i[d]=0,i[p]=1,i[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,w)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const l=this._ids[a],u=t[2*l],h=t[2*l+1];if(a>0&&Math.abs(u-o)<=ZM&&Math.abs(h-s)<=ZM)continue;if(o=u,s=h,l===d||l===p||l===f)continue;let c=0;for(let t=0,e=this._hashKey(u,h);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let m,g=c;for(;m=n[g],YM(u,h,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(v+2),i[g]=v,S++;let _=n[g];for(;m=n[_],YM(u,h,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,i[l],-1,i[_]),i[l]=this._legalize(v+2),n[_]=_,S--,_=m;if(g===c)for(;m=e[g],YM(u,h,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(v+2),i[m]=v,n[g]=g,S--,g=m;this._hullStart=e[l]=g,n[g]=e[_]=l,n[l]=_,r[this._hashKey(u,h)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,e=this._hullStart;t<S;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const s=n[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=JM[--r];continue}const l=s-s%3,u=a+(t+1)%3,h=l+(s+2)%3,c=e[o],d=e[t],p=e[u],f=e[h];if(QM(i[2*c],i[2*c+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*f],i[2*f+1])){e[t]=f,e[s]=c;const i=n[h];if(-1===i){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,i),this._link(s,n[o]),this._link(o,h);const a=l+(s+1)%3;r<JM.length&&(JM[r++]=a)}else{if(0===r)break;t=JM[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,i,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=n,this._link(s,i),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function $M(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function QM(t,e,n,i,r,o,s,a){const l=t-s,u=e-a,h=n-s,c=i-a,d=r-s,p=o-a,f=h*h+c*c,m=d*d+p*p;return l*(c*m-f*p)-u*(h*m-f*d)+(l*l+u*u)*(h*p-c*d)<0}function tA(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l),p=(u*h-a*c)*d,f=(s*c-l*h)*d;return p*p+f*f}function eA(t,e,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=t[r],o=e[i];let s=r-1;for(;s>=n&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=i}else{let r=n+1,o=i;nA(t,n+i>>1,r),e[t[n]]>e[t[i]]&&nA(t,n,i),e[t[r]]>e[t[i]]&&nA(t,r,i),e[t[n]]>e[t[r]]&&nA(t,n,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;nA(t,r,o)}t[n+1]=t[o],t[o]=s,i-r+1>=o-n?(eA(t,e,r,i),eA(t,e,n,o-1)):(eA(t,e,n,o-1),eA(t,e,r,i))}}function nA(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function iA(t){return t[0]}function rA(t){return t[1]}function oA(t,e,n){let i=null;const r=new ty;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const o=t=>{const e=[];for(let n=0,i=t.length;n<i-1;n++){const i=t[n],r=t[n+1],o=i.pos+.5*(r.pos-i.pos),s=PM(i.color,r.color,.5),a=2*n;e[a]=i,e[a+1]={color:s,pos:o},e[a+2]=r}return e};if(t.stopList=o(t.stopList),t.stopList=o(t.stopList),i=t.line?sA(t,e,n):t.path?function(t,e,n){var i,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(i=t.path)||void 0===i?void 0:i.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const i=e/2,r=n/2,o=Math.sqrt(i*i+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,n=new xc;n.absellipse(0,0,e,e,0,2*Math.PI,!1,0),n.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=i,a.y=r})}return{points:s,position:a}}(t,e,n):sA(t,e,n),i){const t=[],o=[],{position:s,points:a}=i,l=KM.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),o.push(...RM(a[l.triangles[e]].color)),o.push(...RM(a[l.triangles[e+1]].color)),o.push(...RM(a[l.triangles[e+2]].color));const u=new Jy;u.addAttribute("aVertexPosition",t,2),u.addAttribute("aColor",o,4);const h=Ux.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),c=new AT;c.drawRect(0,0,e+1,n+1),r.mask=c,r.addChild(c);const d=new vS(u,h);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}function sA(t,e,n){const i=e/2,r=n/2,o=[{x:-i,y:r},{x:-i,y:-r},{x:i,y:r},{x:i,y:-r}],s=[nM.fromPointSlope({x:-i,y:0},Math.PI/2),nM.fromPointSlope({x:0,y:r},0),nM.fromPointSlope({x:i,y:0},Math.PI/2),nM.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(o=>{var l,u,h;const c=2*Math.PI;let d=null!==(u=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==u?u:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const p={x:0,y:0};tM(d,Math.PI/2)?(p.x=0,p.y=n/2-o.pos*n):tM(d,0)?(p.x=o.pos*e-e/2,p.y=0):(p.x=o.pos*e-e/2,p.y=n/2-o.pos*n),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=nM.fromPointSlope(p,Math.PI/2-((null===(h=t.line)||void 0===h?void 0:h.ang)||0)),m=s.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=i&&t.x>=-i&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,n=p.x+e*g,s=f.resolveY(n);n<=i&&n>=-i&&s<=r&&s>=-r&&a.push({point:{x:n,y:s},color:o.color}),g+=g}return f});let u=[],h=[];t:for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<l.length-1;e++){const i=l[e],r=l[e+1],o=i.distanceToLinearEquation(r),s=i.distanceToPoint(n),u=r.distanceToPoint(n);if(s<o&&u<o){const i=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=PM(i.color,r.color,s/o);a.splice(e+1,0,{point:n,color:l});continue t}}const i=l[0],r=l[l.length-1],s=i.distanceToPoint(n),c=r.distanceToPoint(n);s<=c?u.push({point:n,dis:s}):h.push({point:n,dis:c})}u=u.sort((t,e)=>e.dis-t.dis);const c=u.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[0].color};{const n=t.stopList[0].color,i=t.stopList[1].color;return{point:e.point,color:PM(n,i,1-(0===u[0].dis?1:e.dis/u[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);h=h.sort((t,e)=>e.dis-t.dis);const d=h.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const n=t.stopList[t.stopList.length-2].color,i=t.stopList[t.stopList.length-1].color;return{point:e.point,color:PM(n,i,0===h[0].dis?0:e.dis/h[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=c.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=i,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const aA="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",lA=[aA],uA={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec3 hsl = rgb2hsl(texColor.rgb);\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n"};class hA extends Gx{constructor(t,e){var n;super(void 0,(n=uA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${lA.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const cA=[aA],dA={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n"};class pA extends Gx{constructor(t,e,n){var i;super(void 0,(i=dA[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${cA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(n)})}}const fA=[aA],mA={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n if (arg1 > 0.0) {\n texColor.r += (1.0 - texColor.r) * arg1;\n texColor.g += (1.0 - texColor.g) * arg1;\n texColor.b += (1.0 - texColor.b) * arg1;\n } else if (arg1 < 0.0) {\n texColor.r -= texColor.r * arg1;\n texColor.g -= texColor.g * arg1;\n texColor.b -= texColor.b * arg1;\n }\n // todo 对比度\n texColor.rgb *= texColor.a;\n return texColor;\n}\n"};class gA extends Gx{constructor(t,e,n){var i;super(void 0,(i=mA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${fA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:n})}}class vA{constructor(t,e,n,i,r){this.ctx=t,this.fillStyle=e,this.width=n,this.height=i,this.config=r,this.clonedObjects=[],this._displayObject=null}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new OT;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType)return oA(this.fillStyle,this.width,this.height);if("blipFill"===this.fillStyle.fillType){const{src:t,filters:e}=this.fillStyle,n=this.ctx.spriteTexture.getTexture(t),i=this.ctx.spriteTexture.getFrameData(t);if(n){const t=new OT;return t.texture=n,e.length>0&&this.config.useFilter&&(t.filters=function(t){const e=[];return t.forEach(t=>{if("biLevel"===t.type)e.push(new hA("biLevel",t.args[0]));else if("clrChange"===t.type||"changeBulletColor"===t.type){const n=RM(t.args[0]),i=RM(t.args[1]);e.push(new pA(t.type,n,i))}else"alphaModFix"===t.type?e.push(new hA(t.type,t.args[0])):"lum"===t.type&&e.push(new gA(t.type,t.args[0],t.args[1]))}),e}(e)),t.width=this.width,t.height=this.height,i.rotate&&(t.position.x=this.width/2,t.position.y=this.height/2,t.anchor.x=.5,t.anchor.y=.5,t.rotation=i.rotate/180*Math.PI),t}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,n=this.ctx.spriteTexture.getGifFrames(t).map((t,n)=>({texture:t,time:e[n]||20})),i=new jE(n,!0);i.width=this.width,i.height=this.height;const r=this.fillStyle.loop;let o=1;return i.onLoop=()=>{o+=1,r>0&&o>r&&i.gotoAndStop(i.totalFrames)},i}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var _A=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class yA extends BM{constructor(t,e,n){var i;super(t,e,n),this.textureContainer=new ty,this.underline=null,this.cacheSprite=new OT;const{shapeId:r,paragraphIndex:o,lineIndex:s,unitIndex:a,lineHeight:l,width:u,underLine:h,fill:c,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(i=null==c?void 0:c.fill)||void 0===i?void 0:i.fillType)?c.fill.color:null;if(h){const t=p?l/16:f/16;this.underline=new UM(e,h.type,t,u,d,m,p,r,o,s,a)}this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill()}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:n}=this.json;return new vA(this.ctx,null==t?void 0:t.fill,e,n,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new vA(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:n,lineHeight:i,fillLineHeight:r}=this.json;return t?new vA(this.ctx,null==e?void 0:e.fill,n,Math.max(r,i),{useFilter:!1,useSlideBackgroundFill:!1}):new vA(this.ctx,null==e?void 0:e.fill,r,i,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:n}=this.json;let i="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(i=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",i]}]}:void 0;return new vA(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===n,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,n,i,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:o?0:null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>_A(this,void 0,void 0,(function*(){this.doRender()})))}doRender(){let t=!1;const{lineWidth:e,lineHeight:n,baseLine:i,isHorz:r,underline:o,height:s,width:a,highlightColor:l,x:u,y:h,content:c,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new AT,[i,o]=AM(l);t.beginFill(i,o),t.drawRect(0,0,r?a:e,r?n:s),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(e.scale.x=.5,e.scale.y=.5,r&&(e.position.y=h>0?h:0),f){const n=this.textFill.displayObject;if(n)n.mask=e,n.addChild(e),n.position.x=-u,e.position.x+=u,t=!0,this.textureContainer.addChild(n);else if(this.textFill.isSolidFill()){const n=new IM;n.color=this.textFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(e.scale.x=.5,e.scale.y=.5,f){const n=this.strokeFill.displayObject;if(n)n.mask=e,n.addChild(e),r?n.position.y=h>0?h:0:n.position.x=u,this.textureContainer.addChild(n);else if(this.strokeFill.isSolidFill()){r?e.position.y=h>0?h:0:e.position.x=u;const n=new IM;n.color=this.strokeFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=h>0?h:0:e.position.x=u,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=o?o-n/16:i,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Hy.create({width:r?a:e,height:r?Math.max(d,n):s,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&h<0&&(this.cacheSprite.position.y=h),this.container.addChild(this.cacheSprite)}else this.container.addChild(this.textureContainer);this.container.name=c}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var xA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class bA extends BM{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,n){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createUnits(t,e,n,i){for(let r=0,o=this.json.textUnits.length;r<o;r++)i.addSubMTask(()=>xA(this,void 0,void 0,(function*(){const i=this.json.textUnits[r],{height:o,width:s,fillHeight:a,baseline:l,y:u,underline:h}=this.json,c=new yA(Object.assign(Object.assign({},i),{lineHeight:o,lineWidth:s,baseLine:l-u,underline:h,fillLineHeight:a||o,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:n,unitIndex:r}),this.ctx,this.global);c.preRender(),this.units.push(c)})))}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>xA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})))}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var wA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class TA extends BM{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,n){const i=this.getIterateElements();return i[e]?i[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createLines(t,e,n){for(let i=0,r=this.json.lines.length;i<r;i++)n.addSubMTask(()=>wA(this,void 0,void 0,(function*(){const r=this.json.lines[i],o=new bA(r,this.ctx,this.global);o.isHorz=this.isHorz,o.container.name="line-"+i,o.createUnits(t,e,i,n),this.lines.push(o)})))}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>wA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})))}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var SA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class EA{constructor(t,e,n,i){this.iterateElements=[],this.paragraphs=[],this.container=new ty,this.json=t,this.ctx=e,this.parentGlobalPos=i,this.iterateType=n,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const r=new AT;r.drawRect(0,0,t.width,t.height),this.container.addChild(r)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()})}createParagraphs(t,e){for(let n=0,i=this.json.paragraphs.length;n<i;n++)e.addSubMTask(()=>SA(this,void 0,void 0,(function*(){var i;const r=this.json.paragraphs[n],o=new TA(r,this.ctx,this.global);o.isHorz=null===(i=this.json.isHorz)||void 0===i||i,o.createLines(t,n,e),e.addSubMTask(()=>SA(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(o.getIterateElements()),o.container.name="段落-"+n,this.paragraphs.push(o)})))})))}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>SA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})));t.addSubMTask(()=>SA(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})))}}var MA=n(48),AA=n.n(MA),RA=n(49),CA=n.n(RA);const PA={Reflection:class extends Gx{constructor(t){super(AA.a,CA.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uBlur:0}),this.json=t}}};class IA{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+uM()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class OA{constructor(t,e,n,i,r,o,s,a,l,u,h){this.id=t,this.ctx=e,this.paths=n,this.hash=i,this.nept=r,this.width=o,this.height=s,this.lineStyle=a,this.shouldFill=l,this.bgColor=u,this.lnColor=h,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(n),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const n=[],i=[];for(let t=0;t<e.length;t+=2){const r=e[t],o=e[t+1],[s,a]=o.split(",").map(t=>Number(t)/100);n.push(r),i.push({x:s,y:a})}if("MLLLC"!==n.join(""))return!1;for(let t=0;t<3;t++){const e=i[t],n=i[t+1];if(e.x!==n.x&&e.y!==n.y)return!1}const r=i.slice(0,4).reduce((t,e)=>t+e.x,0)/4,o=i.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(o))return!1;const s={x:r,y:o};return tM(this.pointDis(s,i[0]),this.pointDis(s,i[1]))&&tM(this.pointDis(s,i[0]),this.pointDis(s,i[2]))&&tM(this.pointDis(s,i[0]),this.pointDis(s,i[3]))&&this.pointDis(s,i[0])===this.pointDis(s,i[1])}createDisplayObject(){if(this.isPureRect){const t=new AT;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new AT,[e,n]=AM(this.bgColor);return t.beginFill(e,n),t.drawRect(0,0,this.width,this.height),t}{const t=new OT,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let n=!1;return this._displayObject&&(n=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),n}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var LA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const NA={pivot:{x:0,y:0},width:0,height:0};class DA extends SM{constructor(t,e,n,i){var r;super(t,e,n),this.renderContainer=new ty,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.filterAreaJustifies=[],this.strokeGraphics=null,this.arrowList=[],this.fillColorFilter=new IM,this.strokeColorFilter=new IM,this.id="",this.fill=new bM(this),this.stroke=new yM(this),this.updateFilterArea=()=>{const t=this.renderContainer.getBounds(!1),e=this.filterAreaJustifies.map(e=>e(t)),n=e.map(t=>t.width),i=e.map(t=>t.height),r=new d_(t.x,t.y,Math.max(...n),Math.max(...i));this.renderContainer.filterArea=r,(this.renderContainer.filters||[]).forEach(t=>{t.uniforms.uShapeFilterArea=new Float32Array(4),t.uniforms.uShapeFilterArea[0]=r.x,t.uniforms.uShapeFilterArea[1]=r.y,t.uniforms.uShapeFilterArea[2]=r.width,t.uniforms.uShapeFilterArea[3]=r.height})},this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.id=t.id;const{fillStyle:o,lineStyle:s}=this.json;this.container.name=t.id,this.renderContainer.name=t.id+"-render-container",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics(),this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==o?void 0:o.fillType)&&(this.fillColorFilter.currentColor=o.color,this.fillColorFilter.designColor=o.color),"solidFill"===(null===(r=null==s?void 0:s.fill)||void 0===r?void 0:r.fillType)&&(this.strokeColorFilter.currentColor=s.fill.color,this.strokeColorFilter.designColor=s.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new EA(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new g_(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,n,i,r,o,s;return this.strokeFill.displayObject?(null!==(n=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set strokeActive(t){var e,n,i,r,o,s;const{displayObject:a}=this.strokeFill;t?a&&(null!==(n=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==n?n:-1)<0?a.filters=[this.strokeColorFilter]:(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==o?o:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(s=this.strokeGraphics)||void 0===s?void 0:s.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get fillActive(){var t,e,n,i,r,o,s;return this.backgroundFill.displayObject?(null!==(n=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set fillActive(t){var e,n,i,r,o,s;t?this.backgroundFill.displayObject&&(null!==(n=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==o?o:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var n,i;return null!==(i=null===(n=this.text)||void 0===n?void 0:n.getTextElement(t,e))&&void 0!==i?i:null}getBgElement(){return this}getIterateEntry(t,e,n){return"el"===t?0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null):this.text?this.text.getIterateEntry(e-1,n)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}createStrokeGraphics(){var t,e,n,i;const{id:r,geometry:o,lineStyle:s}=this.json,{width:a,height:l,pivot:u}=(null==o?void 0:o.lineTransform)||NA,h=a||this.json.width,c=l||this.json.height,d="solidFill"===(null===(t=null==s?void 0:s.fill)||void 0===t?void 0:t.fillType)?s.fill.color:null;return s&&"noFill"!==(null===(e=s.fill)||void 0===e?void 0:e.fillType)?new OA(r+"-path-graphics",this.ctx,null!==(n=null==o?void 0:o.paths)&&void 0!==n?n:[],null!==(i=null==o?void 0:o.hash)&&void 0!==i?i:"",u||{x:0,y:0},h,c,s,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:n,lineStyle:i,width:r,height:o}=this.json,s=(null==n?void 0:n.lineTransform)||NA,a=Object(l.isNumber)(null==i?void 0:i.width)?i.width:1;return new vA(this.ctx,null==i?void 0:i.fill,(s.width||r)+a+t,Math.max((s.height||o)+a,e),{useFilter:!1,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:n,fillStyle:i,id:r}=this.json,{width:o,height:s,pivot:a}=(null==e?void 0:e.lineTransform)||NA,l=o||this.json.width,u=s||this.json.height,h="solidFill"===(null==i?void 0:i.fillType)?i.color:null;return i&&"noFill"!==i.fillType||this.json.isPicture?new OA(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,u,n,!0,h,null):null}createBackgroundFill(){var t,e;const{fillStyle:n,width:i,height:r,lineStyle:o,geometry:s}=this.json,a=(null==s?void 0:s.fillTransform)||NA;return new vA(this.ctx,n,(a.width||i)+(null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0),(a.height||r)+(null!==(e=null==o?void 0:o.width)&&void 0!==e?e:0),{useFilter:!1,useSlideBackgroundFill:this.json.useBgFill})}createBackground(){var t,e,n,i,r,o,s,a;const{pivot:l,width:u,height:h}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||NA,{displayObject:c}=this.backgroundFill;c?(this.json.useBgFill&&(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)?(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,c.pivot.x=(null===(i=this.json.position)||void 0===i?void 0:i.x)||0,c.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.container.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(o=this.json.fillStyle)||void 0===o?void 0:o.fillType)?(c.height=h||this.designHeight,c.width=u||this.designWidth,c instanceof jE&&c.play(),(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.isNeedMask(c.width,c.height))&&(c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(c.width,c.height))&&(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject)),c.x=l.x,c.y=l.y,this.container.addChild(c)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.container.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,n;const{displayObject:i}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[o,s]=this.calculateFillObjectOffset();i?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(i.width,i.height))&&r&&(this.needCacheAsBitMap=!0,i.pivot.x=r.pivot.x,i.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,i.mask=r,i.addChild(r),i.position.x=-o/2,i.position.y=-s/2,r.position.x=o/2,r.position.y=s/2),this.container.addChild(i)):this.strokeFill.hasFill&&(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&this.container.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,n;const i=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of i){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const i=new OT(e.texture);i.pivot.x=e.pivot.x,i.pivot.y=e.pivot.y;const r=this.backgroundFill.getClonedDisplayObject(),o=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.getClonedDisplayObject(),s=r||o;s&&(this.backgroundFill.displayObject&&(s.pivot.x=this.backgroundFill.displayObject.pivot.x,s.pivot.y=this.backgroundFill.displayObject.pivot.y),s.mask=i,s.filters=[FM[t.fill]],this.needCacheAsBitMap=!0,this.container.addChild(s),this.container.addChild(i))}}}createArrow(){if(!this.arrowList.length)return;const t=new ty,e=this.strokeFill.getClonedDisplayObject(),[n,i]=this.calculateFillObjectOffset();this.arrowList.forEach(e=>{const n=this.ctx.graphicsTexture.getGraphicsData(e.graphicsId);if(n){const{texture:i}=n,r=new OT(i);r.pivot.x=e.pivot.x,r.pivot.y=e.pivot.y,r.position.x=e.position.x+e.pivot.x,r.position.y=e.position.y+e.pivot.y,r.rotation=e.rotate/180*Math.PI,t.addChild(r)}}),this.arrowRenderTexture=Hy.create({width:t.width,height:t.height,resolution:1}),this.ctx.renderer.render(t,{renderTexture:this.arrowRenderTexture});const r=new OT;r.texture=this.arrowRenderTexture,e&&(e.mask=r,e.position.x=-n/2,e.position.y=-i/2,r.position.x=-n/2,r.position.y=-i/2,this.container.addChild(e),this.container.addChild(r))}generateArrowList(){var t,e;const{lineArrowList:n,lineStyle:i,id:r}=this.json,o="solidFill"===(null===(t=null==i?void 0:i.fill)||void 0===t?void 0:t.fillType)?i.fill.color:null;null===(e=n||[])||void 0===e||e.forEach((t,e)=>{var n,s;const a=new IA(Object.assign(Object.assign({},t),{fillStyle:null==i?void 0:i.fill,lineWidth:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(s=a.paths)&&void 0!==s?s:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,o,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,n,i;const{lineStyle:r,geometry:o}=this.json,{width:s,height:a}=(null==o?void 0:o.lineTransform)||NA,l=s||this.json.width,u=a||this.json.height,h=(null===(e=null==o?void 0:o.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],c="solidFill"===(null===(n=null==r?void 0:r.fill)||void 0===n?void 0:n.fillType)?r.fill.color:null;t.addSubMTask(()=>LA(this,void 0,void 0,(function*(){for(const t of h)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==o?void 0:o.lineTransform)||NA).pivot,l,u,r,this.ctx.objectPoolGroup,!0,null,c)}))),null===(i=this.text)||void 0===i||i.createParagraphs(this.json.id,t)}subClassRender(){}setupEffect(){const{effectList:t}=this.json;if(t&&t.length>0){const e=[];return t.forEach(t=>{"reflection"===t.type&&(this.filterAreaJustifies.push(t=>(t.height*=2,t)),e.push(new PA.Reflection(t)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(t){t.addSubMTask(()=>LA(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()}))),this.text&&this.text.render(t),t.addSubMTask(()=>LA(this,void 0,void 0,(function*(){var t,e,n,i,r,o;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType))this.renderContainer.addChild(this.container),this.text&&(this.text.container.position.x=(null!==(i=null===(n=this.json.position)||void 0===n?void 0:n.x)&&void 0!==i?i:0)+this.text.x,this.text.container.position.y=(null!==(o=null===(r=this.json.position)||void 0===r?void 0:r.y)&&void 0!==o?o:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(l.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Hy.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}})))}clearOnSlideChange(){}initOnReuse(){}destroy(){var t,e,n,i;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(n=this.strokeGraphics)||void 0===n||n.destroy(),this.renderContainer.destroy(),null===(i=this.arrowRenderTexture)||void 0===i||i.destroy(!0),this.arrowList=[]}}var FA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function BA(t,e){for(const n in e)t.style[n]=e[n]}class UA{constructor(t){var e,n;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(e),this.medianIsEnd=!1,this.ctx.eventHub.emit(zR.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e)},this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=UA.formatTime(this.duration)},this.playMedia=()=>FA(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()})})),this.pauseMedia=()=>FA(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>FA(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=UA.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString()})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this.playMediaFromCtrl=()=>{this.ctx.eventHub.emit(zR.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(zR.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.canvasElement=t.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(n=this.info.cut.end)&&void 0!==n?n:0)}getMedianContainer(){var t;let e=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(t){let e="00:00";if(t){const n=Math.floor(t/60),i=String(n<0?0:n).padStart(2,"0"),r=Math.floor(t%60);e=`${i}:${String(r<0?0:r).padStart(2,"0")}`}return e}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};BA(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=document.createElement("img");BA(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),BA(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const n=document.createElement("img");BA(n,{height:"20px"}),n.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(n)}createTimer(){const t=document.createElement("div");BA(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){BA(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");BA(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),BA(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var t;const{target:e}=this,{stageWidth:n,stageHeight:i}=this.ctx,r=e.getGlobalPosition(),o=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),s=n*o,a=1/o*(300>s?s/300:1);r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,n-300*a),r.y=Math.max(r.y,0),r.y=Math.min(r.y,i-50),BA(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:r.x+"px",top:r.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${a})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var kA=n(50);class GA extends a.a{constructor(t){super(),this.lastTime=-1,this.howl=null,this.rctClient=null,jR.RtcAudioClazz?(this.rctClient=new jR.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play"))):(this.howl=new kA.Howl({src:[t]}),this.howl.on("load",()=>this.emit("load")),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>this.emit("play")))}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate")),this.isEnded||requestAnimationFrame(()=>this.startTimeChangeEmit())}play(){var t,e;this.lastTime=-1,null===(t=this.howl)||void 0===t||t.play(),null===(e=this.rctClient)||void 0===e||e.play(),this.startTimeChangeEmit()}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.rctClient)||void 0===e||e.pause()}stop(){var t;null===(t=this.howl)||void 0===t||t.stop(),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0)}destroy(){var t,e,n,i,r,o,s;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.howl)||void 0===e||e.unload(),null===(n=this.rctClient)||void 0===n||n.pause(),null===(i=this.rctClient)||void 0===i||i.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("play"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("pause")}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek():-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration():0}get isEnded(){return Math.abs(this.currentTime-this.duration)<.001}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&this.howl.playing()}}var HA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class zA extends a.a{constructor(t){var e,n;super(),this.type="video",this.sprite=new OT,this.isPlaying=!1,this.id=t.id,this.video=t.video,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(n=t.video.cut)||void 0===n?void 0:n.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this,this.videoResource=new Iy(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const i=this.video.src.replace(/4$/,"3");this.rtcAudio=new GA(i);const{video:r,width:o,height:s,target:a}=t;this.controller=new UA({targetId:t.id,ctx:t.ctx,width:o,height:s,target:a,media:this,info:r,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=o,this.sprite.height=s,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const l=new Ty(null,{height:s,width:o});l.resource=this.videoResource,this.videoResource.bind(l),this.sprite=new OT,this.sprite.visible=!1,this.sprite.texture=new ky(l),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.videoResource.source.addEventListener(t,()=>{"timeupdate"!==t||this.isPlaying||this.pause(),this.emit(t)})})}get currentTime(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){this.videoResource.source&&(this.videoResource.source.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.paused)||void 0===e||e}get ended(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.ended)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var t;return HA(this,void 0,void 0,(function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoResource.source;return!!(t&&t.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(jR.RtcAudioClazz&&(this.rtcAudio.play(),this.videoResource.source.volume=0),yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play())}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,jR.RtcAudioClazz&&this.rtcAudio.pause(),null===(t=this.videoResource.source)||void 0===t||t.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){var t;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.rtcAudio.destroy(),this.controller.destroy()}}var jA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class VA extends a.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.id=t.id,this.audio=t.audio,this.audioPlayer=new GA(this.audio.src),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:e,height:n,target:i}=t;this.controller=new UA({targetId:t.id,ctx:t.ctx,height:n,width:e,target:i,media:this,info:this.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play"))}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get paused(){return this.audioPlayer.isPaused}get ended(){return this.audioPlayer.isEnded}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return jA(this,void 0,void 0,(function*(){this.isPlaying=!0,this.audioPlayer.play()}))}pause(){this.isPlaying=!1,this.audioPlayer.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){this.audioPlayer.pause(),this.controller.destroy()}}class WA extends DA{constructor(t,e,n,i){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,n,i),this.isInteractiveOutside=!1,this.cmd=new xM(this),this.media=null==t?void 0:t.media,this.picFill=new vA(this.ctx,t.picFill,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1})}applyCommand(t,e){var n,i,r,o,s;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),i=Number(e[1]||"0");null===(n=this.mediaPlayer)||void 0===n||n.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(i)})}else"custom-pause"===t?null===(i=this.mediaPlayer)||void 0===i||i.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.pause(),null===(s=this.mediaPlayer)||void 0===s||s.seek(0))}renderPic(){var t,e,n,i,r;const{displayObject:o}=this.picFill;if(o){const s=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(o.width,o.height))&&s&&(o.mask=s,this.container.addChild(s)),o.width=this.designWidth,o.height=this.designHeight,o instanceof jE&&this.ctx.slideScopeEventHub.once("slide-render",t=>{this.ctx.slideIndex===t&&o.play()}),this.container.addChild(o),"video"===(null===(n=this.media)||void 0===n?void 0:n.type)&&this.media.src?(this.mediaPlayer=new zA({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:o,container:this.container,canvasElement:this.ctx.view}),null===(i=this.mediaPlayer)||void 0===i||i.sprite):"audio"===(null===(r=this.media)||void 0===r?void 0:r.type)&&this.media.src&&(this.mediaPlayer=new VA({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:o,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.isInteractiveOutside=this.container.interactive,this.container.interactive=!0,this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}}preRender(t){super.preRender(t)}subClassRender(){this.renderPic()}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var XA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class qA extends SM{constructor(t,e,n,i,r){super(t,e,n),this.children=[],this.cacheSprite=new OT,this.cacheContainer=new ty,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.container.name=t.id,this.cacheContainer.name=t.id+"-cache-container",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new vA(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(r)}createChildren(t){var e,n,i,r;const o={x:null!==(n=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:null!==(r=null===(i=this.json.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0};for(let e=0,n=this.json.children.length;e<n;e++)t.addSubMTask(()=>{const n=this.json.children[e];let i=null;return"Shape"===(null==n?void 0:n.type)?i=new DA(n,this.ctx,o,this.json.fillStyle):"Picture"===(null==n?void 0:n.type)?i=new WA(n,this.ctx,o,this.json.fillStyle):"Container"===(null==n?void 0:n.type)&&(i=new qA(n,this.ctx,o,this.json.fillStyle,t)),i&&this.children.push(i),Promise.resolve()})}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>(e.preRender(t),Promise.resolve()))}getBgElement(){return null}getIterateEntry(t,e,n){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}getTextElement(){return null}render(t){for(const e of this.children)e.render(t),t.addSubMTask(()=>XA(this,void 0,void 0,(function*(){var t;e.renderContainer&&this.cacheContainer.addChild(e.renderContainer),(e.json.hlinkHover||e.json.hlinkClick)&&(null===(t=e.hyperlink)||void 0===t||t.addProxy(this.container))})));t.addSubMTask(()=>XA(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer)})))}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class YA extends a.a{constructor(t,e,n,i){super(),this.cond={},this.timeoutIds=[],this.condHandle=t=>{if(t)if(t.delay&&t.delay>0){const e=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger())},t.delay);this.timeoutIds.push(e)}else this.cond[t.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=t,this.ctx=i,this.eventHubs=n,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=()=>this.condHandle(t);t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const t=this.triggerParams;this.triggerParams=void 0,this.emit("active",t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class ZA extends a.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new a.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var t,e,n,i,r,o;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.seekToStart(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.seekToStart(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var t,e,n,i;this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=i,this.json=e,this.ctx=s,this.globalEventHub=l,this.commonTimeNode=new wR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h}),this.bindShapeEvent(),this.nextConds=new YA("mainSeq",e.nextCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new YA("mainSeq",e.preCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(zR.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(zR.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",()=>{this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(zR.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(zR.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit(zR.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(zR.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const n=()=>{this.ctx.eventHub.emit(zR.userInput);const t=`shape ${e} onClick`,{mode:n}=this.ctx;"interactive"!==n&&"sync"!==n||this.ctx.eventHub.emit(zR.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==n&&"local"!==n||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",n),this.interactiveListeners.push([t,n])}}}})}setCurrentStep(t,e){this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let n=t;this.commonTimeNode.seekToStart();const{length:i}=this.commonTimeNode.children;if(-1===n&&(n=i-1),n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}function JA(t,e,n){const i=e.split(".");i.reduce((r,o,s)=>{if(r)return s!==i.length-1?r[o]:void(r[o]=n);console.warn(`${t} not support ${e}`)},t)}function KA(t,e){if(!e)return null;return e.split(".").reduce((n,i)=>{if(n)return n[i];console.warn(`${t} not support ${e}`)},t)}class $A{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new a.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){let e=t.id;"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:n,json:i,ctx:r,parent:o,eventHub:s,iterateType:l,iterateIndex:u,iterateId:h}=t;this.json=i,this.id=i.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=s,this.commonTimeNode=new wR({json:i.cBhvr.ctn,isSub:n,eventHubs:{global:s,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:l,iterateIndex:u,iterateId:h}),this.timingTarget=this.ctx.timingTargets.getTarget(i.cBhvr.target,e,{type:l,index:u,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class QA extends $A{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=KA(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&JA(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&JA(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&JA(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class tR{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const n=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(n,(e,n,i)=>`${n}math.${t}${i}`)}),new Function("vars","math","$","return "+e)}}class eR extends tR{constructor(t,e,n){super(t,e),this.value=t.val.value,n&&(this.fmla=this.parseFmla(n))}resolveValue(){return this.value}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue()-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}class nR extends tR{constructor(t,e){var n;super(t,e),this.value=null===(n=t.val)||void 0===n?void 0:n.value}interpolationFrom(t,e,n){let i=t.resolveValue(n);return e>this.time&&(i=this.resolveValue()),i}resolveValue(){return this.value||""}}class iR extends tR{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue(n)-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}class rR extends tR{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return PM(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}class oR extends $A{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=KA(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,n,i;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t,i=this.keyFrames.findIndex(t=>n<=t[0]),{attrList:r}=this.json.cBhvr;if(i<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&JA(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=i-1,s=this.keyFrames[i],a=this.keyFrames[o]||s,l=s[0]-a[0]==0?1:(n-a[0])/(s[0]-a[0]),u=s[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&JA(this.timingTarget,r[0],u)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&JA(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new iR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new iR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const n={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new iR(n,this.timingTarget);this.keyFrames.push([n.time,t])}const i={time:1,val:{type:"string",value:((null===(t=n.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new iR(i,this.timingTarget);this.keyFrames.push([i.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let n=null;"string"===t.val.type?"num"===e?n=new iR(t,this.timingTarget):"str"===e&&(n=new nR(t,this.timingTarget)):"number"===t.val.type?n=new eR(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,n=new rR(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),n&&this.keyFrames.push([t.time,n])}}}var sR=n(51),aR=n.n(sR),lR=n(52),uR=n.n(lR);class hR extends Gx{constructor(){super(uR.a,aR.a,{percent:0,direction:1,transition:0})}set transition(t){this.uniforms.transition=t}set percent(t){this.uniforms.percent=t}set direction(t){this.uniforms.direction=t}}var cR=n(53),dR=n.n(cR);class pR extends Gx{constructor(){super(void 0,dR.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class fR extends $A{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;this.filter&&(this.filter.percent=this.commonTimeNode.applyTimeFilter(n)),n>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let n=0;"out"===t.json.transition?n=-1:"in"===t.json.transition&&(n=1);const i=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(i){const t=i[1],e=i[3];if("wipe"===t){const n=new hR;"up"===e?n.direction=1:"down"===e?n.direction=2:"left"===e?n.direction=3:"right"===e&&(n.direction=4),this.filter=n,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new pR;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=n)}}get modifyAttrKey(){return this.filterType}}class mR extends $A{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:t,delta:e})=>{var n;const i=e/t,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.ppt_x=this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=this.timingTarget.design_ppt_y)},this.onSeekToEnd=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new xc,n=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(n)for(const t of n){const[n,...i]=t.trim().replace(/\s+/g," ").split(" ");if("M"===n){const[t,n]=i.map(t=>Number(t));e.moveTo(t,n)}else if("L"===n){const[t,n]=i.map(t=>Number(t));e.lineTo(t,n)}else if("C"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t));e.bezierCurveTo(t,n,r,o,s,a)}else if("Z"===n)e.closePath();else if("E"===n)console.warn("not implements");else if("c"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,n+l.y,r+l.x,o+l.y,s+l.x,a+l.y)}else if("l"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.lineTo(n+t.x,r+t.y)}else if("m"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.moveTo(n+t.x,r+t.y)}}this.path=e}}class gR extends $A{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var n,i,r,o,s;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(n=this.from)&&void 0!==n?n:{x:null!==(r=null===(i=this.startVal)||void 0===i?void 0:i.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class vR extends $A{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const[e]=this.json.cBhvr.attrList[0].split(".");JA(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");JA(this.timingTarget,t+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;if(this.timingTarget&&(this.onTimeUpdate({duration:1,delta:0}),(null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase())){const[t]=this.json.cBhvr.attrList[0].split(".");JA(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=KA(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const n=t/e;this.to.interpolationFrom(this.from,n,this.target),this.timingTarget&&JA(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new MM(this.json.from),this.to=new MM(this.json.to),this.by=new MM(this.json.by),this.target=new MM):(this.from=new EM(this.json.from),this.to=new EM(this.json.to),this.by=new EM(this.json.by),this.target=new EM),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=KA(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class _R extends $A{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;let i=0,r=0;if(void 0!==this.from&&void 0!==this.to){i=this.from,r=this.to;const t=i+(r-i)*n;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*n-this.lastVal;this.lastVal=this.by*n,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Object(l.isNumber)(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class yR extends $A{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:n,cmdType:i}=this.json;!this.isApplied&&n&&i&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(n,i))},this.onSeekToStart=()=>{var t,e;null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,n,i;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(i=null===(n=this.json)||void 0===n?void 0:n.cmdType)&&void 0!==i?i:"")}}class xR{constructor(t){this.runtimeNodeEventHub=new a.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:n,isSub:i,eventHub:r,ctx:o,parent:s,iterateType:l,iterateIndex:u,iterateId:h}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new wR({json:e.cMediaNode.ctn,isSub:i,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:n,iterateType:l,iterateIndex:u,iterateId:h}),this.audio=new GA(e.cMediaNode.tgtEl),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy)}}var bR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class wR extends a.a{constructor(t){var e,n;super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(mv.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:i,isIterate:r,ctx:o,eventHubs:s,parent:a,json:l,iterateType:u,iterateId:h,iterateIndex:c}=t;this.isSub=i,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=o,this.iterateIndex=c,this.eventHubs=s,this.iterateType=u,this.iterateId=h,this.tmFilter=null!==(n=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==n?n:[];const d=Number(this.json.dur),p=this.json.spd||1;this.isNegativeSpeed=p<0,Number.isNaN(d)||(this.duration=d/Math.abs(p)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new YA(this.json.id||"",l.stCondLst,s,this.ctx),this.endConds=new YA(this.json.id||"",l.endCondLst,s,this.ctx),l.endSync&&(this.endSync=new YA(this.json.id||"",[l.endSync],s,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=iM();let e=!0,n=0;const i=n=>{n===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",i))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",i);e;){const e=JSON.parse(JSON.stringify(this.json)),i=new wR({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:n,iterateId:t});this.iterateShadows[n]=i,n+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let n=null;const i={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId};return"seq"===t.type?n=new ZA(i):"par"===t.type?n=new TR(i):"set"===t.type?n=new QA(i):"anim"===t.type?n=new oR(i):"animEffect"===t.type?n=new fR(i):"animMotion"===t.type?n=new mR(i):"animScale"===t.type?n=new gR(i):"animClr"===t.type?n=new vR(i):"animRot"===t.type?n=new _R(i):"cmd"===t.type?n=new yR(i):"audio"===t.type&&(n=new xR(i)),n}createSubList(t){this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return(e=t,function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(e)?e.cBhvr.ctn:function(t){var e,n;return!!(null===(n=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===n?void 0:n.ctn)}(e)?e.cMediaNode.ctn:e.ctn).presetOrder;var e}if(t&&t[0]&&e(t[0])){[...t].sort((t,n)=>{var i,r;return(null!==(i=e(t))&&void 0!==i?i:0)-(null!==(r=e(n))&&void 0!==r?r:0)}).forEach(e=>{const n=t.findIndex(t=>t===e),i=this.createTimeNode(e,!1);i&&(this.bindCommonTimeNodeEvent(i),this.children[n]=i)})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(zR.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(zR.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(zR.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return bR(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>Object(l.isNumber)(t[0])&&Object(l.isNumber)(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const n=this.tmFilter[e];if(t<n[0]){const i=this.tmFilter[e-1];return(t-i[0])/(n[0]-i[0])*(n[1]-i[1])+i[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=n=>{n.forEach(n=>{var i,r,o;n.cBhvr&&n.cBhvr.target&&t.findIndex(t=>t.id===n.cBhvr.target.id)<0&&t.push(n.cBhvr.target),(null===(r=null===(i=null==n?void 0:n.cBhvr)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.childTnLst)&&n.cBhvr.ctn.childTnLst.length>0&&e(n.cBhvr.ctn.childTnLst),(null===(o=null==n?void 0:n.ctn)||void 0===o?void 0:o.childTnLst)&&n.ctn.childTnLst.length>0&&e(n.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,n=!0;for(;n;){const i=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});i&&(this.setPreStyleForTarget(i),e+=1),n=!!i}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,n;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const i=null===(n=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===n?void 0:n.filter(t=>"set"===t.type&&"visible"===t.to);(null==i?void 0:i.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const n=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];n&&this.endConds.condHandle(n),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(zR.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const n=this.json.autoRev||t;if(n?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(n,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(n,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class TR extends a.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new a.a;const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h}=t;this.id=e.ctn.id,this.json=e,this.ctx=s,this.isIterate=i,this.globalEventHub=l,this.commonTimeNode=new wR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var SR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class ER{constructor(t,e,n){this.json=t,this.ctx=n,this.globalEventHub=e;const i=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);i&&(this.tmRoot=new TR({json:i,isSub:!1,isIterate:!1,eventHub:e,ctx:n,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var n,i,r;return"seq"===(null===(n=e.json)||void 0===n?void 0:n.type)&&(null===(r=null===(i=e.json)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return SR(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var n;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(n=this.mainSeq)||void 0===n||n.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,n){const i=this.findSeq(t);i&&i.setCurrentStep(e,n)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var MR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class AR extends qA{constructor(t,e,n,i){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,n,void 0,i),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.globalEventHub=new a.a,this.json=t,e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new AT;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Object(l.isArray)(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(zR.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(zR.requestNextSlide)})}get interactiveContainer(){return this.container}render(t){this.isRendered||(this.isRendered=!0,super.render(t),t.addSubMTask(()=>MR(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")}))))}createTiming(){this.json.timing&&!this.timing&&(this.timing=new ER(this.json.timing,this.globalEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var n;null===(n=this.timing)||void 0===n||n.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.globalEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.globalEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?(this.globalEventHub.emit("shape slide onStopAudio"),this.globalEventHub.emit("shape slide onNext")):this.ctx.eventHub.emit(zR.requestNextSlide)}prevStep(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?(this.globalEventHub.emit("shape slide onStopAudio"),this.globalEventHub.emit("shape slide onPrev")):this.ctx.eventHub.emit(zR.requestPrevSlide)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.timing)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){return MR(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?yield n.play():yield n.pause())}))}setMediaCurrentTime(t,e){const n=this.ctx.medias[t];n&&n.seek(e)}}class RR{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}var CR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const PR=t=>new Promise(e=>setTimeout(e,t));class IR extends a.a{constructor(){super(...arguments),this.uuid=iM(),this.isCancel=!1,this.tasks=[]}addMTask(t){this.tasks.push({fn:t,state:"wait",sub:[]})}addSubMTask(t){let e=this.tasks.findIndex(t=>"running"===t.state);e<0&&(e=0),this.tasks[e].sub.push({fn:t,state:"wait",sub:[]})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(t=>{console.log(t)}))}applyAll(){return CR(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield PR(16);else{const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",yield t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(t=>{console.log(t)}))}this.isCancel||this.emit("task-finish")}))}}var OR=n(54);const LR=new(n.n(OR).a),NR=LR.getDevice(),DR=LR.getBrowser(),FR=LR.getOS(),BR={isDesktop(){let t=!0;return"mobile"===NR.type&&(t=!1),/Samsung/.test(DR.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),FR.name&&/iOS/.test(FR.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),FR.name&&/android/i.test(FR.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const n=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(n){const t=n.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var UR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class kR{constructor(t,e,n,i,r,o,s){this.loader=t,this.mode=e,this.renderer=n,this.ticker=i,this.view=r,this.clock=o,this.objPoolGroup=s,this.currentStageIndex=0,this.cacheCount=BR.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.microTaskManager=new RR(i)}setSnapshotCache(t){this.snapshotCache=t}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const e=new aM(this.loader),n=new a.a,i={mode:this.mode,renderer:this.renderer,graphicsTexture:new gM,stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new _M(n),eventHub:n,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new vM,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new a.a};return this.stageCtxs[t]=i,Promise.resolve()})}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>UR(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height})))}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],{spriteTexture:i}=this.stageCtxs[t],{coloredSheets:r,sheets:o}=n,s=r||o;return s&&s.forEach(t=>{e.addSubMTask(()=>i.loadSpriteSheetItem(this.url,this.taskId,t))}),Promise.resolve()})}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],i=this.stageCtxs[t],r=new AR(n,i,{x:0,y:0},e);return this.stageImpls[t]=r,Promise.resolve()})}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()))}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>UR(this,void 0,void 0,(function*(){const n=this.stageCtxs[t];n.graphicsTexture.pack().forEach((t,i)=>{e.addSubMTask(()=>n.graphicsTexture.render(t,i,this.objPoolGroup))})})))}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>UR(this,void 0,void 0,(function*(){const n=this.stageImpls[t],i=this.stageCtxs[t];yield n.render(e),e.addSubMTask(()=>UR(this,void 0,void 0,(function*(){var e,r;if(!(yield null===(e=this.snapshotCache)||void 0===e?void 0:e.getItem(t.toString()+"-start"))&&jR.platform.isLowGpuMemory()){n.createTiming(),n.container.visible=!0,n.collectMainSeqStartValue(),n.setMainSeqStep(0,"start");const e=Hy.create({width:n.json.width,height:n.json.height,resolution:1});i.renderer.render(n.container,{renderTexture:e});const o=i.renderer.plugins.extract.base64(e,"image/jpeg");yield null===(r=this.snapshotCache)||void 0===r?void 0:r.setItem(t.toString()+"-start",o),n.container.visible=!1,e.destroy(),n.timing&&(n.timing.destroy(),n.timing=void 0)}})))})))}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const n=new IR;return this.stageStates[t]={state:"load",task:n},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(n),e?n.applyAll():new Promise(e=>{n.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return UR(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}}var GR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};r.skipHello();const HR={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip"},zR={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",userInput:"userInput"};class jR extends a.a{constructor(t,e={}){super(),this.loader=new KE(!0),this.transactionPlayer=new og,this.transactionSprite=new OT,this.isForward=!0,this.drawCall=0,this.scale=1,this.prevSlideBase64=null,this.fps=new qE,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.mode=t;let n=Math.max(window.devicePixelRatio,2);BR.isDesktop()||(n=1),this.config={minFPS:Object(l.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(l.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(l.isUndefined)(e.resolution)?n:e.resolution,autoFPS:!Object(l.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(l.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(l.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor},this.app=new Lb({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const i=this.app.renderer,{drawElements:r}=i.gl;i.gl.drawElements=(...t)=>{r.call(i.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,n=Math.max(t,e-.1);n>=t&&this.updateResolution(n)}if(this.config.autoFPS){const t=14,{minFPS:e,maxFPS:n}=this.app.ticker,i=Math.max(t,e-2),r=Math.max(t,n-2);i>=t&&r>=t&&(this.app.ticker.minFPS=i,this.app.ticker.maxFPS=r)}}else if(t>this.config.maxFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,n=Math.min(t,e+.1);n<=this.config.resolution&&this.updateResolution(n)}if(this.config.autoFPS){const t=this.config.minFPS,e=this.config.maxFPS,{minFPS:n,maxFPS:i}=this.app.ticker,r=Math.min(t,n+2),o=Math.min(e,i+2);r<=t&&o<=e&&(this.app.ticker.minFPS=r,this.app.ticker.maxFPS=o)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,ey.LOW),this.clock=new oM(this.app.ticker),this.objPoolGroup=iM(),this.stagePool=new kR(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup)}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}updateConfig(t){Object(l.isUndefined)(t.minFPS)||(this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),Object(l.isUndefined)(t.maxFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS),Object(l.isUndefined)(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(l.isUndefined)(t.autoFPS)||(this.config.autoFPS=t.autoFPS),Object(l.isUndefined)(t.autoResolution)||(this.config.autoResolution=t.autoResolution),Object(l.isUndefined)(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor)}preload(t){return GR(this,void 0,void 0,(function*(){t<1||t>this.slideCount||!this.loader.cache||(yield this.stagePool.preload(t))}))}setResourceData(t,e){this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.loader.bindTask(t);const n=this.taskId;this.snapshotCache=XE.a.createInstance({name:"_slide_snapshot_cache_",storeName:n,driver:XE.a.INDEXEDDB,version:1}),ZE.updateActiveTime("_slide_snapshot_cache_",n).catch(()=>{}),this.stagePool.setSnapshotCache(this.snapshotCache)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t,e=!1){var n,i;return GR(this,void 0,void 0,(function*(){this.emit(zR.renderStart,t);const r=yield this.stagePool.getStage(t);this.translateEvent(r.ctx.eventHub,[zR.mainSeqStepChange,zR.mainSeqStateChange,zR.hyperlinkTrigger,zR.interactiveSeqAction,zR.mainSeqStepStart,zR.mainSeqStepEnd,zR.animateStart,zR.animateEnd,zR.mediaPlay,zR.mediaPause,zR.mediaSeek,zR.requestGotoSlide,zR.requestNextSlide,zR.requestPrevSlide,zR.interactiveSeqStateChange,zR.userInput]),this.currentIndex=Number(t);const{width:o,height:s,slideCount:a}=r.json;this.slideCount=a,this.designWidth=o,this.designHeight=s,r.json.transition&&r.json.transition.type&&!this.prevSlideBase64&&this.currentStage&&(this.prevSlideBase64=this.getBase64(this.currentStage)),null===(n=this.currentStage)||void 0===n||n.clearOnSlideChange();const l=this.currentStage;this.currentStage=r,r.initOnReuse(),r.createTiming(),r.container.visible=!0,r.collectMainSeqStartValue(),this.isForward?r.setMainSeqStep(0,"start"):r.setMainSeqStep(-1,"end");let u=null;if(r.json.transition&&r.json.transition.type){const n=t.toString()+(this.isForward||e?"-start":"-end"),r=yield null===(i=this.snapshotCache)||void 0===i?void 0:i.getItem(n);u=r||this.getBase64(this.currentStage)}r.container.visible=!1,this.app.stage.addChild(r.container);let{transition:h}=r.json;!this.isForward&&(null==l?void 0:l.json.transition)&&(h=l.json.transition),this.prevSlideBase64&&u&&h&&h.type&&l&&r&&(yield this.playTransaction(this.prevSlideBase64,u,h,l,r),this.prevSlideBase64=null),this.isForward?yield r.startTiming():r.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),r.container.visible=!0,l&&(l.setMainSeqStep(0,"start"),l.clearOnTransactionEnd(),this.app.stage.removeChild(l.container)),r.ctx.slideScopeEventHub.emit("slide-render",r.ctx.slideIndex),this.emit(zR.renderEnd,t),this.emit(zR.slideChange,t),this.preload(t+1).catch(()=>{}),this.preload(t-1).catch(()=>{})}))}getBase64(t){if(!t.container.transform)return null;const e=Hy.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),n}playTransaction(t,e,n,i,r){return GR(this,void 0,void 0,(function*(){const o=this.app.view.parentElement;if(t&&e&&o&&HR[n.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.transactionSprite.visible=!1,this.app.stage.addChild(this.transactionSprite);const o=this.transactionPlayer.renderer.domElement,s=ky.from(o),a=()=>s.update();return this.app.ticker.add(a),this.transactionSprite.texture=s,setTimeout(()=>{this.transactionSprite.visible=!0},100),new Promise(o=>{var s,l,u;null===(s=this.transactionPlayer)||void 0===s||s.play({reverse:!this.isForward,prevTextureUrl:t,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:HR[n.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:null===(u=null===(l=this.currentStage)||void 0===l?void 0:l.json.transition)||void 0===u?void 0:u.dur,delay:0,clearColor:this.config.transactionBgColor,onTransactionEnd:()=>{var t,e;o(),i.container.visible=!1,r.container.visible=!0,null===(t=this.app.stage)||void 0===t||t.removeChild(this.transactionSprite),null===(e=this.app.ticker)||void 0===e||e.remove(a)}})})}return Promise.resolve()}))}scaleView(t,e=!1){if(this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px"),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e)}}updateResolution(t){this.app.ticker.addOnce(()=>{let e=BR.isDesktop()?t:1;for(;e*this.designWidth>5120||e*this.designHeight>5120;)e-=.1;this.app.renderer.resolution=e,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight)})}nextStep(){var t;null===(t=this.currentStage)||void 0===t||t.nextStep()}prevStep(){var t;null===(t=this.currentStage)||void 0===t||t.prevStep()}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},ey.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.currentStage)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){var n;return GR(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMediaCurrentTime(t,e)}pause(){this.app.ticker.stop()}resume(){this.app.ticker.start()}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}createSnapshotForNextSlide(t){var e,n;return GR(this,void 0,void 0,(function*(){const i=this.nextSlideIndex,r=this.stagePool.getStageJson(i);if(r&&r.transition&&r.transition.type&&this.currentStage&&this.transactionPlayer){const i=t?this.currentStage.json.index+"-start":this.currentStage.json.index+"-end";if(this.currentStage.timing&&(t?this.currentStage.timing.mainSeqHasPrevStep():this.currentStage.timing.mainSeqHasNextStep()))this.prevSlideBase64=this.getBase64(this.currentStage);else{const t=yield null===(e=this.snapshotCache)||void 0===e?void 0:e.getItem(i);t?this.prevSlideBase64=t:(this.prevSlideBase64=this.getBase64(this.currentStage),null===(n=this.snapshotCache)||void 0===n||n.setItem(i,this.prevSlideBase64))}}}))}destroy(){var t;try{try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}pM.collectObjectByGroup(this.objPoolGroup),fM.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0})}catch(t){}}}jR.storeManager=ZE,jR.platform=BR,jR.RtcAudioClazz=null;var VR,WR=[],XR="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(VR||(VR={}));var qR,YR=function(t){return Object.freeze(t)},ZR=function(t,e){this.inlineSize=t,this.blockSize=e,YR(this)},JR=function(){function t(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,YR(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),KR=function(t){return t instanceof SVGElement&&"getBBox"in t},$R=function(t){if(KR(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},QR=function(t){var e,n;if(t instanceof Element)return!0;var i=null===(n=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(i&&t instanceof i.Element)},tC="undefined"!=typeof window?window:{},eC=new WeakMap,nC=/auto|scroll/,iC=/^tb|vertical/,rC=/msie|trident/i.test(tC.navigator&&tC.navigator.userAgent),oC=function(t){return parseFloat(t||"0")},sC=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new ZR((n?e:t)||0,(n?t:e)||0)},aC=YR({devicePixelContentBoxSize:sC(),borderBoxSize:sC(),contentBoxSize:sC(),contentRect:new JR(0,0,0,0)}),lC=function(t,e){if(void 0===e&&(e=!1),eC.has(t)&&!e)return eC.get(t);if($R(t))return eC.set(t,aC),aC;var n=getComputedStyle(t),i=KR(t)&&t.ownerSVGElement&&t.getBBox(),r=!rC&&"border-box"===n.boxSizing,o=iC.test(n.writingMode||""),s=!i&&nC.test(n.overflowY||""),a=!i&&nC.test(n.overflowX||""),l=i?0:oC(n.paddingTop),u=i?0:oC(n.paddingRight),h=i?0:oC(n.paddingBottom),c=i?0:oC(n.paddingLeft),d=i?0:oC(n.borderTopWidth),p=i?0:oC(n.borderRightWidth),f=i?0:oC(n.borderBottomWidth),m=c+u,g=l+h,v=(i?0:oC(n.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,w=r?g+_:0,T=i?i.width:oC(n.width)-b-x,S=i?i.height:oC(n.height)-w-y,E=T+m+x+v,M=S+g+y+_,A=YR({devicePixelContentBoxSize:sC(Math.round(T*devicePixelRatio),Math.round(S*devicePixelRatio),o),borderBoxSize:sC(E,M,o),contentBoxSize:sC(T,S,o),contentRect:new JR(c,l,T,S)});return eC.set(t,A),A},uC=function(t,e,n){var i=lC(t,n),r=i.borderBoxSize,o=i.contentBoxSize,s=i.devicePixelContentBoxSize;switch(e){case VR.DEVICE_PIXEL_CONTENT_BOX:return s;case VR.BORDER_BOX:return r;default:return o}},hC=function(t){var e=lC(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=YR([e.borderBoxSize]),this.contentBoxSize=YR([e.contentBoxSize]),this.devicePixelContentBoxSize=YR([e.devicePixelContentBoxSize])},cC=function(t){if($R(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},dC=function(){var t=1/0,e=[];WR.forEach((function(n){if(0!==n.activeTargets.length){var i=[];n.activeTargets.forEach((function(e){var n=new hC(e.target),r=cC(e.target);i.push(n),e.lastReportedSize=uC(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){n.callback.call(n.observer,i,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,i=e;n<i.length;n++){(0,i[n])()}return t},pC=function(t){WR.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(n){n.isActive()&&(cC(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))}))}))},fC=function(){var t,e=0;for(pC(e);WR.some((function(t){return t.activeTargets.length>0}));)e=dC(),pC(e);return WR.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:XR}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=XR),window.dispatchEvent(t)),e>0},mC=[],gC=function(t){if(!qR){var e=0,n=document.createTextNode("");new MutationObserver((function(){return mC.splice(0).forEach((function(t){return t()}))})).observe(n,{characterData:!0}),qR=function(){n.textContent=""+(e?e--:e++)}}mC.push(t),qR()},vC=0,_C={attributes:!0,characterData:!0,childList:!0,subtree:!0},yC=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],xC=function(t){return void 0===t&&(t=0),Date.now()+t},bC=!1,wC=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!bC){bC=!0;var n,i=xC(t);n=function(){var n=!1;try{n=fC()}finally{if(bC=!1,t=i-xC(),!vC)return;n?e.run(1e3):t>0?e.run(t):e.start()}},gC((function(){requestAnimationFrame(n)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,_C)};document.body?e():tC.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),yC.forEach((function(e){return tC.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),yC.forEach((function(e){return tC.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),TC=function(t){!vC&&t>0&&wC.start(),!(vC+=t)&&wC.stop()},SC=function(){function t(t,e){this.target=t,this.observedBox=e||VR.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=uC(this.target,this.observedBox,!0);return t=this.target,KR(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),EC=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},MC=new WeakMap,AC=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},RC=function(){function t(){}return t.connect=function(t,e){var n=new EC(t,e);MC.set(t,n)},t.observe=function(t,e,n){var i=MC.get(t),r=0===i.observationTargets.length;AC(i.observationTargets,e)<0&&(r&&WR.push(i),i.observationTargets.push(new SC(e,n&&n.box)),TC(1),wC.schedule())},t.unobserve=function(t,e){var n=MC.get(t),i=AC(n.observationTargets,e),r=1===n.observationTargets.length;i>=0&&(r&&WR.splice(WR.indexOf(n),1),n.observationTargets.splice(i,1),TC(-1))},t.disconnect=function(t){var e=this,n=MC.get(t);n.observationTargets.slice().forEach((function(n){return e.unobserve(t,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},t}(),CC=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");RC.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!QR(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");RC.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!QR(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");RC.unobserve(this,t)},t.prototype.disconnect=function(){RC.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),PC=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},IC=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},OC=function(){function t(t,e,n,i,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=i,this.id=r}return t.prototype.apply=function(){return PC(this,void 0,void 0,(function(){var t;return IC(this,(function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}}))}))},t}(),LC=function(){function t(){var t=this;this.eventHub=new a.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var n,i=t.tasks.findIndex((function(t){return t.index===e.index})),r=i+1;r>=0&&(null===(n=t.tasks[r])||void 0===n||n.apply()),i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var n=e.task,i=t.tasks.findIndex((function(t){return t.index===n.index}));i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,i=0,r=this.tasks.length;i<r;i++)"idle"===this.tasks[i].state&&"idle"===(null===(t=this.tasks[i+1])||void 0===t?void 0:t.state)&&n.add(i);Array.from(n).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,n){var i=new OC(this.index++,e,t,this.eventHub,n);this.tasks.push(i),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&i.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t}();function NC(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),u=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+",a:"+s+"}":"unknown format"}var DC=Array.prototype.forEach,FC=Array.prototype.slice,BC={BREAK:{},extend:function(t){return this.each(FC.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(FC.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=FC.call(arguments);return function(){for(var e=FC.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(DC&&t.forEach&&t.forEach===DC)t.forEach(e,n);else if(t.length===t.length+0){var i,r=void 0;for(r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){var r=this,o=arguments;function s(){i=null,n||t.apply(r,o)}var a=n||!i;clearTimeout(i),i=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():FC.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},UC=[{litmus:BC.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:NC},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:NC},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:NC},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:NC}}},{litmus:BC.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:BC.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:BC.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(BC.isNumber(t.r)&&BC.isNumber(t.g)&&BC.isNumber(t.b)&&BC.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(BC.isNumber(t.r)&&BC.isNumber(t.g)&&BC.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(BC.isNumber(t.h)&&BC.isNumber(t.s)&&BC.isNumber(t.v)&&BC.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(BC.isNumber(t.h)&&BC.isNumber(t.s)&&BC.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],kC=void 0,GC=void 0,HC=function(){GC=!1;var t=arguments.length>1?BC.toArray(arguments):arguments[0];return BC.each(UC,(function(e){if(e.litmus(t))return BC.each(e.conversions,(function(e,n){if(kC=e.read(t),!1===GC&&!1!==kC)return GC=kC,kC.conversionName=n,kC.conversion=e,BC.BREAK})),BC.BREAK})),GC},zC=void 0,jC={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(zC=8*e)|t&~(255<<zC)}},VC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},WC=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},XC=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),qC=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0},YC=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},ZC=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},JC=function(){function t(){if(WC(this,t),this.__state=HC.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return XC(t,[{key:"toString",value:function(){return NC(this)}},{key:"toHexString",value:function(){return NC(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function KC(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||JC.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(JC.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function $C(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||JC.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(JC.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}JC.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=jC.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");BC.extend(t.__state,jC.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},JC.recalculateHSV=function(t){var e=jC.rgb_to_hsv(t.r,t.g,t.b);BC.extend(t.__state,{s:e.s,v:e.v}),BC.isNaN(e.h)?BC.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},JC.COMPONENTS=["r","g","b","h","s","v","hex","a"],KC(JC.prototype,"r",2),KC(JC.prototype,"g",1),KC(JC.prototype,"b",0),$C(JC.prototype,"h"),$C(JC.prototype,"s"),$C(JC.prototype,"v"),Object.defineProperty(JC.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(JC.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=jC.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var QC=function(){function t(e,n){WC(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return XC(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),tP={};BC.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){BC.each(t,(function(t){tP[t]=e}))}));var eP=/(\d+(\.\d+)?)px/;function nP(t){if("0"===t||BC.isUndefined(t))return 0;var e=t.match(eP);return BC.isNull(e)?0:parseFloat(e[1])}var iP={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,n){var i=n,r=e;BC.isUndefined(r)&&(r=!0),BC.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=tP[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var u=s.initKeyboardEvent||s.initKeyEvent;BC.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),u(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}BC.defaults(s,i),t.dispatchEvent(s)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),iP},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),iP},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return iP},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return iP},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return nP(e["border-left-width"])+nP(e["border-right-width"])+nP(e["padding-left"])+nP(e["padding-right"])+nP(e.width)},getHeight:function(t){var e=getComputedStyle(t);return nP(e["border-top-width"])+nP(e["border-bottom-width"])+nP(e["padding-top"])+nP(e["padding-bottom"])+nP(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},rP=function(t){function e(t,n){WC(this,e);var i=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),iP.bind(i.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return YC(e,t),XC(e,[{key:"setValue",value:function(t){var n=qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(QC),oP=function(t){function e(t,n,i){WC(this,e);var r=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,s=r;if(r.__select=document.createElement("select"),BC.isArray(o)){var a={};BC.each(o,(function(t){a[t]=t})),o=a}return BC.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),r.updateDisplay(),iP.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return YC(e,t),XC(e,[{key:"setValue",value:function(t){var n=qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return iP.isActive(this.__select)?this:(this.__select.value=this.getValue(),qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(QC),sP=function(t){function e(t,n){WC(this,e);var i=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;function o(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),iP.bind(i.__input,"keyup",o),iP.bind(i.__input,"change",o),iP.bind(i.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),iP.bind(i.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return YC(e,t),XC(e,[{key:"updateDisplay",value:function(){return iP.isActive(this.__input)||(this.__input.value=this.getValue()),qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(QC);function aP(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var lP=function(t){function e(t,n,i){WC(this,e);var r=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,BC.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=aP(r.__impliedStep),r}return YC(e,t),XC(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=aP(t),this}}]),e}(QC);var uP=function(t){function e(t,n,i){WC(this,e);var r=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function u(){iP.unbind(window,"mousemove",l),iP.unbind(window,"mouseup",u),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),iP.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);BC.isNaN(t)||o.setValue(t)})),iP.bind(r.__input,"blur",(function(){a()})),iP.bind(r.__input,"mousedown",(function(t){iP.bind(window,"mousemove",l),iP.bind(window,"mouseup",u),s=t.clientY})),iP.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return YC(e,t),XC(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(lP);function hP(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var cP=function(t){function e(t,n,i,r,o){WC(this,e);var s=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(hP(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function u(){iP.unbind(window,"mousemove",l),iP.unbind(window,"mouseup",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(hP(e,n.left,n.right,a.__min,a.__max))}function c(){iP.unbind(window,"touchmove",h),iP.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),iP.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),iP.bind(window,"mousemove",l),iP.bind(window,"mouseup",u),l(t)})),iP.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;iP.bind(window,"touchmove",h),iP.bind(window,"touchend",c),h(t)})),iP.addClass(s.__background,"slider"),iP.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return YC(e,t),XC(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",qC(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(lP),dP=function(t){function e(t,n,i){WC(this,e);var r=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,iP.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),iP.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return YC(e,t),XC(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(QC),pP=function(t){function e(t,n){WC(this,e);var i=ZC(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new JC(i.getValue()),i.__temp=new JC(0);var r=i;i.domElement=document.createElement("div"),iP.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",iP.bind(i.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),iP.bind(i.__input,"blur",c),iP.bind(i.__selector,"mousedown",(function(){iP.addClass(this,"drag").bind(window,"mouseup",(function(){iP.removeClass(r.__selector,"drag")}))})),iP.bind(i.__selector,"touchstart",(function(){iP.addClass(this,"drag").bind(window,"touchend",(function(){iP.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){p(t),iP.bind(window,"mousemove",p),iP.bind(window,"touchmove",p),iP.bind(window,"mouseup",u),iP.bind(window,"touchend",u)}function l(t){f(t),iP.bind(window,"mousemove",f),iP.bind(window,"touchmove",f),iP.bind(window,"mouseup",h),iP.bind(window,"touchend",h)}function u(){iP.unbind(window,"mousemove",p),iP.unbind(window,"touchmove",p),iP.unbind(window,"mouseup",u),iP.unbind(window,"touchend",u),d()}function h(){iP.unbind(window,"mousemove",f),iP.unbind(window,"touchmove",f),iP.unbind(window,"mouseup",h),iP.unbind(window,"touchend",h),d()}function c(){var t=HC(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return BC.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),BC.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),BC.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),BC.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),BC.extend(s.style,{width:"100%",height:"100%",background:"none"}),mP(s,"top","rgba(0,0,0,0)","#000"),BC.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",BC.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),iP.bind(i.__saturation_field,"mousedown",a),iP.bind(i.__saturation_field,"touchstart",a),iP.bind(i.__field_knob,"mousedown",a),iP.bind(i.__field_knob,"touchstart",a),iP.bind(i.__hue_field,"mousedown",l),iP.bind(i.__hue_field,"touchstart",l),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return YC(e,t),XC(e,[{key:"updateDisplay",value:function(){var t=HC(this.getValue());if(!1!==t){var e=!1;BC.each(JC.COMPONENTS,(function(n){if(!BC.isUndefined(t[n])&&!BC.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&BC.extend(this.__color.__state,t)}BC.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;BC.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,mP(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),BC.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(QC),fP=["-moz-","-o-","-webkit-","-ms-",""];function mP(t,e,n,i){t.style.background="",BC.each(fP,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "}))}var gP=function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}},vP='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',_P=function(t,e){var n=t[e];return BC.isArray(arguments[2])||BC.isObject(arguments[2])?new oP(t,e,arguments[2]):BC.isNumber(n)?BC.isNumber(arguments[2])&&BC.isNumber(arguments[3])?BC.isNumber(arguments[4])?new cP(t,e,arguments[2],arguments[3],arguments[4]):new cP(t,e,arguments[2],arguments[3]):BC.isNumber(arguments[4])?new uP(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new uP(t,e,{min:arguments[2],max:arguments[3]}):BC.isString(n)?new sP(t,e):BC.isFunction(n)?new dP(t,e,""):BC.isBoolean(n)?new rP(t,e):null};var yP=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},xP=function(){function t(){WC(this,t),this.backgroundElement=document.createElement("div"),BC.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),iP.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),BC.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;iP.bind(this.backgroundElement,"click",(function(){e.hide()}))}return XC(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),BC.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",iP.unbind(t.domElement,"webkitTransitionEnd",e),iP.unbind(t.domElement,"transitionend",e),iP.unbind(t.domElement,"oTransitionEnd",e)};iP.bind(this.domElement,"webkitTransitionEnd",e),iP.bind(this.domElement,"transitionend",e),iP.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-iP.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-iP.getHeight(this.domElement)/2+"px"}}]),t}();gP(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var bP=function(){try{return!!window.localStorage}catch(t){return!1}}(),wP=void 0,TP=!0,SP=void 0,EP=!1,MP=[],AP=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),iP.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=BC.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=BC.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),BC.isUndefined(i.load)?i.load={preset:"Default"}:i.preset&&(i.load.preset=i.preset),BC.isUndefined(i.parent)&&i.hideable&&MP.push(this),i.resizable=BC.isUndefined(i.parent)&&i.resizable,i.autoPlace&&BC.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=bP&&"true"===localStorage.getItem(LP(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,UP(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,a&&(a.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?iP.addClass(n.__ul,t.CLASS_CLOSED):iP.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(t){bP&&(o=t,t?iP.bind(window,"unload",s):iP.unbind(window,"unload",s),localStorage.setItem(LP(n,"isLocal"),t))}}}),BC.isUndefined(i.parent)){if(this.closed=i.closed||!1,iP.addClass(this.domElement,t.CLASS_MAIN),iP.makeSelectable(this.domElement,!1),bP&&o){n.useLocalStorage=!0;var l=localStorage.getItem(LP(this,"gui"));l&&(i.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,iP.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(iP.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(iP.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),iP.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===i.closed&&(i.closed=!0);var u=document.createTextNode(i.name);iP.addClass(u,"controller-name"),a=RP(n,u);iP.addClass(this.__ul,t.CLASS_CLOSED),iP.addClass(a,"title"),iP.bind(a,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),i.closed||(this.closed=!1)}i.autoPlace&&(BC.isUndefined(i.parent)&&(TP&&(SP=document.createElement("div"),iP.addClass(SP,"dg"),iP.addClass(SP,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(SP),TP=!1),SP.appendChild(this.domElement),iP.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||UP(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},iP.bind(window,"resize",this.__resizeHandler),iP.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),iP.bind(this.__ul,"transitionend",this.__resizeHandler),iP.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&BP(this),s=function(){bP&&"true"===localStorage.getItem(LP(n,"isLocal"))&&localStorage.setItem(LP(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,i.parent||((r=n.getRoot()).width+=1,BC.defer((function(){r.width-=1})))};function RP(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function CP(t){iP.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&iP.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function PP(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function IP(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[i]&&void 0!==s[i][e.property]){var a=s[i][e.property];e.initialValue=a,e.setValue(a)}}}}function OP(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new pP(e,n);else{var o=[e,n].concat(i.factoryArgs);r=_P.apply(t,o)}i.before instanceof QC&&(i.before=i.before.__li),IP(t,r),iP.addClass(r.domElement,"c");var s=document.createElement("span");iP.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=RP(t,a,i.before);return iP.addClass(l,AP.CLASS_CONTROLLER_ROW),r instanceof pP?iP.addClass(l,"color"):iP.addClass(l,VC(r.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,BC.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),OP(t,n.object,n.property,{before:i,factoryArgs:[BC.toArray(arguments)]})}if(BC.isArray(e)||BC.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),OP(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof cP){var i=new uP(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});BC.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),iP.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof uP){var r=function(e){if(BC.isNumber(n.__min)&&BC.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=OP(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=BC.compose(r,n.min),n.max=BC.compose(r,n.max)}else n instanceof rP?(iP.bind(e,"click",(function(){iP.fakeEvent(n.__checkbox,"click")})),iP.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof dP?(iP.bind(e,"click",(function(){iP.fakeEvent(n.__button,"click")})),iP.bind(e,"mouseover",(function(){iP.addClass(n.__button,"hover")})),iP.bind(e,"mouseout",(function(){iP.removeClass(n.__button,"hover")}))):n instanceof pP&&(iP.addClass(e,"color"),n.updateDisplay=BC.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=BC.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&PP(t.getRoot(),!0),e}),n.setValue)}(t,l,r),t.__controllers.push(r),r}function LP(t,e){return document.location.href+"."+e}function NP(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function DP(t,e){e.style.display=t.useLocalStorage?"block":"none"}function FP(t){var e=t.__save_row=document.createElement("li");iP.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),iP.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",iP.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",iP.addClass(i,"button"),iP.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",iP.addClass(r,"button"),iP.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",iP.addClass(o,"button"),iP.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?BC.each(t.load.remembered,(function(e,n){NP(t,n,n===t.preset)})):NP(t,"Default",!1),iP.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),bP){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(LP(0,"isLocal"))&&l.setAttribute("checked","checked"),DP(t,a),iP.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,DP(t,a)}))}var u=document.getElementById("dg-new-constructor");iP.bind(u,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||wP.hide()})),iP.bind(n,"click",(function(){u.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),wP.show(),u.focus(),u.select()})),iP.bind(i,"click",(function(){t.save()})),iP.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),iP.bind(o,"click",(function(){t.revert()}))}function BP(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function i(){iP.removeClass(t.__closeButton,AP.CLASS_DRAG),iP.unbind(window,"mousemove",n),iP.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),e=r.clientX,iP.addClass(t.__closeButton,AP.CLASS_DRAG),iP.bind(window,"mousemove",n),iP.bind(window,"mouseup",i),!1}t.__resize_handle=document.createElement("div"),BC.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),iP.bind(t.__resize_handle,"mousedown",r),iP.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function UP(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function kP(t,e){var n={};return BC.each(t.__rememberedObjects,(function(i,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];BC.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[r]=o})),n}AP.toggleHide=function(){EP=!EP,BC.each(MP,(function(t){t.domElement.style.display=EP?"none":""}))},AP.CLASS_AUTO_PLACE="a",AP.CLASS_AUTO_PLACE_CONTAINER="ac",AP.CLASS_MAIN="main",AP.CLASS_CONTROLLER_ROW="cr",AP.CLASS_TOO_TALL="taller-than-window",AP.CLASS_CLOSED="closed",AP.CLASS_CLOSE_BUTTON="close-button",AP.CLASS_CLOSE_TOP="close-top",AP.CLASS_CLOSE_BOTTOM="close-bottom",AP.CLASS_DRAG="drag",AP.DEFAULT_WIDTH=245,AP.TEXT_CLOSED="Close Controls",AP.TEXT_OPEN="Open Controls",AP._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||AP.toggleHide()},iP.bind(window,"keydown",AP._keydownHandler,!1),BC.extend(AP.prototype,{add:function(t,e){return OP(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return OP(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;BC.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&SP.removeChild(this.domElement);var t=this;BC.each(this.__folders,(function(e){t.removeFolder(e)})),iP.unbind(window,"keydown",AP._keydownHandler,!1),CP(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new AP(e);this.__folders[t]=n;var i=RP(this,n.domElement);return iP.addClass(i,"folder"),n},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],CP(t);var e=this;BC.each(t.__folders,(function(e){t.removeFolder(e)})),BC.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=iP.getOffset(t.__ul).top,n=0;BC.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=iP.getHeight(e))})),window.innerHeight-e-20<n?(iP.addClass(t.domElement,AP.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(iP.removeClass(t.domElement,AP.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&BC.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:BC.debounce((function(){this.onResize()}),50),remember:function(){if(BC.isUndefined(wP)&&((wP=new xP).domElement.innerHTML=vP),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;BC.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&FP(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&UP(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=kP(this)),t.folders={},BC.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=kP(this),PP(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=kP(this,!0)),this.load.remembered[t]=kP(this),this.preset=t,NP(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){BC.each(this.__controllers,(function(e){this.getRoot().load.remembered?IP(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),BC.each(this.__folders,(function(t){t.revert(t)})),t||PP(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&yP.call(window,(function(){t(e)}));BC.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){BC.each(this.__controllers,(function(t){t.updateDisplay()})),BC.each(this.__folders,(function(t){t.updateDisplay()}))}});var GP=AP,HP=function(){function t(t){this.runTime={fps:0,resolution:""},this.target=t.target,this.data=t.params,this.player=t.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.player.view&&(t.controller.runTimeFps.setValue(t.player.fps.value),t.controller.drawCall.setValue(t.player.runtime.drawCall),t.controller.runTimeResolution.setValue(t.player.view.width+"*"+t.player.view.height))}),500)},t.prototype.createControllerGUI=function(){var t,e,n,i,r,o=new GP({autoPlace:!0,closed:!0});o.domElement.style.opacity=".6",o.domElement.style.transformOrigin="100% 0",o.domElement.style.transform="scale(1)",this.target.appendChild(o.domElement),o.domElement.style.position="absolute",o.domElement.style.right="0",o.domElement.style.top="0",o.domElement.style.zIndex="2";var s=o.add({FPS:0},"FPS",0),a=o.add({drawCall:0},"drawCall",0),l=o.add({"分辨率":""},"分辨率",""),u=o.add({"额外计算":0},"额外计算",0,200),h=o.addFolder("renderOptions");return this.controller={runTimeResolution:l,runTimeFps:s,drawCall:a,moreCalculation:u,minFPS:h.add({"最低fps":null!==(t=this.data.minFPS)&&void 0!==t?t:40},"最低fps",0,60),maxFPS:h.add({"最高fps":null!==(e=this.data.maxFPS)&&void 0!==e?e:50},"最高fps",0,60),resolution:h.add({"目标分辨倍率":null!==(n=this.data.resolution)&&void 0!==n?n:window.devicePixelRatio},"目标分辨倍率",.5,6),autoResolution:h.add({"自动分辨率":null!==(i=this.data.autoResolution)&&void 0!==i&&i},"自动分辨率",!0),autoFps:h.add({"自动fps":null===(r=this.data.autoFPS)||void 0===r||r},"自动fps",!0),transactionBgColor:h.addColor({"切页背景色":this.data.transactionBgColor},"切页背景色")},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,o},t.prototype.addEventListener=function(){var t,e=this;this.controller.autoFps.onChange((function(t){e.data.autoFPS=t,e.player.updateConfig(e.data)})),this.controller.maxFPS.onChange((function(t){e.data.maxFPS=t,e.player.updateConfig(e.data)})),this.controller.minFPS.onChange((function(t){e.data.minFPS=t,e.player.updateConfig(e.data)})),this.controller.autoResolution.onChange((function(t){e.data.autoResolution=t,e.player.updateConfig(e.data)})),this.controller.resolution.onChange((function(t){e.data.resolution=t,e.player.updateConfig(e.data)})),this.controller.transactionBgColor.onChange((function(t){e.data.transactionBgColor=t,e.player.updateConfig(e.data)})),this.controller.moreCalculation.onChange((function(n){t&&e.player.app.ticker.remove(t),n>0&&(t=function(){for(var t="";t.length<8e3*n;)t+=Math.random().toString(32).substr(2);uM()(t)},e.player.app.ticker.add(t))}))},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),zP=function(){function t(t){var e=this;this.tasks=[],this.schedule=function(){var t=e.tasks[0];t?e.fn(t).then((function(){e.tasks.splice(0,1),window.requestAnimationFrame(e.schedule)})):window.requestAnimationFrame(e.schedule)},this.fn=t,this.schedule()}return t.prototype.addTask=function(t){this.tasks.push(t)},t}(),jP=function(){function t(){this.autoUnlock=Object.create(null),this.locks=Object.create(null)}return t.prototype.addLock=function(t,e){var n=this;this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete n.locks[t]}),3e3)},t.prototype.unlock=function(t,e){e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.locks[t]},t}(),VP=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),WP=function(){return(WP=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},XP=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},qP=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};window.__slide_local_logger__||(window.__slide_local_logger__=o.createInstance({name:"_slide_local_log_",driver:o.INDEXEDDB,version:1}));var YP=window.__slide_local_logger__,ZP=window.ResizeObserver||CC,JP=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function KP(t,e){return XP(this,void 0,void 0,(function(){var n;return qP(this,(function(i){switch(i.label){case 0:n=Date.now(),i.label=1;case 1:return!t()&&Date.now()-n<e?[4,JP(50)]:[3,3];case 2:return i.sent(),[3,1];case 3:return[2]}}))}))}var $P={syncDispatch:"syncDispatch",syncReceive:"syncReceive",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},QP={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},tI="";try{tI="0.2.10"}catch(t){tI="dev"}var eI=function(t){function e(e){var n=t.call(this)||this;return n.iosResetCache=[],n.needClearCacheImage=!1,n.version=tI,n.__slideState=Object(l.cloneDeep)(QP),n.userInputTime=0,n.isSyncingSlideState=!1,n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new LC,n.isLoading=!1,n.interactive=!0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new ZP((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.enableGlobalClick=!1,n.log="",n.logId="",n.lastEmitedState=null,n.playerController=null,n.lock=new jP,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isFrowning=!1,n.isReleasing=!1,n.isTouchStart=!1,n.touchStartId=void 0,n.designWidth=0,n.designHeight=0,n._slideCount=0,n.userInputHandle=function(){n.userInputTime=Date.now()},n.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-n.userInputTime)>500&&n.enableGlobalClick&&n.nextStep()}))},n.handleViewTouchStart=function(){window.clearTimeout(n.touchStartId),n.isTouchStart=!0,n.touchStartId=setTimeout((function(){n.isTouchStart=!1}),350)},n.handleViewTouchEnd=function(){n.isTouchStart&&(n.isTouchStart=!1,n.handleViewClick())},n.persistLog=function(){return XP(n,void 0,void 0,(function(){var t,e;return qP(this,(function(n){switch(n.label){case 0:if(!YP||!this.logId)return[3,5];n.label=1;case 1:return n.trys.push([1,4,,5]),t=this.log,[4,YP.getItem(this.logId)];case 2:return e=n.sent()||"",[4,YP.setItem(this.logId,e+t)];case 3:return n.sent(),this.log="",[3,5];case 4:return n.sent(),[3,5];case 5:return[2]}}))}))},n.handleSlideRef=function(){console.log(n),window.__slide=n},n.handleSlideStateLog=function(){console.log(n.logId),console.log(JSON.stringify(n.slideState,null,2))},n.handleLogDownload=function(){return XP(n,void 0,void 0,(function(){var t,e,n;return qP(this,(function(i){switch(i.label){case 0:return t="",YP?(e=t,[4,YP.getItem(this.logId)]):[3,2];case 1:t=e+(i.sent()||""),i.label=2;case 2:return t+=this.log,(n=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),n.setAttribute("download",this.logId),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),console.log(t),[2]}}))}))},n.receiveSyncHandler=function(t){return XP(n,void 0,void 0,(function(){var e,n,i,r,o=this;return qP(this,(function(s){switch(s.label){case 0:return this.log+="=== sync receive ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n","nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){o.doNextStep()}))):this.doNextStep(),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep():(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){o.doPrevStep()}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId].step+=1,[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return s.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type&&(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state),s.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(){return XP(n,void 0,void 0,(function(){var t,e;return qP(this,(function(n){switch(n.label){case 0:return this.player?[4,null===(e=this.player)||void 0===e?void 0:e.createSnapshotForNextSlide(!0)]:[2];case 1:return n.sent(),(t=this.player.prevSlideIndex)>=1&&this.renderSlide(t,!1),[2]}}))}))},n.handleNextSlide=function(){return XP(n,void 0,void 0,(function(){var t,e;return qP(this,(function(n){switch(n.label){case 0:return this.player?[4,null===(e=this.player)||void 0===e?void 0:e.createSnapshotForNextSlide(!1)]:[2];case 1:return n.sent(),(t=this.player.nextSlideIndex)<=this.slideCount&&this.renderSlide(t,!0),[2]}}))}))},n.handleGotoSlide=function(t){if(t<=n.slideCount&&t>=1){var e=n.slideState.currentSlideIndex<=t;n.renderSlide(t,e)}else-1===t&&n.renderSlide(n.slideCount,!0)},e.timestamp&&(n.timestamp=e.timestamp),e.rtcAudio&&(jR.RtcAudioClazz=e.rtcAudio),n.config=e,n.syncQueue=new zP(n.receiveSyncHandler),n.mode=e.mode,n.anchor=e.anchor,n.enableGlobalClick=!Object(l.isUndefined)(e.enableGlobalClick)&&e.enableGlobalClick,n.resize=e.resize||!1,n.interactive=e.interactive,n.cacheImage.style.position="absolute",n.cacheImage.style.zIndex="100",n.frame.style.cssText="width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",n.setMedianControllerAttribute(),n.frame.appendChild(n.medianController),n.anchor.appendChild(n.frame),n.frameResizeObserver.observe(n.frame),n.on($P.syncReceive,(function(t){n.lock.unlock(t.type,t.uuid),n.syncQueue.addTask(t)})),n.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,i=t.task;n.emit($P.renderError,{error:e,index:i.slideIndex})})),window.addEventListener("__slide_log__",n.handleLogDownload),window.addEventListener("__slide_state__",n.handleSlideStateLog),window.addEventListener("__slide_ref__",n.handleSlideRef),n.persistLogId=window.setInterval(n.persistLog,5e3),n.resizeView=Object(l.debounce)(n.resizeView.bind(n),50),n.player=n.initPlayer(e),(null==e?void 0:e.controller)&&n.createController(),n.player.view&&n.frame.appendChild(n.player.view),n.handleViewClick=Object(l.debounce)(n.handleViewClick,300),n}return VP(e,t),e.prototype.initPlayer=function(t){var e,n,i,r=this,o=new jR(this.mode);return o.setInteractive(this.interactive),o.updateConfig(t.renderOptions||{}),o.on(zR.renderStart,(function(t){r.isLoading=!0,r.emit($P.renderStart,t)})),o.on(zR.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit($P.renderEnd,t)})),o.on(zR.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emit($P.slideChange,t)})),o.on(zR.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),o.on(zR.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),o.on(zR.interactiveSeqStateChange,(function(t){var e=t.id,n=t.state;r.__slideState.interactiveSeqState[e]=n,r.emitStateChange()})),o.on(zR.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit($P.animateStart))})),o.on(zR.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit($P.animateEnd))})),o.on(zR.interactiveSeqAction,(function(t){var e=t.action,n=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:n}),r.emitStateChange()})),o.on(zR.mainSeqStepStart,(function(t){r.emit($P.mainSeqStepStart,t)})),o.on(zR.mainSeqStepEnd,(function(t){r.emit($P.mainSeqStepEnd,t)})),o.on(zR.mediaPlay,(function(t){var e={type:"play",time:r.timestamp()-1e3*t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:e}),r.emitStateChange()})),o.on(zR.mediaPause,(function(t){var e={type:"pause",time:t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:e}),r.emitStateChange()})),o.on(zR.mediaSeek,(function(t){var e={type:"pause",time:0};t.isPlaying?(e.type="play",r.__slideState.mediaState[t.id]?e.time=r.__slideState.mediaState[t.id].time-1e3*t.time:e.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=e):(e.type="pause",e.time=t.time,r.__slideState.mediaState[t.id]=e),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:e}),r.emitStateChange()})),o.on(zR.requestPrevSlide,this.handlePrevSlide),o.on(zR.requestNextSlide,this.handleNextSlide),o.on(zR.requestGotoSlide,this.handleGotoSlide),null===(e=o.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(n=o.view)||void 0===n||n.addEventListener("touchstart",this.handleViewTouchStart),null===(i=o.view)||void 0===i||i.addEventListener("click",this.handleViewClick),o.on(zR.userInput,this.userInputHandle),o},e.prototype.createController=function(){this.player&&(this.playerController=new HP({player:this.player,params:this.player.config||{},target:this.frame}))},e.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2"},e.prototype.frameResizeHandler=function(){var t=this.frame.getBoundingClientRect(),e=t.width,n=t.height;this.frameWidth=e,this.frameHeight=n,this.resizeView()},e.prototype.resizeView=function(){var t,e,n=this,i=this.width,r=this.height;if(i>0&&r>0){var o=this.frameWidth/i,s=o*r;s>this.frameHeight&&(o*=this.frameHeight/s),null===(t=this.player)||void 0===t||t.scaleView(o,this.resize),this.cacheImage.style.transform="scale("+o+")",this.medianController.style.transform="scale("+o+")",this.medianController.style.top=(this.frameHeight-r*o)/2+"px",this.medianController.setAttribute("data-scale",o.toString()),this.isInitResized||(this.isInitResized=!0,null===(e=this.player)||void 0===e||e.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,n,i;return XP(this,void 0,void 0,(function(){var r,o=this;return qP(this,(function(s){switch(s.label){case 0:return this.isSyncingSlideState=!0,this.log+="=== stateChange receive ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n",t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(n=this.player)||void 0===n||n.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[4,null===(i=this.player)||void 0===i?void 0:i.clock.waitUntil((function(){var e,n;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(n=o.player)||void 0===n?void 0:n.currentStage)}),3e3)];case 3:return s.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var n in t.interactiveSeqState){var i=t.interactiveSeqState[n];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(n,i.step,"end"===i.state?"end":"start")}},e.prototype.initMedia=function(t){var e,n,i=this,r=function(r){var s=t.mediaState[r],a=o.__slideState.mediaState[r];if(a&&s.type===a.type&&s.time===a.time)return"continue";"play"===s.type?null===(e=o.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=i.timestamp();null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,(e-s.time)/1e3)})):null===(n=o.player)||void 0===n||n.setMediaState(r,!1).then((function(){var t;null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,s.time)}))},o=this;for(var s in t.mediaState)r(s)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var n;null===(n=this.player)||void 0===n||n.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e}),this.logId=t+"-"+Math.random().toString(32).substr(2)},e.prototype._renderSlide=function(t){var e;return XP(this,void 0,void 0,(function(){var n=this;return qP(this,(function(i){switch(i.label){case 0:return this.player&&t===this.player.currentIndex?[2]:((jR.platform.isIOS()||jR.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),this.isLoading=!0,[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return i.sent(),this.__slideState.currentSlideIndex=t,this.isLoading=!1,this.resizeView(),this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=n.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(n.player.view.style.visibility="visible"),"hidden"===n.frame.style.visibility&&(n.frame.style.visibility="visible"),n.needClearCacheImage)try{n.frame.removeChild(n.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var n=Number(t);(n!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(n>this.slideCount&&this.slideCount>0||this.poseRenderSlide(n,e))}},e.prototype.needCreateNewPlayer=function(){var t=jR.platform.isLowGpuMemory()?15:30;return(jR.platform.isIOS()||jR.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){this.isLoading=!0,"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var n,i,r,o=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var s=this.player.getSnapshot();this.cacheImage.src=s,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(n=this.playerController)||void 0===n||n.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(i=this.config)||void 0===i?void 0:i.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.frame.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return o._renderSlide(t)}),t,a),new Promise((function(t){o.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive&&(this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide())},e.prototype.doNextStep=function(){if(this.player){this.player.nextStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive&&(this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide())},e.prototype.doPrevStep=function(){if(this.player){this.player.prevStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Object(l.isEqual)(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit($P.stateChange,t),this.log+="=== stateChange dispatch ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(this.slideState,null,2),this.log+="\n\n")}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e),this.emit($P.syncDispatch,WP(WP({},t),{uuid:e})),this.log+="=== sync dispatch ["+(new Date).toISOString()+"] ===\n",this.log+=JSON.stringify(t,null,2),this.log+="\n\n"}},e.prototype.setMainSeqStep=function(t,e){var n;null===(n=this.player)||void 0===n||n.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype.frozen=function(){var t;return XP(this,void 0,void 0,(function(){var e,n,i,r=this;return qP(this,(function(o){switch(o.label){case 0:return this.isFrowning?[2,KP((function(){return!r.isFrowning}),6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]):[3,2];case 1:for(n in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)i=this.__slideState.mediaState[n],this.__slideState.mediaState[n]=WP(WP({},i),{frozenTime:this.timestamp()});this.isFrowning=!1,o.label=2;case 2:return[2]}}))}))},e.prototype.release=function(){var t,e;return XP(this,void 0,void 0,(function(){var n,i,r,o,s=this;return qP(this,(function(a){switch(a.label){case 0:if(this.isReleasing)return[2,KP((function(){return!s.isReleasing}),6e4)];for(i in this.isReleasing=!0,this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.frame.appendChild(this.player.view),this.player.view.style.visibility="hidden"),n=this.__slideState,this.__slideState=Object(l.cloneDeep)(QP),n.mediaState)"play"===(r=n.mediaState[i]).type&&(o=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(o-r.time),r.frozenTime=void 0);return[4,this.setSlideState(n)];case 1:return a.sent(),[4,this.player.clock.delay(333)];case 2:a.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return this.isReleasing=!1,[2]}}))}))},e.prototype.destroy=function(){var t,e,n,i;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(e=this.player)||void 0===e||e.destroy(),null===(n=this.player)||void 0===n||n.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),YP&&YP.removeItem(this.logId).catch((function(){}));try{(null===(i=this.player)||void 0===i?void 0:i.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}},e.disposeLocalCache=function(){jR.storeManager.dispose()},e}(a.a)}]);
250
+ */vb.registerPlugin("accessibility",ny),vb.registerPlugin("extract",Fb),vb.registerPlugin("interaction",py),vb.registerPlugin("particle",Kw),vb.registerPlugin("prepare",iS),vb.registerPlugin("batch",Ab),vb.registerPlugin("tilingSprite",cS),$b.registerPlugin(NS),$b.registerPlugin(cw),$b.registerPlugin(Cw),$b.registerPlugin(Ww),$b.registerPlugin(oS),Lb.registerPlugin(oy),Lb.registerPlugin(Qb);var VE={AlphaFilter:FS,BlurFilter:aE,BlurFilterPass:sE,ColorMatrixFilter:uE,DisplacementFilter:cE,FXAAFilter:pE,NoiseFilter:NE},WE=n(2),XE=n.n(WE);class qE extends a.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(t=>{const e=t-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(1e3*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=t,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}var YE=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const ZE=new class{constructor(){this.life=144e5,this.cache=XE.a.createInstance({name:"_slide_cache_life_",storeName:"_slide_cache_life_",driver:XE.a.INDEXEDDB,version:1}),this.clear().catch(()=>{})}clear(){return YE(this,void 0,void 0,(function*(){const t=yield this.cache.keys();for(const e of t){const t=(yield this.cache.getItem(e))||0;if(Date.now()-t>this.life){const[t,n]=e.split("@");yield XE.a.createInstance({name:t,storeName:n,driver:XE.a.INDEXEDDB,version:1}).dropInstance().then(()=>{this.cache.removeItem(e).catch(()=>{})}).catch(()=>{})}}}))}updateActiveTime(t,e){return this.cache.setItem(`${t}@${e}`,Date.now())}dispose(){return YE(this,void 0,void 0,(function*(){const t=yield this.cache.keys();for(const e of t){const[t,n]=e.split("@");yield XE.a.createInstance({name:t,storeName:n,driver:XE.a.INDEXEDDB,version:1}).dropInstance().then(()=>{this.cache.removeItem(e).catch(()=>{})}).catch(()=>{})}}))}};var JE;!function(t){t.ResourceError="RESOURCE_ERROR",t.RuntimeError="RUNTIME_ERROR",t.RuntimeWarn="RUNTIME_WARN",t.CanvasCrash="CANVAS_CRASH"}(JE||(JE={}));class KE extends Error{constructor(t,e){var n,i;super(),n=this,i=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,i):n.__proto__&&(n.__proto__=i),this.errorType=t,this.errorMsg=e}static transform(t){return t instanceof KE?t:new KE(JE.RuntimeError,t.message)}}function $E(){return function(t,e,n){const i=n.value;n.value=function(...t){try{return i.apply(this,t)}catch(t){throw new KE(JE.RuntimeWarn,t.message)}}}}var QE=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function tM(t){return QE(this,void 0,void 0,(function*(){const e=yield fetch(t);if(!e.ok)throw new KE(JE.ResourceError,`"${e.url}" loaded failed with status "${e.status}"`);return e}))}class eM{constructor(t){this.useCache=!1,this.useCache=t}bindTask(t){if(this.taskId=t,this.useCache){const t="_slide_local_cache_",e=this.taskId;this.cache=WE.createInstance({name:t,storeName:e,driver:WE.INDEXEDDB,version:1}),ZE.updateActiveTime(t,e).catch(()=>{})}}fetchJson(t){var e,n;return QE(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);if(i&&this.useCache)return i;if(i=yield(yield tM(""+t)).json(),this.useCache)try{yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i)}catch(t){}return i}))}fetchPng(t){var e,n;return QE(this,void 0,void 0,(function*(){let i=yield null===(e=this.cache)||void 0===e?void 0:e.getItem(t);if(i&&this.useCache)return i;{const e=yield tM(t),r=yield e.blob();if(i=yield function(t){return new Promise((e,n)=>{const i=new FileReader;i.onload=()=>{e(i.result)},i.onerror=()=>{n(new KE(JE.ResourceError,"Failed parse blob data."))},i.readAsDataURL(t)})}(r),this.useCache)try{yield null===(n=this.cache)||void 0===n?void 0:n.setItem(t,i)}catch(t){}return i}}))}destroy(){}}var nM=n(7),iM=n.n(nM);function rM(t,e,n=5){return Math.abs(t-e)<=Math.pow(10,-n)}function oM(t){return Math.floor(1e6*t)/1e6}class sM{constructor(){this.point={x:0,y:0},this.slope=Math.PI/4}static fromPointSlope(t,e){const n=new sM;return n.point=t,n.slope=e,n}resolveY(t){return Math.tan(this.slope)*(t-this.point.x)+this.point.y}distanceToLinearEquation(t){return rM(this.slope,t.slope)?this.distanceToPoint(t.point):-1}distanceToPoint(t){let e=0;if(Math.tan(this.slope)*(t.x-this.point.x)+this.point.y===t.y)return 0;e=this.slope>=Math.PI/2?this.slope-Math.PI/2:Math.PI/2+this.slope;const n=sM.fromPointSlope(t,e),i=this.crossPoint(n);return i?Math.ceil(Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2))):0}crossPoint(t){if(rM(t.slope,this.slope))return null;let e=0,n=0;const i=Math.tan(t.slope),r=Math.tan(this.slope),{x:o,y:s}=this.point,{x:a,y:l}=t.point;return rM(this.slope,Math.PI/2)?(e=this.point.x,n=i*(e-a)+l):rM(t.slope,Math.PI/2)?(e=t.point.x,n=r*(e-o)+s):rM(this.slope,Math.PI)||rM(this.slope,0)?(n=this.point.y,e=(n-l)/i+a):rM(t.slope,Math.PI)||rM(t.slope,0)?(n=t.point.y,e=(n-s)/r+o):(e=(i*a-l+s-r*o)/(i-r),n=r*(e-o)+s),{x:e,y:n}}}function aM(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}var lM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class uM{constructor(t){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=t=>{const e=t/(mv.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=e,this.callbackList=this.callbackList.filter(t=>t&&!t.applied);let{length:t}=this.callbackList;for(let e=0;e<t;e++){const n=this.callbackList[e];if(n&&!n.applied){if(!(n.triggerTime<=this.timestamp))break;n.running=!0,n.fn(),n.applied=!0,t=this.callbackList.length}}}},this.ticker=t,this.ticker.add(this.onTimeUpdate)}setTimeout(t,e){const n=aM(),i=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:t,triggerTime:i,id:n,applied:!1,running:!1}),this.callbackList.sort((t,e)=>t.triggerTime-e.triggerTime),n}clearTimeout(t){const e=this.callbackList.findIndex(e=>e.id===t);e>=0&&!this.callbackList[e].running&&this.callbackList.splice(e,1)}delay(t){return new Promise(e=>{this.setTimeout(e,t)})}waitUntil(t,e){return lM(this,void 0,void 0,(function*(){const n=this.timestamp;for(;!t()&&this.timestamp-n<e;)yield this.delay(50)}))}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var hM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class cM{constructor(t){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.loader=t}getTexture(t){return this.textures[t]||null}getFrameData(t){return this.frames[t]}getGifFrames(t){return this.gifs[t]?this.gifs[t].filter(t=>!!t):[]}loadSpriteSheetItem(t,e,n){return hM(this,void 0,void 0,(function*(){const i=yield this.loader.fetchJson(`${t}/${e}/jsonOutput/${n}.json`),r=yield this.loader.fetchPng(`${t}/${e}/jsonOutput/${n}.png`),o=document.createElement("img");o.src=r,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()});const s=new Ty(o),a=new rS(s,i);yield new Promise(t=>{a.parse(()=>t(""))}),this.spriteSheets.push(a),Object.keys(a.textures).forEach(t=>{const e=t.match(/^(.+)_gif_(\d+)$/);if(e&&e[1]&&e[2]){const n=e[1];this.gifs[n]||(this.gifs[n]=[]);const i=parseInt(e[2],10);this.gifs[n][i]=a.textures[t]}else this.frames[t]=i.frames[t],this.textures[t]=a.textures[t]})}))}destroy(){this.spriteSheets.forEach(t=>t.destroy(!0)),this.spriteSheets=[],this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null)}}var dM=n(3),pM=n.n(dM);function fM(t,e,n){let i,r;const o=Math.round(t)%360;if(o%180==0)i=Math.cos(o*(Math.PI/180))*e,r=0;else if(o%90==0)i=0,r=Math.sin(o*(Math.PI/180))*n;else{const t=function(t){const e=t*Math.PI/180;return Math.tan(e)}(o);i=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e*t,2)),(o>90&&o<270||o<-90&&o>-270)&&(i=-i),r=t*i}return{x:i,y:r}}function mM(t,e,n,i,r,o){const s=t,a=e;let l,u,h,c,d;if(0===Math.round(i))l=r,u=o,d=0;else if(Math.round(i)>=360)l=r,u=o,h=r+2*t*Math.abs(Math.cos(-n/180*Math.PI)),c=o+2*e*Math.sin(-n/180*Math.PI),d=1;else{const t=-n,e=-(n+i),{x:h,y:c}=fM(t,s,a),p=r-h,f=o+c,{x:m,y:g}=fM(e,s,a);l=m+p,u=f-g,d=i>=-360&&i<-180?1:i>=-180&&i<0||i>0&&i<180?0:1}return{radiusX:s,radiusY:a,xAxisRotation:0,largeArcFlag:d,sweepFlag:i>0?1:0,endX:l,endY:u,middleX:h,middleY:c}}class gM{constructor(){this.pool=[]}getObject(t){const e=this.pool.find(t=>!t.isUsed);if(e)return e.isUsed=!0,e.obj;{const e={obj:this.createObject(),isUsed:!0,group:t};return this.pool.push(e),e.obj}}collectObject(t){const e=this.pool.find(e=>e.obj===t);e&&(e.isUsed=!1,this.resetObject(e.obj))}collectObjectByGroup(t){this.pool.filter(e=>e.group===t).forEach(t=>this.collectObject(t.obj))}}const vM=new class extends gM{createObject(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("version","1.1"),t}resetObject(t){t.removeAttribute("viewBox"),t.removeAttribute("width"),t.removeAttribute("height"),t.innerHTML=""}};const _M=new class extends gM{createObject(){return document.createElement("img")}resetObject(t){t.removeAttribute("src")}};var yM=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class xM{constructor(){this.imgElements=[],this.svgElements=[],this.idToHashMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.hashToIdMap=Object.create(null)}render(t,e,n){return yM(this,void 0,void 0,(function*(){const{items:e,width:i,height:r}=t,o=_M.getObject(n),s=new Ty(o,{width:i,height:r,resolution:1}),a=vM.getObject(n);this.imgElements.push(o),this.svgElements.push(a),a.setAttribute("viewBox",`0 0 ${i} ${r}`),a.setAttribute("width",""+i),a.setAttribute("height",""+r);const u={},h={};e.forEach(t=>{const{item:e,x:n,y:i}=t,r=n+2,o=i+2;e.pathsData.forEach(t=>{let e="";t.cmds.forEach(([n,i])=>{e+=n+" ",e+=i.map(e=>(Object(l.isNumber)(e)||(e.x=e.x+t.offset.x+r,e.y=e.y+t.offset.y+o),e)).reduce((t,e)=>(Object(l.isNumber)(e)?t+=e+" ":t+=`${e.x} ${e.y} `,t),""),e+=" "}),t.pathElement.setAttribute("d",e),a.appendChild(t.pathElement)});const c=e.width-4-2*e.padding,d=e.height-4-2*e.padding;this.textures[e.hash]={texture:new ky(s,new d_(r+2,o+2,c,d)),pivot:e.pivot},u[e.hash]={x:r+2,y:o+2,w:c,h:d,pivot:e.pivot},h[e.hash]=this.hashToIdMap[e.hash]});const c=(d='<?xml version="1.0" encoding="utf-8"?>'+a.outerHTML,"data:image/svg+xml,"+encodeURIComponent(d).replace(/'/g,"%27").replace(/"/g,"%22"));var d;o.src=c,yield new Promise((t,e)=>{o.onload=()=>t(""),o.onerror=()=>e()})}))}getGraphicsData(t){const e=this.idToHashMap[t]||"";return this.textures[e]||null}addGraphics(t,e,n,i,r,o,s,a,l,u,h){var c,d;if(!s&&!l)return t;const p=pM()(n+(null!==(d=null===(c=null==s?void 0:s.width)||void 0===c?void 0:c.toString())&&void 0!==d?d:0)+l+u+h);if(this.hashToIdMap[p]||(this.hashToIdMap[p]=[]),this.hashToIdMap[p].push(t),this.idToHashMap[t]=p,this.graphics.findIndex(t=>t.hash===p)<0){const{graphicsWidth:t,graphicsHeight:n,pathsData:a,pivot:c,padding:d}=function(t,e,n,i,r,o,s,a,l){var u;const h=[],c={x:Math.abs(r.x),y:Math.abs(r.y)};let d=0,p=0,f=0,m=0,g=0,v="none";const _=null!==(u=null==i?void 0:i.width)&&void 0!==u?u:0;return s?(d=e,p=n,g=0):(v=l||"#ff0000",g=_,f=.5*_,m=.5*_,d=e+_,p=n+_,c.x+=.5*_,c.y+=.5*_),d+=Math.abs(r.x),p+=Math.abs(r.y),f+=Math.abs(r.x),m+=Math.abs(r.y),d+=4,p+=4,f+=2,m+=2,d=Math.ceil(d),p=Math.ceil(p),t.forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","path");"none"!==t.fill&&s?e.setAttribute("fill",a||"#ff0000"):e.setAttribute("fill","none"),t.hasStroke&&!s&&(e.setAttribute("stroke-linecap",(null==i?void 0:i.cap)||"butt"),e.setAttribute("stroke-linejoin",(null==i?void 0:i.join)||"miter"),e.setAttribute("stroke-width",g.toString()),e.setAttribute("stroke",v),(null==i?void 0:i.dash)&&e.setAttribute("stroke-dasharray",i.dash));const{scale:n}=t,r=t.path.trim().split(" ");let o={x:0,y:0};const l={offset:{x:f,y:m},cmds:[],pathElement:e};for(let t=0;t<r.length;t+=2){const e=r[t],i=r[t+1];if("M"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["M",[{x:t,y:e}]])}else if("A"===e){const[t,e,r,s]=i.split(",").map(t=>Number(t)),a=r/Math.PI*180,u=s/Math.PI*180,h=mM(t,e,a,u,o.x,o.y);Math.round(u)>=360?(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.middleX/9525*n.x,y:h.middleY/9525*n.y}]]),l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]])):(o={x:h.endX,y:h.endY},l.cmds.push(["A",[h.radiusX/9525*n.x,h.radiusY/9525*n.y,h.xAxisRotation,h.largeArcFlag,h.sweepFlag,{x:h.endX/9525*n.x,y:h.endY/9525*n.y}]]))}else if("L"===e){let[t,e]=i.split(",").map(t=>Number(t));o={x:t,y:e},t=t/9525*n.x,e=e/9525*n.y,l.cmds.push(["L",[{x:t,y:e}]])}else if("QB"===e){let[t,e,r,s]=i.split(",").map(t=>Number(t));o={x:r,y:s},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,l.cmds.push(["Q",[{x:t,y:e},{x:r,y:s}]])}else if("CB"===e){let[t,e,r,s,a,u]=i.split(",").map(t=>Number(t));o={x:a,y:u},t=t/9525*n.x,e=e/9525*n.y,r=r/9525*n.x,s=s/9525*n.y,a=a/9525*n.x,u=u/9525*n.y,l.cmds.push(["C",[{x:t,y:e},{x:r,y:s},{x:a,y:u}]])}else"C"===e&&l.cmds.push(["Z",[]])}h.push(l)}),{graphicsWidth:d,graphicsHeight:p,pivot:c,padding:2,pathsData:h}}(e,r,o,s,i,0,l,u,h);this.graphics.push({hash:p,pathsData:a,pivot:c,width:t,height:n,padding:d})}return t}pack(){this.graphics.forEach(t=>{t.width+=4,t.height+=4});return function t(e){const n=[],i=e.filter(t=>{const e=t.width<2048&&t.height<2048;return e||n.push(t),e}).sort((t,e)=>t.width*t.height-e.width*e.height);let r=i.length+1,o=2050,s=2050;const a=[];let l=null;for(;(o>2048||s>2048)&&i.length>0;)r-=1,l=iM()(i.slice(0,r)),o=l.width,s=l.height;return l&&a.push(l),n.forEach(t=>{const e=iM()([t]);a.push(e)}),r<i.length?a.concat(t(i.slice(r))):a}(this.graphics)}destroy(){Object.keys(this.textures).forEach(t=>{var e;null===(e=this.textures[t])||void 0===e||e.texture.destroy(!0)}),this.textures=Object.create(null),this.imgElements.forEach(t=>_M.collectObject(t)),this.svgElements.forEach(t=>vM.collectObject(t)),this.graphics=[]}}class bM{constructor(){this.runningTimeNodes={}}addRunningTimeNode(t,e,n){const i=`${e}_${t}`;if(this.runningTimeNodes[i])try{this.runningTimeNodes[i].dispose(!0)}catch(t){}this.runningTimeNodes[i]=n}}class wM{constructor(t){this.eventHub=t,this.targets=Object.create(null)}getTargets(){return Object.keys(this.targets).map(t=>this.targets[t])}addTarget(t,e){this.targets[t]=e}getTargetById(t){return this.targets[t]}getTarget(t,e,n={type:"el",index:0,id:""}){var i,r;let o=this.targets[t.id];return"shape"!==t.type?o:("shape"===t.type&&t.txEl&&(o=null!==(i=null==o?void 0:o.getTextElement(t.txEl.type,t.txEl.range))&&void 0!==i?i:null),"shape"===t.type&&t.bg&&0===n.index&&(e=!1,o=null!==(r=null==o?void 0:o.getBgElement())&&void 0!==r?r:null,this.eventHub.emit("IterateTimeNodeEnd",n.id)),e&&o?o.getIterateEntry(n.type,n.index,n.id):(o||this.eventHub.emit("IterateTimeNodeEnd",n.id),o))}clearTargets(){this.targets=Object.create(null)}}class TM{constructor(t){this.target=t}get color(){return this.target.strokeColorFilter.currentColor}set color(t){this.target.strokeColorFilter.color=t}get on(){return this.target.strokeActive?"true":"false"}set on(t){this.target.strokeActive="true"===t}}class SM{constructor(t){this.target=t}applyCommand(t,e){this.target.applyCommand(t,e)}}class EM{constructor(t){this.target=t}get color(){return this.target.fillColorFilter.currentColor}set color(t){this.target.fillActive&&(this.target.fillColorFilter.color=t)}get on(){return this.target.fillActive?"true":"false"}set on(t){this.target.fillActive="true"===t}get designColor(){return this.target.fillColorFilter.designColor}}class MM{constructor(t,e){this.hardHidden=!1,this.target=t,!0===e&&(this.hardHidden=!0)}get opacity(){return this.target.alpha}set opacity(t){this.target.alpha=t}get rotation(){return this.target.rotation/Math.PI*180}set rotation(t){this.target.rotation=t/180*Math.PI}get visibility(){return this.target.visible?"visible":"hidden"}set visibility(t){this.visibility===t||this.hardHidden||(this.target.visible="visible"===t)}}class AM{constructor(t,e){this.actions=[],this.ctx=e,this.object=t,this.object.interactive=!0}reset(t){this.object.interactive=!1,this.object.removeAllListeners(),this.object=t,this.object.interactive=!0}addAction(t,e){this.actions.push([t,e]),"click"===e?(this.object.addListener("click",()=>this.handleAction(t)),this.object.cursor="pointer"):"hover"===e&&this.object.addListener("mouseover",()=>this.handleAction(t))}addProxy(t){this.proxy=t,this.hitArea=this.getOriginHitArea(),this.proxy.interactive=!0,this.actions.forEach(([t,e])=>{var n,i;"click"===e?null===(n=this.proxy)||void 0===n||n.addListener("click",e=>this.handleProxyAction(e,t)):"hover"===e&&(null===(i=this.proxy)||void 0===i||i.addListener("mouseover",e=>this.handleProxyAction(e,t)))})}handleProxyAction(t,e){var n;const i=t.data.global,r=this.object.getGlobalPosition(),o=i.x-r.x+this.object.pivot.x,s=i.y-r.y+this.object.pivot.y;(null===(n=this.hitArea)||void 0===n?void 0:n.contains(o,s))&&this.object.visible&&this.handleAction(e,!0)}getOriginHitArea(){return this.object.hitArea?this.object.hitArea:new g_(0,0,this.object.width,this.object.height)}handleAction(t,e=!1){this.proxy&&!e||(this.ctx.eventHub.emit(ZR.hyperlinkTrigger,t),this.execAction(t))}execAction(t){var e;if(this.ctx.eventHub.emit(ZR.userInput),"ppaction://hlinksldjump"===t.action){const n=(null!==(e=null==t?void 0:t.target)&&void 0!==e?e:"").match(/slide(\d+)\.xml/);n&&n[1]&&this.ctx.eventHub.emit(ZR.requestGotoSlide,Number(n[1]))}else if("ppaction://hlinkshowjump?jump=nextslide"===t.action)this.ctx.eventHub.emit(ZR.requestNextSlide);else if("ppaction://hlinkshowjump?jump=previousslide"===t.action)this.ctx.eventHub.emit(ZR.requestPrevSlide);else if("ppaction://hlinkshowjump?jump=firstslide"===t.action)this.ctx.eventHub.emit(ZR.requestGotoSlide,1);else if("ppaction://hlinkshowjump?jump=lastslide"===t.action)this.ctx.eventHub.emit(ZR.requestGotoSlide,-1);else if("ppaction://hlinkshowjump?jump=lastslideviewed"===t.action){const t=this.ctx.lastViewedIndex;this.ctx.eventHub.emit(ZR.requestGotoSlide,t)}else"ppaction://hlinkshowjump?jump=endshow"===t.action&&this.ctx.eventHub.emit(ZR.requestGotoSlide,-1)}}class RM{constructor(t,e,n){var i,r,o,s,a,l;this.scaleExt={x:1,y:1},this.scaleOrigin={x:1,y:1},this.designScale={x:1,y:1},this.bound=new d_(0,0,1,1),this.pptX=0,this.pptY=0,this.presetSubType=0,this.designWidth=0,this.designHeight=0,this.designX=0,this.designY=0,this.hasPreset=!1,this.container=new ty,this.ctx=e,this.style=new MM(this.container,t.hardHidden),this.designGlobalPosition={x:n.x+(null!==(r=null===(i=t.position)||void 0===i?void 0:i.x)&&void 0!==r?r:0),y:n.y+(null!==(s=null===(o=t.position)||void 0===o?void 0:o.y)&&void 0!==s?s:0)},(t.hlinkClick||t.hlinkHover)&&(this.hyperlink=new AM(this.container,this.ctx),t.hlinkHover&&(null===(a=this.hyperlink)||void 0===a||a.addAction(t.hlinkHover,"hover")),t.hlinkClick&&(null===(l=this.hyperlink)||void 0===l||l.addAction(t.hlinkClick,"click"))),this.ctx.clock.waitUntil(()=>{try{return!!this.container.width}catch(t){return!1}},3e3).then(()=>{try{this.designWidth=this.designWidth||this.container.width}catch(t){}}),this.ctx.clock.waitUntil(()=>{try{return!!this.container.height}catch(t){return!1}},3e3).then(()=>{try{this.designHeight=this.designHeight||this.container.height}catch(t){}})}updateScale(){this.container&&(this.container.scale.x=this.designScale.x*this.scaleExt.x*this.scaleOrigin.x,this.container.scale.y=this.designScale.y*this.scaleExt.y*this.scaleOrigin.y)}updateTransform(t){var e,n,i,r,o,s,a,l;this.designWidth=t.width,this.designHeight=t.height,this.designX=null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,this.designY=null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0;const u=this.designWidth/2,h=this.designHeight/2;this.container.width=this.designWidth,this.container.height=this.designHeight,this.container.pivot.x=u,this.container.pivot.y=h;const c=null!==(s=null===(o=t.position)||void 0===o?void 0:o.x)&&void 0!==s?s:0,d=null!==(l=null===(a=t.position)||void 0===a?void 0:a.y)&&void 0!==l?l:0;this.container.x=c+u,this.container.y=d+h,t.scale&&(this.designScale={x:t.scale.x,y:t.scale.y},this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y),t.rotation&&(this.container.rotation=t.rotation);const p=new AT;p.drawRect(0,0,this.designWidth,this.designHeight),this.container.addChild(p),this.json.hardHidden&&(this.container.visible=!1),this.bound.x=c,this.bound.y=d,this.bound.width=this.designWidth,this.bound.height=this.designHeight}get scale(){return this.scaleOrigin}set scale(t){this.scaleOrigin.x=t.x,this.scaleOrigin.y=t.y,this.updateScale()}get design_ppt_w(){return oM(this.designWidth/this.ctx.stageWidth)}get design_ppt_h(){return oM((this.designHeight||this.container.height)/this.ctx.stageHeight)}get design_ppt_x(){return oM(this.designX/this.ctx.stageWidth)}get design_ppt_y(){return oM(this.designY/this.ctx.stageHeight)}get ppt_w(){return this.scaleExt.x*this.scaleOrigin.x*this.designWidth/this.ctx.stageWidth}set ppt_w(t){this.designWidth&&(this.scaleExt.x=t*this.ctx.stageWidth/this.designWidth,this.updateScale())}get ppt_h(){const t=this.designHeight||this.container.height;return this.scaleExt.y*this.scaleOrigin.y*t/this.ctx.stageHeight}set ppt_h(t){this.designHeight&&(this.scaleExt.y=t*this.ctx.stageHeight/this.designHeight,this.updateScale())}get ppt_x(){return(this.container.position.x-this.container.pivot.x)/this.ctx.stageWidth}set ppt_x(t){this.pptX=t;const e=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=t*this.ctx.stageWidth+this.container.pivot.x*e}get ppt_y(){return(this.container.position.y-this.container.pivot.y)/this.ctx.stageHeight}set ppt_y(t){this.pptY=t;const e=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=t*this.ctx.stageHeight+this.container.pivot.y*e}get r(){return this.container.rotation}set r(t){this.container.rotation=t}set xshear(t){this.container.skew.x=t}get xshear(){return this.container.skew.x}set yshear(t){this.container.skew.y=t}get yshear(){return this.container.skew.y}}class CM{constructor(t){if(this._isInit=!1,this.h=0,this.s=0,this.l=0,this.a=1,t){this._isInit=!0;const e=t.match(/-?[0-9]+/g);e&&(this.h=parseInt(e[0],10),this.s=parseInt(e[1],10)/100,this.l=parseInt(e[2],10)/100)}}isInit(){return this._isInit}by(t,e){e.h=Math.max(Math.min(this.h+t.h,359),0),e.s=Math.max(Math.min(this.s+t.s,1),0),e.l=Math.max(Math.min(this.l+t.l,1),0),e.a=Math.max(Math.min(this.a+t.a,1),0)}fromHexString(t){const[e,n,i,r]=OM(t);let o=0,s=0,a=0;const l=Math.max(e,n,i),u=Math.min(e,n,i),h=l-u;a=(l+u)/2,0===h?o=0:l===e?o=(n-i)/h%6*60:l===n?o=60*((i-e)/h+2):l===i&&(o=60*((e-n)/h+4)),s=0===h?0:h/(1-Math.abs(2*a-1)),this.h=o,this.s=s,this.l=a,this.a=r}interpolationFrom(t,e,n){const i=t.h+(this.h-t.h)*e,r=t.s+(this.s-t.s)*e,o=t.l+(this.l-t.l)*e,s=t.a+(this.a-t.a)*e;n.h=Math.max(Math.min(i,359),0),n.s=Math.max(Math.min(r,1),0),n.l=Math.max(Math.min(o,1),0),n.a=Math.max(Math.min(s,1),0)}toHexString(){let t=[0,0,0,0];const{h:e,s:n,l:i}=this;if(e<360&&e>=0&&n<=1&&n>=0&&i<=1&&i>=0){let r,o,s;const a=(1-Math.abs(2*i-1))*n,l=a*(1-Math.abs(e/60%2-1)),u=i-a/2;[r,o,s]=e>=0&&e<60?[a,l,0]:e>=60&&e<120?[l,a,0]:e>=120&&e<180?[0,a,l]:e>=180&&e<240?[0,l,a]:e>=240&&e<300?[l,0,a]:[a,0,l],t=[r+u,o+u,s+u,this.a]}return LM(t)}}class PM{constructor(t){this._isInit=!1,this.r=0,this.g=0,this.b=0,this.a=0,t&&(this._isInit=!0,this.fromHexString(t))}fromHexString(t){const[e,n,i,r]=OM(t);this.r=e,this.g=n,this.b=i,this.a=r}isInit(){return this._isInit}interpolationFrom(t,e,n){n.r=t.r+(this.r-t.r)*e,n.g=t.g+(this.g-t.g)*e,n.b=t.b+(this.b-t.b)*e,n.a=t.a+(this.a-t.a)*e}by(t,e){e.r=Math.min(Math.max(this.r+t.r,0),255),e.g=Math.min(Math.max(this.g+t.g,0),255),e.b=Math.min(Math.max(this.b+t.b,0),255),e.a=Math.min(Math.max(this.a+t.a,0),1)}toHexString(){return LM([this.r,this.g,this.b,this.a])}}function IM(t){const e=t.substring(1);return[parseInt(e.substring(0,6),16),parseInt(e.substring(6,8),16)/255]}function OM(t){return 0===(t=t.replace(/^#/,"")).substring(6,8).length&&(t+="FF"),[parseInt(t.substring(0,2).padStart(8,"0"),16)/255,parseInt(t.substring(2,4).padStart(8,"0"),16)/255,parseInt(t.substring(4,6).padStart(8,"0"),16)/255,parseInt(t.substring(6,8).padStart(8,"0"),16)/255]}function LM(t){return"#"+Math.round(255*t[0]).toString(16).padStart(2,"0")+Math.round(255*t[1]).toString(16).padStart(2,"0")+Math.round(255*t[2]).toString(16).padStart(2,"0")+Math.round(255*t[3]).toString(16).padStart(2,"0")}function NM(t,e,n){const i=OM(t),r=OM(e),o=Math.round(255*(i[0]+(r[0]-i[0])*n)),s=Math.round(255*(i[1]+(r[1]-i[1])*n)),a=Math.round(255*(i[2]+(r[2]-i[2])*n)),l=Math.round(255*(i[3]+(r[3]-i[3])*n));return"#"+o.toString(16).padStart(2,"0")+s.toString(16).padStart(2,"0")+a.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")}class DM extends Gx{constructor(){super(void 0,"\nvarying vec2 vTextureCoord;\n\nuniform vec4 color;\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n\n if (texColor.a > 0.0) {\n vec4 resultColor = color;\n resultColor = resultColor * texColor.a;\n gl_FragColor = resultColor;\n } else {\n gl_FragColor = texColor;\n }\n}\n",{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF",this.designColor="#FFFFFFFF"}set color(t){this.currentColor=t;const e=OM(t);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const FM=new VE.ColorMatrixFilter;FM.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const BM=new VE.ColorMatrixFilter;BM.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const UM=new VE.ColorMatrixFilter;UM.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const kM=new VE.ColorMatrixFilter;kM.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const GM={darken:FM,darkenLess:BM,lightenLess:kM,lighten:UM};class HM extends RM{constructor(t,e,n){super({position:{x:t.x,y:t.y},width:t.width,height:t.height},e,n),this.fillColorFilter=new DM,this.fill=new EM(this),this.json=t,this.ctx=e,this.parentGlobalPos=n,this.global={x:n.x+t.x,y:n.y+t.y},this.updateTransform({position:{x:t.x,y:t.y},width:t.width,height:t.height})}get fillActive(){var t,e;return(null!==(e=null===(t=this.container.filters)||void 0===t?void 0:t.length)&&void 0!==e?e:-1)>0}set fillActive(t){var e,n;t?(null!==(n=null===(e=this.container.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}clearOnSlideChange(){}initOnReuse(){}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(t){const e=t*this.ctx.stageWidth-this.global.x,n=544===this.presetSubType?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*n}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(t){const e=t*this.ctx.stageHeight-this.global.y,n=544===this.presetSubType?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*n}get design_ppt_x(){return oM(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return oM(this.global.y/this.ctx.stageHeight)}}class zM{constructor(t,e,n,i,r,o,s,a,l,u,h){this.ctx=t,this.type=e,this.lineWidth=n,this.width=i,this.height=r,this.fillColor=o,this.isHorz=s,this.renderContainer=new ty,this.ghcTextureId=`${a}-text-p${l}-l${u}-u${h}-underLine`}createPaths(){if("ww"===this.type)return null;{let t=`M 0,0 L ${9525*this.width},0`,[e,n]=[this.width,this.lineWidth];return this.isHorz||(t="M 0,0 L 0,"+9525*this.height,[e,n]=[this.lineWidth,this.height]),{paths:[{id:aM(),path:t,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:pM()(t)}],width:e,height:n}}}getLineStyle(){const t={width:this.lineWidth};return"dotted"===this.type&&(t.dash=""+this.lineWidth),t}preRender(){const t=this.createPaths();if(t){const{paths:e,width:n,height:i}=t,r=e.reduce((t,e)=>t+e.hash,"");this.ctx.graphicsTexture.addGraphics(this.ghcTextureId,e,r,{x:0,y:0},n,i,this.getLineStyle(),this.ctx.objectPoolGroup,!1,null,this.fillColor)}}render(){if(this.ghcTextureId){const t=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);t&&(this.sprite=new OT,this.sprite.texture=t.texture,this.sprite.pivot.x=t.pivot.x)}}destroy(){var t;null===(t=this.sprite)||void 0===t||t.destroy({texture:!0})}}const jM=134217729;function VM(t,e,n,i,r){let o,s,a,l,u=e[0],h=i[0],c=0,d=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=i[++d]);let p=0;if(c<t&&d<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=i[++d]),o=s,0!==a&&(r[p++]=a);c<t&&d<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d]),o=s,0!==a&&(r[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(r[p++]=a);for(;d<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=i[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function WM(t,e){let n=e[0];for(let i=1;i<t;i++)n+=e[i];return n}function XM(t){return new Float64Array(t)}const qM=XM(4),YM=XM(8),ZM=XM(12),JM=XM(16),KM=XM(4);function $M(t,e,n,i,r,o){const s=(e-o)*(n-r),a=(t-r)*(i-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*u?l:-function(t,e,n,i,r,o,s){let a,l,u,h,c,d,p,f,m,g,v,_,y,x,b,w,T,S;const E=t-r,M=n-r,A=e-o,R=i-o;x=E*R,d=jM*E,p=d-(d-E),f=E-p,d=jM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),w=A*M,d=jM*A,p=d-(d-A),f=A-p,d=jM*M,m=d-(d-M),g=M-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,qM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,qM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,qM[2]=_-(S-c)+(v-c),qM[3]=S;let C=WM(4,qM),P=22204460492503146e-32*s;if(C>=P||-C>=P)return C;if(c=t-E,a=t-(E+c)+(c-r),c=n-M,u=n-(M+c)+(c-r),c=e-A,l=e-(A+c)+(c-o),c=i-R,h=i-(R+c)+(c-o),0===a&&0===l&&0===u&&0===h)return C;if(P=11093356479670487e-47*s+33306690738754706e-32*Math.abs(C),C+=E*h+R*a-(A*u+M*l),C>=P||-C>=P)return C;x=a*R,d=jM*a,p=d-(d-a),f=a-p,d=jM*R,m=d-(d-R),g=R-m,b=f*g-(x-p*m-f*m-p*g),w=l*M,d=jM*l,p=d-(d-l),f=l-p,d=jM*M,m=d-(d-M),g=M-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,KM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,KM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const I=VM(4,qM,4,KM,YM);x=E*h,d=jM*E,p=d-(d-E),f=E-p,d=jM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),w=A*u,d=jM*A,p=d-(d-A),f=A-p,d=jM*u,m=d-(d-u),g=u-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,KM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,KM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const O=VM(I,YM,4,KM,ZM);x=a*h,d=jM*a,p=d-(d-a),f=a-p,d=jM*h,m=d-(d-h),g=h-m,b=f*g-(x-p*m-f*m-p*g),w=l*u,d=jM*l,p=d-(d-l),f=l-p,d=jM*u,m=d-(d-u),g=u-m,T=f*g-(w-p*m-f*m-p*g),v=b-T,c=b-v,KM[0]=b-(v+c)+(c-T),_=x+v,c=_-x,y=x-(_-c)+(v-c),v=y-w,c=y-v,KM[1]=y-(v+c)+(c-w),S=_+v,c=S-_,KM[2]=_-(S-c)+(v-c),KM[3]=S;const L=VM(O,ZM,4,KM,JM);return JM[L-1]}(t,e,n,i,r,o,u)}XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(8),XM(8),XM(8),XM(4),XM(8),XM(8),XM(8),XM(12);XM(192),XM(192);XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(8),XM(8),XM(8),XM(8),XM(8),XM(8),XM(8),XM(8),XM(8),XM(4),XM(4),XM(4),XM(8),XM(16),XM(16),XM(16),XM(32),XM(32),XM(48),XM(64);XM(1152),XM(1152);XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(4),XM(24),XM(24),XM(24),XM(24),XM(24),XM(24),XM(24),XM(24),XM(24),XM(24),XM(1152),XM(1152),XM(1152),XM(1152),XM(1152),XM(2304),XM(2304),XM(3456),XM(5760),XM(8),XM(8),XM(8),XM(16),XM(24),XM(48),XM(48),XM(96),XM(192),XM(384),XM(384),XM(384),XM(768);XM(96),XM(96),XM(96),XM(1152);const QM=Math.pow(2,-52),tA=new Uint32Array(512);class eA{static from(t,e=aA,n=lA){const i=t.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=t[o];r[2*o]=e(i),r[2*o+1]=n(i)}return new eA(r)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=t.length>>1;let s=1/0,a=1/0,l=-1/0,u=-1/0;for(let e=0;e<o;e++){const n=t[2*e],i=t[2*e+1];n<s&&(s=n),i<a&&(a=i),n>l&&(l=n),i>u&&(u=i),this._ids[e]=e}const h=(s+l)/2,c=(a+u)/2;let d,p,f,m=1/0;for(let e=0;e<o;e++){const n=nA(h,c,t[2*e],t[2*e+1]);n<m&&(d=e,m=n)}const g=t[2*d],v=t[2*d+1];m=1/0;for(let e=0;e<o;e++){if(e===d)continue;const n=nA(g,v,t[2*e],t[2*e+1]);n<m&&n>0&&(p=e,m=n)}let _=t[2*p],y=t[2*p+1],x=1/0;for(let e=0;e<o;e++){if(e===d||e===p)continue;const n=rA(g,v,_,y,t[2*e],t[2*e+1]);n<x&&(f=e,x=n)}let b=t[2*f],w=t[2*f+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];oA(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,i=-1/0;t<o;t++){const r=this._ids[t];this._dists[r]>i&&(e[n++]=r,i=this._dists[r])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if($M(g,v,_,y,b,w)<0){const t=p,e=_,n=y;p=f,_=b,y=w,f=t,b=e,w=n}const T=function(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l);return{x:t+(u*h-a*c)*d,y:e+(s*c-l*h)*d}}(g,v,_,y,b,w);this._cx=T.x,this._cy=T.y;for(let e=0;e<o;e++)this._dists[e]=nA(t[2*e],t[2*e+1],T.x,T.y);oA(this._ids,this._dists,0,o-1),this._hullStart=d;let S=3;n[d]=e[f]=p,n[p]=e[d]=f,n[f]=e[p]=d,i[d]=0,i[p]=1,i[f]=2,r.fill(-1),r[this._hashKey(g,v)]=d,r[this._hashKey(_,y)]=p,r[this._hashKey(b,w)]=f,this.trianglesLen=0,this._addTriangle(d,p,f,-1,-1,-1);for(let o,s,a=0;a<this._ids.length;a++){const l=this._ids[a],u=t[2*l],h=t[2*l+1];if(a>0&&Math.abs(u-o)<=QM&&Math.abs(h-s)<=QM)continue;if(o=u,s=h,l===d||l===p||l===f)continue;let c=0;for(let t=0,e=this._hashKey(u,h);t<this._hashSize&&(c=r[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let m,g=c;for(;m=n[g],$M(u,h,t[2*g],t[2*g+1],t[2*m],t[2*m+1])>=0;)if(g=m,g===c){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(v+2),i[g]=v,S++;let _=n[g];for(;m=n[_],$M(u,h,t[2*_],t[2*_+1],t[2*m],t[2*m+1])<0;)v=this._addTriangle(_,l,m,i[l],-1,i[_]),i[l]=this._legalize(v+2),n[_]=_,S--,_=m;if(g===c)for(;m=e[g],$M(u,h,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(v+2),i[m]=v,n[g]=g,S--,g=m;this._hullStart=e[l]=g,n[g]=e[_]=l,n[l]=_,r[this._hashKey(u,h)]=l,r[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,e=this._hullStart;t<S;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const s=n[t],a=t-t%3;if(o=a+(t+2)%3,-1===s){if(0===r)break;t=tA[--r];continue}const l=s-s%3,u=a+(t+1)%3,h=l+(s+2)%3,c=e[o],d=e[t],p=e[u],f=e[h];if(iA(i[2*c],i[2*c+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*f],i[2*f+1])){e[t]=f,e[s]=c;const i=n[h];if(-1===i){let e=this._hullStart;do{if(this._hullTri[e]===h){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,i),this._link(s,n[o]),this._link(o,h);const a=l+(s+1)%3;r<tA.length&&(tA[r++]=a)}else{if(0===r)break;t=tA[--r]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,i,r,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=e,this._triangles[s+2]=n,this._link(s,i),this._link(s+1,r),this._link(s+2,o),this.trianglesLen+=3,s}}function nA(t,e,n,i){const r=t-n,o=e-i;return r*r+o*o}function iA(t,e,n,i,r,o,s,a){const l=t-s,u=e-a,h=n-s,c=i-a,d=r-s,p=o-a,f=h*h+c*c,m=d*d+p*p;return l*(c*m-f*p)-u*(h*m-f*d)+(l*l+u*u)*(h*p-c*d)<0}function rA(t,e,n,i,r,o){const s=n-t,a=i-e,l=r-t,u=o-e,h=s*s+a*a,c=l*l+u*u,d=.5/(s*u-a*l),p=(u*h-a*c)*d,f=(s*c-l*h)*d;return p*p+f*f}function oA(t,e,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=t[r],o=e[i];let s=r-1;for(;s>=n&&e[t[s]]>o;)t[s+1]=t[s--];t[s+1]=i}else{let r=n+1,o=i;sA(t,n+i>>1,r),e[t[n]]>e[t[i]]&&sA(t,n,i),e[t[r]]>e[t[i]]&&sA(t,r,i),e[t[n]]>e[t[r]]&&sA(t,n,r);const s=t[r],a=e[s];for(;;){do{r++}while(e[t[r]]<a);do{o--}while(e[t[o]]>a);if(o<r)break;sA(t,r,o)}t[n+1]=t[o],t[o]=s,i-r+1>=o-n?(oA(t,e,r,i),oA(t,e,n,o-1)):(oA(t,e,n,o-1),oA(t,e,r,i))}}function sA(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function aA(t){return t[0]}function lA(t){return t[1]}function uA(t,e,n){let i=null;const r=new ty;if(t.stopList.sort((t,e)=>t.pos-e.pos),!t.stopList.find(t=>0===t.pos)){const e=t.stopList[0];t.stopList.unshift({pos:0,color:e.color})}if(!t.stopList.find(t=>1===t.pos)){const e=t.stopList[t.stopList.length-1];t.stopList.push({pos:1,color:e.color})}const o=t=>{const e=[];for(let n=0,i=t.length;n<i-1;n++){const i=t[n],r=t[n+1],o=i.pos+.5*(r.pos-i.pos),s=NM(i.color,r.color,.5),a=2*n;e[a]=i,e[a+1]={color:s,pos:o},e[a+2]=r}return e};if(t.stopList=o(t.stopList),t.stopList=o(t.stopList),i=t.line?hA(t,e,n):t.path?function(t,e,n){var i,r,o;const s=[],a={x:0,y:0};if("circle"===(null===(i=t.path)||void 0===i?void 0:i.path)||"rect"===(null===(r=t.path)||void 0===r?void 0:r.path)||"shape"===(null===(o=t.path)||void 0===o?void 0:o.path)){const i=e/2,r=n/2,o=Math.sqrt(i*i+r*r);t.stopList.forEach(t=>{if(0===t.pos)s.push({point:{x:0,y:0},color:t.color});else{const e=o*t.pos,n=new xc;n.absellipse(0,0,e,e,0,2*Math.PI,!1,0),n.getPoints(50).forEach(e=>{s.push({point:{x:e.x,y:e.y},color:t.color})})}a.x=i,a.y=r})}return{points:s,position:a}}(t,e,n):hA(t,e,n),i){const t=[],o=[],{position:s,points:a}=i,l=eA.from(a,t=>t.point.x,t=>t.point.y);for(let e=0;e<l.triangles.length;e+=3)t.push(a[l.triangles[e]].point.x,a[l.triangles[e]].point.y),t.push(a[l.triangles[e+1]].point.x,a[l.triangles[e+1]].point.y),t.push(a[l.triangles[e+2]].point.x,a[l.triangles[e+2]].point.y),o.push(...OM(a[l.triangles[e]].color)),o.push(...OM(a[l.triangles[e+1]].color)),o.push(...OM(a[l.triangles[e+2]].color));const u=new Jy;u.addAttribute("aVertexPosition",t,2),u.addAttribute("aColor",o,4);const h=Ux.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec4 aColor;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec4 vColor;\n void main() {\n vColor = aColor;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","precision mediump float; \n varying vec4 vColor;\n void main() {\n float alpha = vColor.a;\n vec4 color = vColor;\n color.a = 1.0;\n gl_FragColor = color * alpha;\n }\n "),c=new AT;c.drawRect(0,0,e+1,n+1),r.mask=c,r.addChild(c);const d=new vS(u,h);d.position.x=s.x,d.position.y=s.y,r.addChild(d)}return r}function hA(t,e,n){const i=e/2,r=n/2,o=[{x:-i,y:r},{x:-i,y:-r},{x:i,y:r},{x:i,y:-r}],s=[sM.fromPointSlope({x:-i,y:0},Math.PI/2),sM.fromPointSlope({x:0,y:r},0),sM.fromPointSlope({x:i,y:0},Math.PI/2),sM.fromPointSlope({x:0,y:-r},0)],a=[],l=t.stopList.slice(1,t.stopList.length-1).map(o=>{var l,u,h;const c=2*Math.PI;let d=null!==(u=null===(l=t.line)||void 0===l?void 0:l.ang)&&void 0!==u?u:0;for(;d>c;)d-=c;for(;d<0;)d+=c;const p={x:0,y:0};rM(d,Math.PI/2)?(p.x=0,p.y=n/2-o.pos*n):rM(d,0)?(p.x=o.pos*e-e/2,p.y=0):(p.x=o.pos*e-e/2,p.y=n/2-o.pos*n),d>Math.PI/2&&d<=Math.PI&&(p.x*=-1),d>Math.PI&&d<=2*Math.PI&&(p.y*=-1);const f=sM.fromPointSlope(p,Math.PI/2-((null===(h=t.line)||void 0===h?void 0:h.ang)||0)),m=s.map(t=>f.crossPoint(t)).filter(t=>t&&t.x<=i&&t.x>=-i&&t.y<=r&&t.y>=-r).map(t=>({point:t,color:o.color})).sort((t,e)=>e.point.y-t.point.y);a.push(...m);let g=Math.abs(m[1].point.x-m[0].point.x)/10;for(let t=20;t--;){const e=t%2==0?1:-1,n=p.x+e*g,s=f.resolveY(n);n<=i&&n>=-i&&s<=r&&s>=-r&&a.push({point:{x:n,y:s},color:o.color}),g+=g}return f});let u=[],h=[];t:for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<l.length-1;e++){const i=l[e],r=l[e+1],o=i.distanceToLinearEquation(r),s=i.distanceToPoint(n),u=r.distanceToPoint(n);if(s<o&&u<o){const i=t.stopList.slice(1,t.stopList.length-1)[e],r=t.stopList.slice(1,t.stopList.length-1)[e+1],l=NM(i.color,r.color,s/o);a.splice(e+1,0,{point:n,color:l});continue t}}const i=l[0],r=l[l.length-1],s=i.distanceToPoint(n),c=r.distanceToPoint(n);s<=c?u.push({point:n,dis:s}):h.push({point:n,dis:c})}u=u.sort((t,e)=>e.dis-t.dis);const c=u.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[0].color};{const n=t.stopList[0].color,i=t.stopList[1].color;return{point:e.point,color:NM(n,i,1-(0===u[0].dis?1:e.dis/u[0].dis))}}}).sort((t,e)=>e.point.y-t.point.y);h=h.sort((t,e)=>e.dis-t.dis);const d=h.map((e,n)=>{if(0===n)return{point:e.point,color:t.stopList[t.stopList.length-1].color};{const n=t.stopList[t.stopList.length-2].color,i=t.stopList[t.stopList.length-1].color;return{point:e.point,color:NM(n,i,0===h[0].dis?0:e.dis/h[0].dis)}}}).sort((t,e)=>e.point.y-t.point.y),p=c.concat(...a).concat(d);for(let t=0;t<p.length;t++)p[t].point.x+=i,p[t].point.y=-p[t].point.y+r;return{points:p,position:{x:0,y:0}}}const cA="\nvec3 rgb2hsl(vec3 rgb) {\n float cMax = max(max(rgb.r, rgb.g), rgb.b);\n float cMin = min(min(rgb.r, rgb.g), rgb.b);\n float delta = cMax - cMin;\n \n float h = 0.0;\n if (delta == 0.0) {\n h = 0.0;\n } else if (cMax == rgb.r) {\n h = 60.0 * mod(((rgb.g - rgb.b) / delta), 6.0);\n } else if (cMax == rgb.g ) {\n h = 60.0 * ((rgb.b - rgb.r) / delta + 2.0);\n } else if (cMax == rgb.b) {\n h = 60.0 * ((rgb.r - rgb.g) / delta + 4.0);\n }\n \n float l = (cMax + cMin) / 2.0;\n \n float s = 0.0;\n if (delta == 0.0) {\n s = 0.0;\n } else {\n s = delta / (1.0 - abs(2.0 * l - 1.0));\n }\n \n return vec3(h, s, l);\n}\n",dA=[cA],pA={biLevel:"\nvec4 transform(vec4 texColor, float arg) {\n vec3 hsl = rgb2hsl(texColor.rgb);\n mat3 rgb2yuv = mat3(\n 0.2126, 0.7152, 0.0722,\n -0.09991, -0.33609, 0.43600,\n 0.615, -0.5586, -0.05639\n );\n vec3 yuv = texColor.rgb * rgb2yuv;\n if (yuv.x >= 0.49 || texColor.a < 0.9) {\n return vec4(1.0, 1.0, 1.0, 1.0) * texColor.a;\n } else {\n return vec4(0.0, 0.0, 0.0, 1.0) * texColor.a;\n }\n}\n",alphaModFix:"\nvec4 transform(vec4 texColor, float arg) {\n return texColor * arg;\n}\n"};class fA extends Gx{constructor(t,e){var n;super(void 0,(n=pA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg;\nuniform sampler2D uSampler;\n\n${dA.map(t=>t+"\n").join("\n")}\n\n${n}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg);\n}\n`),{arg:e})}}const mA=[cA],gA={clrChange:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n float epsilon = 0.001;\n vec3 colorDiff = arg1.rgb - (texColor.rgb / max(texColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n if (colorDistance < epsilon) {\n arg2.rgb *= arg2.a;\n return arg2;\n } else {\n return texColor;\n }\n}\n",changeBulletColor:"\nvec4 transform(vec4 texColor, vec4 arg1, vec4 arg2) {\n if (texColor.a == 0.0) {\n return texColor;\n } else {\n return arg2;\n }\n}\n"};class vA extends Gx{constructor(t,e,n){var i;super(void 0,(i=gA[t],`\nvarying vec2 vTextureCoord;\n\nuniform vec4 arg1;\nuniform vec4 arg2;\nuniform sampler2D uSampler;\n\n${mA.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:Float32Array.from(e),arg2:Float32Array.from(n)})}}const _A=[cA],yA={lum:"\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n if (arg1 > 0.0) {\n texColor.r += (1.0 - texColor.r) * arg1;\n texColor.g += (1.0 - texColor.g) * arg1;\n texColor.b += (1.0 - texColor.b) * arg1;\n } else if (arg1 < 0.0) {\n texColor.r -= texColor.r * arg1;\n texColor.g -= texColor.g * arg1;\n texColor.b -= texColor.b * arg1;\n }\n // todo 对比度\n texColor.rgb *= texColor.a;\n return texColor;\n}\n"};class xA extends Gx{constructor(t,e,n){var i;super(void 0,(i=yA[t],`\nvarying vec2 vTextureCoord;\n\nuniform float arg1;\nuniform float arg2;\nuniform sampler2D uSampler;\n\n${_A.map(t=>t+"\n").join("\n")}\n\n${i}\n\nvoid main(void){\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = transform(texColor, arg1, arg2);\n}\n`),{arg1:e,arg2:n})}}class bA{constructor(t,e,n,i,r){this.ctx=t,this.fillStyle=e,this.width=n,this.height=i,this.config=r,this.clonedObjects=[],this._displayObject=null}get displayObject(){return this._displayObject||(this._displayObject=this.createDisplayObject()),this._displayObject}set displayObject(t){this._displayObject&&this._displayObject.destroy({children:!0,texture:!0}),this._displayObject=t}get hasFill(){return!!this.fillStyle&&"noFill"!==this.fillStyle.fillType}createDisplayObject(){if(!this.fillStyle)return null;if(this.config.useSlideBackgroundFill&&this.ctx.bgTexture){const t=new OT;return t.texture=this.ctx.bgTexture,t}if("solidFill"===this.fillStyle.fillType||"noFill"===this.fillStyle.fillType)return null;if("gradientFill"===this.fillStyle.fillType)return uA(this.fillStyle,this.width,this.height);if("blipFill"===this.fillStyle.fillType){const{src:t,filters:e}=this.fillStyle,n=this.ctx.spriteTexture.getTexture(t),i=this.ctx.spriteTexture.getFrameData(t);if(n){const t=new OT;return t.texture=n,e.length>0&&this.config.useFilter&&(t.filters=function(t){const e=[];return t.forEach(t=>{if("biLevel"===t.type)e.push(new fA("biLevel",t.args[0]));else if("clrChange"===t.type||"changeBulletColor"===t.type){const n=OM(t.args[0]),i=OM(t.args[1]);e.push(new vA(t.type,n,i))}else"alphaModFix"===t.type?e.push(new fA(t.type,t.args[0])):"lum"===t.type&&e.push(new xA(t.type,t.args[0],t.args[1]))}),e}(e)),t.width=this.width,t.height=this.height,i.rotate&&(t.position.x=this.width/2,t.position.y=this.height/2,t.anchor.x=.5,t.anchor.y=.5,t.rotation=i.rotate/180*Math.PI),t}}else if("gifFill"===this.fillStyle.fillType){const{src:t,delays:e}=this.fillStyle,n=this.ctx.spriteTexture.getGifFrames(t).map((t,n)=>({texture:t,time:e[n]||20})),i=new jE(n,!0);i.width=this.width,i.height=this.height;const r=this.fillStyle.loop;let o=1;return i.onLoop=()=>{o+=1,r>0&&o>r&&i.gotoAndStop(i.totalFrames)},i}return null}isSolidFill(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)}getSolidFillColor(){var t;return"solidFill"===(null===(t=this.fillStyle)||void 0===t?void 0:t.fillType)?this.fillStyle.color:"#000000"}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var wA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class TA extends HM{constructor(t,e,n){var i;super(t,e,n),this.textureContainer=new ty,this.underline=null,this.cacheSprite=new OT;const{shapeId:r,paragraphIndex:o,lineIndex:s,unitIndex:a,lineHeight:l,width:u,underLine:h,fill:c,height:d,isHorz:p,lineWidth:f}=t,m="solidFill"===(null===(i=null==c?void 0:c.fill)||void 0===i?void 0:i.fillType)?c.fill.color:null;if(h){const t=p?l/16:f/16;this.underline=new zM(e,h.type,t,u,d,m,p,r,o,s,a)}this.textGraphics=this.createTextGraphics(),this.textFill=this.createTextFill(),this.strokeGraphics=this.createStrokeGraphics(),this.strokeFill=this.createStrokeFill()}createStrokeFill(){const{stroke:t,lineWidth:e,lineHeight:n}=this.json;return new bA(this.ctx,null==t?void 0:t.fill,e,n,{useFilter:!1,useSlideBackgroundFill:!1})}createStrokeGraphics(){const{stroke:t}=this.json,e=(null==t?void 0:t.key)?{fillType:"blipFill",src:t.key,filters:[]}:void 0;return new bA(this.ctx,e,(null==t?void 0:t.width)||0,(null==t?void 0:t.height)||0,{useFilter:!1,useSlideBackgroundFill:!1})}createTextFill(){const{isHorz:t,fill:e,lineWidth:n,lineHeight:i,fillLineHeight:r}=this.json;return t?new bA(this.ctx,null==e?void 0:e.fill,n,Math.max(r,i),{useFilter:!1,useSlideBackgroundFill:!1}):new bA(this.ctx,null==e?void 0:e.fill,r,i,{useFilter:!1,useSlideBackgroundFill:!1})}createTextGraphics(){var t;const{fill:e,content:n}=this.json;let i="#000000";"solidFill"===(null===(t=null==e?void 0:e.fill)||void 0===t?void 0:t.fillType)&&(i=e.fill.color);const r=(null==e?void 0:e.key)?{fillType:"blipFill",src:e.key,filters:[{type:"changeBulletColor",args:["#000000",i]}]}:void 0;return new bA(this.ctx,r,(null==e?void 0:e.width)||0,(null==e?void 0:e.height)||0,{useFilter:"◾"===n,useSlideBackgroundFill:!1})}getIterateEntry(){return null}getBgElement(){return null}updateTransform(t){var e,n,i,r;const{isHorz:o}=this.json;t.position={x:o&&null!==(n=null===(e=t.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:o?0:null!==(r=null===(i=t.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0},t.width=o?this.json.width:this.json.lineWidth,t.height=o?this.json.lineHeight:this.json.height,super.updateTransform(t)}preRender(){var t;null===(t=this.underline)||void 0===t||t.preRender()}render(t){t.addSubMTask(()=>wA(this,void 0,void 0,(function*(){this.doRender()})))}doRender(){let t=!1;const{lineWidth:e,lineHeight:n,baseLine:i,isHorz:r,underline:o,height:s,width:a,highlightColor:l,x:u,y:h,content:c,fillLineHeight:d,fill:p}=this.json;let f=!1!==this.json.needFill;if(p&&p.fill&&"solidFill"!==p.fill.fillType&&(f=!0),l){const t=new AT,[i,o]=IM(l);t.beginFill(i,o),t.drawRect(0,0,r?a:e,r?n:s),t.endFill(),this.textureContainer.addChild(t)}if(this.textGraphics.displayObject){const e=this.textGraphics.displayObject;if(e.scale.x=.5,e.scale.y=.5,r&&(e.position.y=h>0?h:0),f){const n=this.textFill.displayObject;if(n)n.mask=e,n.addChild(e),n.position.x=-u,e.position.x+=u,t=!0,this.textureContainer.addChild(n);else if(this.textFill.isSolidFill()){const n=new DM;n.color=this.textFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else this.textureContainer.addChild(e)}if(this.strokeGraphics.displayObject){const e=this.strokeGraphics.displayObject;if(e.scale.x=.5,e.scale.y=.5,f){const n=this.strokeFill.displayObject;if(n)n.mask=e,n.addChild(e),r?n.position.y=h>0?h:0:n.position.x=u,this.textureContainer.addChild(n);else if(this.strokeFill.isSolidFill()){r?e.position.y=h>0?h:0:e.position.x=u;const n=new DM;n.color=this.strokeFill.getSolidFillColor(),e.filters=[n],t=!0,this.textureContainer.addChild(e)}}else r?e.position.y=h>0?h:0:e.position.x=u,this.textureContainer.addChild(e)}if(this.underline&&(this.underline.render(),this.underline.sprite)){r?(this.underline.sprite.position.y=o?o-n/16:i,this.underline.sprite.position.x=0):(this.underline.sprite.position.x=0,this.underline.sprite.position.y=0);const t=this.textFill.getClonedDisplayObject();t?(t.mask=this.underline.sprite,t.addChild(this.underline.sprite),this.textureContainer.addChild(t)):this.textureContainer.addChild(this.underline.sprite)}if(t){const t=Hy.create({width:r?a:e,height:r?Math.max(d,n):s,resolution:this.ctx.renderer.resolution});this.ctx.renderer.render(this.textureContainer,{renderTexture:t}),this.cacheSprite.texture=t,r&&h<0&&(this.cacheSprite.position.y=h),this.container.addChild(this.cacheSprite)}else this.container.addChild(this.textureContainer);this.container.name=c}destroy(){this.textFill.destroy(),this.textGraphics.destroy(),this.strokeFill.destroy(),this.strokeGraphics.destroy(),this.cacheSprite.texture.destroy(!0),this.cacheSprite.destroy(),this.textureContainer.destroy(),this.container.destroy()}}var SA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class EA extends HM{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(t,e,n){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createUnits(t,e,n,i){for(let r=0,o=this.json.textUnits.length;r<o;r++)i.addSubMTask(()=>SA(this,void 0,void 0,(function*(){const i=this.json.textUnits[r],{height:o,width:s,fillHeight:a,baseline:l,y:u,underline:h}=this.json,c=new TA(Object.assign(Object.assign({},i),{lineHeight:o,lineWidth:s,baseLine:l-u,underline:h,fillLineHeight:a||o,isHorz:this.isHorz,shapeId:t,paragraphIndex:e,lineIndex:n,unitIndex:r}),this.ctx,this.global);c.preRender(),this.units.push(c)})))}render(t){for(const e of this.units.reverse())e.render(t),t.addSubMTask(()=>SA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})))}destroy(){this.units.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var MA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class AA extends HM{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const t=this.lines.reduce((t,e)=>t=t.concat(e.getIterateElements()),[]);return this.iterateElements=t,t}getIterateEntry(t,e,n){const i=this.getIterateElements();return i[e]?i[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}preRender(){}createLines(t,e,n){for(let i=0,r=this.json.lines.length;i<r;i++)n.addSubMTask(()=>MA(this,void 0,void 0,(function*(){const r=this.json.lines[i],o=new EA(r,this.ctx,this.global);o.isHorz=this.isHorz,o.container.name="line-"+i,o.createUnits(t,e,i,n),this.lines.push(o)})))}render(t){for(const e of this.lines)e.render(t),t.addSubMTask(()=>MA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})))}destroy(){this.lines.forEach(t=>{t.destroy()}),this.container.destroy({children:!1})}}var RA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class CA{constructor(t,e,n,i){this.iterateElements=[],this.paragraphs=[],this.container=new ty,this.json=t,this.ctx=e,this.parentGlobalPos=i,this.iterateType=n,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+t.position.x,y:this.parentGlobalPos.y+t.position.y},this.container.position.x=t.position.x,this.container.position.y=t.position.y,this.container.scale.x=t.scale.x,this.container.scale.y=t.scale.y;const r=new AT;r.drawRect(0,0,t.width,t.height),this.container.addChild(r)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(t,e){return"paragraph"===t?this.paragraphs[e[0]]:null}getIterateEntry(t,e){return this.iterateElements[t]?this.iterateElements[t]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(t=>{t.destroy()})}createParagraphs(t,e){for(let n=0,i=this.json.paragraphs.length;n<i;n++)e.addSubMTask(()=>RA(this,void 0,void 0,(function*(){var i;const r=this.json.paragraphs[n],o=new AA(r,this.ctx,this.global);o.isHorz=null===(i=this.json.isHorz)||void 0===i||i,o.createLines(t,n,e),e.addSubMTask(()=>RA(this,void 0,void 0,(function*(){this.iterateElements=this.iterateElements.concat(o.getIterateElements()),o.container.name="段落-"+n,this.paragraphs.push(o)})))})))}render(t){for(const e of this.paragraphs)e.render(t),t.addSubMTask(()=>RA(this,void 0,void 0,(function*(){this.container.addChild(e.container)})));t.addSubMTask(()=>RA(this,void 0,void 0,(function*(){const{width:t}=this.container;this.container.scale.x<0&&(this.container.x+=-1*t)})))}}var PA=n(48),IA=n.n(PA),OA=n(49),LA=n.n(OA);const NA={Reflection:class extends Gx{constructor(t){super(IA.a,LA.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:t.startAlpha,uEndAlpha:t.endAlpha,uBlur:0}),this.json=t}}};class DA{constructor(t){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=t.id,this.type=t.type,this.heightSize=t.heightSize,this.widthSize=t.widthSize,this.fillStyle=t.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=t.lineWidth||1,this.position=t.position||{x:0,y:0},this.rotate=t.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+pM()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class FA{constructor(t,e,n,i,r,o,s,a,l,u,h){this.id=t,this.ctx=e,this.paths=n,this.hash=i,this.nept=r,this.width=o,this.height=s,this.lineStyle=a,this.shouldFill=l,this.bgColor=u,this.lnColor=h,this.clonedObjects=[],this._displayObject=null,this.isRectangle=!1,this.isPureRect=!1,this.isColoredPureRect=!1,this.isRectangle=this.rectangleDetect(n),this.isRectangle&&l?this.bgColor?this.isColoredPureRect=!0:this.isPureRect=!0:this.ctx.graphicsTexture.addGraphics(this.id,this.paths,this.hash,this.nept,this.width,this.height,this.lineStyle,this.ctx.objectPoolGroup,this.shouldFill,this.bgColor,this.lnColor)}get displayObject(){return this._displayObject}pointDis(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}rectangleDetect(t){if(1!==t.length)return!1;const e=t[0].path.trim().split(" ");if(10!==e.length)return!1;const n=[],i=[];for(let t=0;t<e.length;t+=2){const r=e[t],o=e[t+1],[s,a]=o.split(",").map(t=>Number(t)/100);n.push(r),i.push({x:s,y:a})}if("MLLLC"!==n.join(""))return!1;for(let t=0;t<3;t++){const e=i[t],n=i[t+1];if(e.x!==n.x&&e.y!==n.y)return!1}const r=i.slice(0,4).reduce((t,e)=>t+e.x,0)/4,o=i.slice(0,4).reduce((t,e)=>t+e.y,0)/4;if(Number.isNaN(r)||Number.isNaN(o))return!1;const s={x:r,y:o};return rM(this.pointDis(s,i[0]),this.pointDis(s,i[1]))&&rM(this.pointDis(s,i[0]),this.pointDis(s,i[2]))&&rM(this.pointDis(s,i[0]),this.pointDis(s,i[3]))&&this.pointDis(s,i[0])===this.pointDis(s,i[1])}createDisplayObject(){if(this.isPureRect){const t=new AT;return t.beginFill(0,1),t.drawRect(0,0,this.width,this.height),t}if(this.isColoredPureRect&&this.bgColor){const t=new AT,[e,n]=IM(this.bgColor);return t.beginFill(e,n),t.drawRect(0,0,this.width,this.height),t}{const t=new OT,e=this.ctx.graphicsTexture.getGraphicsData(this.id);return e?(t.texture=e.texture,t.pivot.x=e.pivot.x,t.pivot.y=e.pivot.y,t):null}}getClonedDisplayObject(){const t=this.createDisplayObject();return this.clonedObjects.push(t),t}render(){this._displayObject=this.createDisplayObject()}isNeedMask(t,e){let n=!1;return this._displayObject&&(n=!(this.isRectangle&&Math.abs(t-this._displayObject.width)<2&&Math.abs(e-this._displayObject.height)<2&&this.shouldFill)),n}destroy(){var t;null===(t=this._displayObject)||void 0===t||t.destroy(),this._displayObject=null,this.clonedObjects.forEach(t=>{null==t||t.destroy()}),this.clonedObjects=[]}}var BA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const UA={pivot:{x:0,y:0},width:0,height:0};class kA extends RM{constructor(t,e,n,i){var r;super(t,e,n),this.renderContainer=new ty,this.needCacheAsBitMap=!1,this.backgroundGraphics=null,this.filterAreaJustifies=[],this.strokeGraphics=null,this.arrowList=[],this.fillColorFilter=new DM,this.strokeColorFilter=new DM,this.id="",this.fill=new EM(this),this.stroke=new TM(this),this.updateFilterArea=()=>{const t=this.renderContainer.getBounds(!1),e=this.filterAreaJustifies.map(e=>e(t)),n=e.map(t=>t.width),i=e.map(t=>t.height),r=new d_(t.x,t.y,Math.max(...n),Math.max(...i));this.renderContainer.filterArea=r,(this.renderContainer.filters||[]).forEach(t=>{t.uniforms.uShapeFilterArea=new Float32Array(4),t.uniforms.uShapeFilterArea[0]=r.x,t.uniforms.uShapeFilterArea[1]=r.y,t.uniforms.uShapeFilterArea[2]=r.width,t.uniforms.uShapeFilterArea[3]=r.height})},this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.id=t.id;const{fillStyle:o,lineStyle:s}=this.json;this.container.name=t.id,this.renderContainer.name=t.id+"-render-container",this.generateArrowList(),this.backgroundFill=this.createBackgroundFill(),this.backgroundGraphics=this.createBackgroundGraphics(),this.strokeFill=this.createStrokeFill(),this.strokeGraphics=this.createStrokeGraphics(),this.ctx.timingTargets.addTarget(this.id,this),"solidFill"===(null==o?void 0:o.fillType)&&(this.fillColorFilter.currentColor=o.color,this.fillColorFilter.designColor=o.color),"solidFill"===(null===(r=null==s?void 0:s.fill)||void 0===r?void 0:r.fillType)&&(this.strokeColorFilter.currentColor=s.fill.color,this.strokeColorFilter.designColor=s.fill.color),this.updateTransform(this.json),t.textBody&&(this.text=new CA(t.textBody,this.ctx,t.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new g_(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var t,e,n,i,r,o,s;return this.strokeFill.displayObject?(null!==(n=null===(e=null===(t=this.strokeFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set strokeActive(t){var e,n,i,r,o,s;const{displayObject:a}=this.strokeFill;t?a&&(null!==(n=null===(e=a.filters)||void 0===e?void 0:e.indexOf(this.strokeColorFilter))&&void 0!==n?n:-1)<0?a.filters=[this.strokeColorFilter]:(null===(i=this.strokeGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.strokeGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.strokeColorFilter))&&void 0!==o?o:-1)<0&&(this.strokeGraphics.displayObject.filters=[this.strokeColorFilter]):a?a.filters=[]:(null===(s=this.strokeGraphics)||void 0===s?void 0:s.displayObject)&&(this.strokeGraphics.displayObject.filters=[])}get fillActive(){var t,e,n,i,r,o,s;return this.backgroundFill.displayObject?(null!==(n=null===(e=null===(t=this.backgroundFill.displayObject)||void 0===t?void 0:t.filters)||void 0===e?void 0:e.length)&&void 0!==n?n:-1)>0:(null!==(s=null===(o=null===(r=null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)||void 0===r?void 0:r.filters)||void 0===o?void 0:o.length)&&void 0!==s?s:-1)>0}set fillActive(t){var e,n,i,r,o,s;t?this.backgroundFill.displayObject&&(null!==(n=null===(e=this.backgroundFill.displayObject.filters)||void 0===e?void 0:e.indexOf(this.fillColorFilter))&&void 0!==n?n:-1)<0?this.backgroundFill.displayObject.filters=[this.fillColorFilter]:(null===(i=this.backgroundGraphics)||void 0===i?void 0:i.displayObject)&&(null!==(o=null===(r=this.backgroundGraphics.displayObject.filters)||void 0===r?void 0:r.indexOf(this.fillColorFilter))&&void 0!==o?o:-1)<0&&(this.backgroundGraphics.displayObject.filters=[this.fillColorFilter]):this.backgroundFill.displayObject?this.backgroundFill.displayObject.filters=[]:(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.displayObject)&&(this.backgroundGraphics.displayObject.filters=[])}getTextElement(t,e){var n,i;return null!==(i=null===(n=this.text)||void 0===n?void 0:n.getTextElement(t,e))&&void 0!==i?i:null}getBgElement(){return this}getIterateEntry(t,e,n){return 0===e?this:"el"===t?(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null):this.text?this.text.getIterateEntry(e-1,n)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}createStrokeGraphics(){var t,e,n,i;const{id:r,geometry:o,lineStyle:s}=this.json,{width:a,height:l,pivot:u}=(null==o?void 0:o.lineTransform)||UA,h=a||this.json.width,c=l||this.json.height,d="solidFill"===(null===(t=null==s?void 0:s.fill)||void 0===t?void 0:t.fillType)?s.fill.color:null;return s&&"noFill"!==(null===(e=s.fill)||void 0===e?void 0:e.fillType)?new FA(r+"-path-graphics",this.ctx,null!==(n=null==o?void 0:o.paths)&&void 0!==n?n:[],null!==(i=null==o?void 0:o.hash)&&void 0!==i?i:"",u||{x:0,y:0},h,c,s,!1,null,d):null}createStrokeFill(){const[t,e]=this.calculateFillObjectOffset(),{geometry:n,lineStyle:i,width:r,height:o}=this.json,s=(null==n?void 0:n.lineTransform)||UA,a=Object(l.isNumber)(null==i?void 0:i.width)?i.width:1;return new bA(this.ctx,null==i?void 0:i.fill,(s.width||r)+a+t,Math.max((s.height||o)+a,e),{useFilter:!1,useSlideBackgroundFill:!1})}createBackgroundGraphics(){var t;const{geometry:e,lineStyle:n,fillStyle:i,id:r}=this.json,{width:o,height:s,pivot:a}=(null==e?void 0:e.lineTransform)||UA,l=o||this.json.width,u=s||this.json.height,h="solidFill"===(null==i?void 0:i.fillType)?i.color:null;return i&&"noFill"!==i.fillType||this.json.isPicture?new FA(r+"-bg-graphics",this.ctx,null!==(t=null==e?void 0:e.paths)&&void 0!==t?t:[],(null==e?void 0:e.hash)||"",a||{x:0,y:0},l,u,n,!0,h,null):null}createBackgroundFill(){var t,e;const{fillStyle:n,width:i,height:r,lineStyle:o,geometry:s}=this.json,a=(null==s?void 0:s.fillTransform)||UA;return new bA(this.ctx,n,(a.width||i)+(null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0),(a.height||r)+(null!==(e=null==o?void 0:o.width)&&void 0!==e?e:0),{useFilter:!1,useSlideBackgroundFill:this.json.useBgFill})}createBackground(){var t,e,n,i,r,o,s,a;const{pivot:l,width:u,height:h}=(null===(t=this.json.geometry)||void 0===t?void 0:t.fillTransform)||UA,{displayObject:c}=this.backgroundFill;c?(this.json.useBgFill&&(null===(n=this.backgroundGraphics)||void 0===n?void 0:n.displayObject)?(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,c.pivot.x=(null===(i=this.json.position)||void 0===i?void 0:i.x)||0,c.pivot.y=(null===(r=this.json.position)||void 0===r?void 0:r.y)||0,this.container.addChild(this.backgroundGraphics.displayObject)):"gifFill"===(null===(o=this.json.fillStyle)||void 0===o?void 0:o.fillType)?(c.height=h||this.designHeight,c.width=u||this.designWidth,c instanceof jE&&c.play(),(null===(s=this.backgroundGraphics)||void 0===s?void 0:s.isNeedMask(c.width,c.height))&&(c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject))):(null===(a=this.backgroundGraphics)||void 0===a?void 0:a.isNeedMask(c.width,c.height))&&(this.needCacheAsBitMap=!0,c.mask=this.backgroundGraphics.displayObject,this.backgroundGraphics.displayObject&&this.container.addChild(this.backgroundGraphics.displayObject)),c.x=l.x,c.y=l.y,this.container.addChild(c)):this.backgroundFill.hasFill&&(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.displayObject)&&this.container.addChild(this.backgroundGraphics.displayObject)}createPathFill(){var t,e,n;const{displayObject:i}=this.strokeFill,r=null===(t=this.strokeGraphics)||void 0===t?void 0:t.displayObject,[o,s]=this.calculateFillObjectOffset();i?((null===(e=this.strokeGraphics)||void 0===e?void 0:e.isNeedMask(i.width,i.height))&&r&&(this.needCacheAsBitMap=!0,i.pivot.x=r.pivot.x,i.pivot.y=r.pivot.y,r.pivot.x=0,r.pivot.y=0,i.mask=r,i.addChild(r),i.position.x=-o/2,i.position.y=-s/2,r.position.x=o/2,r.position.y=s/2),this.container.addChild(i)):this.strokeFill.hasFill&&(null===(n=this.strokeGraphics)||void 0===n?void 0:n.displayObject)&&this.container.addChild(this.strokeGraphics.displayObject)}createFilledPathMask(){var t,e,n;const i=(null===(e=null===(t=this.json.geometry)||void 0===t?void 0:t.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[];for(const t of i){const e=this.ctx.graphicsTexture.getGraphicsData(t.id);if(e){const i=new OT(e.texture);i.pivot.x=e.pivot.x,i.pivot.y=e.pivot.y;const r=this.backgroundFill.getClonedDisplayObject(),o=null===(n=this.backgroundGraphics)||void 0===n?void 0:n.getClonedDisplayObject(),s=r||o;s&&(this.backgroundFill.displayObject&&(s.pivot.x=this.backgroundFill.displayObject.pivot.x,s.pivot.y=this.backgroundFill.displayObject.pivot.y),s.mask=i,s.filters=[GM[t.fill]],this.needCacheAsBitMap=!0,this.container.addChild(s),this.container.addChild(i))}}}createArrow(){if(!this.arrowList.length)return;const t=new ty,e=this.strokeFill.getClonedDisplayObject(),[n,i]=this.calculateFillObjectOffset();this.arrowList.forEach(e=>{const n=this.ctx.graphicsTexture.getGraphicsData(e.graphicsId);if(n){const{texture:i}=n,r=new OT(i);r.pivot.x=e.pivot.x,r.pivot.y=e.pivot.y,r.position.x=e.position.x+e.pivot.x,r.position.y=e.position.y+e.pivot.y,r.rotation=e.rotate/180*Math.PI,t.addChild(r)}}),this.arrowRenderTexture=Hy.create({width:t.width,height:t.height,resolution:1}),this.ctx.renderer.render(t,{renderTexture:this.arrowRenderTexture});const r=new OT;r.texture=this.arrowRenderTexture,e&&(e.mask=r,e.position.x=-n/2,e.position.y=-i/2,r.position.x=-n/2,r.position.y=-i/2,this.container.addChild(e),this.container.addChild(r))}generateArrowList(){var t,e;const{lineArrowList:n,lineStyle:i,id:r}=this.json,o="solidFill"===(null===(t=null==i?void 0:i.fill)||void 0===t?void 0:t.fillType)?i.fill.color:null;null===(e=n||[])||void 0===e||e.forEach((t,e)=>{var n,s;const a=new DA(Object.assign(Object.assign({},t),{fillStyle:null==i?void 0:i.fill,lineWidth:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0}));a.graphicsId=`${r}-arrow-${e}-graphics`,a.textureId=`${r}-arrow-${e}-fill`,this.ctx.graphicsTexture.addGraphics(a.graphicsId,null!==(s=a.paths)&&void 0!==s?s:[],a.hash,{x:0,y:0},a.width,a.height,void 0,this.ctx.objectPoolGroup,!0,o,null),this.arrowList.push(a)})}calculateFillObjectOffset(){let[t,e]=[0,0];return this.arrowList.length&&(t=this.arrowList.reduce((t,e)=>Math.max(t,e.width),0),e=this.arrowList.reduce((t,e)=>Math.max(t,e.height),0)),[t,e]}preRender(t){var e,n,i;const{lineStyle:r,geometry:o}=this.json,{width:s,height:a}=(null==o?void 0:o.lineTransform)||UA,l=s||this.json.width,u=a||this.json.height,h=(null===(e=null==o?void 0:o.paths)||void 0===e?void 0:e.filter(t=>"none"!==t.fill&&"norm"!==t.fill))||[],c="solidFill"===(null===(n=null==r?void 0:r.fill)||void 0===n?void 0:n.fillType)?r.fill.color:null;t.addSubMTask(()=>BA(this,void 0,void 0,(function*(){for(const t of h)this.ctx.graphicsTexture.addGraphics(t.id,[t],t.hash,((null==o?void 0:o.lineTransform)||UA).pivot,l,u,r,this.ctx.objectPoolGroup,!0,null,c)}))),null===(i=this.text)||void 0===i||i.createParagraphs(this.json.id,t)}subClassRender(){}setupEffect(){const{effectList:t}=this.json;if(t&&t.length>0){const e=[];return t.forEach(t=>{"reflection"===t.type&&(this.filterAreaJustifies.push(t=>(t.height*=2,t)),e.push(new NA.Reflection(t)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(t){t.addSubMTask(()=>BA(this,void 0,void 0,(function*(){var t,e;null===(t=this.strokeGraphics)||void 0===t||t.render(),null===(e=this.backgroundGraphics)||void 0===e||e.render(),this.createBackground(),this.subClassRender(),this.createFilledPathMask(),this.createPathFill(),this.createArrow()}))),this.text&&this.text.render(t),t.addSubMTask(()=>BA(this,void 0,void 0,(function*(){var t,e,n,i,r,o;if("wd"===(null===(t=this.json.textBody)||void 0===t?void 0:t.iterateType)||"lt"===(null===(e=this.json.textBody)||void 0===e?void 0:e.iterateType))this.renderContainer.addChild(this.container),this.text&&(this.text.container.position.x=(null!==(i=null===(n=this.json.position)||void 0===n?void 0:n.x)&&void 0!==i?i:0)+this.text.x,this.text.container.position.y=(null!==(o=null===(r=this.json.position)||void 0===r?void 0:r.y)&&void 0!==o?o:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(l.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const t=this.json.rotation||0;this.text.container.rotation=-t;const{width:e}=this.text;this.text.container.position.x=e}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.needCacheAsBitMap,"background"===this.json.id&&this.ctx.hasBackgroundFillShape){const t=Hy.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:t}),this.ctx.bgTexture=t}})))}clearOnSlideChange(){}initOnReuse(){}destroy(){var t,e,n,i;null===(t=this.text)||void 0===t||t.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.backgroundFill.destroy(),null===(e=this.backgroundGraphics)||void 0===e||e.destroy(),this.strokeFill.destroy(),null===(n=this.strokeGraphics)||void 0===n||n.destroy(),this.renderContainer.destroy(),null===(i=this.arrowRenderTexture)||void 0===i||i.destroy(!0),this.arrowList=[]}}var GA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function HA(t,e){for(const n in e)t.style[n]=e[n]}class zA{constructor(t){var e,n;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=t=>{t.stopPropagation();const e=t.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(e),this.medianIsEnd=!1,this.ctx.eventHub.emit(ZR.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(t=0)=>{const e=Math.floor(t)+this.start;this.media.currentTime!==e&&(this.media.currentTime=e)},this.showController=t=>{t.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=zA.formatTime(this.duration)},this.playMedia=()=>GA(this,void 0,void 0,(function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(t=>{t()})})),this.pauseMedia=()=>GA(this,void 0,void 0,(function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()})),this.onMouseOut=t=>{t.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>GA(this,void 0,void 0,(function*(){const t=this.media.currentTime-this.start;this.duration>0&&(t>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=zA.formatTime(t),this.currentProgress.style.flex=(t/this.duration).toString()})),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(t=>{t()})},this.playMediaFromCtrl=()=>{this.ctx.eventHub.emit(ZR.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(ZR.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=t.targetId,this.ctx=t.ctx,this.height=t.height,this.width=t.width,this.target=t.target,this.media=t.media,this.info=t.info,this.canvasElement=t.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=null!==(e=this.info.cut.start)&&void 0!==e?e:0,this.end=null!==(n=this.info.cut.end)&&void 0!==n?n:0)}getMedianContainer(){var t;let e=null===(t=this.canvasElement.parentElement)||void 0===t?void 0:t.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(t){let e="00:00";if(t){const n=Math.floor(t/60),i=String(n<0?0:n).padStart(2,"0"),r=Math.floor(t%60);e=`${i}:${String(r<0?0:r).padStart(2,"0")}`}return e}createButton(){const t={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};HA(this.playButton,Object.assign(Object.assign({},t),{display:"block"}));const e=document.createElement("img");HA(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),HA(this.pauseButton,Object.assign(Object.assign({},t),{display:"none"}));const n=document.createElement("img");HA(n,{height:"20px"}),n.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(n)}createTimer(){const t=document.createElement("div");HA(t,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",t.append(this.currentTime,e,this.totalTime),t}createProgress(){HA(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const t=document.createElement("div");HA(t,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(t),HA(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),t.appendChild(this.currentProgress)}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var t;const{target:e}=this,{stageWidth:n,stageHeight:i}=this.ctx,r=e.getGlobalPosition(),o=Number(null===(t=this.container)||void 0===t?void 0:t.getAttribute("data-scale")),s=n*o,a=1/o*(300>s?s/300:1);r.y=r.y+this.height-50,r.x=Math.max(r.x,0),r.x=Math.min(r.x,n-300*a),r.y=Math.max(r.y,0),r.y=Math.min(r.y,i-50),HA(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:r.x+"px",top:r.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${a})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const t=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,t,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(t){this.playCallBackList.push(t)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var t;this.unbindEvent(),this.playCallBackList=[],null===(t=this.container)||void 0===t||t.removeChild(this.mediaController)}}var jA=n(50);class VA extends a.a{constructor(t){super(),this.lastTime=-1,this.howl=null,this.rctClient=null,JR.RtcAudioClazz?(this.rctClient=new JR.RtcAudioClazz(t),this.rctClient.on("load",()=>this.emit("load")),this.rctClient.on("pause",()=>this.emit("pause")),this.rctClient.on("play",()=>this.emit("play"))):(this.howl=new jA.Howl({src:[t]}),this.howl.on("load",()=>this.emit("load")),this.howl.on("pause",()=>this.emit("pause")),this.howl.on("play",()=>this.emit("play")))}startTimeChangeEmit(){this.currentTime!==this.lastTime&&(this.lastTime=this.currentTime,this.emit("timeupdate")),this.isEnded||requestAnimationFrame(()=>this.startTimeChangeEmit())}play(){var t,e;this.lastTime=-1,null===(t=this.howl)||void 0===t||t.play(),null===(e=this.rctClient)||void 0===e||e.play(),this.startTimeChangeEmit()}pause(){var t,e;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.rctClient)||void 0===e||e.pause()}stop(){var t;null===(t=this.howl)||void 0===t||t.stop(),this.rctClient&&(this.rctClient.pause(),this.rctClient.currentTime=0)}destroy(){var t,e,n,i,r,o,s;null===(t=this.howl)||void 0===t||t.pause(),null===(e=this.howl)||void 0===e||e.unload(),null===(n=this.rctClient)||void 0===n||n.pause(),null===(i=this.rctClient)||void 0===i||i.destroy(),null===(r=this.rctClient)||void 0===r||r.removeAllListeners("load"),null===(o=this.rctClient)||void 0===o||o.removeAllListeners("play"),null===(s=this.rctClient)||void 0===s||s.removeAllListeners("pause")}get currentTime(){return this.rctClient?this.rctClient.currentTime:this.howl?this.howl.seek():-1}set currentTime(t){this.rctClient?this.rctClient.currentTime=t:this.howl&&this.howl.seek(t)}get duration(){return this.rctClient?this.rctClient.duration:this.howl?this.howl.duration():0}get isEnded(){return Math.abs(this.currentTime-this.duration)<.001}get isPaused(){return this.rctClient?this.rctClient.isPaused:!!this.howl&&this.howl.playing()}}var WA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class XA extends a.a{constructor(t){var e,n;super(),this.type="video",this.sprite=new OT,this.isPlaying=!1,this.id=t.id,this.video=t.video,this.start=null===(e=t.video.cut)||void 0===e?void 0:e.start,this.end=null===(n=t.video.cut)||void 0===n?void 0:n.end,this.container=t.container,this.ctx=t.ctx,this.ctx.medias[this.id]=this,this.videoResource=new Iy(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const i=this.video.src.replace(/4$/,"3");this.rtcAudio=new VA(i);const{video:r,width:o,height:s,target:a}=t;this.controller=new zA({targetId:t.id,ctx:t.ctx,width:o,height:s,target:a,media:this,info:r,canvasElement:t.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=o,this.sprite.height=s,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const l=new Ty(null,{height:s,width:o});l.resource=this.videoResource,this.videoResource.bind(l),this.sprite=new OT,this.sprite.visible=!1,this.sprite.texture=new ky(l),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",t=>{t.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",t=>{t.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(t=>{this.videoResource.source.addEventListener(t,()=>{"timeupdate"!==t||this.isPlaying||this.pause(),this.emit(t)})})}get currentTime(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.currentTime)&&void 0!==e?e:0}set currentTime(t){this.videoResource.source&&(this.videoResource.source.currentTime=t)}get paused(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.paused)||void 0===e||e}get ended(){var t,e;return null===(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.ended)||void 0===e||e}get duration(){var t,e;return null!==(e=null===(t=this.videoResource.source)||void 0===t?void 0:t.duration)&&void 0!==e?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var t;return WA(this,void 0,void 0,(function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const t=this.videoResource.source;return!!(t&&t.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(JR.RtcAudioClazz&&(this.rtcAudio.play(),this.videoResource.source.volume=0),yield null===(t=this.videoResource.source)||void 0===t?void 0:t.play())}))}load(){return this.videoResource.load()}pause(){var t;this.isPlaying=!1,JR.RtcAudioClazz&&this.rtcAudio.pause(),null===(t=this.videoResource.source)||void 0===t||t.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){var t;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),null===(t=this.videoResource)||void 0===t||t.destroy(),this.rtcAudio.destroy(),this.controller.destroy()}}var qA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class YA extends a.a{constructor(t){super(),this.type="audio",this.isPlaying=!1,this.id=t.id,this.audio=t.audio,this.audioPlayer=new VA(this.audio.src),t.audio.cut&&(this.start=t.audio.cut.start,this.end=t.audio.cut.end),this.ctx=t.ctx,this.ctx.medias[this.id]=this;const{width:e,height:n,target:i}=t;this.controller=new zA({targetId:t.id,ctx:t.ctx,height:n,width:e,target:i,media:this,info:this.audio,canvasElement:t.canvasElement}),this.audioPlayer.on("load",()=>this.emit("durationchange")),this.audioPlayer.on("timeupdate",()=>this.emit("timeupdate")),this.audioPlayer.on("pause",()=>this.emit("pause")),this.audioPlayer.on("play",()=>this.emit("play"))}get currentTime(){return this.audioPlayer.currentTime}set currentTime(t){this.audioPlayer.currentTime=t}get paused(){return this.audioPlayer.isPaused}get ended(){return this.audioPlayer.isEnded}get duration(){return this.audioPlayer.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return qA(this,void 0,void 0,(function*(){this.isPlaying=!0,this.audioPlayer.play()}))}pause(){this.isPlaying=!1,this.audioPlayer.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(t){this.controller.jumpToTime(t)}stop(){this.seek(0),this.pause()}destroy(){this.audioPlayer.pause(),this.controller.destroy()}}class ZA extends kA{constructor(t,e,n,i){super(Object.assign(Object.assign({},t),{type:"Shape",useBgFill:!1,textRotateWithShape:!0,isPicture:!0}),e,n,i),this.isInteractiveOutside=!1,this.cmd=new SM(this),this.media=null==t?void 0:t.media,this.picFill=new bA(this.ctx,t.picFill,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1})}applyCommand(t,e){var n,i,r,o,s;if("call"===e)if(/playFrom\(([0-9.]+)\)/.test(t)){const e=t.match(/playFrom\(([0-9.]+)\)/),i=Number(e[1]||"0");null===(n=this.mediaPlayer)||void 0===n||n.play().then(()=>{var t;null===(t=this.mediaPlayer)||void 0===t||t.seek(i)})}else"custom-pause"===t?null===(i=this.mediaPlayer)||void 0===i||i.pause():"togglePause"===t?null===(r=this.mediaPlayer)||void 0===r||r.togglePause():"stop"===t&&(null===(o=this.mediaPlayer)||void 0===o||o.pause(),null===(s=this.mediaPlayer)||void 0===s||s.seek(0))}renderPic(){var t,e,n,i,r;const{displayObject:o}=this.picFill;if(o){const s=null===(t=this.backgroundGraphics)||void 0===t?void 0:t.getClonedDisplayObject();(null===(e=this.backgroundGraphics)||void 0===e?void 0:e.isNeedMask(o.width,o.height))&&s&&(o.mask=s,this.container.addChild(s)),o.width=this.designWidth,o.height=this.designHeight,o instanceof jE&&this.ctx.slideScopeEventHub.once("slide-render",t=>{this.ctx.slideIndex===t&&o.play()}),this.container.addChild(o),"video"===(null===(n=this.media)||void 0===n?void 0:n.type)&&this.media.src?(this.mediaPlayer=new XA({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,target:o,container:this.container,canvasElement:this.ctx.view}),null===(i=this.mediaPlayer)||void 0===i||i.sprite):"audio"===(null===(r=this.media)||void 0===r?void 0:r.type)&&this.media.src&&(this.mediaPlayer=new YA({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,target:o,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.isInteractiveOutside=this.container.interactive,this.container.interactive=!0,this.container.on("mouseover",()=>{this.mediaPlayer.showController()}),this.container.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))}}preRender(t){super.preRender(t)}subClassRender(){this.renderPic()}clearOnSlideChange(){super.clearOnSlideChange(),this.mediaPlayer&&(this.container.interactive=!1,this.mediaPlayer.stop(),this.mediaPlayer.hideController())}initOnReuse(){super.initOnReuse(),this.mediaPlayer&&(this.container.interactive=!0)}destroy(){this.mediaPlayer&&(this.picFill.displayObject&&!this.isInteractiveOutside&&(this.container.interactive=!1),this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picFill.destroy()}}var JA=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class KA extends RM{constructor(t,e,n,i,r){super(t,e,n),this.children=[],this.cacheSprite=new OT,this.cacheContainer=new ty,this.json=t,this.json.fillStyle&&"groupFill"===this.json.fillStyle.fillType&&i&&(this.json.fillStyle=i),this.container.name=t.id,this.cacheContainer.name=t.id+"-cache-container",this.ctx.timingTargets.addTarget(t.id,this),this.updateTransform(this.json),this.fillObject=new bA(this.ctx,t.fillStyle,t.width,t.height,{useFilter:!1,useSlideBackgroundFill:!1}),this.createChildren(r)}createChildren(t){var e,n,i,r;const o={x:null!==(n=null===(e=this.json.position)||void 0===e?void 0:e.x)&&void 0!==n?n:0,y:null!==(r=null===(i=this.json.position)||void 0===i?void 0:i.y)&&void 0!==r?r:0};for(let e=0,n=this.json.children.length;e<n;e++)t.addSubMTask(()=>JA(this,void 0,void 0,(function*(){const n=this.json.children[e];let i=null;"Shape"===(null==n?void 0:n.type)?i=new kA(n,this.ctx,o,this.json.fillStyle):"Picture"===(null==n?void 0:n.type)?i=new ZA(n,this.ctx,o,this.json.fillStyle):"Container"===(null==n?void 0:n.type)&&(i=new KA(n,this.ctx,o,this.json.fillStyle,t)),i&&this.children.push(i)})))}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(t){for(const e of this.children)t.addSubMTask(()=>JA(this,void 0,void 0,(function*(){e.preRender(t)})))}getBgElement(){return null}getIterateEntry(t,e,n){return 0===e?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",n),null)}getTextElement(){return null}render(t){for(const e of this.children)e.render(t),t.addSubMTask(()=>JA(this,void 0,void 0,(function*(){var t;e.renderContainer&&this.cacheContainer.addChild(e.renderContainer),(e.json.hlinkHover||e.json.hlinkClick)&&(null===(t=e.hyperlink)||void 0===t||t.addProxy(this.container))})));t.addSubMTask(()=>JA(this,void 0,void 0,(function*(){this.container.addChild(this.cacheContainer)})))}clearOnSlideChange(){this.children.forEach(t=>t.clearOnSlideChange())}initOnReuse(){this.children.forEach(t=>t.initOnReuse())}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(t=>t.destroy()),this.container.destroy({children:!0,texture:!0,baseTexture:!0}),this.cacheContainer.destroy({children:!0,texture:!0,baseTexture:!0})}}class $A extends a.a{constructor(t,e,n,i){super(),this.cond={},this.timeoutIds=[],this.condHandle=t=>{if(t)if(t.delay&&t.delay>0){const e=this.ctx.clock.setTimeout(()=>{t.event&&(this.cond[t.event]=!0,this.detectTrigger())},t.delay);this.timeoutIds.push(e)}else this.cond[t.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=t,this.ctx=i,this.eventHubs=n,e.forEach(t=>{this.addCond(t)})}setTriggerParams(t){this.triggerParams=t}addCond(t){const e=()=>this.condHandle(t);t.event&&(/^shape/.test(t.event)||/^time/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.global.addListener(t.event,e)):/^runtime/.test(t.event)?(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):/^self/.test(t.event)?t.delay&&t.delay>0&&(this.cond[t.event]=!1,this.eventHubs.runtime.addListener(t.event,e)):this.cond[t.event]=!1)}isTrigger(){return Object.keys(this.cond).every(t=>!!this.cond[t])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(t=>"self"!==t).every(t=>!!this.cond[t])}detectTrigger(){if(Object.keys(this.cond).every(t=>!!this.cond[t])){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1});const t=this.triggerParams;this.triggerParams=void 0,this.emit("active",t)}}reset(){Object.keys(this.cond).forEach(t=>{this.cond[t]=!1}),this.timeoutIds.forEach(t=>this.ctx.clock.clearTimeout(t))}}class QA extends a.a{constructor(t){super(),this.isTimeNodeEndSync=!1,this.interactiveListeners=[],this.runtimeNodeEventHub=new a.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var t,e,n,i,r,o;this.hasPrev()||!this.isMainSeq?"idle"===this.currentSeqState?(this.decrSeqIndex(),null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.seekToStart(),null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"running"===this.currentSeqState?(null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.seekToStart(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.clearSubList(),this.currentSeqState="idle"):"end"===this.currentSeqState&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),null===(r=this.commonTimeNode.children[this.currentSeqIndex])||void 0===r||r.commonTimeNode.seekToStart(),null===(o=this.commonTimeNode.children[this.currentSeqIndex])||void 0===o||o.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var t,e,n,i;this.isTimeNodeEndSync&&(this.isTimeNodeEndSync=!1,this.currentSeqState="idle",this.currentSeqIndex=0),this.hasNext()||!this.isMainSeq?"idle"===this.currentSeqState?null===(t=this.commonTimeNode.children[this.currentSeqIndex])||void 0===t||t.commonTimeNode.startTimeNodeForce():"running"===this.currentSeqState?(null===(e=this.commonTimeNode.children[this.currentSeqIndex])||void 0===e||e.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),null===(n=this.commonTimeNode.children[this.currentSeqIndex])||void 0===n||n.commonTimeNode.startTimeNodeForce()):"end"===this.currentSeqState&&(this.incrSeqIndex(),null===(i=this.commonTimeNode.children[this.currentSeqIndex])||void 0===i||i.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h}=t;this.isMainSeq="mainSeq"===e.ctn.nodeType,this.isInteractiveSeq="interactiveSeq"===e.ctn.nodeType,this.id=e.ctn.id,this.isIterate=i,this.json=e,this.ctx=s,this.globalEventHub=l,this.commonTimeNode=new AR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h}),this.bindShapeEvent(),this.nextConds=new $A("mainSeq",e.nextCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new $A("mainSeq",e.preCondLst,{global:l,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(ZR.mainSeqStepStart,e)}),this.commonTimeNode.on("childTimeNodeEnd",t=>{const e=this.commonTimeNode.children.findIndex(e=>e.commonTimeNode.uuid===t.id);e>=0&&(this.currentSeqIndex=e),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(ZR.mainSeqStepEnd,e)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.isTimeNodeEndSync=!0,this.commonTimeNode.resetForRepeat()}),this.commonTimeNode.on("timeNodeDestroy",()=>{this.interactiveListeners.forEach(([t,e])=>{t&&e&&t.interactiveContainer.removeListener("pointerdown",e)}),this.interactiveListeners=[]}),this.nextConds.on("active",()=>{this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(t){this._currentSeqIndex=t,this.isMainSeq?this.ctx.eventHub.emit(ZR.mainSeqStepChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(ZR.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:t,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(t){this._currentSeqState=t,this.isMainSeq?this.ctx.eventHub.emit(ZR.mainSeqStateChange,t):this.isInteractiveSeq&&this.ctx.eventHub.emit(ZR.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:t}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&"idle"===this.currentSeqState)}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&"end"===this.currentSeqState)}bindShapeEvent(){"interactiveSeq"===this.json.ctn.nodeType&&this.json.nextCondLst.forEach(t=>{if(/^shape/.test(t.event)){const e=t.event.split(" ")[1];if(e){const t=this.ctx.timingTargets.getTargetById(e);if(t){t.interactiveContainer.interactive=!0,t.interactiveContainer.cursor="pointer";const n=()=>{this.ctx.eventHub.emit(ZR.userInput);const t=`shape ${e} onClick`,{mode:n}=this.ctx;"interactive"!==n&&"sync"!==n||this.ctx.eventHub.emit(ZR.interactiveSeqAction,{action:t,seqId:this.json.ctn.id}),"sync"!==n&&"local"!==n||this.globalEventHub.emit(t)};t.interactiveContainer.on("pointerdown",n),this.interactiveListeners.push([t,n])}}}})}setCurrentStep(t,e){this.isInteractiveSeq&&0===this.commonTimeNode.applyCount&&(this.commonTimeNode.applyCount=1);let n=t;this.commonTimeNode.seekToStart();const{length:i}=this.commonTimeNode.children;if(-1===n&&(n=i-1),n>=0&&n<i)for(let t=0;t<=n;t++){const i=this.commonTimeNode.children[t];t!==n?i.commonTimeNode.seekToEnd(!1,!0):"start"===e?i.commonTimeNode.seekToStart():"end"===e&&i.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=n,this.currentSeqState="start"===e?"idle":"end"}}function tR(t,e,n){const i=e.split(".");i.reduce((r,o,s)=>{if(r)return s!==i.length-1?r[o]:void(r[o]=n);console.warn(`${t} not support ${e}`)},t)}function eR(t,e){if(!e)return null;return e.split(".").reduce((n,i)=>{if(n)return n[i];console.warn(`${t} not support ${e}`)},t)}class nR{constructor(t){this.timingTarget=null,this.runtimeNodeEventHub=new a.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:t}=this.json.cBhvr;if("next"===this.activeWhenConflict){let e=t.id;"shape"===t.type&&t.txEl&&(e=`${e}-txEl-${t.txEl.range[0]}`),this.commonTimeNode.isIterate&&(e=`${e}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(e,this.modifyAttrKey,this.commonTimeNode)}else"prev"===this.activeWhenConflict&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:n,json:i,ctx:r,parent:o,eventHub:s,iterateType:l,iterateIndex:u,iterateId:h}=t;this.json=i,this.id=i.cBhvr.ctn.id,this.ctx=r,this.globalEventHub=s,this.commonTimeNode=new AR({json:i.cBhvr.ctn,isSub:n,eventHubs:{global:s,runtime:this.runtimeNodeEventHub},ctx:r,parent:o,isIterate:e,iterateType:l,iterateIndex:u,iterateId:h}),this.timingTarget=this.ctx.timingTargets.getTarget(i.cBhvr.target,e,{type:l,index:u,id:h}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class iR extends nR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=eR(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const t=this.json.cBhvr.attrList[0];null!==this.startVal&&this.timingTarget&&tR(this.timingTarget,t,this.startVal)},this.onSeekToEnd=()=>{const t=this.json.cBhvr.attrList[0],e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&tR(this.timingTarget,t,e)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:t,delta:e})=>{if(e/t>=1){const t=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const e=this.json.cBhvr.to||this.json.to;e&&this.timingTarget&&tR(this.timingTarget,t,e)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}var rR=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};class oR{constructor(t,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:t=>t/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:t=>t/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=t.val.value,this.time=t.time,t.fmla&&(this.fmla=this.parseFmla(t.fmla))}parseFmla(t){let e=t.replace(/#ppt_h/g,`(${this.timingTarget.design_ppt_h})`);return e=e.replace(/#ppt_w/g,`(${this.timingTarget.design_ppt_w})`),e=e.replace(/#ppt_x/g,`(${this.timingTarget.design_ppt_x})`),e=e.replace(/#ppt_y/g,`(${this.timingTarget.design_ppt_y})`),e=e.replace(/ppt_w/g,"vars.ppt_w"),e=e.replace(/ppt_h/g,"vars.ppt_h"),e=e.replace(/ppt_x/g,"vars.ppt_x"),e=e.replace(/ppt_y/g,"vars.ppt_y"),e=e.replace(/#/g,"vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(t=>{const n=new RegExp(`([^a-z])${t}([^a-z])`,"g");e=e.replace(n,(e,n,i)=>`${n}math.${t}${i}`)}),new Function("vars","math","$","return "+e)}}class sR extends oR{constructor(t,e,n){super(t,e),this.value=t.val.value,n&&(this.fmla=this.parseFmla(n))}resolveValue(){return this.value}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue()-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}rR([$E()],sR.prototype,"interpolationFrom",null);class aR extends oR{constructor(t,e){var n;super(t,e),this.value=null===(n=t.val)||void 0===n?void 0:n.value}interpolationFrom(t,e,n){let i=t.resolveValue(n);return e>this.time&&(i=this.resolveValue()),i}resolveValue(){return this.value||""}}rR([$E()],aR.prototype,"interpolationFrom",null);class lR extends oR{constructor(t,e){super(t,e),this.fn=this.parseFmla(this.val)}resolveValue(t){return this.fn(t,this.math,1)}interpolationFrom(t,e,n){const i=t.resolveValue(n),r=i+(this.resolveValue(n)-i)*e;return t.fmla?t.fmla(n,this.math,r):r}}rR([$E()],lR.prototype,"interpolationFrom",null);class uR extends oR{constructor(t,e){super(t,e),this.value=t.val.value}interpolationFrom(t,e){return NM(t.resolveValue(),this.value,e)}resolveValue(){return this.value}}rR([$E()],uR.prototype,"interpolationFrom",null);class hR extends nR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=eR(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var t,e,n,i;(null===(t=this.timingTarget)||void 0===t?void 0:t.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),(null===(e=this.timingTarget)||void 0===e?void 0:e.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),(null===(n=this.timingTarget)||void 0===n?void 0:n.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),(null===(i=this.timingTarget)||void 0===i?void 0:i.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t,i=this.keyFrames.findIndex(t=>n<=t[0]),{attrList:r}=this.json.cBhvr;if(i<0){const t=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&r&&r[0]&&tR(this.timingTarget,r[0],t[1].resolveValue(this.vars)))}const o=i-1,s=this.keyFrames[i],a=this.keyFrames[o]||s,l=s[0]-a[0]==0?1:(n-a[0])/(s[0]-a[0]),u=s[1].interpolationFrom(a[1],l,this.vars);this.timingTarget&&r&&r[0]&&tR(this.timingTarget,r[0],u)},this.onSeekToStart=()=>{null!==this.startVal&&this.timingTarget&&tR(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var t;const{valueType:e}=this.json;if(this.json.tavLst.length<=0)if(this.json.to){if(this.json.from||this.startVal){const t={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if("num"===e&&this.timingTarget){const e=new lR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}const t={time:1,val:{type:"string",value:this.json.to},fmla:""};if("num"===e&&this.timingTarget){const e=new lR(t,this.timingTarget);this.keyFrames.push([t.time,e])}}else if(this.json.by){const n={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if("num"===e&&this.timingTarget){const t=new lR(n,this.timingTarget);this.keyFrames.push([n.time,t])}const i={time:1,val:{type:"string",value:((null===(t=n.val)||void 0===t?void 0:t.value)||"")+"+"+this.json.by},fmla:""};if("num"===e&&this.timingTarget){const t=new lR(i,this.timingTarget);this.keyFrames.push([i.time,t])}}if(this.json.tavLst.length>0)for(const t of this.json.tavLst)if(t.val&&this.timingTarget){let n=null;"string"===t.val.type?"num"===e?n=new lR(t,this.timingTarget):"str"===e&&(n=new aR(t,this.timingTarget)):"number"===t.val.type?n=new sR(t,this.timingTarget):"color"===t.val.type?(this.isColorAnim=!0,n=new uR(t,this.timingTarget)):"boolean"===t.val.type&&console.warn("not implements"),n&&this.keyFrames.push([t.time,n])}}}var cR=n(51),dR=n.n(cR),pR=n(52),fR=n.n(pR);class mR extends Gx{constructor(){super(fR.a,dR.a,{percent:0,direction:1,transition:0})}set transition(t){this.uniforms.transition=t}set percent(t){this.uniforms.percent=t}set direction(t){this.uniforms.direction=t}}var gR=n(53),vR=n.n(gR);class _R extends Gx{constructor(){super(void 0,vR.a,{percent:0,transition:1})}set transition(t){this.uniforms.transition=Math.pow(t,t)}set percent(t){this.uniforms.percent=t}}class yR extends nR{constructor(t){var e;super(t),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;this.filter&&(this.filter.percent=this.commonTimeNode.applyTimeFilter(n)),n>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let n=0;"out"===t.json.transition?n=-1:"in"===t.json.transition&&(n=1);const i=null===(e=t.json.filter)||void 0===e?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(i){const t=i[1],e=i[3];if("wipe"===t){const n=new mR;"up"===e?n.direction=1:"down"===e?n.direction=2:"left"===e?n.direction=3:"right"===e&&(n.direction=4),this.filter=n,this.filterType=`${t}-${e}`}else if("fade"===t){const e=new _R;this.filter=e,this.filterType=""+t}this.filter&&(this.filter.transition=n)}}get modifyAttrKey(){return this.filterType}}class xR extends nR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:t,delta:e})=>{var n;const i=e/t,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.ppt_x=this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=this.timingTarget.design_ppt_y)},this.onSeekToEnd=()=>{var t,e,n;const i=null!==(e=null===(t=this.commonTimeNode.json)||void 0===t?void 0:t.spd)&&void 0!==e?e:1,r=null===(n=this.path)||void 0===n?void 0:n.getPoint(i>0?1:0);this.timingTarget&&r&&(this.timingTarget.ppt_x=r.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=r.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var t;const e=new xc,n=null===(t=this.json.path)||void 0===t?void 0:t.match(/[MLCmlc][^MLCmlc]+/g);if(n)for(const t of n){const[n,...i]=t.trim().replace(/\s+/g," ").split(" ");if("M"===n){const[t,n]=i.map(t=>Number(t));e.moveTo(t,n)}else if("L"===n){const[t,n]=i.map(t=>Number(t));e.lineTo(t,n)}else if("C"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t));e.bezierCurveTo(t,n,r,o,s,a)}else if("Z"===n)e.closePath();else if("E"===n)console.warn("not implements");else if("c"===n){const[t,n,r,o,s,a]=i.map(t=>Number(t)),l=e.currentPoint;e.bezierCurveTo(t+l.x,n+l.y,r+l.x,o+l.y,s+l.x,a+l.y)}else if("l"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.lineTo(n+t.x,r+t.y)}else if("m"===n){const t=e.currentPoint,[n,r]=i.map(t=>Number(t));e.moveTo(n+t.x,r+t.y)}}this.path=e}}class bR extends nR{constructor(t){super(t),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=t=>{t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{var n,i,r,o,s;const a=e/t,l={x:1,y:1};if(this.to){const t=null!==(n=this.from)&&void 0!==n?n:{x:null!==(r=null===(i=this.startVal)||void 0===i?void 0:i.x)&&void 0!==r?r:1,y:null!==(s=null===(o=this.startVal)||void 0===o?void 0:o.y)&&void 0!==s?s:1};l.x=t.x+(this.to.x-t.x)*a,l.y=t.y+(this.to.y-t.y)*a}else if(this.by){const t={x:this.by.x,y:this.by.y};l.x=1+(t.x-1)*a,l.y=1+(t.y-1)*a}this.timingTarget&&(this.timingTarget.scale=l)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=t.json.from,this.to=t.json.to,this.by=t.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class wR extends nR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isTimelineStart=!1,this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=t=>{if(this.isTimelineStart)return;this.isTimelineStart=!0,t.isReverse||this.updateCurrentValue(),this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to);const[e]=this.json.cBhvr.attrList[0].split(".");tR(this.timingTarget,e+".on","true")},this.onTimeNodeEnd=()=>{if("remove"===this.json.cBhvr.ctn.fill){const[t]=this.json.cBhvr.attrList[0].split(".");tR(this.timingTarget,t+".on","false")}this.isTimelineStart=!1},this.onSeekToStart=()=>{var t;if(this.timingTarget&&(this.onTimeUpdate({duration:1,delta:0}),(null===(t=this.timingTarget.fill)||void 0===t?void 0:t.designColor.toUpperCase())===this.from.toHexString().toUpperCase())){const[t]=this.json.cBhvr.attrList[0].split(".");tR(this.timingTarget,t+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const t=eR(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.startColorString=t)}},this.onTimeUpdate=({delta:t,duration:e})=>{const n=t/e;this.to.interpolationFrom(this.from,n,this.target),this.timingTarget&&tR(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.isTimelineStart||this.onTimelineStart({isReverse:!1,activeCount:0,id:""}),this.onTimeUpdate({duration:1,delta:1})},"rgb"===this.json.clrSpc?(this.from=new PM(this.json.from),this.to=new PM(this.json.to),this.by=new PM(this.json.by),this.target=new PM):(this.from=new CM(this.json.from),this.to=new CM(this.json.to),this.by=new CM(this.json.by),this.target=new CM),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const t=eR(this.timingTarget,this.json.cBhvr.attrList[0]);t&&(this.currentColorString=t)}}}class TR extends nR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=t=>{this.lastVal=null,t.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:t,delta:e})=>{const n=e/t;let i=0,r=0;if(void 0!==this.from&&void 0!==this.to){i=this.from,r=this.to;const t=i+(r-i)*n;this.timingTarget&&(this.timingTarget.r=t)}else if(void 0!==this.by){this.lastVal||(this.lastVal=0);const t=this.by*n-this.lastVal;this.lastVal=this.by*n,this.timingTarget&&(this.timingTarget.r+=t)}},this.onTimeNodeStart=()=>{var t;Object(l.isNumber)(null===(t=this.timingTarget)||void 0===t?void 0:t.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&null!==this.startVal&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var t;this.currentVal=null===(t=this.timingTarget)||void 0===t?void 0:t.r}}class SR extends nR{constructor(t){super(t),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var t,e;const{cmd:n,cmdType:i}=this.json;!this.isApplied&&n&&i&&(this.isApplied=!0,null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand(n,i))},this.onSeekToStart=()=>{var t,e;null===(e=null===(t=this.timingTarget)||void 0===t?void 0:t.cmd)||void 0===e||e.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("seekToStart",this.onSeekToStart),this.commonTimeNode.on("seekToEnd",this.onSeekToEnd)}get modifyAttrKey(){var t,e,n,i;return(null!==(e=null===(t=this.json)||void 0===t?void 0:t.cmd)&&void 0!==e?e:"")+(null!==(i=null===(n=this.json)||void 0===n?void 0:n.cmdType)&&void 0!==i?i:"")}}class ER{constructor(t){this.runtimeNodeEventHub=new a.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:n,isSub:i,eventHub:r,ctx:o,parent:s,iterateType:l,iterateIndex:u,iterateId:h}=t;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new AR({json:e.cMediaNode.ctn,isSub:i,eventHubs:{global:r,runtime:this.runtimeNodeEventHub},ctx:o,parent:s,isIterate:n,iterateType:l,iterateIndex:u,iterateId:h}),this.audio=new VA(e.cMediaNode.tgtEl),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy)}}var MR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class AR extends a.a{constructor(t){var e,n;super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.tmFilter=[],this.timeDelta=0,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.seekToEnd(!1,!0))},this.handleActive=(t=!0)=>{if(this.isActive=!0,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if("never"===this.json.restart)return;"whenNotActive"!==this.json.restart&&"always"!==this.json.restart||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(t))}else this.startTimeLine(t)},this.updateTimeLine=t=>{const e=t/(mv.TARGET_FPMS||.06);this.timeDelta+=e,this.duration-this.timeDelta<=e&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(t=!1)=>{(this.isTimeNodeEnd()||t)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:i,isIterate:r,ctx:o,eventHubs:s,parent:a,json:l,iterateType:u,iterateId:h,iterateIndex:c}=t;this.isSub=i,this.isIterate=r,this.parentTimeNode=a,this.json=l,this.ctx=o,this.iterateIndex=c,this.eventHubs=s,this.iterateType=u,this.iterateId=h,this.tmFilter=null!==(n=null===(e=l.tmFilter)||void 0===e?void 0:e.split(";").map(t=>t.split(",").map(t=>parseFloat(t.trim()))))&&void 0!==n?n:[];const d=Number(this.json.dur),p=this.json.spd||1;this.isNegativeSpeed=p<0,Number.isNaN(d)||(this.duration=d/Math.abs(p)),this.uuid+="--"+this.json.id,this.setPreStyle(),l.childTnLst&&this.createChildren(l.childTnLst),this.startConds=new $A(this.json.id||"",l.stCondLst,s,this.ctx),this.endConds=new $A(this.json.id||"",l.endCondLst,s,this.ctx),l.endSync&&(this.endSync=new $A(this.json.id||"",[l.endSync],s,this.ctx),this.endSync.on("active",()=>{var t;"interactiveSeq"===this.json.nodeType&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),null===(t=this.endSync)||void 0===t||t.reset())})),this.startConds.on("active",t=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(t))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(t=>t.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&"nextClick"===this.json.masterRel&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&!1===this.isIterate&&this.createIterateShadow()}createIterateShadow(){const t=aM();let e=!0,n=0;const i=n=>{n===t&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",i))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",i);e;){const e=JSON.parse(JSON.stringify(this.json)),i=new AR({json:e,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:e.iterate.type,iterateIndex:n,iterateId:t});this.iterateShadows[n]=i,n+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(t){this.isReverse=t}createTimeNode(t,e){let n=null;const i={json:t,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId};return"seq"===t.type?n=new QA(i):"par"===t.type?n=new RR(i):"set"===t.type?n=new iR(i):"anim"===t.type?n=new hR(i):"animEffect"===t.type?n=new yR(i):"animMotion"===t.type?n=new xR(i):"animScale"===t.type?n=new bR(i):"animClr"===t.type?n=new wR(i):"animRot"===t.type?n=new TR(i):"cmd"===t.type?n=new SR(i):"audio"===t.type&&(n=new ER(i)),n}createSubList(t){this.subList=[],t.forEach(t=>{const e=this.createTimeNode(t,!0);e&&this.subList.push(e)})}bindCommonTimeNodeEvent(t){t.commonTimeNode.on("timeNodeStart",t=>{this.emit("childTimeNodeStart",t)}),t.commonTimeNode.on("timeNodeEnd",t=>{this.emit("childTimeNodeEnd",t),this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(t){function e(t){return(e=t,function(t){var e;return!!(null===(e=t)||void 0===e?void 0:e.cBhvr)}(e)?e.cBhvr.ctn:function(t){var e,n;return!!(null===(n=null===(e=t)||void 0===e?void 0:e.cMediaNode)||void 0===n?void 0:n.ctn)}(e)?e.cMediaNode.ctn:e.ctn).presetOrder;var e}if(t&&t[0]&&e(t[0])){[...t].sort((t,n)=>{var i,r;return(null!==(i=e(t))&&void 0!==i?i:0)-(null!==(r=e(n))&&void 0!==r?r:0)}).forEach(e=>{const n=t.findIndex(t=>t===e),i=this.createTimeNode(e,!1);i&&(this.bindCommonTimeNodeEvent(i),this.children[n]=i)})}else t.forEach(t=>{const e=this.createTimeNode(t,!1);e&&(this.bindCommonTimeNodeEvent(e),this.children.push(e))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(t=>t.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.timeDelta=0,this.children.forEach(t=>t.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(t=>t.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.isEndEventsEmitted=!1,this.timeDelta=0;const t=1e3/this.ctx.ticker.maxFPS;this.duration<=t&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(ZR.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>t&&(this.ctx.eventHub.emit(ZR.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(t=!0){if(t&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(ZR.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return MR(this,void 0,void 0,(function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const t of this.iterateShadows){if(this.isIterateEnd)break;t.children.forEach(t=>{t.commonTimeNode.startTimeNode()}),t.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}}))}applyTimeFilter(t){if(!this.tmFilter.every(t=>Object(l.isNumber)(t[0])&&Object(l.isNumber)(t[1])))return t;for(let e=0;e<this.tmFilter.length;e++){const n=this.tmFilter[e];if(t<n[0]){const i=this.tmFilter[e-1];return(t-i[0])/(n[0]-i[0])*(n[1]-i[1])+i[1]}}return this.tmFilter.length>0?this.tmFilter[this.tmFilter.length-1][1]:t}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}findTargets(){const t=[],e=n=>{n.forEach(n=>{var i,r,o;n.cBhvr&&n.cBhvr.target&&t.findIndex(t=>t.id===n.cBhvr.target.id)<0&&t.push(n.cBhvr.target),(null===(r=null===(i=null==n?void 0:n.cBhvr)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.childTnLst)&&n.cBhvr.ctn.childTnLst.length>0&&e(n.cBhvr.ctn.childTnLst),(null===(o=null==n?void 0:n.ctn)||void 0===o?void 0:o.childTnLst)&&n.ctn.childTnLst.length>0&&e(n.ctn.childTnLst)})};return e(this.json.childTnLst||[]),t}setPreStyle(){this.json.presetClass&&this.findTargets().forEach(t=>{if(this.json.iterate){let e=0,n=!0;for(;n;){const i=this.ctx.timingTargets.getTarget(t,!0,{type:this.json.iterate.type,index:e,id:""});i&&(this.setPreStyleForTarget(i),e+=1),n=!!i}}else{const e=this.ctx.timingTargets.getTarget(t,!1);e&&this.setPreStyleForTarget(e)}})}setPreStyleForTarget(t){var e,n;if(t&&this.json.presetSubtype&&(t.presetSubType=this.json.presetSubtype),t&&!t.hasPreset)if("entr"===this.json.presetClass){const i=null===(n=null===(e=this.json)||void 0===e?void 0:e.childTnLst)||void 0===n?void 0:n.filter(t=>"set"===t.type&&"visible"===t.to);(null==i?void 0:i.length)&&(t.hasPreset=!0,t.style.visibility="hidden")}else("exit"===this.json.presetClass||"path"===this.json.presetClass)&&(t.hasPreset=!0,t.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(t=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(t);const e=this.json.stCondLst.filter(t=>/^self/.test(t.event||""))[0];e&&this.startConds.condHandle(e);const n=this.json.endCondLst.filter(t=>/^self/.test(t.event||""))[0];n&&this.endConds.condHandle(n),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(0===this.children.length||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(t=>t.commonTimeNode.destroy())}seekToStart(t=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(t));if(t)for(let t=this.subList.length-1;t>=0;t--){const e=this.subList[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}for(let t=this.children.length-1;t>=0;t--){const e=this.children[t];null==e||e.commonTimeNode.seekToStart()}}dispose(t=!1){this.isConflictDispose=t,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(ZR.animateEnd);try{this.ctx.ticker.remove(this.updateTimeLine)}catch(t){}this.startConds.reset(),this.endConds.reset()}seekToEnd(t,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const n=this.json.autoRev||t;if(n?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(t=>t.seekToEnd(n,e));0===this.children.length&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(t=>t.commonTimeNode.seekToEnd(n,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(t=>t.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEnd(){let t=!0;return this.children.length>0&&(t=t&&this.children.every(t=>t.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(t=t&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(t=t&&!this.isReverse),t=t&&this.isNatureTimeEnd(),!!this.isConflictDispose||(!(!this.isIterateEnd||!this.json.iterate)||t)}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(t=>t.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(t=>t.commonTimeNode.destroy()),this.clearSubList()}}class RR extends a.a{constructor(t){super(),this.isRunning=!1,this.runtimeNodeEventHub=new a.a;const{json:e,iterateType:n,isIterate:i,isSub:r,parent:o,ctx:s,eventHub:l,iterateIndex:u,iterateId:h}=t;this.id=e.ctn.id,this.json=e,this.ctx=s,this.isIterate=i,this.globalEventHub=l,this.commonTimeNode=new AR({json:e.ctn,isSub:r,eventHubs:{global:l,runtime:this.runtimeNodeEventHub},ctx:s,parent:o,isIterate:!1,iterateType:n,iterateIndex:u,iterateId:h}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),t.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(t=>{t.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var CR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class PR{constructor(t,e,n){this.json=t,this.ctx=n,this.globalEventHub=e;const i=t.timeNodeList.find(t=>"par"===t.type&&"tmRoot"===t.ctn.nodeType);i&&(this.tmRoot=new RR({json:i,isSub:!1,isIterate:!1,eventHub:e,ctx:n,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"mainSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))}findSeq(t){var e;return null===(e=this.tmRoot)||void 0===e?void 0:e.commonTimeNode.children.find(e=>{var n,i,r;return"seq"===(null===(n=e.json)||void 0===n?void 0:n.type)&&(null===(r=null===(i=e.json)||void 0===i?void 0:i.ctn)||void 0===r?void 0:r.id)===t})}start(){var t,e;return CR(this,void 0,void 0,(function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.startTimeNode()):null===(e=this.mainSeq)||void 0===e||e.commonTimeNode.startTimeNode()}))}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var t;null===(t=this.mainSeq)||void 0===t||t.commonTimeNode.collectStartValue()}setMainSeqStep(t,e){var n;-1===t&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),null===(n=this.mainSeq)||void 0===n||n.setCurrentStep(t,e)}destroy(){var t;this.globalEventHub.removeAllListeners(),null===(t=this.tmRoot)||void 0===t||t.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(t){const e=this.findSeq(t);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(t,e,n){const i=this.findSeq(t);i&&i.setCurrentStep(e,n)}resetAllInteractiveSeq(){var t;((null===(t=this.tmRoot)||void 0===t?void 0:t.commonTimeNode.children.filter(t=>{var e,n,i;return"seq"===(null===(e=t.json)||void 0===e?void 0:e.type)&&"interactiveSeq"===(null===(i=null===(n=t.json)||void 0===n?void 0:n.ctn)||void 0===i?void 0:i.nodeType)}))||[]).forEach(t=>{t.setCurrentStep(0,"start")})}applyInteractiveAction(t){this.globalEventHub.emit(t)}}var IR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class OR extends KA{constructor(t,e,n,i){super({id:"stage",width:t.width,height:t.height,type:"Container",children:t.children},e,n,void 0,i),this.isRendered=!1,this.isTimingStartValueCollected=!1,this.globalEventHub=new a.a,this.json=t,e.hasBackgroundFillShape=this.detectUseBackgroundFill(this.json),this.container.visible=!1,this.ctx=e;const r=new AT;r.beginFill(16777215),r.drawRect(0,0,t.width,t.height),r.endFill(),this.container.addChild(r)}detectUseBackgroundFill(t){return!!t&&("Picture"===t.type||"Shape"===t.type?t.useBgFill:!(!t.children||!Object(l.isArray)(t.children))&&t.children.some(t=>this.detectUseBackgroundFill(t)))}initOnReuse(){super.initOnReuse(),this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(ZR.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(ZR.requestNextSlide)})}get interactiveContainer(){return this.container}render(t){this.isRendered||(this.isRendered=!0,super.render(t),t.addSubMTask(()=>IR(this,void 0,void 0,(function*(){this.ctx.eventHub.emit("StageRenderEnd")}))))}createTiming(){this.json.timing&&!this.timing&&(this.timing=new PR(this.json.timing,this.globalEventHub,this.ctx))}startTiming(){var t;return(null===(t=this.timing)||void 0===t?void 0:t.start())||Promise.resolve()}setMainSeqApplied(){var t;null===(t=this.timing)||void 0===t||t.setMainSeqApplied()}setMainSeqStep(t,e){var n;null===(n=this.timing)||void 0===n||n.setMainSeqStep(t,e)}collectMainSeqStartValue(){var t;this.isTimingStartValueCollected||(this.isTimingStartValueCollected=!0,null===(t=this.timing)||void 0===t||t.collectMainSeqStartValue())}hasTiming(){return!!this.timing}clearOnSlideChange(){this.ctx.eventHub.removeAllListeners(),this.globalEventHub.removeAllListeners(),super.clearOnSlideChange()}clearOnTransactionEnd(){var t,e;this.ctx.timingTargets.getTargets().forEach(t=>{t.hasPreset=!1}),null===(t=this.timing)||void 0===t||t.resetAllInteractiveSeq(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0}destroy(){var t,e;this.isTimingStartValueCollected=!1,this.isRendered=!1,this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),null===(t=this.ctx.bgTexture)||void 0===t||t.destroy(!0),this.ctx.spriteTexture.destroy(),this.globalEventHub.removeAllListeners(),null===(e=this.timing)||void 0===e||e.destroy(),this.timing=void 0,super.destroy()}mainSeqStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqStep())&&void 0!==e?e:0}mainSeqLength(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.currentMainSeqLength())&&void 0!==e?e:0}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.timing)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?(this.globalEventHub.emit("shape slide onStopAudio"),this.globalEventHub.emit("shape slide onNext")):this.ctx.eventHub.emit(ZR.requestNextSlide)}prevStep(){var t;this.hasTiming()&&(null===(t=this.timing)||void 0===t?void 0:t.hasMainSeq())?(this.globalEventHub.emit("shape slide onStopAudio"),this.globalEventHub.emit("shape slide onPrev")):this.ctx.eventHub.emit(ZR.requestPrevSlide)}applyInteractiveAction(t){var e;null===(e=this.timing)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.timing)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.timing)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){return IR(this,void 0,void 0,(function*(){const n=this.ctx.medias[t];n&&(e?yield n.play():yield n.pause())}))}setMediaCurrentTime(t,e){const n=this.ctx.medias[t];n&&n.seek(e)}}class LR{constructor(t){this.ticker=t,this.tasks=[],this.couldRunning=!1,this.applyNext=()=>{const t=this.tasks[0];t&&t.applyNext()},t.add(this.applyNext)}addTask(t){this.tasks.push(t),t.once("task-finish",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)}),t.once("task-error",()=>{const e=this.tasks.indexOf(t);e>=0&&this.tasks.splice(e,1)})}start(){this.couldRunning=!0}stop(){this.couldRunning=!1}}const NR=new class{constructor(){this.info=[],this.warn=[],this.error=[]}attach(t,e){this[t]&&this[t].push(e)}createLogger(t){return(e,n)=>{this[t].forEach(t=>{t(`[taskId:${n}] ${e}`)})}}},DR={warn:NR.createLogger("warn"),error:NR.createLogger("error"),info:NR.createLogger("info")};var FR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const BR=t=>new Promise(e=>setTimeout(e,t));class UR extends a.a{constructor(t,e){super(),this.slideIndex=t,this.taskId=e,this.uuid=aM(),this.isCancel=!1,this.tasks=[]}addMTask(t){this.tasks.push({fn:t,state:"wait",sub:[]})}addSubMTask(t){let e=this.tasks.findIndex(t=>"running"===t.state);e<0&&(e=0),this.tasks[e].sub.push({fn:t,state:"wait",sub:[]})}cancel(){this.tasks=[],this.isCancel=!0}applyNext(){if(this.tasks.some(t=>"running"===t.state))return;if(this.tasks.some(t=>"error"===t.state))return;if(this.tasks.every(t=>"finish"===t.state))return void(this.isCancel||this.emit("task-finish"));const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",DR.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",KE.transform(e),this.slideIndex)}))}applyAll(){return FR(this,void 0,void 0,(function*(){for(;!this.tasks.every(t=>"finish"===t.state);)if(this.tasks.some(t=>"running"===t.state))yield BR(16);else{if(this.tasks.some(t=>"error"===t.state))return;{const t=this.tasks.find(t=>"wait"===t.state);t&&(t.state="running",yield t.fn.apply(null).then(()=>{if(t.state="finish",t.sub.length>0){const e=this.tasks.findIndex(e=>e===t);this.tasks.splice(e+1,0,...t.sub)}}).catch(e=>{t.state="error",DR.error(`${e} ${e.stack}`,this.taskId),this.emit("task-error",KE.transform(e),this.slideIndex)}))}}this.isCancel||this.emit("task-finish")}))}}var kR=n(54);const GR=new(n.n(kR).a),HR=GR.getDevice(),zR=GR.getBrowser(),jR=GR.getOS(),VR={isDesktop(){let t=!0;return"mobile"===HR.type&&(t=!1),/Samsung/.test(zR.name||"")&&(t=!1),window.__nativeTags&&window.__nativeTags.platform&&(t=!1),t},isIOS(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^ios/i.test(window.__nativeTags.platform)&&(t=!0),jR.name&&/iOS/.test(jR.name)&&(t=!0),t},isAndroid(){let t=!1;return window.__nativeTags&&window.__nativeTags.platform&&/^android/i.test(window.__nativeTags.platform)&&(t=!0),jR.name&&/android/i.test(jR.name)&&(t=!0),t},isLowGpuMemory(){var t,e;const n=null!==(e=null===(t=window.__nativeTags)||void 0===t?void 0:t.platform)&&void 0!==e?e:"";if(n){const t=n.split(" ");if(t[1]){if(/^iPad/.test(t[1])){const e=t[1].match(/^iPad(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=6)}if(/^iPhone/.test(t[1])){const e=t[1].match(/^iPhone(\d+)/);return!(e&&e[1]&&parseInt(e[1],10)>=9)}return!1}return!1}return!0}};var WR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class XR{constructor(t,e,n,i,r,o,s,a){this.loader=t,this.mode=e,this.renderer=n,this.ticker=i,this.view=r,this.clock=o,this.objPoolGroup=s,this.errorChannel=a,this.currentStageIndex=0,this.cacheCount=VR.isDesktop()?2:1,this.stageStates=Object.create(null),this.stageJsons=Object.create(null),this.stageCtxs=Object.create(null),this.stageImpls=Object.create(null),this.taskId="",this.url="",this.microTaskManager=new LR(i)}setSnapshotCache(t){this.snapshotCache=t}setResourceData(t,e){this.taskId=t,this.url=e}createCtx(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const e=new cM(this.loader),n=new a.a,i={mode:this.mode,renderer:this.renderer,graphicsTexture:new xM,stageWidth:0,stageHeight:0,ticker:this.ticker,timingTargets:new wM(n),eventHub:n,view:this.view,medias:Object.create(null),lastViewedIndex:0,conflictTimeNodeManager:new bM,clock:this.clock,spriteTexture:e,slideIndex:t,objectPoolGroup:this.objPoolGroup,hasBackgroundFillShape:!1,slideScopeEventHub:new a.a};this.stageCtxs[t]=i})))}loadStageJson(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${t}.json`);this.stageJsons[t]=e,this.stageCtxs[t].stageWidth=e.width,this.stageCtxs[t].stageHeight=e.height})))}loadSpriteSheets(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],{spriteTexture:i}=this.stageCtxs[t],{coloredSheets:r,sheets:o}=n,s=r||o;return s&&s.forEach(t=>{e.addSubMTask(()=>i.loadSpriteSheetItem(this.url,this.taskId,t))}),Promise.resolve()})}createStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>{const n=this.stageJsons[t],i=this.stageCtxs[t],r=new OR(n,i,{x:0,y:0},e);return this.stageImpls[t]=r,Promise.resolve()})}preRenderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>(this.stageImpls[t].preRender(e),Promise.resolve()))}createGraphicsTexture(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const n=this.stageCtxs[t];n.graphicsTexture.pack().forEach((t,i)=>{e.addSubMTask(()=>n.graphicsTexture.render(t,i,this.objPoolGroup))})})))}renderStage(t){const{task:e}=this.stageStates[t];e.addMTask(()=>WR(this,void 0,void 0,(function*(){const n=this.stageImpls[t],i=this.stageCtxs[t];yield n.render(e),e.addSubMTask(()=>WR(this,void 0,void 0,(function*(){var e,r;if(!(yield null===(e=this.snapshotCache)||void 0===e?void 0:e.getItem(t.toString()+"-start"))&&JR.platform.isLowGpuMemory()){n.createTiming(),n.container.visible=!0,n.collectMainSeqStartValue(),n.setMainSeqStep(0,"start");const e=Hy.create({width:n.json.width,height:n.json.height,resolution:1});i.renderer.render(n.container,{renderTexture:e});const o=i.renderer.plugins.extract.base64(e,"image/jpeg");yield null===(r=this.snapshotCache)||void 0===r?void 0:r.setItem(t.toString()+"-start",o),n.container.visible=!1,e.destroy(),n.timing&&(n.timing.destroy(),n.timing=void 0)}})))})))}destroyStageByIndex(t){"load"===this.stageStates[t].state&&this.stageStates[t].task.cancel(),delete this.stageStates[t];this.stageImpls[t].destroy(),delete this.stageImpls[t],delete this.stageCtxs[t]}destroyStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);Math.abs(this.currentStageIndex-e)>this.cacheCount&&this.destroyStageByIndex(e)})}destroyAllStage(){Object.keys(this.stageImpls).forEach(t=>{const e=parseInt(t,10);this.destroyStageByIndex(e)})}preload(t,e=!1){if(this.stageImpls[t]||this.stageStates[t])return Promise.resolve();const n=new UR(t,this.taskId);return n.on("task-error",(t,e)=>{this.errorChannel.emit("error",t,e)}),this.stageStates[t]={state:"load",task:n},this.createCtx(t),this.loadStageJson(t),this.loadSpriteSheets(t),this.createStage(t),this.preRenderStage(t),this.createGraphicsTexture(t),this.renderStage(t),this.microTaskManager.addTask(n),e?n.applyAll():new Promise(e=>{n.once("task-finish",()=>{this.stageStates[t].state="finish";Object.keys(this.stageStates).length>2*this.cacheCount+1&&this.destroyStage(),e()})})}getStageJson(t){return this.stageJsons[t]||null}getStage(t){return WR(this,void 0,void 0,(function*(){this.currentStageIndex=t;const e=this.stageStates[t];return"finish"===(null==e?void 0:e.state)&&this.stageImpls[t]?this.stageImpls[t]:"load"===(null==e?void 0:e.state)?(yield e.task.applyAll(),this.stageImpls[t]):(yield this.preload(t,!0),this.stageImpls[t])}))}}var qR=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};r.skipHello();const YR={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip"},ZR={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqAction:"interactiveSeqAction",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide",userInput:"userInput"};class JR extends a.a{constructor(t,e={}){super(),this.errorChannel=new a.a,this.loader=new eM(!("debug"===window.__slide_env__)),this.transactionPlayer=new og,this.transactionSprite=new OT,this.isForward=!0,this.drawCall=0,this.scale=1,this.prevSlideBase64=null,this.fps=new qE,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.onWebGLLost=()=>{this.errorChannel.emit("error",new KE(JE.CanvasCrash,"webgl context lost."))},this.mode=t;let n=Math.max(window.devicePixelRatio,2);VR.isDesktop()||(n=1),this.config={minFPS:Object(l.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(l.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(l.isUndefined)(e.resolution)?n:e.resolution,autoFPS:!Object(l.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(l.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(l.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor},this.app=new Lb({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const i=this.app.renderer,{drawElements:r}=i.gl;i.gl.drawElements=(...t)=>{r.call(i.gl,...t),this.drawCall+=1},this.fps.on("update",t=>{if(t<this.config.minFPS){if(this.config.autoResolution){const t=.7*this.scale,e=this.app.renderer.resolution,n=Math.max(t,e-.1);n>=t&&this.updateResolution(n)}if(this.config.autoFPS){const t=14,{minFPS:e,maxFPS:n}=this.app.ticker,i=Math.max(t,e-2),r=Math.max(t,n-2);i>=t&&r>=t&&(this.app.ticker.minFPS=i,this.app.ticker.maxFPS=r)}}else if(t>this.config.maxFPS){if(this.config.autoResolution){const t=this.scale*this.config.resolution,e=this.app.renderer.resolution,n=Math.min(t,e+.1);n<=this.config.resolution&&this.updateResolution(n)}if(this.config.autoFPS){const t=this.config.minFPS,e=this.config.maxFPS,{minFPS:n,maxFPS:i}=this.app.ticker,r=Math.min(t,n+2),o=Math.min(e,i+2);r<=t&&o<=e&&(this.app.ticker.minFPS=r,this.app.ticker.maxFPS=o)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,ey.LOW),this.clock=new uM(this.app.ticker),this.objPoolGroup=aM(),this.stagePool=new XR(this.loader,this.mode,this.app.renderer,this.app.ticker,this.app.view,this.clock,this.objPoolGroup,this.errorChannel),this.app.view.addEventListener("webglcontextlost",this.onWebGLLost)}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var t;return(null===(t=this.currentStage)||void 0===t?void 0:t.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}updateConfig(t){Object(l.isUndefined)(t.minFPS)||(this.config.minFPS=t.minFPS,this.app.ticker.minFPS=t.minFPS),Object(l.isUndefined)(t.maxFPS)||(this.config.maxFPS=t.maxFPS,this.app.ticker.maxFPS=t.maxFPS),Object(l.isUndefined)(t.resolution)||(this.config.resolution=t.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(l.isUndefined)(t.autoFPS)||(this.config.autoFPS=t.autoFPS),Object(l.isUndefined)(t.autoResolution)||(this.config.autoResolution=t.autoResolution),Object(l.isUndefined)(t.transactionBgColor)||(this.config.transactionBgColor=t.transactionBgColor),this.taskId&&DR.info("ppt player update config: "+JSON.stringify(this.config),this.taskId)}preload(t){return qR(this,void 0,void 0,(function*(){t<1||t>this.slideCount||(DR.info(`preload slide ${t} begin`,this.taskId),yield this.stagePool.preload(t),DR.info(`preload slide ${t} end`,this.taskId))}))}setResourceData(t,e){DR.info("ppt player init config: "+JSON.stringify(this.config),t),DR.info("set resource to "+e,t),this.taskId=t,this.url=e,this.stagePool.setResourceData(t,e),this.loader.bindTask(t);const n=this.taskId;this.snapshotCache=XE.a.createInstance({name:"_slide_snapshot_cache_",storeName:n,driver:XE.a.INDEXEDDB,version:1}),ZE.updateActiveTime("_slide_snapshot_cache_",n).catch(()=>{}),this.stagePool.setSnapshotCache(this.snapshotCache)}setInteractive(t){this.app.stage.interactive=t,this.app.stage.interactiveChildren=t}translateEvent(t,e){e.forEach(e=>{t.on(e,(...t)=>{this.emit(e,...t)})})}renderSlide(t,e=!1){var n,i;return qR(this,void 0,void 0,(function*(){DR.info("render slide "+t,this.taskId),this.emit(ZR.renderStart,t);const r=yield this.stagePool.getStage(t);this.translateEvent(r.ctx.eventHub,[ZR.mainSeqStepChange,ZR.mainSeqStateChange,ZR.hyperlinkTrigger,ZR.interactiveSeqAction,ZR.mainSeqStepStart,ZR.mainSeqStepEnd,ZR.animateStart,ZR.animateEnd,ZR.mediaPlay,ZR.mediaPause,ZR.mediaSeek,ZR.requestGotoSlide,ZR.requestNextSlide,ZR.requestPrevSlide,ZR.interactiveSeqStateChange,ZR.userInput]),this.currentIndex=Number(t);const{width:o,height:s,slideCount:a}=r.json;this.slideCount=a,this.designWidth=o,this.designHeight=s,r.json.transition&&r.json.transition.type&&!this.prevSlideBase64&&this.currentStage&&(this.prevSlideBase64=this.getBase64(this.currentStage)),null===(n=this.currentStage)||void 0===n||n.clearOnSlideChange();const l=this.currentStage;this.currentStage=r,r.initOnReuse(),r.createTiming(),r.container.visible=!0,r.collectMainSeqStartValue(),this.isForward?r.setMainSeqStep(0,"start"):r.setMainSeqStep(-1,"end");let u=null;if(r.json.transition&&r.json.transition.type){const n=t.toString()+(this.isForward||e?"-start":"-end"),r=yield null===(i=this.snapshotCache)||void 0===i?void 0:i.getItem(n);u=r||this.getBase64(this.currentStage)}r.container.visible=!1,this.app.stage.addChild(r.container);let{transition:h}=r.json;!this.isForward&&(null==l?void 0:l.json.transition)&&(h=l.json.transition),this.prevSlideBase64&&u&&h&&h.type&&l&&r&&(yield this.playTransaction(this.prevSlideBase64,u,h,l,r),this.prevSlideBase64=null),this.isForward?yield r.startTiming():r.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),r.container.visible=!0,l&&(l.setMainSeqStep(0,"start"),l.clearOnTransactionEnd(),this.app.stage.removeChild(l.container)),r.ctx.slideScopeEventHub.emit("slide-render",r.ctx.slideIndex),this.emit(ZR.renderEnd,t),this.emit(ZR.slideChange,t),this.preload(t+1).catch(e=>{this.errorChannel.emit("error",KE.transform(e),t+1)}),this.preload(t-1).catch(e=>{this.errorChannel.emit("error",KE.transform(e),t-1)})}))}getBase64(t){if(!t.container.transform)return null;const e=Hy.create({width:this.designWidth,height:this.designHeight,resolution:1});this.app.renderer.render(t.container,{renderTexture:e});const n=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(!0),n}playTransaction(t,e,n,i,r){return qR(this,void 0,void 0,(function*(){const o=this.app.view.parentElement;if(t&&e&&o&&YR[n.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.transactionSprite.visible=!1,this.app.stage.addChild(this.transactionSprite);const o=this.transactionPlayer.renderer.domElement,s=ky.from(o),a=()=>s.update();return this.app.ticker.add(a),this.transactionSprite.texture=s,setTimeout(()=>{this.transactionSprite.visible=!0},100),new Promise(o=>{var s,l,u,h;null===(s=this.transactionPlayer)||void 0===s||s.play({reverse:!this.isForward,prevTextureUrl:t,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:YR[n.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:null===(u=null===(l=this.currentStage)||void 0===l?void 0:l.json.transition)||void 0===u?void 0:u.dur,delay:0,clearColor:this.config.transactionBgColor,maxFPS:Math.ceil(null!==(h=this.config.maxFPS)&&void 0!==h?h:60),onTransactionEnd:()=>{var t,e;o(),i.container.visible=!1,r.container.visible=!0,null===(t=this.app.stage)||void 0===t||t.removeChild(this.transactionSprite),null===(e=this.app.ticker)||void 0===e||e.remove(a)}})})}return Promise.resolve()}))}scaleView(t,e=!1){if(this.view&&(this.view.style.width=Math.floor(this.designWidth*t)+"px",this.view.style.height=Math.floor(this.designHeight*t)+"px"),e){this.scale=t;const e=this.scale*this.config.resolution;this.updateResolution(e)}}updateResolution(t){this.app.ticker.addOnce(()=>{let e=VR.isDesktop()?t:1;for(;e*this.designWidth>5120||e*this.designHeight>5120;)e-=.1;this.app.renderer.resolution=e,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight)})}nextStep(){var t;DR.info("ppt play trigger next step",this.taskId);try{null===(t=this.currentStage)||void 0===t||t.nextStep()}catch(t){this.errorChannel.emit("error",KE.transform(t),this.currentIndex)}}prevStep(){var t;DR.info("ppt play trigger prev step",this.taskId);try{null===(t=this.currentStage)||void 0===t||t.prevStep()}catch(t){this.errorChannel.emit("error",KE.transform(t),this.currentIndex)}}mainSeqLength(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqLength())&&void 0!==e?e:0}mainSeqStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqStep())&&void 0!==e?e:0}setMainSeqStep(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMainSeqStep(t,e)}mainSeqState(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqState())&&void 0!==e?e:null}mainSeqHasNextStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasNextStep())&&void 0!==e&&e}mainSeqHasPrevStep(){var t,e;return null!==(e=null===(t=this.currentStage)||void 0===t?void 0:t.mainSeqHasPrevStep())&&void 0!==e&&e}nextTick(t){this.app.ticker.addOnce(()=>{t()},ey.LOW)}applyInteractiveAction(t){var e;null===(e=this.currentStage)||void 0===e||e.applyInteractiveAction(t)}seekInteractiveSeqToEnd(t){var e;null===(e=this.currentStage)||void 0===e||e.seekInteractiveSeqToEnd(t)}setInteractiveSeqState(t,e,n){var i;null===(i=this.currentStage)||void 0===i||i.setInteractiveSeqState(t,e,n)}setMediaState(t,e){var n;return qR(this,void 0,void 0,(function*(){yield null===(n=this.currentStage)||void 0===n?void 0:n.setMediaState(t,e)}))}setMediaCurrentTime(t,e){var n;null===(n=this.currentStage)||void 0===n||n.setMediaCurrentTime(t,e)}pause(){this.app.ticker.stop()}resume(){this.app.ticker.start()}getSnapshot(){return this.currentStage&&this.getBase64(this.currentStage)||""}createSnapshotForNextSlide(t){var e,n;return qR(this,void 0,void 0,(function*(){const i=this.nextSlideIndex,r=this.stagePool.getStageJson(i);if(r&&r.transition&&r.transition.type&&this.currentStage&&this.transactionPlayer){const i=t?this.currentStage.json.index+"-start":this.currentStage.json.index+"-end";if(this.currentStage.timing&&(t?this.currentStage.timing.mainSeqHasPrevStep():this.currentStage.timing.mainSeqHasNextStep()))this.prevSlideBase64=this.getBase64(this.currentStage);else{const t=yield null===(e=this.snapshotCache)||void 0===e?void 0:e.getItem(i);t?this.prevSlideBase64=t:(this.prevSlideBase64=this.getBase64(this.currentStage),null===(n=this.snapshotCache)||void 0===n||n.setItem(i,this.prevSlideBase64))}}}))}destroy(){var t;try{this.app.view.removeEventListener("webglcontextlost",this.onWebGLLost);try{this.app.renderer.filter.texturePool.clear(!0)}catch(t){}vM.collectObjectByGroup(this.objPoolGroup),_M.collectObjectByGroup(this.objPoolGroup),null===(t=this.transactionPlayer)||void 0===t||t.destroy(),this.loader.destroy(),this.fps.destroy(),this.stagePool.destroyAllStage();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){}this.app.destroy(!0,{children:!0,texture:!0,baseTexture:!0})}catch(t){}}}JR.storeManager=ZE,JR.platform=VR,JR.RtcAudioClazz=null;var KR,$R=[],QR="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(KR||(KR={}));var tC,eC=function(t){return Object.freeze(t)},nC=function(t,e){this.inlineSize=t,this.blockSize=e,eC(this)},iC=function(){function t(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,eC(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),rC=function(t){return t instanceof SVGElement&&"getBBox"in t},oC=function(t){if(rC(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,o=r.offsetWidth,s=r.offsetHeight;return!(o||s||t.getClientRects().length)},sC=function(t){var e,n;if(t instanceof Element)return!0;var i=null===(n=null===(e=t)||void 0===e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(i&&t instanceof i.Element)},aC="undefined"!=typeof window?window:{},lC=new WeakMap,uC=/auto|scroll/,hC=/^tb|vertical/,cC=/msie|trident/i.test(aC.navigator&&aC.navigator.userAgent),dC=function(t){return parseFloat(t||"0")},pC=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=!1),new nC((n?e:t)||0,(n?t:e)||0)},fC=eC({devicePixelContentBoxSize:pC(),borderBoxSize:pC(),contentBoxSize:pC(),contentRect:new iC(0,0,0,0)}),mC=function(t,e){if(void 0===e&&(e=!1),lC.has(t)&&!e)return lC.get(t);if(oC(t))return lC.set(t,fC),fC;var n=getComputedStyle(t),i=rC(t)&&t.ownerSVGElement&&t.getBBox(),r=!cC&&"border-box"===n.boxSizing,o=hC.test(n.writingMode||""),s=!i&&uC.test(n.overflowY||""),a=!i&&uC.test(n.overflowX||""),l=i?0:dC(n.paddingTop),u=i?0:dC(n.paddingRight),h=i?0:dC(n.paddingBottom),c=i?0:dC(n.paddingLeft),d=i?0:dC(n.borderTopWidth),p=i?0:dC(n.borderRightWidth),f=i?0:dC(n.borderBottomWidth),m=c+u,g=l+h,v=(i?0:dC(n.borderLeftWidth))+p,_=d+f,y=a?t.offsetHeight-_-t.clientHeight:0,x=s?t.offsetWidth-v-t.clientWidth:0,b=r?m+v:0,w=r?g+_:0,T=i?i.width:dC(n.width)-b-x,S=i?i.height:dC(n.height)-w-y,E=T+m+x+v,M=S+g+y+_,A=eC({devicePixelContentBoxSize:pC(Math.round(T*devicePixelRatio),Math.round(S*devicePixelRatio),o),borderBoxSize:pC(E,M,o),contentBoxSize:pC(T,S,o),contentRect:new iC(c,l,T,S)});return lC.set(t,A),A},gC=function(t,e,n){var i=mC(t,n),r=i.borderBoxSize,o=i.contentBoxSize,s=i.devicePixelContentBoxSize;switch(e){case KR.DEVICE_PIXEL_CONTENT_BOX:return s;case KR.BORDER_BOX:return r;default:return o}},vC=function(t){var e=mC(t);this.target=t,this.contentRect=e.contentRect,this.borderBoxSize=eC([e.borderBoxSize]),this.contentBoxSize=eC([e.contentBoxSize]),this.devicePixelContentBoxSize=eC([e.devicePixelContentBoxSize])},_C=function(t){if(oC(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},yC=function(){var t=1/0,e=[];$R.forEach((function(n){if(0!==n.activeTargets.length){var i=[];n.activeTargets.forEach((function(e){var n=new vC(e.target),r=_C(e.target);i.push(n),e.lastReportedSize=gC(e.target,e.observedBox),r<t&&(t=r)})),e.push((function(){n.callback.call(n.observer,i,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,i=e;n<i.length;n++){(0,i[n])()}return t},xC=function(t){$R.forEach((function(e){e.activeTargets.splice(0,e.activeTargets.length),e.skippedTargets.splice(0,e.skippedTargets.length),e.observationTargets.forEach((function(n){n.isActive()&&(_C(n.target)>t?e.activeTargets.push(n):e.skippedTargets.push(n))}))}))},bC=function(){var t,e=0;for(xC(e);$R.some((function(t){return t.activeTargets.length>0}));)e=yC(),xC(e);return $R.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:QR}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=QR),window.dispatchEvent(t)),e>0},wC=[],TC=function(t){if(!tC){var e=0,n=document.createTextNode("");new MutationObserver((function(){return wC.splice(0).forEach((function(t){return t()}))})).observe(n,{characterData:!0}),tC=function(){n.textContent=""+(e?e--:e++)}}wC.push(t),tC()},SC=0,EC={attributes:!0,characterData:!0,childList:!0,subtree:!0},MC=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],AC=function(t){return void 0===t&&(t=0),Date.now()+t},RC=!1,CC=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var e=this;if(void 0===t&&(t=250),!RC){RC=!0;var n,i=AC(t);n=function(){var n=!1;try{n=bC()}finally{if(RC=!1,t=i-AC(),!SC)return;n?e.run(1e3):t>0?e.run(t):e.start()}},TC((function(){requestAnimationFrame(n)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,e=function(){return t.observer&&t.observer.observe(document.body,EC)};document.body?e():aC.addEventListener("DOMContentLoaded",e)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),MC.forEach((function(e){return aC.addEventListener(e,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),MC.forEach((function(e){return aC.removeEventListener(e,t.listener,!0)})),this.stopped=!0)},t}()),PC=function(t){!SC&&t>0&&CC.start(),!(SC+=t)&&CC.stop()},IC=function(){function t(t,e){this.target=t,this.observedBox=e||KR.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,e=gC(this.target,this.observedBox,!0);return t=this.target,rC(t)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),OC=function(t,e){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=e},LC=new WeakMap,NC=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},DC=function(){function t(){}return t.connect=function(t,e){var n=new OC(t,e);LC.set(t,n)},t.observe=function(t,e,n){var i=LC.get(t),r=0===i.observationTargets.length;NC(i.observationTargets,e)<0&&(r&&$R.push(i),i.observationTargets.push(new IC(e,n&&n.box)),PC(1),CC.schedule())},t.unobserve=function(t,e){var n=LC.get(t),i=NC(n.observationTargets,e),r=1===n.observationTargets.length;i>=0&&(r&&$R.splice($R.indexOf(n),1),n.observationTargets.splice(i,1),PC(-1))},t.disconnect=function(t){var e=this,n=LC.get(t);n.observationTargets.slice().forEach((function(n){return e.unobserve(t,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},t}(),FC=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");DC.connect(this,t)}return t.prototype.observe=function(t,e){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!sC(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");DC.observe(this,t,e)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!sC(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");DC.unobserve(this,t)},t.prototype.disconnect=function(){DC.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),BC=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},UC=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},kC=function(){function t(t,e,n,i,r){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=n,this.index=t,this.slideIndex=e,this.eventHub=i,this.id=r}return t.prototype.apply=function(){return BC(this,void 0,void 0,(function(){var t;return UC(this,(function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return t=e.sent(),this.eventHub.emit("task-error",{task:this,error:t}),[3,4];case 4:return[2]}}))}))},t}(),GC=function(){function t(){var t=this;this.eventHub=new a.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",(function(e){var n,i=t.tasks.findIndex((function(t){return t.index===e.index})),r=i+1;r>=0&&(null===(n=t.tasks[r])||void 0===n||n.apply()),i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask()),t.eventHub.emit("task-end-"+e.id)})),this.eventHub.on("task-error",(function(e){var n=e.task,i=t.tasks.findIndex((function(t){return t.index===n.index}));i>=0&&(t.tasks.splice(i,1),t.replaceIdleTask())}))}return t.prototype.replaceIdleTask=function(){for(var t,e=this,n=new Set,i=0,r=this.tasks.length;i<r;i++)"idle"===this.tasks[i].state&&"idle"===(null===(t=this.tasks[i+1])||void 0===t?void 0:t.state)&&n.add(i);Array.from(n).forEach((function(t){e.tasks.splice(t,1)}))},t.prototype.addTask=function(t,e,n){var i=new kC(this.index++,e,t,this.eventHub,n);this.tasks.push(i),this.tasks.sort((function(t,e){return t.index-e.index})),this.replaceIdleTask(),1===this.tasks.length&&i.apply()},t.prototype.hasStartTask=function(){return this.tasks.some((function(t){return"start"===t.state}))},t}();function HC(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),s=t.a,a=Math.round(t.h),l=t.s.toFixed(1),u=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+s+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+u+",a:"+s+"}":"unknown format"}var zC=Array.prototype.forEach,jC=Array.prototype.slice,VC={BREAK:{},extend:function(t){return this.each(jC.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(jC.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=jC.call(arguments);return function(){for(var e=jC.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(zC&&t.forEach&&t.forEach===zC)t.forEach(e,n);else if(t.length===t.length+0){var i,r=void 0;for(r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){var r=this,o=arguments;function s(){i=null,n||t.apply(r,o)}var a=n||!i;clearTimeout(i),i=setTimeout(s,e),a&&t.apply(r,o)}},toArray:function(t){return t.toArray?t.toArray():jC.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},WC=[{litmus:VC.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:HC},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:HC},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:HC},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:HC}}},{litmus:VC.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:VC.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:VC.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(VC.isNumber(t.r)&&VC.isNumber(t.g)&&VC.isNumber(t.b)&&VC.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(VC.isNumber(t.r)&&VC.isNumber(t.g)&&VC.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(VC.isNumber(t.h)&&VC.isNumber(t.s)&&VC.isNumber(t.v)&&VC.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(VC.isNumber(t.h)&&VC.isNumber(t.s)&&VC.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],XC=void 0,qC=void 0,YC=function(){qC=!1;var t=arguments.length>1?VC.toArray(arguments):arguments[0];return VC.each(WC,(function(e){if(e.litmus(t))return VC.each(e.conversions,(function(e,n){if(XC=e.read(t),!1===qC&&!1!==XC)return qC=XC,XC.conversionName=n,XC.conversion=e,VC.BREAK})),VC.BREAK})),qC},ZC=void 0,JC={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=[[n,a,o],[s,n,o],[o,n,a],[o,s,n],[a,o,n],[n,o,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,(s/=6)<0&&(s+=1),{h:360*s,s:o/r,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(ZC=8*e)|t&~(255<<ZC)}},KC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$C=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},QC=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),tP=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0},eP=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},nP=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},iP=function(){function t(){if($C(this,t),this.__state=YC.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return QC(t,[{key:"toString",value:function(){return HC(this)}},{key:"toHexString",value:function(){return HC(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function rP(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||iP.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(iP.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function oP(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||iP.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(iP.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}iP.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=JC.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");VC.extend(t.__state,JC.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},iP.recalculateHSV=function(t){var e=JC.rgb_to_hsv(t.r,t.g,t.b);VC.extend(t.__state,{s:e.s,v:e.v}),VC.isNaN(e.h)?VC.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},iP.COMPONENTS=["r","g","b","h","s","v","hex","a"],rP(iP.prototype,"r",2),rP(iP.prototype,"g",1),rP(iP.prototype,"b",0),oP(iP.prototype,"h"),oP(iP.prototype,"s"),oP(iP.prototype,"v"),Object.defineProperty(iP.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(iP.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=JC.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var sP=function(){function t(e,n){$C(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return QC(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),aP={};VC.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){VC.each(t,(function(t){aP[t]=e}))}));var lP=/(\d+(\.\d+)?)px/;function uP(t){if("0"===t||VC.isUndefined(t))return 0;var e=t.match(lP);return VC.isNull(e)?0:parseFloat(e[1])}var hP={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,n){var i=n,r=e;VC.isUndefined(r)&&(r=!0),VC.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=aP[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var a=r.x||r.clientX||0,l=r.y||r.clientY||0;s.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var u=s.initKeyboardEvent||s.initKeyEvent;VC.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),u(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(e,r.bubbles||!1,r.cancelable||!0)}VC.defaults(s,i),t.dispatchEvent(s)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),hP},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),hP},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return hP},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return hP},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return uP(e["border-left-width"])+uP(e["border-right-width"])+uP(e["padding-left"])+uP(e["padding-right"])+uP(e.width)},getHeight:function(t){var e=getComputedStyle(t);return uP(e["border-top-width"])+uP(e["border-bottom-width"])+uP(e["padding-top"])+uP(e["padding-bottom"])+uP(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},cP=function(t){function e(t,n){$C(this,e);var i=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),hP.bind(i.__checkbox,"change",(function(){r.setValue(!r.__prev)}),!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return eP(e,t),QC(e,[{key:"setValue",value:function(t){var n=tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sP),dP=function(t){function e(t,n,i){$C(this,e);var r=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,s=r;if(r.__select=document.createElement("select"),VC.isArray(o)){var a={};VC.each(o,(function(t){a[t]=t})),o=a}return VC.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),r.updateDisplay(),hP.bind(r.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),r.domElement.appendChild(r.__select),r}return eP(e,t),QC(e,[{key:"setValue",value:function(t){var n=tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return hP.isActive(this.__select)?this:(this.__select.value=this.getValue(),tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(sP),pP=function(t){function e(t,n){$C(this,e);var i=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),r=i;function o(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),hP.bind(i.__input,"keyup",o),hP.bind(i.__input,"change",o),hP.bind(i.__input,"blur",(function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())})),hP.bind(i.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return eP(e,t),QC(e,[{key:"updateDisplay",value:function(){return hP.isActive(this.__input)||(this.__input.value=this.getValue()),tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(sP);function fP(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var mP=function(t){function e(t,n,i){$C(this,e);var r=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i||{};return r.__min=o.min,r.__max=o.max,r.__step=o.step,VC.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=fP(r.__impliedStep),r}return eP(e,t),QC(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=fP(t),this}}]),e}(sP);var gP=function(t){function e(t,n,i){$C(this,e);var r=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));r.__truncationSuspended=!1;var o=r,s=void 0;function a(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function u(){hP.unbind(window,"mousemove",l),hP.unbind(window,"mouseup",u),a()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),hP.bind(r.__input,"change",(function(){var t=parseFloat(o.__input.value);VC.isNaN(t)||o.setValue(t)})),hP.bind(r.__input,"blur",(function(){a()})),hP.bind(r.__input,"mousedown",(function(t){hP.bind(window,"mousemove",l),hP.bind(window,"mouseup",u),s=t.clientY})),hP.bind(r.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,a())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return eP(e,t),QC(e,[{key:"updateDisplay",value:function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(mP);function vP(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var _P=function(t){function e(t,n,i,r,o){$C(this,e);var s=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),a=s;function l(t){t.preventDefault();var e=a.__background.getBoundingClientRect();return a.setValue(vP(t.clientX,e.left,e.right,a.__min,a.__max)),!1}function u(){hP.unbind(window,"mousemove",l),hP.unbind(window,"mouseup",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function h(t){var e=t.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(vP(e,n.left,n.right,a.__min,a.__max))}function c(){hP.unbind(window,"touchmove",h),hP.unbind(window,"touchend",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),hP.bind(s.__background,"mousedown",(function(t){document.activeElement.blur(),hP.bind(window,"mousemove",l),hP.bind(window,"mouseup",u),l(t)})),hP.bind(s.__background,"touchstart",(function(t){if(1!==t.touches.length)return;hP.bind(window,"touchmove",h),hP.bind(window,"touchend",c),h(t)})),hP.addClass(s.__background,"slider"),hP.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return eP(e,t),QC(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",tP(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(mP),yP=function(t){function e(t,n,i){$C(this,e);var r=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,hP.bind(r.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),hP.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return eP(e,t),QC(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(sP),xP=function(t){function e(t,n){$C(this,e);var i=nP(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.__color=new iP(i.getValue()),i.__temp=new iP(0);var r=i;i.domElement=document.createElement("div"),hP.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",hP.bind(i.__input,"keydown",(function(t){13===t.keyCode&&c.call(this)})),hP.bind(i.__input,"blur",c),hP.bind(i.__selector,"mousedown",(function(){hP.addClass(this,"drag").bind(window,"mouseup",(function(){hP.removeClass(r.__selector,"drag")}))})),hP.bind(i.__selector,"touchstart",(function(){hP.addClass(this,"drag").bind(window,"touchend",(function(){hP.removeClass(r.__selector,"drag")}))}));var o,s=document.createElement("div");function a(t){p(t),hP.bind(window,"mousemove",p),hP.bind(window,"touchmove",p),hP.bind(window,"mouseup",u),hP.bind(window,"touchend",u)}function l(t){f(t),hP.bind(window,"mousemove",f),hP.bind(window,"touchmove",f),hP.bind(window,"mouseup",h),hP.bind(window,"touchend",h)}function u(){hP.unbind(window,"mousemove",p),hP.unbind(window,"touchmove",p),hP.unbind(window,"mouseup",u),hP.unbind(window,"touchend",u),d()}function h(){hP.unbind(window,"mousemove",f),hP.unbind(window,"touchmove",f),hP.unbind(window,"mouseup",h),hP.unbind(window,"touchend",h),d()}function c(){var t=YC(this.value);!1!==t?(r.__color.__state=t,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,o=n.clientY,s=(i-e.left)/(e.right-e.left),a=1-(o-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=r.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return VC.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),VC.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),VC.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),VC.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),VC.extend(s.style,{width:"100%",height:"100%",background:"none"}),wP(s,"top","rgba(0,0,0,0)","#000"),VC.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",VC.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),hP.bind(i.__saturation_field,"mousedown",a),hP.bind(i.__saturation_field,"touchstart",a),hP.bind(i.__field_knob,"mousedown",a),hP.bind(i.__field_knob,"touchstart",a),hP.bind(i.__hue_field,"mousedown",l),hP.bind(i.__hue_field,"touchstart",l),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return eP(e,t),QC(e,[{key:"updateDisplay",value:function(){var t=YC(this.getValue());if(!1!==t){var e=!1;VC.each(iP.COMPONENTS,(function(n){if(!VC.isUndefined(t[n])&&!VC.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&VC.extend(this.__color.__state,t)}VC.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;VC.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,wP(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),VC.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(sP),bP=["-moz-","-o-","-webkit-","-ms-",""];function wP(t,e,n,i){t.style.background="",VC.each(bP,(function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "}))}var TP=function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}},SP='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',EP=function(t,e){var n=t[e];return VC.isArray(arguments[2])||VC.isObject(arguments[2])?new dP(t,e,arguments[2]):VC.isNumber(n)?VC.isNumber(arguments[2])&&VC.isNumber(arguments[3])?VC.isNumber(arguments[4])?new _P(t,e,arguments[2],arguments[3],arguments[4]):new _P(t,e,arguments[2],arguments[3]):VC.isNumber(arguments[4])?new gP(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new gP(t,e,{min:arguments[2],max:arguments[3]}):VC.isString(n)?new pP(t,e):VC.isFunction(n)?new yP(t,e,""):VC.isBoolean(n)?new cP(t,e):null};var MP=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},AP=function(){function t(){$C(this,t),this.backgroundElement=document.createElement("div"),VC.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),hP.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),VC.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;hP.bind(this.backgroundElement,"click",(function(){e.hide()}))}return QC(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),VC.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",hP.unbind(t.domElement,"webkitTransitionEnd",e),hP.unbind(t.domElement,"transitionend",e),hP.unbind(t.domElement,"oTransitionEnd",e)};hP.bind(this.domElement,"webkitTransitionEnd",e),hP.bind(this.domElement,"transitionend",e),hP.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-hP.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-hP.getHeight(this.domElement)/2+"px"}}]),t}();TP(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var RP=function(){try{return!!window.localStorage}catch(t){return!1}}(),CP=void 0,PP=!0,IP=void 0,OP=!1,LP=[],NP=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),hP.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=VC.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=VC.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),VC.isUndefined(i.load)?i.load={preset:"Default"}:i.preset&&(i.load.preset=i.preset),VC.isUndefined(i.parent)&&i.hideable&&LP.push(this),i.resizable=VC.isUndefined(i.parent)&&i.resizable,i.autoPlace&&VC.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=RP&&"true"===localStorage.getItem(GP(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,WP(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,a&&(a.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?hP.addClass(n.__ul,t.CLASS_CLOSED):hP.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(t){RP&&(o=t,t?hP.bind(window,"unload",s):hP.unbind(window,"unload",s),localStorage.setItem(GP(n,"isLocal"),t))}}}),VC.isUndefined(i.parent)){if(this.closed=i.closed||!1,hP.addClass(this.domElement,t.CLASS_MAIN),hP.makeSelectable(this.domElement,!1),RP&&o){n.useLocalStorage=!0;var l=localStorage.getItem(GP(this,"gui"));l&&(i.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,hP.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(hP.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(hP.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),hP.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===i.closed&&(i.closed=!0);var u=document.createTextNode(i.name);hP.addClass(u,"controller-name"),a=DP(n,u);hP.addClass(this.__ul,t.CLASS_CLOSED),hP.addClass(a,"title"),hP.bind(a,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),i.closed||(this.closed=!1)}i.autoPlace&&(VC.isUndefined(i.parent)&&(PP&&(IP=document.createElement("div"),hP.addClass(IP,"dg"),hP.addClass(IP,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(IP),PP=!1),IP.appendChild(this.domElement),hP.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||WP(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},hP.bind(window,"resize",this.__resizeHandler),hP.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),hP.bind(this.__ul,"transitionend",this.__resizeHandler),hP.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&VP(this),s=function(){RP&&"true"===localStorage.getItem(GP(n,"isLocal"))&&localStorage.setItem(GP(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,i.parent||((r=n.getRoot()).width+=1,VC.defer((function(){r.width-=1})))};function DP(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function FP(t){hP.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&hP.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function BP(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function UP(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,s=void 0;if(o[t.preset])s=o[t.preset];else{if(!o.Default)return;s=o.Default}if(s[i]&&void 0!==s[i][e.property]){var a=s[i][e.property];e.initialValue=a,e.setValue(a)}}}}function kP(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new xP(e,n);else{var o=[e,n].concat(i.factoryArgs);r=EP.apply(t,o)}i.before instanceof sP&&(i.before=i.before.__li),UP(t,r),hP.addClass(r.domElement,"c");var s=document.createElement("span");hP.addClass(s,"property-name"),s.innerHTML=r.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(r.domElement);var l=DP(t,a,i.before);return hP.addClass(l,NP.CLASS_CONTROLLER_ROW),r instanceof xP?hP.addClass(l,"color"):hP.addClass(l,KC(r.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,VC.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),kP(t,n.object,n.property,{before:i,factoryArgs:[VC.toArray(arguments)]})}if(VC.isArray(e)||VC.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),kP(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof _P){var i=new gP(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});VC.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}})),hP.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof gP){var r=function(e){if(VC.isNumber(n.__min)&&VC.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=kP(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};n.min=VC.compose(r,n.min),n.max=VC.compose(r,n.max)}else n instanceof cP?(hP.bind(e,"click",(function(){hP.fakeEvent(n.__checkbox,"click")})),hP.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof yP?(hP.bind(e,"click",(function(){hP.fakeEvent(n.__button,"click")})),hP.bind(e,"mouseover",(function(){hP.addClass(n.__button,"hover")})),hP.bind(e,"mouseout",(function(){hP.removeClass(n.__button,"hover")}))):n instanceof xP&&(hP.addClass(e,"color"),n.updateDisplay=VC.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=VC.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&BP(t.getRoot(),!0),e}),n.setValue)}(t,l,r),t.__controllers.push(r),r}function GP(t,e){return document.location.href+"."+e}function HP(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function zP(t,e){e.style.display=t.useLocalStorage?"block":"none"}function jP(t){var e=t.__save_row=document.createElement("li");hP.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),hP.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",hP.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",hP.addClass(i,"button"),hP.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",hP.addClass(r,"button"),hP.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",hP.addClass(o,"button"),hP.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?VC.each(t.load.remembered,(function(e,n){HP(t,n,n===t.preset)})):HP(t,"Default",!1),hP.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),RP){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(GP(0,"isLocal"))&&l.setAttribute("checked","checked"),zP(t,a),hP.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,zP(t,a)}))}var u=document.getElementById("dg-new-constructor");hP.bind(u,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||CP.hide()})),hP.bind(n,"click",(function(){u.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),CP.show(),u.focus(),u.select()})),hP.bind(i,"click",(function(){t.save()})),hP.bind(r,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),hP.bind(o,"click",(function(){t.revert()}))}function VP(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function i(){hP.removeClass(t.__closeButton,NP.CLASS_DRAG),hP.unbind(window,"mousemove",n),hP.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),e=r.clientX,hP.addClass(t.__closeButton,NP.CLASS_DRAG),hP.bind(window,"mousemove",n),hP.bind(window,"mouseup",i),!1}t.__resize_handle=document.createElement("div"),VC.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),hP.bind(t.__resize_handle,"mousedown",r),hP.bind(t.__closeButton,"mousedown",r),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function WP(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function XP(t,e){var n={};return VC.each(t.__rememberedObjects,(function(i,r){var o={},s=t.__rememberedObjectIndecesToControllers[r];VC.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[r]=o})),n}NP.toggleHide=function(){OP=!OP,VC.each(LP,(function(t){t.domElement.style.display=OP?"none":""}))},NP.CLASS_AUTO_PLACE="a",NP.CLASS_AUTO_PLACE_CONTAINER="ac",NP.CLASS_MAIN="main",NP.CLASS_CONTROLLER_ROW="cr",NP.CLASS_TOO_TALL="taller-than-window",NP.CLASS_CLOSED="closed",NP.CLASS_CLOSE_BUTTON="close-button",NP.CLASS_CLOSE_TOP="close-top",NP.CLASS_CLOSE_BOTTOM="close-bottom",NP.CLASS_DRAG="drag",NP.DEFAULT_WIDTH=245,NP.TEXT_CLOSED="Close Controls",NP.TEXT_OPEN="Open Controls",NP._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||NP.toggleHide()},hP.bind(window,"keydown",NP._keydownHandler,!1),VC.extend(NP.prototype,{add:function(t,e){return kP(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return kP(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;VC.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&IP.removeChild(this.domElement);var t=this;VC.each(this.__folders,(function(e){t.removeFolder(e)})),hP.unbind(window,"keydown",NP._keydownHandler,!1),FP(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new NP(e);this.__folders[t]=n;var i=DP(this,n.domElement);return hP.addClass(i,"folder"),n},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],FP(t);var e=this;VC.each(t.__folders,(function(e){t.removeFolder(e)})),VC.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=hP.getOffset(t.__ul).top,n=0;VC.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=hP.getHeight(e))})),window.innerHeight-e-20<n?(hP.addClass(t.domElement,NP.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(hP.removeClass(t.domElement,NP.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&VC.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:VC.debounce((function(){this.onResize()}),50),remember:function(){if(VC.isUndefined(CP)&&((CP=new AP).domElement.innerHTML=SP),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;VC.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&jP(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&WP(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=XP(this)),t.folders={},VC.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=XP(this),BP(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=XP(this,!0)),this.load.remembered[t]=XP(this),this.preset=t,HP(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){VC.each(this.__controllers,(function(e){this.getRoot().load.remembered?UP(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),VC.each(this.__folders,(function(t){t.revert(t)})),t||BP(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&function t(e){0!==e.length&&MP.call(window,(function(){t(e)}));VC.each(e,(function(t){t.updateDisplay()}))}(this.__listening)},updateDisplay:function(){VC.each(this.__controllers,(function(t){t.updateDisplay()})),VC.each(this.__folders,(function(t){t.updateDisplay()}))}});var qP=NP,YP=function(){function t(t){this.runTime={fps:0,resolution:""},this.target=t.target,this.data=t.params,this.player=t.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return t.prototype.createStats=function(){var t=this;this.stateId=setInterval((function(){t.player.view&&(t.controller.runTimeFps.setValue(t.player.fps.value),t.controller.drawCall.setValue(t.player.runtime.drawCall),t.controller.runTimeResolution.setValue(t.player.view.width+"*"+t.player.view.height))}),500)},t.prototype.createControllerGUI=function(){var t,e,n,i,r,o=new qP({autoPlace:!0,closed:!0});o.domElement.style.opacity=".6",o.domElement.style.transformOrigin="100% 0",o.domElement.style.transform="scale(1)",this.target.appendChild(o.domElement),o.domElement.style.position="absolute",o.domElement.style.right="0",o.domElement.style.top="0",o.domElement.style.zIndex="2";var s=o.add({FPS:0},"FPS",0),a=o.add({drawCall:0},"drawCall",0),l=o.add({"分辨率":""},"分辨率",""),u=o.add({"额外计算":0},"额外计算",0,200),h=o.addFolder("renderOptions");return this.controller={runTimeResolution:l,runTimeFps:s,drawCall:a,moreCalculation:u,minFPS:h.add({"最低fps":null!==(t=this.data.minFPS)&&void 0!==t?t:40},"最低fps",0,60),maxFPS:h.add({"最高fps":null!==(e=this.data.maxFPS)&&void 0!==e?e:50},"最高fps",0,60),resolution:h.add({"目标分辨倍率":null!==(n=this.data.resolution)&&void 0!==n?n:window.devicePixelRatio},"目标分辨倍率",.5,6),autoResolution:h.add({"自动分辨率":null!==(i=this.data.autoResolution)&&void 0!==i&&i},"自动分辨率",!0),autoFps:h.add({"自动fps":null===(r=this.data.autoFPS)||void 0===r||r},"自动fps",!0),transactionBgColor:h.addColor({"切页背景色":this.data.transactionBgColor},"切页背景色")},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,o},t.prototype.addEventListener=function(){var t,e=this;this.controller.autoFps.onChange((function(t){e.data.autoFPS=t,e.player.updateConfig(e.data)})),this.controller.maxFPS.onChange((function(t){e.data.maxFPS=t,e.player.updateConfig(e.data)})),this.controller.minFPS.onChange((function(t){e.data.minFPS=t,e.player.updateConfig(e.data)})),this.controller.autoResolution.onChange((function(t){e.data.autoResolution=t,e.player.updateConfig(e.data)})),this.controller.resolution.onChange((function(t){e.data.resolution=t,e.player.updateConfig(e.data)})),this.controller.transactionBgColor.onChange((function(t){e.data.transactionBgColor=t,e.player.updateConfig(e.data)})),this.controller.moreCalculation.onChange((function(n){t&&e.player.app.ticker.remove(t),n>0&&(t=function(){for(var t="";t.length<8e3*n;)t+=Math.random().toString(32).substr(2);pM()(t)},e.player.app.ticker.add(t))}))},t.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch(t){}},t}(),ZP=function(){function t(t){var e=this;this.tasks=[],this.schedule=function(){var t=e.tasks[0];t?e.fn(t).then((function(){e.tasks.splice(0,1),window.requestAnimationFrame(e.schedule)})):window.requestAnimationFrame(e.schedule)},this.fn=t,this.schedule()}return t.prototype.addTask=function(t){this.tasks.push(t)},t}(),JP=function(){function t(){this.autoUnlock=Object.create(null),this.locks=Object.create(null)}return t.prototype.addLock=function(t,e){var n=this;this.locks[t]=e,this.autoUnlock[t]=window.setTimeout((function(){delete n.locks[t]}),3e3)},t.prototype.unlock=function(t,e){e&&this.locks[t]&&this.locks[t]===e&&(window.clearTimeout(this.autoUnlock[t]),delete this.locks[t])},t.prototype.isLocked=function(t){return!!this.locks[t]},t}(),KP=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),$P=function(){return($P=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},QP=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},tI=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};window.__slide_local_logger__||(window.__slide_local_logger__=o.createInstance({name:"_slide_local_log_",driver:o.INDEXEDDB,version:1}));var eI=window.ResizeObserver||FC,nI=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function iI(t,e){return QP(this,void 0,void 0,(function(){var n;return tI(this,(function(i){switch(i.label){case 0:n=Date.now(),i.label=1;case 1:return!t()&&Date.now()-n<e?[4,nI(50)]:[3,3];case 2:return i.sent(),[3,1];case 3:return[2]}}))}))}var rI={syncDispatch:"syncDispatch",syncReceive:"syncReceive",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},oI={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},sI="";try{sI="0.3.2"}catch(t){sI="dev"}var aI=function(t){function e(e){var n=t.call(this)||this;return n.iosResetCache=[],n.needClearCacheImage=!1,n.version=sI,n.__slideState=Object(l.cloneDeep)(oI),n.userInputTime=0,n.isSyncingSlideState=!1,n.resize=!1,n.isAnimating=!1,n.renderingTaskManager=new GC,n.isLoading=!1,n.interactive=!0,n.frameWidth=1,n.frameHeight=1,n.frame=document.createElement("div"),n.medianController=document.createElement("div"),n.frameResizeObserver=new eI((function(){return n.frameResizeHandler()})),n.timestamp=function(){return Date.now()},n.mode="local",n.enableGlobalClick=!1,n.lastEmitedState=null,n.playerController=null,n.lock=new JP,n.isInitResized=!1,n.cacheImage=document.createElement("img"),n.isFrowning=!1,n.isReleasing=!1,n.isTouchStart=!1,n.touchStartId=void 0,n.taskId="",n.designWidth=0,n.designHeight=0,n._slideCount=0,n.userInputHandle=function(){n.userInputTime=Date.now()},n.handleViewClick=function(){setTimeout((function(){var t=Date.now();Math.abs(t-n.userInputTime)>500&&n.enableGlobalClick&&n.nextStep()}))},n.handleViewTouchStart=function(){window.clearTimeout(n.touchStartId),n.isTouchStart=!0,n.touchStartId=setTimeout((function(){n.isTouchStart=!1}),350)},n.handleViewTouchEnd=function(){n.isTouchStart&&(n.isTouchStart=!1,n.handleViewClick())},n.handleSlideRef=function(){console.log(n),window.__slide=n},n.receiveSyncHandler=function(t){return QP(n,void 0,void 0,(function(){var e,n,i,r,o=this;return tI(this,(function(s){switch(s.label){case 0:return DR.info("sync receive "+JSON.stringify(t),this.taskId),"nextStep"!==t.type?[3,1]:(this.mainSeqStep!==t.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(t.next,"start"),this.player.nextTick((function(){o.doNextStep()}))):this.doNextStep(),[3,6]);case 1:return"prevStep"!==t.type?[3,2]:(0===this.mainSeqStep&&"idle"===this.mainSeqState||this.mainSeqStep===t.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep():(this.setMainSeqStep(t.next+1,"start"),null===(e=this.player)||void 0===e||e.nextTick((function(){o.doPrevStep()}))),[3,6]);case 2:return"interactiveAnim"!==t.type?[3,3]:(this.player?this.player.applyInteractiveAction(t.action):this.__slideState.interactiveSeqState[t.seqId].step+=1,[3,6]);case 3:return"renderSlide"!==t.type?[3,5]:[4,this.doRenderSlide(t.index,t.isForward)];case 4:return s.sent(),[3,6];case 5:"mediaPlay"===t.type?(null===(n=this.player)||void 0===n||n.setMediaState(t.id,!0),this.__slideState.mediaState[t.id]=t.state):"mediaPause"===t.type?(null===(i=this.player)||void 0===i||i.setMediaState(t.id,!1),this.__slideState.mediaState[t.id]=t.state):"mediaSeek"===t.type&&(null===(r=this.player)||void 0===r||r.setMediaCurrentTime(t.id,t.time),this.__slideState.mediaState[t.id]=t.state),s.label=6;case 6:return[2]}}))}))},n.handlePrevSlide=function(){return QP(n,void 0,void 0,(function(){var t,e;return tI(this,(function(n){switch(n.label){case 0:return this.player?[4,null===(e=this.player)||void 0===e?void 0:e.createSnapshotForNextSlide(!0)]:[2];case 1:return n.sent(),(t=this.player.prevSlideIndex)>=1&&this.renderSlide(t,!1),[2]}}))}))},n.handleNextSlide=function(){return QP(n,void 0,void 0,(function(){var t,e;return tI(this,(function(n){switch(n.label){case 0:return this.player?[4,null===(e=this.player)||void 0===e?void 0:e.createSnapshotForNextSlide(!1)]:[2];case 1:return n.sent(),(t=this.player.nextSlideIndex)<=this.slideCount&&this.renderSlide(t,!0),[2]}}))}))},n.handleGotoSlide=function(t){if(t<=n.slideCount&&t>=1){var e=n.slideState.currentSlideIndex<=t;n.renderSlide(t,e)}else-1===t&&n.renderSlide(n.slideCount,!0)},e.timestamp&&(n.timestamp=e.timestamp),e.rtcAudio&&(JR.RtcAudioClazz=e.rtcAudio),e.logger&&("function"==typeof e.logger.info&&NR.attach("info",e.logger.info),"function"==typeof e.logger.warn&&NR.attach("warn",e.logger.warn),"function"==typeof e.logger.error&&NR.attach("error",e.logger.error)),n.config=e,n.syncQueue=new ZP(n.receiveSyncHandler),n.mode=e.mode,n.anchor=e.anchor,n.enableGlobalClick=!Object(l.isUndefined)(e.enableGlobalClick)&&e.enableGlobalClick,n.resize=e.resize||!1,n.interactive=e.interactive,n.cacheImage.style.position="absolute",n.cacheImage.style.zIndex="100",n.frame.style.cssText="width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",n.setMedianControllerAttribute(),n.frame.appendChild(n.medianController),n.anchor.appendChild(n.frame),n.frameResizeObserver.observe(n.frame),n.on(rI.syncReceive,(function(t){n.lock.unlock(t.type,t.uuid),n.syncQueue.addTask(t)})),n.renderingTaskManager.eventHub.on("task-error",(function(t){var e=t.error,i=t.task,r=KE.transform(e);r.errorType===JE.RuntimeWarn?DR.warn(r.message,n.taskId):DR.error(r.message,n.taskId),n.emit(rI.renderError,{error:r,index:i.slideIndex})})),window.addEventListener("__slide_ref__",n.handleSlideRef),n.resizeView=Object(l.debounce)(n.resizeView.bind(n),50),n.player=n.initPlayer(e),(null==e?void 0:e.controller)&&n.createController(),n.player.view&&n.frame.appendChild(n.player.view),n.handleViewClick=Object(l.debounce)(n.handleViewClick,300),n.player.errorChannel.on("error",(function(t,e){var i=KE.transform(t);i.errorType===JE.RuntimeWarn?DR.warn(i.message,n.taskId):DR.error(i.message,n.taskId),n.isLoading=!1,n.emit(rI.renderError,{error:t,index:e})})),n}return KP(e,t),e.prototype.initPlayer=function(t){var e,n,i,r=this,o=new JR(this.mode);return o.setInteractive(this.interactive),o.updateConfig(t.renderOptions||{}),o.on(ZR.renderStart,(function(t){r.isLoading=!0,r.emit(rI.renderStart,t)})),o.on(ZR.renderEnd,(function(t){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(rI.renderEnd,t)})),o.on(ZR.slideChange,(function(t){r.__slideState.currentSlideIndex=t,r.emit(rI.slideChange,t)})),o.on(ZR.mainSeqStateChange,(function(t){r.__slideState.mainSeqState=t,r.emitStateChange()})),o.on(ZR.mainSeqStepChange,(function(t){r.__slideState.mainSeqStep=t,r.emitStateChange()})),o.on(ZR.interactiveSeqStateChange,(function(t){var e=t.id,n=t.state;r.__slideState.interactiveSeqState[e]=n,r.emitStateChange()})),o.on(ZR.animateStart,(function(){!0!==r.isAnimating&&(r.isAnimating=!0,r.emit(rI.animateStart))})),o.on(ZR.animateEnd,(function(){!1!==r.isAnimating&&(r.isAnimating=!1,r.emit(rI.animateEnd))})),o.on(ZR.interactiveSeqAction,(function(t){var e=t.action,n=t.seqId;r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",action:e,seqId:n}),r.emitStateChange()})),o.on(ZR.mainSeqStepStart,(function(t){r.emit(rI.mainSeqStepStart,t)})),o.on(ZR.mainSeqStepEnd,(function(t){r.emit(rI.mainSeqStepEnd,t)})),o.on(ZR.mediaPlay,(function(t){var e={type:"play",time:r.timestamp()-1e3*t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:t.id,state:e}),r.emitStateChange()})),o.on(ZR.mediaPause,(function(t){var e={type:"pause",time:t.time};r.__slideState.mediaState[t.id]=e,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:t.id,state:e}),r.emitStateChange()})),o.on(ZR.mediaSeek,(function(t){var e={type:"pause",time:0};t.isPlaying?(e.type="play",r.__slideState.mediaState[t.id]?e.time=r.__slideState.mediaState[t.id].time-1e3*t.time:e.time=r.timestamp()-1e3*t.time,r.__slideState.mediaState[t.id]=e):(e.type="pause",e.time=t.time,r.__slideState.mediaState[t.id]=e),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:t.id,time:t.time,state:e}),r.emitStateChange()})),o.on(ZR.requestPrevSlide,this.handlePrevSlide),o.on(ZR.requestNextSlide,this.handleNextSlide),o.on(ZR.requestGotoSlide,this.handleGotoSlide),null===(e=o.view)||void 0===e||e.addEventListener("touchend",this.handleViewTouchEnd),null===(n=o.view)||void 0===n||n.addEventListener("touchstart",this.handleViewTouchStart),null===(i=o.view)||void 0===i||i.addEventListener("click",this.handleViewClick),o.on(ZR.userInput,this.userInputHandle),o},e.prototype.createController=function(){this.player&&(this.playerController=new YP({player:this.player,params:this.player.config||{},target:this.frame}))},e.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2"},e.prototype.frameResizeHandler=function(){var t=this.frame.getBoundingClientRect(),e=t.width,n=t.height;this.frameWidth=e,this.frameHeight=n,this.resizeView()},e.prototype.resizeView=function(){var t,e,n=this,i=this.width,r=this.height;if(i>0&&r>0){var o=this.frameWidth/i,s=o*r;s>this.frameHeight&&(o*=this.frameHeight/s),null===(t=this.player)||void 0===t||t.scaleView(o,this.resize),this.cacheImage.style.transform="scale("+o+")",this.medianController.style.transform="scale("+o+")",this.medianController.style.top=(this.frameHeight-r*o)/2+"px",this.medianController.setAttribute("data-scale",o.toString()),this.isInitResized||(this.isInitResized=!0,null===(e=this.player)||void 0===e||e.clock.setTimeout((function(){n.frame.style.visibility="visible"}),32))}},e.prototype.setSlideState=function(t){var e,n,i;return QP(this,void 0,void 0,(function(){var r,o=this;return tI(this,(function(s){switch(s.label){case 0:return this.isSyncingSlideState=!0,DR.info("stateChange receive "+JSON.stringify(t),this.taskId),t.taskId&&t.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=t.taskId,null===(e=this.player)||void 0===e||e.setResourceData(t.taskId,this.__slideState.url)),t.url&&t.url!==this.__slideState.url&&(this.__slideState.url=t.url,null===(n=this.player)||void 0===n||n.setResourceData(this.__slideState.taskId,t.url)),Number.isInteger(t.currentSlideIndex)&&t.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=t.currentSlideIndex,[4,this.doRenderSlide(t.currentSlideIndex)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[4,null===(i=this.player)||void 0===i?void 0:i.clock.waitUntil((function(){var e,n;return(null===(e=o.player)||void 0===e?void 0:e.currentIndex)===t.currentSlideIndex&&(null===(n=o.player)||void 0===n?void 0:n.currentStage)}),3e3)];case 3:return s.sent(),r=!1,Number.isInteger(t.mainSeqStep)&&t.mainSeqStep!==this.__slideState.mainSeqStep&&(r=!0,this.__slideState.mainSeqStep=t.mainSeqStep),t.mainSeqState&&t.mainSeqState!==this.__slideState.mainSeqState&&(r=!0,this.__slideState.mainSeqState=t.mainSeqState),r&&this.setMainSeqStep(this.__slideState.mainSeqStep,"idle"===this.__slideState.mainSeqState?"start":"end"),t.mediaState&&(this.initMedia(t),this.__slideState.mediaState=t.mediaState),t.interactiveSeqState&&(this.initInteractiveSeq(t),this.__slideState.interactiveSeqState=t.interactiveSeqState),this.isSyncingSlideState=!1,[2]}}))}))},e.prototype.initInteractiveSeq=function(t){var e;for(var n in t.interactiveSeqState){var i=t.interactiveSeqState[n];null===(e=this.player)||void 0===e||e.setInteractiveSeqState(n,i.step,"end"===i.state?"end":"start")}},e.prototype.initMedia=function(t){var e,n,i=this,r=function(r){var s=t.mediaState[r],a=o.__slideState.mediaState[r];if(a&&s.type===a.type&&s.time===a.time)return"continue";"play"===s.type?null===(e=o.player)||void 0===e||e.setMediaState(r,!0).then((function(){var t,e=i.timestamp();null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,(e-s.time)/1e3)})):null===(n=o.player)||void 0===n||n.setMediaState(r,!1).then((function(){var t;null===(t=i.player)||void 0===t||t.setMediaCurrentTime(r,s.time)}))},o=this;for(var s in t.mediaState)r(s)},Object.defineProperty(e.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),e.prototype.getSlideCountAsync=function(){return QP(this,void 0,void 0,(function(){return tI(this,(function(t){switch(t.label){case 0:if(this._slideCount>0)return[2,this._slideCount];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(this.__slideState.url+"/"+this.__slideState.taskId+"/jsonOutput/slide-1.json")];case 2:return[4,t.sent().json()];case 3:return[2,t.sent().slideCount];case 4:return t.sent(),[2,0];case 5:return[2]}}))}))},Object.defineProperty(e.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqLength",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqStep",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mainSeqState",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderOptions",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawCall",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"runtimeFps",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"view",{get:function(){var t;return(null===(t=this.player)||void 0===t?void 0:t.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),e.prototype.updateRenderOption=function(t){this.player&&(this.player.updateConfig(t),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},e.prototype.setResource=function(t,e){var n;this.taskId=t,null===(n=this.player)||void 0===n||n.setResourceData(t,e),this.__slideState.taskId=t,this.__slideState.url=e,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:t,url:e})},e.prototype._renderSlide=function(t){var e;return QP(this,void 0,void 0,(function(){var n=this;return tI(this,(function(i){switch(i.label){case 0:return this.player&&t===this.player.currentIndex?[2]:((JR.platform.isIOS()||JR.platform.isAndroid())&&this.iosResetCache.indexOf(t)<0&&this.iosResetCache.push(t),this.isLoading=!0,[4,null===(e=this.player)||void 0===e?void 0:e.renderSlide(t)]);case 1:return i.sent(),this.__slideState.currentSlideIndex=t,this.isLoading=!1,this.resizeView(),this.emitStateChange(),setTimeout((function(){var t,e;if("hidden"===(null===(e=null===(t=n.player)||void 0===t?void 0:t.view)||void 0===e?void 0:e.style.visibility)&&(n.player.view.style.visibility="visible"),"hidden"===n.frame.style.visibility&&(n.frame.style.visibility="visible"),n.needClearCacheImage)try{n.frame.removeChild(n.cacheImage)}catch(t){}}),100),[2]}}))}))},e.prototype.renderSlide=function(t,e){if(void 0===e&&(e=!0),this.player){var n=Number(t);(n!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(n>this.slideCount&&this.slideCount>0||this.poseRenderSlide(n,e))}},e.prototype.needCreateNewPlayer=function(){var t=JR.platform.isLowGpuMemory()?15:30;return(JR.platform.isIOS()||JR.platform.isAndroid())&&this.iosResetCache.length>t},e.prototype.poseRenderSlide=function(t,e){this.isLoading=!0,"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e}):"sync"===this.mode?(this.doRenderSlide(t,e),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:t,isForward:e})):this.doRenderSlide(t,e)},e.prototype.doRenderSlide=function(t,e){var n,i,r,o=this;if(void 0===e&&(e=!0),!this.player)return Promise.resolve();if(this.needCreateNewPlayer()&&(this.iosResetCache=[],this.iosNewPlayer=this.initPlayer(this.config),this.iosNewPlayer.setResourceData(this.__slideState.taskId,this.__slideState.url)),this.iosNewPlayer){var s=this.player.getSnapshot();this.cacheImage.src=s,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(n=this.playerController)||void 0===n||n.destroy(),this.player=this.iosNewPlayer,this.iosNewPlayer=void 0,(null===(i=this.config)||void 0===i?void 0:i.controller)&&this.createController(),this.needClearCacheImage=!0,(null===(r=null==this?void 0:this.player)||void 0===r?void 0:r.view)&&(this.player.view.style.visibility="hidden",this.frame.appendChild(this.player.view))}var a=Math.random().toString(32).substr(2);return this.player.isForward=e,this.renderingTaskManager.addTask((function(){return o._renderSlide(t)}),t,a),new Promise((function(t){o.renderingTaskManager.eventHub.once("task-end-"+a,t)}))},e.prototype.nextStep=function(){!this.isLoading&&this.player&&this.interactive&&(this.player.mainSeqHasNextStep()?"interactive"===this.mode?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):"sync"===this.mode?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide())},e.prototype.doNextStep=function(){if(this.player){this.player.nextStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,this.emitStateChange()}},e.prototype.prevStep=function(){!this.isLoading&&this.player&&this.interactive&&(this.player.mainSeqHasPrevStep()?"interactive"===this.mode?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):"sync"===this.mode?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide())},e.prototype.doPrevStep=function(){if(this.player){this.player.prevStep();var t=this.player.mainSeqStep();this.__slideState.mainSeqStep=t,this.emitStateChange()}},e.prototype.isSlideStateReady=function(t){return t.taskId.length>0&&t.url.length>0&&t.currentSlideIndex>0},e.prototype.emitStateChange=function(){if("local"!==this.mode&&!this.isSyncingSlideState){var t=this.slideState;!Object(l.isEqual)(this.lastEmitedState,t)&&this.isSlideStateReady(t)&&(this.lastEmitedState=t,this.emit(rI.stateChange,t),DR.info("stateChange dispatch "+JSON.stringify(this.slideState),this.taskId))}},e.prototype.emitSyncDispatch=function(t){if(!this.lock.isLocked(t.type)){var e=Math.random().toString(32).substr(2);this.lock.addLock(t.type,e),this.emit(rI.syncDispatch,$P($P({},t),{uuid:e})),DR.info("sync dispatch "+JSON.stringify(t),this.taskId)}},e.prototype.setMainSeqStep=function(t,e){var n;null===(n=this.player)||void 0===n||n.setMainSeqStep(t,e)},e.prototype.setInteractive=function(t){var e;this.interactive=t,null===(e=this.player)||void 0===e||e.setInteractive(t)},e.prototype.pause=function(){var t;null===(t=this.player)||void 0===t||t.pause()},e.prototype.resume=function(){var t;null===(t=this.player)||void 0===t||t.resume()},e.prototype.frozen=function(){var t;return QP(this,void 0,void 0,(function(){var e,n,i,r=this;return tI(this,(function(o){switch(o.label){case 0:return this.isFrowning?[2,iI((function(){return!r.isFrowning}),6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil((function(){return!r.isLoading}),6e4)]):[3,2];case 1:for(n in o.sent(),e=this.player.getSnapshot()||"",this.cacheImage.src=e,this.frame.appendChild(this.cacheImage),this.player.destroy(),null===(t=this.playerController)||void 0===t||t.destroy(),this.player=void 0,this.__slideState.mediaState)i=this.__slideState.mediaState[n],this.__slideState.mediaState[n]=$P($P({},i),{frozenTime:this.timestamp()});this.isFrowning=!1,o.label=2;case 2:return[2]}}))}))},e.prototype.release=function(){var t,e;return QP(this,void 0,void 0,(function(){var n,i,r,o,s=this;return tI(this,(function(a){switch(a.label){case 0:if(this.isReleasing)return[2,iI((function(){return!s.isReleasing}),6e4)];for(i in this.isReleasing=!0,this.player=this.initPlayer(this.config),(null===(t=this.config)||void 0===t?void 0:t.controller)&&this.createController(),this.player.view&&(this.frame.appendChild(this.player.view),this.player.view.style.visibility="hidden"),n=this.__slideState,this.__slideState=Object(l.cloneDeep)(oI),n.mediaState)"play"===(r=n.mediaState[i]).type&&(o=Math.max(null!==(e=r.frozenTime)&&void 0!==e?e:0,r.time),r.time=this.timestamp()-(o-r.time),r.frozenTime=void 0);return[4,this.setSlideState(n)];case 1:return a.sent(),[4,this.player.clock.delay(333)];case 2:a.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch(t){}return this.isReleasing=!1,[2]}}))}))},e.prototype._doDestroy=function(){var t,e,n,i;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),null===(t=this.player)||void 0===t||t.removeAllListeners(),null===(e=this.player)||void 0===e||e.destroy(),null===(n=this.player)||void 0===n||n.removeAllListeners(),window.removeEventListener("__slide_ref__",this.handleSlideRef);try{(null===(i=this.player)||void 0===i?void 0:i.view)&&this.anchor.removeChild(this.player.view),this.anchor.removeChild(this.frame)}catch(t){}},e.prototype.waitLoadEnd=function(){return QP(this,void 0,void 0,(function(){var t;return tI(this,(function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return this.isLoading&&t<10?[4,nI(100)]:[3,3];case 2:return e.sent(),t+=1,[3,1];case 3:return[2]}}))}))},e.prototype.destroy=function(){var t=this;this.isLoading?this.waitLoadEnd().then((function(){t._doDestroy()})):this._doDestroy()},e.disposeLocalCache=function(){JR.storeManager.dispose()},e}(a.a)}]);