!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='";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+='
");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