!function e(t,i,n){function r(a,s){if(!i[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var h=i[a]={exports:{}};t[a][0].call(h.exports,function(e){var i=t[a][1][e];return r(i||e)},h,h.exports,e,t,i,n)}return i[a].exports}for(var o="function"==typeof require&&require,a=0;a0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(i,"__esModule",{value:!0});var a=e("./localthree"),s=e("./runloop"),l=e("./scenebase"),c=e("./config"),h=e("./util/camera"),u=e("./util/dom"),d=e("./util/async"),p=e("./strings"),f=e("./story"),m=e("./components/ui"),g=e("./util/camera"),v=e("./components/ui/captions"),y=e("./util/ga"),_=function(){function e(e){var t=this;this.renderer=e,this.currentCamera=new a.default.PerspectiveCamera(h.fovFromFocal(35)),this.threeScene=new a.default.Scene,this.loadedScenes=[],this.config=new c.Config,this.ui=new m.GoatUI(this),this.menuTab=document.getElementById("menu-tab"),this.captions=new v.Captions,this.mainScene=void 0,this.chapterId="",this._nextChapterId=void 0,this._prevChapterId=void 0,this._nextScene=void 0,this._isTransitioning=!1,this.width=-1,this.height=-1,this.renderTarget=new a.default.WebGLRenderTarget(this.width,this.height,{minFilter:a.default.LinearFilter,magFilter:a.default.NearestFilter,format:a.default.RGBFormat}),this.maxQualityLevel=s.AdaptiveQualityLevel.Highest,this.depthMaterial=new a.default.MeshDepthMaterial({skinning:!0}),this.usingDebugCamera=!1,this.started=!1,this.paused=!1,this.autoPaused=!1,this._runningElapsed=0,this.config.assetPrefix=window.ASSET_PREFIX,this.init(),this.bind();var i=this;1===window.DEBUG&&document.addEventListener("keydown",function(e){67==e.keyCode&&(i.usingDebugCamera=!i.usingDebugCamera,i.usingDebugCamera?t.debugCamera=new g.DebugCamera(t,t.currentCamera,t.threeScene):void 0!==t.debugCamera&&(t.debugCamera.destroy(),t.debugCamera=void 0))});["caption-top","caption-bottom","title","main"].forEach(function(e){var i=document.getElementById(e);if(null==i)return console.error("Failed to initialise interaction detection on element:",e);i.addEventListener("mousedown",t.interactionTriggered.bind(t)),i.addEventListener("touchstart",t.interactionTriggeredTouch.bind(t)),i.addEventListener("touchmove",t.onTouchMove.bind(t))}),document.addEventListener("mousemove",this.mouseMove.bind(this))}return e.prototype.onTouchMove=function(e){this.mainScene&&this.mainScene.interaction&&this.mainScene.interaction.onTouchMove(e)},e.prototype.interactionTriggered=function(e){this.mainScene&&this.mainScene.interaction&&this.mainScene.interaction.processInput(e,e)},e.prototype.interactionTriggeredTouch=function(e){this.mainScene&&this.mainScene.interaction&&this.mainScene.interaction.processInput(e.touches[0],e)},e.prototype.mouseMove=function(e){this.mainScene&&this.mainScene.interaction&&this.mainScene.interaction.mouseMove(e)},e.prototype.init=function(){return n(this,void 0,void 0,function(){var e,t,i,n,a,s,l,h,u=this;return r(this,function(r){switch(r.label){case 0:return this.mainScene&&((e=this.mainScene).delegate=void 0,e.loadDelegate=void 0,this.mainScene.cancel(),this.mainScene=void 0),this._runningElapsed=0,location.host.match(/otitenanekoti/)&&this.requestChangeLanguage(c.Language.TeReoMaori,!0),this.ui.showStartScreen(),t=void 0,this.started?t=f.STORY_ENTRY:((i=location.search.match(/chapter=([a-z]+)/))&&(t=f.CHAPTER_ALIASES[i[1]]),t||(t=f.STORY_ENTRY)),this.chapterId=t,this.started?[3,4]:(n=location.search.match(/lang=([a-z]+)/))?(a=n[1],this.requestChangeLanguage(a,!0),[3,3]):[3,1];case 1:return[4,this.ui.selectLanguage()];case 2:a=r.sent(),r.label=3;case 3:this.config.lang=a,requestAnimationFrame(function(){u.ui.didChangeLanguage(a)}),this.trackLanguageChange(a),console.log("language chosen",this.config.lang),r.label=4;case 4:return[4,d.tick()];case 5:return r.sent(),this.readyNextScene(this.chapterId),this._nextScene?(s=this._nextScene.ready().catch(function(e){return u.handleLoadError(e)}),this.started?[3,9]:(l=location.search.match(/mode=([a-z]+)/))?(h=l[1],[3,8]):[3,6]):(console.error("couldn't find initial scene"),[2]);case 6:return[4,this.ui.selectMode()];case 7:h=r.sent(),r.label=8;case 8:this.config.mode=h,this.trackModeChange(h),requestAnimationFrame(function(){u.ui.didChangeMode(h)}),r.label=9;case 9:return this._nextScene.loadDelegate=this,this.ui.beginLoading(!0,500),y.track(this._nextScene.tag,"Loading"),Promise.all([s]).then(function(e){o(e,1)[0];u.gotoNextScene().then(function(){u.start()})}),this.currentCamera.position.set(0,0,3),[2]}})})},e.prototype.togglePause=function(e,t){void 0===e&&(e=void 0),void 0===t&&(t=void 0);var i=this.autoPaused||this.paused;void 0!=t&&(this.autoPaused=t),this.paused=void 0==e?!this.paused:e;var n=this.autoPaused||this.paused;i!=n&&(this.loadedScenes.forEach(function(e){var t=o(e,2),i=(t[0],t[1]);n?i.pause():i.resume()}),this.pauseCallback&&this.pauseCallback(n),window.runloop&&this.ui.didPause(n))},e.prototype.bind=function(){var e=this;u.on(window,["visibilitychange"],function(t){"visible"==document.visibilityState?e.togglePause(e.paused,!1):"hidden"==document.visibilityState&&e.togglePause(e.paused,!0)},!1)},e.prototype.start=function(){var e=this;this.started=!0,this.loadedScenes.forEach(function(t){var i=o(t,2),n=(i[0],i[1]);e.config.qualityLevel!=s.AdaptiveQualityLevel.Highest&&n.setQualityLevel(e.config.qualityLevel)}),this.notifyChangeChapter()},e.prototype.replay=function(e){void 0===e&&(e=!0),this.mainScene.cancel(),e&&this.togglePause(!1),this.mainScene.begin(!0)},e.prototype.restart=function(){var e=this;this.togglePause(!0),this.mainScene.cancel(),this.loadedScenes.forEach(function(t){var i=o(t,2),n=(i[0],i[1]);n.uninstall(e.threeScene),n.cleanup()}),this.togglePause(!1),this._nextChapterId=this._nextScene=void 0,this.init()},e.prototype.update=function(e,t){this.paused||void 0!=this.mainScene&&(this._runningElapsed+=e,t=this._runningElapsed,this.loadedScenes.forEach(function(i){var n=o(i,2);n[0];return n[1].update(e,t)}),1===window.DEBUG&&this.debugCamera&&this.debugCamera.update(e,t))},e.prototype.render=function(e){this.mainScene&&!this.mainScene.renderCount?this.threeScene.traverse(function(e){e._origFrustumCulled=e.frustumCulled,e.frustumCulled=!1}):this.mainScene&&1==this.mainScene.renderCount&&this.threeScene.traverse(function(e){var t=e._origFrustumCulled;e.frustumCulled=void 0===t||t});var t=this.usingDebugCamera&&window.DEBUG&&void 0!==this.debugCamera?this.debugCamera.camera:this.currentCamera;e.render(this.threeScene,t),this.mainScene&&(this.mainScene.renderCount+=1)},e.prototype.handleResize=function(e,t){this.width=e,this.height=t,this.menuTab&&(this.menuTab.style.right=(window.innerWidth-e)/2+"px");var i=e/t;console.log("resized to %d x %d",e,t),this.currentCamera&&h.isPerspectiveCamera(this.currentCamera)&&(this.currentCamera.aspect=i,this.currentCamera.updateProjectionMatrix()),i<5/4?this.togglePause(this.paused,!0):this.togglePause(this.paused,!1),1===window.DEBUG&&this.debugCamera&&h.isPerspectiveCamera(this.debugCamera.camera)&&(this.debugCamera.camera.aspect=i,this.debugCamera.camera.updateProjectionMatrix()),this.mainScene&&this.mainScene.interaction&&this.mainScene.interaction.resizeCalled()},e.prototype.resizeRenderTarget=function(e,t){this.renderTarget.setSize(e,t)},e.prototype.setCamera=function(e){this.currentCamera=e,h.isPerspectiveCamera(this.currentCamera)&&(this.currentCamera.aspect=this.width/this.height,this.currentCamera.updateProjectionMatrix())},e.prototype.getCamera=function(){return this.currentCamera},e.prototype.normaliseScreenCoords=function(e){var t=this.renderer.domElement,i=t.getBoundingClientRect(),n=t.clientLeft,r=t.clientTop,o=e.x-(i.left+n),s=i.width-2*n,l=e.y-(i.top+r),c=i.height-2*r;return new a.default.Vector2(o/s*2-1,2*(1-l/c)-1)},e.prototype.getCaptions=function(){return this.captions},e.prototype.qualityLevelChanged=function(e){this.config.qualityLevel=Math.min(e,this.maxQualityLevel),this.loadedScenes.forEach(function(t){var i=o(t,2);i[0];i[1].setQualityLevel(e)})},e.prototype.gotoNextScene=function(e){return void 0===e&&(e=!1),n(this,void 0,void 0,function(){var t,i,o,a,c=this;return r(this,function(h){if(this._isTransitioning=!0,void 0==(t=f.CHAPTERS[this._nextChapterId]))throw new Error("couldn't find chapter "+this._nextChapterId);return i=!1,-1!=t.requires.indexOf(this.chapterId)&&(i=!0),o=this._nextScene,i?(this.togglePause(!1),a=d.tick()):(this.started&&(this.ui.beginLoading("scene010"==this._nextChapterId),y.track(o.tag,"Loading")),a=d.delay(1)),this._nextChapterId==this.chapterId&&this.mainScene&&this.mainScene.sceneSound&&this.mainScene.sceneSound.cancel(),o.loadDelegate=this,[2,(e&&!i?o.ready():o.chainReady()).then(function(e){return n(c,void 0,void 0,function(){var e,t,n,c,h=this;return r(this,function(r){switch(r.label){case 0:if(this.started=!0,this.togglePause(!1),this.mainScene&&(this.mainScene.cancel(!0),i||this.mainScene.fadeOut()),this._prevChapterId=this.chapterId,this.chapterId=this._nextChapterId,void 0==(e=f.CHAPTERS[this.chapterId]))throw console.error(),new Error("couldn't find chapter "+this.chapterId);return i||this.renderer.dispose(),o._dependentScenes.forEach(function(e){e.isLoaded||(e.scene.init(),e.scene.setDelegate(h),e.scene.install(h.threeScene),h.loadedScenes.push([e.id,e.scene])),e.scene.makePassive&&e.scene.makePassive()}),t=[],n=[],this.loadedScenes.forEach(function(i){-1==e.requires.indexOf(i[0])?(console.log("unloading %s",i[0]),i[1].update=function(){},i[1].uninstall(h.threeScene),i[0]==h._nextChapterId?n.push(i[1]):i[1].cleanup()):t.push(i)}),t.push([this.chapterId,o]),this.loadedScenes=t,this.mainScene&&(this.mainScene.delegate=void 0,this.mainScene.loadDelegate=void 0),this.mainScene=void 0,[4,d.tick()];case 1:return r.sent(),o.init(),o.setDelegate(this),o.addEventListener(l.SceneEvent.End,function(e){h.onSceneEvent(e.type,e.value)}),o.install(this.threeScene),n.forEach(function(e){e.cleanup(!0)}),this.mainScene=o,c=o.begin(void 0,i),this.config.qualityLevel!=s.AdaptiveQualityLevel.Highest&&o.setQualityLevel(this.config.qualityLevel),this.notifyChangeChapter(),this.readyNextScene(),[4,c];case 2:return r.sent(),[4,a];case 3:return r.sent(),this.started&&("scene010"==this.chapterId?d.delay(1.75).then(function(){h.ui.endLoading()}):this.ui.endLoading()),this._isTransitioning=!1,[2,!0]}})})},function(e){return c.handleLoadError(e),Promise.reject(e)})]})})},e.prototype.onSceneEvent=function(e,t){if(!this._isTransitioning){if(e==l.SceneEvent.Next||e==l.SceneEvent.End){if(void 0==this._nextScene&&this.readyNextScene(),void 0==this._nextChapterId||void 0==this._nextScene)return void this.endScreen();this.gotoNextScene()}if(e==l.SceneEvent.Prev){var i=Object.keys(f.CHAPTERS),n=i.indexOf(this.chapterId),r=i[n-1];console.log("prepping prev scene %s",r),this.readyNextScene(r),this.gotoNextScene()}}},e.prototype.readyNextScene=function(e){var t=this,i=this._nextChapterId;if(void 0==e){var n=f.CHAPTERS[this.chapterId];if(!n.next)return void(this._nextScene=void 0);this._nextChapterId=n.next}else this._nextChapterId=e;var r=f.CHAPTERS[this._nextChapterId];if(r)return this._nextScene&&this._nextScene!==this.mainScene&&this._nextChapterId!==i&&this.chapterId!==i&&this._nextScene.cleanup(),this._nextScene=new r.scene(this.config),r.requires.forEach(function(e){var i=void 0,n=!1;if(t.loadedScenes.forEach(function(t){var r=o(t,2),a=r[0],s=r[1];a==e&&(i=s,n=!0)}),!i){var r=f.CHAPTERS[e];i=new r.scene(t.config),n=!1}t._nextScene.addDependentScene(e,i,n)}),this._nextScene.prepare();console.error("failed to find chapter for %s",this._nextChapterId)},e.prototype.endScreen=function(){this.ui.showEndScreen()},e.prototype.requestBegin=function(e){if(void 0!==e)return this.requestChangeMode(e,!0),void this.start();this.restart()},e.prototype.requestReplay=function(){this.replay()},e.prototype.requestPause=function(e){this.togglePause(e)},e.prototype.requestJumpToChapter=function(e){var t=f.CHAPTER_ALIASES[e];t?(this.mainScene.cancel(),this.togglePause(!0),"restart"==t?this.restart():this.chapterId==t?(this.ui.dismissEndScreen(),this.replay()):(this._nextChapterId!=t&&this.readyNextScene(t),this.gotoNextScene(!0))):console.error("no such chapter name %s",e)},e.prototype.notifyChangeChapter=function(){var e=f.REV_CHAPTER_ALIASES[this.chapterId];this.ui.didChangeChapter(e)},e.prototype.updateLoadingProgress=function(e){this.ui.updateLoadingProgress(e)},e.prototype.requestChangeMode=function(e,t){void 0===t&&(t=!1),e!=this.config.mode?e==c.PlayMode.Autoplay||e==c.PlayMode.Interactive||e==c.PlayMode.Manual?(this.config.mode=e,this.trackModeChange(e),this.ui.didChangeMode(e),this.started&&(this.readyNextScene(this.chapterId),this.gotoNextScene(!0))):console.error("bad mode %s",e):t&&this.ui.didChangeMode(e)},e.prototype.requestChangeLanguage=function(e,t){var i=this;void 0===t&&(t=!1);c.Language.English;e!=this.config.lang?(this.trackLanguageChange(e),this.config.lang=e,requestAnimationFrame(function(){document.title=p.default("page_title",e).text,document.getElementsByTagName("html")[0].setAttribute("lang",e),i.ui.didChangeLanguage(e)}),this.started&&(this.readyNextScene(this.chapterId),this.gotoNextScene(!0))):t&&this.ui.didChangeLanguage(e)},e.prototype.requestShowMenu=function(e){this.ui.showMenu(e)},e.prototype.handleLoadError=function(e){var t;e.target&&e.target instanceof XMLHttpRequest&&(e=e.target),e instanceof XMLHttpRequest&&(t=e.status+" "+e.statusText+": "+e.responseURL),("string"==typeof e||e instanceof String)&&(t=e),e.text&&(t=e.text);var i=p.default("LoadError",this.config.lang).text;return t&&(i+="\n\n"+t),console.log("LOADERROR",e),alert(i),!1},e.prototype.trackModeChange=function(e){var t=0,i="Default";switch(e){case c.PlayMode.Interactive:t=0,i="Default";break;case c.PlayMode.Manual:t=1,i="Read";break;case c.PlayMode.Autoplay:t=2,i="Watch"}y.track("Global","Mode"+i),y.track("Global","ChooseMode",t)},e.prototype.trackLanguageChange=function(e){y.track("Global",e==c.Language.English?"English":"Māori"),y.track("Global","ChooseLanguage",e==c.Language.English?0:1)},e.prototype.getConfig=function(){return this.config},e}();i.default=_},{"./components/ui":15,"./components/ui/captions":16,"./config":24,"./localthree":33,"./runloop":38,"./scenebase":39,"./story":55,"./strings":56,"./util/async":58,"./util/camera":60,"./util/dom":63,"./util/ga":64}],2:[function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(i,"__esModule",{value:!0});var r=e("../localthree"),o=e("../util/cloneGltf"),a=e("./target"),s=function(e){function t(t,i,n,s,c,h){var u=e.call(this)||this;u.birds=[],u.count=0,u.target=i,u.count=t;for(var d=0;dthis.currentFadeValue,this.deferredResolved=!1,this.deferred=new a.default,this.deferred.promise()},t.prototype.setValue=function(e){this.startingFadeValue=e,this.currentFadeValue=e,this.targetFadeValue=e,this.updateUniform()},t.prototype.update=function(e,i){var n=this.currentFadeValue-this.targetFadeValue;if(Math.abs(n)>t.EPS&&n<0===this.movingPositive){var r=(this.targetFadeValue-this.startingFadeValue)/this.fadeTime*e;this.currentFadeValue+=r,this.updateUniform()}else!1===this.deferredResolved&&(this.deferred.resolve(),this.deferredResolved=!0)},t.prototype.updateUniform=function(){this.shaderMaterial.uniforms.fadeAmount.value=this.currentFadeValue},t.EPS=.01,t}(r.default.Object3D);i.default=s},{"../util/deferred":62,"./../localthree":33,glslify:74}],9:[function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(i,"__esModule",{value:!0});var r=e("../localthree"),o=e("three"),a=e("./target"),s=function(e){function t(i,n,r){var o=e.call(this)||this;o.moths=[],o.numberMoths=10,o.followRadius=50,o.shouldUpdateMoths=!0,o.parent=n,t.wingMaterial.map=r;for(var a=0;a=i;)t=this.advanceFrame(!0)||t,this.millisRemaining-=i;return t&&this.setFrame(this.currentFrame),t}},e.prototype.update=function(e,t){return this.advanceMillis(e)},e.prototype.reset=function(){return this.fade=!1,this.fadeFramesRemaining=0,this.millisRemaining=0,this.startFrame=0,this.endFrame=this.frames-1,this.currentFrame=0,this.setFrame(0),this.material.opacity=1,this.material.needsUpdate=!0,this},e.prototype.play=function(){return this.millisRemaining=0,this.startFrame=0,this.endFrame=this.frames-1,this.playing=!0,this.looping=!1,this.material.opacity=1,this.material.needsUpdate=!0,this},e.prototype.loop=function(){return this.play(),this.looping=!0,this},e.prototype.fadeOut=function(){this.fade=!0,this.fadeFramesRemaining=5,this.material.opacity=1,this.material.needsUpdate=!0},e.prototype.stop=function(){return this.fade=!1,this.material.visible=!1,this.playing=!1,this},e.prototype.getProgress=function(){return this.currentFrame/(this.frames-1)},e}();i.default=o},{"../localthree":33}],12:[function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function i(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},s=this&&this.__spread||function(){for(var e=[],t=0;t0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(i,"__esModule",{value:!0});var r=e("../../util/dom"),o=e("../../config"),a=e("../../loaders/audio"),s=e("../../util/interaction"),l=function(){function e(e){var t=this;this.delegate=e,this.preStory=document.getElementById("pre-story"),r.toarray(this.preStory.querySelectorAll("button[data-lang]")).forEach(function(e){var i=e;r.on(i,["click"],function(e){e.preventDefault();var n=i.getAttribute("data-lang");i.classList.add("selected"),t.delegate.requestChangeLanguage(n),t.langSelected&&t.langSelected(n)})}),[["button.manual",o.PlayMode.Manual],["button.default",o.PlayMode.Interactive],["button.auto",o.PlayMode.Autoplay]].forEach(function(e){var i=n(e,2),o=i[0],l=i[1];r.once(t.preStory.querySelector(o),["click"],function(e){a.initMixer(e),t.modeSelected&&t.modeSelected(l),s.Interaction.sounds.ding.play()})})}return e.prototype.beginLoading=function(){this.modeSelected=this.langSelected=void 0,this.preStory.classList.contains("hidden")||(this.preStory.className="loading")},e.prototype.selectLanguage=function(){var e=this;return new Promise(function(t){e.langSelected=t,e.preStory.className="lang-select"})},e.prototype.selectMode=function(){var e=this;return new Promise(function(t){e.modeSelected=t,e.preStory.classList.remove("loading"),e.preStory.classList.add("lang-select"),e.preStory.classList.add("mode-select")})},e.prototype.dismiss=function(){var e=this;this.preStory.classList.contains("hidden")||(this.preStory.className="loading",setTimeout(function(){e.preStory.className="hidden"},900))},e.prototype.didChangeLanguage=function(e){r.toarray(this.preStory.querySelectorAll("button[data-lang]")).forEach(function(t){t.getAttribute("data-lang")==e?t.classList.add("selected"):t.classList.remove("selected")})},e}();i.default=l},{"../../config":24,"../../loaders/audio":25,"../../util/dom":63,"../../util/interaction":66}],23:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e("gsap"),r=function(){function e(){this.animDuration=1.5,this.stagger=.5,this.timeline=new n.TimelineLite,this.timeline.pause(),this.timeline.autoRemoveChildren=!0;for(var e=document.querySelector("#title"),t=window.runloop.app.config.lang,i=0;i1?(t--,n.set(e,t)):n.delete(e):console.error("Attempted to decrement count for "+e+" but does not exist in fetch counts")},i.printNonZeroReferenceCounts=function(){window.DEBUG&&console.warn(n)}},{}],27:[function(e,t,i){"use strict";var n=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},r=this&&this.__spread||function(){for(var e=[],t=0;t0)for(m=0;m x0.y ? 1.0 : 0.0\n //i1.y = 1.0 - i1.x;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n // x0 = x0 - 0.0 + 0.0 * C.xx ;\n // x1 = x0 - i1 + 1.0 * C.xx ;\n // x2 = x0 - 1.0 + 2.0 * C.xx ;\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n\n// Permutations\n i = mod289(i); // Avoid truncation effects in permutation\n vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))\n + i.x + vec3(0.0, i1.x, 1.0 ));\n\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m ;\n m = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\n m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\n"]),r(["#define GLSLIFY 1\n#define GLSLIFY 1\nvoid main() {\n float mask_col = texture2D(mask, vUv).r;\n\n #ifdef USE_NOISE_MAP\n\n vec3 noise = texture2D(noiseTex, (noiseOffsetRepeat.xy + vUv) * noiseOffsetRepeat.zw).rgb;\n noise = 1.0 - (1.0 - noise) * contrast;\n\n #else\n\n float _noise = snoise((noiseOffsetRepeat.xy + vUv) * noiseOffsetRepeat.zw);\n _noise = 1.0 - (1.0 - _noise) * contrast;\n vec3 noise = vec3(_noise, _noise, _noise);\n\n #endif\n\n gl_FragColor = vec4(noise * tint, mask_col * opacity);\n}\n"])].join("\n"),vertexShader:[r(["#define GLSLIFY 1\n#define GLSLIFY 1\nvarying vec2 vUv;\nuniform sampler2D mask;\nuniform sampler2D noiseTex;\nuniform vec4 noiseOffsetRepeat;\nuniform vec3 tint;\nuniform float opacity;\nuniform float contrast;\n\n//\n// Description : Array and textureless GLSL 2D simplex noise function.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : ijm\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat snoise(vec2 v)\n {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\n vec2 i = floor(v + dot(v, C.yy) );\n vec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\n vec2 i1;\n //i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n //i1.y = 1.0 - i1.x;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n // x0 = x0 - 0.0 + 0.0 * C.xx ;\n // x1 = x0 - i1 + 1.0 * C.xx ;\n // x2 = x0 - 1.0 + 2.0 * C.xx ;\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n\n// Permutations\n i = mod289(i); // Avoid truncation effects in permutation\n vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))\n + i.x + vec3(0.0, i1.x, 1.0 ));\n\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m ;\n m = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\n m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\n"]),r(["precision highp float;\n#define GLSLIFY 1\n#define GLSLIFY 1\n\nvarying vec4 vNormal;\n// varying vec3 vColor;\n\nvoid main() {\n vNormal = modelMatrix * vec4(normal, 1.0);\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"])].join("\n"),uniforms:{mask:{type:"t",value:void 0},noiseTex:{type:"t",value:void 0},noiseOffsetRepeat:{type:"4f",value:new n.default.Vector4(0,0,1,1)},tint:{value:new n.default.Color(16777215)},opacity:{value:1},contrast:{value:.2}},defines:{USE_NOISE_MAP:1}});return e.transparent=!0,e}},{"../localthree":33,glslify:74}],36:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e("glslify");i.grasswind_vert=n(['#define GLSLIFY 1\n#define GLSLIFY 1\nuniform float time;\nuniform float animationAmount;\nuniform float animationScale;\nuniform float inverseCompression;\n\nvarying vec2 vUv;\n\n//\n// GLSL textureless classic 2D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-08-22\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x)\n{\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec2 fade(vec2 t) {\n return t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\n// Classic Perlin noise\nfloat cnoise(vec2 P)\n{\n vec4 Pi = floor(P.xyxy) + vec4(0.0, 0.0, 1.0, 1.0);\n vec4 Pf = fract(P.xyxy) - vec4(0.0, 0.0, 1.0, 1.0);\n Pi = mod289(Pi); // To avoid truncation effects in permutation\n vec4 ix = Pi.xzxz;\n vec4 iy = Pi.yyww;\n vec4 fx = Pf.xzxz;\n vec4 fy = Pf.yyww;\n\n vec4 i = permute(permute(ix) + iy);\n\n vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0 ;\n vec4 gy = abs(gx) - 0.5 ;\n vec4 tx = floor(gx + 0.5);\n gx = gx - tx;\n\n vec2 g00 = vec2(gx.x,gy.x);\n vec2 g10 = vec2(gx.y,gy.y);\n vec2 g01 = vec2(gx.z,gy.z);\n vec2 g11 = vec2(gx.w,gy.w);\n\n vec4 norm = taylorInvSqrt(vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));\n g00 *= norm.x;\n g01 *= norm.y;\n g10 *= norm.z;\n g11 *= norm.w;\n\n float n00 = dot(g00, vec2(fx.x, fy.x));\n float n10 = dot(g10, vec2(fx.y, fy.y));\n float n01 = dot(g01, vec2(fx.z, fy.z));\n float n11 = dot(g11, vec2(fx.w, fy.w));\n\n vec2 fade_xy = fade(Pf.xy);\n vec2 n_x = mix(vec2(n00, n01), vec2(n10, n11), fade_xy.x);\n float n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return 2.3 * n_xy;\n}\n\nvoid main() {\n vUv = uv;\n vec3 newPosition = position;\n\n // calculate lateral vertex offset\n float offset = sin((color.g * 3.14 + time * color.b * inverseCompression) * animationScale) * animationAmount * color.r;\n \n // calculate final positions\n newPosition.x += offset;\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(newPosition, 1.0);\n}']),i.grasswind_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform vec3 overallColor;\nuniform sampler2D texture;\nuniform sampler2D alphaTexture;\nuniform sampler2D pngTexture;\nuniform float alpha;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 color;\n#ifdef USE_TEXTURE\n color = texture2D(texture, vUv) * vec4(overallColor, 1.0);\n#else \n color = vec4(overallColor, 1.0);\n#endif\n\n#ifdef USE_ALPHA_TEXTURE\n float texAlpha = texture2D(alphaTexture, vUv).r;\n color.a = texAlpha;\n#endif\n\n#ifdef USE_PNG\n color = texture2D(pngTexture, vUv);\n#endif\n // alpha is inverted because the default is zero and i didnt want to have to update all uniforms through the code base\n gl_FragColor = color * vec4(1.0, 1.0, 1.0, 1.0 - alpha);\n}"]),i.mist_vert=n(['#define GLSLIFY 1\n#define GLSLIFY 1\nuniform float time;\n\nvarying vec2 vUv;\n\n//\n// GLSL textureless classic 3D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-10-11\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x)\n{\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec3 fade(vec3 t) {\n return t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\n// Classic Perlin noise\nfloat cnoise(vec3 P)\n{\n vec3 Pi0 = floor(P); // Integer part for indexing\n vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\n vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\n\nvoid main() {\n vUv = uv;\n vec4 newPosition = modelMatrix * vec4(position, 1.0);\n newPosition.y += cnoise(newPosition.xyz + (time * 0.0625)) * 1.0;\n newPosition.x += cnoise(newPosition.xyz + (time * 0.03125)) * 3.0;\n gl_Position = projectionMatrix * viewMatrix * newPosition;\n}']),i.mist_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform sampler2D texture;\n\nvarying vec2 vUv;\n\nvoid main() {\n float alpha = texture2D(texture, vUv).r;\n gl_FragColor = vec4(vec3(1.0), alpha);\n}"]),i.clearing_mist_vert=n(['#define GLSLIFY 1\n#define GLSLIFY 1\nuniform float time;\n\nvarying vec2 vUv;\n\n//\n// GLSL textureless classic 3D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-10-11\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x)\n{\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec3 fade(vec3 t) {\n return t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\n// Classic Perlin noise\nfloat cnoise(vec3 P)\n{\n vec3 Pi0 = floor(P); // Integer part for indexing\n vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\n vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\n\nvoid main() {\n vUv = uv;\n vec4 newPosition = modelMatrix * vec4(position, 1.0);\n newPosition.y += cnoise(newPosition.xyz + (time * 0.0625)) * 0.2;\n newPosition.x += cnoise(newPosition.xyz + (time * 0.03125)) * 0.2;\n gl_Position = projectionMatrix * viewMatrix * newPosition;\n}']),i.clearing_mist_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform sampler2D texture;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 color = vec4(1.0);\n color.a = texture2D(texture, vUv).r;\n gl_FragColor = color;\n}"]),i.clouds_vert=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform float time;\n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv + vec2(time * 0.0005, 0.0);\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);\n}"]),i.clouds_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform sampler2D texture;\nuniform sampler2D alphaTexture;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 color = texture2D(texture, vUv);\n color.a = texture2D(alphaTexture, vUv).r;\n gl_FragColor = color;\n}"]),i.mountain_pass_lights_vert=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);\n}"]),i.mountain_pass_lights_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform sampler2D alphaMap;\nuniform vec3 color;\nuniform float alphaMul;\n\nvarying vec2 vUv;\n\nvoid main() {\n float a = texture2D(alphaMap, vUv).r * alphaMul;\n gl_FragColor = vec4(color, a);\n}"]),i.glowworm_glow_vert=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform mat4 inverseTransposeModelMatrix;\n\nvarying vec3 vWorldNormal;\nvarying vec4 vWorldPosition;\n\nvoid main() {\n vWorldPosition = modelMatrix * vec4(position, 1.0);\n // vWorldNormal = mat3(inverseTransposeModelMatrix) * normal;\n vWorldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\n gl_Position = projectionMatrix * viewMatrix * vWorldPosition;\n}\n"]),i.glowworm_glow_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform vec3 color;\nuniform float alpha;\nuniform float falloff;\n\nvarying vec3 vWorldNormal;\nvarying vec4 vWorldPosition;\n\nvoid main() {\n vec3 direction = normalize(vWorldPosition.xyz - cameraPosition);\n float fresnel = pow(max(0.0, dot(direction, vWorldNormal)), falloff);\n gl_FragColor = vec4(color, fresnel * alpha);\n}\n"]),i.end_clouds_vert=n(['#define GLSLIFY 1\n#define GLSLIFY 1\nuniform float time;\n\nvarying vec2 vUv;\n\n//\n// GLSL textureless classic 3D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-10-11\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec3 mod289(vec3 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x)\n{\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec3 fade(vec3 t) {\n return t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\n// Classic Perlin noise\nfloat cnoise(vec3 P)\n{\n vec3 Pi0 = floor(P); // Integer part for indexing\n vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\n vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\n\nvoid main() {\n vUv = uv;\n vec4 newPosition = modelMatrix * vec4(position, 1.0);\n newPosition.y += cnoise(newPosition.xyz + (time * 0.0625)) * 0.2;\n newPosition.x += cnoise(newPosition.xyz + (time * 0.03125)) * 0.2;\n gl_Position = projectionMatrix * viewMatrix * newPosition;\n}']),i.end_clouds_frag=n(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform sampler2D texture;\nuniform sampler2D alphaTexture;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 color = texture2D(texture, vUv);\n color.a = texture2D(alphaTexture, vUv).r;\n gl_FragColor = color;\n}"])},{glslify:74}],37:[function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(i,"__esModule",{value:!0});var r=e("../localthree"),o=e("glslify"),a=function(e){function t(t,i){var n=e.call(this)||this;return n.size=.05,n.noiseAmount=1,n.noiseScale=1,n.noiseRandomnessMultiplier=0,n.sizeVariance=0,n.speed=1,n.speedVariance=0,n.rotationSpeedMax=0,n.rotationSpeedMin=0,n.pulseSpeed=0,n.pulseSpeedVariance=0,n.pulseAmplitude=0,n.pulseAmplitudeVariance=0,n.color=new r.default.Color(1,1,1),n.direction=new r.default.Vector3(0,-1,0),n.textureAtlasDimension=1,n.lightInnerAngle=0,n.lightOuterAngle=0,n.lightLinearDistanceFalloff=1,n.lightColor=new r.default.Color(16777215),n.lightIntensity=1,n.useBoundsX=!0,n.useBoundsY=!0,n.useBoundsZ=!0,n.useRotation=!0,n.useMovement=!0,n.usePulse=!1,n.useCircularSize=!1,n.useAdditive=!1,n.useGlowwormLight=!1,n.geo=new r.default.BufferGeometry,n.accumulator=0,n.texture=t,n.geo.boundingBox=new r.default.Box3,n.geo.boundingSphere=new r.default.Sphere,n.geo.boundingBox.setFromCenterAndSize(new r.default.Vector3(0,0,0),new r.default.Vector3(1,1,1)),void 0!==i&&(void 0!==i.size&&(n.size=i.size),void 0!==i.noiseAmount&&(n.noiseAmount=i.noiseAmount),void 0!==i.noiseScale&&(n.noiseScale=i.noiseScale),void 0!==i.noiseRandomnessMultiplier&&(n.noiseRandomnessMultiplier=i.noiseRandomnessMultiplier),void 0!==i.sizeVariance&&(n.sizeVariance=i.sizeVariance),void 0!==i.speed&&(n.speed=i.speed),void 0!==i.speedVariance&&(n.speedVariance=i.speedVariance),void 0!==i.rotationSpeedMax&&(n.rotationSpeedMax=i.rotationSpeedMax),void 0!==i.rotationSpeedMin&&(n.rotationSpeedMin=i.rotationSpeedMin),void 0!==i.pulseSpeed&&(n.pulseSpeed=i.pulseSpeed),void 0!==i.pulseSpeedVariance&&(n.pulseSpeedVariance=i.pulseSpeedVariance),void 0!==i.pulseAmplitude&&(n.pulseAmplitude=i.pulseAmplitude),void 0!==i.pulseAmplitudeVariance&&(n.pulseAmplitudeVariance=i.pulseAmplitudeVariance),void 0!==i.direction&&(n.direction=i.direction),void 0!==i.textureAtlasDimension&&(n.textureAtlasDimension=i.textureAtlasDimension),void 0!==i.color&&(n.color=i.color),void 0!==i.boundingBox&&(n.geo.boundingBox=i.boundingBox),void 0!==i.useBoundsX&&(n.useBoundsX=i.useBoundsX),void 0!==i.useBoundsY&&(n.useBoundsY=i.useBoundsY),void 0!==i.useBoundsZ&&(n.useBoundsZ=i.useBoundsZ),void 0!==i.useRotation&&(n.useRotation=i.useRotation),void 0!==i.useMovement&&(n.useMovement=i.useMovement),void 0!==i.usePulse&&(n.usePulse=i.usePulse),void 0!==i.useCircularSize&&(n.useCircularSize=i.useCircularSize),void 0!==i.useAdditive&&(n.useAdditive=i.useAdditive),void 0!==i.useGlowwormLight&&(n.useGlowwormLight=i.useGlowwormLight),void 0!==i.lightInnerAngle&&(n.lightInnerAngle=i.lightInnerAngle),void 0!==i.lightOuterAngle&&(n.lightOuterAngle=i.lightOuterAngle),void 0!==i.lightLinearDistanceFalloff&&(n.lightLinearDistanceFalloff=i.lightLinearDistanceFalloff),void 0!==i.lightColor&&(n.lightColor=i.lightColor),void 0!==i.lightIntensity&&(n.lightIntensity=i.lightIntensity)),n}return n(t,e),t.prototype.buildFromRandom=function(e){for(var t=[],i=this.geo.boundingBox.getCenter(),n=this.geo.boundingBox.getSize(),r=0;r.5?1:-1,s.push(w,w,w,w);var b=Math.random();l.push(b,b,b,b);var S=(2*Math.random()-1)*this.pulseSpeedVariance*this.pulseSpeed,M=this.pulseSpeed+S;c.push(M,M,M,M);var T=(2*Math.random()-1)*this.pulseAmplitudeVariance*this.pulseAmplitude,E=this.pulseAmplitude+T;h.push(E,E,E,E)}this.geo.addAttribute("position",new r.default.Float32BufferAttribute(i,3)),this.geo.setIndex(n),this.geo.addAttribute("uv",new r.default.Float32BufferAttribute(o,2)),this.geo.addAttribute("particleCenter",new r.default.Float32BufferAttribute(e,3)),this.geo.addAttribute("speed",new r.default.Float32BufferAttribute(a,1)),this.geo.addAttribute("rotationSpeed",new r.default.Float32BufferAttribute(s,1)),this.geo.addAttribute("randomness",new r.default.Float32BufferAttribute(l,1)),this.geo.addAttribute("pulseSpeed",new r.default.Float32BufferAttribute(c,1)),this.geo.addAttribute("pulseAmplitude",new r.default.Float32BufferAttribute(h,1)),this.updateUniforms(),this.mesh=new r.default.Mesh(this.geo,this.material),this.add(this.mesh)},t.prototype.updateUniforms=function(){var e=this.geo.boundingBox.getCenter(),t=this.geo.boundingBox.getSize();this.geo.boundingBox.getBoundingSphere(this.geo.boundingSphere),this.direction.normalize();var i={time:{type:"f",value:0},noiseAmount:{type:"f",value:this.noiseAmount},noiseScale:{type:"f",value:this.noiseScale},overallSize:{type:"f",value:1},overallPulseAmount:{type:"f",value:1},texture:{type:"t",value:this.texture},color:{type:"c",value:this.color},xCenterAndSize:{value:new r.default.Vector2(e.x,1.01*t.x)},yCenterAndSize:{value:new r.default.Vector2(e.y,1.01*t.y)},zCenterAndSize:{value:new r.default.Vector2(e.z,1.01*t.z)},direction:{value:this.direction},randomnessMultiplier:{value:this.noiseRandomnessMultiplier},circleCenter:{value:new r.default.Vector3(0,0,0)},radiusSq:{type:"f",value:0},lightPosition:{value:new r.default.Vector3},lightDirection:{value:new r.default.Vector3},lightCutoff:{value:Math.cos(this.lightInnerAngle*Math.PI/180)},lightOuterCutoff:{value:Math.cos(this.lightOuterAngle*Math.PI/180)},lightLinearDistanceFalloffSq:{value:this.lightLinearDistanceFalloff*this.lightLinearDistanceFalloff},lightColor:{type:"c",value:this.lightColor},lightIntensity:{type:"f",value:this.lightIntensity}},n={};this.useBoundsX&&(n.USE_BOUNDS_X=""),this.useBoundsY&&(n.USE_BOUNDS_Y=""),this.useBoundsZ&&(n.USE_BOUNDS_Z=""),this.useRotation&&(n.USE_ROTATION=""),this.useMovement&&(n.USE_MOVEMENT=""),this.usePulse&&(n.USE_PULSE=""),this.useCircularSize&&(n.USE_CIRCULAR_SIZE=""),this.useGlowwormLight&&(n.USE_GLOWWORM_LIGHT=""),this.material=new r.default.ShaderMaterial({vertexShader:o(['#define GLSLIFY 1\n#define GLSLIFY 1\nattribute vec3 particleCenter;\nattribute float speed;\nattribute float rotationSpeed;\nattribute float randomness;\nattribute float pulseSpeed;\nattribute float pulseAmplitude;\n\nuniform float time;\nuniform float noiseAmount;\nuniform float noiseScale;\nuniform float overallSize;\nuniform float overallPulseAmount;\nuniform float randomnessMultiplier;\nuniform vec3 direction;\n\n// circular size stuff\nuniform vec3 circleCenter;\nuniform float radiusSq;\n\n// yCenterAndSize is for wrapping particle positions around as they fall\n// x is the center of the bounding box, and y is the size\nuniform vec2 xCenterAndSize;\nuniform vec2 yCenterAndSize;\nuniform vec2 zCenterAndSize;\n\n// point lighting stuff\nuniform vec3 lightPosition;\nuniform vec3 lightDirection;\nuniform float lightCutoff;\nuniform float lightOuterCutoff;\nuniform float lightLinearDistanceFalloffSq;\n\nvarying vec2 vUv;\nvarying float vSpotLightMultiplier;\n\n//\n// GLSL textureless classic 4D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-08-22\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec4 mod289(vec4 x)\n{\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x)\n{\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec4 fade(vec4 t) {\n return t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\n// Classic Perlin noise\nfloat cnoise(vec4 P)\n{\n vec4 Pi0 = floor(P); // Integer part for indexing\n vec4 Pi1 = Pi0 + 1.0; // Integer part + 1\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec4 Pf0 = fract(P); // Fractional part for interpolation\n vec4 Pf1 = Pf0 - 1.0; // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = vec4(Pi0.zzzz);\n vec4 iz1 = vec4(Pi1.zzzz);\n vec4 iw0 = vec4(Pi0.wwww);\n vec4 iw1 = vec4(Pi1.wwww);\n\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n vec4 ixy00 = permute(ixy0 + iw0);\n vec4 ixy01 = permute(ixy0 + iw1);\n vec4 ixy10 = permute(ixy1 + iw0);\n vec4 ixy11 = permute(ixy1 + iw1);\n\n vec4 gx00 = ixy00 * (1.0 / 7.0);\n vec4 gy00 = floor(gx00) * (1.0 / 7.0);\n vec4 gz00 = floor(gy00) * (1.0 / 6.0);\n gx00 = fract(gx00) - 0.5;\n gy00 = fract(gy00) - 0.5;\n gz00 = fract(gz00) - 0.5;\n vec4 gw00 = vec4(0.75) - abs(gx00) - abs(gy00) - abs(gz00);\n vec4 sw00 = step(gw00, vec4(0.0));\n gx00 -= sw00 * (step(0.0, gx00) - 0.5);\n gy00 -= sw00 * (step(0.0, gy00) - 0.5);\n\n vec4 gx01 = ixy01 * (1.0 / 7.0);\n vec4 gy01 = floor(gx01) * (1.0 / 7.0);\n vec4 gz01 = floor(gy01) * (1.0 / 6.0);\n gx01 = fract(gx01) - 0.5;\n gy01 = fract(gy01) - 0.5;\n gz01 = fract(gz01) - 0.5;\n vec4 gw01 = vec4(0.75) - abs(gx01) - abs(gy01) - abs(gz01);\n vec4 sw01 = step(gw01, vec4(0.0));\n gx01 -= sw01 * (step(0.0, gx01) - 0.5);\n gy01 -= sw01 * (step(0.0, gy01) - 0.5);\n\n vec4 gx10 = ixy10 * (1.0 / 7.0);\n vec4 gy10 = floor(gx10) * (1.0 / 7.0);\n vec4 gz10 = floor(gy10) * (1.0 / 6.0);\n gx10 = fract(gx10) - 0.5;\n gy10 = fract(gy10) - 0.5;\n gz10 = fract(gz10) - 0.5;\n vec4 gw10 = vec4(0.75) - abs(gx10) - abs(gy10) - abs(gz10);\n vec4 sw10 = step(gw10, vec4(0.0));\n gx10 -= sw10 * (step(0.0, gx10) - 0.5);\n gy10 -= sw10 * (step(0.0, gy10) - 0.5);\n\n vec4 gx11 = ixy11 * (1.0 / 7.0);\n vec4 gy11 = floor(gx11) * (1.0 / 7.0);\n vec4 gz11 = floor(gy11) * (1.0 / 6.0);\n gx11 = fract(gx11) - 0.5;\n gy11 = fract(gy11) - 0.5;\n gz11 = fract(gz11) - 0.5;\n vec4 gw11 = vec4(0.75) - abs(gx11) - abs(gy11) - abs(gz11);\n vec4 sw11 = step(gw11, vec4(0.0));\n gx11 -= sw11 * (step(0.0, gx11) - 0.5);\n gy11 -= sw11 * (step(0.0, gy11) - 0.5);\n\n vec4 g0000 = vec4(gx00.x,gy00.x,gz00.x,gw00.x);\n vec4 g1000 = vec4(gx00.y,gy00.y,gz00.y,gw00.y);\n vec4 g0100 = vec4(gx00.z,gy00.z,gz00.z,gw00.z);\n vec4 g1100 = vec4(gx00.w,gy00.w,gz00.w,gw00.w);\n vec4 g0010 = vec4(gx10.x,gy10.x,gz10.x,gw10.x);\n vec4 g1010 = vec4(gx10.y,gy10.y,gz10.y,gw10.y);\n vec4 g0110 = vec4(gx10.z,gy10.z,gz10.z,gw10.z);\n vec4 g1110 = vec4(gx10.w,gy10.w,gz10.w,gw10.w);\n vec4 g0001 = vec4(gx01.x,gy01.x,gz01.x,gw01.x);\n vec4 g1001 = vec4(gx01.y,gy01.y,gz01.y,gw01.y);\n vec4 g0101 = vec4(gx01.z,gy01.z,gz01.z,gw01.z);\n vec4 g1101 = vec4(gx01.w,gy01.w,gz01.w,gw01.w);\n vec4 g0011 = vec4(gx11.x,gy11.x,gz11.x,gw11.x);\n vec4 g1011 = vec4(gx11.y,gy11.y,gz11.y,gw11.y);\n vec4 g0111 = vec4(gx11.z,gy11.z,gz11.z,gw11.z);\n vec4 g1111 = vec4(gx11.w,gy11.w,gz11.w,gw11.w);\n\n vec4 norm00 = taylorInvSqrt(vec4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));\n g0000 *= norm00.x;\n g0100 *= norm00.y;\n g1000 *= norm00.z;\n g1100 *= norm00.w;\n\n vec4 norm01 = taylorInvSqrt(vec4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));\n g0001 *= norm01.x;\n g0101 *= norm01.y;\n g1001 *= norm01.z;\n g1101 *= norm01.w;\n\n vec4 norm10 = taylorInvSqrt(vec4(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));\n g0010 *= norm10.x;\n g0110 *= norm10.y;\n g1010 *= norm10.z;\n g1110 *= norm10.w;\n\n vec4 norm11 = taylorInvSqrt(vec4(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));\n g0011 *= norm11.x;\n g0111 *= norm11.y;\n g1011 *= norm11.z;\n g1111 *= norm11.w;\n\n float n0000 = dot(g0000, Pf0);\n float n1000 = dot(g1000, vec4(Pf1.x, Pf0.yzw));\n float n0100 = dot(g0100, vec4(Pf0.x, Pf1.y, Pf0.zw));\n float n1100 = dot(g1100, vec4(Pf1.xy, Pf0.zw));\n float n0010 = dot(g0010, vec4(Pf0.xy, Pf1.z, Pf0.w));\n float n1010 = dot(g1010, vec4(Pf1.x, Pf0.y, Pf1.z, Pf0.w));\n float n0110 = dot(g0110, vec4(Pf0.x, Pf1.yz, Pf0.w));\n float n1110 = dot(g1110, vec4(Pf1.xyz, Pf0.w));\n float n0001 = dot(g0001, vec4(Pf0.xyz, Pf1.w));\n float n1001 = dot(g1001, vec4(Pf1.x, Pf0.yz, Pf1.w));\n float n0101 = dot(g0101, vec4(Pf0.x, Pf1.y, Pf0.z, Pf1.w));\n float n1101 = dot(g1101, vec4(Pf1.xy, Pf0.z, Pf1.w));\n float n0011 = dot(g0011, vec4(Pf0.xy, Pf1.zw));\n float n1011 = dot(g1011, vec4(Pf1.x, Pf0.y, Pf1.zw));\n float n0111 = dot(g0111, vec4(Pf0.x, Pf1.yzw));\n float n1111 = dot(g1111, Pf1);\n\n vec4 fade_xyzw = fade(Pf0);\n vec4 n_0w = mix(vec4(n0000, n1000, n0100, n1100), vec4(n0001, n1001, n0101, n1101), fade_xyzw.w);\n vec4 n_1w = mix(vec4(n0010, n1010, n0110, n1110), vec4(n0011, n1011, n0111, n1111), fade_xyzw.w);\n vec4 n_zw = mix(n_0w, n_1w, fade_xyzw.z);\n vec2 n_yzw = mix(n_zw.xy, n_zw.zw, fade_xyzw.y);\n float n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);\n return 2.2 * n_xyzw;\n}\n\nfloat distanceSq(vec3 vec) {\n return vec.x * vec.x + vec.y * vec.y + vec.z * vec.z;\n}\n\nvoid main() {\n vUv = uv;\n\n float multipliedRandomness = randomness * randomnessMultiplier;\n\n // get camera vectors\n vec3 cameraRight = vec3(viewMatrix[0][0], viewMatrix[1][0], viewMatrix[2][0]);\n vec3 cameraUp = vec3(viewMatrix[0][1], viewMatrix[1][1], viewMatrix[2][1]);\n vec3 cameraForward = vec3(-viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2]);\n\n// MOVEMENT BLOCK\n\n vec4 particleCenterWS;\n\n#ifdef USE_MOVEMENT\n // calculate new particle position along the direction vector\n particleCenterWS = vec4(particleCenter, 1.0);\n float movement = time * speed;\n particleCenterWS.xyz += direction * movement;\n\n // calculate camera space wiggle\n float wiggle = cnoise(vec4((particleCenter + time * speed) * noiseScale, multipliedRandomness)) * noiseAmount;\n vec3 wiggleDirection = cross(cameraForward, direction);\n particleCenterWS.xyz += wiggleDirection * wiggle;\n#else\n particleCenterWS = vec4(particleCenter, 1.0);\n#endif\n\n// BOUNDS BLOCK\n\n#ifdef USE_BOUNDS_X\n particleCenterWS.x = mod(particleCenterWS.x - (xCenterAndSize.x - xCenterAndSize.y * 0.5), xCenterAndSize.y) + xCenterAndSize.x - xCenterAndSize.y * 0.5;\n#endif\n\n#ifdef USE_BOUNDS_Y\n particleCenterWS.y = mod(particleCenterWS.y - (yCenterAndSize.x - yCenterAndSize.y * 0.5), yCenterAndSize.y) + yCenterAndSize.x - yCenterAndSize.y * 0.5;\n#endif\n\n#ifdef USE_BOUNDS_Z\n particleCenterWS.z = mod(particleCenterWS.z - (zCenterAndSize.x - zCenterAndSize.y * 0.5), zCenterAndSize.y) + zCenterAndSize.x - zCenterAndSize.y * 0.5;\n#endif\n\n// ROTATION BLOCK\n\n vec3 tempPosition;\n\n#ifdef USE_ROTATION\n // make z rotation matrix for camera space rotation\n float rotSpeedTemp = time * rotationSpeed;\n float cosRotation = cos(rotSpeedTemp);\n float sinRotation = sin(rotSpeedTemp);\n\n // matrix initialization has to be column major\n mat3 rotation = mat3(cosRotation, sinRotation, 0.0, -sinRotation, cosRotation, 0.0, 0.0, 0.0, 1.0);\n\n tempPosition = rotation * position;\n#else\n tempPosition = position;\n#endif\n\n float pulsePositionMultiplier;\n#ifdef USE_PULSE\n // calculate pulse offsets\n pulsePositionMultiplier = 1.0 - sin(time * pulseSpeed + multipliedRandomness) * pulseAmplitude * overallPulseAmount;\n#else\n pulsePositionMultiplier = 1.0;\n#endif\n\n float multipliedOverallSize;\n#ifdef USE_CIRCULAR_SIZE\n vec3 vectorToCenter = particleCenterWS.xyz - circleCenter;\n float vectorLengthSq = distanceSq(vectorToCenter);\n multipliedOverallSize = 1.0 - smoothstep(radiusSq * randomness, radiusSq, vectorLengthSq);\n multipliedOverallSize *= overallSize;\n#else\n multipliedOverallSize = overallSize;\n#endif\n\n // rotate position and scale verts in camera space\n tempPosition *= pulsePositionMultiplier * pow(multipliedOverallSize, randomness);\n vec3 newPosition = particleCenterWS.xyz + cameraRight * tempPosition.x + cameraUp * tempPosition.y;\n vec4 worldSpacePosition = modelMatrix * vec4(newPosition, 1.0);\n\n// POINT LIGHTING BLOCK\n\n#ifdef USE_GLOWWORM_LIGHT\n vec3 distanceVector = worldSpacePosition.xyz - lightPosition;\n float dist = distanceSq(distanceVector);\n vec3 normDistance = normalize(distanceVector);\n float theta = dot(normDistance, normalize(-lightDirection));\n float epsilon = lightCutoff - lightOuterCutoff;\n float intensity = (theta - lightOuterCutoff) / epsilon;\n vSpotLightMultiplier = clamp(intensity - dist / lightLinearDistanceFalloffSq, 0.0, 1.0);\n#endif\n\n gl_Position = projectionMatrix * viewMatrix * worldSpacePosition;\n}\n']),fragmentShader:o(["#define GLSLIFY 1\n#define GLSLIFY 1\nuniform sampler2D texture;\nuniform vec3 color;\nuniform vec3 lightColor;\nuniform float lightIntensity;\n\nvarying vec2 vUv;\nvarying float vSpotLightMultiplier;\n\nvoid main() {\n\n vec3 newColor = color;\n#ifdef USE_GLOWWORM_LIGHT\n newColor = mix(newColor, lightColor * lightIntensity, vSpotLightMultiplier * lightIntensity);\n#endif\n\n gl_FragColor = texture2D(texture, vUv) * vec4(newColor, 1.0);\n}\n"]),uniforms:i,defines:n}),this.material.transparent=!0,this.material.depthWrite=!1,this.material.name="InstancedParticlesQuads",this.useAdditive&&(this.material.blending=r.default.AdditiveBlending)},t.prototype.setUniform=function(e,t){this.material.uniforms[e].value=t},t.prototype.getBoundingBox=function(){return this.geo.boundingBox},t.prototype.update=function(e,t){this.accumulator+=e,this.material.uniforms.time.value=this.accumulator},t.prototype.cleanup=function(){this.geo.dispose(),this.material.dispose(),this.remove(this.mesh)},t}(r.default.Object3D);i.default=a},{"../localthree":33,glslify:74}],38:[function(e,t,i){"use strict";function n(e){var t=Math.max(window.innerWidth,320);return t-t%4}function r(e){var t=Math.max(window.innerHeight,320);return t-t%4}Object.defineProperty(i,"__esModule",{value:!0});var o=e("./localthree"),a=e("stats.js"),s=e("./util/dom");i.getWW=n,i.getWH=r,i.nextPowerOf2=function(e){for(var t=2;t<.95*e;)t<<=1;return t};var l=function(){function e(e,t,i){var s=this;this.threeRenderer=t,this.container=i,this.width=0,this.height=0,this.leftOffset=0,this.frameNum=0,this.queuedFrame=0,this.deltaRemaining=0,this.paused=!1,this.running=!1,this.clock=new o.default.Clock(!1),this.qualityTracker=new h(10,15,45,10),this.app=e,this.app.pauseCallback=function(e){s.paused=e},this.width=n(),this.height=r();t.getSize(),t.getPixelRatio();this.render=this.render.bind(this),this.resize(!0),this.app.handleResize(this.width,this.height),this.paused=!1,this.running=!1,1===window.DEBUG&&(this._stats=new a,this._stats.showPanel(0),document.body.appendChild(this._stats.dom)),this.qualityTracker.onQualityLevelChanged=this.qualityLevelChanged.bind(this),this.qualityTracker.onThroughTheQualityFloor=this.throughTheQualityFloor.bind(this)}return e.prototype.reset=function(){this.clock.start()},e.prototype.resize=function(e){var t=n(this.threeRenderer)-20,i=r(this.threeRenderer)-20;if(t/i>2){t=2*i}return!(!e&&this.width==t&&this.height==i)&&(this.width=t,this.height=i,this.leftOffset=0,this.container.style.width=this.width+"px",this.container.style.height=this.height+"px",this.container.style.maxWidth="",this.threeRenderer.setSize(this.width,this.height),!0)},e.prototype.render=function(){void 0!==this._stats&&this._stats.begin(),this.frameNum+=1,this.running&&(this.queuedFrame=requestAnimationFrame(this.render));var e=this.resize();if(e){var t=this.threeRenderer.getPixelRatio();this.app.handleResize(this.width*t,this.height*t)}var i=this.clock.getDelta()+this.deltaRemaining;if(!this.paused||e){var n=this.clock.elapsedTime;i>.5&&(console.log("dt="+i.toFixed(2)+"s > 500ms threshold, ignoring and doing 33ms update"),i=.033),this.paused||(this.app.update(i,n),this.qualityTracker.update(i,n)),this.app.beforeRender&&this.app.beforeRender(this.threeRenderer),this.app.render(this.threeRenderer),this.app.lateRender&&this.app.lateRender(this.threeRenderer),void 0!==this._stats&&this._stats.end()}else void 0!==this._stats&&this._stats.end()},e.prototype.qualityLevelChanged=function(e){this.app.qualityLevelChanged(e),c.Low},e.prototype.throughTheQualityFloor=function(){var e=this;console.warn("QUALITY IS FLOORED"),this.stop(),this.app.togglePause(!0);var t=document.getElementById("device-unsupported-prompt");null!==t&&(t.classList.add("allow-carryon"),t.style.display="block",s.once(t.querySelector(".carryon"),["click"],function(t){t.preventDefault(),e.continueAnyway()}))},e.prototype.continueAnyway=function(){this.start(),this.app.togglePause(!1);var e=document.getElementById("device-unsupported-prompt");null!==e&&(e.style.display="none")},e.prototype.start=function(){this.running||(this.running=!0,this.clock.start(),this.queuedFrame=requestAnimationFrame(this.render))},e.prototype.stop=function(){this.running=!1,cancelAnimationFrame(this.queuedFrame),this.queuedFrame=void 0},e.prototype.togglePause=function(){this.running?this.stop():this.start()},e}();i.RunLoop=l;var c;!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High",e[e.Highest=3]="Highest"}(c=i.AdaptiveQualityLevel||(i.AdaptiveQualityLevel={}));var h=function(){function e(e,t,i,n){this.currentQualityLevel=c.Highest,this.timer=0,this.sampleCount=0,this.currentFps=0,this.timeInterval=e,this.lowerFpsLimit=t,this.upperFpsLimit=i,this.continueLimit=n}return e.prototype.update=function(e,t){this.timer+=e,this.sampleCount++,this.currentFps+=(1/e-this.currentFps)/this.sampleCount,this.timer>this.timeInterval&&(this.timer-=this.timeInterval,this.assessQualityLevels())},e.prototype.assessQualityLevels=function(){this.currentFpsthis.upperFpsLimit&&this.currentQualityLevel<3&&(this.currentQualityLevel++,console.warn("High framerate: %s FPS > %s FPS target, increasing quality to %s",this.currentFps.toPrecision(3),this.upperFpsLimit.toPrecision(3),c[this.currentQualityLevel]),this.qualityLevelChanged()),this.currentFps=0,this.sampleCount=0},e.prototype.qualityLevelChanged=function(){void 0!==this.onQualityLevelChanged&&this.onQualityLevelChanged(this.currentQualityLevel)},e.prototype.qualityFloored=function(){void 0!==this.onThroughTheQualityFloor&&(this.onThroughTheQualityFloor(),this.onThroughTheQualityFloor=void 0)},e.prototype.DEV_setLevel=function(e){this.currentQualityLevel=e,this.qualityLevelChanged()},e}();i.AdaptiveQualityTracker=h},{"./localthree":33,"./util/dom":63,"stats.js":77}],39:[function(e,t,i){"use strict";function n(e){return e.kind==f.AssetType.Texture}function r(e){return e.kind==f.AssetType.GLTF}function o(e){return e.kind==f.AssetType.Sound}function a(e){return e.kind==f.AssetType.OBJ}function s(e){return e.kind==f.AssetType.Json}function l(e,t,n){var r=e.match(/\.([^.]+)$/);if(r){var o=r[1],a=i.AssetExtensionsMap[o];if(a)return new a(e,t,n);console.error("%s - loader not found for extension %s",e,o)}else console.error("%s - extension not found, loader not mapped",e)}function c(e,t){var i=[];for(var n in e)if(e.hasOwnProperty(n)){if("string"!=typeof e[n]){i.push(e[n]);continue}var r=l(e[n],n,t);if(!r){console.error("received null asset for %s",n);continue}e[n]=r,i.push(r)}return i}function h(e,t){["gltfs","json","textures","objs","sounds"].forEach(function(i){var n=t[i];void 0!=n&&Object.keys(n).forEach(function(r){var o=t.prefix+r,a=e[i];void 0!=a&&null!=a||(e[i]=a={}),a[o]&&console.error("Name collision: %s in %s in %s",r,i,e);var s;if("string"==typeof n[r]){if(void 0==(s=l(n[r],r,e.config)))return void console.error("couldn't create asset",o);s.source=f.AssetSource.Bundle,t._wrappedAssets.push(s)}else s=n[r];n[r]=a[o]=s})})}var u=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),d=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(i,"__esModule",{value:!0});var p=e("./localthree"),f=e("./loaders/iasset"),m=e("./loaders/texture"),g=e("./loaders/gltf"),v=e("./loaders/json"),y=e("./loaders/audio"),_=e("./loaders/obj"),x=e("./util/ga"),w=e("./components/scenesound");i.AssetExtensionsMap={},i.AssetExtensionsMap.jpg=i.AssetExtensionsMap.png=m.default,i.AssetExtensionsMap.glb=i.AssetExtensionsMap.gltf=g.default,i.AssetExtensionsMap.mp3=i.AssetExtensionsMap.ogg=y.AudioAsset,i.AssetExtensionsMap.obj=_.default,i.AssetExtensionsMap.json=v.default;var b=function(){function e(e){this.config=e,this._assetName="",this._wrappedAssets=[],this.initialPosition=new p.default.Vector3,this.initialScale=new p.default.Vector3(1,1,1),this.initialRotation=new p.default.Euler}return e.getInstance=function(e){return e.assets[this.assetName]||(e.assets[this.assetName]=new this(e),e.assets[this.assetName]._assetName=this.assetName),e.assets[this.assetName]},e.prototype.getAsset=function(e,t){if(void 0!=e){var i=e[t];if(i.loadState==f.AssetLoadState.Ready)return i.unwrap()}},e.prototype.getTexture=function(e){if(void 0!=this.textures){var t=this.textures[e];return void 0!=t&&n(t)?t.unwrap():void 0}},e.prototype.dispose=function(){this._wrappedAssets.forEach(function(e){e.dispose&&e.dispose()})},e.prototype.setInitialsFromRoot=function(){this.root?(this.initialPosition.copy(this.root.position),this.initialScale.copy(this.root.scale),this.initialRotation.copy(this.root.rotation)):console.warn("no root")},e.prototype.reset=function(){this.root&&(this.root.position.copy(this.initialPosition),this.root.scale.copy(this.initialScale),this.root.rotation.copy(this.initialRotation),this.onReset&&this.onReset())},e.prototype.getRoot=function(){if(this.root)return this.root;if(this.assemble&&this.assemble(),!this.root)throw new Error("no root");return this.root},e.prototype.unparent=function(){var e=this.root;return!(!e||!e.parent)&&(e.parent.remove(e),!0)},e.assetName="sheep",e}();i.AssetBundle=b,i.isTextureAsset=n,i.isGLTFAsset=r,i.isAudioAsset=o,i.isOBJAsset=a,i.isJSONAsset=s,i.assetFromUrl=l,i.mergeBundle=h;var S=function(){return function(e,t,i){this.id=e,this.scene=t,this.isLoaded=i}}();i.DepSceneWrapper=S;var M;!function(e){e.End="end",e.Next="next",e.Prev="prev",e.Replay="replay",e.CustomEvent="custom",e.Advance="advance"}(M=i.SceneEvent||(i.SceneEvent={}));var T=function(e){function t(t){var i=e.call(this)||this;return i.config=t,i._sceneTextureKeys=[],i.bundles={},i._dependentScenes=[],i.progressTarget=0,i.progressCurrent=0,i.renderCount=0,i._sceneElapsed=0,i.textures&&(i._sceneTextureKeys=Object.keys(i.textures)),i.sceneSound=new w.SceneSound(i,t),i}return u(t,e),t.prototype._defaultWarn=function(e){},t.prototype.setDelegate=function(e){this.delegate=e},t.prototype.wrapResources=function(){if(void 0===this._wrappedAssets){var e=c(this.textures,this.config),t=c(this.gltfs,this.config),i=c(this.sounds,this.config),n=c(this.objs,this.config),r=c(this.json,this.config);this._wrappedAssets=e.concat(t).concat(i).concat(n).concat(r)}},t.prototype.notifyProgressUpdate=function(){if(0!=this.progressTarget){var e=this.progressCurrent,t=this.progressTarget;this.loadDelegate&&this.loadDelegate.updateLoadingProgress(e/t)}},t.prototype.addDependentScene=function(e,t,i){this._dependentScenes.push(new S(e,t,i))},t.prototype.prepareDepScenes=function(){var e=this;return Promise.all(this._dependentScenes.map(function(t){if(t.isLoaded)return Promise.resolve(t.scene);var i=d(t.scene.prepare(),2),n=i[0],r=i[1];return e.progressTarget+=r.length,r.forEach(function(t){t.then(function(t){e.progressCurrent+=1,e.notifyProgressUpdate()})}),n.then(function(e){return t.scene})}))},t.prototype.readyDepScenes=function(){return Promise.all(this._dependentScenes.map(function(e){return e.isLoaded?Promise.resolve(e.scene):e.scene.ready().then(function(t){return e.scene})}))},t.prototype.prepare=function(){var e=this;Object.keys(this.bundles).forEach(function(t){h(e,e.bundles[t])}),this.wrapResources();var t=this._wrappedAssets.map(function(e){return e.fetch()}),i=this._prepPromise=this.prepareDepScenes().then(function(e){return Promise.all(t)});return this.progressTarget+=t.length,t.forEach(function(t){t.then(function(t){e.progressCurrent+=1,e.notifyProgressUpdate()})}),[i,t]},t.prototype.ready=function(){var e=this;return void 0==this._prepPromise&&this.prepare(),this._prepPromise=Promise.all([this.readyDepScenes(),this._prepPromise]).then(function(t){var i=d(t,2),n=(i[0],i[1].map(function(e){return e.ready()}));return e.progressTarget+=n.length,n.forEach(function(t){t.then(function(t){e.progressCurrent+=1,e.notifyProgressUpdate()})}),Promise.all(n)}),this._prepPromise},t.prototype.chainReady=function(){var e=this;return void 0==this._prepPromise&&this.prepare(),this._prepPromise.then(function(t){var i=Promise.resolve([]);return t.forEach(function(t){e.progressTarget+=1,i=i.then(function(i){return new Promise(function(n,r){setTimeout(function(){return t.ready().then(function(t){e.progressCurrent+=1,e.notifyProgressUpdate(),i.push(t),n(i)})},0)})})}),i})},t.prototype.init=function(){void 0!=this._wrappedAssets&&(this._wrappedAssets.forEach(function(e){e.error}),this.scene_init(),this._wrappedAssets&&this._wrappedAssets.forEach(function(e){r(e)&&e.result&&e.source==f.AssetSource.Scene&&(e.result.animations=[])}))},t.prototype.scene_init=function(){this._defaultWarn("scene_init")},t.prototype.install=function(e,t){void 0===t&&(t=!0),this._defaultWarn("install")},t.prototype.onBegin=function(){this._defaultWarn("onBegin")},t.prototype.onPause=function(){},t.prototype.onResume=function(){},t.prototype.onCancel=function(){},t.prototype.onCleanup=function(){},t.prototype.begin=function(e,t){var i=this;return void 0===t&&(t=!1),this.state&&this.state.cancelled&&!e?Promise.resolve():new Promise(function(n,r){var o=function(){if(i.state){if(i.state.started){i.state.cancel();var e=i.state.fresh();i.state=e}i.state.start()}i.fadeInBGSound(),i.onBegin()},a=Date.now()/1e3,s=function(r){var l=Date.now()/1e3;!t&&!e&&l-a<5&&i.renderCount<40?requestAnimationFrame(function(){return s(n)}):(i.animUtil&&i.animUtil.reset(),t||e?o():setTimeout(o,1e3),x.track(i.tag,"Begin"),r())};s(n)})},t.prototype.pause=function(){this.state&&!this.state.cancelled&&this.state.pause(),this.onPause&&this.onPause(),this.sceneSound.pause()},t.prototype.resume=function(){this.delegate&&(this.state&&!this.state.cancelled&&this.state.resume(),this.onResume&&this.onResume(),this.sceneSound.resume())},t.prototype.cancel=function(e){void 0===e&&(e=!1),this.state&&!this.state.cancelled&&this.state.cancel(),this.onCancel&&this.onCancel(),e||this.sceneSound.cancel()},t.prototype.mute=function(){this.state&&this.state.mute(),this.sceneSound.mute()},t.prototype.unmute=function(){this.state&&this.state.unmute(),this.sceneSound.unmute()},t.prototype.setQualityLevel=function(e){this._defaultWarn("setQualityLevel")},t.prototype.update=function(e,t){0==this._sceneElapsed&&this._defaultWarn("update"),this._sceneElapsed+=e,this._sceneElapsed>10&&this.event(M.Next,0)},t.prototype.uninstall=function(e){this._defaultWarn("uninstall")},t.prototype.cleanup=function(e){void 0===e&&(e=!1),this.fadeOutBGSound();var t=[];if(this._wrappedAssets&&this._wrappedAssets.forEach(function(e){r(e)?t.push(e):e.source==f.AssetSource.Scene&&e.dispose&&e.dispose()}),!e){var i=this.scene;this.scene||(i=this.root),t.forEach(function(e){e.result&&e.result.scenes.forEach(function(t){t.parent&&(t.parent==i||t.parent.parent&&t.parent.parent==i)&&(console.log("deparenting",e.url),t.parent.remove(t))})})}t.forEach(function(e){e.source==f.AssetSource.Scene&&e.dispose()}),this.onCleanup&&this.onCleanup(e),this.animUtil&&!e&&this.animUtil.cleanup(),this.interaction&&!e&&this.interaction.cleanup(),this.sceneSound&&this.sceneSound.cleanup(),this.state=void 0,this.delegate=void 0,this.loadDelegate=void 0},t.prototype.fadeOut=function(){this.sceneSound.fadeOut(2).then(function(e){e.forEach(function(e){console.info("late dispose of %s?",e.howl._src),e.stop(),e.unload()})})},t.prototype.fadeInBGSound=function(e){if(!this._bgSound){var i=this.getSoundNow(e||t.BGLayer);if(i){var n=this._bgSound=i.play();n.volume(0),n.fade(0,1,1e3),n.loop(!0)}}},t.prototype.fadeOutBGSound=function(){if(this._bgSound){var e=this.getSoundNow(t.BGLayer),i=this._bgSound;i.fade(1,0,500),i.once("fade",function(){i.stop(),e&&e.dispose(),i.unload()}),this._bgSound=void 0}},t.prototype.changeBGSound=function(e){this.fadeOutBGSound(),this.fadeInBGSound(e)},t.prototype.event=function(e,t){this.dispatchEvent({type:e,value:t})},t.prototype.getTexture=function(e){var t=this.textures[e];if("string"!=typeof t&&void 0!=t)return n(t)?t.unwrap():void 0},t.prototype.getAllTextures=function(){var e=this;if(!this.textures)return[];var t=[];return Object.keys(this.textures).forEach(function(i){var n=e.getTexture(i);void 0!=n?t.push(n):console.info("undefined texture",i)}),t},t.prototype.getGLTF=function(e){var t=this.gltfs[e];if("string"!=typeof t)return r(t)?t.unwrap():void 0},t.prototype.getOBJ=function(e){var t=this.objs[e];if("string"!=typeof t)return a(t)?t.unwrap():void 0},t.prototype.getJSON=function(e){var t=this.json[e];if("string"!=typeof t)return s(t)?t.unwrap():void 0},t.prototype.getSound=function(e){var t=this.sounds[e];if("string"==typeof t||void 0===t||!o(t))return console.error("bad asset type"),Promise.reject(Error("bad asset"));if(void 0==y.mixer.initPromise)return console.error("no mixer init promise"),Promise.reject(Error("no mixer init promise"));var i=t;return y.mixer.initPromise.then(function(){return i.fetch()})},t.prototype.getSoundNow=function(e){var t=this.sounds[e];if("string"!=typeof t&&void 0!==t&&o(t))return t},t.prototype.bindAnim=function(e,t,i,n){void 0===n&&(n=p.default.InterpolateDiscrete);var r=this.getGLTF(i);if(!r)throw new Error("no bundle named "+i);var o=r.animations[0];o.tracks.forEach(function(e){e.setInterpolation(n)});return e.clipAction(o,t)},t.prototype.getClip=function(e,t){void 0===t&&(t=p.default.InterpolateDiscrete);var i=this.getGLTF(e);if(!i)throw new Error("no bundle named "+e);var n=i.animations[0];return n.tracks.forEach(function(e){e.setInterpolation(t)}),n},t.BGLayer="_BG_",t}(p.default.EventDispatcher);i.SceneBase=T},{"./components/scenesound":10,"./loaders/audio":25,"./loaders/gltf":27,"./loaders/iasset":28,"./loaders/json":29,"./loaders/obj":30,"./loaders/texture":32,"./localthree":33,"./util/ga":64}],40:[function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,s)}l((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){function i(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?.75.toString():"0");u.showTimeline.add(a.TweenLite.to(h.cardObj.position,u.transitionTime,{y:p,ease:a.Back.easeInOut,onStart:function(){h.sound.play()}}),m),u.showEnabledTimeline.add(a.TweenLite.to(h.cardObj.scale,.2,{x:1.05*i,y:1.05*i}),d>0?.1*d:0).add(a.TweenLite.to(h.cardObj.scale,.2,{x:i,y:i}),d>0?.2*d:.2),u.scene.add(h.cardObj),u.interaction.addCollidable(h.cardFront,h),u.cardFaces.push(h.cardFront)},u=this,d=0;d1.2?1.2:t,this.scene.scale.set(t,t,1)}}},e.prototype.showCards=function(){var e=this;return this.onResize(),this.rolloverOff(),new Promise(function(t,i){if(e.visible)return t();e.onCancel.push(function(){i()}),e.showTimeline.eventCallback("onComplete",function(){e.visible=!0,e.playing=void 0,t()}),e.showTimeline.play(0),e.playing=e.showTimeline})},e.prototype.flipCards=function(e,t,i){var n=this;this.rolloverOff();for(var r=function(){var n=o.cards[o.nextUnflippedCard],r=t.config.vo()?e[s]-o.flipTimeline.duration():i?i[s]:3*s;o.flipTimeline.add(a.TweenLite.delayedCall(r,function(){n.flipTimeline.play(0)})),n.flipped=!0,o.nextUnflippedCard++},o=this,s=0;s0?.75.toString():"0");this.hideTimeline.add(a.TweenLite.to(e.cardObj.position,this.transitionTime,{y:e.initialPosition.y,ease:a.Back.easeInOut,onStart:function(){e.sound.play()}}),i)},e.prototype.cardsEnabled=function(e){this.paused&&e&&console.error("Cards are paused, cannot select card");var t=s.InteractionState.idle;e&&(t=s.InteractionState.waiting),this.cards.forEach(function(e){e.chosen||(e.state=t)})},e.prototype.cardSelected=function(){this.cardsEnabled(!1),this.rolloverOff(),this.playing&&(this.playing.pause(),this.playing=void 0),this.cards.forEach(function(e){e.resolve=void 0})},e.prototype.rolloverOn=function(){var e=this;this.cardFaces.forEach(function(t){return e.interaction.addVisible(t)})},e.prototype.rolloverOff=function(){var e=this;this.cardFaces.forEach(function(t){return e.interaction.removeVisible(t)})},e.prototype.reset=function(){this.cards.forEach(function(e){return e.reset()}),this.hideTimeline.clear(),this.hideTimeline.restart(),this.flipTimeline.clear(),this.flipTimeline.restart(),this.nextUnflippedCard=0,this.visible=!1,this.cardsEnabled(!1),this.rolloverOff()},e.prototype.pause=function(e){this.playing&&this.playing.pause(),this.paused=!0,e&&(this.playing=void 0)},e.prototype.resume=function(){this.playing&&this.playing.resume(),this.paused=!1},e.prototype.cancel=function(){this.pause(!0),this.reset(),this.onCancel.forEach(function(e){e()})},e.prototype.update=function(e,t){},e}();i.ChoicesScene=h;var u=new o.default.MeshBasicMaterial({transparent:!0}),d=new o.default.PlaneBufferGeometry(.35,.5),p=!1,f=function(){function e(e,t,i,n,r){this.state=s.InteractionState.idle,this.flipped=!1,this.chosen=!1,this.hoverOn=!1,this.option=e,this.parent=t,this.cardFront=this.makeSide(e.textureName),this.cardBack=this.makeSide("cardBack"),this.cardBack.rotation.y=Math.PI,this.cardObj=new l.Object3D,this.cardObj.add(this.cardFront),this.cardObj.add(this.cardBack),this.scale=i;var c=new o.default.Vector3(i,i,i);this.cardObj.scale.set(c.x,c.y,1);this.cardObj.rotation.y=Math.PI,this.zRotation=r,this.initialPosition=n;var h=s.Interaction.sounds[this.option.soundName];h&&(this.sound=h);this.flipTimeline=new a.TimelineLite,this.flipTimeline.pause(),this.hoverOnTimeline=new a.TimelineLite,this.hoverOnTimeline.pause(),this.hoverOffTimeline=new a.TimelineLite,this.hoverOffTimeline.pause(),this.flipTimeline.add([a.TweenLite.to(this.cardObj.scale,.2,{x:1.18*c.x,y:1.18*c.x,z:1}),a.TweenLite.to(this.cardObj.scale,.25,{x:c.x,y:c.y,z:1,delay:.36*1.25}),a.TweenLite.to(this.cardObj.rotation,.6,{y:this.rad(-10),z:this.rad(-this.zRotation),onStart:function(){s.Interaction.sounds.cardFlip.play()}}),a.TweenLite.to(this.cardObj.rotation,.25,{y:10*Math.PI/180,delay:.65}),a.TweenLite.to(this.cardObj.rotation,.25,{y:0,delay:.72*1.25})]),this.addHoverTweens(this.hoverOnTimeline),this.hoverOffTimeline.add(a.TweenLite.to(this.cardObj.scale,.25,{x:this.scale,y:this.scale})),this.setToInitialPosition()}return e.prototype.cleanup=function(){[this.hoverOnTimeline,this.hoverOffTimeline,this.flipTimeline].forEach(function(e){["onStart","onComplete"].forEach(function(t){e.eventCallback(t,null)})})},e.prototype.rad=function(e){return e*(Math.PI/180)},e.prototype.setToInitialPosition=function(){this.cardObj.position.set(this.initialPosition.x,this.initialPosition.y,this.initialPosition.z),this.cardObj.scale.set(this.scale,this.scale,1),this.cardObj.rotation.z=this.rad(this.zRotation)},e.prototype.makeSide=function(e){var t=new o.default.Mesh(d,this.getMaterial(e));return t.renderOrder=1,t},e.prototype.getMaterial=function(e,t){var i;if("cardBack"==e)p||(u.map=this.parent.textures[e],u.alphaMap=this.parent.textures.matte,[u.map,u.alphaMap].forEach(function(e){e&&(e.repeat.set(1,770/1024),e.offset.y=.248046875)}),p=!0),i=u;else{var n=new o.default.Color(t?8289918:16777215);i=new o.default.MeshBasicMaterial({color:n});var r=this.parent.textures[e];r&&(r.repeat.set(1,770/1024),r.offset.y=.248046875,r.anisotropy=2,i.map=r,i.alphaMap=this.parent.textures.matte,i.transparent=!0)}return i},e.prototype.callAction=function(){this.parent.paused&&console.error("Cards are paused, cannot select card"),this.chosen||this.parent.paused||this.state==s.InteractionState.idle||this.resolve&&(this.resolve(),this.resolve=void 0,this.isChosen())},e.prototype.isChosen=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return this.parent.cardSelected(),this.chosen=!0,this.state=s.InteractionState.idle,e=this.getMaterial(this.option.textureName,!0),[4,this.parent.hideCards(this)];case 1:return t.sent(),this.cardFront.material=e,this.cardObj.scale.set(this.scale,this.scale,1),[2]}})})},e.prototype.reset=function(){this.chosen=!1,this.cardObj.rotation.y=Math.PI,this.setToInitialPosition(),this.cardFront.material=this.getMaterial(this.option.textureName)},e.prototype.addHoverTweens=function(e){e.add(a.TweenLite.to(this.cardObj.scale,.15,{x:1.1*this.scale,y:1.1*this.scale})).add(a.TweenLite.to(this.cardObj.scale,.1,{x:1.025*this.scale,y:1.025*this.scale})).add(a.TweenLite.to(this.cardObj.scale,.2,{x:1.05*this.scale,y:1.05*this.scale}))},e.prototype.rolloverOn=function(){this.hoverOn||(this.hoverOn=!0,this.hoverOffTimeline.pause(),this.hoverOnTimeline.play(0))},e.prototype.rolloverOff=function(){this.hoverOn&&(this.hoverOn=!1,this.hoverOnTimeline.pause(),this.hoverOffTimeline.play(0))},e.prototype.update=function(e,t){},e}();i.ChoiceCard=f},{"../localthree":33,"../util/async":58,"../util/interaction":66,gsap:75,three:80}],41:[function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function i(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=this.TWOS_DELTA;){this.dtAccum-=this.TWOS_DELTA,this.waterfallMat.uniforms.noiseOffsetRepeat.value.y-=.15*this.TWOS_DELTA,this.lightShaftMat.uniforms.noiseOffsetRepeat.value.x+=.0025*this.TWOS_DELTA,this.quadParticles.update(this.TWOS_DELTA,t-this.dtAccum),this.frothTexture.offset.x+=.03*e;var i=this.mistMat.uniforms.noiseOffsetRepeat.value;i.x-=e/3,i.y+=e/4}this.interaction.update(e,t)},t.prototype.onCleanup=function(e){void 0===e&&(e=!1),e||void 0===this.quadParticles||this.quadParticles.cleanup()},t}(s.SceneBase);i.default=M},{"../components/bundles/bigfoot":3,"../components/bundles/goat":5,"../components/bundles/sheep":6,"../components/scenesound":10,"../components/statemachine":12,"../components/stick":13,"../localthree":33,"../materials/maskednoise":35,"../particles/instanced_particles_quads":37,"../scenebase":39,"../strings":56,"../util/animationutil":57,"../util/camera":60,"../util/ga":64,"../util/interaction":66,"../util/threeextra":68,"./scene040_bundle":45}],43:[function(e,t,i){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,s)}l((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function i(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]