1/*! For license information please see bundle.13f89e5b1721ed5ba87d.js.LICENSE.txt */
2(()=>{var t={369:(t,e,n)=>{"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}const i=Object;var o=n(299);const a=o.first,s=o.strlen,l=(t,e)=>{const n=(t,e)=>t.reduce(((t,e)=>e.map(((e,n)=>[].concat(r(t[n]||[]),[e])))),[]).map((t=>e.apply(void 0,r(t)))),o=t.map((t=>t.map((t=>t.replace(/\n/g,"\\n"))))),l=o.map((t=>t.map(s))),c=n(l,Math.max),u=i.assign({delimiter:" ",minColumnWidths:c.map((t=>0)),maxTotalWidth:0},e),h=s(u.delimiter),d=c.reduce(((t,e)=>t+e),0),p=c.map((t=>t/d)),f=u.maxTotalWidth-h*(c.length-1),m=Math.max(0,d-f),g=n([u.minColumnWidths,c,p],((t,e,n)=>Math.max(t,Math.floor(e-m*n)))),v=l.map((t=>n([g,t],((t,e)=>t-e))));return n([o,v],((t,e)=>n([t,e],((t,e)=>{return e>=0?u.right?" ".repeat(e)+t:t+" ".repeat(e):(n=t,r=s(t)+e,a(n,r-1)+"…");var n,r})).join(u.delimiter)))},c=t=>i.assign((e=>{var n;if(e[0]&&Array.isArray(e[0]))return l(e.map((e=>e.map(((e,n)=>void 0===e?"":t.print(e,n))))),t).join("\n");const o=[].concat(r(new Set((n=[]).concat.apply(n,r(e.map(i.keys)))))),a=[o.map(t.title)].concat(r(e.map((e=>o.map((n=>void 0===e[n]?"":t.print(e[n],n))))))),c=l(a,t);return(t.dash?[c[0],t.dash.repeat(s(c[0]))].concat(r(c.slice(1))):c).join("\n")}),t,{configure:e=>c(i.assign({},t,e))});t.exports=c({maxTotalWidth:Number.MAX_SAFE_INTEGER,print:String,title:String,dash:"-",right:!1})},386:(t,e,n)=>{"use strict";n.r(e),n.d(e,{getBoard:()=>s});var r=n(212),i=n(637),o=n(962);const a=new r.MeshPhongMaterial;a.color=new r.Color(o.groundColor);const s=()=>new Promise(((t,e)=>{(new i.j).load("./models/Board.stl",(function(e){const n=new r.Mesh(e,a);e.center(),n.scale.set(o.boardScale,o.boardScale,o.boardScale),n.rotateX(-Math.PI/2),n.castShadow=!0,n.receiveShadow=!0,t(n)}),(()=>{}),(t=>{e("Cannot load board model: "+t)}))}))},962:(t,e,n)=>{"use strict";n.r(e),n.d(e,{groundColor:()=>r,floorColor:()=>i,lightColor:()=>o,skyColor:()=>a,houseColor:()=>s,houseScale:()=>h,boardScale:()=>p,cupolaColor:()=>l,workerColor1:()=>c,workerColor2:()=>u,workerScale:()=>d});const r=3120717,i=8413251,o=16777215,a=3902417,s=16764879,l=3902463,c=13467442,u=3902463,h=.096,d=.08,p=.15},153:(t,e,n)=>{"use strict";n.r(e),n.d(e,{getHouse:()=>s,getLv1House:()=>l,getLv2House:()=>c,getLv3House:()=>u,getCupola:()=>h});var r=n(212),i=n(637),o=n(962);const a={1:"./models/Lvl1_v1.stl",2:"./models/Lvl2_V1.stl",3:"./models/Lvl3_b3.stl"},s=(t=1)=>()=>{const e=new r.MeshPhongMaterial;return e.color=new r.Color(o.houseColor),new Promise(((n,s)=>{let l;(new i.j).load(a[t.toString()],(function(t){return l=new r.Mesh(t,e),l.scale.set(o.houseScale,o.houseScale,o.houseScale),l.castShadow=!1,l.receiveShadow=!1,l.material.transparent=!0,l.material.opacity=0,l.position.y=100,n(l)}),(()=>{}),(t=>{s("Cannot load lv1 house model: "+t)}))}))},l=s(1),c=s(2),u=s(3),h=()=>{const t=new r.MeshPhongMaterial;return t.color=new r.Color(o.cupolaColor),new Promise(((e,n)=>{let a;(new i.j).load("./models/Dome_b.stl",(function(n){return a=new r.Mesh(n,t),a.scale.set(o.houseScale,o.houseScale,o.houseScale),a.castShadow=!1,a.receiveShadow=!1,a.material.transparent=!0,a.material.opacity=0,e(a)}),(()=>{}),(t=>{n("Cannot load cupola model: "+t)}))}))}},602:(t,e,n)=>{"use strict";n.r(e),n.d(e,{workerColorMap:()=>s,getWorker:()=>l,getFemaleWorker:()=>c,getMaleWorker:()=>u});var r=n(212),i=n(637),o=n(962);const a={F:"./models/Worker_F1_final.stl",M:"./models/Worker_M1_final.stl"},s=[o.workerColor1,o.workerColor2],l=t=>()=>{const e=new r.MeshPhongMaterial;return e.color=new r.Color(16777215),new Promise(((n,s)=>{(new i.j).load(a[t],(function(t){const i=new r.Mesh(t,e);t.center(),i.scale.set(o.workerScale,o.workerScale,o.workerScale),i.rotateX(-Math.PI/2),i.material.transparent=!0,i.material.opacity=.5,i.receiveShadow=!0,i.position.y=1.1,n(i)}),(()=>{}),(t=>{s("Cannot load worker model: "+t)}))}))},c=l("F"),u=l("M")},376:(t,e,n)=>{"use strict";function r(t,e){var n=t.__state.conversionName.toString(),r=Math.round(t.r),i=Math.round(t.g),o=Math.round(t.b),a=t.a,s=Math.round(t.h),l=t.s.toFixed(1),c=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var u=t.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===n?"rgb("+r+","+i+","+o+")":"CSS_RGBA"===n?"rgba("+r+","+i+","+o+","+a+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+r+","+i+","+o+"]":"RGBA_ARRAY"===n?"["+r+","+i+","+o+","+a+"]":"RGB_OBJ"===n?"{r:"+r+",g:"+i+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+r+",g:"+i+",b:"+o+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+l+",v:"+c+",a:"+a+"}":"unknown format"}n.r(e),n.d(e,{color:()=>ut,controllers:()=>ht,dom:()=>dt,gui:()=>pt,GUI:()=>ft,default:()=>mt});var i=Array.prototype.forEach,o=Array.prototype.slice,a={BREAK:{},extend:function(t){return this.each(o.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))}),this),t},defaults:function(t){return this.each(o.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))}),this),t},compose:function(){var t=o.call(arguments);return function(){for(var e=o.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(i&&t.forEach&&t.forEach===i)t.forEach(e,n);else if(t.length===t.length+0){var r,o=void 0;for(o=0,r=t.length;o<r;o++)if(o in t&&e.call(n,t[o],o)===this.BREAK)return}else for(var a in t)if(e.call(n,t[a],a)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var r=void 0;return function(){var i=this,o=arguments;function a(){r=null,n||t.apply(i,o)}var s=n||!r;clearTimeout(r),r=setTimeout(a,e),s&&t.apply(i,o)}},toArray:function(t){return t.toArray?t.toArray():o.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},s=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:r},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:r},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:r},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:r}}},{litmus:a.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:a.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(a.isNumber(t.r)&&a.isNumber(t.g)&&a.isNumber(t.b)&&a.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(a.isNumber(t.r)&&a.isNumber(t.g)&&a.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(a.isNumber(t.h)&&a.isNumber(t.s)&&a.isNumber(t.v)&&a.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(a.isNumber(t.h)&&a.isNumber(t.s)&&a.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],l=void 0,c=void 0,u=function(){c=!1;var t=arguments.length>1?a.toArray(arguments):arguments[0];return a.each(s,(function(e){if(e.litmus(t))return a.each(e.conversions,(function(e,n){if(l=e.read(t),!1===c&&!1!==l)return c=l,l.conversionName=n,l.conversion=e,a.BREAK})),a.BREAK})),c},h=void 0,d={hsv_to_rgb:function(t,e,n){var r=Math.floor(t/60)%6,i=t/60-Math.floor(t/60),o=n*(1-e),a=n*(1-i*e),s=n*(1-(1-i)*e),l=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][r];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,n){var r=Math.min(t,e,n),i=Math.max(t,e,n),o=i-r,a=void 0;return 0===i?{h:NaN,s:0,v:0}:(a=t===i?(e-n)/o:e===i?2+(n-t)/o:4+(t-e)/o,(a/=6)<0&&(a+=1),{h:360*a,s:o/i,v:i/255})},rgb_to_hex:function(t,e,n){var r=this.hex_with_component(0,2,t);return r=this.hex_with_component(r,1,e),this.hex_with_component(r,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(h=8*e)|t&~(255<<h)}},p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},m=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),g=function t(e,n,r){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,n);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0},v=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},y=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},_=function(){function t(){if(f(this,t),this.__state=u.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return m(t,[{key:"toString",value:function(){return r(this)}},{key:"toHexString",value:function(){return r(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function x(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||_.recalculateRGB(this,e,n),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(_.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function b(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||_.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(_.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}_.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=d.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");a.extend(t.__state,d.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},_.recalculateHSV=function(t){var e=d.rgb_to_hsv(t.r,t.g,t.b);a.extend(t.__state,{s:e.s,v:e.v}),a.isNaN(e.h)?a.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},_.COMPONENTS=["r","g","b","h","s","v","hex","a"],x(_.prototype,"r",2),x(_.prototype,"g",1),x(_.prototype,"b",0),b(_.prototype,"h"),b(_.prototype,"s"),b(_.prototype,"v"),Object.defineProperty(_.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(_.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=d.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var w=function(){function t(e,n){f(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return m(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),M={};a.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){a.each(t,(function(t){M[t]=e}))}));var S=/(\d+(\.\d+)?)px/;function E(t){if("0"===t||a.isUndefined(t))return 0;var e=t.match(S);return a.isNull(e)?0:parseFloat(e[1])}var T={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,n){var r=n,i=e;a.isUndefined(i)&&(i=!0),a.isUndefined(r)&&(r=!0),t.style.position="absolute",i&&(t.style.left=0,t.style.right=0),r&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,r){var i=n||{},o=M[e];if(!o)throw new Error("Event type "+e+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var l=i.x||i.clientX||0,c=i.y||i.clientY||0;s.initMouseEvent(e,i.bubbles||!1,i.cancelable||!0,window,i.clickCount||1,0,0,l,c,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var u=s.initKeyboardEvent||s.initKeyEvent;a.defaults(i,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),u(e,i.bubbles||!1,i.cancelable,window,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.keyCode,i.charCode);break;default:s.initEvent(e,i.bubbles||!1,i.cancelable||!0)}a.defaults(s,r),t.dispatchEvent(s)},bind:function(t,e,n,r){var i=r||!1;return t.addEventListener?t.addEventListener(e,n,i):t.attachEvent&&t.attachEvent("on"+e,n),T},unbind:function(t,e,n,r){var i=r||!1;return t.removeEventListener?t.removeEventListener(e,n,i):t.detachEvent&&t.detachEvent("on"+e,n),T},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return T},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),r=n.indexOf(e);-1!==r&&(n.splice(r,1),t.className=n.join(" "))}else t.className=void 0;return T},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return E(e["border-left-width"])+E(e["border-right-width"])+E(e["padding-left"])+E(e["padding-right"])+E(e.width)},getHeight:function(t){var e=getComputedStyle(t);return E(e["border-top-width"])+E(e["border-bottom-width"])+E(e["padding-top"])+E(e["padding-bottom"])+E(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},A=function(t){function e(t,n){f(this,e);var r=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),i=r;return r.__prev=r.getValue(),r.__checkbox=document.createElement("input"),r.__checkbox.setAttribute("type","checkbox"),T.bind(r.__checkbox,"change",(function(){i.setValue(!i.__prev)}),!1),r.domElement.appendChild(r.__checkbox),r.updateDisplay(),r}return v(e,t),m(e,[{key:"setValue",value:function(t){var n=g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(w),L=function(t){function e(t,n,r){f(this,e);var i=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r,s=i;if(i.__select=document.createElement("select"),a.isArray(o)){var l={};a.each(o,(function(t){l[t]=t})),o=l}return a.each(o,(function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),s.__select.appendChild(n)})),i.updateDisplay(),T.bind(i.__select,"change",(function(){var t=this.options[this.selectedIndex].value;s.setValue(t)})),i.domElement.appendChild(i.__select),i}return v(e,t),m(e,[{key:"setValue",value:function(t){var n=g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return T.isActive(this.__select)?this:(this.__select.value=this.getValue(),g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(w),C=function(t){function e(t,n){f(this,e);var r=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),i=r;function o(){i.setValue(i.__input.value)}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),T.bind(r.__input,"keyup",o),T.bind(r.__input,"change",o),T.bind(r.__input,"blur",(function(){i.__onFinishChange&&i.__onFinishChange.call(i,i.getValue())})),T.bind(r.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return v(e,t),m(e,[{key:"updateDisplay",value:function(){return T.isActive(this.__input)||(this.__input.value=this.getValue()),g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(w);function R(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var P=function(t){function e(t,n,r){f(this,e);var i=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r||{};return i.__min=o.min,i.__max=o.max,i.__step=o.step,a.isUndefined(i.__step)?0===i.initialValue?i.__impliedStep=1:i.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(i.initialValue))/Math.LN10))/10:i.__impliedStep=i.__step,i.__precision=R(i.__impliedStep),i}return v(e,t),m(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=R(t),this}}]),e}(w),O=function(t){function e(t,n,r){f(this,e);var i=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,r));i.__truncationSuspended=!1;var o=i,s=void 0;function l(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function c(t){var e=s-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),s=t.clientY}function u(){T.unbind(window,"mousemove",c),T.unbind(window,"mouseup",u),l()}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),T.bind(i.__input,"change",(function(){var t=parseFloat(o.__input.value);a.isNaN(t)||o.setValue(t)})),T.bind(i.__input,"blur",(function(){l()})),T.bind(i.__input,"mousedown",(function(t){T.bind(window,"mousemove",c),T.bind(window,"mouseup",u),s=t.clientY})),T.bind(i.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,l())})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return v(e,t),m(e,[{key:"updateDisplay",value:function(){var t,n,r;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,r=Math.pow(10,n),Math.round(t*r)/r),g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P);function D(t,e,n,r,i){return r+(t-e)/(n-e)*(i-r)}var I=function(t){function e(t,n,r,i,o){f(this,e);var a=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:r,max:i,step:o})),s=a;function l(t){t.preventDefault();var e=s.__background.getBoundingClientRect();return s.setValue(D(t.clientX,e.left,e.right,s.__min,s.__max)),!1}function c(){T.unbind(window,"mousemove",l),T.unbind(window,"mouseup",c),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function u(t){var e=t.touches[0].clientX,n=s.__background.getBoundingClientRect();s.setValue(D(e,n.left,n.right,s.__min,s.__max))}function h(){T.unbind(window,"touchmove",u),T.unbind(window,"touchend",h),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),T.bind(a.__background,"mousedown",(function(t){document.activeElement.blur(),T.bind(window,"mousemove",l),T.bind(window,"mouseup",c),l(t)})),T.bind(a.__background,"touchstart",(function(t){1===t.touches.length&&(T.bind(window,"touchmove",u),T.bind(window,"touchend",h),u(t))})),T.addClass(a.__background,"slider"),T.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return v(e,t),m(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(P),N=function(t){function e(t,n,r){f(this,e);var i=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===r?"Fire":r,T.bind(i.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),T.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return v(e,t),m(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(w),B=function(t){function e(t,n){f(this,e);var r=y(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));r.__color=new _(r.getValue()),r.__temp=new _(0);var i=r;r.domElement=document.createElement("div"),T.makeSelectable(r.domElement,!1),r.__selector=document.createElement("div"),r.__selector.className="selector",r.__saturation_field=document.createElement("div"),r.__saturation_field.className="saturation-field",r.__field_knob=document.createElement("div"),r.__field_knob.className="field-knob",r.__field_knob_border="2px solid ",r.__hue_knob=document.createElement("div"),r.__hue_knob.className="hue-knob",r.__hue_field=document.createElement("div"),r.__hue_field.className="hue-field",r.__input=document.createElement("input"),r.__input.type="text",r.__input_textShadow="0 1px 1px ",T.bind(r.__input,"keydown",(function(t){13===t.keyCode&&p.call(this)})),T.bind(r.__input,"blur",p),T.bind(r.__selector,"mousedown",(function(){T.addClass(this,"drag").bind(window,"mouseup",(function(){T.removeClass(i.__selector,"drag")}))})),T.bind(r.__selector,"touchstart",(function(){T.addClass(this,"drag").bind(window,"touchend",(function(){T.removeClass(i.__selector,"drag")}))}));var o,s=document.createElement("div");function l(t){g(t),T.bind(window,"mousemove",g),T.bind(window,"touchmove",g),T.bind(window,"mouseup",h),T.bind(window,"touchend",h)}function c(t){v(t),T.bind(window,"mousemove",v),T.bind(window,"touchmove",v),T.bind(window,"mouseup",d),T.bind(window,"touchend",d)}function h(){T.unbind(window,"mousemove",g),T.unbind(window,"touchmove",g),T.unbind(window,"mouseup",h),T.unbind(window,"touchend",h),m()}function d(){T.unbind(window,"mousemove",v),T.unbind(window,"touchmove",v),T.unbind(window,"mouseup",d),T.unbind(window,"touchend",d),m()}function p(){var t=u(this.value);!1!==t?(i.__color.__state=t,i.setValue(i.__color.toOriginal())):this.value=i.__color.toString()}function m(){i.__onFinishChange&&i.__onFinishChange.call(i,i.__color.toOriginal())}function g(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=i.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,r=n.clientX,o=n.clientY,a=(r-e.left)/(e.right-e.left),s=1-(o-e.top)/(e.bottom-e.top);return s>1?s=1:s<0&&(s=0),a>1?a=1:a<0&&(a=0),i.__color.v=s,i.__color.s=a,i.setValue(i.__color.toOriginal()),!1}function v(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=i.__hue_field.getBoundingClientRect(),n=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return n>1?n=1:n<0&&(n=0),i.__color.h=360*n,i.setValue(i.__color.toOriginal()),!1}return a.extend(r.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),a.extend(r.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:r.__field_knob_border+(r.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),a.extend(r.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),a.extend(r.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),a.extend(s.style,{width:"100%",height:"100%",background:"none"}),F(s,"top","rgba(0,0,0,0)","#000"),a.extend(r.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=r.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.extend(r.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:r.__input_textShadow+"rgba(0,0,0,0.7)"}),T.bind(r.__saturation_field,"mousedown",l),T.bind(r.__saturation_field,"touchstart",l),T.bind(r.__field_knob,"mousedown",l),T.bind(r.__field_knob,"touchstart",l),T.bind(r.__hue_field,"mousedown",c),T.bind(r.__hue_field,"touchstart",c),r.__saturation_field.appendChild(s),r.__selector.appendChild(r.__field_knob),r.__selector.appendChild(r.__saturation_field),r.__selector.appendChild(r.__hue_field),r.__hue_field.appendChild(r.__hue_knob),r.domElement.appendChild(r.__input),r.domElement.appendChild(r.__selector),r.updateDisplay(),r}return v(e,t),m(e,[{key:"updateDisplay",value:function(){var t=u(this.getValue());if(!1!==t){var e=!1;a.each(_.COMPONENTS,(function(n){if(!a.isUndefined(t[n])&&!a.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}}),this),e&&a.extend(this.__color.__state,t)}a.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,r=255-n;a.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,F(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),a.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+r+","+r+","+r+",.7)"})}}]),e}(w),z=["-moz-","-o-","-webkit-","-ms-",""];function F(t,e,n,r){t.style.background="",a.each(z,(function(i){t.style.cssText+="background: "+i+"linear-gradient("+e+", "+n+" 0%, "+r+" 100%); "}))}var H='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',k=function(t,e){var n=t[e];return a.isArray(arguments[2])||a.isObject(arguments[2])?new L(t,e,arguments[2]):a.isNumber(n)?a.isNumber(arguments[2])&&a.isNumber(arguments[3])?a.isNumber(arguments[4])?new I(t,e,arguments[2],arguments[3],arguments[4]):new I(t,e,arguments[2],arguments[3]):a.isNumber(arguments[4])?new O(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new O(t,e,{min:arguments[2],max:arguments[3]}):a.isString(n)?new C(t,e):a.isFunction(n)?new N(t,e,""):a.isBoolean(n)?new A(t,e):null},U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},G=function(){function t(){f(this,t),this.backgroundElement=document.createElement("div"),a.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),T.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),a.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;T.bind(this.backgroundElement,"click",(function(){e.hide()}))}return m(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),a.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",T.unbind(t.domElement,"webkitTransitionEnd",e),T.unbind(t.domElement,"transitionend",e),T.unbind(t.domElement,"oTransitionEnd",e)};T.bind(this.domElement,"webkitTransitionEnd",e),T.bind(this.domElement,"transitionend",e),T.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-T.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-T.getHeight(this.domElement)/2+"px"}}]),t}();!function(t,e){var n=e||document,r=document.createElement("style");r.type="text/css",r.innerHTML=t;var i=n.getElementsByTagName("head")[0];try{i.appendChild(r)}catch(t){}}(function(t){if("undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var V="Default",W=function(){try{return!!window.localStorage}catch(t){return!1}}(),j=void 0,q=!0,X=void 0,Y=!1,Z=[],J=function t(e){var n=this,r=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),T.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=a.defaults(r,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),r=a.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),a.isUndefined(r.load)?r.load={preset:V}:r.preset&&(r.load.preset=r.preset),a.isUndefined(r.parent)&&r.hideable&&Z.push(this),r.resizable=a.isUndefined(r.parent)&&r.resizable,r.autoPlace&&a.isUndefined(r.scrollable)&&(r.scrollable=!0);var i,o=W&&"true"===localStorage.getItem(nt(0,"isLocal")),s=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:r.load.preset},set:function(t){n.parent?n.getRoot().preset=t:r.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),n.revert()}},width:{get:function(){return r.width},set:function(t){r.width=t,st(n,t)}},name:{get:function(){return r.name},set:function(t){r.name=t,l&&(l.innerHTML=r.name)}},closed:{get:function(){return r.closed},set:function(e){r.closed=e,r.closed?T.addClass(n.__ul,t.CLASS_CLOSED):T.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return r.load}},useLocalStorage:{get:function(){return o},set:function(t){W&&(o=t,t?T.bind(window,"unload",s):T.unbind(window,"unload",s),localStorage.setItem(nt(0,"isLocal"),t))}}}),a.isUndefined(r.parent)){if(this.closed=r.closed||!1,T.addClass(this.domElement,t.CLASS_MAIN),T.makeSelectable(this.domElement,!1),W&&o){n.useLocalStorage=!0;var c=localStorage.getItem(nt(0,"gui"));c&&(r.load=JSON.parse(c))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,T.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),r.closeOnTop?(T.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(T.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),T.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===r.closed&&(r.closed=!0);var u=document.createTextNode(r.name);T.addClass(u,"controller-name"),l=K(n,u),T.addClass(this.__ul,t.CLASS_CLOSED),T.addClass(l,"title"),T.bind(l,"click",(function(t){return t.preventDefault(),n.closed=!n.closed,!1})),r.closed||(this.closed=!1)}r.autoPlace&&(a.isUndefined(r.parent)&&(q&&(X=document.createElement("div"),T.addClass(X,"dg"),T.addClass(X,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(X),q=!1),X.appendChild(this.domElement),T.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||st(n,r.width)),this.__resizeHandler=function(){n.onResizeDebounced()},T.bind(window,"resize",this.__resizeHandler),T.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),T.bind(this.__ul,"transitionend",this.__resizeHandler),T.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),r.resizable&&at(this),s=function(){W&&"true"===localStorage.getItem(nt(0,"isLocal"))&&localStorage.setItem(nt(0,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,r.parent||((i=n.getRoot()).width+=1,a.defer((function(){i.width-=1})))};function K(t,e,n){var r=document.createElement("li");return e&&r.appendChild(e),n?t.__ul.insertBefore(r,n):t.__ul.appendChild(r),t.onResize(),r}function Q(t){T.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&T.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function $(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function tt(t,e){var n=t.getRoot(),r=n.__rememberedObjects.indexOf(e.object);if(-1!==r){var i=n.__rememberedObjectIndecesToControllers[r];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[r]=i),i[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,a=void 0;if(o[t.preset])a=o[t.preset];else{if(!o.Default)return;a=o.Default}if(a[r]&&void 0!==a[r][e.property]){var s=a[r][e.property];e.initialValue=s,e.setValue(s)}}}}function et(t,e,n,r){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var i=void 0;if(r.color)i=new B(e,n);else{var o=[e,n].concat(r.factoryArgs);i=k.apply(t,o)}r.before instanceof w&&(r.before=r.before.__li),tt(t,i),T.addClass(i.domElement,"c");var s=document.createElement("span");T.addClass(s,"property-name"),s.innerHTML=i.property;var l=document.createElement("div");l.appendChild(s),l.appendChild(i.domElement);var c=K(t,l,r.before);return T.addClass(c,J.CLASS_CONTROLLER_ROW),i instanceof B?T.addClass(c,"color"):T.addClass(c,p(i.getValue())),function(t,e,n){if(n.__li=e,n.__gui=t,a.extend(n,{options:function(e){if(arguments.length>1){var r=n.__li.nextElementSibling;return n.remove(),et(t,n.object,n.property,{before:r,factoryArgs:[a.toArray(arguments)]})}if(a.isArray(e)||a.isObject(e)){var i=n.__li.nextElementSibling;return n.remove(),et(t,n.object,n.property,{before:i,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof I){var r=new O(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});a.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=n[t],i=r[t];n[t]=r[t]=function(){var t=Array.prototype.slice.call(arguments);return i.apply(r,t),e.apply(n,t)}})),T.addClass(e,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof O){var i=function(e){if(a.isNumber(n.__min)&&a.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,i=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=et(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(r),i&&o.listen(),o}return e};n.min=a.compose(i,n.min),n.max=a.compose(i,n.max)}else n instanceof A?(T.bind(e,"click",(function(){T.fakeEvent(n.__checkbox,"click")})),T.bind(n.__checkbox,"click",(function(t){t.stopPropagation()}))):n instanceof N?(T.bind(e,"click",(function(){T.fakeEvent(n.__button,"click")})),T.bind(e,"mouseover",(function(){T.addClass(n.__button,"hover")})),T.bind(e,"mouseout",(function(){T.removeClass(n.__button,"hover")}))):n instanceof B&&(T.addClass(e,"color"),n.updateDisplay=a.compose((function(t){return e.style.borderLeftColor=n.__color.toString(),t}),n.updateDisplay),n.updateDisplay());n.setValue=a.compose((function(e){return t.getRoot().__preset_select&&n.isModified()&&$(t.getRoot(),!0),e}),n.setValue)}(t,c,i),t.__controllers.push(i),i}function nt(t,e){return document.location.href+"."+e}function rt(t,e,n){var r=document.createElement("option");r.innerHTML=e,r.value=e,t.__preset_select.appendChild(r),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function it(t,e){e.style.display=t.useLocalStorage?"block":"none"}function ot(t){var e=t.__save_row=document.createElement("li");T.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),T.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML=" ",T.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",T.addClass(r,"button"),T.addClass(r,"save");var i=document.createElement("span");i.innerHTML="New",T.addClass(i,"button"),T.addClass(i,"save-as");var o=document.createElement("span");o.innerHTML="Revert",T.addClass(o,"button"),T.addClass(o,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?a.each(t.load.remembered,(function(e,n){rt(t,n,n===t.preset)})):rt(t,V,!1),T.bind(s,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(s),e.appendChild(n),e.appendChild(r),e.appendChild(i),e.appendChild(o),W){var l=document.getElementById("dg-local-explain"),c=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(nt(0,"isLocal"))&&c.setAttribute("checked","checked"),it(t,l),T.bind(c,"change",(function(){t.useLocalStorage=!t.useLocalStorage,it(t,l)}))}var u=document.getElementById("dg-new-constructor");T.bind(u,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||j.hide()})),T.bind(n,"click",(function(){u.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),j.show(),u.focus(),u.select()})),T.bind(r,"click",(function(){t.save()})),T.bind(i,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),T.bind(o,"click",(function(){t.revert()}))}function at(t){var e=void 0;function n(n){return n.preventDefault(),t.width+=e-n.clientX,t.onResize(),e=n.clientX,!1}function r(){T.removeClass(t.__closeButton,J.CLASS_DRAG),T.unbind(window,"mousemove",n),T.unbind(window,"mouseup",r)}function i(i){return i.preventDefault(),e=i.clientX,T.addClass(t.__closeButton,J.CLASS_DRAG),T.bind(window,"mousemove",n),T.bind(window,"mouseup",r),!1}t.__resize_handle=document.createElement("div"),a.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),T.bind(t.__resize_handle,"mousedown",i),T.bind(t.__closeButton,"mousedown",i),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function st(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function lt(t,e){var n={};return a.each(t.__rememberedObjects,(function(r,i){var o={},s=t.__rememberedObjectIndecesToControllers[i];a.each(s,(function(t,n){o[n]=e?t.initialValue:t.getValue()})),n[i]=o})),n}function ct(t){0!==t.length&&U.call(window,(function(){ct(t)})),a.each(t,(function(t){t.updateDisplay()}))}J.toggleHide=function(){Y=!Y,a.each(Z,(function(t){t.domElement.style.display=Y?"none":""}))},J.CLASS_AUTO_PLACE="a",J.CLASS_AUTO_PLACE_CONTAINER="ac",J.CLASS_MAIN="main",J.CLASS_CONTROLLER_ROW="cr",J.CLASS_TOO_TALL="taller-than-window",J.CLASS_CLOSED="closed",J.CLASS_CLOSE_BUTTON="close-button",J.CLASS_CLOSE_TOP="close-top",J.CLASS_CLOSE_BOTTOM="close-bottom",J.CLASS_DRAG="drag",J.DEFAULT_WIDTH=245,J.TEXT_CLOSED="Close Controls",J.TEXT_OPEN="Open Controls",J._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||J.toggleHide()},T.bind(window,"keydown",J._keydownHandler,!1),a.extend(J.prototype,{add:function(t,e){return et(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return et(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;a.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&X.removeChild(this.domElement);var t=this;a.each(this.__folders,(function(e){t.removeFolder(e)})),T.unbind(window,"keydown",J._keydownHandler,!1),Q(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new J(e);this.__folders[t]=n;var r=K(this,n.domElement);return T.addClass(r,"folder"),n},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],Q(t);var e=this;a.each(t.__folders,(function(e){t.removeFolder(e)})),a.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=T.getOffset(t.__ul).top,n=0;a.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(n+=T.getHeight(e))})),window.innerHeight-e-20<n?(T.addClass(t.domElement,J.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(T.removeClass(t.domElement,J.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&a.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:a.debounce((function(){this.onResize()}),50),remember:function(){if(a.isUndefined(j)&&((j=new G).domElement.innerHTML=H),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;a.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&ot(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&st(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=lt(this)),t.folders={},a.each(this.__folders,(function(e,n){t.folders[n]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=lt(this),$(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=lt(this,!0)),this.load.remembered[t]=lt(this),this.preset=t,rt(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){a.each(this.__controllers,(function(e){this.getRoot().load.remembered?tt(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),a.each(this.__folders,(function(t){t.revert(t)})),t||$(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&ct(this.__listening)},updateDisplay:function(){a.each(this.__controllers,(function(t){t.updateDisplay()})),a.each(this.__folders,(function(t){t.updateDisplay()}))}});var ut={Color:_,math:d,interpret:u},ht={Controller:w,BooleanController:A,OptionController:L,StringController:C,NumberController:P,NumberControllerBox:O,NumberControllerSlider:I,FunctionController:N,ColorController:B},dt={dom:T},pt={GUI:J},ft=J;const mt={color:ut,controllers:ht,dom:dt,gui:pt,GUI:J}},858:t=>{"use strict";t.exports=function(t){if(!/^data\:/i.test(t))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');var e=(t=t.replace(/\r?\n/g,"")).indexOf(",");if(-1===e||e<=4)throw new TypeError("malformed data: URI");for(var n=t.substring(5,e).split(";"),r=n[0]||"text/plain",i=r,o=!1,a="",s=1;s<n.length;s++)"base64"==n[s]?o=!0:(i+=";"+n[s],0==n[s].indexOf("charset=")&&(a=n[s].substring(8)));n[0]||a.length||(i+=";charset=US-ASCII",a="US-ASCII");var l=unescape(t.substring(e+1)),c=o?"base64":"ascii",u=Buffer.from?Buffer.from(l,c):new Buffer(l,c);return u.type=r,u.typeFull=i,u.charset=a,u}},144:(t,e,n)=>{"use strict";t=n.nmd(t);const{assign:r}=Object,i="undefined"!=typeof window&&window.window===window&&window.navigator,o=n(741).SourceMapConsumer,a=n(526),s=n(472),l=n(858),c=i?null:t.require,u=t=>{const e=n=>n in e.cache?e.cache[n]:e.cache[n]=t(n);return e.forgetEverything=()=>{e.cache=Object.create(null)},e.cache=Object.create(null),e};function h(t,e){const n=e?a:Promise,i=u((e=>c(e,t(e))));function c(t,h){return void 0===h?i(s.resolve(t)):n.resolve(h).then((n=>{let i,h,d,p=t=>(d=d||function(t){const e=/\u0023 sourceMappingURL=(.+)\n?/g;let n;for(;;){const r=e.exec(t.text);if(!r)break;n=r}const i=n&&n[1],a=e=>r({},e,{sourceFile:t,sourceLine:t.lines[e.line-1]||""});return i?function(t,e,n){const i=e.startsWith("data:")?c(t,l(e).toString()):c(s.relativeToFile(t,e)),a=i.then((t=>o(JSON.parse(t.text)))),h=u((function(t){return i.then((e=>{const n=s.relativeToFile(e.path,t);return a.then((e=>c(n,e.sourceContentFor(t,!0)||void 0)))}))}));return t=>a.then((e=>{const i=e.originalPositionFor(t);return i.source?h(i.source).then((e=>e._resolve(r({},t,{line:i.line,column:i.column+1,name:i.name})))):n(t)})).catch((e=>r(n(t),{sourceMapError:e})))}(t.path,i,a):a}(i))(t);return i={path:t,text:n,get lines(){return h=h||n.split("\n")},resolve(t){const n=p(t);if(!e)return Promise.resolve(n);try{return a.valueFrom(n)}catch(e){return r({},t,{error:e})}},_resolve:p}}))}return r((function(t){const n=c(t);if(e)try{return a.valueFrom(n)}catch(e){const n={path:t,text:"",lines:[],error:e,resolve:t=>r({},t,{error:e,sourceLine:"",sourceFile:n})};return n}return n}),{resetCache:()=>i.forgetEverything(),getCache:()=>i.cache})}t.exports=h((function(t){return new a((e=>{if(i){let n=new XMLHttpRequest;n.open("GET",t,!1),n.send(null),e(n.responseText)}else e(c("fs").readFileSync(t,{encoding:"utf8"}))}))}),!0),t.exports.async=h((function(t){return new Promise(((e,n)=>{if(i){let r=new XMLHttpRequest;r.open("GET",t),r.onreadystatechange=t=>{4===r.readyState&&(200===r.status?e(r.responseText):n(new Error(r.statusText)))},r.send(null)}else c("fs").readFile(t,{encoding:"utf8"},((t,r)=>{t?n(t):e(r)}))}))}))},526:t=>{"use strict";t.exports=class t{constructor(t){try{t((t=>{this.setValue(t,!1)}),(t=>{this.setValue(t,!0)}))}catch(t){this.setValue(t,!0)}}setValue(e,n){this.val=e instanceof t?e.val:e,this.rejected=n||e instanceof t&&e.rejected}static valueFrom(e){if(e instanceof t){if(e.rejected)throw e.val;return e.val}return e}then(e){try{if(!this.rejected)return t.resolve(e(this.val))}catch(e){return t.reject(e)}return this}catch(e){try{if(this.rejected)return t.resolve(e(this.val))}catch(e){return t.reject(e)}return this}static resolve(e){return new t((t=>{t(e)}))}static reject(e){return new t(((t,n)=>{n(e)}))}}},472:t=>{"use strict";const e="undefined"!=typeof window&&window.window===window&&window.navigator,n=e?window.location.href:process.cwd(),r=new RegExp("^((https|http)://)?[a-z0-9A-Z]{3}.[a-z0-9A-Z][a-z0-9A-Z]{0,61}?[a-z0-9A-Z].com|net|cn|cc (:s[0-9]{1-4})?/$"),i=t.exports={concat(t,e){const n="/"===t[t.length-1],r="/"===e[0];return t+(n||r?"":"/")+(n&&r?e.substring(1):e)},resolve:t=>i.isAbsolute(t)?i.normalize(t):i.normalize(i.concat(n,t)),normalize(t){let n=[],r=0;t.split("/").reverse().filter((t=>"."!==t)).forEach((t=>{".."===t?r++:0===r?n.push(t):r--}));const i=n.reverse().join("/");return(e&&"/"===i[0]?"/"===i[1]?window.location.protocol:window.location.origin:"")+i},isData:t=>0===t.indexOf("data:"),isURL:t=>r.test(t),isAbsolute:t=>"/"===t[0]||/^[^\/]*:/.test(t),relativeToFile:(t,e)=>i.isData(t)||i.isAbsolute(e)?i.normalize(e):i.normalize(i.concat(t.split("/").slice(0,-1).join("/"),e))}},805:(t,e,n)=>{var r=n(798),i=Object.prototype.hasOwnProperty,o="undefined"!=typeof Map;function a(){this._array=[],this._set=o?new Map:Object.create(null)}a.fromArray=function(t,e){for(var n=new a,r=0,i=t.length;r<i;r++)n.add(t[r],e);return n},a.prototype.size=function(){return o?this._set.size:Object.getOwnPropertyNames(this._set).length},a.prototype.add=function(t,e){var n=o?t:r.toSetString(t),a=o?this.has(t):i.call(this._set,n),s=this._array.length;a&&!e||this._array.push(t),a||(o?this._set.set(t,s):this._set[n]=s)},a.prototype.has=function(t){if(o)return this._set.has(t);var e=r.toSetString(t);return i.call(this._set,e)},a.prototype.indexOf=function(t){if(o){var e=this._set.get(t);if(e>=0)return e}else{var n=r.toSetString(t);if(i.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')},a.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)},a.prototype.toArray=function(){return this._array.slice()},e.I=a},588:(t,e,n)=>{var r=n(757);e.encode=function(t){var e,n="",i=function(t){return t<0?1+(-t<<1):0+(t<<1)}(t);do{e=31&i,(i>>>=5)>0&&(e|=32),n+=r.encode(e)}while(i>0);return n},e.decode=function(t,e,n){var i,o,a,s,l=t.length,c=0,u=0;do{if(e>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=r.decode(t.charCodeAt(e++))))throw new Error("Invalid base64 digit: "+t.charAt(e-1));i=!!(32&o),c+=(o&=31)<<u,u+=5}while(i);n.value=(s=(a=c)>>1,1==(1&a)?-s:s),n.rest=e}},757:(t,e)=>{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");e.encode=function(t){if(0<=t&&t<n.length)return n[t];throw new TypeError("Must be between 0 and 63: "+t)},e.decode=function(t){return 65<=t&&t<=90?t-65:97<=t&&t<=122?t-97+26:48<=t&&t<=57?t-48+52:43==t?62:47==t?63:-1}},614:(t,e)=>{function n(t,r,i,o,a,s){var l=Math.floor((r-t)/2)+t,c=a(i,o[l],!0);return 0===c?l:c>0?r-l>1?n(l,r,i,o,a,s):s==e.LEAST_UPPER_BOUND?r<o.length?r:-1:l:l-t>1?n(t,l,i,o,a,s):s==e.LEAST_UPPER_BOUND?l:t<0?-1:t}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(t,r,i,o){if(0===r.length)return-1;var a=n(-1,r.length,t,r,i,o||e.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===i(r[a],r[a-1],!0);)--a;return a}},293:(t,e,n)=>{var r=n(798);function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}i.prototype.unsortedForEach=function(t,e){this._array.forEach(t,e)},i.prototype.add=function(t){var e,n,i,o,a,s;n=t,i=(e=this._last).generatedLine,o=n.generatedLine,a=e.generatedColumn,s=n.generatedColumn,o>i||o==i&&s>=a||r.compareByGeneratedPositionsInflated(e,n)<=0?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(r.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},e.H=i},700:(t,e)=>{function n(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function r(t,e,i,o){if(i<o){var a=i-1;n(t,(u=i,h=o,Math.round(u+Math.random()*(h-u))),o);for(var s=t[o],l=i;l<o;l++)e(t[l],s)<=0&&n(t,a+=1,l);n(t,a+1,l);var c=a+1;r(t,e,i,c-1),r(t,e,c+1,o)}var u,h}e.U=function(t,e){r(t,e,0,t.length-1)}},965:(t,e,n)=>{var r=n(798),i=n(614),o=n(805).I,a=n(588),s=n(700).U;function l(t,e){var n=t;return"string"==typeof t&&(n=r.parseSourceMapInput(t)),null!=n.sections?new h(n,e):new c(n,e)}function c(t,e){var n=t;"string"==typeof t&&(n=r.parseSourceMapInput(t));var i=r.getArg(n,"version"),a=r.getArg(n,"sources"),s=r.getArg(n,"names",[]),l=r.getArg(n,"sourceRoot",null),c=r.getArg(n,"sourcesContent",null),u=r.getArg(n,"mappings"),h=r.getArg(n,"file",null);if(i!=this._version)throw new Error("Unsupported version: "+i);l&&(l=r.normalize(l)),a=a.map(String).map(r.normalize).map((function(t){return l&&r.isAbsolute(l)&&r.isAbsolute(t)?r.relative(l,t):t})),this._names=o.fromArray(s.map(String),!0),this._sources=o.fromArray(a,!0),this._absoluteSources=this._sources.toArray().map((function(t){return r.computeSourceURL(l,t,e)})),this.sourceRoot=l,this.sourcesContent=c,this._mappings=u,this._sourceMapURL=e,this.file=h}function u(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function h(t,e){var n=t;"string"==typeof t&&(n=r.parseSourceMapInput(t));var i=r.getArg(n,"version"),a=r.getArg(n,"sections");if(i!=this._version)throw new Error("Unsupported version: "+i);this._sources=new o,this._names=new o;var s={line:-1,column:0};this._sections=a.map((function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var n=r.getArg(t,"offset"),i=r.getArg(n,"line"),o=r.getArg(n,"column");if(i<s.line||i===s.line&&o<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=n,{generatedOffset:{generatedLine:i+1,generatedColumn:o+1},consumer:new l(r.getArg(t,"map"),e)}}))}l.fromSourceMap=function(t,e){return c.fromSourceMap(t,e)},l.prototype._version=3,l.prototype.__generatedMappings=null,Object.defineProperty(l.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),l.prototype.__originalMappings=null,Object.defineProperty(l.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),l.prototype._charIsMappingSeparator=function(t,e){var n=t.charAt(e);return";"===n||","===n},l.prototype._parseMappings=function(t,e){throw new Error("Subclasses must implement _parseMappings")},l.GENERATED_ORDER=1,l.ORIGINAL_ORDER=2,l.GREATEST_LOWER_BOUND=1,l.LEAST_UPPER_BOUND=2,l.prototype.eachMapping=function(t,e,n){var i,o=e||null;switch(n||l.GENERATED_ORDER){case l.GENERATED_ORDER:i=this._generatedMappings;break;case l.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;i.map((function(t){var e=null===t.source?null:this._sources.at(t.source);return{source:e=r.computeSourceURL(a,e,this._sourceMapURL),generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}}),this).forEach(t,o)},l.prototype.allGeneratedPositionsFor=function(t){var e=r.getArg(t,"line"),n={source:r.getArg(t,"source"),originalLine:e,originalColumn:r.getArg(t,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var o=[],a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var s=this._originalMappings[a];if(void 0===t.column)for(var l=s.originalLine;s&&s.originalLine===l;)o.push({line:r.getArg(s,"generatedLine",null),column:r.getArg(s,"generatedColumn",null),lastColumn:r.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var c=s.originalColumn;s&&s.originalLine===e&&s.originalColumn==c;)o.push({line:r.getArg(s,"generatedLine",null),column:r.getArg(s,"generatedColumn",null),lastColumn:r.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return o},e.SourceMapConsumer=l,c.prototype=Object.create(l.prototype),c.prototype.consumer=l,c.prototype._findSourceIndex=function(t){var e,n=t;if(null!=this.sourceRoot&&(n=r.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);for(e=0;e<this._absoluteSources.length;++e)if(this._absoluteSources[e]==t)return e;return-1},c.fromSourceMap=function(t,e){var n=Object.create(c.prototype),i=n._names=o.fromArray(t._names.toArray(),!0),a=n._sources=o.fromArray(t._sources.toArray(),!0);n.sourceRoot=t._sourceRoot,n.sourcesContent=t._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=t._file,n._sourceMapURL=e,n._absoluteSources=n._sources.toArray().map((function(t){return r.computeSourceURL(n.sourceRoot,t,e)}));for(var l=t._mappings.toArray().slice(),h=n.__generatedMappings=[],d=n.__originalMappings=[],p=0,f=l.length;p<f;p++){var m=l[p],g=new u;g.generatedLine=m.generatedLine,g.generatedColumn=m.generatedColumn,m.source&&(g.source=a.indexOf(m.source),g.originalLine=m.originalLine,g.originalColumn=m.originalColumn,m.name&&(g.name=i.indexOf(m.name)),d.push(g)),h.push(g)}return s(n.__originalMappings,r.compareByOriginalPositions),n},c.prototype._version=3,Object.defineProperty(c.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),c.prototype._parseMappings=function(t,e){for(var n,i,o,l,c,h=1,d=0,p=0,f=0,m=0,g=0,v=t.length,y=0,_={},x={},b=[],w=[];y<v;)if(";"===t.charAt(y))h++,y++,d=0;else if(","===t.charAt(y))y++;else{for((n=new u).generatedLine=h,l=y;l<v&&!this._charIsMappingSeparator(t,l);l++);if(o=_[i=t.slice(y,l)])y+=i.length;else{for(o=[];y<l;)a.decode(t,y,x),c=x.value,y=x.rest,o.push(c);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");_[i]=o}n.generatedColumn=d+o[0],d=n.generatedColumn,o.length>1&&(n.source=m+o[1],m+=o[1],n.originalLine=p+o[2],p=n.originalLine,n.originalLine+=1,n.originalColumn=f+o[3],f=n.originalColumn,o.length>4&&(n.name=g+o[4],g+=o[4])),w.push(n),"number"==typeof n.originalLine&&b.push(n)}s(w,r.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,s(b,r.compareByOriginalPositions),this.__originalMappings=b},c.prototype._findMapping=function(t,e,n,r,o,a){if(t[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[n]);if(t[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[r]);return i.search(t,e,o,a)},c.prototype.computeColumnSpans=function(){for(var t=0;t<this._generatedMappings.length;++t){var e=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var n=this._generatedMappings[t+1];if(e.generatedLine===n.generatedLine){e.lastGeneratedColumn=n.generatedColumn-1;continue}}e.lastGeneratedColumn=1/0}},c.prototype.originalPositionFor=function(t){var e={generatedLine:r.getArg(t,"line"),generatedColumn:r.getArg(t,"column")},n=this._findMapping(e,this._generatedMappings,"generatedLine","generatedColumn",r.compareByGeneratedPositionsDeflated,r.getArg(t,"bias",l.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===e.generatedLine){var o=r.getArg(i,"source",null);null!==o&&(o=this._sources.at(o),o=r.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var a=r.getArg(i,"name",null);return null!==a&&(a=this._names.at(a)),{source:o,line:r.getArg(i,"originalLine",null),column:r.getArg(i,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},c.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(t){return null==t}))},c.prototype.sourceContentFor=function(t,e){if(!this.sourcesContent)return null;var n=this._findSourceIndex(t);if(n>=0)return this.sourcesContent[n];var i,o=t;if(null!=this.sourceRoot&&(o=r.relative(this.sourceRoot,o)),null!=this.sourceRoot&&(i=r.urlParse(this.sourceRoot))){var a=o.replace(/^file:\/\//,"");if("file"==i.scheme&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!i.path||"/"==i.path)&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(e)return null;throw new Error('"'+o+'" is not in the SourceMap.')},c.prototype.generatedPositionFor=function(t){var e=r.getArg(t,"source");if((e=this._findSourceIndex(e))<0)return{line:null,column:null,lastColumn:null};var n={source:e,originalLine:r.getArg(t,"line"),originalColumn:r.getArg(t,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,r.getArg(t,"bias",l.GREATEST_LOWER_BOUND));if(i>=0){var o=this._originalMappings[i];if(o.source===n.source)return{line:r.getArg(o,"generatedLine",null),column:r.getArg(o,"generatedColumn",null),lastColumn:r.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},h.prototype=Object.create(l.prototype),h.prototype.constructor=l,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:function(){for(var t=[],e=0;e<this._sections.length;e++)for(var n=0;n<this._sections[e].consumer.sources.length;n++)t.push(this._sections[e].consumer.sources[n]);return t}}),h.prototype.originalPositionFor=function(t){var e={generatedLine:r.getArg(t,"line"),generatedColumn:r.getArg(t,"column")},n=i.search(e,this._sections,(function(t,e){return t.generatedLine-e.generatedOffset.generatedLine||t.generatedColumn-e.generatedOffset.generatedColumn})),o=this._sections[n];return o?o.consumer.originalPositionFor({line:e.generatedLine-(o.generatedOffset.generatedLine-1),column:e.generatedColumn-(o.generatedOffset.generatedLine===e.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}},h.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(t){return t.consumer.hasContentsOfAllSources()}))},h.prototype.sourceContentFor=function(t,e){for(var n=0;n<this._sections.length;n++){var r=this._sections[n].consumer.sourceContentFor(t,!0);if(r)return r}if(e)return null;throw new Error('"'+t+'" is not in the SourceMap.')},h.prototype.generatedPositionFor=function(t){for(var e=0;e<this._sections.length;e++){var n=this._sections[e];if(-1!==n.consumer._findSourceIndex(r.getArg(t,"source"))){var i=n.consumer.generatedPositionFor(t);if(i)return{line:i.line+(n.generatedOffset.generatedLine-1),column:i.column+(n.generatedOffset.generatedLine===i.line?n.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},h.prototype._parseMappings=function(t,e){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var i=this._sections[n],o=i.consumer._generatedMappings,a=0;a<o.length;a++){var l=o[a],c=i.consumer._sources.at(l.source);c=r.computeSourceURL(i.consumer.sourceRoot,c,this._sourceMapURL),this._sources.add(c),c=this._sources.indexOf(c);var u=null;l.name&&(u=i.consumer._names.at(l.name),this._names.add(u),u=this._names.indexOf(u));var h={source:c,generatedLine:l.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:l.generatedColumn+(i.generatedOffset.generatedLine===l.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:l.originalLine,originalColumn:l.originalColumn,name:u};this.__generatedMappings.push(h),"number"==typeof h.originalLine&&this.__originalMappings.push(h)}s(this.__generatedMappings,r.compareByGeneratedPositionsDeflated),s(this.__originalMappings,r.compareByOriginalPositions)}},833:(t,e,n)=>{var r=n(588),i=n(798),o=n(805).I,a=n(293).H;function s(t){t||(t={}),this._file=i.getArg(t,"file",null),this._sourceRoot=i.getArg(t,"sourceRoot",null),this._skipValidation=i.getArg(t,"skipValidation",!1),this._sources=new o,this._names=new o,this._mappings=new a,this._sourcesContents=null}s.prototype._version=3,s.fromSourceMap=function(t){var e=t.sourceRoot,n=new s({file:t.file,sourceRoot:e});return t.eachMapping((function(t){var r={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(r.source=t.source,null!=e&&(r.source=i.relative(e,r.source)),r.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(r.name=t.name)),n.addMapping(r)})),t.sources.forEach((function(r){var o=r;null!==e&&(o=i.relative(e,r)),n._sources.has(o)||n._sources.add(o);var a=t.sourceContentFor(r);null!=a&&n.setSourceContent(r,a)})),n},s.prototype.addMapping=function(t){var e=i.getArg(t,"generated"),n=i.getArg(t,"original",null),r=i.getArg(t,"source",null),o=i.getArg(t,"name",null);this._skipValidation||this._validateMapping(e,n,r,o),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:e.line,generatedColumn:e.column,originalLine:null!=n&&n.line,originalColumn:null!=n&&n.column,source:r,name:o})},s.prototype.setSourceContent=function(t,e){var n=t;null!=this._sourceRoot&&(n=i.relative(this._sourceRoot,n)),null!=e?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(n)]=e):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(t,e,n){var r=e;if(null==e){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=t.file}var a=this._sourceRoot;null!=a&&(r=i.relative(a,r));var s=new o,l=new o;this._mappings.unsortedForEach((function(e){if(e.source===r&&null!=e.originalLine){var o=t.originalPositionFor({line:e.originalLine,column:e.originalColumn});null!=o.source&&(e.source=o.source,null!=n&&(e.source=i.join(n,e.source)),null!=a&&(e.source=i.relative(a,e.source)),e.originalLine=o.line,e.originalColumn=o.column,null!=o.name&&(e.name=o.name))}var c=e.source;null==c||s.has(c)||s.add(c);var u=e.name;null==u||l.has(u)||l.add(u)}),this),this._sources=s,this._names=l,t.sources.forEach((function(e){var r=t.sourceContentFor(e);null!=r&&(null!=n&&(e=i.join(n,e)),null!=a&&(e=i.relative(a,e)),this.setSourceContent(e,r))}),this)},s.prototype._validateMapping=function(t,e,n,r){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||n||r)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:e,name:r}))},s.prototype._serializeMappings=function(){for(var t,e,n,o,a=0,s=1,l=0,c=0,u=0,h=0,d="",p=this._mappings.toArray(),f=0,m=p.length;f<m;f++){if(t="",(e=p[f]).generatedLine!==s)for(a=0;e.generatedLine!==s;)t+=";",s++;else if(f>0){if(!i.compareByGeneratedPositionsInflated(e,p[f-1]))continue;t+=","}t+=r.encode(e.generatedColumn-a),a=e.generatedColumn,null!=e.source&&(o=this._sources.indexOf(e.source),t+=r.encode(o-h),h=o,t+=r.encode(e.originalLine-1-c),c=e.originalLine-1,t+=r.encode(e.originalColumn-l),l=e.originalColumn,null!=e.name&&(n=this._names.indexOf(e.name),t+=r.encode(n-u),u=n)),d+=t}return d},s.prototype._generateSourcesContent=function(t,e){return t.map((function(t){if(!this._sourcesContents)return null;null!=e&&(t=i.relative(e,t));var n=i.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)},s.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.h=s},933:(t,e,n)=>{var r=n(833).h,i=n(798),o=/(\r?\n)/,a="$$$isSourceNode$$$";function s(t,e,n,r,i){this.children=[],this.sourceContents={},this.line=null==t?null:t,this.column=null==e?null:e,this.source=null==n?null:n,this.name=null==i?null:i,this[a]=!0,null!=r&&this.add(r)}s.fromStringWithSourceMap=function(t,e,n){var r=new s,a=t.split(o),l=0,c=function(){return t()+(t()||"");function t(){return l<a.length?a[l++]:void 0}},u=1,h=0,d=null;return e.eachMapping((function(t){if(null!==d){if(!(u<t.generatedLine)){var e=(n=a[l]||"").substr(0,t.generatedColumn-h);return a[l]=n.substr(t.generatedColumn-h),h=t.generatedColumn,p(d,e),void(d=t)}p(d,c()),u++,h=0}for(;u<t.generatedLine;)r.add(c()),u++;if(h<t.generatedColumn){var n=a[l]||"";r.add(n.substr(0,t.generatedColumn)),a[l]=n.substr(t.generatedColumn),h=t.generatedColumn}d=t}),this),l<a.length&&(d&&p(d,c()),r.add(a.splice(l).join(""))),e.sources.forEach((function(t){var o=e.sourceContentFor(t);null!=o&&(null!=n&&(t=i.join(n,t)),r.setSourceContent(t,o))})),r;function p(t,e){if(null===t||void 0===t.source)r.add(e);else{var o=n?i.join(n,t.source):t.source;r.add(new s(t.originalLine,t.originalColumn,o,e,t.name))}}},s.prototype.add=function(t){if(Array.isArray(t))t.forEach((function(t){this.add(t)}),this);else{if(!t[a]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);t&&this.children.push(t)}return this},s.prototype.prepend=function(t){if(Array.isArray(t))for(var e=t.length-1;e>=0;e--)this.prepend(t[e]);else{if(!t[a]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},s.prototype.walk=function(t){for(var e,n=0,r=this.children.length;n<r;n++)(e=this.children[n])[a]?e.walk(t):""!==e&&t(e,{source:this.source,line:this.line,column:this.column,name:this.name})},s.prototype.join=function(t){var e,n,r=this.children.length;if(r>0){for(e=[],n=0;n<r-1;n++)e.push(this.children[n]),e.push(t);e.push(this.children[n]),this.children=e}return this},s.prototype.replaceRight=function(t,e){var n=this.children[this.children.length-1];return n[a]?n.replaceRight(t,e):"string"==typeof n?this.children[this.children.length-1]=n.replace(t,e):this.children.push("".replace(t,e)),this},s.prototype.setSourceContent=function(t,e){this.sourceContents[i.toSetString(t)]=e},s.prototype.walkSourceContents=function(t){for(var e=0,n=this.children.length;e<n;e++)this.children[e][a]&&this.children[e].walkSourceContents(t);var r=Object.keys(this.sourceContents);for(e=0,n=r.length;e<n;e++)t(i.fromSetString(r[e]),this.sourceContents[r[e]])},s.prototype.toString=function(){var t="";return this.walk((function(e){t+=e})),t},s.prototype.toStringWithSourceMap=function(t){var e={code:"",line:1,column:0},n=new r(t),i=!1,o=null,a=null,s=null,l=null;return this.walk((function(t,r){e.code+=t,null!==r.source&&null!==r.line&&null!==r.column?(o===r.source&&a===r.line&&s===r.column&&l===r.name||n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:e.line,column:e.column},name:r.name}),o=r.source,a=r.line,s=r.column,l=r.name,i=!0):i&&(n.addMapping({generated:{line:e.line,column:e.column}}),o=null,i=!1);for(var c=0,u=t.length;c<u;c++)10===t.charCodeAt(c)?(e.line++,e.column=0,c+1===u?(o=null,i=!1):i&&n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:e.line,column:e.column},name:r.name})):e.column++})),this.walkSourceContents((function(t,e){n.setSourceContent(t,e)})),{code:e.code,map:n}}},798:(t,e)=>{e.getArg=function(t,e,n){if(e in t)return t[e];if(3===arguments.length)return n;throw new Error('"'+e+'" is a required argument.')};var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(t){var e=t.match(n);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}function o(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function a(t){var n=t,r=i(t);if(r){if(!r.path)return t;n=r.path}for(var a,s=e.isAbsolute(n),l=n.split(/\/+/),c=0,u=l.length-1;u>=0;u--)"."===(a=l[u])?l.splice(u,1):".."===a?c++:c>0&&(""===a?(l.splice(u+1,c),c=0):(l.splice(u,2),c--));return""===(n=l.join("/"))&&(n=s?"/":"."),r?(r.path=n,o(r)):n}function s(t,e){""===t&&(t="."),""===e&&(e=".");var n=i(e),s=i(t);if(s&&(t=s.path||"/"),n&&!n.scheme)return s&&(n.scheme=s.scheme),o(n);if(n||e.match(r))return e;if(s&&!s.host&&!s.path)return s.host=e,o(s);var l="/"===e.charAt(0)?e:a(t.replace(/\/+$/,"")+"/"+e);return s?(s.path=l,o(s)):l}e.urlParse=i,e.urlGenerate=o,e.normalize=a,e.join=s,e.isAbsolute=function(t){return"/"===t.charAt(0)||n.test(t)},e.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var n=0;0!==e.indexOf(t+"/");){var r=t.lastIndexOf("/");if(r<0)return e;if((t=t.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return e;++n}return Array(n+1).join("../")+e.substr(t.length+1)};var l=!("__proto__"in Object.create(null));function c(t){return t}function u(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var n=e-10;n>=0;n--)if(36!==t.charCodeAt(n))return!1;return!0}function h(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}e.toSetString=l?c:function(t){return u(t)?"$"+t:t},e.fromSetString=l?c:function(t){return u(t)?t.slice(1):t},e.compareByOriginalPositions=function(t,e,n){var r=h(t.source,e.source);return 0!==r||0!=(r=t.originalLine-e.originalLine)||0!=(r=t.originalColumn-e.originalColumn)||n||0!=(r=t.generatedColumn-e.generatedColumn)||0!=(r=t.generatedLine-e.generatedLine)?r:h(t.name,e.name)},e.compareByGeneratedPositionsDeflated=function(t,e,n){var r=t.generatedLine-e.generatedLine;return 0!==r||0!=(r=t.generatedColumn-e.generatedColumn)||n||0!==(r=h(t.source,e.source))||0!=(r=t.originalLine-e.originalLine)||0!=(r=t.originalColumn-e.originalColumn)?r:h(t.name,e.name)},e.compareByGeneratedPositionsInflated=function(t,e){var n=t.generatedLine-e.generatedLine;return 0!==n||0!=(n=t.generatedColumn-e.generatedColumn)||0!==(n=h(t.source,e.source))||0!=(n=t.originalLine-e.originalLine)||0!=(n=t.originalColumn-e.originalColumn)?n:h(t.name,e.name)},e.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(t,e,n){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),n){var r=i(n);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var l=r.path.lastIndexOf("/");l>=0&&(r.path=r.path.substring(0,l+1))}e=s(o(r),e)}return a(e)}},741:(t,e,n)=>{n(833).h,e.SourceMapConsumer=n(965).SourceMapConsumer,n(933)},486:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",l=32,c=128,u=1/0,h=9007199254740991,d=NaN,p=4294967295,f=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],m="[object Arguments]",g="[object Array]",v="[object Boolean]",y="[object Date]",_="[object Error]",x="[object Function]",b="[object GeneratorFunction]",w="[object Map]",M="[object Number]",S="[object Object]",E="[object Promise]",T="[object RegExp]",A="[object Set]",L="[object String]",C="[object Symbol]",R="[object WeakMap]",P="[object ArrayBuffer]",O="[object DataView]",D="[object Float32Array]",I="[object Float64Array]",N="[object Int8Array]",B="[object Int16Array]",z="[object Int32Array]",F="[object Uint8Array]",H="[object Uint8ClampedArray]",k="[object Uint16Array]",U="[object Uint32Array]",G=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,X=RegExp(j.source),Y=RegExp(q.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(et.source),rt=/^\s+/,it=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,st=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/[()=,{}\[\]\/\s]/,ut=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,gt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_t=/($^)/,xt=/['\n\r\u2028\u2029\\]/g,bt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",wt="a-z\\xdf-\\xf6\\xf8-\\xff",Mt="A-Z\\xc0-\\xd6\\xd8-\\xde",St="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Et="["+St+"]",Tt="["+bt+"]",At="\\d+",Lt="["+wt+"]",Ct="[^\\ud800-\\udfff"+St+At+"\\u2700-\\u27bf"+wt+Mt+"]",Rt="\\ud83c[\\udffb-\\udfff]",Pt="[^\\ud800-\\udfff]",Ot="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",It="["+Mt+"]",Nt="(?:"+Lt+"|"+Ct+")",Bt="(?:"+It+"|"+Ct+")",zt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ft="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ht="(?:"+Tt+"|"+Rt+")?",kt="[\\ufe0e\\ufe0f]?",Ut=kt+Ht+"(?:\\u200d(?:"+[Pt,Ot,Dt].join("|")+")"+kt+Ht+")*",Gt="(?:"+["[\\u2700-\\u27bf]",Ot,Dt].join("|")+")"+Ut,Vt="(?:"+[Pt+Tt+"?",Tt,Ot,Dt,"[\\ud800-\\udfff]"].join("|")+")",Wt=RegExp("['’]","g"),jt=RegExp(Tt,"g"),qt=RegExp(Rt+"(?="+Rt+")|"+Vt+Ut,"g"),Xt=RegExp([It+"?"+Lt+"+"+zt+"(?="+[Et,It,"$"].join("|")+")",Bt+"+"+Ft+"(?="+[Et,It+Nt,"$"].join("|")+")",It+"?"+Nt+"+"+zt,It+"+"+Ft,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",At,Gt].join("|"),"g"),Yt=RegExp("[\\u200d\\ud800-\\udfff"+bt+"\\ufe0e\\ufe0f]"),Zt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Jt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Kt=-1,Qt={};Qt[D]=Qt[I]=Qt[N]=Qt[B]=Qt[z]=Qt[F]=Qt[H]=Qt[k]=Qt[U]=!0,Qt[m]=Qt[g]=Qt[P]=Qt[v]=Qt[O]=Qt[y]=Qt[_]=Qt[x]=Qt[w]=Qt[M]=Qt[S]=Qt[T]=Qt[A]=Qt[L]=Qt[R]=!1;var $t={};$t[m]=$t[g]=$t[P]=$t[O]=$t[v]=$t[y]=$t[D]=$t[I]=$t[N]=$t[B]=$t[z]=$t[w]=$t[M]=$t[S]=$t[T]=$t[A]=$t[L]=$t[C]=$t[F]=$t[H]=$t[k]=$t[U]=!0,$t[_]=$t[x]=$t[R]=!1;var te={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ee=parseFloat,ne=parseInt,re="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ie="object"==typeof self&&self&&self.Object===Object&&self,oe=re||ie||Function("return this")(),ae=e&&!e.nodeType&&e,se=ae&&t&&!t.nodeType&&t,le=se&&se.exports===ae,ce=le&&re.process,ue=function(){try{return se&&se.require&&se.require("util").types||ce&&ce.binding&&ce.binding("util")}catch(t){}}(),he=ue&&ue.isArrayBuffer,de=ue&&ue.isDate,pe=ue&&ue.isMap,fe=ue&&ue.isRegExp,me=ue&&ue.isSet,ge=ue&&ue.isTypedArray;function ve(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function ye(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function _e(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function xe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function be(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function we(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function Me(t,e){return!(null==t||!t.length)&&De(t,e,0)>-1}function Se(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Ee(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function Te(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Ae(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Le(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Re=ze("length");function Pe(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Oe(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function De(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Oe(t,Ne,n)}function Ie(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Ne(t){return t!=t}function Be(t,e){var n=null==t?0:t.length;return n?ke(t,e)/n:d}function ze(t){return function(e){return null==e?i:e[t]}}function Fe(t){return function(e){return null==t?i:t[e]}}function He(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function ke(t,e){for(var n,r=-1,o=t.length;++r<o;){var a=e(t[r]);a!==i&&(n=n===i?a:n+a)}return n}function Ue(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,sn(t)+1).replace(rt,""):t}function Ve(t){return function(e){return t(e)}}function We(t,e){return Ee(e,(function(e){return t[e]}))}function je(t,e){return t.has(e)}function qe(t,e){for(var n=-1,r=t.length;++n<r&&De(e,t[n],0)>-1;);return n}function Xe(t,e){for(var n=t.length;n--&&De(e,t[n],0)>-1;);return n}function Ye(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var Ze=Fe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Je=Fe({"&":"&","<":"<",">":">",'"':""","'":"'"});function Ke(t){return"\\"+te[t]}function Qe(t){return Yt.test(t)}function $e(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function tn(t,e){return function(n){return t(e(n))}}function en(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[i++]=n)}return o}function nn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function rn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function on(t){return Qe(t)?function(t){for(var e=qt.lastIndex=0;qt.test(t);)++e;return e}(t):Re(t)}function an(t){return Qe(t)?function(t){return t.match(qt)||[]}(t):function(t){return t.split("")}(t)}function sn(t){for(var e=t.length;e--&&it.test(t.charAt(e)););return e}var ln=Fe({"&":"&","<":"<",">":">",""":'"',"'":"'"}),cn=function t(e){var n,r=(e=null==e?oe:cn.defaults(oe.Object(),e,cn.pick(oe,Jt))).Array,it=e.Date,bt=e.Error,wt=e.Function,Mt=e.Math,St=e.Object,Et=e.RegExp,Tt=e.String,At=e.TypeError,Lt=r.prototype,Ct=wt.prototype,Rt=St.prototype,Pt=e["__core-js_shared__"],Ot=Ct.toString,Dt=Rt.hasOwnProperty,It=0,Nt=(n=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Bt=Rt.toString,zt=Ot.call(St),Ft=oe._,Ht=Et("^"+Ot.call(Dt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kt=le?e.Buffer:i,Ut=e.Symbol,Gt=e.Uint8Array,Vt=kt?kt.allocUnsafe:i,qt=tn(St.getPrototypeOf,St),Yt=St.create,te=Rt.propertyIsEnumerable,re=Lt.splice,ie=Ut?Ut.isConcatSpreadable:i,ae=Ut?Ut.iterator:i,se=Ut?Ut.toStringTag:i,ce=function(){try{var t=co(St,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==oe.clearTimeout&&e.clearTimeout,Re=it&&it.now!==oe.Date.now&&it.now,Fe=e.setTimeout!==oe.setTimeout&&e.setTimeout,un=Mt.ceil,hn=Mt.floor,dn=St.getOwnPropertySymbols,pn=kt?kt.isBuffer:i,fn=e.isFinite,mn=Lt.join,gn=tn(St.keys,St),vn=Mt.max,yn=Mt.min,_n=it.now,xn=e.parseInt,bn=Mt.random,wn=Lt.reverse,Mn=co(e,"DataView"),Sn=co(e,"Map"),En=co(e,"Promise"),Tn=co(e,"Set"),An=co(e,"WeakMap"),Ln=co(St,"create"),Cn=An&&new An,Rn={},Pn=Ho(Mn),On=Ho(Sn),Dn=Ho(En),In=Ho(Tn),Nn=Ho(An),Bn=Ut?Ut.prototype:i,zn=Bn?Bn.valueOf:i,Fn=Bn?Bn.toString:i;function Hn(t){if(ns(t)&&!ja(t)&&!(t instanceof Vn)){if(t instanceof Gn)return t;if(Dt.call(t,"__wrapped__"))return ko(t)}return new Gn(t)}var kn=function(){function t(){}return function(e){if(!es(e))return{};if(Yt)return Yt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Un(){}function Gn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Vn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new qn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new jn(t);this.size=e.size}function Zn(t,e){var n=ja(t),r=!n&&Wa(t),i=!n&&!r&&Za(t),o=!n&&!r&&!i&&us(t),a=n||r||i||o,s=a?Ue(t.length,Tt):[],l=s.length;for(var c in t)!e&&!Dt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||vo(c,l))||s.push(c);return s}function Jn(t){var e=t.length;return e?t[qr(0,e-1)]:i}function Kn(t,e){return Io(Ai(t),ar(e,0,t.length))}function Qn(t){return Io(Ai(t))}function $n(t,e,n){(n!==i&&!Ua(t[e],n)||n===i&&!(e in t))&&ir(t,e,n)}function tr(t,e,n){var r=t[e];Dt.call(t,e)&&Ua(r,n)&&(n!==i||e in t)||ir(t,e,n)}function er(t,e){for(var n=t.length;n--;)if(Ua(t[n][0],e))return n;return-1}function nr(t,e,n,r){return hr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function rr(t,e){return t&&Li(e,Os(e),t)}function ir(t,e,n){"__proto__"==e&&ce?ce(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function or(t,e){for(var n=-1,o=e.length,a=r(o),s=null==t;++n<o;)a[n]=s?i:As(t,e[n]);return a}function ar(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function sr(t,e,n,r,o,a){var s,l=1&e,c=2&e,u=4&e;if(n&&(s=o?n(t,r,o,a):n(t)),s!==i)return s;if(!es(t))return t;var h=ja(t);if(h){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Dt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!l)return Ai(t,s)}else{var d=po(t),p=d==x||d==b;if(Za(t))return bi(t,l);if(d==S||d==m||p&&!o){if(s=c||p?{}:mo(t),!l)return c?function(t,e){return Li(t,ho(t),e)}(t,function(t,e){return t&&Li(e,Ds(e),t)}(s,t)):function(t,e){return Li(t,uo(t),e)}(t,rr(s,t))}else{if(!$t[d])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case P:return wi(t);case v:case y:return new i(+t);case O:return function(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case D:case I:case N:case B:case z:case F:case H:case k:case U:return Mi(t,n);case w:return new i;case M:case L:return new i(t);case T:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case A:return new i;case C:return r=t,zn?St(zn.call(r)):{}}}(t,d,l)}}a||(a=new Yn);var f=a.get(t);if(f)return f;a.set(t,s),ss(t)?t.forEach((function(r){s.add(sr(r,e,n,r,t,a))})):rs(t)&&t.forEach((function(r,i){s.set(i,sr(r,e,n,i,t,a))}));var g=h?i:(u?c?no:eo:c?Ds:Os)(t);return _e(g||t,(function(r,i){g&&(r=t[i=r]),tr(s,i,sr(r,e,n,i,t,a))})),s}function lr(t,e,n){var r=n.length;if(null==t)return!r;for(t=St(t);r--;){var o=n[r],a=e[o],s=t[o];if(s===i&&!(o in t)||!a(s))return!1}return!0}function cr(t,e,n){if("function"!=typeof t)throw new At(o);return Ro((function(){t.apply(i,n)}),e)}function ur(t,e,n,r){var i=-1,o=Me,a=!0,s=t.length,l=[],c=e.length;if(!s)return l;n&&(e=Ee(e,Ve(n))),r?(o=Se,a=!1):e.length>=200&&(o=je,a=!1,e=new Xn(e));t:for(;++i<s;){var u=t[i],h=null==n?u:n(u);if(u=r||0!==u?u:0,a&&h==h){for(var d=c;d--;)if(e[d]===h)continue t;l.push(u)}else o(e,h,r)||l.push(u)}return l}Hn.templateSettings={escape:Z,evaluate:J,interpolate:K,variable:"",imports:{_:Hn}},Hn.prototype=Un.prototype,Hn.prototype.constructor=Hn,Gn.prototype=kn(Un.prototype),Gn.prototype.constructor=Gn,Vn.prototype=kn(Un.prototype),Vn.prototype.constructor=Vn,Wn.prototype.clear=function(){this.__data__=Ln?Ln(null):{},this.size=0},Wn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Wn.prototype.get=function(t){var e=this.__data__;if(Ln){var n=e[t];return n===a?i:n}return Dt.call(e,t)?e[t]:i},Wn.prototype.has=function(t){var e=this.__data__;return Ln?e[t]!==i:Dt.call(e,t)},Wn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ln&&e===i?a:e,this},jn.prototype.clear=function(){this.__data__=[],this.size=0},jn.prototype.delete=function(t){var e=this.__data__,n=er(e,t);return!(n<0||(n==e.length-1?e.pop():re.call(e,n,1),--this.size,0))},jn.prototype.get=function(t){var e=this.__data__,n=er(e,t);return n<0?i:e[n][1]},jn.prototype.has=function(t){return er(this.__data__,t)>-1},jn.prototype.set=function(t,e){var n=this.__data__,r=er(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Sn||jn),string:new Wn}},qn.prototype.delete=function(t){var e=so(this,t).delete(t);return this.size-=e?1:0,e},qn.prototype.get=function(t){return so(this,t).get(t)},qn.prototype.has=function(t){return so(this,t).has(t)},qn.prototype.set=function(t,e){var n=so(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(t){return this.__data__.set(t,a),this},Xn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new jn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof jn){var r=n.__data__;if(!Sn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(t,e),this.size=n.size,this};var hr=Pi(_r),dr=Pi(xr,!0);function pr(t,e){var n=!0;return hr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function fr(t,e,n){for(var r=-1,o=t.length;++r<o;){var a=t[r],s=e(a);if(null!=s&&(l===i?s==s&&!cs(s):n(s,l)))var l=s,c=a}return c}function mr(t,e){var n=[];return hr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function gr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=go),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?gr(s,e-1,n,r,i):Te(i,s):r||(i[i.length]=s)}return i}var vr=Oi(),yr=Oi(!0);function _r(t,e){return t&&vr(t,e,Os)}function xr(t,e){return t&&yr(t,e,Os)}function br(t,e){return we(e,(function(e){return Qa(t[e])}))}function wr(t,e){for(var n=0,r=(e=vi(e,t)).length;null!=t&&n<r;)t=t[Fo(e[n++])];return n&&n==r?t:i}function Mr(t,e,n){var r=e(t);return ja(t)?r:Te(r,n(t))}function Sr(t){return null==t?t===i?"[object Undefined]":"[object Null]":se&&se in St(t)?function(t){var e=Dt.call(t,se),n=t[se];try{t[se]=i;var r=!0}catch(t){}var o=Bt.call(t);return r&&(e?t[se]=n:delete t[se]),o}(t):function(t){return Bt.call(t)}(t)}function Er(t,e){return t>e}function Tr(t,e){return null!=t&&Dt.call(t,e)}function Ar(t,e){return null!=t&&e in St(t)}function Lr(t,e,n){for(var o=n?Se:Me,a=t[0].length,s=t.length,l=s,c=r(s),u=1/0,h=[];l--;){var d=t[l];l&&e&&(d=Ee(d,Ve(e))),u=yn(d.length,u),c[l]=!n&&(e||a>=120&&d.length>=120)?new Xn(l&&d):i}d=t[0];var p=-1,f=c[0];t:for(;++p<a&&h.length<u;){var m=d[p],g=e?e(m):m;if(m=n||0!==m?m:0,!(f?je(f,g):o(h,g,n))){for(l=s;--l;){var v=c[l];if(!(v?je(v,g):o(t[l],g,n)))continue t}f&&f.push(g),h.push(m)}}return h}function Cr(t,e,n){var r=null==(t=To(t,e=vi(e,t)))?t:t[Fo(Ko(e))];return null==r?i:ve(r,t,n)}function Rr(t){return ns(t)&&Sr(t)==m}function Pr(t,e,n,r,o){return t===e||(null==t||null==e||!ns(t)&&!ns(e)?t!=t&&e!=e:function(t,e,n,r,o,a){var s=ja(t),l=ja(e),c=s?g:po(t),u=l?g:po(e),h=(c=c==m?S:c)==S,d=(u=u==m?S:u)==S,p=c==u;if(p&&Za(t)){if(!Za(e))return!1;s=!0,h=!1}if(p&&!h)return a||(a=new Yn),s||us(t)?$i(t,e,n,r,o,a):function(t,e,n,r,i,o,a){switch(n){case O:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case P:return!(t.byteLength!=e.byteLength||!o(new Gt(t),new Gt(e)));case v:case y:case M:return Ua(+t,+e);case _:return t.name==e.name&&t.message==e.message;case T:case L:return t==e+"";case w:var s=$e;case A:var l=1&r;if(s||(s=nn),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var u=$i(s(t),s(e),r,i,o,a);return a.delete(t),u;case C:if(zn)return zn.call(t)==zn.call(e)}return!1}(t,e,c,n,r,o,a);if(!(1&n)){var f=h&&Dt.call(t,"__wrapped__"),x=d&&Dt.call(e,"__wrapped__");if(f||x){var b=f?t.value():t,E=x?e.value():e;return a||(a=new Yn),o(b,E,n,r,a)}}return!!p&&(a||(a=new Yn),function(t,e,n,r,o,a){var s=1&n,l=eo(t),c=l.length;if(c!=eo(e).length&&!s)return!1;for(var u=c;u--;){var h=l[u];if(!(s?h in e:Dt.call(e,h)))return!1}var d=a.get(t),p=a.get(e);if(d&&p)return d==e&&p==t;var f=!0;a.set(t,e),a.set(e,t);for(var m=s;++u<c;){var g=t[h=l[u]],v=e[h];if(r)var y=s?r(v,g,h,e,t,a):r(g,v,h,t,e,a);if(!(y===i?g===v||o(g,v,n,r,a):y)){f=!1;break}m||(m="constructor"==h)}if(f&&!m){var _=t.constructor,x=e.constructor;_==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof x&&x instanceof x||(f=!1)}return a.delete(t),a.delete(e),f}(t,e,n,r,o,a))}(t,e,n,r,Pr,o))}function Or(t,e,n,r){var o=n.length,a=o,s=!r;if(null==t)return!a;for(t=St(t);o--;){var l=n[o];if(s&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++o<a;){var c=(l=n[o])[0],u=t[c],h=l[1];if(s&&l[2]){if(u===i&&!(c in t))return!1}else{var d=new Yn;if(r)var p=r(u,h,c,t,e,d);if(!(p===i?Pr(h,u,3,r,d):p))return!1}}return!0}function Dr(t){return!(!es(t)||(e=t,Nt&&Nt in e))&&(Qa(t)?Ht:mt).test(Ho(t));var e}function Ir(t){return"function"==typeof t?t:null==t?il:"object"==typeof t?ja(t)?Hr(t[0],t[1]):Fr(t):pl(t)}function Nr(t){if(!wo(t))return gn(t);var e=[];for(var n in St(t))Dt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t,e){return t<e}function zr(t,e){var n=-1,i=Xa(t)?r(t.length):[];return hr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Fr(t){var e=lo(t);return 1==e.length&&e[0][2]?So(e[0][0],e[0][1]):function(n){return n===t||Or(n,t,e)}}function Hr(t,e){return _o(t)&&Mo(e)?So(Fo(t),e):function(n){var r=As(n,t);return r===i&&r===e?Ls(n,t):Pr(e,r,3)}}function kr(t,e,n,r,o){t!==e&&vr(e,(function(a,s){if(o||(o=new Yn),es(a))!function(t,e,n,r,o,a,s){var l=Lo(t,n),c=Lo(e,n),u=s.get(c);if(u)$n(t,n,u);else{var h=a?a(l,c,n+"",t,e,s):i,d=h===i;if(d){var p=ja(c),f=!p&&Za(c),m=!p&&!f&&us(c);h=c,p||f||m?ja(l)?h=l:Ya(l)?h=Ai(l):f?(d=!1,h=bi(c,!0)):m?(d=!1,h=Mi(c,!0)):h=[]:os(c)||Wa(c)?(h=l,Wa(l)?h=ys(l):es(l)&&!Qa(l)||(h=mo(c))):d=!1}d&&(s.set(c,h),o(h,c,r,a,s),s.delete(c)),$n(t,n,h)}}(t,e,s,n,kr,r,o);else{var l=r?r(Lo(t,s),a,s+"",t,e,o):i;l===i&&(l=a),$n(t,s,l)}}),Ds)}function Ur(t,e){var n=t.length;if(n)return vo(e+=e<0?n:0,n)?t[e]:i}function Gr(t,e,n){e=e.length?Ee(e,(function(t){return ja(t)?function(e){return wr(e,1===t.length?t[0]:t)}:t})):[il];var r=-1;return e=Ee(e,Ve(ao())),function(t,e){var r=t.length;for(t.sort((function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r<a;){var l=Si(i[r],o[r]);if(l)return r>=s?l:l*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}));r--;)t[r]=t[r].value;return t}(zr(t,(function(t,n,i){return{criteria:Ee(e,(function(e){return e(t)})),index:++r,value:t}})))}function Vr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=wr(t,a);n(s,a)&&Kr(o,vi(a,t),s)}return o}function Wr(t,e,n,r){var i=r?Ie:De,o=-1,a=e.length,s=t;for(t===e&&(e=Ai(e)),n&&(s=Ee(t,Ve(n)));++o<a;)for(var l=0,c=e[o],u=n?n(c):c;(l=i(s,u,l,r))>-1;)s!==t&&re.call(s,l,1),re.call(t,l,1);return t}function jr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;vo(i)?re.call(t,i,1):ci(t,i)}}return t}function qr(t,e){return t+hn(bn()*(e-t+1))}function Xr(t,e){var n="";if(!t||e<1||e>h)return n;do{e%2&&(n+=t),(e=hn(e/2))&&(t+=t)}while(e);return n}function Yr(t,e){return Po(Eo(t,e,il),t+"")}function Zr(t){return Jn(Us(t))}function Jr(t,e){var n=Us(t);return Io(n,ar(e,0,n.length))}function Kr(t,e,n,r){if(!es(t))return t;for(var o=-1,a=(e=vi(e,t)).length,s=a-1,l=t;null!=l&&++o<a;){var c=Fo(e[o]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var h=l[c];(u=r?r(h,c,l):i)===i&&(u=es(h)?h:vo(e[o+1])?[]:{})}tr(l,c,u),l=l[c]}return t}var Qr=Cn?function(t,e){return Cn.set(t,e),t}:il,$r=ce?function(t,e){return ce(t,"toString",{configurable:!0,enumerable:!1,value:el(e),writable:!0})}:il;function ti(t){return Io(Us(t))}function ei(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=r(o);++i<o;)a[i]=t[i+e];return a}function ni(t,e){var n;return hr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function ri(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!cs(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return ii(t,e,il,n)}function ii(t,e,n,r){var o=0,a=null==t?0:t.length;if(0===a)return 0;for(var s=(e=n(e))!=e,l=null===e,c=cs(e),u=e===i;o<a;){var h=hn((o+a)/2),d=n(t[h]),p=d!==i,f=null===d,m=d==d,g=cs(d);if(s)var v=r||m;else v=u?m&&(r||p):l?m&&p&&(r||!f):c?m&&p&&!f&&(r||!g):!f&&!g&&(r?d<=e:d<e);v?o=h+1:a=h}return yn(a,4294967294)}function oi(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Ua(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function ai(t){return"number"==typeof t?t:cs(t)?d:+t}function si(t){if("string"==typeof t)return t;if(ja(t))return Ee(t,si)+"";if(cs(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function li(t,e,n){var r=-1,i=Me,o=t.length,a=!0,s=[],l=s;if(n)a=!1,i=Se;else if(o>=200){var c=e?null:Xi(t);if(c)return nn(c);a=!1,i=je,l=new Xn}else l=e?[]:s;t:for(;++r<o;){var u=t[r],h=e?e(u):u;if(u=n||0!==u?u:0,a&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue t;e&&l.push(h),s.push(u)}else i(l,h,n)||(l!==s&&l.push(h),s.push(u))}return s}function ci(t,e){return null==(t=To(t,e=vi(e,t)))||delete t[Fo(Ko(e))]}function ui(t,e,n,r){return Kr(t,e,n(wr(t,e)),r)}function hi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ei(t,r?0:o,r?o+1:i):ei(t,r?o+1:0,r?i:o)}function di(t,e){var n=t;return n instanceof Vn&&(n=n.value()),Ae(e,(function(t,e){return e.func.apply(e.thisArg,Te([t],e.args))}),n)}function pi(t,e,n){var i=t.length;if(i<2)return i?li(t[0]):[];for(var o=-1,a=r(i);++o<i;)for(var s=t[o],l=-1;++l<i;)l!=o&&(a[o]=ur(a[o]||s,t[l],e,n));return li(gr(a,1),e,n)}function fi(t,e,n){for(var r=-1,o=t.length,a=e.length,s={};++r<o;){var l=r<a?e[r]:i;n(s,t[r],l)}return s}function mi(t){return Ya(t)?t:[]}function gi(t){return"function"==typeof t?t:il}function vi(t,e){return ja(t)?t:_o(t,e)?[t]:zo(_s(t))}var yi=Yr;function _i(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ei(t,e,n)}var xi=ue||function(t){return oe.clearTimeout(t)};function bi(t,e){if(e)return t.slice();var n=t.length,r=Vt?Vt(n):new t.constructor(n);return t.copy(r),r}function wi(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}function Mi(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Si(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,a=cs(t),s=e!==i,l=null===e,c=e==e,u=cs(e);if(!l&&!u&&!a&&t>e||a&&s&&c&&!l&&!u||r&&s&&c||!n&&c||!o)return 1;if(!r&&!a&&!u&&t<e||u&&n&&o&&!r&&!a||l&&n&&o||!s&&o||!c)return-1}return 0}function Ei(t,e,n,i){for(var o=-1,a=t.length,s=n.length,l=-1,c=e.length,u=vn(a-s,0),h=r(c+u),d=!i;++l<c;)h[l]=e[l];for(;++o<s;)(d||o<a)&&(h[n[o]]=t[o]);for(;u--;)h[l++]=t[o++];return h}function Ti(t,e,n,i){for(var o=-1,a=t.length,s=-1,l=n.length,c=-1,u=e.length,h=vn(a-l,0),d=r(h+u),p=!i;++o<h;)d[o]=t[o];for(var f=o;++c<u;)d[f+c]=e[c];for(;++s<l;)(p||o<a)&&(d[f+n[s]]=t[o++]);return d}function Ai(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Li(t,e,n,r){var o=!n;n||(n={});for(var a=-1,s=e.length;++a<s;){var l=e[a],c=r?r(n[l],t[l],l,n,t):i;c===i&&(c=t[l]),o?ir(n,l,c):tr(n,l,c)}return n}function Ci(t,e){return function(n,r){var i=ja(n)?ye:nr,o=e?e():{};return i(n,t,ao(r,2),o)}}function Ri(t){return Yr((function(e,n){var r=-1,o=n.length,a=o>1?n[o-1]:i,s=o>2?n[2]:i;for(a=t.length>3&&"function"==typeof a?(o--,a):i,s&&yo(n[0],n[1],s)&&(a=o<3?i:a,o=1),e=St(e);++r<o;){var l=n[r];l&&t(e,l,r,a)}return e}))}function Pi(t,e){return function(n,r){if(null==n)return n;if(!Xa(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=St(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Oi(t){return function(e,n,r){for(var i=-1,o=St(e),a=r(e),s=a.length;s--;){var l=a[t?s:++i];if(!1===n(o[l],l,o))break}return e}}function Di(t){return function(e){var n=Qe(e=_s(e))?an(e):i,r=n?n[0]:e.charAt(0),o=n?_i(n,1).join(""):e.slice(1);return r[t]()+o}}function Ii(t){return function(e){return Ae(Qs(Ws(e).replace(Wt,"")),t,"")}}function Ni(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=kn(t.prototype),r=t.apply(n,e);return es(r)?r:n}}function Bi(t){return function(e,n,r){var o=St(e);if(!Xa(e)){var a=ao(n,3);e=Os(e),n=function(t){return a(o[t],t,o)}}var s=t(e,n,r);return s>-1?o[a?e[s]:s]:i}}function zi(t){return to((function(e){var n=e.length,r=n,a=Gn.prototype.thru;for(t&&e.reverse();r--;){var s=e[r];if("function"!=typeof s)throw new At(o);if(a&&!l&&"wrapper"==io(s))var l=new Gn([],!0)}for(r=l?r:n;++r<n;){var c=io(s=e[r]),u="wrapper"==c?ro(s):i;l=u&&xo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[io(u[0])].apply(l,u[3]):1==s.length&&xo(s)?l[c]():l.thru(s)}return function(){var t=arguments,r=t[0];if(l&&1==t.length&&ja(r))return l.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Fi(t,e,n,o,a,s,l,u,h,d){var p=e&c,f=1&e,m=2&e,g=24&e,v=512&e,y=m?i:Ni(t);return function i(){for(var c=arguments.length,_=r(c),x=c;x--;)_[x]=arguments[x];if(g)var b=oo(i),w=Ye(_,b);if(o&&(_=Ei(_,o,a,g)),s&&(_=Ti(_,s,l,g)),c-=w,g&&c<d){var M=en(_,b);return ji(t,e,Fi,i.placeholder,n,_,M,u,h,d-c)}var S=f?n:this,E=m?S[t]:t;return c=_.length,u?_=Ao(_,u):v&&c>1&&_.reverse(),p&&h<c&&(_.length=h),this&&this!==oe&&this instanceof i&&(E=y||Ni(E)),E.apply(S,_)}}function Hi(t,e){return function(n,r){return function(t,e,n,r){return _r(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function ki(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=si(n),r=si(r)):(n=ai(n),r=ai(r)),o=t(n,r)}return o}}function Ui(t){return to((function(e){return e=Ee(e,Ve(ao())),Yr((function(n){var r=this;return t(e,(function(t){return ve(t,r,n)}))}))}))}function Gi(t,e){var n=(e=e===i?" ":si(e)).length;if(n<2)return n?Xr(e,t):e;var r=Xr(e,un(t/on(e)));return Qe(e)?_i(an(r),0,t).join(""):r.slice(0,t)}function Vi(t){return function(e,n,o){return o&&"number"!=typeof o&&yo(e,n,o)&&(n=o=i),e=fs(e),n===i?(n=e,e=0):n=fs(n),function(t,e,n,i){for(var o=-1,a=vn(un((e-t)/(n||1)),0),s=r(a);a--;)s[i?a:++o]=t,t+=n;return s}(e,n,o=o===i?e<n?1:-1:fs(o),t)}}function Wi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=vs(e),n=vs(n)),t(e,n)}}function ji(t,e,n,r,o,a,s,c,u,h){var d=8&e;e|=d?l:64,4&(e&=~(d?64:l))||(e&=-4);var p=[t,e,o,d?a:i,d?s:i,d?i:a,d?i:s,c,u,h],f=n.apply(i,p);return xo(t)&&Co(f,p),f.placeholder=r,Oo(f,t,e)}function qi(t){var e=Mt[t];return function(t,n){if(t=vs(t),(n=null==n?0:yn(ms(n),292))&&fn(t)){var r=(_s(t)+"e").split("e");return+((r=(_s(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xi=Tn&&1/nn(new Tn([,-0]))[1]==u?function(t){return new Tn(t)}:cl;function Yi(t){return function(e){var n=po(e);return n==w?$e(e):n==A?rn(e):function(t,e){return Ee(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Zi(t,e,n,a,u,h,d,p){var f=2&e;if(!f&&"function"!=typeof t)throw new At(o);var m=a?a.length:0;if(m||(e&=-97,a=u=i),d=d===i?d:vn(ms(d),0),p=p===i?p:ms(p),m-=u?u.length:0,64&e){var g=a,v=u;a=u=i}var y=f?i:ro(t),_=[t,e,n,a,u,g,v,h,d,p];if(y&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,a=r==c&&8==n||r==c&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!a)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var l=e[3];if(l){var u=t[3];t[3]=u?Ei(u,l,e[4]):l,t[4]=u?en(t[3],s):e[4]}(l=e[5])&&(u=t[5],t[5]=u?Ti(u,l,e[6]):l,t[6]=u?en(t[5],s):e[6]),(l=e[7])&&(t[7]=l),r&c&&(t[8]=null==t[8]?e[8]:yn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(_,y),t=_[0],e=_[1],n=_[2],a=_[3],u=_[4],!(p=_[9]=_[9]===i?f?0:t.length:vn(_[9]-m,0))&&24&e&&(e&=-25),e&&1!=e)x=8==e||16==e?function(t,e,n){var o=Ni(t);return function a(){for(var s=arguments.length,l=r(s),c=s,u=oo(a);c--;)l[c]=arguments[c];var h=s<3&&l[0]!==u&&l[s-1]!==u?[]:en(l,u);return(s-=h.length)<n?ji(t,e,Fi,a.placeholder,i,l,h,i,i,n-s):ve(this&&this!==oe&&this instanceof a?o:t,this,l)}}(t,e,p):e!=l&&33!=e||u.length?Fi.apply(i,_):function(t,e,n,i){var o=1&e,a=Ni(t);return function e(){for(var s=-1,l=arguments.length,c=-1,u=i.length,h=r(u+l),d=this&&this!==oe&&this instanceof e?a:t;++c<u;)h[c]=i[c];for(;l--;)h[c++]=arguments[++s];return ve(d,o?n:this,h)}}(t,e,n,a);else var x=function(t,e,n){var r=1&e,i=Ni(t);return function e(){return(this&&this!==oe&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Oo((y?Qr:Co)(x,_),t,e)}function Ji(t,e,n,r){return t===i||Ua(t,Rt[n])&&!Dt.call(r,n)?e:t}function Ki(t,e,n,r,o,a){return es(t)&&es(e)&&(a.set(e,t),kr(t,e,i,Ki,a),a.delete(e)),t}function Qi(t){return os(t)?i:t}function $i(t,e,n,r,o,a){var s=1&n,l=t.length,c=e.length;if(l!=c&&!(s&&c>l))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var d=-1,p=!0,f=2&n?new Xn:i;for(a.set(t,e),a.set(e,t);++d<l;){var m=t[d],g=e[d];if(r)var v=s?r(g,m,d,e,t,a):r(m,g,d,t,e,a);if(v!==i){if(v)continue;p=!1;break}if(f){if(!Ce(e,(function(t,e){if(!je(f,e)&&(m===t||o(m,t,n,r,a)))return f.push(e)}))){p=!1;break}}else if(m!==g&&!o(m,g,n,r,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function to(t){return Po(Eo(t,i,qo),t+"")}function eo(t){return Mr(t,Os,uo)}function no(t){return Mr(t,Ds,ho)}var ro=Cn?function(t){return Cn.get(t)}:cl;function io(t){for(var e=t.name+"",n=Rn[e],r=Dt.call(Rn,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function oo(t){return(Dt.call(Hn,"placeholder")?Hn:t).placeholder}function ao(){var t=Hn.iteratee||ol;return t=t===ol?Ir:t,arguments.length?t(arguments[0],arguments[1]):t}function so(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function lo(t){for(var e=Os(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Mo(i)]}return e}function co(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Dr(n)?n:i}var uo=dn?function(t){return null==t?[]:(t=St(t),we(dn(t),(function(e){return te.call(t,e)})))}:gl,ho=dn?function(t){for(var e=[];t;)Te(e,uo(t)),t=qt(t);return e}:gl,po=Sr;function fo(t,e,n){for(var r=-1,i=(e=vi(e,t)).length,o=!1;++r<i;){var a=Fo(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ts(i)&&vo(a,i)&&(ja(t)||Wa(t))}function mo(t){return"function"!=typeof t.constructor||wo(t)?{}:kn(qt(t))}function go(t){return ja(t)||Wa(t)||!!(ie&&t&&t[ie])}function vo(t,e){var n=typeof t;return!!(e=null==e?h:e)&&("number"==n||"symbol"!=n&&vt.test(t))&&t>-1&&t%1==0&&t<e}function yo(t,e,n){if(!es(n))return!1;var r=typeof e;return!!("number"==r?Xa(n)&&vo(e,n.length):"string"==r&&e in n)&&Ua(n[e],t)}function _o(t,e){if(ja(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!cs(t))||$.test(t)||!Q.test(t)||null!=e&&t in St(e)}function xo(t){var e=io(t),n=Hn[e];if("function"!=typeof n||!(e in Vn.prototype))return!1;if(t===n)return!0;var r=ro(n);return!!r&&t===r[0]}(Mn&&po(new Mn(new ArrayBuffer(1)))!=O||Sn&&po(new Sn)!=w||En&&po(En.resolve())!=E||Tn&&po(new Tn)!=A||An&&po(new An)!=R)&&(po=function(t){var e=Sr(t),n=e==S?t.constructor:i,r=n?Ho(n):"";if(r)switch(r){case Pn:return O;case On:return w;case Dn:return E;case In:return A;case Nn:return R}return e});var bo=Pt?Qa:vl;function wo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function Mo(t){return t==t&&!es(t)}function So(t,e){return function(n){return null!=n&&n[t]===e&&(e!==i||t in St(n))}}function Eo(t,e,n){return e=vn(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,a=vn(i.length-e,0),s=r(a);++o<a;)s[o]=i[e+o];o=-1;for(var l=r(e+1);++o<e;)l[o]=i[o];return l[e]=n(s),ve(t,this,l)}}function To(t,e){return e.length<2?t:wr(t,ei(e,0,-1))}function Ao(t,e){for(var n=t.length,r=yn(e.length,n),o=Ai(t);r--;){var a=e[r];t[r]=vo(a,n)?o[a]:i}return t}function Lo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Co=Do(Qr),Ro=Fe||function(t,e){return oe.setTimeout(t,e)},Po=Do($r);function Oo(t,e,n){var r=e+"";return Po(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ot,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return _e(f,(function(n){var r="_."+n[0];e&n[1]&&!Me(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(st):[]}(r),n)))}function Do(t){var e=0,n=0;return function(){var r=_n(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Io(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var a=qr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var No,Bo,zo=(No=Na((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,n,r,i){e.push(r?i.replace(ut,"$1"):n||t)})),e}),(function(t){return 500===Bo.size&&Bo.clear(),t})),Bo=No.cache,No);function Fo(t){if("string"==typeof t||cs(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Ho(t){if(null!=t){try{return Ot.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function ko(t){if(t instanceof Vn)return t.clone();var e=new Gn(t.__wrapped__,t.__chain__);return e.__actions__=Ai(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Uo=Yr((function(t,e){return Ya(t)?ur(t,gr(e,1,Ya,!0)):[]})),Go=Yr((function(t,e){var n=Ko(e);return Ya(n)&&(n=i),Ya(t)?ur(t,gr(e,1,Ya,!0),ao(n,2)):[]})),Vo=Yr((function(t,e){var n=Ko(e);return Ya(n)&&(n=i),Ya(t)?ur(t,gr(e,1,Ya,!0),i,n):[]}));function Wo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ms(n);return i<0&&(i=vn(r+i,0)),Oe(t,ao(e,3),i)}function jo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ms(n),o=n<0?vn(r+o,0):yn(o,r-1)),Oe(t,ao(e,3),o,!0)}function qo(t){return null!=t&&t.length?gr(t,1):[]}function Xo(t){return t&&t.length?t[0]:i}var Yo=Yr((function(t){var e=Ee(t,mi);return e.length&&e[0]===t[0]?Lr(e):[]})),Zo=Yr((function(t){var e=Ko(t),n=Ee(t,mi);return e===Ko(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Lr(n,ao(e,2)):[]})),Jo=Yr((function(t){var e=Ko(t),n=Ee(t,mi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Lr(n,i,e):[]}));function Ko(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Qo=Yr($o);function $o(t,e){return t&&t.length&&e&&e.length?Wr(t,e):t}var ta=to((function(t,e){var n=null==t?0:t.length,r=or(t,e);return jr(t,Ee(e,(function(t){return vo(t,n)?+t:t})).sort(Si)),r}));function ea(t){return null==t?t:wn.call(t)}var na=Yr((function(t){return li(gr(t,1,Ya,!0))})),ra=Yr((function(t){var e=Ko(t);return Ya(e)&&(e=i),li(gr(t,1,Ya,!0),ao(e,2))})),ia=Yr((function(t){var e=Ko(t);return e="function"==typeof e?e:i,li(gr(t,1,Ya,!0),i,e)}));function oa(t){if(!t||!t.length)return[];var e=0;return t=we(t,(function(t){if(Ya(t))return e=vn(t.length,e),!0})),Ue(e,(function(e){return Ee(t,ze(e))}))}function aa(t,e){if(!t||!t.length)return[];var n=oa(t);return null==e?n:Ee(n,(function(t){return ve(e,i,t)}))}var sa=Yr((function(t,e){return Ya(t)?ur(t,e):[]})),la=Yr((function(t){return pi(we(t,Ya))})),ca=Yr((function(t){var e=Ko(t);return Ya(e)&&(e=i),pi(we(t,Ya),ao(e,2))})),ua=Yr((function(t){var e=Ko(t);return e="function"==typeof e?e:i,pi(we(t,Ya),i,e)})),ha=Yr(oa),da=Yr((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,aa(t,n)}));function pa(t){var e=Hn(t);return e.__chain__=!0,e}function fa(t,e){return e(t)}var ma=to((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return or(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Vn&&vo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fa,args:[o],thisArg:i}),new Gn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)})),ga=Ci((function(t,e,n){Dt.call(t,n)?++t[n]:ir(t,n,1)})),va=Bi(Wo),ya=Bi(jo);function _a(t,e){return(ja(t)?_e:hr)(t,ao(e,3))}function xa(t,e){return(ja(t)?xe:dr)(t,ao(e,3))}var ba=Ci((function(t,e,n){Dt.call(t,n)?t[n].push(e):ir(t,n,[e])})),wa=Yr((function(t,e,n){var i=-1,o="function"==typeof e,a=Xa(t)?r(t.length):[];return hr(t,(function(t){a[++i]=o?ve(e,t,n):Cr(t,e,n)})),a})),Ma=Ci((function(t,e,n){ir(t,n,e)}));function Sa(t,e){return(ja(t)?Ee:zr)(t,ao(e,3))}var Ea=Ci((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Ta=Yr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&yo(t,e[0],e[1])?e=[]:n>2&&yo(e[0],e[1],e[2])&&(e=[e[0]]),Gr(t,gr(e,1),[])})),Aa=Re||function(){return oe.Date.now()};function La(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,c,i,i,i,i,e)}function Ca(t,e){var n;if("function"!=typeof e)throw new At(o);return t=ms(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Ra=Yr((function(t,e,n){var r=1;if(n.length){var i=en(n,oo(Ra));r|=l}return Zi(t,r,e,n,i)})),Pa=Yr((function(t,e,n){var r=3;if(n.length){var i=en(n,oo(Pa));r|=l}return Zi(e,r,t,n,i)}));function Oa(t,e,n){var r,a,s,l,c,u,h=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new At(o);function m(e){var n=r,o=a;return r=a=i,h=e,l=t.apply(o,n)}function g(t){return h=t,c=Ro(y,e),d?m(t):l}function v(t){var n=t-u;return u===i||n>=e||n<0||p&&t-h>=s}function y(){var t=Aa();if(v(t))return _(t);c=Ro(y,function(t){var n=e-(t-u);return p?yn(n,s-(t-h)):n}(t))}function _(t){return c=i,f&&r?m(t):(r=a=i,l)}function x(){var t=Aa(),n=v(t);if(r=arguments,a=this,u=t,n){if(c===i)return g(u);if(p)return xi(c),c=Ro(y,e),m(u)}return c===i&&(c=Ro(y,e)),l}return e=vs(e)||0,es(n)&&(d=!!n.leading,s=(p="maxWait"in n)?vn(vs(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),x.cancel=function(){c!==i&&xi(c),h=0,r=u=a=c=i},x.flush=function(){return c===i?l:_(Aa())},x}var Da=Yr((function(t,e){return cr(t,1,e)})),Ia=Yr((function(t,e,n){return cr(t,vs(e)||0,n)}));function Na(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new At(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||qn),n}function Ba(t){if("function"!=typeof t)throw new At(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Na.Cache=qn;var za=yi((function(t,e){var n=(e=1==e.length&&ja(e[0])?Ee(e[0],Ve(ao())):Ee(gr(e,1),Ve(ao()))).length;return Yr((function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return ve(t,this,r)}))})),Fa=Yr((function(t,e){var n=en(e,oo(Fa));return Zi(t,l,i,e,n)})),Ha=Yr((function(t,e){var n=en(e,oo(Ha));return Zi(t,64,i,e,n)})),ka=to((function(t,e){return Zi(t,256,i,i,i,e)}));function Ua(t,e){return t===e||t!=t&&e!=e}var Ga=Wi(Er),Va=Wi((function(t,e){return t>=e})),Wa=Rr(function(){return arguments}())?Rr:function(t){return ns(t)&&Dt.call(t,"callee")&&!te.call(t,"callee")},ja=r.isArray,qa=he?Ve(he):function(t){return ns(t)&&Sr(t)==P};function Xa(t){return null!=t&&ts(t.length)&&!Qa(t)}function Ya(t){return ns(t)&&Xa(t)}var Za=pn||vl,Ja=de?Ve(de):function(t){return ns(t)&&Sr(t)==y};function Ka(t){if(!ns(t))return!1;var e=Sr(t);return e==_||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!os(t)}function Qa(t){if(!es(t))return!1;var e=Sr(t);return e==x||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function $a(t){return"number"==typeof t&&t==ms(t)}function ts(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function es(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ns(t){return null!=t&&"object"==typeof t}var rs=pe?Ve(pe):function(t){return ns(t)&&po(t)==w};function is(t){return"number"==typeof t||ns(t)&&Sr(t)==M}function os(t){if(!ns(t)||Sr(t)!=S)return!1;var e=qt(t);if(null===e)return!0;var n=Dt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ot.call(n)==zt}var as=fe?Ve(fe):function(t){return ns(t)&&Sr(t)==T},ss=me?Ve(me):function(t){return ns(t)&&po(t)==A};function ls(t){return"string"==typeof t||!ja(t)&&ns(t)&&Sr(t)==L}function cs(t){return"symbol"==typeof t||ns(t)&&Sr(t)==C}var us=ge?Ve(ge):function(t){return ns(t)&&ts(t.length)&&!!Qt[Sr(t)]},hs=Wi(Br),ds=Wi((function(t,e){return t<=e}));function ps(t){if(!t)return[];if(Xa(t))return ls(t)?an(t):Ai(t);if(ae&&t[ae])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[ae]());var e=po(t);return(e==w?$e:e==A?nn:Us)(t)}function fs(t){return t?(t=vs(t))===u||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ms(t){var e=fs(t),n=e%1;return e==e?n?e-n:e:0}function gs(t){return t?ar(ms(t),0,p):0}function vs(t){if("number"==typeof t)return t;if(cs(t))return d;if(es(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=es(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ft.test(t);return n||gt.test(t)?ne(t.slice(2),n?2:8):pt.test(t)?d:+t}function ys(t){return Li(t,Ds(t))}function _s(t){return null==t?"":si(t)}var xs=Ri((function(t,e){if(wo(e)||Xa(e))Li(e,Os(e),t);else for(var n in e)Dt.call(e,n)&&tr(t,n,e[n])})),bs=Ri((function(t,e){Li(e,Ds(e),t)})),ws=Ri((function(t,e,n,r){Li(e,Ds(e),t,r)})),Ms=Ri((function(t,e,n,r){Li(e,Os(e),t,r)})),Ss=to(or),Es=Yr((function(t,e){t=St(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&yo(e[0],e[1],o)&&(r=1);++n<r;)for(var a=e[n],s=Ds(a),l=-1,c=s.length;++l<c;){var u=s[l],h=t[u];(h===i||Ua(h,Rt[u])&&!Dt.call(t,u))&&(t[u]=a[u])}return t})),Ts=Yr((function(t){return t.push(i,Ki),ve(Ns,i,t)}));function As(t,e,n){var r=null==t?i:wr(t,e);return r===i?n:r}function Ls(t,e){return null!=t&&fo(t,e,Ar)}var Cs=Hi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),t[e]=n}),el(il)),Rs=Hi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),Dt.call(t,e)?t[e].push(n):t[e]=[n]}),ao),Ps=Yr(Cr);function Os(t){return Xa(t)?Zn(t):Nr(t)}function Ds(t){return Xa(t)?Zn(t,!0):function(t){if(!es(t))return function(t){var e=[];if(null!=t)for(var n in St(t))e.push(n);return e}(t);var e=wo(t),n=[];for(var r in t)("constructor"!=r||!e&&Dt.call(t,r))&&n.push(r);return n}(t)}var Is=Ri((function(t,e,n){kr(t,e,n)})),Ns=Ri((function(t,e,n,r){kr(t,e,n,r)})),Bs=to((function(t,e){var n={};if(null==t)return n;var r=!1;e=Ee(e,(function(e){return e=vi(e,t),r||(r=e.length>1),e})),Li(t,no(t),n),r&&(n=sr(n,7,Qi));for(var i=e.length;i--;)ci(n,e[i]);return n})),zs=to((function(t,e){return null==t?{}:function(t,e){return Vr(t,e,(function(e,n){return Ls(t,n)}))}(t,e)}));function Fs(t,e){if(null==t)return{};var n=Ee(no(t),(function(t){return[t]}));return e=ao(e),Vr(t,n,(function(t,n){return e(t,n[0])}))}var Hs=Yi(Os),ks=Yi(Ds);function Us(t){return null==t?[]:We(t,Os(t))}var Gs=Ii((function(t,e,n){return e=e.toLowerCase(),t+(n?Vs(e):e)}));function Vs(t){return Ks(_s(t).toLowerCase())}function Ws(t){return(t=_s(t))&&t.replace(yt,Ze).replace(jt,"")}var js=Ii((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),qs=Ii((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Xs=Di("toLowerCase"),Ys=Ii((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Zs=Ii((function(t,e,n){return t+(n?" ":"")+Ks(e)})),Js=Ii((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ks=Di("toUpperCase");function Qs(t,e,n){return t=_s(t),(e=n?i:e)===i?function(t){return Zt.test(t)}(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.match(lt)||[]}(t):t.match(e)||[]}var $s=Yr((function(t,e){try{return ve(t,i,e)}catch(t){return Ka(t)?t:new bt(t)}})),tl=to((function(t,e){return _e(e,(function(e){e=Fo(e),ir(t,e,Ra(t[e],t))})),t}));function el(t){return function(){return t}}var nl=zi(),rl=zi(!0);function il(t){return t}function ol(t){return Ir("function"==typeof t?t:sr(t,1))}var al=Yr((function(t,e){return function(n){return Cr(n,t,e)}})),sl=Yr((function(t,e){return function(n){return Cr(t,n,e)}}));function ll(t,e,n){var r=Os(e),i=br(e,r);null!=n||es(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=br(e,Os(e)));var o=!(es(n)&&"chain"in n&&!n.chain),a=Qa(t);return _e(i,(function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),i=n.__actions__=Ai(this.__actions__);return i.push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Te([this.value()],arguments))})})),t}function cl(){}var ul=Ui(Ee),hl=Ui(be),dl=Ui(Ce);function pl(t){return _o(t)?ze(Fo(t)):function(t){return function(e){return wr(e,t)}}(t)}var fl=Vi(),ml=Vi(!0);function gl(){return[]}function vl(){return!1}var yl,_l=ki((function(t,e){return t+e}),0),xl=qi("ceil"),bl=ki((function(t,e){return t/e}),1),wl=qi("floor"),Ml=ki((function(t,e){return t*e}),1),Sl=qi("round"),El=ki((function(t,e){return t-e}),0);return Hn.after=function(t,e){if("function"!=typeof e)throw new At(o);return t=ms(t),function(){if(--t<1)return e.apply(this,arguments)}},Hn.ary=La,Hn.assign=xs,Hn.assignIn=bs,Hn.assignInWith=ws,Hn.assignWith=Ms,Hn.at=Ss,Hn.before=Ca,Hn.bind=Ra,Hn.bindAll=tl,Hn.bindKey=Pa,Hn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ja(t)?t:[t]},Hn.chain=pa,Hn.chunk=function(t,e,n){e=(n?yo(t,e,n):e===i)?1:vn(ms(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var a=0,s=0,l=r(un(o/e));a<o;)l[s++]=ei(t,a,a+=e);return l},Hn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Hn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Te(ja(n)?Ai(n):[n],gr(e,1))},Hn.cond=function(t){var e=null==t?0:t.length,n=ao();return t=e?Ee(t,(function(t){if("function"!=typeof t[1])throw new At(o);return[n(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(ve(i[0],this,n))return ve(i[1],this,n)}}))},Hn.conforms=function(t){return function(t){var e=Os(t);return function(n){return lr(n,t,e)}}(sr(t,1))},Hn.constant=el,Hn.countBy=ga,Hn.create=function(t,e){var n=kn(t);return null==e?n:rr(n,e)},Hn.curry=function t(e,n,r){var o=Zi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Hn.curryRight=function t(e,n,r){var o=Zi(e,16,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Hn.debounce=Oa,Hn.defaults=Es,Hn.defaultsDeep=Ts,Hn.defer=Da,Hn.delay=Ia,Hn.difference=Uo,Hn.differenceBy=Go,Hn.differenceWith=Vo,Hn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ei(t,(e=n||e===i?1:ms(e))<0?0:e,r):[]},Hn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ei(t,0,(e=r-(e=n||e===i?1:ms(e)))<0?0:e):[]},Hn.dropRightWhile=function(t,e){return t&&t.length?hi(t,ao(e,3),!0,!0):[]},Hn.dropWhile=function(t,e){return t&&t.length?hi(t,ao(e,3),!0):[]},Hn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&yo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ms(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ms(r))<0&&(r+=o),r=n>r?0:gs(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Hn.filter=function(t,e){return(ja(t)?we:mr)(t,ao(e,3))},Hn.flatMap=function(t,e){return gr(Sa(t,e),1)},Hn.flatMapDeep=function(t,e){return gr(Sa(t,e),u)},Hn.flatMapDepth=function(t,e,n){return n=n===i?1:ms(n),gr(Sa(t,e),n)},Hn.flatten=qo,Hn.flattenDeep=function(t){return null!=t&&t.length?gr(t,u):[]},Hn.flattenDepth=function(t,e){return null!=t&&t.length?gr(t,e=e===i?1:ms(e)):[]},Hn.flip=function(t){return Zi(t,512)},Hn.flow=nl,Hn.flowRight=rl,Hn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Hn.functions=function(t){return null==t?[]:br(t,Os(t))},Hn.functionsIn=function(t){return null==t?[]:br(t,Ds(t))},Hn.groupBy=ba,Hn.initial=function(t){return null!=t&&t.length?ei(t,0,-1):[]},Hn.intersection=Yo,Hn.intersectionBy=Zo,Hn.intersectionWith=Jo,Hn.invert=Cs,Hn.invertBy=Rs,Hn.invokeMap=wa,Hn.iteratee=ol,Hn.keyBy=Ma,Hn.keys=Os,Hn.keysIn=Ds,Hn.map=Sa,Hn.mapKeys=function(t,e){var n={};return e=ao(e,3),_r(t,(function(t,r,i){ir(n,e(t,r,i),t)})),n},Hn.mapValues=function(t,e){var n={};return e=ao(e,3),_r(t,(function(t,r,i){ir(n,r,e(t,r,i))})),n},Hn.matches=function(t){return Fr(sr(t,1))},Hn.matchesProperty=function(t,e){return Hr(t,sr(e,1))},Hn.memoize=Na,Hn.merge=Is,Hn.mergeWith=Ns,Hn.method=al,Hn.methodOf=sl,Hn.mixin=ll,Hn.negate=Ba,Hn.nthArg=function(t){return t=ms(t),Yr((function(e){return Ur(e,t)}))},Hn.omit=Bs,Hn.omitBy=function(t,e){return Fs(t,Ba(ao(e)))},Hn.once=function(t){return Ca(2,t)},Hn.orderBy=function(t,e,n,r){return null==t?[]:(ja(e)||(e=null==e?[]:[e]),ja(n=r?i:n)||(n=null==n?[]:[n]),Gr(t,e,n))},Hn.over=ul,Hn.overArgs=za,Hn.overEvery=hl,Hn.overSome=dl,Hn.partial=Fa,Hn.partialRight=Ha,Hn.partition=Ea,Hn.pick=zs,Hn.pickBy=Fs,Hn.property=pl,Hn.propertyOf=function(t){return function(e){return null==t?i:wr(t,e)}},Hn.pull=Qo,Hn.pullAll=$o,Hn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Wr(t,e,ao(n,2)):t},Hn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Wr(t,e,i,n):t},Hn.pullAt=ta,Hn.range=fl,Hn.rangeRight=ml,Hn.rearg=ka,Hn.reject=function(t,e){return(ja(t)?we:mr)(t,Ba(ao(e,3)))},Hn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=ao(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return jr(t,i),n},Hn.rest=function(t,e){if("function"!=typeof t)throw new At(o);return Yr(t,e=e===i?e:ms(e))},Hn.reverse=ea,Hn.sampleSize=function(t,e,n){return e=(n?yo(t,e,n):e===i)?1:ms(e),(ja(t)?Kn:Jr)(t,e)},Hn.set=function(t,e,n){return null==t?t:Kr(t,e,n)},Hn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:Kr(t,e,n,r)},Hn.shuffle=function(t){return(ja(t)?Qn:ti)(t)},Hn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&yo(t,e,n)?(e=0,n=r):(e=null==e?0:ms(e),n=n===i?r:ms(n)),ei(t,e,n)):[]},Hn.sortBy=Ta,Hn.sortedUniq=function(t){return t&&t.length?oi(t):[]},Hn.sortedUniqBy=function(t,e){return t&&t.length?oi(t,ao(e,2)):[]},Hn.split=function(t,e,n){return n&&"number"!=typeof n&&yo(t,e,n)&&(e=n=i),(n=n===i?p:n>>>0)?(t=_s(t))&&("string"==typeof e||null!=e&&!as(e))&&!(e=si(e))&&Qe(t)?_i(an(t),0,n):t.split(e,n):[]},Hn.spread=function(t,e){if("function"!=typeof t)throw new At(o);return e=null==e?0:vn(ms(e),0),Yr((function(n){var r=n[e],i=_i(n,0,e);return r&&Te(i,r),ve(t,this,i)}))},Hn.tail=function(t){var e=null==t?0:t.length;return e?ei(t,1,e):[]},Hn.take=function(t,e,n){return t&&t.length?ei(t,0,(e=n||e===i?1:ms(e))<0?0:e):[]},Hn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ei(t,(e=r-(e=n||e===i?1:ms(e)))<0?0:e,r):[]},Hn.takeRightWhile=function(t,e){return t&&t.length?hi(t,ao(e,3),!1,!0):[]},Hn.takeWhile=function(t,e){return t&&t.length?hi(t,ao(e,3)):[]},Hn.tap=function(t,e){return e(t),t},Hn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new At(o);return es(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Oa(t,e,{leading:r,maxWait:e,trailing:i})},Hn.thru=fa,Hn.toArray=ps,Hn.toPairs=Hs,Hn.toPairsIn=ks,Hn.toPath=function(t){return ja(t)?Ee(t,Fo):cs(t)?[t]:Ai(zo(_s(t)))},Hn.toPlainObject=ys,Hn.transform=function(t,e,n){var r=ja(t),i=r||Za(t)||us(t);if(e=ao(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:es(t)&&Qa(o)?kn(qt(t)):{}}return(i?_e:_r)(t,(function(t,r,i){return e(n,t,r,i)})),n},Hn.unary=function(t){return La(t,1)},Hn.union=na,Hn.unionBy=ra,Hn.unionWith=ia,Hn.uniq=function(t){return t&&t.length?li(t):[]},Hn.uniqBy=function(t,e){return t&&t.length?li(t,ao(e,2)):[]},Hn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?li(t,i,e):[]},Hn.unset=function(t,e){return null==t||ci(t,e)},Hn.unzip=oa,Hn.unzipWith=aa,Hn.update=function(t,e,n){return null==t?t:ui(t,e,gi(n))},Hn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ui(t,e,gi(n),r)},Hn.values=Us,Hn.valuesIn=function(t){return null==t?[]:We(t,Ds(t))},Hn.without=sa,Hn.words=Qs,Hn.wrap=function(t,e){return Fa(gi(e),t)},Hn.xor=la,Hn.xorBy=ca,Hn.xorWith=ua,Hn.zip=ha,Hn.zipObject=function(t,e){return fi(t||[],e||[],tr)},Hn.zipObjectDeep=function(t,e){return fi(t||[],e||[],Kr)},Hn.zipWith=da,Hn.entries=Hs,Hn.entriesIn=ks,Hn.extend=bs,Hn.extendWith=ws,ll(Hn,Hn),Hn.add=_l,Hn.attempt=$s,Hn.camelCase=Gs,Hn.capitalize=Vs,Hn.ceil=xl,Hn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=vs(n))==n?n:0),e!==i&&(e=(e=vs(e))==e?e:0),ar(vs(t),e,n)},Hn.clone=function(t){return sr(t,4)},Hn.cloneDeep=function(t){return sr(t,5)},Hn.cloneDeepWith=function(t,e){return sr(t,5,e="function"==typeof e?e:i)},Hn.cloneWith=function(t,e){return sr(t,4,e="function"==typeof e?e:i)},Hn.conformsTo=function(t,e){return null==e||lr(t,e,Os(e))},Hn.deburr=Ws,Hn.defaultTo=function(t,e){return null==t||t!=t?e:t},Hn.divide=bl,Hn.endsWith=function(t,e,n){t=_s(t),e=si(e);var r=t.length,o=n=n===i?r:ar(ms(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},Hn.eq=Ua,Hn.escape=function(t){return(t=_s(t))&&Y.test(t)?t.replace(q,Je):t},Hn.escapeRegExp=function(t){return(t=_s(t))&&nt.test(t)?t.replace(et,"\\$&"):t},Hn.every=function(t,e,n){var r=ja(t)?be:pr;return n&&yo(t,e,n)&&(e=i),r(t,ao(e,3))},Hn.find=va,Hn.findIndex=Wo,Hn.findKey=function(t,e){return Pe(t,ao(e,3),_r)},Hn.findLast=ya,Hn.findLastIndex=jo,Hn.findLastKey=function(t,e){return Pe(t,ao(e,3),xr)},Hn.floor=wl,Hn.forEach=_a,Hn.forEachRight=xa,Hn.forIn=function(t,e){return null==t?t:vr(t,ao(e,3),Ds)},Hn.forInRight=function(t,e){return null==t?t:yr(t,ao(e,3),Ds)},Hn.forOwn=function(t,e){return t&&_r(t,ao(e,3))},Hn.forOwnRight=function(t,e){return t&&xr(t,ao(e,3))},Hn.get=As,Hn.gt=Ga,Hn.gte=Va,Hn.has=function(t,e){return null!=t&&fo(t,e,Tr)},Hn.hasIn=Ls,Hn.head=Xo,Hn.identity=il,Hn.includes=function(t,e,n,r){t=Xa(t)?t:Us(t),n=n&&!r?ms(n):0;var i=t.length;return n<0&&(n=vn(i+n,0)),ls(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&De(t,e,n)>-1},Hn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ms(n);return i<0&&(i=vn(r+i,0)),De(t,e,i)},Hn.inRange=function(t,e,n){return e=fs(e),n===i?(n=e,e=0):n=fs(n),function(t,e,n){return t>=yn(e,n)&&t<vn(e,n)}(t=vs(t),e,n)},Hn.invoke=Ps,Hn.isArguments=Wa,Hn.isArray=ja,Hn.isArrayBuffer=qa,Hn.isArrayLike=Xa,Hn.isArrayLikeObject=Ya,Hn.isBoolean=function(t){return!0===t||!1===t||ns(t)&&Sr(t)==v},Hn.isBuffer=Za,Hn.isDate=Ja,Hn.isElement=function(t){return ns(t)&&1===t.nodeType&&!os(t)},Hn.isEmpty=function(t){if(null==t)return!0;if(Xa(t)&&(ja(t)||"string"==typeof t||"function"==typeof t.splice||Za(t)||us(t)||Wa(t)))return!t.length;var e=po(t);if(e==w||e==A)return!t.size;if(wo(t))return!Nr(t).length;for(var n in t)if(Dt.call(t,n))return!1;return!0},Hn.isEqual=function(t,e){return Pr(t,e)},Hn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Pr(t,e,i,n):!!r},Hn.isError=Ka,Hn.isFinite=function(t){return"number"==typeof t&&fn(t)},Hn.isFunction=Qa,Hn.isInteger=$a,Hn.isLength=ts,Hn.isMap=rs,Hn.isMatch=function(t,e){return t===e||Or(t,e,lo(e))},Hn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Or(t,e,lo(e),n)},Hn.isNaN=function(t){return is(t)&&t!=+t},Hn.isNative=function(t){if(bo(t))throw new bt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dr(t)},Hn.isNil=function(t){return null==t},Hn.isNull=function(t){return null===t},Hn.isNumber=is,Hn.isObject=es,Hn.isObjectLike=ns,Hn.isPlainObject=os,Hn.isRegExp=as,Hn.isSafeInteger=function(t){return $a(t)&&t>=-9007199254740991&&t<=h},Hn.isSet=ss,Hn.isString=ls,Hn.isSymbol=cs,Hn.isTypedArray=us,Hn.isUndefined=function(t){return t===i},Hn.isWeakMap=function(t){return ns(t)&&po(t)==R},Hn.isWeakSet=function(t){return ns(t)&&"[object WeakSet]"==Sr(t)},Hn.join=function(t,e){return null==t?"":mn.call(t,e)},Hn.kebabCase=js,Hn.last=Ko,Hn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ms(n))<0?vn(r+o,0):yn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Oe(t,Ne,o,!0)},Hn.lowerCase=qs,Hn.lowerFirst=Xs,Hn.lt=hs,Hn.lte=ds,Hn.max=function(t){return t&&t.length?fr(t,il,Er):i},Hn.maxBy=function(t,e){return t&&t.length?fr(t,ao(e,2),Er):i},Hn.mean=function(t){return Be(t,il)},Hn.meanBy=function(t,e){return Be(t,ao(e,2))},Hn.min=function(t){return t&&t.length?fr(t,il,Br):i},Hn.minBy=function(t,e){return t&&t.length?fr(t,ao(e,2),Br):i},Hn.stubArray=gl,Hn.stubFalse=vl,Hn.stubObject=function(){return{}},Hn.stubString=function(){return""},Hn.stubTrue=function(){return!0},Hn.multiply=Ml,Hn.nth=function(t,e){return t&&t.length?Ur(t,ms(e)):i},Hn.noConflict=function(){return oe._===this&&(oe._=Ft),this},Hn.noop=cl,Hn.now=Aa,Hn.pad=function(t,e,n){t=_s(t);var r=(e=ms(e))?on(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Gi(hn(i),n)+t+Gi(un(i),n)},Hn.padEnd=function(t,e,n){t=_s(t);var r=(e=ms(e))?on(t):0;return e&&r<e?t+Gi(e-r,n):t},Hn.padStart=function(t,e,n){t=_s(t);var r=(e=ms(e))?on(t):0;return e&&r<e?Gi(e-r,n)+t:t},Hn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(_s(t).replace(rt,""),e||0)},Hn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&yo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fs(t),e===i?(e=t,t=0):e=fs(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=bn();return yn(t+o*(e-t+ee("1e-"+((o+"").length-1))),e)}return qr(t,e)},Hn.reduce=function(t,e,n){var r=ja(t)?Ae:He,i=arguments.length<3;return r(t,ao(e,4),n,i,hr)},Hn.reduceRight=function(t,e,n){var r=ja(t)?Le:He,i=arguments.length<3;return r(t,ao(e,4),n,i,dr)},Hn.repeat=function(t,e,n){return e=(n?yo(t,e,n):e===i)?1:ms(e),Xr(_s(t),e)},Hn.replace=function(){var t=arguments,e=_s(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Hn.result=function(t,e,n){var r=-1,o=(e=vi(e,t)).length;for(o||(o=1,t=i);++r<o;){var a=null==t?i:t[Fo(e[r])];a===i&&(r=o,a=n),t=Qa(a)?a.call(t):a}return t},Hn.round=Sl,Hn.runInContext=t,Hn.sample=function(t){return(ja(t)?Jn:Zr)(t)},Hn.size=function(t){if(null==t)return 0;if(Xa(t))return ls(t)?on(t):t.length;var e=po(t);return e==w||e==A?t.size:Nr(t).length},Hn.snakeCase=Ys,Hn.some=function(t,e,n){var r=ja(t)?Ce:ni;return n&&yo(t,e,n)&&(e=i),r(t,ao(e,3))},Hn.sortedIndex=function(t,e){return ri(t,e)},Hn.sortedIndexBy=function(t,e,n){return ii(t,e,ao(n,2))},Hn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ri(t,e);if(r<n&&Ua(t[r],e))return r}return-1},Hn.sortedLastIndex=function(t,e){return ri(t,e,!0)},Hn.sortedLastIndexBy=function(t,e,n){return ii(t,e,ao(n,2),!0)},Hn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ri(t,e,!0)-1;if(Ua(t[n],e))return n}return-1},Hn.startCase=Zs,Hn.startsWith=function(t,e,n){return t=_s(t),n=null==n?0:ar(ms(n),0,t.length),e=si(e),t.slice(n,n+e.length)==e},Hn.subtract=El,Hn.sum=function(t){return t&&t.length?ke(t,il):0},Hn.sumBy=function(t,e){return t&&t.length?ke(t,ao(e,2)):0},Hn.template=function(t,e,n){var r=Hn.templateSettings;n&&yo(t,e,n)&&(e=i),t=_s(t),e=ws({},e,r,Ji);var o,a,s=ws({},e.imports,r.imports,Ji),l=Os(s),c=We(s,l),u=0,h=e.interpolate||_t,d="__p += '",p=Et((e.escape||_t).source+"|"+h.source+"|"+(h===K?ht:_t).source+"|"+(e.evaluate||_t).source+"|$","g"),f="//# sourceURL="+(Dt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Kt+"]")+"\n";t.replace(p,(function(e,n,r,i,s,l){return r||(r=i),d+=t.slice(u,l).replace(xt,Ke),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),s&&(a=!0,d+="';\n"+s+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+e.length,e})),d+="';\n";var m=Dt.call(e,"variable")&&e.variable;if(m){if(ct.test(m))throw new bt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(G,""):d).replace(V,"$1").replace(W,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=$s((function(){return wt(l,f+"return "+d).apply(i,c)}));if(g.source=d,Ka(g))throw g;return g},Hn.times=function(t,e){if((t=ms(t))<1||t>h)return[];var n=p,r=yn(t,p);e=ao(e),t-=p;for(var i=Ue(r,e);++n<t;)e(n);return i},Hn.toFinite=fs,Hn.toInteger=ms,Hn.toLength=gs,Hn.toLower=function(t){return _s(t).toLowerCase()},Hn.toNumber=vs,Hn.toSafeInteger=function(t){return t?ar(ms(t),-9007199254740991,h):0===t?t:0},Hn.toString=_s,Hn.toUpper=function(t){return _s(t).toUpperCase()},Hn.trim=function(t,e,n){if((t=_s(t))&&(n||e===i))return Ge(t);if(!t||!(e=si(e)))return t;var r=an(t),o=an(e);return _i(r,qe(r,o),Xe(r,o)+1).join("")},Hn.trimEnd=function(t,e,n){if((t=_s(t))&&(n||e===i))return t.slice(0,sn(t)+1);if(!t||!(e=si(e)))return t;var r=an(t);return _i(r,0,Xe(r,an(e))+1).join("")},Hn.trimStart=function(t,e,n){if((t=_s(t))&&(n||e===i))return t.replace(rt,"");if(!t||!(e=si(e)))return t;var r=an(t);return _i(r,qe(r,an(e))).join("")},Hn.truncate=function(t,e){var n=30,r="...";if(es(e)){var o="separator"in e?e.separator:o;n="length"in e?ms(e.length):n,r="omission"in e?si(e.omission):r}var a=(t=_s(t)).length;if(Qe(t)){var s=an(t);a=s.length}if(n>=a)return t;var l=n-on(r);if(l<1)return r;var c=s?_i(s,0,l).join(""):t.slice(0,l);if(o===i)return c+r;if(s&&(l+=c.length-l),as(o)){if(t.slice(l).search(o)){var u,h=c;for(o.global||(o=Et(o.source,_s(dt.exec(o))+"g")),o.lastIndex=0;u=o.exec(h);)var d=u.index;c=c.slice(0,d===i?l:d)}}else if(t.indexOf(si(o),l)!=l){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},Hn.unescape=function(t){return(t=_s(t))&&X.test(t)?t.replace(j,ln):t},Hn.uniqueId=function(t){var e=++It;return _s(t)+e},Hn.upperCase=Js,Hn.upperFirst=Ks,Hn.each=_a,Hn.eachRight=xa,Hn.first=Xo,ll(Hn,(yl={},_r(Hn,(function(t,e){Dt.call(Hn.prototype,e)||(yl[e]=t)})),yl),{chain:!1}),Hn.VERSION="4.17.21",_e(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Hn[t].placeholder=Hn})),_e(["drop","take"],(function(t,e){Vn.prototype[t]=function(n){n=n===i?1:vn(ms(n),0);var r=this.__filtered__&&!e?new Vn(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,p),type:t+(r.__dir__<0?"Right":"")}),r},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),_e(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Vn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ao(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),_e(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}})),_e(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Vn.prototype[t]=function(){return this.__filtered__?new Vn(this):this[n](1)}})),Vn.prototype.compact=function(){return this.filter(il)},Vn.prototype.find=function(t){return this.filter(t).head()},Vn.prototype.findLast=function(t){return this.reverse().find(t)},Vn.prototype.invokeMap=Yr((function(t,e){return"function"==typeof t?new Vn(this):this.map((function(n){return Cr(n,t,e)}))})),Vn.prototype.reject=function(t){return this.filter(Ba(ao(t)))},Vn.prototype.slice=function(t,e){t=ms(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Vn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ms(e))<0?n.dropRight(-e):n.take(e-t)),n)},Vn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Vn.prototype.toArray=function(){return this.take(p)},_r(Vn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Hn[r?"take"+("last"==e?"Right":""):e],a=r||/^find/.test(e);o&&(Hn.prototype[e]=function(){var e=this.__wrapped__,s=r?[1]:arguments,l=e instanceof Vn,c=s[0],u=l||ja(e),h=function(t){var e=o.apply(Hn,Te([t],s));return r&&d?e[0]:e};u&&n&&"function"==typeof c&&1!=c.length&&(l=u=!1);var d=this.__chain__,p=!!this.__actions__.length,f=a&&!d,m=l&&!p;if(!a&&u){e=m?e:new Vn(this);var g=t.apply(e,s);return g.__actions__.push({func:fa,args:[h],thisArg:i}),new Gn(g,d)}return f&&m?t.apply(this,s):(g=this.thru(h),f?r?g.value()[0]:g.value():g)})})),_e(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Lt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Hn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(ja(i)?i:[],t)}return this[n]((function(n){return e.apply(ja(n)?n:[],t)}))}})),_r(Vn.prototype,(function(t,e){var n=Hn[e];if(n){var r=n.name+"";Dt.call(Rn,r)||(Rn[r]=[]),Rn[r].push({name:e,func:n})}})),Rn[Fi(i,2).name]=[{name:"wrapper",func:i}],Vn.prototype.clone=function(){var t=new Vn(this.__wrapped__);return t.__actions__=Ai(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ai(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ai(this.__views__),t},Vn.prototype.reverse=function(){if(this.__filtered__){var t=new Vn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Vn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=ja(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=yn(e,t+a);break;case"takeRight":t=vn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,c=r?s:a-1,u=this.__iteratees__,h=u.length,d=0,p=yn(l,this.__takeCount__);if(!n||!r&&i==l&&p==l)return di(t,this.__actions__);var f=[];t:for(;l--&&d<p;){for(var m=-1,g=t[c+=e];++m<h;){var v=u[m],y=v.iteratee,_=v.type,x=y(g);if(2==_)g=x;else if(!x){if(1==_)continue t;break t}}f[d++]=g}return f},Hn.prototype.at=ma,Hn.prototype.chain=function(){return pa(this)},Hn.prototype.commit=function(){return new Gn(this.value(),this.__chain__)},Hn.prototype.next=function(){this.__values__===i&&(this.__values__=ps(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Hn.prototype.plant=function(t){for(var e,n=this;n instanceof Un;){var r=ko(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},Hn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vn){var e=t;return this.__actions__.length&&(e=new Vn(this)),(e=e.reverse()).__actions__.push({func:fa,args:[ea],thisArg:i}),new Gn(e,this.__chain__)}return this.thru(ea)},Hn.prototype.toJSON=Hn.prototype.valueOf=Hn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Hn.prototype.first=Hn.prototype.head,ae&&(Hn.prototype[ae]=function(){return this}),Hn}();oe._=cn,(r=function(){return cn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},307:(t,e,n)=>{"use strict";n.r(e)},273:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>M});var r=n(171),i=n.n(r),o=n(472),a=n.n(o);const{assign:s}=Object,{min:l,max:c}=Math,u=((t="")=>function(e,n={},r=[]){(n instanceof Node||"string"==typeof n||Array.isArray(n))&&(r=n,n={}),r&&!Array.isArray(r)&&(r=[r]);const[i,...o]=e.split("."),[a,l]=i.split("#"),c=document.createElement(a||"div");l&&(c.id=l);for(const e of o)c.classList.add(t+e);for(const t of r)t&&c.appendChild("string"==typeof t?document.createTextNode(t):t);return s(c,n)})("panic-overlay__"),h=u("style","\n\n.panic-overlay__modal {\n \n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background:white;\n z-index: 10000;\n box-sizing: border-box;\n overflow-y: scroll;\n overflow-x: hidden;\n font-size:18px;\n --left-pad: 60px;\n}\n\n.panic-overlay__modal,\n.panic-overlay__modal * {\n display: block;\n padding: 0;\n margin: 0;\n font-family: Menlo, Monaco, \"Courier New\", Courier, monospace;\n}\n\n.panic-overlay__modal span,\n.panic-overlay__modal em,\n.panic-overlay__modal strong {\n display: inline;\n}\n\n.panic-overlay strong {\n font-weight: bold;\n}\n\n.panic-overlay__hidden {\n display: none;\n}\n\n.panic-overlay__modal h1 {\n\n color: black;\n margin: 0;\n padding: 0;\n font-size: 1.77em;\n font-weight: 600;\n opacity: 0.75;\n margin-top:50px;\n margin-bottom:45px;\n position: relative;\n padding-left: var(--left-pad);\n}\n\n.panic-overlay__close {\n color: black;\n font-weight: normal;\n text-decoration: none;\n position: absolute;\n top:-0.32em;\n right: 1em;\n font-size: 1.77em;\n opacity: 0.15;\n transition: all 0.25s ease-in-out;\n}\n\n.panic-overlay__close:hover {\n transform:scale(1.5);\n opacity: 0.25;\n}\n\n.panic-overlay__error {\n margin: 1em 0 3em 0;\n left:0;\n}\n\n.panic-overlay__error-title {\n display: flex;\n align-items: stretch;\n padding-right: 50px;\n}\n\n.panic-overlay__error-type {\n min-height: 2.8em;\n display: flex !important;\n align-items: center;\n padding:0 1em;\n background: rgb(255, 0, 64);\n color: white;\n margin-right: 2em;\n padding-left: var(--left-pad);\n white-space: nowrap;\n}\n\n.panic-overlay__error-counter {\n color: white;\n opacity: 0.3;\n position: absolute;\n left: 0.8em;\n}\n\n.panic-overlay__error-message {\n display: flex !important;\n align-items: center;\n font-weight:400;\n line-height: 1em;\n}\n\n.panic-overlay__error-stack {\n margin-top: 2em;\n white-space: pre;\n padding-left: var(--left-pad);\n}\n\n.panic-overlay__stack-entry {\n cursor: pointer;\n margin-bottom: 2.5em;\n}\n\n.panic-overlay__collapsed .panic-overlay__stack-entry-hidden {\n display: none;\n}\n\n.panic-overlay__file {\n font-weight: bold;\n margin-top: 2.5em;\n margin-bottom: 1.5em;\n color: rgb(202, 17, 63);\n}\n\n.panic-overlay__file strong {\n text-decoration: underline;\n}\n\n.panic-overlay__file:before,\n.panic-overlay__more:before {\n content: '@ ';\n opacity: 0.5;\n margin-left: -1.25em;\n}\n\n.panic-overlay__more:before {\n content: '▷ ';\n opacity: 0.5;\n}\n\n.panic-overlay__more {\n opacity: 0.25;\n color: black;\n font-size: 0.835em;\n cursor: pointer;\n text-align: center;\n display: none;\n}\n\n.panic-overlay__more em {\n font-style: normal;\n font-weight: normal;\n border-bottom: 1px dashed black;\n}\n\n.panic-overlay__collapsed .panic-overlay__more {\n display: block;\n}\n\n.panic-overlay__lines {\n color:rgb(187, 165, 165);\n font-size: 0.835em;\n}\n\n.panic-overlay__lines:not(.panic-overlay__no-fade) {\n -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 75%, rgba(0,0,0,0));\n mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 75%, rgba(0,0,0,0));\n}\n\n.panic-overlay__line-number { \n padding-right: 1.5em;\n opacity: 0.5;\n}\n\n.panic-overlay__line-hili {\n background: #ffff78;\n color: #5f4545;\n}\n\n.panic-overlay__stack-entry:first-child .panic-overlay__line-hili strong {\n text-decoration: underline wavy #ff0040;\n}\n\n.panic-overlay__line-hili em {\n font-style: italic;\n color: rgb(255, 0, 64);\n font-size: 0.75em;\n margin-left: 2em;\n opacity: 0.25;\n position: relative;\n top: -0.115em;\n white-space: nowrap;\n}\n\n.panic-overlay__line-hili em:before {\n content: '← ';\n}\n\n.panic-overlay__no-source {\n font-style: italic;\n}\n\n@media only screen and (max-width: 640px) {\n\n .panic-overlay__modal {\n font-size: 15px;\n --left-pad: 50px;\n }\n \n .panic-overlay__modal h1 {\n margin:40px 0;\n }\n}\n\n@media only screen and (max-width: 500px) {\n \n .panic-overlay__modal {\n font-size: 14px;\n --left-pad: 45px;\n }\n \n .panic-overlay__modal h1 {\n margin:30px 0;\n }\n}\n\n"),d={handleErrors:!0,projectRoot:void 0,stackEntryClicked(t){this.projectRoot&&(window.location=`vscode://file/${a().concat(this.projectRoot,t.fileRelative)}:${t.line}:${t.column}`)}},p=d,f=u(".errors"),m=u(".modal.hidden.collapsed",[u("h1",["Oops :(",u("a.close",{href:"#",onclick(){x(!1)}},"×")]),f]),g=(t,e)=>(t.thirdParty||t.native||t.hide)&&0!==e;function v(t,e,n){const[r,i]=[t.slice(0,e-1),t.slice(e-1)];return[r,u("strong",i)]}function y(t){const e=new(i())(t).withSources(),n=e.clean().asTable();for(const t of f.childNodes)if(t._indexText===n)return void s(t.querySelector(".panic-overlay__error-counter"),{innerText:t._counter=(t._counter||1)+1,style:""});const r=()=>m.classList.remove("panic-overlay__collapsed"),o=String(t&&(t.type||t.constructor&&t.constructor.name)||typeof t),a=String(t&&t.message),h=u(".error",{_indexText:n},[u(".error-title",[u("span.error-type",[o,u("span.error-counter",{style:"display: none;"})]),u("span.error-message",a)]),u(".error-stack",[...e.items.map(((t,e)=>function(t,e,n){const{sourceFile:r={lines:[]},line:i,column:o,fileShort:a,calleeShort:s}=t,h=i-1,d=r.lines.length;let f=h-4,m=h+4+2;f<0&&(m=l(m-f,d),f=0),m>d&&(f=c(0,f-(m-d)),m=d);const y=r.lines.slice(f,m),_=String(f+y.length).length,x=i-f-1,b=x===y.length-1,w=".stack-entry"+(g(t,e)?".stack-entry-hidden":"");return u(w,{onclick(){p.stackEntryClicked(t)}},[u(".file",u("strong",a)),u(".lines"+(b?".no-fade":""),y.length?y.map(((t,e)=>u(".line"+(e===x?".line-hili":""),[u("span.line-number",String(f+e+1).padStart(_," ")),u("span.line-text",e===x?v(t,o):t)]))):[u(".line",[u("span.line-number",String(i)),u("span.line-text.no-source",`… somewhere at ${s?s+"()":"???"} …`)])])])}(t,e))),u(".more",u("em",{onclick:r},"show more"))])]);return e.items.find(g)||r(),f.insertBefore(h,f.firstChild),f.childElementCount>10&&f.lastChild.remove(),x(!0),y}let _=!1;function x(t){return document.body&&(t&&(document.head.appendChild(h),document.body.appendChild(m)),document.body.classList.toggle("panic-overlay__visible",t)),m.classList.toggle("panic-overlay__hidden",!t),_&&!t&&(f.innerText="",m.classList.add("panic-overlay__collapsed")),_=t,y}function b(t){p.handleErrors&&y(t)}var w;window.addEventListener("error",(t=>b(t.error))),window.addEventListener("unhandledrejection",(t=>b(t.reason))),w=()=>{x(_)},document.body?w():document.addEventListener("DOMContentLoaded",w),y.toggle=x,y.configure=function(t){return s(p,d,t),y};const M=y},299:t=>{"use strict";var e=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};const n="[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]",r=new RegExp("(?:"+n+")|[\0-\b\v-\u2028\u2029\ufeff︀-️]","g"),i=new RegExp("(?:"+n+")|[\n\0-\b\v-\u2028\u2029\ufeff︀-️]","g"),o=new RegExp("((?:"+n+")|[\t\n\0-\b\v-\u2028\u2029\ufeff︀-️])?([^\t\n\0-\b\v-\u2028\u2029\ufeff︀-️]*)","g");t.exports={zeroWidthCharacters:i,ansiEscapeCodes:new RegExp(n,"g"),strlen:t=>Array.from(t.replace(i,"")).length,isBlank:t=>0===t.replace(i,"").replace(/\s/g,"").length,blank:t=>Array.from(t.replace(r,"")).map((t=>"\t"===t||"\n"===t?t:" ")).join(""),partition(t){for(var e,n=[];o.lastIndex!==t.length&&(e=o.exec(t));)n.push([e[1]||"",e[2]]);return o.lastIndex=0,n},first(n,r){let i="",o=0;for(const s of t.exports.partition(n)){var a=e(s,2);const t=a[0],n=a[1],l=Array.from(n).slice(0,r-o);i+=t+l.join(""),o+=l.length}return i}}},490:t=>{"use strict";t.exports=(t,e)=>{const n=t||[],r=[];let i={label:void 0,items:[n.first]};return n.forEach((t=>{const n=e(t);i.label!==n&&i.items.length?r.push(i={label:n,items:[t]}):i.items.push(t)})),r}},171:(t,e,n)=>{"use strict";t=n.nmd(t);const r=Object,i="undefined"!=typeof window&&window.window===window&&window.navigator,o=i?null:t.require,a=t=>t[t.length-1],s=n(144),l=n(490),c=n(369),u=t=>t.replace(/\\/g,"/"),h=i?window.location.href:u(process.cwd())+"/";class d{constructor(t,e){const n=t,r=t&&t instanceof SyntaxError&&!i;if(t||(t=new Error,e=void 0===e?1:e),t instanceof Error&&(t=t.stack||""),"string"==typeof t&&(t=this.rawParse(t).slice(e).map((t=>this.extractEntryMetadata(t)))),Array.isArray(t)){if(r){const e=o("util").inspect(n).split("\n"),r=e[0].split(":"),i=r.pop(),a=r.join(":");a&&t.unshift({file:u(a),line:i,column:(e[2]||"").indexOf("^")+1,sourceLine:e[1],callee:"(syntax error)",syntaxError:!0})}this.items=t}else this.items=[]}extractEntryMetadata(t){const e=this.decomposePath(t.file||""),n=e[0],i=e[1];return r.assign(t,{calleeShort:t.calleeShort||a((t.callee||"").split(".")),fileRelative:n,fileShort:this.shortenPath(n),fileName:a((t.file||"").split("/")),thirdParty:this.isThirdParty(n,i)&&!t.index,externalDomain:i})}shortenPath(t){return t.replace(/^node_modules\//,"").replace(/^webpack\/bootstrap\//,"").replace(/^__parcel_source_root\//,"")}decomposePath(t){let e=t;i&&(e=e.replace(h,""));const n=e.match(/^(http|https)\:\/\/?([^\/]+)\/(.*)/),r=n?n[2]:void 0;return e=n?n[3]:e,i||(e=o("path").relative(h,e)),[u(e).replace(/^.*\:\/\/?\/?/,""),r]}isThirdParty(t,e){return e||"~"===t[0]||"/"===t[0]||0===t.indexOf("node_modules")||0===t.indexOf("webpack/bootstrap")}rawParse(t){return(t||"").split("\n").map((t=>{let e,n,r,o,a=[];if((r=(t=t.trim()).match(/at (.+) \(eval at .+ \((.+)\), .+\)/))||(r=t.match(/at (.+) \((.+)\)/))||"at "!==t.slice(0,3)&&(r=t.match(/(.*)@(.*)/)))e=r[1],n="native"===r[2],a=(r[2].match(/(.*):(\d+):(\d+)/)||r[2].match(/(.*):(\d+)/)||[]).slice(1);else{if(!(o=t.match(/^(at\s+)*(.+):(\d+):(\d+)/)))return;a=o.slice(2)}return e&&!a[0]&&"Array"===e.split(".")[0]&&(n=!0),{beforeParse:t,callee:e||"",index:i&&a[0]===window.location.href,native:n||!1,file:u(a[0]||""),line:parseInt(a[1]||"",10)||void 0,column:parseInt(a[2]||"",10)||void 0}})).filter((t=>void 0!==t))}withSourceAt(t){return this.items[t]&&this.withSource(this.items[t])}withSourceAsyncAt(t){return this.items[t]&&this.withSourceAsync(this.items[t])}withSource(t){if(this.shouldSkipResolving(t))return t;{let e=s(t.file||"").resolve(t);return e.sourceFile?this.withSourceResolved(t,e):t}}withSourceAsync(t){return this.shouldSkipResolving(t)?Promise.resolve(t):s.async(t.file||"").then((e=>e.resolve(t))).then((e=>this.withSourceResolved(t,e))).catch((e=>this.withSourceResolved(t,{error:e,sourceLine:""})))}shouldSkipResolving(t){return t.sourceFile||t.error||t.file&&t.file.indexOf("<")>=0}withSourceResolved(t,e){return e.sourceFile&&!e.sourceFile.error&&(e.file=u(e.sourceFile.path),e=this.extractEntryMetadata(e)),e.sourceLine.includes("// @hide")&&(e.sourceLine=e.sourceLine.replace("// @hide",""),e.hide=!0),(e.sourceLine.includes("__webpack_require__")||e.sourceLine.includes("/******/ ({"))&&(e.thirdParty=!0),r.assign({sourceLine:""},t,e)}withSources(){return this.map((t=>this.withSource(t)))}withSourcesAsync(){return Promise.all(this.items.map((t=>this.withSourceAsync(t)))).then((t=>new d(t)))}mergeRepeatedLines(){return new d(l(this.items,(t=>t.file+t.line)).map((t=>t.items.slice(1).reduce(((t,e)=>(t.callee=(t.callee||"<anonymous>")+" → "+(e.callee||"<anonymous>"),t.calleeShort=(t.calleeShort||"<anonymous>")+" → "+(e.calleeShort||"<anonymous>"),t)),r.assign({},t.items[0])))))}clean(){const t=this.withSources().mergeRepeatedLines();return t.filter(t.isClean.bind(t))}cleanAsync(){return this.withSourcesAsync().then((t=>(t=t.mergeRepeatedLines()).filter(t.isClean.bind(t))))}isClean(t,e){return 0===e||!(t.thirdParty||t.hide||t.native)}at(t){return r.assign({beforeParse:"",callee:"<???>",index:!1,native:!1,file:"<???>",line:0,column:0},this.items[t])}asTable(t){const e=t&&t.maxColumnWidths||this.maxColumnWidths(),n=(t,e)=>t&&(t.length>e?t.slice(0,e-1)+"…":t),r=this.map((t=>{return["at "+n(t.calleeShort,e.callee),(r=t.fileShort&&t.fileShort+":"+t.line||"",i=e.file,r&&(r.length>i?"…"+r.slice(-(i-1)):r)),n((t.sourceLine||"").trim()||"",e.sourceLine)];var r,i}));return c(r.items)}maxColumnWidths(){return{callee:30,file:60,sourceLine:80}}static resetCache(){s.resetCache(),s.async.resetCache()}static locationsEqual(t,e){return t.file===e.file&&t.line===e.line&&t.column===e.column}}["map","filter","slice","concat"].forEach((t=>{d.prototype[t]=function(){return new d(this.items[t].apply(this.items,arguments))}})),t.exports=d},212:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ACESFilmicToneMapping:()=>nt,AddEquation:()=>E,AddOperation:()=>K,AdditiveAnimationBlendMode:()=>qe,AdditiveBlending:()=>b,AlphaFormat:()=>Bt,AlwaysDepth:()=>G,AlwaysStencilFunc:()=>Sn,AmbientLight:()=>hh,AmbientLightProbe:()=>Dh,AnimationClip:()=>du,AnimationLoader:()=>xu,AnimationMixer:()=>hd,AnimationObjectGroup:()=>cd,AnimationUtils:()=>$c,ArcCurve:()=>Lu,ArrayCamera:()=>Ls,ArrowHelper:()=>ep,Audio:()=>Wh,AudioAnalyser:()=>Jh,AudioContext:()=>Rh,AudioListener:()=>Vh,AudioLoader:()=>Ph,AxesHelper:()=>np,AxisHelper:()=>$p,BackSide:()=>m,BasicDepthPacking:()=>on,BasicShadowMap:()=>u,BinaryTextureLoader:()=>of,Bone:()=>dl,BooleanKeyframeTrack:()=>ou,BoundingBoxHelper:()=>tf,Box2:()=>bd,Box3:()=>tr,Box3Helper:()=>Jd,BoxBufferGeometry:()=>ho,BoxGeometry:()=>ho,BoxHelper:()=>Zd,BufferAttribute:()=>Si,BufferGeometry:()=>ji,BufferGeometryLoader:()=>_h,ByteType:()=>Et,Cache:()=>fu,Camera:()=>vo,CameraHelper:()=>qd,CanvasRenderer:()=>sf,CanvasTexture:()=>Ul,CatmullRomCurve3:()=>Iu,CineonToneMapping:()=>et,CircleBufferGeometry:()=>Vl,CircleGeometry:()=>Vl,ClampToEdgeWrapping:()=>dt,Clock:()=>zh,Color:()=>xi,ColorKeyframeTrack:()=>au,CompressedTexture:()=>kl,CompressedTextureLoader:()=>bu,ConeBufferGeometry:()=>jl,ConeGeometry:()=>jl,CubeCamera:()=>xo,CubeReflectionMapping:()=>ot,CubeRefractionMapping:()=>at,CubeTexture:()=>bo,CubeTextureLoader:()=>Mu,CubeUVReflectionMapping:()=>ct,CubeUVRefractionMapping:()=>ut,CubicBezierCurve:()=>Fu,CubicBezierCurve3:()=>Hu,CubicInterpolant:()=>eu,CullFaceBack:()=>s,CullFaceFront:()=>l,CullFaceFrontBack:()=>c,CullFaceNone:()=>a,Curve:()=>Tu,CurvePath:()=>qu,CustomBlending:()=>S,CustomToneMapping:()=>rt,CylinderBufferGeometry:()=>Wl,CylinderGeometry:()=>Wl,Cylindrical:()=>_d,DataTexture:()=>Mo,DataTexture2DArray:()=>Xo,DataTexture3D:()=>Yo,DataTextureLoader:()=>Su,DataUtils:()=>op,DecrementStencilOp:()=>pn,DecrementWrapStencilOp:()=>mn,DefaultLoadingManager:()=>gu,DepthFormat:()=>Gt,DepthStencilFormat:()=>Vt,DepthTexture:()=>Gl,DirectionalLight:()=>uh,DirectionalLightHelper:()=>Vd,DiscreteInterpolant:()=>ru,DodecahedronBufferGeometry:()=>Xl,DodecahedronGeometry:()=>Xl,DoubleSide:()=>g,DstAlphaFactor:()=>B,DstColorFactor:()=>F,DynamicBufferAttribute:()=>Vp,DynamicCopyUsage:()=>On,DynamicDrawUsage:()=>Tn,DynamicReadUsage:()=>Cn,EdgesGeometry:()=>Ql,EdgesHelper:()=>ef,EllipseCurve:()=>Au,EqualDepth:()=>j,EqualStencilFunc:()=>_n,EquirectangularReflectionMapping:()=>st,EquirectangularRefractionMapping:()=>lt,Euler:()=>Nr,EventDispatcher:()=>Bn,ExtrudeBufferGeometry:()=>Tc,ExtrudeGeometry:()=>Tc,FaceColors:()=>Op,FileLoader:()=>_u,FlatShading:()=>v,Float16BufferAttribute:()=>Oi,Float32Attribute:()=>Kp,Float32BufferAttribute:()=>Di,Float64Attribute:()=>Qp,Float64BufferAttribute:()=>Ii,FloatType:()=>Rt,Fog:()=>Bs,FogExp2:()=>Ns,Font:()=>Th,FontLoader:()=>Lh,FrontSide:()=>f,Frustum:()=>To,GLBufferAttribute:()=>fd,GLSL1:()=>In,GLSL3:()=>Nn,GammaEncoding:()=>Qe,GreaterDepth:()=>X,GreaterEqualDepth:()=>q,GreaterEqualStencilFunc:()=>Mn,GreaterStencilFunc:()=>bn,GridHelper:()=>Fd,Group:()=>Cs,HalfFloatType:()=>Pt,HemisphereLight:()=>Ju,HemisphereLightHelper:()=>zd,HemisphereLightProbe:()=>Oh,IcosahedronBufferGeometry:()=>Lc,IcosahedronGeometry:()=>Lc,ImageBitmapLoader:()=>Sh,ImageLoader:()=>wu,ImageUtils:()=>Vn,ImmediateRenderObject:()=>Ed,IncrementStencilOp:()=>dn,IncrementWrapStencilOp:()=>fn,InstancedBufferAttribute:()=>yh,InstancedBufferGeometry:()=>vh,InstancedInterleavedBuffer:()=>pd,InstancedMesh:()=>xl,Int16Attribute:()=>Xp,Int16BufferAttribute:()=>Li,Int32Attribute:()=>Zp,Int32BufferAttribute:()=>Ri,Int8Attribute:()=>Wp,Int8BufferAttribute:()=>Ei,IntType:()=>Lt,InterleavedBuffer:()=>Fs,InterleavedBufferAttribute:()=>ks,Interpolant:()=>tu,InterpolateDiscrete:()=>He,InterpolateLinear:()=>ke,InterpolateSmooth:()=>Ue,InvertStencilOp:()=>gn,JSONLoader:()=>lf,KeepStencilOp:()=>un,KeyframeTrack:()=>iu,LOD:()=>ol,LatheBufferGeometry:()=>Cc,LatheGeometry:()=>Cc,Layers:()=>Br,LensFlare:()=>uf,LessDepth:()=>V,LessEqualDepth:()=>W,LessEqualStencilFunc:()=>xn,LessStencilFunc:()=>yn,Light:()=>Zu,LightProbe:()=>fh,Line:()=>Al,Line3:()=>Sd,LineBasicMaterial:()=>bl,LineCurve:()=>ku,LineCurve3:()=>Uu,LineDashedMaterial:()=>Kc,LineLoop:()=>Pl,LinePieces:()=>Rp,LineSegments:()=>Rl,LineStrip:()=>Cp,LinearEncoding:()=>Je,LinearFilter:()=>_t,LinearInterpolant:()=>nu,LinearMipMapLinearFilter:()=>Mt,LinearMipMapNearestFilter:()=>bt,LinearMipmapLinearFilter:()=>wt,LinearMipmapNearestFilter:()=>xt,LinearToneMapping:()=>$,Loader:()=>vu,LoaderUtils:()=>gh,LoadingManager:()=>mu,LogLuvEncoding:()=>tn,LoopOnce:()=>Be,LoopPingPong:()=>Fe,LoopRepeat:()=>ze,LuminanceAlphaFormat:()=>kt,LuminanceFormat:()=>Ht,MOUSE:()=>i,Material:()=>pi,MaterialLoader:()=>mh,Math:()=>Hn,MathUtils:()=>Hn,Matrix3:()=>Un,Matrix4:()=>Er,MaxEquation:()=>C,Mesh:()=>co,MeshBasicMaterial:()=>bi,MeshDepthMaterial:()=>ws,MeshDistanceMaterial:()=>Ms,MeshFaceMaterial:()=>Ip,MeshLambertMaterial:()=>Zc,MeshMatcapMaterial:()=>Jc,MeshNormalMaterial:()=>Yc,MeshPhongMaterial:()=>qc,MeshPhysicalMaterial:()=>jc,MeshStandardMaterial:()=>Wc,MeshToonMaterial:()=>Xc,MinEquation:()=>L,MirroredRepeatWrapping:()=>pt,MixOperation:()=>J,MultiMaterial:()=>Np,MultiplyBlending:()=>M,MultiplyOperation:()=>Z,NearestFilter:()=>ft,NearestMipMapLinearFilter:()=>yt,NearestMipMapNearestFilter:()=>gt,NearestMipmapLinearFilter:()=>vt,NearestMipmapNearestFilter:()=>mt,NeverDepth:()=>U,NeverStencilFunc:()=>vn,NoBlending:()=>_,NoColors:()=>Pp,NoToneMapping:()=>Q,NormalAnimationBlendMode:()=>je,NormalBlending:()=>x,NotEqualDepth:()=>Y,NotEqualStencilFunc:()=>wn,NumberKeyframeTrack:()=>su,Object3D:()=>Jr,ObjectLoader:()=>xh,ObjectSpaceNormalMap:()=>ln,OctahedronBufferGeometry:()=>Rc,OctahedronGeometry:()=>Rc,OneFactor:()=>P,OneMinusDstAlphaFactor:()=>z,OneMinusDstColorFactor:()=>H,OneMinusSrcAlphaFactor:()=>N,OneMinusSrcColorFactor:()=>D,OrthographicCamera:()=>lh,PCFShadowMap:()=>h,PCFSoftShadowMap:()=>d,PMREMGenerator:()=>wp,ParametricBufferGeometry:()=>Pc,ParametricGeometry:()=>Pc,Particle:()=>zp,ParticleBasicMaterial:()=>kp,ParticleSystem:()=>Fp,ParticleSystemMaterial:()=>Up,Path:()=>Xu,PerspectiveCamera:()=>yo,Plane:()=>ti,PlaneBufferGeometry:()=>Co,PlaneGeometry:()=>Co,PlaneHelper:()=>Kd,PointCloud:()=>Bp,PointCloudMaterial:()=>Hp,PointLight:()=>sh,PointLightHelper:()=>Dd,Points:()=>zl,PointsMaterial:()=>Ol,PolarGridHelper:()=>Hd,PolyhedronBufferGeometry:()=>ql,PolyhedronGeometry:()=>ql,PositionalAudio:()=>Zh,PropertyBinding:()=>ld,PropertyMixer:()=>Kh,QuadraticBezierCurve:()=>Gu,QuadraticBezierCurve3:()=>Vu,Quaternion:()=>Jn,QuaternionKeyframeTrack:()=>cu,QuaternionLinearInterpolant:()=>lu,REVISION:()=>r,RGBADepthPacking:()=>an,RGBAFormat:()=>Ft,RGBAIntegerFormat:()=>Zt,RGBA_ASTC_10x10_Format:()=>ye,RGBA_ASTC_10x5_Format:()=>me,RGBA_ASTC_10x6_Format:()=>ge,RGBA_ASTC_10x8_Format:()=>ve,RGBA_ASTC_12x10_Format:()=>_e,RGBA_ASTC_12x12_Format:()=>xe,RGBA_ASTC_4x4_Format:()=>se,RGBA_ASTC_5x4_Format:()=>le,RGBA_ASTC_5x5_Format:()=>ce,RGBA_ASTC_6x5_Format:()=>ue,RGBA_ASTC_6x6_Format:()=>he,RGBA_ASTC_8x5_Format:()=>de,RGBA_ASTC_8x6_Format:()=>pe,RGBA_ASTC_8x8_Format:()=>fe,RGBA_BPTC_Format:()=>be,RGBA_ETC2_EAC_Format:()=>ae,RGBA_PVRTC_2BPPV1_Format:()=>re,RGBA_PVRTC_4BPPV1_Format:()=>ne,RGBA_S3TC_DXT1_Format:()=>Kt,RGBA_S3TC_DXT3_Format:()=>Qt,RGBA_S3TC_DXT5_Format:()=>$t,RGBDEncoding:()=>rn,RGBEEncoding:()=>$e,RGBEFormat:()=>Ut,RGBFormat:()=>zt,RGBIntegerFormat:()=>Yt,RGBM16Encoding:()=>nn,RGBM7Encoding:()=>en,RGB_ETC1_Format:()=>ie,RGB_ETC2_Format:()=>oe,RGB_PVRTC_2BPPV1_Format:()=>ee,RGB_PVRTC_4BPPV1_Format:()=>te,RGB_S3TC_DXT1_Format:()=>Jt,RGFormat:()=>qt,RGIntegerFormat:()=>Xt,RawShaderMaterial:()=>Vc,Ray:()=>Sr,Raycaster:()=>md,RectAreaLight:()=>dh,RedFormat:()=>Wt,RedIntegerFormat:()=>jt,ReinhardToneMapping:()=>tt,RepeatWrapping:()=>ht,ReplaceStencilOp:()=>hn,ReverseSubtractEquation:()=>A,RingBufferGeometry:()=>Oc,RingGeometry:()=>Oc,SRGB8_ALPHA8_ASTC_10x10_Format:()=>De,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Re,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Pe,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Oe,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Ie,SRGB8_ALPHA8_ASTC_12x12_Format:()=>Ne,SRGB8_ALPHA8_ASTC_4x4_Format:()=>we,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Me,SRGB8_ALPHA8_ASTC_5x5_Format:()=>Se,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Ee,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Te,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Ae,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Le,SRGB8_ALPHA8_ASTC_8x8_Format:()=>Ce,Scene:()=>zs,SceneUtils:()=>cf,ShaderChunk:()=>Ro,ShaderLib:()=>Oo,ShaderMaterial:()=>go,ShadowMaterial:()=>Gc,Shape:()=>Yu,ShapeBufferGeometry:()=>Dc,ShapeGeometry:()=>Dc,ShapePath:()=>Eh,ShapeUtils:()=>Mc,ShortType:()=>Tt,Skeleton:()=>ml,SkeletonHelper:()=>Pd,SkinnedMesh:()=>hl,SmoothShading:()=>y,Sphere:()=>gr,SphereBufferGeometry:()=>Ic,SphereGeometry:()=>Ic,Spherical:()=>yd,SphericalHarmonics3:()=>ph,SplineCurve:()=>Wu,SpotLight:()=>nh,SpotLightHelper:()=>Ad,Sprite:()=>el,SpriteMaterial:()=>Us,SrcAlphaFactor:()=>I,SrcAlphaSaturateFactor:()=>k,SrcColorFactor:()=>O,StaticCopyUsage:()=>Pn,StaticDrawUsage:()=>En,StaticReadUsage:()=>Ln,StereoCamera:()=>Bh,StreamCopyUsage:()=>Dn,StreamDrawUsage:()=>An,StreamReadUsage:()=>Rn,StringKeyframeTrack:()=>uu,SubtractEquation:()=>T,SubtractiveBlending:()=>w,TOUCH:()=>o,TangentSpaceNormalMap:()=>sn,TetrahedronBufferGeometry:()=>Nc,TetrahedronGeometry:()=>Nc,TextBufferGeometry:()=>Bc,TextGeometry:()=>Bc,Texture:()=>jn,TextureLoader:()=>Eu,TorusBufferGeometry:()=>zc,TorusGeometry:()=>zc,TorusKnotBufferGeometry:()=>Fc,TorusKnotGeometry:()=>Fc,Triangle:()=>hi,TriangleFanDrawMode:()=>Ze,TriangleStripDrawMode:()=>Ye,TrianglesDrawMode:()=>Xe,TubeBufferGeometry:()=>Hc,TubeGeometry:()=>Hc,UVMapping:()=>it,Uint16Attribute:()=>Yp,Uint16BufferAttribute:()=>Ci,Uint32Attribute:()=>Jp,Uint32BufferAttribute:()=>Pi,Uint8Attribute:()=>jp,Uint8BufferAttribute:()=>Ti,Uint8ClampedAttribute:()=>qp,Uint8ClampedBufferAttribute:()=>Ai,Uniform:()=>dd,UniformsLib:()=>Po,UniformsUtils:()=>mo,UnsignedByteType:()=>St,UnsignedInt248Type:()=>Nt,UnsignedIntType:()=>Ct,UnsignedShort4444Type:()=>Ot,UnsignedShort5551Type:()=>Dt,UnsignedShort565Type:()=>It,UnsignedShortType:()=>At,VSMShadowMap:()=>p,Vector2:()=>kn,Vector3:()=>Kn,Vector4:()=>Xn,VectorKeyframeTrack:()=>hu,Vertex:()=>Gp,VertexColors:()=>Dp,VideoTexture:()=>Hl,WebGL1Renderer:()=>Is,WebGLCubeRenderTarget:()=>wo,WebGLMultisampleRenderTarget:()=>Zn,WebGLRenderTarget:()=>Yn,WebGLRenderTargetCube:()=>af,WebGLRenderer:()=>Ds,WebGLUtils:()=>As,WireframeGeometry:()=>kc,WireframeHelper:()=>nf,WrapAroundEnding:()=>We,XHRLoader:()=>rf,ZeroCurvatureEnding:()=>Ge,ZeroFactor:()=>R,ZeroSlopeEnding:()=>Ve,ZeroStencilOp:()=>cn,sRGBEncoding:()=>Ke});const r="126",i={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},o={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=0,s=1,l=2,c=3,u=0,h=1,d=2,p=3,f=0,m=1,g=2,v=1,y=2,_=0,x=1,b=2,w=3,M=4,S=5,E=100,T=101,A=102,L=103,C=104,R=200,P=201,O=202,D=203,I=204,N=205,B=206,z=207,F=208,H=209,k=210,U=0,G=1,V=2,W=3,j=4,q=5,X=6,Y=7,Z=0,J=1,K=2,Q=0,$=1,tt=2,et=3,nt=4,rt=5,it=300,ot=301,at=302,st=303,lt=304,ct=306,ut=307,ht=1e3,dt=1001,pt=1002,ft=1003,mt=1004,gt=1004,vt=1005,yt=1005,_t=1006,xt=1007,bt=1007,wt=1008,Mt=1008,St=1009,Et=1010,Tt=1011,At=1012,Lt=1013,Ct=1014,Rt=1015,Pt=1016,Ot=1017,Dt=1018,It=1019,Nt=1020,Bt=1021,zt=1022,Ft=1023,Ht=1024,kt=1025,Ut=Ft,Gt=1026,Vt=1027,Wt=1028,jt=1029,qt=1030,Xt=1031,Yt=1032,Zt=1033,Jt=33776,Kt=33777,Qt=33778,$t=33779,te=35840,ee=35841,ne=35842,re=35843,ie=36196,oe=37492,ae=37496,se=37808,le=37809,ce=37810,ue=37811,he=37812,de=37813,pe=37814,fe=37815,me=37816,ge=37817,ve=37818,ye=37819,_e=37820,xe=37821,be=36492,we=37840,Me=37841,Se=37842,Ee=37843,Te=37844,Ae=37845,Le=37846,Ce=37847,Re=37848,Pe=37849,Oe=37850,De=37851,Ie=37852,Ne=37853,Be=2200,ze=2201,Fe=2202,He=2300,ke=2301,Ue=2302,Ge=2400,Ve=2401,We=2402,je=2500,qe=2501,Xe=0,Ye=1,Ze=2,Je=3e3,Ke=3001,Qe=3007,$e=3002,tn=3003,en=3004,nn=3005,rn=3006,on=3200,an=3201,sn=0,ln=1,cn=0,un=7680,hn=7681,dn=7682,pn=7683,fn=34055,mn=34056,gn=5386,vn=512,yn=513,_n=514,xn=515,bn=516,wn=517,Mn=518,Sn=519,En=35044,Tn=35048,An=35040,Ln=35045,Cn=35049,Rn=35041,Pn=35046,On=35050,Dn=35042,In="100",Nn="300 es";function Bn(){}Object.assign(Bn.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e<r;e++)n[e].call(this,t)}}});const zn=[];for(let t=0;t<256;t++)zn[t]=(t<16?"0":"")+t.toString(16);let Fn=1234567;const Hn={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(zn[255&t]+zn[t>>8&255]+zn[t>>16&255]+zn[t>>24&255]+"-"+zn[255&e]+zn[e>>8&255]+"-"+zn[e>>16&15|64]+zn[e>>24&255]+"-"+zn[63&n|128]+zn[n>>8&255]+"-"+zn[n>>16&255]+zn[n>>24&255]+zn[255&r]+zn[r>>8&255]+zn[r>>16&255]+zn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return Hn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Hn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Fn=t%2147483647),Fn=16807*Fn%2147483647,(Fn-1)/2147483646},degToRad:function(t){return t*Hn.DEG2RAD},radToDeg:function(t){return t*Hn.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))},setQuaternionFromProperEuler:function(t,e,n,r,i){const o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((e+r)/2),u=a((e+r)/2),h=o((e-r)/2),d=a((e-r)/2),p=o((r-e)/2),f=a((r-e)/2);switch(i){case"XYX":t.set(s*u,l*h,l*d,s*c);break;case"YZY":t.set(l*d,s*u,l*h,s*c);break;case"ZXZ":t.set(l*h,l*d,s*u,s*c);break;case"XZX":t.set(s*u,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*u,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};class kn{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}kn.prototype.isVector2=!0;class Un{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,o,a,s,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],_=r[7],x=r[2],b=r[5],w=r[8];return i[0]=o*f+a*v+s*x,i[3]=o*m+a*y+s*b,i[6]=o*g+a*_+s*w,i[1]=l*f+c*v+u*x,i[4]=l*m+c*y+u*b,i[7]=l*g+c*_+u*w,i[2]=h*f+d*v+p*x,i[5]=h*m+d*y+p*b,i[8]=h*g+d*_+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8];return e*o*c-e*a*l-n*i*c+n*a*s+r*i*l-r*o*s}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=c*o-a*l,h=a*s-c*i,d=l*i-o*s,p=e*u+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(r*l-c*n)*f,t[2]=(a*n-r*o)*f,t[3]=h*f,t[4]=(c*e-r*s)*f,t[5]=(r*i-a*e)*f,t[6]=d*f,t[7]=(n*s-l*e)*f,t[8]=(o*e-n*i)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,o,a){const s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*o+l*a)+o+t,-r*l,r*s,-r*(-l*o+s*a)+a+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],o=r[3],a=r[6],s=r[1],l=r[4],c=r[7];return r[0]=e*i+n*s,r[3]=e*o+n*l,r[6]=e*a+n*c,r[1]=-n*i+e*s,r[4]=-n*o+e*l,r[7]=-n*a+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;Un.prototype.isMatrix3=!0;const Vn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};let Wn=0;class jn extends Bn{constructor(t=jn.DEFAULT_IMAGE,e=jn.DEFAULT_MAPPING,n=dt,r=dt,i=_t,o=wt,a=Ft,s=St,l=1,c=Je){super(),Object.defineProperty(this,"id",{value:Wn++}),this.uuid=Hn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=s,this.offset=new kn(0,0),this.repeat=new kn(1,1),this.center=new kn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Un,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=Hn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(qn(r[t].image)):e.push(qn(r[t]))}else e=qn(r);t.images[r.uuid]={uuid:r.uuid,url:e}}n.image=r.uuid}return e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==it)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ht:t.x=t.x-Math.floor(t.x);break;case dt:t.x=t.x<0?0:1;break;case pt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ht:t.y=t.y-Math.floor(t.y);break;case dt:t.y=t.y<0?0:1;break;case pt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function qn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Vn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}jn.DEFAULT_IMAGE=void 0,jn.DEFAULT_MAPPING=it,jn.prototype.isTexture=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const o=.01,a=.1,s=t.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(c-h)<o&&Math.abs(u-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+h)<a&&Math.abs(u+f)<a&&Math.abs(p+m)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,s=(d+1)/2,v=(g+1)/2,y=(c+h)/4,_=(u+f)/4,x=(p+m)/4;return t>s&&t>v?t<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(t),r=y/n,i=_/n):s>v?s<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=y/r,i=x/r):v<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=_/i,r=x/i),this.set(n,r,i,e),this}let v=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(u-f)/v,this.z=(h-c)/v,this.w=Math.acos((l+d+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}Xn.prototype.isVector4=!0;class Yn extends Bn{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Xn(0,0,t,e),this.scissorTest=!1,this.viewport=new Xn(0,0,t,e),n=n||{},this.texture=new jn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:_t,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}Yn.prototype.isWebGLRenderTarget=!0;class Zn extends Yn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}Zn.prototype.isWebGLMultisampleRenderTarget=!0;class Jn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,o,a){let s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3];const h=i[o+0],d=i[o+1],p=i[o+2],f=i[o+3];if(0===a)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=u);if(1===a)return t[e+0]=h,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||s!==h||l!==d||c!==p){let t=1-a;const e=s*h+l*d+c*p+u*f,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),o=Math.atan2(i,e*n);t=Math.sin(t*o)/i,a=Math.sin(a*o)/i}const i=a*n;if(s=s*t+h*i,l=l*t+d*i,c=c*t+p*i,u=u*t+f*i,t===1-a){const t=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=t,l*=t,c*=t,u*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,o){const a=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[o],h=i[o+1],d=i[o+2],p=i[o+3];return t[e]=a*p+c*u+s*d-l*h,t[e+1]=s*p+c*h+l*u-a*d,t[e+2]=l*p+c*d+a*h-s*u,t[e+3]=c*p-a*u-s*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,o=t._order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(o){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],o=e[1],a=e[5],s=e[9],l=e[2],c=e[6],u=e[10],h=n+a+u;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(c-s)*t,this._y=(i-l)*t,this._z=(o-r)*t}else if(n>a&&n>u){const t=2*Math.sqrt(1+n-a-u);this._w=(c-s)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(i+l)/t}else if(a>u){const t=2*Math.sqrt(1+a-n-u);this._w=(i-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+u-n-a);this._w=(o-r)/t,this._x=(i+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Hn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,o=this._w;let a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;const s=1-a*a;if(s<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,a),u=Math.sin((1-e)*c)/l,h=Math.sin(e*c)/l;return this._w=o*u+this._w*h,this._x=n*u+this._x*h,this._y=r*u+this._y*h,this._z=i*u+this._z*h,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Jn.prototype.isQuaternion=!0;class Kn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion($n.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion($n.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,l=s*e+o*r-a*n,c=s*n+a*e-i*r,u=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=l*s+h*-i+c*-a-u*-o,this.y=c*s+h*-o+u*-i-l*-a,this.z=u*s+h*-a+l*-o-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Qn.copy(this).projectOnVector(t),this.sub(Qn)}reflect(t){return this.sub(Qn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Hn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}Kn.prototype.isVector3=!0;const Qn=new Kn,$n=new Jn;class tr{constructor(t=new Kn(1/0,1/0,1/0),e=new Kn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;for(let s=0,l=t.length;s<l;s+=3){const l=t[s],c=t[s+1],u=t[s+2];l<e&&(e=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,n,r),this.max.set(i,o,a),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;for(let s=0,l=t.count;s<l;s++){const l=t.getX(s),c=t.getY(s),u=t.getZ(s);l<e&&(e=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,n,r),this.max.set(i,o,a),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=nr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Kn),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Kn),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),rr.copy(e.boundingBox),rr.applyMatrix4(t.matrixWorld),this.union(rr));const n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Kn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,nr),nr.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ur),hr.subVectors(this.max,ur),ir.subVectors(t.a,ur),or.subVectors(t.b,ur),ar.subVectors(t.c,ur),sr.subVectors(or,ir),lr.subVectors(ar,or),cr.subVectors(ir,ar);let e=[0,-sr.z,sr.y,0,-lr.z,lr.y,0,-cr.z,cr.y,sr.z,0,-sr.x,lr.z,0,-lr.x,cr.z,0,-cr.x,-sr.y,sr.x,0,-lr.y,lr.x,0,-cr.y,cr.x,0];return!!fr(e,ir,or,ar,hr)&&(e=[1,0,0,0,1,0,0,0,1],!!fr(e,ir,or,ar,hr)&&(dr.crossVectors(sr,lr),e=[dr.x,dr.y,dr.z],fr(e,ir,or,ar,hr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Kn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return nr.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(nr).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(er[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),er[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),er[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),er[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),er[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),er[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),er[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),er[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(er)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}tr.prototype.isBox3=!0;const er=[new Kn,new Kn,new Kn,new Kn,new Kn,new Kn,new Kn,new Kn],nr=new Kn,rr=new tr,ir=new Kn,or=new Kn,ar=new Kn,sr=new Kn,lr=new Kn,cr=new Kn,ur=new Kn,hr=new Kn,dr=new Kn,pr=new Kn;function fr(t,e,n,r,i){for(let o=0,a=t.length-3;o<=a;o+=3){pr.fromArray(t,o);const a=i.x*Math.abs(pr.x)+i.y*Math.abs(pr.y)+i.z*Math.abs(pr.z),s=e.dot(pr),l=n.dot(pr),c=r.dot(pr);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>a)return!1}return!0}const mr=new tr;class gr{constructor(t=new Kn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):mr.setFromPoints(t).getCenter(n);let r=0;for(let e=0,i=t.length;e<i;e++)r=Math.max(r,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Kn),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new tr),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const vr=new Kn,yr=new Kn,_r=new Kn,xr=new Kn,br=new Kn,wr=new Kn,Mr=new Kn;class Sr{constructor(t=new Kn,e=new Kn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Kn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,vr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Kn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=vr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(vr.copy(this.direction).multiplyScalar(e).add(this.origin),vr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){yr.copy(t).add(e).multiplyScalar(.5),_r.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(yr);const i=.5*t.distanceTo(e),o=-this.direction.dot(_r),a=xr.dot(this.direction),s=-xr.dot(_r),l=xr.lengthSq(),c=Math.abs(1-o*o);let u,h,d,p;if(c>0)if(u=o*s-a,h=o*a-s,p=i*c,u>=0)if(h>=-p)if(h<=p){const t=1/c;u*=t,h*=t,d=u*(u+o*h+2*a)+h*(o*u+h+2*s)+l}else h=i,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*s)+l;else h=-i,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*s)+l;else h<=-p?(u=Math.max(0,-(-o*i+a)),h=u>0?-i:Math.min(Math.max(-i,-s),i),d=-u*u+h*(h+2*s)+l):h<=p?(u=0,h=Math.min(Math.max(-i,-s),i),d=h*(h+2*s)+l):(u=Math.max(0,-(o*i+a)),h=u>0?i:Math.min(Math.max(-i,-s),i),d=-u*u+h*(h+2*s)+l);else h=o>0?-i:i,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*s)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(_r).multiplyScalar(h).add(yr),d}intersectSphere(t,e){vr.subVectors(t.center,this.origin);const n=vr.dot(this.direction),r=vr.dot(vr)-n*n,i=t.radius*t.radius;if(r>i)return null;const o=Math.sqrt(i-r),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,o,a,s;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,r=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,r=(t.min.x-h.x)*l),c>=0?(i=(t.min.y-h.y)*c,o=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,o=(t.min.y-h.y)*c),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),u>=0?(a=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(a=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||a>r?null:((a>n||n!=n)&&(n=a),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,vr)}intersectTriangle(t,e,n,r,i){br.subVectors(e,t),wr.subVectors(n,t),Mr.crossVectors(br,wr);let o,a=this.direction.dot(Mr);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}xr.subVectors(this.origin,t);const s=o*this.direction.dot(wr.crossVectors(xr,wr));if(s<0)return null;const l=o*this.direction.dot(br.cross(xr));if(l<0)return null;if(s+l>a)return null;const c=-o*xr.dot(Mr);return c<0?null:this.at(c/a,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Er{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,o,a,s,l,c,u,h,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Er).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Tr.setFromMatrixColumn(t,0).length(),i=1/Tr.setFromMatrixColumn(t,1).length(),o=1/Tr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){const t=o*c,n=o*u,r=a*c,i=a*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-a*s,e[2]=i-t*l,e[6]=r+n*l,e[10]=o*s}else if("YXZ"===t.order){const t=s*c,n=s*u,r=l*c,i=l*u;e[0]=t+i*a,e[4]=r*a-n,e[8]=o*l,e[1]=o*u,e[5]=o*c,e[9]=-a,e[2]=n*a-r,e[6]=i+t*a,e[10]=o*s}else if("ZXY"===t.order){const t=s*c,n=s*u,r=l*c,i=l*u;e[0]=t-i*a,e[4]=-o*u,e[8]=r+n*a,e[1]=n+r*a,e[5]=o*c,e[9]=i-t*a,e[2]=-o*l,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){const t=o*c,n=o*u,r=a*c,i=a*u;e[0]=s*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=s*u,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){const t=o*s,n=o*l,r=a*s,i=a*l;e[0]=s*c,e[4]=i-t*u,e[8]=r*u+n,e[1]=u,e[5]=o*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*u+r,e[10]=t-i*u}else if("XZY"===t.order){const t=o*s,n=o*l,r=a*s,i=a*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=t*u+i,e[5]=o*c,e[9]=n*u-r,e[2]=r*u-n,e[6]=a*c,e[10]=i*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Lr,t,Cr)}lookAt(t,e,n){const r=this.elements;return Or.subVectors(t,e),0===Or.lengthSq()&&(Or.z=1),Or.normalize(),Rr.crossVectors(n,Or),0===Rr.lengthSq()&&(1===Math.abs(n.z)?Or.x+=1e-4:Or.z+=1e-4,Or.normalize(),Rr.crossVectors(n,Or)),Rr.normalize(),Pr.crossVectors(Or,Rr),r[0]=Rr.x,r[4]=Pr.x,r[8]=Or.x,r[1]=Rr.y,r[5]=Pr.y,r[9]=Or.y,r[2]=Rr.z,r[6]=Pr.z,r[10]=Or.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=r[0],w=r[4],M=r[8],S=r[12],E=r[1],T=r[5],A=r[9],L=r[13],C=r[2],R=r[6],P=r[10],O=r[14],D=r[3],I=r[7],N=r[11],B=r[15];return i[0]=o*b+a*E+s*C+l*D,i[4]=o*w+a*T+s*R+l*I,i[8]=o*M+a*A+s*P+l*N,i[12]=o*S+a*L+s*O+l*B,i[1]=c*b+u*E+h*C+d*D,i[5]=c*w+u*T+h*R+d*I,i[9]=c*M+u*A+h*P+d*N,i[13]=c*S+u*L+h*O+d*B,i[2]=p*b+f*E+m*C+g*D,i[6]=p*w+f*T+m*R+g*I,i[10]=p*M+f*A+m*P+g*N,i[14]=p*S+f*L+m*O+g*B,i[3]=v*b+y*E+_*C+x*D,i[7]=v*w+y*T+_*R+x*I,i[11]=v*M+y*A+_*P+x*N,i[15]=v*S+y*L+_*O+x*B,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],a=t[5],s=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+i*s*u-r*l*u-i*a*h+n*l*h+r*a*d-n*s*d)+t[7]*(+e*s*d-e*l*h+i*o*h-r*o*d+r*l*c-i*s*c)+t[11]*(+e*l*u-e*a*d-i*o*u+n*o*d+i*a*c-n*l*c)+t[15]*(-r*a*c-e*s*u+e*a*h+r*o*u-n*o*h+n*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*l-f*h*l+f*s*d-a*m*d-u*s*g+a*h*g,y=p*h*l-c*m*l-p*s*d+o*m*d+c*s*g-o*h*g,_=c*f*l-p*u*l+p*a*d-o*f*d-c*a*g+o*u*g,x=p*u*s-c*f*s-p*a*h+o*f*h+c*a*m-o*u*m,b=e*v+n*y+r*_+i*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=v*w,t[1]=(f*h*i-u*m*i-f*r*d+n*m*d+u*r*g-n*h*g)*w,t[2]=(a*m*i-f*s*i+f*r*l-n*m*l-a*r*g+n*s*g)*w,t[3]=(u*s*i-a*h*i-u*r*l+n*h*l+a*r*d-n*s*d)*w,t[4]=y*w,t[5]=(c*m*i-p*h*i+p*r*d-e*m*d-c*r*g+e*h*g)*w,t[6]=(p*s*i-o*m*i-p*r*l+e*m*l+o*r*g-e*s*g)*w,t[7]=(o*h*i-c*s*i+c*r*l-e*h*l-o*r*d+e*s*d)*w,t[8]=_*w,t[9]=(p*u*i-c*f*i-p*n*d+e*f*d+c*n*g-e*u*g)*w,t[10]=(o*f*i-p*a*i+p*n*l-e*f*l-o*n*g+e*a*g)*w,t[11]=(c*a*i-o*u*i-c*n*l+e*u*l+o*n*d-e*a*d)*w,t[12]=x*w,t[13]=(c*f*r-p*u*r+p*n*h-e*f*h-c*n*m+e*u*m)*w,t[14]=(p*a*r-o*f*r-p*n*s+e*f*s+o*n*m-e*a*m)*w,t[15]=(o*u*r-c*a*r+c*n*s-e*u*s-o*n*h+e*a*h)*w,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,a=t.y,s=t.z,l=i*o,c=i*a;return this.set(l*o+n,l*a-r*s,l*s+r*a,0,l*a+r*s,c*a+n,c*s-r*o,0,l*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,o=e._y,a=e._z,s=e._w,l=i+i,c=o+o,u=a+a,h=i*l,d=i*c,p=i*u,f=o*c,m=o*u,g=a*u,v=s*l,y=s*c,_=s*u,x=n.x,b=n.y,w=n.z;return r[0]=(1-(f+g))*x,r[1]=(d+_)*x,r[2]=(p-y)*x,r[3]=0,r[4]=(d-_)*b,r[5]=(1-(h+g))*b,r[6]=(m+v)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Tr.set(r[0],r[1],r[2]).length();const o=Tr.set(r[4],r[5],r[6]).length(),a=Tr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Ar.copy(this);const s=1/i,l=1/o,c=1/a;return Ar.elements[0]*=s,Ar.elements[1]*=s,Ar.elements[2]*=s,Ar.elements[4]*=l,Ar.elements[5]*=l,Ar.elements[6]*=l,Ar.elements[8]*=c,Ar.elements[9]*=c,Ar.elements[10]*=c,e.setFromRotationMatrix(Ar),n.x=i,n.y=o,n.z=a,this}makePerspective(t,e,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,s=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),u=(n+r)/(n-r),h=-(o+i)/(o-i),d=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,r,i,o){const a=this.elements,s=1/(e-t),l=1/(n-r),c=1/(o-i),u=(e+t)*s,h=(n+r)*l,d=(o+i)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}Er.prototype.isMatrix4=!0;const Tr=new Kn,Ar=new Er,Lr=new Kn(0,0,0),Cr=new Kn(1,1,1),Rr=new Kn,Pr=new Kn,Or=new Kn,Dr=new Er,Ir=new Jn;class Nr{constructor(t=0,e=0,n=0,r=Nr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Hn.clamp,i=t.elements,o=i[0],a=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Dr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Dr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Ir.setFromEuler(this),this.setFromQuaternion(Ir,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Kn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Nr.prototype.isEuler=!0,Nr.DefaultOrder="XYZ",Nr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Br{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let zr=0;const Fr=new Kn,Hr=new Jn,kr=new Er,Ur=new Kn,Gr=new Kn,Vr=new Kn,Wr=new Jn,jr=new Kn(1,0,0),qr=new Kn(0,1,0),Xr=new Kn(0,0,1),Yr={type:"added"},Zr={type:"removed"};function Jr(){Object.defineProperty(this,"id",{value:zr++}),this.uuid=Hn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Jr.DefaultUp.clone();const t=new Kn,e=new Nr,n=new Jn,r=new Kn(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Er},normalMatrix:{value:new Un}}),this.matrix=new Er,this.matrixWorld=new Er,this.matrixAutoUpdate=Jr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Br,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}Jr.DefaultUp=new Kn(0,1,0),Jr.DefaultMatrixAutoUpdate=!0,Jr.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Jr,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return Hr.setFromAxisAngle(t,e),this.quaternion.multiply(Hr),this},rotateOnWorldAxis:function(t,e){return Hr.setFromAxisAngle(t,e),this.quaternion.premultiply(Hr),this},rotateX:function(t){return this.rotateOnAxis(jr,t)},rotateY:function(t){return this.rotateOnAxis(qr,t)},rotateZ:function(t){return this.rotateOnAxis(Xr,t)},translateOnAxis:function(t,e){return Fr.copy(t).applyQuaternion(this.quaternion),this.position.add(Fr.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(jr,t)},translateY:function(t){return this.translateOnAxis(qr,t)},translateZ:function(t){return this.translateOnAxis(Xr,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(kr.copy(this.matrixWorld).invert())},lookAt:function(t,e,n){t.isVector3?Ur.copy(t):Ur.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Gr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?kr.lookAt(Gr,Ur,this.up):kr.lookAt(Ur,Gr,this.up),this.quaternion.setFromRotationMatrix(kr),r&&(kr.extractRotation(r.matrixWorld),Hr.setFromRotationMatrix(kr),this.quaternion.premultiply(Hr.invert()))},add:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Yr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Zr)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Zr)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),kr.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),kr.multiply(t.parent.matrixWorld)),t.applyMatrix4(kr),this.add(t),t.updateWorldMatrix(!1,!0),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Kn),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Jn),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,t,Vr),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Kn),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,Wr,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Kn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)},traverseAncestors:function(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=o(t.geometries),r=o(t.materials),i=o(t.textures),a=o(t.images),s=o(t.shapes),l=o(t.skeletons),c=o(t.animations);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),a.length>0&&(n.images=a),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function o(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}});const Kr=new Kn,Qr=new Kn,$r=new Un;class ti{constructor(t=new Kn(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=Kr.subVectors(n,e).cross(Qr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Kn),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Kn);const n=t.delta(Kr),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;const i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Kn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||$r.getNormalMatrix(t),r=this.coplanarPoint(Kr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}ti.prototype.isPlane=!0;const ei=new Kn,ni=new Kn,ri=new Kn,ii=new Kn,oi=new Kn,ai=new Kn,si=new Kn,li=new Kn,ci=new Kn,ui=new Kn;class hi{constructor(t=new Kn,e=new Kn,n=new Kn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Kn),r.subVectors(n,e),ei.subVectors(t,e),r.cross(ei);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){ei.subVectors(r,e),ni.subVectors(n,e),ri.subVectors(t,e);const o=ei.dot(ei),a=ei.dot(ni),s=ei.dot(ri),l=ni.dot(ni),c=ni.dot(ri),u=o*l-a*a;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Kn),0===u)return i.set(-2,-1,-1);const h=1/u,d=(l*s-a*c)*h,p=(o*c-a*s)*h;return i.set(1-d-p,p,d)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ii),ii.x>=0&&ii.y>=0&&ii.x+ii.y<=1}static getUV(t,e,n,r,i,o,a,s){return this.getBarycoord(t,e,n,r,ii),s.set(0,0),s.addScaledVector(i,ii.x),s.addScaledVector(o,ii.y),s.addScaledVector(a,ii.z),s}static isFrontFacing(t,e,n,r){return ei.subVectors(n,e),ni.subVectors(t,e),ei.cross(ni).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ei.subVectors(this.c,this.b),ni.subVectors(this.a,this.b),.5*ei.cross(ni).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Kn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return hi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new ti),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return hi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return hi.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return hi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return hi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Kn);const n=this.a,r=this.b,i=this.c;let o,a;oi.subVectors(r,n),ai.subVectors(i,n),li.subVectors(t,n);const s=oi.dot(li),l=ai.dot(li);if(s<=0&&l<=0)return e.copy(n);ci.subVectors(t,r);const c=oi.dot(ci),u=ai.dot(ci);if(c>=0&&u<=c)return e.copy(r);const h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return o=s/(s-c),e.copy(n).addScaledVector(oi,o);ui.subVectors(t,i);const d=oi.dot(ui),p=ai.dot(ui);if(p>=0&&d<=p)return e.copy(i);const f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(ai,a);const m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return si.subVectors(i,r),a=(u-c)/(u-c+(d-p)),e.copy(r).addScaledVector(si,a);const g=1/(m+f+h);return o=f*g,a=h*g,e.copy(n).addScaledVector(oi,o).addScaledVector(ai,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let di=0;function pi(){Object.defineProperty(this,"id",{value:di++}),this.uuid=Hn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=f,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=I,this.blendDst=N,this.blendEquation=E,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=W,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=un,this.stencilZFail=un,this.stencilZPass=un,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}pi.prototype=Object.assign(Object.create(Bn.prototype),{constructor:pi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===v;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(n.blending=this.blending),this.side!==f&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(pi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const fi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mi={h:0,s:0,l:0},gi={h:0,s:0,l:0};function vi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function yi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function _i(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Hn.euclideanModulo(t,1),e=Hn.clamp(e,0,1),n=Hn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=vi(i,r,t+1/3),this.g=vi(i,r,t),this.b=vi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=fi[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=yi(t.r),this.g=yi(t.g),this.b=yi(t.b),this}copyLinearToSRGB(t){return this.r=_i(t.r),this.g=_i(t.g),this.b=_i(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),o=Math.min(e,n,r);let a,s;const l=(o+i)/2;if(o===i)a=0,s=0;else{const t=i-o;switch(s=l<=.5?t/(i+o):t/(2-i-o),i){case e:a=(n-r)/t+(n<r?6:0);break;case n:a=(r-e)/t+2;break;case r:a=(e-n)/t+4}a/=6}return t.h=a,t.s=s,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(mi),mi.h+=t,mi.s+=e,mi.l+=n,this.setHSL(mi.h,mi.s,mi.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(mi),t.getHSL(gi);const n=Hn.lerp(mi.h,gi.h,e),r=Hn.lerp(mi.s,gi.s,e),i=Hn.lerp(mi.l,gi.l,e);return this.setHSL(n,r,i),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}xi.NAMES=fi,xi.prototype.isColor=!0,xi.prototype.r=1,xi.prototype.g=1,xi.prototype.b=1;class bi extends pi{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new xi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Z,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this}}bi.prototype.isMeshBasicMaterial=!0;const wi=new Kn,Mi=new kn;function Si(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=En,this.updateRange={offset:0,count:-1},this.version=0}function Ei(t,e,n){Si.call(this,new Int8Array(t),e,n)}function Ti(t,e,n){Si.call(this,new Uint8Array(t),e,n)}function Ai(t,e,n){Si.call(this,new Uint8ClampedArray(t),e,n)}function Li(t,e,n){Si.call(this,new Int16Array(t),e,n)}function Ci(t,e,n){Si.call(this,new Uint16Array(t),e,n)}function Ri(t,e,n){Si.call(this,new Int32Array(t),e,n)}function Pi(t,e,n){Si.call(this,new Uint32Array(t),e,n)}function Oi(t,e,n){Si.call(this,new Uint16Array(t),e,n)}function Di(t,e,n){Si.call(this,new Float32Array(t),e,n)}function Ii(t,e,n){Si.call(this,new Float64Array(t),e,n)}function Ni(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}Object.defineProperty(Si.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Si.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new xi),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this},copyVector2sArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new kn),e[n++]=i.x,e[n++]=i.y}return this},copyVector3sArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new Kn),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this},copyVector4sArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new Xn),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Mi.fromBufferAttribute(this,e),Mi.applyMatrix3(t),this.setXY(e,Mi.x,Mi.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)wi.fromBufferAttribute(this,e),wi.applyMatrix3(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this},applyMatrix4:function(t){for(let e=0,n=this.count;e<n;e++)wi.x=this.getX(e),wi.y=this.getY(e),wi.z=this.getZ(e),wi.applyMatrix4(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this},applyNormalMatrix:function(t){for(let e=0,n=this.count;e<n;e++)wi.x=this.getX(e),wi.y=this.getY(e),wi.z=this.getZ(e),wi.applyNormalMatrix(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this},transformDirection:function(t){for(let e=0,n=this.count;e<n;e++)wi.x=this.getX(e),wi.y=this.getY(e),wi.z=this.getZ(e),wi.transformDirection(t),this.setXYZ(e,wi.x,wi.y,wi.z);return this},set:function(t,e=0){return this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Ei.prototype=Object.create(Si.prototype),Ei.prototype.constructor=Ei,Ti.prototype=Object.create(Si.prototype),Ti.prototype.constructor=Ti,Ai.prototype=Object.create(Si.prototype),Ai.prototype.constructor=Ai,Li.prototype=Object.create(Si.prototype),Li.prototype.constructor=Li,Ci.prototype=Object.create(Si.prototype),Ci.prototype.constructor=Ci,Ri.prototype=Object.create(Si.prototype),Ri.prototype.constructor=Ri,Pi.prototype=Object.create(Si.prototype),Pi.prototype.constructor=Pi,Oi.prototype=Object.create(Si.prototype),Oi.prototype.constructor=Oi,Oi.prototype.isFloat16BufferAttribute=!0,Di.prototype=Object.create(Si.prototype),Di.prototype.constructor=Di,Ii.prototype=Object.create(Si.prototype),Ii.prototype.constructor=Ii;const Bi={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function zi(t,e){return new Bi[t](e)}let Fi=0;const Hi=new Er,ki=new Jr,Ui=new Kn,Gi=new tr,Vi=new tr,Wi=new Kn;function ji(){Object.defineProperty(this,"id",{value:Fi++}),this.uuid=Hn.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}ji.prototype=Object.assign(Object.create(Bn.prototype),{constructor:ji,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Ni(t)>65535?Pi:Ci)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Un).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Hi.makeRotationX(t),this.applyMatrix4(Hi),this},rotateY:function(t){return Hi.makeRotationY(t),this.applyMatrix4(Hi),this},rotateZ:function(t){return Hi.makeRotationZ(t),this.applyMatrix4(Hi),this},translate:function(t,e,n){return Hi.makeTranslation(t,e,n),this.applyMatrix4(Hi),this},scale:function(t,e,n){return Hi.makeScale(t,e,n),this.applyMatrix4(Hi),this},lookAt:function(t){return ki.lookAt(t),ki.updateMatrix(),this.applyMatrix4(ki.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ui).negate(),this.translate(Ui.x,Ui.y,Ui.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Di(e,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new tr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Kn(-1/0,-1/0,-1/0),new Kn(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Gi.setFromBufferAttribute(n),this.morphTargetsRelative?(Wi.addVectors(this.boundingBox.min,Gi.min),this.boundingBox.expandByPoint(Wi),Wi.addVectors(this.boundingBox.max,Gi.max),this.boundingBox.expandByPoint(Wi)):(this.boundingBox.expandByPoint(Gi.min),this.boundingBox.expandByPoint(Gi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new gr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Kn,1/0);if(t){const n=this.boundingSphere.center;if(Gi.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Vi.setFromBufferAttribute(n),this.morphTargetsRelative?(Wi.addVectors(Gi.min,Vi.min),Gi.expandByPoint(Wi),Wi.addVectors(Gi.max,Vi.max),Gi.expandByPoint(Wi)):(Gi.expandByPoint(Vi.min),Gi.expandByPoint(Vi.max))}Gi.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)Wi.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(Wi));if(e)for(let i=0,o=e.length;i<o;i++){const o=e[i],a=this.morphTargetsRelative;for(let e=0,i=o.count;e<i;e++)Wi.fromBufferAttribute(o,e),a&&(Ui.fromBufferAttribute(t,e),Wi.add(Ui)),r=Math.max(r,n.distanceToSquared(Wi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeTangents:function(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,r=e.position.array,i=e.normal.array,o=e.uv.array,a=r.length/3;void 0===e.tangent&&this.setAttribute("tangent",new Si(new Float32Array(4*a),4));const s=e.tangent.array,l=[],c=[];for(let t=0;t<a;t++)l[t]=new Kn,c[t]=new Kn;const u=new Kn,h=new Kn,d=new Kn,p=new kn,f=new kn,m=new kn,g=new Kn,v=new Kn;function y(t,e,n){u.fromArray(r,3*t),h.fromArray(r,3*e),d.fromArray(r,3*n),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),h.sub(u),d.sub(u),f.sub(p),m.sub(p);const i=1/(f.x*m.y-m.x*f.y);isFinite(i)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(i),v.copy(d).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(i),l[t].add(g),l[e].add(g),l[n].add(g),c[t].add(v),c[e].add(v),c[n].add(v))}let _=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(let t=0,e=_.length;t<e;++t){const e=_[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)y(n[t+0],n[t+1],n[t+2])}const x=new Kn,b=new Kn,w=new Kn,M=new Kn;function S(t){w.fromArray(i,3*t),M.copy(w);const e=l[t];x.copy(e),x.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(M,e);const n=b.dot(c[t])<0?-1:1;s[4*t]=x.x,s[4*t+1]=x.y,s[4*t+2]=x.z,s[4*t+3]=n}for(let t=0,e=_.length;t<e;++t){const e=_[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)S(n[t+0]),S(n[t+1]),S(n[t+2])}},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new Si(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const r=new Kn,i=new Kn,o=new Kn,a=new Kn,s=new Kn,l=new Kn,c=new Kn,u=new Kn;if(t)for(let h=0,d=t.count;h<d;h+=3){const d=t.getX(h+0),p=t.getX(h+1),f=t.getX(h+2);r.fromBufferAttribute(e,d),i.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),a.fromBufferAttribute(n,d),s.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),a.add(c),s.add(c),l.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(void 0===t.attributes[r])continue;const i=n[r].array,o=t.attributes[r],a=o.array,s=o.itemSize*e,l=Math.min(a.length,i.length-s);for(let t=0,e=s;t<l;t++,e++)i[e]=a[t]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Wi.fromBufferAttribute(t,e),Wi.normalize(),t.setXYZ(e,Wi.x,Wi.y,Wi.z)},toNonIndexed:function(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,o=new n.constructor(e.length*r);let a=0,s=0;for(let t=0,i=e.length;t<i;t++){a=e[t]*r;for(let t=0;t<r;t++)o[s++]=n[a++]}return new Si(o,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new ji,n=this.index.array,r=this.attributes;for(const i in r){const o=t(r[i],n);e.setAttribute(i,o)}const i=this.morphAttributes;for(const r in i){const o=[],a=i[r];for(let e=0,r=a.length;e<r;e++){const r=t(a[e],n);o.push(r)}e.morphAttributes[r]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,n=o.length;t<n;t++){const n=o[t];e.addGroup(n.start,n.count,n.materialIndex)}return e},toJSON:function(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const r=n[e],i=r.toJSON(t.data);""!==r.name&&(i.name=r.name),t.data.attributes[e]=i}const r={};let i=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,r=n.length;e<r;e++){const r=n[e],i=r.toJSON(t.data);""!==r.name&&(i.name=r.name),o.push(i)}o.length>0&&(r[e]=o,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t},clone:function(){return(new ji).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const t in r){const n=r[t];this.setAttribute(t,n.clone(e))}const i=t.morphAttributes;for(const t in i){const n=[],r=i[t];for(let t=0,i=r.length;t<i;t++)n.push(r[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const qi=new Er,Xi=new Sr,Yi=new gr,Zi=new Kn,Ji=new Kn,Ki=new Kn,Qi=new Kn,$i=new Kn,to=new Kn,eo=new Kn,no=new Kn,ro=new Kn,io=new kn,oo=new kn,ao=new kn,so=new Kn,lo=new Kn;function co(t=new ji,e=new bi){Jr.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function uo(t,e,n,r,i,o,a,s,l,c,u,h){Zi.fromBufferAttribute(i,c),Ji.fromBufferAttribute(i,u),Ki.fromBufferAttribute(i,h);const d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){eo.set(0,0,0),no.set(0,0,0),ro.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],n=o[t];0!==e&&(Qi.fromBufferAttribute(n,c),$i.fromBufferAttribute(n,u),to.fromBufferAttribute(n,h),a?(eo.addScaledVector(Qi,e),no.addScaledVector($i,e),ro.addScaledVector(to,e)):(eo.addScaledVector(Qi.sub(Zi),e),no.addScaledVector($i.sub(Ji),e),ro.addScaledVector(to.sub(Ki),e)))}Zi.add(eo),Ji.add(no),Ki.add(ro)}t.isSkinnedMesh&&e.skinning&&(t.boneTransform(c,Zi),t.boneTransform(u,Ji),t.boneTransform(h,Ki));const p=function(t,e,n,r,i,o,a,s){let l;if(l=e.side===m?r.intersectTriangle(a,o,i,!0,s):r.intersectTriangle(i,o,a,e.side!==g,s),null===l)return null;lo.copy(s),lo.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(lo);return c<n.near||c>n.far?null:{distance:c,point:lo.clone(),object:t}}(t,e,n,r,Zi,Ji,Ki,so);if(p){s&&(io.fromBufferAttribute(s,c),oo.fromBufferAttribute(s,u),ao.fromBufferAttribute(s,h),p.uv=hi.getUV(so,Zi,Ji,Ki,io,oo,ao,new kn)),l&&(io.fromBufferAttribute(l,c),oo.fromBufferAttribute(l,u),ao.fromBufferAttribute(l,h),p.uv2=hi.getUV(so,Zi,Ji,Ki,io,oo,ao,new kn));const t={a:c,b:c,c:h,normal:new Kn,materialIndex:0};hi.getNormal(Zi,Ji,Ki,t.normal),p.face=t}return p}co.prototype=Object.assign(Object.create(Jr.prototype),{constructor:co,isMesh:!0,copy:function(t){return Jr.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Yi.copy(n.boundingSphere),Yi.applyMatrix4(i),!1===t.ray.intersectsSphere(Yi))return;if(qi.copy(i).invert(),Xi.copy(t.ray).applyMatrix4(qi),null!==n.boundingBox&&!1===Xi.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const i=n.index,a=n.attributes.position,s=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,u=n.attributes.uv2,h=n.groups,d=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,p=h.length;n<p;n++){const p=h[n],f=r[p.materialIndex];for(let n=Math.max(p.start,d.start),r=Math.min(p.start+p.count,d.start+d.count);n<r;n+=3){const r=i.getX(n),h=i.getX(n+1),d=i.getX(n+2);o=uo(this,f,t,Xi,a,s,l,c,u,r,h,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else for(let n=Math.max(0,d.start),h=Math.min(i.count,d.start+d.count);n<h;n+=3){const h=i.getX(n),d=i.getX(n+1),p=i.getX(n+2);o=uo(this,r,t,Xi,a,s,l,c,u,h,d,p),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}else if(void 0!==a)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],p=r[i.materialIndex];for(let n=Math.max(i.start,d.start),r=Math.min(i.start+i.count,d.start+d.count);n<r;n+=3)o=uo(this,p,t,Xi,a,s,l,c,u,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,e.push(o))}else for(let n=Math.max(0,d.start),i=Math.min(a.count,d.start+d.count);n<i;n+=3)o=uo(this,r,t,Xi,a,s,l,c,u,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}});class ho extends ji{constructor(t=1,e=1,n=1,r=1,i=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const a=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const s=[],l=[],c=[],u=[];let h=0,d=0;function p(t,e,n,r,i,o,p,f,m,g,v){const y=o/m,_=p/g,x=o/2,b=p/2,w=f/2,M=m+1,S=g+1;let E=0,T=0;const A=new Kn;for(let o=0;o<S;o++){const a=o*_-b;for(let s=0;s<M;s++){const h=s*y-x;A[t]=h*r,A[e]=a*i,A[n]=w,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),u.push(s/m),u.push(1-o/g),E+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=h+e+M*t,r=h+e+M*(t+1),i=h+(e+1)+M*(t+1),o=h+(e+1)+M*t;s.push(n,r,o),s.push(r,i,o),T+=6}a.addGroup(d,T,v),d+=T,h+=E}p("z","y","x",-1,-1,n,e,t,o,i,0),p("z","y","x",1,-1,n,e,-t,o,i,1),p("x","z","y",1,1,t,n,e,r,o,2),p("x","z","y",1,-1,t,n,-e,r,o,3),p("x","y","z",1,-1,t,e,n,r,i,4),p("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new Di(l,3)),this.setAttribute("normal",new Di(c,3)),this.setAttribute("uv",new Di(u,2))}}function po(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function fo(t){const e={};for(let n=0;n<t.length;n++){const r=po(t[n]);for(const t in r)e[t]=r[t]}return e}const mo={clone:po,merge:fo};function go(t){pi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function vo(){Jr.call(this),this.type="Camera",this.matrixWorldInverse=new Er,this.projectionMatrix=new Er,this.projectionMatrixInverse=new Er}function yo(t=50,e=1,n=.1,r=2e3){vo.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}go.prototype=Object.create(pi.prototype),go.prototype.constructor=go,go.prototype.isShaderMaterial=!0,go.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=po(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},go.prototype.toJSON=function(t){const e=pi.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},vo.prototype=Object.assign(Object.create(Jr.prototype),{constructor:vo,isCamera:!0,copy:function(t,e){return Jr.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Kn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Jr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Jr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),yo.prototype=Object.assign(Object.create(vo.prototype),{constructor:yo,isPerspectiveCamera:!0,copy:function(t,e){return vo.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Hn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Hn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Hn.RAD2DEG*Math.atan(Math.tan(.5*Hn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Hn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,a=o.fullHeight;i+=o.offsetX*r/t,e-=o.offsetY*n/a,r*=o.width/t,n*=o.height/a}const a=this.filmOffset;0!==a&&(i+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Jr.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const _o=90;class xo extends Jr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new yo(_o,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Kn(1,0,0)),this.add(r);const i=new yo(_o,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Kn(-1,0,0)),this.add(i);const o=new yo(_o,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Kn(0,1,0)),this.add(o);const a=new yo(_o,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new Kn(0,-1,0)),this.add(a);const s=new yo(_o,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Kn(0,0,1)),this.add(s);const l=new yo(_o,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Kn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,o,a,s,l]=this.children,c=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,s),n.texture.generateMipmaps=h,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(u),t.xr.enabled=c}}class bo extends jn{constructor(t,e,n,r,i,o,a,s,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:ot,n,r,i,o,a=void 0!==a?a:zt,s,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}bo.prototype.isCubeTexture=!0;class wo extends Yn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bo(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:_t,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Ft,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",o=new ho(5,5,5),a=new go({name:"CubemapFromEquirect",uniforms:po(n),vertexShader:r,fragmentShader:i,side:m,blending:_});a.uniforms.tEquirect.value=e;const s=new co(o,a),l=e.minFilter;return e.minFilter===wt&&(e.minFilter=_t),new xo(1,10,this).update(t,s),e.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let i=0;i<6;i++)t.setRenderTarget(this,i),t.clear(e,n,r);t.setRenderTarget(i)}}wo.prototype.isWebGLCubeRenderTarget=!0;class Mo extends jn{constructor(t,e,n,r,i,o,a,s,l,c,u,h){super(null,o,a,s,l,c,r,i,u,h),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ft,this.minFilter=void 0!==c?c:ft,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Mo.prototype.isDataTexture=!0;const So=new gr,Eo=new Kn;class To{constructor(t=new ti,e=new ti,n=new ti,r=new ti,i=new ti,o=new ti){this.planes=[t,e,n,r,i,o]}set(t,e,n,r,i,o){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-r,u-s,f-h,y-m).normalize(),e[1].setComponents(a+r,u+s,f+h,y+m).normalize(),e[2].setComponents(a+i,u+l,f+d,y+g).normalize(),e[3].setComponents(a-i,u-l,f-d,y-g).normalize(),e[4].setComponents(a-o,u-c,f-p,y-v).normalize(),e[5].setComponents(a+o,u+c,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),So.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(So)}intersectsSprite(t){return So.center.set(0,0,0),So.radius=.7071067811865476,So.applyMatrix4(t.matrixWorld),this.intersectsSphere(So)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<r)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(Eo.x=r.normal.x>0?t.max.x:t.min.x,Eo.y=r.normal.y>0?t.max.y:t.min.y,Eo.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Eo)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ao(){let t=null,e=!1,n=null,r=null;function i(e,o){n(e,o),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Lo(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=r.get(e);void 0===o?r.set(e,function(e,r){const i=e.array,o=e.usage,a=t.createBuffer();t.bindBuffer(r,a),t.bufferData(r,i,o),e.onUploadCallback();let s=5126;return i instanceof Float32Array?s=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?e.isFloat16BufferAttribute?n?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:i instanceof Int16Array?s=5122:i instanceof Uint32Array?s=5125:i instanceof Int32Array?s=5124:i instanceof Int8Array?s=5120:i instanceof Uint8Array&&(s=5121),{buffer:a,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):o.version<e.version&&(function(e,r,i){const o=r.array,a=r.updateRange;t.bindBuffer(i,e),-1===a.count?t.bufferSubData(i,0,o):(n?t.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):t.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,e,i),o.version=e.version)}}}class Co extends ji{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,o=e/2,a=Math.floor(n),s=Math.floor(r),l=a+1,c=s+1,u=t/a,h=e/s,d=[],p=[],f=[],m=[];for(let t=0;t<c;t++){const e=t*h-o;for(let n=0;n<l;n++){const r=n*u-i;p.push(r,-e,0),f.push(0,0,1),m.push(n/a),m.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<a;e++){const n=e+l*t,r=e+l*(t+1),i=e+1+l*(t+1),o=e+1+l*t;d.push(n,r,o),d.push(r,i,o)}this.setIndex(d),this.setAttribute("position",new Di(p,3)),this.setAttribute("normal",new Di(f,3)),this.setAttribute("uv",new Di(m,2))}}const Ro={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Po={common:{diffuse:{value:new xi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Un},uv2Transform:{value:new Un},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new kn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new xi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Un}},sprite:{diffuse:{value:new xi(15658734)},opacity:{value:1},center:{value:new kn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Un}}},Oo={basic:{uniforms:fo([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.fog]),vertexShader:Ro.meshbasic_vert,fragmentShader:Ro.meshbasic_frag},lambert:{uniforms:fo([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.fog,Po.lights,{emissive:{value:new xi(0)}}]),vertexShader:Ro.meshlambert_vert,fragmentShader:Ro.meshlambert_frag},phong:{uniforms:fo([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,Po.lights,{emissive:{value:new xi(0)},specular:{value:new xi(1118481)},shininess:{value:30}}]),vertexShader:Ro.meshphong_vert,fragmentShader:Ro.meshphong_frag},standard:{uniforms:fo([Po.common,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.roughnessmap,Po.metalnessmap,Po.fog,Po.lights,{emissive:{value:new xi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ro.meshphysical_vert,fragmentShader:Ro.meshphysical_frag},toon:{uniforms:fo([Po.common,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.gradientmap,Po.fog,Po.lights,{emissive:{value:new xi(0)}}]),vertexShader:Ro.meshtoon_vert,fragmentShader:Ro.meshtoon_frag},matcap:{uniforms:fo([Po.common,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,{matcap:{value:null}}]),vertexShader:Ro.meshmatcap_vert,fragmentShader:Ro.meshmatcap_frag},points:{uniforms:fo([Po.points,Po.fog]),vertexShader:Ro.points_vert,fragmentShader:Ro.points_frag},dashed:{uniforms:fo([Po.common,Po.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ro.linedashed_vert,fragmentShader:Ro.linedashed_frag},depth:{uniforms:fo([Po.common,Po.displacementmap]),vertexShader:Ro.depth_vert,fragmentShader:Ro.depth_frag},normal:{uniforms:fo([Po.common,Po.bumpmap,Po.normalmap,Po.displacementmap,{opacity:{value:1}}]),vertexShader:Ro.normal_vert,fragmentShader:Ro.normal_frag},sprite:{uniforms:fo([Po.sprite,Po.fog]),vertexShader:Ro.sprite_vert,fragmentShader:Ro.sprite_frag},background:{uniforms:{uvTransform:{value:new Un},t2D:{value:null}},vertexShader:Ro.background_vert,fragmentShader:Ro.background_frag},cube:{uniforms:fo([Po.envmap,{opacity:{value:1}}]),vertexShader:Ro.cube_vert,fragmentShader:Ro.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ro.equirect_vert,fragmentShader:Ro.equirect_frag},distanceRGBA:{uniforms:fo([Po.common,Po.displacementmap,{referencePosition:{value:new Kn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ro.distanceRGBA_vert,fragmentShader:Ro.distanceRGBA_frag},shadow:{uniforms:fo([Po.lights,Po.fog,{color:{value:new xi(0)},opacity:{value:1}}]),vertexShader:Ro.shadow_vert,fragmentShader:Ro.shadow_frag}};function Do(t,e,n,r,i){const o=new xi(0);let a,s,l=0,c=null,u=0,h=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(n,i,p,g){let v=!0===i.isScene?i.background:null;v&&v.isTexture&&(v=e.get(v));const y=t.xr,_=y.getSession&&y.getSession();_&&"additive"===_.environmentBlendMode&&(v=null),null===v?d(o,l):v&&v.isColor&&(d(v,1),g=!0),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.isWebGLCubeRenderTarget||v.mapping===ct)?(void 0===s&&(s=new co(new ho(1,1,1),new go({name:"BackgroundCubeMaterial",uniforms:po(Oo.cube.uniforms),vertexShader:Oo.cube.vertexShader,fragmentShader:Oo.cube.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),v.isWebGLCubeRenderTarget&&(v=v.texture),s.material.uniforms.envMap.value=v,s.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v._needsFlipEnvMap?-1:1,c===v&&u===v.version&&h===t.toneMapping||(s.material.needsUpdate=!0,c=v,u=v.version,h=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):v&&v.isTexture&&(void 0===a&&(a=new co(new Co(2,2),new go({name:"BackgroundMaterial",uniforms:po(Oo.background.uniforms),vertexShader:Oo.background.vertexShader,fragmentShader:Oo.background.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),a.material.uniforms.t2D.value=v,!0===v.matrixAutoUpdate&&v.updateMatrix(),a.material.uniforms.uvTransform.value.copy(v.matrix),c===v&&u===v.version&&h===t.toneMapping||(a.material.needsUpdate=!0,c=v,u=v.version,h=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Io(t,e,n,r){const i=t.getParameter(34921),o=r.isWebGL2?null:e.get("OES_vertex_array_object"),a=r.isWebGL2||null!==o,s={},l=d(null);let c=l;function u(e){return r.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function h(e){return r.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],r=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function p(){const t=c.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,i){const o=c.newAttributes,a=c.enabledAttributes,s=c.attributeDivisors;o[n]=1,0===a[n]&&(t.enableVertexAttribArray(n),a[n]=1),s[n]!==i&&((r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function g(){const e=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function v(e,n,i,o,a,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,o,a,s):t.vertexAttribIPointer(e,n,i,a,s)}function y(){_(),c!==l&&(c=l,u(c.object))}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,h,y,_){let x=!1;if(a){const e=function(e,n,i){const a=!0===i.wireframe;let l=s[e.id];void 0===l&&(l={},s[e.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let u=c[a];return void 0===u&&(u=d(r.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),c[a]=u),u}(y,h,l);c!==e&&(c=e,u(c.object)),x=function(t,e){const n=c.attributes,r=t.attributes;let i=0;for(const t in r){const e=n[t],o=r[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;i++}return c.attributesNum!==i||c.index!==e}(y,_),x&&function(t,e){const n={},r=t.attributes;let i=0;for(const t in r){const e=r[t],o={};o.attribute=e,e.data&&(o.data=e.data),n[t]=o,i++}c.attributes=n,c.attributesNum=i,c.index=e}(y,_)}else{const t=!0===l.wireframe;c.geometry===y.id&&c.program===h.id&&c.wireframe===t||(c.geometry=y.id,c.program=h.id,c.wireframe=t,x=!0)}!0===i.isInstancedMesh&&(x=!0),null!==_&&n.update(_,34963),x&&(function(i,o,a,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=s.attributes,c=a.getAttributes(),u=o.defaultAttributeValues;for(const e in c){const r=c[e];if(r>=0){const o=l[e];if(void 0!==o){const e=o.normalized,i=o.itemSize,a=n.get(o);if(void 0===a)continue;const l=a.buffer,c=a.type,u=a.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,a=n.stride,h=o.offset;n&&n.isInstancedInterleavedBuffer?(m(r,n.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)):f(r),t.bindBuffer(34962,l),v(r,i,c,e,a*u,h*u)}else o.isInstancedBufferAttribute?(m(r,o.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)):f(r),t.bindBuffer(34962,l),v(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const o=e.buffer,a=e.type;m(r+0,1),m(r+1,1),m(r+2,1),m(r+3,1),t.bindBuffer(34962,o),t.vertexAttribPointer(r+0,4,a,!1,64,0),t.vertexAttribPointer(r+1,4,a,!1,64,16),t.vertexAttribPointer(r+2,4,a,!1,64,32),t.vertexAttribPointer(r+3,4,a,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const o=e.buffer,a=e.type;m(r,1),t.bindBuffer(34962,o),t.vertexAttribPointer(r,3,a,!1,12,0)}else if(void 0!==u){const n=u[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,h,y),null!==_&&t.bindBuffer(34963,n.get(_).buffer))},reset:y,resetDefaultState:_,dispose:function(){y();for(const t in s){const e=s[t];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const n=s[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)h(r[t].object),delete r[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function No(t,e,n,r){const i=r.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,r){t.drawArrays(o,e,r),n.update(r,o,1)},this.renderInstances=function(r,a,s){if(0===s)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,r,a,s),n.update(a,o,s)}}function Bo(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),u=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=u>0,y=o||e.has("OES_texture_float");return{isWebGL2:o,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:o?t.getParameter(36183):0}}function zo(t){const e=this;let n=null,r=0,i=!1,o=!1;const a=new ti,s=new Un,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){const o=null!==t?t.length:0;let c=null;if(0!==o){if(c=l.value,!0!==i||null===c){const e=r+4*o,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=r;e!==o;++e,n+=4)a.copy(t[e]).applyMatrix4(i,s),a.normal.toArray(c,n),c[n+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const a=0!==t.length||e||0!==r||i;return i=e,n=u(t,o,0),r=t.length,a},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,c()},this.setState=function(e,a,s){const h=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!i||null===h||0===h.length||o&&!p)o?u(null):c();else{const t=o?0:r,e=4*t;let i=f.clippingState||null;l.value=i,i=u(h,a,e,s);for(let t=0;t!==e;++t)i[t]=n[t];f.clippingState=i,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function Fo(t){let e=new WeakMap;function n(t,e){return e===st?t.mapping=ot:e===lt&&(t.mapping=at),t}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const o=i.mapping;if(o===st||o===lt){if(e.has(i))return n(e.get(i).texture,i.mapping);{const o=i.image;if(o&&o.height>0){const a=t.getRenderTarget(),s=new wo(o.height/2);return s.fromEquirectangularTexture(t,i),e.set(i,s),t.setRenderTarget(a),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function Ho(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ko(t,e,n,r){const i={},o=new WeakMap;function a(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);s.removeEventListener("dispose",a),delete i[s.id];const l=o.get(s);l&&(e.remove(l),o.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){const n=[],r=t.index,i=t.attributes.position;let a=0;if(null!==r){const t=r.array;a=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],o=t[e+2];n.push(r,i,i,o,o,r)}}else{const t=i.array;a=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const s=new(Ni(n)>65535?Pi:Ci)(n,1);s.version=a;const l=o.get(t);l&&e.remove(l),o.set(t,s)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",a),i[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const r=t.morphAttributes;for(const t in r){const n=r[t];for(let t=0,r=n.length;t<r;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return o.get(t)}}}function Uo(t,e,n,r){const i=r.isWebGL2;let o,a,s;this.setMode=function(t){o=t},this.setIndex=function(t){a=t.type,s=t.bytesPerElement},this.render=function(e,r){t.drawElements(o,r,a,e*s),n.update(r,o,1)},this.renderInstances=function(r,l,c){if(0===c)return;let u,h;if(i)u=t,h="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),h="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[h](o,l,a,r*s,c),n.update(l,o,c)}}function Go(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Vo(t,e){return t[0]-e[0]}function Wo(t,e){return Math.abs(e[1])-Math.abs(t[1])}function jo(t){const e={},n=new Float32Array(8),r=[];for(let t=0;t<8;t++)r[t]=[t,0];return{update:function(i,o,a,s){const l=i.morphTargetInfluences,c=void 0===l?0:l.length;let u=e[o.id];if(void 0===u){u=[];for(let t=0;t<c;t++)u[t]=[t,0];e[o.id]=u}for(let t=0;t<c;t++){const e=u[t];e[0]=t,e[1]=l[t]}u.sort(Wo);for(let t=0;t<8;t++)t<c&&u[t][1]?(r[t][0]=u[t][0],r[t][1]=u[t][1]):(r[t][0]=Number.MAX_SAFE_INTEGER,r[t][1]=0);r.sort(Vo);const h=a.morphTargets&&o.morphAttributes.position,d=a.morphNormals&&o.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=r[t],i=e[0],a=e[1];i!==Number.MAX_SAFE_INTEGER&&a?(h&&o.getAttribute("morphTarget"+t)!==h[i]&&o.setAttribute("morphTarget"+t,h[i]),d&&o.getAttribute("morphNormal"+t)!==d[i]&&o.setAttribute("morphNormal"+t,d[i]),n[t]=a,p+=a):(h&&!0===o.hasAttribute("morphTarget"+t)&&o.deleteAttribute("morphTarget"+t),d&&!0===o.hasAttribute("morphNormal"+t)&&o.deleteAttribute("morphNormal"+t),n[t]=0)}const f=o.morphTargetsRelative?1:1-p;s.getUniforms().setValue(t,"morphTargetBaseInfluence",f),s.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function qo(t,e,n,r){let i=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const a=r.render.frame,s=t.geometry,l=e.get(t,s);return i.get(l)!==a&&(e.update(l),i.set(l,a)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}Oo.physical={uniforms:fo([Oo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new kn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new xi(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Ro.meshphysical_vert,fragmentShader:Ro.meshphysical_frag};class Xo extends jn{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=ft,this.minFilter=ft,this.wrapR=dt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}Xo.prototype.isDataTexture2DArray=!0;class Yo extends jn{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=ft,this.minFilter=ft,this.wrapR=dt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}Yo.prototype.isDataTexture3D=!0;const Zo=new jn,Jo=new Xo,Ko=new Yo,Qo=new bo,$o=[],ta=[],ea=new Float32Array(16),na=new Float32Array(9),ra=new Float32Array(4);function ia(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let o=$o[i];if(void 0===o&&(o=new Float32Array(i),$o[i]=o),0!==e){r.toArray(o,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(o,i)}return o}function oa(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function aa(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function sa(t,e){let n=ta[e];void 0===n&&(n=new Int32Array(e),ta[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function la(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function ca(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(oa(n,e))return;t.uniform2fv(this.addr,e),aa(n,e)}}function ua(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(oa(n,e))return;t.uniform3fv(this.addr,e),aa(n,e)}}function ha(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(oa(n,e))return;t.uniform4fv(this.addr,e),aa(n,e)}}function da(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(oa(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),aa(n,e)}else{if(oa(n,r))return;ra.set(r),t.uniformMatrix2fv(this.addr,!1,ra),aa(n,r)}}function pa(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(oa(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),aa(n,e)}else{if(oa(n,r))return;na.set(r),t.uniformMatrix3fv(this.addr,!1,na),aa(n,r)}}function fa(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(oa(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),aa(n,e)}else{if(oa(n,r))return;ea.set(r),t.uniformMatrix4fv(this.addr,!1,ea),aa(n,r)}}function ma(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||Zo,i)}function ga(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Jo,i)}function va(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||Ko,i)}function ya(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||Qo,i)}function _a(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function xa(t,e){const n=this.cache;oa(n,e)||(t.uniform2iv(this.addr,e),aa(n,e))}function ba(t,e){const n=this.cache;oa(n,e)||(t.uniform3iv(this.addr,e),aa(n,e))}function wa(t,e){const n=this.cache;oa(n,e)||(t.uniform4iv(this.addr,e),aa(n,e))}function Ma(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Sa(t,e){t.uniform1fv(this.addr,e)}function Ea(t,e){t.uniform1iv(this.addr,e)}function Ta(t,e){t.uniform2iv(this.addr,e)}function Aa(t,e){t.uniform3iv(this.addr,e)}function La(t,e){t.uniform4iv(this.addr,e)}function Ca(t,e){const n=ia(e,this.size,2);t.uniform2fv(this.addr,n)}function Ra(t,e){const n=ia(e,this.size,3);t.uniform3fv(this.addr,n)}function Pa(t,e){const n=ia(e,this.size,4);t.uniform4fv(this.addr,n)}function Oa(t,e){const n=ia(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Da(t,e){const n=ia(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Ia(t,e){const n=ia(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Na(t,e,n){const r=e.length,i=sa(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.safeSetTexture2D(e[t]||Zo,i[t])}function Ba(t,e,n){const r=e.length,i=sa(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.safeSetTextureCube(e[t]||Qo,i[t])}function za(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return la;case 35664:return ca;case 35665:return ua;case 35666:return ha;case 35674:return da;case 35675:return pa;case 35676:return fa;case 5124:case 35670:return _a;case 35667:case 35671:return xa;case 35668:case 35672:return ba;case 35669:case 35673:return wa;case 5125:return Ma;case 35678:case 36198:case 36298:case 36306:case 35682:return ma;case 35679:case 36299:case 36307:return va;case 35680:case 36300:case 36308:case 36293:return ya;case 36289:case 36303:case 36311:case 36292:return ga}}(e.type)}function Fa(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Sa;case 35664:return Ca;case 35665:return Ra;case 35666:return Pa;case 35674:return Oa;case 35675:return Da;case 35676:return Ia;case 5124:case 35670:return Ea;case 35667:case 35671:return Ta;case 35668:case 35672:return Aa;case 35669:case 35673:return La;case 35678:case 36198:case 36298:case 36306:case 35682:return Na;case 35680:case 36300:case 36308:case 36293:return Ba}}(e.type)}function Ha(t){this.id=t,this.seq=[],this.map={}}Fa.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),aa(e,t)},Ha.prototype.setValue=function(t,e,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(t,e[o.id],n)}};const ka=/(\w+)(\])?(\[|\.)?/g;function Ua(t,e){t.seq.push(e),t.map[e.id]=e}function Ga(t,e,n){const r=t.name,i=r.length;for(ka.lastIndex=0;;){const o=ka.exec(r),a=ka.lastIndex;let s=o[1];const l="]"===o[2],c=o[3];if(l&&(s|=0),void 0===c||"["===c&&a+2===i){Ua(n,void 0===c?new za(s,t,e):new Fa(s,t,e));break}{let t=n.map[s];void 0===t&&(t=new Ha(s),Ua(n,t)),n=t}}}function Va(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r);Ga(n,t.getUniformLocation(e,n.name),this)}}function Wa(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}Va.prototype.setValue=function(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)},Va.prototype.setOptional=function(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)},Va.upload=function(t,e,n,r){for(let i=0,o=e.length;i!==o;++i){const o=e[i],a=n[o.id];!1!==a.needsUpdate&&o.setValue(t,a.value,r)}},Va.seqWithValue=function(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n};let ja=0;function qa(t){switch(t){case Je:return["Linear","( value )"];case Ke:return["sRGB","( value )"];case $e:return["RGBE","( value )"];case en:return["RGBM","( value, 7.0 )"];case nn:return["RGBM","( value, 16.0 )"];case rn:return["RGBD","( value, 256.0 )"];case Qe:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case tn:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function Xa(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Ya(t,e){const n=qa(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Za(t,e){const n=qa(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Ja(t,e){let n;switch(e){case $:n="Linear";break;case tt:n="Reinhard";break;case et:n="OptimizedCineon";break;case nt:n="ACESFilmic";break;case rt:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Ka(t){return""!==t}function Qa(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $a(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ts=/^[ \t]*#include +<([\w\d./]+)>/gm;function es(t){return t.replace(ts,ns)}function ns(t,e){const n=Ro[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return es(n)}const rs=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,is=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function os(t){return t.replace(is,ss).replace(rs,as)}function as(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ss(0,e,n,r)}function ss(t,e,n,r){let i="";for(let t=parseInt(e);t<parseInt(n);t++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return i}function ls(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function cs(t,e,n,r){const i=t.getContext(),o=n.defines;let a=n.vertexShader,s=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===h?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===d?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===p&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ot:case at:e="ENVMAP_TYPE_CUBE";break;case ct:case ut:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),u=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case at:case ut:e="ENVMAP_MODE_REFRACTION"}return e}(n),f=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Z:e="ENVMAP_BLENDING_MULTIPLY";break;case J:e="ENVMAP_BLENDING_MIX";break;case K:e="ENVMAP_BLENDING_ADD"}return e}(n),m=t.gammaFactor>0?t.gammaFactor:1,g=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ka).join("\n")}(n),v=function(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(o),y=i.createProgram();let _,x,b=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(_=[v].filter(Ka).join("\n"),_.length>0&&(_+="\n"),x=[g,v].filter(Ka).join("\n"),x.length>0&&(x+="\n")):(_=[ls(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ka).join("\n"),x=[g,ls(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Q?"#define TONE_MAPPING":"",n.toneMapping!==Q?Ro.tonemapping_pars_fragment:"",n.toneMapping!==Q?Ja("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ro.encodings_pars_fragment,n.map?Ya("mapTexelToLinear",n.mapEncoding):"",n.matcap?Ya("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Ya("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Ya("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Ya("lightMapTexelToLinear",n.lightMapEncoding):"",Za("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ka).join("\n")),a=es(a),a=Qa(a,n),a=$a(a,n),s=es(s),s=Qa(s,n),s=$a(s,n),a=os(a),s=os(s),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(b="#version 300 es\n",_=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,x=["#define varying in",n.glslVersion===Nn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Nn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const w=b+x+s,M=Wa(i,35633,b+_+a),S=Wa(i,35632,w);if(i.attachShader(y,M),i.attachShader(y,S),void 0!==n.index0AttributeName?i.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(y).trim(),e=i.getShaderInfoLog(M).trim(),n=i.getShaderInfoLog(S).trim();let r=!0,o=!0;if(!1===i.getProgramParameter(y,35714)){r=!1;const e=Xa(i,M,"vertex"),n=Xa(i,S,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(y,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:_},fragmentShader:{log:n,prefix:x}})}let E,T;return i.deleteShader(M),i.deleteShader(S),this.getUniforms=function(){return void 0===E&&(E=new Va(i,y)),E},this.getAttributes=function(){return void 0===T&&(T=function(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i).name;n[r]=t.getAttribLocation(e,r)}return n}(i,y)),T},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.name=n.shaderName,this.id=ja++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=M,this.fragmentShader=S,this}function us(t,e,n,r,i,o){const a=[],s=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,u=r.maxVertexUniforms,h=r.vertexTextures;let d=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function v(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Je,e}return{getParameters:function(i,a,f,y,_){const x=y.fog,b=i.isMeshStandardMaterial?y.environment:null,w=e.get(i.envMap||b),M=p[i.type],S=_.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=u,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+r+"."),0):r}}(_):0;let E,T;if(null!==i.precision&&(d=r.getMaxPrecision(i.precision),d!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",d,"instead.")),M){const t=Oo[M];E=t.vertexShader,T=t.fragmentShader}else E=i.vertexShader,T=i.fragmentShader;const A=t.getRenderTarget();return{isWebGL2:s,shaderID:M,shaderName:i.type,vertexShader:E,fragmentShader:T,defines:i.defines,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:d,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:h,outputEncoding:null!==A?v(A.texture):t.outputEncoding,map:!!i.map,mapEncoding:v(i.map),matcap:!!i.matcap,matcapEncoding:v(i.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:v(w),envMapCubeUV:!!w&&(w.mapping===ct||w.mapping===ut),lightMap:!!i.lightMap,lightMapEncoding:v(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:v(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:i.normalMapType===ln,tangentSpaceNormalMap:i.normalMapType===sn,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,transmissionMap:!!i.transmissionMap,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap||i.transmissionMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||i.transmissionMap||!i.displacementMap),fog:!!x,useFog:i.fog,fogExp2:x&&x.isFogExp2,flatShading:!!i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:l,skinning:i.skinning&&S>0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&f.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Q,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===g,flipSided:i.side===m,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<f.length;t++)n.push(e[f[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=p[t.type];let n;if(e){const t=Oo[e];n=mo.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let r;for(let t=0,e=a.length;t<e;t++){const e=a[t];if(e.cacheKey===n){r=e,++r.usedTimes;break}}return void 0===r&&(r=new cs(t,n,e,i),a.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){const e=a.indexOf(t);a[e]=a[a.length-1],a.pop(),t.destroy()}},programs:a}}function hs(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function ds(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function ps(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function fs(t){const e=[];let n=0;const r=[],i=[],o={id:-1};function a(r,i,a,s,l,c){let u=e[n];const h=t.get(a);return void 0===u?(u={id:r.id,object:r,geometry:i,material:a,program:h.program||o,groupOrder:s,renderOrder:r.renderOrder,z:l,group:c},e[n]=u):(u.id=r.id,u.object=r,u.geometry=i,u.material=a,u.program=h.program||o,u.groupOrder=s,u.renderOrder=r.renderOrder,u.z=l,u.group=c),n++,u}return{opaque:r,transparent:i,init:function(){n=0,r.length=0,i.length=0},push:function(t,e,n,o,s,l){const c=a(t,e,n,o,s,l);(!0===n.transparent?i:r).push(c)},unshift:function(t,e,n,o,s,l){const c=a(t,e,n,o,s,l);(!0===n.transparent?i:r).unshift(c)},finish:function(){for(let t=n,r=e.length;t<r;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){r.length>1&&r.sort(t||ds),i.length>1&&i.sort(e||ps)}}}function ms(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new fs(t),e.set(n,[i])):r>=e.get(n).length?(i=new fs(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function gs(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Kn,color:new xi};break;case"SpotLight":n={position:new Kn,direction:new Kn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Kn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Kn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Kn,halfWidth:new Kn,halfHeight:new Kn}}return t[e.id]=n,n}}}let vs=0;function ys(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function _s(t,e){const n=new gs,r=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new kn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new kn,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)i.probe.push(new Kn);const o=new Kn,a=new Er,s=new Er;return{setup:function(o){let a=0,s=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,u=0,h=0,d=0,p=0,f=0,m=0,g=0;o.sort(ys);for(let t=0,e=o.length;t<e;t++){const e=o[t],v=e.color,y=e.intensity,_=e.distance,x=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)a+=v.r*y,s+=v.g*y,l+=v.b*y;else if(e.isLightProbe)for(let t=0;t<9;t++)i.probe[t].addScaledVector(e.sh.coefficients[t],y);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[c]=n,i.directionalShadowMap[c]=x,i.directionalShadowMatrix[c]=e.shadow.matrix,f++}i.directional[c]=t,c++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(v).multiplyScalar(y),t.distance=_,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[h]=n,i.spotShadowMap[h]=x,i.spotShadowMatrix[h]=e.shadow.matrix,g++}i.spot[h]=t,h++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(v).multiplyScalar(y),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.rectArea[d]=t,d++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,i.pointShadow[u]=n,i.pointShadowMap[u]=x,i.pointShadowMatrix[u]=e.shadow.matrix,m++}i.point[u]=t,u++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(y),t.groundColor.copy(e.groundColor).multiplyScalar(y),i.hemi[p]=t,p++}}d>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=Po.LTC_FLOAT_1,i.rectAreaLTC2=Po.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Po.LTC_HALF_1,i.rectAreaLTC2=Po.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=l;const v=i.hash;v.directionalLength===c&&v.pointLength===u&&v.spotLength===h&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===f&&v.numPointShadows===m&&v.numSpotShadows===g||(i.directional.length=c,i.spot.length=h,i.rectArea.length=d,i.point.length=u,i.hemi.length=p,i.directionalShadow.length=f,i.directionalShadowMap.length=f,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=f,i.pointShadowMatrix.length=m,i.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=u,v.spotLength=h,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,i.version=vs++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,u=0;const h=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(h),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(h),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),s.identity(),a.copy(d.matrixWorld),a.premultiply(h),s.extractRotation(a),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),c++}else if(d.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),r++}else if(d.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(h),t.direction.normalize(),u++}}},state:i}}function xs(t,e){const n=new _s(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(){n.setup(r)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function bs(t,e){let n=new WeakMap;return{get:function(r,i=0){let o;return!1===n.has(r)?(o=new xs(t,e),n.set(r,[o])):i>=n.get(r).length?(o=new xs(t,e),n.get(r).push(o)):o=n.get(r)[i],o},dispose:function(){n=new WeakMap}}}class ws extends pi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=on,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}ws.prototype.isMeshDepthMaterial=!0;class Ms extends pi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Kn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Ss(t,e,n){let r=new To;const i=new kn,o=new kn,a=new Xn,s=[],l=[],c={},u={0:m,1:f,2:g},d=new go({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new kn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=d.clone();v.defines.HORIZONTAL_PASS=1;const y=new ji;y.setAttribute("position",new Si(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new co(y,d),b=this;function w(n,r){const i=e.update(x);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,d,x,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,x,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=s[r];return void 0===i&&(i=new ws({depthPacking:an,morphTargets:t,skinning:e}),s[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=l[r];return void 0===i&&(i=new Ms({morphTargets:t,skinning:e}),l[r]=i),i}function E(e,n,r,i,o,a,s){let l=null,h=M,d=e.customDepthMaterial;if(!0===i.isPointLight&&(h=S,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=h(t,i,!0===e.isInstancedMesh)}else l=d;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=s===p?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=o,l.farDistance=a),l}function T(n,i,o,a,s){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===p)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],u=i[c.materialIndex];if(u&&u.visible){const e=E(n,r,u,a,o.near,o.far,s);t.renderBufferDirect(o,null,r,e,n,c)}}}else if(i.visible){const e=E(n,r,i,a,o.near,o.far,s);t.renderBufferDirect(o,null,r,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)T(l[t],i,o,a,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=h,this.render=function(e,s,l){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===e.length)return;const c=t.getRenderTarget(),u=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(_),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let c=0,u=e.length;c<u;c++){const u=e[c],h=u.shadow;if(void 0===h){console.warn("THREE.WebGLShadowMap:",u,"has no shadow.");continue}if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;i.copy(h.mapSize);const f=h.getFrameExtents();if(i.multiply(f),o.copy(h.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(o.x=Math.floor(n/f.x),i.x=o.x*f.x,h.mapSize.x=o.x),i.y>n&&(o.y=Math.floor(n/f.y),i.y=o.y*f.y,h.mapSize.y=o.y)),null===h.map&&!h.isPointLightShadow&&this.type===p){const t={minFilter:_t,magFilter:_t,format:Ft};h.map=new Yn(i.x,i.y,t),h.map.texture.name=u.name+".shadowMap",h.mapPass=new Yn(i.x,i.y,t),h.camera.updateProjectionMatrix()}if(null===h.map){const t={minFilter:ft,magFilter:ft,format:Ft};h.map=new Yn(i.x,i.y,t),h.map.texture.name=u.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const m=h.getViewportCount();for(let t=0;t<m;t++){const e=h.getViewport(t);a.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(a),h.updateMatrices(u,t),r=h.getFrustum(),T(s,l,h.camera,u,this.type)}h.isPointLightShadow||this.type!==p||w(h,l),h.needsUpdate=!1}b.needsUpdate=!1,t.setRenderTarget(c,u,h)}}function Es(t,e,n){const r=n.isWebGL2,i=new function(){let e=!1;const n=new Xn;let r=null;const i=new Xn(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},o=new function(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?ft(2929):mt(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case U:t.depthFunc(512);break;case G:t.depthFunc(519);break;case V:t.depthFunc(513);break;case W:t.depthFunc(515);break;case j:t.depthFunc(514);break;case q:t.depthFunc(518);break;case X:t.depthFunc(516);break;case Y:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},c=new function(){let e=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null;return{setTest:function(t){e||(t?ft(2960):mt(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&l===r||(t.stencilOp(e,n,r),a=e,s=n,l=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null}}};let u={},h=null,d=!1,p=null,f=null,v=null,y=null,Z=null,J=null,K=null,Q=!1,$=null,tt=null,et=null,nt=null,rt=null;const it=t.getParameter(35661);let ot=!1,at=0;const st=t.getParameter(7938);-1!==st.indexOf("WebGL")?(at=parseFloat(/^WebGL (\d)/.exec(st)[1]),ot=at>=1):-1!==st.indexOf("OpenGL ES")&&(at=parseFloat(/^OpenGL ES (\d)/.exec(st)[1]),ot=at>=2);let lt=null,ct={};const ut=new Xn,ht=new Xn;function dt(e,n,r){const i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<r;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,i);return o}const pt={};function ft(e){!0!==u[e]&&(t.enable(e),u[e]=!0)}function mt(e){!1!==u[e]&&(t.disable(e),u[e]=!1)}pt[3553]=dt(3553,3553,1),pt[34067]=dt(34067,34069,6),i.setClear(0,0,0,1),o.setClear(1),c.setClear(0),ft(2929),o.setFunc(W),_t(!1),xt(s),ft(2884),yt(_);const gt={[E]:32774,[T]:32778,[A]:32779};if(r)gt[L]=32775,gt[C]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(gt[L]=t.MIN_EXT,gt[C]=t.MAX_EXT)}const vt={[R]:0,[P]:1,[O]:768,[I]:770,[k]:776,[F]:774,[B]:772,[D]:769,[N]:771,[H]:775,[z]:773};function yt(e,n,r,i,o,a,s,l){if(e!==_){if(!1===d&&(ft(3042),d=!0),e===S)o=o||n,a=a||r,s=s||i,n===f&&o===Z||(t.blendEquationSeparate(gt[n],gt[o]),f=n,Z=o),r===v&&i===y&&a===J&&s===K||(t.blendFuncSeparate(vt[r],vt[i],vt[a],vt[s]),v=r,y=i,J=a,K=s),p=e,Q=null;else if(e!==p||l!==Q){if(f===E&&Z===E||(t.blendEquation(32774),f=E,Z=E),l)switch(e){case x:t.blendFuncSeparate(1,771,1,771);break;case b:t.blendFunc(1,1);break;case w:t.blendFuncSeparate(0,0,769,771);break;case M:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case x:t.blendFuncSeparate(770,771,1,771);break;case b:t.blendFunc(770,1);break;case w:t.blendFunc(0,769);break;case M:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}v=null,y=null,J=null,K=null,p=e,Q=l}}else!0===d&&(mt(3042),d=!1)}function _t(e){$!==e&&(e?t.frontFace(2304):t.frontFace(2305),$=e)}function xt(e){e!==a?(ft(2884),e!==tt&&(e===s?t.cullFace(1029):e===l?t.cullFace(1028):t.cullFace(1032))):mt(2884),tt=e}function bt(e,n,r){e?(ft(32823),nt===n&&rt===r||(t.polygonOffset(n,r),nt=n,rt=r)):mt(32823)}function wt(e){void 0===e&&(e=33984+it-1),lt!==e&&(t.activeTexture(e),lt=e)}return{buffers:{color:i,depth:o,stencil:c},enable:ft,disable:mt,useProgram:function(e){return h!==e&&(t.useProgram(e),h=e,!0)},setBlending:yt,setMaterial:function(t,e){t.side===g?mt(2884):ft(2884);let n=t.side===m;e&&(n=!n),_t(n),t.blending===x&&!1===t.transparent?yt(_):yt(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),i.setMask(t.colorWrite);const r=t.stencilWrite;c.setTest(r),r&&(c.setMask(t.stencilWriteMask),c.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),c.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),bt(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:_t,setCullFace:xt,setLineWidth:function(e){e!==et&&(ot&&t.lineWidth(e),et=e)},setPolygonOffset:bt,setScissorTest:function(t){t?ft(3089):mt(3089)},activeTexture:wt,bindTexture:function(e,n){null===lt&&wt();let r=ct[lt];void 0===r&&(r={type:void 0,texture:void 0},ct[lt]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||pt[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=ct[lt];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===ut.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ut.copy(e))},viewport:function(e){!1===ht.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),ht.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},lt=null,ct={},h=null,d=!1,p=null,f=null,v=null,y=null,Z=null,J=null,K=null,Q=!1,$=null,tt=null,et=null,nt=null,rt=null,i.reset(),o.reset(),c.reset()}}}function Ts(t,e,n,r,i,o,a){const s=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=new WeakMap;let p,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(t,e,n,r){let i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Hn.floorPowerOfTwo:Math.floor,o=r(i*t.width),a=r(i*t.height);void 0===p&&(p=m(o,a));const s=n?m(o,a):p;return s.width=o,s.height=a,s.getContext("2d").drawImage(t,0,0,o,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+a+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function v(t){return Hn.isPowerOfTwo(t.width)&&Hn.isPowerOfTwo(t.height)}function y(t,e){return t.generateMipmaps&&e&&t.minFilter!==ft&&t.minFilter!==_t}function _(e,n,i,o){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,o))}function x(n,r,i){if(!1===s)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||e.get("EXT_color_buffer_float"),o}function b(t){return t===ft||t===mt||t===vt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const n=r.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),r.remove(e))}(n),n.isVideoTexture&&d.delete(n),a.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),o=r.get(n);if(e){if(void 0!==o.__webglTexture&&t.deleteTexture(o.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}}(n),a.memory.textures--}let S=0;function E(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function T(e,i){const a=r.get(e);e.version>0&&a.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;R(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const a=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=a||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const h=u[0],d=v(h)||s,p=o.convert(r.format),f=o.convert(r.type),m=x(r.internalFormat,p,f);let b;if(C(34067,r,d),a){for(let t=0;t<6;t++){b=u[t].mipmaps;for(let e=0;e<b.length;e++){const i=b[e];r.format!==Ft&&r.format!==zt?null!==p?n.compressedTexImage2D(34069+t,e,m,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,i.width,i.height,0,p,f,i.data)}}e.__maxMipLevel=b.length-1}else{b=r.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e<b.length;e++){const r=b[e].image[t].image;n.texImage2D(34069+t,e+1,m,r.width,r.height,0,p,f,r.data)}}else{n.texImage2D(34069+t,0,m,p,f,u[t]);for(let e=0;e<b.length;e++){const r=b[e];n.texImage2D(34069+t,e+1,m,p,f,r.image[t])}}e.__maxMipLevel=b.length}y(r,d)&&_(34067,r,h.width,h.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}(a,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,a.__webglTexture))}const A={[ht]:10497,[dt]:33071,[pt]:33648},L={[ft]:9728,[mt]:9984,[vt]:9986,[_t]:9729,[xt]:9985,[wt]:9987};function C(n,o,a){if(a?(t.texParameteri(n,10242,A[o.wrapS]),t.texParameteri(n,10243,A[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,A[o.wrapR]),t.texParameteri(n,10240,L[o.magFilter]),t.texParameteri(n,10241,L[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===dt&&o.wrapT===dt||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,b(o.magFilter)),t.texParameteri(n,10241,b(o.minFilter)),o.minFilter!==ft&&o.minFilter!==_t&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(o.type===Rt&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&o.type===Pt&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function R(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),a.memory.textures++)}function P(e,r,i){let a=3553;r.isDataTexture2DArray&&(a=35866),r.isDataTexture3D&&(a=32879),R(e,r),n.activeTexture(33984+i),n.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!s&&(t.wrapS!==dt||t.wrapT!==dt||t.minFilter!==ft&&t.minFilter!==_t)}(r)&&!1===v(r.image),c=g(r.image,l,!1,u),h=v(c)||s,d=o.convert(r.format);let p,f=o.convert(r.type),m=x(r.internalFormat,d,f);C(a,r,h);const b=r.mipmaps;if(r.isDepthTexture)m=6402,s?m=r.type===Rt?36012:r.type===Ct?33190:r.type===Nt?35056:33189:r.type===Rt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===m&&r.type!==At&&r.type!==Ct&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=At,f=o.convert(r.type)),r.format===Vt&&6402===m&&(m=34041,r.type!==Nt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Nt,f=o.convert(r.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(r.isDataTexture)if(b.length>0&&h){for(let t=0,e=b.length;t<e;t++)p=b[t],n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);r.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,c.width,c.height,0,d,f,c.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(let t=0,e=b.length;t<e;t++)p=b[t],r.format!==Ft&&r.format!==zt?null!==d?n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=b.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(b.length>0&&h){for(let t=0,e=b.length;t<e;t++)p=b[t],n.texImage2D(3553,t,m,d,f,p);r.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,m,d,f,c),e.__maxMipLevel=0;y(r,h)&&_(a,r,c.width,c.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function O(e,i,a,s){const l=i.texture,c=o.convert(l.format),u=o.convert(l.type),h=x(l.internalFormat,c,u);32879===s||35866===s?n.texImage3D(s,0,h,i.width,i.height,i.depth,0,c,u,null):n.texImage2D(s,0,h,i.width,i.height,0,c,u,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,a,s,r.get(l).__webglTexture,0),t.bindFramebuffer(36160,null)}function D(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===Rt?i=36012:e.type===Ct&&(i=33190));const r=I(n);t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){const e=I(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=n.texture,i=o.convert(e.format),a=o.convert(e.type),s=x(e.internalFormat,i,a);if(r){const e=I(n);t.renderbufferStorageMultisample(36161,e,s,n.width,n.height)}else t.renderbufferStorage(36161,s,n.width,n.height)}t.bindRenderbuffer(36161,null)}function I(t){return s&&t.isWebGLMultisampleRenderTarget?Math.min(h,t.samples):0}let N=!1,B=!1;this.allocateTextureUnit=function(){const t=S;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=T,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),a.memory.textures++;const u=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,d=i.isDataTexture3D||i.isDataTexture2DArray,p=v(e)||s;if(!s||i.format!==zt||i.type!==Rt&&i.type!==Pt||(i.format=Ft,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),h)if(s){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=o.convert(i.format),r=o.convert(i.type),a=x(i.internalFormat,n,r),s=I(e);t.renderbufferStorageMultisample(36161,s,a,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),D(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){n.bindTexture(34067,c.__webglTexture),C(34067,i,p);for(let t=0;t<6;t++)O(l.__webglFramebuffer[t],e,36064,34069+t);y(i,p)&&_(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;d&&(s?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),C(t,i,p),O(l.__webglFramebuffer,e,36064,t),y(i,p)&&_(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&function(e){const n=r.get(e),i=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),E(n.depthTexture,0);const i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Gt)t.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==Vt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)t.bindFramebuffer(36160,n.__webglFramebuffer[r]),n.__webglDepthbuffer[r]=t.createRenderbuffer(),D(n.__webglDepthbuffer[r],e,!1)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),D(n.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(y(e,v(t)||s)){const i=t.isWebGLCubeRenderTarget?34067:3553,o=r.get(e).__webglTexture;n.bindTexture(i,o),_(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(s){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,o=e.height;let a=16384;e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024),t.blitFramebuffer(0,0,i,o,0,0,i,o,a,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),N=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),t=t.texture),T(t,e)}}function As(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===St)return 5121;if(t===Ot)return 32819;if(t===Dt)return 32820;if(t===It)return 33635;if(t===Et)return 5120;if(t===Tt)return 5122;if(t===At)return 5123;if(t===Lt)return 5124;if(t===Ct)return 5125;if(t===Rt)return 5126;if(t===Pt)return r?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(t===Bt)return 6406;if(t===zt)return 6407;if(t===Ft)return 6408;if(t===Ht)return 6409;if(t===kt)return 6410;if(t===Gt)return 6402;if(t===Vt)return 34041;if(t===Wt)return 6403;if(t===jt)return 36244;if(t===qt)return 33319;if(t===Xt)return 33320;if(t===Yt)return 36248;if(t===Zt)return 36249;if(t===Jt||t===Kt||t===Qt||t===$t){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===Jt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Kt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Qt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===$t)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===te||t===ee||t===ne||t===re){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===te)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ee)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ne)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===re)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ie)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===oe||t===ae)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===oe)return n.COMPRESSED_RGB8_ETC2;if(t===ae)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===se||t===le||t===ce||t===ue||t===he||t===de||t===pe||t===fe||t===me||t===ge||t===ve||t===ye||t===_e||t===xe||t===we||t===Me||t===Se||t===Ee||t===Te||t===Ae||t===Le||t===Ce||t===Re||t===Pe||t===Oe||t===De||t===Ie||t===Ne?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):t===be?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===Nt?r?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Ls(t=[]){yo.call(this),this.cameras=t}Ms.prototype.isMeshDistanceMaterial=!0,Ls.prototype=Object.assign(Object.create(yo.prototype),{constructor:Ls,isArrayCamera:!0});class Cs extends Jr{constructor(){super(),this.type="Group"}}function Rs(){this._targetRay=null,this._grip=null,this._hand=null}function Ps(t,e){const n=this;let r=null,i=1,o=null,a="local-floor",s=null;const l=[],c=new Map,u=new yo;u.layers.enable(1),u.viewport=new Xn;const h=new yo;h.layers.enable(2),h.viewport=new Xn;const d=[u,h],p=new Ls;p.layers.enable(1),p.layers.enable(2);let f=null,m=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function v(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),f=null,m=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(t){const e=r.inputSources;for(let t=0;t<l.length;t++)c.set(e[t],l[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],r=c.get(n);r&&(r.dispatchEvent({type:"disconnected",data:n}),c.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],r=c.get(n);r&&r.dispatchEvent({type:"connected",data:n})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=l[t];return void 0===e&&(e=new Rs,l[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=l[t];return void 0===e&&(e=new Rs,l[t]=e),e.getGripSpace()},this.getHand=function(t){let e=l[t];return void 0===e&&(e=new Rs,l[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){i=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return r},this.setSession=async function(t){if(r=t,null!==r){r.addEventListener("select",g),r.addEventListener("selectstart",g),r.addEventListener("selectend",g),r.addEventListener("squeeze",g),r.addEventListener("squeezestart",g),r.addEventListener("squeezeend",g),r.addEventListener("end",v),r.addEventListener("inputsourceschange",y);const t=e.getContextAttributes();!0!==t.xrCompatible&&await e.makeXRCompatible();const s={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:i},l=new XRWebGLLayer(r,e,s);r.updateRenderState({baseLayer:l}),o=await r.requestReferenceSpace(a),M.setContext(r),M.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const _=new Kn,x=new Kn;function b(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){p.near=h.near=u.near=t.near,p.far=h.far=u.far=t.far,f===p.near&&m===p.far||(r.updateRenderState({depthNear:p.near,depthFar:p.far}),f=p.near,m=p.far);const e=t.parent,n=p.cameras;b(p,e);for(let t=0;t<n.length;t++)b(n[t],e);t.matrixWorld.copy(p.matrixWorld),t.matrix.copy(p.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);return 2===n.length?function(t,e,n){_.setFromMatrixPosition(e.matrixWorld),x.setFromMatrixPosition(n.matrixWorld);const r=_.distanceTo(x),i=e.projectionMatrix.elements,o=n.projectionMatrix.elements,a=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(o[8]+1)/o[0],d=a*u,p=a*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=a+f,v=s+f,y=d-m,b=p+(r-m),w=l*s/v*g,M=c*s/v*g;t.projectionMatrix.makePerspective(y,b,w,M,g,v)}(p,u,h):p.projectionMatrix.copy(u.projectionMatrix),p};let w=null;const M=new Ao;M.setAnimationLoop((function(e,n){if(s=n.getViewerPose(o),null!==s){const e=s.views,n=r.renderState.baseLayer;t.setFramebuffer(n.framebuffer);let i=!1;e.length!==p.cameras.length&&(p.cameras.length=0,i=!0);for(let t=0;t<e.length;t++){const r=e[t],o=n.getViewport(r),a=d[t];a.matrix.fromArray(r.transform.matrix),a.projectionMatrix.fromArray(r.projectionMatrix),a.viewport.set(o.x,o.y,o.width,o.height),0===t&&p.matrix.copy(a.matrix),!0===i&&p.cameras.push(a)}}const i=r.inputSources;for(let t=0;t<l.length;t++){const e=l[t],r=i[t];e.update(r,n,o)}w&&w(e,n)})),this.setAnimationLoop=function(t){w=t},this.dispose=function(){}}function Os(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);const r=t.get(n).envMap;if(r){e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture&&r._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;const i=t.get(r).__maxMipLevel;void 0!==i&&(e.maxMipLevel.value=i)}let i,o;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(i=n.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===m&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===m&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,r,i,o){r.isMeshBasicMaterial?e(t,r):r.isMeshLambertMaterial?(e(t,r),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,r)):r.isMeshToonMaterial?(e(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===m&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===m&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshPhongMaterial?(e(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===m&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===m&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshStandardMaterial?(e(t,r),r.isMeshPhysicalMaterial?function(t,e){n(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen),e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===m&&t.clearcoatNormalScale.value.negate()),t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,r):n(t,r)):r.isMeshMatcapMaterial?(e(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===m&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===m&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDepthMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDistanceMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?(e(t,r),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===m&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===m&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,o):r.isSpriteMaterial?function(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ds(t){const e=void 0!==(t=t||{}).canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let h=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Je,this.physicallyCorrectLights=!1,this.toneMapping=Q,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const m=this;let g=!1,v=null,y=0,_=0,x=null,b=null,w=-1,M=null;const S=new Xn,E=new Xn;let T=null,A=e.width,L=e.height,C=1,R=null,P=null;const O=new Xn(0,0,A,L),D=new Xn(0,0,A,L);let I=!1;const N=new To;let B=!1,z=!1;const F=new Er,H=new Kn,k={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function U(){return null===x?C:1}let G,V,W,j,q,X,Y,Z,J,K,$,tt,et,nt,rt,it,ot,at,st,lt,ct,ut=n;function ht(t,n){for(let r=0;r<t.length;r++){const i=t[r],o=e.getContext(i,n);if(null!==o)return o}return null}try{const t={alpha:r,depth:i,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",mt,!1),e.addEventListener("webglcontextrestored",gt,!1),null===ut){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),ut=ht(e,t),null===ut)throw ht(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ut.getShaderPrecisionFormat&&(ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function dt(){G=new Ho(ut),V=new Bo(ut,G,t),G.init(V),lt=new As(ut,G,V),W=new Es(ut,G,V),W.scissor(E.copy(D).multiplyScalar(C).floor()),W.viewport(S.copy(O).multiplyScalar(C).floor()),j=new Go(ut),q=new hs,X=new Ts(ut,G,W,q,V,lt,j),Y=new Fo(m),Z=new Lo(ut,V),ct=new Io(ut,G,Z,V),J=new ko(ut,Z,j,ct),K=new qo(ut,J,Z,j),ot=new jo(ut),rt=new zo(q),$=new us(m,Y,G,V,ct,rt),tt=new Os(q),et=new ms(q),nt=new bs(G,V),it=new Do(m,Y,W,K,s),at=new No(ut,G,j,V),st=new Uo(ut,G,j,V),j.programs=$.programs,m.capabilities=V,m.extensions=G,m.properties=q,m.renderLists=et,m.state=W,m.info=j}dt();const pt=new Ps(m,ut);this.xr=pt;const ft=new Ss(m,K,V.maxTextureSize);function mt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function gt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1,dt()}function vt(t){const e=t.target;e.removeEventListener("dispose",vt),function(t){yt(t),q.remove(t)}(e)}function yt(t){const e=q.get(t).program;void 0!==e&&$.releaseProgram(e)}this.shadowMap=ft,this.getContext=function(){return ut},this.getContextAttributes=function(){return ut.getContextAttributes()},this.forceContextLoss=function(){const t=G.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=G.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(t){void 0!==t&&(C=t,this.setSize(A,L,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new kn),t.set(A,L)},this.setSize=function(t,n,r){pt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(A=t,L=n,e.width=Math.floor(t*C),e.height=Math.floor(n*C),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new kn),t.set(A*C,L*C).floor()},this.setDrawingBufferSize=function(t,n,r){A=t,L=n,C=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new Xn),t.copy(S)},this.getViewport=function(t){return t.copy(O)},this.setViewport=function(t,e,n,r){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,n,r),W.viewport(S.copy(O).multiplyScalar(C).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,n,r){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,r),W.scissor(E.copy(D).multiplyScalar(C).floor())},this.getScissorTest=function(){return I},this.setScissorTest=function(t){W.setScissorTest(I=t)},this.setOpaqueSort=function(t){R=t},this.setTransparentSort=function(t){P=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new xi),t.copy(it.getClearColor())},this.setClearColor=function(){it.setClearColor.apply(it,arguments)},this.getClearAlpha=function(){return it.getClearAlpha()},this.setClearAlpha=function(){it.setClearAlpha.apply(it,arguments)},this.clear=function(t,e,n){let r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),ut.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",mt,!1),e.removeEventListener("webglcontextrestored",gt,!1),et.dispose(),nt.dispose(),q.dispose(),Y.dispose(),K.dispose(),ct.dispose(),pt.dispose(),xt.stop()},this.renderBufferImmediate=function(t,e){ct.initAttributes();const n=q.get(t);t.hasPositions&&!n.position&&(n.position=ut.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=ut.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=ut.createBuffer()),t.hasColors&&!n.color&&(n.color=ut.createBuffer());const r=e.getAttributes();t.hasPositions&&(ut.bindBuffer(34962,n.position),ut.bufferData(34962,t.positionArray,35048),ct.enableAttribute(r.position),ut.vertexAttribPointer(r.position,3,5126,!1,0,0)),t.hasNormals&&(ut.bindBuffer(34962,n.normal),ut.bufferData(34962,t.normalArray,35048),ct.enableAttribute(r.normal),ut.vertexAttribPointer(r.normal,3,5126,!1,0,0)),t.hasUvs&&(ut.bindBuffer(34962,n.uv),ut.bufferData(34962,t.uvArray,35048),ct.enableAttribute(r.uv),ut.vertexAttribPointer(r.uv,2,5126,!1,0,0)),t.hasColors&&(ut.bindBuffer(34962,n.color),ut.bufferData(34962,t.colorArray,35048),ct.enableAttribute(r.color),ut.vertexAttribPointer(r.color,3,5126,!1,0,0)),ct.disableUnusedAttributes(),ut.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,o){null===e&&(e=k);const a=i.isMesh&&i.matrixWorld.determinant()<0,s=Tt(t,e,r,i);W.setMaterial(r,a);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let u,h=1;!0===r.wireframe&&(l=J.getWireframeAttribute(n),h=2),(r.morphTargets||r.morphNormals)&&ot.update(i,n,r,s),ct.setup(i,r,s,n,l);let d=at;null!==l&&(u=Z.get(l),d=st,d.setIndex(u));const p=null!==l?l.count:c.count,f=n.drawRange.start*h,m=n.drawRange.count*h,g=null!==o?o.start*h:0,v=null!==o?o.count*h:1/0,y=Math.max(f,g),_=Math.min(p,f+m,g+v)-1,x=Math.max(0,_-y+1);if(0!==x){if(i.isMesh)!0===r.wireframe?(W.setLineWidth(r.wireframeLinewidth*U()),d.setMode(1)):d.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),W.setLineWidth(t*U()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,x,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,x,t)}else d.render(y,x)}},this.compile=function(t,e){d=nt.get(t),d.init(),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights();const n=new WeakMap;t.traverse((function(e){const r=e.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){const o=r[i];!1===n.has(o)&&(Et(o,t,e),n.set(o))}else!1===n.has(r)&&(Et(r,t,e),n.set(r))}))};let _t=null;const xt=new Ao;function bt(t,e,n,r){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||N.intersectsSprite(t)){r&&H.setFromMatrixPosition(t.matrixWorld).applyMatrix4(F);const e=K.update(t),i=t.material;i.visible&&h.push(t,e,i,n,H.z,null)}}else if(t.isImmediateRenderObject)r&&H.setFromMatrixPosition(t.matrixWorld).applyMatrix4(F),h.push(t,null,t.material,n,H.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==j.render.frame&&(t.skeleton.update(),t.skeleton.frame=j.render.frame),!t.frustumCulled||N.intersectsObject(t))){r&&H.setFromMatrixPosition(t.matrixWorld).applyMatrix4(F);const e=K.update(t),i=t.material;if(Array.isArray(i)){const r=e.groups;for(let o=0,a=r.length;o<a;o++){const a=r[o],s=i[a.materialIndex];s&&s.visible&&h.push(t,e,s,n,H.z,a)}}else i.visible&&h.push(t,e,i,n,H.z,null)}const i=t.children;for(let t=0,o=i.length;t<o;t++)bt(i[t],e,n,r)}function wt(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,o=t.length;i<o;i++){const o=t[i],a=o.object,s=o.geometry,l=null===r?o.material:r,c=o.group;if(n.isArrayCamera){const t=n.cameras;for(let n=0,r=t.length;n<r;n++){const r=t[n];a.layers.test(r.layers)&&(W.viewport(S.copy(r.viewport)),d.setupLightsView(r),Mt(a,e,r,s,l,c))}}else Mt(a,e,n,s,l,c)}}function Mt(t,e,n,r,i,o){if(t.onBeforeRender(m,e,n,r,i,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const r=Tt(n,e,i,t);W.setMaterial(i),ct.reset(),function(t,e){t.render((function(t){m.renderBufferImmediate(t,e)}))}(t,r)}else m.renderBufferDirect(n,e,r,i,t,o);t.onAfterRender(m,e,n,r,i,o)}function Et(t,e,n){!0!==e.isScene&&(e=k);const r=q.get(t),i=d.state.lights,o=d.state.shadowsArray,a=i.state.version,s=$.getParameters(t,i.state,o,e,n),l=$.getProgramCacheKey(s);let c=r.program,u=!0;if(r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=Y.get(t.envMap||r.environment),void 0===c)t.addEventListener("dispose",vt);else if(c.cacheKey!==l)yt(t);else if(r.lightsStateVersion!==a)u=!1;else{if(void 0!==s.shaderID)return;u=!1}u&&(s.uniforms=$.getUniforms(t),t.onBeforeCompile(s,m),c=$.acquireProgram(s,l),r.program=c,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding);const h=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=rt.numPlanes,r.numIntersection=rt.numIntersection,h.clippingPlanes=rt.uniform),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=a,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);const p=r.program.getUniforms(),f=Va.seqWithValue(p.seq,h);r.uniformsList=f}function Tt(t,e,n,r){!0!==e.isScene&&(e=k),X.resetTextureUnits();const i=e.fog,o=n.isMeshStandardMaterial?e.environment:null,a=null===x?m.outputEncoding:x.texture.encoding,s=Y.get(n.envMap||o),l=q.get(n),c=d.state.lights;if(!0===B&&(!0===z||t!==M)){const e=t===M&&n.id===w;rt.setState(n,t,e)}n.version===l.__version?n.fog&&l.fog!==i||l.environment!==o||l.needsLights&&l.lightsStateVersion!==c.state.version?Et(n,e,r):void 0===l.numClippingPlanes||l.numClippingPlanes===rt.numPlanes&&l.numIntersection===rt.numIntersection?(l.outputEncoding!==a||l.envMap!==s)&&Et(n,e,r):Et(n,e,r):(Et(n,e,r),l.__version=n.version);let u=!1,h=!1,p=!1;const f=l.program,g=f.getUniforms(),v=l.uniforms;if(W.useProgram(f.program)&&(u=!0,h=!0,p=!0),n.id!==w&&(w=n.id,h=!0),u||M!==t){if(g.setValue(ut,"projectionMatrix",t.projectionMatrix),V.logarithmicDepthBuffer&&g.setValue(ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),M!==t&&(M=t,h=!0,p=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=g.map.cameraPosition;void 0!==e&&e.setValue(ut,H.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(ut,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&g.setValue(ut,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){g.setOptional(ut,r,"bindMatrix"),g.setOptional(ut,r,"bindMatrixInverse");const t=r.skeleton;if(t){const e=t.bones;if(V.floatVertexTextures){if(null===t.boneTexture){let n=Math.sqrt(4*e.length);n=Hn.ceilPowerOfTwo(n),n=Math.max(n,4);const r=new Float32Array(n*n*4);r.set(t.boneMatrices);const i=new Mo(r,n,n,Ft,Rt);t.boneMatrices=r,t.boneTexture=i,t.boneTextureSize=n}g.setValue(ut,"boneTexture",t.boneTexture,X),g.setValue(ut,"boneTextureSize",t.boneTextureSize)}else g.setOptional(ut,t,"boneMatrices")}}var y,_;return(h||l.receiveShadow!==r.receiveShadow)&&(l.receiveShadow=r.receiveShadow,g.setValue(ut,"receiveShadow",r.receiveShadow)),h&&(g.setValue(ut,"toneMappingExposure",m.toneMappingExposure),l.needsLights&&(_=p,(y=v).ambientLightColor.needsUpdate=_,y.lightProbe.needsUpdate=_,y.directionalLights.needsUpdate=_,y.directionalLightShadows.needsUpdate=_,y.pointLights.needsUpdate=_,y.pointLightShadows.needsUpdate=_,y.spotLights.needsUpdate=_,y.spotLightShadows.needsUpdate=_,y.rectAreaLights.needsUpdate=_,y.hemisphereLights.needsUpdate=_),i&&n.fog&&tt.refreshFogUniforms(v,i),tt.refreshMaterialUniforms(v,n,C,L),Va.upload(ut,l.uniformsList,v,X)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Va.upload(ut,l.uniformsList,v,X),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(ut,"center",r.center),g.setValue(ut,"modelViewMatrix",r.modelViewMatrix),g.setValue(ut,"normalMatrix",r.normalMatrix),g.setValue(ut,"modelMatrix",r.matrixWorld),f}xt.setAnimationLoop((function(t){pt.isPresenting||_t&&_t(t)})),"undefined"!=typeof window&&xt.setContext(window),this.setAnimationLoop=function(t){_t=t,pt.setAnimationLoop(t),null===t?xt.stop():xt.start()},this.render=function(t,e){let n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;ct.resetDefaultState(),w=-1,M=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===pt.enabled&&!0===pt.isPresenting&&(e=pt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(m,t,e,n||x),d=nt.get(t,f.length),d.init(),f.push(d),F.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),N.setFromProjectionMatrix(F),z=this.localClippingEnabled,B=rt.init(this.clippingPlanes,z,e),h=et.get(t,p.length),h.init(),p.push(h),bt(t,e,0,m.sortObjects),h.finish(),!0===m.sortObjects&&h.sort(R,P),!0===B&&rt.beginShadows();const i=d.state.shadowsArray;ft.render(i,t,e),d.setupLights(),d.setupLightsView(e),!0===B&&rt.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),it.render(h,t,e,r);const o=h.opaque,a=h.transparent;o.length>0&&wt(o,t,e),a.length>0&&wt(a,t,e),!0===t.isScene&&t.onAfterRender(m,t,e),null!==x&&(X.updateRenderTargetMipmap(x),X.updateMultisampleRenderTarget(x)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null},this.setFramebuffer=function(t){v!==t&&null===x&&ut.bindFramebuffer(36160,t),v=t},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return x},this.setRenderTarget=function(t,e=0,n=0){x=t,y=e,_=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=v,i=!1,o=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const a=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=a[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:a,S.copy(t.viewport),E.copy(t.scissor),T=t.scissorTest}else S.copy(O).multiplyScalar(C).floor(),E.copy(D).multiplyScalar(C).floor(),T=I;if(b!==r&&(ut.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(E),W.setScissorTest(T),i){const r=q.get(t.texture);ut.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(o){const r=q.get(t.texture),i=e||0;ut.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,o,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){let a=!1;s!==b&&(ut.bindFramebuffer(36160,s),a=!0);try{const s=t.texture,l=s.format,c=s.type;if(l!==Ft&<.convert(l)!==ut.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const u=c===Pt&&(G.has("EXT_color_buffer_half_float")||V.isWebGL2&&G.has("EXT_color_buffer_float"));if(!(c===St||lt.convert(c)===ut.getParameter(35738)||c===Rt&&(V.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float"))||u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ut.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ut.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{a&&ut.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),a=lt.convert(e.format);X.setTexture2D(e,0),ut.copyTexImage2D(3553,n,a,t.x,t.y,i,o,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,o=e.image.height,a=lt.convert(n.format),s=lt.convert(n.type);X.setTexture2D(n,0),ut.pixelStorei(37440,n.flipY),ut.pixelStorei(37441,n.premultiplyAlpha),ut.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ut.texSubImage2D(3553,r,t.x,t.y,i,o,a,s,e.image.data):e.isCompressedTexture?ut.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):ut.texSubImage2D(3553,r,t.x,t.y,a,s,e.image),0===r&&n.generateMipmaps&&ut.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:o,height:a,data:s}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let u;if(r.isDataTexture3D)X.setTexture3D(r,0),u=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),u=35866}ut.pixelStorei(37440,r.flipY),ut.pixelStorei(37441,r.premultiplyAlpha),ut.pixelStorei(3317,r.unpackAlignment);const h=ut.getParameter(3314),d=ut.getParameter(32878),p=ut.getParameter(3316),f=ut.getParameter(3315),g=ut.getParameter(32877);ut.pixelStorei(3314,o),ut.pixelStorei(32878,a),ut.pixelStorei(3316,t.min.x),ut.pixelStorei(3315,t.min.y),ut.pixelStorei(32877,t.min.z),ut.texSubImage3D(u,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,s),ut.pixelStorei(3314,h),ut.pixelStorei(32878,d),ut.pixelStorei(3316,p),ut.pixelStorei(3315,f),ut.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ut.generateMipmap(u),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Cs.prototype.isGroup=!0,Object.assign(Rs.prototype,{constructor:Rs,getHandSpace:function(){return null===this._hand&&(this._hand=new Cs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Cs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Cs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,o=null;const a=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){o=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,n);if(void 0===l.joints[r.jointName]){const t=new Cs;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[r.jointName]=t,l.add(t)}const i=l.joints[r.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],a=r.position.distanceTo(i.position),s=.02,c=.005;l.inputState.pinching&&a>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&(r=e.getPose(t.targetRaySpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),null!==s&&t.gripSpace&&(i=e.getPose(t.gripSpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale)));return null!==a&&(a.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==o),this}}),Object.assign(Ps.prototype,Bn.prototype);class Is extends Ds{}Is.prototype.isWebGL1Renderer=!0;class Ns{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new Ns(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Ns.prototype.isFogExp2=!0;class Bs{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new Bs(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Bs.prototype.isFog=!0;class zs extends Jr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function Fs(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=En,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Hn.generateUUID()}zs.prototype.isScene=!0,Object.defineProperty(Fs.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Fs.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e=0){return this.array.set(t,e),this},clone:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Hn.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new Fs(new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),this.stride);return e.setUsage(this.usage),e},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Hn.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const Hs=new Kn;function ks(t,e,n,r){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}Object.defineProperties(ks.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}}),Object.assign(ks.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(let e=0,n=this.data.count;e<n;e++)Hs.x=this.getX(e),Hs.y=this.getY(e),Hs.z=this.getZ(e),Hs.applyMatrix4(t),this.setXYZ(e,Hs.x,Hs.y,Hs.z);return this},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this},clone:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new Si(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ks(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}});class Us extends pi{constructor(t){super(),this.type="SpriteMaterial",this.color=new xi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Gs;Us.prototype.isSpriteMaterial=!0;const Vs=new Kn,Ws=new Kn,js=new Kn,qs=new kn,Xs=new kn,Ys=new Er,Zs=new Kn,Js=new Kn,Ks=new Kn,Qs=new kn,$s=new kn,tl=new kn;class el extends Jr{constructor(t){if(super(),this.type="Sprite",void 0===Gs){Gs=new ji;const t=new Fs(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Gs.setIndex([0,1,2,0,2,3]),Gs.setAttribute("position",new ks(t,3,0,!1)),Gs.setAttribute("uv",new ks(t,2,3,!1))}this.geometry=Gs,this.material=void 0!==t?t:new Us,this.center=new kn(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ws.setFromMatrixScale(this.matrixWorld),Ys.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),js.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ws.multiplyScalar(-js.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;nl(Zs.set(-.5,-.5,0),js,o,Ws,r,i),nl(Js.set(.5,-.5,0),js,o,Ws,r,i),nl(Ks.set(.5,.5,0),js,o,Ws,r,i),Qs.set(0,0),$s.set(1,0),tl.set(1,1);let a=t.ray.intersectTriangle(Zs,Js,Ks,!1,Vs);if(null===a&&(nl(Js.set(-.5,.5,0),js,o,Ws,r,i),$s.set(0,1),a=t.ray.intersectTriangle(Zs,Ks,Js,!1,Vs),null===a))return;const s=t.ray.origin.distanceTo(Vs);s<t.near||s>t.far||e.push({distance:s,point:Vs.clone(),uv:hi.getUV(Vs,Zs,Js,Ks,Qs,$s,tl,new kn),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function nl(t,e,n,r,i,o){qs.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Xs.x=o*qs.x-i*qs.y,Xs.y=i*qs.x+o*qs.y):Xs.copy(qs),t.copy(e),t.x+=Xs.x,t.y+=Xs.y,t.applyMatrix4(Ys)}el.prototype.isSprite=!0;const rl=new Kn,il=new Kn;class ol extends Jr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let r;for(r=0;r<n.length&&!(e<n[r].distance);r++);return n.splice(r,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,r;for(n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){rl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(rl);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){rl.setFromMatrixPosition(t.matrixWorld),il.setFromMatrixPosition(this.matrixWorld);const n=rl.distanceTo(il)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r<i&&n>=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)e[r].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,r=n.length;t<r;t++){const r=n[t];e.object.levels.push({object:r.object.uuid,distance:r.distance})}return e}}const al=new Kn,sl=new Xn,ll=new Xn,cl=new Kn,ul=new Er;function hl(t,e){co.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Er,this.bindMatrixInverse=new Er}function dl(){Jr.call(this),this.type="Bone"}hl.prototype=Object.assign(Object.create(co.prototype),{constructor:hl,isSkinnedMesh:!0,copy:function(t){return co.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const t=new Xn,e=this.geometry.attributes.skinWeight;for(let n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){co.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(t,e){const n=this.skeleton,r=this.geometry;sl.fromBufferAttribute(r.attributes.skinIndex,t),ll.fromBufferAttribute(r.attributes.skinWeight,t),al.fromBufferAttribute(r.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const r=ll.getComponent(t);if(0!==r){const i=sl.getComponent(t);ul.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),e.addScaledVector(cl.copy(al).applyMatrix4(ul),r)}}return e.applyMatrix4(this.bindMatrixInverse)}}),dl.prototype=Object.assign(Object.create(Jr.prototype),{constructor:dl,isBone:!0});const pl=new Er,fl=new Er;class ml{constructor(t=[],e=[]){this.uuid=Hn.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Er)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Er;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=t.length;r<i;r++){const i=t[r]?t[r].matrixWorld:fl;pl.multiplyMatrices(i,e[r]),pl.toArray(n,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new ml(this.bones,this.boneInverses)}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,r=t.bones.length;n<r;n++){const r=t.bones[n];let i=e[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new dl),this.bones.push(i),this.boneInverses.push((new Er).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let r=0,i=e.length;r<i;r++){const i=e[r];t.bones.push(i.uuid);const o=n[r];t.boneInverses.push(o.toArray())}return t}}const gl=new Er,vl=new Er,yl=[],_l=new co;function xl(t,e,n){co.call(this,t,e),this.instanceMatrix=new Si(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}xl.prototype=Object.assign(Object.create(co.prototype),{constructor:xl,isInstancedMesh:!0,copy:function(t){return co.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,3*t)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){const n=this.matrixWorld,r=this.count;if(_l.geometry=this.geometry,_l.material=this.material,void 0!==_l.material)for(let i=0;i<r;i++){this.getMatrixAt(i,gl),vl.multiplyMatrices(n,gl),_l.matrixWorld=vl,_l.raycast(t,yl);for(let t=0,n=yl.length;t<n;t++){const n=yl[t];n.instanceId=i,n.object=this,e.push(n)}yl.length=0}},setColorAt:function(t,e){null===this.instanceColor&&(this.instanceColor=new Si(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}});class bl extends pi{constructor(t){super(),this.type="LineBasicMaterial",this.color=new xi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}bl.prototype.isLineBasicMaterial=!0;const wl=new Kn,Ml=new Kn,Sl=new Er,El=new Sr,Tl=new gr;function Al(t=new ji,e=new bl){Jr.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}Al.prototype=Object.assign(Object.create(Jr.prototype),{constructor:Al,isLine:!0,copy:function(t){return Jr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,r=e.count;t<r;t++)wl.fromBufferAttribute(e,t-1),Ml.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=wl.distanceTo(Ml);t.setAttribute("lineDistance",new Di(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Tl.copy(n.boundingSphere),Tl.applyMatrix4(r),Tl.radius+=i,!1===t.ray.intersectsSphere(Tl))return;Sl.copy(r).invert(),El.copy(t.ray).applyMatrix4(Sl);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,s=new Kn,l=new Kn,c=new Kn,u=new Kn,h=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,o=n.length-1;r<o;r+=h){const o=n[r],h=n[r+1];if(s.fromBufferAttribute(i,o),l.fromBufferAttribute(i,h),El.distanceSqToSegment(s,l,u,c)>a)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);d<t.near||d>t.far||e.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,r=i.count-1;n<r;n+=h){if(s.fromBufferAttribute(i,n),l.fromBufferAttribute(i,n+1),El.distanceSqToSegment(s,l,u,c)>a)continue;u.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(u);r<t.near||r>t.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Ll=new Kn,Cl=new Kn;function Rl(t,e){Al.call(this,t,e),this.type="LineSegments"}Rl.prototype=Object.assign(Object.create(Al.prototype),{constructor:Rl,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;t<r;t+=2)Ll.fromBufferAttribute(e,t),Cl.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Ll.distanceTo(Cl);t.setAttribute("lineDistance",new Di(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}});class Pl extends Al{constructor(t,e){super(t,e),this.type="LineLoop"}}Pl.prototype.isLineLoop=!0;class Ol extends pi{constructor(t){super(),this.type="PointsMaterial",this.color=new xi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}Ol.prototype.isPointsMaterial=!0;const Dl=new Er,Il=new Sr,Nl=new gr,Bl=new Kn;function zl(t=new ji,e=new Ol){Jr.call(this),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}function Fl(t,e,n,r,i,o,a){const s=Il.distanceSqToPoint(t);if(s<n){const n=new Kn;Il.closestPointToPoint(t,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:e,face:null,object:a})}}zl.prototype=Object.assign(Object.create(Jr.prototype),{constructor:zl,isPoints:!0,copy:function(t){return Jr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Nl.copy(n.boundingSphere),Nl.applyMatrix4(r),Nl.radius+=i,!1===t.ray.intersectsSphere(Nl))return;Dl.copy(r).invert(),Il.copy(t.ray).applyMatrix4(Dl);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,s=n.length;i<s;i++){const s=n[i];Bl.fromBufferAttribute(o,s),Fl(Bl,s,a,r,t,e,this)}}else for(let n=0,i=o.count;n<i;n++)Bl.fromBufferAttribute(o,n),Fl(Bl,n,a,r,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class Hl extends jn{constructor(t,e,n,r,i,o,a,s,l){super(t,e,n,r,i,o,a,s,l),this.format=void 0!==a?a:zt,this.minFilter=void 0!==o?o:_t,this.magFilter=void 0!==i?i:_t,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Hl.prototype.isVideoTexture=!0;class kl extends jn{constructor(t,e,n,r,i,o,a,s,l,c,u,h){super(null,o,a,s,l,c,r,i,u,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}kl.prototype.isCompressedTexture=!0;class Ul extends jn{constructor(t,e,n,r,i,o,a,s,l){super(t,e,n,r,i,o,a,s,l),this.needsUpdate=!0}}Ul.prototype.isCanvasTexture=!0;class Gl extends jn{constructor(t,e,n,r,i,o,a,s,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Vt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=At),void 0===n&&c===Vt&&(n=Nt),super(null,r,i,o,a,s,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:ft,this.minFilter=void 0!==s?s:ft,this.flipY=!1,this.generateMipmaps=!1}}Gl.prototype.isDepthTexture=!0;class Vl extends ji{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],o=[],a=[],s=[],l=new Kn,c=new kn;o.push(0,0,0),a.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=e;i++,u+=3){const h=n+i/e*r;l.x=t*Math.cos(h),l.y=t*Math.sin(h),o.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(o[u]/t+1)/2,c.y=(o[u+1]/t+1)/2,s.push(c.x,c.y)}for(let t=1;t<=e;t++)i.push(t,t+1,0);this.setIndex(i),this.setAttribute("position",new Di(o,3)),this.setAttribute("normal",new Di(a,3)),this.setAttribute("uv",new Di(s,2))}}class Wl extends ji{constructor(t=1,e=1,n=1,r=8,i=1,o=!1,a=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],u=[],h=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const i=p,o=new kn,f=new Kn;let v=0;const y=!0===n?t:e,_=!0===n?1:-1;for(let t=1;t<=r;t++)u.push(0,m*_,0),h.push(0,_,0),d.push(.5,.5),p++;const x=p;for(let t=0;t<=r;t++){const e=t/r*s+a,n=Math.cos(e),i=Math.sin(e);f.x=y*i,f.y=m*_,f.z=y*n,u.push(f.x,f.y,f.z),h.push(0,_,0),o.x=.5*n+.5,o.y=.5*i*_+.5,d.push(o.x,o.y),p++}for(let t=0;t<r;t++){const e=i+t,r=x+t;!0===n?c.push(r,r+1,e):c.push(r+1,r,e),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}!function(){const o=new Kn,v=new Kn;let y=0;const _=(e-t)/n;for(let l=0;l<=i;l++){const c=[],g=l/i,y=g*(e-t)+t;for(let t=0;t<=r;t++){const e=t/r,i=e*s+a,l=Math.sin(i),f=Math.cos(i);v.x=y*l,v.y=-g*n+m,v.z=y*f,u.push(v.x,v.y,v.z),o.set(l,_,f).normalize(),h.push(o.x,o.y,o.z),d.push(e,1-g),c.push(p++)}f.push(c)}for(let t=0;t<r;t++)for(let e=0;e<i;e++){const n=f[e][t],r=f[e+1][t],i=f[e+1][t+1],o=f[e][t+1];c.push(n,r,o),c.push(r,i,o),y+=6}l.addGroup(g,y,0),g+=y}(),!1===o&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Di(u,3)),this.setAttribute("normal",new Di(h,3)),this.setAttribute("uv",new Di(d,2))}}class jl extends Wl{constructor(t=1,e=1,n=8,r=1,i=!1,o=0,a=2*Math.PI){super(0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}}class ql extends ji{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],o=[];function a(t,e,n,r){const i=r+1,o=[];for(let r=0;r<=i;r++){o[r]=[];const a=t.clone().lerp(n,r/i),s=e.clone().lerp(n,r/i),l=i-r;for(let t=0;t<=l;t++)o[r][t]=0===t&&r===i?a:a.clone().lerp(s,t/l)}for(let t=0;t<i;t++)for(let e=0;e<2*(i-t)-1;e++){const n=Math.floor(e/2);e%2==0?(s(o[t][n+1]),s(o[t+1][n]),s(o[t][n])):(s(o[t][n+1]),s(o[t+1][n+1]),s(o[t+1][n]))}}function s(t){i.push(t.x,t.y,t.z)}function l(e,n){const r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function c(t,e,n,r){r<0&&1===t.x&&(o[e]=t.x-1),0===n.x&&0===n.z&&(o[e]=r/2/Math.PI+.5)}function u(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new Kn,r=new Kn,i=new Kn;for(let o=0;o<e.length;o+=3)l(e[o+0],n),l(e[o+1],r),l(e[o+2],i),a(n,r,i,t)}(r),function(t){const e=new Kn;for(let n=0;n<i.length;n+=3)e.x=i[n+0],e.y=i[n+1],e.z=i[n+2],e.normalize().multiplyScalar(t),i[n+0]=e.x,i[n+1]=e.y,i[n+2]=e.z}(n),function(){const t=new Kn;for(let n=0;n<i.length;n+=3){t.x=i[n+0],t.y=i[n+1],t.z=i[n+2];const r=u(t)/2/Math.PI+.5,a=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);o.push(r,1-a)}var e;(function(){const t=new Kn,e=new Kn,n=new Kn,r=new Kn,a=new kn,s=new kn,l=new kn;for(let h=0,d=0;h<i.length;h+=9,d+=6){t.set(i[h+0],i[h+1],i[h+2]),e.set(i[h+3],i[h+4],i[h+5]),n.set(i[h+6],i[h+7],i[h+8]),a.set(o[d+0],o[d+1]),s.set(o[d+2],o[d+3]),l.set(o[d+4],o[d+5]),r.copy(t).add(e).add(n).divideScalar(3);const p=u(r);c(a,d+0,t,p),c(s,d+2,e,p),c(l,d+4,n,p)}})(),function(){for(let t=0;t<o.length;t+=6){const e=o[t+0],n=o[t+2],r=o[t+4],i=Math.max(e,n,r),a=Math.min(e,n,r);i>.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),r<.2&&(o[t+4]+=1))}}()}(),this.setAttribute("position",new Di(i,3)),this.setAttribute("normal",new Di(i.slice(),3)),this.setAttribute("uv",new Di(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}class Xl extends ql{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}const Yl=new Kn,Zl=new Kn,Jl=new Kn,Kl=new hi;class Ql extends ji{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Hn.DEG2RAD*e),i=t.getIndex(),o=t.getAttribute("position"),a=i?i.count:o.count,s=[0,0,0],l=["a","b","c"],c=new Array(3),u={},h=[];for(let t=0;t<a;t+=3){i?(s[0]=i.getX(t),s[1]=i.getX(t+1),s[2]=i.getX(t+2)):(s[0]=t,s[1]=t+1,s[2]=t+2);const{a:e,b:a,c:d}=Kl;if(e.fromBufferAttribute(o,s[0]),a.fromBufferAttribute(o,s[1]),d.fromBufferAttribute(o,s[2]),Kl.getNormal(Jl),c[0]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,c[1]=`${Math.round(a.x*n)},${Math.round(a.y*n)},${Math.round(a.z*n)}`,c[2]=`${Math.round(d.x*n)},${Math.round(d.y*n)},${Math.round(d.z*n)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=c[t],i=c[e],o=Kl[l[t]],a=Kl[l[e]],d=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(Jl.dot(u[p].normal)<=r&&(h.push(o.x,o.y,o.z),h.push(a.x,a.y,a.z)),u[p]=null):d in u||(u[d]={index0:s[t],index1:s[e],normal:Jl.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];Yl.fromBufferAttribute(o,e),Zl.fromBufferAttribute(o,n),h.push(Yl.x,Yl.y,Yl.z),h.push(Zl.x,Zl.y,Zl.z)}this.setAttribute("position",new Di(h,3))}}function $l(t,e,n,r,i){let o,a;if(i===function(t,e,n,r){let i=0;for(let o=e,a=n-r;o<n;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}(t,e,n,r)>0)for(o=e;o<n;o+=r)a=xc(o,t[o],t[o+1],a);else for(o=n-r;o>=e;o-=r)a=xc(o,t[o],t[o+1],a);return a&&fc(a,a.next)&&(bc(a),a=a.next),a}function tc(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!fc(r,r.next)&&0!==pc(r.prev,r,r.next))r=r.next;else{if(bc(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function ec(t,e,n,r,i,o,a){if(!t)return;!a&&o&&function(t,e,n,r){let i=t;do{null===i.z&&(i.z=cc(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;e<c&&(s++,r=r.nextZ,r);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(a>1)}(i)}(t,r,i,o);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,o?rc(t,r,i,o):nc(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),bc(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?ec(t=ic(tc(t),e,n),e,n,r,i,o,2):2===a&&oc(t,e,n,r,i,o):ec(tc(t),e,n,r,i,o,1);break}}function nc(t){const e=t.prev,n=t,r=t.next;if(pc(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(hc(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&pc(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function rc(t,e,n,r){const i=t.prev,o=t,a=t.next;if(pc(i,o,a)>=0)return!1;const s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,l=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=cc(s,l,e,n,r),d=cc(c,u,e,n,r);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&hc(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&pc(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&hc(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&pc(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&hc(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&pc(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&hc(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&pc(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ic(t,e,n){let r=t;do{const i=r.prev,o=r.next.next;!fc(i,o)&&mc(i,r,r.next,o)&&yc(i,o)&&yc(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),bc(r),bc(r.next),r=t=o),r=r.next}while(r!==t);return tc(r)}function oc(t,e,n,r,i,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&dc(a,t)){let s=_c(a,t);return a=tc(a,a.next),s=tc(s,s.next),ec(a,e,n,r,i,o),void ec(s,e,n,r,i,o)}t=t.next}a=a.next}while(a!==t)}function ac(t,e){return t.x-e.x}function sc(t,e){if(e=function(t,e){let n=e;const r=t.x,i=t.y;let o,a=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>a){if(a=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(r===a)return o;const s=o,l=o.x,c=o.y;let u,h=1/0;n=o;do{r>=n.x&&n.x>=l&&r!==n.x&&hc(i<c?r:a,i,l,c,i<c?a:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),yc(n,t)&&(u<h||u===h&&(n.x>o.x||n.x===o.x&&lc(o,n)))&&(o=n,h=u)),n=n.next}while(n!==s);return o}(t,e)){const n=_c(e,t);tc(e,e.next),tc(n,n.next)}}function lc(t,e){return pc(t.prev,t,e.prev)<0&&pc(e.next,t,t.next)<0}function cc(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function uc(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function hc(t,e,n,r,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function dc(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&mc(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(yc(t,e)&&yc(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(pc(t.prev,t,e.prev)||pc(t,e.prev,e))||fc(t,e)&&pc(t.prev,t,t.next)>0&&pc(e.prev,e,e.next)>0)}function pc(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function fc(t,e){return t.x===e.x&&t.y===e.y}function mc(t,e,n,r){const i=vc(pc(t,e,n)),o=vc(pc(t,e,r)),a=vc(pc(n,r,t)),s=vc(pc(n,r,e));return i!==o&&a!==s||!(0!==i||!gc(t,n,e))||!(0!==o||!gc(t,r,e))||!(0!==a||!gc(n,t,r))||!(0!==s||!gc(n,e,r))}function gc(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function vc(t){return t>0?1:t<0?-1:0}function yc(t,e){return pc(t.prev,t,t.next)<0?pc(t,e,t.next)>=0&&pc(t,t.prev,e)>=0:pc(t,e,t.prev)<0||pc(t,t.next,e)<0}function _c(t,e){const n=new wc(t.i,t.x,t.y),r=new wc(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function xc(t,e,n,r){const i=new wc(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function bc(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 wc(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}const Mc={area:function(t){const e=t.length;let n=0;for(let r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},isClockWise:function(t){return Mc.area(t)<0},triangulateShape:function(t,e){const n=[],r=[],i=[];Sc(t),Ec(n,t);let o=t.length;e.forEach(Sc);for(let t=0;t<e.length;t++)r.push(o),o+=e[t].length,Ec(n,e[t]);const a=function(t,e,n){n=n||2;const r=e&&e.length,i=r?e[0]*n:t.length;let o=$l(t,0,i,n,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c,u,h,d,p;if(r&&(o=function(t,e,n,r){const i=[];let o,a,s,l,c;for(o=0,a=e.length;o<a;o++)s=e[o]*r,l=o<a-1?e[o+1]*r:t.length,c=$l(t,s,l,r,!1),c===c.next&&(c.steiner=!0),i.push(uc(c));for(i.sort(ac),o=0;o<i.length;o++)sc(i[o],n),n=tc(n,n.next);return n}(t,e,o,n)),t.length>80*n){s=c=t[0],l=u=t[1];for(let e=n;e<i;e+=n)h=t[e],d=t[e+1],h<s&&(s=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-s,u-l),p=0!==p?1/p:0}return ec(o,a,n,s,l,p),a}(n,r);for(let t=0;t<a.length;t+=3)i.push(a.slice(t,t+3));return i}};function Sc(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Ec(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Tc extends ji{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let e=0,n=t.length;e<n;e++)o(t[e]);function o(t){const o=[],a=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,c=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,h=void 0!==e.bevelSize?e.bevelSize:u-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:Ac;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,v,y,_,x,b=!1;f&&(g=f.getSpacedPoints(s),b=!0,c=!1,v=f.computeFrenetFrames(s,!1),y=new Kn,_=new Kn,x=new Kn),c||(p=0,u=0,h=0,d=0);const w=t.extractPoints(a);let M=w.shape;const S=w.holes;if(!Mc.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];Mc.isClockWise(e)&&(S[t]=e.reverse())}}const E=Mc.triangulateShape(M,S),T=M;for(let t=0,e=S.length;t<e;t++){const e=S[t];M=M.concat(e)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const L=M.length,C=E.length;function R(t,e,n){let r,i,o;const a=t.x-e.x,s=t.y-e.y,l=n.x-t.x,c=n.y-t.y,u=a*a+s*s,h=a*c-s*l;if(Math.abs(h)>Number.EPSILON){const h=Math.sqrt(u),d=Math.sqrt(l*l+c*c),p=e.x-s/h,f=e.y+a/h,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(a*c-s*l);r=p+a*m-t.x,i=f+s*m-t.y;const g=r*r+i*i;if(g<=2)return new kn(r,i);o=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(c)&&(t=!0),t?(r=-s,i=a,o=Math.sqrt(u)):(r=a,i=s,o=Math.sqrt(u/2))}return new kn(r/o,i/o)}const P=[];for(let t=0,e=T.length,n=e-1,r=t+1;t<e;t++,n++,r++)n===e&&(n=0),r===e&&(r=0),P[t]=R(T[t],T[n],T[r]);const O=[];let D,I=P.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];D=[];for(let t=0,n=e.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),D[t]=R(e[t],e[r],e[i]);O.push(D),I=I.concat(D)}for(let t=0;t<p;t++){const e=t/p,n=u*Math.cos(e*Math.PI/2),r=h*Math.sin(e*Math.PI/2)+d;for(let t=0,e=T.length;t<e;t++){const e=A(T[t],P[t],r);z(e.x,e.y,-n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];D=O[t];for(let t=0,i=e.length;t<i;t++){const i=A(e[t],D[t],r);z(i.x,i.y,-n)}}}const N=h+d;for(let t=0;t<L;t++){const e=c?A(M[t],I[t],N):M[t];b?(_.copy(v.normals[0]).multiplyScalar(e.x),y.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(_).add(y),z(x.x,x.y,x.z)):z(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<L;e++){const n=c?A(M[e],I[e],N):M[e];b?(_.copy(v.normals[t]).multiplyScalar(n.x),y.copy(v.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(_).add(y),z(x.x,x.y,x.z)):z(n.x,n.y,l/s*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=u*Math.cos(e*Math.PI/2),r=h*Math.sin(e*Math.PI/2)+d;for(let t=0,e=T.length;t<e;t++){const e=A(T[t],P[t],r);z(e.x,e.y,l+n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];D=O[t];for(let t=0,i=e.length;t<i;t++){const i=A(e[t],D[t],r);b?z(i.x,i.y+g[s-1].y,g[s-1].x+n):z(i.x,i.y,l+n)}}}function B(t,e){let n=t.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=s+2*p;t<n;t++){const n=L*t,o=L*(t+1);H(e+r+n,e+i+n,e+i+o,e+r+o)}}}function z(t,e,n){o.push(t),o.push(e),o.push(n)}function F(t,e,i){k(t),k(e),k(i);const o=r.length/3,a=m.generateTopUV(n,r,o-3,o-2,o-1);U(a[0]),U(a[1]),U(a[2])}function H(t,e,i,o){k(t),k(e),k(o),k(e),k(i),k(o);const a=r.length/3,s=m.generateSideWallUV(n,r,a-6,a-3,a-2,a-1);U(s[0]),U(s[1]),U(s[3]),U(s[1]),U(s[2]),U(s[3])}function k(t){r.push(o[3*t+0]),r.push(o[3*t+1]),r.push(o[3*t+2])}function U(t){i.push(t.x),i.push(t.y)}!function(){const t=r.length/3;if(c){let t=0,e=L*t;for(let t=0;t<C;t++){const n=E[t];F(n[2]+e,n[1]+e,n[0]+e)}t=s+2*p,e=L*t;for(let t=0;t<C;t++){const n=E[t];F(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<C;t++){const e=E[t];F(e[2],e[1],e[0])}for(let t=0;t<C;t++){const e=E[t];F(e[0]+L*s,e[1]+L*s,e[2]+L*s)}}n.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;B(T,e),e+=T.length;for(let t=0,n=S.length;t<n;t++){const n=S[t];B(n,e),e+=n.length}n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new Di(r,3)),this.setAttribute("uv",new Di(i,2)),this.computeVertexNormals()}toJSON(){const t=ji.prototype.toJSON.call(this);return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,r=t.length;e<r;e++){const r=t[e];n.shapes.push(r.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}}const Ac={generateTopUV:function(t,e,n,r,i){const o=e[3*n],a=e[3*n+1],s=e[3*r],l=e[3*r+1],c=e[3*i],u=e[3*i+1];return[new kn(o,a),new kn(s,l),new kn(c,u)]},generateSideWallUV:function(t,e,n,r,i,o){const a=e[3*n],s=e[3*n+1],l=e[3*n+2],c=e[3*r],u=e[3*r+1],h=e[3*r+2],d=e[3*i],p=e[3*i+1],f=e[3*i+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(s-u)<.01?[new kn(a,1-l),new kn(c,1-h),new kn(d,1-f),new kn(m,1-v)]:[new kn(s,1-l),new kn(u,1-h),new kn(p,1-f),new kn(g,1-v)]}};class Lc extends ql{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}}class Cc extends ji{constructor(t,e=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e),r=Hn.clamp(r,0,2*Math.PI);const i=[],o=[],a=[],s=1/e,l=new Kn,c=new kn;for(let i=0;i<=e;i++){const u=n+i*s*r,h=Math.sin(u),d=Math.cos(u);for(let n=0;n<=t.length-1;n++)l.x=t[n].x*h,l.y=t[n].y,l.z=t[n].x*d,o.push(l.x,l.y,l.z),c.x=i/e,c.y=n/(t.length-1),a.push(c.x,c.y)}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const r=e+n*t.length,o=r,a=r+t.length,s=r+t.length+1,l=r+1;i.push(o,a,l),i.push(a,s,l)}if(this.setIndex(i),this.setAttribute("position",new Di(o,3)),this.setAttribute("uv",new Di(a,2)),this.computeVertexNormals(),r===2*Math.PI){const n=this.attributes.normal.array,r=new Kn,i=new Kn,o=new Kn,a=e*t.length*3;for(let e=0,s=0;e<t.length;e++,s+=3)r.x=n[s+0],r.y=n[s+1],r.z=n[s+2],i.x=n[a+s+0],i.y=n[a+s+1],i.z=n[a+s+2],o.addVectors(r,i).normalize(),n[s+0]=n[a+s+0]=o.x,n[s+1]=n[a+s+1]=o.y,n[s+2]=n[a+s+2]=o.z}}}class Rc extends ql{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}}function Pc(t,e,n){ji.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};const r=[],i=[],o=[],a=[],s=1e-5,l=new Kn,c=new Kn,u=new Kn,h=new Kn,d=new Kn;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=e+1;for(let r=0;r<=n;r++){const p=r/n;for(let n=0;n<=e;n++){const r=n/e;t(r,p,c),i.push(c.x,c.y,c.z),r-s>=0?(t(r-s,p,u),h.subVectors(c,u)):(t(r+s,p,u),h.subVectors(u,c)),p-s>=0?(t(r,p-s,u),d.subVectors(c,u)):(t(r,p+s,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),o.push(l.x,l.y,l.z),a.push(r,p)}}for(let t=0;t<n;t++)for(let n=0;n<e;n++){const e=t*p+n,i=t*p+n+1,o=(t+1)*p+n+1,a=(t+1)*p+n;r.push(e,i,a),r.push(i,o,a)}this.setIndex(r),this.setAttribute("position",new Di(i,3)),this.setAttribute("normal",new Di(o,3)),this.setAttribute("uv",new Di(a,2))}Pc.prototype=Object.create(ji.prototype),Pc.prototype.constructor=Pc;class Oc extends ji{constructor(t=.5,e=1,n=8,r=1,i=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},n=Math.max(3,n);const a=[],s=[],l=[],c=[];let u=t;const h=(e-t)/(r=Math.max(1,r)),d=new Kn,p=new kn;for(let t=0;t<=r;t++){for(let t=0;t<=n;t++){const r=i+t/n*o;d.x=u*Math.cos(r),d.y=u*Math.sin(r),s.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,c.push(p.x,p.y)}u+=h}for(let t=0;t<r;t++){const e=t*(n+1);for(let t=0;t<n;t++){const r=t+e,i=r,o=r+n+1,s=r+n+2,l=r+1;a.push(i,o,l),a.push(o,s,l)}}this.setIndex(a),this.setAttribute("position",new Di(s,3)),this.setAttribute("normal",new Di(l,3)),this.setAttribute("uv",new Di(c,2))}}class Dc extends ji{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],r=[],i=[],o=[];let a=0,s=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(a,s,e),a+=s,s=0;function l(t){const a=r.length/3,l=t.extractPoints(e);let c=l.shape;const u=l.holes;!1===Mc.isClockWise(c)&&(c=c.reverse());for(let t=0,e=u.length;t<e;t++){const e=u[t];!0===Mc.isClockWise(e)&&(u[t]=e.reverse())}const h=Mc.triangulateShape(c,u);for(let t=0,e=u.length;t<e;t++){const e=u[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];r.push(e.x,e.y,0),i.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=h.length;t<e;t++){const e=h[t],r=e[0]+a,i=e[1]+a,o=e[2]+a;n.push(r,i,o),s+=3}}this.setIndex(n),this.setAttribute("position",new Di(r,3)),this.setAttribute("normal",new Di(i,3)),this.setAttribute("uv",new Di(o,2))}toJSON(){const t=ji.prototype.toJSON.call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}}class Ic extends ji{constructor(t=1,e=8,n=6,r=0,i=2*Math.PI,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const s=Math.min(o+a,Math.PI);let l=0;const c=[],u=new Kn,h=new Kn,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let y=0;0==d&&0==o?y=.5/e:d==n&&s==Math.PI&&(y=-.5/e);for(let n=0;n<=e;n++){const s=n/e;u.x=-t*Math.cos(r+s*i)*Math.sin(o+v*a),u.y=t*Math.cos(o+v*a),u.z=t*Math.sin(r+s*i)*Math.sin(o+v*a),p.push(u.x,u.y,u.z),h.copy(u).normalize(),f.push(h.x,h.y,h.z),m.push(s+y,1-v),g.push(l++)}c.push(g)}for(let t=0;t<n;t++)for(let r=0;r<e;r++){const e=c[t][r+1],i=c[t][r],a=c[t+1][r],l=c[t+1][r+1];(0!==t||o>0)&&d.push(e,i,l),(t!==n-1||s<Math.PI)&&d.push(i,a,l)}this.setIndex(d),this.setAttribute("position",new Di(p,3)),this.setAttribute("normal",new Di(f,3)),this.setAttribute("uv",new Di(m,2))}}class Nc extends ql{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}}class Bc extends Tc{constructor(t,e={}){const n=e.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ji;const r=n.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(r,e),this.type="TextGeometry"}}class zc extends ji{constructor(t=1,e=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const o=[],a=[],s=[],l=[],c=new Kn,u=new Kn,h=new Kn;for(let o=0;o<=n;o++)for(let d=0;d<=r;d++){const p=d/r*i,f=o/n*Math.PI*2;u.x=(t+e*Math.cos(f))*Math.cos(p),u.y=(t+e*Math.cos(f))*Math.sin(p),u.z=e*Math.sin(f),a.push(u.x,u.y,u.z),c.x=t*Math.cos(p),c.y=t*Math.sin(p),h.subVectors(u,c).normalize(),s.push(h.x,h.y,h.z),l.push(d/r),l.push(o/n)}for(let t=1;t<=n;t++)for(let e=1;e<=r;e++){const n=(r+1)*t+e-1,i=(r+1)*(t-1)+e-1,a=(r+1)*(t-1)+e,s=(r+1)*t+e;o.push(n,i,s),o.push(i,a,s)}this.setIndex(o),this.setAttribute("position",new Di(a,3)),this.setAttribute("normal",new Di(s,3)),this.setAttribute("uv",new Di(l,2))}}class Fc extends ji{constructor(t=1,e=.4,n=64,r=8,i=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},n=Math.floor(n),r=Math.floor(r);const a=[],s=[],l=[],c=[],u=new Kn,h=new Kn,d=new Kn,p=new Kn,f=new Kn,m=new Kn,g=new Kn;for(let a=0;a<=n;++a){const y=a/n*i*Math.PI*2;v(y,i,o,t,d),v(y+.01,i,o,t,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=r;++t){const i=t/r*Math.PI*2,o=-e*Math.cos(i),p=e*Math.sin(i);u.x=d.x+(o*g.x+p*f.x),u.y=d.y+(o*g.y+p*f.y),u.z=d.z+(o*g.z+p*f.z),s.push(u.x,u.y,u.z),h.subVectors(u,d).normalize(),l.push(h.x,h.y,h.z),c.push(a/n),c.push(t/r)}}for(let t=1;t<=n;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),o=(r+1)*t+e,s=(r+1)*(t-1)+e;a.push(n,i,s),a.push(i,o,s)}function v(t,e,n,r,i){const o=Math.cos(t),a=Math.sin(t),s=n/e*t,l=Math.cos(s);i.x=r*(2+l)*.5*o,i.y=r*(2+l)*a*.5,i.z=r*Math.sin(s)*.5}this.setIndex(a),this.setAttribute("position",new Di(s,3)),this.setAttribute("normal",new Di(l,3)),this.setAttribute("uv",new Di(c,2))}}class Hc extends ji{constructor(t,e=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i};const o=t.computeFrenetFrames(e,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new Kn,s=new Kn,l=new kn;let c=new Kn;const u=[],h=[],d=[],p=[];function f(i){c=t.getPointAt(i/e,c);const l=o.normals[i],d=o.binormals[i];for(let t=0;t<=r;t++){const e=t/r*Math.PI*2,i=Math.sin(e),o=-Math.cos(e);s.x=o*l.x+i*d.x,s.y=o*l.y+i*d.y,s.z=o*l.z+i*d.z,s.normalize(),h.push(s.x,s.y,s.z),a.x=c.x+n*s.x,a.y=c.y+n*s.y,a.z=c.z+n*s.z,u.push(a.x,a.y,a.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===i?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=r;n++)l.x=t/e,l.y=n/r,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),o=(r+1)*t+e,a=(r+1)*(t-1)+e;p.push(n,i,a),p.push(i,o,a)}}()}(),this.setIndex(p),this.setAttribute("position",new Di(u,3)),this.setAttribute("normal",new Di(h,3)),this.setAttribute("uv",new Di(d,2))}toJSON(){const t=ji.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t}}class kc extends ji{constructor(t){if(super(),this.type="WireframeGeometry",!0===t.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const e=[],n=[0,0],r={},i=new Kn;if(null!==t.index){const o=t.attributes.position,a=t.index;let s=t.groups;0===s.length&&(s=[{start:0,count:a.count,materialIndex:0}]);for(let t=0,e=s.length;t<e;++t){const e=s[t],i=e.start;for(let t=i,o=i+e.count;t<o;t+=3)for(let e=0;e<3;e++){const i=a.getX(t+e),o=a.getX(t+(e+1)%3);n[0]=Math.min(i,o),n[1]=Math.max(i,o);const s=n[0]+","+n[1];void 0===r[s]&&(r[s]={index1:n[0],index2:n[1]})}}for(const t in r){const n=r[t];i.fromBufferAttribute(o,n.index1),e.push(i.x,i.y,i.z),i.fromBufferAttribute(o,n.index2),e.push(i.x,i.y,i.z)}}else{const n=t.attributes.position;for(let t=0,r=n.count/3;t<r;t++)for(let r=0;r<3;r++){const o=3*t+r;i.fromBufferAttribute(n,o),e.push(i.x,i.y,i.z);const a=3*t+(r+1)%3;i.fromBufferAttribute(n,a),e.push(i.x,i.y,i.z)}}this.setAttribute("position",new Di(e,3))}}var Uc=Object.freeze({__proto__:null,BoxGeometry:ho,BoxBufferGeometry:ho,CircleGeometry:Vl,CircleBufferGeometry:Vl,ConeGeometry:jl,ConeBufferGeometry:jl,CylinderGeometry:Wl,CylinderBufferGeometry:Wl,DodecahedronGeometry:Xl,DodecahedronBufferGeometry:Xl,EdgesGeometry:Ql,ExtrudeGeometry:Tc,ExtrudeBufferGeometry:Tc,IcosahedronGeometry:Lc,IcosahedronBufferGeometry:Lc,LatheGeometry:Cc,LatheBufferGeometry:Cc,OctahedronGeometry:Rc,OctahedronBufferGeometry:Rc,ParametricGeometry:Pc,ParametricBufferGeometry:Pc,PlaneGeometry:Co,PlaneBufferGeometry:Co,PolyhedronGeometry:ql,PolyhedronBufferGeometry:ql,RingGeometry:Oc,RingBufferGeometry:Oc,ShapeGeometry:Dc,ShapeBufferGeometry:Dc,SphereGeometry:Ic,SphereBufferGeometry:Ic,TetrahedronGeometry:Nc,TetrahedronBufferGeometry:Nc,TextGeometry:Bc,TextBufferGeometry:Bc,TorusGeometry:zc,TorusBufferGeometry:zc,TorusKnotGeometry:Fc,TorusKnotBufferGeometry:Fc,TubeGeometry:Hc,TubeBufferGeometry:Hc,WireframeGeometry:kc});class Gc extends pi{constructor(t){super(),this.type="ShadowMaterial",this.color=new xi(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Gc.prototype.isShadowMaterial=!0;class Vc extends go{constructor(t){super(t),this.type="RawShaderMaterial"}}function Wc(t){pi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xi(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}function jc(t){Wc.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new kn(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=Hn.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}Vc.prototype.isRawShaderMaterial=!0,Wc.prototype=Object.create(pi.prototype),Wc.prototype.constructor=Wc,Wc.prototype.isMeshStandardMaterial=!0,Wc.prototype.copy=function(t){return pi.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this},jc.prototype=Object.create(Wc.prototype),jc.prototype.constructor=jc,jc.prototype.isMeshPhysicalMaterial=!0,jc.prototype.copy=function(t){return Wc.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new xi).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this};class qc extends pi{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new xi(16777215),this.specular=new xi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Z,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}qc.prototype.isMeshPhongMaterial=!0;class Xc extends pi{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xi(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Xc.prototype.isMeshToonMaterial=!0;class Yc extends pi{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Yc.prototype.isMeshNormalMaterial=!0;class Zc extends pi{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new xi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Z,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Zc.prototype.isMeshLambertMaterial=!0;class Jc extends pi{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Jc.prototype.isMeshMatcapMaterial=!0;class Kc extends bl{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Kc.prototype.isLineDashedMaterial=!0;var Qc=Object.freeze({__proto__:null,ShadowMaterial:Gc,SpriteMaterial:Us,RawShaderMaterial:Vc,ShaderMaterial:go,PointsMaterial:Ol,MeshPhysicalMaterial:jc,MeshStandardMaterial:Wc,MeshPhongMaterial:qc,MeshToonMaterial:Xc,MeshNormalMaterial:Yc,MeshLambertMaterial:Zc,MeshDepthMaterial:ws,MeshDistanceMaterial:Ms,MeshBasicMaterial:bi,MeshMatcapMaterial:Jc,LineDashedMaterial:Kc,LineBasicMaterial:bl,Material:pi});const $c={arraySlice:function(t,e,n){return $c.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const r=t.length,i=new t.constructor(r);for(let o=0,a=0;a!==r;++o){const r=n[o]*e;for(let n=0;n!==e;++n)i[a++]=t[r+n]}return i},flattenJSON:function(t,e,n,r){let i=1,o=t[0];for(;void 0!==o&&void 0===o[r];)o=t[i++];if(void 0===o)return;let a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)},subclip:function(t,e,n,r,i=30){const o=t.clone();o.name=e;const a=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],s=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*i;if(!(o<n||o>=r)){l.push(e.times[t]);for(let n=0;n<s;++n)c.push(e.values[t*s+n])}}0!==l.length&&(e.times=$c.convertArray(l,e.times.constructor),e.values=$c.convertArray(c,e.values.constructor),a.push(e))}o.tracks=a;let s=1/0;for(let t=0;t<o.tracks.length;++t)s>o.tracks[t].times[0]&&(s=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*s);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,o=e/r;for(let e=0;e<i;++e){const r=n.tracks[e],i=r.ValueTypeName;if("bool"===i||"string"===i)continue;const a=t.tracks.find((function(t){return t.name===r.name&&t.ValueTypeName===i}));if(void 0===a)continue;let s=0;const l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);let c=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const h=r.times.length-1;let d;if(o<=r.times[0]){const t=s,e=l-s;d=$c.arraySlice(r.values,t,e)}else if(o>=r.times[h]){const t=h*l+s,e=t+l-s;d=$c.arraySlice(r.values,t,e)}else{const t=r.createInterpolant(),e=s,n=l-s;t.evaluate(o),d=$c.arraySlice(t.resultBuffer,e,n)}"quaternion"===i&&(new Jn).fromArray(d).normalize().conjugate().toArray(d);const p=a.times.length;for(let t=0;t<p;++t){const e=t*u+c;if("quaternion"===i)Jn.multiplyQuaternionsFlat(a.values,e,d,0,a.values,e);else{const t=u-2*c;for(let n=0;n<t;++n)a.values[e+n]-=d[n]}}}return t.blendMode=qe,t}};function tu(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function eu(t,e,n,r){tu.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function nu(t,e,n,r){tu.call(this,t,e,n,r)}function ru(t,e,n,r){tu.call(this,t,e,n,r)}Object.assign(tu.prototype,{evaluate:function(t){const e=this.parameterPositions;let n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{let o;n:{r:if(!(t<r)){for(let o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,r=e[++n],t<r)break e}o=e.length;break n}if(t>=i)break t;{const a=e[1];t<a&&(n=2,i=a);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===o)break;if(r=i,i=e[--n-1],t>=i)break e}o=n,n=0}}for(;n<o;){const r=n+o>>>1;t<e[r]?o=r:n=r+1}if(r=e[n],i=e[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r;for(let t=0;t!==r;++t)e[t]=n[i+t];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(tu.prototype,{beforeStart_:tu.prototype.copySampleValue_,afterEnd_:tu.prototype.copySampleValue_}),eu.prototype=Object.assign(Object.create(tu.prototype),{constructor:eu,DefaultSettings_:{endingStart:Ge,endingEnd:Ge},intervalChanged_:function(t,e,n){const r=this.parameterPositions;let i=t-2,o=t+1,a=r[i],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case Ve:i=t,a=2*e-n;break;case We:i=r.length-2,a=e+r[i]-r[i+1];break;default:i=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Ve:o=t,s=2*n-e;break;case We:o=1,s=n+r[1]-r[0];break;default:o=t-1,s=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=o*c},interpolate_:function(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,l=s-a,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(r-e),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f;for(let t=0;t!==a;++t)i[t]=g*o[c+t]+v*o[l+t]+y*o[s+t]+_*o[u+t];return i}}),nu.prototype=Object.assign(Object.create(tu.prototype),{constructor:nu,interpolate_:function(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,l=s-a,c=(n-e)/(r-e),u=1-c;for(let t=0;t!==a;++t)i[t]=o[l+t]*u+o[s+t]*c;return i}}),ru.prototype=Object.assign(Object.create(tu.prototype),{constructor:ru,interpolate_:function(t){return this.copySampleValue_(t-1)}});class iu{constructor(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=$c.convertArray(e,this.TimeBufferType),this.values=$c.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:$c.convertArray(t.times,Array),values:$c.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new ru(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new eu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case He:e=this.InterpolantFactoryMethodDiscrete;break;case ke:e=this.InterpolantFactoryMethodLinear;break;case Ue:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return He;case this.InterpolantFactoryMethodLinear:return ke;case this.InterpolantFactoryMethodSmooth:return Ue}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t}return this}trim(t,e){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<t;)++i;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);const t=this.getValueSize();this.times=$c.arraySlice(n,i,o),this.values=$c.arraySlice(this.values,i*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==i;e++){const r=n[e];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,r),t=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,r,o),t=!1;break}o=r}if(void 0!==r&&$c.isTypedArray(r))for(let e=0,n=r.length;e!==n;++e){const n=r[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=$c.arraySlice(this.times),e=$c.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Ue,i=t.length-1;let o=1;for(let a=1;a<i;++a){let i=!1;const s=t[a];if(s!==t[a+1]&&(1!==a||s!==t[0]))if(r)i=!0;else{const t=a*n,r=t-n,o=t+n;for(let a=0;a!==n;++a){const n=e[t+a];if(n!==e[r+a]||n!==e[o+a]){i=!0;break}}}if(i){if(a!==o){t[o]=t[a];const r=a*n,i=o*n;for(let t=0;t!==n;++t)e[i+t]=e[r+t]}++o}}if(i>0){t[o]=t[i];for(let t=i*n,r=o*n,a=0;a!==n;++a)e[r+a]=e[t+a];++o}return o!==t.length?(this.times=$c.arraySlice(t,0,o),this.values=$c.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this}clone(){const t=$c.arraySlice(this.times,0),e=$c.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}iu.prototype.TimeBufferType=Float32Array,iu.prototype.ValueBufferType=Float32Array,iu.prototype.DefaultInterpolation=ke;class ou extends iu{}ou.prototype.ValueTypeName="bool",ou.prototype.ValueBufferType=Array,ou.prototype.DefaultInterpolation=He,ou.prototype.InterpolantFactoryMethodLinear=void 0,ou.prototype.InterpolantFactoryMethodSmooth=void 0;class au extends iu{}au.prototype.ValueTypeName="color";class su extends iu{}function lu(t,e,n,r){tu.call(this,t,e,n,r)}su.prototype.ValueTypeName="number",lu.prototype=Object.assign(Object.create(tu.prototype),{constructor:lu,interpolate_:function(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(n-e)/(r-e);let l=t*a;for(let t=l+a;l!==t;l+=4)Jn.slerpFlat(i,0,o,l-a,o,l,s);return i}});class cu extends iu{InterpolantFactoryMethodLinear(t){return new lu(this.times,this.values,this.getValueSize(),t)}}cu.prototype.ValueTypeName="quaternion",cu.prototype.DefaultInterpolation=ke,cu.prototype.InterpolantFactoryMethodSmooth=void 0;class uu extends iu{}uu.prototype.ValueTypeName="string",uu.prototype.ValueBufferType=Array,uu.prototype.DefaultInterpolation=He,uu.prototype.InterpolantFactoryMethodLinear=void 0,uu.prototype.InterpolantFactoryMethodSmooth=void 0;class hu extends iu{}hu.prototype.ValueTypeName="vector";class du{constructor(t,e=-1,n,r=je){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Hn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let t=0,i=n.length;t!==i;++t)e.push(pu(n[t]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,r=n.length;t!==r;++t)e.push(iu.toJSON(n[t]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,o=[];for(let t=0;t<i;t++){let a=[],s=[];a.push((t+i-1)%i,t,(t+1)%i),s.push(0,1,0);const l=$c.getKeyframeOrder(a);a=$c.sortedArray(a,1,l),s=$c.sortedArray(s,1,l),r||0!==a[0]||(a.push(i),s.push(s[0])),o.push(new su(".morphTargetInfluences["+e[t].name+"]",a,s).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name.match(i);if(o&&o.length>1){const t=o[1];let e=r[t];e||(r[t]=e=[]),e.push(n)}}const o=[];for(const t in r)o.push(this.CreateFromMorphTargetSequence(t,r[t],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const o=[],a=[];$c.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.fps||30,a=t.blendMode;let s=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const i=l[t].keys;if(i&&0!==i.length)if(i[0].morphTargets){const t={};let e;for(e=0;e<i.length;e++)if(i[e].morphTargets)for(let n=0;n<i[e].morphTargets.length;n++)t[i[e].morphTargets[n]]=-1;for(const n in t){const t=[],o=[];for(let r=0;r!==i[e].morphTargets.length;++r){const r=i[e];t.push(r.time),o.push(r.morphTarget===n?1:0)}r.push(new su(".morphTargetInfluence["+n+"]",t,o))}s=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";n(hu,o+".position",i,"pos",r),n(cu,o+".quaternion",i,"rot",r),n(hu,o+".scale",i,"scl",r)}}return 0===r.length?null:new this(i,s,r,a)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function pu(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return su;case"vector":case"vector2":case"vector3":case"vector4":return hu;case"color":return au;case"quaternion":return cu;case"bool":case"boolean":return ou;case"string":return uu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];$c.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const fu={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function mu(t,e,n){const r=this;let i,o=!1,a=0,s=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===o&&void 0!==r.onStart&&r.onStart(t,a,s),o=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,s),a===s&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return i?i(t):t},this.setURLModifier=function(t){return i=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],r=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}const gu=new mu;function vu(t){this.manager=void 0!==t?t:gu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(vu.prototype,{load:function(){},loadAsync:function(t,e){const n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});const yu={};function _u(t){vu.call(this,t)}_u.prototype=Object.assign(Object.create(vu.prototype),{constructor:_u,load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=fu.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;if(void 0!==yu[t])return void yu[t].push({onLoad:e,onProgress:n,onError:r});const a=t.match(/^data:(.*?)(;base64)?,(.*)$/);let s;if(a){const n=a[1],o=!!a[2];let s=a[3];s=decodeURIComponent(s),o&&(s=atob(s));try{let r;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(s.length);for(let e=0;e<s.length;e++)t[e]=s.charCodeAt(e);r="blob"===o?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;r=e.parseFromString(s,n);break;case"json":r=JSON.parse(s);break;default:r=s}setTimeout((function(){e&&e(r),i.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}),0)}}else{yu[t]=[],yu[t].push({onLoad:e,onProgress:n,onError:r}),s=new XMLHttpRequest,s.open("GET",t,!0),s.addEventListener("load",(function(e){const n=this.response,r=yu[t];if(delete yu[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),fu.add(t,n);for(let t=0,e=r.length;t<e;t++){const e=r[t];e.onLoad&&e.onLoad(n)}i.manager.itemEnd(t)}else{for(let t=0,n=r.length;t<n;t++){const n=r[t];n.onError&&n.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}}),!1),s.addEventListener("progress",(function(e){const n=yu[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onProgress&&r.onProgress(e)}}),!1),s.addEventListener("error",(function(e){const n=yu[t];delete yu[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),s.addEventListener("abort",(function(e){const n=yu[t];delete yu[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)s.setRequestHeader(t,this.requestHeader[t]);s.send(null)}return i.manager.itemStart(t),s},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}});class xu extends vu{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new _u(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}parse(t){const e=[];for(let n=0;n<t.length;n++){const r=du.parse(t[n]);e.push(r)}return e}}function bu(t){vu.call(this,t)}bu.prototype=Object.assign(Object.create(vu.prototype),{constructor:bu,load:function(t,e,n,r){const i=this,o=[],a=new kl,s=new _u(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);let l=0;function c(c){s.load(t[c],(function(t){const n=i.parse(t,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=_t),a.image=o,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,r)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)c(e);else s.load(t,(function(t){const n=i.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){o[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)o[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),o[e].format=n.format,o[e].width=n.width,o[e].height=n.height}a.image=o}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=_t),a.format=n.format,a.needsUpdate=!0,e&&e(a)}),n,r);return a}});class wu extends vu{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=fu.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;const a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1),fu.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return a.addEventListener("load",s,!1),a.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),i.manager.itemStart(t),a.src=t,a}}class Mu extends vu{constructor(t){super(t)}load(t,e,n,r){const i=new bo,o=new wu(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function s(n){o.load(t[n],(function(t){i.images[n]=t,a++,6===a&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(let e=0;e<t.length;++e)s(e);return i}}function Su(t){vu.call(this,t)}function Eu(t){vu.call(this,t)}function Tu(){this.type="Curve",this.arcLengthDivisions=200}Su.prototype=Object.assign(Object.create(vu.prototype),{constructor:Su,load:function(t,e,n,r){const i=this,o=new Mo,a=new _u(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(i.withCredentials),a.load(t,(function(t){const n=i.parse(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:dt,o.wrapT=void 0!==n.wrapT?n.wrapT:dt,o.magFilter=void 0!==n.magFilter?n.magFilter:_t,o.minFilter=void 0!==n.minFilter?n.minFilter:_t,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=wt),1===n.mipmapCount&&(o.minFilter=_t),o.needsUpdate=!0,e&&e(o,n))}),n,r),o}}),Eu.prototype=Object.assign(Object.create(vu.prototype),{constructor:Eu,load:function(t,e,n,r){const i=new jn,o=new wu(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(n){i.image=n;const r=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);i.format=r?zt:Ft,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}),Object.assign(Tu.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),i+=n.distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let o;o=e||t*n[i-1];let a,s=0,l=i-1;for(;s<=l;)if(r=Math.floor(s+(l-s)/2),a=n[r]-o,a<0)s=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){const n=1e-4;let r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);const o=this.getPoint(r),a=this.getPoint(i),s=e||(o.isVector2?new kn:new Kn);return s.copy(a).sub(o).normalize(),s},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Kn,r=[],i=[],o=[],a=new Kn,s=new Er;for(let e=0;e<=t;e++){const n=e/t;r[e]=this.getTangentAt(n,new Kn),r[e].normalize()}i[0]=new Kn,o[0]=new Kn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),h=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),h<=l&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),o[0].crossVectors(r[0],i[0]);for(let e=1;e<=t;e++){if(i[e]=i[e-1].clone(),o[e]=o[e-1].clone(),a.crossVectors(r[e-1],r[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Hn.clamp(r[e-1].dot(r[e]),-1,1));i[e].applyMatrix4(s.makeRotationAxis(a,t))}o[e].crossVectors(r[e],i[e])}if(!0===e){let e=Math.acos(Hn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(a.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],e*n)),o[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class Au extends Tu{constructor(t=0,e=0,n=1,r=1,i=0,o=2*Math.PI,a=!1,s=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s}getPoint(t,e){const n=e||new kn,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const a=this.aStartAngle+t*i;let s=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=s-this.aX,r=l-this.aY;s=n*t-r*e+this.aX,l=n*e+r*t+this.aY}return n.set(s,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Au.prototype.isEllipseCurve=!0;class Lu extends Au{constructor(t,e,n,r,i,o){super(t,e,n,n,r,i,o),this.type="ArcCurve"}}function Cu(){let t=0,e=0,n=0,r=0;function i(i,o,a,s){t=i,e=a,n=-3*i+3*o-2*a-s,r=2*i-2*o+a+s}return{initCatmullRom:function(t,e,n,r,o){i(e,n,o*(n-t),o*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,o,a,s){let l=(e-t)/o-(n-t)/(o+a)+(n-e)/a,c=(n-e)/a-(r-e)/(a+s)+(r-n)/s;l*=a,c*=a,i(e,n,l,c)},calc:function(i){const o=i*i;return t+e*i+n*o+r*(o*i)}}}Lu.prototype.isArcCurve=!0;const Ru=new Kn,Pu=new Cu,Ou=new Cu,Du=new Cu;class Iu extends Tu{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new Kn){const n=e,r=this.points,i=r.length,o=(i-(this.closed?0:1))*t;let a,s,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?a=r[(l-1)%i]:(Ru.subVectors(r[0],r[1]).add(r[0]),a=Ru);const u=r[l%i],h=r[(l+1)%i];if(this.closed||l+2<i?s=r[(l+2)%i]:(Ru.subVectors(r[i-1],r[i-2]).add(r[i-1]),s=Ru),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(h),t),r=Math.pow(h.distanceToSquared(s),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),Pu.initNonuniformCatmullRom(a.x,u.x,h.x,s.x,e,n,r),Ou.initNonuniformCatmullRom(a.y,u.y,h.y,s.y,e,n,r),Du.initNonuniformCatmullRom(a.z,u.z,h.z,s.z,e,n,r)}else"catmullrom"===this.curveType&&(Pu.initCatmullRom(a.x,u.x,h.x,s.x,this.tension),Ou.initCatmullRom(a.y,u.y,h.y,s.y,this.tension),Du.initCatmullRom(a.z,u.z,h.z,s.z,this.tension));return n.set(Pu.calc(c),Ou.calc(c),Du.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Kn).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Nu(t,e,n,r,i){const o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function Bu(t,e,n,r){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function zu(t,e,n,r,i){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}Iu.prototype.isCatmullRomCurve3=!0;class Fu extends Tu{constructor(t=new kn,e=new kn,n=new kn,r=new kn){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new kn){const n=e,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(zu(t,r.x,i.x,o.x,a.x),zu(t,r.y,i.y,o.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Fu.prototype.isCubicBezierCurve=!0;class Hu extends Tu{constructor(t=new Kn,e=new Kn,n=new Kn,r=new Kn){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Kn){const n=e,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(zu(t,r.x,i.x,o.x,a.x),zu(t,r.y,i.y,o.y,a.y),zu(t,r.z,i.z,o.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Hu.prototype.isCubicBezierCurve3=!0;class ku extends Tu{constructor(t=new kn,e=new kn){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new kn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new kn;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ku.prototype.isLineCurve=!0;class Uu extends Tu{constructor(t=new Kn,e=new Kn){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new Kn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Gu extends Tu{constructor(t=new kn,e=new kn,n=new kn){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new kn){const n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(Bu(t,r.x,i.x,o.x),Bu(t,r.y,i.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Gu.prototype.isQuadraticBezierCurve=!0;class Vu extends Tu{constructor(t=new Kn,e=new Kn,n=new Kn){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Kn){const n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(Bu(t,r.x,i.x,o.x),Bu(t,r.y,i.y,o.y),Bu(t,r.z,i.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Vu.prototype.isQuadraticBezierCurve3=!0;class Wu extends Tu{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new kn){const n=e,r=this.points,i=(r.length-1)*t,o=Math.floor(i),a=i-o,s=r[0===o?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(Nu(a,s.x,l.x,c.x,u.x),Nu(a,s.y,l.y,c.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new kn).fromArray(n))}return this}}Wu.prototype.isSplineCurve=!0;var ju=Object.freeze({__proto__:null,ArcCurve:Lu,CatmullRomCurve3:Iu,CubicBezierCurve:Fu,CubicBezierCurve3:Hu,EllipseCurve:Au,LineCurve:ku,LineCurve3:Uu,QuadraticBezierCurve:Gu,QuadraticBezierCurve3:Vu,SplineCurve:Wu});class qu extends Tu{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new ku(e,t))}getPoint(t){const e=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=e){const t=n[r]-e,i=this.curves[r],o=i.getLength(),a=0===o?0:1-t/o;return i.getPointAt(a)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],a=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a);for(let t=0;t<s.length;t++){const r=s[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new ju[n.type]).fromJSON(n))}return this}}class Xu extends qu{constructor(t){super(),this.type="Path",this.currentPoint=new kn,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new ku(this.currentPoint.clone(),new kn(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new Gu(this.currentPoint.clone(),new kn(t,e),new kn(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,o){const a=new Fu(this.currentPoint.clone(),new kn(t,e),new kn(n,r),new kn(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Wu(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,o){const a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+a,e+s,n,r,i,o),this}absarc(t,e,n,r,i,o){return this.absellipse(t,e,n,n,r,i,o),this}ellipse(t,e,n,r,i,o,a,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,r,i,o,a,s),this}absellipse(t,e,n,r,i,o,a,s){const l=new Au(t,e,n,r,i,o,a,s);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Yu extends Xu{constructor(t){super(t),this.uuid=Hn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new Xu).fromJSON(n))}return this}}class Zu extends Jr{constructor(t,e=1){super(),this.type="Light",this.color=new xi(t),this.intensity=e}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}Zu.prototype.isLight=!0;class Ju extends Zu{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(Jr.DefaultUp),this.updateMatrix(),this.groundColor=new xi(e)}copy(t){return Zu.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Ju.prototype.isHemisphereLight=!0;const Ku=new Er,Qu=new Kn,$u=new Kn;class th{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new kn(512,512),this.map=null,this.mapPass=null,this.matrix=new Er,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new To,this._frameExtents=new kn(1,1),this._viewportCount=1,this._viewports=[new Xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Qu.setFromMatrixPosition(t.matrixWorld),e.position.copy(Qu),$u.setFromMatrixPosition(t.target.matrixWorld),e.lookAt($u),e.updateMatrixWorld(),Ku.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ku),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class eh extends th{constructor(){super(new yo(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*Hn.RAD2DEG*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix()),super.updateMatrices(t)}}eh.prototype.isSpotLightShadow=!0;class nh extends Zu{constructor(t,e,n=0,r=Math.PI/3,i=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(Jr.DefaultUp),this.updateMatrix(),this.target=new Jr,this.distance=n,this.angle=r,this.penumbra=i,this.decay=o,this.shadow=new eh}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}nh.prototype.isSpotLight=!0;const rh=new Er,ih=new Kn,oh=new Kn;class ah extends th{constructor(){super(new yo(90,1,.5,500)),this._frameExtents=new kn(4,2),this._viewportCount=6,this._viewports=[new Xn(2,1,1,1),new Xn(0,1,1,1),new Xn(3,1,1,1),new Xn(1,1,1,1),new Xn(3,0,1,1),new Xn(1,0,1,1)],this._cubeDirections=[new Kn(1,0,0),new Kn(-1,0,0),new Kn(0,0,1),new Kn(0,0,-1),new Kn(0,1,0),new Kn(0,-1,0)],this._cubeUps=[new Kn(0,1,0),new Kn(0,1,0),new Kn(0,1,0),new Kn(0,1,0),new Kn(0,0,1),new Kn(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix;ih.setFromMatrixPosition(t.matrixWorld),n.position.copy(ih),oh.copy(n.position),oh.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(oh),n.updateMatrixWorld(),r.makeTranslation(-ih.x,-ih.y,-ih.z),rh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rh)}}ah.prototype.isPointLightShadow=!0;class sh extends Zu{constructor(t,e,n=0,r=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new ah}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}sh.prototype.isPointLight=!0;class lh extends vo{constructor(t=-1,e=1,n=1,r=-1,i=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=i,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,i,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-t,o=n+t,a=r+e,s=r-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=t*this.view.offsetX,o=i+t*this.view.width,a-=e*this.view.offsetY,s=a-e*this.view.height}this.projectionMatrix.makeOrthographic(i,o,a,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=Jr.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}lh.prototype.isOrthographicCamera=!0;class ch extends th{constructor(){super(new lh(-5,5,5,-5,.5,500))}}ch.prototype.isDirectionalLightShadow=!0;class uh extends Zu{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Jr.DefaultUp),this.updateMatrix(),this.target=new Jr,this.shadow=new ch}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}uh.prototype.isDirectionalLight=!0;class hh extends Zu{constructor(t,e){super(t,e),this.type="AmbientLight"}}hh.prototype.isAmbientLight=!0;class dh extends Zu{constructor(t,e,n=10,r=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=r}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}dh.prototype.isRectAreaLight=!0;class ph{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Kn)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,r=t.y,i=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*r),e.addScaledVector(o[2],.488603*i),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*r*1.092548),e.addScaledVector(o[5],r*i*1.092548),e.addScaledVector(o[6],.315392*(3*i*i-1)),e.addScaledVector(o[7],n*i*1.092548),e.addScaledVector(o[8],.546274*(n*n-r*r)),e}getIrradianceAt(t,e){const n=t.x,r=t.y,i=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*r),e.addScaledVector(o[2],1.023328*i),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*r),e.addScaledVector(o[5],.858086*r*i),e.addScaledVector(o[6],.743125*i*i-.247708),e.addScaledVector(o[7],.858086*n*i),e.addScaledVector(o[8],.429043*(n*n-r*r)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this}toArray(t=[],e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(t,e+3*r);return t}static getBasisAt(t,e){const n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)}}ph.prototype.isSphericalHarmonics3=!0;class fh extends Zu{constructor(t=new ph,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}fh.prototype.isLightProbe=!0;class mh extends vu{constructor(t){super(t),this.textures={}}load(t,e,n,r){const i=this,o=new _u(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const r=new Qc[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=(new xi).setHex(t.sheen)),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(r.morphNormals=t.morphNormals),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.vertexTangents&&(r.vertexTangents=t.vertexTangents),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const i=t.uniforms[e];switch(r.uniforms[e]={},i.type){case"t":r.uniforms[e].value=n(i.value);break;case"c":r.uniforms[e].value=(new xi).setHex(i.value);break;case"v2":r.uniforms[e].value=(new kn).fromArray(i.value);break;case"v3":r.uniforms[e].value=(new Kn).fromArray(i.value);break;case"v4":r.uniforms[e].value=(new Xn).fromArray(i.value);break;case"m3":r.uniforms[e].value=(new Un).fromArray(i.value);break;case"m4":r.uniforms[e].value=(new Er).fromArray(i.value);break;default:r.uniforms[e].value=i.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)r.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new kn).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new kn).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}const gh={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}},extractUrlBase:function(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function vh(){ji.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function yh(t,e,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Si.call(this,t,e,n),this.meshPerAttribute=r||1}vh.prototype=Object.assign(Object.create(ji.prototype),{constructor:vh,isInstancedBufferGeometry:!0,copy:function(t){return ji.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t=ji.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),yh.prototype=Object.assign(Object.create(Si.prototype),{constructor:yh,isInstancedBufferAttribute:!0,copy:function(t){return Si.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){const t=Si.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}});class _h extends vu{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new _u(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}parse(t){const e={},n={};function r(t,r){if(void 0!==e[r])return e[r];const i=t.interleavedBuffers[r],o=function(t,e){if(void 0!==n[e])return n[e];const r=t.arrayBuffers[e],i=new Uint32Array(r).buffer;return n[e]=i,i}(t,i.buffer),a=new Fs(zi(i.type,o),i.stride);return a.uuid=i.uuid,e[r]=a,a}const i=t.isInstancedBufferGeometry?new vh:new ji,o=t.data.index;if(void 0!==o){const t=zi(o.type,o.array);i.setIndex(new Si(t,1))}const a=t.data.attributes;for(const e in a){const n=a[e];let o;if(n.isInterleavedBufferAttribute)o=new ks(r(t.data,n.data),n.itemSize,n.offset,n.normalized);else{const t=zi(n.type,n.array);o=new(n.isInstancedBufferAttribute?yh:Si)(t,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),i.setAttribute(e,o)}const s=t.data.morphAttributes;if(s)for(const e in s){const n=s[e],o=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];let a;a=i.isInterleavedBufferAttribute?new ks(r(t.data,i.data),i.itemSize,i.offset,i.normalized):new Si(zi(i.type,i.array),i.itemSize,i.normalized),void 0!==i.name&&(a.name=i.name),o.push(a)}i.morphAttributes[e]=o}t.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];i.addGroup(e.start,e.count,e.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new Kn;void 0!==c.center&&t.fromArray(c.center),i.boundingSphere=new gr(t,c.radius)}return t.name&&(i.name=t.name),t.userData&&(i.userData=t.userData),i}}class xh extends vu{constructor(t){super(t)}load(t,e,n,r){const i=this,o=""===this.path?gh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||o;const a=new _u(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){let o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?i.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,r)}parse(t,e){const n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),o=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,o),s=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,i,s,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),void 0!==e){let t=!1;for(const e in o)if(o[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}parseShapes(t){const e={};if(void 0!==t)for(let n=0,r=t.length;n<r;n++){const r=(new Yu).fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){const n={},r={};if(e.traverse((function(t){t.isBone&&(r[t.uuid]=t)})),void 0!==t)for(let e=0,i=t.length;e<i;e++){const i=(new ml).fromJSON(t[e],r);n[i.uuid]=i}return n}parseGeometries(t,e){const n={};let r;if(void 0!==t){const i=new _h;for(let o=0,a=t.length;o<a;o++){let a;const s=t[o];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new Uc[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":a=new Uc[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new Uc[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new Uc[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new Uc[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new Uc[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":a=new Uc[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new Uc[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new Uc[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new Uc[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":a=new Uc[s.type]((new ju[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":a=new Uc[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":a=new Uc[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":r=[];for(let t=0,n=s.shapes.length;t<n;t++){const n=e[s.shapes[t]];r.push(n)}a=new Uc[s.type](r,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":r=[];for(let t=0,n=s.shapes.length;t<n;t++){const n=e[s.shapes[t]];r.push(n)}const t=s.options.extrudePath;void 0!==t&&(s.options.extrudePath=(new ju[t.type]).fromJSON(t)),a=new Uc[s.type](r,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),!0===a.isBufferGeometry&&void 0!==s.userData&&(a.userData=s.userData),n[s.uuid]=a}}return n}parseMaterials(t,e){const n={},r={};if(void 0!==t){const i=new mh;i.setTextures(e);for(let e=0,o=t.length;e<o;e++){const o=t[e];if("MultiMaterial"===o.type){const t=[];for(let e=0;e<o.materials.length;e++){const r=o.materials[e];void 0===n[r.uuid]&&(n[r.uuid]=i.parse(r)),t.push(n[r.uuid])}r[o.uuid]=t}else void 0===n[o.uuid]&&(n[o.uuid]=i.parse(o)),r[o.uuid]=n[o.uuid]}}return r}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const r=t[n],i=du.parse(r);e[i.uuid]=i}return e}parseImages(t,e){const n=this,r={};let i;function o(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),i.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:zi(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new mu(e);i=new wu(n),i.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],i=n.url;if(Array.isArray(i)){r[n.uuid]=[];for(let t=0,e=i.length;t<e;t++){const e=o(i[t]);null!==e&&(e instanceof HTMLImageElement?r[n.uuid].push(e):r[n.uuid].push(new Mo(e.data,e.width,e.height)))}}else{const t=o(n.url);null!==t&&(r[n.uuid]=t)}}}return r}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const r={};if(void 0!==t)for(let i=0,o=t.length;i<o;i++){const o=t[i];let a;void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const s=e[o.image];Array.isArray(s)?(a=new bo(s),6===s.length&&(a.needsUpdate=!0)):(a=s&&s.data?new Mo(s.data,s.width,s.height):new jn(s),s&&(a.needsUpdate=!0)),a.uuid=o.uuid,void 0!==o.name&&(a.name=o.name),void 0!==o.mapping&&(a.mapping=n(o.mapping,bh)),void 0!==o.offset&&a.offset.fromArray(o.offset),void 0!==o.repeat&&a.repeat.fromArray(o.repeat),void 0!==o.center&&a.center.fromArray(o.center),void 0!==o.rotation&&(a.rotation=o.rotation),void 0!==o.wrap&&(a.wrapS=n(o.wrap[0],wh),a.wrapT=n(o.wrap[1],wh)),void 0!==o.format&&(a.format=o.format),void 0!==o.type&&(a.type=o.type),void 0!==o.encoding&&(a.encoding=o.encoding),void 0!==o.minFilter&&(a.minFilter=n(o.minFilter,Mh)),void 0!==o.magFilter&&(a.magFilter=n(o.magFilter,Mh)),void 0!==o.anisotropy&&(a.anisotropy=o.anisotropy),void 0!==o.flipY&&(a.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(a.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(a.unpackAlignment=o.unpackAlignment),r[o.uuid]=a}return r}parseObject(t,e,n,r){let i,o,a;function s(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),e.push(n[i])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}switch(t.type){case"Scene":i=new zs,void 0!==t.background&&Number.isInteger(t.background)&&(i.background=new xi(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?i.fog=new Bs(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(i.fog=new Ns(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":i=new yo(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(i.focus=t.focus),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.filmGauge&&(i.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(i.filmOffset=t.filmOffset),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"OrthographicCamera":i=new lh(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"AmbientLight":i=new hh(t.color,t.intensity);break;case"DirectionalLight":i=new uh(t.color,t.intensity);break;case"PointLight":i=new sh(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":i=new dh(t.color,t.intensity,t.width,t.height);break;case"SpotLight":i=new nh(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":i=new Ju(t.color,t.groundColor,t.intensity);break;case"LightProbe":i=(new fh).fromJSON(t);break;case"SkinnedMesh":o=s(t.geometry),a=l(t.material),i=new hl(o,a),void 0!==t.bindMode&&(i.bindMode=t.bindMode),void 0!==t.bindMatrix&&i.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(i.skeleton=t.skeleton);break;case"Mesh":o=s(t.geometry),a=l(t.material),i=new co(o,a);break;case"InstancedMesh":o=s(t.geometry),a=l(t.material);const e=t.count,n=t.instanceMatrix;i=new xl(o,a,e),i.instanceMatrix=new Si(new Float32Array(n.array),16);break;case"LOD":i=new ol;break;case"Line":i=new Al(s(t.geometry),l(t.material));break;case"LineLoop":i=new Pl(s(t.geometry),l(t.material));break;case"LineSegments":i=new Rl(s(t.geometry),l(t.material));break;case"PointCloud":case"Points":i=new zl(s(t.geometry),l(t.material));break;case"Sprite":i=new el(l(t.material));break;case"Group":i=new Cs;break;case"Bone":i=new dl;break;default:i=new Jr}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(i.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(i.matrixAutoUpdate=t.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.quaternion&&i.quaternion.fromArray(t.quaternion),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.castShadow&&(i.castShadow=t.castShadow),void 0!==t.receiveShadow&&(i.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(i.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(i.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(i.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&i.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(i.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.frustumCulled&&(i.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(i.renderOrder=t.renderOrder),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.layers&&(i.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)i.add(this.parseObject(o[t],e,n,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];i.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(i.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],r=i.getObjectByProperty("uuid",n.object);void 0!==r&&i.addLevel(r,n.distance)}}return i}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const bh={UVMapping:it,CubeReflectionMapping:ot,CubeRefractionMapping:at,EquirectangularReflectionMapping:st,EquirectangularRefractionMapping:lt,CubeUVReflectionMapping:ct,CubeUVRefractionMapping:ut},wh={RepeatWrapping:ht,ClampToEdgeWrapping:dt,MirroredRepeatWrapping:pt},Mh={NearestFilter:ft,NearestMipmapNearestFilter:mt,NearestMipmapLinearFilter:vt,LinearFilter:_t,LinearMipmapNearestFilter:xt,LinearMipmapLinearFilter:wt};function Sh(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),vu.call(this,t),this.options={premultiplyAlpha:"none"}}Sh.prototype=Object.assign(Object.create(vu.prototype),{constructor:Sh,isImageBitmapLoader:!0,setOptions:function(t){return this.options=t,this},load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=fu.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){fu.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}});class Eh{constructor(){this.type="ShapePath",this.color=new xi,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Xu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}bezierCurveTo(t,e,n,r,i,o){return this.currentPath.bezierCurveTo(t,e,n,r,i,o),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],i=new Yu;i.curves=r.curves,e.push(i)}return e}function r(t,e){const n=e.length;let r=!1;for(let i=n-1,o=0;o<n;i=o++){let n=e[i],a=e[o],s=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[o],s=-s,a=e[i],l=-l),t.y<n.y||t.y>a.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-s*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return r}const i=Mc.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);let a,s,l;const c=[];if(1===o.length)return s=o[0],l=new Yu,l.curves=s.curves,c.push(l),c;let u=!i(o[0].getPoints());u=t?!u:u;const h=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,n=o.length;e<n;e++)s=o[e],p=s.getPoints(),a=i(p),a=t?!a:a,a?(!u&&d[g]&&g++,d[g]={s:new Yu,p},d[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:p[0]});if(!d[0])return n(o);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)h[t]=[];for(let n=0,i=d.length;n<i;n++){const i=m[n];for(let o=0;o<i.length;o++){const a=i[o];let s=!0;for(let i=0;i<d.length;i++)r(a.p,d[i].p)&&(n!==i&&e.push({froms:n,tos:i,hole:o}),s?(s=!1,h[i].push(a)):t=!0);s&&h[n].push(a)}}e.length>0&&(t||(m=h))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,c.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return c}}class Th{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],r=function(t,e,n){const r=Array.from(t),i=e/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,a=[];let s=0,l=0;for(let t=0;t<r.length;t++){const e=r[t];if("\n"===e)s=0,l-=o;else{const t=Ah(e,i,s,l,n);s+=t.offsetX,a.push(t.path)}}return a}(t,e,this.data);for(let t=0,e=r.length;t<e;t++)Array.prototype.push.apply(n,r[t].toShapes());return n}}function Ah(t,e,n,r,i){const o=i.glyphs[t]||i.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".");const a=new Eh;let s,l,c,u,h,d,p,f;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let i=0,o=t.length;i<o;)switch(t[i++]){case"m":s=t[i++]*e+n,l=t[i++]*e+r,a.moveTo(s,l);break;case"l":s=t[i++]*e+n,l=t[i++]*e+r,a.lineTo(s,l);break;case"q":c=t[i++]*e+n,u=t[i++]*e+r,h=t[i++]*e+n,d=t[i++]*e+r,a.quadraticCurveTo(h,d,c,u);break;case"b":c=t[i++]*e+n,u=t[i++]*e+r,h=t[i++]*e+n,d=t[i++]*e+r,p=t[i++]*e+n,f=t[i++]*e+r,a.bezierCurveTo(h,d,p,f,c,u)}}return{offsetX:o.ha*e,path:a}}Th.prototype.isFont=!0;class Lh extends vu{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new _u(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(t){let n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const r=i.parse(n);e&&e(r)}),n,r)}parse(t){return new Th(t)}}let Ch;const Rh={getContext:function(){return void 0===Ch&&(Ch=new(window.AudioContext||window.webkitAudioContext)),Ch},setContext:function(t){Ch=t}};class Ph extends vu{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new _u(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{const t=n.slice(0);Rh.getContext().decodeAudioData(t,(function(t){e(t)}))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}}class Oh extends fh{constructor(t,e,n=1){super(void 0,n);const r=(new xi).set(t),i=(new xi).set(e),o=new Kn(r.r,r.g,r.b),a=new Kn(i.r,i.g,i.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}}Oh.prototype.isHemisphereLightProbe=!0;class Dh extends fh{constructor(t,e=1){super(void 0,e);const n=(new xi).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Dh.prototype.isAmbientLightProbe=!0;const Ih=new Er,Nh=new Er;class Bh{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new yo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new yo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;const n=t.projectionMatrix.clone(),r=e.eyeSep/2,i=r*e.near/e.focus,o=e.near*Math.tan(Hn.DEG2RAD*e.fov*.5)/e.zoom;let a,s;Nh.elements[12]=-r,Ih.elements[12]=r,a=-o*e.aspect+i,s=o*e.aspect+i,n.elements[0]=2*e.near/(s-a),n.elements[8]=(s+a)/(s-a),this.cameraL.projectionMatrix.copy(n),a=-o*e.aspect-i,s=o*e.aspect-i,n.elements[0]=2*e.near/(s-a),n.elements[8]=(s+a)/(s-a),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Nh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Ih)}}class zh{constructor(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Fh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Fh();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Fh(){return("undefined"==typeof performance?Date:performance).now()}const Hh=new Kn,kh=new Jn,Uh=new Kn,Gh=new Kn;class Vh extends Jr{constructor(){super(),this.type="AudioListener",this.context=Rh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new zh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Hh,kh,Uh),Gh.set(0,0,-1).applyQuaternion(kh),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Hh.x,t),e.positionY.linearRampToValueAtTime(Hh.y,t),e.positionZ.linearRampToValueAtTime(Hh.z,t),e.forwardX.linearRampToValueAtTime(Gh.x,t),e.forwardY.linearRampToValueAtTime(Gh.y,t),e.forwardZ.linearRampToValueAtTime(Gh.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Hh.x,Hh.y,Hh.z),e.setOrientation(Gh.x,Gh.y,Gh.z,n.x,n.y,n.z)}}class Wh extends Jr{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const jh=new Kn,qh=new Jn,Xh=new Kn,Yh=new Kn;class Zh extends Wh{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(jh,qh,Xh),Yh.set(0,0,1).applyQuaternion(qh);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(jh.x,t),e.positionY.linearRampToValueAtTime(jh.y,t),e.positionZ.linearRampToValueAtTime(jh.z,t),e.orientationX.linearRampToValueAtTime(Yh.x,t),e.orientationY.linearRampToValueAtTime(Yh.y,t),e.orientationZ.linearRampToValueAtTime(Yh.z,t)}else e.setPosition(jh.x,jh.y,jh.z),e.setOrientation(Yh.x,Yh.y,Yh.z)}}class Jh{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Kh{constructor(t,e,n){let r,i,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,r=this.valueSize,i=t*r+r;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==r;++t)n[i+t]=n[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(n,i,0,t,r)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const t=e*this._origIndex;this._mixBufferRegion(n,r,t,1-i,e)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let t=e,i=e+e;t!==i;++t)if(n[t]!==n[t+e]){a.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let t=n,i=r;t!==i;++t)e[t]=e[r+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)t[e+r]=t[n+r]}_slerp(t,e,n,r){Jn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const o=this._workIndex*i;Jn.multiplyQuaternionsFlat(t,o,t,e,t,n),Jn.slerpFlat(t,e,t,e,t,o,r)}_lerp(t,e,n,r,i){const o=1-r;for(let a=0;a!==i;++a){const i=e+a;t[i]=t[i]*o+t[n+a]*r}}_lerpAdditive(t,e,n,r,i){for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]+t[n+o]*r}}}const Qh=new RegExp("[\\[\\]\\.:\\/]","g"),$h="[^\\[\\]\\.:\\/]",td="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",ed=/((?:WC+[\/:])*)/.source.replace("WC",$h),nd=/(WCOD+)?/.source.replace("WCOD",td),rd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",$h),id=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",$h),od=new RegExp("^"+ed+nd+rd+id+"$"),ad=["material","materials","bones"];function sd(t,e,n){const r=n||ld.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function ld(t,e,n){this.path=e,this.parsedPath=n||ld.parseTrackName(e),this.node=ld.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(sd.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(ld,{Composite:sd,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new ld.Composite(t,e,n):new ld(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Qh,"")},parseTrackName:function(t){const e=od.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==ad.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.name===e||i.uuid===e)return i;const o=n(i.children);if(o)return o}return null},r=n(t.children);if(r)return r}return null}}),Object.assign(ld.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)t[e++]=n[r]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){let t=this.node;const e=this.parsedPath,n=e.objectName,r=e.propertyName;let i=e.propertyIndex;if(t||(t=ld.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===r){r=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==r){if(void 0===t[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[r]}}const o=t[r];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}s=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(s=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][a]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(ld.prototype,{_getValue_unbound:ld.prototype.getValue,_setValue_unbound:ld.prototype.setValue});class cd{constructor(){this.uuid=Hn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,o=i.length;let a,s=t.length,l=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],h=u.uuid;let d=e[h];if(void 0===d){d=s++,e[h]=d,t.push(u);for(let t=0,e=o;t!==e;++t)i[t].push(new ld(u,n[t],r[t]))}else if(d<l){a=t[d];const s=--l,c=t[s];e[c.uuid]=d,t[d]=c,e[h]=s,t[s]=u;for(let t=0,e=o;t!==e;++t){const e=i[t],o=e[s];let a=e[d];e[d]=o,void 0===a&&(a=new ld(u,n[t],r[t])),e[s]=a}}else t[d]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o],s=a.uuid,l=e[s];if(void 0!==l&&l>=i){const o=i++,c=t[o];e[c.uuid]=l,t[l]=c,e[s]=o,t[o]=a;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[o],i=e[l];e[l]=r,e[o]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,o=t.length;for(let a=0,s=arguments.length;a!==s;++a){const s=arguments[a].uuid,l=e[s];if(void 0!==l)if(delete e[s],l<i){const a=--i,s=t[a],c=--o,u=t[c];e[s.uuid]=l,t[l]=s,e[u.uuid]=a,t[a]=u,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[a],i=e[c];e[l]=r,e[a]=i,e.pop()}}else{const i=--o,a=t[i];i>0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const o=this._paths,a=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[t]=r,o.push(t),a.push(e),i.push(u);for(let n=c,r=s.length;n!==r;++n){const r=s[n];u[n]=new ld(r,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),i[n]=i[a],i.pop(),r[n]=r[a],r.pop()}}}cd.prototype.isAnimationObjectGroup=!0;class ud{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,o=i.length,a=new Array(o),s={endingStart:Ge,endingEnd:Ge};for(let t=0;t!==o;++t){const e=i[t].createInterpolant(null);a[t]=e,e.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ze,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,o=n/r;t.warp(1,i,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const o=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case qe:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulateAdditive(a);break;case je:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulate(r,a)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const o=n===Fe;if(0===t)return-1===i?r:o&&1==(1&i)?e-r:r;if(n===Be){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const a=this.repetitions-i;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=Ve,r.endingEnd=Ve):(r.endingStart=t?this.zeroSlopeAtStart?Ve:Ge:We,r.endingEnd=e?this.zeroSlopeAtEnd?Ve:Ge:We)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}}class hd extends Bn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName;let c=l[s];void 0===c&&(c={},l[s]=c);for(let t=0;t!==i;++t){const i=r[t],l=i.name;let u=c[l];if(void 0!==u)o[t]=u;else{if(u=o[t],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,s,l));continue}const r=e&&e._propertyBindings[t].binding.parsedPath;u=new Kh(ld.create(n,l,r),i.ValueTypeName,i.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,s,l),o[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const r=this._actions,i=this._actionsByClip;let o=i[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=r.length,r.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;const i=t._clip.uuid,o=this._actionsByClip,a=o[i],s=a.knownActions,l=s[s.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[i],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_addInactiveBinding(t,e,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[e];void 0===o&&(o={},r[e]=o),o[n]=t,t._cacheIndex=i.length,i.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,a=o[r],s=e[e.length-1],l=t._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete a[i],0===Object.keys(a).length&&delete o[r]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new nu(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i}clipAction(t,e,n){const r=e||this._root,i=r.uuid;let o="string"==typeof t?du.findByName(r,t):t;const a=null!==o?o.uuid:t,s=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:je),void 0!==s){const t=s.actionByRoot[i];if(void 0!==t&&t.blendMode===n)return t;l=s.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new ud(this,o,e,n);return this._bindAction(c,l),this._addInactiveAction(c,a,i),c}existingAction(t,e){const n=e||this._root,r=n.uuid,i="string"==typeof t?du.findByName(n,t):t,o=i?i.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[r]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1;for(let a=0;a!==n;++a)e[a]._update(r,t,i,o);const a=this._bindings,s=this._nActiveBindings;for(let t=0;t!==s;++t)a[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const t=i.knownActions;for(let n=0,r=t.length;n!==r;++n){const r=t[n];this._deactivateAction(r);const i=r._cacheIndex,o=e[e.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,e[i]=o,e.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const r=n[t].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName[e];if(void 0!==r)for(const t in r){const e=r[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}hd.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class dd{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new dd(void 0===this.value.clone?this.value:this.value.clone())}}function pd(t,e,n){Fs.call(this,t,e),this.meshPerAttribute=n||1}function fd(t,e,n,r,i){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}function md(t,e,n=0,r=1/0){this.ray=new Sr(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Br,this.params={Mesh:{},Line:{threshold:1},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 gd(t,e){return t.distance-e.distance}function vd(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r){const r=t.children;for(let t=0,i=r.length;t<i;t++)vd(r[t],e,n,!0)}}pd.prototype=Object.assign(Object.create(Fs.prototype),{constructor:pd,isInstancedInterleavedBuffer:!0,copy:function(t){return Fs.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){const e=Fs.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){const e=Fs.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}),Object.defineProperty(fd.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(fd.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}}),Object.assign(md.prototype,{set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},intersectObject:function(t,e=!1,n=[]){return vd(t,this,n,e),n.sort(gd),n},intersectObjects:function(t,e=!1,n=[]){for(let r=0,i=t.length;r<i;r++)vd(t[r],this,n,e);return n.sort(gd),n}});class yd{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Hn.clamp(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class _d{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}const xd=new kn;class bd{constructor(t=new kn(1/0,1/0),e=new kn(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=xd.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new kn),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new kn),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new kn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new kn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return xd.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}bd.prototype.isBox2=!0;const wd=new Kn,Md=new Kn;class Sd{constructor(t=new Kn,e=new Kn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Kn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Kn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Kn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){wd.subVectors(t,this.start),Md.subVectors(this.end,this.start);const n=Md.dot(Md);let r=Md.dot(wd)/n;return e&&(r=Hn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Kn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Ed(t){Jr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Ed.prototype=Object.create(Jr.prototype),Ed.prototype.constructor=Ed,Ed.prototype.isImmediateRenderObject=!0;const Td=new Kn;class Ad extends Jr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ji,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,n=32;t<n;t++,e++){const i=t/n*Math.PI*2,o=e/n*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new Di(r,3));const i=new bl({fog:!1,toneMapped:!1});this.cone=new Rl(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Td.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Td),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Ld=new Kn,Cd=new Er,Rd=new Er;class Pd extends Rl{constructor(t){const e=Od(t),n=new ji,r=[],i=[],o=new xi(0,0,1),a=new xi(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(a.r,a.g,a.b))}n.setAttribute("position",new Di(r,3)),n.setAttribute("color",new Di(i,3)),super(n,new bl({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,r=n.getAttribute("position");Rd.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(Cd.multiplyMatrices(Rd,i.matrixWorld),Ld.setFromMatrixPosition(Cd),r.setXYZ(n,Ld.x,Ld.y,Ld.z),Cd.multiplyMatrices(Rd,i.parent.matrixWorld),Ld.setFromMatrixPosition(Cd),r.setXYZ(n+1,Ld.x,Ld.y,Ld.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}function Od(t){const e=[];t&&t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Od(t.children[n]));return e}class Dd extends co{constructor(t,e,n){super(new Ic(e,4,2),new bi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Id=new Kn,Nd=new xi,Bd=new xi;class zd extends Jr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new Rc(e);r.rotateY(.5*Math.PI),this.material=new bi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),o=new Float32Array(3*i.count);r.setAttribute("color",new Si(o,3)),this.add(new co(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Nd.copy(this.light.color),Bd.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const r=t<n/2?Nd:Bd;e.setXYZ(t,r.r,r.g,r.b)}e.needsUpdate=!0}t.lookAt(Id.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Fd extends Rl{constructor(t=10,e=10,n=4473924,r=8947848){n=new xi(n),r=new xi(r);const i=e/2,o=t/e,a=t/2,s=[],l=[];for(let t=0,c=0,u=-a;t<=e;t++,u+=o){s.push(-a,0,u,a,0,u),s.push(u,0,-a,u,0,a);const e=t===i?n:r;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new ji;c.setAttribute("position",new Di(s,3)),c.setAttribute("color",new Di(l,3)),super(c,new bl({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class Hd extends Rl{constructor(t=10,e=16,n=8,r=64,i=4473924,o=8947848){i=new xi(i),o=new xi(o);const a=[],s=[];for(let n=0;n<=e;n++){const r=n/e*(2*Math.PI),l=Math.sin(r)*t,c=Math.cos(r)*t;a.push(0,0,0),a.push(l,0,c);const u=1&n?i:o;s.push(u.r,u.g,u.b),s.push(u.r,u.g,u.b)}for(let e=0;e<=n;e++){const l=1&e?i:o,c=t-t/n*e;for(let t=0;t<r;t++){let e=t/r*(2*Math.PI),n=Math.sin(e)*c,i=Math.cos(e)*c;a.push(n,0,i),s.push(l.r,l.g,l.b),e=(t+1)/r*(2*Math.PI),n=Math.sin(e)*c,i=Math.cos(e)*c,a.push(n,0,i),s.push(l.r,l.g,l.b)}}const l=new ji;l.setAttribute("position",new Di(a,3)),l.setAttribute("color",new Di(s,3)),super(l,new bl({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const kd=new Kn,Ud=new Kn,Gd=new Kn;class Vd extends Jr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let r=new ji;r.setAttribute("position",new Di([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const i=new bl({fog:!1,toneMapped:!1});this.lightPlane=new Al(r,i),this.add(this.lightPlane),r=new ji,r.setAttribute("position",new Di([0,0,0,0,0,1],3)),this.targetLine=new Al(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){kd.setFromMatrixPosition(this.light.matrixWorld),Ud.setFromMatrixPosition(this.light.target.matrixWorld),Gd.subVectors(Ud,kd),this.lightPlane.lookAt(Ud),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Ud),this.targetLine.scale.z=Gd.length()}}const Wd=new Kn,jd=new vo;class qd extends Rl{constructor(t){const e=new ji,n=new bl({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={},a=new xi(16755200),s=new xi(16711680),l=new xi(43775),c=new xi(16777215),u=new xi(3355443);function h(t,e,n){d(t,n),d(e,n)}function d(t,e){r.push(0,0,0),i.push(e.r,e.g,e.b),void 0===o[t]&&(o[t]=[]),o[t].push(r.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),h("c","t",c),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),e.setAttribute("position",new Di(r,3)),e.setAttribute("color",new Di(i,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const t=this.geometry,e=this.pointMap;jd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Xd("c",e,t,jd,0,0,-1),Xd("t",e,t,jd,0,0,1),Xd("n1",e,t,jd,-1,-1,-1),Xd("n2",e,t,jd,1,-1,-1),Xd("n3",e,t,jd,-1,1,-1),Xd("n4",e,t,jd,1,1,-1),Xd("f1",e,t,jd,-1,-1,1),Xd("f2",e,t,jd,1,-1,1),Xd("f3",e,t,jd,-1,1,1),Xd("f4",e,t,jd,1,1,1),Xd("u1",e,t,jd,.7,1.1,-1),Xd("u2",e,t,jd,-.7,1.1,-1),Xd("u3",e,t,jd,0,2,-1),Xd("cf1",e,t,jd,-1,0,1),Xd("cf2",e,t,jd,1,0,1),Xd("cf3",e,t,jd,0,-1,1),Xd("cf4",e,t,jd,0,1,1),Xd("cn1",e,t,jd,-1,0,-1),Xd("cn2",e,t,jd,1,0,-1),Xd("cn3",e,t,jd,0,-1,-1),Xd("cn4",e,t,jd,0,1,-1),t.getAttribute("position").needsUpdate=!0}}function Xd(t,e,n,r,i,o,a){Wd.set(i,o,a).unproject(r);const s=e[t];if(void 0!==s){const t=n.getAttribute("position");for(let e=0,n=s.length;e<n;e++)t.setXYZ(s[e],Wd.x,Wd.y,Wd.z)}}const Yd=new tr;class Zd extends Rl{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new ji;i.setIndex(new Si(n,1)),i.setAttribute("position",new Si(r,3)),super(i,new bl({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Yd.setFromObject(this.object),Yd.isEmpty())return;const e=Yd.min,n=Yd.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return Rl.prototype.copy.call(this,t),this.object=t.object,this}}class Jd extends Rl{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new ji;r.setIndex(new Si(n,1)),r.setAttribute("position",new Di([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new bl({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}class Kd extends Al{constructor(t,e=1,n=16776960){const r=n,i=new ji;i.setAttribute("position",new Di([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),super(i,new bl({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=new ji;o.setAttribute("position",new Di([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new co(o,new bi({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?m:f,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}const Qd=new Kn;let $d,tp;class ep extends Jr{constructor(t=new Kn(0,0,1),e=new Kn(0,0,0),n=1,r=16776960,i=.2*n,o=.2*i){super(),this.type="ArrowHelper",void 0===$d&&($d=new ji,$d.setAttribute("position",new Di([0,0,0,0,1,0],3)),tp=new Wl(0,.5,1,5,1),tp.translate(0,-.5,0)),this.position.copy(e),this.line=new Al($d,new bl({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new co(tp,new bi({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,i,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Qd.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Qd,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class np extends Rl{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ji;n.setAttribute("position",new Di(e,3)),n.setAttribute("color",new Di([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new bl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}const rp=new Float32Array(1),ip=new Int32Array(rp.buffer),op={toHalfFloat:function(t){rp[0]=t;const e=ip[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e,n):i<113?(r|=2048,n|=(r>>114-i)+(r>>113-i&1),n):(n|=i-112<<10|r>>1,n+=1&r,n)}},ap=Math.pow(2,8),sp=[.125,.215,.35,.446,.526,.582],lp=5+sp.length,cp={[Je]:0,[Ke]:1,[$e]:2,[en]:3,[nn]:4,[rn]:5,[Qe]:6},up=new bi({side:m,depthWrite:!1,depthTest:!1}),hp=new co(new ho,up),dp=new lh,{_lodPlanes:pp,_sizeLods:fp,_sigmas:mp}=Sp(),gp=new xi;let vp=null;const yp=(1+Math.sqrt(5))/2,_p=1/yp,xp=[new Kn(1,1,1),new Kn(-1,1,1),new Kn(1,1,-1),new Kn(-1,1,-1),new Kn(0,yp,_p),new Kn(0,yp,-_p),new Kn(_p,0,yp),new Kn(-_p,0,yp),new Kn(yp,_p,0),new Kn(-yp,_p,0)];function bp(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class wp{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(20),n=new Kn(0,1,0);return new Vc({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:cp[Je]},outputEncoding:{value:cp[Je]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}(),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){vp=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Lp(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Ap(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<pp.length;t++)pp[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(vp),t.scissorTest=!1,Tp(t,0,0,t.width,t.height)}_fromTexture(t){vp=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:ft,minFilter:ft,generateMipmaps:!1,type:St,format:Ut,encoding:Mp(t)?t.encoding:$e,depthBuffer:!1},n=Ep(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Ep(e),n}_compileMaterial(t){const e=new co(pp[0],t);this._renderer.compile(e,dp)}_sceneToCubeUV(t,e,n,r){const i=new yo(90,1,e,n),o=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.outputEncoding,u=s.toneMapping;s.getClearColor(gp),s.toneMapping=Q,s.outputEncoding=Je,s.autoClear=!1;let h=!1;const d=t.background;if(d){if(d.isColor){up.color.copy(d).convertSRGBToLinear(),t.background=null;const e=bp(up.color);up.opacity=e,h=!0}}else{up.color.copy(gp).convertSRGBToLinear();const t=bp(up.color);up.opacity=t,h=!0}for(let e=0;e<6;e++){const n=e%3;0==n?(i.up.set(0,o[e],0),i.lookAt(a[e],0,0)):1==n?(i.up.set(0,0,o[e]),i.lookAt(0,a[e],0)):(i.up.set(0,o[e],0),i.lookAt(0,0,a[e])),Tp(r,n*ap,e>2?ap:0,ap,ap),s.setRenderTarget(r),h&&s.render(hp,i),s.render(t,i)}s.toneMapping=u,s.outputEncoding=c,s.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Lp()):null==this._equirectShader&&(this._equirectShader=Ap());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new co(pp[0],r),o=r.uniforms;o.envMap.value=t,t.isCubeTexture||o.texelSize.value.set(1/t.image.width,1/t.image.height),o.inputEncoding.value=cp[t.encoding],o.outputEncoding.value=cp[e.texture.encoding],Tp(e,0,0,3*ap,2*ap),n.setRenderTarget(e),n.render(i,dp)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<lp;e++){const n=Math.sqrt(mp[e]*mp[e]-mp[e-1]*mp[e-1]),r=xp[(e-1)%xp.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,r,"latitudinal",i),this._halfBlur(o,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,o,a){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new co(pp[r],l),u=l.uniforms,h=fp[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;u.envMap.value=t.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===o,a&&(u.poleAxis.value=a),u.dTheta.value=d,u.mipInt.value=8-n,u.inputEncoding.value=cp[t.texture.encoding],u.outputEncoding.value=cp[t.texture.encoding];const v=fp[r];Tp(e,3*Math.max(0,ap-2*v),(0===r?0:2*ap)+2*v*(r>4?r-8+4:0),3*v,2*v),s.setRenderTarget(e),s.render(c,dp)}}function Mp(t){return void 0!==t&&t.type===St&&(t.encoding===Je||t.encoding===Ke||t.encoding===Qe)}function Sp(){const t=[],e=[],n=[];let r=8;for(let i=0;i<lp;i++){const o=Math.pow(2,r);e.push(o);let a=1/o;i>4?a=sp[i-8+4-1]:0==i&&(a=0),n.push(a);const s=1/(o-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*h),v=new Float32Array(f*d*h),y=new Float32Array(m*d*h);for(let t=0;t<h;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,p*d*t),v.set(u,f*d*t);const i=[t,t,t,t,t,t];y.set(i,m*d*t)}const _=new ji;_.setAttribute("position",new Si(g,p)),_.setAttribute("uv",new Si(v,f)),_.setAttribute("faceIndex",new Si(y,m)),t.push(_),r>4&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Ep(t){const e=new Yn(3*ap,3*ap,t);return e.texture.mapping=ct,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Tp(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ap(){const t=new kn(1,1);return new Vc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:cp[Je]},outputEncoding:{value:cp[Je]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}function Lp(){return new Vc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:cp[Je]},outputEncoding:{value:cp[Je]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:_,depthTest:!1,depthWrite:!1})}const Cp=0,Rp=1,Pp=0,Op=1,Dp=2;function Ip(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Np(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Bp(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new zl(t,e)}function zp(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new el(t)}function Fp(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new zl(t,e)}function Hp(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ol(t)}function kp(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ol(t)}function Up(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ol(t)}function Gp(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Kn(t,e,n)}function Vp(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Si(t,e).setUsage(Tn)}function Wp(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ei(t,e)}function jp(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ti(t,e)}function qp(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Ai(t,e)}function Xp(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Li(t,e)}function Yp(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ci(t,e)}function Zp(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ri(t,e)}function Jp(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Pi(t,e)}function Kp(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Di(t,e)}function Qp(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Ii(t,e)}function $p(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new np(t)}function tf(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Zd(t,e)}function ef(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Rl(new Ql(t.geometry),new bl({color:void 0!==e?e:16777215}))}function nf(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Rl(new kc(t.geometry),new bl({color:void 0!==e?e:16777215}))}function rf(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new _u(t)}function of(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Su(t)}function af(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new wo(t,n)}function sf(){console.error("THREE.CanvasRenderer has been removed")}function lf(){console.error("THREE.JSONLoader has been removed.")}Tu.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Tu.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xu.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Fd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Pd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},vu.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gh.extractUrlBase(t)},vu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},bd.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},bd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},bd.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},bd.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},tr.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},tr.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},tr.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},tr.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},tr.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},gr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},To.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Sd.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Hn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Hn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Hn.floorPowerOfTwo(t)},Hn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Hn.ceilPowerOfTwo(t)},Un.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Un.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Un.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Un.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Un.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Un.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Er.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Er.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Er.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Kn).setFromMatrixColumn(this,3)},Er.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Er.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Er.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Er.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Er.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Er.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Er.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Er.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Er.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Er.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Er.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Er.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Er.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Er.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Er.prototype.makeFrustum=function(t,e,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,o)},Er.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},ti.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Jn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Jn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Sr.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sr.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},Sr.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},hi.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},hi.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},hi.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},hi.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},hi.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},hi.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),hi.getBarycoord(t,e,n,r,i)},hi.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),hi.getNormal(t,e,n,r)},Yu.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yu.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Tc(this,t)},Yu.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Dc(this,t)},kn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},kn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},kn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Kn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Kn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Kn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Kn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Kn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Kn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Kn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Kn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Kn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Xn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Jr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Jr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Jr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Jr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Jr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Jr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),co.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(co.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Xe},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(ol.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ml.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),hl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Tu.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),yo.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(Si.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Tn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Tn)}}}),Si.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Tn:En),this},Si.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Si.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ji.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ji.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new Si(arguments[1],arguments[2])))},ji.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ji.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ji.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ji.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ji.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ji.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(vh.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(md.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(Fs.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Tn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),Fs.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Tn:En),this},Fs.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Tc.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Tc.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Tc.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},zs.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(dd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(pi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===v}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(qc.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(jc.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(go.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Ds.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},Ds.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Ds.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Ds.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Ds.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Ds.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Ds.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Ds.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Ds.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Ds.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Ds.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Ds.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Ds.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Ds.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Ds.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Ds.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Ds.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Ds.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Ds.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Ds.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Ds.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Ds.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Ds.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Ds.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Ds.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Ds.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ke:Je}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ss.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Yn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(Wh.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Ph).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Jh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},xo.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},xo.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Vn.crossOrigin=void 0,Vn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new Eu;i.setCrossOrigin(this.crossOrigin);const o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},Vn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new Mu;i.setCrossOrigin(this.crossOrigin);const o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},Vn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Vn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const cf={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function uf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:r}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=r)},886:(t,e,n)=>{"use strict";n.r(e),n.d(e,{OrbitControls:()=>i,MapControls:()=>o});var r=n(212),i=function(t,e){var n,i,o,a,s,l;void 0===e&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new r.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:r.MOUSE.ROTATE,MIDDLE:r.MOUSE.DOLLY,RIGHT:r.MOUSE.PAN},this.touches={ONE:r.TOUCH.ROTATE,TWO:r.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return g.phi},this.getAzimuthalAngle=function(){return g.theta},this.listenToKeyEvents=function(t){t.addEventListener("keydown",K),this._domElementKeyEvents=t},this.saveState=function(){c.target0.copy(c.target),c.position0.copy(c.object.position),c.zoom0=c.object.zoom},this.reset=function(){c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.zoom=c.zoom0,c.object.updateProjectionMatrix(),c.dispatchEvent(u),c.update(),f=p.NONE},this.update=(n=new r.Vector3,i=(new r.Quaternion).setFromUnitVectors(t.up,new r.Vector3(0,1,0)),o=i.clone().invert(),a=new r.Vector3,s=new r.Quaternion,l=2*Math.PI,function(){var t=c.object.position;n.copy(t).sub(c.target),n.applyQuaternion(i),g.setFromVector3(n),c.autoRotate&&f===p.NONE&&P(2*Math.PI/60/60*c.autoRotateSpeed),c.enableDamping?(g.theta+=v.theta*c.dampingFactor,g.phi+=v.phi*c.dampingFactor):(g.theta+=v.theta,g.phi+=v.phi);var e=c.minAzimuthAngle,r=c.maxAzimuthAngle;return isFinite(e)&&isFinite(r)&&(e<-Math.PI?e+=l:e>Math.PI&&(e-=l),r<-Math.PI?r+=l:r>Math.PI&&(r-=l),g.theta=e<=r?Math.max(e,Math.min(r,g.theta)):g.theta>(e+r)/2?Math.max(e,g.theta):Math.min(r,g.theta)),g.phi=Math.max(c.minPolarAngle,Math.min(c.maxPolarAngle,g.phi)),g.makeSafe(),g.radius*=y,g.radius=Math.max(c.minDistance,Math.min(c.maxDistance,g.radius)),!0===c.enableDamping?c.target.addScaledVector(_,c.dampingFactor):c.target.add(_),n.setFromSpherical(g),n.applyQuaternion(o),t.copy(c.target).add(n),c.object.lookAt(c.target),!0===c.enableDamping?(v.theta*=1-c.dampingFactor,v.phi*=1-c.dampingFactor,_.multiplyScalar(1-c.dampingFactor)):(v.set(0,0,0),_.set(0,0,0)),y=1,!!(x||a.distanceToSquared(c.object.position)>m||8*(1-s.dot(c.object.quaternion))>m)&&(c.dispatchEvent(u),a.copy(c.object.position),s.copy(c.object.quaternion),x=!1,!0)}),this.dispose=function(){c.domElement.removeEventListener("contextmenu",et),c.domElement.removeEventListener("pointerdown",X),c.domElement.removeEventListener("wheel",J),c.domElement.removeEventListener("touchstart",Q),c.domElement.removeEventListener("touchend",tt),c.domElement.removeEventListener("touchmove",$),c.domElement.ownerDocument.removeEventListener("pointermove",Y),c.domElement.ownerDocument.removeEventListener("pointerup",Z),null!==c._domElementKeyEvents&&c._domElementKeyEvents.removeEventListener("keydown",K)};var c=this,u={type:"change"},h={type:"start"},d={type:"end"},p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=p.NONE,m=1e-6,g=new r.Spherical,v=new r.Spherical,y=1,_=new r.Vector3,x=!1,b=new r.Vector2,w=new r.Vector2,M=new r.Vector2,S=new r.Vector2,E=new r.Vector2,T=new r.Vector2,A=new r.Vector2,L=new r.Vector2,C=new r.Vector2;function R(){return Math.pow(.95,c.zoomSpeed)}function P(t){v.theta-=t}function O(t){v.phi-=t}var D,I=(D=new r.Vector3,function(t,e){D.setFromMatrixColumn(e,0),D.multiplyScalar(-t),_.add(D)}),N=function(){var t=new r.Vector3;return function(e,n){!0===c.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(c.object.up,t)),t.multiplyScalar(e),_.add(t)}}(),B=function(){var t=new r.Vector3;return function(e,n){var r=c.domElement;if(c.object.isPerspectiveCamera){var i=c.object.position;t.copy(i).sub(c.target);var o=t.length();o*=Math.tan(c.object.fov/2*Math.PI/180),I(2*e*o/r.clientHeight,c.object.matrix),N(2*n*o/r.clientHeight,c.object.matrix)}else c.object.isOrthographicCamera?(I(e*(c.object.right-c.object.left)/c.object.zoom/r.clientWidth,c.object.matrix),N(n*(c.object.top-c.object.bottom)/c.object.zoom/r.clientHeight,c.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),c.enablePan=!1)}}();function z(t){c.object.isPerspectiveCamera?y/=t:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom*t)),c.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function F(t){c.object.isPerspectiveCamera?y*=t:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom/t)),c.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function H(t){b.set(t.clientX,t.clientY)}function k(t){S.set(t.clientX,t.clientY)}function U(t){if(1==t.touches.length)b.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);b.set(e,n)}}function G(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,n)}}function V(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);A.set(0,r)}function W(t){if(1==t.touches.length)w.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);w.set(e,n)}M.subVectors(w,b).multiplyScalar(c.rotateSpeed);var r=c.domElement;P(2*Math.PI*M.x/r.clientHeight),O(2*Math.PI*M.y/r.clientHeight),b.copy(w)}function j(t){if(1==t.touches.length)E.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);E.set(e,n)}T.subVectors(E,S).multiplyScalar(c.panSpeed),B(T.x,T.y),S.copy(E)}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);L.set(0,r),C.set(0,Math.pow(L.y/A.y,c.zoomSpeed)),z(C.y),A.copy(L)}function X(t){if(!1!==c.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var e;switch(t.preventDefault(),c.domElement.focus?c.domElement.focus():window.focus(),t.button){case 0:e=c.mouseButtons.LEFT;break;case 1:e=c.mouseButtons.MIDDLE;break;case 2:e=c.mouseButtons.RIGHT;break;default:e=-1}switch(e){case r.MOUSE.DOLLY:if(!1===c.enableZoom)return;!function(t){A.set(t.clientX,t.clientY)}(t),f=p.DOLLY;break;case r.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===c.enablePan)return;k(t),f=p.PAN}else{if(!1===c.enableRotate)return;H(t),f=p.ROTATE}break;case r.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===c.enableRotate)return;H(t),f=p.ROTATE}else{if(!1===c.enablePan)return;k(t),f=p.PAN}break;default:f=p.NONE}f!==p.NONE&&(c.domElement.ownerDocument.addEventListener("pointermove",Y),c.domElement.ownerDocument.addEventListener("pointerup",Z),c.dispatchEvent(h))}(t)}}function Y(t){if(!1!==c.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){if(!1!==c.enabled)switch(t.preventDefault(),f){case p.ROTATE:if(!1===c.enableRotate)return;!function(t){w.set(t.clientX,t.clientY),M.subVectors(w,b).multiplyScalar(c.rotateSpeed);var e=c.domElement;P(2*Math.PI*M.x/e.clientHeight),O(2*Math.PI*M.y/e.clientHeight),b.copy(w),c.update()}(t);break;case p.DOLLY:if(!1===c.enableZoom)return;!function(t){L.set(t.clientX,t.clientY),C.subVectors(L,A),C.y>0?z(R()):C.y<0&&F(R()),A.copy(L),c.update()}(t);break;case p.PAN:if(!1===c.enablePan)return;!function(t){E.set(t.clientX,t.clientY),T.subVectors(E,S).multiplyScalar(c.panSpeed),B(T.x,T.y),S.copy(E),c.update()}(t)}}(t)}}function Z(t){switch(t.pointerType){case"mouse":case"pen":c.domElement.ownerDocument.removeEventListener("pointermove",Y),c.domElement.ownerDocument.removeEventListener("pointerup",Z),!1!==c.enabled&&(c.dispatchEvent(d),f=p.NONE)}}function J(t){!1===c.enabled||!1===c.enableZoom||f!==p.NONE&&f!==p.ROTATE||(t.preventDefault(),t.stopPropagation(),c.dispatchEvent(h),function(t){t.deltaY<0?F(R()):t.deltaY>0&&z(R()),c.update()}(t),c.dispatchEvent(d))}function K(t){!1!==c.enabled&&!1!==c.enablePan&&function(t){var e=!1;switch(t.keyCode){case c.keys.UP:B(0,c.keyPanSpeed),e=!0;break;case c.keys.BOTTOM:B(0,-c.keyPanSpeed),e=!0;break;case c.keys.LEFT:B(c.keyPanSpeed,0),e=!0;break;case c.keys.RIGHT:B(-c.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),c.update())}(t)}function Q(t){if(!1!==c.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(c.touches.ONE){case r.TOUCH.ROTATE:if(!1===c.enableRotate)return;U(t),f=p.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(!1===c.enablePan)return;G(t),f=p.TOUCH_PAN;break;default:f=p.NONE}break;case 2:switch(c.touches.TWO){case r.TOUCH.DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(t){c.enableZoom&&V(t),c.enablePan&&G(t)}(t),f=p.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(t){c.enableZoom&&V(t),c.enableRotate&&U(t)}(t),f=p.TOUCH_DOLLY_ROTATE;break;default:f=p.NONE}break;default:f=p.NONE}f!==p.NONE&&c.dispatchEvent(h)}}function $(t){if(!1!==c.enabled)switch(t.preventDefault(),t.stopPropagation(),f){case p.TOUCH_ROTATE:if(!1===c.enableRotate)return;W(t),c.update();break;case p.TOUCH_PAN:if(!1===c.enablePan)return;j(t),c.update();break;case p.TOUCH_DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(t){c.enableZoom&&q(t),c.enablePan&&j(t)}(t),c.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(t){c.enableZoom&&q(t),c.enableRotate&&W(t)}(t),c.update();break;default:f=p.NONE}}function tt(t){!1!==c.enabled&&(c.dispatchEvent(d),f=p.NONE)}function et(t){!1!==c.enabled&&t.preventDefault()}c.domElement.addEventListener("contextmenu",et),c.domElement.addEventListener("pointerdown",X),c.domElement.addEventListener("wheel",J),c.domElement.addEventListener("touchstart",Q),c.domElement.addEventListener("touchend",tt),c.domElement.addEventListener("touchmove",$),this.update()};i.prototype=Object.create(r.EventDispatcher.prototype),i.prototype.constructor=i;var o=function(t,e){i.call(this,t,e),this.screenSpacePanning=!1,this.mouseButtons.LEFT=r.MOUSE.PAN,this.mouseButtons.RIGHT=r.MOUSE.ROTATE,this.touches.ONE=r.TOUCH.PAN,this.touches.TWO=r.TOUCH.DOLLY_ROTATE};o.prototype=Object.create(r.EventDispatcher.prototype),o.prototype.constructor=o},637:(t,e,n)=>{"use strict";n.d(e,{j:()=>i});var r=n(212),i=function(t){r.Loader.call(this,t)};i.prototype=Object.assign(Object.create(r.Loader.prototype),{constructor:i,load:function(t,e,n,i){var o=this,a=new r.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{e(o.parse(n))}catch(e){i?i(e):console.error(e),o.manager.itemError(t)}}),n,i)},parse:function(t){function e(t,e,n){for(var r=0,i=t.length;r<i;r++)if(t[r]!==e.getUint8(n+r,!1))return!1;return!0}var n,i=function(t){if("string"==typeof t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=255&t.charCodeAt(n);return e.buffer||e}return t}(t);return function(t){var n;if(84+50*(n=new DataView(t)).getUint32(80,!0)===n.byteLength)return!0;for(var r=[115,111,108,105,100],i=0;i<5;i++)if(e(r,n,i))return!1;return!0}(i)?function(t){for(var e,n,i,o,a,s,l,c,u=new DataView(t),h=u.getUint32(80,!0),d=!1,p=0;p<70;p++)1129270351==u.getUint32(p,!1)&&82==u.getUint8(p+4)&&61==u.getUint8(p+5)&&(d=!0,o=new Float32Array(3*h*3),a=u.getUint8(p+6)/255,s=u.getUint8(p+7)/255,l=u.getUint8(p+8)/255,c=u.getUint8(p+9)/255);for(var f=new r.BufferGeometry,m=new Float32Array(3*h*3),g=new Float32Array(3*h*3),v=0;v<h;v++){var y=84+50*v,_=u.getFloat32(y,!0),x=u.getFloat32(y+4,!0),b=u.getFloat32(y+8,!0);if(d){var w=u.getUint16(y+48,!0);0==(32768&w)?(e=(31&w)/31,n=(w>>5&31)/31,i=(w>>10&31)/31):(e=a,n=s,i=l)}for(var M=1;M<=3;M++){var S=y+12*M,E=3*v*3+3*(M-1);m[E]=u.getFloat32(S,!0),m[E+1]=u.getFloat32(S+4,!0),m[E+2]=u.getFloat32(S+8,!0),g[E]=_,g[E+1]=x,g[E+2]=b,d&&(o[E]=e,o[E+1]=n,o[E+2]=i)}}return f.setAttribute("position",new r.BufferAttribute(m,3)),f.setAttribute("normal",new r.BufferAttribute(g,3)),d&&(f.setAttribute("color",new r.BufferAttribute(o,3)),f.hasColors=!0,f.alpha=c),f}(i):function(t){for(var e,n=new r.BufferGeometry,i=/solid([\s\S]*?)endsolid/g,o=/facet([\s\S]*?)endfacet/g,a=0,s=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,l=new RegExp("vertex"+s+s+s,"g"),c=new RegExp("normal"+s+s+s,"g"),u=[],h=[],d=new r.Vector3,p=0,f=0,m=0;null!==(e=i.exec(t));){f=m;for(var g=e[0];null!==(e=o.exec(g));){for(var v=0,y=0,_=e[0];null!==(e=c.exec(_));)d.x=parseFloat(e[1]),d.y=parseFloat(e[2]),d.z=parseFloat(e[3]),y++;for(;null!==(e=l.exec(_));)u.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),h.push(d.x,d.y,d.z),v++,m++;1!==y&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+a),3!==v&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+a),a++}var x=f,b=m-f;n.addGroup(x,b,p),p++}return n.setAttribute("position",new r.Float32BufferAttribute(u,3)),n.setAttribute("normal",new r.Float32BufferAttribute(h,3)),n}("string"!=typeof(n=t)?r.LoaderUtils.decodeText(new Uint8Array(n)):n)}})},550:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},a=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var l=o(n(376)),c=n(486),u=s(n(273)),h=o(n(212)),d=n(886),p=n(386),f=n(962),m=n(153);n(307);var g=n(602),v=0,y=!1,_=[],x=null,b=!1,w=[f.houseColor,f.houseColor,f.houseColor,f.cupolaColor],M=function(t){return t%2==0},S=(0,c.range)(0,2).map((function(){return{}})),E=["M","F"],T=(new l.GUI,document.querySelector("canvas.webgl")),A=new h.Scene;A.background=new h.Color(f.skyColor);var L=new h.MeshPhongMaterial({color:new h.Color(f.floorColor)}),C=new h.Mesh(new h.PlaneGeometry(1e4,1e4),L);C.position.y=-3,C.rotation.x=-Math.PI/2,C.receiveShadow=!0,A.add(C);var R,P,O,D,I,N=new h.Group;(0,p.getBoard)().then((function(t){R=t,N.add(R)})),(0,m.getLv1House)().then((function(t){P=t,N.add(P),_[0]=P})),(0,m.getLv2House)().then((function(t){O=t,N.add(O),_[1]=O})),(0,m.getLv3House)().then((function(t){D=t,N.add(D),_[2]=D})),(0,m.getCupola)().then((function(t){I=t,N.add(I),_[3]=I})),(0,g.getFemaleWorker)().then((function(t){(0,c.range)(0,2).forEach((function(e){S[e].F=t.clone(),S[e].F.material=t.material.clone(),S[e].F.material.color.setHex(g.workerColorMap[Number(M(e))]),S[e].F.position.x=-1*e,S[e].F.position.z=-15,N.add(S[e].F)}))})),(0,g.getMaleWorker)().then((function(t){(0,c.range)(0,2).forEach((function(e){S[e].M=t.clone(),S[e].M.material=t.material.clone(),S[e].M.material.color.setHex(g.workerColorMap[Number(M(e))]),S[e].M.position.x=-1*e,S[e].M.position.z=-10,N.add(S[e].M)}))})),A.add(N);var B=new h.HemisphereLight(f.skyColor,f.groundColor,.3);B.position.set(25,45,25),A.add(B);var z=new h.AmbientLight(f.lightColor,.4);A.add(z);var F=new h.DirectionalLight(16050587,.7);F.castShadow=!0,F.position.set(25,40,25),F.shadow.mapSize.width=1024,F.shadow.mapSize.height=1024,F.shadow.camera.near=1,F.shadow.camera.far=100,F.target.position.set(0,0,0),A.add(F),A.add(F.target);var H={width:window.innerWidth,height:window.innerHeight};window.addEventListener("resize",(function(){H.width=window.innerWidth,H.height=window.innerHeight,G.aspect=H.width/H.height,G.updateProjectionMatrix(),W.setSize(H.width,H.height),W.setPixelRatio(Math.min(window.devicePixelRatio,2))}));var k=new h.Vector2,U=new h.Raycaster,G=new h.PerspectiveCamera(75,H.width/H.height,.1,100);G.position.x=0,G.position.y=0,G.position.z=10,A.add(G),new h.AxesHelper(5);var V=new d.OrbitControls(G,T);V.enableDamping=!0,V.minPolarAngle=Math.PI/4,V.maxPolarAngle=Math.PI/2,V.maxAzimuthAngle=Math.PI/4,V.minDistance=.1,V.maxDistance=30,V.mouseButtons={LEFT:2,MIDDLE:1,RIGHT:0},V.enablePan=!1;var W=new h.WebGLRenderer({canvas:T});function j(){document.querySelector("#menu").innerHTML="Selected worker ".concat(x?"M"===x?"Male":"Female":"none"," <br> Player state: ").concat(JSON.stringify(ft)),W.render(A,G),y=!0}W.setSize(H.width,H.height),W.setPixelRatio(Math.min(window.devicePixelRatio,2)),W.shadowMap.enabled=!0,W.shadowMap.type=h.PCFShadowMap;var q,X=[],Y=function(t){return t*f.boardScale},Z=Y(3),J=Y(112),K=Y(20),Q=Y(1),$=K-2*Q,tt=Y(8),et=Y(5.5),nt=Y(10),rt=Y(16),it=Y(13),ot=[rt+.1,it,nt],at=Y(6.5),st=Y(9.75),lt=Y(10),ct=[{x:0,y:0,z:0},{x:Q+.05,y:rt,z:-(.05+Q)},{x:Q+.05,y:rt+it,z:-(.05+Q)},{x:tt+Q,y:rt+it+nt,z:-Q-et}];!function(t){t[t.Init1=0]="Init1",t[t.Init2=1]="Init2",t[t.House1=10]="House1",t[t.House2=11]="House2",t[t.Move1=20]="Move1",t[t.Move2=21]="Move2",t[t.Finish=30]="Finish"}(q||(q={}));var ut=q.Init1;function ht(){if(0===X.length)for(var t=0;t<5;t++)for(var e=t*(K+Z)-J/2,n=0;n<5;n++){var r=n*(K+Z)-J/2;X.push({x:[e,e+K],z:[r,r+K],i:t,j:n})}}var dt=null,pt=(0,c.range)(0,25).map((function(){return[]})),ft=(0,c.range)(0,2).map((function(){return{M:-1,F:-1}}));function mt(t){return ft[t]}function gt(t,e){return mt(e).M===t||mt(e).F===t}function vt(t){return(0,c.range)(0,2).some((function(e){return gt(t,e)}))}function yt(t,e){if(E.includes(e)){var n=S[t][e];n.material.opacity=1,n.receiveShadow=!0,n.castShadow=!0,n.material.transparent=!1}}function _t(t,e,n){ft[t][e]=n}function xt(t,e){return t.findIndex((function(t){var n=t.x,r=t.z;return e[0].point.x>=n[0]&&e[0].point.x<=n[1]&&e[0].point.z>=r[0]&&e[0].point.z<=r[1]}))}function bt(){var t,e=((t={})[q.Init1]=q.Init2,t[q.Init2]=q.Move1,t[q.House1]=q.Move2,t[q.Move1]=q.House1,t[q.House2]=q.Move1,t[q.Move2]=q.House2,t);ut=e[ut]}function wt(t,e,n,r){if(void 0===n&&(n="M"),void 0===r&&(r=!0),!E.includes(n))throw new Error("type must be M or F");var i=S[e][n];r?i.material.color.setHex(g.workerColorMap[e]):i.material.color.setHex(16738657),i.material.transparent=!0,i.material.opacity=.8,i.position.x=X[t].x[0]+st,i.position.z=X[t].z[0]+lt,i.position.y=at}function Mt(t){return Number(String(t).split("").slice(-1)[0])}function St(t){return{x:t%5,y:Math.floor(t/5)}}var Et=function(t,e){var n=St(t),r=St(e);return Math.sqrt(Math.pow(n.x-r.x,2)+Math.pow(n.y-r.y,2))};W.domElement.addEventListener("click",(function(t){var e;if(y){t.preventDefault(),ht(),k.x=t.clientX/window.innerWidth*2-1,k.y=-t.clientY/window.innerHeight*2+1,U.setFromCamera(k,G);var n=U.intersectObject(R,!0);if(n[0]){var r=xt(X,n);if(dt===r){switch(console.log("selectedIndex",dt,"closestIndex",r),ut){case q.Init1:case q.Init2:var i=Mt(ut);if(vt(r))return;if(yt(i,s=v<2?"M":"F"),_t(i,s,r),3==v)bt();else{var o=((e={})[q.Init1]=q.Init2,e[q.Init2]=q.Init1,e);v++,ut=o[ut]}break;case q.House1:case q.House2:if(!b)break;!function(t,e){if(void 0===e&&(e=0),!(e>3)){var n=_[e],r=n.clone();n.material.opacity=0,r.material=n.material.clone(),r.material.opacity=1,r.receiveShadow=!0,r.castShadow=!0,r.material.transparent=!1,0===e&&(0,c.random)(0,10)%2==0&&(r.rotateY([Math.PI/2]),r.translateZ($)),pt[t]=a(a([],pt[t],!0),[r],!1),A.add(r)}}(r,pt[r].length),bt();break;case q.Move1:case q.Move2:if(x){if(b){var s=x;yt(i=Mt(ut),s),_t(i,s,r),x=null,3===pt[r].length&&(alert("Player ".concat(i," has won!")),ut=q.Finish),bt()}}else{var l=mt(i=Mt(ut));l.M===r?x="M":l.F===r&&(x="F"),console.log("selected worker state",x)}}dt=null}}j()}})),W.domElement.addEventListener("mousemove",(function(t){if(t.preventDefault(),y){ht(),k.x=t.clientX/window.innerWidth*2-1,k.y=-t.clientY/window.innerHeight*2+1,U.setFromCamera(k,G);var e=U.intersectObject(R,!0);if(e[0]){var n=xt(X,e);if(-1!==n){switch(ut){case q.Init1:case q.Init2:wt(n,i=Mt(ut),h=v<2?"M":"F",!vt(n)),j();break;case q.House1:case q.House2:P.material.opacity=0,O.material.opacity=0,D.material.opacity=0,I.material.opacity=0;var r=pt[n].length,i=Mt(ut),o=ft[i].F,a=ft[i].M,s=pt[n].length,l=Et(n,o),u=Et(n,a);b=!vt(n)&&(l<=1.5||u<=1.5)&&s<4,function(t,e,n,r){if(void 0===e&&(e=0),void 0===r&&(r=!0),!(e>3)){var i=_[e];i.material.opacity=.5,r?i.material.color.setHex(w[e]):i.material.color.setHex(16738657),i.position.x=X[t].x[0]+Q+n.x,i.position.z=X[t].z[0]+K-Q+n.z,i.position.y=n.y}}(n,r,ct[r],b),j();break;case q.Move1:case q.Move2:if(i=Mt(ut),(0,c.range)(0,2).forEach((function(t){S[t].F.material.color.setHex(g.workerColorMap[t]),S[t].M.material.color.setHex(g.workerColorMap[t])})),!function(t){var e=mt(t),n=e.F,r=e.M,i=St(n),o=St(r);return(0,c.range)(0,25).filter((function(e){var n=St(e),r=n.x===i.x-1&&n.y===i.y||n.x===i.x+1&&n.y===i.y||n.x===i.x&&n.y===i.y-1||n.x===i.x&&n.y===i.y+1,a=n.x===o.x-1&&n.y===o.y||n.x===o.x+1&&n.y===o.y||n.x===o.x&&n.y===o.y-1||n.x===o.x&&n.y===o.y+1;return!(!r&&!a)&&["M","F"].some((function(n){var r=ft[t][n],i=pt[e].length,o=pt[r].length,a=Et(e,r);return!(!(Math.abs(o-i)<=1)||vt(e)||a>=1.5||i>3)}))})).length>0}(i)){ut=q.Finish,alert("You cannot step on any tile Player ".concat(i," loose."));break}if(x){var h=x,d=ft[i][h],p=(s=pt[n].length,pt[d].length),f=Et(n,d),m=Math.abs(p-s)<=1;wt(n,i,h,b=!vt(n)&&f<=1.5&&s<4&&m),function(t,e){if(0===e)return function(t){t.position.y=at}(t);t.position.y=at+ot.slice(0,e).reduce((function(t,e){return t+e}),0)-Y(1)}(S[i][h],s)}else gt(n,i)&&S[i][function(t,e){var n=mt(e);return n.M===t?"M":n.F===t?"F":""}(n,i)].material.color.setHex(65280);j()}dt=n}}}})),W.domElement.addEventListener("contextmenu",(function(t){if(t.preventDefault(),null!==x){var e=Mt(ut);wt(ft[e][x],e,x,!0),yt(e,x),x=null,j()}})),V.addEventListener("change",j),document.addEventListener("load",j),setTimeout(j,1e3),u.default.configure({projectRoot:"/Users/mac/Projects/games/santorini"})}},e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),n(550)})();
3//# sourceMappingURL=bundle.13f89e5b1721ed5ba87d.js.map