!function(t){"use strict";var e=function(){this.pageScrollElement="html, body",this.$body=t("body"),this.setUserOS(),this.setUserAgent()};e.prototype.setUserOS=function(){var t="";-1!=navigator.appVersion.indexOf("Win")&&(t="windows"),-1!=navigator.appVersion.indexOf("Mac")&&(t="mac"),-1!=navigator.appVersion.indexOf("X11")&&(t="unix"),-1!=navigator.appVersion.indexOf("Linux")&&(t="linux"),this.$body.addClass(t)},e.prototype.setUserAgent=function(){navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)?this.$body.addClass("mobile"):(this.$body.addClass("desktop"),navigator.userAgent.match(/MSIE 9.0/)&&this.$body.addClass("ie9"))},e.prototype.isVisibleXs=function(){return!t("#pg-visible-xs").length&&this.$body.append('
'),t("#pg-visible-xs").is(":visible")},e.prototype.isVisibleSm=function(){return!t("#pg-visible-sm").length&&this.$body.append('
'),t("#pg-visible-sm").is(":visible")},e.prototype.isVisibleMd=function(){return!t("#pg-visible-md").length&&this.$body.append('
'),t("#pg-visible-md").is(":visible")},e.prototype.isVisibleLg=function(){return!t("#pg-visible-lg").length&&this.$body.append('
'),t("#pg-visible-lg").is(":visible")},e.prototype.getUserAgent=function(){return t("body").hasClass("mobile")?"mobile":"desktop"},e.prototype.setFullScreen=function(t){var e=t.requestFullScreen||t.webkitRequestFullScreen||t.mozRequestFullScreen||t.msRequestFullscreen;if(e)e.call(t);else if(void 0!==window.ActiveXObject){var i=new ActiveXObject("WScript.Shell");null!==i&&i.SendKeys("{F11}")}},e.prototype.getColor=function(e,i){i=parseFloat(i)||1;var n=t(".pg-colors").length?t(".pg-colors"):t('
').appendTo("body"),r=(e=(n.find('[data-color="'+e+'"]').length?n.find('[data-color="'+e+'"]'):t('
').appendTo(n)).css("background-color")).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);return"rgba("+r[1]+", "+r[2]+", "+r[3]+", "+i+")"},e.prototype.initSidebar=function(e){t('[data-pages="sidebar"]',e).each((function(){var e=t(this);e.sidebar(e.data())}))},e.prototype.initDropDown=function(e){t(".dropdown-default",e).each((function(){var e=t(this).find(".dropdown-menu").siblings(".dropdown-toggle"),i=t(this).find(".dropdown-menu").actual("outerWidth");e.actual("outerWidth")",i+=r.children("a").text(),i+=""}i+="",e.after(i);var s=e.next()[0];t(s).on("change",(function(i){t("option:selected",this);var n=this.value,r=e.find('a[data-target="'+n+'"]');0==r.length&&(r=e.find('a[data-target="'+n+'"]')),r.tab("show")})),t(s).wrap(''),new SelectFx(s)}))},e.prototype.initNotificationCenter=function(){t("body").on("click",".notification-list .dropdown-menu",(function(t){t.stopPropagation()})),t("body").on("click",".toggle-more-details",(function(e){var i=t(this).closest(".heading");i.closest(".heading").children(".more-details").stop().slideToggle("fast",(function(){i.toggleClass("open")}))}))},e.prototype.initProgressBars=function(){t(window).on("load",(function(){t(".progress-bar-indeterminate, .progress-circle-indeterminate, .mapplic-pin").hide().show(0)}))},e.prototype.initInputFile=function(){t(document).on("change",".btn-file :file",(function(){var e=t(this),i=e.get(0).files?e.get(0).files.length:1,n=e.val().replace(/\\/g,"/").replace(/.*\//,"");e.trigger("fileselect",[i,n])})),t(".btn-file :file").on("fileselect",(function(e,i,n){var r=t(this).parents(".input-group").find(":text"),o=i>1?i+" files selected":n;r.length?r.val(o):t(this).parent().html(o)}))},e.prototype.initHorizontalMenu=function(){var e,i;t("[data-pages-init='horizontal-menu']");function n(){var e=t("[data-pages-init='horizontal-menu']"),i=parseInt(e.data("hideExtraLi"))||0;if(0!=e.length){var n=e[0].getBoundingClientRect(),r=0,o=0;if(e.children("ul").children("li.more").remove(),e.children("ul").children("li").each((function(e){t(this).removeAttr("style"),r+=t(this).outerWidth(!0),o++})),!(t(window).width()<992)){var a=parseInt(n.width/(r/o))-1;if(o>(a-=i))for(var s=function(t){t.children("ul").append("
    • ");return t.children("ul").children("li.more")}(e),c=a;c ul > li",(function(){if(0!=t(this).children("ul").length)if(t(window).width()<992){var i=t(".menu-bar"),n=t(this),r=(i.find("li"),t(this).children("ul"));n.hasClass("open active")?(n.find(".arrow").removeClass("open active"),r.slideUp(200,(function(){n.removeClass("open active")}))):(i.find("li.open").find("ul").slideUp(200),i.find("li.open").find("a").find(".arrow").removeClass("open active"),i.find("li.open").removeClass("open active"),n.find(".arrow").addClass("open active"),r.slideDown(200,(function(){n.addClass("open active")})))}else t(this).hasClass("opening")?function(i){var n=t(i.children("ul")[0]),r=t("
      ");if(0==n.length)return;var o=n[0].getBoundingClientRect();r.css({width:o.width+"px",height:o.height+"px","z-index":"auto"}),i.append(r);var a=n.children("li").css("transition-duration");a=parseInt(1e3*parseFloat(a)),i.addClass("closing"),window.clearTimeout(e),e=window.setTimeout((function(){r.height(0),i.removeClass("open opening closing")}),a-80)}(t(this)):function(i){var n=t(i.children("ul")[0]),r=t("
      ");if(i.children(".ghost-nav-dropdown").remove(),i.addClass("open").siblings().removeClass("open opening"),0==n.length)return;var o=n[0].getBoundingClientRect();r.css({width:o.width+"px",height:"0px"}),i.append(r),r.height(o.height);var a=r.css("transition-duration");a=parseInt(1e3*parseFloat(a)),window.clearTimeout(e),e=window.setTimeout((function(){i.addClass("opening"),r.remove()}),a)}(t(this))})),t(window).on("resize",(function(t){clearTimeout(i),i=setTimeout((function(){n()}),250)})),t(".content").on("click",(function(){t(".horizontal-menu .bar-inner > ul > li").removeClass("open"),t(".menu-bar > ul > li").removeClass("open opening").children("ul").removeAttr("style"),t("body").find(".ghost-nav-dropdown").remove()})),t('[data-toggle="horizontal-menu"]').on("click touchstart",(function(e){e.preventDefault(),t("body").toggleClass("horizontal-menu-open"),t(".horizontal-menu-backdrop").length?t(".horizontal-menu-backdrop").fadeToggle("fast",(function(){t(this).remove()})):(t(".header").append('
      '),t(".horizontal-menu-backdrop").fadeToggle("fast")),t(".menu-bar").toggleClass("open")}))},e.prototype.initTooltipPlugin=function(e){t.fn.tooltip&&t('[data-toggle="tooltip"]',e).tooltip()},e.prototype.initSelect2Plugin=function(e){t.fn.select2&&t('[data-init-plugin="select2"]',e).each((function(){t(this).select2({minimumResultsForSearch:"true"==t(this).attr("data-disable-search")?-1:1}).on("select2:open",(function(){t.fn.scrollbar&&t(".select2-results__options").scrollbar({ignoreMobile:!1})}))}))},e.prototype.initScrollBarPlugin=function(e){t.fn.scrollbar&&t(".scrollable",e).scrollbar({ignoreOverlay:!1})},e.prototype.initListView=function(e){t.fn.ioslist&&t('[data-init-list-view="ioslist"]',e).ioslist(),t.fn.scrollbar&&t(".list-view-wrapper",e).scrollbar({ignoreOverlay:!1})},e.prototype.initSwitcheryPlugin=function(e){window.Switchery&&t('[data-init-plugin="switchery"]',e).each((function(){var e=t(this);new Switchery(e.get(0),{color:null!=e.data("color")?t.Pages.getColor(e.data("color")):t.Pages.getColor("success"),size:null!=e.data("size")?e.data("size"):"default"})}))},e.prototype.initSelectFxPlugin=function(e){window.SelectFx&&t('select[data-init-plugin="cs-select"]',e).each((function(){var e=t(this).get(0);t(e).wrap('
      '),new SelectFx(e)}))},e.prototype.initUnveilPlugin=function(e){t.fn.unveil&&t("img",e).unveil()},e.prototype.initValidatorPlugin=function(){t.validator&&t.validator.setDefaults({ignore:"",showErrors:function(e,i){var n=this;return t.each(this.successList,(function(e,i){if(t(this).closest(".form-group-attached").length)return t(i).popover("hide")})),t.each(i,(function(e,i){var r;if(!(r=t(i.element).closest(".form-group-attached")).length)return n.defaultShowErrors();t(i.element).popover({trigger:"manual",placement:"top",html:!0,container:r.closest("form"),content:i.message}),(r=t(i.element).closest(".form-group")).addClass("has-error"),t(i.element).popover("show")}))},onfocusout:function(e){var i=t(e).closest(".form-group");t(e).valid()&&(i.removeClass("has-error"),i.next(".error").remove())},onkeyup:function(e){var i=t(e).closest(".form-group");t(e).valid()?(t(e).removeClass("error"),i.removeClass("has-error"),i.next("label.error").remove(),i.find("label.error").remove()):i.addClass("has-error")},errorPlacement:function(e,i){var n=t(i).closest(".form-group");n.hasClass("form-group-default")?(n.addClass("has-error"),e.insertAfter(n)):e.insertAfter(i)}})},e.prototype.setBackgroundImage=function(){t("[data-pages-bg-image]").each((function(){var e=t(this),i={pagesBgImage:"",lazyLoad:"true",progressType:"",progressColor:"",bgOverlay:"",bgOverlayClass:"",overlayOpacity:0},n=e.data();t.extend(i,n);var r=i.pagesBgImage,o=i.bgOverlay,a=i.overlayOpacity,s=t('
      ');s.addClass(i.bgOverlayClass),s.css({"background-color":o,opacity:1}),e.append(s);var c=new Image;c.src=r,c.onload=function(){e.css({"background-image":"url("+r+")"}),e.children(".bg-overlay").css({opacity:a})}}))},e.prototype.secondarySidebar=function(){t('[data-init="secondary-sidebar"]').each((function(){t(this).on("click",".main-menu li a",(function(e){if(!1!==t(this).parent().children(".sub-menu")){var i=t(this),n=t(this).parent().parent(),r=t(this).parent(),o=t(this).parent().children(".sub-menu");r.hasClass("open active")?(i.children(".arrow").removeClass("open active"),o.slideUp(200,(function(){r.removeClass("open active")}))):(n.children("li.open").children(".sub-menu").slideUp(200),n.children("li.open").children("a").children(".arrow").removeClass("open active"),n.children("li.open").removeClass("open active"),i.children(".arrow").addClass("open active"),o.slideDown(200,(function(){r.addClass("open active")})))}}))})),t('[data-init="secondary-sidebar-toggle"]').each((function(){t(this).on("click",(function(e){var i=t(this).get(0).getBoundingClientRect(),n=t('[data-init="secondary-sidebar"]');if(n.hasClass("open"))n.removeClass("open"),n.removeAttr("style");else{n.addClass("open");var r=n.get(0).getBoundingClientRect();n.css({top:i.bottom,"max-height":t(window).height()-i.bottom,left:t(window).width()/2-r.width/2,visibility:"visible"})}}))}))},e.prototype.init=function(){this.initSidebar(),this.setBackgroundImage(),this.initDropDown(),this.initFormGroupDefault(),this.initSlidingTabs(),this.initNotificationCenter(),this.initProgressBars(),this.initHorizontalMenu(),this.initTooltipPlugin(),this.initSelect2Plugin(),this.initScrollBarPlugin(),this.initSwitcheryPlugin(),this.initSelectFxPlugin(),this.initUnveilPlugin(),this.initValidatorPlugin(),this.initListView(),this.initInputFile(),this.reponsiveTabs(),this.secondarySidebar()},t.Pages=new e,t.Pages.Constructor=e}(window.jQuery),function(t){"use strict";function e(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function i(t,i){this.el=t,this.options=e({},this.options),e(this.options,i),this._init()}function n(t,e){e.parentNode.insertBefore(t,e.nextSibling)}i.prototype.options={newTab:!0,stickyPlaceholder:!0,container:"body",onChange:function(t){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),t.dispatchEvent(e)}},i.prototype._init=function(){var t=document.querySelector("option[selected]");this.hasDefaultPlaceholder=t&&t.disabled,this.selectedOpt=t||this.el.querySelector("option"),this._createSelectEl(),this.selOpts=[].slice.call(this.selEl.querySelectorAll("li[data-option]")),this.selOptsCount=this.selOpts.length,this.current=this.selOpts.indexOf(this.selEl.querySelector("li.cs-selected"))||-1,this.selPlaceholder=this.selEl.querySelector("span.cs-placeholder"),this._initEvents(),this.el.onchange=function(){var t=this.selectedIndex;this.children[t].innerHTML.trim()}},i.prototype._createSelectEl=function(){var t="",e=function(t){var e="",i="",n="";return!t.selectedOpt||this.foundSelected||this.hasDefaultPlaceholder||(i+="cs-selected ",this.foundSelected=!0),t.getAttribute("data-class")&&(i+=t.getAttribute("data-class")),t.getAttribute("data-link")&&(n="data-link="+t.getAttribute("data-link")),""!==i&&(e='class="'+i+'" '),"
    • '+t.textContent+"
    • "};[].slice.call(this.el.children).forEach((function(i){if(!i.disabled){var n=i.tagName.toLowerCase();"option"===n?t+=e(i):"optgroup"===n&&(t+='
    • '+i.label+"
        ",[].slice.call(i.children).forEach((function(i){t+=e(i)})),t+="
    • ")}}));var i='
        '+t+"
      ";this.selEl=document.createElement("div"),this.selEl.className=this.el.className,this.selEl.tabIndex=this.el.tabIndex,this.selEl.innerHTML=''+this.selectedOpt.textContent+""+i,this.el.parentNode.appendChild(this.selEl),this.selEl.appendChild(this.el);var n=document.createElement("div");n.className="cs-backdrop",this.selEl.appendChild(n)},i.prototype._initEvents=function(){var t=this;this.selPlaceholder.addEventListener("click",(function(){t._toggleSelect()})),this.selOpts.forEach((function(e,i){e.addEventListener("click",(function(){t.current=i,t._changeOption(),t._toggleSelect()}))})),document.addEventListener("click",(function(e){var i=e.target;t._isOpen()&&i!==t.selEl&&!function(t,e){if(!t)return!1;for(var i=t.target||t.srcElement||t||!1;i&&i!=e;)i=i.parentNode||!1;return!1!==i}(i,t.selEl)&&t._toggleSelect()})),this.selEl.addEventListener("keydown",(function(e){switch(e.keyCode||e.which){case 38:e.preventDefault(),t._navigateOpts("prev");break;case 40:e.preventDefault(),t._navigateOpts("next");break;case 32:e.preventDefault(),t._isOpen()&&void 0!==t.preSelCurrent&&-1!==t.preSelCurrent&&t._changeOption(),t._toggleSelect();break;case 13:e.preventDefault(),t._isOpen()&&void 0!==t.preSelCurrent&&-1!==t.preSelCurrent&&(t._changeOption(),t._toggleSelect());break;case 27:e.preventDefault(),t._isOpen()&&t._toggleSelect()}}))},i.prototype._navigateOpts=function(t){this._isOpen()||this._toggleSelect();var e=void 0!==this.preSelCurrent&&-1!==this.preSelCurrent?this.preSelCurrent:this.current;("prev"===t&&e>0||"next"===t&&e
      '),this.$element.attr("data-color")&&this.$container.addClass("progress-circle-"+this.$element.attr("data-color")),this.$element.attr("data-thick")&&this.$container.addClass("progress-circle-thick"),this.$pie=t('
      '),this.$pie.$left=t('
      '),this.$pie.$right=t('
      '),this.$pie.append(this.$pie.$left).append(this.$pie.$right),this.$container.append(this.$pie).append('
      '),this.$element.after(this.$container),this.val=this.$element.val();var r=n(this.val);this.val<=50?this.$pie.$right.css("transform","rotate("+r+"deg)"):(this.$pie.css("clip","rect(auto, auto, auto, auto)"),this.$pie.$right.css("transform","rotate(180deg)"),this.$pie.$left.css("transform","rotate("+r+"deg)"))};e.VERSION="1.0.0",e.prototype.value=function(t){if(void 0!==t){var e=n(t);this.$pie.removeAttr("style"),this.$pie.$right.removeAttr("style"),this.$pie.$left.removeAttr("style"),t<=50?this.$pie.$right.css("transform","rotate("+e+"deg)"):(this.$pie.css("clip","rect(auto, auto, auto, auto)"),this.$pie.$right.css("transform","rotate(180deg)"),this.$pie.$left.css("transform","rotate("+e+"deg)"))}};var i=t.fn.circularProgress;function n(t){return parseInt(t/100*360)}t.fn.circularProgress=function(i){return this.filter(":input").each((function(){var n=t(this),r=n.data("pg.circularProgress"),o="object"==typeof i&&i;r||n.data("pg.circularProgress",r=new e(this,o)),"string"==typeof i?r[i]():o.hasOwnProperty("value")&&r.value(o.value)}))},t.fn.circularProgress.Constructor=e,t.fn.circularProgress.defaults={value:0},t.fn.circularProgress.noConflict=function(){return t.fn.circularProgress=i,this},t(window).on("load",(function(){t('[data-pages-progress="circle"]').each((function(){var e=t(this);e.circularProgress(e.data())}))}))}(window.jQuery),function(t){"use strict";var e=function(e,i){var n=this;function r(){if(n.notification.addClass("pgn-simple"),n.alert.append(n.options.message),n.options.showClose){var e=t('').append('').append('Close');n.alert.prepend(e)}}function o(){var t=n.container.position(),e=n.container.height(),i=n.container.width(),r=t.top,o=n.container.parent().height()-(r+e),a=t.left,s=n.container.parent().width()-(a+i);/top/.test(n.options.position)&&n.wrapper.css("top",r),/bottom/.test(n.options.position)&&n.wrapper.css("bottom",o),/left/.test(n.options.position)&&n.wrapper.css("left",a),/right/.test(n.options.position)&&n.wrapper.css("right",s)}return n.container=t(e),n.notification=t('
      '),n.options=t.extend(!0,{},t.fn.pgNotification.defaults,i),n.container.find(".pgn-wrapper[data-position="+this.options.position+"]").length?n.wrapper=t(".pgn-wrapper[data-position="+this.options.position+"]"):(n.wrapper=t('
      '),n.container.append(n.wrapper)),n.alert=t('
      '),n.alert.addClass("alert-"+n.options.type),"bar"==n.options.style?new function(){n.notification.addClass("pgn-bar"),n.alert.addClass("alert-"+n.options.type);var e=t('
      ');if(e.append(""+n.options.message+""),n.options.showClose){var i=t('').append('').append('Close');e.append(i)}n.alert.append(e)}:"flip"==n.options.style?new function(){if(n.notification.addClass("pgn-flip"),n.alert.append(""+n.options.message+""),n.options.showClose){var e=t('').append('').append('Close');n.alert.prepend(e)}}:"circle"==n.options.style?new function(){n.notification.addClass("pgn-circle");var t="
      ";n.options.thumbnail&&(t+='
      '+n.options.thumbnail+"
      ");t+='
      ',n.options.title&&(t+='

      '+n.options.title+"

      ");t+="

      "+n.options.message+"

      ",t+="
      ",n.options.showClose&&(t+='");n.alert.append(t),n.alert.after('
      ')}:(n.options.style,new r),n.notification.append(n.alert),t("body").hasClass("horizontal-menu")&&(o(),t(window).on("resize",o)),n.alert.on("closed.bs.alert",(function(){n.notification.remove(),n.options.onClosed()})),this};e.VERSION="1.0.0",e.prototype.show=function(){if(this.wrapper.prepend(this.notification),this.options.onShown(),0!=this.options.timeout){var e=this;setTimeout(function(){this.notification.fadeOut("slow",(function(){t(this).remove(),e.options.onClosed()}))}.bind(this),this.options.timeout)}},t.fn.pgNotification=function(t){return new e(this,t)},t.fn.pgNotification.defaults={style:"simple",message:null,position:"top-right",type:"info",showClose:!0,timeout:4e3,onShown:function(){},onClosed:function(){}}}(window.jQuery),function(t){"use strict";var e=function(e,i){this.$element=t(e),this.options=t.extend(!0,{},t.fn.card.defaults,i),this.$loader=null,this.$body=this.$element.find(".card-block")};e.VERSION="1.0.0",e.prototype.collapse=function(){var e=this.$element.find(".collapse-icon");this.$element.find(".card-header");if(this.$body.stop().slideToggle("fast"),this.$element.hasClass("card-collapsed"))return this.$element.removeClass("card-collapsed"),e.removeClass().addClass("fa-chevron-down"),void(t.isFunction(this.options.onExpand)&&this.options.onExpand(this));this.$element.addClass("card-collapsed"),e.removeClass().addClass("fa-chevron-right"),t.isFunction(this.options.onCollapse)&&this.options.onCollapse(this)},e.prototype.close=function(){this.$element.remove(),t.isFunction(this.options.onClose)&&this.options.onClose(this)},e.prototype.error=function(t){if(t){var e=this;this.$element.pgNotification({style:"bar",message:t,position:"top",timeout:0,type:"danger",onShown:function(){e.$loader.find("> div").fadeOut()},onClosed:function(){e.refresh(!1)}}).show()}};var i=t.fn.card;t.fn.card=function(i){return this.each((function(){var n=t(this),r=n.data("pg.card"),o="object"==typeof i&&i;r||n.data("pg.card",r=new e(this,o)),"string"==typeof i?r[i]():o.hasOwnProperty("refresh")?r.refresh(o.refresh):o.hasOwnProperty("error")&&r.error(o.error)}))},t.fn.card.Constructor=e,t.fn.card.defaults={progress:"circle",progressColor:"master",refresh:!1,error:null,overlayColor:"255,255,255",overlayOpacity:.8,refreshButton:'[data-toggle="refresh"]',maximizeButton:'[data-toggle="maximize"]',collapseButton:'[data-toggle="collapse"]',closeButton:'[data-toggle="close"]'},t.fn.card.noConflict=function(){return t.fn.card=i,this}}(window.jQuery),function(t){"use strict";var e=function(e,i){var n=this;return n.options=t.extend(!0,{},t.fn.pgMobileViews.defaults,i),n.element=t(e),n.element.on("click",(function(e){e.preventDefault();var i=n.element.data(),r=t(i.viewPort),o=i.toggleView;return null!=i.toggleView?(r.children().last().children(".view").hide(),t(i.toggleView).show()):o=r.last(),r.toggleClass(i.viewAnimation),n.options.onNavigate(o,i.viewAnimation),!1})),this};t.fn.pgMobileViews=function(t){return new e(this,t)},t.fn.pgMobileViews.defaults={onNavigate:function(t,e){}},t(window).on("load",(function(){t('[data-navigate="view"]').each((function(){t(this).pgMobileViews()}))}))}(window.jQuery),function(t){"use strict";var e=function(e,i){this.$element=t(e),this.options=t.extend(!0,{},t.fn.quickview.defaults,i),this.bezierEasing=[.05,.74,.27,.99];var n=this;t(this.options.notes).on("click",".list > ul > li",(function(e){var i=t(this).find(".note-preview");i=t(this).find(".note-preview");t(n.options.noteEditor).html(i.html()),t(n.options.notes).toggleClass("push")})),t(this.options.notes).on("click",".list > ul > li .checkbox",(function(t){t.stopPropagation()})),t(this.options.notes).on("click",n.options.backButton,(function(e){t(n.options.notes).find(".toolbar > li > a").removeClass("active"),t(n.options.notes).toggleClass("push")})),t(this.options.deleteNoteButton).click((function(e){e.preventDefault(),t(this).toggleClass("selected"),t(n.options.notes).find(".list > ul > li .checkbox").fadeToggle("fast"),t(n.options.deleteNoteConfirmButton).fadeToggle("fast").removeClass("hide")})),t(this.options.newNoteButton).click((function(e){e.preventDefault(),t(n.options.noteEditor).html("")})),t(this.options.deleteNoteConfirmButton).click((function(){t(n.options.notes).find("input[type=checkbox]:checked").each((function(){t(this).parents("li").remove()}))})),t(this.options.notes).on("click",".toolbar > li > a",(function(e){var i=t(this).attr("data-action");document.execCommand(i,!1,null),t(this).toggleClass("active")}))};e.VERSION="1.0.0";var i=t.fn.quickview;t.fn.quickview=function(i){return this.each((function(){var n=t(this),r=n.data("pg.quickview"),o="object"==typeof i&&i;r||n.data("pg.quickview",r=new e(this,o)),"string"==typeof i&&r[i]()}))},t.fn.quickview.Constructor=e,t.fn.quickview.defaults={notes:"#note-views",alerts:"#alerts",chat:"#chat",notesList:".list",noteEditor:".quick-note-editor",deleteNoteButton:".delete-note-link",deleteNoteConfirmButton:".btn-remove-notes",newNoteButton:".new-note-link",backButton:".close-note-link"},t.fn.quickview.noConflict=function(){return t.fn.quickview=i,this},t(window).on("load",(function(){t('[data-pages="quickview"]').each((function(){var e=t(this);e.quickview(e.data())}))})),t(document).on("click.pg.quickview.data-api touchstart",'[data-toggle="quickview"]',(function(e){var i=t(this).attr("data-toggle-element");t(i).toggleClass("open"),e.preventDefault()}))}(window.jQuery),function(t){"use strict";var e=function(e,i){if(this.$element=t(e),this.$body=t("body"),this.options=t.extend(!0,{},t.fn.sidebar.defaults,i),this.bezierEasing=[.05,.74,.27,.99],this.cssAnimation=!0,this.css3d=!0,this.sideBarWidth=this.$element.width(),this.sideBarWidthCondensed=-this.$element.offset().left,this.$sidebarMenu=this.$element.find(".sidebar-menu > ul"),this.$pageContainer=t(this.options.pageContainer),this.$sidebarMenu.length){"desktop"==t.Pages.getUserAgent()&&this.$sidebarMenu.scrollbar({ignoreOverlay:!1,disableBodyScroll:1==this.$element.data("disableBodyScroll")}),Modernizr.csstransitions||(this.cssAnimation=!1),Modernizr.csstransforms3d||(this.css3d=!1),"undefined"==typeof angular&&t(document).on("click",".sidebar-menu a",(function(e){if(!1!==t(this).parent().children(".sub-menu")){var i=t(this),n=t(this).parent().parent(),r=t(this).parent(),o=t(this).parent().children(".sub-menu");r.hasClass("open active")?(i.children(".arrow").removeClass("open active"),o.slideUp(200,(function(){r.removeClass("open active")}))):(n.children("li.open").children(".sub-menu").slideUp(200),n.children("li.open").children("a").children(".arrow").removeClass("open active"),n.children("li.open").removeClass("open active"),i.children(".arrow").addClass("open active"),o.slideDown(200,(function(){r.addClass("open active")})))}})),t(".sidebar-slide-toggle").on("click touchend",(function(e){e.preventDefault(),t(this).toggleClass("active");var i=t(this).attr("data-pages-toggle");null!=i&&t(i).toggleClass("show")}));var n=this;this.$element.bind("mouseenter mouseleave",(function(e){var i=1==this.css3d?"translate3d("+n.sideBarWidthCondensed+"px, 0,0)":"translate("+n.sideBarWidthCondensed+"px, 0)";if(t.Pages.isVisibleSm()||t.Pages.isVisibleXs())return!1;t(".close-sidebar").data("clicked")||n.$body.hasClass("menu-pin")||(n.$element.css({transform:i}),n.$body.addClass("sidebar-visible"))})),this.$pageContainer.bind("mouseover",(function(e){var i=1==n.css3d?"translate3d(0, 0,0)":"translate(0, 0)";if(t.Pages.isVisibleSm()||t.Pages.isVisibleXs())return!1;if(void 0!==e&&t(e.target).parent(".page-sidebar").length)return;n.$body.hasClass("menu-pin")||(t(".sidebar-overlay-slide").hasClass("show")&&(t(".sidebar-overlay-slide").removeClass("show"),t("[data-pages-toggle]").removeClass("active")),n.$element.css({transform:i}),n.$body.removeClass("sidebar-visible"))})),t(document).bind("ready",r),t(window).bind("resize",r)}function r(){t(window).width()<1200?t("body").hasClass("menu-pin")&&(t("body").removeClass("menu-pin"),t("body").addClass("menu-unpinned")):t("body").hasClass("menu-unpinned")&&t("body").addClass("menu-pin")}};e.prototype.toggleSidebar=function(e){var i,n=t("body").css("background-color");t(".page-container").css("background-color",n),this.$body.hasClass("sidebar-open")?(this.$body.removeClass("sidebar-open"),i=setTimeout(function(){this.$element.removeClass("visible")}.bind(this),400)):(clearTimeout(i),this.$element.addClass("visible"),setTimeout(function(){this.$body.addClass("sidebar-open")}.bind(this),10),setTimeout((function(){t(".page-container").css({"background-color":""})}),1e3))},e.prototype.togglePinSidebar=function(t){"hide"==t?this.$body.removeClass("menu-pin"):"show"==t?this.$body.addClass("menu-pin"):this.$body.toggleClass("menu-pin")};var i=t.fn.sidebar;t.fn.sidebar=function(i){return this.each((function(){var n=t(this),r=n.data("pg.sidebar"),o="object"==typeof i&&i;r||n.data("pg.sidebar",r=new e(this,o)),"string"==typeof i&&r[i]()}))},t.fn.sidebar.Constructor=e,t.fn.sidebar.defaults={pageContainer:".page-container"},t.fn.sidebar.noConflict=function(){return t.fn.sidebar=i,this},t(document).on("click.pg.sidebar.data-api",'[data-toggle-pin="sidebar"]',(function(e){t(this);return t('[data-pages="sidebar"]').data("pg.sidebar").togglePinSidebar(),!1})),t(document).on("click.pg.sidebar.data-api touchstart",'[data-toggle="sidebar"]',(function(e){t(this);return t('[data-pages="sidebar"]').data("pg.sidebar").toggleSidebar(),!1}))}(window.jQuery),function(t){"use strict";"undefined"==typeof angular&&t.Pages.init()}(window.jQuery),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE={})}(this,(function(t){function e(){}function i(t,e){this.x=t||0,this.y=e||0}function n(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0e&&(e=t[i]);return e}function B(){Object.defineProperty(this,"id",{value:Qr+=2}),this.uuid=Vr.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function F(t,e,i,n,r,o){M.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new z(t,e,i,n,r,o)),this.mergeVertices()}function z(t,e,i,n,r,a){function s(t,e,i,n,r,a,s,m,g,v,y){var x=a/g,b=s/v,w=a/2,_=s/2,E=m/2;s=g+1;var M,T,S=v+1,A=a=0,R=new o;for(T=0;Tl;l++)(u=n[l])&&(s=u[0],c=u[1])?(h&&r.addAttribute("morphTarget"+l,h[s]),o&&r.addAttribute("morphNormal"+l,o[s]),i[l]=c):i[l]=0;a.getUniforms().setValue(t,"morphTargetInfluences",i)}}}function ot(t,e){var i={};return{update:function(n){var r=e.render.frame,o=n.geometry,a=t.get(n,o);return i[a.id]!==r&&(o.isGeometry&&a.updateFromObject(n),t.update(a),i[a.id]=r),a},dispose:function(){i={}}}}function at(t,e,i,n,r,o,a,c,l,h){t=void 0!==t?t:[],s.call(this,t,void 0!==e?e:301,i,n,r,o,a,c,l,h),this.flipY=!1}function st(t,e,i){var n=t[0];if(0>=n||0/gm,(function(t,e){if(void 0===(t=Wr[e]))throw Error("Can not resolve #include <"+e+">");return jt(t)}))}function Wt(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,(function(t,e,i,n){for(t="",e=parseInt(e);e 0 ) {\n\t\tfloat fogFactor = 0.0;\n\t\tif ( fogType == 1 ) {\n\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t\t} else {\n\t\t\tconst float LOG2 = 1.442695;\n\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );\n\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\t\t}\n\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\t}\n}"].join("\n")),e.compileShader(D),e.compileShader(U),e.attachShader(N,D),e.attachShader(N,U),e.linkProgram(N),R=N,E=e.getAttribLocation(R,"position"),M=e.getAttribLocation(R,"uv"),s=e.getUniformLocation(R,"uvOffset"),c=e.getUniformLocation(R,"uvScale"),l=e.getUniformLocation(R,"rotation"),h=e.getUniformLocation(R,"center"),u=e.getUniformLocation(R,"scale"),d=e.getUniformLocation(R,"color"),p=e.getUniformLocation(R,"map"),f=e.getUniformLocation(R,"opacity"),m=e.getUniformLocation(R,"modelViewMatrix"),g=e.getUniformLocation(R,"projectionMatrix"),v=e.getUniformLocation(R,"fogType"),y=e.getUniformLocation(R,"fogDensity"),x=e.getUniformLocation(R,"fogNear"),b=e.getUniformLocation(R,"fogFar"),w=e.getUniformLocation(R,"fogColor"),e.getUniformLocation(R,"fogDepth"),_=e.getUniformLocation(R,"alphaTest"),(N=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=8,N.height=8,(D=N.getContext("2d")).fillStyle="white",D.fillRect(0,0,8,8),C=new ae(N)}i.useProgram(R),i.initAttributes(),i.enableAttribute(E),i.enableAttribute(M),i.disableUnusedAttributes(),i.disable(e.CULL_FACE),i.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,S),e.vertexAttribPointer(E,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(M,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A),e.uniformMatrix4fv(g,!1,I.projectionMatrix.elements),i.activeTexture(e.TEXTURE0),e.uniform1i(p,0),D=N=0,(U=o.fog)?(e.uniform3f(w,U.color.r,U.color.g,U.color.b),U.isFog?(e.uniform1f(x,U.near),e.uniform1f(b,U.far),e.uniform1i(v,1),D=N=1):U.isFogExp2&&(e.uniform1f(y,U.density),e.uniform1i(v,2),D=N=2)):(e.uniform1i(v,0),D=N=0),U=0;for(var B=r.length;Ue||t.height>e){if("data"in t)return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+t.width+"x"+t.height+").");e/=Math.max(t.width,t.height);var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(t.width*e),i.height=Math.floor(t.height*e),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function c(t){return Vr.isPowerOfTwo(t.width)&&Vr.isPowerOfTwo(t.height)}function l(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function h(e,i,r,o){t.generateMipmap(e),n.get(i).__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function u(e){return 1003===e||1004===e||1005===e?t.NEAREST:t.LINEAR}function d(e){(e=e.target).removeEventListener("dispose",d);t:{var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)break t;t.deleteTexture(i.__webglTexture)}n.remove(e)}e.isVideoTexture&&delete b[e.id],a.memory.textures--}function p(e){(e=e.target).removeEventListener("dispose",p);var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(r=0;6>r;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}a.memory.textures--}function f(e,u){var p=n.get(e);if(e.isVideoTexture){var f=e.id,g=a.render.frame;b[f]!==g&&(b[f]=g,e.update())}if(0v;v++)g[v]=u||f?f?e.image[v].image:e.image[v]:s(e.image[v],r.maxCubemapSize);var y=g[0],x=c(y),b=o.convert(e.format),w=o.convert(e.type);for(m(t.TEXTURE_CUBE_MAP,e,x),v=0;6>v;v++)if(u)for(var _,E=g[v].mipmaps,M=0,T=E.length;Md;d++)r.__webglFramebuffer[d]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){for(i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),m(t.TEXTURE_CUBE_MAP,e.texture,u),d=0;6>d;d++)g(r.__webglFramebuffer[d],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+d);l(e.texture,u)&&h(t.TEXTURE_CUBE_MAP,e.texture,e.width,e.height),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,o.__webglTexture),m(t.TEXTURE_2D,e.texture,u),g(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),l(e.texture,u)&&h(t.TEXTURE_2D,e.texture,e.width,e.height),i.bindTexture(t.TEXTURE_2D,null);if(e.depthBuffer){if(r=n.get(e),o=!0===e.isWebGLRenderTargetCube,e.depthTexture){if(o)throw Error("target.depthTexture not supported in Cube render targets");if(e&&e.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),!e.depthTexture||!e.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(n.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),f(e.depthTexture,0),r=n.get(e.depthTexture).__webglTexture,1026===e.depthTexture.format)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(1027!==e.depthTexture.format)throw Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}else if(o)for(r.__webglDepthbuffer=[],o=0;6>o;o++)t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[o]),r.__webglDepthbuffer[o]=t.createRenderbuffer(),v(r.__webglDepthbuffer[o],e);else t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),v(r.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(e){var r=e.texture,o=c(e);if(l(r,o)){o=e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D;var a=n.get(r).__webglTexture;i.bindTexture(o,a),h(o,r,e.width,e.height),i.bindTexture(o,null)}}}function he(t,e){return{convert:function(i){if(1e3===i)return t.REPEAT;if(1001===i)return t.CLAMP_TO_EDGE;if(1002===i)return t.MIRRORED_REPEAT;if(1003===i)return t.NEAREST;if(1004===i)return t.NEAREST_MIPMAP_NEAREST;if(1005===i)return t.NEAREST_MIPMAP_LINEAR;if(1006===i)return t.LINEAR;if(1007===i)return t.LINEAR_MIPMAP_NEAREST;if(1008===i)return t.LINEAR_MIPMAP_LINEAR;if(1009===i)return t.UNSIGNED_BYTE;if(1017===i)return t.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return t.UNSIGNED_SHORT_5_5_5_1;if(1019===i)return t.UNSIGNED_SHORT_5_6_5;if(1010===i)return t.BYTE;if(1011===i)return t.SHORT;if(1012===i)return t.UNSIGNED_SHORT;if(1013===i)return t.INT;if(1014===i)return t.UNSIGNED_INT;if(1015===i)return t.FLOAT;if(1016===i){var n=e.get("OES_texture_half_float");if(null!==n)return n.HALF_FLOAT_OES}if(1021===i)return t.ALPHA;if(1022===i)return t.RGB;if(1023===i)return t.RGBA;if(1024===i)return t.LUMINANCE;if(1025===i)return t.LUMINANCE_ALPHA;if(1026===i)return t.DEPTH_COMPONENT;if(1027===i)return t.DEPTH_STENCIL;if(100===i)return t.FUNC_ADD;if(101===i)return t.FUNC_SUBTRACT;if(102===i)return t.FUNC_REVERSE_SUBTRACT;if(200===i)return t.ZERO;if(201===i)return t.ONE;if(202===i)return t.SRC_COLOR;if(203===i)return t.ONE_MINUS_SRC_COLOR;if(204===i)return t.SRC_ALPHA;if(205===i)return t.ONE_MINUS_SRC_ALPHA;if(206===i)return t.DST_ALPHA;if(207===i)return t.ONE_MINUS_DST_ALPHA;if(208===i)return t.DST_COLOR;if(209===i)return t.ONE_MINUS_DST_COLOR;if(210===i)return t.SRC_ALPHA_SATURATE;if((33776===i||33777===i||33778===i||33779===i)&&null!==(n=e.get("WEBGL_compressed_texture_s3tc"))){if(33776===i)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((35840===i||35841===i||35842===i||35843===i)&&null!==(n=e.get("WEBGL_compressed_texture_pvrtc"))){if(35840===i)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i&&null!==(n=e.get("WEBGL_compressed_texture_etc1")))return n.COMPRESSED_RGB_ETC1_WEBGL;if((37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i)&&null!==(n=e.get("WEBGL_compressed_texture_astc")))return i;if((103===i||104===i)&&null!==(n=e.get("EXT_blend_minmax"))){if(103===i)return n.MIN_EXT;if(104===i)return n.MAX_EXT}return 1020===i&&null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:0}}}function ue(t,e,i,n){w.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function de(t){ue.call(this),this.cameras=t||[]}function pe(t){function e(){if(null!==a&&!0===a.isPresenting){var e=a.getEyeParameters("left"),n=e.renderWidth;e=e.renderHeight,y=t.getPixelRatio(),v=t.getSize(),t.setDrawingBufferSize(2*n,e,1)}else i.enabled&&t.setDrawingBufferSize(v.width,v.height,y)}var i=this,a=null,s=null,l=null,h=new n,u=new n;"undefined"!=typeof window&&"VRFrameData"in window&&(s=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var d=new n,p=new r,f=new o,m=new ue;m.bounds=new c(0,0,.5,1),m.layers.enable(1);var g=new ue;g.bounds=new c(.5,0,.5,1),g.layers.enable(2);var v,y,x=new de([m,g]);x.layers.enable(1),x.layers.enable(2),this.enabled=!1,this.userHeight=1.6,this.getDevice=function(){return a},this.setDevice=function(t){void 0!==t&&(a=t)},this.setPoseTarget=function(t){void 0!==t&&(l=t)},this.getCamera=function(t){if(null===a)return t;a.depthNear=t.near,a.depthFar=t.far,a.getFrameData(s);var e=a.stageParameters;e?h.fromArray(e.sittingToStandingTransform):h.makeTranslation(0,i.userHeight,0),e=s.pose;var n=null!==l?l:t;return n.matrix.copy(h),n.matrix.decompose(n.position,n.quaternion,n.scale),null!==e.orientation&&(p.fromArray(e.orientation),n.quaternion.multiply(p)),null!==e.position&&(p.setFromRotationMatrix(h),f.fromArray(e.position),f.applyQuaternion(p),n.position.add(f)),n.updateMatrixWorld(),!1===a.isPresenting?t:(m.near=t.near,g.near=t.near,m.far=t.far,g.far=t.far,x.matrixWorld.copy(t.matrixWorld),x.matrixWorldInverse.copy(t.matrixWorldInverse),m.matrixWorldInverse.fromArray(s.leftViewMatrix),g.matrixWorldInverse.fromArray(s.rightViewMatrix),u.getInverse(h),m.matrixWorldInverse.multiply(u),g.matrixWorldInverse.multiply(u),null!==(t=n.parent)&&(d.getInverse(t.matrixWorld),m.matrixWorldInverse.multiply(d),g.matrixWorldInverse.multiply(d)),m.matrixWorld.getInverse(m.matrixWorldInverse),g.matrixWorld.getInverse(g.matrixWorldInverse),m.projectionMatrix.fromArray(s.leftProjectionMatrix),g.projectionMatrix.fromArray(s.rightProjectionMatrix),x.projectionMatrix.copy(m.projectionMatrix),(t=a.getLayers()).length&&(null!==(t=t[0]).leftBounds&&4===t.leftBounds.length&&m.bounds.fromArray(t.leftBounds),null!==t.rightBounds&&4===t.rightBounds.length&&g.bounds.fromArray(t.rightBounds)),x)},this.getStandingMatrix=function(){return h},this.submitFrame=function(){null!==a&&!0===a.isPresenting&&a.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function fe(t){function e(){(P=new K(Ct)).get("WEBGL_depth_texture"),P.get("OES_texture_float"),P.get("OES_texture_float_linear"),P.get("OES_texture_half_float"),P.get("OES_texture_half_float_linear"),P.get("OES_standard_derivatives"),P.get("OES_element_index_uint"),P.get("ANGLE_instanced_arrays"),Y=new he(Ct,P),O=new $(Ct,P,t),(I=new ce(Ct,P,Y)).scissor(ft.copy(wt).multiplyScalar(xt)),I.viewport(pt.copy(bt).multiplyScalar(xt)),N=new it(Ct),D=new Yt,U=new le(Ct,P,I,D,O,Y,N),B=new v(Ct),F=new tt(Ct,B,N),z=new ot(F,N),j=new rt(Ct),H=new Xt(nt,P,O),G=new Qt,k=new ie,V=new Z(nt,I,F,S),W=new J(Ct,P,N),q=new et(Ct,P,N),X=new se(nt,Ct,I,U,O),N.programs=H.programs,nt.context=Ct,nt.capabilities=O,nt.extensions=P,nt.properties=D,nt.renderLists=G,nt.state=I,nt.info=N}function i(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),at=!0}function r(){console.log("THREE.WebGLRenderer: Context Restored."),at=!1,e()}function a(t){(t=t.target).removeEventListener("dispose",a),s(t),D.remove(t)}function s(t){var e=D.get(t).program;t.program=void 0,void 0!==e&&H.releaseProgram(e)}function l(){var t=Lt.getDevice();t&&t.isPresenting?t.requestAnimationFrame(h):window.requestAnimationFrame(h)}function h(t){!1!==Ot&&(It(t),l())}function d(t,e,i,n){for(var r=0,o=t.length;rt.matrixWorld.determinant();I.setMaterial(r,a),a=g(i,e.fog,r,t),ht="",function(t,e,i){t.render((function(t){nt.renderBufferImmediate(t,e,i)}))}(t,a,r)}else nt.renderBufferDirect(i,e.fog,n,r,t,o);t.onAfterRender(nt,e,i,n,r,o),L=k.get(e,dt||i)}function f(t,e,i){var n=D.get(t),r=L.state.lights;i=H.getParameters(t,r.state,L.state.shadowsArray,e,Mt.numPlanes,Mt.numIntersection,i);var o=H.getProgramCode(t,i),c=n.program,l=!0;if(void 0===c)t.addEventListener("dispose",a);else if(c.code!==o)s(t);else{if(n.lightsHash!==r.state.hash)D.update(t,"lightsHash",r.state.hash);else if(void 0!==i.shaderID)return;l=!1}if(l&&(i.shaderID?(c=Zr[i.shaderID],n.shader={name:t.type,uniforms:qr.clone(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}):n.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader},t.onBeforeCompile(n.shader,nt),c=H.acquireProgram(t,n.shader,i,o),n.program=c,t.program=c),i=c.getAttributes(),t.morphTargets)for(o=t.numSupportedMorphTargets=0;or.matrixWorld.determinant();I.setMaterial(n,a);var s=g(t,e,n,r),c=!1;(t=i.id+"_"+s.id+"_"+(!0===n.wireframe))!==ht&&(ht=t,c=!0),r.morphTargetInfluences&&(j.update(r,i,n,s),c=!0),a=i.index;var l=i.attributes.position;if(e=1,!0===n.wireframe&&(a=F.getWireframeAttribute(i),e=2),t=W,null!==a){var h=B.get(a);(t=q).setIndex(h)}if(c){if(i&&i.isInstancedBufferGeometry&&null===P.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{I.initAttributes(),c=i.attributes,s=s.getAttributes();var u=n.defaultAttributeValues;for(_ in s){var d=s[_];if(0<=d){var p=c[_];if(void 0!==p){var f=p.normalized,m=p.itemSize,v=B.get(p);if(void 0!==v){var y=v.buffer,x=v.type;if(v=v.bytesPerElement,p.isInterleavedBufferAttribute){var b=p.data,w=b.stride;p=p.offset,b&&b.isInstancedInterleavedBuffer?(I.enableAttributeAndDivisor(d,b.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=b.meshPerAttribute*b.count)):I.enableAttribute(d),Ct.bindBuffer(Ct.ARRAY_BUFFER,y),Ct.vertexAttribPointer(d,m,x,f,w*v,p*v)}else p.isInstancedBufferAttribute?(I.enableAttributeAndDivisor(d,p.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=p.meshPerAttribute*p.count)):I.enableAttribute(d),Ct.bindBuffer(Ct.ARRAY_BUFFER,y),Ct.vertexAttribPointer(d,m,x,f,0,0)}}else if(void 0!==u&&void 0!==(f=u[_]))switch(f.length){case 2:Ct.vertexAttrib2fv(d,f);break;case 3:Ct.vertexAttrib3fv(d,f);break;case 4:Ct.vertexAttrib4fv(d,f);break;default:Ct.vertexAttrib1fv(d,f)}}}I.disableUnusedAttributes()}null!==a&&Ct.bindBuffer(Ct.ELEMENT_ARRAY_BUFFER,h.buffer)}h=1/0,null!==a?h=a.count:void 0!==l&&(h=l.count),a=i.drawRange.start*e,l=null!==o?o.start*e:0;var _=Math.max(a,l);if(0!==(o=Math.max(0,Math.min(h,a+i.drawRange.count*e,l+(null!==o?o.count*e:1/0))-1-_+1))){if(r.isMesh)if(!0===n.wireframe)I.setLineWidth(n.wireframeLinewidth*(null===st?xt:1)),t.setMode(Ct.LINES);else switch(r.drawMode){case 0:t.setMode(Ct.TRIANGLES);break;case 1:t.setMode(Ct.TRIANGLE_STRIP);break;case 2:t.setMode(Ct.TRIANGLE_FAN)}else r.isLine?(void 0===(n=n.linewidth)&&(n=1),I.setLineWidth(n*(null===st?xt:1)),r.isLineSegments?t.setMode(Ct.LINES):r.isLineLoop?t.setMode(Ct.LINE_LOOP):t.setMode(Ct.LINE_STRIP)):r.isPoints&&t.setMode(Ct.POINTS);i&&i.isInstancedBufferGeometry?0=O.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+O.maxTextures),gt+=1,t},this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),U.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),U.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?U.setTextureCube(e,i):U.setTextureCubeDynamic(e,i)}}(),this.getRenderTarget=function(){return st},this.setRenderTarget=function(t){(st=t)&&void 0===D.get(t).__webglFramebuffer&&U.setupRenderTarget(t);var e=null,i=!1;t?(e=D.get(t).__webglFramebuffer,t.isWebGLRenderTargetCube&&(e=e[t.activeCubeFace],i=!0),pt.copy(t.viewport),ft.copy(t.scissor),mt=t.scissorTest):(pt.copy(bt).multiplyScalar(xt),ft.copy(wt).multiplyScalar(xt),mt=_t),ct!==e&&(Ct.bindFramebuffer(Ct.FRAMEBUFFER,e),ct=e),I.viewport(pt),I.scissor(ft),I.setScissorTest(mt),i&&(i=D.get(t.texture),Ct.framebufferTexture2D(Ct.FRAMEBUFFER,Ct.COLOR_ATTACHMENT0,Ct.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,i,n,r,o){if(t&&t.isWebGLRenderTarget){var a=D.get(t).__webglFramebuffer;if(a){var s=!1;a!==ct&&(Ct.bindFramebuffer(Ct.FRAMEBUFFER,a),s=!0);try{var c=t.texture,l=c.format,h=c.type;1023!==l&&Y.convert(l)!==Ct.getParameter(Ct.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===h||Y.convert(h)===Ct.getParameter(Ct.IMPLEMENTATION_COLOR_READ_TYPE)||1015===h&&(P.get("OES_texture_float")||P.get("WEBGL_color_buffer_float"))||1016===h&&P.get("EXT_color_buffer_half_float")?Ct.checkFramebufferStatus(Ct.FRAMEBUFFER)===Ct.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=i&&i<=t.height-r&&Ct.readPixels(e,i,n,r,Y.convert(l),Y.convert(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{s&&Ct.bindFramebuffer(Ct.FRAMEBUFFER,ct)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,i){var n=e.image.width,r=e.image.height,o=Y.convert(e.format);this.setTexture2D(e,0),Ct.copyTexImage2D(Ct.TEXTURE_2D,i||0,o,t.x,t.y,n,r,0)},this.copyTextureToTexture=function(t,e,i,n){var r=e.image.width,o=e.image.height,a=Y.convert(i.format),s=Y.convert(i.type);e=e.isDataTexture?e.image.data:e.image,this.setTexture2D(i,0),Ct.texSubImage2D(Ct.TEXTURE_2D,n||0,t.x,t.y,r,o,a,s,e)}}function me(t,e){this.name="",this.color=new g(t),this.density=void 0!==e?e:25e-5}function ge(t,e,i){this.name="",this.color=new g(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function ve(){b.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function ye(t){k.call(this),this.type="SpriteMaterial",this.color=new g(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(t)}function xe(t){b.call(this),this.type="Sprite",this.material=void 0!==t?t:new ye,this.center=new i(.5,.5)}function be(){b.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function we(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],t=0,e=this.bones.length;te;e++){var d=u[c[e]],p=u[c[(e+1)%3]];a[0]=Math.min(d,p),a[1]=Math.max(d,p),void 0===s[d=a[0]+","+a[1]]&&(s[d]={index1:a[0],index2:a[1]})}}for(d in s)h=s[d],c=t.vertices[h.index1],r.push(c.x,c.y,c.z),c=t.vertices[h.index2],r.push(c.x,c.y,c.z)}else if(t&&t.isBufferGeometry)if(c=new o,null!==t.index){l=t.attributes.position,u=t.index;var f=t.groups;for(0===f.length&&(f=[{start:0,count:u.count,materialIndex:0}]),t=0,n=f.length;te;e++)d=u.getX(h+e),p=u.getX(h+(e+1)%3),a[0]=Math.min(d,p),a[1]=Math.max(d,p),void 0===s[d=a[0]+","+a[1]]&&(s[d]={index1:a[0],index2:a[1]});for(d in s)h=s[d],c.fromBufferAttribute(l,h.index1),r.push(c.x,c.y,c.z),c.fromBufferAttribute(l,h.index2),r.push(c.x,c.y,c.z)}else for(h=0,i=(l=t.attributes.position).count/3;he;e++)s=3*h+e,c.fromBufferAttribute(l,s),r.push(c.x,c.y,c.z),s=3*h+(e+1)%3,c.fromBufferAttribute(l,s),r.push(c.x,c.y,c.z);this.addAttribute("position",new I(r,3))}function De(t,e,i){M.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new Ue(t,e,i)),this.mergeVertices()}function Ue(t,e,i){B.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};var n,r,a=[],s=[],c=[],l=[],h=new o,u=new o,d=new o,p=new o,f=new o,m=e+1;for(n=0;n<=i;n++){var g=n/i;for(r=0;r<=e;r++){var v=r/e;t(v,g,u),s.push(u.x,u.y,u.z),0<=v-1e-5?(t(v-1e-5,g,d),p.subVectors(u,d)):(t(v+1e-5,g,d),p.subVectors(d,u)),0<=g-1e-5?(t(v,g-1e-5,d),f.subVectors(u,d)):(t(v,g+1e-5,d),f.subVectors(d,u)),h.crossVectors(p,f).normalize(),c.push(h.x,h.y,h.z),l.push(v,g)}}for(n=0;nn&&1===t.x&&(h[e]=t.x-1),0===i.x&&0===i.z&&(h[e]=n/2/Math.PI+.5)}B.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1;var l=[],h=[];!function(t){for(var i=new o,n=new o,r=new o,c=0;ca&&(.2>e&&(h[t+0]+=1),.2>n&&(h[t+2]+=1),.2>r&&(h[t+4]+=1))}(),this.addAttribute("position",new I(l,3)),this.addAttribute("normal",new I(l.slice(),3)),this.addAttribute("uv",new I(h,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function ze(t,e){M.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new He(t,e)),this.mergeVertices()}function He(t,e){Fe.call(this,[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="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ge(t,e){M.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ke(t,e)),this.mergeVertices()}function ke(t,e){Fe.call(this,[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="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ve(t,e){M.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new je(t,e)),this.mergeVertices()}function je(t,e){var i=(1+Math.sqrt(5))/2;Fe.call(this,[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,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="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function We(t,e){M.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new qe(t,e)),this.mergeVertices()}function qe(t,e){var i=(1+Math.sqrt(5))/2,n=1/i;Fe.call(this,[-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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[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="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xe(t,e,i,n,r,o){M.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed."),t=new Ye(t,e,i,n,r),this.tangents=t.tangents,this.normals=t.normals,this.binormals=t.binormals,this.fromBufferGeometry(t),this.mergeVertices()}function Ye(t,e,n,r,a){function s(i){f=t.getPointAt(i/e,f);var o=c.normals[i];for(i=c.binormals[i],h=0;h<=r;h++){var a=h/r*Math.PI*2,s=Math.sin(a);a=-Math.cos(a),d.x=a*o.x+s*i.x,d.y=a*o.y+s*i.y,d.z=a*o.z+s*i.z,d.normalize(),g.push(d.x,d.y,d.z),u.x=f.x+n*d.x,u.y=f.y+n*d.y,u.z=f.z+n*d.z,m.push(u.x,u.y,u.z)}}B.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:a},e=e||64,n=n||1,r=r||8,a=a||!1;var c=t.computeFrenetFrames(e,a);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var l,h,u=new o,d=new o,p=new i,f=new o,m=[],g=[],v=[],y=[];for(l=0;l=e;r-=n)o=ui(r,t[r],t[r+1],o);return o&&si(o,o.next)&&(di(o),o=o.next),o}function ti(t,e){if(!t)return t;e||(e=t);do{var i=!1;if(t.steiner||!si(t,t.next)&&0!==ai(t.prev,t,t.next))t=t.next;else{if(di(t),(t=e=t.prev)===t.next)break;i=!0}}while(i||t!==e);return e}function ei(t,e){return t.x-e.x}function ii(t,e){var i=e,n=t.x,r=t.y,o=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){var a=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>o){if(o=a,a===n){if(r===i.y)return i;if(r===i.next.y)return i.next}var s=i.x=i.x&&i.x>=a&&n!==i.x&&oi(rs.x)&&li(i,t)&&(s=i,l=h)}i=i.next}return s}function ni(t,e,i,n,r){return 1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1)|(1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ri(t){var e=t,i=t;do{e.xai(t.prev,t,t.next)?0<=ai(t,e,t.next)&&0<=ai(t,t.prev,e):0>ai(t,e,t.prev)||0>ai(t,t.next,e)}function hi(t,e){var i=new pi(t.i,t.x,t.y),n=new pi(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function ui(t,e,i,n){return t=new pi(t,e,i),n?(t.next=n.next,t.prev=n,n.next.prev=t,n.next=t):(t.prev=t,t.next=t),t}function di(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 pi(t,e,i){this.i=t,this.x=e,this.y=i,this.nextZ=this.prevZ=this.z=this.next=this.prev=null,this.steiner=!1}function fi(t){var e=t.length;2Number.EPSILON){var l=Math.sqrt(c),h=Math.sqrt(a*a+s*s);if(c=e.x-o/l,e=e.y+r/l,2>=(o=(a=c+r*(s=((n.x-s/h-c)*s-(n.y+a/h-e)*a)/(r*s-o*a))-t.x)*a+(r=e+o*s-t.y)*r))return new i(a,r);o=Math.sqrt(o/2)}else t=!1,r>Number.EPSILON?a>Number.EPSILON&&(t=!0):r<-Number.EPSILON?a<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(s)&&(t=!0),t?(a=-o,o=Math.sqrt(c)):(a=r,r=o,o=Math.sqrt(c/2));return new i(a/o,r/o)}function l(t,e){for(H=t.length;0<=--H;){var i=H,n=H-1;0>n&&(n=t.length-1);var o,s=v+2*_;for(o=0;oh;h++){var u=l[o[h]],d=l[o[(h+1)%3]];n[0]=Math.min(u,d),n[1]=Math.max(u,d),void 0===r[u=n[0]+","+n[1]]?r[u]={index1:n[0],index2:n[1],face1:s,face2:void 0}:r[u].face2=s}for(u in r)(void 0===(n=r[u]).face2||a[n.face1].normal.dot(a[n.face2].normal)<=e)&&(o=t[n.index1],i.push(o.x,o.y,o.z),o=t[n.index2],i.push(o.x,o.y,o.z));this.addAttribute("position",new I(i,3))}function Li(t,e,i,n,r,o,a,s){M.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Pi(t,e,i,n,r,o,a,s)),this.mergeVertices()}function Pi(t,e,n,r,a,s,c,l){function h(n){var a,s=new i,h=new o,v=0,b=!0===n?t:e,w=!0===n?1:-1,_=g;for(a=1;a<=r;a++)p.push(0,y*w,0),f.push(0,w,0),m.push(.5,.5),g++;var E=g;for(a=0;a<=r;a++){var M=a/r*l+c,T=Math.cos(M);M=Math.sin(M),h.x=b*M,h.y=y*w,h.z=b*T,p.push(h.x,h.y,h.z),f.push(0,w,0),s.x=.5*T+.5,s.y=.5*M*w+.5,m.push(s.x,s.y),g++}for(a=0;athis.duration&&this.resetDuration(),this.optimize()}function Hn(t){this.manager=void 0!==t?t:go,this.textures={}}function Gn(t){this.manager=void 0!==t?t:go}function kn(){}function Vn(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:go,this.withCredentials=!1}function jn(t){this.manager=void 0!==t?t:go,this.texturePath=""}function Wn(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==t?t:go,this.options=void 0}function qn(){this.type="ShapePath",this.color=new g,this.subPaths=[],this.currentPath=null}function Xn(t){this.type="Font",this.data=t}function Yn(t){this.manager=void 0!==t?t:go}function Zn(t){this.manager=void 0!==t?t:go}function Jn(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ue,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ue,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function $n(t,e,i){b.call(this),this.type="CubeCamera";var n=new ue(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new o(1,0,0)),this.add(n);var r=new ue(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new o(-1,0,0)),this.add(r);var a=new ue(90,1,t,e);a.up.set(0,0,1),a.lookAt(new o(0,1,0)),this.add(a);var s=new ue(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new o(0,-1,0)),this.add(s);var c=new ue(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new o(0,0,1)),this.add(c);var l=new ue(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new o(0,0,-1)),this.add(l),this.renderTarget=new h(i,i,{format:1022,magFilter:1006,minFilter:1006}),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,o=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,t.render(e,n,i),i.activeCubeFace=1,t.render(e,r,i),i.activeCubeFace=2,t.render(e,a,i),i.activeCubeFace=3,t.render(e,s,i),i.activeCubeFace=4,t.render(e,c,i),i.texture.generateMipmaps=o,i.activeCubeFace=5,t.render(e,l,i),t.setRenderTarget(null)},this.clear=function(t,e,i,n){for(var r=this.renderTarget,o=0;6>o;o++)r.activeCubeFace=o,t.setRenderTarget(r),t.clear(e,i,n);t.setRenderTarget(null)}}function Qn(){b.call(this),this.type="AudioListener",this.context=Oo.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Kn(t){b.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.offset=this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function tr(t){Kn.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function er(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function ir(t,e,i){switch(this.binding=t,this.valueSize=i,t=Float64Array,e){case"quaternion":e=this._slerp;break;case"string":case"bool":t=Array,e=this._select;break;default:e=this._lerp}this.buffer=new t(4*i),this._mixBufferRegion=e,this.referenceCount=this.useCount=this.cumulativeWeight=0}function nr(t,e,i){i=i||rr.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function rr(t,e,i){this.path=e,this.parsedPath=i||rr.parseTrackName(e),this.node=rr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function or(){this.uuid=Vr.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function ar(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null,e=(t=e.tracks).length,i=Array(e);for(var n={endingStart:2400,endingEnd:2400},r=0;r!==e;++r){var o=t[r].createInterpolant(null);i[r]=o,o.settings=n}this._interpolantSettings=n,this._interpolants=i,this._propertyBindings=Array(e),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function sr(t){this._root=t,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function cr(t,e){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=e),this.value=t}function lr(){B.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function hr(t,e,i,n){this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function ur(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function dr(t,e,i){ur.call(this,t,e),this.meshPerAttribute=i||1}function pr(t,e,i){T.call(this,t,e),this.meshPerAttribute=i||1}function fr(t,e,i,n){this.ray=new W(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function mr(t,e){return t.distance-e.distance}function gr(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n)){n=0;for(var r=(t=t.children).length;ni;i++,n++){var r=i/32*Math.PI*2,o=n/32*Math.PI*2;e.push(Math.cos(r),Math.sin(r),1,Math.cos(o),Math.sin(o),1)}t.addAttribute("position",new I(e,3)),e=new Me({fog:!1}),this.cone=new Se(t,e),this.add(this.cone),this.update()}function Mr(t){for(var e=function t(e){var i=[];e&&e.isBone&&i.push(e);for(var n=0;nt?-1:0e;e++)t[e]=(16>e?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&n|128]+t[n>>8&255]+"-"+t[n>>16&255]+t[n>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]).toUpperCase()}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-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())},degToRad:function(t){return t*Vr.DEG2RAD},radToDeg:function(t){return t*Vr.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};Object.defineProperties(i.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(i.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(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:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(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:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y;return t=t.elements,this.x=t[0]*e+t[3]*i+t[6],this.y=t[1]*e+t[4]*i+t[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(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:(Gr=new i,kr=new i,function(t,e){return Gr.set(t,t),kr.set(e,e),this.clamp(Gr,kr)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return 0>t&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x;return e*e+(t=this.y-t.y)*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e);e=Math.sin(e);var n=this.x-t.x,r=this.y-t.y;return this.x=n*i-r*e+t.x,this.y=n*e+r*i+t.y,this}}),Object.assign(n.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,c,l,h,u,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=l,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new n).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},copyPosition:function(t){var e=this.elements;return t=t.elements,e[12]=t[12],e[13]=t[13],e[14]=t[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t=new o;return function(e){var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length();return e=1/t.setFromMatrixColumn(e,2).length(),i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*e,i[9]=n[9]*e,i[10]=n[10]*e,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i);i=Math.sin(i);var a=Math.cos(n);n=Math.sin(n);var s=Math.cos(r);if(r=Math.sin(r),"XYZ"===t.order){t=o*s;var c=o*r,l=i*s,h=i*r;e[0]=a*s,e[4]=-a*r,e[8]=n,e[1]=c+l*n,e[5]=t-h*n,e[9]=-i*a,e[2]=h-t*n,e[6]=l+c*n,e[10]=o*a}else"YXZ"===t.order?(t=a*s,c=a*r,l=n*s,h=n*r,e[0]=t+h*i,e[4]=l*i-c,e[8]=o*n,e[1]=o*r,e[5]=o*s,e[9]=-i,e[2]=c*i-l,e[6]=h+t*i,e[10]=o*a):"ZXY"===t.order?(t=a*s,c=a*r,l=n*s,h=n*r,e[0]=t-h*i,e[4]=-o*r,e[8]=l+c*i,e[1]=c+l*i,e[5]=o*s,e[9]=h-t*i,e[2]=-o*n,e[6]=i,e[10]=o*a):"ZYX"===t.order?(t=o*s,c=o*r,l=i*s,h=i*r,e[0]=a*s,e[4]=l*n-c,e[8]=t*n+h,e[1]=a*r,e[5]=h*n+t,e[9]=c*n-l,e[2]=-n,e[6]=i*a,e[10]=o*a):"YZX"===t.order?(t=o*a,c=o*n,l=i*a,h=i*n,e[0]=a*s,e[4]=h-t*r,e[8]=l*r+c,e[1]=r,e[5]=o*s,e[9]=-i*s,e[2]=-n*s,e[6]=c*r+l,e[10]=t-h*r):"XZY"===t.order&&(t=o*a,c=o*n,l=i*a,h=i*n,e[0]=a*s,e[4]=-r,e[8]=n*s,e[1]=t*r+h,e[5]=o*s,e[9]=c*r-l,e[2]=l*r-c,e[6]=i*s,e[10]=h*r+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:function(t){var e=this.elements,i=t._x,n=t._y,r=t._z,o=t._w,a=i+i,s=n+n,c=r+r;t=i*a;var l=i*s;i*=c;var h=n*s;return n*=c,r*=c,a*=o,s*=o,o*=c,e[0]=1-(h+r),e[4]=l-o,e[8]=i+s,e[1]=l+o,e[5]=1-(t+r),e[9]=n-a,e[2]=i-s,e[6]=n+a,e[10]=1-(t+h),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new o,e=new o,i=new o;return function(n,r,o){var a=this.elements;return i.subVectors(n,r),0===i.lengthSq()&&(i.z=1),i.normalize(),t.crossVectors(o,i),0===t.lengthSq()&&(1===Math.abs(o.z)?i.x+=1e-4:i.z+=1e-4,i.normalize(),t.crossVectors(o,i)),t.normalize(),e.crossVectors(i,t),a[0]=t.x,a[4]=e.x,a[8]=i.x,a[1]=t.y,a[5]=e.y,a[9]=i.y,a[2]=t.z,a[6]=e.z,a[10]=i.z,this}}(),multiply:function(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:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements;e=this.elements,t=i[0];var r=i[4],o=i[8],a=i[12],s=i[1],c=i[5],l=i[9],h=i[13],u=i[2],d=i[6],p=i[10],f=i[14],m=i[3],g=i[7],v=i[11];i=i[15];var y=n[0],x=n[4],b=n[8],w=n[12],_=n[1],E=n[5],M=n[9],T=n[13],S=n[2],A=n[6],R=n[10],C=n[14],L=n[3],P=n[7],O=n[11];return n=n[15],e[0]=t*y+r*_+o*S+a*L,e[4]=t*x+r*E+o*A+a*P,e[8]=t*b+r*M+o*R+a*O,e[12]=t*w+r*T+o*C+a*n,e[1]=s*y+c*_+l*S+h*L,e[5]=s*x+c*E+l*A+h*P,e[9]=s*b+c*M+l*R+h*O,e[13]=s*w+c*T+l*C+h*n,e[2]=u*y+d*_+p*S+f*L,e[6]=u*x+d*E+p*A+f*P,e[10]=u*b+d*M+p*R+f*O,e[14]=u*w+d*T+p*C+f*n,e[3]=m*y+g*_+v*S+i*L,e[7]=m*x+g*E+v*A+i*P,e[11]=m*b+g*M+v*R+i*O,e[15]=m*w+g*T+v*C+i*n,this},multiplyScalar:function(t){var 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},applyToBufferAttribute:function(){var t=new o;return function(e){for(var i=0,n=e.count;ithis.determinant()&&(a=-a),i.x=o[12],i.y=o[13],i.z=o[14],e.copy(this),i=1/a,o=1/s;var l=1/c;return e.elements[0]*=i,e.elements[1]*=i,e.elements[2]*=i,e.elements[4]*=o,e.elements[5]*=o,e.elements[6]*=o,e.elements[8]*=l,e.elements[9]*=l,e.elements[10]*=l,n.setFromRotationMatrix(e),r.x=a,r.y=s,r.z=c,this}}(),makePerspective:function(t,e,i,n,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements;return a[0]=2*r/(e-t),a[4]=0,a[8]=(e+t)/(e-t),a[12]=0,a[1]=0,a[5]=2*r/(i-n),a[9]=(i+n)/(i-n),a[13]=0,a[2]=0,a[6]=0,a[10]=-(o+r)/(o-r),a[14]=-2*o*r/(o-r),a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,i,n,r,o){var a=this.elements,s=1/(e-t),c=1/(i-n),l=1/(o-r);return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-(e+t)*s,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-(i+n)*c,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-(o+r)*l,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){var e=this.elements;t=t.elements;for(var i=0;16>i;i++)if(e[i]!==t[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;16>i;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}),Object.assign(r,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,o,a){var s=i[n+0],c=i[n+1],l=i[n+2];i=i[n+3],n=r[o+0];var h=r[o+1],u=r[o+2];if(i!==(r=r[o+3])||s!==n||c!==h||l!==u){o=1-a;var d=s*n+c*h+l*u+i*r,p=0<=d?1:-1,f=1-d*d;f>Number.EPSILON&&(f=Math.sqrt(f),d=Math.atan2(f,d*p),o=Math.sin(o*d)/f,a=Math.sin(a*d)/f),s=s*o+n*(p*=a),c=c*o+h*p,l=l*o+u*p,i=i*o+r*p,o===1-a&&(s*=a=1/Math.sqrt(s*s+c*c+l*l+i*i),c*=a,l*=a,i*=a)}t[e]=s,t[e+1]=c,t[e+2]=l,t[e+3]=i}}),Object.defineProperties(r.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(r.prototype,{set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z;t=t.order;var o=Math.cos,a=Math.sin,s=o(i/2),c=o(n/2);return o=o(r/2),i=a(i/2),n=a(n/2),r=a(r/2),"XYZ"===t?(this._x=i*c*o+s*n*r,this._y=s*n*o-i*c*r,this._z=s*c*r+i*n*o,this._w=s*c*o-i*n*r):"YXZ"===t?(this._x=i*c*o+s*n*r,this._y=s*n*o-i*c*r,this._z=s*c*r-i*n*o,this._w=s*c*o+i*n*r):"ZXY"===t?(this._x=i*c*o-s*n*r,this._y=s*n*o+i*c*r,this._z=s*c*r+i*n*o,this._w=s*c*o-i*n*r):"ZYX"===t?(this._x=i*c*o-s*n*r,this._y=s*n*o+i*c*r,this._z=s*c*r-i*n*o,this._w=s*c*o+i*n*r):"YZX"===t?(this._x=i*c*o+s*n*r,this._y=s*n*o+i*c*r,this._z=s*c*r-i*n*o,this._w=s*c*o-i*n*r):"XZY"===t&&(this._x=i*c*o-s*n*r,this._y=s*n*o-i*c*r,this._z=s*c*r+i*n*o,this._w=s*c*o+i*n*r),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){e/=2;var i=Math.sin(e);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(e),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e=t.elements,i=e[0];t=e[4];var n=e[8],r=e[1],o=e[5],a=e[9],s=e[2],c=e[6],l=i+o+(e=e[10]);return 0o&&i>e?(i=2*Math.sqrt(1+i-o-e),this._w=(c-a)/i,this._x=.25*i,this._y=(t+r)/i,this._z=(n+s)/i):o>e?(i=2*Math.sqrt(1+o-i-e),this._w=(n-s)/i,this._x=(t+r)/i,this._y=.25*i,this._z=(a+c)/i):(i=2*Math.sqrt(1+e-i-o),this._w=(r-t)/i,this._x=(n+s)/i,this._y=(a+c)/i,this._z=.25*i),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new o;return function(i,n){return void 0===e&&(e=new o),1e-6>(t=i.dot(n)+1)?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._z=this._y=this._x=0,this._w=1):(t=1/t,this._x*=t,this._y*=t,this._z*=t,this._w*=t),this.onChangeCallback(),this},multiply:function(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:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z;t=t._w;var o=e._x,a=e._y,s=e._z;return e=e._w,this._x=i*e+t*o+n*s-r*a,this._y=n*e+t*a+r*o-i*s,this._z=r*e+t*s+i*a-n*o,this._w=t*e-i*o-n*a-r*s,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(0>a?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=i,this._y=n,this._z=r,this;if(t=Math.sqrt(1-a*a),.001>Math.abs(t))return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var s=Math.atan2(t,a);return a=Math.sin((1-e)*s)/t,e=Math.sin(e*s)/t,this._w=o*a+this._w*e,this._x=i*a+this._x*e,this._y=n*a+this._y*e,this._z=r*a+this._z*e,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(o.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(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:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(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:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(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:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new r;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new r;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[3]*i+t[6]*n,this.y=t[1]*e+t[4]*i+t[7]*n,this.z=t[2]*e+t[5]*i+t[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=1/((t=t.elements)[3]*e+t[7]*i+t[11]*n+t[15]);return this.x=(t[0]*e+t[4]*i+t[8]*n+t[12])*r,this.y=(t[1]*e+t[5]*i+t[9]*n+t[13])*r,this.z=(t[2]*e+t[6]*i+t[10]*n+t[14])*r,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=(t=t.w)*e+o*n-a*i,c=t*i+a*e-r*n,l=t*n+r*i-o*e;return e=-r*e-o*i-a*n,this.x=s*t+e*-r+c*-a-l*-o,this.y=c*t+e*-o+l*-r-s*-a,this.z=l*t+e*-a+s*-o-c*-r,this},project:function(){var t=new n;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new n;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z;return t=t.elements,this.x=t[0]*e+t[4]*i+t[8]*n,this.y=t[1]*e+t[5]*i+t[9]*n,this.z=t[2]*e+t[6]*i+t[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(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:function(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:function(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:function(){var t=new o,e=new o;return function(i,n){return t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(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:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(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:function(t,e){var i=t.x,n=t.y;t=t.z;var r=e.x,o=e.y;return e=e.z,this.x=n*e-t*o,this.y=t*r-i*e,this.z=i*o-n*r,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new o;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new o;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){return t=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq()),Math.acos(Vr.clamp(t,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i+(t=this.z-t.z)*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return t=t.elements,this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length();return t=this.setFromMatrixColumn(t,2).length(),this.x=e,this.y=i,this.z=t,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&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}}),Object.assign(a.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,c){var l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=i,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements;return t=t.elements,e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},setFromMatrix4:function(t){return t=t.elements,this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var t=new o;return function(e){for(var i=0,n=e.count;ii;i++)if(e[i]!==t[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;9>i;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}});var jr=0;s.DEFAULT_IMAGE=void 0,s.DEFAULT_MAPPING=300,s.prototype=Object.assign(Object.create(e.prototype),{constructor:s,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(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.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:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={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,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=Vr.generateUUID()),!e&&void 0===t.images[n.uuid]){var r=t.images,o=n.uuid,a=n.uuid;if(n instanceof HTMLCanvasElement)var s=n;else{(s=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=n.width,s.height=n.height;var c=s.getContext("2d");n instanceof ImageData?c.putImageData(n,0,0):c.drawImage(n,0,0,n.width,n.height)}s=2048t.x||1t.x?0:1;break;case 1002:t.x=1===Math.abs(Math.floor(t.x)%2)?Math.ceil(t.x)-t.x:t.x-Math.floor(t.x)}if(0>t.y||1t.y?0:1;break;case 1002:t.y=1===Math.abs(Math.floor(t.y)%2)?Math.ceil(t.y)-t.y:t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.defineProperty(s.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(c.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.w=this.z=this.y=this.x=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(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 Error("index is out of range: "+t)}return this},getComponent:function(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 Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(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:function(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:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(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:function(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:function(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:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(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},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return t=t.elements,this.x=t[0]*e+t[4]*i+t[8]*n+t[12]*r,this.y=t[1]*e+t[5]*i+t[9]*n+t[13]*r,this.z=t[2]*e+t[6]*i+t[10]*n+t[14]*r,this.w=t[3]*e+t[7]*i+t[11]*n+t[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.z=this.y=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e=(t=t.elements)[0],i=t[4],n=t[8],r=t[1],o=t[5],a=t[9],s=t[2],c=t[6],l=t[10];return.01>Math.abs(i-r)&&.01>Math.abs(n-s)&&.01>Math.abs(a-c)?.1>Math.abs(i+r)&&.1>Math.abs(n+s)&&.1>Math.abs(a+c)&&.1>Math.abs(e+o+l-3)?(this.set(1,0,0,0),this):(t=Math.PI,l=(l+1)/2,i=(i+r)/4,n=(n+s)/4,a=(a+c)/4,(e=(e+1)/2)>(o=(o+1)/2)&&e>l?.01>e?(c=0,i=s=.707106781):(s=i/(c=Math.sqrt(e)),i=n/c):o>l?.01>o?(c=.707106781,s=0,i=.707106781):(c=i/(s=Math.sqrt(o)),i=a/s):.01>l?(s=c=.707106781,i=0):(c=n/(i=Math.sqrt(l)),s=a/i),this.set(c,s,i,t),this):(t=Math.sqrt((c-a)*(c-a)+(n-s)*(n-s)+(r-i)*(r-i)),.001>Math.abs(t)&&(t=1),this.x=(c-a)/t,this.y=(n-s)/t,this.z=(r-i)/t,this.w=Math.acos((e+o+l-1)/2),this)},min:function(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:function(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:function(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:function(){var t,e;return function(i,n){return void 0===t&&(t=new c,e=new c),t.set(i,i,i,i),e.set(n,n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){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:function(){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:function(){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:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(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:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&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}}),l.prototype=Object.assign(Object.create(e.prototype),{constructor:l,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),h.prototype=Object.create(l.prototype),h.prototype.constructor=h,h.prototype.isWebGLRenderTargetCube=!0,u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isDataTexture=!0,Object.assign(d.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;sr&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(e,i,n),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;sr&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(e,i,n),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(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:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new o),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:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t=new o;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){if(0=t.constant},intersectsTriangle:function(){function t(t){var r,o=0;for(r=t.length-3;o<=r;o+=3){c.fromArray(t,o);var a=h.x*Math.abs(c.x)+h.y*Math.abs(c.y)+h.z*Math.abs(c.z),s=e.dot(c),l=i.dot(c),u=n.dot(c);if(Math.max(-Math.max(s,l,u),Math.min(s,l,u))>a)return!1}return!0}var e=new o,i=new o,n=new o,r=new o,a=new o,s=new o,c=new o,l=new o,h=new o,u=new o;return function(o){return!this.isEmpty()&&(this.getCenter(l),h.subVectors(this.max,l),e.subVectors(o.a,l),i.subVectors(o.b,l),n.subVectors(o.c,l),r.subVectors(i,e),a.subVectors(n,i),s.subVectors(e,n),!!t(o=[0,-r.z,r.y,0,-a.z,a.y,0,-s.z,s.y,r.z,0,-r.x,a.z,0,-a.x,s.z,0,-s.x,-r.y,r.x,0,-a.y,a.x,0,-s.y,s.x,0])&&(!!t(o=[1,0,0,0,1,0,0,0,1])&&(u.crossVectors(r,a),t(o=[u.x,u.y,u.z]))))}}(),clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new o),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new o;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new o;return function(e){return void 0===e&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),e=new p),this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new o,new o,new o,new o,new o,new o,new o,new o];return function(e){return this.isEmpty()||(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t)),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(p.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new d;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).getCenter(n);for(var r=i=0,o=e.length;r=this.radius},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new o),e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new d),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius*=t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(f.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new o,e=new o;return function(i,n,r){return n=t.subVectors(r,n).cross(e.subVectors(i,n)).normalize(),this.setFromNormalAndCoplanarPoint(n,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new o),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new o;return function(e,i){void 0===i&&(console.warn("THREE.Plane: .intersectLine() target is now required"),i=new o);var n=e.delta(t),r=this.normal.dot(n);if(0===r){if(0===this.distanceToPoint(e.start))return i.copy(e.start)}else if(!(0>(r=-(e.start.dot(this.normal)+this.constant)/r)||1e&&0t&&0i;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements;t=i[0];var n=i[1],r=i[2],o=i[3],a=i[4],s=i[5],c=i[6],l=i[7],h=i[8],u=i[9],d=i[10],p=i[11],f=i[12],m=i[13],g=i[14];return i=i[15],e[0].setComponents(o-t,l-a,p-h,i-f).normalize(),e[1].setComponents(o+t,l+a,p+h,i+f).normalize(),e[2].setComponents(o+n,l+s,p+u,i+m).normalize(),e[3].setComponents(o-n,l-s,p-u,i-m).normalize(),e[4].setComponents(o-r,l-c,p-d,i-g).normalize(),e[5].setComponents(o+r,l+c,p+d,i+g).normalize(),this},intersectsObject:function(){var t=new p;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new p;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){var e=this.planes,i=t.center;t=-t.radius;for(var n=0;6>n;n++)if(e[n].distanceToPoint(i)r;r++){var o=n[r];t.x=0a&&0>o)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;6>i;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}});var Wr={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",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( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\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 dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\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\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\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",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 ) {\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 );\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\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",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.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\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.w );\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.w );\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.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, 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.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.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 = value.rgb * cLogLuvM;\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 = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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\n",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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",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 = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\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#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\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#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\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#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars_begin:"uniform vec3 ambientLightColor;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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\n",lights_pars_maps:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n",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, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment_begin:"#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\t\tscale *= float( gl_FrontFacing ) * 2.0 - 1.0;\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",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}\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}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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 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\n",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\n",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#endif\n",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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},qr={merge:function(t){for(var e={},i=0;i>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return 0>i&&(i+=1),1i?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){return e=Vr.euclideanModulo(e,1),i=Vr.clamp(i,0,1),n=Vr.clamp(n,0,1),0===i?this.r=this.g=this.b=n:(n=2*n-(i=.5>=n?n*(1+i):n+i-n*i),this.r=t(n,i,e+1/3),this.g=t(n,i,e),this.b=t(n,i,e-1/3)),this}}(),setStyle:function(t){function e(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n=i[2];switch(i[1]){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){n=parseFloat(i[1])/360;var r=parseInt(i[2],10)/100,o=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(n,r,o)}}}else if(i=/^#([A-Fa-f0-9]+)$/.exec(t)){if(3===(n=(i=i[1]).length))return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(6===n)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return t&&0=s?c/(o+a):c/(2-o-a),o){case i:e=(n-r)/c+(nMath.abs(a)?(this._x=Math.atan2(-l,r),this._z=Math.atan2(-o,t)):(this._x=Math.atan2(u,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(a,r),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-h,t),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(u,-1,1)),.99999>Math.abs(u)?(this._y=Math.atan2(-h,r),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(s,t))):"ZYX"===e?(this._y=Math.asin(-n(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(u,r),this._z=Math.atan2(s,t)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===e?(this._z=Math.asin(n(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-h,t)):(this._x=0,this._y=Math.atan2(a,r))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),.99999>Math.abs(o)?(this._x=Math.atan2(u,c),this._y=Math.atan2(a,t)):(this._x=Math.atan2(-l,r),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new n;return function(e,i,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new r;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(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:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new o(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(x.prototype,{set:function(t){this.mask=1<a;a++)if(r[a]===r[(a+1)%3]){e.push(o);break}for(o=e.length-1;0<=o;o--)for(r=e[o],this.faces.splice(r,1),n=0,t=this.faceVertexUvs.length;nthis.opacity&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,0!==this.rotation&&(n.rotation=this.rotation),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),0(t=e.dot(this.direction))?e.copy(this.origin):e.copy(this.direction).multiplyScalar(t).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new o;return function(e){var i=t.subVectors(e,this.origin).dot(this.direction);return 0>i?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(i).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new o,e=new o,i=new o;return function(n,r,o,a){t.copy(n).add(r).multiplyScalar(.5),e.copy(r).sub(n).normalize(),i.copy(this.origin).sub(t);var s=.5*n.distanceTo(r),c=-this.direction.dot(e),l=i.dot(this.direction),h=-i.dot(e),u=i.lengthSq(),d=Math.abs(1-c*c);if(0=-p?r<=p?c=(n*=s=1/d)*(n+c*(r*=s)+2*l)+r*(c*n+r+2*h)+u:(r=s,c=-(n=Math.max(0,-(c*r+l)))*n+r*(r+2*h)+u):(r=-s,c=-(n=Math.max(0,-(c*r+l)))*n+r*(r+2*h)+u):r<=-p?c=-(n=Math.max(0,-(-c*s+l)))*n+(r=0(e=e.radius*e.radius)?null:(r=n-(e=Math.sqrt(e-r)),n+=e,0>r&&0>n?null:0>r?this.at(n,i):this.at(r,i))}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);return 0===e?0===t.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(t.normal)+t.constant)/e)?t:null},intersectPlane:function(t,e){return null===(t=this.distanceToPlane(t))?null:this.at(t,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||0>t.normal.dot(this.direction)*e},intersectBox:function(t,e){var i=1/this.direction.x,n=1/this.direction.y,r=1/this.direction.z,o=this.origin;if(0<=i){var a=(t.min.x-o.x)*i;i*=t.max.x-o.x}else a=(t.max.x-o.x)*i,i*=t.min.x-o.x;if(0<=n){var s=(t.min.y-o.y)*n;n*=t.max.y-o.y}else s=(t.max.y-o.y)*n,n*=t.min.y-o.y;return a>n||s>i?null:((s>a||a!=a)&&(a=s),(nt||s>i?null:((s>a||a!=a)&&(a=s),(ti?null:this.at(0<=a?a:i,e)))},intersectsBox:function(){var t=new o;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new o,e=new o,i=new o,n=new o;return function(r,o,a,s,c){if(e.subVectors(o,r),i.subVectors(a,r),n.crossVectors(e,i),0<(o=this.direction.dot(n))){if(s)return null;s=1}else{if(!(0>o))return null;s=-1,o=-o}return t.subVectors(this.origin,r),0>(r=s*this.direction.dot(i.crossVectors(t,i)))||0>(a=s*this.direction.dot(e.cross(t)))||r+a>o||0>(r=-s*t.dot(n))?null:this.at(r/o,c)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(q.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new o),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new o),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new o),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new o,e=new o;return function(i,n){return t.subVectors(i,this.start),e.subVectors(this.end,this.start),i=e.dot(e),i=e.dot(t)/i,n&&(i=Vr.clamp(i,0,1)),i}}(),closestPointToPoint:function(t,e,i){return t=this.closestPointToPointParameter(t,e),void 0===i&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),i=new o),this.delta(i).multiplyScalar(t).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(X,{getNormal:function(){var t=new o;return function(e,i,n,r){return void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new o),r.subVectors(n,i),t.subVectors(e,i),r.cross(t),0<(e=r.lengthSq())?r.multiplyScalar(1/Math.sqrt(e)):r.set(0,0,0)}}(),getBarycoord:function(){var t=new o,e=new o,i=new o;return function(n,r,a,s,c){t.subVectors(s,r),e.subVectors(a,r),i.subVectors(n,r),n=t.dot(t),r=t.dot(e),a=t.dot(i);var l=e.dot(e);s=e.dot(i);var h=n*l-r*r;return void 0===c&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),c=new o),0===h?c.set(-2,-1,-1):(l=(l*a-r*s)*(h=1/h),n=(n*s-r*a)*h,c.set(1-l-n,n,l))}}(),containsPoint:function(){var t=new o;return function(e,i,n,r){return X.getBarycoord(e,i,n,r,t),0<=t.x&&0<=t.y&&1>=t.x+t.y}}()}),Object.assign(X.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){var t=new o,e=new o;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new o),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return X.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new o),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return X.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return X.containsPoint(t,this.a,this.b,this.c)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(){var t=new f,e=[new q,new q,new q],i=new o,n=new o;return function(r,a){void 0===a&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),a=new o);var s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),!0===this.containsPoint(i))a.copy(i);else for(e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a),r=0;ri.far?null:{distance:e,point:w.clone(),object:t})}function r(i,n,r,o,a,s,c,d){return l.fromBufferAttribute(o,s),h.fromBufferAttribute(o,c),u.fromBufferAttribute(o,d),(i=e(i,i.material,n,r,l,h,u,b))&&(a&&(g.fromBufferAttribute(a,s),v.fromBufferAttribute(a,c),y.fromBufferAttribute(a,d),i.uv=t(b,l,h,u,g,v,y)),a=new E(s,c,d),X.getNormal(l,h,u,a.normal),i.face=a,i.faceIndex=s),i}var a=new n,s=new W,c=new p,l=new o,h=new o,u=new o,d=new o,f=new o,m=new o,g=new i,v=new i,y=new i,x=new o,b=new o,w=new o;return function(i,n){var o,p=this.geometry,x=this.material,w=this.matrixWorld;if(void 0!==x&&(null===p.boundingSphere&&p.computeBoundingSphere(),c.copy(p.boundingSphere),c.applyMatrix4(w),!1!==i.ray.intersectsSphere(c)&&(a.getInverse(w),s.copy(i.ray).applyMatrix4(a),null===p.boundingBox||!1!==s.intersectsBox(p.boundingBox))))if(p.isBufferGeometry){x=p.index;var _,E=p.attributes.position;if(p=p.attributes.uv,null!==x)for(w=0,_=x.count;w<_;w+=3){var M=x.getX(w),T=x.getX(w+1),S=x.getX(w+2);(o=r(this,i,s,E,p,M,T,S))&&(o.faceIndex=Math.floor(w/3),n.push(o))}else if(void 0!==E)for(w=0,_=E.count;w<_;w+=3)(o=r(this,i,s,E,p,M=w,T=w+1,S=w+2))&&n.push(o)}else if(p.isGeometry){w=Array.isArray(x),_=p.vertices,M=p.faces,0<(T=p.faceVertexUvs[0]).length&&(E=T);for(var A=0,R=M.length;Ao||((o=n.ray.origin.distanceTo(t))n.far||r.push({distance:o,point:t.clone(),face:null,object:this}))}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return b.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),be.prototype=Object.assign(Object.create(b.prototype),{constructor:be,copy:function(t){b.prototype.copy.call(this,t,!1);for(var e=0,i=(t=t.levels).length;e=n[r].distance;r++)n[r-1].object.visible=!1,n[r].object.visible=!0;for(;ra||(u.applyMatrix4(this.matrixWorld),(g=n.ray.origin.distanceTo(u))n.far||r.push({distance:g,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}else for(s=0,m=f.length/3-1;sa||(u.applyMatrix4(this.matrixWorld),(g=n.ray.origin.distanceTo(u))n.far||r.push({distance:g,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}else if(s.isGeometry)for(h=(l=s.vertices).length,s=0;sa||(u.applyMatrix4(this.matrixWorld),(g=n.ray.origin.distanceTo(u))n.far||r.push({distance:g,point:c.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Se.prototype=Object.assign(Object.create(Te.prototype),{constructor:Se,isLineSegments:!0,computeLineDistances:function(){var t=new o,e=new o;return function(){var i=this.geometry;if(i.isBufferGeometry)if(null===i.index){for(var n=i.attributes.position,r=[],o=0,a=n.count;on.far||r.push({distance:t,distanceToRay:Math.sqrt(o),point:d.clone(),index:i,face:null,object:s}))}var s=this,c=this.geometry,l=this.matrixWorld,h=n.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),i.copy(c.boundingSphere),i.applyMatrix4(l),i.radius+=h,!1!==n.ray.intersectsSphere(i)){t.getInverse(l),e.copy(n.ray).applyMatrix4(t);var u=(h/=(this.scale.x+this.scale.y+this.scale.z)/3)*h;h=new o;var d=new o;if(c.isBufferGeometry){var p=c.index;if(c=c.attributes.position.array,null!==p){var f=p.array;p=0;for(var m=f.length;p=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Oe.prototype=Object.create(s.prototype),Oe.prototype.constructor=Oe,Oe.prototype.isCompressedTexture=!0,Ie.prototype=Object.create(s.prototype),Ie.prototype.constructor=Ie,Ie.prototype.isDepthTexture=!0,Ne.prototype=Object.create(B.prototype),Ne.prototype.constructor=Ne,De.prototype=Object.create(M.prototype),De.prototype.constructor=De,Ue.prototype=Object.create(B.prototype),Ue.prototype.constructor=Ue,Be.prototype=Object.create(M.prototype),Be.prototype.constructor=Be,Fe.prototype=Object.create(B.prototype),Fe.prototype.constructor=Fe,ze.prototype=Object.create(M.prototype),ze.prototype.constructor=ze,He.prototype=Object.create(Fe.prototype),He.prototype.constructor=He,Ge.prototype=Object.create(M.prototype),Ge.prototype.constructor=Ge,ke.prototype=Object.create(Fe.prototype),ke.prototype.constructor=ke,Ve.prototype=Object.create(M.prototype),Ve.prototype.constructor=Ve,je.prototype=Object.create(Fe.prototype),je.prototype.constructor=je,We.prototype=Object.create(M.prototype),We.prototype.constructor=We,qe.prototype=Object.create(Fe.prototype),qe.prototype.constructor=qe,Xe.prototype=Object.create(M.prototype),Xe.prototype.constructor=Xe,Ye.prototype=Object.create(B.prototype),Ye.prototype.constructor=Ye,Ze.prototype=Object.create(M.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(B.prototype),Je.prototype.constructor=Je,$e.prototype=Object.create(M.prototype),$e.prototype.constructor=$e,Qe.prototype=Object.create(B.prototype),Qe.prototype.constructor=Qe;var lo=function(t,e,i){i=i||2;var n,r=e&&e.length,o=r?e[0]*i:t.length,a=Ke(t,0,o,i,!0),s=[];if(!a)return s;if(r){var c,l=i;r=[];var h=0;for(c=e.length;h80*i){var d=n=t[0],p=r=t[1];for(l=i;ln&&(n=h),e>r&&(r=e);n=0!==(n=Math.max(n-d,r-p))?1/n:0}return function t(e,i,n,r,o,a,s){if(e){if(!s&&a){var c=e,l=c;do{null===l.z&&(l.z=ni(l.x,l.y,r,o,a)),l.prevZ=l.prev,l=l.nextZ=l.next}while(l!==c);l.prevZ.nextZ=null,l.prevZ=null,c=l;var h,u,d,p,f=1;do{l=c;var m=c=null;for(u=0;l;){u++;var g=l;for(h=d=0;hd.x?u.x>f.x?u.x:f.x:d.x>f.x?d.x:f.x,b=u.y>d.y?u.y>f.y?u.y:f.y:d.y>f.y?d.y:f.y;for(h=ni(u.x=h;){if(v!==m.prev&&v!==m.next&&oi(u.x,u.y,d.x,d.y,f.x,f.y,v.x,v.y)&&0<=ai(v.prev,v,v.next)){m=!1;break t}v=v.prevZ}m=!0}}else t:if(m=e,u=m.prev,d=m,f=m.next,0<=ai(u,d,f))m=!1;else{for(h=m.next.next;h!==m.prev;){if(oi(u.x,u.y,d.x,d.y,f.x,f.y,h.x,h.y)&&0<=ai(h.prev,h,h.next)){m=!1;break t}h=h.next}m=!0}if(m)i.push(l.i/n),i.push(e.i/n),i.push(g.i/n),di(e),c=e=g.next;else if((e=g)===c){if(s){if(1===s){s=i,c=n,l=e;do{!si(g=l.prev,m=l.next.next)&&ci(g,l,l.next,m)&&li(g,m)&&li(m,g)&&(s.push(g.i/c),s.push(l.i/c),s.push(m.i/c),di(l),di(l.next),l=e=m),l=l.next}while(l!==e);t(e=l,i,n,r,o,a,2)}else if(2===s)t:{s=e;do{for(c=s.next.next;c!==s.prev;){if(l=s.i!==c.i){if(g=c,m=(l=s).next.i!==g.i&&l.prev.i!==g.i){e:{m=l;do{if(m.i!==l.i&&m.next.i!==l.i&&m.i!==g.i&&m.next.i!==g.i&&ci(m,m.next,l,g)){m=!0;break e}m=m.next}while(m!==l);m=!1}m=!m}if(m=m&&li(l,g)&&li(g,l)){m=l,u=!1,d=(l.x+g.x)/2,g=(l.y+g.y)/2;do{m.y>g!=m.next.y>g&&m.next.y!==m.y&&d<(m.next.x-m.x)*(g-m.y)/(m.next.y-m.y)+m.x&&(u=!u),m=m.next}while(m!==l);m=u}l=m}if(l){e=hi(s,c),s=ti(s,s.next),e=ti(e,e.next),t(s,i,n,r,o,a),t(e,i,n,r,o,a);break t}c=c.next}s=s.next}while(s!==e)}}else t(ti(e),i,n,r,o,a,1);break}}}}(a,s,i,d,p,n),s},ho={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;rho.area(t)},triangulateShape:function(t,e){var i=[],n=[],r=[];fi(t),mi(i,t);var o=t.length;for(e.forEach(fi),t=0;tMath.abs(s-l)?[new i(t,1-n),new i(c,1-r),new i(h,1-o),new i(d,1-e)]:[new i(s,1-n),new i(l,1-r),new i(u,1-o),new i(p,1-e)]}};yi.prototype=Object.create(M.prototype),yi.prototype.constructor=yi,xi.prototype=Object.create(vi.prototype),xi.prototype.constructor=xi,bi.prototype=Object.create(M.prototype),bi.prototype.constructor=bi,wi.prototype=Object.create(B.prototype),wi.prototype.constructor=wi,_i.prototype=Object.create(M.prototype),_i.prototype.constructor=_i,Ei.prototype=Object.create(B.prototype),Ei.prototype.constructor=Ei,Mi.prototype=Object.create(M.prototype),Mi.prototype.constructor=Mi,Ti.prototype=Object.create(B.prototype),Ti.prototype.constructor=Ti,Si.prototype=Object.create(M.prototype),Si.prototype.constructor=Si,Si.prototype.toJSON=function(){var t=M.prototype.toJSON.call(this);return Ri(this.parameters.shapes,t)},Ai.prototype=Object.create(B.prototype),Ai.prototype.constructor=Ai,Ai.prototype.toJSON=function(){var t=B.prototype.toJSON.call(this);return Ri(this.parameters.shapes,t)},Ci.prototype=Object.create(B.prototype),Ci.prototype.constructor=Ci,Li.prototype=Object.create(M.prototype),Li.prototype.constructor=Li,Pi.prototype=Object.create(B.prototype),Pi.prototype.constructor=Pi,Oi.prototype=Object.create(Li.prototype),Oi.prototype.constructor=Oi,Ii.prototype=Object.create(Pi.prototype),Ii.prototype.constructor=Ii,Ni.prototype=Object.create(M.prototype),Ni.prototype.constructor=Ni,Di.prototype=Object.create(B.prototype),Di.prototype.constructor=Di;var po=Object.freeze({WireframeGeometry:Ne,ParametricGeometry:De,ParametricBufferGeometry:Ue,TetrahedronGeometry:ze,TetrahedronBufferGeometry:He,OctahedronGeometry:Ge,OctahedronBufferGeometry:ke,IcosahedronGeometry:Ve,IcosahedronBufferGeometry:je,DodecahedronGeometry:We,DodecahedronBufferGeometry:qe,PolyhedronGeometry:Be,PolyhedronBufferGeometry:Fe,TubeGeometry:Xe,TubeBufferGeometry:Ye,TorusKnotGeometry:Ze,TorusKnotBufferGeometry:Je,TorusGeometry:$e,TorusBufferGeometry:Qe,TextGeometry:yi,TextBufferGeometry:xi,SphereGeometry:bi,SphereBufferGeometry:wi,RingGeometry:_i,RingBufferGeometry:Ei,PlaneGeometry:H,PlaneBufferGeometry:G,LatheGeometry:Mi,LatheBufferGeometry:Ti,ShapeGeometry:Si,ShapeBufferGeometry:Ai,ExtrudeGeometry:gi,ExtrudeBufferGeometry:vi,EdgesGeometry:Ci,ConeGeometry:Oi,ConeBufferGeometry:Ii,CylinderGeometry:Li,CylinderBufferGeometry:Pi,CircleGeometry:Ni,CircleBufferGeometry:Di,BoxGeometry:F,BoxBufferGeometry:z});Ui.prototype=Object.create(k.prototype),Ui.prototype.constructor=Ui,Ui.prototype.isShadowMaterial=!0,Ui.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.color.copy(t.color),this},Bi.prototype=Object.create(j.prototype),Bi.prototype.constructor=Bi,Bi.prototype.isRawShaderMaterial=!0,Fi.prototype=Object.create(k.prototype),Fi.prototype.constructor=Fi,Fi.prototype.isMeshStandardMaterial=!0,Fi.prototype.copy=function(t){return k.prototype.copy.call(this,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.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.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},zi.prototype=Object.create(Fi.prototype),zi.prototype.constructor=zi,zi.prototype.isMeshPhysicalMaterial=!0,zi.prototype.copy=function(t){return Fi.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Hi.prototype=Object.create(k.prototype),Hi.prototype.constructor=Hi,Hi.prototype.isMeshPhongMaterial=!0,Hi.prototype.copy=function(t){return k.prototype.copy.call(this,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.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.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Gi.prototype=Object.create(Hi.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isMeshToonMaterial=!0,Gi.prototype.copy=function(t){return Hi.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},ki.prototype=Object.create(k.prototype),ki.prototype.constructor=ki,ki.prototype.isMeshNormalMaterial=!0,ki.prototype.copy=function(t){return k.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,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.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Vi.prototype=Object.create(k.prototype),Vi.prototype.constructor=Vi,Vi.prototype.isMeshLambertMaterial=!0,Vi.prototype.copy=function(t){return k.prototype.copy.call(this,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.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ji.prototype=Object.create(Me.prototype),ji.prototype.constructor=ji,ji.prototype.isLineDashedMaterial=!0,ji.prototype.copy=function(t){return Me.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var fo=Object.freeze({ShadowMaterial:Ui,SpriteMaterial:ye,RawShaderMaterial:Bi,ShaderMaterial:j,PointsMaterial:Re,MeshPhysicalMaterial:zi,MeshStandardMaterial:Fi,MeshPhongMaterial:Hi,MeshToonMaterial:Gi,MeshNormalMaterial:ki,MeshLambertMaterial:Vi,MeshDepthMaterial:ne,MeshDistanceMaterial:re,MeshBasicMaterial:V,LineDashedMaterial:ji,LineBasicMaterial:Me,Material:k}),mo={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={}}},go=new Wi,vo={};Object.assign(qi.prototype,{load:function(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,o=mo.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===vo[t]){var a=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){i=a[1];var s=!!a[2];a=a[3],a=window.decodeURIComponent(a),s&&(a=window.atob(a));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":var l=new Uint8Array(a.length);for(s=0;s(r=i[t=Math.floor(o+(a-o)/2)]-e))o=t+1;else{if(!(0e&&(e=0),1<(t+=1e-4)&&(t=1),e=this.getPoint(e),this.getPoint(t).clone().sub(e).normalize()},getTangentAt:function(t){return t=this.getUtoTmapping(t),this.getTangent(t)},computeFrenetFrames:function(t,e){var i,r=new o,a=[],s=[],c=[],l=new o,h=new n;for(i=0;i<=t;i++){var u=i/t;a[i]=this.getTangentAt(u),a[i].normalize()}s[0]=new o,c[0]=new o,i=Number.MAX_VALUE,u=Math.abs(a[0].x);var d=Math.abs(a[0].y),p=Math.abs(a[0].z);for(u<=i&&(i=u,r.set(1,0,0)),d<=i&&(i=d,r.set(0,1,0)),p<=i&&r.set(0,0,1),l.crossVectors(a[0],r).normalize(),s[0].crossVectors(a[0],l),c[0].crossVectors(a[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),l.crossVectors(a[i-1],a[i]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(Vr.clamp(a[i-1].dot(a[i]),-1,1)),s[i].applyMatrix4(h.makeRotationAxis(l,r))),c[i].crossVectors(a[i],s[i]);if(!0===e)for(r=Math.acos(Vr.clamp(s[0].dot(s[t]),-1,1)),r/=t,0r;)r+=n;for(;r>n;)r-=n;r(r=Math.pow(s.distanceToSquared(c),l))&&(r=1),1e-4>n&&(n=r),1e-4>(l=Math.pow(c.distanceToSquared(i),l))&&(l=r),xo.initNonuniformCatmullRom(a.x,s.x,c.x,i.x,n,r,l),bo.initNonuniformCatmullRom(a.y,s.y,c.y,i.y,n,r,l),wo.initNonuniformCatmullRom(a.z,s.z,c.z,i.z,n,r,l)}else"catmullrom"===this.curveType&&(xo.initCatmullRom(a.x,s.x,c.x,i.x,this.tension),bo.initCatmullRom(a.y,s.y,c.y,i.y,this.tension),wo.initCatmullRom(a.z,s.z,c.z,i.z,this.tension));return e.set(xo.calc(t),bo.calc(t),wo.calc(t)),e},nn.prototype.copy=function(t){Qi.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;en.length-2?n.length-1:t+1];return n=n[t>n.length-3?n.length-1:t+2],e.set(rn(r,o.x,a.x,s.x,n.x),rn(r,o.y,a.y,s.y,n.y)),e},pn.prototype.copy=function(t){Qi.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e=e)return e=i[t]-e,i=(t=this.curves[t]).getLength(),t.getPointAt(0===i?0:1-e/i);t++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i=r)break t;for(t<(o=e[1])&&(i=2,r=o),o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===o)break;if(n=r,t>=(r=e[--i-1]))break e}n=i,i=0}for(;i>>1]?n=r:i=r+1;if(n=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return this._cachedIndex=i=e.length,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize;t*=n;for(var r=0;r!==n;++r)e[r]=i[t+r];return e},interpolate_:function(){throw Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Cn.prototype,{beforeStart_:Cn.prototype.copySampleValue_,afterEnd_:Cn.prototype.copySampleValue_}),Ln.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Ln,interpolate_:function(t,e,i,n){var o=this.resultBuffer,a=this.sampleValues,s=this.valueSize;for(e=(i-e)/(n-e),i=(t*=s)+s;t!==i;t+=4)r.slerpFlat(o,0,a,t-s,a,t,e);return o}}),Pn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Pn,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Ln(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),On.prototype=Object.assign(Object.create(Bn.prototype),{constructor:On,ValueTypeName:"color"}),In.prototype=Object.assign(Object.create(Bn.prototype),{constructor:In,ValueTypeName:"number"}),Nn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Nn,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,o=t+1,a=n[r],s=n[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=t,a=2*e-i;break;case 2402:a=e+n[r=n.length-2]-n[r+1];break;default:r=t,a=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*i-e;break;case 2402:o=1,s=i+n[1]-n[0];break;default:o=t-1,s=e}t=.5*(i-e),n=this.valueSize,this._weightPrev=t/(e-a),this._weightNext=t/(s-i),this._offsetPrev=r*n,this._offsetNext=o*n},interpolate_:function(t,e,i,n){var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a,c=this._offsetPrev,l=this._offsetNext,h=this._weightPrev,u=this._weightNext,d=(i-e)/(n-e);for(e=-h*(n=(i=d*d)*d)+2*h*i-h*d,h=(1+h)*n+(-1.5-2*h)*i+(-.5+h)*d+1,d=(-1-u)*n+(1.5+u)*i+.5*d,u=u*n-u*i,i=0;i!==a;++i)r[i]=e*o[c+i]+h*o[s+i]+d*o[t+i]+u*o[l+i];return r}}),Dn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Dn,interpolate_:function(t,e,i,n){var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(t*=a)-a;for(i=1-(e=(i-e)/(n-e)),n=0;n!==a;++n)r[n]=o[s+n]*i+o[t+n]*e;return r}}),Un.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Un,interpolate_:function(t){return this.copySampleValue_(t-1)}});var Eo={arraySlice:function(t,e,i){return Eo.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&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){for(var e=t.length,i=Array(e),n=0;n!==e;++n)i[n]=n;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[n])&&(e.push(o.time),i.push.apply(i,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[n])&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(a=o[n])&&(e.push(o.time),i.push(a)),o=t[r++]}while(void 0!==o)}}};Object.assign(Bn,{parse:function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=Bn._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];Eo.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e=t.constructor;if(void 0!==e.toJSON)e=e.toJSON(t);else{e={name:t.name,times:Eo.convertArray(t.times,Array),values:Eo.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return In;case"vector":case"vector2":case"vector3":case"vector4":return Fn;case"color":return On;case"quaternion":return Pn;case"bool":case"boolean":return Rn;case"string":return An}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}}),Object.assign(Bn.prototype,{constructor:Bn,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Un(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Dn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Nn(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){switch(t){case 2300:var e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){if(e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw Error(e);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrack:",e)}else this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i=this.times,n=i.length,r=0,o=n-1;r!==n&&i[r]e;)--o;return++o,0===r&&o===n||(r>=o&&(r=(o=Math.max(o,1))-1),t=this.getValueSize(),this.times=Eo.arraySlice(i,r,o),this.values=Eo.arraySlice(this.values,r*t,o*t)),this},validate:function(){var t=!0,e=this.getValueSize();0!=e-Math.floor(e)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var i=this.times;e=this.values;var n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var r=null,o=0;o!==n;o++){var a=i[o];if("number"==typeof a&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(null!==r&&r>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,r),t=!1;break}r=a}if(void 0!==e&&Eo.isTypedArray(e))for(o=0,i=e.length;o!==i;++o)if(n=e[o],isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,n),t=!1;break}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,o=t.length-1,a=1;ah.opacity&&(h.transparent=!0),n.setTextures(l),n.parse(h)}}()});var To={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",i=0,n=t.length;ir;r++){var S=h[v++],A=T[2*S];A=new i(A,S=T[2*S+1]),2!==r&&s.faceVertexUvs[n][x].push(A),0!==r&&s.faceVertexUvs[n][x+1].push(A)}}if(b&&(b=3*h[v++],y.normal.set(d[b++],d[b++],d[b]),_.normal.copy(y.normal)),w)for(n=0;4>n;n++)b=3*h[v++],w=new o(d[b++],d[b++],d[b]),2!==n&&y.vertexNormals.push(w),0!==n&&_.vertexNormals.push(w);if(f&&(f=p[f=h[v++]],y.color.setHex(f),_.color.setHex(f)),u)for(n=0;4>n;n++)f=p[f=h[v++]],2!==n&&y.vertexColors.push(new g(f)),0!==n&&_.vertexColors.push(new g(f));s.faces.push(y),s.faces.push(_)}else{if((y=new E).a=h[v++],y.b=h[v++],y.c=h[v++],x&&(x=h[v++],y.materialIndex=x),x=s.faces.length,n)for(n=0;nr;r++)A=new i(A=T[2*(S=h[v++])],S=T[2*S+1]),s.faceVertexUvs[n][x].push(A);if(b&&(b=3*h[v++],y.normal.set(d[b++],d[b++],d[b])),w)for(n=0;3>n;n++)b=3*h[v++],w=new o(d[b++],d[b++],d[b]),y.vertexNormals.push(w);if(f&&(f=h[v++],y.color.setHex(p[f])),u)for(n=0;3>n;n++)f=h[v++],y.vertexColors.push(new g(p[f]));s.faces.push(y)}}if(v=void 0!==(l=t).influencesPerVertex?l.influencesPerVertex:2,l.skinWeights)for(a=0,h=l.skinWeights.length;aNumber.EPSILON){if(0>l&&(a=e[o],c=-c,s=e[r],l=-l),!(t.ys.y))if(t.y===a.y){if(t.x===a.x)return!0}else{if(0===(r=l*(t.x-a.x)-c*(t.y-a.y)))return!0;0>r||(n=!n)}}else if(t.y===a.y&&(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x))return!0}return n}var r=ho.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return i(o);if(e=[],1===o.length){var a=o[0],s=new gn;return s.curves=a.curves,e.push(s),e}var c=!r(o[0].getPoints());c=t?!c:c,s=[];var l=[],h=[],u=0;l[u]=void 0,h[u]=[];for(var d=0,p=o.length;dn&&this._mixBufferRegion(i,t,3*e,1-n,e),n=e;for(var o=e+e;n!==o;++n)if(i[n]!==i[n+e]){r.setValue(i,t);break}},saveOriginalState:function(){var t=this.buffer,e=this.valueSize,i=3*e;this.binding.getValue(t,i);for(var n=e;n!==i;++n)t[n]=t[i+n%e];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(t,e,i,n,r){if(.5<=n)for(n=0;n!==r;++n)t[e+n]=t[i+n]},_slerp:function(t,e,i,n){r.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}}}),Object.assign(nr.prototype,{getValue:function(t,e){this.bind();var i=this._bindings[this._targetGroup.nCachedObjects_];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(rr,{Composite:nr,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new rr.Composite(t,e,i):new rr(t,e,i)},sanitizeNodeName:function(){var t=/[\[\]\.:\/]/g;return function(e){return e.replace(/\s/g,"_").replace(t,"")}}(),parseTrackName:function(){var t="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",e=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");t=/(WCOD+)?/.source.replace("WCOD",t);var i=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),n=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),r=new RegExp("^"+e+t+i+n+"$"),o=["material","materials","bones"];return function(t){var e=r.exec(t);if(!e)throw Error("PropertyBinding: Cannot parse trackName: "+t);var i=(e={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]}).nodeName&&e.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var n=e.nodeName.substring(i+1);-1!==o.indexOf(n)&&(e.nodeName=e.nodeName.substring(0,i),e.objectName=n)}if(null===e.propertyName||0===e.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return e}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){var n=function(t){for(var i=0;i=e){var h=e++,u=t[h];for(i[u.uuid]=l,t[l]=u,i[c]=h,t[h]=s,s=0,c=r;s!==c;++s){var d=(u=n[s])[l];u[l]=u[h],u[h]=d}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a].uuid,l=n[c];if(void 0!==l)if(delete n[c],l(e=(t-r)*i)||0===i)return;this._startTime=null,e*=i}if(e*=this._updateTimeScale(t),i=this._updateTime(e),0<(t=this._updateWeight(t))){e=this._interpolants,r=this._propertyBindings;for(var o=0,a=e.length;o!==a;++o)e[o].evaluate(i),r[o].accumulate(n,t)}}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(2200===n)t:{if(-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1)),e>=i)e=i;else{if(!(0>e))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>t?-1:1})}else{if(n=2202===n,-1===r&&(0<=t?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),e>=i||0>e){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var a=this.repetitions-r;0>=a?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0t,this._setEndings(t,!t,n)):this._setEndings(!1,!1,n),this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o}))}if(n&&1==(1&r))return this.time=e,i-e}return this.time=e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;return null===o&&(this._weightInterpolant=o=n._lendControlInterpolant()),n=o.parameterPositions,o=o.sampleValues,n[0]=r,o[0]=e,n[1]=r+t,o[1]=i,this}}),sr.prototype=Object.assign(Object.create(e.prototype),{constructor:sr,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings;t=t._interpolants;var a=i.uuid,s=this._bindingsByRootAndName,c=s[a];for(void 0===c&&(c={},s[a]=c),s=0;s!==r;++s){var l=n[s],h=l.name,u=c[h];if(void 0===u){if(void 0!==(u=o[s])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,a,h));continue}++(u=new ir(rr.create(i,h,e&&e._propertyBindings[s].binding.parsedPath),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(u,a,h)}o[s]=u,t[s].resultBuffer=u.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(i=0,n=(e=t._propertyBindings).length;i!==n;++i){var r=e[i];0==r.useCount++&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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:function(t){return null!==(t=t._cacheIndex)&&tthis.max.x||t.ythis.max.y)},containsBox:function(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:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new i),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:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new i),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),wr.prototype=Object.create(b.prototype),wr.prototype.constructor=wr,wr.prototype.isImmediateRenderObject=!0,_r.prototype=Object.create(Se.prototype),_r.prototype.constructor=_r,_r.prototype.update=function(){var t=new o,e=new o,i=new a;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,l=a=0,h=c.length;lMath.abs(e)&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.lookAt(this.plane.normal),b.prototype.updateMatrixWorld.call(this,t)},Ur.prototype=Object.create(b.prototype),Ur.prototype.constructor=Ur,Ur.prototype.setDirection=function(){var t,e=new o;return function(i){.99999i.y?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),Ur.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},Ur.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},Br.prototype=Object.create(Se.prototype),Br.prototype.constructor=Br,Qi.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Qi.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(fn.prototype,{createPointsGeometry:function(t){return console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."),t=this.getPoints(t),this.createGeometry(t)},createSpacedPointsGeometry:function(t){return console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."),t=this.getSpacedPoints(t),this.createGeometry(t)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new M,i=0,n=t.length;it[Math.floor(Math.random()*t.length)];function a(t,e){return null==t&&(t=0),null==e&&(e=1),t+Math.random()*(e-t)}function s(t,e){return null==t&&(t=0),null==e&&(e=1),Math.floor(t+Math.random()*(e-t+1))}var c=t=>document.querySelector(t);const l=t=>"number"==typeof t?"#"+("00000"+t.toString(16)).slice(-6):t,h=(t,e=1)=>{const i=l(t),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i),r=n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null;return"rgba("+r.r+","+r.g+","+r.b+","+e+")"}},function(t,e,i){"use strict";i.d(e,"a",(function(){return r}));var n=i(0);window&&!window.VANTA&&(window.VANTA={version:"0.3.1"});const r=window.VANTA||{};r.register||(r.register=(t,e)=>{r[t]=t=>new e(t)});var o=function(){return Array.prototype.unshift.call(arguments,"[VANTA]"),console.error.apply(this,arguments)};r.VantaBase=class{constructor(t={}){var e,i,a,s;if(r.current=this,this.onMouseMoveWrapper=this.onMouseMoveWrapper.bind(this),this.resize=this.resize.bind(this),this.animationLoop=this.animationLoop.bind(this),this.restart=this.restart.bind(this),this.options=Object(n.c)({},this.defaultOptions),t instanceof HTMLElement||"string"==typeof t?Object(n.c)(this.options,{el:t}):Object(n.c)(this.options,t),this.el=this.options.el,null==this.el)o('Instance needs "el" param!');else if(!(this.options.el instanceof HTMLElement||(s=this.el,this.el=Object(n.e)(s),this.el)))return void o("Cannot find element",s);for(a=0;a=0&&n>=0&&!this.options.mouseEase&&this.triggerMouseMove(i,n)}triggerMouseMove(t,e){this.uniforms&&(this.uniforms.u_mouse.value.x=t/this.scale,this.uniforms.u_mouse.value.y=e/this.scale);const i=t/this.width,n=e/this.height;"function"==typeof this.onMouseMove&&this.onMouseMove(i,n)}setSize(){this.scale||(this.scale=1),Object(n.d)()&&this.options.scaleMobile?this.scale=this.options.scaleMobile:this.options.scale&&(this.scale=this.options.scale),this.width=this.el.offsetWidth||window.innerWidth,this.height=this.el.offsetHeight||window.innerHeight}resize(){var t,e;this.setSize(),null!=(t=this.camera)&&(t.aspect=this.width/this.height),null!=(e=this.camera)&&"function"==typeof e.updateProjectionMatrix&&e.updateProjectionMatrix(),this.renderer&&(this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio/this.scale)),"function"==typeof this.onResize&&this.onResize()}animationLoop(){var t,e,i,n,r,o,a,s;return this.t||(this.t=0),this.t+=1,this.t2||(this.t2=0),this.t2+=null!=(o=this.options.speed)?o:1,this.uniforms&&(this.uniforms.u_time.value=.016667*this.t2),t=this.el.offsetHeight,e=this.el.getBoundingClientRect(),s=null!=(a=window.pageYOffset)?a:(document.documentElement||document.body.parentNode||document.body).scrollTop,n=(r=e.top+s)-window.innerHeight,i=r+t,this.options.mouseEase&&(this.mouseEaseX=this.mouseEaseX||this.mouseX||0,this.mouseEaseY=this.mouseEaseY||this.mouseY||0,Math.abs(this.mouseEaseX-this.mouseX)+Math.abs(this.mouseEaseY-this.mouseY)>.1&&(this.mouseEaseX=this.mouseEaseX+.05*(this.mouseX-this.mouseEaseX),this.mouseEaseY=this.mouseEaseY+.05*(this.mouseY-this.mouseEaseY),this.triggerMouseMove(this.mouseEaseX,this.mouseEaseY))),n<=s&&s<=i&&("function"==typeof this.onUpdate&&this.onUpdate(),this.scene&&this.camera&&(this.renderer.render(this.scene,this.camera),"transparent"==this.options.backgroundColor?this.renderer.setClearColor(this.options.backgroundColor,0):this.renderer.setClearColor(this.options.backgroundColor,this.options.backgroundAlpha)),this.fps&&this.fps.update&&this.fps.update()),this.req=window.requestAnimationFrame(this.animationLoop)}restart(){if(this.scene)for(;this.scene.children.length;)this.scene.remove(this.scene.children[0]);"function"==typeof this.onRestart&&this.onRestart(),this.init()}init(){"function"==typeof this.onInit&&this.onInit()}destroy(){"function"==typeof this.onDestroy&&this.onDestroy(),this.el.removeEventListener("mousemove",this.onMouseMoveWrapper),window.removeEventListener("scroll",this.onMouseMoveWrapper),window.removeEventListener("resize",this.resize),window.cancelAnimationFrame(this.req),this.renderer&&(this.el.removeChild(this.renderer.domElement),this.renderer=null,this.scene=null)}},e.b=r.VantaBase},,,function(t,e,i){"use strict";i.r(e);var n=i(1);let r=32,o=r*r;const a=800;THREE.BirdGeometry=function(t){t.quantity&&(r=Math.pow(2,t.quantity),o=r*r);const e=3*o,i=3*e;THREE.BufferGeometry.call(this);const n=new THREE.BufferAttribute(new Float32Array(3*i),3),a=new THREE.BufferAttribute(new Float32Array(3*i),3),s=new THREE.BufferAttribute(new Float32Array(2*i),2),c=new THREE.BufferAttribute(new Float32Array(i),1);this.addAttribute("position",n),this.addAttribute("birdColor",a),this.addAttribute("reference",s),this.addAttribute("birdVertex",c);let l=0;const h=function(){for(let t=0;t{const t=[];for(;i{const t=[];for(;i zoneRadiusSquared ) continue;\n\n percent = distSquared / zoneRadiusSquared;\n\n if ( percent < separationThresh ) { // low\n\n // Separation - Move apart for comfort\n f = (separationThresh / percent - 1.0) * delta;\n velocity -= normalize(dir) * f;\n\n } else if ( percent < alignmentThresh ) { // high\n\n // Alignment - fly the same direction\n float threshDelta = alignmentThresh - separationThresh;\n float adjustedPercent = ( percent - separationThresh ) / threshDelta;\n\n birdVelocity = texture2D( textureVelocity, ref ).xyz;\n\n f = ( 0.5 - cos( adjustedPercent * PI_2 ) * 0.5 + 0.5 ) * delta;\n velocity += normalize(birdVelocity) * f;\n\n } else {\n\n // Attraction / Cohesion - move closer\n float threshDelta = 1.0 - alignmentThresh;\n float adjustedPercent = ( percent - alignmentThresh ) / threshDelta;\n\n f = ( 0.5 - ( cos( adjustedPercent * PI_2 ) * -0.5 + 0.5 ) ) * delta;\n\n velocity += normalize(dir) * f;\n\n }\n }\n }\n\n // this make tends to fly around than down or up\n // if (velocity.y > 0.) velocity.y *= (1. - 0.2 * delta);\n\n // Speed Limits\n if ( length( velocity ) > limit ) {\n velocity = normalize( velocity ) * limit;\n }\n\n gl_FragColor = vec4( velocity, 1.0 );\n\n}",e),this.positionVariable=this.gpuCompute.addVariable("texturePosition","uniform float time;\nuniform float delta;\n\nvoid main() {\n\n vec2 uv = gl_FragCoord.xy / resolution.xy;\n vec4 tmpPos = texture2D( texturePosition, uv );\n vec3 position = tmpPos.xyz;\n vec3 velocity = texture2D( textureVelocity, uv ).xyz;\n\n float phase = tmpPos.w;\n\n phase = mod( ( phase + delta +\n length( velocity.xz ) * delta * 3. +\n max( velocity.y, 0.0 ) * delta * 6. ), 62.83 );\n\n gl_FragColor = vec4( position + velocity * delta * 15. , phase );\n\n}",t),this.gpuCompute.setVariableDependencies(this.velocityVariable,[this.positionVariable,this.velocityVariable]),this.gpuCompute.setVariableDependencies(this.positionVariable,[this.positionVariable,this.velocityVariable]),this.positionUniforms=this.positionVariable.material.uniforms,this.velocityUniforms=this.velocityVariable.material.uniforms,this.positionUniforms.time={value:0},this.positionUniforms.delta={value:0},this.velocityUniforms.time={value:1},this.velocityUniforms.delta={value:0},this.velocityUniforms.testing={value:1},this.velocityUniforms.separationDistance={value:1},this.velocityUniforms.alignmentDistance={value:1},this.velocityUniforms.cohesionDistance={value:1},this.velocityUniforms.speedLimit={value:1},this.velocityUniforms.freedomFactor={value:1},this.velocityUniforms.predator={value:new THREE.Vector3},this.velocityVariable.material.defines.BOUNDS=a.toFixed(2),this.velocityVariable.wrapS=THREE.RepeatWrapping,this.velocityVariable.wrapT=THREE.RepeatWrapping,this.positionVariable.wrapS=THREE.RepeatWrapping,this.positionVariable.wrapT=THREE.RepeatWrapping;const i=this.gpuCompute.init();null!==i&&console.error(i)}initBirds(){const t=new THREE.BirdGeometry(this.options);this.birdUniforms={color:{value:new THREE.Color(16720384)},texturePosition:{value:null},textureVelocity:{value:null},time:{value:1},delta:{value:0}};const e=new THREE.ShaderMaterial({uniforms:this.birdUniforms,vertexShader:"attribute vec2 reference;\nattribute float birdVertex;\n\nattribute vec3 birdColor;\n\nuniform sampler2D texturePosition;\nuniform sampler2D textureVelocity;\n\nvarying vec4 vColor;\nvarying float z;\n\nuniform float time;\n\nvoid main() {\n\n vec4 tmpPos = texture2D( texturePosition, reference );\n vec3 pos = tmpPos.xyz;\n vec3 velocity = normalize(texture2D( textureVelocity, reference ).xyz);\n\n vec3 newPosition = position;\n\n if ( birdVertex == 4.0 || birdVertex == 7.0 ) {\n // flap wings\n newPosition.y = sin( tmpPos.w ) * 5.;\n }\n\n newPosition = mat3( modelMatrix ) * newPosition;\n\n velocity.z *= -1.;\n float xz = length( velocity.xz );\n float xyz = 1.;\n float x = sqrt( 1. - velocity.y * velocity.y );\n\n float cosry = velocity.x / xz;\n float sinry = velocity.z / xz;\n\n float cosrz = x / xyz;\n float sinrz = velocity.y / xyz;\n\n mat3 maty = mat3(\n cosry, 0, -sinry,\n 0 , 1, 0 ,\n sinry, 0, cosry\n );\n\n mat3 matz = mat3(\n cosrz , sinrz, 0,\n -sinrz, cosrz, 0,\n 0 , 0 , 1\n );\n newPosition = maty * matz * newPosition;\n newPosition += pos;\n z = newPosition.z;\n\n vColor = vec4( birdColor, 1.0 );\n gl_Position = projectionMatrix * viewMatrix * vec4( newPosition, 1.0 );\n}",fragmentShader:"varying vec4 vColor;\nvarying float z;\nuniform vec3 color;\nvoid main() {\n // Fake colors for now\n float rr = 0.2 + ( 1000. - z ) / 1000. * vColor.x;\n float gg = 0.2 + ( 1000. - z ) / 1000. * vColor.y;\n float bb = 0.2 + ( 1000. - z ) / 1000. * vColor.z;\n gl_FragColor = vec4( rr, gg, bb, 1. );\n}",side:THREE.DoubleSide}),i=new THREE.Mesh(t,e);return i.rotation.y=Math.PI/2,i.matrixAutoUpdate=!1,i.updateMatrix(),this.scene.add(i)}onInit(){this.camera=new THREE.PerspectiveCamera(75,this.width/this.height,1,3e3),this.camera.position.z=350,this.fog=new THREE.Fog(16777215,100,1e3),this.mouseX=this.mouseY=0;try{this.initComputeRenderer(),this.valuesChanger=this.valuesChanger.bind(this),this.valuesChanger(),this.initBirds()}catch(t){console.error("[vanta.js] birds init error: ",t)}}valuesChanger(){return this.velocityUniforms.separationDistance.value=this.options.separation,this.velocityUniforms.alignmentDistance.value=this.options.alignment,this.velocityUniforms.speedLimit.value=this.options.speedLimit,this.velocityUniforms.cohesionDistance.value=this.options.cohesion}onUpdate(){this.now=performance.now(),this.last||(this.last=this.now);let t=(this.now-this.last)/1e3;return t>1&&(t=1),this.last=this.now,this.positionUniforms.time.value=this.now,this.positionUniforms.delta.value=t,this.velocityUniforms.time.value=this.now,this.velocityUniforms.delta.value=t,this.birdUniforms.time.value=this.now,this.birdUniforms.delta.value=t,this.velocityUniforms.predator.value.set(this.mouseX,-this.mouseY,0),this.mouseX=1e4,this.mouseY=1e4,this.gpuCompute.compute(),this.birdUniforms.texturePosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionVariable).texture,this.birdUniforms.textureVelocity.value=this.gpuCompute.getCurrentRenderTarget(this.velocityVariable).texture}onMouseMove(t,e){return this.mouseX=t-.5,this.mouseY=e-.5}onDestroy(){}onResize(){}}s.initClass(),n.a.register("BIRDS",s)}]),$((function(){$(".page-container").scrollbar().addClass("scrollbar-macosx"),$(".scrollable").scrollbar().addClass("scrollbar-macosx"),$.fn.selectListTrigger=function(t){return this.each((function(){!function(t,e){if(t.fireEvent)t.fireEvent("on"+e);else{var i=document.createEvent("Events");i.initEvent(e,!0,!1),t.dispatchEvent(i)}}($(this).get(0),t)}))},$('[data-init-plugin="select2"]').on("select2:select",(function(t){$(this).selectListTrigger("change")})),$("body").on("click",".requestModal",(function(){let t=$(this).attr("data-type");t&&$(this).closest(".parentContainer").find('.modalContainer[data-type="'+t+'"]').modal("show")})),$("body").on("click",".tabButton",(function(){let t=$(this).attr("tab-name");$(this).closest(".tabsContainer").find(".tabButton").not($(this).closest(".tabsContainer").find(".tabsContainer .tabButton")).removeClass("active"),$(this).addClass("active"),$(this).closest(".tabsContainer").find(".tabContent:not(.hide)").not($(this).closest(".tabsContainer").find(".tabsContainer .tabContent")).addClass("hide"),$(this).closest(".tabsContainer").find('.tabContent[tab-name="'+t+'"]').not($(this).closest(".tabsContainer").find(".tabsContainer .tabContent")).removeClass("hide")})),$(".scrollable").scrollbar().addClass("scrollbar-macosx"),$("#maintenanceContainer").length>0&&VANTA.BIRDS({el:"#maintenanceContainer",backgroundColor:16382457,wingSpan:40,separation:100,alignment:100,cohesion:100,quantity:2}),$.fn.select2.defaults.set("theme","bootstrap"),$.fn.select2.defaults.set("containerCssClass","form-control")}));