-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcones.html
1 lines (1 loc) · 728 KB
/
cones.html
1
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,shrink-to-fit=0,user-scalable=no,minimum-scale=1,maximum-scale=1"><title>cones</title><style>html{width:100%;height:100%;display:flex;justify-content:center;align-items:center;flex-direction:column}body{width:100%;height:100%;display:flex;justify-content:center;align-items:center;flex-direction:row;margin:0}canvas{margin:auto;display:block;box-shadow:0 2px 12px -2px rgba(0,0,0,.15)}</style><body><script>!function(){return function e(t,n,i){function r(o,s){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){return r(t[o][1][e]||e)},u,u.exports,e,t,n,i)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<i.length;o++)r(i[o]);return r}}()({1:[function(e,t,n){(function(t){const n=e("canvas-sketch"),i=e("dat.gui");t.THREE=e("three"),e("three/examples/js/exporters/OBJExporter"),e("three/examples/js/exporters/GLTFExporter"),e("three/examples/js/utils/BufferGeometryUtils"),e("three/examples/js/controls/OrbitControls");n(({context:e})=>{const t=new THREE.WebGLRenderer({context:e});t.setClearColor("#000",1);const n=new THREE.PerspectiveCamera(45,1,.01,100);n.position.set(2,2,-4),n.lookAt(new THREE.Vector3);const r=new THREE.OrbitControls(n,e.canvas),a=new THREE.Scene;var o=new THREE.ConeBufferGeometry(1,1,32),s=new THREE.MeshStandardMaterial({color:16776960});const c=new THREE.Mesh(o,s),l=new THREE.Object3D;l.add(c),c.position.set(0,.5,0),a.add(l);var u=new THREE.ConeBufferGeometry(1,1,32),h=new THREE.MeshStandardMaterial({color:16776960,flatShading:!1});THREE.BufferGeometryUtils.mergeVertices(u),u.computeVertexNormals();const d=new THREE.Mesh(u,h),p=new THREE.Object3D;p.add(d),a.add(p),d.position.set(0,.5,0),p.rotation.set(Math.PI,0,0),a.add(new THREE.AmbientLight(819));const f=new THREE.PointLight("#ffffff",5,15.5);f.position.set(2,2,-4).multiplyScalar(1.5),a.add(f);const m=new i.GUI,g={topSize:2,topColor:"#FF0000",bottomSize:1,bottomColor:"#FFFFFF",spacing:.3,downloadObj:()=>{const e=(new THREE.OBJExporter).parse(a),t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,document.body.appendChild(i),i.download="tris.obj",i.click(),console.log(e)},downloadGltf:()=>{const e=(new THREE.GLTFExporter).parse(a,t=>{const n=new Blob([t],{type:"text/plain"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,document.body.appendChild(r),r.download="tris.glb",r.click(),console.log(e)},{binary:!0})}};return l.scale.setY(g.topSize),s.color.set(g.topColor),p.scale.setY(g.bottomSize),h.color.set(g.bottomColor),l.position.setY(g.spacing),m.add(g,"topSize",0,5).onChange(e=>{l.scale.setY(e)}),m.addColor(g,"topColor").onChange(e=>{s.color.set(e)}),m.add(g,"bottomSize",0,5).onChange(e=>{p.scale.setY(e)}),m.addColor(g,"bottomColor").onChange(e=>{h.color.set(e)}),m.add(g,"spacing",0,1).onChange(e=>{l.position.setY(e)}),m.add(g,"downloadObj"),m.add(g,"downloadGltf"),{resize({pixelRatio:e,viewportWidth:i,viewportHeight:r}){t.setPixelRatio(e),t.setSize(i,r),n.aspect=i/r,n.updateProjectionMatrix()},render({}){r.update(),t.render(a,n)},unload(){r.dispose(),t.dispose()}}},{animate:!0,context:"webgl",attributes:{antialias:!0}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"canvas-sketch":2,"dat.gui":4,three:6,"three/examples/js/controls/OrbitControls":7,"three/examples/js/exporters/GLTFExporter":8,"three/examples/js/exporters/OBJExporter":9,"three/examples/js/utils/BufferGeometryUtils":10}],2:[function(e,t,n){(function(i){!function(i,r){"object"==typeof n&&void 0!==t?t.exports=r(e("convert-length")):"function"==typeof define&&define.amd?define(["convert-length"],r):i.canvasSketch=r(null)}(this,function(e){e=e&&e.hasOwnProperty("default")?e.default:e;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;var a=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var a,o,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var l in a=Object(arguments[c]))n.call(a,l)&&(s[l]=a[l]);if(t){o=t(a);for(var u=0;u<o.length;u++)r.call(a,o[u])&&(s[o[u]]=a[o[u]])}}return s},o="undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:{};function s(e,t){return e(t={exports:{}},t.exports),t.exports}var c=o.performance&&o.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date},l=function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then};var u=function(e){return!(!e||"object"!=typeof e)&&("object"==typeof window&&"object"==typeof window.Node?e instanceof window.Node:"number"==typeof e.nodeType&&"string"==typeof e.nodeName)};function h(){return"undefined"!=typeof window&&window["canvas-sketch-cli"]}function d(){for(var e=arguments,t=0;t<arguments.length;t++)if(null!=e[t])return e[t]}function p(){return"undefined"!=typeof document}var f,m=s(function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}(e.exports="function"==typeof Object.keys?Object.keys:n).shim=n}),g=s(function(e,t){var n="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function i(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}(t=e.exports=n?i:r).supported=i,t.unsupported=r}),v=s(function(e){var t=Array.prototype.slice,n=e.exports=function(e,a,o){return o||(o={}),e===a||(e instanceof Date&&a instanceof Date?e.getTime()===a.getTime():!e||!a||"object"!=typeof e&&"object"!=typeof a?o.strict?e===a:e==a:function(e,a,o){var s,c;if(i(e)||i(a))return!1;if(e.prototype!==a.prototype)return!1;if(g(e))return!!g(a)&&(e=t.call(e),a=t.call(a),n(e,a,o));if(r(e)){if(!r(a))return!1;if(e.length!==a.length)return!1;for(s=0;s<e.length;s++)if(e[s]!==a[s])return!1;return!0}try{var l=m(e),u=m(a)}catch(e){return!1}if(l.length!=u.length)return!1;for(l.sort(),u.sort(),s=l.length-1;s>=0;s--)if(l[s]!=u[s])return!1;for(s=l.length-1;s>=0;s--)if(!n(e[c=l[s]],a[c],o))return!1;return typeof e==typeof a}(e,a,o))};function i(e){return null==e}function r(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}}),y=s(function(e,t){!function(t){var n,i,r,a=(n=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|"[^"]*"|'[^']*'/g,i=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,r=/[^-+\dA-Z]/g,function(e,t,s,c){if(1!==arguments.length||"string"!==(null===(l=e)?"null":void 0===l?"undefined":"object"!=typeof l?typeof l:Array.isArray(l)?"array":{}.toString.call(l).slice(8,-1).toLowerCase())||/\d/.test(e)||(t=e,e=void 0),(e=e||new Date)instanceof Date||(e=new Date(e)),isNaN(e))throw TypeError("Invalid date");var l,u=(t=String(a.masks[t]||t||a.masks.default)).slice(0,4);"UTC:"!==u&&"GMT:"!==u||(t=t.slice(4),s=!0,"GMT:"===u&&(c=!0));var h=s?"getUTC":"get",d=e[h+"Date"](),p=e[h+"Day"](),f=e[h+"Month"](),m=e[h+"FullYear"](),g=e[h+"Hours"](),v=e[h+"Minutes"](),y=e[h+"Seconds"](),x=e[h+"Milliseconds"](),_=s?0:e.getTimezoneOffset(),b=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var i=t.getTimezoneOffset()-n.getTimezoneOffset();return t.setHours(t.getHours()-i),1+Math.floor((t-n)/6048e5)}(e),w=function(e){var t=e.getDay();return 0===t&&(t=7),t}(e),M={d:d,dd:o(d),ddd:a.i18n.dayNames[p],dddd:a.i18n.dayNames[p+7],m:f+1,mm:o(f+1),mmm:a.i18n.monthNames[f],mmmm:a.i18n.monthNames[f+12],yy:String(m).slice(2),yyyy:m,h:g%12||12,hh:o(g%12||12),H:g,HH:o(g),M:v,MM:o(v),s:y,ss:o(y),l:o(x,3),L:o(Math.round(x/10)),t:g<12?a.i18n.timeNames[0]:a.i18n.timeNames[1],tt:g<12?a.i18n.timeNames[2]:a.i18n.timeNames[3],T:g<12?a.i18n.timeNames[4]:a.i18n.timeNames[5],TT:g<12?a.i18n.timeNames[6]:a.i18n.timeNames[7],Z:c?"GMT":s?"UTC":(String(e).match(i)||[""]).pop().replace(r,""),o:(_>0?"-":"+")+o(100*Math.floor(Math.abs(_)/60)+Math.abs(_)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10],W:b,N:w};return t.replace(n,function(e){return e in M?M[e]:e.slice(1,e.length-1)})});function o(e,t){for(e=String(e),t=t||2;e.length<t;)e="0"+e;return e}a.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},a.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},e.exports=a}()}),x="",_=function(e,t){if("string"!=typeof e)throw new TypeError("expected a string");if(1===t)return e;if(2===t)return e+e;var n=e.length*t;if(f!==e||void 0===f)f=e,x="";else if(x.length>=n)return x.substr(0,n);for(;n>x.length&&t>1;)1&t&&(x+=e),t>>=1,e+=e;return x=(x+=e).substr(0,n)};var b,w=function(e,t,n){return e=e.toString(),void 0===t?e:(n=0===n?"0":n?n.toString():" ",_(n,t-e.length)+e)},M=function(){},E={extension:"",prefix:"",suffix:""},T=["image/png","image/jpeg","image/webp"];function S(e,t){return void 0===t&&(t={}),new Promise(function(n,i){t=a({},E,t);var r=L(Object.assign({},t,{frame:void 0})),o=e?"streamStart":"streamEnd",s=h();return s&&s.output&&"function"==typeof s[o]?s[o](a({},t,{filename:r})).then(function(e){return n(e)}):n({filename:r,client:!1})})}function A(e,t){return void 0===t&&(t={}),function(e){return new Promise(function(t){var n=e.indexOf(",");if(-1!==n){for(var i=e.slice(n+1),r=window.atob(i),a=e.slice(0,n),o=/data:([^;]+)/.exec(a),s=(o?o[1]:"")||void 0,c=new ArrayBuffer(r.length),l=new Uint8Array(c),u=0;u<r.length;u++)l[u]=r.charCodeAt(u);t(new window.Blob([c],{type:s}))}else t(new window.Blob)})}(e).then(function(e){return R(e,t)})}function R(e,t){return void 0===t&&(t={}),new Promise(function(n){var i=(t=a({},E,t)).filename,r=h();if(r&&"function"==typeof r.saveBlob&&r.output)return r.saveBlob(e,a({},t,{filename:i})).then(function(e){return n(e)});b||((b=document.createElement("a")).style.visibility="hidden",b.target="_blank"),b.download=i,b.href=window.URL.createObjectURL(e),document.body.appendChild(b),b.onclick=function(){b.onclick=M,setTimeout(function(){window.URL.revokeObjectURL(e),b.parentElement&&b.parentElement.removeChild(b),b.removeAttribute("href"),n({filename:i,client:!1})})},b.click()})}function L(e){if(void 0===e&&(e={}),"function"==typeof(e=a({},e)).file)return e.file(e);if(e.file)return e.file;var t,n=null,i="";("string"==typeof e.extension&&(i=e.extension),"number"==typeof e.frame)&&(t="number"==typeof e.totalFrames?e.totalFrames:Math.max(1e3,e.frame),n=w(String(e.frame),String(t).length,"0"));var r=isFinite(e.totalLayers)&&isFinite(e.layer)&&e.totalLayers>1?""+e.layer:"";return null!=n?[r,n].filter(Boolean).join("-")+i:[e.prefix,e.name||e.timeStamp,r,e.hash,e.suffix].filter(Boolean).join("-")+i}var C={dimension:"dimensions",animated:"animate",animating:"animate",unit:"units",P5:"p5",pixellated:"pixelated",looping:"loop",pixelPerInch:"pixels"},P=["dimensions","units","pixelsPerInch","orientation","scaleToFit","scaleToView","bleed","pixelRatio","exportPixelRatio","maxPixelRatio","scaleContext","resizeCanvas","styleCanvas","canvas","context","attributes","parent","file","name","prefix","suffix","animate","playing","loop","duration","totalFrames","fps","playbackRate","timeScale","frame","time","flush","pixelated","hotkeys","p5","id","scaleToFitPadding","data","params","encoding","encodingQuality"],O=function(e){Object.keys(e).forEach(function(e){e in C?console.warn('[canvas-sketch] Could not recognize the setting "'+e+'", did you mean "'+C[e]+'"?'):P.includes(e)||console.warn('[canvas-sketch] Could not recognize the setting "'+e+'"')})};var N=[["postcard",101.6,152.4],["poster-small",280,430],["poster",460,610],["poster-large",610,910],["business-card",50.8,88.9],["2r",64,89],["3r",89,127],["4r",102,152],["5r",127,178],["6r",152,203],["8r",203,254],["10r",254,305],["11r",279,356],["12r",305,381],["a0",841,1189],["a1",594,841],["a2",420,594],["a3",297,420],["a4",210,297],["a5",148,210],["a6",105,148],["a7",74,105],["a8",52,74],["a9",37,52],["a10",26,37],["2a0",1189,1682],["4a0",1682,2378],["b0",1e3,1414],["b1",707,1e3],["b1+",720,1020],["b2",500,707],["b2+",520,720],["b3",353,500],["b4",250,353],["b5",176,250],["b6",125,176],["b7",88,125],["b8",62,88],["b9",44,62],["b10",31,44],["b11",22,32],["b12",16,22],["c0",917,1297],["c1",648,917],["c2",458,648],["c3",324,458],["c4",229,324],["c5",162,229],["c6",114,162],["c7",81,114],["c8",57,81],["c9",40,57],["c10",28,40],["c11",22,32],["c12",16,22],["half-letter",5.5,8.5,"in"],["letter",8.5,11,"in"],["legal",8.5,14,"in"],["junior-legal",5,8,"in"],["ledger",11,17,"in"],["tabloid",11,17,"in"],["ansi-a",8.5,11,"in"],["ansi-b",11,17,"in"],["ansi-c",17,22,"in"],["ansi-d",22,34,"in"],["ansi-e",34,44,"in"],["arch-a",9,12,"in"],["arch-b",12,18,"in"],["arch-c",18,24,"in"],["arch-d",24,36,"in"],["arch-e",36,48,"in"],["arch-e1",30,42,"in"],["arch-e2",26,38,"in"],["arch-e3",27,39,"in"]].reduce(function(e,t){var n={units:t[3]||"mm",dimensions:[t[1],t[2]]};return e[t[0]]=n,e[t[0].replace(/-/g," ")]=n,e},{});function I(t,n,i,r){return void 0===n&&(n="px"),void 0===i&&(i="px"),void 0===r&&(r=72),e(t,n,i,{pixelsPerInch:r,precision:4,roundPixel:!0})}function D(e,t){var n,i,r,a,o,s,c=p(),l=t.dimensions,u=function(e){return!(!e.dimensions||"string"!=typeof e.dimensions&&!(Array.isArray(e.dimensions)&&e.dimensions.length>=2))}(t),h=e.exporting,f=!!u&&!1!==t.scaleToFit,m=!(!h&&u)||t.scaleToView;c||(f=m=!1);var g,v,y=t.units,x="number"==typeof t.pixelsPerInch&&isFinite(t.pixelsPerInch)?t.pixelsPerInch:72,_=d(t.bleed,0),b=c?window.devicePixelRatio:1,w=m?b:1;"number"==typeof t.pixelRatio&&isFinite(t.pixelRatio)?v=d(t.exportPixelRatio,g=t.pixelRatio):u?(g=w,v=d(t.exportPixelRatio,1)):v=d(t.exportPixelRatio,g=b),"number"==typeof t.maxPixelRatio&&isFinite(t.maxPixelRatio)&&(g=Math.min(t.maxPixelRatio,g)),h&&(g=v);var M,E,T=function(e,t){if(!p())return[300,150];var n=t.parent||window;if(n===window||n===document||n===document.body)return[window.innerWidth,window.innerHeight];var i=n.getBoundingClientRect();return[i.width,i.height]}(0,t),S=T[0],A=T[1];if(u){var R=function(e,t,n){if(void 0===t&&(t="px"),void 0===n&&(n=72),"string"==typeof e){var i=e.toLowerCase();if(!(i in N))throw new Error('The dimension preset "'+e+'" is not supported or could not be found; try using a4, a3, postcard, letter, etc.');var r=N[i];return r.dimensions.map(function(e){return I(e,r.units,t,n)})}return e}(l,y,x),L=Math.max(R[0],R[1]),C=Math.min(R[0],R[1]);if(t.orientation){var P="landscape"===t.orientation;n=P?L:C,i=P?C:L}else n=R[0],i=R[1];M=n,E=i,n+=2*_,i+=2*_}else M=n=S,E=i=A;var O=n,D=i;if(u&&y&&(O=I(n,y,"px",x),D=I(i,y,"px",x)),r=Math.round(O),a=Math.round(D),f&&!h&&u){var H=n/i,F=S/A,B=d(t.scaleToFitPadding,40),z=Math.round(S-2*B),U=Math.round(A-2*B);(r>z||a>U)&&(F>H?(a=U,r=Math.round(a*H)):(r=z,a=Math.round(r/H)))}return{bleed:_,pixelRatio:g,width:n,height:i,dimensions:[n,i],units:y||"px",scaleX:(o=m?Math.round(g*r):Math.round(g*O))/n,scaleY:(s=m?Math.round(g*a):Math.round(g*D))/i,viewportWidth:m?Math.round(r):Math.round(O),viewportHeight:m?Math.round(a):Math.round(D),canvasWidth:o,canvasHeight:s,trimWidth:M,trimHeight:E,styleWidth:r,styleHeight:a}}var H=function(e,t){if("string"!=typeof e)throw new TypeError("must specify type string");if(t=t||{},"undefined"==typeof document&&!t.canvas)return null;var n=t.canvas||document.createElement("canvas");"number"==typeof t.width&&(n.width=t.width);"number"==typeof t.height&&(n.height=t.height);var i,r=t;try{var a=[e];0===e.indexOf("webgl")&&a.push("experimental-"+e);for(var o=0;o<a.length;o++)if(i=n.getContext(a[o],r))return i}catch(e){i=null}return i||null};function F(e){var t,n;void 0===e&&(e={});var i=!1;if(!1!==e.canvas){if(!(t=e.context)||"string"==typeof t){var r=e.canvas;r||(r=function(){if(!p())throw new Error("It appears you are runing from Node.js or a non-browser environment. Try passing in an existing { canvas } interface instead.");return document.createElement("canvas")}(),i=!0);var o=t||"2d";if("function"!=typeof r.getContext)throw new Error("The specified { canvas } element does not have a getContext() function, maybe it is not a <canvas> tag?");if(!(t=H(o,a({},e.attributes,{canvas:r}))))throw new Error("Failed at canvas.getContext('"+o+"') - the browser may not support this context, or a different context may already be in use with this canvas.")}if(n=t.canvas,e.canvas&&n!==e.canvas)throw new Error("The { canvas } and { context } settings must point to the same underlying canvas element");e.pixelated&&(t.imageSmoothingEnabled=!1,t.mozImageSmoothingEnabled=!1,t.oImageSmoothingEnabled=!1,t.webkitImageSmoothingEnabled=!1,t.msImageSmoothingEnabled=!1,n.style["image-rendering"]="pixelated")}return{canvas:n,context:t,ownsCanvas:i}}var B=function(){var e=this;this._settings={},this._props={},this._sketch=void 0,this._raf=null,this._lastRedrawResult=void 0,this._isP5Resizing=!1,this._keyboardShortcuts=function(e){void 0===e&&(e={});var t=function(t){if(e.enabled()){var n=h();83!==t.keyCode||t.altKey||!t.metaKey&&!t.ctrlKey?32===t.keyCode?e.togglePlay(t):n&&!t.altKey&&75===t.keyCode&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.commit(t)):(t.preventDefault(),e.save(t))}};return{attach:function(){window.addEventListener("keydown",t)},detach:function(){window.removeEventListener("keydown",t)}}}({enabled:function(){return!1!==e.settings.hotkeys},save:function(t){t.shiftKey?e.props.recording?(e.endRecord(),e.run()):e.record():e.props.recording||e.exportFrame()},togglePlay:function(){e.props.playing?e.pause():e.play()},commit:function(t){e.exportFrame({commit:!0})}}),this._animateHandler=function(){return e.animate()},this._resizeHandler=function(){e.resize()&&e.render()}},z={sketch:{configurable:!0},settings:{configurable:!0},props:{configurable:!0}};z.sketch.get=function(){return this._sketch},z.settings.get=function(){return this._settings},z.props.get=function(){return this._props},B.prototype._computePlayhead=function(e,t){return"number"==typeof t&&isFinite(t)?e/t:0},B.prototype._computeFrame=function(e,t,n,i){return isFinite(n)&&n>1?Math.floor(e*(n-1)):Math.floor(i*t)},B.prototype._computeCurrentFrame=function(){return this._computeFrame(this.props.playhead,this.props.time,this.props.totalFrames,this.props.fps)},B.prototype._getSizeProps=function(){var e=this.props;return{width:e.width,height:e.height,pixelRatio:e.pixelRatio,canvasWidth:e.canvasWidth,canvasHeight:e.canvasHeight,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight}},B.prototype.run=function(){if(!this.sketch)throw new Error("should wait until sketch is loaded before trying to play()");return!1!==this.settings.playing&&this.play(),"function"==typeof this.sketch.dispose&&console.warn("In canvas-sketch@0.0.23 the dispose() event has been renamed to unload()"),this.props.started||(this._signalBegin(),this.props.started=!0),this.tick(),this.render(),this},B.prototype.play=function(){var e=this.settings.animate;"animation"in this.settings&&(e=!0,console.warn("[canvas-sketch] { animation } has been renamed to { animate }")),e&&(p()?this.props.playing||(this.props.started||(this._signalBegin(),this.props.started=!0),this.props.playing=!0,null!=this._raf&&window.cancelAnimationFrame(this._raf),this._lastTime=c(),this._raf=window.requestAnimationFrame(this._animateHandler)):console.error("[canvas-sketch] WARN: Using { animate } in Node.js is not yet supported"))},B.prototype.pause=function(){this.props.recording&&this.endRecord(),this.props.playing=!1,null!=this._raf&&p()&&window.cancelAnimationFrame(this._raf)},B.prototype.togglePlay=function(){this.props.playing?this.pause():this.play()},B.prototype.stop=function(){this.pause(),this.props.frame=0,this.props.playhead=0,this.props.time=0,this.props.deltaTime=0,this.props.started=!1,this.render()},B.prototype.record=function(){var e=this;if(!this.props.recording)if(p()){this.stop(),this.props.playing=!0,this.props.recording=!0;var t=this._createExportOptions({sequence:!0}),n=1/this.props.fps;null!=this._raf&&window.cancelAnimationFrame(this._raf);var i,r=function(){return e.props.recording?(e.props.deltaTime=n,e.tick(),e.exportFrame(t).then(function(){e.props.recording&&(e.props.deltaTime=0,e.props.frame++,e.props.frame<e.props.totalFrames?(e.props.time+=n,e.props.playhead=e._computePlayhead(e.props.time,e.props.duration),e._raf=window.requestAnimationFrame(r)):(console.log("Finished recording"),e._signalEnd(),e.endRecord(),e.stop(),e.run()))})):Promise.resolve()};this.props.started||(this._signalBegin(),this.props.started=!0),(i=t,void 0===i&&(i={}),S(!0,i)).catch(function(e){console.error(e)}).then(function(t){e._raf=window.requestAnimationFrame(r)})}else console.error("[canvas-sketch] WARN: Recording from Node.js is not yet supported")},B.prototype._signalBegin=function(){var e=this;this.sketch&&"function"==typeof this.sketch.begin&&this._wrapContextScale(function(t){return e.sketch.begin(t)})},B.prototype._signalEnd=function(){var e=this;this.sketch&&"function"==typeof this.sketch.end&&this._wrapContextScale(function(t){return e.sketch.end(t)})},B.prototype.endRecord=function(){var e;null!=this._raf&&p()&&window.cancelAnimationFrame(this._raf),this.props.recording=!1,this.props.deltaTime=0,this.props.playing=!1,(void 0===e&&(e={}),S(!1,e)).catch(function(e){console.error(e)})},B.prototype._createExportOptions=function(e){return void 0===e&&(e={}),{sequence:e.sequence,save:e.save,fps:this.props.fps,frame:e.sequence?this.props.frame:void 0,file:this.settings.file,name:this.settings.name,prefix:this.settings.prefix,suffix:this.settings.suffix,encoding:this.settings.encoding,encodingQuality:this.settings.encodingQuality,timeStamp:e.timeStamp||y(new Date,"yyyy.mm.dd-HH.MM.ss"),totalFrames:isFinite(this.props.totalFrames)?Math.max(100,this.props.totalFrames):1e3}},B.prototype.exportFrame=function(e){var t=this;if(void 0===e&&(e={}),!this.sketch)return Promise.all([]);"function"==typeof this.sketch.preExport&&this.sketch.preExport();var n=this._createExportOptions(e),i=h(),r=Promise.resolve();if(i&&e.commit&&"function"==typeof i.commit){var o=a({},n),s=i.commit(o);r=l(s)?s:Promise.resolve(s)}return r.then(function(e){return t._doExportFrame(a({},n,{hash:e||""}))}).then(function(e){return 1===e.length?e[0]:e})},B.prototype._doExportFrame=function(e){var t=this;void 0===e&&(e={}),this._props.exporting=!0,this.resize();var n=this.render();return void 0===n&&(n=[this.props.canvas]),n=(n=[].concat(n).filter(Boolean)).map(function(t){var n,i="object"==typeof t&&t&&("data"in t||"dataURL"in t),r=i?t.data:t,o=i?a({},t,{data:r}):{data:r};if(u(n=r)&&/canvas/i.test(n.nodeName)&&"function"==typeof n.getContext){var s=function(e,t){void 0===t&&(t={});var n=t.encoding||"image/png";if(!T.includes(n))throw new Error("Invalid canvas encoding "+n);var i=(n.split("/")[1]||"").replace(/jpeg/i,"jpg");return i&&(i=("."+i).toLowerCase()),{extension:i,type:n,dataURL:e.toDataURL(n,t.encodingQuality)}}(r,{encoding:o.encoding||e.encoding,encodingQuality:d(o.encodingQuality,e.encodingQuality,.95)});return Object.assign(o,{dataURL:s.dataURL,extension:s.extension,type:s.type})}return o}),this._props.exporting=!1,this.resize(),this.render(),Promise.all(n.map(function(t,n,i){var r=a({extension:"",prefix:"",suffix:""},e,t,{layer:n,totalLayers:i.length}),o=!1!==e.save&&t.save;for(var s in r.save=!1!==o,r.filename=L(r),delete r.encoding,delete r.encodingQuality,r)void 0===r[s]&&delete r[s];var c=Promise.resolve({});if(r.save){var l=r.data;if(r.dataURL)c=A(r.dataURL,r);else c=function(e,t){void 0===t&&(t={});var n=Array.isArray(e)?e:[e];return R(new window.Blob(n,{type:t.type||""}),t)}(l,r)}return c.then(function(e){return Object.assign({},r,e)})})).then(function(n){var i=n.filter(function(e){return e.save});if(i.length>0){var r,a=i.find(function(e){return e.outputName}),o=i.some(function(e){return e.client}),s=i.some(function(e){return e.stream});r=i.length>1?i.length:a?a.outputName+"/"+i[0].filename:""+i[0].filename;var c="";if(e.sequence)c=isFinite(t.props.totalFrames)?" (frame "+(e.frame+1)+" / "+t.props.totalFrames+")":" (frame "+e.frame+")";else i.length>1&&(c=" files");console.log("%c["+(o?"canvas-sketch-cli":"canvas-sketch")+"]%c "+(s?"Streaming into":"Exported")+" %c"+r+"%c"+c,"color: #8e8e8e;","color: initial;","font-weight: bold;","font-weight: initial;")}return"function"==typeof t.sketch.postExport&&t.sketch.postExport(),n})},B.prototype._wrapContextScale=function(e){this._preRender(),e(this.props),this._postRender()},B.prototype._preRender=function(){var e=this.props;this.props.gl||!e.context||e.p5?e.p5&&e.p5.scale(e.scaleX/e.pixelRatio,e.scaleY/e.pixelRatio):(e.context.save(),!1!==this.settings.scaleContext&&e.context.scale(e.scaleX,e.scaleY))},B.prototype._postRender=function(){var e=this.props;this.props.gl||!e.context||e.p5||e.context.restore(),e.gl&&!1!==this.settings.flush&&!e.p5&&e.gl.flush()},B.prototype.tick=function(){this.sketch&&"function"==typeof this.sketch.tick&&(this._preRender(),this.sketch.tick(this.props),this._postRender())},B.prototype.render=function(){return this.props.p5?(this._lastRedrawResult=void 0,this.props.p5.redraw(),this._lastRedrawResult):this.submitDrawCall()},B.prototype.submitDrawCall=function(){if(this.sketch){var e,t=this.props;return this._preRender(),"function"==typeof this.sketch?e=this.sketch(t):"function"==typeof this.sketch.render&&(e=this.sketch.render(t)),this._postRender(),e}},B.prototype.update=function(e){var t=this;void 0===e&&(e={});var n=["animate"];Object.keys(e).forEach(function(e){if(n.indexOf(e)>=0)throw new Error("Sorry, the { "+e+" } option is not yet supported with update().")});var i=this._settings.canvas,r=this._settings.context;for(var a in e){var o=e[a];void 0!==o&&(t._settings[a]=o)}var s=Object.assign({},this._settings,e);if("time"in e&&"frame"in e)throw new Error("You should specify { time } or { frame } but not both");if("time"in e?delete s.frame:"frame"in e&&delete s.time,"duration"in e&&"totalFrames"in e)throw new Error("You should specify { duration } or { totalFrames } but not both");"duration"in e?delete s.totalFrames:"totalFrames"in e&&delete s.duration,"data"in e&&(this._props.data=e.data);var c=this.getTimeProps(s);if(Object.assign(this._props,c),i!==this._settings.canvas||r!==this._settings.context){var l=F(this._settings),u=l.context;this.props.canvas=l.canvas,this.props.context=u,this._setupGLKey(),this._appendCanvasIfNeeded()}return e.p5&&"function"!=typeof e.p5&&(this.props.p5=e.p5,this.props.p5.draw=function(){t._isP5Resizing||(t._lastRedrawResult=t.submitDrawCall())}),"playing"in e&&(e.playing?this.play():this.pause()),O(this._settings),this.resize(),this.render(),this.props},B.prototype.resize=function(){var e=this._getSizeProps(),t=this.settings,n=this.props,i=D(n,t);Object.assign(this._props,i);var r=this.props,a=r.pixelRatio,o=r.canvasWidth,s=r.canvasHeight,c=r.styleWidth,l=r.styleHeight,u=this.props.canvas;u&&!1!==t.resizeCanvas&&(n.p5?u.width===o&&u.height===s||(this._isP5Resizing=!0,n.p5.pixelDensity(a),n.p5.resizeCanvas(o/a,s/a,!1),this._isP5Resizing=!1):(u.width!==o&&(u.width=o),u.height!==s&&(u.height=s)),p()&&!1!==t.styleCanvas&&(u.style.width=c+"px",u.style.height=l+"px"));var h=this._getSizeProps(),d=!v(e,h);return d&&this._sizeChanged(),d},B.prototype._sizeChanged=function(){this.sketch&&"function"==typeof this.sketch.resize&&this.sketch.resize(this.props)},B.prototype.animate=function(){if(this.props.playing)if(p()){this._raf=window.requestAnimationFrame(this._animateHandler);var e=c(),t=1e3/this.props.fps,n=e-this._lastTime,i=this.props.duration,r="number"==typeof i&&isFinite(i),a=!0,o=this.settings.playbackRate;"fixed"===o?n=t:"throttle"===o?n>t?this._lastTime=e-=n%t:a=!1:this._lastTime=e;var s=n/1e3,l=this.props.time+s*this.props.timeScale;l<0&&r&&(l=i+l);var u=!1,h=!1;if(r&&l>=i&&(!1!==this.settings.loop?(a=!0,l%=i,h=!0):(a=!1,l=i,u=!0),this._signalEnd()),a){this.props.deltaTime=s,this.props.time=l,this.props.playhead=this._computePlayhead(l,i);var d=this.props.frame;this.props.frame=this._computeCurrentFrame(),h&&this._signalBegin(),d!==this.props.frame&&this.tick(),this.render(),this.props.deltaTime=0}u&&this.pause()}else console.error("[canvas-sketch] WARN: Animation in Node.js is not yet supported")},B.prototype.dispatch=function(e){if("function"!=typeof e)throw new Error("must pass function into dispatch()");e(this.props),this.render()},B.prototype.mount=function(){this._appendCanvasIfNeeded()},B.prototype.unmount=function(){p()&&(window.removeEventListener("resize",this._resizeHandler),this._keyboardShortcuts.detach()),this.props.canvas.parentElement&&this.props.canvas.parentElement.removeChild(this.props.canvas)},B.prototype._appendCanvasIfNeeded=function(){p()&&(!1!==this.settings.parent&&this.props.canvas&&!this.props.canvas.parentElement&&(this.settings.parent||document.body).appendChild(this.props.canvas))},B.prototype._setupGLKey=function(){var e;this.props.context&&("function"==typeof(e=this.props.context).clear&&"function"==typeof e.clearColor&&"function"==typeof e.bufferData?this._props.gl=this.props.context:delete this._props.gl)},B.prototype.getTimeProps=function(e){void 0===e&&(e={});var t=e.duration,n=e.totalFrames,i=d(e.timeScale,1),r=d(e.fps,24),a="number"==typeof t&&isFinite(t),o="number"==typeof n&&isFinite(n),s=a?Math.floor(r*t):void 0,c=o?n/r:void 0;if(a&&o&&s!==n)throw new Error("You should specify either duration or totalFrames, but not both. Or, they must match exactly.");void 0===e.dimensions&&void 0!==e.units&&console.warn("You've specified a { units } setting but no { dimension }, so the units will be ignored."),n=d(n,s,Infinity),t=d(t,c,Infinity);var l=e.time,u=e.frame,h="number"==typeof l&&isFinite(l),p="number"==typeof u&&isFinite(u),f=0,m=0,g=0;if(h&&p)throw new Error("You should specify either start frame or time, but not both.");return h?(g=this._computePlayhead(f=l,t),m=this._computeFrame(g,f,n,r)):p&&(g=this._computePlayhead(f=(m=u)/r,t)),{playhead:g,time:f,frame:m,duration:t,totalFrames:n,fps:r,timeScale:i}},B.prototype.setup=function(e){var t=this;if(void 0===e&&(e={}),this.sketch)throw new Error("Multiple setup() calls not yet supported.");this._settings=Object.assign({},e,this._settings),O(this._settings);var n=F(this._settings),i=n.context,r=n.canvas,a=this.getTimeProps(this._settings);this._props=Object.assign({},a,{canvas:r,context:i,deltaTime:0,started:!1,exporting:!1,playing:!1,recording:!1,settings:this.settings,data:this.settings.data,render:function(){return t.render()},togglePlay:function(){return t.togglePlay()},dispatch:function(e){return t.dispatch(e)},tick:function(){return t.tick()},resize:function(){return t.resize()},update:function(e){return t.update(e)},exportFrame:function(e){return t.exportFrame(e)},record:function(){return t.record()},play:function(){return t.play()},pause:function(){return t.pause()},stop:function(){return t.stop()}}),this._setupGLKey(),this.resize()},B.prototype.loadAndRun=function(e,t){var n=this;return this.load(e,t).then(function(){return n.run(),n})},B.prototype.unload=function(){var e=this;this.pause(),this.sketch&&("function"==typeof this.sketch.unload&&this._wrapContextScale(function(t){return e.sketch.unload(t)}),this._sketch=null)},B.prototype.destroy=function(){this.unload(),this.unmount()},B.prototype.load=function(e,t){var n=this;if("function"!=typeof e)throw new Error("The function must take in a function as the first parameter. Example:\n canvasSketcher(() => { ... }, settings)");this.sketch&&this.unload(),void 0!==t&&this.update(t),this._preRender();var i=Promise.resolve();if(this.settings.p5){if(!p())throw new Error("[canvas-sketch] ERROR: Using p5.js in Node.js is not supported");i=new Promise(function(e){var t,i=n.settings.p5;i.p5&&(t=i.preload,i=i.p5);var r=function(i){t&&(i.preload=function(){return t(i)}),i.setup=function(){var t=n.props,r="webgl"===n.settings.context,a=r?i.WEBGL:i.P2D;i.noLoop(),i.pixelDensity(t.pixelRatio),i.createCanvas(t.viewportWidth,t.viewportHeight,a),r&&n.settings.attributes&&i.setAttributes(n.settings.attributes),n.update({p5:i,canvas:i.canvas,context:i._renderer.drawingContext}),e()}};if("function"==typeof i)new i(r);else{if("function"!=typeof window.createCanvas)throw new Error("{ p5 } setting is passed but can't find p5.js in global (window) scope. Maybe you did not create it globally?\nnew p5(); // <-- attaches to global scope");r(window)}})}return i.then(function(){var t=e(n.props);return l(t)||(t=Promise.resolve(t)),t}).then(function(e){return e||(e={}),n._sketch=e,p()&&(n._keyboardShortcuts.attach(),window.addEventListener("resize",n._resizeHandler)),n._postRender(),n._sizeChanged(),n}).catch(function(e){throw console.warn("Could not start sketch, the async loading function rejected with an error:\n Error: "+e.message),e})},Object.defineProperties(B.prototype,z);var U="hot-id-cache",G=[];function k(e,t){if(void 0===t&&(t={}),t.p5){if(t.canvas||t.context&&"string"!=typeof t.context)throw new Error('In { p5 } mode, you can\'t pass your own canvas or context, unless the context is a "webgl" or "2d" string');t=Object.assign({},t,{canvas:!1,context:"string"==typeof t.context&&t.context})}var n,i,r=(n=h())&&n.hot;r&&(i=d(t.id,"$__DEFAULT_CANVAS_SKETCH_ID__$"));var a=r&&"string"==typeof i;a&&G.includes(i)&&(console.warn("Warning: You have multiple calls to canvasSketch() in --hot mode. You must pass unique { id } strings in settings to enable hot reload across multiple sketches. ",i),a=!1);var o=Promise.resolve();if(a){G.push(i);var s=function(e){var t=h();if(t)return t[U]=t[U]||{},t[U][e]}(i);if(s){var c=function(){var e,n=(e=s.manager,t.animate?{time:e.props.time}:void 0);return s.manager.destroy(),n};o=s.load.then(c).catch(c)}}return o.then(function(n){var r,o,s,c,l=new B;return e?(t=Object.assign({},t,n),l.setup(t),l.mount(),r=l.loadAndRun(e)):r=Promise.resolve(l),a&&(o=i,s={load:r,manager:l},(c=h())&&(c[U]=c[U]||{},c[U][o]=s)),r})}return k.canvasSketch=k,k.PaperSizes=N,k})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"convert-length":3}],3:[function(e,t,n){var i=e("defined"),r=["mm","cm","m","pc","pt","in","ft","px"],a={m:{system:"metric",factor:1},cm:{system:"metric",factor:.01},mm:{system:"metric",factor:.001},pt:{system:"imperial",factor:1/72},pc:{system:"imperial",factor:1/6},in:{system:"imperial",factor:1},ft:{system:"imperial",factor:12}};const o={metric:{unit:"m",ratio:1/.0254},imperial:{unit:"in",ratio:.0254}};t.exports=function(e,t,n,s){if("number"!=typeof e||!isFinite(e))throw new Error("Value must be a finite number");if(!t||!n)throw new Error("Must specify from and to units");var c=i((s=s||{}).pixelsPerInch,96),l=s.precision,u=!1!==s.roundPixel;if(t=t.toLowerCase(),n=n.toLowerCase(),-1===r.indexOf(t))throw new Error('Invalid from unit "'+t+'", must be one of: '+r.join(", "));if(-1===r.indexOf(n))throw new Error('Invalid from unit "'+n+'", must be one of: '+r.join(", "));if(t===n)return e;var h=1,d=1,p=!1;"px"===t&&(d=1/c,t="in"),"px"===n&&(p=!0,h=c,n="in");var f=a[t],m=a[n],g=e*f.factor*d;f.system!==m.system&&(g*=o[f.system].ratio);var v=g/m.factor*h;return p&&u?v=Math.round(v):"number"==typeof l&&isFinite(l)&&(v=function(e,t){return Number(Math.round(e+"e"+t)+"e-"+t)}(v,l)),v},t.exports.units=r},{defined:5}],4:[function(e,t,n){var i,r;i=this,r=function(e){"use strict";function t(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),a=Math.round(e.b),o=e.a,s=Math.round(e.h),c=e.s.toFixed(1),l=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var u=e.hex.toString(16);u.length<6;)u="0"+u;return"#"+u}return"CSS_RGB"===n?"rgb("+i+","+r+","+a+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+a+","+o+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+a+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+a+","+o+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+a+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+a+",a:"+o+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+",a:"+o+"}":"unknown format"}var n=Array.prototype.forEach,i=Array.prototype.slice,r={BREAK:{},extend:function(e){return this.each(i.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(i.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=i.call(arguments);return function(){for(var t=i.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,i){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,i);else if(e.length===e.length+0){var r,a=void 0;for(a=0,r=e.length;a<r;a++)if(a in e&&t.call(i,e[a],a)===this.BREAK)return}else for(var o in e)if(t.call(i,e[o],o)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var i=void 0;return function(){var r=this,a=arguments;var o=n||!i;clearTimeout(i),i=setTimeout(function(){i=null,n||e.apply(r,a)},t),o&&e.apply(r,a)}},toArray:function(e){return e.toArray?e.toArray():i.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return!1===e||!0===e},isFunction:function(e){return e instanceof Function}},a=[{litmus:r.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:t},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:t},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:t},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:t}}},{litmus:r.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:r.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:r.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(r.isNumber(e.r)&&r.isNumber(e.g)&&r.isNumber(e.b)&&r.isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(r.isNumber(e.r)&&r.isNumber(e.g)&&r.isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(r.isNumber(e.h)&&r.isNumber(e.s)&&r.isNumber(e.v)&&r.isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(r.isNumber(e.h)&&r.isNumber(e.s)&&r.isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],o=void 0,s=void 0,c=function(){s=!1;var e=arguments.length>1?r.toArray(arguments):arguments[0];return r.each(a,function(t){if(t.litmus(e))return r.each(t.conversions,function(t,n){if(o=t.read(e),!1===s&&!1!==o)return s=o,o.conversionName=n,o.conversion=t,r.BREAK}),r.BREAK}),s},l=void 0,u={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),a=n*(1-t),o=n*(1-r*t),s=n*(1-(1-r)*t),c=[[n,s,a],[o,n,a],[a,n,s],[a,o,n],[s,a,n],[n,a,o]][i];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),a=r-i,o=void 0;return 0===r?{h:NaN,s:0,v:0}:(o=e===r?(t-n)/a:t===r?2+(n-e)/a:4+(e-t)/a,(o/=6)<0&&(o+=1),{h:360*o,s:a/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),i=this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(l=8*t)|e&~(255<<l)}},h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},p=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),f=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var o=r.get;return void 0!==o?o.call(i):void 0},m=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},v=function(){function e(){if(d(this,e),this.__state=c.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return p(e,[{key:"toString",value:function(){return t(this)}},{key:"toHexString",value:function(){return t(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function y(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(v.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(v.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function x(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(v.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(v.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}v.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=u.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");r.extend(e.__state,u.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},v.recalculateHSV=function(e){var t=u.rgb_to_hsv(e.r,e.g,e.b);r.extend(e.__state,{s:t.s,v:t.v}),r.isNaN(t.h)?r.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},v.COMPONENTS=["r","g","b","h","s","v","hex","a"],y(v.prototype,"r",2),y(v.prototype,"g",1),y(v.prototype,"b",0),x(v.prototype,"h"),x(v.prototype,"s"),x(v.prototype,"v"),Object.defineProperty(v.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(v.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=u.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var _=function(){function e(t,n){d(this,e),this.initialValue=t[n],this.domElement=document.createElement("div"),this.object=t,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return p(e,[{key:"onChange",value:function(e){return this.__onChange=e,this}},{key:"onFinishChange",value:function(e){return this.__onFinishChange=e,this}},{key:"setValue",value:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),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()}}]),e}(),b={};r.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(e,t){r.each(e,function(e){b[e]=t})});var w=/(\d+(\.\d+)?)px/;function M(e){if("0"===e||r.isUndefined(e))return 0;var t=e.match(w);return r.isNull(t)?0:parseFloat(t[1])}var E={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var i=n,a=t;r.isUndefined(a)&&(a=!0),r.isUndefined(i)&&(i=!0),e.style.position="absolute",a&&(e.style.left=0,e.style.right=0),i&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,i){var a=n||{},o=b[t];if(!o)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":s.initMouseEvent(t,a.bubbles||!1,a.cancelable||!0,window,a.clickCount||1,0,0,a.x||a.clientX||0,a.y||a.clientY||0,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=s.initKeyboardEvent||s.initKeyEvent;r.defaults(a,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,a.bubbles||!1,a.cancelable,window,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.keyCode,a.charCode);break;default:s.initEvent(t,a.bubbles||!1,a.cancelable||!0)}r.defaults(s,i),e.dispatchEvent(s)},bind:function(e,t,n,i){return e.addEventListener?e.addEventListener(t,n,i||!1):e.attachEvent&&e.attachEvent("on"+t,n),E},unbind:function(e,t,n,i){return e.removeEventListener?e.removeEventListener(t,n,i||!1):e.detachEvent&&e.detachEvent("on"+t,n),E},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return E},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),i=n.indexOf(t);-1!==i&&(n.splice(i,1),e.className=n.join(" "))}else e.className=void 0;return E},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return M(t["border-left-width"])+M(t["border-right-width"])+M(t["padding-left"])+M(t["padding-right"])+M(t.width)},getHeight:function(e){var t=getComputedStyle(e);return M(t["border-top-width"])+M(t["border-bottom-width"])+M(t["padding-top"])+M(t["padding-bottom"])+M(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do{n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent}while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},T=function(e){function t(e,n){d(this,t);var i=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__prev=i.getValue(),i.__checkbox=document.createElement("input"),i.__checkbox.setAttribute("type","checkbox"),E.bind(i.__checkbox,"change",function(){r.setValue(!r.__prev)},!1),i.domElement.appendChild(i.__checkbox),i.updateDisplay(),i}return m(t,_),p(t,[{key:"setValue",value:function(e){var n=f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);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),f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),S=function(e){function t(e,n,i){d(this,t);var a=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=i,s=a;if(a.__select=document.createElement("select"),r.isArray(o)){var c={};r.each(o,function(e){c[e]=e}),o=c}return r.each(o,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),s.__select.appendChild(n)}),a.updateDisplay(),E.bind(a.__select,"change",function(){s.setValue(this.options[this.selectedIndex].value)}),a.domElement.appendChild(a.__select),a}return m(t,_),p(t,[{key:"setValue",value:function(e){var n=f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return E.isActive(this.__select)?this:(this.__select.value=this.getValue(),f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(),A=function(e){function t(e,n){d(this,t);var i=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;function a(){r.setValue(r.__input.value)}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),E.bind(i.__input,"keyup",a),E.bind(i.__input,"change",a),E.bind(i.__input,"blur",function(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}),E.bind(i.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return m(t,_),p(t,[{key:"updateDisplay",value:function(){return E.isActive(this.__input)||(this.__input.value=this.getValue()),f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function R(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,i){d(this,t);var a=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),o=i||{};return a.__min=o.min,a.__max=o.max,a.__step=o.step,a.__impliedStep=r.isUndefined(a.__step)?0===a.initialValue?1:Math.pow(10,Math.floor(Math.log(Math.abs(a.initialValue))/Math.LN10))/10:a.__step,a.__precision=R(a.__impliedStep),a}return m(t,_),p(t,[{key:"setValue",value:function(e){var n=e;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),f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=R(e),this}}]),t}(),C=function(e){function t(e,n,i){d(this,t);var a=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));a.__truncationSuspended=!1;var o=a,s=void 0;function c(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(e){var t=s-e.clientY;o.setValue(o.getValue()+t*o.__impliedStep),s=e.clientY}function u(){E.unbind(window,"mousemove",l),E.unbind(window,"mouseup",u),c()}return a.__input=document.createElement("input"),a.__input.setAttribute("type","text"),E.bind(a.__input,"change",function(){var e=parseFloat(o.__input.value);r.isNaN(e)||o.setValue(e)}),E.bind(a.__input,"blur",function(){c()}),E.bind(a.__input,"mousedown",function(e){E.bind(window,"mousemove",l),E.bind(window,"mouseup",u),s=e.clientY}),E.bind(a.__input,"keydown",function(e){13===e.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,c())}),a.updateDisplay(),a.domElement.appendChild(a.__input),a}return m(t,L),p(t,[{key:"updateDisplay",value:function(){var e,n;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=Math.pow(10,this.__precision),Math.round(e*n)/n),f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function P(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var O=function(e){function t(e,n,i,r,a){d(this,t);var o=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:a})),s=o;function c(e){e.preventDefault();var t=s.__background.getBoundingClientRect();return s.setValue(P(e.clientX,t.left,t.right,s.__min,s.__max)),!1}function l(){E.unbind(window,"mousemove",c),E.unbind(window,"mouseup",l),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function u(e){var t=e.touches[0].clientX,n=s.__background.getBoundingClientRect();s.setValue(P(t,n.left,n.right,s.__min,s.__max))}function h(){E.unbind(window,"touchmove",u),E.unbind(window,"touchend",h),s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}return o.__background=document.createElement("div"),o.__foreground=document.createElement("div"),E.bind(o.__background,"mousedown",function(e){document.activeElement.blur(),E.bind(window,"mousemove",c),E.bind(window,"mouseup",l),c(e)}),E.bind(o.__background,"touchstart",function(e){if(1!==e.touches.length)return;E.bind(window,"touchmove",u),E.bind(window,"touchend",h),u(e)}),E.addClass(o.__background,"slider"),E.addClass(o.__foreground,"slider-fg"),o.updateDisplay(),o.__background.appendChild(o.__foreground),o.domElement.appendChild(o.__background),o}return m(t,L),p(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",f(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),N=function(e){function t(e,n,i){d(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,E.bind(r.__button,"click",function(e){return e.preventDefault(),a.fire(),!1}),E.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return m(t,_),p(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),I=function(e){function t(e,n){d(this,t);var i=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new v(i.getValue()),i.__temp=new v(0);var a=i;i.domElement=document.createElement("div"),E.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",E.bind(i.__input,"keydown",function(e){13===e.keyCode&&f.call(this)}),E.bind(i.__input,"blur",f),E.bind(i.__selector,"mousedown",function(){E.addClass(this,"drag").bind(window,"mouseup",function(){E.removeClass(a.__selector,"drag")})}),E.bind(i.__selector,"touchstart",function(){E.addClass(this,"drag").bind(window,"touchend",function(){E.removeClass(a.__selector,"drag")})});var o,s=document.createElement("div");function l(e){y(e),E.bind(window,"mousemove",y),E.bind(window,"touchmove",y),E.bind(window,"mouseup",h),E.bind(window,"touchend",h)}function u(e){x(e),E.bind(window,"mousemove",x),E.bind(window,"touchmove",x),E.bind(window,"mouseup",p),E.bind(window,"touchend",p)}function h(){E.unbind(window,"mousemove",y),E.unbind(window,"touchmove",y),E.unbind(window,"mouseup",h),E.unbind(window,"touchend",h),m()}function p(){E.unbind(window,"mousemove",x),E.unbind(window,"touchmove",x),E.unbind(window,"mouseup",p),E.unbind(window,"touchend",p),m()}function f(){var e=c(this.value);!1!==e?(a.__color.__state=e,a.setValue(a.__color.toOriginal())):this.value=a.__color.toString()}function m(){a.__onFinishChange&&a.__onFinishChange.call(a,a.__color.toOriginal())}function y(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=a.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=(n.clientX-t.left)/(t.right-t.left),r=1-(n.clientY-t.top)/(t.bottom-t.top);return r>1?r=1:r<0&&(r=0),i>1?i=1:i<0&&(i=0),a.__color.v=r,a.__color.s=i,a.setValue(a.__color.toOriginal()),!1}function x(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=a.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),a.__color.h=360*n,a.setValue(a.__color.toOriginal()),!1}return r.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),r.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),r.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),r.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),r.extend(s.style,{width:"100%",height:"100%",background:"none"}),H(s,"top","rgba(0,0,0,0)","#000"),r.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=i.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",r.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),E.bind(i.__saturation_field,"mousedown",l),E.bind(i.__saturation_field,"touchstart",l),E.bind(i.__field_knob,"mousedown",l),E.bind(i.__field_knob,"touchstart",l),E.bind(i.__hue_field,"mousedown",u),E.bind(i.__hue_field,"touchstart",u),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return m(t,_),p(t,[{key:"updateDisplay",value:function(){var e=c(this.getValue());if(!1!==e){var t=!1;r.each(v.COMPONENTS,function(n){if(!r.isUndefined(e[n])&&!r.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&r.extend(this.__color.__state,e)}r.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;r.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,H(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),r.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function H(e,t,n,i){e.style.background="",r.each(D,function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "})}var F=function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}},B=function(e,t){var n=e[t];return r.isArray(arguments[2])||r.isObject(arguments[2])?new S(e,t,arguments[2]):r.isNumber(n)?r.isNumber(arguments[2])&&r.isNumber(arguments[3])?r.isNumber(arguments[4])?new O(e,t,arguments[2],arguments[3],arguments[4]):new O(e,t,arguments[2],arguments[3]):r.isNumber(arguments[4])?new C(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new C(e,t,{min:arguments[2],max:arguments[3]}):r.isString(n)?new A(e,t):r.isFunction(n)?new N(e,t,""):r.isBoolean(n)?new T(e,t):null},z=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},U=function(){function e(){d(this,e),this.backgroundElement=document.createElement("div"),r.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"}),E.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),r.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 t=this;E.bind(this.backgroundElement,"click",function(){t.hide()})}return p(e,[{key:"show",value:function(){var e=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(),r.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",E.unbind(e.domElement,"webkitTransitionEnd",t),E.unbind(e.domElement,"transitionend",t),E.unbind(e.domElement,"oTransitionEnd",t)};E.bind(this.domElement,"webkitTransitionEnd",t),E.bind(this.domElement,"transitionend",t),E.bind(this.domElement,"oTransitionEnd",t),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-E.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-E.getHeight(this.domElement)/2+"px"}}]),e}();F(function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".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 G="Default",k=function(){try{return!!window.localStorage}catch(e){return!1}}(),V=void 0,j=!0,W=void 0,q=!1,X=[],Y=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),E.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=r.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=r.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),r.isUndefined(i.load)?i.load={preset:G}:i.preset&&(i.load.preset=i.preset),r.isUndefined(i.parent)&&i.hideable&&X.push(this),i.resizable=r.isUndefined(i.parent)&&i.resizable,i.autoPlace&&r.isUndefined(i.scrollable)&&(i.scrollable=!0);var a,o=k&&"true"===localStorage.getItem(ee(this,"isLocal")),s=void 0,c=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}(this),n.revert()}},width:{get:function(){return i.width},set:function(e){i.width=e,re(n,e)}},name:{get:function(){return i.name},set:function(e){i.name=e,c&&(c.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(t){i.closed=t,i.closed?E.addClass(n.__ul,e.CLASS_CLOSED):E.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(e){k&&(o=e,e?E.bind(window,"unload",s):E.unbind(window,"unload",s),localStorage.setItem(ee(n,"isLocal"),e))}}}),r.isUndefined(i.parent)){if(this.closed=i.closed||!1,E.addClass(this.domElement,e.CLASS_MAIN),E.makeSelectable(this.domElement,!1),k&&o){n.useLocalStorage=!0;var l=localStorage.getItem(ee(this,"gui"));l&&(i.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,E.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),i.closeOnTop?(E.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(E.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),E.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===i.closed&&(i.closed=!0);var u=document.createTextNode(i.name);E.addClass(u,"controller-name"),c=Z(n,u);E.addClass(this.__ul,e.CLASS_CLOSED),E.addClass(c,"title"),E.bind(c,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),i.closed||(this.closed=!1)}i.autoPlace&&(r.isUndefined(i.parent)&&(j&&(W=document.createElement("div"),E.addClass(W,"dg"),E.addClass(W,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(W),j=!1),W.appendChild(this.domElement),E.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||re(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},E.bind(window,"resize",this.__resizeHandler),E.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),E.bind(this.__ul,"transitionend",this.__resizeHandler),E.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&ie(this),this.saveToLocalStorageIfPossible=s=function(){k&&"true"===localStorage.getItem(ee(n,"isLocal"))&&localStorage.setItem(ee(n,"gui"),JSON.stringify(n.getSaveObject()))},i.parent||((a=n.getRoot()).width+=1,r.defer(function(){a.width-=1}))};function Z(e,t,n){var i=document.createElement("li");return t&&i.appendChild(t),n?e.__ul.insertBefore(i,n):e.__ul.appendChild(i),e.onResize(),i}function J(e){E.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&E.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function K(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function Q(e,t){var n=e.getRoot(),i=n.__rememberedObjects.indexOf(t.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(n.__rememberedObjectIndecesToControllers[i]=r={}),r[t.property]=t,n.load&&n.load.remembered){var a=n.load.remembered,o=void 0;if(a[e.preset])o=a[e.preset];else{if(!a[G])return;o=a[G]}if(o[i]&&void 0!==o[i][t.property]){var s=o[i][t.property];t.initialValue=s,t.setValue(s)}}}}function $(e,t,n,i){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var a=void 0;if(i.color)a=new I(t,n);else{var o=[t,n].concat(i.factoryArgs);a=B.apply(e,o)}i.before instanceof _&&(i.before=i.before.__li),Q(e,a),E.addClass(a.domElement,"c");var s=document.createElement("span");E.addClass(s,"property-name"),s.innerHTML=a.property;var c=document.createElement("div");c.appendChild(s),c.appendChild(a.domElement);var l=Z(e,c,i.before);return E.addClass(l,Y.CLASS_CONTROLLER_ROW),E.addClass(l,a instanceof I?"color":h(a.getValue())),function(e,t,n){if(n.__li=t,n.__gui=e,r.extend(n,{options:function(t){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),$(e,n.object,n.property,{before:i,factoryArgs:[r.toArray(arguments)]})}if(r.isArray(t)||r.isObject(t)){var a=n.__li.nextElementSibling;return n.remove(),$(e,n.object,n.property,{before:a,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof O){var i=new C(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});r.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}}),E.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof C){var a=function(t){if(r.isNumber(n.__min)&&r.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,a=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=$(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),a&&o.listen(),o}return t};n.min=r.compose(a,n.min),n.max=r.compose(a,n.max)}else n instanceof T?(E.bind(t,"click",function(){E.fakeEvent(n.__checkbox,"click")}),E.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof N?(E.bind(t,"click",function(){E.fakeEvent(n.__button,"click")}),E.bind(t,"mouseover",function(){E.addClass(n.__button,"hover")}),E.bind(t,"mouseout",function(){E.removeClass(n.__button,"hover")})):n instanceof I&&(E.addClass(t,"color"),n.updateDisplay=r.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=r.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&K(e.getRoot(),!0),t},n.setValue)}(e,l,a),e.__controllers.push(a),a}function ee(e,t){return document.location.href+"."+t}function te(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function ne(e,t){t.style.display=e.useLocalStorage?"block":"none"}function ie(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function i(){E.removeClass(e.__closeButton,Y.CLASS_DRAG),E.unbind(window,"mousemove",n),E.unbind(window,"mouseup",i)}function a(r){return r.preventDefault(),t=r.clientX,E.addClass(e.__closeButton,Y.CLASS_DRAG),E.bind(window,"mousemove",n),E.bind(window,"mouseup",i),!1}e.__resize_handle=document.createElement("div"),r.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),E.bind(e.__resize_handle,"mousedown",a),E.bind(e.__closeButton,"mousedown",a),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function re(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function ae(e,t){var n={};return r.each(e.__rememberedObjects,function(i,a){var o={};r.each(e.__rememberedObjectIndecesToControllers[a],function(e,n){o[n]=t?e.initialValue:e.getValue()}),n[a]=o}),n}Y.toggleHide=function(){q=!q,r.each(X,function(e){e.domElement.style.display=q?"none":""})},Y.CLASS_AUTO_PLACE="a",Y.CLASS_AUTO_PLACE_CONTAINER="ac",Y.CLASS_MAIN="main",Y.CLASS_CONTROLLER_ROW="cr",Y.CLASS_TOO_TALL="taller-than-window",Y.CLASS_CLOSED="closed",Y.CLASS_CLOSE_BUTTON="close-button",Y.CLASS_CLOSE_TOP="close-top",Y.CLASS_CLOSE_BOTTOM="close-bottom",Y.CLASS_DRAG="drag",Y.DEFAULT_WIDTH=245,Y.TEXT_CLOSED="Close Controls",Y.TEXT_OPEN="Open Controls",Y._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||Y.toggleHide()},E.bind(window,"keydown",Y._keydownHandler,!1),r.extend(Y.prototype,{add:function(e,t){return $(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return $(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;r.defer(function(){t.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&&W.removeChild(this.domElement);var e=this;r.each(this.__folders,function(t){e.removeFolder(t)}),E.unbind(window,"keydown",Y._keydownHandler,!1),J(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new Y(t);this.__folders[e]=n;var i=Z(this,n.domElement);return E.addClass(i,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],J(e);var t=this;r.each(e.__folders,function(t){e.removeFolder(t)}),r.defer(function(){t.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 e=this.getRoot();if(e.scrollable){var t=E.getOffset(e.__ul).top,n=0;r.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=E.getHeight(t))}),window.innerHeight-t-20<n?(E.addClass(e.domElement,Y.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-20+"px"):(E.removeClass(e.domElement,Y.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&r.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:r.debounce(function(){this.onResize()},50),remember:function(){if(r.isUndefined(V)&&((V=new U).domElement.innerHTML='<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>'),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;r.each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&function(e){var t=e.__save_row=document.createElement("li");E.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),E.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",E.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",E.addClass(i,"button"),E.addClass(i,"save");var a=document.createElement("span");a.innerHTML="New",E.addClass(a,"button"),E.addClass(a,"save-as");var o=document.createElement("span");o.innerHTML="Revert",E.addClass(o,"button"),E.addClass(o,"revert");var s=e.__preset_select=document.createElement("select");e.load&&e.load.remembered?r.each(e.load.remembered,function(t,n){te(e,n,n===e.preset)}):te(e,G,!1);if(E.bind(s,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(s),t.appendChild(n),t.appendChild(i),t.appendChild(a),t.appendChild(o),k){var c=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage"),u=document.getElementById("dg-save-locally");u.style.display="block","true"===localStorage.getItem(ee(e,"isLocal"))&&l.setAttribute("checked","checked"),ne(e,c),E.bind(l,"change",function(){e.useLocalStorage=!e.useLocalStorage,ne(e,c)})}var h=document.getElementById("dg-new-constructor");E.bind(h,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||V.hide()}),E.bind(n,"click",function(){h.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),V.show(),h.focus(),h.select()}),E.bind(i,"click",function(){e.save()}),E.bind(a,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),E.bind(o,"click",function(){e.revert()})}(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&re(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=ae(this)),e.folders={},r.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=ae(this),K(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[G]=ae(this,!0)),this.load.remembered[e]=ae(this),this.preset=e,te(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){r.each(this.__controllers,function(t){this.getRoot().load.remembered?Q(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),r.each(this.__folders,function(e){e.revert(e)}),e||K(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&function e(t){0!==t.length&&z.call(window,function(){e(t)});r.each(t,function(e){e.updateDisplay()})}(this.__listening)},updateDisplay:function(){r.each(this.__controllers,function(e){e.updateDisplay()}),r.each(this.__folders,function(e){e.updateDisplay()})}});var oe={Color:v,math:u,interpret:c},se={Controller:_,BooleanController:T,OptionController:S,StringController:A,NumberController:L,NumberControllerBox:C,NumberControllerSlider:O,FunctionController:N,ColorController:I},ce={dom:E},le={GUI:Y},ue=Y,he={color:oe,controllers:se,dom:ce,gui:le,GUI:ue};e.color=oe,e.controllers=se,e.dom=ce,e.gui=le,e.GUI=ue,e.default=he,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r(i.dat={})},{}],5:[function(e,t,n){t.exports=function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]}},{}],6:[function(e,t,n){var i,r;i=this,r=function(e){"use strict";void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t});var t=0,n=1,i=2,r=1,a=2,o=3,s=0,c=1,l=2,u=0,h=1,d=2,p=3,f=4,m=5,g=100,v=101,y=102,x=103,_=104,b=200,w=201,M=202,E=203,T=204,S=205,A=206,R=207,L=208,C=209,P=210,O=0,N=1,I=2,D=3,H=4,F=5,B=6,z=7,U=0,G=1,k=2,V=0,j=1,W=2,q=3,X=4,Y=5,Z=301,J=302,K=303,Q=304,$=305,ee=306,te=307,ne=1e3,ie=1001,re=1002,ae=1003,oe=1004,se=1005,ce=1006,le=1007,ue=1008,he=1009,de=1010,pe=1011,fe=1012,me=1013,ge=1014,ve=1015,ye=1016,xe=1017,_e=1018,be=1019,we=1020,Me=1021,Ee=1022,Te=1023,Se=1024,Ae=1025,Re=Te,Le=1026,Ce=1027,Pe=1028,Oe=1029,Ne=1030,Ie=1031,De=1032,He=1033,Fe=33776,Be=33777,ze=33778,Ue=33779,Ge=35840,ke=35841,Ve=35842,je=35843,We=36196,qe=37492,Xe=37496,Ye=37808,Ze=37809,Je=37810,Ke=37811,Qe=37812,$e=37813,et=37814,tt=37815,nt=37816,it=37817,rt=37818,at=37819,ot=37820,st=37821,ct=36492,lt=37840,ut=37841,ht=37842,dt=37843,pt=37844,ft=37845,mt=37846,gt=37847,vt=37848,yt=37849,xt=37850,_t=37851,bt=37852,wt=37853,Mt=2201,Et=2400,Tt=3e3,St=3001,At=3007,Rt=3002,Lt=3003,Ct=3004,Pt=3005,Ot=3006,Nt=3200,It=3201,Dt=0,Ht=1,Ft=7680,Bt=519,zt=35044,Ut=35048;function Gt(){}Object.assign(Gt.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});for(var kt=[],Vt=0;Vt<256;Vt++)kt[Vt]=(Vt<16?"0":"")+Vt.toString(16);var jt,Wt={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(kt[255&e]+kt[e>>8&255]+kt[e>>16&255]+kt[e>>24&255]+"-"+kt[255&t]+kt[t>>8&255]+"-"+kt[t>>16&15|64]+kt[t>>24&255]+"-"+kt[63&n|128]+kt[n>>8&255]+"-"+kt[n>>16&255]+kt[n>>24&255]+kt[255&i]+kt[i>>8&255]+kt[i>>16&255]+kt[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Wt.DEG2RAD},radToDeg:function(e){return e*Wt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+i)/2),u=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);"XYX"===r?e.set(s*u,c*h,c*d,s*l):"YZY"===r?e.set(c*d,s*u,c*h,s*l):"ZXZ"===r?e.set(c*h,c*d,s*u,s*l):"XZX"===r?e.set(s*u,c*f,c*p,s*l):"YXY"===r?e.set(c*p,s*u,c*f,s*l):"ZYZ"===r?e.set(c*f,c*p,s*u,s*l):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};function qt(e,t){this.x=e||0,this.y=t||0}function Xt(){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.")}Object.defineProperties(qt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(qt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=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:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}}),Object.assign(Xt.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],_=i[2],b=i[5],w=i[8];return r[0]=a*f+o*v+s*_,r[3]=a*m+o*y+s*b,r[6]=a*g+o*x+s*w,r[1]=c*f+l*v+u*_,r[4]=c*m+l*y+u*b,r[7]=c*g+l*x+u*w,r[2]=h*f+d*v+p*_,r[5]=h*m+d*y+p*b,r[8]=h*g+d*x+p*w,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*r*l+n*o*s+i*r*c-i*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],d=n[8],p=d*c-l*h,f=l*u-d*s,m=h*s-c*u,g=r*p+a*f+o*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);var v=1/g;return i[0]=p*v,i[1]=(o*h-d*a)*v,i[2]=(l*a-o*c)*v,i[3]=f*v,i[4]=(d*r-o*u)*v,i[5]=(o*s-l*r)*v,i[6]=m*v,i[7]=(a*u-h*r)*v,i[8]=(c*r-a*s)*v,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),c=Math.sin(r);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-i*c,i*s,-i*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],c=i[4],l=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*c,i[6]=t*o+n*l,i[1]=-n*r+t*s,i[4]=-n*a+t*c,i[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var Yt={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===jt&&(jt=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),jt.width=e.width,jt.height=e.height;var n=jt.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=jt}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Zt=0;function Jt(e,t,n,i,r,a,o,s,c,l){Object.defineProperty(this,"id",{value:Zt++}),this.uuid=Wt.generateUUID(),this.name="",this.image=void 0!==e?e:Jt.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:Jt.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:ie,this.wrapT=void 0!==i?i:ie,this.magFilter=void 0!==r?r:ce,this.minFilter=void 0!==a?a:ue,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Te,this.internalFormat=null,this.type=void 0!==s?s:he,this.offset=new qt(0,0),this.repeat=new qt(1,1),this.center=new qt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:Tt,this.version=0,this.onUpdate=null}function Kt(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function Qt(e,t,n){this.width=e,this.height=t,this.scissor=new Kt(0,0,e,t),this.scissorTest=!1,this.viewport=new Kt(0,0,e,t),this.texture=new Jt(void 0,(n=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=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:ce,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}function $t(e,t,n){Qt.call(this,e,t,n),this.samples=4}function en(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}Jt.DEFAULT_IMAGE=void 0,Jt.DEFAULT_MAPPING=300,Jt.prototype=Object.assign(Object.create(Gt.prototype),{constructor:Jt,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var 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){var i=this.image;if(void 0===i.uuid&&(i.uuid=Wt.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(Yt.getDataURL(i[a]))}else r=Yt.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ne:e.x=e.x-Math.floor(e.x);break;case ie:e.x=e.x<0?0:1;break;case re:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ne:e.y=e.y-Math.floor(e.y);break;case ie:e.y=e.y<0?0:1;break;case re:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(Jt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Kt.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Kt.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(u+1)/2,v=(f+1)/2,y=(s+l)/4,x=(c+d)/4,_=(h+p)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=_/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(v)),i=_/r),this.set(n,i,r,t),this}var b=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(c-d)/b,this.z=(l-s)/b,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=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:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Qt.prototype=Object.assign(Object.create(Gt.prototype),{constructor:Qt,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$t.prototype=Object.assign(Object.create(Qt.prototype),{constructor:$t,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Qt.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(en,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],c=n[i+1],l=n[i+2],u=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(u!==f||s!==h||c!==d||l!==p){var m=1-o,g=s*h+c*d+l*p+u*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,g*v);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*v;if(s=s*m+h*b,c=c*m+d*b,l=l*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=w,c*=w,l*=w,u*=w}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}}),Object.defineProperties(en.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(en.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(i/2),u=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===a?(this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p):"YXZ"===a?(this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p):"ZXY"===a?(this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p):"ZYX"===a?(this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p):"YZX"===a?(this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p):"XZY"===a&&(this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=i+s+h;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-c)*t,this._y=(a-l)*t,this._z=(o-r)*t):i>s&&i>h?(t=2*Math.sqrt(1+i-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+l)/t):s>h?(t=2*Math.sqrt(1+s-i-h),this._w=(a-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-i-s),this._w=(o-r)/t,this._x=(a+l)/t,this._y=(c+u)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Wt.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+i*c-r*s,this._y=i*l+a*s+r*o-n*c,this._z=r*l+a*c+n*s-i*o,this._w=a*l-n*o-i*s-r*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*i+t*this._y,this._z=c*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var tn=new rn,nn=new en;function rn(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(rn.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(nn.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(nn.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*i-o*n,l=s*n+o*t-r*i,u=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=c*s+h*-r+l*-o-u*-a,this.y=l*s+h*-a+u*-r-c*-o,this.z=u*s+h*-o+c*-a-l*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=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:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return tn.copy(this).projectOnVector(e),this.sub(tn)},reflect:function(e){return this.sub(tn.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Wt.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var an=new rn,on=new dn,sn=new rn(0,0,0),cn=new rn(1,1,1),ln=new rn,un=new rn,hn=new rn;function dn(){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.")}Object.assign(dn.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,c,l,u,h,d,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new dn).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,i=1/an.setFromMatrixColumn(e,0).length(),r=1/an.setFromMatrixColumn(e,1).length(),a=1/an.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){var h=a*l,d=a*u,p=o*l,f=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=d+p*c,t[5]=h-f*c,t[9]=-o*s,t[2]=f-h*c,t[6]=p+d*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*u,g=c*l;t[0]=(v=s*l)+(y=c*u)*o,t[4]=g*o-m,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var v,y;m=s*u,g=c*l;t[0]=(v=s*l)-(y=c*u)*o,t[4]=-a*u,t[8]=g+m*o,t[1]=m+g*o,t[5]=a*l,t[9]=y-v*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*l,d=a*u,p=o*l,f=o*u;t[0]=s*l,t[4]=p*c-d,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=d*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,_=a*c,b=o*s,w=o*c;t[0]=s*l,t[4]=w-x*u,t[8]=b*u+_,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=_*u+b,t[10]=x-w*u}else if("XZY"===e.order){x=a*s,_=a*c,b=o*s,w=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=x*u+w,t[5]=a*l,t[9]=_*u-b,t[2]=b*u-_,t[6]=o*l,t[10]=w*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(sn,e,cn)},lookAt:function(e,t,n){var i=this.elements;return hn.subVectors(e,t),0===hn.lengthSq()&&(hn.z=1),hn.normalize(),ln.crossVectors(n,hn),0===ln.lengthSq()&&(1===Math.abs(n.z)?hn.x+=1e-4:hn.z+=1e-4,hn.normalize(),ln.crossVectors(n,hn)),ln.normalize(),un.crossVectors(hn,ln),i[0]=ln.x,i[4]=un.x,i[8]=hn.x,i[1]=ln.y,i[5]=un.y,i[9]=hn.y,i[2]=ln.z,i[6]=un.z,i[10]=hn.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=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],x=n[11],_=n[15],b=i[0],w=i[4],M=i[8],E=i[12],T=i[1],S=i[5],A=i[9],R=i[13],L=i[2],C=i[6],P=i[10],O=i[14],N=i[3],I=i[7],D=i[11],H=i[15];return r[0]=a*b+o*T+s*L+c*N,r[4]=a*w+o*S+s*C+c*I,r[8]=a*M+o*A+s*P+c*D,r[12]=a*E+o*R+s*O+c*H,r[1]=l*b+u*T+h*L+d*N,r[5]=l*w+u*S+h*C+d*I,r[9]=l*M+u*A+h*P+d*D,r[13]=l*E+u*R+h*O+d*H,r[2]=p*b+f*T+m*L+g*N,r[6]=p*w+f*S+m*C+g*I,r[10]=p*M+f*A+m*P+g*D,r[14]=p*E+f*R+m*O+g*H,r[3]=v*b+y*T+x*L+_*N,r[7]=v*w+y*S+x*C+_*I,r[11]=v*M+y*A+x*P+_*D,r[15]=v*E+y*R+x*O+_*H,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+r*s*u-i*c*u-r*o*h+n*c*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*c*h+r*a*h-i*a*d+i*c*l-r*s*l)+e[11]*(+t*c*u-t*o*d-r*a*u+n*a*d+r*o*l-n*c*l)+e[15]*(-i*o*l-t*s*u+t*o*h+i*a*u-n*a*h+n*s*l)},transpose:function(){var e,t=this.elements;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:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],_=p*y*h-v*f*h+v*u*m-l*y*m-p*u*x+l*f*x,b=g*f*h-d*y*h-g*u*m+c*y*m+d*u*x-c*f*x,w=d*v*h-g*p*h+g*l*m-c*v*m-d*l*x+c*p*x,M=g*p*u-d*v*u-g*l*f+c*v*f+d*l*y-c*p*y,E=r*_+a*b+o*w+s*M;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/E;return n[0]=_*T,n[1]=(v*f*s-p*y*s-v*o*m+a*y*m+p*o*x-a*f*x)*T,n[2]=(l*y*s-v*u*s+v*o*h-a*y*h-l*o*x+a*u*x)*T,n[3]=(p*u*s-l*f*s-p*o*h+a*f*h+l*o*m-a*u*m)*T,n[4]=b*T,n[5]=(d*y*s-g*f*s+g*o*m-r*y*m-d*o*x+r*f*x)*T,n[6]=(g*u*s-c*y*s-g*o*h+r*y*h+c*o*x-r*u*x)*T,n[7]=(c*f*s-d*u*s+d*o*h-r*f*h-c*o*m+r*u*m)*T,n[8]=w*T,n[9]=(g*p*s-d*v*s-g*a*m+r*v*m+d*a*x-r*p*x)*T,n[10]=(c*v*s-g*l*s+g*a*h-r*v*h-c*a*x+r*l*x)*T,n[11]=(d*l*s-c*p*s-d*a*h+r*p*h+c*a*m-r*l*m)*T,n[12]=M*T,n[13]=(d*v*o-g*p*o+g*a*f-r*v*f-d*a*y+r*p*y)*T,n[14]=(g*l*o-c*v*o-g*a*u+r*v*u+c*a*y-r*l*y)*T,n[15]=(c*p*o-d*l*o+d*a*u-r*p*u-c*a*f+r*l*f)*T,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,c=r*a,l=r*o;return this.set(c*a+n,c*o-i*s,c*s+i*o,0,c*o+i*s,l*o+n,l*s-i*a,0,c*s-i*o,l*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,c=r+r,l=a+a,u=o+o,h=r*c,d=r*l,p=r*u,f=a*l,m=a*u,g=o*u,v=s*c,y=s*l,x=s*u,_=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*_,i[1]=(d+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+y)*w,i[9]=(m-v)*w,i[10]=(1-(h+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(e,t,n){var i=this.elements,r=an.set(i[0],i[1],i[2]).length(),a=an.set(i[4],i[5],i[6]).length(),o=an.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],on.copy(this);var s=1/r,c=1/a,l=1/o;return on.elements[0]*=s,on.elements[1]*=s,on.elements[2]*=s,on.elements[4]*=c,on.elements[5]*=c,on.elements[6]*=c,on.elements[8]*=l,on.elements[9]*=l,on.elements[10]*=l,t.setFromRotationMatrix(on),n.x=r,n.y=a,n.z=o,this},makePerspective:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(n-i),c=(t+e)/(t-e),l=(n+i)/(n-i),u=-(a+r)/(a-r),h=-2*a*r/(a-r);return o[0]=2*r/(t-e),o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=s,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),c=1/(n-i),l=1/(a-r),u=(t+e)*s,h=(n+i)*c,d=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var pn=new dn,fn=new en;function mn(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||mn.DefaultOrder}function gn(){this.mask=1}mn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],mn.DefaultOrder="XYZ",Object.defineProperties(mn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(mn.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Wt.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],c=r[1],l=r[5],u=r[9],h=r[2],d=r[6],p=r[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===t?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return pn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(pn,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return fn.setFromEuler(this),this.setFromQuaternion(fn,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new rn(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(gn.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});var vn=0,yn=new rn,xn=new en,_n=new dn,bn=new rn,wn=new rn,Mn=new rn,En=new en,Tn=new rn(1,0,0),Sn=new rn(0,1,0),An=new rn(0,0,1),Rn={type:"added"},Ln={type:"removed"};function Cn(){Object.defineProperty(this,"id",{value:vn++}),this.uuid=Wt.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Cn.DefaultUp.clone();var e=new rn,t=new mn,n=new en,i=new rn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new dn},normalMatrix:{value:new Xt}}),this.matrix=new dn,this.matrixWorld=new dn,this.matrixAutoUpdate=Cn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new gn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Pn(){Cn.call(this),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}))}Cn.DefaultUp=new rn(0,1,0),Cn.DefaultMatrixAutoUpdate=!0,Cn.prototype=Object.assign(Object.create(Gt.prototype),{constructor:Cn,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return xn.setFromAxisAngle(e,t),this.quaternion.multiply(xn),this},rotateOnWorldAxis:function(e,t){return xn.setFromAxisAngle(e,t),this.quaternion.premultiply(xn),this},rotateX:function(e){return this.rotateOnAxis(Tn,e)},rotateY:function(e){return this.rotateOnAxis(Sn,e)},rotateZ:function(e){return this.rotateOnAxis(An,e)},translateOnAxis:function(e,t){return yn.copy(e).applyQuaternion(this.quaternion),this.position.add(yn.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Tn,e)},translateY:function(e){return this.translateOnAxis(Sn,e)},translateZ:function(e){return this.translateOnAxis(An,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(_n.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?bn.copy(e):bn.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),wn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_n.lookAt(wn,bn,this.up):_n.lookAt(bn,wn,this.up),this.quaternion.setFromRotationMatrix(_n),i&&(_n.extractRotation(i.matrixWorld),xn.setFromRotationMatrix(_n),this.quaternion.premultiply(xn.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Rn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Ln)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),_n.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),_n.multiply(e.parent.matrixWorld)),e.applyMatrix4(_n),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new rn),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new en),this.updateMatrixWorld(!0),this.matrixWorld.decompose(wn,e,Mn),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new rn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(wn,En,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new rn),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&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===t)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){r(e.shapes,o[s])}else r(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var l=[];for(s=0,c=this.material.length;s<c;s++)l.push(r(e.materials,this.material[s]));i.material=l}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(e).object)}if(t){var u=f(e.geometries),h=f(e.materials),d=f(e.textures),p=f(e.images);o=f(e.shapes);u.length>0&&(n.geometries=u),h.length>0&&(n.materials=h),d.length>0&&(n.textures=d),p.length>0&&(n.images=p),o.length>0&&(n.shapes=o)}return n.object=i,n;function f(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){this.add(e.children[n].clone())}return this}}),Pn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Pn,isScene:!0,copy:function(e,t){return Cn.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=Cn.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var On=[new rn,new rn,new rn,new rn,new rn,new rn,new rn,new rn],Nn=new rn,In=new Wn,Dn=new rn,Hn=new rn,Fn=new rn,Bn=new rn,zn=new rn,Un=new rn,Gn=new rn,kn=new rn,Vn=new rn,jn=new rn;function Wn(e,t){this.min=void 0!==e?e:new rn(Infinity,Infinity,Infinity),this.max=void 0!==t?t:new rn(-Infinity,-Infinity,-Infinity)}function qn(e,t,n,i,r){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){jn.fromArray(e,a);var s=r.x*Math.abs(jn.x)+r.y*Math.abs(jn.y)+r.z*Math.abs(jn.z),c=t.dot(jn),l=n.dot(jn),u=i.dot(jn);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}Object.assign(Wn.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=Infinity,n=Infinity,i=Infinity,r=-Infinity,a=-Infinity,o=-Infinity,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],h=e[s+2];l<t&&(t=l),u<n&&(n=u),h<i&&(i=h),l>r&&(r=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=Infinity,n=Infinity,i=Infinity,r=-Infinity,a=-Infinity,o=-Infinity,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),h=e.getZ(s);l<t&&(t=l),u<n&&(n=u),h<i&&(i=h),l>r&&(r=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Nn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-Infinity,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new rn),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new rn),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),In.copy(t.boundingBox),In.applyMatrix4(e.matrixWorld),this.union(In));for(var n=e.children,i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new rn),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Nn),Nn.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Gn),kn.subVectors(this.max,Gn),Dn.subVectors(e.a,Gn),Hn.subVectors(e.b,Gn),Fn.subVectors(e.c,Gn),Bn.subVectors(Hn,Dn),zn.subVectors(Fn,Hn),Un.subVectors(Dn,Fn);var t=[0,-Bn.z,Bn.y,0,-zn.z,zn.y,0,-Un.z,Un.y,Bn.z,0,-Bn.x,zn.z,0,-zn.x,Un.z,0,-Un.x,-Bn.y,Bn.x,0,-zn.y,zn.x,0,-Un.y,Un.x,0];return!!qn(t,Dn,Hn,Fn,kn)&&(!!qn(t=[1,0,0,0,1,0,0,0,1],Dn,Hn,Fn,kn)&&(Vn.crossVectors(Bn,zn),qn(t=[Vn.x,Vn.y,Vn.z],Dn,Hn,Fn,kn)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new rn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Nn.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(Nn).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(On[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),On[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),On[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),On[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),On[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),On[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),On[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),On[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(On),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Xn=new Wn;function Yn(e,t){this.center=void 0!==e?e:new rn,this.radius=void 0!==t?t:0}Object.assign(Yn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):Xn.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new rn),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Wn),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Zn=new rn,Jn=new rn,Kn=new rn,Qn=new rn,$n=new rn,ei=new rn,ti=new rn;function ni(e,t){this.origin=void 0!==e?e:new rn,this.direction=void 0!==t?t:new rn(0,0,-1)}Object.assign(ni.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new rn),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Zn)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new rn),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Zn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zn.copy(this.direction).multiplyScalar(t).add(this.origin),Zn.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){Jn.copy(e).add(t).multiplyScalar(.5),Kn.copy(t).sub(e).normalize(),Qn.copy(this.origin).sub(Jn);var r,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(Kn),u=Qn.dot(this.direction),h=-Qn.dot(Kn),d=Qn.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*u-h,s=c*p,(r=l*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+l*(a*=f)+2*u)+a*(l*r+a+2*h)+d}else a=c,o=-(r=Math.max(0,-(l*a+u)))*r+a*(a+2*h)+d;else a=-c,o=-(r=Math.max(0,-(l*a+u)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-l*c+u)))*r+(a=r>0?-c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-c,-h),c))*(a+2*h)+d):o=-(r=Math.max(0,-(l*c+u)))*r+(a=r>0?c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d;else a=l>0?-c:c,o=-(r=Math.max(0,-(l*a+u)))*r+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Kn).multiplyScalar(a).add(Jn),o},intersectSphere:function(e,t){Zn.subVectors(e.center,this.origin);var n=Zn.dot(this.direction),i=Zn.dot(Zn)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:this.at(o<0?s:o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),l>=0?(r=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(r=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Zn)},intersectTriangle:function(e,t,n,i,r){$n.subVectors(t,e),ei.subVectors(n,e),ti.crossVectors($n,ei);var a,o=this.direction.dot(ti);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Qn.subVectors(this.origin,e);var s=a*this.direction.dot(ei.crossVectors(Qn,ei));if(s<0)return null;var c=a*this.direction.dot($n.cross(Qn));if(c<0)return null;if(s+c>o)return null;var l=-a*Qn.dot(ti);return l<0?null:this.at(l/o,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var ii=new rn,ri=new rn,ai=new Xt;function oi(e,t){this.normal=void 0!==e?e:new rn(1,0,0),this.constant=void 0!==t?t:0}Object.assign(oi.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=ii.subVectors(n,t).cross(ri.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new rn),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new rn);var n=e.delta(ii),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new rn),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||ai.getNormalMatrix(e),i=this.coplanarPoint(ii).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var si=new rn,ci=new rn,li=new rn,ui=new rn,hi=new rn,di=new rn,pi=new rn,fi=new rn,mi=new rn,gi=new rn;function vi(e,t,n){this.a=void 0!==e?e:new rn,this.b=void 0!==t?t:new rn,this.c=void 0!==n?n:new rn}Object.assign(vi,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new rn),i.subVectors(n,t),si.subVectors(e,t),i.cross(si);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){si.subVectors(i,t),ci.subVectors(n,t),li.subVectors(e,t);var a=si.dot(si),o=si.dot(ci),s=si.dot(li),c=ci.dot(ci),l=ci.dot(li),u=a*c-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new rn),0===u)return r.set(-2,-1,-1);var h=1/u,d=(c*s-o*l)*h,p=(a*l-o*s)*h;return r.set(1-d-p,p,d)},containsPoint:function(e,t,n,i){return vi.getBarycoord(e,t,n,i,ui),ui.x>=0&&ui.y>=0&&ui.x+ui.y<=1},getUV:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,ui),s.set(0,0),s.addScaledVector(r,ui.x),s.addScaledVector(a,ui.y),s.addScaledVector(o,ui.z),s},isFrontFacing:function(e,t,n,i){return si.subVectors(n,t),ci.subVectors(e,t),si.cross(ci).dot(i)<0}}),Object.assign(vi.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return si.subVectors(this.c,this.b),ci.subVectors(this.a,this.b),.5*si.cross(ci).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new rn),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return vi.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new oi),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return vi.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return vi.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return vi.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return vi.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new rn);var n,i,r=this.a,a=this.b,o=this.c;hi.subVectors(a,r),di.subVectors(o,r),fi.subVectors(e,r);var s=hi.dot(fi),c=di.dot(fi);if(s<=0&&c<=0)return t.copy(r);mi.subVectors(e,a);var l=hi.dot(mi),u=di.dot(mi);if(l>=0&&u<=l)return t.copy(a);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(r).addScaledVector(hi,n);gi.subVectors(e,o);var d=hi.dot(gi),p=di.dot(gi);if(p>=0&&d<=p)return t.copy(o);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return i=c/(c-p),t.copy(r).addScaledVector(di,i);var m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return pi.subVectors(o,a),i=(u-l)/(u-l+(d-p)),t.copy(a).addScaledVector(pi,i);var g=1/(m+f+h);return n=f*g,i=h*g,t.copy(r).addScaledVector(hi,n).addScaledVector(di,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var yi={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},xi={h:0,s:0,l:0},_i={h:0,s:0,l:0};function bi(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function wi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Mi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Ei(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function Ti(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new rn,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new bi,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(bi.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Wt.euclideanModulo(e,1),t=Wt.clamp(t,0,1),n=Wt.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=wi(r,i,e+1/3),this.g=wi(r,i,e),this.b=wi(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[2];switch(n[1]){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var a=parseFloat(i[1])/360,o=parseInt(i[2],10)/100,s=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,o,s)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],l=c.length;if(3===l)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=yi[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=Mi(e.r),this.g=Mi(e.g),this.b=Mi(e.b),this},copyLinearToSRGB:function(e){return this.r=Ei(e.r),this.g=Ei(e.g),this.b=Ei(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),c=(s+o)/2;if(s===o)t=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case i:t=(r-a)/l+(r<a?6:0);break;case r:t=(a-i)/l+2;break;case a:t=(i-r)/l+4}t/=6}return e.h=t,e.s=n,e.l=c,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(xi),xi.h+=e,xi.s+=t,xi.l+=n,this.setHSL(xi.h,xi.s,xi.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(xi),e.getHSL(_i);var n=Wt.lerp(xi.h,_i.h,t),i=Wt.lerp(xi.s,_i.s,t),r=Wt.lerp(xi.l,_i.l,t);return this.setHSL(n,i,r),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),bi.NAMES=yi,Object.assign(Ti.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Si=0;function Ai(){Object.defineProperty(this,"id",{value:Si++}),this.uuid=Wt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=h,this.side=s,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=T,this.blendDst=S,this.blendEquation=g,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=D,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Bt,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ft,this.stencilZFail=Ft,this.stencilZPass=Ft,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}function Ri(e){Ai.call(this),this.type="MeshBasicMaterial",this.color=new bi(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=U,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(e)}Ai.prototype=Object.assign(Object.create(Gt.prototype),{constructor:Ai,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).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(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==h&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==s&&(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),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ai.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),(Ri.prototype=Object.create(Ai.prototype)).constructor=Ri,Ri.prototype.isMeshBasicMaterial=!0,Ri.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var Li=new rn;function Ci(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=zt,this.updateRange={offset:0,count:-1},this.version=0}function Pi(e,t,n){Ci.call(this,new Int8Array(e),t,n)}function Oi(e,t,n){Ci.call(this,new Uint8Array(e),t,n)}function Ni(e,t,n){Ci.call(this,new Uint8ClampedArray(e),t,n)}function Ii(e,t,n){Ci.call(this,new Int16Array(e),t,n)}function Di(e,t,n){Ci.call(this,new Uint16Array(e),t,n)}function Hi(e,t,n){Ci.call(this,new Int32Array(e),t,n)}function Fi(e,t,n){Ci.call(this,new Uint32Array(e),t,n)}function Bi(e,t,n){Ci.call(this,new Float32Array(e),t,n)}function zi(e,t,n){Ci.call(this,new Float64Array(e),t,n)}function Ui(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Gi(e){if(0===e.length)return-Infinity;for(var t=e[0],n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(Ci.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ci.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new bi),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new qt),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new rn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new Kt),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.applyMatrix3(e),this.setXYZ(t,Li.x,Li.y,Li.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.applyMatrix4(e),this.setXYZ(t,Li.x,Li.y,Li.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.applyNormalMatrix(e),this.setXYZ(t,Li.x,Li.y,Li.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Li.x=this.getX(t),Li.y=this.getY(t),Li.z=this.getZ(t),Li.transformDirection(e),this.setXYZ(t,Li.x,Li.y,Li.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return this.array[(e*=this.itemSize)+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return this.array[(e*=this.itemSize)+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return this.array[(e*=this.itemSize)+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,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}}}),(Pi.prototype=Object.create(Ci.prototype)).constructor=Pi,(Oi.prototype=Object.create(Ci.prototype)).constructor=Oi,(Ni.prototype=Object.create(Ci.prototype)).constructor=Ni,(Ii.prototype=Object.create(Ci.prototype)).constructor=Ii,(Di.prototype=Object.create(Ci.prototype)).constructor=Di,(Hi.prototype=Object.create(Ci.prototype)).constructor=Hi,(Fi.prototype=Object.create(Ci.prototype)).constructor=Fi,(Bi.prototype=Object.create(Ci.prototype)).constructor=Bi,(zi.prototype=Object.create(Ci.prototype)).constructor=zi,Object.assign(Ui.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(d>0){u=[];for(l=0;l<d;l++)u[l]={name:h[l].name,data:[]};this.morphTargets.normal=u}var p=e.skinIndices,f=e.skinWeights,m=p.length===i.length,g=f.length===i.length;i.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<n.length;l++){var v=n[l];this.vertices.push(i[v.a],i[v.b],i[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var _,b=v.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=v.color;this.colors.push(w,w,w)}if(!0===a)void 0!==(_=r[0][l])?this.uvs.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new qt,new qt,new qt));if(!0===o)void 0!==(_=r[1][l])?this.uvs2.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new qt,new qt,new qt));for(var M=0;M<c;M++){var E=s[M].vertices;t[M].data.push(E[v.a],E[v.b],E[v.c])}for(M=0;M<d;M++){var T=h[M].vertexNormals[l];u[M].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var ki=1,Vi=new dn,ji=new Cn,Wi=new rn,qi=new Wn,Xi=new Wn,Yi=new rn;function Zi(){Object.defineProperty(this,"id",{value:ki+=2}),this.uuid=Wt.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:Infinity},this.userData={}}Zi.prototype=Object.assign(Object.create(Gt.prototype),{constructor:Zi,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){this.index=Array.isArray(e)?new(Gi(e)>65535?Fi:Di)(e,1):e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new Xt).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Vi.makeRotationX(e),this.applyMatrix4(Vi),this},rotateY:function(e){return Vi.makeRotationY(e),this.applyMatrix4(Vi),this},rotateZ:function(e){return Vi.makeRotationZ(e),this.applyMatrix4(Vi),this},translate:function(e,t,n){return Vi.makeTranslation(e,t,n),this.applyMatrix4(Vi),this},scale:function(e,t,n){return Vi.makeScale(e,t,n),this.applyMatrix4(Vi),this},lookAt:function(e){return ji.lookAt(e),ji.updateMatrix(),this.applyMatrix4(ji.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wi).negate(),this.translate(Wi.x,Wi.y,Wi.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Bi(3*t.vertices.length,3),i=new Bi(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Bi(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Bi(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ui).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new Ci(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new Ci(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new Ci(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new Ci(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Ci(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],d=new Bi(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new Bi(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Bi(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Wn);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){qi.setFromBufferAttribute(t[n]),this.morphTargetsRelative?(Yi.addVectors(this.boundingBox.min,qi.min),this.boundingBox.expandByPoint(Yi),Yi.addVectors(this.boundingBox.max,qi.max),this.boundingBox.expandByPoint(Yi)):(this.boundingBox.expandByPoint(qi.min),this.boundingBox.expandByPoint(qi.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 Yn);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(qi.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){Xi.setFromBufferAttribute(o=t[i]),this.morphTargetsRelative?(Yi.addVectors(qi.min,Xi.min),qi.expandByPoint(Yi),Yi.addVectors(qi.max,Xi.max),qi.expandByPoint(Yi)):(qi.expandByPoint(Xi.min),qi.expandByPoint(Xi.max))}qi.getCenter(n);var a=0;for(i=0,r=e.count;i<r;i++)Yi.fromBufferAttribute(e,i),a=Math.max(a,n.distanceToSquared(Yi));if(t)for(i=0,r=t.length;i<r;i++)for(var o,s=this.morphTargetsRelative,c=0,l=(o=t[i]).count;c<l;c++)Yi.fromBufferAttribute(o,c),s&&(Wi.fromBufferAttribute(e,c),Yi.add(Wi)),a=Math.max(a,n.distanceToSquared(Yi));this.boundingSphere.radius=Math.sqrt(a),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(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new Ci(new Float32Array(n.length),3));else for(var i=t.normal.array,r=0,a=i.length;r<a;r++)i[r]=0;var o,s,c,l=t.normal.array,u=new rn,h=new rn,d=new rn,p=new rn,f=new rn;if(e){var m=e.array;for(r=0,a=e.count;r<a;r+=3)s=3*m[r+1],c=3*m[r+2],u.fromArray(n,o=3*m[r+0]),h.fromArray(n,s),d.fromArray(n,c),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[o]+=p.x,l[o+1]+=p.y,l[o+2]+=p.z,l[s]+=p.x,l[s+1]+=p.y,l[s+2]+=p.z,l[c]+=p.x,l[c+1]+=p.y,l[c+2]+=p.z}else for(r=0,a=n.length;r<a;r+=9)u.fromArray(n,r),h.fromArray(n,r+3),d.fromArray(n,r+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[r]=p.x,l[r+1]=p.y,l[r+2]=p.z,l[r+3]=p.x,l[r+4]=p.y,l[r+5]=p.z,l[r+6]=p.x,l[r+7]=p.y,l[r+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,a=e.attributes[i],o=a.array,s=a.itemSize*t,c=Math.min(o.length,r.length-s),l=0,u=s;l<c;l++,u++)r[u]=o[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Yi.x=e.getX(t),Yi.y=e.getY(t),Yi.z=e.getZ(t),Yi.normalize(),e.setXYZ(t,Yi.x,Yi.y,Yi.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=new n.constructor(t.length*i),a=0,o=0,s=0,c=t.length;s<c;s++){a=t[s]*i;for(var l=0;l<i;l++)r[o++]=n[a++]}return new Ci(r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Zi,n=this.index.array,i=this.attributes;for(var r in i){var a=e(i[r],n);t.setAttribute(r,a)}var o=this.morphAttributes;for(r in o){for(var s=[],c=o[r],l=0,u=c.length;l<u;l++){a=e(c[l],n);s.push(a)}t.morphAttributes[r]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var h=this.groups,d=(l=0,h.length);l<d;l++){var p=h[l];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=(d=r[n]).toJSON();""!==d.name&&(a.name=d.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],l=[],u=0,h=c.length;u<h;u++){var d;a=(d=c[u]).toJSON();""!==d.name&&(a.name=d.name),l.push(a)}l.length>0&&(o[n]=l,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Zi).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){this.setAttribute(t,a[t].clone())}var o=e.morphAttributes;for(t in o){var s=[],c=o[t];for(n=0,i=c.length;n<i;n++)s.push(c[n].clone());this.morphAttributes[t]=s}this.morphTargetsRelative=e.morphTargetsRelative;var l=e.groups;for(n=0,i=l.length;n<i;n++){var u=l[n];this.addGroup(u.start,u.count,u.materialIndex)}var h=e.boundingBox;null!==h&&(this.boundingBox=h.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Ji=new dn,Ki=new ni,Qi=new Yn,$i=new rn,er=new rn,tr=new rn,nr=new rn,ir=new rn,rr=new rn,ar=new rn,or=new rn,sr=new rn,cr=new qt,lr=new qt,ur=new qt,hr=new rn,dr=new rn;function pr(e,t){Cn.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Zi,this.material=void 0!==t?t:new Ri,this.updateMorphTargets()}function fr(e,t,n,i,r,a,o,s){if(null===(t.side===c?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,t.side!==l,s)))return null;dr.copy(s),dr.applyMatrix4(e.matrixWorld);var u=n.ray.origin.distanceTo(dr);return u<n.near||u>n.far?null:{distance:u,point:dr.clone(),object:e}}function mr(e,t,n,i,r,a,o,s,c,l,u,h){$i.fromBufferAttribute(r,l),er.fromBufferAttribute(r,u),tr.fromBufferAttribute(r,h);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){ar.set(0,0,0),or.set(0,0,0),sr.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],g=a[p];0!==m&&(nr.fromBufferAttribute(g,l),ir.fromBufferAttribute(g,u),rr.fromBufferAttribute(g,h),o?(ar.addScaledVector(nr,m),or.addScaledVector(ir,m),sr.addScaledVector(rr,m)):(ar.addScaledVector(nr.sub($i),m),or.addScaledVector(ir.sub(er),m),sr.addScaledVector(rr.sub(tr),m)))}$i.add(ar),er.add(or),tr.add(sr)}var v=fr(e,t,n,i,$i,er,tr,hr);if(v){s&&(cr.fromBufferAttribute(s,l),lr.fromBufferAttribute(s,u),ur.fromBufferAttribute(s,h),v.uv=vi.getUV(hr,$i,er,tr,cr,lr,ur,new qt)),c&&(cr.fromBufferAttribute(c,l),lr.fromBufferAttribute(c,u),ur.fromBufferAttribute(c,h),v.uv2=vi.getUV(hr,$i,er,tr,cr,lr,ur,new qt));var y=new Ti(l,u,h);vi.getNormal($i,er,tr,y.normal),v.face=y}return v}pr.prototype=Object.assign(Object.create(Cn.prototype),{constructor:pr,isMesh:!0,copy:function(e){return Cn.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),Qi.copy(i.boundingSphere),Qi.applyMatrix4(a),!1!==e.ray.intersectsSphere(Qi)&&(Ji.getInverse(a),Ki.copy(e.ray).applyMatrix4(Ji),null===i.boundingBox||!1!==Ki.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var o,s,c,l,u,h,d,p,f,m=i.index,g=i.attributes.position,v=i.morphAttributes.position,y=i.morphTargetsRelative,x=i.attributes.uv,_=i.attributes.uv2,b=i.groups,w=i.drawRange;if(null!==m)if(Array.isArray(r))for(l=0,h=b.length;l<h;l++)for(f=r[(p=b[l]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),c=m.getX(u+2),(n=mr(this,f,e,Ki,g,v,y,x,_,o,s,c))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,t.push(n));else for(l=Math.max(0,w.start),h=Math.min(m.count,w.start+w.count);l<h;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(n=mr(this,r,e,Ki,g,v,y,x,_,o,s,c))&&(n.faceIndex=Math.floor(l/3),t.push(n));else if(void 0!==g)if(Array.isArray(r))for(l=0,h=b.length;l<h;l++)for(f=r[(p=b[l]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)(n=mr(this,f,e,Ki,g,v,y,x,_,o=u,s=u+1,c=u+2))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,t.push(n));else for(l=Math.max(0,w.start),h=Math.min(g.count,w.start+w.count);l<h;l+=3)(n=mr(this,r,e,Ki,g,v,y,x,_,o=l,s=l+1,c=l+2))&&(n.faceIndex=Math.floor(l/3),t.push(n))}else if(i.isGeometry){var M,E,T,S,A=Array.isArray(r),R=i.vertices,L=i.faces,C=i.faceVertexUvs[0];C.length>0&&(S=C);for(var P=0,O=L.length;P<O;P++){var N=L[P],I=A?r[N.materialIndex]:r;if(void 0!==I&&(n=fr(this,I,e,Ki,M=R[N.a],E=R[N.b],T=R[N.c],hr))){if(S&&S[P]){var D=S[P];cr.copy(D[0]),lr.copy(D[1]),ur.copy(D[2]),n.uv=vi.getUV(hr,M,E,T,cr,lr,ur,new qt)}n.face=N,n.faceIndex=P,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var gr=0,vr=new dn,yr=new Cn,xr=new rn;function _r(){Object.defineProperty(this,"id",{value:gr+=2}),this.uuid=Wt.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}_r.prototype=Object.assign(Object.create(Gt.prototype),{constructor:_r,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Xt).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(e)}for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return vr.makeRotationX(e),this.applyMatrix4(vr),this},rotateY:function(e){return vr.makeRotationY(e),this.applyMatrix4(vr),this},rotateZ:function(e){return vr.makeRotationZ(e),this.applyMatrix4(vr),this},translate:function(e,t,n){return vr.makeTranslation(e,t,n),this.applyMatrix4(vr),this},scale:function(e,t,n){return vr.makeScale(e,t,n),this.applyMatrix4(vr),this},lookAt:function(e){return yr.lookAt(e),yr.updateMatrix(),this.applyMatrix4(yr.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,i=e.attributes;if(void 0===i.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=i.position.array,a=void 0!==i.normal?i.normal.array:void 0,o=void 0!==i.color?i.color.array:void 0,s=void 0!==i.uv?i.uv.array:void 0,c=void 0!==i.uv2?i.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=0;l<r.length;l+=3)t.vertices.push((new rn).fromArray(r,l)),void 0!==o&&t.colors.push((new bi).fromArray(o,l));function u(e,n,i,r){var l=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[i].clone()],u=new Ti(e,n,i,void 0===a?[]:[(new rn).fromArray(a,3*e),(new rn).fromArray(a,3*n),(new rn).fromArray(a,3*i)],l,r);t.faces.push(u),void 0!==s&&t.faceVertexUvs[0].push([(new qt).fromArray(s,2*e),(new qt).fromArray(s,2*n),(new qt).fromArray(s,2*i)]),void 0!==c&&t.faceVertexUvs[1].push([(new qt).fromArray(c,2*e),(new qt).fromArray(c,2*n),(new qt).fromArray(c,2*i)])}var h=e.groups;if(h.length>0)for(l=0;l<h.length;l++)for(var d=h[l],p=d.start,f=p,m=p+d.count;f<m;f+=3)void 0!==n?u(n[f],n[f+1],n[f+2],d.materialIndex):u(f,f+1,f+2,d.materialIndex);else if(void 0!==n)for(l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(l=0;l<r.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(xr).negate(),this.translate(xr.x,xr.y,xr.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new dn;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){for(var e=new rn,t=new rn,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b];e.subVectors(this.vertices[r.c],o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new rn;if(e){var s,c,l=new rn,u=new rn;for(i=0,r=this.faces.length;i<r;i++)s=this.vertices[(a=this.faces[i]).a],l.subVectors(this.vertices[a.c],c=this.vertices[a.b]),u.subVectors(s,c),l.cross(u),o[a.a].add(l),o[a.b].add(l),o[a.c].add(l)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(i=0,r=this.faces.length;i<r;i++){var h=(a=this.faces[i]).vertexNormals;3===h.length?(h[0].copy(o[a.a]),h[1].copy(o[a.b]),h[2].copy(o[a.c])):(h[0]=o[a.a].clone(),h[1]=o[a.b].clone(),h[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new _r;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)c=new rn,l={a:new rn,b:new rn,c:new rn},o.push(c),s.push(l)}var c,l,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)l=u.vertexNormals[n],(c=u.faceNormals[n]).copy((r=this.faces[n]).normal),l.a.copy(r.vertexNormals[0]),l.b.copy(r.vertexNormals[1]),l.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Wn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Yn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new Xt).getNormalMatrix(t));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==t&&p.applyMatrix4(t),a.push(p)}for(h=0,d=u.length;h<d;h++)l.push(u[h].clone());for(h=0,d=c.length;h<d;h++){var f,m,g=c[h],v=g.vertexNormals,y=g.vertexColors;(f=new Ti(g.a+r,g.b+r,g.c+r)).normal.copy(g.normal),void 0!==i&&f.normal.applyMatrix3(i).normalize();for(var x=0,_=v.length;x<_;x++)m=v[x].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(x=0,_=y.length;x<_;x++)f.vertexColors.push(y[x].clone());f.materialIndex=g.materialIndex+n,s.push(f)}for(h=0,d=e.faceVertexUvs.length;h<d;h++){var b=e.faceVertexUvs[h];void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]);for(x=0,_=b.length;x<_;x++){for(var w=b[x],M=[],E=0,T=w.length;E<T;E++)M.push(w[E].clone());this.faceVertexUvs[h].push(M)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,i,r,a,o,s,c={},l=[],u=[],h=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)e=this.vertices[n],void 0===c[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(c[t]=n,l.push(this.vertices[n]),u[n]=l.length-1):u[n]=u[c[t]];var d=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=u[r.a],r.b=u[r.b],r.c=u[r.c],a=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new rn(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]);for(n=0;n<t;n++){var s=e[n]._id;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],u={},h=[],d={};for(r=0;r<this.faces.length;r++){var p=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=p.normal.length()>0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var _=this.faceVertexUvs[0][r];o.push(S(_[0]),S(_[1]),S(_[2]))}if(m&&o.push(E(p.normal)),g){var b=p.vertexNormals;o.push(E(b[0]),E(b[1]),E(b[2]))}if(v&&o.push(T(p.color)),y){var w=p.vertexColors;o.push(T(w[0]),T(w[1]),T(w[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]?c[t]:(c[t]=s.length/3,s.push(e.x,e.y,e.z),c[t])}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]?u[t]:(u[t]=l.length,l.push(e.getHex()),u[t])}function S(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]?d[t]:(d[t]=h.length/2,h.push(e.x,e.y),d[t])}return e.data={},e.data.vertices=i,e.data.normals=s,l.length>0&&(e.data.colors=l),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new _r).copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),i=0,r=u.length;i<r;i++){var h=u[i],d=[];for(a=0,o=h.length;a<o;a++){d.push(h[a].clone())}this.faceVertexUvs[t].push(d)}}var p=e.morphTargets;for(t=0,n=p.length;t<n;t++){var f={};if(f.name=p[t].name,void 0!==p[t].vertices)for(f.vertices=[],i=0,r=p[t].vertices.length;i<r;i++)f.vertices.push(p[t].vertices[i].clone());if(void 0!==p[t].normals)for(f.normals=[],i=0,r=p[t].normals.length;i<r;i++)f.normals.push(p[t].normals[i].clone());this.morphTargets.push(f)}var m=e.morphNormals;for(t=0,n=m.length;t<n;t++){var g={};if(void 0!==m[t].vertexNormals)for(g.vertexNormals=[],i=0,r=m[t].vertexNormals.length;i<r;i++){var v=m[t].vertexNormals[i],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),g.vertexNormals.push(y)}if(void 0!==m[t].faceNormals)for(g.faceNormals=[],i=0,r=m[t].faceNormals.length;i<r;i++)g.faceNormals.push(m[t].faceNormals[i].clone());this.morphNormals.push(g)}var x=e.skinWeights;for(t=0,n=x.length;t<n;t++)this.skinWeights.push(x[t].clone());var _=e.skinIndices;for(t=0,n=_.length;t<n;t++)this.skinIndices.push(_[t].clone());var b=e.lineDistances;for(t=0,n=b.length;t<n;t++)this.lineDistances.push(b[t]);var w=e.boundingBox;null!==w&&(this.boundingBox=w.clone());var M=e.boundingSphere;return null!==M&&(this.boundingSphere=M.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var br=function(e){function t(t,n,i,r,a,o){e.call(this),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:i,widthSegments:r,heightSegments:a,depthSegments:o},this.fromBufferGeometry(new wr(t,n,i,r,a,o)),this.mergeVertices()}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(_r),wr=function(e){function t(t,n,i,r,a,o){e.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:n,depth:i,widthSegments:r,heightSegments:a,depthSegments:o};var s=this;t=t||1,n=n||1,i=i||1,r=Math.floor(r)||1,a=Math.floor(a)||1,o=Math.floor(o)||1;var c=[],l=[],u=[],h=[],d=0,p=0;function f(e,t,n,i,r,a,o,f,m,g,v){var y,x,_=a/m,b=o/g,w=a/2,M=o/2,E=f/2,T=m+1,S=g+1,A=0,R=0,L=new rn;for(x=0;x<S;x++){var C=x*b-M;for(y=0;y<T;y++){L[e]=(y*_-w)*i,L[t]=C*r,L[n]=E,l.push(L.x,L.y,L.z),L[e]=0,L[t]=0,L[n]=f>0?1:-1,u.push(L.x,L.y,L.z),h.push(y/m),h.push(1-x/g),A+=1}}for(x=0;x<g;x++)for(y=0;y<m;y++){var P=d+y+T*(x+1),O=d+(y+1)+T*(x+1),N=d+(y+1)+T*x;c.push(d+y+T*x,P,N),c.push(P,O,N),R+=6}s.addGroup(p,R,v),p+=R,d+=A}f("z","y","x",-1,-1,i,n,t,o,a,0),f("z","y","x",1,-1,i,n,-t,o,a,1),f("x","z","y",1,1,t,i,n,r,o,2),f("x","z","y",1,-1,t,i,-n,r,o,3),f("x","y","z",1,-1,t,n,i,r,a,4),f("x","y","z",-1,-1,t,n,-i,r,a,5),this.setIndex(c),this.setAttribute("position",new Bi(l,3)),this.setAttribute("normal",new Bi(u,3)),this.setAttribute("uv",new Bi(h,2))}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(Zi);function Mr(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];t[n][i]=r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?r.clone():Array.isArray(r)?r.slice():r}return t}function Er(e){for(var t={},n=0;n<e.length;n++){var i=Mr(e[n]);for(var r in i)t[r]=i[r]}return t}var Tr={clone:Mr,merge:Er},Sr="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",Ar="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function Rr(e){Ai.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Sr,this.fragmentShader=Ar,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,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function Lr(){Cn.call(this),this.type="Camera",this.matrixWorldInverse=new dn,this.projectionMatrix=new dn,this.projectionMatrixInverse=new dn}function Cr(e,t,n,i){Lr.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}(Rr.prototype=Object.create(Ai.prototype)).constructor=Rr,Rr.prototype.isShaderMaterial=!0,Rr.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Mr(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Rr.prototype.toJSON=function(e){var t=Ai.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var i=this.uniforms[n].value;t.uniforms[n]=i&&i.isTexture?{type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?{type:"c",value:i.getHex()}:i&&i.isVector2?{type:"v2",value:i.toArray()}:i&&i.isVector3?{type:"v3",value:i.toArray()}:i&&i.isVector4?{type:"v4",value:i.toArray()}:i&&i.isMatrix3?{type:"m3",value:i.toArray()}:i&&i.isMatrix4?{type:"m4",value:i.toArray()}:{value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},Lr.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Lr,isCamera:!0,copy:function(e,t){return Cn.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new rn),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Cn.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){Cn.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Cr.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Cr,isPerspectiveCamera:!0,copy:function(e,t){return Lr.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Wt.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Wt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Wt.RAD2DEG*Math.atan(Math.tan(.5*Wt.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(e,t,n,i,r,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Wt.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Cn.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var Pr=90,Or=1;function Nr(e,t,n,i){Cn.call(this),this.type="CubeCamera";var r=new Cr(Pr,Or,e,t);r.up.set(0,-1,0),r.lookAt(new rn(1,0,0)),this.add(r);var a=new Cr(Pr,Or,e,t);a.up.set(0,-1,0),a.lookAt(new rn(-1,0,0)),this.add(a);var o=new Cr(Pr,Or,e,t);o.up.set(0,0,1),o.lookAt(new rn(0,1,0)),this.add(o);var s=new Cr(Pr,Or,e,t);s.up.set(0,0,-1),s.lookAt(new rn(0,-1,0)),this.add(s);var c=new Cr(Pr,Or,e,t);c.up.set(0,-1,0),c.lookAt(new rn(0,0,1)),this.add(c);var l=new Cr(Pr,Or,e,t);l.up.set(0,-1,0),l.lookAt(new rn(0,0,-1)),this.add(l),this.renderTarget=new Ir(n,i=i||{format:Ee,magFilter:ce,minFilter:ce}),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),i=this.renderTarget,u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,a),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,s),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=u,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(n)},this.clear=function(e,t,n,i){for(var r=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,n,i);e.setRenderTarget(r)}}function Ir(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),Qt.call(this,e,e,t)}function Dr(e,t,n,i,r,a,o,s,c,l,u,h){Jt.call(this,null,a,o,s,c,l,i,r,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==c?c:ae,this.minFilter=void 0!==l?l:ae,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}(Nr.prototype=Object.create(Cn.prototype)).constructor=Nr,(Ir.prototype=Object.create(Qt.prototype)).constructor=Ir,Ir.prototype.isWebGLCubeRenderTarget=!0,Ir.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Pn,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new Rr({type:"CubemapFromEquirect",uniforms:Mr(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:c,blending:u});r.uniforms.tEquirect.value=t;var a=new pr(new wr(5,5,5),r);n.add(a);var o=new Nr(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(e,n),a.geometry.dispose(),a.material.dispose(),this},(Dr.prototype=Object.create(Jt.prototype)).constructor=Dr,Dr.prototype.isDataTexture=!0;var Hr=new Yn,Fr=new rn;function Br(e,t,n,i,r,a){this.planes=[void 0!==e?e:new oi,void 0!==t?t:new oi,void 0!==n?n:new oi,void 0!==i?i:new oi,void 0!==r?r:new oi,void 0!==a?a:new oi]}Object.assign(Br.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=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 t[0].setComponents(o-i,u-s,f-h,y-m).normalize(),t[1].setComponents(o+i,u+s,f+h,y+m).normalize(),t[2].setComponents(o+r,u+c,f+d,y+g).normalize(),t[3].setComponents(o-r,u-c,f-d,y-g).normalize(),t[4].setComponents(o-a,u-l,f-p,y-v).normalize(),t[5].setComponents(o+a,u+l,f+p,y+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Hr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Hr)},intersectsSprite:function(e){return Hr.center.set(0,0,0),Hr.radius=.7071067811865476,Hr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hr)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(Fr.x=i.normal.x>0?e.max.x:e.min.x,Fr.y=i.normal.y>0?e.max.y:e.min.y,Fr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Fr)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var zr={common:{diffuse:{value:new bi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Xt},uv2Transform:{value:new Xt},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 qt(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 bi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new bi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new bi(15658734)},opacity:{value:1},center:{value:new qt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Xt}}};function Ur(){var e=null,t=!1,n=null;function i(r,a){!1!==t&&(n(r,a),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Gr(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){t.isInterleavedBufferAttribute&&(t=t.data);var a=i.get(t);void 0===a?i.set(t,function(t,n){var i=t.array,r=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=5126;return i instanceof Float32Array?o=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=5123:i instanceof Int16Array?o=5122:i instanceof Uint32Array?o=5125:i instanceof Int32Array?o=5124:i instanceof Int8Array?o=5120:i instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,r)):a.version<t.version&&(function(t,i,r){var a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,t,r),a.version=t.version)}}}function kr(e,t,n,i){_r.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new Vr(e,t,n,i)),this.mergeVertices()}function Vr(e,t,n,i){Zi.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};var r,a,o=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(n)||1,l=Math.floor(i)||1,u=c+1,h=l+1,d=e/c,p=t/l,f=[],m=[],g=[],v=[];for(a=0;a<h;a++){var y=a*p-s;for(r=0;r<u;r++){m.push(r*d-o,-y,0),g.push(0,0,1),v.push(r/c),v.push(1-a/l)}}for(a=0;a<l;a++)for(r=0;r<c;r++){var x=r+u*(a+1),_=r+1+u*(a+1),b=r+1+u*a;f.push(r+u*a,x,b),f.push(x,_,b)}this.setIndex(f),this.setAttribute("position",new Bi(m,3)),this.setAttribute("normal",new Bi(g,3)),this.setAttribute("uv",new Bi(v,2))}(kr.prototype=Object.create(_r.prototype)).constructor=kr,(Vr.prototype=Object.create(Zi.prototype)).constructor=Vr;var jr={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 ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#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 return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\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\t\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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\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 vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",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;\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\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\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\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\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\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\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\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\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\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;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\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\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\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\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\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\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\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\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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 );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\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 ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\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 );\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#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#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#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#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#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#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\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\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\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\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\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\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\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;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",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;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\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 <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 <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 <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}",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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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 <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}",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 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 <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 <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_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 + reflectedLight.directSpecular + reflectedLight.indirectSpecular + 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 TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\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 <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 <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}"},Wr={basic:{uniforms:Er([zr.common,zr.specularmap,zr.envmap,zr.aomap,zr.lightmap,zr.fog]),vertexShader:jr.meshbasic_vert,fragmentShader:jr.meshbasic_frag},lambert:{uniforms:Er([zr.common,zr.specularmap,zr.envmap,zr.aomap,zr.lightmap,zr.emissivemap,zr.fog,zr.lights,{emissive:{value:new bi(0)}}]),vertexShader:jr.meshlambert_vert,fragmentShader:jr.meshlambert_frag},phong:{uniforms:Er([zr.common,zr.specularmap,zr.envmap,zr.aomap,zr.lightmap,zr.emissivemap,zr.bumpmap,zr.normalmap,zr.displacementmap,zr.fog,zr.lights,{emissive:{value:new bi(0)},specular:{value:new bi(1118481)},shininess:{value:30}}]),vertexShader:jr.meshphong_vert,fragmentShader:jr.meshphong_frag},standard:{uniforms:Er([zr.common,zr.envmap,zr.aomap,zr.lightmap,zr.emissivemap,zr.bumpmap,zr.normalmap,zr.displacementmap,zr.roughnessmap,zr.metalnessmap,zr.fog,zr.lights,{emissive:{value:new bi(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:jr.meshphysical_vert,fragmentShader:jr.meshphysical_frag},toon:{uniforms:Er([zr.common,zr.specularmap,zr.aomap,zr.lightmap,zr.emissivemap,zr.bumpmap,zr.normalmap,zr.displacementmap,zr.gradientmap,zr.fog,zr.lights,{emissive:{value:new bi(0)},specular:{value:new bi(1118481)},shininess:{value:30}}]),vertexShader:jr.meshtoon_vert,fragmentShader:jr.meshtoon_frag},matcap:{uniforms:Er([zr.common,zr.bumpmap,zr.normalmap,zr.displacementmap,zr.fog,{matcap:{value:null}}]),vertexShader:jr.meshmatcap_vert,fragmentShader:jr.meshmatcap_frag},points:{uniforms:Er([zr.points,zr.fog]),vertexShader:jr.points_vert,fragmentShader:jr.points_frag},dashed:{uniforms:Er([zr.common,zr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:jr.linedashed_vert,fragmentShader:jr.linedashed_frag},depth:{uniforms:Er([zr.common,zr.displacementmap]),vertexShader:jr.depth_vert,fragmentShader:jr.depth_frag},normal:{uniforms:Er([zr.common,zr.bumpmap,zr.normalmap,zr.displacementmap,{opacity:{value:1}}]),vertexShader:jr.normal_vert,fragmentShader:jr.normal_frag},sprite:{uniforms:Er([zr.sprite,zr.fog]),vertexShader:jr.sprite_vert,fragmentShader:jr.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null}},vertexShader:jr.background_vert,fragmentShader:jr.background_frag},cube:{uniforms:Er([zr.envmap,{opacity:{value:1}}]),vertexShader:jr.cube_vert,fragmentShader:jr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:jr.equirect_vert,fragmentShader:jr.equirect_frag},distanceRGBA:{uniforms:Er([zr.common,zr.displacementmap,{referencePosition:{value:new rn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:jr.distanceRGBA_vert,fragmentShader:jr.distanceRGBA_frag},shadow:{uniforms:Er([zr.lights,zr.fog,{color:{value:new bi(0)},opacity:{value:1}}]),vertexShader:jr.shadow_vert,fragmentShader:jr.shadow_frag}};function qr(e,t,n,i){var r,a,o=new bi(0),l=0,u=null,h=0,d=null;function p(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,i)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),p(o,l=void 0!==t?t:1)},getClearAlpha:function(){return l},setClearAlpha:function(e){p(o,l=e)},render:function(t,i,f,m){var g=i.background,v=e.xr,y=v.getSession&&v.getSession();if(y&&"additive"===y.environmentBlendMode&&(g=null),null===g?p(o,l):g&&g.isColor&&(p(g,1),m=!0),(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.isWebGLCubeRenderTarget||g.mapping===ee)){void 0===a&&((a=new pr(new wr(1,1,1),new Rr({type:"BackgroundCubeMaterial",uniforms:Mr(Wr.cube.uniforms),vertexShader:Wr.cube.vertexShader,fragmentShader:Wr.cube.fragmentShader,side:c,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a));var x=g.isWebGLCubeRenderTarget?g.texture:g;a.material.uniforms.envMap.value=x,a.material.uniforms.flipEnvMap.value=x.isCubeTexture?-1:1,u===g&&h===x.version&&d===e.toneMapping||(a.material.needsUpdate=!0,u=g,h=x.version,d=e.toneMapping),t.unshift(a,a.geometry,a.material,0,0,null)}else g&&g.isTexture&&(void 0===r&&((r=new pr(new Vr(2,2),new Rr({type:"BackgroundMaterial",uniforms:Mr(Wr.background.uniforms),vertexShader:Wr.background.vertexShader,fragmentShader:Wr.background.fragmentShader,side:s,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(r)),r.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),r.material.uniforms.uvTransform.value.copy(g.matrix),u===g&&h===g.version&&d===e.toneMapping||(r.material.needsUpdate=!0,u=g,h=g.version,d=e.toneMapping),t.unshift(r,r.geometry,r.material,0,0,null))}}}function Xr(e,t,n,i){var r,a=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r)},this.renderInstances=function(i,o,s,c){if(0!==c){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](r,o,s,c),n.update(s,r,c)}}}function Yr(e,t,n){var i;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===n.logarithmicDepthBuffer,l=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=u>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function Zr(){var e=this,t=null,n=0,i=!1,r=!1,a=new oi,o=new Xt,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,i,r){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==r||null===l){var u=i+4*c,h=n.matrixWorldInverse;o.getNormalMatrix(h),(null===l||l.length<u)&&(l=new Float32Array(u));for(var d=0,p=i;d!==c;++d,p+=4)a.copy(t[d]).applyMatrix4(h,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,r,a){var o=0!==e.length||r||0!==n||i;return i=r,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){r=!0,l(null)},this.endShadows=function(){r=!1,c()},this.setState=function(e,a,o,u,h,d){if(!i||null===e||0===e.length||r&&!o)r?l(null):c();else{var p=r?0:n,f=4*p,m=h.clippingState||null;s.value=m,m=l(e,u,f,d);for(var g=0;g!==f;++g)m[g]=t[g];h.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}}}function Jr(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function Kr(e,t,n){var i=new WeakMap,r=new WeakMap;function a(e){var o=e.target,s=i.get(o);for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener("dispose",a),i.delete(o);var l=r.get(s);l&&(t.remove(l),r.delete(s)),n.memory.geometries--}function o(e){var n=[],i=e.index,a=e.attributes.position,o=0;if(null!==i){o=i.version;for(var s=0,c=(l=i.array).length;s<c;s+=3){n.push(u=l[s+0],h=l[s+1],h,d=l[s+2],d,u)}}else{var l;o=a.version;for(s=0,c=(l=a.array).length/3-1;s<c;s+=3){var u,h,d;n.push(u=s+0,h=s+1,h,d=s+2,d,u)}}var p=new(Gi(n)>65535?Fi:Di)(n,1);p.version=o,t.update(p,34963);var f=r.get(e);f&&t.remove(f),r.set(e,p)}return{get:function(e,t){var r=i.get(t);return r||(t.addEventListener("dispose",a),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Zi).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){var n=e.index,i=e.attributes;for(var r in null!==n&&t.update(n,34963),i)t.update(i[r],34962);var a=e.morphAttributes;for(var r in a)for(var o=a[r],s=0,c=o.length;s<c;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=r.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return r.get(e)}}}function Qr(e,t,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,a,t*o),n.update(i,r)},this.renderInstances=function(i,c,l,u){if(0!==u){var h,d;if(s)h=e,d="drawElementsInstanced";else if(d="drawElementsInstancedANGLE",null===(h=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](r,l,a,c*o,u),n.update(l,r,u)}}}function $r(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,i){switch(i=i||1,t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function ea(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ta(e){var t={},n=new Float32Array(8);return{update:function(i,r,a,o){var s=i.morphTargetInfluences,c=void 0===s?0:s.length,l=t[r.id];if(void 0===l){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[r.id]=l}var h=a.morphTargets&&r.morphAttributes.position,d=a.morphNormals&&r.morphAttributes.normal;for(u=0;u<c;u++)0!==(f=l[u])[1]&&(h&&r.deleteAttribute("morphTarget"+u),d&&r.deleteAttribute("morphNormal"+u));for(u=0;u<c;u++)(f=l[u])[0]=u,f[1]=s[u];l.sort(ea);var p=0;for(u=0;u<8;u++){var f;if(f=l[u]){var m=f[0],g=f[1];if(g){h&&r.setAttribute("morphTarget"+u,h[m]),d&&r.setAttribute("morphNormal"+u,d[m]),n[u]=g,p+=g;continue}}n[u]=0}var v=r.morphTargetsRelative?1:1-p;o.getUniforms().setValue(e,"morphTargetBaseInfluence",v),o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function na(e,t,n,i){var r=new WeakMap;return{update:function(e){var a=i.render.frame,o=e.geometry,s=t.get(e,o);return r.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),r.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){r=new WeakMap}}}function ia(e,t,n,i,r,a,o,s,c,l){Jt.call(this,e=void 0!==e?e:[],t=void 0!==t?t:Z,n,i,r,a,o=void 0!==o?o:Ee,s,c,l),this.flipY=!1}function ra(e,t,n,i){Jt.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=ae,this.minFilter=ae,this.wrapR=ie,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function aa(e,t,n,i){Jt.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=ae,this.minFilter=ae,this.wrapR=ie,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Wr.physical={uniforms:Er([Wr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new qt(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new bi(0)},transparency:{value:0}}]),vertexShader:jr.meshphysical_vert,fragmentShader:jr.meshphysical_frag},(ia.prototype=Object.create(Jt.prototype)).constructor=ia,ia.prototype.isCubeTexture=!0,Object.defineProperty(ia.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),(ra.prototype=Object.create(Jt.prototype)).constructor=ra,ra.prototype.isDataTexture2DArray=!0,(aa.prototype=Object.create(Jt.prototype)).constructor=aa,aa.prototype.isDataTexture3D=!0;var oa=new Jt,sa=new ra,ca=new aa,la=new ia,ua=[],ha=[],da=new Float32Array(16),pa=new Float32Array(9),fa=new Float32Array(4);function ma(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=ua[r];if(void 0===a&&(a=new Float32Array(r),ua[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)e[o].toArray(a,s+=n)}return a}function ga(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function va(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function ya(e,t){var n=ha[t];void 0===n&&(n=new Int32Array(t),ha[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function xa(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function _a(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ga(n,t))return;e.uniform2fv(this.addr,t),va(n,t)}}function ba(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(ga(n,t))return;e.uniform3fv(this.addr,t),va(n,t)}}function wa(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ga(n,t))return;e.uniform4fv(this.addr,t),va(n,t)}}function Ma(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(ga(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),va(n,t)}else{if(ga(n,i))return;fa.set(i),e.uniformMatrix2fv(this.addr,!1,fa),va(n,i)}}function Ea(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(ga(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),va(n,t)}else{if(ga(n,i))return;pa.set(i),e.uniformMatrix3fv(this.addr,!1,pa),va(n,i)}}function Ta(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(ga(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),va(n,t)}else{if(ga(n,i))return;da.set(i),e.uniformMatrix4fv(this.addr,!1,da),va(n,i)}}function Sa(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||oa,r)}function Aa(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||sa,r)}function Ra(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||ca,r)}function La(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||la,r)}function Ca(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Pa(e,t){var n=this.cache;ga(n,t)||(e.uniform2iv(this.addr,t),va(n,t))}function Oa(e,t){var n=this.cache;ga(n,t)||(e.uniform3iv(this.addr,t),va(n,t))}function Na(e,t){var n=this.cache;ga(n,t)||(e.uniform4iv(this.addr,t),va(n,t))}function Ia(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Da(e,t){e.uniform1fv(this.addr,t)}function Ha(e,t){e.uniform1iv(this.addr,t)}function Fa(e,t){e.uniform2iv(this.addr,t)}function Ba(e,t){e.uniform3iv(this.addr,t)}function za(e,t){e.uniform4iv(this.addr,t)}function Ua(e,t){var n=ma(t,this.size,2);e.uniform2fv(this.addr,n)}function Ga(e,t){var n=ma(t,this.size,3);e.uniform3fv(this.addr,n)}function ka(e,t){var n=ma(t,this.size,4);e.uniform4fv(this.addr,n)}function Va(e,t){var n=ma(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function ja(e,t){var n=ma(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Wa(e,t){var n=ma(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function qa(e,t,n){var i=t.length,r=ya(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTexture2D(t[a]||oa,r[a])}function Xa(e,t,n){var i=t.length,r=ya(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTextureCube(t[a]||la,r[a])}function Ya(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return xa;case 35664:return _a;case 35665:return ba;case 35666:return wa;case 35674:return Ma;case 35675:return Ea;case 35676:return Ta;case 5124:case 35670:return Ca;case 35667:case 35671:return Pa;case 35668:case 35672:return Oa;case 35669:case 35673:return Na;case 5125:return Ia;case 35678:case 36198:case 36298:case 36306:case 35682:return Sa;case 35679:case 36299:case 36307:return Ra;case 35680:case 36300:case 36308:case 36293:return La;case 36289:case 36303:case 36311:case 36292:return Aa}}(t.type)}function Za(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Da;case 35664:return Ua;case 35665:return Ga;case 35666:return ka;case 35674:return Va;case 35675:return ja;case 35676:return Wa;case 5124:case 35670:return Ha;case 35667:case 35671:return Fa;case 35668:case 35672:return Ba;case 35669:case 35673:return za;case 35678:case 36198:case 36298:case 36306:case 35682:return qa;case 35680:case 36300:case 36308:case 36293:return Xa}}(t.type)}function Ja(e){this.id=e,this.seq=[],this.map={}}Za.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),va(t,e)},Ja.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}};var Ka=/([\w\d_]+)(\])?(\[|\.)?/g;function Qa(e,t){e.seq.push(t),e.map[t.id]=t}function $a(e,t,n){var i=e.name,r=i.length;for(Ka.lastIndex=0;;){var a=Ka.exec(i),o=a[1],s=a[3];if("]"===a[2]&&(o|=0),void 0===s||"["===s&&Ka.lastIndex+2===r){Qa(n,void 0===s?new Ya(o,e,t):new Za(o,e,t));break}var c=n.map[o];void 0===c&&Qa(n,c=new Ja(o)),n=c}}function eo(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i);$a(r,e.getUniformLocation(t,r.name),this)}}function to(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}eo.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},eo.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},eo.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},eo.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};var no=0;function io(e){switch(e){case Tt:return["Linear","( value )"];case St:return["sRGB","( value )"];case Rt:return["RGBE","( value )"];case Ct:return["RGBM","( value, 7.0 )"];case Pt:return["RGBM","( value, 16.0 )"];case Ot:return["RGBD","( value, 256.0 )"];case At:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Lt:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function ro(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function ao(e,t){var n=io(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function oo(e,t){var n;switch(t){case j:n="Linear";break;case W:n="Reinhard";break;case q:n="Uncharted2";break;case X:n="OptimizedCineon";break;case Y:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function so(e){return""!==e}function co(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function lo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var uo=/^[ \t]*#include +<([\w\d./]+)>/gm;function ho(e){return e.replace(uo,po)}function po(e,t){var n=jr[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return ho(n)}var fo=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,mo=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function go(e){return e.replace(mo,yo).replace(fo,vo)}function vo(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),yo(e,t,n,i)}function yo(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function xo(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function _o(e,t,n){var i,s,c,l,u,h=e.getContext(),d=n.defines,p=n.vertexShader,f=n.fragmentShader,m=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===r?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===a?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===o&&(t="SHADOWMAP_TYPE_VSM"),t}(n),g=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Z:case J:t="ENVMAP_TYPE_CUBE";break;case ee:case te:t="ENVMAP_TYPE_CUBE_UV";break;case K:case Q:t="ENVMAP_TYPE_EQUIREC";break;case $:t="ENVMAP_TYPE_SPHERE"}return t}(n),v=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case J:case Q:t="ENVMAP_MODE_REFRACTION"}return t}(n),y=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case U:t="ENVMAP_BLENDING_MULTIPLY";break;case G:t="ENVMAP_BLENDING_MIX";break;case k:t="ENVMAP_BLENDING_ADD"}return t}(n),x=e.gammaFactor>0?e.gammaFactor:1,_=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(so).join("\n")}(n),b=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(d),w=h.createProgram();if(n.isRawShaderMaterial?((i=[b].filter(so).join("\n")).length>0&&(i+="\n"),(s=[_,b].filter(so).join("\n")).length>0&&(s+="\n")):(i=[xo(n),"#define SHADER_NAME "+n.shaderName,b,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#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 "+v:"",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.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 "+m:"",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"," attribute mat4 instanceMatrix;","#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(so).join("\n"),s=[_,xo(n),"#define SHADER_NAME "+n.shaderName,b,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+x,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 "+g:"",n.envMap?"#define "+v:"",n.envMap?"#define "+y:"",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.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#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 "+m:"",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!==V?"#define TONE_MAPPING":"",n.toneMapping!==V?jr.tonemapping_pars_fragment:"",n.toneMapping!==V?oo("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?jr.encodings_pars_fragment:"",n.mapEncoding?ao("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?ao("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?ao("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?ao("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?ao("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(c="linearToOutputTexel",l=n.outputEncoding,u=io(l),"vec4 "+c+"( vec4 value ) { return LinearTo"+u[0]+u[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(so).join("\n")),p=lo(p=co(p=ho(p),n),n),f=lo(f=co(f=ho(f),n),n),p=go(p),f=go(f),n.isWebGL2&&!n.isRawShaderMaterial){var M=!1,E=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==p.match(E)&&null!==f.match(E)&&(M=!0,p=p.replace(E,""),f=f.replace(E,"")),i=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,s=["#version 300 es\n","#define varying in",M?"":"out highp vec4 pc_fragColor;",M?"":"#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"+s}var T,S,A=s+f,R=to(h,35633,i+p),L=to(h,35632,A);if(h.attachShader(w,R),h.attachShader(w,L),void 0!==n.index0AttributeName?h.bindAttribLocation(w,0,n.index0AttributeName):!0===n.morphTargets&&h.bindAttribLocation(w,0,"position"),h.linkProgram(w),e.debug.checkShaderErrors){var C=h.getProgramInfoLog(w).trim(),P=h.getShaderInfoLog(R).trim(),O=h.getShaderInfoLog(L).trim(),N=!0,I=!0;if(!1===h.getProgramParameter(w,35714)){N=!1;var D=ro(h,R,"vertex"),H=ro(h,L,"fragment");console.error("THREE.WebGLProgram: shader error: ",h.getError(),"35715",h.getProgramParameter(w,35715),"gl.getProgramInfoLog",C,D,H)}else""!==C?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):""!==P&&""!==O||(I=!1);I&&(this.diagnostics={runnable:N,programLog:C,vertexShader:{log:P,prefix:i},fragmentShader:{log:O,prefix:s}})}return h.detachShader(w,R),h.detachShader(w,L),h.deleteShader(R),h.deleteShader(L),this.getUniforms=function(){return void 0===T&&(T=new eo(h,w)),T},this.getAttributes=function(){return void 0===S&&(S=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n}(h,w)),S},this.destroy=function(){h.deleteProgram(w),this.program=void 0},this.name=n.shaderName,this.id=no++,this.cacheKey=t,this.usedTimes=1,this.program=w,this.vertexShader=R,this.fragmentShader=L,this}function bo(e,t,n){var i=[],r=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,u=n.maxVertexUniforms,h=n.vertexTextures,d={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"},p=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","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"];function f(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=Tt,t}this.getParameters=function(i,p,m,g,v,y,x){var _=g.fog,b=i.envMap||(i.isMeshStandardMaterial?g.environment:null),w=d[i.type],M=x.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var n=Math.floor((u-20)/4),i=Math.min(n,t.length);return i<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(x):0;null!==i.precision&&(s=n.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",s,"instead.");var E=function(e,t){var n;if(t){var i=Wr[t];n={name:e.type,uniforms:Tr.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(i,w);i.onBeforeCompile(E,e);var T=e.getRenderTarget();return{isWebGL2:r,shaderID:w,shaderName:E.name,uniforms:E.uniforms,vertexShader:E.vertexShader,fragmentShader:E.fragmentShader,defines:i.defines,isRawShaderMaterial:i.isRawShaderMaterial,isShaderMaterial:i.isShaderMaterial,precision:s,instancing:!0===x.isInstancedMesh,supportsVertexTextures:h,outputEncoding:null!==T?f(T.texture):e.outputEncoding,map:!!i.map,mapEncoding:f(i.map),matcap:!!i.matcap,matcapEncoding:f(i.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:f(b),envMapCubeUV:!!b&&(b.mapping===ee||b.mapping===te),lightMap:!!i.lightMap,lightMapEncoding:f(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:f(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:i.normalMapType===Ht,tangentSpaceNormalMap:i.normalMapType===Dt,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,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),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||!i.displacementMap),fog:!!_,useFog:i.fog,fogExp2:_&&_.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:a,skinning:i.skinning&&M>0,maxBones:M,useVertexTexture:o,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:p.directional.length,numPointLights:p.point.length,numSpotLights:p.spot.length,numRectAreaLights:p.rectArea.length,numHemiLights:p.hemi.length,numDirLightShadows:p.directionalShadowMap.length,numPointLightShadows:p.pointShadowMap.length,numSpotLightShadows:p.spotShadowMap.length,numClippingPlanes:v,numClipIntersection:y,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&m.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:V,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===l,flipSided:i.side===c,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:r||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:i.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(void 0===t.isRawShaderMaterial){for(var r=0;r<p.length;r++)n.push(t[p[r]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var r,a=0,o=i.length;a<o;a++){var s=i[a];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new _o(e,n,t),i.push(r)),r},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=i.indexOf(e);i[t]=i[i.length-1],i.pop(),e.destroy()}},this.programs=i}function wo(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&e.set(t,n={}),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function Mo(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Eo(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function To(){var e=[],t=0,n=[],i=[],r={id:-1};function a(n,i,a,o,s,c){var l=e[t];return void 0===l?e[t]=l={id:n.id,object:n,geometry:i,material:a,program:a.program||r,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c}:(l.id=n.id,l.object=n,l.geometry=i,l.material=a,l.program=a.program||r,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}return{opaque:n,transparent:i,init:function(){t=0,n.length=0,i.length=0},push:function(e,t,r,o,s,c){var l=a(e,t,r,o,s,c);(!0===r.transparent?i:n).push(l)},unshift:function(e,t,r,o,s,c){var l=a(e,t,r,o,s,c);(!0===r.transparent?i:n).unshift(l)},finish:function(){for(var n=t,i=e.length;n<i;n++){var r=e[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Mo),i.length>1&&i.sort(t||Eo)}}}function So(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r,a=e.get(n);return void 0===a?(r=new To,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=a.get(i))&&(r=new To,a.set(i,r)),r},dispose:function(){e=new WeakMap}}}function Ao(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new rn,color:new bi};break;case"SpotLight":n={position:new rn,direction:new rn,color:new bi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new rn,color:new bi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new rn,skyColor:new bi,groundColor:new bi};break;case"RectAreaLight":n={color:new bi,position:new rn,halfWidth:new rn,halfHeight:new rn}}return e[t.id]=n,n}}}var Ro=0;function Lo(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Co(){for(var e,t=new Ao,n=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new qt};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new qt,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.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:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)i.probe.push(new rn);var a=new rn,o=new dn,s=new dn;return{setup:function(e,r,c){for(var l=0,u=0,h=0,d=0;d<9;d++)i.probe[d].set(0,0,0);var p=0,f=0,m=0,g=0,v=0,y=0,x=0,_=0,b=c.matrixWorldInverse;e.sort(Lo),d=0;for(var w=e.length;d<w;d++){var M=e[d],E=M.color,T=M.intensity,S=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)l+=E.r*T,u+=E.g*T,h+=E.b*T;else if(M.isLightProbe)for(var R=0;R<9;R++)i.probe[R].addScaledVector(M.sh.coefficients[R],T);else if(M.isDirectionalLight){if((P=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),P.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),P.direction.sub(a),P.direction.transformDirection(b),M.castShadow){var L=M.shadow;(C=n.get(M)).shadowBias=L.bias,C.shadowRadius=L.radius,C.shadowMapSize=L.mapSize,i.directionalShadow[p]=C,i.directionalShadowMap[p]=A,i.directionalShadowMatrix[p]=M.shadow.matrix,y++}i.directional[p]=P,p++}else if(M.isSpotLight)(P=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(b),P.color.copy(E).multiplyScalar(T),P.distance=S,P.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),P.direction.sub(a),P.direction.transformDirection(b),P.coneCos=Math.cos(M.angle),P.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),P.decay=M.decay,M.castShadow&&(L=M.shadow,(C=n.get(M)).shadowBias=L.bias,C.shadowRadius=L.radius,C.shadowMapSize=L.mapSize,i.spotShadow[m]=C,i.spotShadowMap[m]=A,i.spotShadowMatrix[m]=M.shadow.matrix,_++),i.spot[m]=P,m++;else if(M.isRectAreaLight)(P=t.get(M)).color.copy(E).multiplyScalar(T),P.position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(b),s.identity(),o.copy(M.matrixWorld),o.premultiply(b),s.extractRotation(o),P.halfWidth.set(.5*M.width,0,0),P.halfHeight.set(0,.5*M.height,0),P.halfWidth.applyMatrix4(s),P.halfHeight.applyMatrix4(s),i.rectArea[g]=P,g++;else if(M.isPointLight){var C;if((P=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(b),P.color.copy(M.color).multiplyScalar(M.intensity),P.distance=M.distance,P.decay=M.decay,M.castShadow)L=M.shadow,(C=n.get(M)).shadowBias=L.bias,C.shadowRadius=L.radius,C.shadowMapSize=L.mapSize,C.shadowCameraNear=L.camera.near,C.shadowCameraFar=L.camera.far,i.pointShadow[f]=C,i.pointShadowMap[f]=A,i.pointShadowMatrix[f]=M.shadow.matrix,x++;i.point[f]=P,f++}else if(M.isHemisphereLight){var P;(P=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),P.direction.transformDirection(b),P.direction.normalize(),P.skyColor.copy(M.color).multiplyScalar(T),P.groundColor.copy(M.groundColor).multiplyScalar(T),i.hemi[v]=P,v++}}i.ambient[0]=l,i.ambient[1]=u,i.ambient[2]=h;var O=i.hash;O.directionalLength===p&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===g&&O.hemiLength===v&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===_||(i.directional.length=p,i.spot.length=m,i.rectArea.length=g,i.point.length=f,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=x,i.spotShadowMatrix.length=_,O.directionalLength=p,O.pointLength=f,O.spotLength=m,O.rectAreaLength=g,O.hemiLength=v,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=_,i.version=Ro++)},state:i}}function Po(){var e=new Co,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(i){e.setup(t,n,i)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function Oo(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r;return!1===e.has(n)?(r=new Po,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):!1===e.get(n).has(i)?(r=new Po,e.get(n).set(i,r)):r=e.get(n).get(i),r},dispose:function(){e=new WeakMap}}}function No(e){Ai.call(this),this.type="MeshDepthMaterial",this.depthPacking=Nt,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(e)}function Io(e){Ai.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new rn,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(e)}(No.prototype=Object.create(Ai.prototype)).constructor=No,No.prototype.isMeshDepthMaterial=!0,No.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},(Io.prototype=Object.create(Ai.prototype)).constructor=Io,Io.prototype.isMeshDistanceMaterial=!0,Io.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var Do="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",Ho="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function Fo(e,t,n){var i=new Br,a=new qt,h=new qt,d=new Kt,p=[],f=[],m={},g={0:c,1:s,2:l},v=new Rr({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new qt},radius:{value:4}},vertexShader:Ho,fragmentShader:Do}),y=v.clone();y.defines.HORIZONAL_PASS=1;var x=new Zi;x.setAttribute("position",new Ci(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var _=new pr(x,v),b=this;function w(n,i){var r=t.update(_);v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,v,_,null),y.uniforms.shadow_pass.value=n.mapPass.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,y,_,null)}function M(e,t,n){var i=e<<0|t<<1|n<<2,r=p[i];return void 0===r&&(r=new No({depthPacking:It,morphTargets:e,skinning:t}),p[i]=r),r}function E(e,t,n){var i=e<<0|t<<1|n<<2,r=f[i];return void 0===r&&(r=new Io({morphTargets:e,skinning:t}),f[i]=r),r}function T(t,n,i,r,a,s){var c=t.geometry,l=null,u=M,h=t.customDepthMaterial;if(!0===i.isPointLight&&(u=E,h=t.customDistanceMaterial),void 0===h){var d=!1;!0===n.morphTargets&&(!0===c.isBufferGeometry?d=c.morphAttributes&&c.morphAttributes.position&&c.morphAttributes.position.length>0:!0===c.isGeometry&&(d=c.morphTargets&&c.morphTargets.length>0));var p=!1;!0===t.isSkinnedMesh&&(!0===n.skinning?p=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(d,p,!0===t.isInstancedMesh)}else l=h;if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var f=l.uuid,v=n.uuid,y=m[f];void 0===y&&(m[f]=y={});var x=y[v];void 0===x&&(x=l.clone(),y[v]=x),l=x}return l.visible=n.visible,l.wireframe=n.wireframe,l.side=s===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:g[n.side],l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=r,l.farDistance=a),l}function S(n,r,a,s,c){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&c===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var h=l.groups,d=0,p=h.length;d<p;d++){var f=h[d],m=u[f.materialIndex];if(m&&m.visible){var g=T(n,m,s,a.near,a.far,c);e.renderBufferDirect(a,null,l,g,n,f)}}else if(u.visible){g=T(n,u,s,a.near,a.far,c);e.renderBufferDirect(a,null,l,g,n,null)}}for(var v=n.children,y=0,x=v.length;y<x;y++)S(v[y],r,a,s,c)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=r,this.render=function(t,r,s){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),l=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),f=e.state;f.setBlending(u),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var m=0,g=t.length;m<g;m++){var v=t[m],y=v.shadow;if(void 0!==y){a.copy(y.mapSize);var x,_=y.getFrameExtents();if(a.multiply(_),h.copy(y.mapSize),(a.x>n||a.y>n)&&(console.warn("THREE.WebGLShadowMap:",v,"has shadow exceeding max texture size, reducing"),a.x>n&&(h.x=Math.floor(n/_.x),a.x=h.x*_.x,y.mapSize.x=h.x),a.y>n&&(h.y=Math.floor(n/_.y),a.y=h.y*_.y,y.mapSize.y=h.y)),null===y.map&&!y.isPointLightShadow&&this.type===o)y.map=new Qt(a.x,a.y,x={minFilter:ce,magFilter:ce,format:Te}),y.map.texture.name=v.name+".shadowMap",y.mapPass=new Qt(a.x,a.y,x),y.camera.updateProjectionMatrix();if(null===y.map)y.map=new Qt(a.x,a.y,x={minFilter:ae,magFilter:ae,format:Te}),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix();e.setRenderTarget(y.map),e.clear();for(var M=y.getViewportCount(),E=0;E<M;E++){var T=y.getViewport(E);d.set(h.x*T.x,h.y*T.y,h.x*T.z,h.y*T.w),f.viewport(d),y.updateMatrices(v,E),i=y.getFrustum(),S(r,s,y.camera,v,this.type)}y.isPointLightShadow||this.type!==o||w(y,s)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}b.needsUpdate=!1,e.setRenderTarget(c,l,p)}}}function Bo(e,r,a){var o=a.isWebGL2;var s=new function(){var t=!1,n=new Kt,i=null,r=new Kt(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},U=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?xe(2929):_e(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case O:e.depthFunc(512);break;case N:e.depthFunc(519);break;case I:e.depthFunc(513);break;case D:e.depthFunc(515);break;case H:e.depthFunc(514);break;case F:e.depthFunc(518);break;case B:e.depthFunc(516);break;case z:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},G=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?xe(2960):_e(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&c===i||(e.stencilOp(t,n,i),o=t,s=n,c=i)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,c=null,l=null}}},k=e.getParameter(34921),V=new Uint8Array(k),j=new Uint8Array(k),W=new Uint8Array(k),q={},X=null,Y=null,Z=null,J=null,K=null,Q=null,$=null,ee=null,te=null,ne=!1,ie=null,re=null,ae=null,oe=null,se=null,ce=e.getParameter(35661),le=!1,ue=0,he=e.getParameter(7938);-1!==he.indexOf("WebGL")?(ue=parseFloat(/^WebGL\ ([0-9])/.exec(he)[1]),le=ue>=1):-1!==he.indexOf("OpenGL ES")&&(ue=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(he)[1]),le=ue>=2);var de=null,pe={},fe=new Kt,me=new Kt;function ge(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<i;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,r);return a}var ve={};function ye(t,n){(V[t]=1,0===j[t]&&(e.enableVertexAttribArray(t),j[t]=1),W[t]!==n)&&((o?e:r.get("ANGLE_instanced_arrays"))[o?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](t,n),W[t]=n)}function xe(t){!0!==q[t]&&(e.enable(t),q[t]=!0)}function _e(t){!1!==q[t]&&(e.disable(t),q[t]=!1)}ve[3553]=ge(3553,3553,1),ve[34067]=ge(34067,34069,6),s.setClear(0,0,0,1),U.setClear(1),G.setClear(0),xe(2929),U.setFunc(D),Te(!1),Se(n),xe(2884),Ee(u);var be={};if(be[g]=32774,be[v]=32778,be[y]=32779,o)be[x]=32775,be[_]=32776;else{var we=r.get("EXT_blend_minmax");null!==we&&(be[x]=we.MIN_EXT,be[_]=we.MAX_EXT)}var Me={};function Ee(t,n,i,r,a,o,s,c){if(t!==u){if(Y||(xe(3042),Y=!0),t===m)a=a||n,o=o||i,s=s||r,n===J&&a===$||(e.blendEquationSeparate(be[n],be[a]),J=n,$=a),i===K&&r===Q&&o===ee&&s===te||(e.blendFuncSeparate(Me[i],Me[r],Me[o],Me[s]),K=i,Q=r,ee=o,te=s),Z=t,ne=null;else if(t!==Z||c!==ne){if(J===g&&$===g||(e.blendEquation(32774),J=g,$=g),c)switch(t){case h:e.blendFuncSeparate(1,771,1,771);break;case d:e.blendFunc(1,1);break;case p:e.blendFuncSeparate(0,0,769,771);break;case f:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case h:e.blendFuncSeparate(770,771,1,771);break;case d:e.blendFunc(770,1);break;case p:e.blendFunc(0,769);break;case f:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}K=null,Q=null,ee=null,te=null,Z=t,ne=c}}else Y&&(_e(3042),Y=!1)}function Te(t){ie!==t&&(e.frontFace(t?2304:2305),ie=t)}function Se(r){r!==t?(xe(2884),r!==re&&e.cullFace(r===n?1029:r===i?1028:1032)):_e(2884),re=r}function Ae(t,n,i){t?(xe(32823),oe===n&&se===i||(e.polygonOffset(n,i),oe=n,se=i)):_e(32823)}function Re(t){void 0===t&&(t=33984+ce-1),de!==t&&(e.activeTexture(t),de=t)}return Me[b]=0,Me[w]=1,Me[M]=768,Me[T]=770,Me[P]=776,Me[L]=774,Me[A]=772,Me[E]=769,Me[S]=771,Me[C]=775,Me[R]=773,{buffers:{color:s,depth:U,stencil:G},initAttributes:function(){for(var e=0,t=V.length;e<t;e++)V[e]=0},enableAttribute:function(e){ye(e,0)},enableAttributeAndDivisor:ye,disableUnusedAttributes:function(){for(var t=0,n=j.length;t!==n;++t)j[t]!==V[t]&&(e.disableVertexAttribArray(t),j[t]=0)},enable:xe,disable:_e,useProgram:function(t){return X!==t&&(e.useProgram(t),X=t,!0)},setBlending:Ee,setMaterial:function(e,t){e.side===l?_e(2884):xe(2884);var n=e.side===c;t&&(n=!n),Te(n),e.blending===h&&!1===e.transparent?Ee(u):Ee(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),U.setFunc(e.depthFunc),U.setTest(e.depthTest),U.setMask(e.depthWrite),s.setMask(e.colorWrite);var i=e.stencilWrite;G.setTest(i),i&&(G.setMask(e.stencilWriteMask),G.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),G.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Ae(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Te,setCullFace:Se,setLineWidth:function(t){t!==ae&&(le&&e.lineWidth(t),ae=t)},setPolygonOffset:Ae,setScissorTest:function(e){e?xe(3089):_e(3089)},activeTexture:Re,bindTexture:function(t,n){null===de&&Re();var i=pe[de];void 0===i&&(pe[de]=i={type:void 0,texture:void 0}),i.type===t&&i.texture===n||(e.bindTexture(t,n||ve[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=pe[de];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===fe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),fe.copy(t))},viewport:function(t){!1===me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),me.copy(t))},reset:function(){for(var t=0;t<j.length;t++)1===j[t]&&(e.disableVertexAttribArray(t),j[t]=0);q={},de=null,pe={},X=null,Z=null,ie=null,re=null,s.reset(),U.reset(),G.reset()}}}function zo(e,t,n,i,r,a,o){var s,c=r.isWebGL2,l=r.maxTextures,u=r.maxCubemapSize,h=r.maxTextureSize,d=r.maxSamples,p=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Wt.floorPowerOfTwo:Math.floor,o=a(r*e.width),c=a(r*e.height);void 0===s&&(s=m(o,c));var l=n?m(o,c):s;return l.width=o,l.height=c,l.getContext("2d").drawImage(e,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+c+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function v(e){return Wt.isPowerOfTwo(e.width)&&Wt.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==ae&&e.minFilter!==ce}function x(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function _(n,i,r){if(!1===c)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=i;return 6403===i&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===i&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===i&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function b(e){return e===ae||e===oe||e===se?9728:9729}function w(t){var n=t.target;n.removeEventListener("dispose",w),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(t.texture),i.remove(t)}(n),o.memory.textures--}var E=0;function T(e,t){var r=i.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&r.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void O(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function S(t,r){if(6===t.image.length){var o=i.get(t);if(t.version>0&&o.__version!==t.version){P(o,t),n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),l=t.image[0]&&t.image[0].isDataTexture,h=[],d=0;d<6;d++)h[d]=s||l?l?t.image[d].image:t.image[d]:g(t.image[d],!1,!0,u);var p,f=h[0],m=v(f)||c,b=a.convert(t.format),w=a.convert(t.type),M=_(t.internalFormat,b,w);if(C(34067,t,m),s){for(d=0;d<6;d++){p=h[d].mipmaps;for(var E=0;E<p.length;E++){var T=p[E];t.format!==Te&&t.format!==Ee?null!==b?n.compressedTexImage2D(34069+d,E,M,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+d,E,M,T.width,T.height,0,b,w,T.data)}}o.__maxMipLevel=p.length-1}else{p=t.mipmaps;for(d=0;d<6;d++)if(l){n.texImage2D(34069+d,0,M,h[d].width,h[d].height,0,b,w,h[d].data);for(E=0;E<p.length;E++){var S=(T=p[E]).image[d].image;n.texImage2D(34069+d,E+1,M,S.width,S.height,0,b,w,S.data)}}else{n.texImage2D(34069+d,0,M,b,w,h[d]);for(E=0;E<p.length;E++){n.texImage2D(34069+d,E+1,M,b,w,(T=p[E]).image[d])}}o.__maxMipLevel=p.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture)}}function A(e,t){n.activeTexture(33984+t),n.bindTexture(34067,i.get(e).__webglTexture)}var R={};R[ne]=10497,R[ie]=33071,R[re]=33648;var L={};function C(n,a,o){o?(e.texParameteri(n,10242,R[a.wrapS]),e.texParameteri(n,10243,R[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,R[a.wrapR]),e.texParameteri(n,10240,L[a.magFilter]),e.texParameteri(n,10241,L[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===ie&&a.wrapT===ie||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,b(a.magFilter)),e.texParameteri(n,10241,b(a.minFilter)),a.minFilter!==ae&&a.minFilter!==ce&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(a.type===ve&&null===t.get("OES_texture_float_linear"))return;if(a.type===ye&&null===(c||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function P(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",w),t.__webglTexture=e.createTexture(),o.memory.textures++)}function O(t,i,r){var o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),P(t,i),n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s=function(e){return!c&&(e.wrapS!==ie||e.wrapT!==ie||e.minFilter!==ae&&e.minFilter!==ce)}(i)&&!1===v(i.image),l=g(i.image,s,!1,h),u=v(l)||c,d=a.convert(i.format),p=a.convert(i.type),f=_(i.internalFormat,d,p);C(o,i,u);var m,b=i.mipmaps;if(i.isDepthTexture)f=6402,c?f=i.type===ve?36012:i.type===ge?33190:i.type===we?35056:33189:i.type===ve&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Le&&6402===f&&i.type!==fe&&i.type!==ge&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=fe,p=a.convert(i.type)),i.format===Ce&&6402===f&&(f=34041,i.type!==we&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=we,p=a.convert(i.type))),n.texImage2D(3553,0,f,l.width,l.height,0,d,p,null);else if(i.isDataTexture)if(b.length>0&&u){for(var w=0,M=b.length;w<M;w++)n.texImage2D(3553,w,f,(m=b[w]).width,m.height,0,d,p,m.data);i.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,f,l.width,l.height,0,d,p,l.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(w=0,M=b.length;w<M;w++)m=b[w],i.format!==Te&&i.format!==Ee?null!==d?n.compressedTexImage2D(3553,w,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);t.__maxMipLevel=b.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,f,l.width,l.height,l.depth,0,d,p,l.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,f,l.width,l.height,l.depth,0,d,p,l.data),t.__maxMipLevel=0;else if(b.length>0&&u){for(w=0,M=b.length;w<M;w++)n.texImage2D(3553,w,f,d,p,m=b[w]);i.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,f,d,p,l),t.__maxMipLevel=0;y(i,u)&&x(o,i,l.width,l.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function N(t,r,o,s){var c=a.convert(r.texture.format),l=a.convert(r.texture.type),u=_(r.texture.internalFormat,c,l);n.texImage2D(s,0,u,r.width,r.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function I(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===ve?r=36012:o.type===ge&&(r=33190));var s=H(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){s=H(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),l=a.convert(n.texture.type);r=_(n.texture.internalFormat,c,l);if(i){s=H(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height)}e.bindRenderbuffer(36161,null)}function D(t){var n=i.get(t),r=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.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),T(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Le)e.framebufferTexture2D(36160,36096,3553,r,0);else{if(n.depthTexture.format!==Ce)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),I(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),I(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function H(e){return c&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}L[ae]=9728,L[oe]=9984,L[se]=9986,L[ce]=9729,L[le]=9985,L[ue]=9987;var F=!1,B=!1;this.allocateTextureUnit=function(){var e=E;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=T,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=S,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(t){var r=i.get(t),s=i.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),o.memory.textures++;var l=!0===t.isWebGLCubeRenderTarget,u=!0===t.isWebGLMultisampleRenderTarget,h=v(t)||c;if(!c||t.texture.format!==Ee||t.texture.type!==ve&&t.texture.type!==ye||(t.texture.format=Te,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){r.__webglFramebuffer=[];for(var d=0;d<6;d++)r.__webglFramebuffer[d]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),u)if(c){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var p=a.convert(t.texture.format),f=a.convert(t.texture.type),m=_(t.texture.internalFormat,p,f),g=H(t);e.renderbufferStorageMultisample(36161,g,m,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),I(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){for(n.bindTexture(34067,s.__webglTexture),C(34067,t.texture,h),d=0;d<6;d++)N(r.__webglFramebuffer[d],t,36064,34069+d);y(t.texture,h)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),C(3553,t.texture,h),N(r.__webglFramebuffer,t,36064,3553),y(t.texture,h)&&x(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&D(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,v(e)||c)){var r=e.isWebGLCubeRenderTarget?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(r,a),x(r,t,e.width,e.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(c){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var r=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,r,a,0,0,r,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),e=e.texture),T(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?S(e,t):A(e,t)}}function Uo(e,t,n){var i=n.isWebGL2;return{convert:function(e){var n;if(e===he)return 5121;if(e===xe)return 32819;if(e===_e)return 32820;if(e===be)return 33635;if(e===de)return 5120;if(e===pe)return 5122;if(e===fe)return 5123;if(e===me)return 5124;if(e===ge)return 5125;if(e===ve)return 5126;if(e===ye)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(e===Me)return 6406;if(e===Ee)return 6407;if(e===Te)return 6408;if(e===Se)return 6409;if(e===Ae)return 6410;if(e===Le)return 6402;if(e===Ce)return 34041;if(e===Pe)return 6403;if(e===Oe)return 36244;if(e===Ne)return 33319;if(e===Ie)return 33320;if(e===De)return 36248;if(e===He)return 36249;if(e===Fe||e===Be||e===ze||e===Ue){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===Fe)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Be)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===ze)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Ue)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===Ge||e===ke||e===Ve||e===je){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===Ge)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ke)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Ve)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===je)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===We)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===qe||e===Xe)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(e===qe)return n.COMPRESSED_RGB8_ETC2;if(e===Xe)return n.COMPRESSED_RGBA8_ETC2_EAC}return e===Ye||e===Ze||e===Je||e===Ke||e===Qe||e===$e||e===et||e===tt||e===nt||e===it||e===rt||e===at||e===ot||e===st||e===lt||e===ut||e===ht||e===dt||e===pt||e===ft||e===mt||e===gt||e===vt||e===yt||e===xt||e===_t||e===bt||e===wt?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:e===ct?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===we?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Go(e){Cr.call(this),this.cameras=e||[]}function ko(){Cn.call(this),this.type="Group"}function Vo(e,t){var n=this,i=null,r=1,a=null,o="local-floor",s=null,c=[],l=new Map,u=new Cr;u.layers.enable(1),u.viewport=new Kt;var h=new Cr;h.layers.enable(2),h.viewport=new Kt;var d=new Go([u,h]);d.layers.enable(1),d.layers.enable(2);var p=null,f=null;function m(e){var t=l.get(e.inputSource);t&&(t.targetRay&&t.targetRay.dispatchEvent({type:e.type}),t.grip&&t.grip.dispatchEvent({type:e.type}))}function g(){l.forEach(function(e,t){e.targetRay&&(e.targetRay.dispatchEvent({type:"disconnected",data:t}),e.targetRay.visible=!1),e.grip&&(e.grip.dispatchEvent({type:"disconnected",data:t}),e.grip.visible=!1)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(e){a=e,M.setContext(i),M.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function y(e){for(var t=i.inputSources,n=0;n<c.length;n++)l.set(t[n],c[n]);for(n=0;n<e.removed.length;n++){(a=l.get(r=e.removed[n]))&&(a.targetRay&&a.targetRay.dispatchEvent({type:"disconnected",data:r}),a.grip&&a.grip.dispatchEvent({type:"disconnected",data:r}),l.delete(r))}for(n=0;n<e.added.length;n++){var r,a;(a=l.get(r=e.added[n]))&&(a.targetRay&&a.targetRay.dispatchEvent({type:"connected",data:r}),a.grip&&a.grip.dispatchEvent({type:"connected",data:r}))}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return void 0===t&&(c[e]=t={}),void 0===t.targetRay&&(t.targetRay=new ko,t.targetRay.matrixAutoUpdate=!1,t.targetRay.visible=!1),t.targetRay},this.getControllerGrip=function(e){var t=c[e];return void 0===t&&(c[e]=t={}),void 0===t.grip&&(t.grip=new ko,t.grip.matrixAutoUpdate=!1,t.grip.visible=!1),t.grip},this.setFramebufferScaleFactor=function(e){r=e,1==n.isPresenting&&console.warn("WebXRManager: Cannot change framebuffer scale while presenting VR content")},this.setReferenceSpaceType=function(e){o=e},this.getReferenceSpace=function(){return a},this.getSession=function(){return i},this.setSession=function(e){if(null!==(i=e)){i.addEventListener("select",m),i.addEventListener("selectstart",m),i.addEventListener("selectend",m),i.addEventListener("squeeze",m),i.addEventListener("squeezestart",m),i.addEventListener("squeezeend",m),i.addEventListener("end",g);var n=t.getContextAttributes(),a=new XRWebGLLayer(i,t,{antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:r});i.updateRenderState({baseLayer:a}),i.requestReferenceSpace(o).then(v),i.addEventListener("inputsourceschange",y)}};var x=new rn,_=new rn;function b(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){d.near=h.near=u.near=e.near,d.far=h.far=u.far=e.far,p===d.near&&f===d.far||(i.updateRenderState({depthNear:d.near,depthFar:d.far}),p=d.near,f=d.far);var t=e.parent,n=d.cameras;b(d,t);for(var r=0;r<n.length;r++)b(n[r],t);e.matrixWorld.copy(d.matrixWorld);for(var a=e.children,o=(r=0,a.length);r<o;r++)a[r].updateMatrixWorld(!0);return function(e,t,n){x.setFromMatrixPosition(t.matrixWorld),_.setFromMatrixPosition(n.matrixWorld);var i=x.distanceTo(_),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),c=(r[9]+1)/r[5],l=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=i/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+f,v=s+f;e.projectionMatrix.makePerspective(d-m,p+(i-m),c*s/v*g,l*s/v*g,g,v)}(d,u,h),d};var w=null;var M=new Ur;M.setAnimationLoop(function(t,n){if(null!==(s=n.getViewerPose(a))){var r=s.views,o=i.renderState.baseLayer;e.setFramebuffer(o.framebuffer);for(var l=0;l<r.length;l++){var u=r[l],h=o.getViewport(u),p=d.cameras[l];p.matrix.fromArray(u.transform.matrix),p.projectionMatrix.fromArray(u.projectionMatrix),p.viewport.set(h.x,h.y,h.width,h.height),0===l&&d.matrix.copy(p.matrix)}}var f=i.inputSources;for(l=0;l<c.length;l++){var m=c[l],g=f[l],v=null,y=null;g&&(m.targetRay&&null!==(v=n.getPose(g.targetRaySpace,a))&&(m.targetRay.matrix.fromArray(v.transform.matrix),m.targetRay.matrix.decompose(m.targetRay.position,m.targetRay.rotation,m.targetRay.scale)),m.grip&&g.gripSpace&&null!==(y=n.getPose(g.gripSpace,a))&&(m.grip.matrix.fromArray(y.transform.matrix),m.grip.matrix.decompose(m.grip.position,m.grip.rotation,m.grip.scale))),m.targetRay&&(m.targetRay.visible=null!==v),m.grip&&(m.grip.visible=null!==y)}w&&w(t,n)}),this.setAnimationLoop=function(e){w=e},this.dispose=function(){}}function jo(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,d=null,p=null;this.domElement=t,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=Tt,this.physicallyCorrectLights=!1,this.toneMapping=j,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var f,m,g,v,y,x,_,b,w,M,E,T,S,A,R,L,C,P,O=this,N=!1,I=null,D=0,H=0,F=null,B=null,z=-1,U={geometry:null,program:null,wireframe:!1},G=null,k=null,V=new Kt,W=new Kt,q=null,X=t.width,Y=t.height,Z=1,J=null,K=null,Q=new Kt(0,0,X,Y),$=new Kt(0,0,X,Y),ee=!1,te=new Br,ne=new Zr,ie=!1,re=!1,ae=new dn,oe=new rn;function se(){return null===F?Z:1}try{var ce={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h,xrCompatible:!0};if(t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",fe,!1),null===(f=n||t.getContext("webgl",ce)||t.getContext("experimental-webgl",ce)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===f.getShaderPrecisionFormat&&(f.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function le(){m=new Jr(f),!1===(g=new Yr(f,m,e)).isWebGL2&&(m.get("WEBGL_depth_texture"),m.get("OES_texture_float"),m.get("OES_texture_half_float"),m.get("OES_texture_half_float_linear"),m.get("OES_standard_derivatives"),m.get("OES_element_index_uint"),m.get("ANGLE_instanced_arrays")),m.get("OES_texture_float_linear"),P=new Uo(f,m,g),(v=new Bo(f,m,g)).scissor(W.copy($).multiplyScalar(Z).floor()),v.viewport(V.copy(Q).multiplyScalar(Z).floor()),y=new $r(f),x=new wo,_=new zo(f,m,v,x,g,P,y),b=new Gr(f,g),w=new Kr(f,b,y),M=new na(f,w,b,y),R=new ta(f),E=new bo(O,m,g),T=new So,S=new Oo,A=new qr(O,v,M,s),L=new Xr(f,m,y,g),C=new Qr(f,m,y,g),y.programs=E.programs,O.capabilities=g,O.extensions=m,O.properties=x,O.renderLists=T,O.state=v,O.info=y}le();var ue=new Vo(O,f);this.xr=ue;var de=new Fo(O,M,g.maxTextureSize);function pe(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),N=!0}function fe(){console.log("THREE.WebGLRenderer: Context Restored."),N=!1,le()}function me(e){var t=e.target;t.removeEventListener("dispose",me),function(e){ge(e),x.remove(e)}(t)}function ge(e){var t=x.get(e).program;e.program=void 0,void 0!==t&&E.releaseProgram(t)}this.shadowMap=de,this.getContext=function(){return f},this.getContextAttributes=function(){return f.getContextAttributes()},this.forceContextLoss=function(){var e=m.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=m.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(e){void 0!==e&&(Z=e,this.setSize(X,Y,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new qt),e.set(X,Y)},this.setSize=function(e,n,i){ue.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(X=e,Y=n,t.width=Math.floor(e*Z),t.height=Math.floor(n*Z),!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new qt),e.set(X*Z,Y*Z).floor()},this.setDrawingBufferSize=function(e,n,i){X=e,Y=n,Z=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Kt),e.copy(V)},this.getViewport=function(e){return e.copy(Q)},this.setViewport=function(e,t,n,i){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,i),v.viewport(V.copy(Q).multiplyScalar(Z).floor())},this.getScissor=function(e){return e.copy($)},this.setScissor=function(e,t,n,i){e.isVector4?$.set(e.x,e.y,e.z,e.w):$.set(e,t,n,i),v.scissor(W.copy($).multiplyScalar(Z).floor())},this.getScissorTest=function(){return ee},this.setScissorTest=function(e){v.setScissorTest(ee=e)},this.setOpaqueSort=function(e){J=e},this.setTransparentSort=function(e){K=e},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===n||n)&&(i|=1024),f.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",fe,!1),T.dispose(),S.dispose(),x.dispose(),M.dispose(),ue.dispose(),be.stop(),this.forceContextLoss()},this.renderBufferImmediate=function(e,t){v.initAttributes();var n=x.get(e);e.hasPositions&&!n.position&&(n.position=f.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=f.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=f.createBuffer()),e.hasColors&&!n.color&&(n.color=f.createBuffer());var i=t.getAttributes();e.hasPositions&&(f.bindBuffer(34962,n.position),f.bufferData(34962,e.positionArray,35048),v.enableAttribute(i.position),f.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(f.bindBuffer(34962,n.normal),f.bufferData(34962,e.normalArray,35048),v.enableAttribute(i.normal),f.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(f.bindBuffer(34962,n.uv),f.bufferData(34962,e.uvArray,35048),v.enableAttribute(i.uv),f.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(f.bindBuffer(34962,n.color),f.bufferData(34962,e.colorArray,35048),v.enableAttribute(i.color),f.vertexAttribPointer(i.color,3,5126,!1,0,0)),v.disableUnusedAttributes(),f.drawArrays(4,0,e.count),e.count=0};var xe=new Pn;this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=xe);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=Se(e,t,i,r);v.setMaterial(i,o);var c=!1;U.geometry===n.id&&U.program===s.id&&U.wireframe===(!0===i.wireframe)||(U.geometry=n.id,U.program=s.id,U.wireframe=!0===i.wireframe,c=!0),(i.morphTargets||i.morphNormals)&&(R.update(r,n,i,s),c=!0);var l=n.index,u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var h,d=1;!0===i.wireframe&&(l=w.getWireframeAttribute(n),d=2);var p=L;null!==l&&(h=b.get(l),(p=C).setIndex(h)),c&&(!function(e,t,n,i){if(!1===g.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===m.get("ANGLE_instanced_arrays"))return;v.initAttributes();var r=t.attributes,a=i.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=r[s];if(void 0!==l){var u=l.normalized,h=l.itemSize,d=b.get(l);if(void 0===d)continue;var p=d.buffer,y=d.type,x=d.bytesPerElement;if(l.isInterleavedBufferAttribute){var _=l.data,w=_.stride,M=l.offset;_&&_.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(c,_.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=_.meshPerAttribute*_.count)):v.enableAttribute(c),f.bindBuffer(34962,p),f.vertexAttribPointer(c,h,y,u,w*x,M*x)}else l.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=l.meshPerAttribute*l.count)):v.enableAttribute(c),f.bindBuffer(34962,p),f.vertexAttribPointer(c,h,y,u,0,0)}else if("instanceMatrix"===s){var d=b.get(e.instanceMatrix);if(void 0===d)continue;var p=d.buffer,y=d.type;v.enableAttributeAndDivisor(c+0,1),v.enableAttributeAndDivisor(c+1,1),v.enableAttributeAndDivisor(c+2,1),v.enableAttributeAndDivisor(c+3,1),f.bindBuffer(34962,p),f.vertexAttribPointer(c+0,4,y,!1,64,0),f.vertexAttribPointer(c+1,4,y,!1,64,16),f.vertexAttribPointer(c+2,4,y,!1,64,32),f.vertexAttribPointer(c+3,4,y,!1,64,48)}else if(void 0!==o){var E=o[s];if(void 0!==E)switch(E.length){case 2:f.vertexAttrib2fv(c,E);break;case 3:f.vertexAttrib3fv(c,E);break;case 4:f.vertexAttrib4fv(c,E);break;default:f.vertexAttrib1fv(c,E)}}}}v.disableUnusedAttributes()}(r,n,i,s),null!==l&&f.bindBuffer(34963,h.buffer));var y=null!==l?l.count:u.count,x=n.drawRange.start*d,_=n.drawRange.count*d,M=null!==a?a.start*d:0,E=null!==a?a.count*d:Infinity,T=Math.max(x,M),S=Math.min(y,x+_,M+E)-1,A=Math.max(0,S-T+1);if(0!==A){if(r.isMesh)!0===i.wireframe?(v.setLineWidth(i.wireframeLinewidth*se()),p.setMode(1)):p.setMode(4);else if(r.isLine){var P=i.linewidth;void 0===P&&(P=1),v.setLineWidth(P*se()),p.setMode(r.isLineSegments?1:r.isLineLoop?2:3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);r.isInstancedMesh?p.renderInstances(n,T,A,r.count):n.isInstancedBufferGeometry?p.renderInstances(n,T,A,n.maxInstancedCount):p.render(T,A)}},this.compile=function(e,t){(p=S.get(e,t)).init(),e.traverse(function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))}),p.setupLights(t);var n={};e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var i=0;i<t.material.length;i++)t.material[i].uuid in n==!1&&(Ee(t.material[i],e,t),n[t.material[i].uuid]=!0);else t.material.uuid in n==!1&&(Ee(t.material,e,t),n[t.material.uuid]=!0)})};var _e=null;var be=new Ur;function we(e,t,n,i){for(var r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,c=o.geometry,l=void 0===i?o.material:i,u=o.group;if(n.isArrayCamera){k=n;for(var h=n.cameras,d=0,f=h.length;d<f;d++){var m=h[d];s.layers.test(m.layers)&&(v.viewport(V.copy(m.viewport)),p.setupLights(m),Me(s,t,m,c,l,u))}}else k=null,Me(s,t,n,c,l,u)}}function Me(e,t,n,i,r,a){if(e.onBeforeRender(O,t,n,i,r,a),p=S.get(t,k||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Se(n,t,r,e);v.setMaterial(r),U.geometry=null,U.program=null,U.wireframe=!1,function(e,t){e.render(function(e){O.renderBufferImmediate(e,t)})}(e,o)}else O.renderBufferDirect(n,t,i,r,e,a);e.onAfterRender(O,t,n,i,r,a),p=S.get(t,k||n)}function Ee(e,t,n){var i=x.get(e),r=p.state.lights,a=r.state.version,o=E.getParameters(e,r.state,p.state.shadowsArray,t,ne.numPlanes,ne.numIntersection,n),s=E.getProgramCacheKey(o),c=i.program,l=!0;if(void 0===c)e.addEventListener("dispose",me);else if(c.cacheKey!==s)ge(e);else if(i.lightsStateVersion!==a)i.lightsStateVersion=a,l=!1;else{if(void 0!==o.shaderID)return;l=!1}l&&(c=E.acquireProgram(o,s),i.program=c,i.uniforms=o.uniforms,i.environment=e.isMeshStandardMaterial?t.environment:null,i.outputEncoding=O.outputEncoding,e.program=c);var u=c.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var h=0;h<O.maxMorphTargets;h++)u["morphTarget"+h]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(h=0;h<O.maxMorphNormals;h++)u["morphNormal"+h]>=0&&e.numSupportedMorphNormals++}var d=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=ne.numPlanes,i.numIntersection=ne.numIntersection,d.clippingPlanes=ne.uniform),i.fog=t.fog,i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=a,i.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotShadowMatrix.value=r.state.spotShadowMatrix,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix);var f=i.program.getUniforms(),m=eo.seqWithValue(f.seq,d);i.uniformsList=m}function Se(e,t,n,i){_.resetTextureUnits();var r=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=x.get(n),s=p.state.lights;ie&&((re||e!==G)&&ne.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,o,e===G&&n.id===z));n.version===o.__version?void 0===o.program?Ee(n,t,i):n.fog&&o.fog!==r?Ee(n,t,i):o.environment!==a?Ee(n,t,i):o.needsLights&&o.lightsStateVersion!==s.state.version?Ee(n,t,i):void 0===o.numClippingPlanes||o.numClippingPlanes===ne.numPlanes&&o.numIntersection===ne.numIntersection?o.outputEncoding!==O.outputEncoding&&Ee(n,t,i):Ee(n,t,i):(Ee(n,t,i),o.__version=n.version);var l,u,h=!1,d=!1,m=!1,y=o.program,b=y.getUniforms(),w=o.uniforms;if(v.useProgram(y.program)&&(h=!0,d=!0,m=!0),n.id!==z&&(z=n.id,d=!0),h||G!==e){if(b.setValue(f,"projectionMatrix",e.projectionMatrix),g.logarithmicDepthBuffer&&b.setValue(f,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),G!==e&&(G=e,d=!0,m=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var M=b.map.cameraPosition;void 0!==M&&M.setValue(f,oe.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&b.setValue(f,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&b.setValue(f,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){b.setOptional(f,i,"bindMatrix"),b.setOptional(f,i,"bindMatrixInverse");var E=i.skeleton;if(E)if(g.floatVertexTextures){if(void 0===E.boneTexture){var T=Math.sqrt(4*E.bones.length);T=Wt.ceilPowerOfTwo(T),T=Math.max(T,4);var S=new Float32Array(T*T*4);S.set(E.boneMatrices);var A=new Dr(S,T,T,Te,ve);E.boneMatrices=S,E.boneTexture=A,E.boneTextureSize=T}b.setValue(f,"boneTexture",E.boneTexture,_),b.setValue(f,"boneTextureSize",E.boneTextureSize)}else b.setOptional(f,E,"boneMatrices")}return(d||o.receiveShadow!==i.receiveShadow)&&(o.receiveShadow=i.receiveShadow,b.setValue(f,"receiveShadow",i.receiveShadow)),d&&(b.setValue(f,"toneMappingExposure",O.toneMappingExposure),b.setValue(f,"toneMappingWhitePoint",O.toneMappingWhitePoint),o.needsLights&&((l=w).ambientLightColor.needsUpdate=u=m,l.lightProbe.needsUpdate=u,l.directionalLights.needsUpdate=u,l.directionalLightShadows.needsUpdate=u,l.pointLights.needsUpdate=u,l.pointLightShadows.needsUpdate=u,l.spotLights.needsUpdate=u,l.spotLightShadows.needsUpdate=u,l.rectAreaLights.needsUpdate=u,l.hemisphereLights.needsUpdate=u),r&&n.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(w,r),n.isMeshBasicMaterial?Ae(w,n):n.isMeshLambertMaterial?(Ae(w,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(w,n)):n.isMeshToonMaterial?(Ae(w,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===c&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===c&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshPhongMaterial?(Ae(w,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===c&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===c&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshStandardMaterial?(Ae(w,n,a),n.isMeshPhysicalMaterial?function(e,t,n){Re(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===c&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(w,n,a):Re(w,n,a)):n.isMeshMatcapMaterial?(Ae(w,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===c&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===c&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshDepthMaterial?(Ae(w,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshDistanceMaterial?(Ae(w,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(w,n)):n.isMeshNormalMaterial?(Ae(w,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===c&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===c&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(w,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(w,n)):n.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*Z,e.scale.value=.5*Y,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(w,n):n.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(w,n):n.isShadowMaterial&&(w.color.value.copy(n.color),w.opacity.value=n.opacity),void 0!==w.ltc_1&&(w.ltc_1.value=zr.LTC_1),void 0!==w.ltc_2&&(w.ltc_2.value=zr.LTC_2),eo.upload(f,o.uniformsList,w,_),n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(eo.upload(f,o.uniformsList,w,_),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&b.setValue(f,"center",i.center),b.setValue(f,"modelViewMatrix",i.modelViewMatrix),b.setValue(f,"normalMatrix",i.normalMatrix),b.setValue(f,"modelMatrix",i.matrixWorld),y}function Ae(e,t,n){e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap);var i,r,a=t.envMap||n;a&&(e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=x.get(a).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),t.aoMap?r=t.aoMap:t.lightMap&&(r=t.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uv2Transform.value.copy(r.matrix))}function Re(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===c&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===c&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}be.setAnimationLoop(function(e){ue.isPresenting||_e&&_e(e)}),"undefined"!=typeof window&&be.setContext(window),this.setAnimationLoop=function(e){_e=e,ue.setAnimationLoop(e),be.start()},this.render=function(e,t){var n,i;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."),i=arguments[3]),t&&t.isCamera){if(!N){U.geometry=null,U.program=null,U.wireframe=!1,z=-1,G=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ue.enabled&&ue.isPresenting&&(t=ue.getCamera(t)),(p=S.get(e,t)).init(),e.onBeforeRender(O,e,t,n||F),ae.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),te.setFromProjectionMatrix(ae),ie=ne.init(this.clippingPlanes,re=this.localClippingEnabled,t),(d=T.get(e,t)).init(),function e(t,n,i,r){if(!1===t.visible)return;var a=t.layers.test(n.layers);if(a)if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(n);else if(t.isLight)p.pushLight(t),t.castShadow&&p.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||te.intersectsSprite(t)){r&&oe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ae);var o=M.update(t),s=t.material;s.visible&&d.push(t,o,s,i,oe.z,null)}}else if(t.isImmediateRenderObject)r&&oe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ae),d.push(t,null,t.material,i,oe.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==y.render.frame&&(t.skeleton.update(),t.skeleton.frame=y.render.frame),!t.frustumCulled||te.intersectsObject(t))){r&&oe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ae);var o=M.update(t),s=t.material;if(Array.isArray(s))for(var c=o.groups,l=0,u=c.length;l<u;l++){var h=c[l],f=s[h.materialIndex];f&&f.visible&&d.push(t,o,f,i,oe.z,h)}else s.visible&&d.push(t,o,s,i,oe.z,null)}var m=t.children;for(var l=0,u=m.length;l<u;l++)e(m[l],n,i,r)}(e,t,0,O.sortObjects),d.finish(),!0===O.sortObjects&&d.sort(J,K),ie&&ne.beginShadows(),de.render(p.state.shadowsArray,e,t),p.setupLights(t),ie&&ne.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),A.render(d,e,t,i);var r=d.opaque,a=d.transparent;if(e.overrideMaterial){var o=e.overrideMaterial;r.length&&we(r,e,t,o),a.length&&we(a,e,t,o)}else r.length&&we(r,e,t),a.length&&we(a,e,t);e.onAfterRender(O,e,t),null!==F&&(_.updateRenderTargetMipmap(F),_.updateMultisampleRenderTarget(F)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),d=null,p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){I!==e&&null===F&&f.bindFramebuffer(36160,e),I=e},this.getActiveCubeFace=function(){return D},this.getActiveMipmapLevel=function(){return H},this.getRenderTarget=function(){return F},this.setRenderTarget=function(e,t,n){F=e,D=t,H=n,e&&void 0===x.get(e).__webglFramebuffer&&_.setupRenderTarget(e);var i=I,r=!1;if(e){var a=x.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=a[t||0],r=!0):i=e.isWebGLMultisampleRenderTarget?x.get(e).__webglMultisampledFramebuffer:a,V.copy(e.viewport),W.copy(e.scissor),q=e.scissorTest}else V.copy(Q).multiplyScalar(Z).floor(),W.copy($).multiplyScalar(Z).floor(),q=ee;if(B!==i&&(f.bindFramebuffer(36160,i),B=i),v.viewport(V),v.scissor(W),v.setScissorTest(q),r){var o=x.get(e.texture);f.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=x.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var c=!1;s!==B&&(f.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,h=l.type;if(u!==Te&&P.convert(u)!==f.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===he||P.convert(h)===f.getParameter(35738)||h===ve&&(g.isWebGL2||m.get("OES_texture_float")||m.get("WEBGL_color_buffer_float"))||h===ye&&m.get(g.isWebGL2?"EXT_color_buffer_float":"EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===f.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&f.readPixels(t,n,i,r,P.convert(u),P.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&f.bindFramebuffer(36160,B)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=P.convert(t.format);_.setTexture2D(t,0),f.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),v.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){var r=t.image.width,a=t.image.height,o=P.convert(n.format),s=P.convert(n.type);_.setTexture2D(n,0),t.isDataTexture?f.texSubImage2D(3553,i||0,e.x,e.y,r,a,o,s,t.image.data):f.texSubImage2D(3553,i||0,e.x,e.y,o,s,t.image),v.unbindTexture()},this.initTexture=function(e){_.setTexture2D(e,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Wo(e,t){this.name="",this.color=new bi(e),this.density=void 0!==t?t:25e-5}function qo(e,t,n){this.name="",this.color=new bi(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Xo(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=zt,this.updateRange={offset:0,count:-1},this.version=0}Go.prototype=Object.assign(Object.create(Cr.prototype),{constructor:Go,isArrayCamera:!0}),ko.prototype=Object.assign(Object.create(Cn.prototype),{constructor:ko,isGroup:!0}),Object.assign(Vo.prototype,Gt.prototype),Object.assign(Wo.prototype,{isFogExp2:!0,clone:function(){return new Wo(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(qo.prototype,{isFog:!0,clone:function(){return new qo(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Xo.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Xo.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Yo,Zo=new rn;function Jo(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function Ko(e){Ai.call(this),this.type="SpriteMaterial",this.color=new bi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Jo.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Jo.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Zo.x=this.getX(t),Zo.y=this.getY(t),Zo.z=this.getZ(t),Zo.applyMatrix4(e),this.setXYZ(t,Zo.x,Zo.y,Zo.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return this.data.array[(e=e*this.data.stride+this.offset)+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return this.data.array[(e=e*this.data.stride+this.offset)+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return this.data.array[(e=e*this.data.stride+this.offset)+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}}),(Ko.prototype=Object.create(Ai.prototype)).constructor=Ko,Ko.prototype.isSpriteMaterial=!0,Ko.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Qo=new rn,$o=new rn,es=new rn,ts=new qt,ns=new qt,is=new dn,rs=new rn,as=new rn,os=new rn,ss=new qt,cs=new qt,ls=new qt;function us(e){if(Cn.call(this),this.type="Sprite",void 0===Yo){Yo=new Zi;var t=new Xo(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Yo.setIndex([0,1,2,0,2,3]),Yo.setAttribute("position",new Jo(t,3,0,!1)),Yo.setAttribute("uv",new Jo(t,2,3,!1))}this.geometry=Yo,this.material=void 0!==e?e:new Ko,this.center=new qt(.5,.5)}function hs(e,t,n,i,r,a){ts.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(ns.x=a*ts.x-r*ts.y,ns.y=r*ts.x+a*ts.y):ns.copy(ts),e.copy(t),e.x+=ns.x,e.y+=ns.y,e.applyMatrix4(is)}us.prototype=Object.assign(Object.create(Cn.prototype),{constructor:us,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),$o.setFromMatrixScale(this.matrixWorld),is.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),es.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&$o.multiplyScalar(-es.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var a=this.center;hs(rs.set(-.5,-.5,0),es,a,$o,n,i),hs(as.set(.5,-.5,0),es,a,$o,n,i),hs(os.set(.5,.5,0),es,a,$o,n,i),ss.set(0,0),cs.set(1,0),ls.set(1,1);var o=e.ray.intersectTriangle(rs,as,os,!1,Qo);if(null!==o||(hs(as.set(-.5,.5,0),es,a,$o,n,i),cs.set(0,1),null!==(o=e.ray.intersectTriangle(rs,os,as,!1,Qo)))){var s=e.ray.origin.distanceTo(Qo);s<e.near||s>e.far||t.push({distance:s,point:Qo.clone(),uv:vi.getUV(Qo,rs,as,os,ss,cs,ls,new qt),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Cn.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var ds=new rn,ps=new rn;function fs(){Cn.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function ms(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),pr.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new dn,this.bindMatrixInverse=new dn}fs.prototype=Object.assign(Object.create(Cn.prototype),{constructor:fs,isLOD:!0,copy:function(e){Cn.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){ds.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(ds);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){ds.setFromMatrixPosition(e.matrixWorld),ps.setFromMatrixPosition(this.matrixWorld);var n=ds.distanceTo(ps)/e.zoom;t[0].object.visible=!0;for(var i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}},toJSON:function(e){var t=Cn.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),ms.prototype=Object.assign(Object.create(pr.prototype),{constructor:ms,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Kt,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();Infinity!==r?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){pr.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var gs=new dn,vs=new dn;function ys(e,t){if(this.bones=(e=e||[]).slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new dn)}}function xs(){Cn.call(this),this.type="Bone"}Object.assign(ys.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new dn;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){gs.multiplyMatrices(e[r]?e[r].matrixWorld:vs,t[r]),gs.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)},clone:function(){return new ys(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),xs.prototype=Object.assign(Object.create(Cn.prototype),{constructor:xs,isBone:!0});var _s=new dn,bs=new dn,ws=[],Ms=new pr;function Es(e,t,n){pr.call(this,e,t),this.instanceMatrix=new Ci(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function Ts(e){Ai.call(this),this.type="LineBasicMaterial",this.color=new bi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}Es.prototype=Object.assign(Object.create(pr.prototype),{constructor:Es,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,i=this.count;if(Ms.geometry=this.geometry,Ms.material=this.material,void 0!==Ms.material)for(var r=0;r<i;r++)this.getMatrixAt(r,_s),bs.multiplyMatrices(n,_s),Ms.matrixWorld=bs,Ms.raycast(e,ws),ws.length>0&&(ws[0].instanceId=r,ws[0].object=this,t.push(ws[0]),ws.length=0)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),(Ts.prototype=Object.create(Ai.prototype)).constructor=Ts,Ts.prototype.isLineBasicMaterial=!0,Ts.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var Ss=new rn,As=new rn,Rs=new dn,Ls=new ni,Cs=new Yn;function Ps(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Cn.call(this),this.type="Line",this.geometry=void 0!==e?e:new Zi,this.material=void 0!==t?t:new Ts}Ps.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Ps,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)Ss.fromBufferAttribute(t,i-1),As.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Ss.distanceTo(As);e.setAttribute("lineDistance",new Bi(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(n=e.lineDistances)[0]=0;for(i=1,r=a.length;i<r;i++)n[i]=n[i-1],n[i]+=a[i-1].distanceTo(a[i])}return this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Cs.copy(n.boundingSphere),Cs.applyMatrix4(i),Cs.radius+=r,!1!==e.ray.intersectsSphere(Cs)){Rs.getInverse(i),Ls.copy(e.ray).applyMatrix4(Rs);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new rn,c=new rn,l=new rn,u=new rn,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position.array;if(null!==d)for(var f=d.array,m=0,g=f.length-1;m<g;m+=h){var v=f[m+1];if(s.fromArray(p,3*f[m]),c.fromArray(p,3*v),!(Ls.distanceSqToSegment(s,c,u,l)>o))u.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(u))<e.near||_>e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,g=p.length/3-1;m<g;m+=h){if(s.fromArray(p,3*m),c.fromArray(p,3*m+3),!(Ls.distanceSqToSegment(s,c,u,l)>o))u.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(u))<e.near||_>e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var y=n.vertices,x=y.length;for(m=0;m<x-1;m+=h){var _;if(!(Ls.distanceSqToSegment(y[m],y[m+1],u,l)>o))u.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(u))<e.near||_>e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Os=new rn,Ns=new rn;function Is(e,t){Ps.call(this,e,t),this.type="LineSegments"}function Ds(e,t){Ps.call(this,e,t),this.type="LineLoop"}function Hs(e){Ai.call(this),this.type="PointsMaterial",this.color=new bi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Is.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Is,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)Os.fromBufferAttribute(t,i),Ns.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Os.distanceTo(Ns);e.setAttribute("lineDistance",new Bi(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,i=0,r=a.length;i<r;i+=2)Os.copy(a[i]),Ns.copy(a[i+1]),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Os.distanceTo(Ns)}return this}}),Ds.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Ds,isLineLoop:!0}),(Hs.prototype=Object.create(Ai.prototype)).constructor=Hs,Hs.prototype.isPointsMaterial=!0,Hs.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var Fs=new dn,Bs=new ni,zs=new Yn,Us=new rn;function Gs(e,t){Cn.call(this),this.type="Points",this.geometry=void 0!==e?e:new Zi,this.material=void 0!==t?t:new Hs,this.updateMorphTargets()}function ks(e,t,n,i,r,a,o){var s=Bs.distanceSqToPoint(e);if(s<n){var c=new rn;Bs.closestPointToPoint(e,c),c.applyMatrix4(i);var l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Vs(e,t,n,i,r,a,o,s,c){Jt.call(this,e,t,n,i,r,a,o,s,c),this.format=void 0!==o?o:Ee,this.minFilter=void 0!==a?a:ce,this.magFilter=void 0!==r?r:ce,this.generateMipmaps=!1}function js(e,t,n,i,r,a,o,s,c,l,u,h){Jt.call(this,null,a,o,s,c,l,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ws(e,t,n,i,r,a,o,s,c){Jt.call(this,e,t,n,i,r,a,o,s,c),this.needsUpdate=!0}function qs(e,t,n,i,r,a,o,s,c,l){if((l=void 0!==l?l:Le)!==Le&&l!==Ce)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Le&&(n=fe),void 0===n&&l===Ce&&(n=we),Jt.call(this,null,i,r,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:ae,this.minFilter=void 0!==s?s:ae,this.flipY=!1,this.generateMipmaps=!1}function Xs(e){Zi.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,c,l,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t<i;t++){var g=m[t];for(n=0;n<3;n++)s=g[f[n]],c=g[f[(n+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)h.push((u=e.vertices[(o=p[l]).index1]).x,u.y,u.z),h.push((u=e.vertices[o.index2]).x,u.y,u.z)}else if(e&&e.isBufferGeometry){var v,y,x,_,b;if(u=new rn,null!==e.index){for(v=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,a=x.length;r<a;++r)for(t=b=(_=x[r]).start,i=b+_.count;t<i;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),c=y.getX(t+(n+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)u.fromBufferAttribute(v,(o=p[l]).index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(v,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,i=(v=e.attributes.position).count/3;t<i;t++)for(n=0;n<3;n++)u.fromBufferAttribute(v,3*t+n),h.push(u.x,u.y,u.z),u.fromBufferAttribute(v,3*t+(n+1)%3),h.push(u.x,u.y,u.z)}this.setAttribute("position",new Bi(h,3))}function Ys(e,t,n){_r.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Zs(e,t,n)),this.mergeVertices()}function Zs(e,t,n){Zi.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i,r,a=[],o=[],s=[],c=[],l=new rn,u=new rn,h=new rn,d=new rn,p=new rn;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(i=0;i<=n;i++){var m=i/n;for(r=0;r<=t;r++){var g=r/t;e(g,m,u),o.push(u.x,u.y,u.z),g-1e-5>=0?(e(g-1e-5,m,h),d.subVectors(u,h)):(e(g+1e-5,m,h),d.subVectors(h,u)),m-1e-5>=0?(e(g,m-1e-5,h),p.subVectors(u,h)):(e(g,m+1e-5,h),p.subVectors(h,u)),l.crossVectors(d,p).normalize(),s.push(l.x,l.y,l.z),c.push(g,m)}}for(i=0;i<n;i++)for(r=0;r<t;r++){var v=i*f+r+1,y=(i+1)*f+r+1,x=(i+1)*f+r;a.push(i*f+r,v,x),a.push(v,y,x)}this.setIndex(a),this.setAttribute("position",new Bi(o,3)),this.setAttribute("normal",new Bi(s,3)),this.setAttribute("uv",new Bi(c,2))}function Js(e,t,n,i){_r.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new Ks(e,t,n,i)),this.mergeVertices()}function Ks(e,t,n,i){Zi.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var r=[],a=[];function o(e,t,n,i){var r,a,o=Math.pow(2,i),c=[];for(r=0;r<=o;r++){c[r]=[];var l=e.clone().lerp(n,r/o),u=t.clone().lerp(n,r/o),h=o-r;for(a=0;a<=h;a++)c[r][a]=0===a&&r===o?l:l.clone().lerp(u,a/h)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var d=Math.floor(a/2);a%2==0?(s(c[r][d+1]),s(c[r+1][d]),s(c[r][d])):(s(c[r][d+1]),s(c[r+1][d+1]),s(c[r+1][d]))}}function s(e){r.push(e.x,e.y,e.z)}function c(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function l(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}!function(e){for(var n=new rn,i=new rn,r=new rn,a=0;a<t.length;a+=3)c(t[a+0],n),c(t[a+1],i),c(t[a+2],r),o(n,i,r,e)}(i=i||0),function(e){for(var t=new rn,n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){for(var e=new rn,t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];var n=u(e)/2/Math.PI+.5,i=(o=e,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5);a.push(n,1-i)}var o;(function(){for(var e=new rn,t=new rn,n=new rn,i=new rn,o=new qt,s=new qt,c=new qt,h=0,d=0;h<r.length;h+=9,d+=6){e.set(r[h+0],r[h+1],r[h+2]),t.set(r[h+3],r[h+4],r[h+5]),n.set(r[h+6],r[h+7],r[h+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),c.set(a[d+4],a[d+5]),i.copy(e).add(t).add(n).divideScalar(3);var p=u(i);l(o,d+0,e,p),l(s,d+2,t,p),l(c,d+4,n,p)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],i=a[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Bi(r,3)),this.setAttribute("normal",new Bi(r.slice(),3)),this.setAttribute("uv",new Bi(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Qs(e,t){_r.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new $s(e,t)),this.mergeVertices()}function $s(e,t){Ks.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ec(e,t){_r.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new tc(e,t)),this.mergeVertices()}function tc(e,t){Ks.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function nc(e,t){_r.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ic(e,t)),this.mergeVertices()}function ic(e,t){var n=(1+Math.sqrt(5))/2;Ks.call(this,[-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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function rc(e,t){_r.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ac(e,t)),this.mergeVertices()}function ac(e,t){var n=(1+Math.sqrt(5))/2,i=1/n;Ks.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function oc(e,t,n,i,r,a){_r.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new sc(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function sc(e,t,n,i,r){Zi.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},n=n||1,i=i||8;var a=e.computeFrenetFrames(t=t||64,r=r||!1);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new rn,l=new rn,u=new qt,h=new rn,d=[],p=[],f=[],m=[];function g(r){h=e.getPointAt(r/t,h);var o=a.normals[r],u=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);l.x=g*o.x+m*u.x,l.y=g*o.y+m*u.y,l.z=g*o.z+m*u.z,l.normalize(),p.push(l.x,l.y,l.z),c.x=h.x+n*l.x,c.y=h.y+n*l.y,c.z=h.z+n*l.z,d.push(c.x,c.y,c.z)}}!function(){for(o=0;o<t;o++)g(o);g(!1===r?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=i;s++)u.x=o/t,u.y=s/i,f.push(u.x,u.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=i;o++){var e=(i+1)*(s-1)+(o-1),n=(i+1)*s+(o-1),r=(i+1)*s+o,a=(i+1)*(s-1)+o;m.push(e,n,a),m.push(n,r,a)}}()}(),this.setIndex(m),this.setAttribute("position",new Bi(d,3)),this.setAttribute("normal",new Bi(p,3)),this.setAttribute("uv",new Bi(f,2))}function cc(e,t,n,i,r,a,o){_r.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new lc(e,t,n,i,r,a)),this.mergeVertices()}function lc(e,t,n,i,r,a){Zi.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var o,s,c=[],l=[],u=[],h=[],d=new rn,p=new rn,f=new rn,m=new rn,g=new rn,v=new rn,y=new rn;for(o=0;o<=n;++o){var x=o/n*r*Math.PI*2;for(S(x,r,a,e,f),S(x+.01,r,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=i;++s){var _=s/i*Math.PI*2,b=-t*Math.cos(_),w=t*Math.sin(_);d.x=f.x+(b*y.x+w*g.x),d.y=f.y+(b*y.y+w*g.y),d.z=f.z+(b*y.z+w*g.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/n),h.push(s/i)}}for(s=1;s<=n;s++)for(o=1;o<=i;o++){var M=(i+1)*s+(o-1),E=(i+1)*s+o,T=(i+1)*(s-1)+o;c.push((i+1)*(s-1)+(o-1),M,T),c.push(M,E,T)}function S(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);r.x=i*(2+c)*.5*a,r.y=i*(2+c)*o*.5,r.z=i*Math.sin(s)*.5}this.setIndex(c),this.setAttribute("position",new Bi(l,3)),this.setAttribute("normal",new Bi(u,3)),this.setAttribute("uv",new Bi(h,2))}function uc(e,t,n,i,r){_r.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new hc(e,t,n,i,r)),this.mergeVertices()}function hc(e,t,n,i,r){Zi.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var a,o,s=[],c=[],l=[],u=[],h=new rn,d=new rn,p=new rn;for(a=0;a<=n;a++)for(o=0;o<=i;o++){var f=o/i*r,m=a/n*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),c.push(d.x,d.y,d.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),u.push(o/i),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=i;o++){var g=(i+1)*(a-1)+o-1,v=(i+1)*(a-1)+o,y=(i+1)*a+o;s.push((i+1)*a+o-1,g,y),s.push(g,v,y)}this.setIndex(s),this.setAttribute("position",new Bi(c,3)),this.setAttribute("normal",new Bi(l,3)),this.setAttribute("uv",new Bi(u,2))}Gs.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Gs,isPoints:!0,raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),zs.copy(n.boundingSphere),zs.applyMatrix4(i),zs.radius+=r,!1!==e.ray.intersectsSphere(zs)){Fs.getInverse(i),Bs.copy(e.ray).applyMatrix4(Fs);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(null!==s)for(var l=s.array,u=0,h=l.length;u<h;u++){var d=l[u];Us.fromArray(c,3*d),ks(Us,d,o,i,e,t,this)}else{u=0;for(var p=c.length/3;u<p;u++)Us.fromArray(c,3*u),ks(Us,u,o,i,e,t,this)}}else{var f=n.vertices;for(u=0,p=f.length;u<p;u++)ks(f[u],u,o,i,e,t,this)}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Vs.prototype=Object.assign(Object.create(Jt.prototype),{constructor:Vs,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),(js.prototype=Object.create(Jt.prototype)).constructor=js,js.prototype.isCompressedTexture=!0,(Ws.prototype=Object.create(Jt.prototype)).constructor=Ws,Ws.prototype.isCanvasTexture=!0,(qs.prototype=Object.create(Jt.prototype)).constructor=qs,qs.prototype.isDepthTexture=!0,(Xs.prototype=Object.create(Zi.prototype)).constructor=Xs,(Ys.prototype=Object.create(_r.prototype)).constructor=Ys,(Zs.prototype=Object.create(Zi.prototype)).constructor=Zs,(Js.prototype=Object.create(_r.prototype)).constructor=Js,(Ks.prototype=Object.create(Zi.prototype)).constructor=Ks,(Qs.prototype=Object.create(_r.prototype)).constructor=Qs,($s.prototype=Object.create(Ks.prototype)).constructor=$s,(ec.prototype=Object.create(_r.prototype)).constructor=ec,(tc.prototype=Object.create(Ks.prototype)).constructor=tc,(nc.prototype=Object.create(_r.prototype)).constructor=nc,(ic.prototype=Object.create(Ks.prototype)).constructor=ic,(rc.prototype=Object.create(_r.prototype)).constructor=rc,(ac.prototype=Object.create(Ks.prototype)).constructor=ac,(oc.prototype=Object.create(_r.prototype)).constructor=oc,(sc.prototype=Object.create(Zi.prototype)).constructor=sc,sc.prototype.toJSON=function(){var e=Zi.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},(cc.prototype=Object.create(_r.prototype)).constructor=cc,(lc.prototype=Object.create(Zi.prototype)).constructor=lc,(uc.prototype=Object.create(_r.prototype)).constructor=uc,(hc.prototype=Object.create(Zi.prototype)).constructor=hc;var dc=function(e,t,n){n=n||2;var i,r,a,o,s,c,l,u=t&&t.length,h=u?t[0]*n:e.length,d=pc(e,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r<a;r++)(o=pc(e,t[r]*i,r<a-1?t[r+1]*i:e.length,i,!1))===o.next&&(o.steiner=!0),s.push(Mc(o));for(s.sort(_c),r=0;r<s.length;r++)bc(s[r],n),n=fc(n,n.next);return n}(e,t,d,n)),e.length>80*n){i=a=e[0],r=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<i&&(i=s),(c=e[f+1])<r&&(r=c),s>a&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-i,o-r))?1/l:0}return mc(d,p,n,i,r,l),p};function pc(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=Pc(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=Pc(a,e[a],e[a+1],o);return o&&Ac(o,o.next)&&(Oc(o),o=o.next),o}function fc(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!Ac(i,i.next)&&0!==Sc(i.prev,i,i.next))i=i.next;else{if(Oc(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function mc(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=wc(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<l&&(s++,i=i.nextZ);t++);for(c=l;s>0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,l*=2}while(o>1)}(r)}(e,i,r,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?vc(e,i,r,a):gc(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Oc(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?mc(e=yc(e,t,n),t,n,i,r,a,2):2===o&&xc(e,t,n,i,r,a):mc(fc(e),t,n,i,r,a,1);break}}}function gc(e){var t=e.prev,n=e,i=e.next;if(Sc(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(Ec(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Sc(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function vc(e,t,n,i){var r=e.prev,a=e,o=e.next;if(Sc(r,a,o)>=0)return!1;for(var s=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,c=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,l=wc(r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,t,n,i),u=wc(s,c,t,n,i),h=e.prevZ,d=e.nextZ;h&&h.z>=l&&d&&d.z<=u;){if(h!==e.prev&&h!==e.next&&Ec(r.x,r.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Sc(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,d!==e.prev&&d!==e.next&&Ec(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Sc(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;h&&h.z>=l;){if(h!==e.prev&&h!==e.next&&Ec(r.x,r.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Sc(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;d&&d.z<=u;){if(d!==e.prev&&d!==e.next&&Ec(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Sc(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function yc(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!Ac(r,a)&&Rc(r,i,i.next,a)&&Lc(r,a)&&Lc(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),Oc(i),Oc(i.next),i=e=a),i=i.next}while(i!==e);return i}function xc(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Tc(o,s)){var c=Cc(o,s);return o=fc(o,o.next),c=fc(c,c.next),mc(o,t,n,i,r,a),void mc(c,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function _c(e,t){return e.x-t.x}function bc(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-Infinity;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n.prev;var c,l=n,u=n.x,h=n.y,d=Infinity;i=n.next;for(;i!==l;)r>=i.x&&i.x>=u&&r!==i.x&&Ec(a<h?r:o,a,u,h,a<h?o:r,a,i.x,i.y)&&((c=Math.abs(a-i.y)/(r-i.x))<d||c===d&&i.x>n.x)&&Lc(i,e)&&(n=i,d=c),i=i.next;return n}(e,t)){var n=Cc(t,e);fc(n,n.next)}}function wc(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Mc(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Ec(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function Tc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Rc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&Lc(e,t)&&Lc(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)}function Sc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ac(e,t){return e.x===t.x&&e.y===t.y}function Rc(e,t,n,i){return!!(Ac(e,n)&&Ac(t,i)||Ac(e,i)&&Ac(n,t))||Sc(e,t,n)>0!=Sc(e,t,i)>0&&Sc(n,i,e)>0!=Sc(n,i,t)>0}function Lc(e,t){return Sc(e.prev,e,e.next)<0?Sc(e,t,e.next)>=0&&Sc(e,e.prev,t)>=0:Sc(e,t,e.prev)<0||Sc(e,e.next,t)<0}function Cc(e,t){var n=new Nc(e.i,e.x,e.y),i=new Nc(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Pc(e,t,n,i){var r=new Nc(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Oc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Nc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ic={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return Ic.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];Dc(e),Hc(n,e);var a=e.length;t.forEach(Dc);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,Hc(n,t[o]);var s=dc(n,i);for(o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function Dc(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Hc(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Fc(e,t){_r.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Bc(e,t)),this.mergeVertices()}function Bc(e,t){Zi.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,i=[],r=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,c=void 0!==t.depth?t.depth:100,l=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,h=void 0!==t.bevelSize?t.bevelSize:u-2,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:zc;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);var g,v,y,x,_,b,w,M,E=!1;f&&(g=f.getSpacedPoints(s),E=!0,l=!1,v=f.computeFrenetFrames(s,!1),y=new rn,x=new rn,_=new rn),l||(p=0,u=0,h=0,d=0);var T=e.extractPoints(o),S=T.shape,A=T.holes;if(!Ic.isClockWise(S))for(S=S.reverse(),w=0,M=A.length;w<M;w++)Ic.isClockWise(b=A[w])&&(A[w]=b.reverse());var R=Ic.triangulateShape(S,A),L=S;for(w=0,M=A.length;w<M;w++)S=S.concat(b=A[w]);function C(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var P,O,N,I,D,H,F=S.length,B=R.length;function z(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s;if(Math.abs(o*l-s*c)>Number.EPSILON){var h=Math.sqrt(u),d=Math.sqrt(c*c+l*l),p=t.x-s/h,f=t.y+o/h,m=((n.x-l/d-p)*l-(n.y+c/d-f)*c)/(o*l-s*c),g=(i=p+o*m-e.x)*i+(r=f+s*m-e.y)*r;if(g<=2)return new qt(i,r);a=Math.sqrt(g/2)}else{var v=!1;o>Number.EPSILON?c>Number.EPSILON&&(v=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(v=!0):Math.sign(s)===Math.sign(l)&&(v=!0),v?(i=-s,r=o,a=Math.sqrt(u)):(i=o,r=s,a=Math.sqrt(u/2))}return new qt(i/a,r/a)}for(var U=[],G=0,k=L.length,V=k-1,j=G+1;G<k;G++,V++,j++)V===k&&(V=0),j===k&&(j=0),U[G]=z(L[G],L[V],L[j]);var W,q,X=[],Y=U.concat();for(w=0,M=A.length;w<M;w++){for(W=[],V=(k=(b=A[w]).length)-1,j=(G=0)+1;G<k;G++,V++,j++)V===k&&(V=0),j===k&&(j=0),W[G]=z(b[G],b[V],b[j]);X.push(W),Y=Y.concat(W)}for(P=0;P<p;P++){for(N=P/p,I=u*Math.cos(N*Math.PI/2),O=h*Math.sin(N*Math.PI/2)+d,G=0,k=L.length;G<k;G++)J((D=C(L[G],U[G],O)).x,D.y,-I);for(w=0,M=A.length;w<M;w++)for(W=X[w],G=0,k=(b=A[w]).length;G<k;G++)J((D=C(b[G],W[G],O)).x,D.y,-I)}for(O=h+d,G=0;G<F;G++)D=l?C(S[G],Y[G],O):S[G],E?(x.copy(v.normals[0]).multiplyScalar(D.x),y.copy(v.binormals[0]).multiplyScalar(D.y),_.copy(g[0]).add(x).add(y),J(_.x,_.y,_.z)):J(D.x,D.y,0);for(q=1;q<=s;q++)for(G=0;G<F;G++)D=l?C(S[G],Y[G],O):S[G],E?(x.copy(v.normals[q]).multiplyScalar(D.x),y.copy(v.binormals[q]).multiplyScalar(D.y),_.copy(g[q]).add(x).add(y),J(_.x,_.y,_.z)):J(D.x,D.y,c/s*q);for(P=p-1;P>=0;P--){for(N=P/p,I=u*Math.cos(N*Math.PI/2),O=h*Math.sin(N*Math.PI/2)+d,G=0,k=L.length;G<k;G++)J((D=C(L[G],U[G],O)).x,D.y,c+I);for(w=0,M=A.length;w<M;w++)for(W=X[w],G=0,k=(b=A[w]).length;G<k;G++)D=C(b[G],W[G],O),E?J(D.x,D.y+g[s-1].y,g[s-1].x+I):J(D.x,D.y,c+I)}function Z(e,t){var n,i;for(G=e.length;--G>=0;){n=G,(i=G-1)<0&&(i=e.length-1);var r=0,a=s+2*p;for(r=0;r<a;r++){var o=F*r,c=F*(r+1);Q(t+n+o,t+i+o,t+i+c,t+n+c)}}}function J(e,t,n){a.push(e),a.push(t),a.push(n)}function K(e,t,r){$(e),$(t),$(r);var a=i.length/3,o=m.generateTopUV(n,i,a-3,a-2,a-1);ee(o[0]),ee(o[1]),ee(o[2])}function Q(e,t,r,a){$(e),$(t),$(a),$(t),$(r),$(a);var o=i.length/3,s=m.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){i.push(a[3*e+0]),i.push(a[3*e+1]),i.push(a[3*e+2])}function ee(e){r.push(e.x),r.push(e.y)}!function(){var e=i.length/3;if(l){var t=0,r=F*t;for(G=0;G<B;G++)K((H=R[G])[2]+r,H[1]+r,H[0]+r);for(r=F*(t=s+2*p),G=0;G<B;G++)K((H=R[G])[0]+r,H[1]+r,H[2]+r)}else{for(G=0;G<B;G++)K((H=R[G])[2],H[1],H[0]);for(G=0;G<B;G++)K((H=R[G])[0]+F*s,H[1]+F*s,H[2]+F*s)}n.addGroup(e,i.length/3-e,0)}(),function(){var e=i.length/3,t=0;for(Z(L,t),t+=L.length,w=0,M=A.length;w<M;w++)Z(b=A[w],t),t+=b.length;n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new Bi(i,3)),this.setAttribute("uv",new Bi(r,2)),this.computeVertexNormals()}(Fc.prototype=Object.create(_r.prototype)).constructor=Fc,Fc.prototype.toJSON=function(){var e=_r.prototype.toJSON.call(this);return Uc(this.parameters.shapes,this.parameters.options,e)},(Bc.prototype=Object.create(Zi.prototype)).constructor=Bc,Bc.prototype.toJSON=function(){var e=Zi.prototype.toJSON.call(this);return Uc(this.parameters.shapes,this.parameters.options,e)};var zc={generateTopUV:function(e,t,n,i,r){var a=t[3*i],o=t[3*i+1],s=t[3*r],c=t[3*r+1];return[new qt(t[3*n],t[3*n+1]),new qt(a,o),new qt(s,c)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],c=t[3*n+2],l=t[3*i],u=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-u)<.01?[new qt(o,1-c),new qt(l,1-h),new qt(d,1-f),new qt(m,1-v)]:[new qt(s,1-c),new qt(u,1-h),new qt(p,1-f),new qt(g,1-v)]}};function Uc(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){n.shapes.push(e[i].uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Gc(e,t){_r.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new kc(e,t)),this.mergeVertices()}function kc(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new _r;var i=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Bc.call(this,i,t),this.type="TextBufferGeometry"}function Vc(e,t,n,i,r,a,o){_r.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new jc(e,t,n,i,r,a,o)),this.mergeVertices()}function jc(e,t,n,i,r,a,o){Zi.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,l=Math.min(a+o,Math.PI),u=0,h=[],d=new rn,p=new rn,f=[],m=[],g=[],v=[];for(c=0;c<=n;c++){var y=[],x=c/n,_=0;for(0==c&&0==a?_=.5/t:c==n&&l==Math.PI&&(_=-.5/t),s=0;s<=t;s++){var b=s/t;d.x=-e*Math.cos(i+b*r)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(i+b*r)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.copy(d).normalize(),g.push(p.x,p.y,p.z),v.push(b+_,1-x),y.push(u++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<t;s++){var w=h[c][s],M=h[c+1][s],E=h[c+1][s+1];(0!==c||a>0)&&f.push(h[c][s+1],w,E),(c!==n-1||l<Math.PI)&&f.push(w,M,E)}this.setIndex(f),this.setAttribute("position",new Bi(m,3)),this.setAttribute("normal",new Bi(g,3)),this.setAttribute("uv",new Bi(v,2))}function Wc(e,t,n,i,r,a){_r.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new qc(e,t,n,i,r,a)),this.mergeVertices()}function qc(e,t,n,i,r,a){Zi.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,c,l=[],u=[],h=[],d=[],p=e,f=(t-e)/(i=void 0!==i?Math.max(1,i):1),m=new rn,g=new qt;for(s=0;s<=i;s++){for(c=0;c<=n;c++)o=r+c/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,d.push(g.x,g.y);p+=f}for(s=0;s<i;s++){var v=s*(n+1);for(c=0;c<n;c++){var y=(o=c+v)+n+1,x=o+n+2,_=o+1;l.push(o,y,_),l.push(y,x,_)}}this.setIndex(l),this.setAttribute("position",new Bi(u,3)),this.setAttribute("normal",new Bi(h,3)),this.setAttribute("uv",new Bi(d,2))}function Xc(e,t,n,i){_r.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new Yc(e,t,n,i)),this.mergeVertices()}function Yc(e,t,n,i){Zi.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=Wt.clamp(i,0,2*Math.PI);var r,a,o,s=[],c=[],l=[],u=1/t,h=new rn,d=new qt;for(a=0;a<=t;a++){var p=n+a*u*i,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,c.push(h.x,h.y,h.z),d.x=a/t,d.y=o/(e.length-1),l.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var g=(r=o+a*e.length)+e.length,v=r+e.length+1,y=r+1;s.push(r,g,y),s.push(g,v,y)}if(this.setIndex(s),this.setAttribute("position",new Bi(c,3)),this.setAttribute("uv",new Bi(l,2)),this.computeVertexNormals(),i===2*Math.PI){var x=this.attributes.normal.array,_=new rn,b=new rn,w=new rn;for(r=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)_.x=x[o+0],_.y=x[o+1],_.z=x[o+2],b.x=x[r+o+0],b.y=x[r+o+1],b.z=x[r+o+2],w.addVectors(_,b).normalize(),x[o+0]=x[r+o+0]=w.x,x[o+1]=x[r+o+1]=w.y,x[o+2]=x[r+o+2]=w.z}}function Zc(e,t){_r.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Jc(e,t)),this.mergeVertices()}function Jc(e,t){Zi.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],i=[],r=[],a=[],o=0,s=0;if(!1===Array.isArray(e))l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;function l(e){var o,c,l,u=i.length/3,h=e.extractPoints(t),d=h.shape,p=h.holes;for(!1===Ic.isClockWise(d)&&(d=d.reverse()),o=0,c=p.length;o<c;o++)!0===Ic.isClockWise(l=p[o])&&(p[o]=l.reverse());var f=Ic.triangulateShape(d,p);for(o=0,c=p.length;o<c;o++)d=d.concat(l=p[o]);for(o=0,c=d.length;o<c;o++){var m=d[o];i.push(m.x,m.y,0),r.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var g=f[o];n.push(g[0]+u,g[1]+u,g[2]+u),s+=3}}this.setIndex(n),this.setAttribute("position",new Bi(i,3)),this.setAttribute("normal",new Bi(r,3)),this.setAttribute("uv",new Bi(a,2))}function Kc(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){t.shapes.push(e[n].uuid)}else t.shapes.push(e.uuid);return t}function Qc(e,t){Zi.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,a,o=[],s=Math.cos(Wt.DEG2RAD*t),c=[0,0],l={},u=["a","b","c"];e.isBufferGeometry?(a=new _r).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)n=m[u[g]],i=m[u[(g+1)%3]],c[0]=Math.min(n,i),c[1]=Math.max(n,i),void 0===l[r=c[0]+","+c[1]]?l[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[r].face2=p;for(r in l){var v=l[r];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=h[v.index1];o.push(y.x,y.y,y.z),o.push((y=h[v.index2]).x,y.y,y.z)}}this.setAttribute("position",new Bi(o,3))}function $c(e,t,n,i,r,a,o,s){_r.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new el(e,t,n,i,r,a,o,s)),this.mergeVertices()}function el(e,t,n,i,r,a,o,s){Zi.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,i=Math.floor(i)||8,r=Math.floor(r)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],u=[],h=[],d=[],p=0,f=[],m=n/2,g=0;function v(n){var r,a,f,v=new qt,y=new rn,x=0,_=!0===n?e:t,b=!0===n?1:-1;for(a=p,r=1;r<=i;r++)u.push(0,m*b,0),h.push(0,b,0),d.push(.5,.5),p++;for(f=p,r=0;r<=i;r++){var w=r/i*s+o,M=Math.cos(w),E=Math.sin(w);y.x=_*E,y.y=m*b,y.z=_*M,u.push(y.x,y.y,y.z),h.push(0,b,0),v.x=.5*M+.5,v.y=.5*E*b+.5,d.push(v.x,v.y),p++}for(r=0;r<i;r++){var T=a+r,S=f+r;!0===n?l.push(S,S+1,T):l.push(S+1,S,T),x+=3}c.addGroup(g,x,!0===n?1:2),g+=x}!function(){var a,v,y=new rn,x=new rn,_=0,b=(t-e)/n;for(v=0;v<=r;v++){var w=[],M=v/r,E=M*(t-e)+e;for(a=0;a<=i;a++){var T=a/i,S=T*s+o,A=Math.sin(S),R=Math.cos(S);x.x=E*A,x.y=-M*n+m,x.z=E*R,u.push(x.x,x.y,x.z),y.set(A,b,R).normalize(),h.push(y.x,y.y,y.z),d.push(T,1-M),w.push(p++)}f.push(w)}for(a=0;a<i;a++)for(v=0;v<r;v++){var L=f[v][a],C=f[v+1][a],P=f[v+1][a+1],O=f[v][a+1];l.push(L,C,O),l.push(C,P,O),_+=6}c.addGroup(g,_,0),g+=_}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new Bi(u,3)),this.setAttribute("normal",new Bi(h,3)),this.setAttribute("uv",new Bi(d,2))}function tl(e,t,n,i,r,a,o){$c.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function nl(e,t,n,i,r,a,o){el.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function il(e,t,n,i){_r.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new rl(e,t,n,i)),this.mergeVertices()}function rl(e,t,n,i){Zi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],c=[],l=[],u=new rn,h=new qt;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var d=n+a/t*i;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[r]/e+1)/2,h.y=(s[r+1]/e+1)/2,l.push(h.x,h.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.setAttribute("position",new Bi(s,3)),this.setAttribute("normal",new Bi(c,3)),this.setAttribute("uv",new Bi(l,2))}(Gc.prototype=Object.create(_r.prototype)).constructor=Gc,(kc.prototype=Object.create(Bc.prototype)).constructor=kc,(Vc.prototype=Object.create(_r.prototype)).constructor=Vc,(jc.prototype=Object.create(Zi.prototype)).constructor=jc,(Wc.prototype=Object.create(_r.prototype)).constructor=Wc,(qc.prototype=Object.create(Zi.prototype)).constructor=qc,(Xc.prototype=Object.create(_r.prototype)).constructor=Xc,(Yc.prototype=Object.create(Zi.prototype)).constructor=Yc,(Zc.prototype=Object.create(_r.prototype)).constructor=Zc,Zc.prototype.toJSON=function(){var e=_r.prototype.toJSON.call(this);return Kc(this.parameters.shapes,e)},(Jc.prototype=Object.create(Zi.prototype)).constructor=Jc,Jc.prototype.toJSON=function(){var e=Zi.prototype.toJSON.call(this);return Kc(this.parameters.shapes,e)},(Qc.prototype=Object.create(Zi.prototype)).constructor=Qc,($c.prototype=Object.create(_r.prototype)).constructor=$c,(el.prototype=Object.create(Zi.prototype)).constructor=el,(tl.prototype=Object.create($c.prototype)).constructor=tl,(nl.prototype=Object.create(el.prototype)).constructor=nl,(il.prototype=Object.create(_r.prototype)).constructor=il,(rl.prototype=Object.create(Zi.prototype)).constructor=rl;var al=Object.freeze({__proto__:null,WireframeGeometry:Xs,ParametricGeometry:Ys,ParametricBufferGeometry:Zs,TetrahedronGeometry:Qs,TetrahedronBufferGeometry:$s,OctahedronGeometry:ec,OctahedronBufferGeometry:tc,IcosahedronGeometry:nc,IcosahedronBufferGeometry:ic,DodecahedronGeometry:rc,DodecahedronBufferGeometry:ac,PolyhedronGeometry:Js,PolyhedronBufferGeometry:Ks,TubeGeometry:oc,TubeBufferGeometry:sc,TorusKnotGeometry:cc,TorusKnotBufferGeometry:lc,TorusGeometry:uc,TorusBufferGeometry:hc,TextGeometry:Gc,TextBufferGeometry:kc,SphereGeometry:Vc,SphereBufferGeometry:jc,RingGeometry:Wc,RingBufferGeometry:qc,PlaneGeometry:kr,PlaneBufferGeometry:Vr,LatheGeometry:Xc,LatheBufferGeometry:Yc,ShapeGeometry:Zc,ShapeBufferGeometry:Jc,ExtrudeGeometry:Fc,ExtrudeBufferGeometry:Bc,EdgesGeometry:Qc,ConeGeometry:tl,ConeBufferGeometry:nl,CylinderGeometry:$c,CylinderBufferGeometry:el,CircleGeometry:il,CircleBufferGeometry:rl,BoxGeometry:br,BoxBufferGeometry:wr});function ol(e){Ai.call(this),this.type="ShadowMaterial",this.color=new bi(0),this.transparent=!0,this.setValues(e)}function sl(e){Rr.call(this,e),this.type="RawShaderMaterial"}function cl(e){Ai.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new bi(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 bi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dt,this.normalScale=new qt(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.vertexTangents=!1,this.setValues(e)}function ll(e){cl.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new qt(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function ul(e){Ai.call(this),this.type="MeshPhongMaterial",this.color=new bi(16777215),this.specular=new bi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=U,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(e)}function hl(e){Ai.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new bi(16777215),this.specular=new bi(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,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(e)}function dl(e){Ai.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dt,this.normalScale=new qt(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.setValues(e)}function pl(e){Ai.call(this),this.type="MeshLambertMaterial",this.color=new bi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=U,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(e)}function fl(e){Ai.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new bi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ml(e){Ts.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}(ol.prototype=Object.create(Ai.prototype)).constructor=ol,ol.prototype.isShadowMaterial=!0,ol.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this},(sl.prototype=Object.create(Rr.prototype)).constructor=sl,sl.prototype.isRawShaderMaterial=!0,(cl.prototype=Object.create(Ai.prototype)).constructor=cl,cl.prototype.isMeshStandardMaterial=!0,cl.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},(ll.prototype=Object.create(cl.prototype)).constructor=ll,ll.prototype.isMeshPhysicalMaterial=!0,ll.prototype.copy=function(e){return cl.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,this.sheen=e.sheen?(this.sheen||new bi).copy(e.sheen):null,this.transparency=e.transparency,this},(ul.prototype=Object.create(Ai.prototype)).constructor=ul,ul.prototype.isMeshPhongMaterial=!0,ul.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},(hl.prototype=Object.create(Ai.prototype)).constructor=hl,hl.prototype.isMeshToonMaterial=!0,hl.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},(dl.prototype=Object.create(Ai.prototype)).constructor=dl,dl.prototype.isMeshNormalMaterial=!0,dl.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},(pl.prototype=Object.create(Ai.prototype)).constructor=pl,pl.prototype.isMeshLambertMaterial=!0,pl.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},(fl.prototype=Object.create(Ai.prototype)).constructor=fl,fl.prototype.isMeshMatcapMaterial=!0,fl.prototype.copy=function(e){return Ai.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},(ml.prototype=Object.create(Ts.prototype)).constructor=ml,ml.prototype.isLineDashedMaterial=!0,ml.prototype.copy=function(e){return Ts.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var gl=Object.freeze({__proto__:null,ShadowMaterial:ol,SpriteMaterial:Ko,RawShaderMaterial:sl,ShaderMaterial:Rr,PointsMaterial:Hs,MeshPhysicalMaterial:ll,MeshStandardMaterial:cl,MeshPhongMaterial:ul,MeshToonMaterial:hl,MeshNormalMaterial:dl,MeshLambertMaterial:pl,MeshDepthMaterial:No,MeshDistanceMaterial:Io,MeshBasicMaterial:Ri,MeshMatcapMaterial:fl,LineDashedMaterial:ml,LineBasicMaterial:Ts,Material:Ai}),vl={arraySlice:function(e,t,n){return vl.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,c=0;c!==t;++c)r[o++]=e[s+c];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],d=0;d<c.times.length;++d){var p=c.times[d]*r;if(!(p<n||p>=i)){u.push(c.times[d]);for(var f=0;f<l;++f)h.push(c.values[d*l+f])}}0!==u.length&&(c.times=vl.convertArray(u,c.times.constructor),c.values=vl.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;var m=Infinity;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a}};function yl(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function xl(e,t,n,i){yl.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function _l(e,t,n,i){yl.call(this,e,t,n,i)}function bl(e,t,n,i){yl.call(this,e,t,n,i)}function wl(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=vl.convertArray(t,this.TimeBufferType),this.values=vl.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Ml(e,t,n){wl.call(this,e,t,n)}function El(e,t,n,i){wl.call(this,e,t,n,i)}function Tl(e,t,n,i){wl.call(this,e,t,n,i)}function Sl(e,t,n,i){yl.call(this,e,t,n,i)}function Al(e,t,n,i){wl.call(this,e,t,n,i)}function Rl(e,t,n,i){wl.call(this,e,t,n,i)}function Ll(e,t,n,i){wl.call(this,e,t,n,i)}function Cl(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Wt.generateUUID(),this.duration<0&&this.resetDuration()}function Pl(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Tl;case"vector":case"vector2":case"vector3":case"vector4":return Ll;case"color":return El;case"quaternion":return Al;case"bool":case"boolean":return Ml;case"string":return Rl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];vl.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(yl.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return this._cachedIndex=n=t.length,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===o)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return this._cachedIndex=n=t.length,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(yl.prototype,{beforeStart_:yl.prototype.copySampleValue_,afterEnd_:yl.prototype.copySampleValue_}),xl.prototype=Object.assign(Object.create(yl.prototype),{constructor:xl,DefaultSettings_:{endingStart:Et,endingEnd:Et},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var c=.5*(n-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=a*l},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),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,x=d*m-d*f,_=0;_!==o;++_)r[_]=g*a[l+_]+v*a[c+_]+y*a[s+_]+x*a[u+_];return r}}),_l.prototype=Object.assign(Object.create(yl.prototype),{constructor:_l,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(i-t),u=1-l,h=0;h!==o;++h)r[h]=a[c+h]*u+a[s+h]*l;return r}}),bl.prototype=Object.assign(Object.create(yl.prototype),{constructor:bl,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(wl,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:vl.convertArray(e.times,Array),values:vl.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}),Object.assign(wl.prototype,{constructor:wl,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new bl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new _l(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new xl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=vl.arraySlice(n,r,a),this.values=vl.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&vl.isTypedArray(i)){o=0;for(var c=i.length;o!==c;++o){var l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=vl.arraySlice(this.times),t=vl.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(i)s=!0;else for(var l=o*n,u=l-n,h=l+n,d=0;d!==n;++d){var p=t[l+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];var f=o*n,m=r*n;for(d=0;d!==n;++d)t[m+d]=t[f+d]}++r}}if(a>0){e[r]=e[a];for(f=a*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length?(this.times=vl.arraySlice(e,0,r),this.values=vl.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this},clone:function(){var e=vl.arraySlice(this.times,0),t=vl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Ml.prototype=Object.assign(Object.create(wl.prototype),{constructor:Ml,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),El.prototype=Object.assign(Object.create(wl.prototype),{constructor:El,ValueTypeName:"color"}),Tl.prototype=Object.assign(Object.create(wl.prototype),{constructor:Tl,ValueTypeName:"number"}),Sl.prototype=Object.assign(Object.create(yl.prototype),{constructor:Sl,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(i-t),l=s+o;s!==l;s+=4)en.slerpFlat(r,0,a,s-o,a,s,c);return r}}),Al.prototype=Object.assign(Object.create(wl.prototype),{constructor:Al,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Sl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Rl.prototype=Object.assign(Object.create(wl.prototype),{constructor:Rl,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ll.prototype=Object.assign(Object.create(wl.prototype),{constructor:Ll,ValueTypeName:"vector"}),Object.assign(Cl,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Pl(n[r]).scale(i));return new Cl(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,a=n.length;r!==a;++r)t.push(wl.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var l=vl.getKeyframeOrder(s);s=vl.sortedArray(s,1,l),c=vl.sortedArray(c,1,l),i||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new Tl(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new Cl(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){n=e.geometry&&e.geometry.animations||e.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(r);if(c&&c.length>1){var l=i[h=c[1]];l||(i[h]=l=[]),l.push(s)}}var u=[];for(var h in i)u.push(Cl.CreateFromMorphTargetSequence(h,i[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];vl.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var u={},h=0;h<l.length;h++)if(l[h].morphTargets)for(var d=0;d<l[h].morphTargets.length;d++)u[l[h].morphTargets[d]]=-1;for(var p in u){var f=[],m=[];for(d=0;d!==l[h].morphTargets.length;++d){var g=l[h];f.push(g.time),m.push(g.morphTarget===p?1:0)}i.push(new Tl(".morphTargetInfluence["+p+"]",f,m))}a=u.length*(o||1)}else{var v=".bones["+t[c].name+"]";n(Ll,v+".position",l,"pos",i),n(Al,v+".quaternion",l,"rot",i),n(Ll,v+".scale",l,"scl",i)}}return 0===i.length?null:new Cl(r,a,i)}}),Object.assign(Cl.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Cl(this.name,this.duration,e)}});var Ol={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Nl(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var i=c[t],r=c[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}var Il=new Nl;function Dl(e){this.manager=void 0!==e?e:Il,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}Object.assign(Dl.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this}});var Hl={};function Fl(e){Dl.call(this,e)}function Bl(e){Dl.call(this,e)}function zl(e){Dl.call(this,e)}function Ul(e){Dl.call(this,e)}function Gl(e){Dl.call(this,e)}function kl(e){Dl.call(this,e)}function Vl(e){Dl.call(this,e)}function jl(){this.type="Curve",this.arcLengthDivisions=200}function Wl(e,t,n,i,r,a,o,s){jl.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function ql(e,t,n,i,r,a){Wl.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function Xl(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,c*=o,l*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}Fl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Fl,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ol.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;if(void 0===Hl[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(l,s);break;case"json":u=JSON.parse(l);break;default:u=l}setTimeout(function(){t&&t(u),r.manager.itemEnd(e)},0)}catch(t){setTimeout(function(){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)},0)}}else{Hl[e]=[],Hl[e].push({onLoad:t,onProgress:n,onError:i});var m=new XMLHttpRequest;for(var g in m.open("GET",e,!0),m.addEventListener("load",function(t){var n=this.response,i=Hl[e];if(delete Hl[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ol.add(e,n);for(var a=0,o=i.length;a<o;a++){(s=i[a]).onLoad&&s.onLoad(n)}r.manager.itemEnd(e)}else{for(a=0,o=i.length;a<o;a++){var s;(s=i[a]).onError&&s.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}},!1),m.addEventListener("progress",function(t){for(var n=Hl[e],i=0,r=n.length;i<r;i++){var a=n[i];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener("error",function(t){var n=Hl[e];delete Hl[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)},!1),m.addEventListener("abort",function(t){var n=Hl[e];delete Hl[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(e),m}Hl[e].push({onLoad:t,onProgress:n,onError:i})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Bl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Bl,load:function(e,t,n,i){var r=this,a=new Fl(r.manager);a.setPath(r.path),a.load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=Cl.parse(e[n]);t.push(i)}return t}}),zl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:zl,load:function(e,t,n,i){var r=this,a=[],o=new js;o.image=a;var s=new Fl(this.manager);function c(c){s.load(e[c],function(e){var n=r.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=ce),o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,h=e.length;u<h;++u)c(u);else s.load(e,function(e){var n=r.parse(e,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=ce),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}),Ul.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Ul,load:function(e,t,n,i){var r=this,a=new Dr,o=new Fl(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(e){var n=r.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:ie,a.wrapT=void 0!==n.wrapT?n.wrapT:ie,a.magFilter=void 0!==n.magFilter?n.magFilter:ce,a.minFilter=void 0!==n.minFilter?n.minFilter:ce,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=ue),1===n.mipmapCount&&(a.minFilter=ce),a.needsUpdate=!0,t&&t(a,n))},n,i),a}}),Gl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Gl,load:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ol.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),Ol.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}),kl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:kl,load:function(e,t,n,i){var r=new ia,a=new Gl(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){r.images[n]=e,6===++o&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(var c=0;c<e.length;++c)s(c);return r}}),Vl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Vl,load:function(e,t,n,i){var r=new Jt,a=new Gl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){r.image=n;var i=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?Ee:Te,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}),Object.assign(jl.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(a-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r=new rn,a=[],o=[],s=[],c=new rn,l=new dn;for(n=0;n<=e;n++)a[n]=this.getTangentAt(n/e),a[n].normalize();o[0]=new rn,s[0]=new rn;var u=Number.MAX_VALUE,h=Math.abs(a[0].x),d=Math.abs(a[0].y),p=Math.abs(a[0].z);for(h<=u&&(u=h,r.set(1,0,0)),d<=u&&(u=d,r.set(0,1,0)),p<=u&&r.set(0,0,1),c.crossVectors(a[0],r).normalize(),o[0].crossVectors(a[0],c),s[0].crossVectors(a[0],o[0]),n=1;n<=e;n++)o[n]=o[n-1].clone(),s[n]=s[n-1].clone(),c.crossVectors(a[n-1],a[n]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(Wt.clamp(a[n-1].dot(a[n]),-1,1)),o[n].applyMatrix4(l.makeRotationAxis(c,i))),s[n].crossVectors(a[n],o[n]);if(!0===t)for(i=Math.acos(Wt.clamp(o[0].dot(o[e]),-1,1)),i/=e,a[0].dot(c.crossVectors(o[0],o[e]))>0&&(i=-i),n=1;n<=e;n++)o[n].applyMatrix4(l.makeRotationAxis(a[n],i*n)),s[n].crossVectors(a[n],o[n]);return{tangents:a,normals:o,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),(Wl.prototype=Object.create(jl.prototype)).constructor=Wl,Wl.prototype.isEllipseCurve=!0,Wl.prototype.getPoint=function(e,t){for(var n=t||new qt,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=c-this.aY;s=h*l-d*u+this.aX,c=h*u+d*l+this.aY}return n.set(s,c)},Wl.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Wl.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Wl.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},(ql.prototype=Object.create(Wl.prototype)).constructor=ql,ql.prototype.isArcCurve=!0;var Yl=new rn,Zl=new Xl,Jl=new Xl,Kl=new Xl;function Ql(e,t,n,i){jl.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function $l(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function eu(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function tu(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function nu(e,t,n,i){jl.call(this),this.type="CubicBezierCurve",this.v0=e||new qt,this.v1=t||new qt,this.v2=n||new qt,this.v3=i||new qt}function iu(e,t,n,i){jl.call(this),this.type="CubicBezierCurve3",this.v0=e||new rn,this.v1=t||new rn,this.v2=n||new rn,this.v3=i||new rn}function ru(e,t){jl.call(this),this.type="LineCurve",this.v1=e||new qt,this.v2=t||new qt}function au(e,t){jl.call(this),this.type="LineCurve3",this.v1=e||new rn,this.v2=t||new rn}function ou(e,t,n){jl.call(this),this.type="QuadraticBezierCurve",this.v0=e||new qt,this.v1=t||new qt,this.v2=n||new qt}function su(e,t,n){jl.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new rn,this.v1=t||new rn,this.v2=n||new rn}function cu(e){jl.call(this),this.type="SplineCurve",this.points=e||[]}(Ql.prototype=Object.create(jl.prototype)).constructor=Ql,Ql.prototype.isCatmullRomCurve3=!0,Ql.prototype.getPoint=function(e,t){var n,i,r,a,o=t||new rn,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,u=Math.floor(l),h=l-u;if(this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(Yl.subVectors(s[0],s[1]).add(s[0]),n=Yl),i=s[u%c],r=s[(u+1)%c],this.closed||u+2<c?a=s[(u+2)%c]:(Yl.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=Yl),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(i),d),f=Math.pow(i.distanceToSquared(r),d),m=Math.pow(r.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Zl.initNonuniformCatmullRom(n.x,i.x,r.x,a.x,p,f,m),Jl.initNonuniformCatmullRom(n.y,i.y,r.y,a.y,p,f,m),Kl.initNonuniformCatmullRom(n.z,i.z,r.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(Zl.initCatmullRom(n.x,i.x,r.x,a.x,this.tension),Jl.initCatmullRom(n.y,i.y,r.y,a.y,this.tension),Kl.initCatmullRom(n.z,i.z,r.z,a.z,this.tension));return o.set(Zl.calc(h),Jl.calc(h),Kl.calc(h)),o},Ql.prototype.copy=function(e){jl.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){this.points.push(e.points[t].clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ql.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){e.points.push(this.points[t].toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ql.prototype.fromJSON=function(e){jl.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new rn).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},(nu.prototype=Object.create(jl.prototype)).constructor=nu,nu.prototype.isCubicBezierCurve=!0,nu.prototype.getPoint=function(e,t){var n=t||new qt,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(tu(e,i.x,r.x,a.x,o.x),tu(e,i.y,r.y,a.y,o.y)),n},nu.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},nu.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},nu.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},(iu.prototype=Object.create(jl.prototype)).constructor=iu,iu.prototype.isCubicBezierCurve3=!0,iu.prototype.getPoint=function(e,t){var n=t||new rn,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(tu(e,i.x,r.x,a.x,o.x),tu(e,i.y,r.y,a.y,o.y),tu(e,i.z,r.z,a.z,o.z)),n},iu.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},iu.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},iu.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},(ru.prototype=Object.create(jl.prototype)).constructor=ru,ru.prototype.isLineCurve=!0,ru.prototype.getPoint=function(e,t){var n=t||new qt;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ru.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ru.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},ru.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ru.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ru.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},(au.prototype=Object.create(jl.prototype)).constructor=au,au.prototype.isLineCurve3=!0,au.prototype.getPoint=function(e,t){var n=t||new rn;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},au.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},au.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},au.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},au.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},(ou.prototype=Object.create(jl.prototype)).constructor=ou,ou.prototype.isQuadraticBezierCurve=!0,ou.prototype.getPoint=function(e,t){var n=t||new qt,i=this.v0,r=this.v1,a=this.v2;return n.set(eu(e,i.x,r.x,a.x),eu(e,i.y,r.y,a.y)),n},ou.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ou.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ou.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},(su.prototype=Object.create(jl.prototype)).constructor=su,su.prototype.isQuadraticBezierCurve3=!0,su.prototype.getPoint=function(e,t){var n=t||new rn,i=this.v0,r=this.v1,a=this.v2;return n.set(eu(e,i.x,r.x,a.x),eu(e,i.y,r.y,a.y),eu(e,i.z,r.z,a.z)),n},su.prototype.copy=function(e){return jl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},su.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},su.prototype.fromJSON=function(e){return jl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},(cu.prototype=Object.create(jl.prototype)).constructor=cu,cu.prototype.isSplineCurve=!0,cu.prototype.getPoint=function(e,t){var n=t||new qt,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],c=i[a],l=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set($l(o,s.x,c.x,l.x,u.x),$l(o,s.y,c.y,l.y,u.y)),n},cu.prototype.copy=function(e){jl.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){this.points.push(e.points[t].clone())}return this},cu.prototype.toJSON=function(){var e=jl.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){e.points.push(this.points[t].toArray())}return e},cu.prototype.fromJSON=function(e){jl.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new qt).fromArray(i))}return this};var lu=Object.freeze({__proto__:null,ArcCurve:ql,CatmullRomCurve3:Ql,CubicBezierCurve:nu,CubicBezierCurve3:iu,EllipseCurve:Wl,LineCurve:ru,LineCurve3:au,QuadraticBezierCurve:ou,QuadraticBezierCurve3:su,SplineCurve:cu});function uu(){jl.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function hu(e){uu.call(this),this.type="Path",this.currentPoint=new qt,e&&this.setFromPoints(e)}function du(e){hu.call(this,e),this.uuid=Wt.generateUUID(),this.type="Shape",this.holes=[]}function pu(e,t){Cn.call(this),this.type="Light",this.color=new bi(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function fu(e,t,n){pu.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Cn.DefaultUp),this.updateMatrix(),this.groundColor=new bi(t)}function mu(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new qt(512,512),this.map=null,this.mapPass=null,this.matrix=new dn,this._frustum=new Br,this._frameExtents=new qt(1,1),this._viewportCount=1,this._viewports=[new Kt(0,0,1,1)]}function gu(){mu.call(this,new Cr(50,1,.5,500))}function vu(e,t,n,i,r,a){pu.call(this,e,t),this.type="SpotLight",this.position.copy(Cn.DefaultUp),this.updateMatrix(),this.target=new Cn,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new gu}function yu(){mu.call(this,new Cr(90,1,.5,500)),this._frameExtents=new qt(4,2),this._viewportCount=6,this._viewports=[new Kt(2,1,1,1),new Kt(0,1,1,1),new Kt(3,1,1,1),new Kt(1,1,1,1),new Kt(3,0,1,1),new Kt(1,0,1,1)],this._cubeDirections=[new rn(1,0,0),new rn(-1,0,0),new rn(0,0,1),new rn(0,0,-1),new rn(0,1,0),new rn(0,-1,0)],this._cubeUps=[new rn(0,1,0),new rn(0,1,0),new rn(0,1,0),new rn(0,1,0),new rn(0,0,1),new rn(0,0,-1)]}function xu(e,t,n,i){pu.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new yu}function _u(e,t,n,i,r,a){Lr.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function bu(){mu.call(this,new _u(-5,5,5,-5,.5,500))}function wu(e,t){pu.call(this,e,t),this.type="DirectionalLight",this.position.copy(Cn.DefaultUp),this.updateMatrix(),this.target=new Cn,this.shadow=new bu}function Mu(e,t){pu.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Eu(e,t,n,i){pu.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function Tu(e){Dl.call(this,e),this.textures={}}uu.prototype=Object.assign(Object.create(jl.prototype),{constructor:uu,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ru(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength();return a.getPointAt(0===o?0:1-r/o)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a.getPoints(a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e),s=0;s<o.length;s++){var c=o[s];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){jl.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){this.curves.push(e.curves[t].clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=jl.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){e.curves.push(this.curves[t].toJSON())}return e},fromJSON:function(e){jl.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new lu[i.type]).fromJSON(i))}return this}}),hu.prototype=Object.assign(Object.create(uu.prototype),{constructor:hu,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new ru(this.currentPoint.clone(),new qt(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,i){var r=new ou(this.currentPoint.clone(),new qt(e,t),new qt(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(e,t,n,i,r,a){var o=new nu(this.currentPoint.clone(),new qt(e,t),new qt(n,i),new qt(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},splineThru:function(e){var t=new cu([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,i,r,a){return this.absarc(e+this.currentPoint.x,t+this.currentPoint.y,n,i,r,a),this},absarc:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this},ellipse:function(e,t,n,i,r,a,o,s){return this.absellipse(e+this.currentPoint.x,t+this.currentPoint.y,n,i,r,a,o,s),this},absellipse:function(e,t,n,i,r,a,o,s){var c=new Wl(e,t,n,i,r,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return uu.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=uu.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return uu.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),du.prototype=Object.assign(Object.create(hu.prototype),{constructor:du,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){hu.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){this.holes.push(e.holes[t].clone())}return this},toJSON:function(){var e=hu.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){e.holes.push(this.holes[t].toJSON())}return e},fromJSON:function(e){hu.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new hu).fromJSON(i))}return this}}),pu.prototype=Object.assign(Object.create(Cn.prototype),{constructor:pu,isLight:!0,copy:function(e){return Cn.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Cn.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),fu.prototype=Object.assign(Object.create(pu.prototype),{constructor:fu,isHemisphereLight:!0,copy:function(e){return pu.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(mu.prototype,{_projScreenMatrix:new dn,_lightPositionWorld:new rn,_lookTarget:new rn,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),i.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),gu.prototype=Object.assign(Object.create(mu.prototype),{constructor:gu,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*Wt.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),mu.prototype.updateMatrices.call(this,e)}}),vu.prototype=Object.assign(Object.create(pu.prototype),{constructor:vu,isSpotLight:!0,copy:function(e){return pu.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),yu.prototype=Object.assign(Object.create(mu.prototype),{constructor:yu,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,i=this.matrix,r=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),n.position.copy(r),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),xu.prototype=Object.assign(Object.create(pu.prototype),{constructor:xu,isPointLight:!0,copy:function(e){return pu.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),_u.prototype=Object.assign(Object.create(Lr.prototype),{constructor:_u,isOrthographicCamera:!0,copy:function(e,t){return Lr.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=c*this.view.offsetX)+c*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Cn.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),bu.prototype=Object.assign(Object.create(mu.prototype),{constructor:bu,isDirectionalLightShadow:!0,updateMatrices:function(e){mu.prototype.updateMatrices.call(this,e)}}),wu.prototype=Object.assign(Object.create(pu.prototype),{constructor:wu,isDirectionalLight:!0,copy:function(e){return pu.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Mu.prototype=Object.assign(Object.create(pu.prototype),{constructor:Mu,isAmbientLight:!0}),Eu.prototype=Object.assign(Object.create(pu.prototype),{constructor:Eu,isRectAreaLight:!0,copy:function(e){return pu.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=pu.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Tu.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Tu,load:function(e,t,n,i){var r=this,a=new Fl(r.manager);a.setPath(r.path),a.load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new gl[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new bi).setHex(e.sheen)),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&(i.vertexColors="number"==typeof e.vertexColors?e.vertexColors>0:e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=(new bi).setHex(a.value);break;case"v2":i.uniforms[r].value=(new qt).fromArray(a.value);break;case"v3":i.uniforms[r].value=(new rn).fromArray(a.value);break;case"v4":i.uniforms[r].value=(new Kt).fromArray(a.value);break;case"m3":i.uniforms[r].value=(new Xt).fromArray(a.value);case"m4":i.uniforms[r].value=(new dn).fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)i.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),i.normalScale=(new qt).fromArray(s)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new qt).fromArray(e.clearcoatNormalScale)),i},setTextures:function(e){return this.textures=e,this}});var Su={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function Au(){Zi.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Ru(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Ci.call(this,e,t,n),this.meshPerAttribute=i||1}function Lu(e){Dl.call(this,e)}Au.prototype=Object.assign(Object.create(Zi.prototype),{constructor:Au,isInstancedBufferGeometry:!0,copy:function(e){return Zi.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Zi.prototype.toJSON.call(this);return e.maxInstancedCount=this.maxInstancedCount,e.isInstancedBufferGeometry=!0,e}}),Ru.prototype=Object.assign(Object.create(Ci.prototype),{constructor:Ru,isInstancedBufferAttribute:!0,copy:function(e){return Ci.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=Ci.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Lu.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Lu,load:function(e,t,n,i){var r=this,a=new Fl(r.manager);a.setPath(r.path),a.load(e,function(e){t(r.parse(JSON.parse(e)))},n,i)},parse:function(e){var t=e.isInstancedBufferGeometry?new Au:new Zi,n=e.data.index;if(void 0!==n){var i=new Cu[n.type](n.array);t.setIndex(new Ci(i,1))}var r=e.data.attributes;for(var a in r){i=new Cu[(d=r[a]).type](d.array);var o=new(d.isInstancedBufferAttribute?Ru:Ci)(i,d.itemSize,d.normalized);void 0!==d.name&&(o.name=d.name),t.setAttribute(a,o)}var s=e.data.morphAttributes;if(s)for(var a in s){for(var c=s[a],l=[],u=0,h=c.length;u<h;u++){var d;o=new Ci(i=new Cu[(d=c[u]).type](d.array),d.itemSize,d.normalized);void 0!==d.name&&(o.name=d.name),l.push(o)}t.morphAttributes[a]=l}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==p){u=0;for(var f=p.length;u!==f;++u){var m=p[u];t.addGroup(m.start,m.count,m.materialIndex)}}var g=e.data.boundingSphere;if(void 0!==g){var v=new rn;void 0!==g.center&&v.fromArray(g.center),t.boundingSphere=new Yn(v,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Cu={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Pu(e){Dl.call(this,e)}Pu.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Pu,load:function(e,t,n,i){var r=this,a=""===this.path?Su.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Fl(r.manager);o.setPath(this.path),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)},n,i)},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,i,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new du).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new Lu,r=0,a=e.length;r<a;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new al[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new al[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new al[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new al[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new al[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new al[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":o=new al[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new al[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new al[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new al[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new al[s.type]((new lu[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new al[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new al[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,u=s.shapes.length;l<u;l++){c.push(t[s.shapes[l]])}o=new al[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,u=s.shapes.length;l<u;l++){c.push(t[s.shapes[l]])}var h=s.options.extrudePath;void 0!==h&&(s.options.extrudePath=(new lu[h.type]).fromJSON(h)),o=new al[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=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}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},i={};if(void 0!==e){var r=new Tu;r.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];void 0===n[u.uuid]&&(n[u.uuid]=r.parse(u)),c.push(n[u.uuid])}i[s.uuid]=c}else void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=Cl.parse(i);void 0!==i.uuid&&(r.uuid=i.uuid),t.push(r)}return t},parseImages:function(e,t){var n=this,i={};function r(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(void 0!==e&&e.length>0){var a=new Gl(new Nl(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){i[c.uuid]=[];for(var u=0,h=l.length;u<h;u++){var d=l[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;i[c.uuid].push(r(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;i[c.uuid]=r(p)}}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,a=e.length;r<a;r++){var o,s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new ia(t[s.image]):new Jt(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,Nu)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],Iu),o.wrapT=n(s.wrap[1],Iu)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,Du)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,Du)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),i[s.uuid]=o}return i},parseObject:function(e,t,n){var i;function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],i=0,r=e.length;i<r;i++){var a=e[i];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":i=new Pn,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new bi(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new qo(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new Wo(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new Cr(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new _u(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new Mu(e.color,e.intensity);break;case"DirectionalLight":i=new wu(e.color,e.intensity);break;case"PointLight":i=new xu(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new Eu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new vu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new fu(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":i=new pr(o=r(e.geometry),s=a(e.material));break;case"InstancedMesh":var o=r(e.geometry),s=a(e.material),c=e.instanceMatrix;(i=new Es(o,s,e.count)).instanceMatrix=new Ci(new Float32Array(c.array),16);break;case"LOD":i=new fs;break;case"Line":i=new Ps(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new Ds(r(e.geometry),a(e.material));break;case"LineSegments":i=new Is(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new Gs(r(e.geometry),a(e.material));break;case"Sprite":i=new us(a(e.material));break;case"Group":i=new ko;break;default:i=new Cn}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children)for(var l=e.children,u=0;u<l.length;u++)i.add(this.parseObject(l[u],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate);for(var h=e.levels,d=0;d<h.length;d++){var p=h[d],f=i.getObjectByProperty("uuid",p.object);void 0!==f&&i.addLevel(f,p.distance)}}return i}});var Ou,Nu={UVMapping:300,CubeReflectionMapping:Z,CubeRefractionMapping:J,EquirectangularReflectionMapping:K,EquirectangularRefractionMapping:Q,SphericalReflectionMapping:$,CubeUVReflectionMapping:ee,CubeUVRefractionMapping:te},Iu={RepeatWrapping:ne,ClampToEdgeWrapping:ie,MirroredRepeatWrapping:re},Du={NearestFilter:ae,NearestMipmapNearestFilter:oe,NearestMipmapLinearFilter:se,LinearFilter:ce,LinearMipmapNearestFilter:le,LinearMipmapLinearFilter:ue};function Hu(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Dl.call(this,e),this.options=void 0}function Fu(){this.type="ShapePath",this.color=new bi,this.subPaths=[],this.currentPath=null}function Bu(e){this.type="Font",this.data=e}function zu(e,t,n,i,r){var a=r.glyphs[e]||r.glyphs["?"];if(a){var o,s,c,l,u,h,d,p,f=new Fu;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;){switch(m[g++]){case"m":o=m[g++]*t+n,s=m[g++]*t+i,f.moveTo(o,s);break;case"l":o=m[g++]*t+n,s=m[g++]*t+i,f.lineTo(o,s);break;case"q":c=m[g++]*t+n,l=m[g++]*t+i,u=m[g++]*t+n,h=m[g++]*t+i,f.quadraticCurveTo(u,h,c,l);break;case"b":c=m[g++]*t+n,l=m[g++]*t+i,u=m[g++]*t+n,h=m[g++]*t+i,d=m[g++]*t+n,p=m[g++]*t+i,f.bezierCurveTo(u,h,d,p,c,l)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function Uu(e){Dl.call(this,e)}Hu.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Hu,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ol.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;fetch(e).then(function(e){return e.blob()}).then(function(e){return void 0===r.options?createImageBitmap(e):createImageBitmap(e,r.options)}).then(function(n){Ol.add(e,n),t&&t(n),r.manager.itemEnd(e)}).catch(function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}),Object.assign(Fu.prototype,{moveTo:function(e,t){return this.currentPath=new hu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this},bezierCurveTo:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new du;a.curves=r.curves,t.push(a)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[r],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=Ic.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new du).curves=s.curves,l.push(c),l;var u=!r(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=r(h=(s=a[v]).getPoints()),(o=e?!o:o)?(!u&&f[g]&&g++,f[g]={s:new du,p:h},f[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,_=[],b=0,w=f.length;b<w;b++)p[b]=[];for(b=0,w=f.length;b<w;b++)for(var M=m[b],E=0;E<M.length;E++){for(var T=M[E],S=!0,A=0;A<f.length;A++)i(T.p,f[A].p)&&(b!==A&&_.push({froms:b,tos:A,hole:E}),S?(S=!1,p[A].push(T)):x=!0);S&&p[b].push(T)}_.length>0&&(x||(m=p))}v=0;for(var R=f.length;v<R;v++){l.push(c=f[v].s);for(var L=0,C=(d=m[v]).length;L<C;L++)c.holes.push(d[L].h)}return l}}),Object.assign(Bu.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],i=function(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[],s=0,c=0,l=0;l<i.length;l++){var u=i[l];if("\n"===u)s=0,c-=a;else{var h=zu(u,r,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),Uu.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Uu,load:function(e,t,n,i){var r=this,a=new Fl(this.manager);a.setPath(this.path),a.load(e,function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var i=r.parse(n);t&&t(i)},n,i)},parse:function(e){return new Bu(e)}});var Gu={getContext:function(){return void 0===Ou&&(Ou=new(window.AudioContext||window.webkitAudioContext)),Ou},setContext:function(e){Ou=e}};function ku(e){Dl.call(this,e)}function Vu(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new rn)}function ju(e,t){pu.call(this,void 0,t),this.sh=void 0!==e?e:new Vu}function Wu(e,t,n){ju.call(this,void 0,n);var i=(new bi).set(e),r=(new bi).set(t),a=new rn(i.r,i.g,i.b),o=new rn(r.r,r.g,r.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function qu(e,t){ju.call(this,void 0,t);var n=(new bi).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}ku.prototype=Object.assign(Object.create(Dl.prototype),{constructor:ku,load:function(e,t,n,i){var r=new Fl(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.load(e,function(e){var n=e.slice(0);Gu.getContext().decodeAudioData(n,function(e){t(e)})},n,i)}}),Object.assign(Vu.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t},getIrradianceAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}),Object.assign(Vu,{getBasisAt:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}),ju.prototype=Object.assign(Object.create(pu.prototype),{constructor:ju,isLightProbe:!0,copy:function(e){return pu.prototype.copy.call(this,e),this.sh.copy(e.sh),this.intensity=e.intensity,this},toJSON:function(e){return pu.prototype.toJSON.call(this,e)}}),Wu.prototype=Object.assign(Object.create(ju.prototype),{constructor:Wu,isHemisphereLightProbe:!0,copy:function(e){return ju.prototype.copy.call(this,e),this},toJSON:function(e){return ju.prototype.toJSON.call(this,e)}}),qu.prototype=Object.assign(Object.create(ju.prototype),{constructor:qu,isAmbientLightProbe:!0,copy:function(e){return ju.prototype.copy.call(this,e),this},toJSON:function(e){return ju.prototype.toJSON.call(this,e)}});var Xu=new dn,Yu=new dn;function Zu(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Cr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Cr,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}}function Ju(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Zu.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,i,r=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(Wt.DEG2RAD*t.fov*.5)/t.zoom;Yu.elements[12]=-a,Xu.elements[12]=a,r.elements[0]=2*t.near/((i=s*t.aspect+o)-(n=-s*t.aspect+o)),r.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(r),r.elements[0]=2*t.near/((i=s*t.aspect-o)-(n=-s*t.aspect-o)),r.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Yu),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Xu)}}),Object.assign(Ju.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Ku=new rn,Qu=new en,$u=new rn,eh=new rn;function th(){Cn.call(this),this.type="AudioListener",this.context=Gu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ju}function nh(e){Cn.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.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.sourceType="empty",this._startedAt=0,this._pausedAt=0,this.filters=[]}th.prototype=Object.assign(Object.create(Cn.prototype),{constructor:th,getInput:function(){return this.gain},removeFilter:function(){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:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){Cn.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ku,Qu,$u),eh.set(0,0,-1).applyQuaternion(Qu),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ku.x,i),t.positionY.linearRampToValueAtTime(Ku.y,i),t.positionZ.linearRampToValueAtTime(Ku.z,i),t.forwardX.linearRampToValueAtTime(eh.x,i),t.forwardY.linearRampToValueAtTime(eh.y,i),t.forwardZ.linearRampToValueAtTime(eh.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Ku.x,Ku.y,Ku.z),t.setOrientation(eh.x,eh.y,eh.z,n.x,n.y,n.z)}}),nh.prototype=Object.assign(Object.create(Cn.prototype),{constructor:nh,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._pausedAt+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._pausedAt+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._pausedAt=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!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:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var ih=new rn,rh=new en,ah=new rn,oh=new rn;function sh(e){nh.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function ch(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function lh(e,t,n){this.binding=e,this.valueSize=n;var i,r=Float64Array;switch(t){case"quaternion":i=this._slerp;break;case"string":case"bool":r=Array,i=this._select;break;default:i=this._lerp}this.buffer=new r(4*n),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}sh.prototype=Object.assign(Object.create(nh.prototype),{constructor:sh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(Cn.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(ih,rh,ah),oh.set(0,0,1).applyQuaternion(rh);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ih.x,n),t.positionY.linearRampToValueAtTime(ih.y,n),t.positionZ.linearRampToValueAtTime(ih.z,n),t.orientationX.linearRampToValueAtTime(oh.x,n),t.orientationY.linearRampToValueAtTime(oh.y,n),t.orientationZ.linearRampToValueAtTime(oh.z,n)}else t.setPosition(ih.x,ih.y,ih.z),t.setOrientation(oh.x,oh.y,oh.z)}}}),Object.assign(ch.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(lh.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{this._mixBufferRegion(n,r,0,t/(a+=t),i)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.binding;(this.cumulativeWeight=0,r<1)&&this._mixBufferRegion(n,i,3*t,1-r,t);for(var o=t,s=t+t;o!==s;++o)if(n[o]!==n[o+t]){a.setValue(n,i);break}},saveOriginalState:function(){var e=this.buffer,t=this.valueSize,n=3*t;this.binding.getValue(e,n);for(var i=t,r=n;i!==r;++i)e[i]=e[n+i%t];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(e,t,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){en.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}});var uh=new RegExp("[\\[\\]\\.:\\/]","g"),hh="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",dh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),ph=/(WCOD+)?/.source.replace("WCOD",hh),fh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),mh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),gh=new RegExp("^"+dh+ph+fh+mh+"$"),vh=["material","materials","bones"];function yh(e,t,n){var i=n||xh.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function xh(e,t,n){this.path=t,this.parsedPath=n||xh.parseTrackName(t),this.node=xh.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function _h(){this.uuid=Wt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function bh(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,a=new Array(r),o={endingStart:Et,endingEnd:Et},s=0;s!==r;++s){var c=i[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Mt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=Infinity,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function wh(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Mh(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Eh(e,t,n){Xo.call(this,e,t),this.meshPerAttribute=n||1}function Th(e,t,n,i){this.ray=new ni(e,t),this.near=n||0,this.far=i||Infinity,this.camera=null,this.layers=new gn,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 Sh(e,t){return e.distance-t.distance}function Ah(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)Ah(r[a],t,n,!0)}function Rh(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}function Lh(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}Object.assign(yh.prototype,{getValue:function(e,t){this.bind();var n=this._bindings[this._targetGroup.nCachedObjects_];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(xh,{Composite:yh,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new xh.Composite(e,t,n):new xh(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(uh,"")},parseTrackName:function(e){var t=gh.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==vh.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function(e){for(var n=0;n<e.length;n++){var r=e[n];if(r.name===t||r.uuid===t)return r;var a=i(r.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}}),Object.assign(xh.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(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=xh.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var c=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!e.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===r){r=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(xh.prototype,{_getValue_unbound:xh.prototype.getValue,_setValue_unbound:xh.prototype.setValue}),Object.assign(_h.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],d=h.uuid,p=i[d];if(void 0===p){p=t++,i[d]=p,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new xh(h,r[f],a[f]))}else if(p<n){c=e[p];var g=--n,v=e[g];i[v.uuid]=p,e[p]=v,i[d]=g,e[g]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[p];y[p]=y[g],void 0===x&&(x=new xh(h,r[f],a[f])),y[g]=x}}else e[p]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&l>=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[l];f[l]=f[u],f[u]=m}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=i[c];if(void 0!==l)if(delete i[c],l<n){var u=--n,h=e[u],d=e[g=--t];i[h.uuid]=l,e[l]=h,i[d.uuid]=u,e[u]=d,e.pop();for(var p=0,f=a;p!==f;++p){var m=(v=r[p])[g];v[l]=v[u],v[u]=m,v.pop()}}else{var g;i[(d=e[g=--t]).uuid]=l,e[l]=d,e.pop();for(p=0,f=a;p!==f;++p){var v;(v=r[p])[l]=v[g],v.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,c=this.nCachedObjects_,l=new Array(s.length);n[e]=i=r.length,a.push(e),o.push(t),r.push(l);for(var u=c,h=s.length;u!==h;++u){l[u]=new xh(s[u],e,t)}return l},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}),Object.assign(bh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=i/r;e.warp(1,r/i,t),this.warp(a,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=2202===i;if(0===e)return-1===r?t:a&&1==(1&r)?n-t:t;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:Et:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:Et:2402)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),wh.prototype=Object.assign(Object.create(Gt.prototype),{constructor:wh,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(c[s]=l={});for(var u=0;u!==r;++u){var h=i[u],d=h.name,p=l[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}++(p=new lh(xh.create(n,d,t&&t._propertyBindings[u].binding.parsedPath),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;void 0===r&&(i[t]=r={}),r[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new _l(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?Cl.findByName(n,e):e,a=null!==r?r.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[i];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var l=new bh(this,r,t);return this._bindAction(l,s),this._addInactiveAction(l,a,i),l},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?Cl.findByName(n,e):e,a=this._actionsByClip[r?r.uuid:e];return void 0!==a&&a.actionByRoot[i]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){for(var t=this._actions,n=this._nActiveActions,i=this.time+=e*=this.timeScale,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(i,e,r,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Mh.prototype.clone=function(){return new Mh(void 0===this.value.clone?this.value:this.value.clone())},Eh.prototype=Object.assign(Object.create(Xo.prototype),{constructor:Eh,isInstancedInterleavedBuffer:!0,copy:function(e){return Xo.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(Th.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return Ah(e,this,i,t),i.sort(Sh),i},intersectObjects:function(e,t,n){var i=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,a=e.length;r<a;r++)Ah(e[r],this,i,t);return i.sort(Sh),i}}),Object.assign(Rh.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Wt.clamp(t/this.radius,-1,1))),this}}),Object.assign(Lh.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var Ch=new qt;function Ph(e,t){this.min=void 0!==e?e:new qt(Infinity,Infinity),this.max=void 0!==t?t:new qt(-Infinity,-Infinity)}Object.assign(Ph.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Ch.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-Infinity,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new qt),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new qt),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new qt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new qt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Ch.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Oh=new rn,Nh=new rn;function Ih(e,t){this.start=void 0!==e?e:new rn,this.end=void 0!==t?t:new rn}function Dh(e){Cn.call(this),this.material=e,this.render=function(){}}Object.assign(Ih.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new rn),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new rn),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new rn),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Oh.subVectors(e,this.start),Nh.subVectors(this.end,this.start);var n=Nh.dot(Nh),i=Nh.dot(Oh)/n;return t&&(i=Wt.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new rn),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),(Dh.prototype=Object.create(Cn.prototype)).constructor=Dh,Dh.prototype.isImmediateRenderObject=!0;var Hh=new rn;function Fh(e,t){Cn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Zi,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Bi(i,3));var c=new Ts({fog:!1,toneMapped:!1});this.cone=new Is(n,c),this.add(this.cone),this.update()}(Fh.prototype=Object.create(Cn.prototype)).constructor=Fh,Fh.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Fh.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Hh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Hh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Bh=new rn,zh=new dn,Uh=new dn;function Gh(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new Zi,i=[],r=[],a=new bi(0,0,1),o=new bi(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Bi(i,3)),n.setAttribute("color",new Bi(r,3));var l=new Ts({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Is.call(this,n,l),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function kh(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new jc(t,4,2),r=new Ri({wireframe:!0,fog:!1,toneMapped:!1});pr.call(this,i,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}(Gh.prototype=Object.create(Is.prototype)).constructor=Gh,Gh.prototype.isSkeletonHelper=!0,Gh.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");Uh.getInverse(this.root.matrixWorld);for(var r=0,a=0;r<t.length;r++){var o=t[r];o.parent&&o.parent.isBone&&(zh.multiplyMatrices(Uh,o.matrixWorld),Bh.setFromMatrixPosition(zh),i.setXYZ(a,Bh.x,Bh.y,Bh.z),zh.multiplyMatrices(Uh,o.parent.matrixWorld),Bh.setFromMatrixPosition(zh),i.setXYZ(a+1,Bh.x,Bh.y,Bh.z),a+=2)}n.getAttribute("position").needsUpdate=!0,Cn.prototype.updateMatrixWorld.call(this,e)},(kh.prototype=Object.create(pr.prototype)).constructor=kh,kh.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},kh.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var Vh=new rn,jh=new bi,Wh=new bi;function qh(e,t,n){Cn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new tc(t);i.rotateY(.5*Math.PI),this.material=new Ri({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new Ci(a,3)),this.add(new pr(i,this.material)),this.update()}function Xh(e,t,n,i){e=e||10,t=t||10,n=new bi(void 0!==n?n:4473924),i=new bi(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,h=-o;l<=t;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=l===r?n:i;d.toArray(c,u),d.toArray(c,u+=3),d.toArray(c,u+=3),d.toArray(c,u+=3),u+=3}var p=new Zi;p.setAttribute("position",new Bi(s,3)),p.setAttribute("color",new Bi(c,3));var f=new Ts({vertexColors:!0,toneMapped:!1});Is.call(this,p,f)}function Yh(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new bi(void 0!==r?r:4473924),a=new bi(void 0!==a?a:8947848);var o,s,c,l,u,h,d,p=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,p.push(0,0,0),p.push(o,0,s),f.push((d=1&l?r:a).r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=n;l++)for(d=1&l?r:a,h=e-e/n*l,u=0;u<i;u++)c=u/i*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),c=(u+1)/i*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Zi;m.setAttribute("position",new Bi(p,3)),m.setAttribute("color",new Bi(f,3));var g=new Ts({vertexColors:!0,toneMapped:!1});Is.call(this,m,g)}(qh.prototype=Object.create(Cn.prototype)).constructor=qh,qh.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},qh.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");jh.copy(this.light.color),Wh.copy(this.light.groundColor);for(var n=0,i=t.count;n<i;n++){var r=n<i/2?jh:Wh;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(Vh.setFromMatrixPosition(this.light.matrixWorld).negate())},Xh.prototype=Object.assign(Object.create(Is.prototype),{constructor:Xh,copy:function(e){return Is.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),(Yh.prototype=Object.create(Is.prototype)).constructor=Yh;var Zh=new rn,Jh=new rn,Kh=new rn;function Qh(e,t,n){Cn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var i=new Zi;i.setAttribute("position",new Bi([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new Ts({fog:!1,toneMapped:!1});this.lightPlane=new Ps(i,r),this.add(this.lightPlane),(i=new Zi).setAttribute("position",new Bi([0,0,0,0,0,1],3)),this.targetLine=new Ps(i,r),this.add(this.targetLine),this.update()}(Qh.prototype=Object.create(Cn.prototype)).constructor=Qh,Qh.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Qh.prototype.update=function(){Zh.setFromMatrixPosition(this.light.matrixWorld),Jh.setFromMatrixPosition(this.light.target.matrixWorld),Kh.subVectors(Jh,Zh),this.lightPlane.lookAt(Jh),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(Jh),this.targetLine.scale.z=Kh.length()};var $h=new rn,ed=new Lr;function td(e){var t=new Zi,n=new Ts({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={},o=new bi(16755200),s=new bi(16711680),c=new bi(43775),l=new bi(16777215),u=new bi(3355443);function h(e,t,n){d(e,n),d(t,n)}function d(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.setAttribute("position",new Bi(i,3)),t.setAttribute("color",new Bi(r,3)),Is.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function nd(e,t,n,i,r,a,o){$h.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],$h.x,$h.y,$h.z)}(td.prototype=Object.create(Is.prototype)).constructor=td,td.prototype.update=function(){var e=this.geometry,t=this.pointMap;ed.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),nd("c",t,e,ed,0,0,-1),nd("t",t,e,ed,0,0,1),nd("n1",t,e,ed,-1,-1,-1),nd("n2",t,e,ed,1,-1,-1),nd("n3",t,e,ed,-1,1,-1),nd("n4",t,e,ed,1,1,-1),nd("f1",t,e,ed,-1,-1,1),nd("f2",t,e,ed,1,-1,1),nd("f3",t,e,ed,-1,1,1),nd("f4",t,e,ed,1,1,1),nd("u1",t,e,ed,.7,1.1,-1),nd("u2",t,e,ed,-.7,1.1,-1),nd("u3",t,e,ed,0,2,-1),nd("cf1",t,e,ed,-1,0,1),nd("cf2",t,e,ed,1,0,1),nd("cf3",t,e,ed,0,-1,1),nd("cf4",t,e,ed,0,1,1),nd("cn1",t,e,ed,-1,0,-1),nd("cn2",t,e,ed,1,0,-1),nd("cn3",t,e,ed,0,-1,-1),nd("cn4",t,e,ed,0,1,-1),e.getAttribute("position").needsUpdate=!0};var id=new Wn;function rd(e,t){this.object=e,void 0===t&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Zi;r.setIndex(new Ci(n,1)),r.setAttribute("position",new Ci(i,3)),Is.call(this,r,new Ts({color:t,toneMapped:!1})),this.matrixAutoUpdate=!1,this.update()}function ad(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Zi;i.setIndex(new Ci(n,1)),i.setAttribute("position",new Bi([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)),Is.call(this,i,new Ts({color:t,toneMapped:!1})),this.geometry.computeBoundingSphere()}function od(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var i=void 0!==n?n:16776960,r=new Zi;r.setAttribute("position",new Bi([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),Ps.call(this,r,new Ts({color:i,toneMapped:!1}));var a=new Zi;a.setAttribute("position",new Bi([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new pr(a,new Ri({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}(rd.prototype=Object.create(Is.prototype)).constructor=rd,rd.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&id.setFromObject(this.object),!id.isEmpty()){var t=id.min,n=id.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}},rd.prototype.setFromObject=function(e){return this.object=e,this.update(),this},rd.prototype.copy=function(e){return Is.prototype.copy.call(this,e),this.object=e.object,this},rd.prototype.clone=function(){return(new this.constructor).copy(this)},(ad.prototype=Object.create(Is.prototype)).constructor=ad,ad.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Cn.prototype.updateMatrixWorld.call(this,e))},(od.prototype=Object.create(Ps.prototype)).constructor=od,od.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?c:s,this.lookAt(this.plane.normal),Cn.prototype.updateMatrixWorld.call(this,e)};var sd,cd,ld=new rn;function ud(e,t,n,i,r,a){Cn.call(this),void 0===e&&(e=new rn(0,0,1)),void 0===t&&(t=new rn(0,0,0)),void 0===n&&(n=1),void 0===i&&(i=16776960),void 0===r&&(r=.2*n),void 0===a&&(a=.2*r),void 0===sd&&((sd=new Zi).setAttribute("position",new Bi([0,0,0,0,1,0],3)),(cd=new el(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Ps(sd,new Ts({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new pr(cd,new Ri({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}function hd(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Zi;n.setAttribute("position",new Bi(t,3)),n.setAttribute("color",new Bi([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new Ts({vertexColors:!0,toneMapped:!1});Is.call(this,n,i)}(ud.prototype=Object.create(Cn.prototype)).constructor=ud,ud.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{ld.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(ld,t)}},ud.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},ud.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},ud.prototype.copy=function(e){return Cn.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},ud.prototype.clone=function(){return(new this.constructor).copy(this)},(hd.prototype=Object.create(Is.prototype)).constructor=hd;var dd=4,pd=8,fd=Math.pow(2,pd),md=[.125,.215,.35,.446,.526,.582],gd=pd-dd+1+md.length,vd=20,yd={};yd[Tt]=0,yd[St]=1,yd[Rt]=2,yd[Ct]=3,yd[Pt]=4,yd[Ot]=5,yd[At]=6;var xd,_d,bd,wd,Md=new _u,Ed=(xd=vd,_d=new Float32Array(xd),bd=new rn(0,1,0),(wd=new sl({defines:{n:xd},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:_d},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:bd},inputEncoding:{value:yd[Tt]},outputEncoding:{value:yd[Tt]}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:u,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",wd),Td=null,Sd=null,Ad=function(){for(var e=[],t=[],n=[],i=pd,r=0;r<gd;r++){var a=Math.pow(2,i);t.push(a);var o=1/a;r>pd-dd?o=md[r-pd+dd-1]:0==r&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,g=f>2?0:-1,v=[m,g,0,m+2/3,g,0,m+2/3,g+1,0,m,g,0,m+2/3,g+1,0,m,g+1,0];h.set(v,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new Zi;x.setAttribute("position",new Ci(h,3)),x.setAttribute("uv",new Ci(d,2)),x.setAttribute("faceIndex",new Ci(p,1)),e.push(x),i>dd&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Rd=Ad._lodPlanes,Ld=Ad._sizeLods,Cd=Ad._sigmas,Pd=null,Od=null,Nd=null,Id=(1+Math.sqrt(5))/2,Dd=1/Id,Hd=[new rn(1,1,1),new rn(-1,1,1),new rn(1,1,-1),new rn(-1,1,-1),new rn(0,Id,Dd),new rn(0,Id,-Dd),new rn(Dd,0,Id),new rn(-Dd,0,Id),new rn(Id,Dd,0),new rn(-Id,Dd,0)];function Fd(e){Od=e,Ud(Ed)}function Bd(e){var t={magFilter:ae,minFilter:ae,generateMipmaps:!1,type:e?e.type:he,format:e?e.format:Re,encoding:e?e.encoding:Rt,depthBuffer:!1,stencilBuffer:!1},n=Gd(t);return n.depthBuffer=!e,Pd=Gd(t),n}function zd(e){Pd.dispose(),Od.setRenderTarget(Nd),e.scissorTest=!1,e.setSize(e.width,e.height)}function Ud(e){var t=new Pn;t.add(new pr(Rd[0],e)),Od.compile(t,Md)}function Gd(e){var t=new Qt(3*fd,3*fd,e);return t.texture.mapping=ee,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function kd(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Vd(e){var t=Od.autoClear;Od.autoClear=!1;for(var n=1;n<gd;n++){jd(e,n-1,n,Math.sqrt(Cd[n]*Cd[n]-Cd[n-1]*Cd[n-1]),Hd[(n-1)%Hd.length])}Od.autoClear=t}function jd(e,t,n,i,r){Wd(e,Pd,t,n,i,"latitudinal",r),Wd(Pd,e,n,n,i,"longitudinal",r)}function Wd(e,t,n,i,r,a,o){"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var s=new Pn;s.add(new pr(Rd[i],Ed));var c=Ed.uniforms,l=Ld[n]-1,u=isFinite(r)?Math.PI/(2*l):2*Math.PI/(2*vd-1),h=r/u,d=isFinite(r)?1+Math.floor(3*h):vd;d>vd&&console.warn("sigmaRadians, "+r+", is too large and will clip, as it requested "+d+" samples when the maximum is set to "+vd);for(var p=[],f=0,m=0;m<vd;++m){var g=m/h,v=Math.exp(-g*g/2);p.push(v),0==m?f+=v:m<d&&(f+=2*v)}for(m=0;m<p.length;m++)p[m]=p[m]/f;c.envMap.value=e.texture,c.samples.value=d,c.weights.value=p,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o),c.dTheta.value=u,c.mipInt.value=pd-n,c.inputEncoding.value=yd[e.texture.encoding],c.outputEncoding.value=yd[e.texture.encoding];var y=Ld[i];kd(t,g=3*Math.max(0,fd-2*y),(0===i?0:2*fd)+2*y*(i>pd-dd?i-pd+dd:0),3*y,2*y),Od.setRenderTarget(t),Od.render(s,Md)}function qd(){var e=new sl({uniforms:{envMap:{value:null},texelSize:{value:new qt(1,1)},inputEncoding:{value:yd[Tt]},outputEncoding:{value:yd[Tt]}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:u,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function Xd(){var e=new sl({uniforms:{envMap:{value:null},inputEncoding:{value:yd[Tt]},outputEncoding:{value:yd[Tt]}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:u,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Yd(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ql.call(this,e),this.type="catmullrom",this.closed=!0}function Zd(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ql.call(this,e),this.type="catmullrom"}function Jd(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Ql.call(this,e),this.type="catmullrom"}Fd.prototype={constructor:Fd,fromScene:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=.1),void 0===i&&(i=100),Nd=Od.getRenderTarget();var r=Bd();return function(e,t,n,i){var r=new Cr(90,1,t,n),a=[1,1,1,1,-1,1],o=[1,1,-1,-1,-1,1],s=Od.outputEncoding,c=Od.toneMapping,l=Od.toneMappingExposure,u=Od.getClearColor(),h=Od.getClearAlpha();Od.toneMapping=j,Od.toneMappingExposure=1,Od.outputEncoding=Tt,e.scale.z*=-1;var d=e.background;if(d&&d.isColor){d.convertSRGBToLinear();var p=Math.max(d.r,d.g,d.b),f=Math.min(Math.max(Math.ceil(Math.log2(p)),-128),127);d=d.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;Od.setClearColor(d,m),e.background=null}for(var g=0;g<6;g++){var v=g%3;0==v?(r.up.set(0,a[g],0),r.lookAt(o[g],0,0)):1==v?(r.up.set(0,0,a[g]),r.lookAt(0,o[g],0)):(r.up.set(0,a[g],0),r.lookAt(0,0,o[g])),kd(i,v*fd,g>2?fd:0,fd,fd),Od.setRenderTarget(i),Od.render(e,r)}Od.toneMapping=c,Od.toneMappingExposure=l,Od.outputEncoding=s,Od.setClearColor(u,h),e.scale.z*=-1}(e,n,i,r),t>0&&jd(r,0,0,t),Vd(r),zd(r),r},fromEquirectangular:function(e){return e.magFilter=ae,e.minFilter=ae,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){Nd=Od.getRenderTarget();var t=Bd(e);return function(e,t){var n=new Pn;e.isCubeTexture?null==Sd&&(Sd=Xd()):null==Td&&(Td=qd());var i=e.isCubeTexture?Sd:Td;n.add(new pr(Rd[0],i));var r=i.uniforms;r.envMap.value=e,e.isCubeTexture||r.texelSize.value.set(1/e.image.width,1/e.image.height);r.inputEncoding.value=yd[e.encoding],r.outputEncoding.value=yd[e.encoding],kd(t,0,0,3*fd,2*fd),Od.setRenderTarget(t),Od.render(n,Md)}(e,t),Vd(t),zd(t),t},compileCubemapShader:function(){null==Sd&&Ud(Sd=Xd())},compileEquirectangularShader:function(){null==Td&&Ud(Td=qd())},dispose:function(){Ed.dispose(),null!=Sd&&Sd.dispose(),null!=Td&&Td.dispose();for(var e=0;e<Rd.length;e++)Rd[e].dispose()}},jl.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(jl.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(uu.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new _r,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new rn(r.x,r.y,r.z||0))}return t}}),Object.assign(hu.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Yd.prototype=Object.create(Ql.prototype),Zd.prototype=Object.create(Ql.prototype),Jd.prototype=Object.create(Ql.prototype),Object.assign(Jd.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Xh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Gh.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Dl.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Su.extractUrlBase(e)}}),Dl.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.")}},Object.assign(Pu.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Ph.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Wn.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Br.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Ih.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Wt,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Wt.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Wt.ceilPowerOfTwo(e)}}),Object.assign(Xt.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(dn.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new rn).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),oi.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},en.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(ni.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(vi.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(vi,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),vi.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),vi.getNormal(e,t,n,i)}}),Object.assign(du.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Fc(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Zc(this,e)}}),Object.assign(qt.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(rn.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Kt.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(_r.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(Cn.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Cn.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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.")}}}),Object.assign(pr.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(pr.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},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(fs.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ys.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),ms.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(jl.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Cr.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(pu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Ci.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===Ut},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Ut)}}}),Object.assign(Ci.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Ut:zt),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Zi.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Ci(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Zi.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(Th.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(Xo.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Ut},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(Xo.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Ut:zt),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Bc.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(Mh.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(Ai.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 bi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(ul.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(Rr.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(jo.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(jo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},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(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?St:Tt}}}),Object.defineProperties(Fo.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(Qt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(nh.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new ku).load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),ch.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Nr.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var Kd={merge:function(e,t,n){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};Yt.crossOrigin=void 0,Yt.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Vl;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},Yt.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new kl;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},Yt.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Yt.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Qd={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")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"115"}})),e.ACESFilmicToneMapping=Y,e.AddEquation=g,e.AddOperation=k,e.AdditiveBlending=d,e.AlphaFormat=Me,e.AlwaysDepth=N,e.AlwaysStencilFunc=Bt,e.AmbientLight=Mu,e.AmbientLightProbe=qu,e.AnimationClip=Cl,e.AnimationLoader=Bl,e.AnimationMixer=wh,e.AnimationObjectGroup=_h,e.AnimationUtils=vl,e.ArcCurve=ql,e.ArrayCamera=Go,e.ArrowHelper=ud,e.Audio=nh,e.AudioAnalyser=ch,e.AudioContext=Gu,e.AudioListener=th,e.AudioLoader=ku,e.AxesHelper=hd,e.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new hd(e)},e.BackSide=c,e.BasicDepthPacking=Nt,e.BasicShadowMap=0,e.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ul(e)},e.Bone=xs,e.BooleanKeyframeTrack=Ml,e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new rd(e,t)},e.Box2=Ph,e.Box3=Wn,e.Box3Helper=ad,e.BoxBufferGeometry=wr,e.BoxGeometry=br,e.BoxHelper=rd,e.BufferAttribute=Ci,e.BufferGeometry=Zi,e.BufferGeometryLoader=Lu,e.ByteType=de,e.Cache=Ol,e.Camera=Lr,e.CameraHelper=td,e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},e.CanvasTexture=Ws,e.CatmullRomCurve3=Ql,e.CineonToneMapping=X,e.CircleBufferGeometry=rl,e.CircleGeometry=il,e.ClampToEdgeWrapping=ie,e.Clock=Ju,e.ClosedSplineCurve3=Yd,e.Color=bi,e.ColorKeyframeTrack=El,e.CompressedTexture=js,e.CompressedTextureLoader=zl,e.ConeBufferGeometry=nl,e.ConeGeometry=tl,e.CubeCamera=Nr,e.CubeGeometry=br,e.CubeReflectionMapping=Z,e.CubeRefractionMapping=J,e.CubeTexture=ia,e.CubeTextureLoader=kl,e.CubeUVReflectionMapping=ee,e.CubeUVRefractionMapping=te,e.CubicBezierCurve=nu,e.CubicBezierCurve3=iu,e.CubicInterpolant=xl,e.CullFaceBack=n,e.CullFaceFront=i,e.CullFaceFrontBack=3,e.CullFaceNone=t,e.Curve=jl,e.CurvePath=uu,e.CustomBlending=m,e.CylinderBufferGeometry=el,e.CylinderGeometry=$c,e.Cylindrical=Lh,e.DataTexture=Dr,e.DataTexture2DArray=ra,e.DataTexture3D=aa,e.DataTextureLoader=Ul,e.DecrementStencilOp=7683,e.DecrementWrapStencilOp=34056,e.DefaultLoadingManager=Il,e.DepthFormat=Le,e.DepthStencilFormat=Ce,e.DepthTexture=qs,e.DirectionalLight=wu,e.DirectionalLightHelper=Qh,e.DirectionalLightShadow=bu,e.DiscreteInterpolant=bl,e.DodecahedronBufferGeometry=ac,e.DodecahedronGeometry=rc,e.DoubleSide=l,e.DstAlphaFactor=A,e.DstColorFactor=L,e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Ci(e,t).setUsage(Ut)},e.DynamicCopyUsage=35050,e.DynamicDrawUsage=Ut,e.DynamicReadUsage=35049,e.EdgesGeometry=Qc,e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Is(new Qc(e.geometry),new Ts({color:void 0!==t?t:16777215}))},e.EllipseCurve=Wl,e.EqualDepth=H,e.EqualStencilFunc=514,e.EquirectangularReflectionMapping=K,e.EquirectangularRefractionMapping=Q,e.Euler=mn,e.EventDispatcher=Gt,e.ExtrudeBufferGeometry=Bc,e.ExtrudeGeometry=Fc,e.Face3=Ti,e.Face4=function(e,t,n,i,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Ti(e,t,n,r,a,o)},e.FaceColors=1,e.FileLoader=Fl,e.FlatShading=1,e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Bi(e,t)},e.Float32BufferAttribute=Bi,e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new zi(e,t)},e.Float64BufferAttribute=zi,e.FloatType=ve,e.Fog=qo,e.FogExp2=Wo,e.Font=Bu,e.FontLoader=Uu,e.FrontFaceDirectionCCW=1,e.FrontFaceDirectionCW=0,e.FrontSide=s,e.Frustum=Br,e.GammaEncoding=At,e.Geometry=_r,e.GeometryUtils=Kd,e.GreaterDepth=B,e.GreaterEqualDepth=F,e.GreaterEqualStencilFunc=518,e.GreaterStencilFunc=516,e.GridHelper=Xh,e.Group=ko,e.HalfFloatType=ye,e.HemisphereLight=fu,e.HemisphereLightHelper=qh,e.HemisphereLightProbe=Wu,e.IcosahedronBufferGeometry=ic,e.IcosahedronGeometry=nc,e.ImageBitmapLoader=Hu,e.ImageLoader=Gl,e.ImageUtils=Yt,e.ImmediateRenderObject=Dh,e.IncrementStencilOp=7682,e.IncrementWrapStencilOp=34055,e.InstancedBufferAttribute=Ru,e.InstancedBufferGeometry=Au,e.InstancedInterleavedBuffer=Eh,e.InstancedMesh=Es,e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ii(e,t)},e.Int16BufferAttribute=Ii,e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Hi(e,t)},e.Int32BufferAttribute=Hi,e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Pi(e,t)},e.Int8BufferAttribute=Pi,e.IntType=me,e.InterleavedBuffer=Xo,e.InterleavedBufferAttribute=Jo,e.Interpolant=yl,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.InvertStencilOp=5386,e.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},e.KeepStencilOp=Ft,e.KeyframeTrack=wl,e.LOD=fs,e.LatheBufferGeometry=Yc,e.LatheGeometry=Xc,e.Layers=gn,e.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},e.LessDepth=I,e.LessEqualDepth=D,e.LessEqualStencilFunc=515,e.LessStencilFunc=513,e.Light=pu,e.LightProbe=ju,e.LightShadow=mu,e.Line=Ps,e.Line3=Ih,e.LineBasicMaterial=Ts,e.LineCurve=ru,e.LineCurve3=au,e.LineDashedMaterial=ml,e.LineLoop=Ds,e.LinePieces=1,e.LineSegments=Is,e.LineStrip=0,e.LinearEncoding=Tt,e.LinearFilter=ce,e.LinearInterpolant=_l,e.LinearMipMapLinearFilter=1008,e.LinearMipMapNearestFilter=1007,e.LinearMipmapLinearFilter=ue,e.LinearMipmapNearestFilter=le,e.LinearToneMapping=j,e.Loader=Dl,e.LoaderUtils=Su,e.LoadingManager=Nl,e.LogLuvEncoding=Lt,e.LoopOnce=2200,e.LoopPingPong=2202,e.LoopRepeat=Mt,e.LuminanceAlphaFormat=Ae,e.LuminanceFormat=Se,e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},e.Material=Ai,e.MaterialLoader=Tu,e.Math=Wt,e.MathUtils=Wt,e.Matrix3=Xt,e.Matrix4=dn,e.MaxEquation=_,e.Mesh=pr,e.MeshBasicMaterial=Ri,e.MeshDepthMaterial=No,e.MeshDistanceMaterial=Io,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MeshLambertMaterial=pl,e.MeshMatcapMaterial=fl,e.MeshNormalMaterial=dl,e.MeshPhongMaterial=ul,e.MeshPhysicalMaterial=ll,e.MeshStandardMaterial=cl,e.MeshToonMaterial=hl,e.MinEquation=x,e.MirroredRepeatWrapping=re,e.MixOperation=G,e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e},e.MultiplyBlending=f,e.MultiplyOperation=U,e.NearestFilter=ae,e.NearestMipMapLinearFilter=1005,e.NearestMipMapNearestFilter=1004,e.NearestMipmapLinearFilter=se,e.NearestMipmapNearestFilter=oe,e.NeverDepth=O,e.NeverStencilFunc=512,e.NoBlending=u,e.NoColors=0,e.NoToneMapping=V,e.NormalBlending=h,e.NotEqualDepth=z,e.NotEqualStencilFunc=517,e.NumberKeyframeTrack=Tl,e.Object3D=Cn,e.ObjectLoader=Pu,e.ObjectSpaceNormalMap=Ht,e.OctahedronBufferGeometry=tc,e.OctahedronGeometry=ec,e.OneFactor=w,e.OneMinusDstAlphaFactor=R,e.OneMinusDstColorFactor=C,e.OneMinusSrcAlphaFactor=S,e.OneMinusSrcColorFactor=E,e.OrthographicCamera=_u,e.PCFShadowMap=r,e.PCFSoftShadowMap=a,e.PMREMGenerator=Fd,e.ParametricBufferGeometry=Zs,e.ParametricGeometry=Ys,e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new us(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Hs(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Gs(e,t)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Hs(e)},e.Path=hu,e.PerspectiveCamera=Cr,e.Plane=oi,e.PlaneBufferGeometry=Vr,e.PlaneGeometry=kr,e.PlaneHelper=od,e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Gs(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Hs(e)},e.PointLight=xu,e.PointLightHelper=kh,e.Points=Gs,e.PointsMaterial=Hs,e.PolarGridHelper=Yh,e.PolyhedronBufferGeometry=Ks,e.PolyhedronGeometry=Js,e.PositionalAudio=sh,e.PropertyBinding=xh,e.PropertyMixer=lh,e.QuadraticBezierCurve=ou,e.QuadraticBezierCurve3=su,e.Quaternion=en,e.QuaternionKeyframeTrack=Al,e.QuaternionLinearInterpolant=Sl,e.REVISION="115",e.RGBADepthPacking=It,e.RGBAFormat=Te,e.RGBAIntegerFormat=He,e.RGBA_ASTC_10x10_Format=at,e.RGBA_ASTC_10x5_Format=nt,e.RGBA_ASTC_10x6_Format=it,e.RGBA_ASTC_10x8_Format=rt,e.RGBA_ASTC_12x10_Format=ot,e.RGBA_ASTC_12x12_Format=st,e.RGBA_ASTC_4x4_Format=Ye,e.RGBA_ASTC_5x4_Format=Ze,e.RGBA_ASTC_5x5_Format=Je,e.RGBA_ASTC_6x5_Format=Ke,e.RGBA_ASTC_6x6_Format=Qe,e.RGBA_ASTC_8x5_Format=$e,e.RGBA_ASTC_8x6_Format=et,e.RGBA_ASTC_8x8_Format=tt,e.RGBA_BPTC_Format=ct,e.RGBA_ETC2_EAC_Format=Xe,e.RGBA_PVRTC_2BPPV1_Format=je,e.RGBA_PVRTC_4BPPV1_Format=Ve,e.RGBA_S3TC_DXT1_Format=Be,e.RGBA_S3TC_DXT3_Format=ze,e.RGBA_S3TC_DXT5_Format=Ue,e.RGBDEncoding=Ot,e.RGBEEncoding=Rt,e.RGBEFormat=Re,e.RGBFormat=Ee,e.RGBIntegerFormat=De,e.RGBM16Encoding=Pt,e.RGBM7Encoding=Ct,e.RGB_ETC1_Format=We,e.RGB_ETC2_Format=qe,e.RGB_PVRTC_2BPPV1_Format=ke,e.RGB_PVRTC_4BPPV1_Format=Ge,e.RGB_S3TC_DXT1_Format=Fe,e.RGFormat=Ne,e.RGIntegerFormat=Ie,e.RawShaderMaterial=sl,e.Ray=ni,e.Raycaster=Th,e.RectAreaLight=Eu,e.RedFormat=Pe,e.RedIntegerFormat=Oe,e.ReinhardToneMapping=W,e.RepeatWrapping=ne,e.ReplaceStencilOp=7681,e.ReverseSubtractEquation=y,e.RingBufferGeometry=qc,e.RingGeometry=Wc,e.SRGB8_ALPHA8_ASTC_10x10_Format=_t,e.SRGB8_ALPHA8_ASTC_10x5_Format=vt,e.SRGB8_ALPHA8_ASTC_10x6_Format=yt,e.SRGB8_ALPHA8_ASTC_10x8_Format=xt,e.SRGB8_ALPHA8_ASTC_12x10_Format=bt,e.SRGB8_ALPHA8_ASTC_12x12_Format=wt,e.SRGB8_ALPHA8_ASTC_4x4_Format=lt,e.SRGB8_ALPHA8_ASTC_5x4_Format=ut,e.SRGB8_ALPHA8_ASTC_5x5_Format=ht,e.SRGB8_ALPHA8_ASTC_6x5_Format=dt,e.SRGB8_ALPHA8_ASTC_6x6_Format=pt,e.SRGB8_ALPHA8_ASTC_8x5_Format=ft,e.SRGB8_ALPHA8_ASTC_8x6_Format=mt,e.SRGB8_ALPHA8_ASTC_8x8_Format=gt,e.Scene=Pn,e.SceneUtils=Qd,e.ShaderChunk=jr,e.ShaderLib=Wr,e.ShaderMaterial=Rr,e.ShadowMaterial=ol,e.Shape=du,e.ShapeBufferGeometry=Jc,e.ShapeGeometry=Zc,e.ShapePath=Fu,e.ShapeUtils=Ic,e.ShortType=pe,e.Skeleton=ys,e.SkeletonHelper=Gh,e.SkinnedMesh=ms,e.SmoothShading=2,e.Sphere=Yn,e.SphereBufferGeometry=jc,e.SphereGeometry=Vc,e.Spherical=Rh,e.SphericalHarmonics3=Vu,e.SphericalReflectionMapping=$,e.Spline=Jd,e.SplineCurve=cu,e.SplineCurve3=Zd,e.SpotLight=vu,e.SpotLightHelper=Fh,e.SpotLightShadow=gu,e.Sprite=us,e.SpriteMaterial=Ko,e.SrcAlphaFactor=T,e.SrcAlphaSaturateFactor=P,e.SrcColorFactor=M,e.StaticCopyUsage=35046,e.StaticDrawUsage=zt,e.StaticReadUsage=35045,e.StereoCamera=Zu,e.StreamCopyUsage=35042,e.StreamDrawUsage=35040,e.StreamReadUsage=35041,e.StringKeyframeTrack=Rl,e.SubtractEquation=v,e.SubtractiveBlending=p,e.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},e.TangentSpaceNormalMap=Dt,e.TetrahedronBufferGeometry=$s,e.TetrahedronGeometry=Qs,e.TextBufferGeometry=kc,e.TextGeometry=Gc,e.Texture=Jt,e.TextureLoader=Vl,e.TorusBufferGeometry=hc,e.TorusGeometry=uc,e.TorusKnotBufferGeometry=lc,e.TorusKnotGeometry=cc,e.Triangle=vi,e.TriangleFanDrawMode=2,e.TriangleStripDrawMode=1,e.TrianglesDrawMode=0,e.TubeBufferGeometry=sc,e.TubeGeometry=oc,e.UVMapping=300,e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Di(e,t)},e.Uint16BufferAttribute=Di,e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Fi(e,t)},e.Uint32BufferAttribute=Fi,e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Oi(e,t)},e.Uint8BufferAttribute=Oi,e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Ni(e,t)},e.Uint8ClampedBufferAttribute=Ni,e.Uncharted2ToneMapping=q,e.Uniform=Mh,e.UniformsLib=zr,e.UniformsUtils=Tr,e.UnsignedByteType=he,e.UnsignedInt248Type=we,e.UnsignedIntType=ge,e.UnsignedShort4444Type=xe,e.UnsignedShort5551Type=_e,e.UnsignedShort565Type=be,e.UnsignedShortType=fe,e.VSMShadowMap=o,e.Vector2=qt,e.Vector3=rn,e.Vector4=Kt,e.VectorKeyframeTrack=Ll,e.Vertex=function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new rn(e,t,n)},e.VertexColors=2,e.VideoTexture=Vs,e.WebGLCubeRenderTarget=Ir,e.WebGLMultisampleRenderTarget=$t,e.WebGLRenderTarget=Qt,e.WebGLRenderTargetCube=function(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Ir(e,n)},e.WebGLRenderer=jo,e.WebGLUtils=Uo,e.WireframeGeometry=Xs,e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Is(new Xs(e.geometry),new Ts({color:void 0!==t?t:16777215}))},e.WrapAroundEnding=2402,e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Fl(e)},e.ZeroCurvatureEnding=Et,e.ZeroFactor=b,e.ZeroSlopeEnding=2401,e.ZeroStencilOp=0,e.sRGBEncoding=St,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r((i=i||self).THREE={})},{}],7:[function(e,t,n){THREE.OrbitControls=function(e,t){var n,i,r,a,o;void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new THREE.Vector3,this.minDistance=0,this.maxDistance=Infinity,this.minZoom=0,this.maxZoom=Infinity,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-Infinity,this.maxAzimuthAngle=Infinity,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=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:THREE.MOUSE.ROTATE,MIDDLE:THREE.MOUSE.DOLLY,RIGHT:THREE.MOUSE.PAN},this.touches={ONE:THREE.TOUCH.ROTATE,TWO:THREE.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return f.phi},this.getAzimuthalAngle=function(){return f.theta},this.saveState=function(){s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=function(){s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(c),s.update(),d=h.NONE},this.update=(n=new THREE.Vector3,i=(new THREE.Quaternion).setFromUnitVectors(e.up,new THREE.Vector3(0,1,0)),r=i.clone().inverse(),a=new THREE.Vector3,o=new THREE.Quaternion,function(){var e=s.object.position;return n.copy(e).sub(s.target),n.applyQuaternion(i),f.setFromVector3(n),s.autoRotate&&d===h.NONE&&L(2*Math.PI/60/60*s.autoRotateSpeed),s.enableDamping?(f.theta+=m.theta*s.dampingFactor,f.phi+=m.phi*s.dampingFactor):(f.theta+=m.theta,f.phi+=m.phi),f.theta=Math.max(s.minAzimuthAngle,Math.min(s.maxAzimuthAngle,f.theta)),f.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,f.phi)),f.makeSafe(),f.radius*=g,f.radius=Math.max(s.minDistance,Math.min(s.maxDistance,f.radius)),!0===s.enableDamping?s.target.addScaledVector(v,s.dampingFactor):s.target.add(v),n.setFromSpherical(f),n.applyQuaternion(r),e.copy(s.target).add(n),s.object.lookAt(s.target),!0===s.enableDamping?(m.theta*=1-s.dampingFactor,m.phi*=1-s.dampingFactor,v.multiplyScalar(1-s.dampingFactor)):(m.set(0,0,0),v.set(0,0,0)),g=1,!!(y||a.distanceToSquared(s.object.position)>p||8*(1-o.dot(s.object.quaternion))>p)&&(s.dispatchEvent(c),a.copy(s.object.position),o.copy(s.object.quaternion),y=!1,!0)}),this.dispose=function(){s.domElement.removeEventListener("contextmenu",$,!1),s.domElement.removeEventListener("mousedown",W,!1),s.domElement.removeEventListener("wheel",Y,!1),s.domElement.removeEventListener("touchstart",J,!1),s.domElement.removeEventListener("touchend",Q,!1),s.domElement.removeEventListener("touchmove",K,!1),document.removeEventListener("mousemove",q,!1),document.removeEventListener("mouseup",X,!1),s.domElement.removeEventListener("keydown",Z,!1)};var s=this,c={type:"change"},l={type:"start"},u={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,p=1e-6,f=new THREE.Spherical,m=new THREE.Spherical,g=1,v=new THREE.Vector3,y=!1,x=new THREE.Vector2,_=new THREE.Vector2,b=new THREE.Vector2,w=new THREE.Vector2,M=new THREE.Vector2,E=new THREE.Vector2,T=new THREE.Vector2,S=new THREE.Vector2,A=new THREE.Vector2;function R(){return Math.pow(.95,s.zoomSpeed)}function L(e){m.theta-=e}function C(e){m.phi-=e}var P,O=(P=new THREE.Vector3,function(e,t){P.setFromMatrixColumn(t,0),P.multiplyScalar(-e),v.add(P)}),N=function(){var e=new THREE.Vector3;return function(t,n){!0===s.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(s.object.up,e)),e.multiplyScalar(t),v.add(e)}}(),I=function(){var e=new THREE.Vector3;return function(t,n){var i=s.domElement;if(s.object.isPerspectiveCamera){e.copy(s.object.position).sub(s.target);var r=e.length();r*=Math.tan(s.object.fov/2*Math.PI/180),O(2*t*r/i.clientHeight,s.object.matrix),N(2*n*r/i.clientHeight,s.object.matrix)}else s.object.isOrthographicCamera?(O(t*(s.object.right-s.object.left)/s.object.zoom/i.clientWidth,s.object.matrix),N(n*(s.object.top-s.object.bottom)/s.object.zoom/i.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)}}();function D(e){s.object.isPerspectiveCamera?g/=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom*e)),s.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function H(e){s.object.isPerspectiveCamera?g*=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom/e)),s.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function F(e){x.set(e.clientX,e.clientY)}function B(e){w.set(e.clientX,e.clientY)}function z(e){1==e.touches.length?x.set(e.touches[0].pageX,e.touches[0].pageY):x.set(.5*(e.touches[0].pageX+e.touches[1].pageX),.5*(e.touches[0].pageY+e.touches[1].pageY))}function U(e){1==e.touches.length?w.set(e.touches[0].pageX,e.touches[0].pageY):w.set(.5*(e.touches[0].pageX+e.touches[1].pageX),.5*(e.touches[0].pageY+e.touches[1].pageY))}function G(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);T.set(0,i)}function k(e){1==e.touches.length?_.set(e.touches[0].pageX,e.touches[0].pageY):_.set(.5*(e.touches[0].pageX+e.touches[1].pageX),.5*(e.touches[0].pageY+e.touches[1].pageY));b.subVectors(_,x).multiplyScalar(s.rotateSpeed);var t=s.domElement;L(2*Math.PI*b.x/t.clientHeight),C(2*Math.PI*b.y/t.clientHeight),x.copy(_)}function V(e){1==e.touches.length?M.set(e.touches[0].pageX,e.touches[0].pageY):M.set(.5*(e.touches[0].pageX+e.touches[1].pageX),.5*(e.touches[0].pageY+e.touches[1].pageY));E.subVectors(M,w).multiplyScalar(s.panSpeed),I(E.x,E.y),w.copy(M)}function j(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);S.set(0,i),A.set(0,Math.pow(S.y/T.y,s.zoomSpeed)),D(A.y),T.copy(S)}function W(e){if(!1!==s.enabled){var t;switch(e.preventDefault(),s.domElement.focus?s.domElement.focus():window.focus(),e.button){case 0:t=s.mouseButtons.LEFT;break;case 1:t=s.mouseButtons.MIDDLE;break;case 2:t=s.mouseButtons.RIGHT;break;default:t=-1}switch(t){case THREE.MOUSE.DOLLY:if(!1===s.enableZoom)return;!function(e){T.set(e.clientX,e.clientY)}(e),d=h.DOLLY;break;case THREE.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===s.enablePan)return;B(e),d=h.PAN}else{if(!1===s.enableRotate)return;F(e),d=h.ROTATE}break;case THREE.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===s.enableRotate)return;F(e),d=h.ROTATE}else{if(!1===s.enablePan)return;B(e),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(document.addEventListener("mousemove",q,!1),document.addEventListener("mouseup",X,!1),s.dispatchEvent(l))}}function q(e){if(!1!==s.enabled)switch(e.preventDefault(),d){case h.ROTATE:if(!1===s.enableRotate)return;!function(e){_.set(e.clientX,e.clientY),b.subVectors(_,x).multiplyScalar(s.rotateSpeed);var t=s.domElement;L(2*Math.PI*b.x/t.clientHeight),C(2*Math.PI*b.y/t.clientHeight),x.copy(_),s.update()}(e);break;case h.DOLLY:if(!1===s.enableZoom)return;!function(e){S.set(e.clientX,e.clientY),A.subVectors(S,T),A.y>0?D(R()):A.y<0&&H(R()),T.copy(S),s.update()}(e);break;case h.PAN:if(!1===s.enablePan)return;!function(e){M.set(e.clientX,e.clientY),E.subVectors(M,w).multiplyScalar(s.panSpeed),I(E.x,E.y),w.copy(M),s.update()}(e)}}function X(e){!1!==s.enabled&&(document.removeEventListener("mousemove",q,!1),document.removeEventListener("mouseup",X,!1),s.dispatchEvent(u),d=h.NONE)}function Y(e){!1===s.enabled||!1===s.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),s.dispatchEvent(l),function(e){e.deltaY<0?H(R()):e.deltaY>0&&D(R()),s.update()}(e),s.dispatchEvent(u))}function Z(e){!1!==s.enabled&&!1!==s.enableKeys&&!1!==s.enablePan&&function(e){var t=!1;switch(e.keyCode){case s.keys.UP:I(0,s.keyPanSpeed),t=!0;break;case s.keys.BOTTOM:I(0,-s.keyPanSpeed),t=!0;break;case s.keys.LEFT:I(s.keyPanSpeed,0),t=!0;break;case s.keys.RIGHT:I(-s.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),s.update())}(e)}function J(e){if(!1!==s.enabled){switch(e.preventDefault(),e.touches.length){case 1:switch(s.touches.ONE){case THREE.TOUCH.ROTATE:if(!1===s.enableRotate)return;z(e),d=h.TOUCH_ROTATE;break;case THREE.TOUCH.PAN:if(!1===s.enablePan)return;U(e),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(s.touches.TWO){case THREE.TOUCH.DOLLY_PAN:if(!1===s.enableZoom&&!1===s.enablePan)return;!function(e){s.enableZoom&&G(e),s.enablePan&&U(e)}(e),d=h.TOUCH_DOLLY_PAN;break;case THREE.TOUCH.DOLLY_ROTATE:if(!1===s.enableZoom&&!1===s.enableRotate)return;!function(e){s.enableZoom&&G(e),s.enableRotate&&z(e)}(e),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&s.dispatchEvent(l)}}function K(e){if(!1!==s.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===s.enableRotate)return;k(e),s.update();break;case h.TOUCH_PAN:if(!1===s.enablePan)return;V(e),s.update();break;case h.TOUCH_DOLLY_PAN:if(!1===s.enableZoom&&!1===s.enablePan)return;!function(e){s.enableZoom&&j(e),s.enablePan&&V(e)}(e),s.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===s.enableZoom&&!1===s.enableRotate)return;!function(e){s.enableZoom&&j(e),s.enableRotate&&k(e)}(e),s.update();break;default:d=h.NONE}}function Q(e){!1!==s.enabled&&(s.dispatchEvent(u),d=h.NONE)}function $(e){!1!==s.enabled&&e.preventDefault()}s.domElement.addEventListener("contextmenu",$,!1),s.domElement.addEventListener("mousedown",W,!1),s.domElement.addEventListener("wheel",Y,!1),s.domElement.addEventListener("touchstart",J,!1),s.domElement.addEventListener("touchend",Q,!1),s.domElement.addEventListener("touchmove",K,!1),s.domElement.addEventListener("keydown",Z,!1),-1===s.domElement.tabIndex&&(s.domElement.tabIndex=0),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.OrbitControls.prototype.constructor=THREE.OrbitControls,THREE.MapControls=function(e,t){THREE.OrbitControls.call(this,e,t),this.mouseButtons.LEFT=THREE.MOUSE.PAN,this.mouseButtons.RIGHT=THREE.MOUSE.ROTATE,this.touches.ONE=THREE.TOUCH.PAN,this.touches.TWO=THREE.TOUCH.DOLLY_ROTATE},THREE.MapControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.MapControls.prototype.constructor=THREE.MapControls},{}],8:[function(e,t,n){var i={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},r={};r[THREE.NearestFilter]=i.NEAREST,r[THREE.NearestMipmapNearestFilter]=i.NEAREST_MIPMAP_NEAREST,r[THREE.NearestMipmapLinearFilter]=i.NEAREST_MIPMAP_LINEAR,r[THREE.LinearFilter]=i.LINEAR,r[THREE.LinearMipmapNearestFilter]=i.LINEAR_MIPMAP_NEAREST,r[THREE.LinearMipmapLinearFilter]=i.LINEAR_MIPMAP_LINEAR,r[THREE.ClampToEdgeWrapping]=i.CLAMP_TO_EDGE,r[THREE.RepeatWrapping]=i.REPEAT,r[THREE.MirroredRepeatWrapping]=i.MIRRORED_REPEAT;var a={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"};THREE.GLTFExporter=function(){},THREE.GLTFExporter.prototype={constructor:THREE.GLTFExporter,parse:function(e,t,n){(n=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:Infinity,animations:[],forceIndices:!1,forcePowerOfTwoTextures:!1,includeCustomExtensions:!1},n)).animations.length>0&&(n.trs=!0);var o,s={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},c=0,l=[],u=[],h=new Map,d=[],p={},f={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},m=new Map,g=0;function v(e){return m.has(e)||m.set(e,g++),m.get(e)}function y(e,t){return e.length===t.length&&e.every(function(e,n){return e===t[n]})}function x(e){return 4*Math.ceil(e/4)}function _(e,t){t=t||0;var n=x(e.byteLength);if(n!==e.byteLength){var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==t)for(var r=e.byteLength;r<n;r++)i[r]=t;return i.buffer}return e}function b(e,t){if(0!==Object.keys(e.userData).length)try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var r in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[r]=i.gltfExtensions[r],p[r]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}function w(e,t){var n=!1,i={};0===t.offset.x&&0===t.offset.y||(i.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(i.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,p.KHR_texture_transform=!0)}function M(e){return s.buffers||(s.buffers=[{byteLength:0}]),l.push(e),0}function E(e,t,r,a){var o;if(e.array.constructor===Float32Array)o=i.FLOAT;else if(e.array.constructor===Uint32Array)o=i.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)o=i.UNSIGNED_SHORT;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");o=i.UNSIGNED_BYTE}if(void 0===r&&(r=0),void 0===a&&(a=e.count),n.truncateDrawRange&&void 0!==t&&null===t.index){var l=r+a,u=Infinity===t.drawRange.count?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),(a=Math.min(l,u)-r)<0&&(a=0)}if(0===a)return null;var h,d=function(e,t,n){for(var i={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},r=t;r<t+n;r++)for(var a=0;a<e.itemSize;a++){var o=e.array[r*e.itemSize+a];i.min[a]=Math.min(i.min[a],o),i.max[a]=Math.max(i.max[a],o)}return i}(e,r,a);void 0!==t&&(h=e===t.index?i.ELEMENT_ARRAY_BUFFER:i.ARRAY_BUFFER);var p=function(e,t,n,r,a){var o;s.bufferViews||(s.bufferViews=[]);for(var l=x(r*e.itemSize*(o=t===i.UNSIGNED_BYTE?1:t===i.UNSIGNED_SHORT?2:4)),u=new DataView(new ArrayBuffer(l)),h=0,d=n;d<n+r;d++)for(var p=0;p<e.itemSize;p++){var f=e.array[d*e.itemSize+p];t===i.FLOAT?u.setFloat32(h,f,!0):t===i.UNSIGNED_INT?u.setUint32(h,f,!0):t===i.UNSIGNED_SHORT?u.setUint16(h,f,!0):t===i.UNSIGNED_BYTE&&u.setUint8(h,f),h+=o}var m={buffer:M(u.buffer),byteOffset:c,byteLength:l};return void 0!==a&&(m.target=a),a===i.ARRAY_BUFFER&&(m.byteStride=e.itemSize*o),c+=l,s.bufferViews.push(m),{id:s.bufferViews.length-1,byteLength:0}}(e,o,r,a,h),f={bufferView:p.id,byteOffset:p.byteOffset,componentType:o,count:a,max:d.max,min:d.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]};return s.accessors||(s.accessors=[]),s.accessors.push(f),s.accessors.length-1}function T(e,t,i){f.images.has(e)||f.images.set(e,{});var r=f.images.get(e),a=t===THREE.RGBAFormat?"image/png":"image/jpeg",l=a+":flipY/"+i.toString();if(void 0!==r[l])return r[l];s.images||(s.images=[]);var h={mimeType:a};if(n.embedImages){var d=o=o||document.createElement("canvas");d.width=Math.min(e.width,n.maxTextureSize),d.height=Math.min(e.height,n.maxTextureSize),n.forcePowerOfTwoTextures&&!function(e){return THREE.MathUtils.isPowerOfTwo(e.width)&&THREE.MathUtils.isPowerOfTwo(e.height)}(d)&&(console.warn("GLTFExporter: Resized non-power-of-two image.",e),d.width=THREE.MathUtils.floorPowerOfTwo(d.width),d.height=THREE.MathUtils.floorPowerOfTwo(d.height));var p=d.getContext("2d");!0===i&&(p.translate(0,d.height),p.scale(1,-1)),p.drawImage(e,0,0,d.width,d.height),!0===n.binary?u.push(new Promise(function(e){d.toBlob(function(t){(function(e){return s.bufferViews||(s.bufferViews=[]),new Promise(function(t){var n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){var e=_(n.result),i={buffer:M(e),byteOffset:c,byteLength:e.byteLength};c+=e.byteLength,s.bufferViews.push(i),t(s.bufferViews.length-1)}})})(t).then(function(t){h.bufferView=t,e()})},a)})):h.uri=d.toDataURL(a)}else h.uri=e.src;s.images.push(h);var m=s.images.length-1;return r[l]=m,m}function S(e){return s.samplers||(s.samplers=[]),s.samplers.push({magFilter:r[e.magFilter],minFilter:r[e.minFilter],wrapS:r[e.wrapS],wrapT:r[e.wrapT]}),s.samplers.length-1}function A(e){if(f.textures.has(e))return f.textures.get(e);s.textures||(s.textures=[]);var t={sampler:S(e),source:T(e.image,e.format,e.flipY)};e.name&&(t.name=e.name),s.textures.push(t);var n=s.textures.length-1;return f.textures.set(e,n),n}function R(e){if(f.materials.has(e))return f.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);var t={pbrMetallicRoughness:{}};e.isMeshBasicMaterial?(t.extensions={KHR_materials_unlit:{}},p.KHR_materials_unlit=!0):e.isGLTFSpecularGlossinessMaterial?(t.extensions={KHR_materials_pbrSpecularGlossiness:{}},p.KHR_materials_pbrSpecularGlossiness=!0):e.isMeshStandardMaterial||console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var n=e.color.toArray().concat([e.opacity]);if(y(n,[1,1,1,1])||(t.pbrMetallicRoughness.baseColorFactor=n),e.isMeshStandardMaterial?(t.pbrMetallicRoughness.metallicFactor=e.metalness,t.pbrMetallicRoughness.roughnessFactor=e.roughness):e.isMeshBasicMaterial?(t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9):(t.pbrMetallicRoughness.metallicFactor=.5,t.pbrMetallicRoughness.roughnessFactor=.5),e.isGLTFSpecularGlossinessMaterial){t.pbrMetallicRoughness.baseColorFactor&&(t.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);var i=[1,1,1];e.specular.toArray(i,0),t.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor=i,t.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor=e.glossiness}if(e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){var r={index:A(e.metalnessMap)};w(r,e.metalnessMap),t.pbrMetallicRoughness.metallicRoughnessTexture=r}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){var a={index:A(e.map)};w(a,e.map),e.isGLTFSpecularGlossinessMaterial&&(t.extensions.KHR_materials_pbrSpecularGlossiness.diffuseTexture=a),t.pbrMetallicRoughness.baseColorTexture=a}if(e.isGLTFSpecularGlossinessMaterial&&e.specularMap){var o={index:A(e.specularMap)};w(o,e.specularMap),t.extensions.KHR_materials_pbrSpecularGlossiness.specularGlossinessTexture=o}if(e.emissive){var c=e.emissive.clone().multiplyScalar(e.emissiveIntensity).toArray();if(y(c,[0,0,0])||(t.emissiveFactor=c),e.emissiveMap){var l={index:A(e.emissiveMap)};w(l,e.emissiveMap),t.emissiveTexture=l}}if(e.normalMap){var u={index:A(e.normalMap)};e.normalScale&&-1!==e.normalScale.x&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),u.scale=e.normalScale.x),w(u,e.normalMap),t.normalTexture=u}if(e.aoMap){var h={index:A(e.aoMap),texCoord:1};1!==e.aoMapIntensity&&(h.strength=e.aoMapIntensity),w(h,e.aoMap),t.occlusionTexture=h}e.transparent?t.alphaMode="BLEND":e.alphaTest>0&&(t.alphaMode="MASK",t.alphaCutoff=e.alphaTest),e.side===THREE.DoubleSide&&(t.doubleSided=!0),""!==e.name&&(t.name=e.name),b(e,t),s.materials.push(t);var d=s.materials.length-1;return f.materials.set(e,d),d}function L(e){var t=[e.geometry.uuid];if(Array.isArray(e.material))for(var r=0,a=e.material.length;r<a;r++)t.push(e.material[r].uuid);else t.push(e.material.uuid);var o=t.join(":");if(f.meshes.has(o))return f.meshes.get(o);var c,l=e.geometry;c=e.isLineSegments?i.LINES:e.isLineLoop?i.LINE_LOOP:e.isLine?i.LINE_STRIP:e.isPoints?i.POINTS:e.material.wireframe?i.LINES:i.TRIANGLES,l.isBufferGeometry||(console.warn("GLTFExporter: Exporting THREE.Geometry will increase file size. Use THREE.BufferGeometry instead."),l=(new THREE.BufferGeometry).setFromObject(e));var u={},h={},d=[],p=[],m={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=l.getAttribute("normal");void 0===g||function(e){if(f.attributesNormalized.has(e))return!1;for(var t=new THREE.Vector3,n=0,i=e.count;n<i;n++)if(Math.abs(t.fromArray(e.array,3*n).length()-1)>5e-4)return!1;return!0}(g)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",function(e){if(f.attributesNormalized.has(e))return f.attributesNormalized.get(e);for(var t=e.clone(),n=new THREE.Vector3,i=0,r=t.count;i<r;i++)n.fromArray(t.array,3*i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),n.toArray(t.array,3*i);return f.attributesNormalized.set(e,t),t}(g)));var y=null;for(var x in l.attributes)if("morph"!==x.substr(0,5)){var _=l.attributes[x];x=m[x]||x.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(x)||(x="_"+x),f.attributes.has(v(_)))h[x]=f.attributes.get(v(_));else{y=null;var w=_.array;"JOINTS_0"!==x||w instanceof Uint16Array||w instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new THREE.BufferAttribute(new Uint16Array(w),_.itemSize,_.normalized));var M=E(y||_,l);null!==M&&(h[x]=M,f.attributes.set(v(_),M))}}if(void 0!==g&&l.setAttribute("normal",g),0===Object.keys(h).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){var T=[],S=[],A={};if(void 0!==e.morphTargetDictionary)for(var L in e.morphTargetDictionary)A[e.morphTargetDictionary[L]]=L;for(r=0;r<e.morphTargetInfluences.length;++r){var C={},P=!1;for(var x in l.morphAttributes)if("position"===x||"normal"===x){_=l.morphAttributes[x][r];var O=x.toUpperCase(),N=l.attributes[x];if(f.attributes.has(v(_)))C[O]=f.attributes.get(v(_));else{var I=_.clone();if(!l.morphTargetsRelative)for(var D=0,H=_.count;D<H;D++)I.setXYZ(D,_.getX(D)-N.getX(D),_.getY(D)-N.getY(D),_.getZ(D)-N.getZ(D));C[O]=E(I,l),f.attributes.set(v(N),C[O])}}else P||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),P=!0);p.push(C),T.push(e.morphTargetInfluences[r]),void 0!==e.morphTargetDictionary&&S.push(A[r])}u.weights=T,S.length>0&&(u.extras={},u.extras.targetNames=S)}var F=n.forceIndices,B=Array.isArray(e.material);if(B&&0===l.groups.length)return null;!F&&null===l.index&&B&&(console.warn("THREE.GLTFExporter: Creating index for non-indexed multi-material mesh."),F=!0);var z=!1;if(null===l.index&&F){for(var U=[],G=(r=0,l.attributes.position.count);r<G;r++)U[r]=r;l.setIndex(U),z=!0}var k=B?e.material:[e.material],V=B?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(r=0,G=V.length;r<G;r++){var j={mode:c,attributes:h};if(b(l,j),p.length>0&&(j.targets=p),null!==l.index){var W=v(l.index);void 0===V[r].start&&void 0===V[r].count||(W+=":"+V[r].start+":"+V[r].count),f.attributes.has(W)?j.indices=f.attributes.get(W):(j.indices=E(l.index,l,V[r].start,V[r].count),f.attributes.set(W,j.indices)),null===j.indices&&delete j.indices}var q=R(k[V[r].materialIndex]);null!==q&&(j.material=q),d.push(j)}z&&l.setIndex(null),u.primitives=d,s.meshes||(s.meshes=[]),s.meshes.push(u);var X=s.meshes.length-1;return f.meshes.set(o,X),X}function C(e,t){s.animations||(s.animations=[]);for(var n=(e=THREE.GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,i=[],r=[],o=0;o<n.length;++o){var c=n[o],l=THREE.PropertyBinding.parseTrackName(c.name),u=THREE.PropertyBinding.findNode(t,l.nodeName),d=a[l.propertyName];if("bones"===l.objectName&&(u=!0===u.isSkinnedMesh?u.skeleton.getBoneByName(l.objectIndex):void 0),!u||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;var p,f=c.values.length/c.times.length;d===a.morphTargetInfluences&&(f/=u.morphTargetInfluences.length),!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",f/=3):p=c.getInterpolation()===THREE.InterpolateDiscrete?"STEP":"LINEAR",r.push({input:E(new THREE.BufferAttribute(c.times,1)),output:E(new THREE.BufferAttribute(c.values,f)),interpolation:p}),i.push({sampler:r.length-1,target:{node:h.get(u),path:d}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:r,channels:i}),s.animations.length-1}function P(e){var t=s.nodes[h.get(e)],n=e.skeleton;if(void 0===n)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var r=[],a=new Float32Array(16*n.bones.length),o=0;o<n.bones.length;++o)r.push(h.get(n.bones[o])),n.boneInverses[o].toArray(a,16*o);return void 0===s.skins&&(s.skins=[]),s.skins.push({inverseBindMatrices:E(new THREE.BufferAttribute(a,16)),joints:r,skeleton:h.get(i)}),t.skin=s.skins.length-1}function O(e){var t={};e.name&&(t.name=e.name),t.color=e.color.toArray(),t.intensity=e.intensity,e.isDirectionalLight?t.type="directional":e.isPointLight?(t.type="point",e.distance>0&&(t.range=e.distance)):e.isSpotLight&&(t.type="spot",e.distance>0&&(t.range=e.distance),t.spot={},t.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,t.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1.");var n=s.extensions.KHR_lights_punctual.lights;return n.push(t),n.length-1}function N(e){s.nodes||(s.nodes=[]);var t={};if(n.trs){var i=e.quaternion.toArray(),r=e.position.toArray(),a=e.scale.toArray();y(i,[0,0,0,1])||(t.rotation=i),y(r,[0,0,0])||(t.translation=r),y(a,[1,1,1])||(t.scale=a)}else e.matrixAutoUpdate&&e.updateMatrix(),y(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])||(t.matrix=e.matrix.elements);if(""!==e.name&&(t.name=String(e.name)),b(e,t),e.isMesh||e.isLine||e.isPoints){var o=L(e);null!==o&&(t.mesh=o)}else if(e.isCamera)t.camera=function(e){s.cameras||(s.cameras=[]);var t=e.isOrthographicCamera,n={type:t?"orthographic":"perspective"};return t?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:THREE.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),s.cameras.push(n),s.cameras.length-1}(e);else if(e.isDirectionalLight||e.isPointLight||e.isSpotLight)p.KHR_lights_punctual||(s.extensions=s.extensions||{},s.extensions.KHR_lights_punctual={lights:[]},p.KHR_lights_punctual=!0),t.extensions=t.extensions||{},t.extensions.KHR_lights_punctual={light:O(e)};else if(e.isLight)return console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e),null;if(e.isSkinnedMesh&&d.push(e),e.children.length>0){for(var c=[],l=0,u=e.children.length;l<u;l++){var f=e.children[l];if(f.visible||!1===n.onlyVisible){var m=N(f);null!==m&&c.push(m)}}c.length>0&&(t.children=c)}s.nodes.push(t);var g=s.nodes.length-1;return h.set(e,g),g}function I(e){s.scenes||(s.scenes=[],s.scene=0);var t={};""!==e.name&&(t.name=e.name),s.scenes.push(t);for(var i=[],r=0,a=e.children.length;r<a;r++){var o=e.children[r];if(o.visible||!1===n.onlyVisible){var c=N(o);null!==c&&i.push(c)}}i.length>0&&(t.nodes=i),b(e,t)}!function(e){e=e instanceof Array?e:[e];for(var t=[],i=0;i<e.length;i++)e[i]instanceof THREE.Scene?I(e[i]):t.push(e[i]);for(t.length>0&&function(e){var t=new THREE.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);I(t)}(t),i=0;i<d.length;++i)P(d[i]);for(i=0;i<n.animations.length;++i)C(n.animations[i],e[0])}(e),Promise.all(u).then(function(){var e=new Blob(l,{type:"application/octet-stream"}),i=Object.keys(p);if(i.length>0&&(s.extensionsUsed=i),s.buffers&&s.buffers.length>0&&(s.buffers[0].byteLength=e.size),!0===n.binary){(r=new window.FileReader).readAsArrayBuffer(e),r.onloadend=function(){var e=_(r.result),n=new DataView(new ArrayBuffer(8));n.setUint32(0,e.byteLength,!0),n.setUint32(4,5130562,!0);var i=_(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0,i=e.length;n<i;n++){var r=e.charCodeAt(n);t[n]=r>255?32:r}return t.buffer}(JSON.stringify(s)),32),a=new DataView(new ArrayBuffer(8));a.setUint32(0,i.byteLength,!0),a.setUint32(4,1313821514,!0);var o=new ArrayBuffer(12),c=new DataView(o);c.setUint32(0,1179937895,!0),c.setUint32(4,2,!0),c.setUint32(8,12+a.byteLength+i.byteLength+n.byteLength+e.byteLength,!0);var l=new Blob([o,a,i,n,e],{type:"application/octet-stream"}),u=new window.FileReader;u.readAsArrayBuffer(l),u.onloadend=function(){t(u.result)}}}else{var r;if(s.buffers&&s.buffers.length>0)(r=new window.FileReader).readAsDataURL(e),r.onloadend=function(){s.buffers[0].uri=r.result,t(s)};else t(s)}})}},THREE.GLTFExporter.Utils={insertKeyframe:function(e,t){var n,i=e.getValueSize(),r=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+i),o=e.createInterpolant(new e.ValueBufferType(i));if(0===e.times.length){r[0]=t;for(var s=0;s<i;s++)a[s]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;r[0]=t,r.set(e.times,1),a.set(o.evaluate(t),0),a.set(e.values,i),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;r[r.length-1]=t,r.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),n=r.length-1}else for(s=0;s<e.times.length;s++){if(Math.abs(e.times[s]-t)<.001)return s;if(e.times[s]<t&&e.times[s+1]>t){r.set(e.times.slice(0,s+1),0),r[s+1]=t,r.set(e.times.slice(s+1),s+2),a.set(e.values.slice(0,(s+1)*i),0),a.set(o.evaluate(t),(s+1)*i),a.set(e.values.slice((s+1)*i),(s+2)*i),n=s+1;break}}return e.times=r,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},r=e.tracks,a=0;a<r.length;++a){var o=r[a],s=THREE.PropertyBinding.parseTrackName(o.name),c=THREE.PropertyBinding.findNode(t,s.nodeName);if("morphTargetInfluences"===s.propertyName&&void 0!==s.propertyIndex){if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(THREE.InterpolateLinear)}var l,u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[s.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+s.propertyIndex);if(void 0!==i[c.uuid]){var d=o.createInterpolant(new o.ValueBufferType(1));l=i[c.uuid];for(m=0;m<l.times.length;m++)l.values[m*u+h]=d.evaluate(l.times[m]);for(m=0;m<o.times.length;m++){var p=this.insertKeyframe(l,o.times[m]);l.values[p*u+h]=o.values[m]}}else{for(var f=new((l=o.clone()).ValueBufferType)(u*l.times.length),m=0;m<l.times.length;m++)f[m*u+h]=l.values[m];l.name=".morphTargetInfluences",l.values=f,i[c.uuid]=l,n.push(l)}}else n.push(o)}return e.tracks=n,e}}},{}],9:[function(e,t,n){THREE.OBJExporter=function(){},THREE.OBJExporter.prototype={constructor:THREE.OBJExporter,parse:function(e){var t,n,i,r,a,o="",s=0,c=0,l=0,u=new THREE.Vector3,h=new THREE.Vector3,d=new THREE.Vector2,p=[];return e.traverse(function(e){e instanceof THREE.Mesh&&function(e){var i=0,f=0,m=0,g=e.geometry,v=new THREE.Matrix3;if(g instanceof THREE.Geometry&&(g=(new THREE.BufferGeometry).setFromObject(e)),g instanceof THREE.BufferGeometry){var y=g.getAttribute("position"),x=g.getAttribute("normal"),_=g.getAttribute("uv"),b=g.getIndex();if(o+="o "+e.name+"\n",e.material&&e.material.name&&(o+="usemtl "+e.material.name+"\n"),void 0!==y)for(t=0,r=y.count;t<r;t++,i++)u.x=y.getX(t),u.y=y.getY(t),u.z=y.getZ(t),u.applyMatrix4(e.matrixWorld),o+="v "+u.x+" "+u.y+" "+u.z+"\n";if(void 0!==_)for(t=0,r=_.count;t<r;t++,m++)d.x=_.getX(t),d.y=_.getY(t),o+="vt "+d.x+" "+d.y+"\n";if(void 0!==x)for(v.getNormalMatrix(e.matrixWorld),t=0,r=x.count;t<r;t++,f++)h.x=x.getX(t),h.y=x.getY(t),h.z=x.getZ(t),h.applyMatrix3(v).normalize(),o+="vn "+h.x+" "+h.y+" "+h.z+"\n";if(null!==b)for(t=0,r=b.count;t<r;t+=3){for(a=0;a<3;a++)n=b.getX(t+a)+1,p[a]=s+n+(x||_?"/"+(_?c+n:"")+(x?"/"+(l+n):""):"");o+="f "+p.join(" ")+"\n"}else for(t=0,r=y.count;t<r;t+=3){for(a=0;a<3;a++)p[a]=s+(n=t+a+1)+(x||_?"/"+(_?c+n:"")+(x?"/"+(l+n):""):"");o+="f "+p.join(" ")+"\n"}}else console.warn("THREE.OBJExporter.parseMesh(): geometry type unsupported",g);s+=i,c+=m,l+=f}(e),e instanceof THREE.Line&&function(e){var a=0,c=e.geometry,l=e.type;if(c instanceof THREE.Geometry&&(c=(new THREE.BufferGeometry).setFromObject(e)),c instanceof THREE.BufferGeometry){var h=c.getAttribute("position");if(o+="o "+e.name+"\n",void 0!==h)for(t=0,r=h.count;t<r;t++,a++)u.x=h.getX(t),u.y=h.getY(t),u.z=h.getZ(t),u.applyMatrix4(e.matrixWorld),o+="v "+u.x+" "+u.y+" "+u.z+"\n";if("Line"===l){for(o+="l ",n=1,r=h.count;n<=r;n++)o+=s+n+" ";o+="\n"}if("LineSegments"===l)for(i=1+(n=1),r=h.count;n<r;i=(n+=2)+1)o+="l "+(s+n)+" "+(s+i)+"\n"}else console.warn("THREE.OBJExporter.parseLine(): geometry type unsupported",c);s+=a}(e)}),o}}},{}],10:[function(e,t,n){THREE.BufferGeometryUtils={computeTangents:function(e){var t=e.index,n=e.attributes;if(null!==t&&void 0!==n.position&&void 0!==n.normal&&void 0!==n.uv){var i=t.array,r=n.position.array,a=n.normal.array,o=n.uv.array,s=r.length/3;void 0===n.tangent&&e.setAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*s),4));for(var c=n.tangent.array,l=[],u=[],h=0;h<s;h++)l[h]=new THREE.Vector3,u[h]=new THREE.Vector3;var d=new THREE.Vector3,p=new THREE.Vector3,f=new THREE.Vector3,m=new THREE.Vector2,g=new THREE.Vector2,v=new THREE.Vector2,y=new THREE.Vector3,x=new THREE.Vector3,_=e.groups;0===_.length&&(_=[{start:0,count:i.length}]);h=0;for(var b=_.length;h<b;++h)for(var w=O=(P=_[h]).start,M=O+P.count;w<M;w+=3)N(i[w+0],i[w+1],i[w+2]);var E,T,S,A=new THREE.Vector3,R=new THREE.Vector3,L=new THREE.Vector3,C=new THREE.Vector3;for(h=0,b=_.length;h<b;++h){var P,O;for(w=O=(P=_[h]).start,M=O+P.count;w<M;w+=3)I(i[w+0]),I(i[w+1]),I(i[w+2])}}else console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");function N(e,t,n){d.fromArray(r,3*e),p.fromArray(r,3*t),f.fromArray(r,3*n),m.fromArray(o,2*e),g.fromArray(o,2*t),v.fromArray(o,2*n),p.sub(d),f.sub(d),g.sub(m),v.sub(m);var i=1/(g.x*v.y-v.x*g.y);isFinite(i)&&(y.copy(p).multiplyScalar(v.y).addScaledVector(f,-g.y).multiplyScalar(i),x.copy(f).multiplyScalar(g.x).addScaledVector(p,-v.x).multiplyScalar(i),l[e].add(y),l[t].add(y),l[n].add(y),u[e].add(x),u[t].add(x),u[n].add(x))}function I(e){L.fromArray(a,3*e),C.copy(L),A.copy(T=l[e]),A.sub(L.multiplyScalar(L.dot(T))).normalize(),R.crossVectors(C,T),S=R.dot(u[e]),E=S<0?-1:1,c[4*e]=A.x,c[4*e+1]=A.y,c[4*e+2]=A.z,c[4*e+3]=E}},mergeBufferGeometries:function(e,t){for(var n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,c=new THREE.BufferGeometry,l=0,u=0;u<e.length;++u){var h=e[u];if(n!==(null!==h.index))return null;for(var d in h.attributes){if(!i.has(d))return null;void 0===a[d]&&(a[d]=[]),a[d].push(h.attributes[d])}if(s!==h.morphTargetsRelative)return null;for(var d in h.morphAttributes){if(!r.has(d))return null;void 0===o[d]&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(h.userData),t){var p;if(n)p=h.index.count;else{if(void 0===h.attributes.position)return null;p=h.attributes.position.count}c.addGroup(l,p,u),l+=p}}if(n){var f=0,m=[];for(u=0;u<e.length;++u){for(var g=e[u].index,v=0;v<g.count;++v)m.push(g.getX(v)+f);f+=e[u].attributes.position.count}c.setIndex(m)}for(var d in a){var y=this.mergeBufferAttributes(a[d]);if(!y)return null;c.setAttribute(d,y)}for(var d in o){var x=o[d][0].length;if(0===x)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[d]=[];for(u=0;u<x;++u){var _=[];for(v=0;v<o[d].length;++v)_.push(o[d][v][u]);var b=this.mergeBufferAttributes(_);if(!b)return null;c.morphAttributes[d].push(b)}}return c},mergeBufferAttributes:function(e){for(var t,n,i,r=0,a=0;a<e.length;++a){var o=e[a];if(o.isInterleavedBufferAttribute)return null;if(void 0===t&&(t=o.array.constructor),t!==o.array.constructor)return null;if(void 0===n&&(n=o.itemSize),n!==o.itemSize)return null;if(void 0===i&&(i=o.normalized),i!==o.normalized)return null;r+=o.array.length}var s=new t(r),c=0;for(a=0;a<e.length;++a)s.set(e[a].array,c),c+=e[a].array.length;return new THREE.BufferAttribute(s,n,i)},interleaveAttributes:function(e){for(var t,n=0,i=0,r=0,a=e.length;r<a;++r){var o=e[r];if(void 0===t&&(t=o.array.constructor),t!==o.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;n+=o.array.length,i+=o.itemSize}var s=new THREE.InterleavedBuffer(new t(n),i),c=0,l=[],u=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"],d=0;for(a=e.length;d<a;d++){var p=(o=e[d]).itemSize,f=o.count,m=new THREE.InterleavedBufferAttribute(s,p,c,o.normalized);l.push(m),c+=p;for(var g=0;g<f;g++)for(var v=0;v<p;v++)m[h[v]](g,o[u[v]](g))}return l},estimateBytesUsed:function(e){var t=0;for(var n in e.attributes){var i=e.getAttribute(n);t+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}var r=e.getIndex();return t+=r?r.count*r.itemSize*r.array.BYTES_PER_ELEMENT:0},mergeVertices:function(e,t=1e-4){t=Math.max(t,Number.EPSILON);for(var n={},i=e.getIndex(),r=e.getAttribute("position"),a=i?i.count:r.count,o=0,s=Object.keys(e.attributes),c={},l={},u=[],h=["getX","getY","getZ","getW"],d=0,p=s.length;d<p;d++){c[L=s[d]]=[],(w=e.morphAttributes[L])&&(l[L]=new Array(w.length).fill().map(()=>[]))}var f=Math.log10(1/t),m=Math.pow(10,f);for(d=0;d<a;d++){var g=i?i.getX(d):d,v="",y=0;for(p=s.length;y<p;y++)for(var x=(b=e.getAttribute(L=s[y])).itemSize,_=0;_<x;_++)v+=`${~~(b[h[_]](g)*m)},`;if(v in n)u.push(n[v]);else{for(y=0,p=s.length;y<p;y++){var b=e.getAttribute(L=s[y]),w=e.morphAttributes[L],M=(x=b.itemSize,c[L]),E=l[L];for(_=0;_<x;_++){var T=h[_];if(M.push(b[T](g)),w)for(var S=0,A=w.length;S<A;S++)E[S].push(w[S][T](g))}}n[v]=o,u.push(o),o++}}const R=e.clone();for(d=0,p=s.length;d<p;d++){var L,C=e.getAttribute(L=s[d]),P=new C.array.constructor(c[L]);b=new THREE.BufferAttribute(P,C.itemSize,C.normalized);if(R.setAttribute(L,b),L in l)for(y=0;y<l[L].length;y++){var O=e.morphAttributes[L][y],N=(P=new O.array.constructor(l[L][y]),new THREE.BufferAttribute(P,O.itemSize,O.normalized));R.morphAttributes[L][y]=N}}return R.setIndex(u),R},toTrianglesDrawMode:function(e,t){if(t===THREE.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===THREE.TriangleFanDrawMode||t===THREE.TriangleStripDrawMode){var n=e.getIndex();if(null===n){var i=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<r.count;a++)i.push(a);e.setIndex(i),n=e.getIndex()}var o=n.count-2,s=[];if(t===THREE.TriangleFanDrawMode)for(a=1;a<=o;a++)s.push(n.getX(0)),s.push(n.getX(a)),s.push(n.getX(a+1));else for(a=0;a<o;a++)a%2==0?(s.push(n.getX(a)),s.push(n.getX(a+1)),s.push(n.getX(a+2))):(s.push(n.getX(a+2)),s.push(n.getX(a+1)),s.push(n.getX(a)));s.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(s),c.clearGroups(),c}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}}},{}],11:[function(e,t,n){(function(e){e.CANVAS_SKETCH_DEFAULT_STORAGE_KEY=window.location.href}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1,11]);</script>